text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I need to create a keyed hash for a string of XML to send to a 3rd party. This is the code I am using but it is producing a different hash than the example that the 3rd party has sent me. I have been through all the tutorials I can find and re-read MSDN again and again. What am I doing wrong? Or should I suspect a prob... | [
0.13289804756641388,
0.056518182158470154,
0.5047991871833801,
-0.07495269924402237,
0.042329639196395874,
-0.18033741414546967,
0.4119577407836914,
-0.122989222407341,
-0.22619785368442535,
-0.7953134775161743,
-0.03660544008016586,
0.5885010361671448,
-0.19360895454883575,
0.582285165786... | |
Dim XML() As Byte = myEncoder.GetBytes(StringToHash)
Dim myHMACSHA256 As New System.Security.Cryptography.HMACSHA256(Key)
Dim HashCode As Byte() = myHMACSHA256.ComputeHash(XML)
Return Convert.ToBase64String(HashCode)
End Function
```
It needs to be base-64 encoded, which is why I have the last line.
Than... | [
0.016712112352252007,
-0.036826372146606445,
0.7242398262023926,
-0.22118522226810455,
-0.008670837618410587,
-0.026813263073563576,
0.34917211532592773,
-0.3921659588813782,
-0.003959003370255232,
-0.4223499298095703,
-0.2317730039358139,
0.787786602973938,
-0.25204136967658997,
-0.031419... | |
I'm currently writing a Java app that interfaces with a MySQL database.
My problem is that I'm trying to write a function that fills a JComboBox with the unique year-values registered in the database.
I could use UNIQE on the date-field in the SQL query, but that would only exclude some of the dates, not all-but-... | [
0.2570437490940094,
0.27528661489486694,
0.33743569254875183,
-0.0004968547145836055,
0.07155922800302505,
0.11827319860458374,
-0.2515178322792053,
0.30811163783073425,
-0.4101678133010864,
-0.4001728594303131,
0.20292678475379944,
-0.006823738105595112,
0.021544387564063072,
0.3800007700... | |
I am trying to set a cookie in my Google App Engine page:
```
self.response.headers.add_header('Set-Cookie','CookieName=1234; expires:Sun, 31-May-2009 23:59:59 GMT; path=/;')
```
The expiration date is not showing up in the browser. So it deletes itself at the end of the session.
Here is the output from curl -D:
... | [
-0.09379581362009048,
0.5292378664016724,
0.9352163076400757,
-0.1679246574640274,
-0.1913040280342102,
0.16884170472621918,
0.71169513463974,
-0.0071486192755401134,
0.1035948246717453,
-0.47490182518959045,
-0.19639573991298676,
0.3494323790073395,
-0.38711515069007874,
0.127620577812194... | |
Okay, I have done a bit of searching online and found [this](http://www.coderanch.com/t/100644/OO-Patterns-UML-Refactoring/Difference-between-Facade-Front-Controller) thread, but it still does not quite clear it up for me.
What exactly is the difference between a Front Controller Pattern and a Façade pattern?
As I un... | [
0.24436841905117035,
0.029497627168893814,
0.22313223779201508,
0.030544452369213104,
0.13065442442893982,
0.00998231116682291,
0.04917115718126297,
0.061133913695812225,
-0.20796602964401245,
-0.46392565965652466,
0.04056863859295845,
0.4562324285507202,
-0.33740338683128357,
0.2431000173... | |
a Façade to simplify converting the coordinates to points and then implementing the draw method that actually does the work?
```
private void drawLine(Int32 StartX, Int32 StartY, Int32 EndX, Int32 EndY)
{
Point Start = new Point(StartX, StartY);
Point End = new Point(EndX, EndY);
Draw(... | [
0.3071809709072113,
0.0209294892847538,
0.5084027051925659,
-0.05187714099884033,
0.14670898020267487,
-0.06428682059049606,
0.3415616452693939,
-0.3812789022922516,
0.13883674144744873,
-0.8117300271987915,
-0.45485401153564453,
0.6806551814079285,
-0.4055631756782532,
0.04030075296759605... | |
I understand it, the front controller coordinates the complete function call process.
Example: A Front controller would examine the data, and then decide what action to take. Then it would compile the data for each subsequent call to lower level classes, until it arrives at a suitable response that can be provided to ... | [
-0.058940012007951736,
0.017147500067949295,
0.07624027878046036,
0.0076763522811234,
0.06582166254520416,
0.05147375538945198,
0.07234861701726913,
-0.11910799890756607,
0.17732971906661987,
-0.35241276025772095,
-0.3063267469406128,
0.7031089663505554,
-0.46608400344848633,
-0.0130822295... | |
Architecture Guide 2.0](http://www.codeplex.com/AppArchGuide)? I'm specifically looking at the Service Architecture in chapter 18. (I have the Beta 2 version though)
**Update:** Thanks for a great response Rune. Why do you say it is not correct to change the Facade to a Front controller? I'm a big fan of the Front-con... | [
0.30994313955307007,
0.13467088341712952,
0.5873270630836487,
-0.06916067004203796,
-0.20602579414844513,
-0.34813740849494934,
0.3471622169017792,
-0.44348207116127014,
0.13411486148834229,
-0.8221074938774109,
-0.038711417466402054,
0.6995883584022522,
-0.19497497379779816,
-0.1353316456... | |
instance) channel requests through to consolidate standard behavior that needs to be performed each time.
See these links for short to the point explanations:
* [http://java.sun.com/blueprints/patterns/FrontController.html](http://web.archive.org/web/20120419115929/http://java.sun.com/blueprints/patterns/FrontContro... | [
0.2882314622402191,
-0.02384253591299057,
0.3539200723171234,
0.08374163508415222,
0.0351124107837677,
-0.16822102665901184,
0.36524686217308044,
-0.2972111999988556,
-0.20044662058353424,
-0.5304458141326904,
-0.19602590799331665,
0.46738067269325256,
-0.49619367718696594,
0.0618659183382... | |
I have two controls on a page, one is a search entry and submission control the other is the search results control, they have to be separated due to the layout of the site. Im looking at different ways of having the search control submit displaying the search results in the results control, initially im not bother abo... | [
0.41817596554756165,
-0.08823142945766449,
0.5069973468780518,
0.21575313806533813,
-0.16672836244106293,
-0.007138917688280344,
0.213401660323143,
-0.22113458812236786,
0.20127490162849426,
-0.5752172470092773,
-0.05936814472079277,
0.21903356909751892,
0.04693559184670448,
0.356526106595... | |
the page submit to itself.
apologies if this is a bit basic but im not an ASP.Net expert
There are several options, and sometimes a combination of these is useful:
* automated installation
* disk imaging
* virtualization
* source code control
Details on the various options:
1. **Automated Installation** Tools for ... | [
0.5656623244285583,
-0.3454877436161041,
0.3628612160682678,
0.262490838766098,
-0.1388121098279953,
0.02582380920648575,
0.11346816271543503,
-0.32739198207855225,
-0.24833202362060547,
-0.8359979391098022,
-0.11771664023399353,
0.3163031339645386,
-0.296347439289093,
0.14878013730049133,... | |
by default is zero-click, as it checks your machine periodically to make sure it is still configured as desired. It will detect when a file or mode has been changed, and fix the problem. I currently use this to maintain a handful of RedHat Linux boxes, though it's capable of handling thousands. (Does not support Window... | [
0.30384987592697144,
-0.4045405089855194,
0.41707369685173035,
0.04563003405928612,
-0.0913258045911789,
-0.4007563889026642,
0.1986071765422821,
0.0705886110663414,
-0.40729862451553345,
-0.6412697434425354,
0.08668646961450577,
0.6610234379768372,
-0.3160756826400757,
0.02420103363692760... | |
has examples of how to configure an Amazon EC2 image using shell scripts.
* Install packages. On a Unix box it's possible to do this entirely with packages, and on Windows msi may be an option. For example, [RubyWorks](http://studios.thoughtworks.com/rubyworks) provides you with a full Ruby on Rails stack, all by inst... | [
0.5577307343482971,
0.048361729830503464,
0.2740913927555084,
0.21226541697978973,
-0.11974816769361496,
-0.20725755393505096,
0.18277451395988464,
-0.10554724186658859,
-0.30705204606056213,
-0.833755373954773,
0.008905554190278053,
0.6092577576637268,
0.0358211025595665,
-0.0175830572843... | |
easy to restore things to a clean slate. Keeping things continuously up-to-date is still an issue--is it worth making new images just to propagate a configuration file change?
3. **[Virtualization](http://en.wikipedia.org/wiki/Full_virtualization)** is another option, for example making copies of a Xen, VirtualPC, or V... | [
0.5589984059333801,
-0.0696951374411583,
0.3326326012611389,
0.26495274901390076,
0.1109292209148407,
-0.5059678554534912,
0.40420204401016235,
0.15542231500148773,
-0.5071857571601868,
-0.8891313672065735,
-0.2576584815979004,
0.8990781307220459,
0.04952950030565262,
-0.09451805800199509,... | |
necessary tools installed/configured, then doing builds should be a matter of checking out what's needed from a source code repository and building it.
Currently I use a combination of the above to automate the process as follows:
* Start with a barebones OS install on a VMWare guest
* Run a shell script to install P... | [
0.6204748153686523,
-0.0848916545510292,
0.2594056725502014,
0.07423926889896393,
0.2880728840827942,
0.05977259948849678,
0.29468536376953125,
-0.3496031165122986,
-0.15373779833316803,
-0.820837140083313,
-0.09492453932762146,
0.7319198846817017,
0.023222940042614937,
0.05828126892447471... | |
Can you tell me: could I use twisted for p2p-applications creating? And what protocols should I choose for this?
The best solution is to use the source code for BitTorrent. It was built with Twisted until they switched over to a C++ implementation called Utorrent.
* Last known Twisted version of BitTorrent
+ <http://... | [
0.5856319069862366,
-0.24725529551506042,
0.3112948536872864,
0.14584748446941376,
-0.32381176948547363,
-0.08995818346738815,
0.2795165777206421,
-0.11371739953756332,
-0.15184949338436127,
-0.5407549738883972,
0.2224607914686203,
0.2197733223438263,
-0.2775057554244995,
0.137894049286842... | |
I have this code for doing an ajax request to a webservice:
```
var MyCode = {
req: new XMLHttpRequest(), // firefox only at the moment
service_url: "http://url/to/Service.asmx",
sayhello: function() {
if (this.req.readyState == 4 || this.req.readyState == 0) {
this.req.open("POST", t... | [
0.20072387158870697,
0.10163979232311249,
0.7195267081260681,
-0.15546636283397675,
0.17393741011619568,
-0.19517575204372406,
0.5733457803726196,
-0.24117401242256165,
0.15489326417446136,
-0.8214813470840454,
-0.40923964977264404,
0.3345501720905304,
-0.4095948338508606,
0.26237639784812... | |
var param = '{}';
this.req.send(param);
}
},
handleReceive: function() {
if (this.req.readyState == 4) {
// todo: using eval for json is dangerous
var response = eval("(" + this.req.responseText + ")"); | [
-0.19384492933750153,
-0.5788494944572449,
0.3227202594280243,
-0.2534071207046509,
-0.05333035811781883,
0.2587091624736786,
1.0101679563522339,
-0.7485805749893188,
-0.29797425866127014,
-0.07836263626813889,
-0.39715227484703064,
0.534899115562439,
-0.6913641691207886,
-0.15512989461421... | |
alert(response);
}
}
}
```
It is called with MyCode.sayhello() of course.
The problem with it is that "req is not defined" at the first line in the handleReceive function. It does get called 4 times, so I know the code above sends the request to the server.
How can I solve this?
Classic closure problem.... | [
0.21219632029533386,
-0.32012197375297546,
0.5990570187568665,
-0.3210545480251312,
0.032512061297893524,
-0.1023673340678215,
0.3579428493976593,
-0.2522447407245636,
-0.12385937571525574,
-0.5124128460884094,
-0.24959565699100494,
0.6714338064193726,
-0.5480364561080933,
0.07279165834188... | |
this;
this.req.onreadystatechange = function() { that.handleReceive(); };
``` | [
0.291420578956604,
-0.2655515670776367,
0.34782370924949646,
-0.31421545147895813,
0.5280373692512512,
0.04517669603228569,
0.25908997654914856,
-0.38308805227279663,
0.15364238619804382,
-0.3282732367515564,
-0.3841261863708496,
0.7928076982498169,
-0.35452985763549805,
0.2864506840705871... | |
I would really like to do something like this:
```
Callable<MyObject> myCallable = ....
Future<MyObject> = new Thread( myCallable).start();
```
I basically want to start a single long-running task that runs in parallel with my main task, and I do not want pooling or thread re-use. The Executors stuff seems to be v... | [
0.22585247457027435,
-0.24669808149337769,
0.3138875961303711,
0.09928900003433228,
0.3482501804828644,
-0.19232138991355896,
-0.1286434531211853,
0.21924611926078796,
-0.22041110694408417,
-0.5622842907905579,
0.19326043128967285,
0.5147881507873535,
-0.33191734552383423,
0.27619007229804... | |
on the Executor framework and can be instantiated as is, or you can extend it to customize it. | [
0.40692606568336487,
-0.11919061094522476,
0.449493944644928,
0.21376417577266693,
0.19687886536121368,
-0.5269315838813782,
-0.1715390682220459,
0.03896486014127731,
0.0072389524430036545,
-0.7269279360771179,
-0.3628295361995697,
0.5265507698059082,
-0.23646506667137146,
0.08634438365697... | |
This is one of my most dreaded C/C++ compiler errors:
> file.cpp(3124) : fatal error C1004: unexpected end-of-file found
file.cpp includes almost a hundred header files, which in turn include other header files. It's over 3000 lines. The code should be modularized and structured, the source files smaller. We should r... | [
0.3512691855430603,
0.25817790627479553,
0.6161883473396301,
0.2669430375099182,
0.1604282408952713,
0.38969630002975464,
0.2656261622905731,
0.006080323830246925,
-0.44720977544784546,
-0.6963303089141846,
0.09573513269424438,
-0.07038427889347076,
-0.015120009891688824,
0.098542734980583... | |
or similar.
The problem is that when something is missing, the compiler can't really tell me *where* it is missing. It just knows that when it reached end of the file it wasn't in the right parser state.
Can you offer some tools or other hints / methodologies to help me find the cause for the error?
If the #includes ... | [
0.30262425541877747,
0.371085524559021,
-0.386281281709671,
0.16373175382614136,
0.24791978299617767,
0.03846992924809456,
0.36561477184295654,
0.11554570496082306,
-0.2068990170955658,
-0.5209922194480896,
-0.07854416966438293,
0.45177748799324036,
-0.31779271364212036,
-0.024672662839293... | |
a slow method, but it might help you pinpoint the problem. | [
0.27174240350723267,
-0.05725545063614845,
0.01985481195151806,
0.34620437026023865,
0.07130683958530426,
0.06084228307008743,
0.1070617139339447,
-0.20643655955791473,
0.02732279896736145,
-0.5374761819839478,
0.3052978515625,
0.20594742894172668,
0.30481311678886414,
-0.233763188123703,
... | |
I have three tables
* A: A.pID primary key, A.Name nvarchar(250)
* B: B.pID primary key, B.Name nvarchar(250)
* C: C.pID primary key, C.Name nvarchar(250)
There is a m to n relation between A and B (table `lA_B` with primary key `lA_B.pID` and `.pInstanceA` Foreign key to table A and `.pInstanceB` Foreign key to tab... | [
-0.41164258122444153,
0.3397226929664612,
0.4030924141407013,
-0.18832631409168243,
-0.036301761865615845,
0.7724080681800842,
-0.04622071608901024,
-0.3112339973449707,
-0.20415620505809784,
-0.6363936066627502,
0.09700542688369751,
0.27956512570381165,
-0.14664795994758606,
0.38232102990... | |
C3
* A3 is in relation with B4
* A4 is in relation with C4
* A5 has no relation
Here is my SQL:
```
CREATE TABLE [dbo].[A]( [pID] [bigint] NOT NULL, [Name] [nvarchar](250) NULL )
CREATE TABLE [dbo].[B]( [pID] [bigint] NOT NULL, [Name] [nvarchar](250) NULL )
CREATE TABLE [dbo].[C]( [pID] [bigint] NOT NULL, [Name] [nva... | [
-0.2735891342163086,
0.43277689814567566,
0.2101307213306427,
-0.5091296434402466,
-0.31433409452438354,
0.33955293893814087,
0.4741732180118561,
-0.6431921720504761,
-0.4135524034500122,
-0.03987496346235275,
-0.3509984016418457,
0.2299439013004303,
-0.5288125276565552,
-0.058264635503292... | |
[dbo].[A] ([pID] ,[Name]) VALUES (5,'A5')
INSERT INTO [dbo].[B] ([pID] ,[Name]) VALUES (1,'B1')
INSERT INTO [dbo].[B] ([pID] ,[Name]) VALUES (2,'B2')
INSERT INTO [dbo].[B] ([pID] ,[Name]) VALUES (3,'B3')
INSERT INTO [dbo].[B] ([pID] ,[Name]) VALUES (4,'B4')
INSERT INTO [dbo].[C] ([pID] ,[Name]) VALUES (1,'C1')
INSERT... | [
0.14943107962608337,
0.5067434906959534,
0.24641212821006775,
-0.15164953470230103,
-0.07541514188051224,
0.7550643682479858,
0.21678264439105988,
-0.41289666295051575,
0.01847650855779648,
-0.3531002998352051,
-0.4451204240322113,
-0.047161076217889786,
-0.4106666147708893,
0.412061512470... | |
([pID],[pInstanceA],[pInstanceB]) VALUES (2,2,2)
INSERT INTO [dbo].[lA_C] ([pID],[pInstanceA],[pInstanceB]) VALUES (3,2,3)
INSERT INTO [dbo].[lA_C] ([pID],[pInstanceA],[pInstanceB]) VALUES (4,4,4)
```
this query:
```
SELECT
A.Name AS A,
B.Name AS B,
C.Name AS C
FROM
A
left JOIN lA_B ON (A.... | [
-0.12053854763507843,
0.43987759947776794,
0.2527109384536743,
-0.16548967361450195,
-0.15607985854148865,
0.6865261197090149,
-0.02951340191066265,
-0.541563093662262,
-0.35459160804748535,
-0.21820199489593506,
-0.06359798461198807,
0.07713323086500168,
-0.27357468008995056,
0.2510803639... | |
B2 C1
A2 B3 C2
A2 B3 C3
A3 B4 NULL
A4 NULL C4
A5 NULL NULL
```
And now the question :-)
how to query to receive
```
A1 B1 NULL
A1 B2 NULL
A1 | [
-0.3008215129375458,
0.07801514863967896,
0.14368568360805511,
-0.10095217078924179,
-0.4472474455833435,
0.3004542887210846,
0.3902382552623749,
-0.4036048948764801,
-0.33381539583206177,
-0.08685190230607986,
-0.0343904085457325,
0.19681993126869202,
-0.42731747031211853,
0.0731474906206... | |
NULL C1
A2 B3 NULL
A2 NULL C2
A2 NULL C3
A3 B4 NULL
A4 NULL C4
A5 NULL NULL
```
The problem is that when I make the join both with B and with C the result has all the combinations of B C. How can | [
-0.07496969401836395,
0.33894026279449463,
0.09830408543348312,
-0.3812316656112671,
-0.31017035245895386,
-0.06502481549978256,
0.542528510093689,
-0.5825564861297607,
-0.38644421100616455,
-0.09959226101636887,
-0.09552758932113647,
-0.04386904463171959,
-0.3744284212589264,
0.2999786138... | |
I eliminate this?
You might be able to do that with a UNION:
```
SELECT A.Name AS A, B.Name AS B, NULL AS C
FROM A
left JOIN lA_B ON (A.pID=lA_B.pInstanceA)
left JOIN B ON (lA_B.pInstanceB=B.pID)
UNION
SELECT A.Name AS A, NULL AS B, C.Name AS C
FROM A
left JOIN lA_C ON (A.pID=lA_C.pInstanceA)
left JOIN C ON (lA_C... | [
0.1007629781961441,
0.040043748915195465,
0.12117841839790344,
0.01608734391629696,
0.012360956519842148,
0.027681859210133553,
-0.013262961059808731,
-0.3528635799884796,
-0.14927706122398376,
-0.5350909233093262,
0.1634587198495865,
0.21806597709655762,
-0.7661176323890686,
0.11900584399... | |
JOIN lA_B ON (A.pID=lA_B.pInstanceA)
LEFT JOIN B ON (lA_B.pInstanceB=B.pID)
WHERE b.name is not null
or not exists(select * from lA_C where A.pID=lA_C.pInstanceA)
UNION
SELECT A.Name AS A, NULL AS B, C.Name AS C
FROM A
LEFT JOIN lA_C ON (A.pID=lA_C.pInstanceA)
LEFT JOIN C ON (lA_C.pInstanceB=C.pID)
WHERE c.na... | [
-0.09706351161003113,
0.039614059031009674,
0.6773424744606018,
-0.14181667566299438,
0.27039146423339844,
0.21510617434978485,
-0.11723999679088593,
-0.33139708638191223,
-0.0886954665184021,
-0.5226759314537048,
-0.13135169446468353,
0.08973067998886108,
-0.6221395134925842,
0.4082173705... | |
join on B.
Note that UNION filters out duplicate rows, like DISTINCT. To include every row, you can use UNION ALL. | [
0.2351451963186264,
-0.03870297595858574,
0.08304455876350403,
-0.09435274451971054,
-0.08250682801008224,
0.010646970942616463,
0.06322042644023895,
-0.1925128698348999,
-0.19413651525974274,
-0.5916493535041809,
-0.05032525956630707,
-0.10337044298648834,
-0.6901653409004211,
0.414202630... | |
There are many examples of using REST with simple data models. For example a customer with 5 properties and a collection of orders with 6 properties. However I have a hard time visualizing using REST against a model that is more complex -- that you may find in government procurement, finance, medical records management... | [
0.3901479244232178,
-0.057664044201374054,
0.2873442769050598,
0.10749683529138565,
-0.015902213752269745,
0.21655236184597015,
0.16966019570827484,
-0.13183343410491943,
-0.12824702262878418,
-0.856662929058075,
0.002764378907158971,
0.742972731590271,
-0.10951220989227295,
-0.03196836262... | |
have more than a 1000. This is an ERP application that covers accounting, inventory, sales, labour costing, engineering, etc.
The size or complexity of a single resource is not directly related to REST but more a concern of the media types. I chose to take the route of defining my own media type as I am building the c... | [
0.32228296995162964,
-0.04669032245874405,
0.27896809577941895,
0.2593625783920288,
0.02832656539976597,
0.12638600170612335,
-0.0075632622465491295,
0.08956015855073929,
-0.24002808332443237,
-0.6721681356430054,
-0.029283732175827026,
0.3850044310092926,
0.0214348416775465,
0.15344095230... | |
application/json or application/xml and then use downloaded javascript in the browser to interpret the format.[1] That works as long as the only client you have is a browser and you don't want anyone else to re-use your interface. For me it seems to defeat one of the main goals of REST, i.e serendipitous re-use due to ... | [
0.19763357937335968,
0.019479651004076004,
0.16577807068824768,
0.14623364806175232,
-0.10116223990917206,
-0.3251696527004242,
-0.13600946962833405,
0.08289558440446854,
-0.13679958879947662,
-0.8474394679069519,
-0.46633172035217285,
0.5047522783279419,
-0.301003098487854,
0.021289769560... | |
you are creating hidden coupling between the client and the server. If instead you use the media format "application/vnd.mycompany.myformat+xml" you are explicitly defining a contract with the client. This has a huge advantage when you make changes to the format and you have the option to create "application/vnd.mycomp... | [
0.3984164893627167,
-0.3027069866657257,
0.5851779580116272,
0.14743159711360931,
0.11161733418703079,
-0.37901583313941956,
-0.078650563955307,
-0.09099005907773972,
-0.11006103456020355,
-0.7095698714256287,
-0.28553250432014465,
0.8430868983268738,
-0.1975375860929489,
0.126832500100135... | |
are breaking the contract.
Web applications that use downloaded javascript can consume "application/xml" because the details of the contract are not compiled into the client. However, the client's behaviour is extremely limited to doing whatever the javascript has been preprogrammed to do. Unfortunately, the majority... | [
0.45271480083465576,
0.2154630422592163,
0.5455864667892456,
-0.03120046854019165,
-0.08035797625780106,
-0.4038991630077362,
0.5333387851715088,
0.24039767682552338,
-0.4170544147491455,
-0.43199530243873596,
-0.17090992629528046,
0.5407177805900574,
-0.7222164869308472,
-0.05764789506793... | |
We have a Struts 2 web application that's used by pretty much every employee to manage and configure jobs for our server farm. We're working on a plan to make a dashboard for customers, so they can see their own jobs, and a very simple display of its status ("in process", "ready for proofing", "finished", etc). All of ... | [
0.3591211438179016,
0.13891878724098206,
0.37767428159713745,
0.16135255992412567,
0.018248425796628,
0.1802276074886322,
0.2892931401729584,
-0.18020126223564148,
-0.005968329031020403,
-0.3937385082244873,
0.26892369985580444,
0.39356547594070435,
-0.17022663354873657,
-0.235608294606208... | |
one more complex and controllable.
The naive way to do this, is to have if/elses in every single jsp:
```
<s:if test="user.role == 'customer'">
<!-- TODO - Display simple customer view -->
</s:if>
<s:else>
<!-- TODO - Display complex employee view -->
</s:else>
```
Is there a simpler way to do this? Can I c... | [
0.003632138716056943,
-0.20380960404872894,
0.0658370703458786,
0.07246352732181549,
-0.1846875697374344,
0.019678711891174316,
-0.03680223226547241,
-0.34375107288360596,
-0.15764829516410828,
-0.4932399392127991,
0.04264599829912186,
0.6756568551063538,
-0.4297710359096527,
-0.1301646828... | |
few so-called server side push technologies like - AjaxPush, Comet or even some commercial products like [kaazing gateway](http://www.kaazing.com/) & [lightstreamer](http://www.lightstreamer.com/) | [
-0.13152919709682465,
-0.3453620672225952,
0.24980738759040833,
0.16078773140907288,
-0.18334552645683289,
-0.2091570943593979,
0.18746566772460938,
0.39820805191993713,
-0.3700309097766876,
-0.522737443447113,
-0.06026794761419296,
-0.18186867237091064,
-0.11122073233127594,
0.03469650819... | |
In C, how to configure the initial settings for some program, using key-value pairs, with any or all of: a plain text [configuration file](http://en.wikipedia.org/wiki/Configuration_file), environment variables, and options on the command line. Also, how to decide which method's values overide those from either of the ... | [
0.28180253505706787,
0.14081041514873505,
-0.12163137644529343,
-0.030888058245182037,
0.18417756259441376,
-0.1819135993719101,
-0.14675737917423248,
0.009574412368237972,
0.03510311618447304,
-0.49703431129455566,
-0.34993162751197815,
0.785793125629425,
-0.3764960467815399,
-0.417224645... | |
variables, you can use the getenv function defined in stdlib.h.
* To configure your program using command line arguments, declare your main function like 'int main(int argc, const char\* const\* argv)', and use a loop to go over the arguments in the argv array. It's size is given by argc.
* To configure your program us... | [
0.35677579045295715,
-0.2339668720960617,
0.3152787685394287,
0.18312281370162964,
-0.03546043112874031,
0.2539820373058319,
-0.006294481456279755,
-0.19737406075000763,
-0.18949058651924133,
-0.3540094792842865,
0.19318953156471252,
0.7944757342338562,
-0.3005354702472687,
0.1778450012207... | |
but in my opinion generally commandline argument > environment variable > configuration file makes most sense.
Here is an example of getting configuration from environment and commandline, with commandline overriding environment:
```
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, const... | [
-0.04478229209780693,
-0.14896269142627716,
0.28914907574653625,
-0.1558636873960495,
0.25633755326271057,
-0.1215929463505745,
0.24393640458583832,
-0.2641812562942505,
-0.12298154085874557,
-0.7709078192710876,
-0.2662678360939026,
0.8177560567855835,
-0.34535977244377136,
0.097143366932... | |
commandline arguments
// start at 1, because argv[0] contains the name of the program
for (i = 1; i < argc; ++i) {
if (strcmp("--my-config-var", argv[i]) == 0) {
if (i + 1 < argc)
myConfigVar = argv[i + 1];
else | [
-0.26478472352027893,
-0.17674332857131958,
0.6061029434204102,
-0.33905166387557983,
0.08269020169973373,
0.1377597600221634,
0.2913101017475128,
-0.2624395787715912,
0.015232841484248638,
-0.29704177379608154,
-0.33961236476898193,
0.4991523325443268,
-0.21452143788337708,
0.211611092090... | |
printf("missing value for my-config-var argument\n");
}
}
printf("myConfigVar = '%s'\n", myConfigVar);
return 0;
}
```
You already see it becomes very long and tedious very soon, so better use an existing library if one exists for your desired target platform(s), or at least factor this kind of c... | [
0.11647381633520126,
0.053425103425979614,
0.3872382640838623,
0.024476265534758568,
0.2545047700405121,
-0.1363033503293991,
0.3978414833545685,
-0.01903936266899109,
0.009363371878862381,
-0.8040944933891296,
-0.31637054681777954,
0.6811908483505249,
-0.4405934512615204,
-0.0278534740209... | |
configure the settings file to read some settings from the environment and some from the commandline, for example. It really depends on type and size of the application and your target audience whether this is worth doing though. | [
0.39842942357063293,
-0.08907712250947952,
0.4687168002128601,
0.29659801721572876,
0.20611563324928284,
-0.24528828263282776,
0.3611706793308258,
-0.14724300801753998,
0.09436909854412079,
-0.5989958643913269,
-0.10818233340978622,
0.8708305954933167,
-0.010235587134957314,
-0.40382069349... | |
is there any javascript library that provides me with a custom event as soon as a certain element becomes visible in the browser canvas?
the basic idea is, as soon as the last element in a list becomes visible on the screen, i want to load the next 10 elements so that the user does not need to click on the "next page... | [
0.4802168011665344,
-0.22221283614635468,
0.0795900821685791,
0.060051556676626205,
-0.20852001011371613,
-0.30699262022972107,
0.2696561813354492,
-0.01369564514607191,
-0.41443297266960144,
-0.581342875957489,
0.08023687452077866,
0.5264964699745178,
-0.258544921875,
-0.12099848687648773... | |
jQuery.
```
$.belowViewport = function(elem){
var port = $(window).scrollTop() + $(window).height();
return port <= $(elem).offset().top;
}
$.fn.onBecomeVisible = function( fn ){
var obj = this;
$(window).scroll( function() {
obj.each( function() {
if(!$.belowViewport(this) && !$(this).data('scrollE... | [
-0.17105072736740112,
-0.1169469878077507,
1.1923940181732178,
-0.3244326710700989,
0.22616522014141083,
0.3348919451236725,
0.3250289857387543,
-0.5603681206703186,
-0.008116472512483597,
-0.568254292011261,
-0.36536428332328796,
0.8454152345657349,
-0.3583935797214508,
-0.010236663743853... | |
view. The function will also be passed which element has fired the event.
Note that you can not bind this event using live so you will have to rebind it after adding new elements (presuming you want the event on the last one of those too.).
**EDIT**
I was wrong here, :visible does not return wether or not an elem... | [
0.13715797662734985,
-0.1613806039094925,
0.47062212228775024,
-0.02479751780629158,
-0.26138097047805786,
-0.20940567553043365,
0.5740464329719543,
-0.1560937464237213,
-0.30549508333206177,
-0.5323777794837952,
-0.0933736190199852,
0.693296492099762,
-0.41792944073677063,
-0.086713500320... | |
viewport it has been scrolled into view and that we should execute the function.
**EDIT2**
Tested this in google chrome 1.0, firefox 3.0.10 and IE7 | [
0.2140076756477356,
-0.17235368490219116,
0.9637741446495056,
-0.29331347346305847,
0.04491027817130089,
-0.3266768455505371,
0.12038114666938782,
-0.2629762291908264,
0.13855981826782227,
-0.9303339123725891,
0.07088810950517654,
0.8950114846229553,
-0.37699955701828003,
-0.43643739819526... | |
Are there any lightweight tools that allow easy-to-read crafting of SQL independently of the main apps/utilities associated with a particular database?
I lately find myself working with MySQL, Access & now MS-SQL and use Notepad++ to build queries as it provides basic syntax highlighting that helps my unfamiliar eyes,... | [
-0.012591474689543247,
0.20384429395198822,
-0.04293343797326088,
0.29942914843559265,
-0.19849441945552826,
-0.01891140267252922,
-0.14138568937778473,
0.2725650370121002,
-0.4071548581123352,
-0.7301732301712036,
0.3255680501461029,
0.36174100637435913,
0.12335516512393951,
-0.0628479495... | |
a button and have it displayed in a more human-friendly format.
Does such a tool exist?
**Edit:** Thanks for the suggestions. In particular, SQLinForm has the kind of fine-grained control I was ideally imagining.
Pity only the online version is free, an OSS standalone app (not Java - gumph!) would be preferable as S... | [
0.3176513910293579,
-0.11424102634191513,
0.4401165544986725,
0.16270801424980164,
-0.1437024027109146,
-0.0959012433886528,
0.2053212970495224,
0.12725049257278442,
-0.4762163758277893,
-0.47161614894866943,
0.05793854594230652,
0.6376187801361084,
-0.20893234014511108,
-0.257145136594772... | |
right thing when I checked. Searching on the tool names, [or via Google](https://stackoverflow.uservoice.com/pages/1722-general/suggestions/181675-use-google-search-instead-on-the-inbuilt-one), brings up many similar questions - voted to close.
I've used [SQLInform](http://www.sqlinform.com/) in the past with pretty go... | [
0.12332000583410263,
0.11182378977537155,
0.35341405868530273,
-0.03705814108252525,
-0.04544222354888916,
-0.20670755207538605,
-0.047173094004392624,
-0.007526861969381571,
-0.16969417035579681,
-0.38421961665153503,
0.2582171559333801,
0.5402783155441284,
0.16240808367729187,
0.01389034... | |
I'm creating a starter kit that installs the compiled assemblies from an open-source project into the GAC to make it easier to reference the assemblies in the template. Since they're going in the GAC, they need to be signed.
Do I need to password protect and secure the key file, or is it okay to leave it open and incl... | [
0.6065968871116638,
0.3491484820842743,
0.0484803169965744,
-0.0699029415845871,
0.07432835549116135,
-0.5353351831436157,
0.43518808484077454,
-0.33769407868385315,
-0.17003905773162842,
-0.42805495858192444,
-0.17330874502658844,
0.35580727458000183,
-0.06488842517137527,
0.0060955360531... | |
version of a specific assembly, which is required by the GAC. The other usage, which is preventing spoofing by other assemblies, doesn't seem necessary in this case (correct me if I'm wrong). For this reason, I would believe that it's perfectly acceptable to leave the key open (not password protected) and include the f... | [
0.24984736740589142,
-0.10214214026927948,
0.29251202940940857,
-0.1303204894065857,
0.0047506485134363174,
-0.7163164615631104,
0.5510287880897522,
0.04228045791387558,
-0.3715938329696655,
-0.37002643942832947,
-0.5593411922454834,
0.4920693337917328,
-0.4268215596675873,
0.1528634577989... | |
a great thorough discussion of how to properly use strong name signing in general. | [
0.08041945844888687,
0.36249488592147827,
0.019037282094359398,
-0.22219394147396088,
0.0025508322287350893,
-0.4157228469848633,
0.35897818207740784,
-0.07155323773622513,
0.08786991238594055,
-0.5834429264068604,
0.037169646471738815,
0.23755745589733124,
0.36899513006210327,
-0.28072670... | |
I'm subclassing QProgressBar in a custom widget, and I overwrote the **paintEvent** method with the following code :
```
void myProg::paintEvent(QPaintEvent *pe)
{
QProgressBar::paintEvent(pe);
QRect region = pe->rect();
QPainter *painter = new QPainter(this);
QPen *pen = new QPen;
painter->begin(... | [
0.1798684448003769,
-0.1323765218257904,
0.6764888167381287,
-0.39537519216537476,
-0.03405267372727394,
0.4878764748573303,
0.46840593218803406,
-0.7304926514625549,
0.26910001039505005,
-0.9344095587730408,
0.02457638457417488,
0.4127289056777954,
-0.14293919503688812,
0.1459055095911026... | |
add my own modifications to the widget. However, this isn't working. I only see the widget as a regular QProgressBar. Any ideas on what could be wrong ?
The coordinate system you need to use is relative to the top-left of the widget, but you're apparently using one relative to the widget's parent. (Widget's x and y coo... | [
0.5536929368972778,
-0.003731440519914031,
0.503188967704773,
0.1780136078596115,
0.07437065243721008,
-0.0358499251306057,
0.2623988687992096,
-0.0039486875757575035,
-0.06255285441875458,
-0.6815354824066162,
0.1815471351146698,
0.3280678689479828,
-0.21728651225566864,
0.364396631717681... | |
a painter on the heap with `new`: I'd just create it on the stack.
Try:
```
void myProg::paintEvent(QPaintEvent *pe)
{
QProgressBar::paintEvent(pe);
QRect region = pe->rect();
QPainter painter(this);
QPen pen(Qt::red); //Note: set line colour like this
//(Brush line removed; not necessary when d... | [
-0.0843241810798645,
-0.4307929575443268,
0.6488388180732727,
-0.3411693572998047,
-0.31684181094169617,
0.5883291959762573,
0.36158275604248047,
-0.5742560029029846,
0.03662755340337753,
-0.9507580995559692,
0.026489805430173874,
0.2660289406776428,
-0.08073604106903076,
0.095094762742519... | |
of the widget. | [
-0.042528364807367325,
0.28909388184547424,
-0.016240965574979782,
0.29920992255210876,
-0.14764316380023956,
-0.40633586049079895,
-0.12887002527713776,
-0.03025553934276104,
0.2642889618873596,
-0.3072357177734375,
-0.12333614379167557,
0.3660379648208618,
-0.20849330723285675,
0.4900898... | |
I'm creating a C api that hides some functionality in a DLL file.
Since everything is C++ on the inside most of the functions works against handles which maps directly to this pointers on the inside of the API.
To get a some degree of type safety for those handles I define them like this:
```
typedef struct MyType1*... | [
0.39777570962905884,
0.45703378319740295,
0.18496258556842804,
-0.1628241240978241,
-0.11849304288625717,
0.038780827075242996,
0.08635742217302322,
-0.4055251181125641,
0.06204326078295708,
-0.5354554653167725,
0.21405982971191406,
0.4519575834274292,
-0.5778681635856628,
0.15156243741512... | |
a clr project in visual studio I get this `warning: unresolved typeref token (token) for 'type'; image may not run.`
<http://msdn.microsoft.com/en-us/library/h8027ys9(VS.80).aspx>
It's no big deal since it works, but it looks unprofessional.
I don't like using void\*:
```
typedef void* MyType1Handle;
typedef void* ... | [
0.06726090610027313,
0.13930988311767578,
0.4675537049770355,
-0.1056111752986908,
0.0031275295186787844,
-0.2376091331243515,
0.14651262760162354,
-0.26064029335975647,
-0.14907778799533844,
-0.4129999577999115,
-0.0010075380560010672,
0.5301983952522278,
-0.48466381430625916,
-0.00642244... | |
of getting a platform specific pointer sized integer. It has the same type safety problems as the void\* as well.
Another approach I tried was to do it like this:
```
struct MyType1{};
typedef struct MyType1* MyType1Handle;
```
This didn't work in C since empty structs is invalid C code. I could of course extend my... | [
0.20722083747386932,
0.13511574268341064,
0.219482883810997,
-0.01763242296874523,
-0.2846561074256897,
-0.12808798253536224,
0.13139216601848602,
-0.2561987638473511,
-0.08604536205530167,
-0.5566093921661377,
0.2259611040353775,
0.4047434628009796,
-0.48718753457069397,
0.175981327891349... | |
this:
```
struct HWND__ { int unused; }; typedef struct HWND__ *HWND
```
in fact they have a macro for this:
```
#define DECLARE_HANDLE(name) struct name##__{int unused;}; typedef struct name##__ *name
```
so.. this seems to be a common practice to do so.
Unfortunately I can't make another suggestion except this ... | [
0.11975015699863434,
0.21277382969856262,
0.31747302412986755,
-0.14174413681030273,
0.12359356880187988,
-0.1251385509967804,
0.08096843957901001,
0.05135657265782356,
-0.2561112642288208,
-0.670624315738678,
0.08602936565876007,
0.5724200010299683,
-0.04240693151950836,
0.215887159109115... | |
I'm looking for a way to allow a property in a C# object to be set once only. It's easy to write the code to do this, but I would rather use a standard mechanism if one exists.
```
public OneShot<int> SetOnceProperty { get; set; }
```
What I want to happen is that the property can be set if it is not already set, b... | [
0.3802899122238159,
-0.01822042651474476,
0.12184662371873856,
-0.15215924382209778,
-0.059956565499305725,
-0.5064447522163391,
0.20106400549411774,
-0.20322583615779877,
-0.3867958188056946,
-0.653613805770874,
-0.1046130433678627,
0.7870978713035583,
-0.3691350519657135,
0.0739827230572... | |
.NET 4.0;
(edit: the above sentence was written in anticipation of `System.Threading.WriteOnce<T>` which existed in the "preview" bits available at the time, but this seems to have evaporated before the TPL hit RTM/GA)
until then just do the check yourself... it isn't many lines, from what I recall...
something lik... | [
0.4981782138347626,
-0.2464253455400467,
0.4075140058994293,
-0.1398279368877411,
0.05798015370965004,
-0.49507492780685425,
0.7164121866226196,
-0.10503534972667694,
-0.08737295120954514,
-0.6302535533905029,
-0.19798743724822998,
0.5767669677734375,
-0.544690728187561,
0.1048407480120658... | |
{
get
{
if (!hasValue) throw new InvalidOperationException("Value not set");
return value;
}
set
{
if (hasValue) throw new InvalidOperationException("Value already set"); | [
-0.17420969903469086,
-0.259788453578949,
0.36376485228538513,
-0.23183812201023102,
0.3605688810348511,
-0.1158849447965622,
0.3367196321487427,
-0.15291287004947662,
-0.04202770069241524,
-0.6613982915878296,
-0.7217081785202026,
0.6451370120048523,
-0.24920623004436493,
-0.0692917332053... | |
this.value = value;
this.hasValue = true;
}
}
public T ValueOrDefault { get { return value; } }
public static implicit operator T(WriteOnce<T> value) { return value.Value; }
}
```
Then use, for example:
```
readonly WriteOnce<string> name = new WriteOnce<string>();
public WriteOnce<s... | [
-0.1814177930355072,
-0.2316911667585373,
0.3219607472419739,
-0.28642913699150085,
0.14628982543945312,
-0.08742101490497589,
0.3395750820636749,
-0.3078669011592865,
0.08280478417873383,
-0.47482916712760925,
-0.5263257026672363,
0.8275213241577148,
-0.3866572976112366,
0.059701636433601... | |
I have a Path (a star figure):
```
<Path x:Name="NiceStar" StrokeThickness="10" Stroke="#ff000000" StrokeMiterLimit="1" Data="F1 M 126.578613,11.297852 L 162.373535,83.825684 L 242.412598,95.456055 L 184.495605,151.911133 L 198.167480,231.626953 L 126.578613,193.990234 L 54.988770,231.626953 L 68.661621,151.911133 L 1... | [
-0.4085053503513336,
-0.18844175338745117,
0.9170499444007874,
0.006891022436320782,
-0.19154155254364014,
0.2943792939186096,
0.5703893303871155,
-0.3458622992038727,
0.17528124153614044,
-0.810981273651123,
0.238457590341568,
0.5726808309555054,
0.058835718780756,
0.15409158170223236,
... | |
<GradientStop Offset="0" Color="#ff00ff00"/>
<GradientStop Offset="1" Color="#ff006736"/>
</RadialGradientBrush>
</Path.Fill>
</Path>
```
Now I want to duplicate this Path several times (just refering to "NiceStar"). Can I do this in pure XAML?
I can use it once, by doing this:
```
<Decorato... | [
-0.18656040728092194,
-0.3761937916278839,
0.7538546323776245,
-0.09862145036458969,
-0.11744534969329834,
0.1341576725244522,
0.171037495136261,
-0.3068143129348755,
-0.0024633442517369986,
-0.6275484561920166,
0.36421141028404236,
0.6510406136512756,
-0.33613845705986023,
-0.117098301649... | |
Value="#FF000000"/>
<Setter Property="StrokeMiterLimit" Value="1"/>
<Setter Property="Data" Value="F1 M 126.578613,11.297852 L 162.373535,83.825684 L 242.412598,95.456055 L 184.495605,151.911133 L 198.167480,231.626953 L 126.578613,193.990234 L 54.988770,231.626953 L 68.661621,151.911133 L 10.744629,95.456055 L... | [
-0.8604789972305298,
-0.6342052817344666,
0.9636990427970886,
-0.10751917958259583,
-0.1626671999692917,
0.593783438205719,
0.18166716396808624,
-0.5426568388938904,
0.13883917033672333,
-0.6109709143638611,
0.5242650508880615,
0.6981549263000488,
0.14158792793750763,
0.0607718862593174,
... | |
<MatrixTransform Matrix="1,0,-0,-1,-263.816895,569.592773" />
</RadialGradientBrush.Transform>
<GradientStop Offset="0" Color="#ff00ff00"/>
<GradientStop Offset="1" Color="#ff006736"/>
</RadialGradientBrush>
</Setter.Value>
</Setter>
</Style>
```
... | [
-0.4475759267807007,
-0.6041654944419861,
0.8514969348907471,
0.046648118644952774,
-0.054815322160720825,
0.3326263129711151,
0.08929058909416199,
-0.31376370787620544,
-0.19680792093276978,
-0.7387949824333191,
0.1297198086977005,
0.6043652296066284,
-0.307501882314682,
-0.11307908594608... | |
How can I deny access to a file I open with fstream? I want to unable access to the file while I'm reading/writing to it with fstream?
You cannot do it with the standard fstream, you'll have to use platform specific functions.
On Windows, you can use [CreateFile()](http://msdn.microsoft.com/en-us/library/aa363858(VS.8... | [
0.34134307503700256,
0.16785968840122223,
0.12456198781728745,
0.1031760647892952,
-0.10815849900245667,
-0.38505855202674866,
0.38488125801086426,
-0.2744370698928833,
-0.14783258736133575,
-0.3683500587940216,
-0.13678275048732758,
0.48003658652305603,
-0.5611405968666077,
0.343497842550... | |
out anyway? There might be a better solution... | [
0.4729852080345154,
0.013479474931955338,
0.15961094200611115,
-0.010261737741529942,
0.0030094850808382034,
0.06520776450634003,
0.319221556186676,
-0.20882681012153625,
-0.1137884333729744,
-0.039009273052215576,
-0.009040542878210545,
0.17066796123981476,
-0.1446039080619812,
-0.0861786... | |
How can the following function be implemented in various languages?
Calculate the `(x,y)` point on the circumference of a circle, given input values of:
* Radius
* Angle
* Origin (optional parameter, if supported by the language)
The [parametric equation for a circle](http://en.wikipedia.org/wiki/Circle#Equations) is... | [
0.036862295120954514,
0.011820278130471706,
0.332130491733551,
0.02434348501265049,
-0.16413865983486176,
0.162656769156456,
-0.012657688930630684,
-0.45784035325050354,
-0.13788306713104248,
-0.3684327304363251,
0.09238068014383316,
0.38886889815330505,
0.01980503648519516,
-0.00128805311... | |
I have some clients who are not English speaking. They would like the JavaScript I write for them to be in another language.
Can browsers understand other languages, or am I limited to non-English comments?
```
navigateur.nomApp.indice("Microsoft")
```
Instead of :
```
navigator.appName.indexOf("Microsoft")
```
Y... | [
0.18783563375473022,
0.34929338097572327,
0.23336726427078247,
-0.11839579045772552,
-0.1217619925737381,
-0.007548458408564329,
0.5082974433898926,
0.43322494626045227,
-0.050095491111278534,
-0.9502243399620056,
-0.11443715542554855,
0.5052104592323303,
-0.3317863643169403,
-0.0035616171... | |
In the late years of college, I had a course on Compilers. We created a compiler for a subset of C. I have always wondered how a pass-by-ref function call is compiled into assembly in C++.
For what I remember, a pass-by-val function call follows the following procedure:
* Store the address of the PP
* Push the argume... | [
0.2377776801586151,
0.17864565551280975,
0.2291647046804428,
-0.05407353490591049,
-0.3715113401412964,
-0.0256571676582098,
0.09900060296058655,
-0.2015252560377121,
-0.10114302486181259,
-0.36622855067253113,
0.03363049775362015,
0.6033185720443726,
-0.33822935819625854,
0.20698957145214... | |
the value. I understood that to be basically what passing a pointer is. So how come, these two functions, behave differently?:
```
struct A {
int x;
A(int v){
x = v;
}
};
int byRef(A& v){
v = A(3);
return 0;
}
int byP (A* v){
v = &A(4); //OR new A(4)
return 0;
}
int _tmain(int ... | [
0.47907960414886475,
0.017840294167399406,
0.5713223218917847,
-0.20412983000278473,
-0.08582765609025955,
0.11683493107557297,
0.32446011900901794,
-0.6181406378746033,
-0.0389358252286911,
-0.05543108284473419,
-0.10659856349229813,
0.6255072951316833,
-0.5925219655036926,
0.464313715696... | |
cout << a.x << " " << b.x;
system("pause");
return 0;
}
```
I know that in byP(A\*), v is being passed by value, thus, it won't affect the caller's argument. Then, how would you implement byRef(A&) in terms of A\*?
```
int byRef(A& v){
v = A(3);
return 0;
}
```
This invokes the assignment of the tempo... | [
0.30531010031700134,
0.2008059024810791,
0.4912194013595581,
-0.3475552797317505,
0.24533241987228394,
0.22010259330272675,
0.30867472290992737,
-0.32594069838523865,
0.01937148906290531,
-0.3381180763244629,
-0.35215434432029724,
0.39133796095848083,
-0.6845842003822327,
0.233632251620292... | |
A(4)
return 0;
}
```
This copies a pointer to a temporary object to the passed in pointer value. No assignment function is called. The value of 'v' is changed but the object v pointed to, the object address passed as an argument, is unchanged.
If you did this:
```
struct A {
int x;
A(int v){
x = v;
}
... | [
0.18547166883945465,
-0.021427644416689873,
0.684685468673706,
-0.261812299489975,
0.11766519397497177,
0.15259279310703278,
0.2954276502132416,
-0.4125797748565674,
-0.13075318932533264,
-0.2164904922246933,
-0.4740452468395233,
0.506421685218811,
-0.45797446370124817,
0.21197330951690674... | |
others have said, they are treated as the object passed to the function by the language.
So, to implement the `byRef` using pointers:
```
int byRefUsingP (A *v)
{
*v = A(3);
// or you could do:
// v->operator = (A(3));
// if an operator = is defined (don't know if it will work without one defined)
return 0;... | [
0.4306882917881012,
0.06627871841192245,
0.2739584743976593,
-0.3657401204109192,
-0.04039563983678818,
-0.14199666678905487,
0.4689915180206299,
-0.5835966467857361,
-0.11829759925603867,
-0.2790175676345825,
-0.2409180849790573,
0.36254262924194336,
-0.6914811730384827,
0.127243280410766... | |
I am currently writing code in C++ to find all possible permutations of 6 integers and store the best permutation (i.e. the one whose total is closest to a given value).
I am trying to write this code as efficiently as possible and would apreciate any advice or examples.
I was considering storing the integers in an a... | [
0.26999714970588684,
0.40293991565704346,
0.14127685129642487,
-0.3164011240005493,
0.0703108161687851,
0.2823411226272583,
0.2994682490825653,
-0.5283315777778625,
-0.31851354241371155,
-0.40939563512802124,
0.05443239584565163,
0.3086295425891876,
-0.4214809238910675,
0.21952888369560242... | |
have to start in increasing order (by comparison via operator<), or else the loop will terminate before you've seen every permutation. See <http://en.cppreference.com/w/cpp/algorithm/next_permutation> for details.
It probably doesn't give the fastest runtime possible, because at each step it has to examine the array t... | [
0.40103060007095337,
0.022896915674209595,
0.3143835961818695,
-0.04209592565894127,
0.1800680309534073,
-0.029163246974349022,
0.33695733547210693,
-0.09820474684238434,
-0.4315251111984253,
-0.47979533672332764,
-0.259732723236084,
0.09210067242383957,
-0.24362942576408386,
0.34158584475... | |
I am retrieving a list of files from a web service and displaying them as links. When someone clicks on the link, the file should start downloading. The problem is that no direct access to the file exists. Here is the process to download a file:
1. User clicks on link
2. Server calls web service to retrieve file
3. Br... | [
0.6000200510025024,
0.16755759716033936,
0.6871988773345947,
-0.09802953153848648,
-0.06542164832353592,
-0.2760234475135803,
0.02181262895464897,
-0.09661530703306198,
-0.22990107536315918,
-0.6070717573165894,
-0.15204423666000366,
0.3290208876132965,
-0.04340306669473648,
0.402804642915... | |
I would like to display a "Loading..." feedback dialog when a link is clicked, and have the dialog go away when the file is ready.
I am using jQuery, and have been playing around with adding an iframe to the page to load the file, but the problem I am having is I don't know how to determine that the file is ready.
I ... | [
0.6035256385803223,
-0.06088366359472275,
0.26516783237457275,
0.06052646413445473,
-0.1653193086385727,
-0.4702795743942261,
0.23053644597530365,
0.38172391057014465,
-0.3048059642314911,
-0.6880035996437073,
-0.0507848896086216,
0.5954948663711548,
0.09469325095415115,
-0.082986630499362... | |
this is for downloading a file to a user's machine. What I'm specifically looking for is a way to determine when the file is ready for download. So, when step #4 above takes place, I'd like to remove the "Loading..." message.
It sounds like you need to expose a new request URL on your server, whose only job is to reply... | [
0.10706377029418945,
-0.29187819361686707,
0.6233614683151245,
0.135365828871727,
-0.1533162146806717,
-0.4189537465572357,
-0.13741956651210785,
0.0297929085791111,
-0.4079398512840271,
-0.9197986125946045,
-0.06622761487960815,
0.5809265375137329,
-0.09340602159500122,
0.0661029815673828... | |
also a file ID), so that the server knows which file is being asked about. The server side will need to be able to contact the running web-service-retrieval process/thread to ask it how far it got. (If it can't find the thread then presumably it has finished.) | [
0.06288356333971024,
-0.201727956533432,
0.4501856565475464,
0.3739933371543884,
0.23336774110794067,
-0.11156167834997177,
0.10003358870744705,
-0.0029442578088492155,
-0.39013391733169556,
-0.42644086480140686,
-0.22599661350250244,
0.2882140278816223,
0.13841886818408966,
0.295360118150... | |
What is best way for making a draw panel in a web page. I would like to know how to develop something very simple,for example little panel where users can draw a signature.
This is great example [drawhere.com](http://drawhere.com), but I need something way simpler.
Thanks
I’m afraid I don’t have IE 8 here to test on, ... | [
0.08854347467422485,
-0.16208627820014954,
0.3840557038784027,
-0.14068160951137543,
-0.4266195297241211,
0.06708436459302902,
0.47797611355781555,
-0.325691282749176,
-0.062459200620651245,
-0.7608485221862793,
-0.20067201554775238,
0.45700183510780334,
-0.26712745428085327,
-0.2857508361... | |
I have this problem domain where I need to able to run a background process that would:
* Run a filter to get an obj collection (time consuming operation)
* Pass the obj coll through a set of rules...maybe thru a rule interface
* Be able to expose any changes that the rules caused to any interested listeners.
Each fi... | [
0.6214732527732849,
0.22831901907920837,
0.48978391289711,
0.039167169481515884,
-0.1674000471830368,
-0.15313920378684998,
0.38641783595085144,
-0.29482266306877136,
-0.2901234030723572,
-0.5691384077072144,
0.19709151983261108,
0.8905351758003235,
-0.1539672464132309,
0.07770469784736633... | |
work of running filter->rules. Will this need to be a separate threaded work ?
Any thoughts or references to existing frameworks, design patterns, etc. are welcome.
thanks
Sunit
If your background process needs to be instantly (24/7/365) accessible from remote machines, the Windows service makes a lot of sense to me.... | [
0.3782719075679779,
-0.10668526589870453,
0.2803594172000885,
0.0361076183617115,
-0.21953828632831573,
-0.4246160686016083,
0.4174022972583771,
-0.07688557356595993,
-0.37795281410217285,
-0.9295996427536011,
-0.10521954298019409,
0.42639169096946716,
-0.313321590423584,
-0.06653532385826... | |
good practices, I'll refer you to Juval Lowy's website, [IDesign.net](http://www.idesign.net). The site has a lot of free WCF-related downloads just by providing your email address. | [
0.9128602743148804,
0.2987668216228485,
-0.2863815128803253,
0.06549319624900818,
-0.2354397475719452,
-0.45629581809043884,
0.3270973861217499,
0.054973822087049484,
0.06012680009007454,
-0.6511548757553101,
0.18959063291549683,
0.5051316022872925,
0.25924167037010193,
0.01006530411541462... | |
For some reason our datepicker is falling behind the dropdowns below it in IE6
[www.senegal.co.uk](http://www.senegal.co.uk/)
Every search I have done seems to suggest the datepicker should deal with this.
We do have the following css in place:
```
.ui-datepicker-cover {
display: none; /*sorry for IE5*/
dis... | [
-0.022715313360095024,
-0.0017810047138482332,
0.6094451546669006,
-0.20990918576717377,
0.05935191735625267,
-0.1837281435728073,
0.19019253551959991,
0.07356158643960953,
-0.4045131802558899,
-0.7091955542564392,
-0.2791423201560974,
0.2297562062740326,
-0.10214117169380188,
-0.107247225... | |
have tried adding bgiframe and calling:
> $("#ui-datepicker-div").bgIframe();
But it doesn't solve the issue.
Any ideas?
I'm thinking we're going to need someone with experience using jquery ui datepicker to help us out on this one!
Couldn't find a solution to this in time, so in the end just put in some code to hi... | [
0.19511397182941437,
-0.1527913212776184,
0.296728253364563,
-0.14758121967315674,
-0.047532666474580765,
-0.057093456387519836,
0.2987194061279297,
0.09420078247785568,
-0.28021910786628723,
-0.6759892106056213,
-0.11308040469884872,
0.3042030930519104,
-0.3907463550567627,
0.172458022832... | |
I've got a Ruby method like the following:
```
# Retrieve all fruits from basket that are of the specified kind.
def fruits_of_kind(kind)
basket.select { |f| f.fruit_type == kind.to_s }
end
```
Right now, you can call this like:
```
fruits_of_kind(:apple) # => all apples in basket
fruits_of_kind('banana') # =... | [
-0.1691708266735077,
0.3024357557296753,
-0.06549590080976486,
0.0003467754868324846,
0.05208200961351395,
0.3782864212989807,
0.13064105808734894,
-0.08859118074178696,
-0.25815558433532715,
-0.8259974718093872,
-0.04615628719329834,
0.34549710154533386,
-0.24182869493961334,
0.1283223927... | |
likewise
```
Is this possible to do idiomatically? If so, what's the best way to write methods so that they can accept zero, one, or many inputs?
```
def fruits_of_kind(kind)
return nil if kind.nil?
result = []
([] << kind).flatten.each{|k| result << basket.select{|f| f.fruit_type == k.to_s }}
resu... | [
-0.09445098787546158,
-0.15125373005867004,
0.15305431187152863,
-0.058897893875837326,
-0.28721949458122253,
0.07209667563438416,
0.05126955732703209,
-0.17380328476428986,
-0.25157788395881653,
-0.7860609889030457,
-0.006114047020673752,
0.3047514259815216,
-0.4954969584941864,
-0.081259... | |
basket.select do |fruit|
kinds.flatten.each do |kind|
break true if fruit.fruit_type == kind.to_s
end == true #if no match is found, each returns the whole array, so == true returns false
end
end
```
If you pass in nil, the \* converts it to [nil]. If you want to return nil instead of an empty list, y... | [
-0.055120255798101425,
-0.203005850315094,
-0.06560556590557098,
-0.2150065004825592,
-0.07546029984951019,
0.17888189852237701,
0.09508618712425232,
-0.2553483247756958,
-0.19190111756324768,
-0.8747203946113586,
0.008723907172679901,
0.17610275745391846,
-0.32242313027381897,
0.201205879... | |
difference, but it's a one-element list containing another list, so you need to flatten kinds before doing the "each" loop. Flattening will convert it to [:apple, 'banana'], like you expect, and give you the results you're looking for.
**EDIT**: Even better, thanks to Greg Campbell:
```
def fruits_of_kind(basket, ... | [
0.046033602207899094,
-0.1491243839263916,
-0.018302062526345253,
-0.4408169686794281,
-0.20943519473075867,
0.6895068883895874,
0.013711326755583286,
-0.19884325563907623,
-0.35779500007629395,
-0.8972639441490173,
-0.011323664337396622,
0.4755740165710449,
-0.25817757844924927,
-0.083269... | |
kind_list = kinds.flatten.map{|kind| kind.to_s}
basket.select{|fruit| kind_list.include?(fruit.fruit_type) }
end
``` | [
-0.07801676541566849,
0.12080003321170807,
0.04178066551685333,
-0.21268774569034576,
-0.07785357534885406,
0.059099212288856506,
0.16225799918174744,
-0.015589308924973011,
-0.21300016343593597,
-0.8420451879501343,
-0.17684055864810944,
0.18654635548591614,
-0.523537814617157,
0.28302687... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.