text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I am creating a mini program to find a specific hash key and to replace its source, but to do this I need to find the whole hash and replace it with a new hash the values the user input.
Example of my code.
```
print "Please input the smile you would like to edit: ";
$EditSmile = <STDIN>;
print "Please input the text... | [
0.00221829186193645,
0.007413628976792097,
0.8872082829475403,
-0.44733476638793945,
0.055526841431856155,
0.21208594739437103,
0.0961606428027153,
0.07051162421703339,
0.03269778937101364,
-1.0628972053527832,
-0.030861936509609222,
0.6994896531105042,
-0.5564213991165161,
0.1144476458430... | |
the file `info.pl`, which is included in the program.
The kind folks at Postgres Online Journal have pre-compiled the binaries for PLV8 for Windows
9.6: <http://www.postgresonline.com/journal/archives/367-PLV8-binaries-for-PostgreSQL-9.6-windows-both-32-bit-and-64-bit.html>
9.5: <http://www.postgresonline.com/journal... | [
-0.10333704948425293,
0.22384953498840332,
0.24397875368595123,
0.22719599306583405,
-0.09448273479938507,
0.2247486263513565,
0.1153007447719574,
-0.05326921120285988,
-0.1480264514684677,
-0.40859001874923706,
-0.35067740082740784,
0.5211004018783569,
-0.46922558546066284,
-0.03955110535... | |
In a Java application on a Mac, you can click the top bar and select Quit to exit the program. How can I add a listener to my JFrame to listen to this?
I did a search on this and found ApplicationListener, however Eclipse puts a "cross out" in this and seems to think its deprecated or something.
Specifically, I found... | [
0.4301896393299103,
0.14531071484088898,
-0.017729226499795914,
-0.07855972647666931,
-0.21307259798049927,
-0.4814585745334625,
0.4664836525917053,
0.05190277844667435,
-0.14084725081920624,
-0.5618229508399963,
0.18197230994701385,
1.0768253803253174,
-0.48332661390304565,
-0.13246566057... | |
This is a mock bank database problem involving deadlock. I already have what I think is the answer, but I'm curious if this is a good solution. The question posed is the following:
How do you prevent deadlock in the following code?:
```
void transaction(Account from, Account to, double amount)
{
Semaphore lock1, ... | [
0.42117244005203247,
-0.0031965721864253283,
0.3651221990585327,
-0.12379240989685059,
0.4815352261066437,
0.009410136379301548,
0.15727102756500244,
-0.3060202896595001,
-0.41112637519836426,
-0.07524514198303223,
-0.2827417552471161,
0.6196044087409973,
-0.3369072377681732,
0.34118938446... | |
signal(lock2);
signal(lock1);
}
```
The way this can become deadlocked is via two threads (or processes?) calling the transaction() method at the same time with opposing accounts, i.e.:
transaction(savings, checking, 1); in thread 1 and
transaction(checking, savings, 2); in thread 2.
From my poor understandi... | [
0.027171235531568527,
0.003842794569209218,
0.3965133726596832,
-0.2530524730682373,
0.29812294244766235,
0.07773150503635406,
0.1470213532447815,
-0.16557912528514862,
-0.596967339515686,
-0.3634047508239746,
-0.07236681133508682,
0.3800516128540039,
-0.5488223433494568,
0.359482884407043... | |
look like this when called:
```
//somewhere in main
Semaphore lock1, lock2;
lock1 = getLock(from);
lock2 = getLock(to);
wait(lock1);
wait(lock2);
transaction(checking, savings, 2);
signal(lock2);
signal(lock1);
//.....
```
with transaction looking like this:
```
void... | [
0.05344025045633316,
-0.09430327266454697,
0.41864287853240967,
-0.32262909412384033,
0.3070530295372009,
0.21344740688800812,
0.05183245241641998,
-0.23187966644763947,
-0.57233065366745,
-0.3855529725551605,
-0.35798341035842896,
0.2642531096935272,
-0.4499474763870239,
0.356611967086792... | |
java program, could you also use monitors by putting the word synchronized after void in the function declaration? Would that work? That seems like a smarter way to do it.
I also may not be understanding this at all, so feel free to school me, especially if my explanations are not accurate. Thanks.
> I think what is ... | [
0.47726738452911377,
-0.13461008667945862,
-0.21567866206169128,
0.019234979525208473,
-0.11561565846204758,
-0.41190019249916077,
0.34923088550567627,
0.004548079799860716,
-0.3101160228252411,
-0.5677824020385742,
0.22665809094905853,
0.5115026831626892,
-0.6606020331382751,
-0.112246140... | |
wait(fromLock);
```
which might cause deadlock.
What you need to do is insure that they always lock in the same order. You could use the id of the account somehow to figure out the order of the locks:
```
if (from.id < to.id) {
wait(fromLock)
wait(toLock)
transaction(checking, savings, 2);
signa... | [
0.28142663836479187,
-0.22896915674209595,
0.47215545177459717,
-0.19833092391490936,
0.6605839133262634,
0.01930084638297558,
0.13136562705039978,
-0.2940608561038971,
-0.47612226009368896,
-0.2378282994031906,
-0.2872205078601837,
0.6861193180084229,
-0.25631415843963623,
0.0412506200373... | |
also want to put a check for the `from` and `to` being the same entity. | [
0.522024929523468,
0.16000361740589142,
0.19462674856185913,
0.12189831584692001,
0.185690775513649,
-0.4733322560787201,
0.12731848657131195,
0.1718321442604065,
-0.16549648344516754,
-0.3827221989631653,
-0.0027043528389185667,
0.48400038480758667,
-0.009576383978128433,
0.29392999410629... | |
Redirect the site url http to https..for this i upload .htaccess file in my cpanl public\_html root directory.the code of the file as
```
RewriteEngine On
RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://sitename.in/$1 [R,L]
```
After i hosted this file also it's not redirecting my site to https protocol
... | [
-0.023263270035386086,
0.08897797763347626,
1.0368493795394897,
-0.2804613709449768,
-0.06409066915512085,
0.013429166749119759,
0.5254778861999512,
-0.13183820247650146,
-0.29010993242263794,
-0.7324066162109375,
-0.3182601034641266,
0.3373512327671051,
-0.4261361360549927,
0.587587952613... | |
What is the Difference between Web.config and global.asax ?
The web.config file specifies configuration data for the .NET application. The global.asax file handles application- and session-level events | [
0.13635709881782532,
-0.36846891045570374,
0.2983965277671814,
0.060935456305742264,
0.16773709654808044,
-0.22020043432712555,
-0.21126222610473633,
0.20103003084659576,
-0.17039978504180908,
-0.6751992106437683,
-0.052370667457580566,
0.43584170937538147,
-0.5897930264472961,
-0.15367090... | |
Suppose I have a text file with many lines, one of them being this:
```
<property name="HTTP_PORT" value="8080"></property>
```
And I want to change it to this with sed:
```
<property name="HTTP_PORT" value="80"></property>
```
How would I go about that? I have tried a number of things including these:
```
s... | [
-0.19624321162700653,
0.21095959842205048,
0.441713809967041,
-0.12360907346010208,
0.06448294222354889,
0.19743165373802185,
0.2741081416606903,
-0.36771947145462036,
0.07082065939903259,
-0.8499934077262878,
-0.22414936125278473,
0.4361177384853363,
-0.24779869616031647,
-0.2893926501274... | |
problem)** \**so given the context you are using, what is wrong with the traditional `.*` (zero or more)*\*
```
echo $'<property name="HTTP_PORT" value="8080"></property>'\
| sed 's/^\(.*\)value=\"8080\"\(.*\)$/\1value=\"80\"\2/g'
```
\*\* output \*\*
```
<property name="HTTP_PORT" value="80"></property>
```
Als... | [
-0.12005233019590378,
-0.020732849836349487,
0.5485148429870605,
-0.1719239503145218,
0.2379133254289627,
-0.06417611986398697,
0.2183750718832016,
-0.2807345688343048,
-0.5077728629112244,
-0.7252820134162903,
-0.17367851734161377,
0.8629793524742126,
-0.5319720506668091,
-0.0581120736896... | |
Just out of curiosity, between `<applet>` vs `<object>` for a Java applet, which one should I use? I know that `<applet>` is deprecated, however Sun still recommends the use of `<applet>`.
Is there any drawback between the two tags? Because when I use `<object>` for Mac in Safari, it causes a problem saying that the p... | [
-0.020299715921282768,
-0.07152561098337173,
0.34850430488586426,
-0.06531933695077896,
-0.10462796688079834,
-0.11013194173574448,
0.26204225420951843,
-0.06521449983119965,
-0.5235291719436646,
-0.6595711708068848,
-0.08467685431241989,
0.6046582460403442,
-0.6380660533905029,
-0.1605296... | |
a theoretical unification that would be a catch-all for any embedding of external data. It never worked well, and modern HTML development has effectively abandoned the unification idea. HTML5 introduces `audio` and `video`, for example and keeps `img` (logical unification would surely deprecate `img`, because an image ... | [
0.08783557265996933,
-0.029077073559165,
0.42307427525520325,
0.09164667874574661,
-0.1603652387857437,
-0.33149734139442444,
0.18793457746505737,
0.022573767229914665,
-0.1594361662864685,
-0.3427236080169678,
-0.3838702142238617,
0.4142109453678131,
-0.570317804813385,
0.2127329707145691... | |
Is it possible to shut down the whole phone by an app? How? Do I need to root the phone?
You need the DEVICE\_POWER permission in order to shut the phone completely off which requires the device being rooted.
You can use the PowerManager to get it to sleep or reboot.
<http://developer.android.com/reference/android/os... | [
0.28961730003356934,
-0.08695822954177856,
0.38227930665016174,
0.030647091567516327,
0.24058890342712402,
-0.35078272223472595,
0.6711131930351257,
-0.32247379422187805,
-0.1736679971218109,
-0.46993985772132874,
-0.5620859265327454,
0.8567643165588379,
-0.3931502103805542,
-0.20230489969... | |
i have this peace of code to validate submissions:
```
// Check to see if the URL is banned.
$array=parse_url($contenturl2);
$domaincheck = $array['host'];
$domaincheck1 = str_replace("www.", "", $domaincheck);
$domaincheck2 = "http://".trim($domaincheck1);
$domainchec... | [
0.3235757350921631,
0.20066136121749878,
0.7988449335098267,
-0.01558810006827116,
-0.19387187063694,
-0.417458176612854,
0.17292916774749756,
-0.4078061282634735,
0.14869055151939392,
-0.7410864233970642,
-0.06226303428411484,
0.17567142844200134,
-0.2566017508506775,
0.5429865717887878,
... | |
|| url = '$domaincheck' || url = '$domaincheck1' || url = '$domaincheck2' || url = '$domaincheck3') && url != ''";
$result = mysql_query($query);
if (mysql_num_rows($result)>0)
{
$_SESSION['submitstatus'] = "<div class=success><b>Sorry! This domain is banned from our networ... | [
-0.02240087278187275,
-0.1255894899368286,
0.7805442214012146,
-0.07245004177093506,
0.022134210914373398,
-0.35071325302124023,
0.7430230379104614,
-0.009181762114167213,
-0.2251075953245163,
-0.4451657831668854,
-0.6185140013694763,
0.44393157958984375,
-0.4455775022506714,
0.64309692382... | |
exit;
}
```
At some point its working, but not as it was suposed, because if i add "domain.com/content.html" to the ban list, the url will be banned, but not the domain, when i add the domain "domain.com" to the ban list i want this code to ban all the urls under this domain.
I dont post the whole file h... | [
0.31024476885795593,
0.11129181832075119,
0.5648651123046875,
-0.08472056686878204,
-0.02075432799756527,
-0.5715857148170471,
0.3209809362888336,
0.21586795151233673,
-0.17359451949596405,
-0.4941091239452362,
-0.22536906599998474,
0.344104528427124,
-0.5401612520217896,
0.500721573829650... | |
related:
$contenturl = clean\_string($\_POST['contenturl']);
$contenturl2 = strtolower($contenturl);
Whis $contenturl grabs the domains banned from sql.
I really hope someone can give me a clue on how to acomplish this.
Sincerely
Dani
You need the DEVICE\_POWER permission in order to shut the phone completely off ... | [
0.6909076571464539,
0.17660275101661682,
0.6099738478660583,
0.14388541877269745,
-0.05220441520214081,
-0.6176110506057739,
0.52347731590271,
-0.39137324690818787,
-0.328318327665329,
-0.400738000869751,
-0.1951354444026947,
0.8451533913612366,
-0.23658303916454315,
0.3033536672592163,
... | |
I am using Java EE 6 with all the reference implementations and I wonder how you can generate different responses based on the device accessing the page? At the moment when I develop a JSF page I target browsers running on PC. However I want to generate another HTML structure (that is, using another JSF page) when the ... | [
0.4306940734386444,
0.12709246575832367,
0.1547059416770935,
0.21456532180309296,
-0.09887367486953735,
-0.26042744517326355,
0.20680531859397888,
-0.02567940764129162,
-0.21426363289356232,
-0.7989307641983032,
0.05347878485918045,
0.40597298741340637,
-0.30629828572273254,
-0.00151767733... | |
reading about to do this?
I don't want to use Spring, I know they have something like this.
> *I don't want to use Spring, I know they have something like this.*
Just reinvent it then (*cough*).
[Let's look how they did it](https://www.google.com/search?q=spring%20mobile%20device%20detection). According to the [Spr... | [
-0.008711029775440693,
-0.3057776689529419,
0.7469886541366577,
-0.0393044576048851,
0.167566180229187,
-0.22673098742961884,
0.4662570655345917,
0.031926244497299194,
-0.12379349023103714,
-0.5157421231269836,
-0.3247038722038269,
0.6476529836654663,
-0.3069004416465759,
-0.11527340114116... | |
DeviceResolverHandlerInterceptor and it will be enabled for you.
it seems that they have ported [this piece of PHP code](http://plugins.trac.wordpress.org/browser/wordpress-mobile-pack/trunk/plugins/wpmp_switcher/lite_detection.php) to [this piece of Java code](http://git.springsource.org/spring-mobile/spring-mobile/b... | [
-0.23737959563732147,
-0.10539635270833969,
1.003894329071045,
0.007255015429109335,
0.1634383648633957,
-0.17475807666778564,
0.1621658056974411,
-0.4136742055416107,
-0.43467819690704346,
-0.6486430168151855,
-0.24921691417694092,
0.6435436010360718,
-0.20699186623096466,
-0.022111903876... | |
I need to build an array of pointers to dynamically allocated structures (DBrecord) and fill that array with input from another file. Not sure how to approach this.
The data file will have the number of entries first, followed by entries in a specific order.
numOfEntries
lastName firstName studentID year gpa expGrad... | [
-0.0650414302945137,
0.28141024708747864,
0.2906191349029541,
-0.10829378664493561,
-0.11819543689489365,
0.1756793111562729,
0.06387713551521301,
-0.272684782743454,
-0.11848942935466766,
-0.5362836718559265,
-0.15559269487857819,
0.16305360198020935,
0.26401767134666443,
0.47830983996391... | |
//student first name
char studentID[8]; //student ID
int age; //student age
class year; //year in school
float gpa; //GPA
int expGradYear; //expected graduation year
};
int numEntries; //total number of entries, first num in data file
struct DBrecord **ptrToDB;
//scan first int in d... | [
0.02546556666493416,
0.17142625153064728,
0.3005768656730652,
-0.028765443712472916,
0.17214122414588928,
0.5419381260871887,
0.16852717101573944,
-0.13481782376766205,
-0.04723101854324341,
-0.5589989423751831,
-0.5499251484870911,
-0.12234895676374435,
0.418154776096344,
0.37623780965805... | |
array of pointers to dynamically allocated structures
//fill that array with input from data file
//build 7 arrays of pointers to DBrecords, one for each field except DB ID
//sort each a different way
//note the 7 arrays are pointers, no copying
//print each of the 7 sorted arrays
return 0;
}
```
I can give you som... | [
0.09907524287700653,
-0.035451848059892654,
0.29537495970726013,
-0.12078950554132462,
-0.4400686025619507,
0.13566546142101288,
0.1376398503780365,
-0.6529068946838379,
-0.15492849051952362,
-0.44227299094200134,
-0.002897811820730567,
0.5742998719215393,
-0.5747618675231934,
-0.072139903... | |
struct variable without using "struct DBrecord", just "DBrecord". But that's optional. This is how it would look:
```
typedef struct {
int DBrecordID; // ID for each entry
char *lastName;
char *firstName;
char studentID[8];
...
} DBrecord;
```
Loading from file
-----------------
In this homework you ... | [
-0.16117525100708008,
0.4741664230823517,
0.25620436668395996,
-0.04998975619673729,
-0.08272628486156464,
-0.09340100735425949,
0.4126907289028168,
-0.2728891670703888,
-0.16610370576381683,
-0.5465962886810303,
-0.17358621954917908,
0.4411044716835022,
-0.22681164741516113,
0.19795332849... | |
it.
Portable way of working with files is by using FILE pointer. Let me show it (`stdio.h` must be included):
```
FILE *filePtr; // Define pointer to file
if((filePtr = fopen("records.txt", "r")) == NULL) // If couldn't open the file
{
printf("Error: Couldn't open records.txt file.\n"); // Printf error message
... | [
-0.1485506147146225,
-0.09434868395328522,
0.43609899282455444,
0.03006421960890293,
0.018084997311234474,
-0.1952008605003357,
-0.004068800248205662,
-0.25125202536582947,
-0.18267466127872467,
-0.8843297362327576,
-0.17626003921031952,
0.6077765226364136,
-0.10830709338188171,
0.18327061... | |
at the beginning of the file):
```
char buffer[100]; // Define the buffer
fgets(buffer, 100 /* size of buffer */, filePtr);
```
Now buffer contains the first line (without \n character) - number of records. Continue with converting the num's characters into integer (here `stdlib.h` also has to be included):
```
int... | [
-0.17436137795448303,
0.15170279145240784,
0.36745980381965637,
-0.11243539303541183,
0.14721213281154633,
0.3965018391609192,
0.02122722752392292,
-0.5943731069564819,
-0.16642352938652039,
-0.6733264923095703,
-0.062454503029584885,
0.43620070815086365,
-0.18692219257354736,
-0.045259743... | |
i < numOfRecords; i++)
{
recs[i] = (DBRecord *) malloc(sizeof(DBrecord));
}
```
Now you can acces array elements (= individual records) like this:
```
recs[0]->lastname /* two possibilities */
*(recs[0]).lastname
```
an so on.
Filling array with values from file
-----------------------------------
Now you kno... | [
0.20189711451530457,
-0.1329803466796875,
0.2641141414642334,
-0.11055166274309158,
0.07167787849903107,
0.07115427404642105,
0.32477134466171265,
-0.6264357566833496,
-0.21508947014808655,
-0.5935629606246948,
-0.20461106300354004,
0.6181160807609558,
-0.21801801025867462,
-0.133998975157... | |
you hit newline, then the for cycle continues.
You know the order of stored values in the file, so it shouldn't be hard for you.
If you don't get it, let me now in comments */
}
```
Is it somehow clearer now?
EDIT: File name as main's argument
----------------------------------
There are usually two ways of '... | [
-0.016960136592388153,
-0.06127263233065605,
0.4925784468650818,
-0.10818563401699066,
-0.08466945588588715,
0.029350703582167625,
0.18009723722934723,
0.018201036378741264,
-0.2683214247226715,
-0.5507386922836304,
-0.34623169898986816,
0.48800739645957947,
-0.2560283839702606,
0.34014350... | |
second one. Therefore you need to have main defined as this:
```
int main(int argc, char *argv[]) // this is important!
{
// code
return 0;
}
```
`argc` is integer which says, how much arguments were passed to the program. `argv` is array storing them. Remember, that the first argument is name of the program... | [
-0.2466234713792801,
-0.010662561282515526,
0.2953205406665802,
-0.3162856996059418,
-0.08464960753917694,
-0.10186000168323517,
0.037154532968997955,
-0.16298255324363708,
-0.3132891058921814,
-0.3700824975967407,
-0.20295707881450653,
0.5187994837760925,
-0.5734556317329407,
0.1998555958... | |
if the name of the records file is passed to the program via `./program < records.txt`, which means that "records.txt" (without quotes) will be passed (redirected) to program's standard input.
Therefore to handle that, you can do this:
```
char filename[50]; // buffer for file's name
scanf("%s", &filename); // reads ... | [
0.259215772151947,
0.05595376342535019,
0.3425045311450958,
-0.0649944543838501,
0.2779373526573181,
0.16134163737297058,
-0.16013266146183014,
-0.2780672013759613,
-0.1789269745349884,
-0.7225821614265442,
-0.4443387985229492,
0.3125954866409302,
-0.1511640101671219,
0.3605627715587616,
... | |
is this behaviour will be valid in C#
```
public class MyClass
{
private byte[] data;
public MyClass()
{
this.data = new byte[1024];
}
public unsafe byte* getData()
{
byte* result = null;
fixed (byte* dataPtr = data)
{
result = dataPtr; | [
-0.16654513776302338,
-0.29162168502807617,
0.38303622603416443,
-0.42386454343795776,
-0.08273088186979294,
0.0005037821829319,
0.4697551727294922,
-0.0847630724310875,
-0.25268080830574036,
-0.3541242182254791,
-0.3793301284313202,
0.4803212583065033,
-0.5603957772254944,
0.1199086457490... | |
}
return result;
}
}
```
If you are going to turn off the safety system then **you are responsible for ensuring the memory safety of the program**. As soon as you do, **you are required to do everything safely without the safety system helping you**. That's what "unsafe" means.
As the C# specification cle... | [
0.18357056379318237,
0.12288256734609604,
0.3572830259799957,
-0.0662432536482811,
0.5740928053855896,
-0.388696551322937,
0.36038944125175476,
-0.04970961809158325,
-0.10166734457015991,
-0.15687152743339539,
-0.6279982328414917,
0.5164132714271545,
-0.20831331610679626,
0.154882356524467... | |
and then using it after the duration of the fixed statement, so the address is no longer *valid*. You are therefore specifically required to *not do precisely what you are doing*.
You should not write any unsafe code until you have a thorough and deep understanding of what the rules you must follow are. Start by read... | [
0.6932214498519897,
0.19819800555706024,
-0.10007740557193756,
-0.17435438930988312,
0.18371683359146118,
-0.5117114782333374,
0.6670148372650146,
-0.355701208114624,
0.24349887669086456,
-0.5079155564308167,
-0.27795174717903137,
0.5177422165870667,
-0.3076817989349365,
-0.156241729855537... | |
I am writing a peer to peer application and I want to implement simple symmetric encryption.
I'm looking for a good example of how to do this, I don't mind which library it uses so long as it's free.
Preferably all the encryption would happen at the socket layer so I wouldn't need to change my code at all.
Can some... | [
0.11730395257472992,
0.19045613706111908,
0.03204645216464996,
-0.02321096695959568,
-0.22094343602657318,
-0.2501465380191803,
0.27094385027885437,
-0.15997955203056335,
-0.15314562618732452,
-0.7220115661621094,
-0.10957667976617813,
0.5084364414215088,
-0.17034736275672913,
-0.048258800... | |
I am trying to learn Ruby on Rails and trying to write some of the code by hand so that I learn how it works.
I made this tiny controller:
```
class TestsController < ApplicationController
def test
def show
render :text => "Hi from TestsController!"
end
end
end
```
and this is what is le... | [
0.017540382221341133,
0.19913822412490845,
0.36335355043411255,
-0.06633861362934113,
-0.1516081690788269,
-0.1616535186767578,
0.6832872629165649,
-0.19503383338451385,
0.17142239212989807,
-0.6419495940208435,
0.11613432317972183,
0.351266473531723,
-0.2951168715953827,
-0.10635467618703... | |
of rake routes:
```
home_index GET /home/index(.:format) home#index
root / home#index
test POST /test(.:format) tests#create
new_test GET /test/new(.:format) tests#new
edit_test GET /test/edit(.:format) tests#edit
GET /test(.:format) | [
0.32386818528175354,
-0.10283344984054565,
0.3210046589374542,
0.34795108437538147,
0.2083309143781662,
0.05708884820342064,
0.5738142728805542,
-0.2552880346775055,
0.43327686190605164,
-0.7893486618995667,
0.04309726879000664,
0.26242944598197937,
0.2577493190765381,
0.2829941511154175,
... | |
tests#show
PUT /test(.:format) tests#update
DELETE /test(.:format) tests#destroy
```
A basic controller looks like this:
```
class TestsController < ApplicationController
def show
end
end
```
You do not need the `respond_to` block if you only want to render the default view ... | [
0.1408458948135376,
-0.1105048730969429,
0.3848322629928589,
0.06153273954987526,
-0.17200914025306702,
-0.33567026257514954,
0.2650667130947113,
-0.28038597106933594,
0.1597161889076233,
-0.6156626343727112,
-0.4372656047344208,
0.39309078454971313,
-0.3118503987789154,
0.0353639647364616... | |
In MVC Pattern: when user types something, Control will "translate" user input to Model to process data.
But, in other scene, for example my form has a list box and load data from database when it's loading.
So, the loading method I should put in The View or I should call this through Control.
For example:
View:
```... | [
0.16887347400188446,
-0.20296993851661682,
0.5291582345962524,
-0.12578816711902618,
-0.2832395136356354,
-0.04435364156961441,
0.1199151799082756,
-0.1448410451412201,
-0.17474880814552307,
-0.7665419578552246,
-0.22209987044334412,
0.6690681576728821,
-0.5169917941093445,
0.0712279081344... | |
pattern, called [Observer](http://en.wikipedia.org/wiki/Observer_pattern), whereby the model is the subject, and the view an observer.
That means that the model notifies the view, when there is new data available. | [
0.401406466960907,
-0.377119243144989,
0.06177525594830513,
0.061978913843631744,
0.00394666101783514,
-0.2403235286474228,
0.009793838486075401,
-0.10945522040128708,
-0.5266830325126648,
-0.6580597758293152,
-0.21637235581874847,
0.22519613802433014,
-0.5818323493003845,
0.31019523739814... | |
I'm trying to declare a global variable from within a class like so:
```
class myclass:
global myvar = 'something'
```
I need it to be accessed outside the class, but I don't want to have to declare it outside the class file. My question is, is this possible? If so, what is the syntax?
In your question, you spec... | [
-0.30388641357421875,
0.013246450573205948,
0.14732542634010315,
-0.010536535643041134,
-0.13365678489208221,
-0.16160418093204498,
0.03636624291539192,
0.2798656225204468,
-0.33856144547462463,
-0.5338538289070129,
-0.2903309166431427,
0.32912081480026245,
-0.31721219420433044,
0.12801609... | |
mymodule
myinstance = myclass()
print(mymodule.myvar)
```
Also, in response to your comment on @phihag's answer, you can access myvar unqualified like so:
```py
from mymodule import myvar
print(myvar)
```
If you want to just access it shorthand from another file while still defining it in the class:
```py
class... | [
0.10082128643989563,
0.3026752471923828,
0.42578527331352234,
0.03450154513120651,
-0.11236356943845749,
0.07097000628709793,
0.08355379849672318,
0.04824203997850418,
-0.14448080956935883,
-0.8281688690185547,
-0.20064301788806915,
0.2721139192581177,
-0.06562915444374084,
0.3050618469715... | |
I know there are already some questions and extensive answers about RMagick for Ruby 1.9.x, but I still have problems installing it.
I am working with the Ruby-Aptana Plugin for Eclipse and I have already installed the DevKit. I have tried to install RMagick as follows:
1. I have downloaded and installed ImageMagick ... | [
0.39665600657463074,
0.12006694823503494,
0.4701039493083954,
-0.32875972986221313,
-0.5114362835884094,
-0.21571765840053558,
0.5998413562774658,
-0.28514763712882996,
-0.20410171151161194,
-0.4994452893733978,
0.14273439347743988,
0.8202003836631775,
-0.5243905186653137,
-0.0132038667798... | |
and C:\ImageMagick-6.7.6-Q16
CPATH --> C:\ImageMagick-6.7.6-Q16\include
LIBRARY\_PATH --> C:\ImageMagick-6.7.6-Q16\lib
3. I installed the rmagick gem: gem install rmagick
Unfortunately I still get the error:
```
Temporarily enhancing PATH to include DevKit...
Buidling native extensions. This could take a while... | [
0.3059067130088806,
0.11553025245666504,
0.5405786633491516,
-0.04180395230650902,
-0.3671894967556,
-0.11712759733200073,
0.8832768201828003,
-0.2566787302494049,
-0.1886943280696869,
-0.6090378165245056,
-0.10027828812599182,
1.0921286344528198,
-0.13393595814704895,
0.029606837779283524... | |
respect this when answering my (perhaps silly) question.
Thank u all for you help!
I would ditch RMagick altogether.
RMagick eats up a ton of memory. There are other ruby wrappers for ImageMagick out there that I have had an easier time using.
<https://github.com/probablycorey/mini_magick>
MiniMagick is pretty strai... | [
0.5588415265083313,
0.10278758406639099,
0.17294326424598694,
0.3083534240722656,
-0.2253604680299759,
-0.046642620116472244,
0.5554412603378296,
0.4441301226615906,
0.0705021321773529,
-0.6666706204414368,
0.07312044501304626,
0.5822005867958069,
0.23932234942913055,
-0.01794649288058281,... | |
I am new to Extjs4 and the javascript world in general. I have looked up the documentation and samples and trying to get a basic CRUD grid up and running with my spring backend.
I have a confusion related to the proxy in extjs, are they in the store or model according to the MVC paradigm ?
I have a controller.js def... | [
0.27532610297203064,
0.05777764692902565,
0.4423139989376068,
-0.049489088356494904,
-0.19896404445171356,
-0.2577693462371826,
0.18842647969722748,
0.1412438601255417,
-0.21752949059009552,
-0.7039687633514404,
0.039747871458530426,
0.5018238425254822,
-0.21581721305847168,
0.176698297262... | |
using jackson at the backend for automatic conversion to java objects but somehow that is not working (for add and update only).
How do i link these all up ?
a) Add a user .. do i create a new UserModel and then invoke a rest call like so or is it automatically supported by the proxy specified in the model ?
```
var... | [
0.11217857152223587,
0.08783960342407227,
0.32748910784721375,
0.12274700403213501,
0.260484516620636,
0.2672558128833771,
0.44775697588920593,
-0.38293159008026123,
-0.31190499663352966,
-0.5595322847366333,
-0.12399617582559586,
0.34457632899284363,
-0.5783237218856812,
0.215130031108856... | |
// .. what about /update ?
```
b) I am using the RowEditing plugin .. how can i fetch the roweditor in my controller.js where the reference for the view is available
Thanks in advance
relevant code listings ...
//UserController.js
```
Ext.define('App.controller.UsersController', {
extend : 'Ext.app.Controller'... | [
0.2978588938713074,
-0.11746920645236969,
0.8283753395080566,
-0.22071801126003265,
-0.07631046324968338,
0.27759915590286255,
0.14225974678993225,
-0.18132151663303375,
-0.1746164709329605,
-0.8569604158401489,
0.028186284005641937,
0.7172886729240417,
-0.47080197930336,
0.148850694298744... | |
}); },
views : ['user.List','user.Edit'],
stores : ['UsersStore'] ,
models : ['UserModel'],
editUser : function(grid,record)
{
// empty record
var record = new App.model.UserModel();
// created new record
//How to get a reference to the roweditor here and then save that to the backend ?
//store = Ex... | [
0.13017472624778748,
0.08663582801818848,
0.8714157342910767,
-0.2847510874271393,
0.2658998668193817,
0.41977420449256897,
0.09280005842447281,
-0.5138602256774902,
-0.34024354815483093,
-0.650059700012207,
-0.15661847591400146,
0.6480783820152283,
-0.42769646644592285,
0.3122462332248688... | |
this.columns = [
{header: 'SNo', dataIndex: 'userID', width:50},
{header: 'UID', dataIndex: 'userUID', flex: 1, editor: 'textfield', allowBlank:false},
{header: 'Name', dataIndex: 'userName', flex: 1, editor:'textfield',allowBlank:false},
{ header: 'Level', dataIndex: 'userLevel'... | [
-0.2246866524219513,
-0.196560338139534,
0.6881614327430725,
0.0693817138671875,
0.13690216839313507,
0.26596391201019287,
0.0987778753042221,
-0.35258039832115173,
0.05332713574171066,
-0.5981736779212952,
-0.3250931203365326,
0.4476475715637207,
-0.43928298354148865,
-0.2887112498283386,... | |
store : [
['Level 1','Level 1'],
['Level 2','Level 2'], | [
0.11707001179456711,
0.1633220613002777,
0.18073394894599915,
0.2852059602737427,
0.29135411977767944,
0.26316913962364197,
0.030711745843291283,
-0.0018245569663122296,
0.02316688932478428,
-0.2947385311126709,
-0.5602439641952515,
0.3546275794506073,
0.06557806581258774,
0.11097095161676... | |
['Level 3','Level 3']
]
}
},
{header: 'Email', dataIndex: 'emailID', flex: 1, editor: 'textfield'}
];
this.callParent(arguments);
},
dockedItems : [{
xtype : 'toolbar',
items : [{ | [
-0.13318482041358948,
-0.1277128905057907,
0.7142277956008911,
0.030721615999937057,
0.24095793068408966,
0.30560964345932007,
0.07045715302228928,
-0.23863635957241058,
-0.11188694834709167,
-0.31942689418792725,
-0.1726379245519638,
0.5720856785774231,
-0.5259255766868591,
-0.02669115178... | |
text: 'Add',
iconCls: 'icon-add',
action: 'add'
}]
}]});
```
//Model.js
```
Ext.define('App.model.UserModel', {
extend: 'Ext.data.Model',
fields: ['userID','userUID','userName', 'userLevel' ,'emailID'],
proxy : {
type: 'ajax',
api :
{
read : 'rest/user/fetchAll',
... | [
-0.4119824171066284,
-0.16762493550777435,
0.7131637930870056,
-0.18259507417678833,
0.19549492001533508,
0.278836727142334,
0.08729010820388794,
-0.11243175715208054,
-0.026386262848973274,
-0.6515944004058838,
-0.4299757182598114,
0.7072277069091797,
-0.4603273570537567,
-0.2136468440294... | |
destroy : 'rest/user/deleteUser'
},
reader :
{
type : 'json',
root : 'users',
successProperty : 'success'
},
writer :
{
type : 'json',
allowSingle : 'true' | [
-0.3184378445148468,
0.10032504051923752,
0.24348796904087067,
-0.00824915710836649,
0.31953927874565125,
-0.00980144739151001,
0.7665594220161438,
0.0700027197599411,
0.0820034071803093,
-0.6287578344345093,
-0.5356374382972717,
0.5241429805755615,
-0.1992405503988266,
0.26956087350845337... | |
}
}});
```
//UserStore
```
Ext.define('App.store.UsersStore', {
extend: 'Ext.data.Store',
model: 'App.model.UserModel',
autoLoad : true});
```
//Sample Java controller
```
@Controller
@RequestMapping("/rest/user")
public class UserController {
@RequestMapping(value = "/fetchAll" , method= RequestMethod.GET)
pub... | [
-0.09361454844474792,
-0.5550928115844727,
0.5849810242652893,
-0.1436140090227127,
0.10181482136249542,
0.23081901669502258,
0.24653196334838867,
-0.8321394324302673,
-0.32894015312194824,
-0.6749138832092285,
-0.26862820982933044,
0.5344453454017639,
-0.40467584133148193,
0.0183036979287... | |
createUser(@RequestBody List<User> users)
{ ... }
}
```
1. I would put Proxy's inside store objects, not models. But that just personal preference.
2. When you add record to the store object, if it has autoSync property set to true it would automatically generate create request. What exactly is happening with... | [
0.6689335703849792,
0.03638864681124687,
0.2896963059902191,
-0.08712320774793625,
-0.06382471323013306,
-0.36548179388046265,
-0.029525937512516975,
0.0243641696870327,
0.05387717857956886,
-0.8643832206726074,
0.33382049202919006,
0.4925370216369629,
-0.43441104888916016,
0.2194331139326... | |
I read that the javascript language has characteristics that assist in the implementation of non-blocking IO which contributes to the success of projects like [node.js](http://nodejs.org/). My question is what are these characteristics and why is non-blocking IO trickier to implement in other languages?
The reason that... | [
0.2906758487224579,
-0.0018660384230315685,
0.030755123123526573,
0.043432168662548065,
-0.30342453718185425,
-0.2951771914958954,
0.28217825293540955,
0.2083192765712738,
-0.41820675134658813,
-0.39923641085624695,
-0.0021190510597079992,
0.25934332609176636,
-0.39113765954971313,
0.00321... | |
waiting for a callback from an anonymous callback/ajax function. I'm not sure if this is what you read, but an explanation offered in one Node tutorial is:
"The other method, the one taken by Node and some extremely fast modern servers such as Nginx and Thin, is to use a single non-blocking thread with an event loop. ... | [
0.05827966332435608,
-0.3451100289821625,
-0.17229494452476501,
-0.14656962454319,
-0.2676200866699219,
-0.24358311295509338,
0.3222165107727051,
0.37239155173301697,
-0.4114171862602234,
-0.4198203682899475,
-0.09260941296815872,
0.3017927408218384,
-0.4554189443588257,
0.0453912913799285... | |
perform some type of I/O and pass it a callback function and JavaScript automatically creates a closure, making sure that the correct state is preserved even after the calling function has long since gone out of scope."
source: <http://net.tutsplus.com/tutorials/javascript-ajax/this-time-youll-learn-node-js/>
In refe... | [
0.19415995478630066,
-0.13566577434539795,
0.14580418169498444,
-0.09898068755865097,
0.009495720267295837,
-0.47491660714149475,
0.4573580026626587,
0.18837182223796844,
-0.2728244364261627,
-0.7857726216316223,
-0.38911497592926025,
0.3816947638988495,
-0.16899245977401733,
-0.0412191376... | |
bad: <http://teddziuba.com/2011/10/node-js-is-cancer.html> (Link broken)
and here for a rebuttle: <http://rhyolight.posterous.com/nodejs-is-not-cancer> (Link broken) | [
-0.23428557813167572,
-0.12604676187038422,
0.19915589690208435,
-0.19815346598625183,
-0.011147410608828068,
0.06592942774295807,
0.2484167367219925,
0.3735327124595642,
-0.3456181287765503,
-0.3641595244407654,
0.03929467499256134,
0.050231531262397766,
-0.27273327112197876,
0.2533478140... | |
I am building a Rails app, and it seems that common practice is to have javascript\_include\_tags listed on top of a page.
Would it makes browers load javascript before loading the document, and thus makes visible elements take longer to load?
Thank you.
Looks like some answers were right, but none sums it all up:
... | [
0.5859881639480591,
0.26785117387771606,
0.35438597202301025,
0.10320229083299637,
-0.1231517344713211,
-0.0005267750821076334,
0.504116952419281,
-0.3107483685016632,
-0.0714188665151596,
-0.6146166920661926,
0.4274621605873108,
0.48448026180267334,
-0.11523378640413284,
-0.42127543687820... | |
files even when the HTML page changes.
* Aggregate and minify all your javascript files into one. Why? Because the fewer HTTP requests your clients make, the faster the page loads.
Also, you don't have to care about `$(document).ready()` or `window.onload`, since all your HTML elements will be loaded before the javasc... | [
0.6078128814697266,
-0.06720535457134247,
0.48037847876548767,
0.1974543333053589,
-0.15267428755760193,
-0.23628082871437073,
0.34700825810432434,
-0.20090533792972565,
-0.4102430045604706,
-0.9345735907554626,
-0.31418776512145996,
0.4135390520095825,
-0.31931328773498535,
-0.01443696022... | |
I am reading in multiple files in with millions of lines and I am creating a list of all line numbers that have a specific issue. For example if a specific field is left blank or contains an invalid value.
So my question is what would be the most efficient date type to keep track of a list of numbers that could be upw... | [
0.19728095829486847,
-0.06946262717247009,
0.1923592984676361,
0.2803860902786255,
-0.17526285350322723,
0.2895587086677551,
0.03073951229453087,
0.13833792507648468,
-0.2668841779232025,
-0.6667352914810181,
0.10294190049171448,
0.05175148695707321,
-0.21030214428901672,
0.241720661520957... | |
So in the case of a String Builder, I would check the previous value and if it is is only 1 more I would change it from 1 to 1-2 and if it was more than one would separate it by a comma. With the List, I would just add each number to the list and then combine then once the file has been completely read. However in this... | [
0.18721696734428406,
-0.3212049603462219,
0.5487550497055054,
-0.3376672863960266,
0.058995578438043594,
-0.009093420580029488,
0.13024139404296875,
-0.7209774851799011,
-0.388591468334198,
-0.5623675584793091,
0.21097080409526825,
0.32972925901412964,
-0.38023626804351807,
0.1892780363559... | |
subCurrentLine = new StringBuilder();
StringBuilder subCurrentLineSub = new StringBuilder();
int indexLastSpace = currentLine.LastIndexOf(' ');
int indexLastDash = currentLine.LastIndexOf('-');
int currentStringInt = 0;
if (sbCurrentLineNumbers.Length == 0)
{
sbCurrentLineNumbers.Append(lineCount);
}
else if (in... | [
-0.575365424156189,
-0.6977205276489258,
1.2532395124435425,
-0.33073365688323975,
0.19208784401416779,
0.13837508857250214,
0.4175404906272888,
-0.8164498805999756,
-0.15862824022769928,
-0.5989328026771545,
-0.4278617799282074,
0.19776099920272827,
-0.22811776399612427,
0.351454168558120... | |
currentStringInt = Convert.ToInt32(currentLineSub);
if (currentStringInt == lineCount - 1)
sbCurrentLineNumbers.Append("-" + lineCount);
else
{
sbCurrentLineNumbers.Append(", " + lineCount);
commaCounter++;
}
}
else if (indexLastSpace < indexLastDash)
{
currentLineSub = curr... | [
-0.6503350138664246,
-0.7451044321060181,
1.0547584295272827,
-0.29153305292129517,
0.1741040050983429,
0.1296377032995224,
0.08625847846269608,
-0.6941998600959778,
-0.13656307756900787,
-0.5432120561599731,
-0.1460968255996704,
0.29530617594718933,
-0.3177250623703003,
0.1897788643836975... | |
sbCurrentLineNumbers.Replace(charOld, charNew);
else
{
sbCurrentLineNumbers.Append(", " + lineCount);
commaCounter++;
}
}
```
> My end goal is to out put a message like "Specific field is blank on 1-32, 40, 45, 47, 49-51
If that's the end goal, no point in going through an intermediary ... | [
-0.0738389641046524,
-0.23672114312648773,
0.718910276889801,
-0.32640382647514343,
-0.018944216892123222,
0.15678444504737854,
0.5039530992507935,
-0.5341602563858032,
-0.14552158117294312,
-0.6343136429786682,
-0.07795919477939606,
0.314321368932724,
-0.3875439763069153,
-0.0747388154268... | |
I have a list of MyObjects which I need to divide into three groups:
1. Known good (keep)
2. Known bad (reject)
3. Unrecognized (raise alert)
MyObject contains various properties which must be examined to determine which of the 3 groups to put the object in.
My initial implementation (Java) just takes a List in its ... | [
-0.14096586406230927,
0.1803281158208847,
0.10943195223808289,
-0.40361902117729187,
-0.2133476734161377,
0.06460846960544586,
0.28758740425109863,
-0.5233492255210876,
0.12405131757259369,
-0.5789073705673218,
-0.04435189440846443,
0.30404138565063477,
-0.6411378383636475,
0.0857262834906... | |
sub-list of bad items
}
public List<MyObject> getUnrecognized() {
// return sub-list of unrecognized items
}
}
```
Any issues with this implementation? Is there a better OO choice?
I would probably prefer a static factory method to do the filtering, that then calls a private constructor that takes the three... | [
0.11061511188745499,
0.2223227471113205,
0.17561838030815125,
0.028280412778258324,
-0.22788210213184357,
-0.12575708329677582,
0.2403322458267212,
0.004098418168723583,
-0.21231922507286072,
-0.7118655443191528,
-0.2871665358543396,
0.6159185171127319,
-0.4839997887611389,
-0.023368041962... | |
I am using a WebForms GridView control. When a user clicks "Update" on a row, I want to check the values they entered against some other records.
From that, if I return true, I'd like to display a confirm dialog asking the user if they'd like to continue with their update.
A javascript confirm dialog probably won't ... | [
0.5987348556518555,
0.18012496829032898,
0.5785171985626221,
0.1131398007273674,
0.22723343968391418,
-0.14481425285339355,
-0.018611274659633636,
0.05229594558477402,
0.11066023260354996,
-0.7222623825073242,
0.27692413330078125,
0.6408591866493225,
-0.2210485190153122,
0.263016015291214,... | |
a confirmation if they're different
See this [jsFiddle](http://jsfiddle.net/XjypN/4/) for a demonstration.
```
<script type="text/javascript">
validateInput = function(inputDate, compareDate, confirmButtonID) {
var confirmButton = document.getElementById(confirmButtonID);
if... | [
0.5632745623588562,
-0.11431214213371277,
0.5650928616523743,
0.050616126507520676,
0.07732066512107849,
-0.12169276922941208,
0.07446486502885818,
-0.46591854095458984,
0.24153761565685272,
-0.3049384355545044,
0.16815584897994995,
0.3312539756298065,
-0.057267170399427414,
0.199433282017... | |
var result = dates.compare(inputDate, compareDate);
if (result != 0){ //change to suit your needs
return confirm("Are you sure you want to save these changes?");
}
return | [
0.43895086646080017,
-0.4091889262199402,
0.5036024451255798,
-0.2059059590101242,
0.6022717952728271,
0.4326286017894745,
0.138805091381073,
-0.2667848467826843,
-0.17602738738059998,
-0.4651002585887909,
-0.09066367894411087,
0.3367185890674591,
-0.041506048291921616,
0.08133842051029205... | |
true;
});
} | [
-0.13691823184490204,
-0.07384937256574631,
0.2462165355682373,
-0.5814964175224304,
0.23657366633415222,
-0.2089478224515915,
0.6882109642028809,
0.1830461323261261,
0.26944902539253235,
-0.09337763488292694,
-0.4568653404712677,
1.0073962211608887,
-0.15711314976215363,
0.225699484348297... | |
}
</script>
```
And here's the code for the `dates` class used for the comparison ([link](https://stackoverflow.com/questions/497790)):
```
<script type="text/javascript">
var dates = {
convert:function(d) {
return (
d.constructor === Date ? d :
d.... | [
0.14706800878047943,
-0.008302226662635803,
0.27243685722351074,
-0.19425053894519806,
0.09128516167402267,
0.24682587385177612,
-0.03589324280619621,
-0.4470883011817932,
0.0074067674577236176,
-0.6610882878303528,
-0.2197936326265335,
0.28628483414649963,
-0.11207807809114456,
0.13498890... | |
Date(d[0],d[1],d[2]) :
d.constructor === Number ? new Date(d) :
d.constructor === String ? new Date(d) :
typeof d === "object" ? new Date(d.year,d.month,d.date) :
NaN
); | [
0.06110281124711037,
-0.18703100085258484,
0.442381888628006,
-0.24771223962306976,
0.0777970626950264,
0.4697911739349365,
-0.004599227104336023,
-0.1520267277956009,
-0.22001276910305023,
-0.45656540989875793,
-0.3353559374809265,
0.20066550374031067,
0.10840858519077301,
0.7064533233642... | |
},
compare:function(a,b) {
return (
isFinite(a=this.convert(a).valueOf()) &&
isFinite(b=this.convert(b).valueOf()) ?
(a>b)-(a<b) :
NaN | [
-0.28760188817977905,
-0.21448920667171478,
-0.024335186928510666,
-0.17039306461811066,
0.0976768359541893,
0.48546102643013,
0.2855078876018524,
-0.364929735660553,
-0.08371342718601227,
-0.42701032757759094,
0.23755089938640594,
0.8572413921356201,
-0.09540417790412903,
0.22240461409091... | |
);
},
inRange:function(d,start,end) {
return (
isFinite(d=this.convert(d).valueOf()) &&
isFinite(start=this.convert(start).valueOf()) &&
isFinite(end=this.convert(end).valueOf()) ? | [
-0.19515687227249146,
-0.2999599277973175,
0.5875786542892456,
-0.4692510962486267,
0.5007118582725525,
0.17691770195960999,
0.2922843098640442,
-0.6379677057266235,
0.08476538211107254,
-0.33018726110458374,
-0.40737998485565186,
0.8397148251533508,
-0.2602267861366272,
0.1767834722995758... | |
start <= d && d <= end :
NaN
);
}
}
</script>
```
In the `RowDataBound` event of the `GridView`, assign the `onchange` function for each row:
```
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
var inputCtrl = e.Row.FindControl("txtEnteredDat... | [
-0.2946762144565582,
-0.39328017830848694,
0.6326995491981506,
-0.4076854884624481,
0.20797932147979736,
0.4006780683994293,
0.16575157642364502,
-0.21932034194469452,
-0.027409587055444717,
-0.752238929271698,
-0.46762314438819885,
0.6721048355102539,
-0.3699426054954529,
0.08344199508428... | |
if (updateButtonCtrl != null)
{
inputCtrl.Attributes["onchange"] = string.Format("return validateInput(this.value, '{0}', '{1}');", DataBinder.Eval("DateToCompare"), updateButtonCtrl.ClientID);
}
}
}
```
**jQuery Confirmation Dialog**
If you need something more flexible than a reg... | [
0.38564860820770264,
-0.257326602935791,
0.437480092048645,
0.19997112452983856,
0.10084579139947891,
-0.2431463748216629,
-0.08896836638450623,
-0.3202670216560364,
0.06086141616106033,
-0.46578550338745117,
-0.19397851824760437,
0.4985036551952362,
0.04971132427453995,
0.0685312151908874... | |
How do output the directory size in Linux?
I am currently using "du /root/test" but I get the following result:
754 /root/test
I need to output only the number like:
754
```
du /root/test | awk '{print $1}'
``` | [
0.37373313307762146,
0.07628139853477478,
0.10255147516727448,
-0.3145134449005127,
-0.060396868735551834,
-0.01592111401259899,
0.1480281949043274,
-0.1243804469704628,
-0.12333913147449493,
-0.6104953289031982,
0.08007168024778366,
0.779059648513794,
-0.2949793040752411,
0.10634796321392... | |
I am just starting to learn Ruby (first time programming), and have a basic syntactical question with regards to variables, and various ways of writing code.
Chris Pine's "Learn to Program" taught me to write a basic program like this...
```
num_cars_again= 2
puts 'I own ' + num_cars_again.to_s + ' cars.'
```
This... | [
0.38904085755348206,
0.5171408653259277,
-0.016962669789791107,
0.12232010811567307,
-0.012404339388012886,
0.018857542425394058,
0.24247725307941437,
0.044186417013406754,
-0.20389218628406525,
-0.48997366428375244,
0.19856798648834229,
0.6360243558883667,
0.06557516753673553,
0.056678656... | |
should use one format over the other?
Whenever TIMTOWTDI (there is more than one way to do it), you should look for the pros and cons. Using "string interpolation" (the second) instead of "string concatenation" (the first):
**Pros:**
* Is less typing
* Automatically calls `to_s` for you
* More idiomatic within the Ru... | [
0.34563201665878296,
-0.09607025980949402,
0.030378784984350204,
-0.19252744317054749,
-0.17705436050891876,
-0.07947829365730286,
0.6655676364898682,
-0.1311340630054474,
-0.24418021738529205,
-0.6065344214439392,
-0.28937432169914246,
0.6067488193511963,
-0.4908841848373413,
-0.156177803... | |
a habit of using `'`, or you previously typed a string using that and only later needed to use string interpolation) | [
0.1335446685552597,
-0.041838642209768295,
0.07001827657222748,
-0.21251332759857178,
0.0019197628134861588,
-0.059968043118715286,
0.534261167049408,
-0.037487614899873734,
-0.34960779547691345,
-0.3791731297969818,
-0.3361651301383972,
0.2836717963218689,
-0.5127305388450623,
-0.19489447... | |
I have tried to place the slider on every page on this website: <http://atripathi.com>
It works on the homepage, but doesn't work on any of the other pages (About, Services, etc.)
I know it's probably an easy fix, but I can't get it at the moment.
Thank you for any help or suggestions!
Your `$tag_array` looks like t... | [
0.4065995514392853,
-0.08493229746818542,
0.8781720399856567,
0.09241233766078949,
-0.014187240973114967,
-0.037190888077020645,
0.06906452029943466,
-0.36211496591567993,
-0.21576321125030518,
-0.4970983564853668,
0.06729484349489212,
0.7509288787841797,
-0.5463749170303345,
-0.0620974749... | |
["tag"]=> string(3) "php"
}
[3]=> array(1){
["tag"]=> string(5) "mysql"
}
}
```
It's actually an array of arrays, you can't use `implode` on it. The "Array to string" conversion happens because each element of the array is an array, which PHP need to convert to a string in order to "implode" them.... | [
-0.026309456676244736,
-0.06909376382827759,
0.47217705845832825,
-0.28607749938964844,
-0.15080204606056213,
-0.17494657635688782,
0.18925906717777252,
-0.5096232295036316,
-0.2867952585220337,
-0.4759243130683899,
-0.2888076603412628,
0.6481394171714783,
-0.6228424906730652,
0.1643898785... | |
$query_str = 'SELECT DISTINCT user_id FROM tags WHERE tag IN ("'. implode('","', $tag) .'")';
```
If you don't have PHP 5.3, you can do it this way:
```
function get_tag_users($tag_array)
{
$tag = array_map(create_function('$a', 'return $a["tag"];'), $tag_array);
$query_str = 'SELECT DISTINCT user_id FROM ta... | [
-0.1506093144416809,
-0.05590426176786423,
0.6737542152404785,
-0.18932609260082245,
-0.228813037276268,
-0.10556893050670624,
0.1643124222755432,
-0.31103697419166565,
-0.2287648469209671,
-0.4723970890045166,
-0.2538740932941437,
0.566148042678833,
-0.4136310815811157,
0.1253703981637954... | |
I am on linux mint 12. I have created a virtualenv called `userena`. and then i installed [django-userena](http://django-userena.org/) using pip in that virtualenv. I need to edit some django-usrena files. Where are they located?
To see where your virtualenv files are, enable it and issue the following bash command:
`... | [
0.34482502937316895,
0.14894279837608337,
0.19790253043174744,
-0.1697845757007599,
-0.015801168978214264,
-0.30177780985832214,
0.32233214378356934,
0.15171733498573303,
-0.20967964828014374,
-0.8392447233200073,
-0.11308374255895615,
0.7682565450668335,
0.06812288612127304,
-0.0396533757... | |
What is `th-ruby-include= directory` in rails app root?
I did't touch it.
I'm considering add this directory into `.gitigore` or just delete it everytime I see it.
If this is a directory in your project, it was created outside of Rails. Likely your editor saved a file without your full understanding.
I would norma... | [
0.27783119678497314,
0.14285624027252197,
-0.159538134932518,
0.07160262018442154,
0.10314206779003143,
-0.24616676568984985,
0.7006223797798157,
0.06590467691421509,
-0.007434040307998657,
-0.5983526706695557,
0.06262059509754181,
0.4302322566509247,
-0.37502321600914,
0.3269490599632263,... | |
I know you can change a line in a text file using sed in bash that shows something like;
name="applicationname" //this is not the issue (it varies, thats why i use a var)
Depiction: <http://google.com>
or
Depiction: <http://yahoo.com> //some times the 'value' in depiction varies
to
Depiction: <http://mysite.com/d... | [
0.5499443411827087,
0.08276542276144028,
0.35942259430885315,
-0.0024746276903897524,
-0.3245730996131897,
0.2780102789402008,
0.015524547547101974,
-0.26044249534606934,
-0.2671748101711273,
-0.9902852177619934,
0.2659381926059723,
0.5141371488571167,
0.023549819365143776,
0.0512563958764... | |
answer with many trials and errors... so just to share. :)
```
if grep -Fq "Depiction:" ./file
then
sed -i "s!Depiction:.*!Depiction: http://mysite.com/depiction.php?package=$name" ./file
else
sed -i 1i"Depiction: http://mysite.com/depiction.php?package=$name" ./file
fi
``` | [
0.2607212960720062,
0.13919764757156372,
0.32219773530960083,
0.17004510760307312,
-0.2857297360897064,
0.43915316462516785,
-0.17425338923931122,
-0.4481757879257202,
-0.2819191813468933,
-0.8768808841705322,
-0.018973076716065407,
0.3074185848236084,
-0.1433129459619522,
0.02004081755876... | |
In one [C++ coding style guide](http://www.appinf.com/download/CppCodingStyleGuide.pdf),
I found one particular recommendation (page 41, recommendation number 53):
> Always have non-lvalues on the left side (`0 == i` instead of `i == 0`).
And I don't uderstand what is this good for? Are to sticking to this practice?... | [
0.4068526029586792,
0.298311710357666,
0.1679527312517166,
-0.13039955496788025,
0.23408666253089905,
-0.09844180196523666,
-0.07327346503734589,
-0.1604473739862442,
-0.19149154424667358,
-0.5377326011657715,
0.07535389065742493,
0.45791974663734436,
-0.2442176192998886,
-0.15198999643325... | |
good, old **[Yoda condition](http://www.dodgycoder.net/2011/11/yoda-conditions-pokemon-exception.html)**!!!
 | [
0.26620012521743774,
0.304167777299881,
0.24333637952804565,
-0.02664295770227909,
0.1391955316066742,
-0.47848832607269287,
0.6063244938850403,
0.12914685904979706,
-0.03506239131093025,
-0.11581582576036453,
-0.29638779163360596,
0.5373315811157227,
-0.16423743963241577,
0.32000878453254... | |
Got a question for you javascript gurus out there. I'm creating a sidebar tool that is comprised of a few different text input fields. The purpose of this tool is to edit copy on a template. I've tried to pass the data entered into the field onchange, but I'm running into problems dumping the data into my js object. Th... | [
1.0751821994781494,
0.017084266990423203,
0.33373183012008667,
-0.016836175695061684,
-0.07866117358207703,
0.19932028651237488,
-0.027308804914355278,
-0.0013605003478005528,
-0.08289634436368942,
-0.6207876801490784,
0.3160995543003082,
0.6040112376213074,
-0.6287664771080017,
0.01971430... | |
and then I can parse the changes to my database.
Wouldn't a simply keyup event on the input fields be sufficient?
jQuery:
```
$('textarea').keyup(function() {
$('#foo').html($(this).val());
});
```
HTML:
```
<textarea></textarea>
<div id="foo"></div>
```
**[jsFiddle example](http://jsfiddle.net/j08691/T4mX6... | [
-0.027874525636434555,
0.07612913846969604,
0.706710696220398,
-0.4320219159126282,
0.0675353929400444,
0.11815521866083145,
0.20411664247512817,
-0.3562564551830292,
-0.037662435322999954,
-0.6954567432403564,
-0.2341693639755249,
0.7490570545196533,
-0.26643598079681396,
-0.0826947018504... | |
How does Tomcat locate webapps directory? Where is this location set? Is it a relative directory?
It can be changed in the `$CATALINA_BASE/conf/server.xml` in the `<Host />`. See the Tomcat documentation, specifically the section in regards to the Host container:
[Tomcat 6 Configuration](http://tomcat.apache.org/tomca... | [
-0.11471262574195862,
-0.12551620602607727,
0.6707979440689087,
0.04033119976520538,
0.1561482548713684,
-0.06746631115674973,
0.2079150676727295,
0.035273268818855286,
-0.44968941807746887,
-0.3444771468639374,
-0.19050221145153046,
0.6316242814064026,
-0.15826788544654846,
-0.09403336793... | |
I was reading about buffer, stack and heap overflows. I read this [post](http://www.h-online.com/security/features/A-Heap-of-Risk-747161.html) as well. my question is like that: if I use only global variables in my code, can I say it prevents all the exploits of overflow?
let's say I have this buffers in code declare... | [
-0.04658859968185425,
0.20072150230407715,
0.22531118988990784,
-0.15946494042873383,
0.06111558526754379,
-0.038371678441762924,
0.2048347443342209,
-0.26600950956344604,
-0.27214211225509644,
-0.5266585350036621,
-0.19572028517723083,
0.36866697669029236,
-0.4742988049983978,
0.093985632... | |
code segment and data segment is not executable.
Can we conclude that using Globals is the safest way?
It doesn't matter where your data is. If you try hard enough, you can write outside it. Whether or no any stack buffer overrun might be used to overwrite a return address and cause code in the buffer to be executed, ... | [
-0.16090430319309235,
0.3341226577758789,
0.3686761260032654,
0.11077964305877686,
0.14383827149868011,
-0.05086364597082138,
0.18954293429851532,
0.10792672634124756,
-0.4592481851577759,
-0.4969867765903473,
-0.13327163457870483,
0.5955398678779602,
-0.4839339256286621,
-0.01154783554375... | |
ever load data into dynamicaly-allocated buffers inside buffer classes, so stack buffer overruns have never been a problem in my apps, (and besides, I just don't overrun buffers!). | [
0.15793345868587494,
0.0971580520272255,
0.18587462604045868,
0.13877958059310913,
0.15956838428974152,
-0.30757299065589905,
0.657012403011322,
0.8360608220100403,
-0.396221399307251,
-0.7554708123207092,
-0.21292173862457275,
0.6349814534187317,
-0.21800930798053741,
-0.26500508189201355... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.