text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I am practicing using pointers.
I have a pointer to an array of 3 strings: "dog", "cat", "rat".
I can print the contents using a `for` loop and using an array.
However, I am having problems printing them using pointer arithmetic. I would like to increment the pointer to the next element in the array. However, all it... | [
0.42686665058135986,
0.3643639087677002,
0.41395294666290283,
-0.5762759447097778,
-0.18550832569599152,
0.375031054019928,
0.5452412366867065,
-0.5038894414901733,
-0.018798403441905975,
-0.688629150390625,
0.0430341511964798,
0.5600203275680542,
-0.5402976274490356,
0.1188868060708046,
... | |
< 3; i++)
{
printf("str: %s\n", str[i]);
}
/* display using a pointer arthimatic */
while((*str)++)
{
printf("str: %s\n", str);
}
getchar();
return 0;
}
```
How can I accomplish this?
Edit:
### Code:
```
while(str)
{
printf("str: %s\n", *(str++));
}
```
However, I g... | [
-0.2832109332084656,
0.04692962020635605,
0.6442928910255432,
-0.44111645221710205,
-0.194066122174263,
0.1528509557247162,
0.8498908281326294,
-0.40516167879104614,
-0.05890048295259476,
-0.6368217468261719,
-0.3559001684188843,
0.6450213193893433,
-0.3143906891345978,
0.00438092183321714... | |
A last NULL pointer can be used for that. So the code becomes
```
char *str[] = { "DOG", "CAT", "RAT", NULL };
char **elem_p = str;
/* display using a pointer arthimatic */
while(*elem_p) {
printf("str: %s\n", *elem_p);
elem_p++;
}
```
What you did was to increment the pointer stored in the array's first el... | [
0.074592225253582,
-0.11879710108041763,
0.7039350867271423,
-0.32532140612602234,
-0.10912615060806274,
0.15254029631614685,
0.24404767155647278,
-0.38172203302383423,
-0.33691078424453735,
-0.5982462763786316,
-0.25538370013237,
0.5261501669883728,
-0.36770129203796387,
0.059944350272417... | |
first element to `printf` (you pass the array, but the compiler will convert it to a pointer - see below). `Printf` will interpret the bytes of those pointers as characters and print them, which will result in garbage printed out if it doesn't crash right away.
You want to increment at a higher level instead: Incremen... | [
0.01000235602259636,
0.1425522118806839,
0.2935709059238434,
-0.05383651331067085,
-0.20872671902179718,
0.003573999274522066,
0.05919039249420166,
-0.24492688477039337,
-0.05023741349577904,
-0.39330554008483887,
-0.41277778148651123,
0.500301718711853,
-0.5389320254325867,
-0.15177899599... | |
it. So, we create a pointer which points to `str[0]` initially, but increment it all again. Note that we increment it after printing, so that we print out the first element too.
Actually, i think i should explain why you can't do `str++`. Well, `str` is an array. An array is an object that occupies some fixed amount ... | [
0.1681484431028366,
0.10971486568450928,
0.283719003200531,
0.025414302945137024,
-0.09882637858390808,
-0.031003935262560844,
0.05995149165391922,
-0.1231083869934082,
-0.2480352371931076,
-0.49095460772514343,
-0.30343395471572876,
0.2716473937034607,
-0.36325615644454956,
0.152054429054... | |
up a pointer out of an array in expressions, which then can be used to address elements in the array. If you do `str++`, the compiler will create a pointer for you. But that pointer is temporary, exists only for a short while for the sole purpose of immediately doing something with it, but it can not be changed like be... | [
0.07060234993696213,
0.26140788197517395,
0.5462494492530823,
-0.009740853682160378,
-0.10652654618024826,
0.1577153503894806,
0.06531497091054916,
-0.2799138128757477,
-0.3913537263870239,
-0.7086963653564453,
-0.2143709510564804,
0.04296685755252838,
-0.4830194413661957,
0.06245372816920... | |
Suppose you're working in a language with variable length arrays (e.g. with `A[i]` for all `i` in `1..A.length`) and have to write a routine that takes `n` (`n : 1..8`) variable length arrays of items in a variable length array of length `n`, and needs to call a procedure with every possible length `n` array of items w... | [
0.28792381286621094,
-0.09272660315036774,
-0.1574382483959198,
0.15477555990219116,
0.1546429991722107,
0.19346973299980164,
0.03955975919961929,
-0.3569546043872833,
-0.2792585492134094,
-0.5540775060653687,
0.03883476182818413,
0.2435280829668045,
-0.5430293083190918,
0.1076356992125511... | |
'bow tie', 'cravat', 'ascot', 'bolo'] ... ['jackboots','galoshes','sneakers','slippers']]
```
and make the following procedure calls (in any order):
```
try_on ['top hat', 'bow tie', ... 'jackboots']
try_on ['top hat', 'bow tie', ... 'galoshes']
:
try_on ['derby','bolo',...'slippers']
```
This is sometimes called... | [
-0.20026643574237823,
-0.14213477075099945,
0.16621771454811096,
-0.08056999742984772,
0.2293076068162918,
0.4247220456600189,
0.13902835547924042,
-0.24806632101535797,
-0.1349269449710846,
-0.33093181252479553,
-0.5412032008171082,
0.36893606185913086,
-0.1550377756357193,
0.111157760024... | |
register( [ii,i2,i3] )
```
But what if `n` can vary, giving a signature like:
```
procedure register_combination( items : vararray of vararray of An_item)
```
The code as written contained an ugly case statement, which I replaced with a much simpler solution. But I'm not sure it's the best (and it's surely not the... | [
0.23623211681842804,
0.16957318782806396,
0.16053801774978638,
0.21990497410297394,
-0.1632808893918991,
0.07734902948141098,
0.47575822472572327,
-0.4276330769062042,
-0.2420566827058792,
-0.35271114110946655,
-0.1356576681137085,
0.38047361373901367,
-0.2626586854457855,
-0.0998338609933... | |
I'll post my solution later today, after others have had a chance to respond.
Teaser: I tried to sell a recursive solution, but they wouldn't go for it, so I had to stick to writing fortran in a HLL.
The answer I went with, posted below.
Since they were opposed to recursion (don't ask) and I was opposed to messy case... | [
-0.03828338906168938,
0.06702540814876556,
0.33031803369522095,
0.09405677020549774,
-0.09584203362464905,
0.10060646384954453,
0.34245237708091736,
-0.28559961915016174,
-0.26603153347969055,
-0.3982146680355072,
-0.2605085074901581,
0.05574903264641762,
-0.31557855010032654,
-0.186808645... | |
possible_combinations = possible_combinations * item_list.length
for i from 0 to possible_combinations-1
index = i
this_combination = []
for each item_list in items
item_from_this_list = index mod item_list.length
this_combination << item_list[item_from_this_list]
... | [
0.23315374553203583,
-0.2501567006111145,
0.29015663266181946,
-0.0324174202978611,
0.17616742849349976,
0.3313206136226654,
0.15544116497039795,
-0.76012122631073,
-0.5046935677528381,
-0.7225865721702576,
-0.22284181416034698,
0.23758967220783234,
-0.5555515885353088,
-0.0028532999567687... | |
register_combination(this_combination)
```
Basically, I figure out how many combinations there are, assign each one a number, and then loop through the number producing the corresponding combination. Not a new trick, I suspect, but one worth knowing.
It's shorter, works for any practical combination of list lengths ... | [
0.29609188437461853,
-0.005679699592292309,
0.19497530162334442,
0.07360347360372543,
0.2825099229812622,
-0.00858089979737997,
0.21384693682193756,
-0.4179551601409912,
-0.4219977557659149,
-0.4014189839363098,
0.04494349658489227,
0.22308148443698883,
-0.41009750962257385,
-0.12993200123... | |
This is about syntactic sugar in Haskell. A simple Haskell program:
```
main = do
args <- getArgs
let first = head args
print first
```
I use binding in the first line (`args <- getArgs`) and a pure assignment in the second one (`let first = ...`). Is it possible to merge them together into a readable one-line... | [
-0.26544639468193054,
0.09166129678487778,
0.16481930017471313,
-0.16288958489894867,
-0.4525754153728485,
-0.10358136892318726,
0.1680019348859787,
0.018453875556588173,
0.029416872188448906,
-0.37941932678222656,
-0.16784730553627014,
0.375719279050827,
-0.5208761096000671,
-0.3015674650... | |
let us not forget pattern matching:
```
main = do { arg:_ <- getArgs; print arg }
```
or if you like layout
```
main = do
arg : _ <- getArgs
print arg
```
When possible, most Haskellers prefer pattern matching over `head` and `tail`. | [
-0.25319406390190125,
-0.057141903787851334,
0.15630178153514862,
-0.1386253833770752,
-0.11767211556434631,
-0.3535643219947815,
0.4021676182746887,
0.3734976351261139,
-0.08965828269720078,
-0.7194486260414124,
-0.30552414059638977,
0.6443621516227722,
-0.4535948932170868,
-0.15568102896... | |
Let's say I have a simple class called `WebsterDictionary` that has a function that can take a word and return its definition. Perhaps there is another function that can take a definition and return a word. The class is used all the time by many clients.
To facilitate the lookups, the class contains a member variable... | [
0.28022658824920654,
0.1652580052614212,
0.008656398393213749,
0.14605386555194855,
-0.14469259977340698,
0.05387049540877342,
0.0740235224366188,
0.2071932554244995,
0.08534295856952667,
-0.4675239622592926,
0.28123560547828674,
0.6228710412979126,
-0.09976404160261154,
0.3674578666687011... | |
classes should be stateless...but this class has state (the in-memory dictionary) right?
**EDIT:** Also, if this does become a static class, when do I initialize the Dictionary since there would no longer be a constructor? Do I do check to see if the reference to the Dictionary is null every time one of the static met... | [
-0.08095449209213257,
-0.1516687572002411,
-0.05778449401259422,
0.27357035875320435,
-0.08449229598045349,
-0.07956958562135696,
0.4219221770763397,
0.17029675841331482,
-0.0333390086889267,
-0.867246150970459,
-0.17578990757465363,
0.46632081270217896,
-0.3803492486476898,
0.283539474010... | |
I am considering the possibility of designing an application that would allow people to develop C++ code graphically. I was amazed when I discovered Scratch (see [site](http://scratch.mit.edu/) and [tutorial videos](http://info.scratch.mit.edu/Support/Videos)).
I believe most of C++ can be represented graphically, wi... | [
0.17513461410999298,
0.2851491868495941,
-0.0888652354478836,
-0.08767366409301758,
-0.30517271161079407,
0.1699017435312271,
-0.005559508688747883,
0.015497593209147453,
-0.18294544517993927,
-0.6485363841056824,
-0.1602950543165207,
0.7606720328330994,
-0.020825274288654327,
-0.347177267... | |
sized applications
* manual coding is faster for experienced programmers
* C++ is too complicated a language for such an approach
Considering that we -at my work- already have quite a bit of existing C++ code, I am not looking for a completely new way of programming. I am considering an alternate way of programming th... | [
0.5716751217842102,
0.15043631196022034,
0.18263866007328033,
0.166634663939476,
-0.21523070335388184,
0.027358654886484146,
-0.04853958636522293,
0.16441766917705536,
-0.6783437132835388,
-0.676636278629303,
0.07289052754640579,
0.6901904344558716,
-0.05369085818529129,
-0.119858741760253... | |
programming, I tend to agree with your answers. This is why, ideally, I'll find a way to let the user always choose between typing and graphical programming. A line-by-line parser (+partial interpreter) might be able to convert typed code into graphical design. It *is* possible. Let's all cross our fingers.
**Are ther... | [
0.5101466178894043,
0.09779547899961472,
-0.19839702546596527,
0.21225522458553314,
-0.2675774395465851,
-0.02950456738471985,
0.07111672312021255,
-0.12352460622787476,
-0.011217596009373665,
-0.7042079567909241,
0.1722227782011032,
0.7904950380325317,
-0.36415818333625793,
-0.28736865520... | |
top node is the class itself, the next ones (if any) are typedef instructions inside the class. Bottom nodes are template arguments. Edges, of course, connect classes to template arguments for instantiations.
I already have a prototype for working on such type-level diagrams.
**If you feel this way of representing tem... | [
0.17192938923835754,
0.05434052646160126,
0.02291504666209221,
0.42766493558883667,
-0.140842467546463,
0.016235794872045517,
0.393726646900177,
0.17330245673656464,
0.024796929210424423,
-0.9734687805175781,
-0.23309825360774994,
0.2707866430282593,
0.06832686066627502,
-0.045169916003942... | |
are lacking.
---
To dissect your pros:
**Intuitive** and **simple for small applications** - replace that with "misleading". It makes it look simple, but it isn't: As long as it is simple, VB.NET is simpler. When it gets complicated, visual design would get in the way.
**Help avoid typos** - that's what a good sty... | [
0.135991171002388,
0.2606262266635895,
0.1060643196105957,
0.35603636503219604,
-0.21296913921833038,
-0.23270992934703827,
0.3932044208049774,
-0.060387615114450455,
-0.1611447036266327,
-0.753503143787384,
-0.1507069617509842,
0.9296722412109375,
-0.07263416796922684,
-0.2455646097660064... | |
*correctly*. C++ with it's complexity and exceptions (to rules) isn't even particulary suited.
If you want to make things easy, you need reusable components at a much higher level. Even if you have these, plugging them together is not simple. Despite years of struggle, and many attempts in many environments, this som... | [
0.48169270157814026,
0.1786663979291916,
0.10540056973695755,
0.034076184034347534,
0.028043227270245552,
-0.070958711206913,
0.4498960077762604,
-0.012304523028433323,
-0.3331347107887268,
-0.7512719631195068,
-0.1370301991701126,
0.6644814014434814,
-0.3287477493286133,
-0.13860276341438... | |
- here's where most language-centered approaches go astray. A modern IDE is more than just a text editor and a compiler. What about debugging your graph - with breakpoints, data inspection etc? Will profilers, leak detectors etc. highlight nodes in your graph? Will source control give me a Visual Diff of yesterday's gr... | [
0.5070497393608093,
0.10363097488880157,
0.015199561603367329,
0.47678160667419434,
-0.234968900680542,
-0.10903046280145645,
0.29920169711112976,
0.05975799635052681,
-0.23717795312404633,
-0.5338869690895081,
0.29196348786354065,
0.31165462732315063,
-0.17275317013263702,
0.0472432151436... | |
Is there a way to immediately stop execution of a SQL script in SQL server, like a "break" or "exit" command?
I have a script that does some validation and lookups before it starts doing inserts, and I want it to stop if any of the validations or lookups fail.
**The [raiserror](http://msdn.microsoft.com/en-us/library/... | [
0.06130058318376541,
0.24220214784145355,
0.5692318677902222,
-0.019368786364793777,
0.02739311195909977,
-0.4571247398853302,
0.5726976990699768,
0.11020085215568542,
-0.29157549142837524,
-0.10537645220756531,
-0.24612382054328918,
0.5249780416488647,
-0.2834654152393341,
0.1050626784563... | |
a fatal error', 20, -1) with log
go
print 'ho'
```
Will give you the output:
```
hi
Msg 2745, Level 16, State 2, Line 1
Process ID 51 has raised user error 50000, severity 20. SQL Server is terminating this process.
Msg 50000, Level 20, State 1, Line 1
Oh no a fatal error
Msg 0, Level 20, State 0, Line 0
A severe er... | [
-0.2850312292575836,
0.6524394154548645,
0.6261495351791382,
-0.14760862290859222,
0.10796137154102325,
-0.09341556578874588,
0.26229092478752136,
-0.18988114595413208,
-0.21944420039653778,
-0.31226882338523865,
-0.31404098868370056,
0.4122599959373474,
-0.4371766149997711,
0.311168491840... | |
the RAISEERROR() call itself will fail *and the script will continue executing*.
* When invoked with sqlcmd.exe, exit code 2745 will be reported.
Reference: <http://www.mydatabasesupport.com/forums/ms-sqlserver/174037-sql-server-2000-abort-whole-script.html#post761334>
**The noexec method**
Another method that works... | [
-0.16744224727153778,
0.26572665572166443,
0.7381423711776733,
-0.05989464372396469,
-0.34466487169265747,
-0.06867535412311554,
0.1655179262161255,
-0.30820590257644653,
-0.2837570011615753,
-0.11934137344360352,
-0.0704805925488472,
0.6396133303642273,
-0.22718101739883423,
0.11336422711... | |
-- to run this script again in the same session.
``` | [
0.5223142504692078,
0.6081956028938293,
0.08471112698316574,
-0.06999249011278152,
0.20460845530033112,
-0.24770142138004303,
0.20569287240505219,
0.139456108212471,
0.09778545796871185,
-0.6816803812980652,
-0.10553035885095596,
0.6625112891197205,
-0.09828165173530579,
0.1155104488134384... | |
I have a "generate website" command, that parses through all the tables to republish an entire website into fixed html pages. That's a heavy process, at least on my local machine (the CPU rises up). On the production server it does not seem to be a problem so far but i would like to keep it future proof. Therefore i'm ... | [
0.6547757387161255,
-0.061100587248802185,
0.36730772256851196,
-0.15865276753902435,
-0.2802276909351349,
-0.4150151312351227,
0.33505183458328247,
0.06602417677640915,
-0.39076775312423706,
-0.6223253011703491,
0.3137478530406952,
0.5136327743530273,
-0.1974763721227646,
-0.0249069705605... | |
it's being used in CGI (rather than mod\_php) mode, then you could consider using `proc_nice` instead.
This could allow the "generate website" command to use as much CPU as it wants while no-one else is trying to use the site. | [
0.6255381107330322,
-0.36227813363075256,
0.3573663830757141,
0.07393995672464371,
-0.10832954943180084,
-0.5054572224617004,
0.05083303153514862,
0.17490524053573608,
-0.12714305520057678,
-0.650870680809021,
0.046950243413448334,
0.6791949272155762,
-0.43329769372940063,
-0.0569551885128... | |
I made the following code example to learn how to use a generics method signature.
In order to get a **Display() method** for both Customer and Employee, I actually began replacing my **IPerson interface** with an **Person abstract class**.
But then I stopped, remembering a podcast in which Uncle Bob was telling Sco... | [
0.40354442596435547,
-0.0901598334312439,
0.3173646032810211,
0.13249634206295013,
-0.2254417985677719,
0.09910257905721664,
0.12625287473201752,
-0.10034462809562683,
-0.6227173209190369,
-0.47768622636795044,
0.16177938878536224,
0.31933990120887756,
-0.3217083811759949,
0.16006132960319... | |
a ***CustomerSalaryCalculator class***.
That seems an odd way to program. However, **getting rid of my interface also felt wrong** (since so many IoC containers and DI examples use them inherently) so I decided to give the Single Responsibility Principle a try.
So **the following code is different than I have program... | [
0.5995607972145081,
-0.19163431227207184,
0.27715635299682617,
-0.005346264690160751,
-0.22762136161327362,
-0.19265657663345337,
-0.28859129548072815,
-0.09254530072212219,
-0.20246292650699615,
-0.5722859501838684,
0.14240045845508575,
0.7250871658325195,
-0.24340254068374634,
0.03776845... | |
to go**.
I would **like to hear if others think the same way** on this issue or have experienced positive or negative effects of this (e.g. an unwieldy number of classes each doing one particular thing, etc.).
```
using System;
namespace TestGeneric33
{
class Program
{
static void Main(string[] args... | [
0.10946736484766006,
-0.25255197286605835,
0.22131799161434174,
-0.19681788980960846,
0.2979044020175934,
0.027104860171675682,
0.12802106142044067,
0.16770721971988678,
-0.14476695656776428,
-0.21591448783874512,
-0.5627986788749695,
0.6970183849334717,
-0.43716174364089966,
0.52085334062... | |
Employee employee1 = container.InstantiateType<Employee>("Joe", "Thompson");
Console.WriteLine(PersonDisplayer.SimpleDisplay(customer1));
Console.WriteLine(PersonDisplayer.SimpleDisplay(employee1));
Console.ReadLine();
}
}
public class Container
{
public ... | [
-0.040622830390930176,
-0.42240238189697266,
-0.11612392961978912,
-0.10894665867090225,
-0.0007376836729235947,
0.200758695602417,
0.02707873284816742,
-0.06631789356470108,
-0.0619790144264698,
-0.47988197207450867,
-0.29010868072509766,
0.2917729616165161,
-0.2781566083431244,
0.2224061... | |
T obj = new T();
obj.FirstName = firstName;
obj.LastName = lastName;
return obj;
}
}
public interface IPerson
{
string FirstName { get; set; }
string LastName | [
-0.17928823828697205,
-0.43884989619255066,
0.5499433279037476,
-0.13951925933361053,
-0.06418965756893158,
0.4963562488555908,
0.2723391652107239,
0.019486455246806145,
-0.09760097414255142,
-1.006778597831726,
-0.412319540977478,
0.46669965982437134,
-0.38785332441329956,
0.1772230714559... | |
{ get; set; }
}
public class PersonDisplayer
{
private IPerson _person;
public PersonDisplayer(IPerson person)
{
_person = person;
}
public string SimpleDisplay()
{
return String.Format("{1}, {0}", | [
-0.14039896428585052,
-0.6508278250694275,
0.27655258774757385,
0.015810562297701836,
0.20448355376720428,
0.19612599909305573,
0.18050333857536316,
-0.32635387778282166,
-0.19865338504314423,
-0.5292311310768127,
-0.25038430094718933,
0.6538857221603394,
-0.30095407366752625,
0.0655730664... | |
_person.FirstName, _person.LastName);
}
public static string SimpleDisplay(IPerson person)
{
PersonDisplayer personDisplayer = new PersonDisplayer(person);
return personDisplayer.SimpleDisplay();
}
}
public class Customer : IPerson
{
public s... | [
-0.1740264892578125,
-0.5714123845100403,
0.3808843195438385,
-0.20422635972499847,
0.19982025027275085,
0.45211806893348694,
0.07934469729661942,
-0.18528977036476135,
-0.24690407514572144,
-0.6194180846214294,
-0.4159272611141205,
0.5523882508277893,
-0.3213082253932953,
0.22721189260482... | |
public string LastName { get; set; }
public string Company { get; set; }
}
public class Employee : IPerson
{
public string FirstName { get; set; }
public string LastName { get; set; }
public int EmployeeNumber { get; set; }
}
}
```
I like to think of the [Single Respons... | [
0.41027265787124634,
-0.0786883682012558,
-0.15861372649669647,
0.013032875023782253,
-0.07585059851408005,
-0.05866868421435356,
-0.09802853316068649,
0.07542929798364639,
-0.28654801845550537,
-0.24427759647369385,
-0.3072464168071747,
0.1646544188261032,
-0.30906954407691956,
0.43467867... | |
of duties](http://en.wikipedia.org/wiki/Separation_of_duties). Before I start splitting my classes as you have, I try to think of what each class should be responsible for.
Your classes are quite simple and lend themselves well to an abstract class with an implemented `Print()` and `Save()` functions as you mentioned.... | [
0.4498513638973236,
0.01069369725883007,
-0.06760486215353012,
0.19123438000679016,
-0.22103367745876312,
-0.09878604859113693,
-0.13920383155345917,
-0.4513360559940338,
-0.510164201259613,
-0.4517441689968109,
0.06755411624908447,
0.5049919486045837,
-0.13958701491355896,
0.1660569310188... | |
will depend on the exact situation, but in the end, the code is just an abstraction for us lowly humans to understand, so make it such that it's the most intuitive.
You `Container` class is a little misleading. It doesn't actually 'contain' anything. It actually implements the [Factory Method Pattern](http://en.wikipe... | [
0.40007418394088745,
-0.15491466224193573,
0.09733566641807556,
0.2683236598968506,
0.0935215875506401,
-0.16721011698246002,
0.005944571457803249,
0.1638515591621399,
-0.27771228551864624,
-0.4511304497718811,
-0.21666023135185242,
0.29382696747779846,
-0.4100963771343231,
0.2238411456346... | |
have separate instances of a printer with different properties, keep it static. | [
0.5213395357131958,
0.026681380346417427,
0.09210732579231262,
0.3868904113769531,
0.011982672847807407,
-0.1820567101240158,
-0.18485768139362335,
0.05153769627213478,
-0.06393394619226456,
-0.6627192497253418,
-0.015448850579559803,
0.2806698679924011,
-0.15994317829608917,
0.12898881733... | |
I have a **Product** model which validates multiple attributes (including a Paperclip image attachment) like so:
```
validates_presence_of :name
validates_format_of :name, :with => /^([a-zA-Z0-9\ \-]{3,128})$/i
...
has_attached_file :image
validates_attachment_presence :image
validates_attachment_content_type :image,... | [
0.2629273235797882,
0.3055955171585083,
0.6882836222648621,
-0.15531572699546814,
-0.10519777238368988,
-0.01213457714766264,
0.10101313143968582,
-0.5936766266822815,
-0.04474890977144241,
-0.6696109771728516,
-0.05592433363199234,
0.547146737575531,
-0.05308503285050392,
0.18027567863464... | |
is to conditionally apply the model validations according to what the action is currently in progress (uploading the image or editing other data).
I hope I was clear enough. Any help is appreciated. Thanks.
[Railscasts](http://railscasts.com/episodes/41-conditional-validations) have a nice video screencast about cond... | [
0.03828961029648781,
-0.48067960143089294,
0.001470667775720358,
0.1719934642314911,
-0.16703172028064728,
-0.28846052289009094,
0.5542576909065247,
0.3796260952949524,
-0.2409568727016449,
-0.16846269369125366,
-0.08585245907306671,
0.6110793948173523,
0.12604688107967377,
-0.449893385171... | |
I know cout and printf have buffer today, and it is said that the buffer is some like a stack and get the output of cout and printf from right to left, then put them out(to the console or file)from top to bottem. Like this,
```
a = 1; b = 2; c = 3;
cout<<a<<b<<c<<endl;
buffer:|3|2|1|<- (take “<-” as a poniter)
outp... | [
0.10157757252454758,
0.0007104586693458259,
0.54190593957901,
-0.14379951357841492,
0.18181775510311127,
-0.0601976104080677,
-0.06986398249864578,
-0.17798267304897308,
0.19652202725410461,
-0.5469825267791748,
-0.01726764626801014,
0.3765987455844879,
-0.2211615890264511,
0.2374279350042... | |
I write a code below,
```
#include <iostream>
using namespace std;
int c = 6;
int f()
{
c+=1;
return c;
}
int main()
{
int i = 0;
cout <<"i="<<i<<" i++="<<i++<<" i--="<<i--<<endl;
i = 0;
printf("i=%d i++=%d i--=%d\n" , i , i++ ,i-- );
cout<<f()<<" "<<f()<<" "<<f()<<endl;... | [
-0.23445294797420502,
0.17086656391620636,
0.5409570932388306,
-0.6126387715339661,
0.25182288885116577,
0.4616682529449463,
0.46335336565971375,
-0.372607558965683,
0.21514065563678741,
-0.625669002532959,
-0.5417101383209229,
0.5526789426803589,
-0.5326142311096191,
-0.060138389468193054... | |
system("pause");
return 0;
}
```
Under VS2005, the output is
```
i=0 i++=-1 i--=0
i=0 i++=-1 i--=0
9 8 7
9 8 7
```
Under g++( (GCC) 3.4.2 (mingw-special)), the output is,
```
i=0 i++=0 i--=1
i=0 i++=-1 i--=0
9 8 7
9 8 7
```
It seems that the buffer is like a stack. However, I read **C++ Primer Plus** tod... | [
-0.3618822991847992,
-0.17694208025932312,
0.7145393490791321,
-0.16291896998882294,
0.284007728099823,
0.10192481428384781,
0.052131615579128265,
-0.19396404922008514,
-0.45496171712875366,
-0.5357240438461304,
0.08990903198719025,
0.32045575976371765,
-0.5454816222190857,
0.3314363956451... | |
about how cout's buffer work, can somebody help me?
This is not a bug, nor is it anything to do with output buffering.
The order of execution of the `i--` and `i++` operations is not defined when they're invoked more than once as parameters to the same function call.
To elaborate (and possibly correct) Iraimbilanja's... | [
-0.14201238751411438,
0.16124236583709717,
0.011895319446921349,
-0.18584217131137848,
0.05732617527246475,
0.20566429197788239,
0.05787552148103714,
-0.02257501520216465,
-0.11684022098779678,
-0.39603668451309204,
0.002384105697274208,
0.4856295585632324,
-0.5453287959098816,
-0.07343678... | |
way of writing this is:
```
operator<< ( operator<< ( operator<< ( cout, a ), b ), c )
```
Since for the outer call it's not (AFAIK) defined which order the two parameters are evaluated, it's perfectly possible for the right-hand "c" parameter (or in your case "`i--`") to happen before the left hand parameter is eva... | [
-0.31172552704811096,
0.01035348791629076,
0.251874715089798,
-0.4572325348854065,
-0.009342252276837826,
-0.23576465249061584,
-0.02247731201350689,
-0.3635137379169464,
0.1448795199394226,
-0.295261949300766,
-0.40111857652664185,
0.8527944684028625,
-0.24274681508541107,
-0.170299515128... | |
I was wondering if there's a way to export package information from Cognos 8 from a regular user level or from the framework level.
For instance, I want the field names that cognos is pointing to on the database, i want the datatype, the description cognos uses when you right click a data element, etc..
Any suggestio... | [
0.07747852057218552,
-0.24248026311397552,
0.6421352028846741,
-0.1934555172920227,
-0.2965922951698303,
-0.1043693870306015,
-0.13767388463020325,
-0.07612313330173492,
-0.30671271681785583,
-0.5538756847381592,
-0.10245892405509949,
0.7877262234687805,
-0.19518664479255676,
0.09330350905... | |
$(document).ready() is the ideal solution. | [
0.010654169134795666,
-0.08649973571300507,
0.4250648021697998,
0.21600525081157684,
0.4811131954193115,
-0.1412319540977478,
0.12473645806312561,
-0.2065403163433075,
0.0373043529689312,
-0.546978235244751,
-0.4467151165008545,
0.6676213145256042,
-0.1784396767616272,
-0.15007658302783966... | |
I'm using jQuery 1.3.2:
```
<script src="../../Scripts/jquery-1.3.2.js" type="text/javascript"></script>
```
I've got the following html:
```
<div id="container-div">
<div id="package_1">
<div>Package_1</div>
<div id="package-content"></div>
</div>
<div id="packag... | [
0.0856810137629509,
0.13674043118953705,
0.49870219826698303,
-0.35050761699676514,
-0.08527318388223648,
0.14877086877822876,
0.29209789633750916,
-0.21033945679664612,
0.12465857714414597,
-1.2060909271240234,
-0.1148340255022049,
0.5578380823135376,
-0.049663860350847244,
-0.27910122275... | |
to select all the "package-content" elements with a jQuery selector. I thought i could do the following but it's not working as expected:
```
$('#package-content')
```
This is only returning the first element in the list - which is what i would expect from getElementById("package-content") but I thought jQuery would... | [
-0.05947208032011986,
-0.15018989145755768,
0.22469289600849152,
-0.26787683367729187,
-0.13760404288768768,
-0.2874714732170105,
0.256874680519104,
-0.3927638828754425,
-0.07226548343896866,
-0.446357399225235,
-0.28752458095550537,
0.6975992321968079,
-0.4926920235157013,
-0.123344622552... | |
= 1
alert($('#package-content').parent().attr('id')); // = package_1
$("#package-content").each(function() {
alert('parent: ' + $(this).parent().attr('id') + ' child: ' + $(this).attr('id')); = parent: package_1 child: package-content
});
```
**id** is supposed to be a unique value to identify a particular elemen... | [
0.10074473917484283,
-0.18499812483787537,
0.21272610127925873,
-0.34149083495140076,
0.09183339029550552,
0.0429355651140213,
0.12843939661979675,
-0.4580739736557007,
0.1396387666463852,
-0.5081465840339661,
-0.43405959010124207,
0.4458266794681549,
-0.510317862033844,
0.1116334125399589... | |
I have a requirement and I am not able to figure out the solution. Any kind of help is appreciated.
We have customised the process model.
Issue.
I have FactTable say Release, Release has Project, projects would internally have different states, development-production-QA. what i need to do is generate a query that wo... | [
0.551040768623352,
0.00199625245295465,
0.0061719887889921665,
0.10823602974414825,
-0.04846839979290962,
-0.3006625473499298,
-0.006744666025042534,
-0.07276566326618195,
-0.280481219291687,
-0.6003163456916809,
-0.1272401511669159,
0.4947967827320099,
0.06949031352996826,
0.4234735369682... | |
do it PHP side then I'd recommend to preparse it to smaller chunks and then processing it. If you load it via [DOM](http://php.net/DOM) as one big chunk it will take **a lot** of memory. Also use CLI side PHP script to speed things up. | [
0.5009750723838806,
-0.18073493242263794,
-0.14156901836395264,
0.11810727417469025,
-0.3614506125450134,
-0.2914225161075592,
0.21606945991516113,
0.008170238696038723,
-0.2890901267528534,
-0.44341567158699036,
0.05190972238779068,
0.4787844121456146,
0.06332767009735107,
-0.285957247018... | |
I have built a table in a class GetData.cs
```
public Table BuildTable()
{
Table tButtons = new Table();
TableRow tRow = new TableRow();
TableCell tCell = new TableCell();
long lColumn = 0;
long lPreviousColumn = 0;
long lRow = 0;
long lPreviousRow = 0;
long lLanguage = 0;
long lP... | [
-0.15430848300457,
-0.20999760925769806,
0.9965283870697021,
-0.2105083018541336,
0.3984324634075165,
0.25768351554870605,
-0.07702527195215225,
-0.4526684880256653,
-0.12150262296199799,
-0.7659944891929626,
-0.22422091662883759,
0.39589688181877136,
-0.13191434741020203,
0.27217769622802... | |
Int32 lLangOrd = aReader.GetOrdinal("Language");
Int32 lLabelOrd = aReader.GetOrdinal("Label");
while (aReader.Read())
{
lRow = IsDbNull(aReader,lRowOrd);//first get our column number
lColumn = IsDbNull(aReader,lColOrd);//first get our column number
lLanguage = IsDbNull(aReader,lLa... | [
-0.4506267011165619,
-0.14931954443454742,
1.000356674194336,
-0.4607091546058655,
0.26426801085472107,
0.3754812777042389,
0.002766292542219162,
-0.41401568055152893,
0.028811348602175713,
-0.7031553387641907,
-0.6274629235267639,
0.7447247505187988,
-0.16007421910762787,
-0.2030675113201... | |
(lPreviousRow != 0)//then we are working on one and need to save it before moving on
{
tButtons.Rows.Add(tRow);//add the new row to the table
}
lPreviousRow = lRow;//remember the value for next time
tRow = new TableRow(); | [
0.10145393759012222,
-0.2893565595149994,
0.7538638710975647,
-0.47749048471450806,
0.46534016728401184,
0.20010776817798615,
-0.24822156131267548,
-0.1628660261631012,
-0.23034563660621643,
-0.6849313378334045,
0.03989330306649208,
0.8707037568092346,
-0.22424232959747314,
-0.096805781126... | |
tRow.Visible = true;
//*******put the category titles in here somewhere
}
if (lPreviousColumn != lColumn)//we have a new column
{
if (lPreviousColumn != 0)//then we are working on one and need to save it before moving on
{ | [
0.4165077209472656,
-0.033951643854379654,
0.705059826374054,
0.08547458797693253,
0.3086410164833069,
-0.01565047726035118,
0.030327951535582542,
-0.04136930778622627,
-0.24193713068962097,
-0.5292013883590698,
-0.15119610726833344,
0.8175141215324402,
0.11112872511148453,
0.0575058683753... | |
tRow.Cells.Add(tCell);//add the new cell to the row
}
lPreviousColumn = lColumn;//remember the value for next time
//*******add the cell colors
if (lPreviousLanguage != lLanguage)//we have a new column
{ | [
0.040166061371564865,
-0.31661269068717957,
0.9947171211242676,
-0.15311190485954285,
0.6918581128120422,
0.18920792639255524,
-0.36887702345848083,
-0.24729500710964203,
-0.5041377544403076,
-0.8098515868186951,
-0.13154634833335876,
0.5877758264541626,
-0.12127910554409027,
-0.0069801644... | |
lPreviousLanguage = lLanguage;//remember the value for next time
tCell.Text = IsDbNull(aReader,lLabelOrd,"");
//*******add the languages to properties
}
tCell = new TableCell();
tCell.Visible=true; | [
0.033489640802145004,
-0.2915714383125305,
1.0645228624343872,
-0.13614001870155334,
0.4104968309402466,
-0.12926150858402252,
-0.0280536450445652,
-0.28319108486175537,
-0.42707955837249756,
-0.6695778369903564,
-0.29597505927085876,
0.8080286383628845,
-0.2461826205253601,
-0.19889241456... | |
}
}
CloseConnection();
tButtons.Visible=true;
return tButtons;
}
```
In my Default.aspx.cs page I have
```
GetData Buttons = new GetData();//create a reference to the class
ButtonTable = Buttons.BuildTable();
OutPut.Text = ButtonTable.Rows.Count.ToString();
```
In Default.aspx
```
<asp:Table run... | [
-0.14912264049053192,
0.1933198720216751,
0.5254455804824829,
-0.21115918457508087,
0.08624102175235748,
0.1338476836681366,
0.3732999265193939,
-0.20027534663677216,
-0.4593247175216675,
-0.5635049939155579,
-0.129750058054924,
0.3193698227405548,
-0.452869713306427,
0.24097268283367157,
... | |
"ButtonTable". It will also be automatically added to the [Page.Controls](http://msdn.microsoft.com/en-us/library/system.web.ui.control.controls.aspx) collection. When the page is going to be rendered, the Controls collection will be iterated and rendered in turn.
In your default.aspx.cs code, you're simply pointing y... | [
-0.033089444041252136,
-0.09638842195272446,
0.6679185032844543,
0.055771294981241226,
0.006010864395648241,
-0.04414190351963043,
0.2046564221382141,
0.0013027320383116603,
-0.3885190486907959,
-0.9093484282493591,
-0.2145424634218216,
0.18369930982589722,
-0.1832161545753479,
0.163399115... | |
class would shed some light on the "right way". But - and I mean no offense - I think you need to study the basics behind ASP.NET before you go any further.
That being said, the most immediate fix (but likely *not what you really want*) is to add the table to the Controls collection so that it gets rendered:
```
GetD... | [
-0.17133088409900665,
-0.2388223558664322,
0.4815140664577484,
0.06171095743775368,
0.16799694299697876,
-0.06013290584087372,
0.12550248205661774,
-0.06065397709608078,
-0.1349911391735077,
-0.8340277671813965,
-0.2449330985546112,
0.5659213066101074,
-0.3821742534637451,
0.05571016296744... | |
label. | [
-0.035265784710645676,
-0.24876970052719116,
-0.22744621336460114,
-0.1759088933467865,
0.4929063022136688,
0.16411466896533966,
-0.05749433487653732,
-0.3469965159893036,
-0.4161840081214905,
0.05742954462766647,
0.12851913273334503,
0.709342896938324,
-0.11545827239751816,
0.674009919166... | |
I have following code in html:
```
<div>
<div style="float:left;margin:0.5em">
<span class="title">Label1</span><br/>
<input type="text" name="name1" size="8" />
</div>
<div style="float:left;margin:0.5em">
<span class="title">Label2</span><br/>
<input type="text" name="name2" size="12" />
</di... | [
-0.2303495854139328,
-0.00879743043333292,
0.7400563955307007,
-0.2589817941188812,
-0.11622373014688492,
0.16203343868255615,
-0.018905028700828552,
-0.4233628809452057,
0.036928556859493256,
-0.8865846395492554,
0.09753939509391785,
0.3286970257759094,
0.04411592707037926,
0.109402589499... | |
<div style="float:left;margin:0.5em">
<span class="title">Label5</span><br/>
<input type="text" name="name5" size="8" />
</div>
</div>
```
In Mozilla Firefox and Google Chrome it looks all right:
[firefox and chrome look http://jakub.sturc.info/data/so-labeled-inputs-chrome.png](http://jakub.sturc.info/data... | [
0.04315384477376938,
-0.10213535279035568,
0.8314501047134399,
-0.31870463490486145,
-0.1953999102115631,
-0.09278406947851181,
0.06196057051420212,
-0.34861600399017334,
-0.00257888319902122,
-0.8382511138916016,
-0.008521280251443386,
0.7934651970863342,
-0.11063135415315628,
-0.36242631... | |
Do I have to do anything special to my controller action method to accept/bind data from a .ajax() call?
Controller Action -
```
public class TestController : Controller
{
public JsonResult GetTestJsonData(Metadata data)
{
return new JsonResult { Data = data };
}
}
```
JQuery Call -
```
<script... | [
0.022729478776454926,
-0.3110705018043518,
0.38847193121910095,
0.1444755643606186,
0.018683090806007385,
-0.10961829125881195,
0.24293974041938782,
-0.31780409812927246,
-0.04353341832756996,
-0.4723261594772339,
-0.1271408349275589,
0.5407231450080872,
-0.1944495141506195,
-0.02261128276... | |
data: "{ data: {Name:'joe'}}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert("Name = " + msg.Name);
}
});
});
</script>
```
I would expect that | [
-0.14473778009414673,
-0.1859128773212433,
0.42468908429145813,
-0.34047260880470276,
0.2247912883758545,
-0.12337804585695267,
0.42307355999946594,
-0.06468753516674042,
-0.17606931924819946,
-0.46903499960899353,
-0.9461984634399414,
0.5877145528793335,
-0.29569903016090393,
-0.071082629... | |
this page would alert with the name 'joe'. I'm passing json data from the client to the controller action and the action passes it back to the client. This is just a simple example of what I'm trying to do.
Your code will probably work for a simple example as you are not parsing anything, however if you wanted to trans... | [
0.4101060926914215,
-0.1803296059370041,
0.2811259925365448,
0.11877312511205673,
-0.3547195792198181,
-0.2438981533050537,
0.3874938488006592,
0.15175192058086395,
-0.49896755814552307,
-0.7119444608688354,
-0.16397523880004883,
0.329304963350296,
-0.5107930302619934,
-0.02865174226462841... | |
it into an object.
<http://blogger.forgottenskies.com/?p=252> | [
0.06567440927028656,
-0.33573421835899353,
0.20786374807357788,
0.04514417052268982,
-0.01159959938377142,
0.002883940702304244,
0.49361205101013184,
0.08277945220470428,
-0.42870810627937317,
-0.38240867853164673,
-0.27456343173980713,
-0.2686599791049957,
0.08978097885847092,
0.693321168... | |
One type of entity in my model (let's call it E1) needs to be able to treat its relationship with another entity type (E2) as a stack. Reciprocally, that other entity needs to be able to see all related entities of the first type where the E2 is at the top of the stack, and separately every case where the E2 is within ... | [
0.14643146097660065,
0.1374361366033554,
0.4308743476867676,
-0.05013308301568031,
-0.15095588564872742,
0.027088111266493797,
-0.20013362169265747,
-0.38161006569862366,
-0.22827856242656708,
-0.708180844783783,
-0.11729200929403305,
0.4320501685142517,
-0.5989709496498108,
0.196878418326... | |
}
E2 entities: **quux** { top: `null`; in: *foo*, *baz* }, **plugh** { top: *baz*; in: *foo*, *bar*, *baz* }, **glurp** { top: *bar*; in: *foo*, *bar* }
Right now, I have a database table which has columns for the keys to both E1 and E2, as well as an int for storing the E2's position in the stack. Entity Framework t... | [
0.03885030373930931,
0.1454927623271942,
0.3943440318107605,
-0.028286466374993324,
0.11505003273487091,
-0.12218406796455383,
0.19961287081241608,
-0.28736573457717896,
-0.015505503863096237,
-0.8055198788642883,
0.16922014951705933,
0.587946891784668,
-0.3743293285369873,
0.2989770472049... | |
And if so, how?
Can you commit from the console?
try *svn stat* in the root directory of your project, that should show you the files that have been modified with an M near the name of the file. if you can see them, run *svn ci* to commit all changes.
**Maybe** (and just maybe), svn is ignoring those files on purpos... | [
0.3756345510482788,
-0.31585806608200073,
0.6023104190826416,
0.22565880417823792,
0.25513848662376404,
0.23275704681873322,
0.31775137782096863,
0.24196526408195496,
-0.5026784539222717,
-1.0938868522644043,
0.0003967285738326609,
0.5760848522186279,
-0.15831412374973297,
0.34111604094505... | |
I am trying to force a ChangeConflictException by altering records in two different browsers. This has worked for me in the past. But now it just wont throw the exception.
Last one in is winning.
I have checked the column properties of the entity I am updating and each column is set to always check.
Is there anythin... | [
0.3544207215309143,
0.22844181954860687,
0.6904178857803345,
0.005867317784577608,
-0.2786312401294708,
-0.1281731277704239,
0.14445920288562775,
-0.23195937275886536,
-0.34390223026275635,
-0.8572197556495667,
0.15177801251411438,
0.24075914919376373,
-0.3923104703426361,
0.16571672260761... | |
A loads entity X again, changes property and stores again
5. Browser B submits form
6. Browser B loads entity X again, changes property and stores again
Key point here is that the entity is reloaded on postback (HTTP = stateless) and in 6) you are actually loading changes made by 4) and overwriting them. Linq2Sql does... | [
0.09268328547477722,
0.09010964632034302,
0.8381195664405823,
-0.0998040959239006,
-0.12899018824100494,
0.017420390620827675,
0.3056901693344116,
-0.4832428991794586,
-0.4326235353946686,
-0.34477928280830383,
-0.36267077922821045,
0.34341076016426086,
-0.2789822816848755,
0.1579033732414... | |
I have a problem in my code. I want to get the b tag that has the style color silver using Javascript. I tried using the tagName === "B" but it didn't work. I figured that the B tags are not children of the rowData class.
```
<tr class="rowData">
<td style="padding: 0pt;">
<table><tr>
... | [
0.688433051109314,
0.3409348726272583,
0.004000028129667044,
-0.3596789240837097,
-0.2958475351333618,
0.10585568845272064,
0.21224108338356018,
-0.3974969983100891,
-0.06748784333467484,
-0.5225974321365356,
0.11479359120130539,
0.37869325280189514,
-0.6832765340805054,
0.2505598664283752... | |
<b style="font-size: 15px; color: silver;">Mugging</b>
<br />Payout: <b style="color: green;">$200 - $300</b>
<br />Experience: +1 </td> | [
0.23138751089572906,
0.17551778256893158,
0.32633745670318604,
-0.1349359005689621,
0.14770281314849854,
0.02390493080019951,
0.571287214756012,
-0.15078866481781006,
-0.3241526484489441,
-0.0008443351835012436,
-0.08765678107738495,
0.427760511636734,
-0.08668441325426102,
-0.346178323030... | |
<td style="text-align: right;">
</td>
</tr></table>
</td>
<td style="padding: 0pt;">
<table><tr> | [
-0.0017786487005650997,
-0.3185432255268097,
0.45798259973526,
-0.223296120762825,
-0.09832881391048431,
0.2648455798625946,
-0.11164551228284836,
-0.550531268119812,
-0.017976662144064903,
-0.5198632478713989,
-0.26527324318885803,
0.6852150559425354,
-0.24205616116523743,
-0.337083280086... | |
<td style="width: 100px;">
<b style="color: gray;">Required:</b>
<br />Energy: 1 </td> | [
0.6662896871566772,
-0.34950733184814453,
0.40465256571769714,
-0.1308859884738922,
-0.0773199200630188,
-0.12029639631509781,
0.10564113408327103,
-0.8103002309799194,
-0.04716648906469345,
-0.420466810464859,
-0.43965911865234375,
0.6333597898483276,
-0.08552292734384537,
-0.275899142026... | |
<td style="">
</td>
</tr></table>
</td>
</td>
</tr>
```
I removed some part of it..
Here's some part of the Javascript code:
```
var jobs = {};
jobs.scan = function() {
var tagHolder = {};
var | [
0.3004486858844757,
-0.4961841106414795,
0.32188987731933594,
-0.10319653153419495,
0.08861111849546432,
0.040752291679382324,
0.17270803451538086,
-0.5793473720550537,
-0.01873362995684147,
-0.42221900820732117,
-0.003435316728428006,
0.42090076208114624,
-0.49811938405036926,
0.132303357... | |
availJobs = {};
var jobContents = dom.get("app8743457343_content");
var rData = dom.getElementsByClass("rowData", jobContents, "tr");
for(var i = 0; i < rData.length; i++) {
var rChildren = rData[i].childNodes;
for(var j=0; j<rChildren.length; j++) {
if(rChildren[j].tagName === '... | [
0.3099842369556427,
-0.1620403379201889,
0.3866989314556122,
-0.47763288021087646,
0.46960657835006714,
0.22958900034427643,
0.6841992139816284,
-0.40439295768737793,
-0.009017257019877434,
-0.3919795751571655,
-0.40428426861763,
1.0293374061584473,
-0.19260692596435547,
-0.150804296135902... | |
}
}
}
jobs.scan();
```
When I started the script it didn't alert, or responded. Maybe I need to use something to like nextSibling? Please help me figure this out.. I want the b with the style color silver. The Mugging text
You *could* fight the good fight and try to get that monstrosity working across all browse... | [
0.27031388878822327,
-0.14001552760601044,
0.22344569861888885,
-0.12009860575199127,
-0.30041998624801636,
-0.4795989394187927,
0.5150334239006042,
0.026320038363337517,
-0.23751363158226013,
-0.7628371119499207,
-0.1512768268585205,
0.5888693928718567,
-0.5047780871391296,
-0.21976284682... | |
works for me on IE and Firefox:
```
var text;
var bs = document.getElementsByTagName("b");
for(var x = 0; x < bs.length; x++) {
if(bs[x].style.color == 'silver') {
text = bs[x].innerHTML;
break;
}
}
alert(text);
```
It is just grabbing all the bold elements in the document and checking to see... | [
0.37557172775268555,
-0.016130607575178146,
0.3334714472293854,
-0.34503793716430664,
-0.042496901005506516,
-0.3434278964996338,
0.4835609197616577,
-0.33629998564720154,
-0.09684239327907562,
-0.6880470514297485,
-0.22974266111850739,
0.5803318023681641,
-0.41903242468833923,
-0.06976915... | |
I am not sure where that is coming from as you didn't post that part of the markup, but if the `<b>` will end up being inside this element, you can change this line:
```
var bs = document.getElementsByTagName("b");
```
To this:
```
var bs = jobContents.getElementsByTagName("b");
```
Which will then 1) speed it up... | [
0.4633693993091583,
0.27746447920799255,
0.5045950412750244,
-0.22881631553173065,
0.38652685284614563,
-0.2945702373981476,
0.3266160488128662,
0.15607143938541412,
-0.24154184758663177,
-0.5878549814224243,
-0.26592740416526794,
0.49419596791267395,
0.0009539173915982246,
0.0939928516745... | |
Assume a query of the following form
```
operatingExpenses = Expense.find(:all,
{:select=>"categories.activityType, categories.name heading, sum(amount) totalAmount",
:joins => "inner join expense_categories categories on category_id = categories.id ",
:group => "categories.activityType, categories.n... | [
0.30436089634895325,
0.1204511746764183,
0.3729182183742523,
0.04185867682099342,
0.17667347192764282,
0.033489517867565155,
-0.45444560050964355,
-0.5133783221244812,
-0.26615580916404724,
-0.4147597551345825,
0.1440088003873825,
0.6484103798866272,
0.06041355058550835,
0.2846670746803283... | |
table.column :category_id, :integer, {:null=>false, :default =>1}
end
```
Now the set of records returned by the query fails the following assert
```
assert_equal 800, operatingExpenses[1].totalAmount
<800> expected but was <"800.00">.
```
Why is the Sum/aggregate column returned as a string instead of the same... | [
-0.18087324500083923,
0.1132812649011612,
0.7433699369430542,
-0.07552327960729599,
-0.12261635065078735,
-0.04196016862988472,
0.07546363770961761,
-0.2586471438407898,
-0.4521470069885254,
-0.2909420430660248,
0.14919723570346832,
0.5964562296867371,
-0.30748847126960754,
0.2746237516403... | |
Heading TotalAmount
| Operating | ExpCatX001 | 4000 |
| | ExpCatX002 | 200 |
| Financing | ExpCatX003 | 1000 |
| Investing | ExpCatX004 | 4234 |
| | ExpCatX005 | 201 |
```
For custom queries that require basically a whole custom SQL statement (your find above doesn't exactly ... | [
0.14085081219673157,
-0.100152388215065,
0.5696969032287598,
0.1558847874403,
-0.1596251130104065,
0.008551756851375103,
0.1553189903497696,
0.10244599729776382,
-0.29417192935943604,
-0.11045459657907486,
0.3281725347042084,
0.5553615093231201,
-0.15484048426151276,
0.26068180799484253,
... | |
new model that represents the new information. i.e.
```
class OperatingExpenseReportDatum
attr_accessor :type, :heading, :total
def initialize(row)
# set values from row, like
@total = row["total"].to_f
end
end
```
and then write a helper method into the model, something like:
```
class Expense < AR:... | [
0.08168205618858337,
-0.12429240345954895,
0.714674174785614,
0.3019903600215912,
0.28241610527038574,
-0.04719087854027748,
-0.4147188067436218,
-0.38307204842567444,
-0.3455287218093872,
-0.7493882775306702,
0.02603119984269142,
0.7919675707817078,
-0.15871958434581757,
0.428723812103271... | |
I am using Asp.Net c# and Sql Server 2005. I am using Masterpage and content page. when i debug my code that time it's give error ::
**Window Internet Explorer
SYS.WEBFORMS.PAGEREQUESTMANAGER TIMEOUTEXCEPTION: THE SERVER REQUEST TIMED OUT.**
Any body please help me out ?
Thanks
It is an Ajax error - do you only get... | [
0.3368735611438751,
0.2987428307533264,
0.3049392104148865,
-0.1200261190533638,
-0.45204585790634155,
-0.007806387729942799,
0.6656025648117065,
0.062379881739616394,
-0.1331382393836975,
-1.0506587028503418,
0.3227156400680542,
0.5355488657951355,
0.03983362019062042,
-0.1188424378633499... | |
How does JIT know where to look for csc.exe? Also how is this handled by other .NET languages, like IronRuby?
It is an Ajax error - do you only get the error when debugging? If you want to increase this timeout then set the AsyncPostBackTimeout of your script manager to something large | [
0.01663166657090187,
-0.2036704123020172,
0.038210414350032806,
-0.007317414041608572,
-0.4456943869590759,
-0.2094317376613617,
0.4787118434906006,
0.35873156785964966,
-0.1585858017206192,
-0.6248395442962646,
0.16213145852088928,
0.2726154923439026,
-0.0730428621172905,
0.09383565187454... | |
I've never been a fan of Hungarian notation, I've always found it pretty useless unless you're doing some really low level programming, but in every C++ project I've worked on some kind of Hungarian notation policy was enforced, and with it the use of some 'not-really-Hungarian' prefixes as m\_ for fields, s\_ for stat... | [
0.06319282203912735,
0.3400225341320038,
0.1420498639345169,
-0.08269580453634262,
-0.11642420291900635,
-0.027424558997154236,
0.25118619203567505,
0.5193104147911072,
-0.25161969661712646,
-0.3125039339065552,
-0.2521285116672516,
0.31749042868614197,
-0.28212451934814453,
0.136798322200... | |
being able to distinguish between parameters, locals and fields.
The [naming conventions for fields page at MSDN](https://msdn.microsoft.com/en-us/library/ta31s3bc%28v=VS.71%29.aspx) says I shouldn't, but it does not say why (the way e.g. Google's conventions generally tend to rationalize their prescriptions).
Are th... | [
0.4469042420387268,
0.237604022026062,
0.1537441909313202,
-0.07211823016405106,
-0.31900444626808167,
-0.18668194115161896,
0.6637341976165771,
-0.05731331557035446,
-0.05394105240702629,
-0.35163748264312744,
-0.12233814597129822,
0.3963332772254944,
-0.18982285261154175,
0.1847289502620... | |
the wizard bar at the top of the screen.
 | [
-0.10070322453975677,
0.10943669825792313,
0.38492634892463684,
0.05944870039820671,
-0.15153509378433228,
-0.06698452681303024,
0.4405682384967804,
0.34923064708709717,
-0.3441191613674164,
-0.36925917863845825,
-0.30676236748695374,
0.5963093042373657,
-0.02345314994454384,
0.30707255005... | |
I have a wpf window that has a height of 2000 with an actual desktop height of about 1000. Obviously about half of the window is off screen. Even though the window extends below the screen, the mouse will not move down to that area. I do want this content to be off-screen, and I want the mouse to be able to move over i... | [
0.21896333992481232,
0.23704586923122406,
0.7239159941673279,
0.10956205427646637,
0.036713119596242905,
-0.0661843866109848,
0.2670366168022156,
-0.32487550377845764,
-0.1952361911535263,
-0.8313446044921875,
0.332289457321167,
0.30092525482177734,
0.11652877181768417,
0.28105634450912476... | |
how to go about this.
Cursor delimiting is not done by the application, but by Windows itself. To my knowledge there is no way to have your cursor pointing off the screen.
You could simulate what you want by doing what many games do. Do not draw the Windows cursor, draw a custom one in your app window. Force the real ... | [
0.24320799112319946,
-0.19314002990722656,
0.7037054896354675,
0.22308500111103058,
0.1241658478975296,
-0.039707690477371216,
0.01569943316280842,
-0.17582374811172485,
-0.3519284427165985,
-0.7825731039047241,
-0.015078946016728878,
0.7600786089897156,
-0.29239121079444885,
-0.1695233732... | |
what you'd like, but I don't think WPF can handle this. | [
0.4222877025604248,
-0.11414801329374313,
0.04295014962553978,
0.13073790073394775,
0.3271728754043579,
-0.07542627304792404,
0.03790442645549774,
0.09793499112129211,
0.1408323049545288,
-0.3488205373287201,
0.26122790575027466,
0.36570999026298523,
-0.024027688428759575,
0.24984650313854... | |
I need to get a stack trace for a JVM process running on a client machine that uses windows.
The client has the JRE installed but not the JDK.
I want to use JStack but it is not installed and we can't install a JDK on the client's machine. I also tried using AdaptJ stack trace product from a Java Webstart Session bu... | [
0.3117498457431793,
0.15339453518390656,
0.17949993908405304,
0.04129449650645256,
0.18536783754825592,
-0.494198739528656,
0.14764079451560974,
-0.2623039484024048,
-0.22518447041511536,
-0.7126832604408264,
0.16716983914375305,
0.5233286023139954,
-0.2706921696662903,
-0.0253174118697643... | |
use [SendSignal](http://www.latenighthacking.com/projects/2003/sendSignal/), which was designed for exactly this purpose. | [
0.4256475567817688,
-0.5502676963806152,
0.07172290235757828,
0.22017045319080353,
-0.28038957715034485,
-0.4832594096660614,
-0.10293687134981155,
0.2421259880065918,
-0.20645257830619812,
-0.3549400269985199,
-0.3462285101413727,
0.26712483167648315,
-0.3304597735404968,
-0.1948626339435... | |
I've been trying to understand this example Ruby code [from a blog entry](http://www.randomhacks.net/articles/2007/01/20/13-ways-of-looking-at-a-ruby-symbol) which says it uses the symbols :DEFAULT, :say and :@message "to look up identifiers". But from what I can tell, it's not looking up the identifiers, but the value... | [
0.23995429277420044,
0.0054206461645662785,
0.08118247985839844,
-0.025103194639086723,
-0.27923116087913513,
-0.08080653101205826,
0.3911847770214081,
0.04259102791547775,
-0.3648599088191986,
-0.5560075044631958,
-0.06713486462831497,
0.21713721752166748,
-0.291129469871521,
0.1169924065... | |
DEFAULT
end
def say() @message end
# Use symbols to look up identifiers.
def look_up_with_symbols
[Demo.const_get(:DEFAULT),
method(:say),
instance_variable_get(:@message)]
end
end
dem = Demo.new
puts dem.look_up_with_symbols
```
When I run the code I get this output:
```
Hello
#<Method: De... | [
-0.10895185172557831,
-0.10702422261238098,
0.28295767307281494,
-0.05405954271554947,
0.023262696340680122,
0.1460060328245163,
0.2712143659591675,
-0.6033921241760254,
-0.00880363304167986,
-0.7885575890541077,
-0.12049344182014465,
0.4087366461753845,
-0.26643815636634827,
-0.0492869317... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.