text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I'm currently beginning to program with Java. I tried to code the sequence in the title as an output in Java, but I'm stuck! I'm experimenting with the for function, any help is welcomed ;)
```
System.out.println("1 0 1 0 0 1 0 0 0 1 0 0 0 0 1 0 0 0 0 0");
```
But seriously, folks, this is an untested first pass:
``... | [
0.1629292517900467,
0.30780261754989624,
0.4152470529079437,
-0.43823498487472534,
0.0788978785276413,
-0.012029954232275486,
0.3898753821849823,
-0.19424250721931458,
-0.025434568524360657,
-0.7563270926475525,
-0.1992952674627304,
0.4110119640827179,
-0.2169434130191803,
0.14265994727611... | |
Google is your friend. For example, try googling for "for loop java" and you'll get a lot of good examples. Also, to learn basic things in any language, a google search for "<language> hello world" is very reliable. | [
-0.07241299003362656,
0.12237358838319778,
0.04429320991039276,
0.27888503670692444,
-0.070845827460289,
-0.3500319719314575,
0.5594223737716675,
0.45562058687210083,
-0.1453409343957901,
-0.7760430574417114,
-0.05342382192611694,
0.651343584060669,
-0.07261272519826889,
0.0290864668786525... | |
The two WWW-Authenticate additions Microsoft makes use of that I am currently aware of are
* NTLM
* Negotiate
If Negotiate is sent down from the server, based on a set of conditions Kerberos will be used
* Intranet Zone
* Accessing the server using a Hostname rather then IP
* Integrated Windows Authentication in IE ... | [
0.24607960879802704,
-0.0010739463614299893,
0.7964895367622375,
0.24210132658481598,
-0.027218570932745934,
-0.3331213593482971,
0.4083820581436157,
-0.45713675022125244,
-0.030590316280722618,
-0.8787959218025208,
0.13229787349700928,
0.4285939037799835,
-0.13607828319072723,
0.266033560... | |
there some way for the server to indicate that NTLM should not be sent? I currently handle this by keeping track of the request in the session, and if a NTLM message is received, it disables Kerberos and WWW-Authenticate for the rest of that sessions life.
The initial `WWW-Authenticate` header only specifies `negotiate... | [
0.2144543081521988,
0.21512429416179657,
0.6456358432769775,
0.11294148117303848,
-0.03781359642744064,
-0.3852083384990692,
0.6518934965133667,
-0.3297760486602783,
-0.0840003564953804,
-0.7135657072067261,
-0.062264081090688705,
0.6280901432037354,
-0.10510987043380737,
0.407686024904251... | |
suspect that will only get you `"unauthorized"`, because it was falling back to NTLM in the first place. | [
0.4926133155822754,
0.2196614295244217,
0.525455117225647,
-0.06797987222671509,
0.2999272346496582,
-0.6441280841827393,
0.10857394337654114,
-0.26246076822280884,
-0.3999614119529724,
-0.185260608792305,
0.09115616977214813,
0.4554397761821747,
0.03386737406253815,
0.27566027641296387,
... | |
I am building an iframe that will go into my clients' web pages. I need to figure out if the user's browser supports javascript and serve back the either the javascript or non-javascript version of the page accordingly.
What's the best way to determine javascript support in this case? I thought about using javascript... | [
0.6164113283157349,
0.10103444010019302,
0.3724038600921631,
-0.030714597553014755,
-0.06826065480709076,
0.11599702388048172,
0.16069650650024414,
-0.027030745521187782,
-0.13964320719242096,
-0.695597767829895,
0.15981020033359528,
0.2309030145406723,
-0.34777605533599854,
0.122199013829... | |
is there a better way to determine javascript support?
Why wouldn't you opt for the <`noscript`> tag?
```
<script>
document.write('<iframe src="javascript_enabled_page.html"></iframe>');
</script>
<noscript>
<iframe src="javascript_disabled_page.html"></iframe>;
</noscript>
``` | [
0.09497745335102081,
0.18705473840236664,
0.3078988194465637,
-0.0555524006485939,
0.027013171464204788,
0.19367173314094543,
0.21602369844913483,
-0.3207264244556427,
-0.290129691362381,
-0.43811434507369995,
-0.26891404390335083,
0.37399983406066895,
-0.27702876925468445,
-0.263424456119... | |
I am having problems with my image spacing when I switched to XHTML Strict DOCTYPE.
The following code - which uses Yahoo's reset stylesheet to kill off all default browser padding - leaves a gap of about 4 pixels between the two images below but ONLY when I use the strict doctype. Why is this?
It is only a problem i... | [
-0.03368983790278435,
-0.08655723929405212,
0.6862223148345947,
0.022458422929048538,
-0.19776582717895508,
0.12933281064033508,
0.40298256278038025,
-0.6223341226577759,
-0.1793714314699173,
-0.3053461015224457,
-0.3309877812862396,
0.07673867791891098,
-0.17982077598571777,
-0.1543651223... | |
start the following fixes the problem:
```
img { vertical-align: bottom }
```
The reason this works is that the default for `vertical-align` is `baseline`, which equates to the part of the text "above the line" where the dangly bits hang down (lower case g, q, etc all hang below this baseline).
So in order to leav... | [
-0.023959659039974213,
-0.045906856656074524,
0.42908358573913574,
0.08741796016693115,
-0.05719100683927536,
0.1455271989107132,
-0.078675277531147,
-0.30191242694854736,
-0.34925925731658936,
-0.5370074510574341,
-0.28604453802108765,
0.16568686068058014,
-0.10152246803045273,
-0.3036304... | |
I've got a flash mp3 player on one of my web pages, streaming external audio. Check this site out as an example (no affiliation, just an example):
<http://www.1pixelout.net/code/audio-player-wordpress-plugin/>
When it's a decent sized mp3, once I start playing the file, it takes a little time to buffer. While it's bu... | [
0.23474469780921936,
0.07263410091400146,
0.5401796102523804,
0.05554826557636261,
-0.11669587343931198,
-0.3394898772239685,
0.30253586173057556,
0.14441938698291779,
-0.3631744086742401,
-0.5313794612884521,
-0.001178072765469551,
0.566253662109375,
0.2109760046005249,
0.1433788686990738... | |
but you can pass the current context to the method, and then eval the operations on the instance variable in that specific context:
```
class Whatever
def changeFoo(context)
eval %q( @foo="changed" ), context
end
end
@foo = "original"
o = Whatever.new()
o.changeFoo(binding)
puts "it changed" if @foo == "change... | [
0.07438615709543228,
0.039244115352630615,
0.5297791957855225,
-0.3336612582206726,
0.2956419587135315,
0.05379834771156311,
0.15101714432239532,
-0.2836776077747345,
0.0035050678998231888,
-0.26290982961654663,
-0.09245353192090988,
0.5487938523292542,
-0.5053591728210449,
0.0925364568829... | |
IE seems to ignore the height set in CSS when rendering a HTML SELECT. Are there any work around's for this or do we have to just accept IE will not look as good as other browsers?
There is no work-around for this aside from ditching the `select` element. | [
0.24599914252758026,
0.054544415324926376,
0.20084872841835022,
-0.08266031742095947,
-0.36873820424079895,
-0.2229187935590744,
0.2251347303390503,
0.18571865558624268,
0.09979940950870514,
-0.8495205640792847,
0.08792298287153244,
0.4867298901081085,
-0.22659939527511597,
-0.251610249280... | |
I'm mapping a ProductCategory tree using Fluent NHibernate and everything was going fine until I tried to walk the tree that is returned from the database to ensure it's saving and retreiving appropriately.
Here's how I'm testing:
1. Instantiate 4 categories: Beverages, Beer, Light Beer, and Dark Beer
2. Add Beer to ... | [
0.08030886948108673,
0.5031195282936096,
0.637012779712677,
-0.03203772008419037,
-0.31083348393440247,
0.09854631870985031,
0.3537643849849701,
-0.16769437491893768,
-0.00909077562391758,
-0.3163677155971527,
-0.1196725144982338,
0.6802387237548828,
-0.06987431645393372,
0.157328128814697... | |
fromDB has only one child ProductCategory
9. Check that the only child in fromDB is EqualTo but not SameAs Beer
The test fails because the child is the SameAs Beer. Which means that it's not actually loading the object from the database, because it's still in the NHibernate session somewhere.
Any insight will be much... | [
0.1122824102640152,
0.417257159948349,
0.19407257437705994,
0.022915760055184364,
-0.054610852152109146,
-0.048719827085733414,
0.10051476210355759,
-0.10785414278507233,
-0.00859674159437418,
-0.4135092496871948,
0.08630897849798203,
0.2602351903915405,
-0.2581357955932617,
0.295910537242... | |
are not in the session:
```
Assert.That(Session.Contains(_beveragesCategory), Is.False);
Assert.That(Session.Contains(_beerCategory), Is.False);
Assert.That(Session.Contains(_darkBeerCategory), Is.False);
Assert.That(Session.Contains(_lightBeerCategory), Is.False);
```
When all of those passed (the first time I ran... | [
0.19765621423721313,
0.5458893179893494,
0.6941835284233093,
-0.32206639647483826,
0.1635478287935257,
0.02855462022125721,
0.6641349196434021,
-0.16338910162448883,
-0.10271129757165909,
-0.21615271270275116,
-0.508720874786377,
0.5855108499526978,
-0.3685808777809143,
0.41158849000930786... | |
I am creating a set of widgets in Java that decodes and displays messages received at a serial interface.
The message type is defined by a unique identifier.
Each widget is only interested in a particular identifier.
How to I program the application in a way to distribute the messages correctly to the relevant widge... | [
0.4114232063293457,
0.1680200695991516,
0.3302621841430664,
-0.07468684762716293,
-0.16082513332366943,
-0.016981853172183037,
0.07977045327425003,
-0.17943407595157623,
-0.20269367098808289,
-0.6902942061424255,
-0.018843403086066246,
0.2324669510126114,
-0.5377461910247803,
0.14158506691... | |
relevant message object, and dumps it on a central Message Queue. This can be as simple as a BlockingQueue singleton.
Next, you'll need a queue listener/dispatcher.
This is a separate thread that sits on the queue, waiting for messages.
When it gets a message it then dispatches it to the waiting "widgets".
How it "... | [
-0.07437852770090103,
-0.25412023067474365,
0.5390439033508301,
-0.1687394231557846,
-0.09600061178207397,
0.06759130209684372,
0.19014102220535278,
-0.17161011695861816,
-0.346655011177063,
-0.8106256723403931,
-0.30066967010498047,
0.3343025743961334,
-0.5304672718048096,
0.2718773782253... | |
listeneres = new ArrayList<MessageListener>();
registrationMap.put(type, listeners);
}
listeners.add(listener);
}
public void dispatchMessage(Message msg) {
List<MessageListener> listeners = registrationMap.get(type);
if (listeners != null) {
for(MessageListener listener : listeners) {
... | [
0.3172120451927185,
-0.01400310080498457,
0.3749585747718811,
-0.5121586322784424,
-0.36975935101509094,
0.0019340094877406955,
0.3643999397754669,
-0.7292107343673706,
-0.27684950828552246,
-0.4842967391014099,
-0.11123792827129364,
0.588117778301239,
-0.47406187653541565,
0.1039924919605... | |
you could leverage as well.
That's the heart of it. That should give you enough rope to keep you in trouble. | [
0.15035004913806915,
-0.32619941234588623,
-0.06072062626481056,
0.42966771125793457,
0.49743130803108215,
0.22109046578407288,
-0.2712864875793457,
-0.2189367711544037,
-0.31976810097694397,
-0.12468952685594559,
0.521782398223877,
0.5163235068321228,
0.1331261545419693,
-0.24897630512714... | |
Say I have the following:
```css
tr {
background: #fff;
}
tr.even {
background: #eee
}
tr.highlight {
background: #fec;
}
```
Is it possible to specify a 4th background (`#fea`) instead of having `highlight` simply overwrite `even`?
```
<tr class="even highlight">
<!-- ... -->
</tr>
```
---
Once ... | [
-0.2647303342819214,
0.21616563200950623,
0.5585143566131592,
-0.21335279941558838,
-0.09445487707853317,
0.20606952905654907,
-0.00868251919746399,
0.011326925829052925,
-0.26340869069099426,
-0.5827407836914062,
-0.19810174405574799,
0.2837470769882202,
-0.08085601031780243,
0.0744223818... | |
I'm doing some portlet development for IBM WebSphere Portal 6.1. However, the deployment process is painfully slow. As this is my first time doing portlet development, I'm not too familiar with the various portal servers out there. I'd like some recommendations for a lightweight portal server on which I can deploy quic... | [
0.2155875414609909,
0.23861414194107056,
0.15346936881542206,
0.21959444880485535,
0.23219481110572815,
-0.14372558891773224,
0.04579976201057434,
0.4329768419265747,
-0.5005682706832886,
-0.5897669792175293,
0.03195253387093544,
-0.05761324614286423,
0.01539857592433691,
0.176517009735107... | |
I need to find a way to monitor the status of a list of Windows services over HTTP, preferably without any third party program).
All I really need to be able to do is display the service name and its status ('Started' / 'Stopped').
I'm not an ASP programmer so this is a little outside my realm. I've searched and have... | [
0.10566411912441254,
0.10849495232105255,
0.5716971158981323,
-0.2375347763299942,
0.06475604325532913,
-0.10930570214986801,
0.4906417429447174,
0.1419810950756073,
-0.35322052240371704,
-0.8722586035728455,
-0.3819190263748169,
0.5321320295333862,
-0.20919854938983917,
0.4125783145427704... | |
ServiceController[] services = ServiceController.GetServices();
Response.Write("List of running services : <BR>");
foreach (ServiceController service in services)
{
Response.Write(string.Format(" Service Name: {0} , status {1} <BR>", service.ServiceName, service.Status.ToString()))... | [
-0.16278329491615295,
0.08564447611570358,
0.8912917971611023,
-0.4333757162094116,
0.14658482372760773,
0.24744652211666107,
0.4608878791332245,
-0.06945891678333282,
-0.27742433547973633,
-0.7763314247131348,
-0.6186473369598389,
0.47960564494132996,
-0.31833434104919434,
0.4065772294998... | |
The JDBC 3.0 spec talks about Connection (and Prepared Statement) pooling.
We have several standalone Java programs (i.e. we are not using an application server) that have been using DBCP to provide connection pooling. Should we continue to use DBCP, or can we take advantage of the JDBC-provided pooling and get rid of... | [
0.23972031474113464,
-0.202745258808136,
0.24407953023910522,
0.10316330194473267,
-0.19327135384082794,
-0.591286838054657,
-0.07351245731115341,
-0.1324523687362671,
-0.2645367980003357,
-0.5338433384895325,
-0.06318484991788864,
0.24877649545669556,
-0.50922030210495,
0.0059454361908137... | |
DBCP).
Based on the encouragement of other posters, I attempted to eliminate DBCP and use the MySQL JDBC driver directly (Connector/J 5.0.4). I was unable to do so.
It appears that while the driver does provide a foundation for pooling, it does not provide the most important thing: an actual pool (the source code came... | [
0.2518892288208008,
0.1134604886174202,
0.24816502630710602,
-0.11194483190774918,
-0.49726930260658264,
-0.39134570956230164,
-0.1314375102519989,
-0.27779775857925415,
-0.11301840096712112,
-0.3884891867637634,
0.12354257702827454,
0.4574456810951233,
-0.5121498703956604,
0.0517291091382... | |
that the MySQL driver is following the JDBC doc.
When I look at DBCP, this decision starts to make sense. Good pool management provides many options. For example, when do you purge unused connection? which connections do you purge? is there a hard or soft limit on the max number of connections in the pool? should you ... | [
0.2808063328266144,
-0.179879292845726,
0.024939987808465958,
0.040439195930957794,
0.03448648378252983,
-0.33002859354019165,
-0.08010561764240265,
-0.05905890464782715,
-0.4344917833805084,
-0.4703131914138794,
0.11418873816728592,
0.6864721775054932,
-0.15828007459640503,
0.005187747534... | |
Like almost anyone who's been programming for a while, I'm familiar with the term "production code" and have a vague sense of what it means. However, can someone offer a semi-rigorous definition, since it seems Wikipedia and Google can't? It seems like there are a lot of gray areas in what counts as production, such as... | [
0.9193316698074341,
0.42380812764167786,
-0.31664177775382996,
0.2555888891220093,
0.051355939358472824,
-0.09044903516769409,
0.3817550837993622,
0.3689899444580078,
-0.24447134137153625,
-0.5508661866188049,
-0.599152147769928,
0.582379162311554,
-0.13866908848285675,
0.14177921414375305... | |
you need to work reliably, and consistently.
Whether is a build script, or a public facing web server.
When others rely on your code, particularly folks who may not understand it (i.e. even "smart" developers but perhaps not in your group, but using a library you wrote), that code is production code.
It's production... | [
0.8045573830604553,
0.3496854901313782,
-0.26785966753959656,
0.18439731001853943,
0.2544049918651581,
0.05203747749328613,
0.4178621172904968,
-0.06717328727245331,
-0.11790811270475388,
-0.7373585104942322,
-0.30648529529571533,
0.6975841522216797,
0.20294398069381714,
-0.052750285714864... | |
How do I tell if gcc (more specifically, g++) is optimizing tail recursion *in a particular function*? (Because it's come up a few times: I don't want to test if gcc can optimize tail recursion in general. I want to know if it optimizes **my** tail recursive function.)
If your answer is "look at the generated assemble... | [
0.15600401163101196,
-0.07631450146436691,
0.1970011293888092,
0.1764468103647232,
-0.0853956937789917,
-0.18114277720451355,
-0.19490845501422882,
-0.10762828588485718,
0.03308466076850891,
-0.2230118215084076,
-0.044297631829977036,
0.5535958409309387,
-0.2792569100856781,
-0.29996737837... | |
optimization?](https://stackoverflow.com/questions/34125/which-if-any-c-compilers-do-tail-recursion-optimization) from 5 months ago. However, I don't think *this part* of that question was answered satisfactorily. (The answer there was "The easiest way to check if the compiler did the optimization (that I know of) is p... | [
-0.3594817817211151,
0.31468337774276733,
0.29299837350845337,
0.0005640409071929753,
-0.02203460782766342,
0.1275763213634491,
0.19681861996650696,
-0.313627690076828,
-0.45893430709838867,
-0.35675039887428284,
-0.1102210134267807,
0.8011817336082458,
-0.5341693162918091,
-0.248358681797... | |
.align 4,0x90
_atoi:
pushl %ebp
testl %eax, %eax
movl %esp, %ebp
movl %eax, %ecx
je L3
.align 4,0x90
L5:
movzbl (%ecx), %eax
testb | [
-0.2106688767671585,
0.05027041211724281,
0.9021318554878235,
-0.23011334240436554,
0.057408932596445084,
0.347528338432312,
0.21043868362903595,
-0.3786344826221466,
0.18943685293197632,
-0.3117145001888275,
-0.21232949197292328,
0.5242613554000854,
-0.34819450974464417,
-0.34372439980506... | |
%al, %al
je L3
leal (%edx,%edx,4), %edx
movsbl %al,%eax
incl %ecx
leal -48(%eax,%edx,2), %edx
jne L5
.align 4,0x90
L3:
leave | [
-0.23017121851444244,
0.05293215438723564,
0.9555305242538452,
-0.4497259259223938,
0.03347748890519142,
0.2985312342643738,
0.23494099080562592,
-0.10171482712030411,
0.2943384349346161,
-0.12041120231151581,
-0.46749061346054077,
0.5098559856414795,
-0.03366091102361679,
0.04161788150668... | |
movl %edx, %eax
ret
```
The compiler has performed tail-call optimization on this function. We can tell because there is no `call` instruction in that code whereas the original C code clearly had a function call. Furthermore, we can see the `jne L5` instruction, which jumps backward in the function, indica... | [
-0.18606291711330414,
0.022917836904525757,
0.08020111173391342,
-0.12348238378763199,
0.18924547731876373,
0.09836738556623459,
0.5260338187217712,
-0.36039263010025024,
-0.14362789690494537,
-0.3535226881504059,
-0.3615403473377228,
1.0768506526947021,
-0.580825686454773,
-0.228981852531... | |
this is another matter. The specifics of the assembler code will depend on the code you're compiling.
You could discover it programmatically, I think. Make the function print out the current value of the stack pointer (register ESP on x86). If the function prints the same value for the first call as it does for the re... | [
0.3137197196483612,
0.05037449672818184,
0.1961475908756256,
-0.02619974873960018,
0.19594325125217438,
-0.16329386830329895,
0.12171784043312073,
-0.3281588554382324,
-0.14686346054077148,
-0.4412817358970642,
-0.07147690653800964,
0.8794600963592529,
-0.32347017526626587,
-0.272890359163... | |
I think it's reasonable to assume that the optimization would also be performed without your instrumentation, but if the test fails, we won't know whether the failure was due to the addition of the instrumentation code. | [
0.3615703582763672,
0.36833879351615906,
-0.05691307783126831,
0.36613234877586365,
0.5803237557411194,
-0.1393931359052658,
0.06434269994497299,
-0.368356317281723,
-0.02384333871304989,
-0.3982980251312256,
0.10311160981655121,
0.8164976239204407,
-0.16009201109409332,
0.0111340135335922... | |
Is anyone using the built-in code generation provided via text templates (using .tt files)? If so what are the main pro's/con's over other solutions like codesmith?
the T4 generation was pretty woeful in 2005. Apparently it's OK in 2008, but we went with Codesmith, as this was before 2005.
I assume that you will have ... | [
0.038372479379177094,
0.009641536511480808,
0.2726805508136749,
-0.010526644997298717,
-0.22592301666736603,
-0.07568702846765518,
0.39856863021850586,
0.015070692636072636,
-0.3382335603237152,
-0.4033522605895996,
0.07877101004123688,
0.4771490693092346,
-0.08490633219480515,
0.011712097... | |
I would really like use the [jQuery Validation plugin](http://plugins.jquery.com/project/validate) in my ASP.NET Web Forms application (not MVC).
I value jQuery validation for the Richer UI experience I can provide the end user and I have some requirements to highlight the invalid fields using a red border (css).
I ... | [
0.5145180821418762,
0.2181197702884674,
0.2346791923046112,
0.1586664915084839,
-0.40227943658828735,
-0.3676362633705139,
0.2216329723596573,
-0.11064854264259338,
-0.1660308539867401,
-0.340921550989151,
0.06650253385305405,
0.3604756295681,
0.210116907954216,
-0.017042241990566254,
0.... | |
I can come up with is to have all ASP.NET validators set to enableclientscript=false and repeat the validation rules on the client in jQuery and on the server as asp.net validators but I can already see some challenges with this approach.
In the end I found the lowest friction way to achieve highlighting with asp.net ... | [
0.2031218707561493,
0.10280491411685944,
0.4233717918395996,
-0.1541578322649002,
-0.513028621673584,
0.03537733107805252,
0.06793683767318726,
-0.2565539479255676,
0.09376112371683121,
-0.602956235408783,
0.10131821036338806,
0.5790334939956665,
-0.14193950593471527,
-0.30271121859550476,... | |
$('span.validationerror:hidden').parent().parent().find('input').removeClass('inputError');
$('span.validationerror:visible').parent().parent().find('input').addClass('inputError');
});
</script>
```
This might help!
<http://www.delphicsage.com/home/blog.aspx?d=205> | [
0.04766763374209404,
-0.31118109822273254,
0.24310123920440674,
-0.15412656962871552,
0.1995581090450287,
0.11636664718389511,
0.18285739421844482,
-0.1491781771183014,
-0.1714194118976593,
-0.29911303520202637,
-0.4282268285751343,
0.6633180379867554,
0.014728575944900513,
0.0339387878775... | |
I have mocks working where I test that methods on my mocked object are called with the correct parameters, and return the right result.
Now I want to check another condition. In this case, NO methods should be run on the mocked object. How can I express this in a unit test?
You could create your mock as strict. That w... | [
0.40183225274086,
0.38676995038986206,
0.35626986622810364,
-0.22861237823963165,
-0.21987693011760712,
0.2800360321998596,
0.5377434492111206,
-0.33327794075012207,
-0.012075288221240044,
-0.5280829668045044,
0.052499920129776,
0.7399570345878601,
-0.4764232933521271,
0.027186132967472076... | |
raised and your test will fail. | [
0.5302996635437012,
-0.003666408360004425,
-0.09827904403209686,
0.16693732142448425,
0.018114782869815826,
0.15580089390277863,
-0.013338891789317131,
-0.4828214645385742,
0.17310048639774323,
-0.6840850114822388,
0.27356621623039246,
0.5100446939468384,
-0.11510374397039413,
0.2171457409... | |
I've got quite a bit of PHP code laying around and am wondering at what point should I start upgrading the scripts to support IPV6.
I know IPV6 has been on the 'list of things to do' for a long, long time but really have never seen a clear transition path on when I need to start supporting it.
IPv6 has widespread ado... | [
0.743554949760437,
0.1880875825881958,
0.012497618794441223,
0.023303378373384476,
-0.15721119940280914,
-0.4001389443874359,
0.0399116612970829,
0.33309924602508545,
-0.3806518614292145,
-0.45555227994918823,
-0.28524911403656006,
0.31516456604003906,
0.09546986222267151,
-0.1304081827402... | |
answer to your question is... "When a significant proportion of your target audience uses IPv6".
For a public internet site, the answer to that is likely "probably never". IPv6 was meant to solve the "we're running out of IPv4 addresses" problem. Since instead of IPv6, most organisations have gone down the [network ad... | [
0.7397125363349915,
-0.1336759328842163,
0.3031347393989563,
0.1264067441225052,
-0.16027888655662537,
-0.1019662544131279,
0.37335366010665894,
0.2693766951560974,
-0.3646703064441681,
-0.36241015791893005,
-0.5120235681533813,
0.2579137682914734,
-0.07525418698787689,
0.299673467874527,
... | |
I wanted to write a function that would take an object and convert it to an array that contains that object as a single element. It occurred to me that I could maybe do this with generics and variable arguments to essentially do this automatically, without the need to write a function for each object type I wished to u... | [
0.055065449327230453,
0.017944369465112686,
0.27322205901145935,
-0.2542203962802887,
0.04633156582713127,
0.03310706838965416,
0.19691221415996552,
-0.21654297411441803,
-0.20845440030097961,
-0.5021495223045349,
-0.1356228142976761,
0.5864289402961731,
-0.6151086688041687,
0.083391688764... | |
a little more straightforward then:
```
Object o = new Object();
someMethod(convert_to_array(o));
```
In cases where sometimes I want to pass a single object, but other times I want to pass an array, usually I just use an overloaded method in the API:
```
public void doSomething(Object o)
{
doSomething(new Obje... | [
0.29660117626190186,
-0.11229495704174042,
0.3854667842388153,
-0.26330533623695374,
-0.04793332517147064,
-0.15488533675670624,
0.25733569264411926,
-0.5000796318054199,
-0.3613046109676361,
-0.6558325290679932,
-0.18078456819057465,
0.6489413976669312,
-0.4419606029987335,
0.126993715763... | |
I'm using a Python API that expects me to pass it a function. However, for various reasons, I want to pass it a method, because I want the function to behave different depending on the instance it belongs to. If I pass it a method, the API will not call it with the correct 'self' argument, so I'm wondering how to turn ... | [
0.20857077836990356,
0.14895378053188324,
-0.10986833274364471,
-0.18356217443943024,
-0.10331225395202637,
0.07733887434005737,
0.244345560669899,
0.11360310763120651,
-0.10537483543157578,
-0.4041214883327484,
0.05407124385237694,
0.5282217264175415,
-0.5249086618423462,
0.24919381737709... | |
below, but I'm wondering if there is a standard mechanism for achieving the same effect.
```
class A(object):
def hello(self, salutation):
print('%s, my name is %s' % (salutation, str(self)))
def bind_hello1(self):
return lambda x: self.hello(x)
def bind_hello2(self):
def hello2(*... | [
-0.40786176919937134,
0.3281574249267578,
0.2726537883281708,
-0.6393965482711792,
-0.1922786384820938,
0.32875698804855347,
0.45219123363494873,
-0.12123240530490875,
-0.22020387649536133,
-0.5591951608657837,
-0.22485053539276123,
0.3506648540496826,
-0.4992581009864807,
0.18442822992801... | |
at 0x71570>
Greetings, my name is <__main__.A object at 0x71590>
>>> f1, f2 = a1.bind_hello1(), a2.bind_hello1()
>>> f1('Salutations'); f2('Salutations')
Salutations, my name is <__main__.A object at 0x71570>
Salutations, my name is <__main__.A object at 0x71590>
>>> f1, f2 = a1.bind_hello2(), a2.bind_hello2()
>>> f1... | [
-0.5056059956550598,
0.38049012422561646,
0.4361792206764221,
-0.5073801875114441,
-0.3591148257255554,
0.32045838236808777,
0.5351036190986633,
-0.21148064732551575,
-0.10237562656402588,
-0.40973100066185,
-0.172885924577713,
0.1484382450580597,
-0.5105717778205872,
0.3734588325023651,
... | |
...:
...:
In [3]: def api_function(a_func):
...: a_func("One Fish", "Two Fish", "Blue Fish")
...:
...:
In [4]: c = C()
In [5]: api_function(c.method)
One Fish Two Fish Blue Fish
``` | [
0.3497667908668518,
0.10008902102708817,
0.053135499358177185,
-0.0026742732152342796,
0.24141696095466614,
0.43364042043685913,
-0.12020457535982132,
-0.021613502874970436,
-0.40046194195747375,
-0.4796995222568512,
-0.00893638376146555,
0.5028640031814575,
-0.5840655565261841,
0.24685122... | |
We had a debate - cons and pros of having a factory per dto in order to test some service.
The idea is that the service is being invoked with primitive types parameters (username, password, etc), but the service dependency should be leveraged using those primitives. The only way to test it was to inject into service an... | [
0.6920827627182007,
0.0031972581055015326,
-0.0673634335398674,
0.0313204862177372,
-0.028628645464777946,
0.2989175617694855,
0.18477660417556763,
0.22979065775871277,
-0.2536981403827667,
-0.43750661611557007,
0.10229693353176117,
0.6496170163154602,
-0.689108669757843,
0.072263494133949... | |
hit this message, you've almost certainly created a real loader lock policy violation. This is a very serious error and can cause unpredictable behavior in a program (including deadlock).
The best way to avoid this is to not access any other .Net Objects/Functions directly or indirectly inside of DLL main. For your c... | [
0.23260673880577087,
-0.04060584306716919,
0.1951979696750641,
0.19193591177463531,
-0.3367534577846527,
-0.2964053750038147,
0.4683135449886322,
0.1107478216290474,
-0.4795323312282562,
-0.3815018832683563,
0.009708855301141739,
0.5810214877128601,
-0.4795621335506439,
0.43955689668655396... | |
I'm sending some data over AJAX to a PHP file. It's about filter options. Anyway, I am sending it like this:
```
filter[0][data][type] string
filter[0][data][value] automobiles
filter[0][field] product
filter[1][data][type] numeric
filter[1][data][value] 6000
filter[1][field] price
```
This above is taken from Fi... | [
0.3515624403953552,
-0.24446681141853333,
0.30937379598617554,
-0.1368408054113388,
-0.3874012529850006,
0.006684469990432262,
-0.11242712289094925,
-0.26441219449043274,
-0.028912177309393883,
-0.717008113861084,
0.12076111137866974,
0.42631077766418457,
-0.5281702280044556,
-0.1930365413... | |
based on that and so on
```
So, the translation of this would be:
"Get me all the records from database that are: *hmm, let's check the filters*... I'm getting the first filter type which is "string" which needs to be applied to the mysql column named "product"...So I'm searching for the value of "automobiles" there... | [
0.8371809720993042,
0.5579692125320435,
0.3512254059314728,
0.1780693084001541,
0.00925829540938139,
0.32039791345596313,
-0.4263944923877716,
-0.11873142421245575,
-0.20359571278095245,
-0.5919836759567261,
0.2765978276729584,
0.9928864240646362,
0.14373134076595306,
0.5053155422210693,
... | |
good. The problem is that my way of getting data have changed and I can't send my data in this format no more. The new format is an URL which looks like this:
```
filter[0][field]=prodct&filter[0][data][type]=string&filter[0][data][value]=automobiles&filter[1][field]=price&filter[1][data][type]=numeric&filter[1][data]... | [
0.5449455976486206,
0.4515070617198944,
0.36060208082199097,
0.08705386519432068,
0.041610654443502426,
-0.09059857577085495,
0.2473214864730835,
-0.33051982522010803,
-0.11235470324754715,
-0.3450204133987427,
-0.07163304835557938,
0.8859208226203918,
-0.22456029057502747,
0.0945465490221... | |
query string and import the variables to the global namespace (which could be dangerous), so maybe use its second form (listed on the manual page):
```
$result = array();
parse_str($queryString, $result)
$filters = $result['filter'];
foreach($filters as $filter) {
// your code
}
``` | [
-0.09144406765699387,
-0.42593055963516235,
0.41800379753112793,
-0.21283185482025146,
0.06728438287973404,
-0.10300805419683456,
0.15964525938034058,
-0.3360704481601715,
-0.21971672773361206,
-0.44263583421707153,
-0.19649969041347504,
0.47546374797821045,
-0.810137152671814,
-0.23572331... | |
I have an `input[type="radio"]` element inside a block container of fixed width. The supporting text for the `<input/>` element does not fit in a single line, and falls over to two or more lines. For example:
```css
div.leftBlock {
position: relative;
float: left;
width: 275px;
}
```
```html
<div class="lef... | [
0.20339567959308624,
0.28898632526397705,
0.6442640423774719,
-0.24286238849163055,
-0.005776142235845327,
-0.09447522461414337,
0.4367733895778656,
-0.4261458218097687,
0.2615079879760742,
-0.6443848013877869,
-0.23548129200935364,
0.43544647097587585,
-0.30139368772506714,
0.079495124518... | |
first line of text has to be at the same vertical level as the `<input/>` element.
Any help will be much appreciated.
The container could use positive left `padding`, and a negative `text-indent`.
```css
.leftBlock {
padding-left: 20px;
text-indent: -20px;
}
.leftBlock input {
width: 20px;
}
```
[Here's... | [
-0.3934172987937927,
-0.21287892758846283,
0.37130028009414673,
-0.04201513156294823,
-0.04448353871703148,
0.3173415958881378,
-0.006820337846875191,
-0.17560413479804993,
-0.006256749853491783,
-0.7047576308250427,
-0.32685068249702454,
0.220230370759964,
-0.32484525442123413,
-0.1099868... | |
I just want a very handy way to extract the numbers out of a string in Javascript and I am thinking about using jQuery, but I prefer the method that proves to be the simplest. I have requested the "left" attribute of a css block using jQuery like this:
```
var stuff = $('#block').css("left")
```
The result of "stuff... | [
0.004595078527927399,
0.2616744339466095,
0.3031284213066101,
0.16492901742458344,
-0.0057546054013073444,
-0.03841618821024895,
0.1337439864873886,
0.14525577425956726,
-0.2639421820640564,
-0.5819118022918701,
-0.16998203098773956,
0.2562235891819,
-0.2042071372270584,
-0.028387788683176... | |
you. | [
0.24945226311683655,
0.1961626261472702,
0.08031749725341797,
0.36348938941955566,
0.09130732715129852,
-0.25685885548591614,
0.17062850296497345,
-0.031069165095686913,
-0.08994386345148087,
-0.7576521635055542,
-0.16434843838214874,
0.3483704924583435,
-0.2490721493959427,
0.196157008409... | |
I deleted a file from a repo and now want to put it back. The best I can figure out is to:
* update to the revision before the delete
* copy the files elsewhere
* update to head
* copy the files back
* add them
* commit
That just smells bad and it looses all history to boot. There has got to be a better way to do thi... | [
0.3997920751571655,
0.18302437663078308,
0.365627646446228,
-0.29767361283302307,
-0.1723659485578537,
-0.36497044563293457,
0.464516818523407,
-0.00863310880959034,
-0.4070718288421631,
-0.7117443084716797,
-0.04706154763698578,
0.48164477944374084,
-0.21132466197013855,
0.296243458986282... | |
merge -c -12345 https://svn.mysite.com/svn/repo/project/trunk
^ The negative is important
```
For TortoiseSVN (I think...)
* Right click in Explorer, go to TortoiseSVN -> Merge...
* Make sure "Merge a range of revisions" is selected, click Next
* In the "Revision range to merge" textbox, specify the rev... | [
-0.03523469343781471,
0.05887410789728165,
0.7038154602050781,
-0.2732299268245697,
0.08505336195230484,
0.07831565290689468,
0.32993990182876587,
-0.22878266870975494,
-0.5138247609138489,
-0.6780197024345398,
-0.18458473682403564,
0.6305623650550842,
-0.12448763102293015,
0.1266499608755... | |
go to TortoiseSVN -> Merge...
* in the **From** section enter the revision that did the delete
* in the **To** section enter the revision before the delete.
* Click "merge"
* commit
The trick is to merge *backwards*. Kudos to *sean.bright* for pointing me in the right direction!
---
**Edit:** We are using different ... | [
-0.22563883662223816,
-0.08219068497419357,
0.6066977381706238,
-0.015936456620693207,
-0.0411001592874527,
-0.0635201558470726,
0.4800749123096466,
-0.05243780463933945,
-0.37387630343437195,
-0.4823935031890869,
-0.051543381065130234,
0.903958797454834,
0.010566999204456806,
-0.079973764... | |
reversed. | [
-0.05508847162127495,
-0.025442617014050484,
0.20058628916740417,
-0.1996811032295227,
0.0010633731726557016,
0.23407655954360962,
0.15688638389110565,
-0.1778220385313034,
-0.02069609798491001,
-0.5170760750770569,
-0.14677157998085022,
0.19482140243053436,
-0.16173748672008514,
0.1135499... | |
I'm using the built in web server in Visual Studio to test some pags but I wanted to be able to connect to it from other machines to test out browsers on different platforms. I was wondering if it was possible to configure that server to listen to an external interface or if I have to throw this over to IIS. I've turne... | [
0.4240577816963196,
0.14728377759456635,
0.0736769288778305,
0.001416972721926868,
0.015230084769427776,
-0.09012224525213242,
0.14387448132038116,
0.09723564237356186,
-0.38479161262512207,
-0.7912351489067078,
-0.06121436506509781,
0.5463621616363525,
-0.1689235121011734,
0.3528186976909... | |
Steve Yegge describes the **Properties Pattern** in a [blog post](http://steve-yegge.blogspot.com/2008/10/universal-design-pattern.html#Property) of his.
For someone using a static language like C# or Java, what are the advantages and disadvantages of this approach? In what kind of projects would you want to use the P... | [
0.3712674677371979,
0.3110828399658203,
-0.21828922629356384,
-0.2130626142024994,
-0.10918547958135605,
0.18277886509895325,
0.11255574971437454,
0.008909442462027073,
-0.35535097122192383,
-0.7611710429191589,
-0.17568433284759521,
0.026564106345176697,
-0.3289928436279297,
0.31591516733... | |
systems like the one Yegge proposes as "stringly[sic] typed" so that's another avenue of research.
It's a really neat idea, and one that has a lot of merit in some applications, and a lot of faults in others. What you gain is essentially a very flexible means of building "types" at runtime, but you lose out on a lot o... | [
0.25000396370887756,
0.025207115337252617,
0.16215313971042633,
0.27440693974494934,
-0.02226274646818638,
-0.09942610561847687,
0.06246181204915047,
0.12413323670625687,
-0.1839146763086319,
-0.6785609126091003,
0.00026831822469830513,
0.23200349509716034,
-0.5290759205818176,
0.106521241... | |
manageable is to never directly reference a property in code if you can avoid it. Stuff like `theProtoObject["owner"] = "protoman"` will kill you if the "canonical" name of that slot changes. It can also lead to issues like JavaScript (which uses this pattern underneath as it's object model) where if you misspell the k... | [
-0.02921137772500515,
0.2909369468688965,
0.15572074055671692,
0.3013039529323578,
0.3639407157897949,
-0.5156620144844055,
0.681124746799469,
-0.019088417291641235,
-0.3722011148929596,
-0.3745214641094208,
-0.27315831184387207,
0.6890727877616882,
-0.2977519929409027,
0.08406811952590942... | |
info on your model.
I've seen a few applications that use it. One surprising example hit me recently while looking up open source code in my industry: insurance quoting. [OpenQuote](http://openquote.appliedindustriallogic.com/) is a very flexible project for quoting insurance of any general type. It's written in Java,... | [
0.8603842854499817,
0.09452585130929947,
0.45188048481941223,
0.09694800525903702,
-0.1202940046787262,
-0.18369919061660767,
-0.31012970209121704,
-0.05781101435422897,
-0.0405452586710453,
-0.4238729476928711,
0.46540799736976624,
0.6888313293457031,
-0.18932630121707916,
-0.124589137732... | |
a subject". Generally, another
* type will own a (composite) collection of Attributes which help describe it.
```
So basically `Attribute` is a kind of key-value pair containing a unique string ID (the field name) and a string value, and an enumeration of types combined with some regex to verify and process the value... | [
0.6543955206871033,
0.019623564556241035,
0.13319364190101624,
0.386712908744812,
-0.149503692984581,
-0.2047729641199112,
0.04460172727704048,
-0.2811432182788849,
-0.1030728816986084,
-0.32228884100914,
-0.24955247342586517,
0.5051556825637817,
-0.19432935118675232,
0.212713822722435,
... | |
a flexible, extensible list of benefits on it, which can added or removed or modified at runtime. Each benefit can have properties extended or reduced on them as well.
So that's an example of the pattern in use, and a decent use case for it: insurance policies can be very flexible, at the whim of the underwriters up t... | [
0.512601912021637,
-0.013844721019268036,
0.35023635625839233,
0.15578755736351013,
0.16904281079769135,
-0.039111800491809845,
-0.30380886793136597,
-0.31983497738838196,
-0.3502592146396637,
-0.5486546754837036,
0.017611538991332054,
0.7062464952468872,
-0.033191241323947906,
-0.13483005... | |
to reason about because you don't know for sure what properties are on them. | [
0.640900194644928,
0.28280335664749146,
-0.13809318840503693,
0.3075522482395172,
0.04184602200984955,
-0.1636582762002945,
0.22879280149936676,
-0.3831390142440796,
-0.24013811349868774,
-0.36330756545066833,
0.015505129471421242,
0.4175213575363159,
-0.023180857300758362,
0.0884113088250... | |
I'm wondering if there are any standard methods of keeping the correct pagination of real-time lists. For instance, on Stack Overflow if I go to page 2, and in the period of looking at page 1 a new question was submitted, how can I keep page 2 the same as it was when I started looking at page 1?
A lot of the time peop... | [
0.39234229922294617,
0.028829647228121758,
0.2716180980205536,
0.1430598944425583,
0.029166674241423607,
-0.19450749456882477,
-0.12553617358207703,
0.016543997451663017,
-0.5590509176254272,
-0.40900084376335144,
0.3728201389312744,
0.23691196739673615,
-0.1417139768600464,
0.350379109382... | |
ID of the last seen record or something.
We do this (your requested) behavior for all our paginated web UI's. (I have actually asked for that in SO, and had it declined - but I find the current repagination annoying and unexpected - I hate hitting "next" and having the first n items be the last ones from the previous p... | [
0.3536146283149719,
-0.1587475836277008,
0.6168975830078125,
0.3349462151527405,
0.2193811684846878,
-0.1621009111404419,
-0.058612216264009476,
0.022328855469822884,
-0.2528513967990875,
-0.7480523586273193,
-0.037230294197797775,
0.25835511088371277,
0.0349554680287838,
0.296572685241699... | |
that information to on submit. Effectively you retain a "previous page" and "next page" key. This works intuitively for insertions *and* deletions.
One thing to bear in mind is that a refresh on page 1 (assuming like SO a newest items first list) should either (a) activate the "previous" link, if it was hidden, or (b)... | [
0.01817557029426098,
-0.16919741034507751,
0.5686496496200562,
0.14343267679214478,
-0.27810078859329224,
-0.23366191983222961,
0.28420886397361755,
-0.2701267600059509,
-0.3140716850757599,
-0.8611767888069153,
-0.3132915496826172,
0.5770034790039062,
0.017671801149845123,
0.2108991891145... | |
it redisplays from the beginning of the list. With our lists we usually have, standard, links for "first page", "previous page", "refresh", "next page" and "last page".
The alternative for seeing new items is to always have a previous link and it backs up the smaller of a full page or the top of the list - and that's ... | [
0.13697166740894318,
-0.26049602031707764,
0.6017382740974426,
0.23217952251434326,
-0.13039682805538177,
-0.0029572024941444397,
0.08419723063707352,
0.18904590606689453,
-0.6391302347183228,
-0.6053414940834045,
-0.166129007935524,
0.22623756527900696,
-0.042507998645305634,
0.3735385835... | |
For a pet project, I have been looking for a web chat script capable of running potentially *tens of thousands of users* simultaneously. I don't want to use any kind of applet or browser extension, so on the client side, it should be simple Ajax. On the server side I'm pretty much open to anything.
I'm not looking for... | [
0.49843400716781616,
0.09641072154045105,
0.10373219847679138,
0.12320362776517868,
0.040643058717250824,
-0.016492117196321487,
0.5592834949493408,
0.41826149821281433,
-0.43507030606269836,
-0.5090293288230896,
0.04916280135512352,
0.40738391876220703,
-0.24535249173641205,
-0.0841283127... | |
the only viable option was to run an IRC server and just build a web interface on top of that. I know I could get good performance and stability with that setup, but could I get better performance by using something else?
Any ideas?
Likely using [Custom Basic Authentication for IIS](http://www.codeplex.com/CustomBasic... | [
0.09862808138132095,
-0.000056934797612484545,
-0.06014058366417885,
0.159384623169899,
-0.022650988772511482,
-0.07935266196727753,
0.2959040403366089,
-0.49404391646385193,
-0.1561642736196518,
-0.5031993389129639,
-0.07053454965353012,
0.44477975368499756,
-0.24778659641742706,
-0.02906... | |
it's not what I wanted, I found [QuickStart Tutorial's SOAP Headers sample](http://quickstarts.asp.net/QuickStartv20/webservices/doc/SoapHeaders.aspx) to be informative workaround. Sending password in plain text over http is clearly insecure, but this example could be extended to add more security, for instance running... | [
0.2820548415184021,
-0.3025009334087372,
0.29156267642974854,
0.06914016604423523,
-0.24764449894428253,
-0.21093980967998505,
0.3567568063735962,
0.02536097913980484,
0.12983158230781555,
-0.6496310234069824,
-0.008276781067252159,
0.5777537822723389,
-0.11486075818538666,
-0.017491133883... | |
In java how do I display dates in different locales (for e.g. Russian).
Use SimpleDateFormat constructor which takes locale. You need to first check if JDK supports the locale you are looking for, if not then you need to implement that. | [
0.1285465806722641,
-0.13587352633476257,
-0.05674736201763153,
-0.19387425482273102,
-0.013358122669160366,
-0.29149073362350464,
0.062489621341228485,
-0.0998023971915245,
-0.17268559336662292,
-0.7956316471099854,
-0.13096921145915985,
0.006389475427567959,
-0.348155677318573,
-0.073512... | |
Ok first off, I am linking to boost\_system and boost\_filesystem.
My compiler is a [custom build of MinGW with GCC 4.3.2](http://nuwen.net/mingw.html)
So when I include:
```
#include "boost/filesystem.hpp"
```
I get linking errors such as:
```
..\..\libraries\boost\libs\libboost_system.a(error_code.o):error_code... | [
0.2661553919315338,
0.34851378202438354,
0.5294294357299805,
-0.035243988037109375,
-0.027854513376951218,
-0.2767138183116913,
0.24394553899765015,
-0.09573226422071457,
-0.2726651132106781,
-0.5172260999679565,
-0.013173752464354038,
0.7159522175788879,
-0.27835556864738464,
0.1118611767... | |
of a good place to get windows binaries for boost? The build system is giving me issues, so I'm using some binaries that came with this [custom MinGW package](http://nuwen.net/mingw.html#contents)
Ok, I found the problem. It's a bit convoluted.
GCC is gradually becoming more IS 14882 compliant in the 4.x branch. As th... | [
0.21715813875198364,
0.3014979660511017,
0.29571405053138733,
0.060784295201301575,
-0.15401498973369598,
-0.42863667011260986,
0.46095752716064453,
-0.2006780207157135,
-0.066902294754982,
-0.24362221360206604,
-0.0986136943101883,
0.6641526222229004,
-0.1958511620759964,
0.04140295460820... | |
now removed features)
I was using a mix and match combination of binaries that had been compiled with GCC 3.x, 4.1.x and 4.3.x so no matter which one I used, I got a similar error, because at least one binary I was linking to was incompatible with the compiler I was trying at the moment.
I'm now using GCC 4.1.2 and m... | [
0.30305519700050354,
0.22840668261051178,
0.2741342782974243,
0.12436281889677048,
-0.14821946620941162,
-0.07020395994186401,
0.5666190385818481,
-0.0873912051320076,
-0.1417182981967926,
-0.7328426241874695,
-0.16822677850723267,
0.683380126953125,
-0.4656432569026947,
0.2331693172454834... | |
write...
[This](http://archives.devshed.com/forums/development-94/what-is-the-preferred-gcc-version-3-x-or-4t-2287902.html) seems to be a good post addressing some of the issues as they were with 4.1.x | [
0.23078122735023499,
-0.020451350137591362,
0.35583892464637756,
0.08053980022668839,
-0.42272838950157166,
-0.6458953619003296,
0.13914234936237335,
-0.18953724205493927,
0.02900521270930767,
-0.33437415957450867,
-0.23477968573570251,
0.48780834674835205,
-0.2594209611415863,
0.071146689... | |
I'm trying to request a HTTP resource that requires basic authorization headers from within an Adobe AIR application. I've tried manually adding the headers to the request, as well as using the setRemoteCredentials() method to set them, to no avail.
Here's the code:
```
<mx:Script>
<![CDATA[
import mx.rpc... | [
0.5007604360580444,
0.007702693808823824,
0.34718939661979675,
-0.3519306480884552,
-0.026636561378836632,
0.10279394686222076,
0.4980480670928955,
-0.20869965851306915,
0.4429105818271637,
-0.60257488489151,
-0.23448140919208527,
0.556599497795105,
-0.46494996547698975,
-0.060801304876804... | |
service.send();
}
private function resultHandler(event:ResultEvent):void
{
apiResult.text = event.result.toString();
}
private function resultFailed(event:FaultEvent):void
{
apiResult.text = event.fault.toString();
}
]]>
</mx:Script>
... | [
0.03326555714011192,
-0.25081977248191833,
0.25007641315460205,
-0.2913677990436554,
-0.14886781573295593,
0.4545775055885315,
0.6374762654304504,
-0.2455066442489624,
-0.1781793236732483,
-0.32389307022094727,
-0.22770337760448456,
0.5702316164970398,
-0.36615464091300964,
0.2703939974308... | |
url="https://mywebservice.com/someFileThatRequiresBasicAuth.xml"
resultFormat="text"
result="resultHandler(event)"
fault="resultFailed(event)" />
<mx:Button id="apiButton"
label="Test API Command"
click="authAndSend(apiService)" />
<mx:TextArea id="apiResult" />
```
However, a standard basic aut... | [
0.20566639304161072,
0.13044747710227966,
0.49672338366508484,
-0.060386285185813904,
-0.19243668019771576,
-0.029989363625645638,
0.8768991231918335,
-0.2694772779941559,
0.0030155712738633156,
-0.4603826701641083,
-0.25660771131515503,
0.7452862858772278,
-0.3066679537296295,
0.160838350... | |
(no proxy).']
```
---
**EDIT:** Problem solved, after some attention from Adobe. See the posts below for a full explanation. This code will work for HTTP Authentication headers of arbitrary length.
```
import mx.utils.Base64Encoder;
private function authAndSend(service:HTTPService):void
{
var encoder:Base64... | [
0.43428897857666016,
0.09978797286748886,
0.24894267320632935,
-0.19029508531093597,
-0.10728660970926285,
-0.13496938347816467,
0.7498359084129333,
-0.4354468584060669,
0.1882672905921936,
-0.8146618604660034,
-0.2086043655872345,
0.5349603891372681,
-0.4144738018512726,
0.144992664456367... | |
service.send();
}
```
Finally received some attention from Adobe and got an answer on this. The problem with long HTTP Authentication headers is that, by default, the Base64Encoder class will inject newline characters every 72 characters. Obviously that causes a chunk of the base-64 encoded string to be interpreted as... | [
0.2537901997566223,
-0.07392877340316772,
0.2907293736934662,
-0.14191599190235138,
-0.17162452638149261,
-0.19869615137577057,
0.8003429174423218,
-0.12987415492534637,
-0.05756131932139397,
-0.6196253299713135,
-0.2989712357521057,
0.3920688331127167,
-0.23090505599975586,
0.134761825203... | |
the above example) `encoder.insertNewLines = false;` The default setting is true.
I've fixed the above code to work for arbitrarily long Authentication strings. | [
0.30174896121025085,
0.22211724519729614,
0.3192020356655121,
-0.30134764313697815,
0.40180110931396484,
-0.4079161584377289,
0.7176932096481323,
-0.21740761399269104,
0.2795608937740326,
-0.4002217650413513,
-0.18034031987190247,
0.6611807942390442,
-0.26187747716903687,
0.104397796094417... | |
We have an application in which admin members can add content for their subordinates to view. Their requirement is that it should be able to display Word, Excel, PowerPoint and PDF documents in a non-editable manner.
The one option that I found for doing this is to have the content loaded into a web browser component.... | [
0.4104703664779663,
0.37057414650917053,
0.26989665627479553,
0.10160347819328308,
0.06556679308414459,
-0.42700546979904175,
0.11652952432632446,
0.05604035407304764,
0.061123959720134735,
-0.4863298535346985,
-0.43719375133514404,
0.5032179951667786,
-0.1258258819580078,
-0.0377730093896... | |
enabled PDF viewer) need to be installed on all the machines that will be running the application, which implies expensive licensing fees.
Is there a better way to get this content to display on my forms in C#?
Possibly interesting as well:
Save the documents to XPS using Microsoft Office 2007 (or print them to an X... | [
-0.09629427641630173,
0.00370643544010818,
1.1977581977844238,
0.14577454328536987,
-0.18952669203281403,
-0.1874678134918213,
0.14008481800556183,
-0.21999672055244446,
0.008874183520674706,
-0.8147163987159729,
-0.41682466864585876,
0.7569695711135864,
-0.2625238597393036,
0.053081683814... | |
scaleFactor = 0.8;
for (int pageNum = 0; pageNum < docSeq.DocumentPaginator.PageCount; pageNum++)
{
DocumentPage docPage = docSeq.DocumentPaginator.GetPage(pageNum);
// FIX: calling GetPage without calling UpdateLayout causes a memory leak
((FixedPage)docPage.Visual).UpdateLayout();
RenderTargetBitmap... | [
-0.20316001772880554,
-0.11081399023532867,
1.0734593868255615,
-0.30910924077033997,
-0.356222540140152,
0.45947274565696716,
0.229616180062294,
-0.6835371255874634,
-0.188314750790596,
-0.5182199478149414,
-0.19529946148395538,
0.7023193836212158,
-0.19125141203403473,
-0.088967077434062... | |
//BitmapEncoder encoder = new PngBitmapEncoder(); // Choose type here ie: JpegBitmapEncoder, etc
encoder.Frames.Add(BitmapFrame.Create(renderTarget));
string pageImageFileName = string.Format("{0}-{1}.jpg", Path.Combine(Path.GetDirectoryName(xpsFileName), Path.GetFileNameWithoutExtension(xpsFileName)), pageNu... | [
0.20815326273441315,
-0.28837084770202637,
0.6199885010719299,
-0.2730281352996826,
-0.008688737638294697,
-0.018209557980298996,
0.500019907951355,
-0.5369245409965515,
-0.2206193059682846,
-0.5905912518501282,
-0.19205047190189362,
0.7053107619285583,
-0.08235344290733337,
0.011977157555... | |
We have taken an open-source application, released under GPL ver1.09 and have modified some parts of its source and have made some customisations/enhancements as per our requirement.
We are using this application for non-commercial, internal purposes only.
**Is it mandatory that we have to publish the modified code i... | [
0.9024821519851685,
0.25151047110557556,
0.07019038498401642,
0.03295477107167244,
0.03817840665578842,
-0.5310633778572083,
-0.08534184843301773,
0.04580206051468849,
-0.2453603595495224,
-0.21269844472408295,
-0.21132074296474457,
0.5495266318321228,
-0.18036438524723053,
0.0522334128618... | |
In the final stage of development I started looking at code to try to find some bad practices. I discovered that while accessing a page, I'm querying the DB n times (n is the number of rows of an HTML table) just to get the translation (different languages) for a given record... I immediately thought that was bad and I... | [
0.09281379729509354,
0.3359537720680237,
0.23822395503520966,
-0.17878274619579315,
-0.16040246188640594,
0.13645032048225403,
0.43299949169158936,
-0.5385123491287231,
-0.17932133376598358,
-0.6455867886543274,
0.2739463746547699,
0.35381650924682617,
-0.3024737536907196,
0.26158294081687... | |
to Objects. Execution time this way is also 0ms.
The environment where I'm running these test is a DB and Web server with 0% load on the same machine. It's only me using the application.
The question starts here. Since I have no performance difference **at all** should I avoid that optimization? Should I keep it in t... | [
0.1615668088197708,
0.23280993103981018,
0.14511393010616302,
0.18649044632911682,
-0.2136281281709671,
0.30863747000694275,
0.5763055682182312,
-0.3394433856010437,
-0.17335350811481476,
-0.683364748954773,
0.08224167674779892,
0.46966975927352905,
-0.09361875057220459,
0.1338692307472229... | |
have something in my brain that say it's wrong to optimize if there is no need...
Thanks for your opinion.
I don't think you've actually shown that there's no performance difference at all.
Try running the query a million times each way, and time how long it takes in total... I think you'll see a big difference.
The... | [
0.39295482635498047,
-0.20337408781051636,
0.06478176265954971,
0.22431214153766632,
0.09945663064718246,
0.014279933646321297,
0.29853641986846924,
0.04590221494436264,
-0.24707713723182678,
-0.7041164636611938,
0.37624669075012207,
0.6648614406585693,
-0.007959158159792423,
-0.2064696252... | |
The time taken in network latency returning the results
* The time taken converting the results into useful objects.
Of course, premature optimisation is a bad thing in general, but this does sound like a reasonable change to make - *if* you know that the contents of the tables won't change. | [
0.005366281606256962,
-0.04488684609532356,
0.32410186529159546,
0.22301331162452698,
0.06644446402788162,
-0.017584895715117455,
0.1587267369031906,
-0.14399275183677673,
-0.17957982420921326,
-0.62887042760849,
-0.11166968196630478,
0.44470927119255066,
-0.0216075349599123,
-0.1038963794... | |
I have a new website I'm working on that the client wants to keep a secret, but at the same time, I want to put an under construction page with some info on it. I would like to have everything except index.html require a user/password--index.html would be available to everyone.
I have the following, but I'm not sure w... | [
0.4117296636104584,
0.48461559414863586,
0.6058782935142517,
0.07459842413663864,
0.017063068225979805,
-0.6119542121887207,
0.46431973576545715,
-0.36790016293525696,
-0.23685646057128906,
-0.5276718139648438,
-0.3237158954143524,
0.46186888217926025,
-0.41327783465385437,
0.2847735285758... | |
I'm not exactly sure how.
```
AuthName "Restricted Area"
AuthType Basic
AuthUserFile /path/to/file/.htpasswd
AuthGroupFile /dev/null
<Files "*">
Require valid-user
</Files>
<Files "index.html">
Allow from all
Satisfy any
</Files>
``` | [
0.20153626799583435,
0.3613635301589966,
0.7659058570861816,
0.003976085223257542,
0.15098711848258972,
-0.4712178409099579,
0.30815818905830383,
-0.44242429733276367,
-0.02264009788632393,
-0.3286206126213074,
-0.728287935256958,
0.6541923880577087,
-0.34624984860420227,
0.016286121681332... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.