text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
that performs additional logic like attaching entity dependencies. The rest of your app then only utilizes the Services. Your example might look like this:
```
$site = $siteService->getSiteById(1); // or
$sites = $siteService->getAllSites();
```
Then inside the SiteService class you would have something like this:
... | [
0.0878213569521904,
0.23770388960838318,
0.6290295720100403,
-0.05293991416692734,
-0.23240211606025696,
-0.12089578062295914,
0.35869285464286804,
-0.2672792673110962,
-0.10612167418003082,
-0.7400557398796082,
-0.2827507555484772,
0.4075707793235779,
-0.40828937292099,
-0.043320748955011... | |
I am trying to convert an integer number in C into an array containing each of that number's digits
i.e. if I have
```
int number = 5400
```
how can I get to
```
int numberArray[4]
```
where
```
numberArray[0] = 0;
numberArray[1] = 0;
numberArray[2] = 4;
numberArray[3] = 5;
```
Any suggestions gratefully r... | [
0.04759206622838974,
0.1900998204946518,
0.38192710280418396,
-0.31667250394821167,
0.1413542628288269,
0.24568821489810944,
0.41665753722190857,
-0.5400216579437256,
-0.12354176491498947,
-0.5719285011291504,
-0.2189112901687622,
0.40697622299194336,
-0.0881514847278595,
0.146978825330734... | |
number /= 10;
i++;
} while (number != 0);
return arr;
}
```
EDIT: Just a little bit more C style but more cryptic.
```
#include <math.h>
char * convertNumberIntoArray(unsigned int number) {
unsigned int length = (int)(log10((float)number)) + 1;
char * arr = (char *) malloc(length * sizeof(ch... | [
0.10335273295640945,
0.051728762686252594,
0.6408432126045227,
-0.42914459109306335,
-0.028392096981406212,
0.5402705669403076,
0.3442595899105072,
-0.45959362387657166,
-0.275540292263031,
-0.23691527545452118,
-0.2369997650384903,
0.7736251354217529,
-0.2697637677192688,
0.12797397375106... | |
} while (number != 0);
return arr;
}
``` | [
-0.07831880450248718,
0.011277527548372746,
0.08931864798069,
-0.5202152729034424,
0.2362350970506668,
-0.04898594692349434,
0.4588566720485687,
-0.04507157951593399,
-0.14589925110340118,
0.04118330776691437,
-0.40868479013442993,
0.8503795266151428,
-0.3309888541698456,
0.307630002498626... | |
I searched google but couldn't find an answer to this rather simple question. I have a python script that has the hash-bang (#!) on the first line:
```
#!/usr/bin/python
```
However, what if this is run on a computer with python in /bin/python or /usr/local/bin/python, or some other place? There has to be a better w... | [
0.1520892083644867,
0.43158087134361267,
-0.15256790816783905,
-0.10532646626234055,
-0.20261335372924805,
-0.33367782831192017,
0.4185439348220825,
-0.06057126075029373,
-0.08731596916913986,
-0.4914148151874542,
0.062102992087602615,
0.5672050714492798,
-0.27104654908180237,
-0.143239796... | |
I seem to recall something about avoiding the Immediate If operator ([?:](http://msdn.microsoft.com/en-us/library/ty67wk28(VS.80).aspx)) in C#, but I don't know where I read it and what it was. I think it had to do with the fact that both the true and the false part are executed before deciding on the outcome of the co... | [
-0.1047702208161354,
-0.39730122685432434,
0.1016639769077301,
-0.2920292019844055,
-0.065449059009552,
-0.08157973736524582,
0.23267266154289246,
0.09472732245922089,
0.01746133156120777,
-0.12256493419408798,
-0.34627804160118103,
0.5226739645004272,
-0.24109937250614166,
-0.121111445128... | |
to this operator.
What you've read is about is possibly about `Iif` function in VB.NET. Being a function it evaluates all its arguments before being invoked, so
```
Dim s As String = Iif(person Is Nothing, String.Empty, person.FirstName)
```
will result in `NullReferenceException` being thrown. | [
0.037587519735097885,
-0.1861330270767212,
0.03156108781695366,
-0.13752318918704987,
-0.10975343734025955,
-0.2862260341644287,
0.3006327152252197,
-0.1639091819524765,
0.008117422461509705,
-0.3291168510913849,
-0.19018924236297607,
0.7087270021438599,
-0.254207968711853,
0.2490794956684... | |
I've just installed Resharper, and I really don't know how to use it "correctly".
I noticed that there are some demos and documents at their website, but I'm wondering..
..how did you learn to use it efficiently? Are there any other good resources(demos/tutorials)?
There is a [series of screencasts](http://dimecasts.n... | [
0.5055466890335083,
-0.16329704225063324,
0.4124179780483246,
0.27545052766799927,
0.04494139179587364,
-0.19008192420005798,
-0.07319697737693787,
0.08696796000003815,
-0.28492894768714905,
-0.961353063583374,
0.272734135389328,
0.5940614938735962,
-0.07264041900634766,
-0.206497460603714... | |
I have implemented a linked list as a self-referencing database table:
```
CREATE TABLE LinkedList(
Id bigint NOT NULL,
ParentId bigint NULL,
SomeData nvarchar(50) NOT NULL)
```
where Id is the primary key, and ParentId is the Id of the previous node on the list. The first node has ParentId = NULL.
I n... | [
-0.1117698922753334,
-0.0893932357430458,
0.14089179039001465,
0.032390326261520386,
-0.08521167188882828,
-0.07307635992765427,
-0.0685821995139122,
-0.001856070477515459,
-0.2610466480255127,
-0.6419452428817749,
-0.023184508085250854,
0.08724184334278107,
-0.21902094781398773,
0.3935920... | |
0
38324 24971 1
60088 60089 3
60089 38324 2
61039 61497 5
61497 60088 4
109397 109831 7
109831 61039 6
```
Then sorting it, using the criteria, should result in:
```
Id ParentId SomeData
24971 NULL 0
38324 24971 1
60089 38324 2
60088 60089 | [
-0.5951971411705017,
-0.04663696885108948,
-0.1778559684753418,
-0.043526824563741684,
0.06214558333158493,
-0.07592402398586273,
0.2641235888004303,
0.11325649172067642,
0.03445211425423622,
-0.1689586639404297,
-0.1104821115732193,
0.09019282460212708,
-0.21492113173007965,
0.48127546906... | |
3
61497 60088 4
61039 61497 5
109831 61039 6
109397 109831 7
```
You're supposed to use the *SomeData* colum as a control, so please don't cheat doing *ORDER by SomeData* :-)
In Oracle:
```
SELECT Id, ParentId, SomeData
FROM (
SELECT ll.*, level AS lvl
FROM LinkedList ll
START WITH
Par... | [
-0.1016351655125618,
-0.0774010643362999,
0.17041310667991638,
0.13783077895641327,
0.1922949105501175,
-0.0896361917257309,
0.06062326952815056,
0.04808005690574646,
0.06527063250541687,
-0.16459985077381134,
-0.3746221363544464,
0.33474647998809814,
-0.11394408345222473,
0.00308591709472... | |
it is not searchable by indices. Insert a surrogate root with id of `0` or `-1` instead, and use `START WITH ParentID = 0`. | [
-0.4367806315422058,
-0.09288021922111511,
0.09817895293235779,
0.04940109699964523,
0.09466814249753952,
0.0014596026157960296,
0.2544185221195221,
0.013107006438076496,
0.30724629759788513,
-0.31885379552841187,
-0.19235047698020935,
0.013877005316317081,
-0.026288624852895737,
0.2502042... | |
In .Net 2.0 how can I disallow AutoRedirect when using WebRequest? I found some source code were there where used an AllowAutoRedirect property, but on my WebRequest there is no such property.
You need to cast it to a `HttpWebRequest`
```
HttpWebRequest WebRequest =
(HttpWebRequest)System.Net.WebRequest.Create("http:/... | [
0.2684720456600189,
-0.04630989208817482,
0.38469499349594116,
-0.09853319823741913,
-0.27925196290016174,
-0.34913170337677,
0.5604333281517029,
-0.29006582498550415,
0.051770322024822235,
-0.6274691224098206,
-0.18665532767772675,
0.6825453042984009,
-0.5462627410888672,
-0.0131529746577... | |
Do I have to explicitly instantiate a function template's type when it comes to reference type deduction. If that is the case, where is the ambiguity? Let's compare following 2 code snippets:
1st: [link for the code](http://codepad.org/2H5QY3sW)
```
template <typename T>
void foo(T& var, void(*func)(T&)) // T must ... | [
0.1652342677116394,
0.17145712673664093,
0.3520311713218689,
-0.17764903604984283,
-0.1276835799217224,
-0.1188461109995842,
0.5415549874305725,
-0.7095722556114197,
0.1060345321893692,
-0.3853591978549957,
-0.22268277406692505,
0.49084797501564026,
-0.3653069734573364,
-0.0469110496342182... | |
var){}
int main()
{int k =7;
foo(k, &ret); //error: no matching function for call to 'foo(int&, void (*)(int&))'
cout<<k;
}
```
However, If I call foo by explicitly instantiating with `<int&>` "`foo<int&>(k,&ret);`", the code gives the same output as the former one. What is the reason of this error? Where is the a... | [
0.007311060559004545,
0.11857155710458755,
0.4252927303314209,
-0.32930612564086914,
-0.2419605851173401,
0.3187209367752075,
0.4686717987060547,
-0.5965761542320251,
-0.049005888402462006,
-0.10689601302146912,
-0.23466072976589203,
0.7421469688415527,
-0.36416202783584595,
-0.02844716235... | |
A. Type deduction is done independently for each P/A pair, and the deduced
> template argument values are then combined. If type deduction cannot be done for any P/A pair, or **if for
> any pair the deduction leads to more than one possible set of deduced values**, or if different pairs yield different
> deduced val... | [
0.24876536428928375,
0.026557695120573044,
0.04166943207383156,
-0.10225626826286316,
-0.2434665709733963,
0.21803177893161774,
0.14430221915245056,
-0.6227956414222717,
-0.012153993360698223,
-0.5109992027282715,
0.046685535460710526,
0.4651453495025635,
-0.6162679195404053,
-0.2269254028... | |
these cases can be deduced, so you could then use some other template trickery possibly via enable if to create a new type which represents the version you want, ie. with reference or without. | [
0.6170321106910706,
-0.0825280249118805,
0.07894621044397354,
0.12948475778102875,
0.18073029816150665,
-0.032146237790584564,
0.31397247314453125,
-0.06457771360874176,
-0.1807948350906372,
-0.5794904232025146,
-0.1431262195110321,
0.55340176820755,
-0.5986872315406799,
-0.002983659273013... | |
I wonder is there any way we can create regions in aspx page as we create it in our cs pages.
not as Expandable, but in HTML it is normal to use the comments in order to create blocks of code
```
<!-- Start: Login access form -->
... Code ...
<!-- End: Login access form -->
``` | [
0.03824026137590408,
0.005608145613223314,
0.38629770278930664,
0.24465514719486237,
-0.23698154091835022,
-0.1793932467699051,
-0.017493367195129395,
0.18411043286323547,
-0.5207453966140747,
-0.9421537518501282,
-0.3249761462211609,
-0.1297677904367447,
-0.05877784639596939,
0.2215750813... | |
I have a UITextView that i use for typing some text
(i have added it with Interface builder)
i have made the height 3 font lines high (so in my case the frame height is 47) so i can have 3 lines of text
what i want it to do is type until line3 and the go up if i goto line 4
but what it does is whenever i type enter i... | [
0.12804391980171204,
0.0025095907039940357,
0.8824090957641602,
-0.18560177087783813,
-0.4088302552700043,
0.11337621510028839,
0.3560566008090973,
-0.2449381947517395,
-0.01228510681539774,
-0.9327826499938965,
0.233829528093338,
0.3216795027256012,
-0.2827949523925781,
-0.048848159611225... | |
to the top!
[Click here for the screen capture](http://andyj.be/iphone/iphoneTextView.swf)
It looks like the trick is to make the font size bigger
```
txtView.font = [UIFont systemFontOfSize:14];
```
when i make my font size 2 points bigger it just types normal instead of going up every line. | [
-0.3721470236778259,
-0.19792643189430237,
0.734397292137146,
-0.008134042844176292,
0.15375877916812897,
-0.010233401320874691,
0.3079463541507721,
-0.08285319060087204,
-0.6207152009010315,
-0.24190683662891388,
-0.21647541224956512,
0.5647798180580139,
0.0474933385848999,
-0.31406638026... | |
I would like to know how to escape phpdoc comments within a phpdoc comment.
For example, how would I have to write this:
```
/**
* Some documentation...
*
* <code>
* /**
* * Example example phpdoc.
* */
* </code>
*/
```
Obviously above example won't work.
I tried replacing the asterisk's with *, but... | [
-0.02763977088034153,
0.32546138763427734,
0.4643454849720001,
0.04208827763795853,
-0.1074238121509552,
-0.10352813452482224,
0.6662389636039734,
-0.27063366770744324,
-0.16014885902404785,
-0.7504154443740845,
-0.027972625568509102,
0.4274139404296875,
-0.27067679166793823,
-0.0140931401... | |
{@*}
* </code>
*/
``` | [
0.6190225481987,
0.7275177836418152,
-0.053460173308849335,
-0.019229451194405556,
-0.03048051707446575,
-0.13081377744674683,
0.36719751358032227,
0.15371517837047577,
0.011926419101655483,
-0.5529282689094543,
-0.37759095430374146,
0.265664666891098,
-0.1521999090909958,
0.34238082170486... | |
I know it can be done in Java, as I have used this technique quite extensively in the past. An example in Java would be shown below. (Additional question. What is this technique called? It's hard to find an example of this without a name.)
```
public abstract class Example {
public abstract void doStuff();
}
publi... | [
0.8236472010612488,
0.0291892159730196,
0.17401938140392303,
-0.1447465568780899,
0.21051867306232452,
-0.41215237975120544,
0.5345468521118164,
-0.1386822760105133,
-0.05458526685833931,
-0.516646146774292,
-0.07390208542346954,
0.3947775959968567,
-0.28375309705734253,
0.563317060470581,... | |
}
};
x.doStuff();
}
}
```
Now, my main question would be, can this also be done in C#, and if so, how?
With lamba expressions and class initializers you can get the same behaviour with a bit of effort.
```
public class Example {
public Action DoStuff;
public Action<int> DoStuffWith... | [
0.10946540534496307,
-0.31803926825523376,
0.3555445671081543,
-0.23921625316143036,
-0.13248920440673828,
0.17481958866119385,
0.5551573038101196,
-0.47508111596107483,
-0.21510997414588928,
-0.5912095904350281,
-0.16476936638355255,
0.9574500322341919,
-0.30147573351860046,
0.05610587820... | |
var x = new Example() {
DoStuff = () => {
Console.WriteLine("Did Stuff");
},
DoStuffWithParameter = (p) => {
Console.WriteLine("Did Stuff with parameter " + p); | [
0.1666119545698166,
-0.12481406331062317,
0.5761263966560364,
-0.01698354259133339,
0.1652739942073822,
0.0956386923789978,
0.3978462815284729,
-0.5753076076507568,
-0.0884481891989708,
-0.4492800831794739,
-0.17102262377738953,
0.6280891299247742,
-0.2184344083070755,
-0.03309802338480949... | |
},
DoStuffWithReturnValue = () => { return 99; }
};
x.DoStuff();
x.DoStuffWithParameter(10);
int value = x.DoStuffWithReturnValue();
Console.WriteLine("Return value " + value);
Console.ReadLine();
}
}
```
One problem with this solution that I just real... | [
-0.05460119619965553,
-0.17162825167179108,
0.5694997906684875,
-0.2151431292295456,
0.2293916940689087,
0.011116966605186462,
0.49932658672332764,
-0.38391339778900146,
0.12755335867404938,
-0.5254282355308533,
-0.1948351263999939,
0.8347443342208862,
-0.2654583156108856,
0.19168280065059... | |
the Example class, the lambda expressions would not be able to access those fields.
However, there is no reason that you could not pass the instance of Example to the lambda expressions which would give them access to any public state that example might hold. AFAIK that would be functionally equivalent to the Java An... | [
0.3679371476173401,
-0.044337593019008636,
0.03862142562866211,
0.3727346658706665,
-0.5072473287582397,
-0.013791598379611969,
0.22318358719348907,
-0.14706522226333618,
-0.2832008898258209,
-0.27192917466163635,
-0.07860835641622543,
0.5016182065010071,
-0.34742245078086853,
0.1314635723... | |
In my experience, this has been a contentious issue between "backend" (database developer) and "frontend" guys (application developer, client and server side).
There have been many *heated* pub discussions on this subject.
I just want to know is it just people have different mindsets, or lazy to learn more and feel ... | [
0.5903924703598022,
0.5517647862434387,
0.2165948897600174,
0.18306384980678558,
0.1328943520784378,
-0.3509911596775055,
-0.028266526758670807,
0.03814060240983963,
-0.26857081055641174,
-0.47145092487335205,
0.08030073344707489,
0.5857149362564087,
-0.07097885012626648,
0.132328867912292... | |
their actual code.
Database developers on the other hand only really need to know how to write database queries as that is their job and probably won't need to worry about the code at application level. | [
0.6625688672065735,
0.37893879413604736,
0.027093227952718735,
0.5485661029815674,
-0.02821607142686844,
0.06859902292490005,
0.3157072067260742,
0.33978140354156494,
0.012087595649063587,
-0.41490674018859863,
-0.15549063682556152,
0.7341263890266418,
0.1453986018896103,
-0.09941943734884... | |
This is a bit difficult to explain, so please bear with me.
I am running emacs 23.0.60.2 (from CVS) in order to have truetype support. (in case anyone wonders why I'm running the bleeding edge). I'm experiencing some oddness in navigation within documents with this version that I want to have STOP.
When a window is n... | [
0.26563501358032227,
0.15810416638851166,
0.5622238516807556,
0.05697395280003548,
-0.07919701933860779,
-0.12178337574005127,
0.3561355769634247,
0.06527290493249893,
-0.08208876848220825,
-0.6781553626060486,
0.11774726212024689,
0.44396647810935974,
-0.1253022402524948,
0.05225125700235... | |
next logical line in the window -- which is the continuation of the current line -- at the same relative offset from the window edge. Basically, before it was emacs-like and now it's notepad-like. I don't want notepad-like behaviour.
Does anyone know how to turn this off? Bonus points if you know how to turn it off in... | [
0.18373256921768188,
-0.434552937746048,
0.7311571836471558,
0.166962668299675,
0.004535215441137552,
0.0023145016748458147,
0.2871703803539276,
0.4228684902191162,
-0.2685503363609314,
-0.804936945438385,
-0.02970428578555584,
0.43900784850120544,
0.05900901183485985,
0.1065191775560379,
... | |
```
std::map<std::string, std::string> myMap;
std::map<std::string, std::string>::iterator i = m_myMap.find(some_key_string);
if(i == m_imagesMap.end())
return NULL;
string *p = &i->first;
```
Is the last line valid?
I want to store this pointer p somewhere else, will it be valid for the whole program life?
B... | [
-0.21215933561325073,
0.1328161060810089,
0.5091896057128906,
-0.08669095486402512,
0.30193278193473816,
-0.0743139237165451,
0.30471473932266235,
-0.2889399528503418,
-0.21227945387363434,
-0.5373146533966064,
-0.38422486186027527,
0.6770529747009277,
-0.43442970514297485,
0.0643565356731... | |
iterator does not guarantee stability of pointers! Although it usually happens that most implementations use pointers - at least at some level - to implement iterators (which means it is quite safe to assume your solution will work), *what you should really store is the iterator itself*.
What you could do is create a ... | [
-0.5176040530204773,
-0.2825131416320801,
0.466331422328949,
0.04875391721725464,
0.15698984265327454,
0.019997883588075638,
0.03322300314903259,
-0.5568640828132629,
-0.03952623903751373,
-0.2203170210123062,
-0.1677512377500534,
0.8408668637275696,
-0.3619912564754486,
-0.229755133390426... | |
I am relatively new to MVC, so this is likely a novice question.
I am trying to understand the best practices for how to maintain clear separation of concerns in a few scenarios that don't appear straightfoward.
There are two scenarios I am looking at right now. Imagine a very basic app that lets users view and edit ... | [
0.34921926259994507,
0.13290250301361084,
0.24260254204273224,
0.017075568437576294,
0.2885742783546448,
0.14180485904216766,
0.015970762819051743,
-0.3317340314388275,
-0.26488378643989563,
-0.7371413111686707,
0.47082164883613586,
0.9109414219856262,
-0.04968733713030815,
-0.373791188001... | |
the Entity Framework and mapped to the user profile SQL table.
In the view action/view for displaying a user's profile, functionally, I need to have a button or link that lets a user edit the profile. But that should only be available to some subset of users. For example, the user can edit their own profile. Also, sup... | [
0.16176898777484894,
-0.10640503466129303,
0.5064924955368042,
0.1941818743944168,
-0.02506936341524124,
-0.04288901016116142,
0.05134468153119087,
0.00214384775608778,
-0.06373661011457443,
-0.6272033452987671,
0.06046575307846069,
0.6417083144187927,
-0.21733145415782928,
0.0795281678438... | |
edit the current profile. Should I add a IsEditable property to the UserProfile model class? That doesn't feel tragic, but it doesn't feel completely right either. Should I make a new Model class that aggregates the UserProfile with additional information about security?
Another scenario... When editing a particular p... | [
0.1441114842891693,
0.24021100997924805,
0.5699681043624878,
0.2008543461561203,
0.1923433095216751,
0.09131881594657898,
-0.04860310256481171,
-0.08814388513565063,
-0.23678237199783325,
-0.7762398719787598,
0.15190359950065613,
0.8075219988822937,
-0.21939432621002197,
0.1855147182941436... | |
the database directly, so do I do the aggregate Model thing again and provide the View with both the UserProfile and a list of valid specialties?
I guess the generic issue I am trying to figure out is should I be comfortable with creating lots of little Model classes that are essentially specific to individual views. ... | [
0.4196462035179138,
0.04290159046649933,
0.361868679523468,
0.28806325793266296,
0.033581119030714035,
-0.04234796762466431,
0.1475469470024109,
-0.022294316440820694,
-0.05175962671637535,
-0.49606266617774963,
0.16255828738212585,
0.7781514525413513,
-0.17011384665966034,
0.2021779268980... | |
to cloning the model into a view-specific model to add this single attribute. I do sometimes create view specific models -- for instance I have Grid ViewUserControl that takes a Grid model, which I can produce from any list of other model classes -- but I wouldn't in this case.
In my view I would do something like thi... | [
0.11066370457410812,
-0.3152850866317749,
0.5677506923675537,
-0.05030149593949318,
-0.039505939930677414,
0.1588262915611267,
0.020396392792463303,
-0.2041475921869278,
-0.22308306396007538,
-0.8444425463676453,
0.07390238344669342,
0.7069521546363831,
-0.39915668964385986,
0.182409122586... | |
I've been trying to figure this one our for a while now.
```
(defn is-decimal [astr]
(if (. astr (indexOf (int \.)))
(Double/parseDouble astr)
(Integer/parseInt astr)))
```
That is the function I wrote. `is-decimal` is either passed something such as "2.5" or "5" or something of the sort, but it always use... | [
-0.31906771659851074,
0.11842106282711029,
0.44953209161758423,
-0.12275131791830063,
-0.18509134650230408,
0.13404937088489532,
0.3325502872467041,
-0.19896245002746582,
-0.07714716345071793,
-0.32264071702957153,
-0.2545877695083618,
0.6667051315307617,
-0.09587780386209488,
-0.243117392... | |
false in Clojure. Can anyone think of a way to fix this?
Thanks in advance.
EDIT: Thanks for the help guys. Right after I wrote this I had an idea. I wrote a predicate function that checks for 1 and -1. Just what I needed. I shouldn't code directly after waking up :\
If you want to test whether a string contains a ch... | [
-0.0363660529255867,
0.17459867894649506,
0.312889963388443,
0.22701185941696167,
-0.11313934624195099,
-0.19681227207183838,
0.7040809988975525,
0.02762034721672535,
0.04376044496893883,
-0.46134305000305176,
-0.1266743391752243,
0.43237748742103577,
-0.42584729194641113,
-0.2923800647258... | |
you're sure your string only has numbers in it, you can use it. (Be careful though, this reads anything, not just numbers. This is potentially dangerous. Don't use this if there's any chance your string has something other than a number.)
Note, Clojure also handles the case where an integer is too big to fit into a na... | [
-0.16761313378810883,
0.0598536878824234,
0.12239120900630951,
-0.01496912445873022,
-0.04188750684261322,
-0.16830267012119293,
0.13963553309440613,
-0.09516449272632599,
-0.4510403871536255,
-0.39916181564331055,
-0.13148128986358643,
0.3484097719192505,
-0.4478183090686798,
-0.232001021... | |
rather than `is-decimal`. Your function actually is more of a number parser, so personally I'd call it `parse-number` or `string-to-number`. | [
-0.06399793177843094,
0.12682238221168518,
-0.23140214383602142,
0.19925688207149506,
-0.19522662460803986,
0.1470586508512497,
-0.22705325484275818,
0.30677613615989685,
-0.3064257800579071,
-0.0709364265203476,
-0.06107455864548683,
0.42415890097618103,
-0.0899043008685112,
-0.1689935773... | |
Source texts (7):
1. give 4 cars
2. ga 5 cars
3. GA 5 Cars @mustang six exhausts are necessary
4. Give -1 Cars @mustang
5. Give Cars @mustang
6. Give 3 Cars @ford
7. Give 5 Cars @cobra\_gt
The ones which should be successful ate 1,2,3,6,7
preg\_match('/Give (\d+) Cars @(\w+)|GA (\d+) Cars @(\w+)/i', $a->text, $outpu... | [
0.45753487944602966,
0.47681480646133423,
0.4048076570034027,
0.005408854223787785,
0.17016223073005676,
0.4417974650859833,
0.42572200298309326,
-0.3730930984020233,
0.3194102644920349,
-0.1572730988264084,
-0.13269874453544617,
0.7261425852775574,
-0.08005724847316742,
0.0273415911942720... | |
=> ford
)
Array
(
[0] => Give 5 Cars @cobra_gt
[1] => 5
[2] => cobra_gt
)
```
As you can see it is not working with the lowercase ones, and for number #3 it doesn't produce the right array, it produces empty elements. Any idea where I am going wrong here?
Given the input:
1. give 4 cars
2. ga 5 cars
3. G... | [
0.43005460500717163,
0.3785729706287384,
0.32867681980133057,
0.1682041436433792,
-0.12947025895118713,
0.4630514979362488,
0.3041732907295227,
-0.7520738840103149,
0.14067381620407104,
-0.05754740908741951,
0.2625378966331482,
0.7239969968795776,
-0.23292319476604462,
0.11349090188741684,... | |
only
matching against something that has
"`@something`" in it.
2. Same as #1
3. This matches as expected
4. The `-` in front of `1` causes the match to fail
5. There is no number between `Give` and `Cars`
6. This matches as expected
7. This matches as expected
As to why it doesn't produce the "right" array, it actuall... | [
-0.08486727625131607,
-0.1102728620171547,
0.31179603934288025,
-0.19671759009361267,
-0.30933141708374023,
0.37522852420806885,
0.22199077904224396,
-0.6172772645950317,
-0.045050255954265594,
-0.6691632866859436,
0.04568682983517647,
0.7701138257980347,
-0.6469858884811401,
-0.2881350815... | |
Cars @(\w+)/i
^ 1 ^ 2 ^3 ^4
```
So if you match the '`Give`' case, you are going to have groups 1 and 2, and if you match the '`GA`' case, groups 3 and 4 will be filled.
(Also, the '`i`' modifier is working fine, you just aren't properly accounting for your inputs) | [
0.18313325941562653,
0.40548256039619446,
0.22685405611991882,
0.18343932926654816,
-0.026874704286456108,
0.5902334451675415,
-0.07591015100479126,
-0.07433654367923737,
-0.2311234474182129,
-0.4162713885307312,
-0.17606748640537262,
0.6443355679512024,
-0.024173997342586517,
0.1951400190... | |
I have multiple projects containing multiple WCF service references.
My WCF services are in a state of flux so I frequently have to go around and update all of my service references.
Is there a way to achieve this as a single action?
Well, rather than use the IDE, you could use `svcutil` at the command line via a bui... | [
0.6740164160728455,
0.16924692690372467,
0.15076793730258942,
-0.11669076234102249,
-0.28511184453964233,
-0.1450878381729126,
0.43915677070617676,
-0.3050159811973572,
-0.17324915528297424,
-0.6727603077888489,
0.20188219845294952,
0.47878018021583557,
-0.1641109734773636,
0.3663876056671... | |
I've seen some jquery code where people extend the main object like:
```
$('someId').myCustomObject();
```
Is this possible or am I mistaken? (if yes, how?)
Yes it's easily possible. The standard pattern for building extensions is:
```
(function($) {
$.fn.myCustomObject = function(options) {
var defaults = ... | [
0.22233855724334717,
-0.3841862678527832,
0.6103402376174927,
-0.18929354846477509,
0.512151300907135,
0.141159325838089,
0.03209966421127319,
-0.08651012182235718,
-0.3484511375427246,
-0.47783559560775757,
-0.40292593836784363,
0.7790876030921936,
-0.23080407083034515,
-0.053044114261865... | |
allows compatibility mode. | [
0.2273314893245697,
0.07778854668140411,
0.3376367688179016,
0.10047072172164917,
0.48375508189201355,
-0.414692223072052,
0.13043387234210968,
-0.03867115080356598,
0.12265060096979141,
-0.3211665153503418,
-0.553847074508667,
0.49531444907188416,
-0.24583002924919128,
-0.0995726287364959... | |
I am currently working on an application with a tabbed interface. I want to be able to split the workspace horizontally or vertically by dragging a tab to one edge of the window.
For example, open two tabs: <http://666kb.com/i/b65vvbusbxhvgy8mf.png>
Then drag one tab to the bottom of the screen and drop it. A second ... | [
0.5011467933654785,
-0.17011910676956177,
0.07493842393159866,
0.048008620738983154,
-0.044872984290122986,
0.11506887525320053,
-0.05168301984667778,
0.17538827657699585,
-0.3133721947669983,
-0.7719789743423462,
0.23659496009349823,
0.5978612303733826,
0.27213364839553833,
-0.11591654270... | |
My specific question has to do with JMX as used in JDK 1.6: if I am running a Java process using JRE 1.6 with
```
com.sun.management.jmxremote
```
in the command line, does Java pick a default port for remote JMX connections?
Backstory: I am currently trying to develop a procedure to give to a customer that will e... | [
0.15024666488170624,
0.029806403443217278,
-0.03689584508538246,
0.02703879214823246,
0.06465441733598709,
-0.266594797372818,
0.11086636781692505,
0.07122430950403214,
-0.27597036957740784,
-0.5899252891540527,
0.11836263537406921,
0.5344251394271851,
-0.1573137491941452,
-0.0901062265038... | |
as possible and, if the situation looks too complicated to fix quickly, to restart the display console and allow it to reconnect to the server-side.
I am aware the I could run [jconsole](http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html) on JDK 1.6 processes and [jvisualvm](http://java.sun.com/javase/... | [
0.3193916380405426,
-0.049461498856544495,
0.5313528180122375,
-0.0871080681681633,
0.2623967230319977,
-0.10300681740045547,
0.18795184791088104,
0.051716115325689316,
-0.25910693407058716,
-0.8804312348365784,
-0.34776923060417175,
0.7955819964408875,
-0.01262666005641222,
0.214101150631... | |
that property at the command line, does Java pick another port for remote monitoring? If so, how could you determine what it might be?
The [documentation](http://java.sun.com/javase/6/docs/technotes/guides/management/agent.html) suggests that the JMX agent uses a **local** port -- something unreachable from outside the... | [
0.021329348906874657,
0.10068307816982269,
0.09930191189050674,
0.06338272988796234,
0.12035763263702393,
-0.3493579924106598,
0.5157507061958313,
0.09471546113491058,
-0.49728116393089294,
-0.46480560302734375,
-0.0011393034365028143,
0.49452635645866394,
-0.37828442454338074,
0.356529623... | |
listens to all local JMX connections and exports this information. This way, you don't need to have such magic configuration of each JVM instance on the server. Instead the local proxy can connect to all JVMs via JMX and then somehow expose this information remotely. I am not positive exactly how you would implement th... | [
0.45025724172592163,
0.007539794314652681,
-0.061503998935222626,
0.33537566661834717,
-0.3302166759967804,
-0.2443501353263855,
0.3759264051914215,
0.3622954785823822,
-0.18124130368232727,
-0.7791082262992859,
0.25486910343170166,
0.6531495451927185,
-0.1679406464099884,
0.05780230835080... | |
I'm working on a Wicket-based web application. In the application there are buttons that not every user is authorized to use. These buttons are actually simple links, e.g.
```
<a wicket:id="publishButton" title="Publish" class="rightPanel_publish"><wicket:message key="publish"/></a>
```
with a CSS class (from an ext... | [
0.2573252320289612,
0.1627713143825531,
0.4564160108566284,
-0.0711694061756134,
0.13566052913665771,
0.22833414375782013,
-0.057297416031360626,
-0.012581984512507915,
-0.34793761372566223,
-0.8095594644546509,
-0.09745591133832932,
0.022079184651374817,
-0.24978293478488922,
0.0468457825... | |
link is disabled (in Java) and the CSS, for some reason, is not used anymore.
**My question** is this: is there a way to identify that the link is disabled at runtime and change the CSS class? I would rather avoid using javascript (managed to keep the entire project JS-free so far...), and prefer something that would ... | [
0.09075573831796646,
0.08437681943178177,
0.44184547662734985,
0.11405516415834427,
-0.13428948819637299,
-0.0959949642419815,
0.35393026471138,
0.21494914591312408,
-0.4282439649105072,
-0.7502519488334656,
-0.056065768003463745,
0.43786969780921936,
-0.5817285180091858,
0.231011152267456... | |
is via JS.
However here is the JS that works in any browser (IE 6+, Safari, Opera, FF, etc),
```
if(document.getElementById('foo'))
{
document.getElementById('foo').className='bar';
}
``` | [
0.150761678814888,
0.1402418166399002,
0.44655081629753113,
-0.49732911586761475,
0.10324234515428543,
-0.17859943211078644,
0.44649767875671387,
0.1904841959476471,
-0.041403669863939285,
-0.7479706406593323,
-0.628831148147583,
0.4388759434223175,
-0.529080867767334,
0.10449963808059692,... | |
Leading on from my previous questions I am going to try and clarify one of the problems I am facing.
I am trying to create a multiplayer version of PacMan.
A simple overview of how i've made my application is that I have a server which has a ServerSocket which is constantly listening on a specific port. Once a clien... | [
0.47052472829818726,
0.011940260417759418,
0.2732156217098236,
0.054999563843011856,
-0.1234113946557045,
-0.21727561950683594,
0.21234461665153503,
0.31846728920936584,
-0.16552303731441498,
-0.84450763463974,
0.5424984097480774,
0.4972550570964813,
-0.2899921238422394,
0.2380831241607666... | |
the reverse of this sending the direction and then waiting for the update to be received. This is done using ObjectOutput/Input Streams.
There is also a game class which has all the game logic and this has the game loop which each looping calls each of the connected players serverThread.exchangeDatas() method.
My game... | [
-0.05575033649802208,
-0.01523501705378294,
0.09123653173446655,
0.008986211381852627,
-0.012372290715575218,
-0.15132372081279755,
0.47206825017929077,
0.039973579347133636,
-0.18402262032032013,
-0.6506928205490112,
0.2576112151145935,
0.7945118546485901,
-0.2687224745750427,
0.227654561... | |
Object o = in.readObject();
if (o instanceof Direction)
{
// Get new location
player.setDirection((Direction) o);
//System.out.println("Got: " + (Direction)o + " new location: " + player.getNextLocation());
}
// Send gameState | [
-0.44214025139808655,
-0.18227380514144897,
0.6320256590843201,
-0.07964383810758591,
0.370770663022995,
0.1640741229057312,
-0.029419289901852608,
-0.1102149710059166,
-0.2407810539007187,
-0.6157171130180359,
-0.40673619508743286,
0.4096675515174866,
-0.268538236618042,
0.329608350992202... | |
//System.out.println("Sending data");
Data data = new Data(game.getGameState(), game.getScared(), game.getScareLeft(), player.getLives(), player.getScore());
out.flush();
out.writeObject(data);
out.flush();
out.reset();
```
[Server code](http://pastebin.com/m1e8de96b)
[ServerT... | [
-0.11653502285480499,
-0.18636660277843475,
0.24660471081733704,
0.15893082320690155,
0.015200706198811531,
0.018556730821728706,
0.24388259649276733,
-0.022033492103219032,
-0.4145377576351166,
-0.9053659439086914,
-0.04969971626996994,
0.42158767580986023,
-0.4177098274230957,
0.34916767... | |
Are you using a synced stream (or syncing the access to the stream yourself)?
**Update:** The code sample given may very well be called from multiple threads. If multiple threads access the same stream, errors like the ones you are experiencing may very well occur.
I suggest having a look at <http://java.sun.com/docs... | [
0.57343590259552,
-0.20644843578338623,
0.00020763298380188644,
0.2617250084877014,
0.1279153823852539,
-0.12481708824634552,
0.43345847725868225,
0.015574225224554539,
-0.26367542147636414,
-0.6174074411392212,
0.031199995428323746,
0.6015226244926453,
-0.3805317282676697,
-0.038551650941... | |
Hey i have this div that shows as a popup:
```
<div class="popup">
</div>
```
Then with jquery i add another class to it to give it with the css associated to that class, position, size, color and transparency:
```
.show {
position: absolute;
color: #F4F5F6;
width: 600px;
margin-left: -300px;
he... | [
-0.030950667336583138,
0.02874535322189331,
0.8968661427497864,
-0.11916644871234894,
-0.2351231724023819,
0.015238219872117043,
0.06784005463123322,
-0.001080113579519093,
-0.0852988213300705,
-0.6516214609146118,
-0.18759296834468842,
0.27984121441841125,
-0.3314099907875061,
-0.10657754... | |
```
<div class="popup show">
<div class="image">
<img scr="blabla.png">
</div>
<div class="text">
ble ble ble
</div>
</div>
```
My problem is the following, even though i have overriden the opacity here:
```
div.image
{
position: relative;
float:left;
width:202;
height:402... | [
-0.29241830110549927,
0.02531854249536991,
0.6899865865707397,
-0.20356175303459167,
-0.20102114975452423,
0.29733744263648987,
0.24728752672672272,
-0.38532230257987976,
-0.26725485920906067,
-0.725824236869812,
-0.02123265154659748,
0.5277511477470398,
-0.4678288996219635,
0.187241002917... | |
opacity values without having to put the image div outside of the popup div?
What you want to do is have javascript fire off an AJAX request when the said element is clicked. This AJAX request will go to the server which can then invoke any java code you want.
Now you can build this all yourself or you could use one o... | [
0.18585829436779022,
-0.10232564806938171,
0.4084281027317047,
0.23033249378204346,
-0.2536192238330841,
-0.029212582856416702,
-0.08355193585157394,
-0.1175684779882431,
-0.3500162661075592,
-0.5684968829154968,
0.23222224414348602,
0.7111037373542786,
-0.5408561825752258,
-0.255934089422... | |
Does ASP.NET MVC provide a standard validator functionality or do you have to create your own validation manually? If the latter, is there any third party validator available that you can use on ASP.NET MVC web applications?
Shortly after I posted this answer I found [xval](http://xval.codeplex.com/) which is a validat... | [
0.6604763269424438,
0.16269348561763763,
0.5118905305862427,
0.21954351663589478,
-0.42437443137168884,
-0.2845122218132019,
-0.14491848647594452,
-0.1838938593864441,
-0.3156772553920746,
-0.17595183849334717,
0.1609540581703186,
0.09032098203897476,
-0.0838182121515274,
0.047027871012687... | |
I found this wonderful NSManagedObjectID. This would be very good for referencing an Entity/NSManagedObject/NSEntityDescription, right?
Let's get an ID from an entity:
```
NSEntityDescription *entity = [self newEntity];
NSManagedObjectID *objID = [entity objectID];
```
So... any idea how to get this `objID` ... | [
-0.20320715010166168,
0.15162548422813416,
0.3809894919395447,
0.3076954782009125,
0.23973964154720306,
-0.37190866470336914,
0.30778148770332336,
0.19132459163665771,
-0.3474961221218109,
-0.7307142615318298,
-0.08097001165151596,
0.4028080105781555,
-0.04067474976181984,
0.15658625960350... | |
[NSKeyedArchiver archivedDataWithRootObject:uri];
```
In order to get back to an instance of the original managed object, you need a CoreData stack with the persistent store holding that instance *already added* to the `NSPersistentStoreCoordinator`. Then:
```
NSData *uriData;
NSPersistentStoreCoordinator *psc;
NSMa... | [
-0.5640112161636353,
0.08626580983400345,
0.4678491950035095,
0.04994883015751839,
0.37233293056488037,
-0.017799310386180878,
0.48314768075942993,
0.09755278378725052,
-0.4480651319026947,
-0.7086020112037659,
-0.5233320593833923,
0.41837623715400696,
0.06846167892217636,
0.41469791531562... | |
I'm trying to add a space before every capital letter, except the first one.
Here's what I have so far, and the output I'm getting:
```
>>> tex = "ThisFileName.txt"
>>> re.sub('[A-Z].', ' ', tex)
' his ile ame.txt'
```
I want:
'This File Name.txt'
(It'd be nice if I could also get rid of .txt, but I can do that i... | [
0.13981421291828156,
0.14205847680568695,
0.5797507166862488,
-0.21082240343093872,
0.22475118935108185,
0.19084975123405457,
0.3387398421764374,
-0.30984175205230713,
-0.1403346210718155,
-0.8625450730323792,
-0.18321312963962555,
0.948573887348175,
-0.21471765637397766,
-0.20627814531326... | |
Given the following class definitions:
```
public class BaseClass
{
public string SomeProp1 { get; set; }
}
public class DerivedClass : BaseClass
{
public string SomeProp2 { get; set; }
}
```
How can I take a `List<BaseClass>` and convert it to a `List<DerivedClass>`?
In my real-world scenario `BaseClass` ... | [
0.05499384552240372,
-0.15348577499389648,
0.07218095660209656,
-0.022397253662347794,
-0.11056984961032867,
-0.14323166012763977,
0.23583965003490448,
-0.3505491614341736,
-0.15516455471515656,
-0.5481271743774414,
-0.10986420512199402,
0.4253685772418976,
-0.17466992139816284,
0.13378754... | |
(DerivedClass)instance);
```
Actually ConvertAll is good when you need to create new objects based on the original, when you just need to cast you can use the following
```
List<DerivedClass> result =
listBaseClass.Cast<DerivedClass>().ToList();
```
If not all of the items in your list can be cast to DerivedC... | [
0.13180047273635864,
-0.15176208317279816,
0.31353312730789185,
-0.2119280844926834,
-0.2514294981956482,
0.0031712567433714867,
0.3345140516757965,
-0.6247413158416748,
-0.11682943254709244,
-0.6731038093566895,
-0.014787211082875729,
0.6468424797058105,
-0.4796609878540039,
0.06836213916... | |
We are developing a web application that will be sold to many clients. There is already one client (a bank) which has decided that it will buy the product once it is ready. Unfortunately due to some miscommunication it came out rather late that the only browser they use is IE6. The application was already started with ... | [
0.7547491192817688,
0.25092676281929016,
0.36925506591796875,
-0.040733594447374344,
0.06464643031358719,
-0.11362070590257645,
0.07997489720582962,
0.09540009498596191,
0.006066459231078625,
-0.6833621859550476,
0.07772716879844666,
0.5351637005805969,
-0.17972348630428314,
0.029498711228... | |
after all...
The application isn't too far developed yet, and the design is pretty much OK, so the change isn't that horrible. Still, it'll take some work.
A nice thing about IE6 is that it supports two nonstandard and very helpful features. First is conditional comments, which lets me include some CSS/JS files only ... | [
0.3101534843444824,
-0.03893418610095978,
0.031060170382261276,
-0.08403855562210083,
-0.3265725374221802,
-0.16052234172821045,
0.1971680372953415,
0.14740413427352905,
-0.0929391011595726,
-0.8240823149681091,
-0.04168860986828804,
0.5493829846382141,
-0.2891101837158203,
-0.098664410412... | |
its JavaScript performance. I'm worried that using too many of these expressions might slow it down to a crawl. I also have no idea what computers the bank is using. Since it's a pretty big one, I'd expect a wide variety in all their branch offices. I don't expect to use anything much there - some simple math, ternary ... | [
0.5469952821731567,
0.27875062823295593,
-0.039687227457761765,
0.10932067036628723,
0.2084149867296219,
-0.003771106945350766,
0.47330835461616516,
0.011610031127929688,
-0.16801966726779938,
-0.5201512575149536,
0.04422178119421005,
0.489319384098053,
-0.05609883740544319,
-0.20814068615... | |
other hacks to get around the shortcomings. Thanx, people!
<https://developer.yahoo.com/blogs/ydn/high-performance-sites-rule-7-avoid-css-expressions-7202.html>
Turns out you might want to avoid using these, they are dangerous. | [
0.660585343837738,
-0.22715257108211517,
-0.12340656667947769,
0.28820881247520447,
-0.03422611951828003,
-0.3344002664089203,
0.41124531626701355,
0.5397416353225708,
-0.5254694223403931,
-0.30064043402671814,
0.11354458332061768,
0.46644192934036255,
-0.20275817811489105,
0.0084219612181... | |
I've moved a WebBBS board from one server to another. Ever since the board doesn't work.
I'm getting an Apache error whenever I try to access the board. Don't even know where to start the debugging, I'm not a Perl person. The file paths remained the same and there isn't any DB involved.
<http://gammonline.com/members/... | [
0.5985825657844543,
0.06424775719642639,
0.3614891469478607,
-0.16925634443759918,
-0.25545889139175415,
-0.27156513929367065,
0.7153170704841614,
0.2232140749692917,
-0.3126527965068817,
-0.6999807953834534,
0.3246287405490875,
0.38593554496765137,
-0.26966503262519836,
0.4652760624885559... | |
to find the error log and look at it.
If you are using CGI, the first step is to check you have given it the right permissions so it is an executable script at all.
```
chmod 755 index.cgi
``` | [
0.39383092522621155,
0.29466336965560913,
-0.03664494678378105,
0.036571405827999115,
0.06966117769479752,
-0.6018134951591492,
0.18209779262542725,
0.13393338024616241,
-0.2831200361251831,
-0.5480856895446777,
-0.3019719421863556,
0.5894368290901184,
-0.4837085008621216,
-0.0035860370844... | |
I am starting out with automated testing and I would like to test one of my data access methods. I am trying to test what the code does if the database returns no records.
Is this something that should be done in a unit test or an integration test?
Thanks
If your test code connects to an actual database and relies on... | [
0.7837889194488525,
0.21935488283634186,
-0.3102174997329712,
0.2068805992603302,
0.1373438686132431,
-0.25175583362579346,
0.1567079871892929,
0.019815808162093163,
0.13578423857688904,
-0.6017780303955078,
0.44869527220726013,
0.5885583162307739,
0.020375611260533333,
0.0828680545091629,... | |
actual data, whether that's a JDBC connection or web service proxy or whatever else. With a mock, you say "when this method is called, return this" or "make sure that this method is called N times", and then you tell the class under test to use the mock component rather than the real component. This then is a "unit tes... | [
0.23877596855163574,
-0.2171500027179718,
0.17965690791606903,
0.48059478402137756,
-0.05059466511011124,
0.15861214697360992,
0.06041570007801056,
-0.14637015759944916,
-0.15499772131443024,
-0.3762010931968689,
-0.25969159603118896,
0.426561564207077,
-0.03184628114104271,
0.123630248010... | |
be volatile and dependent on the state of another component.
Not sure what language/technology you are working with, but in the Java world, you can use JMock, EasyMock, etc for this purpose. | [
0.37131112813949585,
-0.05712801218032837,
-0.015150240622460842,
0.1686404049396515,
0.07141565531492233,
-0.5067018866539001,
0.33340200781822205,
0.2772781252861023,
0.15006718039512634,
-0.3009617328643799,
-0.1128958985209465,
0.9277225732803345,
-0.37913283705711365,
-0.2225931882858... | |
```
@search_results = Array.new
duplicates = Set.new
results.each { |result| @search_results.push(result) unless duplicates.add?(result[:url]) }
```
This piece of code is garbling the order of elements in the array @search\_results. Why would inserting the same element in a set and an array change the insertion or... | [
0.23876312375068665,
0.268972784280777,
0.13445749878883362,
-0.10077737271785736,
-0.15871940553188324,
-0.12066172808408737,
0.41354721784591675,
-0.27174562215805054,
-0.3677648901939392,
-0.4859292507171631,
-0.07706891000270844,
0.33792567253112793,
-0.7431769967079163,
0.136202380061... | |
want a guaranteed order.
This is supposedly fixed in Ruby 1.9 I believe.
**Edit:** I'm assuming your results in an Array, if its a Hash then order isn't guaranteed and you'll have to sort the keys, here's what my test looks like:
```
#!/usr/bin/ruby -W
require 'pp'
require 'set'
results = Array.new
results << {:u... | [
0.2029632031917572,
0.19624225795269012,
0.47772538661956787,
-0.05882195755839348,
-0.1432064324617386,
0.1023629754781723,
0.3196529448032379,
-0.5510692000389099,
-0.24842451512813568,
-0.4355742037296295,
0.0022245331201702356,
0.5284362435340881,
-0.4286854863166809,
-0.03218032419681... | |
`.nil?` add the end of `.add?` and here was my result:
```
## @search_results
[{:url=>"http://lifehacker.com"},
{:url=>"http://stackoverflow.com"},
{:url=>"http://43folders.com"},
{:url=>"http://lolindrath.com"}]
```
Now *that* was what I was expecting: is this what you mean by "garbled"?
**Edit 2:** Upon furthe... | [
0.40895748138427734,
0.32774096727371216,
0.2946227490901947,
-0.027819402515888214,
-0.18737095594406128,
-0.23660005629062653,
0.4233119785785675,
-0.17732690274715424,
0.022934017702937126,
-0.30914056301116943,
-0.10153262317180634,
0.5761438012123108,
-0.29872825741767883,
0.272022515... | |
I have a map defined like this
```
std::map<some_key_type, std::string::iterator> mIteratorMap;
```
And a huge string named "mHugeString". Then I walk trough the string collecting iterators like this:
```
std::string::iterator It=mHugeString.begin();
std::string::iterator EndIt=mHugeString.end();
for(;It!=EndIt;++I... | [
-0.019485751166939735,
0.023246724158525467,
0.419098436832428,
-0.0750686526298523,
0.13693639636039734,
0.05499069392681122,
0.22489972412586212,
-0.7419874668121338,
-0.2666909098625183,
-0.5226311683654785,
-0.10062947124242783,
0.5533643364906311,
-0.25874918699264526,
-0.067483171820... | |
was a stupid idea to store them anyways, but why trying to store an iterator in the begining of the string fails, and why the same with the iterators on the end works fine? What is the difference between them?
I haven't tried it but I would have expected that, of course you **can** store iterator values as values in a ... | [
0.04608054831624031,
0.3309319317340851,
0.2986302375793457,
0.10375768691301346,
0.23314256966114044,
0.10502880066633224,
0.2660938799381256,
-0.4069756269454956,
-0.4763411581516266,
-0.4566659927368164,
-0.06909937411546707,
0.4757320284843445,
-0.17133623361587524,
0.3983365595340729,... | |
Is there any real use for **self modifying code**?
I know that they can be used to build worms/viruses, but I was wondering whether there is some good reason that a programmer may have to use self modifying code.
Any ideas? Hypothetical situations are welcome too.
Turns out that the Wikipedia entry on "[self-modifyin... | [
0.38684800267219543,
0.1420760452747345,
-0.22318951785564423,
0.10408017039299011,
-0.07675784826278687,
-0.03860389441251755,
0.2405295968055725,
0.15260565280914307,
-0.38273680210113525,
-0.7744906544685364,
0.2595677077770233,
0.5965798497200012,
-0.4419424533843994,
0.009797461330890... | |
to perform
> the key comparison described in a
> specific invocation.
> 3. **Altering of inlined state** of an object, or simulating the high-level
> construction of closures.
> 4. **Patching of subroutine address calling**, as done usually at load time
> of dynamic libraries, or, on each
> invocation patching the... | [
0.2338167279958725,
-0.15813696384429932,
-0.23368777334690094,
0.08310329169034958,
-0.09201586991548538,
-0.08458612114191055,
0.647636353969574,
-0.2528403699398041,
-0.09110760688781738,
-0.6941702365875244,
-0.40743204951286316,
0.519795835018158,
-0.6952839493751526,
-0.0918197035789... | |
through use of a
> disassembler or debugger.
> 7. Hiding of code to **evade detection** by virus/spyware scanning software and
> the like.
> 8. Filling 100% of memory (in some architectures) with a rolling pattern
> of repeating opcodes, to **erase all
> programs and data**, or to **burn-in
> hardware**.
> 9. **Co... | [
0.2066175639629364,
-0.045062724500894547,
-0.18509353697299957,
0.14849700033664703,
0.11627781391143799,
-0.08948515355587006,
0.58484947681427,
-0.08025339990854263,
-0.2544412910938263,
-0.8580642342567444,
-0.726094663143158,
0.0832952931523323,
-0.49585336446762085,
-0.07642471790313... | |
Computer" machine that
> uses only the
> subtract-and-branch-if-negative
> "instruction" cannot do an indirect
> copy (something like the equivalent of
> "\*a = \*\*b" in the C programming
> language) without using self-modifying
> code.
> 11. Altering instructions for **fault-tolerance**
On the point about thw... | [
0.820856511592865,
0.024484004825353622,
0.11296553909778595,
0.26981139183044434,
-0.019017351791262627,
-0.40213921666145325,
0.17113277316093445,
-0.024690961465239525,
-0.13582907617092133,
-0.5615556836128235,
0.13908705115318298,
0.5554625988006592,
-0.35353705286979675,
0.2914766371... | |
I have a base class which is non-generic with a derived generic class. The AbstractRepository and ILoggingManager are provided by the IoC framework.
**Base Class**
```
public abstract class EventHandlerBase
: AbstractDataProvider
, IEventHandler
{
public EventHandlerBase(
AbstractRepository data,
... | [
0.013484162278473377,
-0.03662436828017235,
0.09977173060178757,
-0.017834598198533058,
-0.22999468445777893,
-0.14166119694709778,
0.0974910780787468,
-0.3514117896556854,
0.05526075139641762,
-0.5863744616508484,
-0.06417582184076309,
0.3942244350910187,
-0.30754414200782776,
-0.04491989... | |
: Contracts.DeliveryItemEventDetail
{
}
```
I would like to declare a constructor in the derived class that will call the non-generic base class, but I do not know the syntax.
Turns out that the Wikipedia entry on "[self-modifying code](http://en.wikipedia.org/wiki/Self-modifying_code)" has a great list:
> 1. **Semi... | [
0.185085728764534,
-0.09330736845731735,
0.20983752608299255,
-0.1705188900232315,
-0.07266711443662643,
-0.15787293016910553,
0.1628483086824417,
-0.3955352008342743,
-0.12200964987277985,
-0.654102623462677,
-0.2287466675043106,
0.47368937730789185,
-0.4814307689666748,
0.210890322923660... | |
an object, or simulating the high-level
> construction of closures.
> 4. **Patching of subroutine address calling**, as done usually at load time
> of dynamic libraries, or, on each
> invocation patching the subroutine's
> internal references to its parameters
> so as to use their actual addresses.
> Whether this... | [
0.291791170835495,
0.053647201508283615,
-0.22300662100315094,
0.280610054731369,
0.04249151423573494,
-0.21871498227119446,
0.7546484470367432,
-0.039293475449085236,
-0.2591191530227661,
-0.4996623694896698,
-0.6467506885528564,
0.15806734561920166,
-0.6284026503562927,
0.191531196236610... | |
software and
> the like.
> 8. Filling 100% of memory (in some architectures) with a rolling pattern
> of repeating opcodes, to **erase all
> programs and data**, or to **burn-in
> hardware**.
> 9. **Compression of code** to be decompressed and executed at runtime,
> e.g., when memory or disk space is
> limited.
>... | [
0.24069498479366302,
0.10422758758068085,
0.1540345400571823,
0.16812005639076233,
0.14148500561714172,
-0.1629190444946289,
0.2635822296142578,
-0.3220927119255066,
0.015241749584674835,
-0.6533063650131226,
-0.4230222702026367,
0.4164898097515106,
-0.416138619184494,
0.04328322783112526,... | |
like the equivalent of
> "\*a = \*\*b" in the C programming
> language) without using self-modifying
> code.
> 11. Altering instructions for **fault-tolerance**
On the point about thwarting hackers using self-modifying code:
Over the course of several firmware updates, DirectTV slowly assembled a program on their ... | [
0.9389927387237549,
-0.21839918196201324,
0.15660713613033295,
0.14072425663471222,
-0.14735934138298035,
-0.2757425010204315,
0.37921011447906494,
-0.018593300133943558,
-0.1511157602071762,
-0.08044229447841644,
0.06820037215948105,
0.5480577945709229,
-0.2907339930534363,
0.066961675882... | |
I have built a simple Eclipse plugin where a user may use a `TableViewer` of database resources to open an editor on any of those resources.
Users may therefore have zero upwards instances of the editor running.
Is there an API available to get a list of those editor instances?
You can get references to all open edi... | [
0.48275482654571533,
0.21286320686340332,
0.25463882088661194,
0.061138253659009933,
-0.1539168357849121,
-0.04254882037639618,
0.234669029712677,
-0.0769304484128952,
-0.132220059633255,
-0.7389481067657471,
0.13899432122707367,
0.6761111617088318,
-0.29447633028030396,
-0.034968052059412... | |
In SharePoint 2007, there's a top nav that the user can hover over, which reveals a dropdown menu of subitems. When they remove their mouse from the dropdown, it disappears, but only after a short delay. This can cause problems, as if people are trying to click a link on the page somewhere, but the nav menu hasn't hidd... | [
-0.30159592628479004,
-0.5832762718200684,
0.4224128723144531,
0.13060051202774048,
-0.08008085936307907,
-0.23349371552467346,
-0.003257779637351632,
0.308633029460907,
-0.4276186525821686,
-0.3614715039730072,
-0.1519870162010193,
0.10641001909971237,
-0.3605136573314667,
0.2901659309864... | |
the menu will suddenly appear and intercept their click when they weren't meaning to.
I've poked at core.js at some suspect areas, but can't seem to nail it down. Any thoughts?
This is the normal behaviour of SharePoint. This control is the asp:Menu control of ASP.Net 2.0 and the only thing you can do is customized th... | [
0.2511104345321655,
-0.2681560814380646,
0.1628241240978241,
0.0074194748885929585,
-0.06868316978216171,
-0.05699200928211212,
0.19824297726154327,
0.415185809135437,
-0.3649023771286011,
-0.7244332432746887,
-0.0677504688501358,
0.625483512878418,
-0.43059125542640686,
0.2031830698251724... | |
it in this position of the MasterPage. | [
-0.23123030364513397,
0.23700569570064545,
0.30573222041130066,
-0.10252586752176285,
0.5519904494285583,
-0.330865740776062,
0.06455037742853165,
0.3010091185569763,
-0.3613826632499695,
-0.8702124953269958,
-0.3087279498577118,
0.22050034999847412,
0.08453843742609024,
0.1662003397941589... | |
What is the concept of each?
When is it ok to shelve your changes instead of checking in?
Shelved means the changes are set aside for *you* to work on later.
Checked in means that the changes are made available to the rest of the team, will be in the build and will eventually ship.
Very different. Think of shelving... | [
0.4645642936229706,
-0.13277484476566315,
0.3091185688972473,
-0.09998780488967896,
0.11921170353889465,
0.101280078291893,
0.10946959257125854,
-0.09128938615322113,
-0.5678350329399109,
-0.6086053848266602,
-0.07289420813322067,
0.27628469467163086,
0.12197236716747284,
0.135623946785926... | |
I have a standalone enum type defined, something like this:
```
package my.pkg.types;
public enum MyEnumType {
TYPE1,
TYPE2
}
```
Now, I want to inject a value of that type into a bean property:
```xml
<bean name="someName" class="my.pkg.classes">
<property name="type" value="my.pkg.types.MyEnumType.TYP... | [
0.1272343248128891,
0.29596081376075745,
0.13931824266910553,
-0.1305108219385147,
-0.2366073578596115,
-0.20624707639217377,
0.14551667869091034,
-0.2806720435619354,
-0.053903233259916306,
-0.4201975166797638,
-0.12298966944217682,
0.3300197720527649,
-0.33620530366897583,
0.202576458454... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.