text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
that it might subsequently add to the global script environment is yet available.
* By the time the default language script is parsed and executed all the global identifiers created by the previous language scripts will have been added to the script environment and are therefore available for use from inline code.
You... | [
-0.07702940702438354,
0.1013827845454216,
0.34216633439064026,
-0.06196816638112068,
0.03259026259183884,
-0.034863829612731934,
0.17081411182880402,
0.2737474739551544,
-0.03970954939723015,
-0.713101327419281,
-0.2424120157957077,
0.5705239772796631,
-0.15771953761577606,
0.0574400722980... | |
you can have a `VBScript` function (fnA) call a function declared in `JScript` (fnB) as long as the call to `fnA` is made as part of the inline execution of **JScript**. IOW JScript can call into VBScript which in turn can call into VBScript and so on, the limiting factor is the engine that the top of this chain must b... | [
0.12471327185630798,
-0.22731120884418488,
0.1321839690208435,
-0.35276472568511963,
-0.32077303528785706,
-0.21702755987644196,
0.261461466550827,
-0.1661510467529297,
-0.1428668051958084,
-0.5344018340110779,
-0.04576898738741875,
0.8219181299209595,
-0.4326905608177185,
-0.1200435757637... | |
at the point it is executed the the function being called does not exist. | [
0.12032843381166458,
0.14926502108573914,
0.09187187254428864,
0.08096202462911606,
0.16755793988704681,
-0.013619734905660152,
0.15311646461486816,
0.08063129335641861,
0.20860335230827332,
0.02966211922466755,
-0.5257172584533691,
0.45903000235557556,
-0.08427108079195023,
0.308802902698... | |
let us suppose some (legacy) code, which cannot be touched, declare
```
struct B{
public:
void f(){}
};
```
and let us suppose to have
```
struct A{
public:
virtual void f()=0;
};
```
is it possible to make an A subclass call B::f without explicitly calling f(), i.e. instead of
```
struct C: public A, ... | [
-0.09433996677398682,
-0.15265168249607086,
0.18000821769237518,
-0.05625985935330391,
0.028602469712495804,
-0.039396703243255615,
0.12228517234325409,
-0.14103029668331146,
-0.1955733746290207,
-0.4095628261566162,
-0.45490342378616333,
0.43922436237335205,
-0.5375200510025024,
0.2089004... | |
functions to A's. You could resort to some kind of code generation using gccxml or other similar products, but if there's only a hundred functions a macro can reduce the forwarding to a one-liner anyway - not worth introducing extra tools unless you've got thousands and thousands of these to do. | [
0.09307718276977539,
-0.1320754438638687,
0.30269700288772583,
0.10505633801221848,
-0.3751448392868042,
0.0874650850892067,
-0.031372908502817154,
0.06712442636489868,
-0.29116514325141907,
-0.20093710720539093,
-0.1488003432750702,
0.61086106300354,
-0.2712567448616028,
0.015920197591185... | |
My requirement is: I want the app user to be able to scan a barcode, which will contain the wifi configuration information, which automatically get saved in his devices' settings app[ofcourse with appropriate security], and his device gets connected to the very network.
Is there any way one can programatically feed wi... | [
0.49434006214141846,
0.25217482447624207,
0.7917659282684326,
0.1497180312871933,
0.48840680718421936,
-0.29395827651023865,
-0.056214235723018646,
-0.25878483057022095,
-0.10403585433959961,
-0.38494807481765747,
-0.17131447792053223,
0.5478555560112,
-0.18888118863105774,
-0.253010511398... | |
on a non-jailbroken phone you can't do this; each app has it's own sandbox, and doesn't have access to system-level functions such as Network Settings. | [
0.27163535356521606,
0.08083163946866989,
0.02565218135714531,
0.14767587184906006,
0.3525007963180542,
-0.2859322130680084,
0.5382351279258728,
-0.24475440382957458,
-0.20425745844841003,
-0.08284363895654678,
-0.28748905658721924,
0.38489657640457153,
-0.6270866394042969,
-0.148061558604... | |
I want to open a ***xxx.txt file kept on desktop*** of my Computer but the program gives an
error **Parser error unrecognized escape sequence '\D'**. I am trying to give the path of the
file as **"C:\Documents and Settings\user\Desktop\xxx.txt"** .
*Am i giving the path in a right way or is there any other way to ... | [
0.06419701874256134,
0.11910247802734375,
0.5227444767951965,
0.037393052130937576,
0.055150777101516724,
0.026109904050827026,
0.5092341899871826,
-0.1163230761885643,
0.09012863039970398,
-0.36518025398254395,
-0.18659894168376923,
0.34416496753692627,
-0.46508821845054626,
0.16882583498... | |
with the `@` character:
```
string myFileName = @"C:\Documents and Settings\user\Desktop\xxx.txt";
``` | [
0.2817937135696411,
0.12922890484333038,
0.6519374251365662,
-0.252842515707016,
0.5504908561706543,
0.12370828539133072,
0.14769239723682404,
0.18806220591068268,
0.12774056196212769,
-0.6107072830200195,
-0.2737747132778168,
0.4869202971458435,
-0.339991956949234,
0.1423073261976242,
0... | |
I need to get hardware and software information of Windows like the information we got from **dxdiag**
- **Computer module** : TOSHIBA l775
- **Processor** : Intel(R) i5 CPU M480 @2.67Ghz ..
- **RAM** : 4.00 GB
- **Graphic Card** : ATI Mobility Radeion HD 5650 - 2746MB
- **Direct Draw** : Enabled
- **DirectX** : Dir... | [
0.13316231966018677,
0.20956307649612427,
0.37786343693733215,
0.11288009583950043,
-0.19798532128334045,
0.40683090686798096,
-0.02244279719889164,
-0.24371318519115448,
-0.18827728927135468,
-1.0002844333648682,
-0.12064516544342041,
0.6294881105422974,
-0.053421858698129654,
0.076920472... | |
it would work on any computer on Windows.
So is there a way to get this information from any computer that uses Windows?
I'm using [.NET 4.0]
I think this will help you more,I dont want to explain
Try this <http://www.codeproject.com/Articles/17973/How-To-Get-Hardware-Information-CPU-ID-MainBoard-I> | [
0.3581717014312744,
0.042720429599285126,
0.09888127446174622,
0.3540138900279999,
0.4442763328552246,
-0.2107338160276413,
0.12286639958620071,
0.07498262822628021,
-0.18543362617492676,
-0.660510778427124,
0.24920673668384552,
0.47620177268981934,
0.0005790384020656347,
-0.00049086572835... | |
when i install wcf service hosting on windows service using InstallUtil i get the following Error Message.
An exception occurred during the Rollback phase of the System.ServiceProcess.Ser
viceProcessInstaller installer.
System.NullReferenceException: Object reference not set to an instance of an obj
ect.
An exception ... | [
0.16217966377735138,
0.08404429256916046,
0.6184771656990051,
-0.17645639181137085,
0.06576646864414215,
-0.3259495198726654,
0.7811166644096375,
-0.18301482498645782,
-0.11339643597602844,
-0.878784716129303,
-0.24841082096099854,
0.7668287754058838,
-0.373403936624527,
0.2681627273559570... | |
Admin. I mean to say run a command prompt as an Admin and try. I had the same error and solved using this technique. | [
0.0891222432255745,
0.1509612649679184,
-0.04569288715720177,
0.2011018991470337,
-0.1612304300069809,
0.18289774656295776,
0.17948301136493683,
0.21392621099948883,
0.2676229178905487,
-0.7915209531784058,
0.08785820752382278,
0.6282510757446289,
-0.3154011070728302,
-0.07531724125146866,... | |
I'm working with a simple db of messages.
```
id | integer
parent_id | integer
msg | character varying(140)
create_dte | numeric(10,0)
```
Messages have a parent\_id of -1 (top-level) | [
0.06443241238594055,
0.04439891129732132,
0.4121437668800354,
-0.020771639421582222,
-0.09167924523353577,
0.33710476756095886,
0.19936737418174744,
-0.1676700860261917,
0.02640685811638832,
-0.5627251863479614,
-0.07724921405315399,
0.13933530449867249,
-0.30481478571891785,
0.36707690358... | |
or the id of another message.
I want to return most recent top-level messages--most recent defined as
recent create\_dte of the parent or any of its children.
Here is my query:
```
select (case when parent_id != -1 then parent_id else id end) as mid, create_dte
from messages
order by create_dte desc
```
My result i... | [
-0.36304667592048645,
-0.05121404677629471,
0.5987039804458618,
-0.06329423189163208,
0.177403062582016,
0.21848233044147491,
0.013411659747362137,
0.02820107340812683,
0.1907861977815628,
-0.7991950511932373,
-0.4881595969200134,
0.2332111895084381,
0.0734066516160965,
0.6124320030212402,... | |
1333685638
676 | 1333648764
5493 | 1333648630
724 | 1333641318
5402 | 1333470056
5397 | 1333468897
5396 | 1333468378
3640 | 1333304212 | [
-0.41872352361679077,
0.047277044504880905,
-0.269839346408844,
0.19952471554279327,
-0.23104870319366455,
0.3562382757663727,
0.5205786824226379,
-0.8510317206382751,
-0.44932082295417786,
-0.2933556139469147,
-0.11147283017635345,
0.6104878187179565,
-0.21559560298919678,
0.3427094817161... | |
3434 | 1333300366
2890 | 1333293369
4958 | 1333288239
4899 | 1333287641
5203 | 1333287298
4899 | 1333287275
4899 | 1333285593
```
How do I eliminate the duplicates in the result while | [
-0.2829854190349579,
0.4106605648994446,
-0.35386911034584045,
0.26438310742378235,
-0.16810759902000427,
0.2019709348678589,
0.6731685400009155,
-0.6830549836158752,
-0.38162899017333984,
-0.3585398197174072,
0.3979562520980835,
0.06937608867883682,
-0.1972898244857788,
0.2240761369466781... | |
maintaining the sort of create\_dte?
I've tried distinct and distinct on but always lose the sorting.
Here is what I need:
```
mid | create_dte
------+----------------------
5655 | 1333906651
5462 | 1333816235
5496 | 1333686356
5157 | 1333685638
676 | 1333648... | [
0.03127821162343025,
0.08060411363840103,
0.13100962340831757,
-0.09447755664587021,
0.004258525557816029,
0.38719138503074646,
0.25393036007881165,
-0.0806369036436081,
0.12113077193498611,
-0.876754641532898,
-0.1825491189956665,
0.5040794014930725,
-0.19883602857589722,
0.47506937384605... | |
1333648630
724 | 1333641318
5402 | 1333470056
5397 | 1333468897
5396 | 1333468378
3640 | 1333304212
3434 | 1333300366
2890 | 1333293369
4958 | | [
-0.38075169920921326,
0.01989719085395336,
-0.18852704763412476,
0.14162911474704742,
-0.2919079065322876,
0.47828230261802673,
0.5568496584892273,
-0.7589495182037354,
-0.35839012265205383,
-0.27894946932792664,
0.009441983886063099,
0.5442894697189331,
-0.207988902926445,
0.2882365286350... | |
1333288239
4899 | 1333287641
5203 | 1333287298
```
(Last two rows not returned as 4899 already appears in result with a more recent create\_dte.)
Thanks
try the following:
```
select (case when parent_id != -1 then parent_id else id end) as mid, max(create_dte )
from messages
group by case wh... | [
-0.06736255437135696,
-0.14215382933616638,
0.4066515564918518,
-0.03550274670124054,
-0.0013686203164979815,
0.26589956879615784,
0.29657793045043945,
-0.38046789169311523,
-0.11661544442176819,
-0.584652304649353,
-0.33941730856895447,
0.4286259710788727,
-0.04767020046710968,
0.29853489... | |
When I run the i386 version of wkhtmlimage (on Ubuntu 64 bit if that matters), I get the following error,
> ./wkhtmltoimage-i386 <http://www.google.com> google.jpg
> ./wkhtmltoimage-i386: error while loading shared libraries: libXrender.so.1: cannot open shared object file: No such file or directory
The thing is tha... | [
0.0008346767863258719,
0.13416369259357452,
0.2525358200073242,
-0.15885652601718903,
-0.28590163588523865,
-0.222866028547287,
0.5988724231719971,
0.029704425483942032,
-0.009527728892862797,
-0.753046452999115,
-0.2775384783744812,
0.5654751658439636,
-0.3384553790092468,
0.2951982617378... | |
parent_id else id end
order by max(create_dte) desc;
``` | [
0.2183361053466797,
0.025359822437167168,
0.23168601095676422,
-0.1064831018447876,
0.31986868381500244,
-0.13329945504665375,
0.2445947825908661,
-0.053307246416807175,
0.19733962416648865,
-0.39366599917411804,
-0.3933652937412262,
0.5740579962730408,
-0.02753833495080471,
0.539932370185... | |
My friend has an below assignment , can anyone can guide how to do this in "C", just guidence is enough.
Write a program to store all processes list into a file and sort all the processes with UID.
For example:
```
./a.out processidlist.txt
```
it has to save the info to processidlist.txt.
In this processidlist.t... | [
-0.3508557677268982,
0.019090231508016586,
0.8631594777107239,
-0.2844007909297943,
0.3010466694831848,
0.15910203754901886,
0.5200186371803284,
-0.08227743953466415,
-0.02819700911641121,
-0.8377260565757751,
0.09988448768854141,
0.7686330080032349,
-0.33716902136802673,
0.050088413059711... | |
)
{
printf("Error opening file %s\n", argv[1]);
}
/* Open the command for reading. */
fp = popen("ps -Af | sort -k1", "r");
if (fp == NULL) {
printf("Failed to run command\n" );
exit;
}
/* Read the output a line at a time - output it. */
while (fgets(path, sizeof(path)-1, fp) != NULL) ... | [
-0.2546674311161041,
0.015498627908527851,
0.5629900693893433,
-0.3143980801105499,
0.16748188436031342,
0.35320550203323364,
0.6493499875068665,
-0.19851188361644745,
-0.030169520527124405,
-0.5525231957435608,
-0.6043632626533508,
0.5906622409820557,
-0.362000435590744,
-0.02637275867164... | |
0;
}
```
Something on these lines should work
```
system("ps -Af | sort -k1");
A indicates all processes
f generates full listing
k denotes sort by column
1 denotes first column which is UID of the processes
```
And if you don't want the annoying header
```
UID PID PPID C STIME TTY TIME CMD
```... | [
-0.2496708780527115,
0.13708269596099854,
0.6916722059249878,
-0.18271838128566742,
0.20344854891300201,
0.18474087119102478,
0.053173039108514786,
-0.0920814797282219,
-0.2774430215358734,
-0.7436788082122803,
-0.49273791909217834,
0.052345577627420425,
-0.46903231739997864,
0.12838894128... | |
I am developing an iPhone application.
The problem i am facing is that in start of app i have to present two different views based on either user has enabled or disable location services,But location services alert comes after some seconds.How can i manage it.?
Flow should be like this
App starts -> locations alert sh... | [
0.35371100902557373,
-0.09564883261919022,
0.8504600524902344,
-0.1508384793996811,
0.1436215341091156,
0.07163576781749725,
-0.05235079303383827,
-0.31685420870780945,
-0.1500757783651352,
-0.6119413375854492,
0.05812011659145355,
0.4705653190612793,
-0.2975603938102722,
-0.06325481832027... | |
time (therefore forcing Load to be called)
* Add a new method on the UserControl (like Initialize) and call it after adding | [
0.19436457753181458,
-0.2258608341217041,
0.14094917476177216,
-0.1005120724439621,
0.04780246689915657,
-0.028217345476150513,
0.4440006911754608,
-0.38149988651275635,
-0.0848998948931694,
-0.660763680934906,
-0.057474520057439804,
0.27600720524787903,
-0.13536636531352997,
0.02961828373... | |
Suppose a have a controller (let's call it "main") and an associated model which performs a bunch (10) of functions.
i'm wondering about the associated overhead in loading a 2nd model to do one function that doesn't exist in the main model vs. just adding that function (duplicating the code) in the main model.
The p... | [
0.34953609108924866,
-0.21669793128967285,
0.09111814945936203,
0.059652067720890045,
-0.08948585391044617,
-0.002130361972376704,
0.44177648425102234,
0.07186095416545868,
-0.6034374833106995,
-0.47443199157714844,
0.044130176305770874,
0.189360573887825,
-0.46110063791275024,
0.248831778... | |
your life a lot harder than it should have been when it comes to maintaining your code down the line. The principles of good OOP encourage you to create classes with a specific area of responsibility, and using that class to handle the situations it was built for. Duplicating functionality in class X into class Y viola... | [
0.33365342020988464,
-0.0671546682715416,
-0.11080165207386017,
0.2925933599472046,
0.1855808049440384,
-0.23689410090446472,
0.5244351625442505,
0.1178770437836647,
-0.35924026370048523,
-0.48892104625701904,
-0.0012639241758733988,
0.5660586357116699,
-0.4336800277233124,
0.0949643552303... | |
tagged 'micro-optimization'") at best. The performance hit for loading the other class should be negligible, certainly nothing worth worrying about. | [
0.05764827877283096,
-0.3336403965950012,
0.1474357545375824,
0.6840967535972595,
0.1444500833749771,
-0.10846380144357681,
0.02798357978463173,
-0.021689897403120995,
-0.21587421000003815,
-0.35092616081237793,
0.08700589090585709,
0.82058185338974,
-0.38311949372291565,
-0.23561464250087... | |
I need to replace a value that matches a string=value
so this is what I've came up with:
```
echo "some string=oldvalue" | sed 's/\(some string\=\)(.*)/\1newvalue/'
```
It works fine, I just wonder if there's a better, shorter way to accomplish the same
TIA
If `some_string` is a constant value, just use:
```
sed '... | [
0.28427937626838684,
0.0184249859303236,
0.011384638957679272,
-0.08217420428991318,
0.15761637687683105,
-0.11061006784439087,
0.31621119379997253,
-0.3971450626850128,
0.06805290281772614,
-0.2570129632949829,
-0.10663049668073654,
0.6874786615371704,
-0.3332096338272095,
-0.040381517261... | |
sed 's/string=[^ ]*/string=newvalue/'
string=newvalue # comment
```
This works by limiting the item after the `=` to non-space characters. | [
-0.29040437936782837,
-0.033462293446063995,
0.22251667082309723,
-0.1387762874364853,
-0.027762334793806076,
0.21033117175102234,
-0.0182485394179821,
-0.021204469725489616,
0.2756900489330292,
-0.6640803813934326,
-0.6263591051101685,
0.33174169063568115,
-0.06997156143188477,
0.12598401... | |
I am new to not only python, but programming altogether so I'd appreciate your help very much!
I am trying to filter detect all tweets from the twitter streaming API using Tweepy.
I have filtered by user id and have confirmed that tweets are being collected in real-time.
**HOWEVER**, it seems that only the **second ... | [
0.7307493090629578,
0.0607723705470562,
0.29939135909080505,
0.26041409373283386,
-0.17280538380146027,
-0.22427324950695038,
0.17147377133369446,
0.06871076673269272,
-0.17874912917613983,
-0.7168562412261963,
-0.058923546224832535,
0.7923673391342163,
-0.15753598511219025,
-0.03215895965... | |
PIN: '
webbrowser.open(auth_url)
verifier = raw_input('PIN: ').strip()
auth.get_access_token(verifier)
access_key = auth.access_token.key
access_secret = auth.access_token.secret
## Authorizing account privileges
auth.set_access_token(access_key, access_secret)
## Get the local time
localtime = time.asctime( time.lo... | [
0.19980724155902863,
-0.3148564100265503,
0.667168140411377,
0.1549568921327591,
0.013467943295836449,
-0.027694400399923325,
0.42702558636665344,
-0.30052250623703003,
-0.1894410103559494,
-0.5704787373542786,
0.07589934021234512,
0.7663672566413879,
-0.2984425127506256,
-0.11647482961416... | |
# suitable for capturing to a flat file but you could opt
# store them elsewhere, retweet select statuses, etc.
try:
print "%s\t%s\t%s\t%s" % (status.text,
status.author.screen_name, | [
-0.03945382684469223,
-0.30389994382858276,
0.42601633071899414,
0.0028949661646038294,
0.255974680185318,
-0.031049029901623726,
0.34961503744125366,
0.20397715270519257,
-0.35113415122032166,
-0.9348134398460388,
-0.349972665309906,
0.3845987021923065,
-0.21981985867023468,
-0.1675090789... | |
status.created_at,
status.source,)
except Exception, e:
print >> sys.stderr, 'Encountered Exception:', e | [
-0.0568428672850132,
0.09570685774087906,
0.11253093183040619,
-0.04165741428732872,
0.2630320191383362,
-0.013523717410862446,
0.24354612827301025,
0.09127882868051529,
-0.27849602699279785,
-0.5394012928009033,
-0.5432580709457397,
0.40276286005973816,
-0.1923043429851532,
0.238499015569... | |
pass
def on_error(self, status_code):
print >> sys.stderr, 'Encountered error with status code:', status_code
return True # Don't kill the stream
def on_timeout(self):
print >> sys.stderr, 'Timeout...'
return True # Don't kill the stream
# Create a streaming API and set a time... | [
0.558005690574646,
-0.4354487955570221,
0.2676519453525543,
0.11899133026599884,
0.059387367218732834,
0.05738091096282005,
0.7629340291023254,
-0.2135828137397766,
-0.07805188745260239,
-0.739975094795227,
0.06828979402780533,
0.5796439051628113,
-0.701482355594635,
0.10839542001485825,
... | |
list
# of users to "follow".
print >> sys.stderr, "Filtering public timeline for %s" % keywords
streaming_api.filter(follow=handle, track=keywords)
```
I had this same problem. The answer was not as easy as running python unbuffered in my case, and I presume it didn't solve the original poster's problem as well. The... | [
0.6211864948272705,
-0.15836046636104584,
0.36206763982772827,
-0.024755211547017097,
-0.2811635732650757,
-0.1640511453151703,
0.13891130685806274,
0.20963618159294128,
-0.40003299713134766,
-0.6323080062866211,
0.07087059319019318,
0.4713265895843506,
-0.45472705364227295,
0.237254753708... | |
streaming.py file. You can view the changes being made recently to try to resolve this issue in the commit history for this file.
I looked into the details of the tweepy class, and there was an issue with the way the streaming.py class reads in the json tweet stream. I think it has to do with twitter updating their st... | [
0.5855726599693298,
-0.3497425317764282,
0.1529359668493271,
-0.017547493800520897,
-0.22330112755298615,
-0.02666207030415535,
0.17460082471370697,
0.09032221883535385,
-0.5413713455200195,
-0.45819059014320374,
-0.0003279177763033658,
0.609230637550354,
-0.49707382917404175,
0.1972572505... | |
# Note: keep-alive newlines might be inserted before each length value.
# read until we get a digit...
c = '\n'
while c == '\n' and self.running and not resp.isclosed():
c = resp.read(1)
delimited_string = c
# read rest of delimiter length..
d = | [
0.34366360306739807,
-0.3114793300628662,
0.5036743879318237,
-0.07778839766979218,
0.3616828918457031,
-0.013647705316543579,
0.3381928503513336,
-0.2517112195491791,
-0.17631442844867706,
-0.5405612587928772,
-0.17185984551906586,
0.4998149573802948,
-0.2749829590320587,
0.27493900060653... | |
''
while d != '\n' and self.running and not resp.isclosed():
d = resp.read(1)
delimited_string += d
try:
int_to_read = int(delimited_string)
next_status_obj = resp.read( int_to_read )
# print 'status_object = %s' % | [
-0.15458257496356964,
-0.2901659905910492,
0.5522083640098572,
-0.43498238921165466,
0.20123836398124695,
0.30354979634284973,
0.4400308430194855,
-0.39129987359046936,
-0.24137286841869354,
-0.6823853254318237,
-0.44374001026153564,
0.45560601353645325,
-0.17706085741519928,
0.07912434637... | |
next_status_obj
self._data(next_status_obj)
except ValueError:
pass
if resp.isclosed():
self.on_closed(resp)
```
This solution also requires learning how to download the source code for the tweepy package, modifying it, and then installing the modified library into python... | [
0.05091240257024765,
-0.1275714635848999,
0.6265021562576294,
-0.12247565388679504,
0.22545099258422852,
-0.28667017817497253,
0.3382048010826111,
-0.06955154240131378,
-0.2517666816711426,
-1.0063973665237427,
-0.282511830329895,
0.5995057225227356,
-0.037404850125312805,
-0.0586677640676... | |
on github for this package to let them know whats up. | [
0.5311543941497803,
0.3150625228881836,
0.25048407912254333,
0.25107041001319885,
0.2206394374370575,
-0.39988213777542114,
0.23946847021579742,
0.4848951995372772,
-0.2560407817363739,
-0.4732128381729126,
-0.06899604946374893,
0.27201414108276367,
-0.011474162340164185,
0.133612915873527... | |
I'm learning MVC3 and I want my drop down list to use `colors` as the data here. How can I do it?
I know that I can do it with `@Html.DropDownList("colors")` but I'm wondering how to do this with `@Html.DropDownListFor(....)`? I'm a bit stumped and any help plus explanation would be appreciated.
I'm putting it all in... | [
0.1705445945262909,
-0.18563789129257202,
0.6222123503684998,
0.028395764529705048,
-0.06538616120815277,
-0.14712895452976227,
0.38030728697776794,
-0.2677219808101654,
-0.1518414318561554,
-0.8071395754814148,
-0.21011944115161896,
0.6631088256835938,
-0.3428696393966675,
-0.147675737738... | |
ColorsName { get; set; }
}
}
@{
var list = new List<Colors>()
{
new Colors() {ColorsId = 1, ColorsName = "Red"},
new Colors() {ColorsId = 2, ColorsName = "Blue"}, | [
-0.1585150808095932,
-0.6143470406532288,
0.4345335066318512,
-0.10881219804286957,
-0.01798137091100216,
0.11644160002470016,
0.37285012006759644,
-0.3758363723754883,
-0.12245335429906845,
-1.0159823894500732,
-0.43092140555381775,
0.6312987208366394,
-0.3175901472568512,
0.0751485377550... | |
new Colors() {ColorsId = 3, ColorsName = "White"}
};
var colors = new SelectList(list, "ColorsId", "ColorsName", 3);
}
@Html.DropDownListFor( ??? )
```
```
@Html.DropDownListFor(model => colors, colors)
``` | [
-0.18035078048706055,
-0.4502250850200653,
0.8348115682601929,
-0.08846524357795715,
0.19877511262893677,
-0.0460871160030365,
0.3424638509750366,
-0.41225385665893555,
-0.23620861768722534,
-0.7639330625534058,
-0.3456819951534271,
0.5263389945030212,
-0.4423236548900604,
0.02410767227411... | |
We are developing application using API Google. During this process we faced with some difficulties.
We used php-sdk that is on this page "code.google.com/p/google-api-php-client/" We used Google Calendar service. We followed documentation located here: "developers.google.com/google-apps/calendar/v3/reference/" sectio... | [
0.19350571930408478,
0.0820765420794487,
0.7188231348991394,
0.12509697675704956,
0.0424751415848732,
0.08329271525144577,
-0.06597236543893814,
-0.3315609097480774,
-0.09091794490814209,
-0.5818318724632263,
-0.38472142815589905,
0.30982670187950134,
-0.02195015922188759,
0.13609755039215... | |
headers)**
```
HTTP/1.1 400 Bad Request Content-Type: application/json; charset=UTF-8 Date: Fri, 06 Apr 2012 05:53:55 GMT Expires: Fri, 06 Apr 2012 05:53:55 GMT Cache-Control: private, max-age=0 X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block Server: GSE Transfer-Encoding: c... | [
-0.09945845603942871,
-0.009645942598581314,
0.46908071637153625,
0.10617856681346893,
-0.10061304271221161,
0.02917453460395336,
0.43266022205352783,
-0.23363348841667175,
-0.3283286988735199,
-0.3560011386871338,
-0.3885345160961151,
0.17854911088943481,
-0.17360588908195496,
0.273409485... | |
I have the following code for a mini framework. How do i "bulletproof" my code so that a possible delinquent developer will not break it? I summarized what the code does in the comments, and here's [a demo for clarification](http://jsfiddle.net/sTjqR/1/)
```
var kit = (function() {
'use strict';
//internal ca... | [
0.40148991346359253,
-0.030007176101207733,
0.2007022649049759,
-0.08947940915822983,
0.14633630216121674,
-0.1267671436071396,
0.4901575744152069,
-0.4339419901371002,
-0.04660675674676895,
-0.6849191188812256,
0.046678196638822556,
0.666273832321167,
-0.18066731095314026,
0.0467815585434... | |
external = {
core: {
error: {
addListener: function(callback) {
callback();
}
}
} | [
-0.20372332632541656,
0.016134949401021004,
0.18803058564662933,
-0.39290326833724976,
-0.08300208300352097,
0.3875470459461212,
0.25139081478118896,
-0.49003103375434875,
0.18141381442546844,
-0.015527737326920033,
0.04161418229341507,
0.8944510817527771,
-0.49041417241096497,
-0.04535216... | |
}
//externally available options
var core = {
//build extension by creating an instance of the passed function
//providing it the core interface, and
//then store the instance in the cache
extend: function(extensionName, extensionDefinition) {
var newExtension = new... | [
0.11403286457061768,
-0.2513398826122284,
0.35856127738952637,
-0.27910441160202026,
0.508540153503418,
0.5656900405883789,
0.2197321057319641,
-0.26363885402679443,
-0.05128661170601845,
-0.6443171501159668,
-0.19751551747322083,
0.44323933124542236,
-0.06856684386730194,
0.19456411898136... | |
= newExtension;
}
};
//expose
return {
core: {
extend: core.extend
},
_internal: internal,
_external: external
}
}());
//let's say two developers built these extensions
//developer1 builds his code
kit.core.extend('extension1', function(core) {
... | [
0.40897810459136963,
-0.14548295736312866,
0.14346426725387573,
-0.3321402966976166,
0.24476921558380127,
0.0791965052485466,
0.4247072637081146,
-0.5444384217262268,
0.14277327060699463,
-0.5185543894767761,
-0.2541293799877167,
0.4566456079483032,
-0.35084494948387146,
-0.068639606237411... | |
})
//developer1 intentionally kills the whole error interface
core.error = null;
});
//now, the other scripts cannot use the error interface
//because some delinquent developer killed it
kit.core.extend('extension2', function(core) {
//core.error is no more!
core.error.addListener(function() {
... | [
0.4405641257762909,
-0.15447689592838287,
0.2672041356563568,
-0.2995748817920685,
0.2127206027507782,
-0.1094089075922966,
0.5375577807426453,
-0.42745262384414673,
-0.04788192734122276,
-0.6622341275215149,
-0.17323234677314758,
0.617736279964447,
-0.6594933271408081,
0.11189490556716919... | |
way/approach to structuring this code?
If you are trying to make your code safe from accidental interferance, then:
```
(function(window, undefined) {
…
}(window));
```
is not how to do it. You don't know what *window* references in the global context (it may not exist at all), the **only** reference you know is ... | [
0.23909224569797516,
0.01594649627804756,
0.15595261752605438,
0.11764394491910934,
0.03671877458691597,
-0.4524548649787903,
0.5351890325546265,
-0.18855522572994232,
0.05403713136911392,
-0.8057559728622437,
-0.07088492065668106,
0.6419677138328552,
-0.46345892548561096,
0.24980618059635... | |
I need a clarification of this case.
According my tests the Result variable is defined to:
Boolean=False, Integer=0, String='', Object=nil etc from the first line.
But I have never seen an official reference for this.
It also make sense as this gives the hint.
[DCC Warning] Unit1.pas(35): H2077 Value assigned to 'TFo... | [
0.3069150149822235,
0.022632859647274017,
0.3904145061969757,
-0.2825557589530945,
-0.13433152437210083,
0.03509854897856712,
0.2640691101551056,
0.033028893172740936,
-0.02669105865061283,
-0.37114202976226807,
-0.15280844271183014,
0.44238153100013733,
-0.10776038467884064,
0.36238706111... | |
function by defining Result in case of exception later. And this make no sense for me.
No, `Result` has no (guaranteed) default value. It is undefined unless you give it a value. This is implied by [the documentation](http://docwiki.embarcadero.com/RADStudio/en/Procedures_and_Functions), which states
> If the function... | [
-0.03413033112883568,
-0.22066892683506012,
0.5515328645706177,
-0.2069549262523651,
-0.005551049020141363,
-0.18053866922855377,
0.18612009286880493,
-0.22178679704666138,
-0.23580460250377655,
-0.2571769952774048,
-0.15615341067314148,
0.44410985708236694,
-0.39934223890304565,
0.2443719... | |
Not sure if my title explains it very well so here's an example. I have two MYSQL tables, comments and votes\_comments which are matched based on a field comment\_id. For sample data comments has two rows and votes\_comments has one row which matches one of the comments row. AKA Two comments were written and a single p... | [
0.2725221812725067,
0.2580290734767914,
0.298160195350647,
-0.052149441093206406,
-0.2056267112493515,
0.37217146158218384,
-0.08921436220407486,
-0.31897592544555664,
-0.052296653389930725,
-0.5808314085006714,
0.21397924423217773,
0.18253013491630554,
-0.059738099575042725,
0.17846114933... | |
have a matching row. What I want to do is grab the matching value if it exists or return null in the column if there is no matching result. AKA: Did the user vote it up, down or not at all (null). Here is my modified query:
```
SELECT comments.*, users.username, votes_comments.vote FROM comments
JOIN users ON users.u... | [
0.02189883217215538,
-0.007774336729198694,
0.1681666374206543,
-0.02153209038078785,
-0.2632197141647339,
0.45680755376815796,
-0.10209599882364273,
-0.4258427619934082,
-0.1819138526916504,
-0.6253390312194824,
0.3175410330295563,
0.31132203340530396,
-0.47105783224105835,
0.024219434708... | |
not. Any ideas how to get what I'm looking for?
I suspect the `WHERE` clause `AND votes_comments.user_id=1` is causing the problem.
Read a [tutorial on Joins](http://www.w3schools.com/sql/sql_join_left.asp) and you'll see that the result of your `LEFT JOIN` is a temporary table with two rows, and for each row, fields... | [
0.10212282836437225,
-0.019306862726807594,
0.5251554846763611,
-0.07989887148141861,
0.2520502805709839,
-0.1240176111459732,
0.09783617407083511,
-0.03571130707859993,
-0.3667738437652588,
-0.7185947895050049,
-0.16059215366840363,
0.12452512979507446,
-0.31466370820999146,
0.27838379144... | |
to the row in `votes_comments` what matches a specific user ID (e.g. ID=1), then your `ON` clause should be something like
```
ON votes_comments.comment_id = comments.comment_id
AND votes_comments.user_id=1
``` | [
0.1812266856431961,
0.16600891947746277,
0.48267078399658203,
-0.12085382640361786,
-0.15455889701843262,
-0.017460834234952927,
-0.47724899649620056,
-0.34873682260513306,
-0.196133092045784,
-0.5306698679924011,
-0.1719914674758911,
0.4091331362724304,
-0.4342500865459442,
-0.24782451987... | |
I am trying to read a file and sort it by number of occurrences of a particular field. Suppose i want to find out the most repeated date from a log file then i use uniq -c option and sort it in descending order. something like this
```
uniq -c | sort -nr
```
This will produce some output like this -
```
809 23/D... | [
0.23801732063293457,
0.1654200702905655,
0.32097914814949036,
-0.09629101306200027,
-0.10423724353313446,
-0.003647343721240759,
0.14900830388069153,
-0.09314829856157303,
-0.460655152797699,
-0.4812854826450348,
0.13383135199546814,
0.301289439201355,
-0.25947800278663635,
0.4402431547641... | |
did this
```
uniq -c | sort -nr | cut -d' ' -f2
```
but this just prints blank space ... please can someone help me on getting the date only and chop off the count. I want only
```
23/Dec/2008:19:20
```
Thanks
The count from `uniq` is preceded by spaces unless there are more than 7 digits in the count, so you n... | [
-0.29749172925949097,
0.21002893149852753,
0.43301305174827576,
-0.020786503329873085,
-0.18870361149311066,
0.06198849901556969,
0.014781040139496326,
-0.3451961278915405,
-0.39808201789855957,
-0.45026397705078125,
0.04167115315794945,
0.6340043544769287,
0.12573911249637604,
-0.21647179... | |
in the face of a repeat count of 10,000,000 or more; if you think that might be a problem, it is probably better than the `cut` alternative. And there are undoubtedly other options available too.
---
Caveat: the counts were determined by experimentation on Mac OS X 10.7.3 but using GNU `uniq` from `coreutils` 8.3. Th... | [
0.07664044946432114,
-0.029462557286024094,
0.42967015504837036,
-0.022519273683428764,
-0.027086827903985977,
0.022801142185926437,
0.35923632979393005,
-0.3782665729522705,
-0.1647564321756363,
-0.4548185467720032,
-0.29107385873794556,
0.25285425782203674,
-0.32558348774909973,
0.110010... | |
with the `[0-9]` regex is the most reliable way of dealing with the variability in observed and theoretical output from `uniq -c`:
```
uniq -c | sort -nr | sed 's/^ *[0-9]* //'
``` | [
-0.19280663132667542,
-0.11696188151836395,
0.3793773651123047,
0.04037277400493622,
-0.13759779930114746,
0.22802813351154327,
-0.09038387984037399,
-0.01162353903055191,
-0.09301808476448059,
-0.4709898829460144,
-0.2724800705909729,
0.6165521740913391,
-0.20364442467689514,
-0.024664299... | |
I am creating design app where users can drag and drop controls to some surface.
Some controls in toolbar can contains broken logic and generate exceptions when injected to the surface.
I would like to suppress some unhandled exception comming from the 3rd party controls when they are dropped.
I want to suppress this ... | [
0.2731841504573822,
-0.020723994821310043,
0.07120675593614578,
0.1299159824848175,
-0.17216436564922333,
-0.15432657301425934,
0.3316039741039276,
-0.11435922980308533,
-0.06546412408351898,
-0.9240498542785645,
0.0030230828560888767,
0.5457488298416138,
-0.5117603540420532,
0.27225053310... | |
for the CMS collector to cope with, then the only solution is to use an object pool to recycle the `buffer` objects instead of dropping them on the floor for the GC to deal with. However, you need to be careful that you don't replace your current problem with others:
* The recycled objects may need to be "cleaned" (ze... | [
-0.03615371137857437,
0.15709829330444336,
0.15452441573143005,
0.22254283726215363,
0.09749970585107803,
-0.1610632687807083,
0.11153499782085419,
-0.06715276092290878,
-0.6320673823356628,
-0.5698310136795044,
-0.22442951798439026,
0.34645774960517883,
-0.3286495506763458,
0.222197353839... | |
the other hand, your real problem may be that your heap is too small for the application you are trying to run. If you run too close to the limit, the GC won't reclaim much garbage each time. Since the cost of running the GC is proportional to the amount of NON-garbage, it is easy to see that the GC's efficiency is non... | [
-0.050560299307107925,
0.0700230747461319,
0.2789955139160156,
0.26152464747428894,
-0.02107386849820614,
-0.12730075418949127,
-0.09389329701662064,
-0.10876774042844772,
-0.36214178800582886,
-0.6342476010322571,
-0.11821609735488892,
0.40132036805152893,
-0.21036221086978912,
0.35712230... | |
I am running the following query and however I change it, it still takes almost 5 seconds to run which is completely unacceptable...
The query:
```
SELECT cat1, cat2, cat3, PRid, title, genre, artist, author, actors, imageURL,
lowprice, highprice, prodcatID, description
from products
where title like '%' AND imageUR... | [
0.38921958208084106,
0.11708824336528778,
0.8669653534889221,
0.017762569710612297,
-0.15401138365268707,
0.599066972732544,
-0.07585936039686203,
-0.05213148519396782,
0.009808862581849098,
-0.6791443824768066,
-0.12303867936134338,
0.5070360898971558,
-0.23010367155075073,
0.101144187152... | |
for a category listing. If I do a fulltext search for something in the title column which has a fulltext index, it takes less than a second.
Should I add another fulltext index to column cat1 and change the query focus to "match against" on that column?
Am I expecting too much?
The table has just short of 3 million ... | [
0.11581774801015854,
-0.03608906641602516,
0.6488004922866821,
-0.004604521673172712,
-0.1497589498758316,
-0.06528078764677048,
0.14204415678977966,
-0.3147374391555786,
-0.536897599697113,
-0.4365136921405792,
0.135874941945076,
0.45661869645118713,
-0.47024211287498474,
0.05328211933374... | |
setting some kind of filter instead of the `%` on the title, field, right? | [
0.5323864221572876,
0.35716238617897034,
-0.1505272388458252,
0.2927279472351074,
0.02084004133939743,
-0.3435041606426239,
-0.291602224111557,
0.2480778992176056,
0.07933013141155243,
0.009752173908054829,
0.025656020268797874,
0.19771891832351685,
-0.08849742263555527,
-0.060049440711736... | |
For learning purposes i would like to convert a cell-based NSOutlineView to a view-based one,
basically i would like the following:
* instead of a normal cell, i'd like an 'image and text table cell view'
* the image can be the stock NSApplicationIcon and the text can just be 'hello world' :)
* I'd like to do this w... | [
-0.10329619795084,
-0.023511841893196106,
0.14370648562908173,
0.24970661103725433,
0.12971219420433044,
-0.03914332389831543,
0.09583479911088943,
0.10684052109718323,
-0.3301457166671753,
-0.9883923530578613,
-0.05204001069068909,
0.471757709980011,
-0.1206565871834755,
0.081628940999507... | |
still can't get it to work - so thanks very much in advance :)
OK, so you want an `NSOutlineView` with `ImageAndTextCell` cells, right?
Let's do one of the most typical examples of this kind : a simple file explorer.
**What we'll need :**
* an `NSOutlineView` (put an outline to your AppDelegate, as `fileOutlineView`... | [
0.22493302822113037,
-0.11951485276222229,
0.7414005994796753,
-0.053497035056352615,
0.06849152594804764,
0.0016095024766400456,
0.011024592444300652,
0.046499427407979965,
-0.2649613618850708,
-0.9532131552696228,
0.08308258652687073,
0.4605008661746979,
-0.18746106326580048,
-0.17364765... | |
the Data Source and Delegate
[fileOutlineView setDataSource:(id<NSOutlineViewDataSource>)self];
[fileOutlineView setDelegate:(id<NSOutlineViewDelegate>)self];
// set the first column's cells as `ImageAndTextCell`s
ImageAndTextCell* iatc = [[ImageAndTextCell alloc] init];
[iatc setEditable:NO];
[[[fileOutlineView table... | [
-0.2198534458875656,
-0.1099848747253418,
0.8871245980262756,
0.011389266699552536,
-0.29745158553123474,
0.1592525839805603,
-0.10410937666893005,
-0.63388991355896,
-0.071705661714077,
-0.996213972568512,
-0.3025129735469818,
0.3728688061237335,
-0.004969690926373005,
-0.1492685377597808... | |
return [[filePath folderContentsWithPathAndBackIgnoringHidden] count];
}
else
{
if ([item isFolder])
{
return [[item folderContentsWithPathAndBackIgnoringHidden] count];
}
else
{
return 0; | [
-0.239523783326149,
-0.3259297013282776,
0.5645927786827087,
-0.20412898063659668,
0.0369226336479187,
0.15569612383842468,
0.1564921736717224,
-0.43588975071907043,
-0.290122389793396,
-0.3566473722457886,
-0.34176456928253174,
0.6920964121818542,
-0.366802453994751,
0.35623109340667725,
... | |
}
}
}
- (id)outlineView:(NSOutlineView *)outlineView child:(NSInteger)index ofItem:(id)item
{
if (item == nil)
{
// Root
return [[filePath folderContentsWithPathAndBackIgnoringHidden] objectAtIndex:index];
}
if ([item isFolder])
{
return [[item folderContentsWithPathAn... | [
-0.17280325293540955,
-0.20157752931118011,
0.6653228402137756,
-0.17553749680519104,
-0.052335891872644424,
0.4770428240299225,
0.14384150505065918,
-0.5473065972328186,
-0.10916445404291153,
-0.9190768003463745,
0.1335216909646988,
0.30993980169296265,
-0.09551574289798737,
0.18457914888... | |
if ([[theColumn identifier] isEqualToString:@"NameColumn"])
{
return [item lastPathComponent];
}
else if ([[theColumn identifier] isEqualToString:@"SizeColumn"])
{
if ([item isFolder]) return @"--";
else return [NSString stringWithFormat:@"%d",[item getFileSize]];
}
else ... | [
-0.1734127551317215,
-0.350929856300354,
0.4267595112323761,
-0.15422643721103668,
0.09258092194795609,
0.3105318546295166,
0.16989900171756744,
-0.6240906715393066,
-0.13591724634170532,
-0.4484955072402954,
-0.49371615052223206,
0.5084604024887085,
-0.2846352159976959,
0.2138603478670120... | |
}
// Never reaches here
return nil;
}
/*******************************************************
*
* OUTLINE-VIEW DELEGATE
*
*******************************************************/
- (BOOL)outlineView:(NSOutlineView *)outlineView shouldSelectItem:(id)item
{
return YES;
}
- (BOOL)outlineView:(NSOutlin... | [
-0.20695483684539795,
-0.45432427525520325,
0.8964244723320007,
-0.172482430934906,
0.12110544741153717,
-0.15978547930717468,
0.1962302327156067,
-0.3925001621246338,
0.03449399769306183,
-1.1180464029312134,
-0.22371968626976013,
0.249049112200737,
-0.031864166259765625,
-0.0457220338284... | |
sharedWorkspace] iconForFileType:NSFileTypeForHFSTypeCode(kGenericFolderIcon)] size:15.0];
else
[cell setImage:[[NSWorkspace sharedWorkspace] iconForFile:item] size:15.0];
if ([item isFileHidden])
{
[cell setFileHidden:YES];
}
else
{
[... | [
-0.3621385395526886,
-0.3401774764060974,
0.29938071966171265,
-0.1294175088405609,
0.09073597192764282,
0.26777538657188416,
0.3438663184642792,
-0.5127502083778381,
-0.27665337920188904,
-0.7648833990097046,
-0.15467451512813568,
0.17829889059066772,
-0.3931642472743988,
0.37880039215087... | |
}
}
}
```
---
***Hint :*** `ImageAndTextCell` class can be found [here](http://developer.apple.com/library/mac/#samplecode/SourceView/Listings/ImageAndTextCell_m.html). You'll also notice a few other methods I'm using, which are obviously NOT supported by Cocoa (e.g. `isFileHidden`, `isFolder` or `folderConten... | [
0.16618941724300385,
-0.07313282787799835,
0.19627730548381805,
-0.12501831352710724,
0.11397179961204529,
-0.27653801441192627,
0.07254929840564728,
0.11420974135398865,
-0.2525891661643982,
-0.7874360084533691,
-0.12653636932373047,
0.7639086842536926,
-0.20392538607120514,
-0.0554431639... | |
I want to change uploading file name. Below is the code I have written:
```
$upload = new Zend_File_Transfer_Adapter_Http();
$upload->setDestination(IMAGE_PHY_PATH);
try {
//upload received file(s)
$upload->addFilter('Rename', array('target' => IMAGE_PHY_PATH."1.jpg",
... | [
0.3646681010723114,
-0.0728437528014183,
0.7055533528327942,
-0.2402007281780243,
0.05948403850197792,
-0.1891026794910431,
0.21656103432178497,
-0.44249895215034485,
-0.2597498595714569,
-0.7211986184120178,
-0.14344942569732666,
0.6551650166511536,
-0.3610394597053528,
0.2394914776086807... | |
with my code?
```
$rename = new Zend_Filter_File_Rename(array(
'target' => IMAGE_PHY_PATH . '1.jpg',
'overwrite' => true
));
$upload->addFilter($rename);
``` | [
0.4509052634239197,
-0.06900409609079361,
0.5172990560531616,
-0.12179724872112274,
0.15109476447105408,
-0.13515816628932953,
0.3184536099433899,
-0.43898719549179077,
0.005121385678648949,
-0.8391315340995789,
-0.22765964269638062,
0.6683546304702759,
-0.4783484935760498,
-0.074770495295... | |
I'm developing a templated binary search tree in C++ for a data structures class right now. Everything has been going well until now. This issue deals with some nitty gritty C++ stuff that I'm not to familiar with, and I need help.
I've previously defined functions that traverse the tree and visit each node in differe... | [
0.3028242290019989,
-0.11911982297897339,
0.23286966979503632,
0.15054064989089966,
0.025778213515877724,
-0.2534562349319458,
0.41726332902908325,
0.0582689605653286,
-0.0018418892286717892,
-0.5645917654037476,
-0.06623144447803497,
0.5388611555099487,
-0.44518938660621643,
0.45925503969... | |
PostOrderVisit(node->rightChild, visit);
visit(node->value);
}
```
This works fine in a test program that makes nodes and statically calls PostOrderVisit.
In a friend class (BinSTree.h/cpp), I am implementing a method that deletes every node in the tree, so I thought it would be a good idea to use this visitor and... | [
-0.37098604440689087,
-0.10273028910160065,
0.31619659066200256,
-0.24889668822288513,
0.014344137161970139,
-0.07465635240077972,
0.5027093291282654,
-0.18756023049354553,
-0.15497824549674988,
-0.46122071146965027,
-0.29118454456329346,
0.3441268503665924,
-0.47773200273513794,
0.4962614... | |
candidates are: static void TreeNode<T>::PostOrderVisit(TreeNode<T>*, void (*)(const T&)) [with T = int]
```
In this case, I thought that `void (BinSTree<T>::*)(const T&)` would be an instance of `void (*)(const T&)`, but it is not. The only way I can get the call to be recognized by the function definition is by cas... | [
-0.4895273745059967,
-0.04443793371319771,
0.36463406682014465,
-0.04517469182610512,
-0.10457414388656616,
0.08083313703536987,
0.14933957159519196,
-0.5996460318565369,
0.20045925676822662,
-0.5825692415237427,
-0.16173315048217773,
0.397645503282547,
-0.3991791307926178,
0.1866078376770... | |
drops the 'this' reference altogether, causing my Delete() method to seg fault (it uses 'this' quite a bit).
This has been a HELL of a hassle, and I have spent quite a bit of time on such a small bit of this project. Can anyone show me a way to either A: make the function be recognized without the casting, or B: how t... | [
0.17869463562965393,
-0.07277736812829971,
0.23596511781215668,
-0.134858638048172,
0.08831494301557541,
-0.25386568903923035,
0.40190133452415466,
-0.16881519556045532,
-0.08547776192426682,
-0.3627172112464905,
-0.12400484085083008,
0.6162729263305664,
-0.2781387269496918,
-0.01665711402... | |
it like f(C\* this, int i). Any casting that you do and screws up this signature you can expect badness to happen. You have already experienced crashes but more sinister artifacts could make the program misbehave or crash at other seemingly random places.
You can use pointer to member function like this:
in .h
```
t... | [
0.45895734429359436,
-0.2559848725795746,
0.4363933205604553,
0.1195196583867073,
-0.01424119621515274,
-0.20769241452217102,
0.19243435561656952,
-0.006427228916436434,
-0.2663927376270294,
-0.49026215076446533,
-0.049661267548799515,
0.4625074565410614,
-0.4654291272163391,
0.29394939541... | |
(node->*visit)(value);
// ...
}
```
You either pass pointer to your derived class (C as in here) or pointer to base class (TreeNode as in original). At some point you may need to cast.
You can also leave original function for when you pass a normal function as visitor. Function overload would take care.
A more ... | [
-0.10254527628421783,
-0.13942450284957886,
0.3957614302635193,
-0.010963010601699352,
-0.1456441879272461,
-0.37353986501693726,
0.42952561378479004,
0.040240734815597534,
-0.20156849920749664,
-0.7866784334182739,
-0.3955880403518677,
0.5378507375717163,
-0.43978235125541687,
0.395322263... | |
call like normal function.
When you call PostOrderVisit you can use all the power of std::bind or boost::bind to carry as much extra info as you wish. E.g.
PostOrderVisit(this->root(), std::bind(&BinSTree::Delete, this)); | [
0.11657444387674332,
-0.41195356845855713,
0.5708333849906921,
-0.12084032595157623,
-0.04639497026801109,
-0.29446181654930115,
0.35935601592063904,
0.0032965263817459345,
0.1614590287208557,
-0.3209870457649231,
-0.5090054869651794,
0.838874876499176,
-0.6527271866798401,
-0.088173970580... | |
I am confused about eager loading and lazy loading, is there any difference in the performance of rails queries?
Is there any way to implement both ways?
[**Eager Loading**](http://railscasts.com/episodes/22-eager-loading)
One way to improve performance is to cut down on the number of SQL queries. You can do this thr... | [
0.01363716833293438,
-0.37658146023750305,
0.14629629254341125,
0.2716922461986542,
-0.3810289204120636,
0.02603445202112198,
0.31487134099006653,
-0.2394935041666031,
-0.3622831404209137,
-0.6112474799156189,
0.13507185876369476,
0.8273285627365112,
-0.10765983164310455,
-0.48050633072853... | |
as there are friends, plus one for the object itself.
```
users = User.find(:all)
```
Then query for each user friend , like :
```
users.each do |user|
friend = Friend.find_by_user_id(user.id)
end
```
Here
1) One query for all users.
2) N query for N no. of users friends .
Take a look on : [Rails 3: Lazy lo... | [
-0.037777822464704514,
-0.18537089228630066,
0.28357478976249695,
0.020048145204782486,
-0.04534740746021271,
0.023173093795776367,
0.14919300377368927,
-0.2220315784215927,
-0.4595802426338196,
-0.47338607907295227,
-0.004562567453831434,
0.7329286336898804,
-0.27254462242126465,
-0.05814... | |
I have a UITableView with a custom cell which i fill (with array infoservices) after parsing the xml data.
```
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
ApplicationCell *cell = (ApplicationCell *)[tableV... | [
-0.2655015289783478,
-0.0669092908501625,
0.8456262946128845,
-0.2749537527561188,
-0.060439594089984894,
0.17200367152690887,
0.27825215458869934,
-0.34749898314476013,
0.024023381993174553,
-0.9652700424194336,
-0.028417278081178665,
0.41685229539871216,
-0.055191319435834885,
0.18956898... | |
}
infoService *e = [self.infoservices objectAtIndex:indexPath.row];
cell.name = [e infoName];
NSString *infodetails = [e infoDetails];
if ( infodetails == nil ) {
cell.details = @"Loading...";
[self startInfoDownload:e forIndexPath:indexPath]; | [
-0.24817579984664917,
-0.33135443925857544,
0.3780002295970917,
-0.08179361373186111,
0.4673736095428467,
-0.0662657767534256,
0.04600035771727562,
-0.24213775992393494,
0.05042648687958717,
-0.7860145568847656,
-0.22157002985477448,
0.7915641069412231,
-0.5174068808555603,
0.0324835740029... | |
NSLog(@"Loading...");
} else {
cell.details = infodetails;
NSLog(@"Show info detail: %@", infodetails );
}
return cell;
}
- (void)infoDidFinishLoading:(NSIndexPath *)indexPath
{
infoDownloader *infoserv = [imageDownloadsInProgress objectForKey:indexPath];
if (in... | [
-0.10837024450302124,
-0.41583579778671265,
0.601340651512146,
-0.10505804419517517,
0.13828912377357483,
0.08417633920907974,
0.16725367307662964,
-0.27736130356788635,
-0.263399600982666,
-0.7418268918991089,
-0.15604136884212494,
0.7396381497383118,
-0.5636292099952698,
-0.0122336940839... | |
row] withObject:infoserv.appRecord];
NSIndexPath *a = [NSIndexPath indexPathForRow:indexPath.row inSection:0]; // I wanted to update this cell specifically
ApplicationCell *cell = (ApplicationCell *)[self.tableView cellForRowAtIndexPath:a];
cell.details = [[infoservices objectAtIndex:[indexPath... | [
-0.6147022247314453,
0.14237479865550995,
0.456877738237381,
0.009753386490046978,
0.24452626705169678,
0.18600958585739136,
0.21777386963367462,
-0.2591197192668915,
-0.3171198070049286,
-0.7639797925949097,
-0.013170706108212471,
0.4475593566894531,
-0.6255336999893188,
0.294633299112319... | |
is that, while the
```
- (void)infoDidFinishLoading:(NSIndexPath *)indexPath
```
gets called after parsing each cell and i can see the
```
NSLog(@"Updating=%@", [[infoservices objectAtIndex:[indexPath row]] infoDetails]);
```
in the debugger with the correct details, the cell does not get refreshed immediately ... | [
-0.17950497567653656,
0.0332745797932148,
0.3389950394630432,
-0.017162196338176727,
0.21443210542201996,
-0.17685890197753906,
0.41208845376968384,
-0.0254935584962368,
-0.2552439868450165,
-0.7837162613868713,
-0.17648550868034363,
0.604693591594696,
-0.289414644241333,
0.225171282887458... | |
Crowded Charts**
**a.** Have you tried rotating the labels? This would significantly reduce the overcrowding on the labels that you earlier had.
Here's your Fiddle with the label mod: <http://jsfiddle.net/kayen/YSwk4/>
**b.** If you have a lot of values and are restricted by space on the x-axis, you can convert your... | [
0.07371845841407776,
0.023360051214694977,
1.0100957155227661,
-0.1207319051027298,
-0.34642866253852844,
0.22065038979053497,
-0.1729762703180313,
-0.2141154408454895,
-0.8636618852615356,
-0.748833417892456,
0.5095183253288269,
0.5368733406066895,
-0.24583707749843597,
0.0891358926892280... | |
For a web API I'm developing I want to do something similar to Facebook Graph API. A user can invite another user. To accept or reject the invitation, the other user needs to do an empty POST to:
```
/invitation/<invitationId>/accepted
```
or
```
/invitation/<invitationId>/rejected
```
However, this is not workin... | [
0.10634303092956543,
0.10346770286560059,
0.2138219028711319,
-0.08859088271856308,
-0.37411966919898987,
-0.05167126655578613,
0.26598304510116577,
-0.04239145293831825,
-0.10583177953958511,
-0.644688069820404,
0.2510482370853424,
0.16042132675647736,
-0.4112677276134491,
0.1916111409664... | |
Does the HTTP protocol allow POSTing empty data? If it doesn't I guess I'll just post some dummy data but I'd rather avoid this kind of hack.
* If it *is* allowed, how can I make Apache/PHP allow the request?
I guess that you want to do some kind of a RESTful api, and that's why you need to send post with no data.
Apa... | [
0.5596556663513184,
-0.023144183680415154,
0.24043969810009003,
0.1557127982378006,
-0.37294939160346985,
-0.3995586931705475,
0.46088677644729614,
0.3091541528701782,
-0.3043346703052521,
-0.4062979817390442,
0.15942028164863586,
0.2686934173107147,
-0.33380356431007385,
0.236658811569213... | |
. '</h2>';
echo '<pre>';
print_r($_POST);
echo '</pre>';
?>
<form action="" method="post">
<input type="submit" value="Request this page using POST" />
</form>
```
You will see that the script detects the post request (using REQUEST\_METHOD from the \_SERVER superglobal) even if the \_POST array is empy | [
-0.027629530057311058,
-0.07836169004440308,
0.5027839541435242,
-0.2147253155708313,
-0.09650641679763794,
0.08144330978393555,
0.444722056388855,
-0.48552337288856506,
-0.07669933140277863,
-0.6895793676376343,
-0.5764093995094299,
0.20956552028656006,
-0.41042110323905945,
0.09725952148... | |
Trapped in a strange issue with Bitmap transparency, I have images with me and convert it in Blob and stored it in local Database.
I have this image

after storing it as Blob and fetching it, then image background gets filled
![enter image descrip... | [
0.22024475038051605,
0.03563770279288292,
0.6790070533752441,
-0.04562215507030487,
-0.19236145913600922,
0.2083008736371994,
0.2107347697019577,
-0.24790702760219574,
-0.5043783783912659,
-0.8300482034683228,
-0.1508234590291977,
0.35272935032844543,
-0.31977593898773193,
0.22804476320743... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.