text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
streamids
data = rpt_control.ServerReport.RenderStream("Image", pageName, deviceInfo, mimeType, encoding)
pages.Add(New Metafile(New MemoryStream(data)))
Next
doc.Print()
```
Until now, we haven't done any printing at all, this is actually handled by the PrintPageHandler method that we referenced earlier.
``... | [
0.04812580347061157,
-0.40759921073913574,
0.9767643213272095,
0.25522634387016296,
-0.16714350879192352,
0.07230935245752335,
0.2809213101863861,
-0.3365054428577423,
-0.02487814612686634,
-0.7058370113372803,
-0.07946456223726273,
0.6991739273071289,
-0.3435521721839905,
0.25586399435997... | |
I have created a Powershell script and set it up to run within a .bat file. When I click on the .bat file the Powershell script runs like a champ. I then set up the .bat file to be run as a scheduled task. Again it works like a champ when I right click on it and launch it interactively. Problem is it fails when the tas... | [
-0.04952865093946457,
-0.050321102142333984,
0.12519896030426025,
0.2674567401409149,
-0.11936730146408081,
-0.5448769330978394,
0.1895555704832077,
0.16853946447372437,
-0.1098608523607254,
-0.7256174683570862,
-0.14811478555202484,
1.034947156906128,
-0.2776680588722229,
-0.1967148333787... | |
"Could not start". Perhaps fails was the wrong choice of words because the task probably doesn't even start running.
The task is set up to run as my user and I am set up as a local administrator on the box.
Check if scheduled task's security setting
Scheduled task might be running under a credential that does not hav... | [
0.13303765654563904,
0.10775993764400482,
0.15998855233192444,
-0.04674836993217468,
0.2519395053386688,
-0.07223121076822281,
0.7665248513221741,
0.07683248817920685,
-0.3465552031993866,
-0.6055861711502075,
-0.01743180677294731,
0.34736698865890503,
0.03331821784377098,
0.54154890775680... | |
was the wrong choice of words because the task probably doesn't even start running.
Make sure that `Task Scheduler` service is running
 | [
0.10231637209653854,
-0.15150435268878937,
0.18472477793693542,
0.0012401891872286797,
0.32057109475135803,
0.07412119209766388,
0.7059224843978882,
0.2470007687807083,
-0.52785724401474,
-0.33084195852279663,
-0.14001010358333588,
0.546099066734314,
0.04018253833055496,
-0.001886857906356... | |
I am trying to match column values returned, but values are returned as a result of pattern matching:
```
select app.employees.id, app.employees.name, app.employees.current_bp,
app.designation.designation from app.employees, app.designation
where app.employees.id like 'khsn?' = app.designation.desig_id like 'khsn?';... | [
0.31374210119247437,
0.4879876971244812,
0.3184340298175812,
0.013991381041705608,
0.2514355480670929,
0.21566243469715118,
0.041566237807273865,
-0.23409481346607208,
-0.3913343846797943,
-0.46347594261169434,
-0.024155106395483017,
0.6169986724853516,
-0.28527042269706726,
0.084834627807... | |
the movies table. Possible tagging them as deleted or obsolete, but you'd still be able to keep them for historical purposes. | [
0.39330556988716125,
0.029898110777139664,
0.21218344569206238,
0.6205317378044128,
0.21086959540843964,
-0.32776427268981934,
-0.49069520831108093,
0.10585159063339233,
-0.5946366786956787,
-0.14464187622070312,
0.1898694485425949,
0.5901846289634705,
0.13143445551395416,
0.25965917110443... | |
I'm currently trying to perform a search over 2 fields in my MySQL table (text type) using PHP.
```
SELECT * FROM content_items WHERE MATCH (content,name) AGAINST ('".urldecode($_REQUEST['term'])."' IN BOOLEAN MODE)
```
I'm always getting zero results, no matter what I search for (even tried to make the query stati... | [
0.1241382509469986,
0.16111502051353455,
0.226213276386261,
0.06679745018482208,
-0.5247935652732849,
-0.15274982154369354,
0.5705651044845581,
-0.12393592298030853,
-0.28259655833244324,
-0.6766635775566101,
0.19637370109558105,
0.444049209356308,
-0.43610966205596924,
0.26069632172584534... | |
I have a PHP script that's being called through jQuery AJAX. I want the PHP script to return the data in JSON format to the javascript. Here's the pseudo code in the PHP script:
```
$json = "{";
foreach($result as $addr)
{
foreach($addr as $line)
{
$json .= $line . "\n";
}
$json .= "\n\n";
}
$j... | [
0.23148296773433685,
0.09210602939128876,
0.30837273597717285,
-0.13942961394786835,
-0.27308088541030884,
-0.014525098726153374,
0.541985273361206,
-0.32502874732017517,
-0.22944872081279755,
-0.4881179630756378,
-0.05478817597031593,
0.4420810341835022,
-0.41858622431755066,
-0.029915841... | |
Not Invented Here syndrome. | [
0.5668880939483643,
0.03261050954461098,
0.09960038214921951,
0.20378871262073517,
0.4080837070941925,
-0.10951203852891922,
0.11243936419487,
0.5148892402648926,
-0.2092941850423813,
-0.3640494644641876,
0.028429685160517693,
0.030535297468304634,
-0.06815966963768005,
0.29717373847961426... | |
I have a Qt project which I have had a debug console displayed whilst I am developing, I am about to ship the product to I removed the qmake console command:
CONFIG += console
However when I do that I get the following error:
```
link /LIBPATH:"c:\Qt\4.5.0\lib" /NOLOGO /INCREMENTAL:NO /LTCG /MANIFEST /MANIFESTFILE:".... | [
-0.1573828160762787,
0.050923097878694534,
0.35767433047294617,
-0.035945598036050797,
0.09940480440855026,
0.12170105427503586,
0.4929863512516022,
-0.269464910030365,
0.35214513540267944,
-0.8057562708854675,
-0.05622703582048416,
0.5052046179771423,
-0.31033647060394287,
0.1899477243423... | |
lib path is missing, however I do have a large number of environment variables setup and working already. Has anybody seen this and know the location of the Microsoft.Windows.Common-Controls?
Also I am running this from buildbot so VS2008's IDE is not really somewhere I want help with.
It seems that the command line i... | [
-0.269247442483902,
0.07305857539176941,
0.48430705070495605,
-0.10518006980419159,
-0.0003311864857096225,
0.014517882838845253,
0.2718818485736847,
0.13899348676204681,
-0.015501003712415695,
-0.6942352652549744,
0.009065630845725536,
0.4188019037246704,
-0.4764018952846527,
0.1054072454... | |
place of one quote). It seems other sources suggest that too, so try experimenting with that. | [
0.49540993571281433,
0.20027025043964386,
-0.11020427942276001,
0.18532980978488922,
0.3830760419368744,
-0.2087147980928421,
0.20153163373470306,
0.1727314293384552,
-0.02973710559308529,
-0.3832366466522217,
0.230376735329628,
0.2775401175022125,
0.054687898606061935,
0.00961797218769788... | |
To add a new value to a dotnet Hashtable I've always used:
```
myHashtable.Add(myNewKey, myNewValue);
```
but I've just come across some code which does the following instead:
```
myHashTable[myNewKey] = myNewValue;
```
Is there any difference between the two methods?
To correct Sergej's answer a little...
* `A... | [
0.14682205021381378,
-0.03701619803905487,
0.27445948123931885,
-0.22564592957496643,
-0.25335800647735596,
-0.08316833525896072,
0.24455635249614716,
-0.2086559534072876,
-0.32604020833969116,
-0.5515027046203613,
-0.18653923273086548,
0.2531285583972931,
-0.6975170373916626,
0.2193150073... | |
You can't use a null key for either one though - you'll get an `ArgumentNullException`. | [
-0.024920331314206123,
0.18818159401416779,
0.2073991447687149,
0.16512133181095123,
-0.02295973151922226,
-0.05491922050714493,
0.3379512131214142,
-0.018446099013090134,
-0.060154370963573456,
-0.2681809365749359,
-0.19092509150505066,
0.45310837030410767,
-0.03271610662341118,
0.2889741... | |
I have the following scenario:
I have a database with a particular MyISAM table of about 4 million rows. I use stored procedures (MySQL Version 5.1) and one in particular to search through these rows on various criteria. This table has several indexes on it, and the queries through this stored procedure are normally v... | [
0.05895991995930672,
0.09328043460845947,
0.4791012704372406,
0.028812777251005173,
0.0037619892973452806,
0.14926593005657196,
0.25373589992523193,
-0.23399877548217773,
-0.04642830044031143,
-0.7394582033157349,
0.07377258688211441,
0.38777679204940796,
-0.06210251897573471,
0.0192157905... | |
at any time). However, there are some rare queries which take longer to run (say 2-3s). I have optimized the searched table as far as I can.
I have developed a web application and I can run and see the results of the fast queries in under a second on my development machine.
However, if I open two browser instances a... | [
-0.08378564566373825,
-0.054091036319732666,
0.5563416481018066,
0.24456240236759186,
0.14409403502941132,
-0.04544667899608612,
0.40616458654403687,
-0.16717329621315002,
-0.2105245739221573,
-0.8584949374198914,
-0.283170610666275,
0.4763205051422119,
0.2614573538303375,
0.04058629646897... | |
slower query to finish before returning the results. i.e. both queries will take 2-3 seconds...
Is there a reason for this? Because I thought that MyISAM handles SELECTS irrespective of one another and currently this is not the behaviour I am experiencing...
Thanks in advance!
Tim
To correct Sergej's answer a little.... | [
-0.3892458975315094,
-0.13261403143405914,
0.6132936477661133,
0.33866235613822937,
-0.39156410098075867,
0.1969679594039917,
0.5899537205696106,
-0.19026917219161987,
-0.3487933278083801,
-0.6976224184036255,
-0.0979151502251625,
0.34595462679862976,
-0.22042199969291687,
0.04069728031754... | |
`IDictionary` implementations (e.g. `Hashtable`) you'll get a null reference. You can't use a null key for either one though - you'll get an `ArgumentNullException`. | [
-0.008342587389051914,
-0.07954858988523483,
0.2708108127117157,
0.17704688012599945,
-0.11386868357658386,
-0.1504940241575241,
0.095221608877182,
0.028184885159134865,
-0.15922805666923523,
-0.46684885025024414,
-0.2228998988866806,
0.4537352919578552,
-0.4884253144264221,
0.225414603948... | |
I use svcutil to generate my wcf proxy that is calling a WSE2 web service.
The problem comes when the web service author changes the order of fields in the proxy.
I examined the generated proxy and sees that the public attributes are adorned with the XmlElementAttribute(Order=0) .. Order=1, etc for each field.
Is th... | [
0.12924188375473022,
0.050844576209783554,
0.48013994097709656,
-0.058900173753499985,
-0.16691380739212036,
-0.17067915201187134,
0.3468804359436035,
-0.2424786388874054,
-0.16375841200351715,
-0.5525293946266174,
0.026672322303056717,
0.48100942373275757,
-0.43518584966659546,
0.35650181... | |
setter *won't* throw an exception (unless you specify a null key).
* Using the indexer as a getter will throw an exception if the key doesn't exist and if you're using a generic `IDictionary<TKey,TValue>`. In the non-generic `IDictionary` implementations (e.g. `Hashtable`) you'll get a null reference. You can't use a n... | [
0.06745845079421997,
-0.3493717908859253,
0.3169495165348053,
0.04293240234255791,
-0.2647097706794739,
-0.31631961464881897,
0.18750014901161194,
-0.10875493288040161,
-0.1636492908000946,
-0.6087583303451538,
-0.34421300888061523,
0.40209922194480896,
-0.6659237146377563,
0.1826720982789... | |
I need to create a table of attributes where each record is essentially just a name-value pair. The problem is that the value can be a string, integer or decimal and I'm using MySQL which doesn't support table inheritance. So, the question is - should I create a separate table for each value type or should I just creat... | [
0.28187116980552673,
0.33127573132514954,
0.03481074795126915,
0.23284223675727844,
0.07284323871135712,
0.1677425503730774,
-0.04876372590661049,
-0.18944957852363586,
-0.22454552352428436,
-0.5619088411331177,
0.43286383152008057,
0.5420815348625183,
-0.2510916590690613,
0.32573065161705... | |
to make a design decision that's going to make the SQL more complex than it has to be.
Having different tables, or even multiple columns where only one of the 3 are populated, is going to be a nightmare. Store it all as varchar along with a type column. | [
0.36983633041381836,
0.16010822355747223,
0.2627081274986267,
0.2233269214630127,
-0.29151687026023865,
0.03160739690065384,
0.49300330877304077,
-0.37825217843055725,
-0.062070488929748535,
-0.342268168926239,
0.36639267206192017,
0.13594630360603333,
-0.5393652319908142,
0.38030180335044... | |
I'm looking for a Python module that can do simple fuzzy string comparisons. Specifically, I'd like a percentage of how similar the strings are. I know this is potentially subjective so I was hoping to find a library that can do positional comparisons as well as longest similar string matches, among other things.
Basi... | [
0.3415633738040924,
0.13686692714691162,
0.1405593305826187,
0.10320477187633514,
-0.28969016671180725,
0.19696886837482452,
-0.0820411965250969,
-0.3972485363483429,
-0.03852293640375137,
-0.5401971340179443,
0.07764783501625061,
0.5488545298576355,
-0.1393619030714035,
0.2611004710197449... | |
edit operations
- string similarity
- approximate median strings, and generally string averaging
- string sequence and set similarity
It supports both normal and Unicode strings.
```none
$ pip install python-levenshtein
...
$ python
>>> import Levenshtein
>>> help(Levenshtein.ratio)
ratio(...)
Compute similarity o... | [
-0.13970990478992462,
0.196435809135437,
0.4963075518608093,
-0.1816059798002243,
-0.23548807203769684,
0.3689916133880615,
0.22363431751728058,
-0.2366211861371994,
0.03425918146967888,
-0.5944515466690063,
-0.104678213596344,
0.6661617159843445,
-0.33462831377983093,
0.0802985206246376,
... | |
0.0
>>> help(Levenshtein.distance)
distance(...)
Compute absolute Levenshtein distance of two strings.
distance(string1, string2)
Examples (it's hard to spell Levenshtein correctly):
>>> distance('Levenshtein', 'Lenvinsten')
4
>>> distance('Levenshtein', 'Levensthein')
2
>>> distance(... | [
-0.058801181614398956,
0.26664969325065613,
0.39067772030830383,
-0.32378602027893066,
-0.2674580216407776,
0.30542299151420593,
0.737079918384552,
-0.42300036549568176,
0.17659784853458405,
-0.5208683013916016,
-0.1797623634338379,
0.24365495145320892,
0.1820290982723236,
0.22804740071296... | |
I'm building up results by joining tables
```
select t1.*, t2.col2 from t1, t2 where t1.col1=t2.col1
```
Is there a way to create a temporary 'mapping' table 'inline' in a select statement for instances where the t2 table doesn't exist?
So something like
```
select t1.*, tempt2.col2 from t1, (<create temp table>)... | [
-0.1141180694103241,
0.14658445119857788,
0.32836970686912537,
0.19125133752822876,
-0.03908202797174454,
0.2434365451335907,
0.03497298061847687,
-0.29427748918533325,
-0.15856340527534485,
-0.7171121835708618,
-0.05003621429204941,
0.3520120680332184,
-0.2902854084968567,
0.0566048808395... | |
t2.col2
FROM t1,
(
SELECT 1 AS col2
FROM dual
WHERE 1 = 0
) t2
```
Table with `N` rows:
```
SELECT t1.*, t2.col2
FROM t1,
(
SELECT 1 AS col2
FROM dual
CONNECT BY | [
-0.4739343225955963,
-0.12488039582967758,
0.5174098610877991,
-0.05574572831392288,
-0.028941409662365913,
0.4161590039730072,
0.12112457305192947,
-0.022204019129276276,
-0.31593579053878784,
-0.5569145083427429,
-0.5346735119819641,
0.5006489157676697,
-0.4446115493774414,
-0.0571387931... | |
level <= :N
) t2
``` | [
-0.24014221131801605,
0.16398324072360992,
0.33509528636932373,
-0.08371569961309433,
0.16916832327842712,
-0.41403302550315857,
0.42915093898773193,
-0.28279605507850647,
-0.07737542688846588,
-0.4750404357910156,
-0.26363497972488403,
0.6465533971786499,
-0.26521432399749756,
0.247638314... | |
I have a person entity containing an Address as a value object:
```
public Person()
{
WithTable("Person");
Id(x => x.Id);
Component<Address>(x => x.Address, a =>
{
a.Map(x => x.Address1);
a.Map(x => x.Address2);
a.Map(x => x.Address3);
a.Map(x => x.Town);
a.Map(x... | [
-0.36993223428726196,
0.17613153159618378,
0.4765528738498688,
-0.16310352087020874,
0.023055361583828926,
0.11901075392961502,
-0.0018924870528280735,
-0.43800321221351624,
0.3499608337879181,
-0.7738693356513977,
-0.24774269759655,
0.5018306970596313,
-0.2313401699066162,
0.5463035106658... | |
a value object (Address1, Address2 etc) are null, the entire component will be mapped as null (i.e. Person.Address will be null). This is giving me problems in cases where all address fields are null because in my pages where I might have (I'm doing ASP MVC):
```
<%= Html.TextBoxFor((x => x.Address.Address1))%>
```
... | [
0.08391069620847702,
0.16219870746135712,
0.19686415791511536,
-0.09002669900655746,
-0.1744539439678192,
-0.13334473967552185,
0.515069305896759,
-0.31337907910346985,
-0.15280933678150177,
-0.6411460638046265,
-0.028390461578965187,
0.3632565438747406,
-0.239028662443161,
0.4339293837547... | |
my view (yuk, horrible)
Making database fields not-nullable (I'm dealing with a legacy database)
Anyone any ideas?
I don't have any definitive answers creating a method/property accessor that isn't mapped, and that returns a default/null-object if the actual address is null.
```
public Address GetAddressOrDefault()
... | [
0.5196236371994019,
0.21094779670238495,
0.49083685874938965,
-0.033813558518886566,
-0.23297253251075745,
0.08486559242010117,
0.5315600037574768,
0.07301319390535355,
0.10236367583274841,
-0.8719731569290161,
-0.071903295814991,
0.6164512038230896,
-0.1513233631849289,
0.4372872412204742... | |
get { return address.Street; }
}
}
``` | [
-0.14879648387432098,
0.08478568494319916,
0.1962825208902359,
-0.10085580497980118,
0.14310237765312195,
-0.029459496960043907,
0.39269474148750305,
-0.04627043381333351,
0.23965954780578613,
-0.7833960056304932,
-0.49409210681915283,
0.6372942924499512,
-0.39124739170074463,
0.1397904008... | |
I have a process with an open filehandle to a file. I need to detect if this file has been deleted by another process (there may be a file with the same name in its place). On UNIX I was comparing the inodes of my filehandle and the file-path via stat, but this doesn't work on Win32. How can I do this in Perl?
Thanks,... | [
0.19522659480571747,
0.0873965173959732,
0.2008950412273407,
0.07067503780126572,
0.041212406009435654,
-0.14390556514263153,
0.14861665666103363,
0.3112494945526123,
-0.616787314414978,
-0.6150305271148682,
0.10537054389715195,
0.7184985280036926,
-0.2640937864780426,
0.3028852343559265,
... | |
In our app we have resource strings that are apparently too long for the compiler. The build breaks stating the "line length is too long." I have found little information about the topic of lengthy string resources and even had a difficult time finding what the limit on such a resource string is. Eventually I found thi... | [
0.4399380385875702,
0.10925033688545227,
0.11662953346967697,
0.2613380551338196,
0.06101332977414131,
-0.21507801115512848,
0.22909115254878998,
0.20288148522377014,
-0.5198880434036255,
-0.4191594421863556,
-0.0850817859172821,
0.40342751145362854,
-0.17382271587848663,
0.061369780451059... | |
resources. I used it to store large text files in my application.
**Edit:** Here is my MFC code, it should be able to give you some pointers.
```
CString CWSApplication::LoadTextResource(UINT nID)
{
HRSRC hResInfo;
HGLOBAL hResData;
hResInfo = ::FindResource(AfxGetResourceHandle(),
... | [
-0.15847957134246826,
0.07912436127662659,
0.6168040037155151,
0.01538338977843523,
0.43528905510902405,
-0.061657894402742386,
0.13866102695465088,
-0.02571958303451538,
-0.2770863175392151,
-0.9136408567428589,
-0.19654862582683563,
0.7156448364257812,
-0.10840114206075668,
0.14321646094... | |
RT_RCDATA);
if ( hResInfo == NULL )
{
return CString();
}
hResData = ::LoadResource(NULL, hResInfo);
if ( hResData == NULL )
{
return CString();
}
char *data = (char*)(::LockResource(hResData));
DWORD len = ::SizeofResource(NULL, hResInfo);
return CString(data... | [
-0.18687032163143158,
-0.1296772062778473,
0.5007251501083374,
-0.3887805938720703,
0.20145365595817566,
0.2899404466152191,
0.47266340255737305,
-0.5442467331886292,
-0.3565746247768402,
-0.2985248267650604,
-0.7476381063461304,
1.0846519470214844,
-0.3871206045150757,
0.1823331117630005,... | |
**The problem in general:**
I have a big 2d point space, sparsely populated with dots.
Think of it as a big white canvas sprinkled with black dots.
I have to iterate over and search through these dots a lot.
The Canvas (point space) can be huge, bordering on the limits
of int and its size is unknown before setting poin... | [
-0.10112473368644714,
0.12366887927055359,
0.07227621227502823,
-0.08976916968822479,
-0.13639716804027557,
-0.05727807804942131,
0.15988712012767792,
0.06704486161470413,
-0.3664551377296448,
-1.030959129333496,
-0.11133652925491333,
0.13790886104106903,
-0.5136121511459351,
0.04893936589... | |
to know the size of the canvas beforehand
(it may even change),
so things like
canvaswidth \* y + x
are sadly out of the question.
I also tried a very naive
abs(x) + abs(y)
but that produces too many collisions.
**Compromise:**
A hash function that provides keys with a *very* low probability of collision.
Any... | [
0.09453978389501572,
-0.05639762431383133,
0.18274205923080444,
0.06012403219938278,
-0.08665781468153,
-0.09914768487215042,
0.3838600814342499,
-0.3764193058013916,
-0.3518654406070709,
-0.8320876359939575,
-0.17423447966575623,
0.5924107432365417,
-0.048846129328012466,
-0.4855693876743... | |
didn't make much sense, because I would have had a sqrt(max(uint32))xsqrt(max(uint32)) sized canvas, which is uniquely representable
by a 16 bit shift and OR.
I hope this is ok, since all answers still make most sense with the updated assumptions
Sorry for that.
a hash function that is GUARANTEED collision-free is n... | [
0.09964008629322052,
-0.036756258457899094,
0.11482585966587067,
0.21580858528614044,
-0.3189525902271271,
-0.049395810812711716,
0.17715777456760406,
-0.15214575827121735,
-0.26858586072921753,
-0.6164872646331787,
-0.12316626310348511,
0.5725261569023132,
-0.2391303926706314,
0.066702216... | |
^ y
```
(you need to transform one of the variables first to make sure the hash function is not commutative) | [
-0.07245419174432755,
-0.03441721200942993,
0.21199223399162292,
-0.18822620809078217,
-0.15605634450912476,
-0.10590413957834244,
0.09398724883794785,
0.10326280444860458,
0.18637193739414215,
-0.4889681041240692,
-0.5367125272750854,
0.37701019644737244,
-0.45773324370384216,
0.092814520... | |
In a Delphi 7 application, I want to move a component following the mouse. I'm doing something like this:
```
procedure MyComponent.MouseMove(Sender: TObject;Shift: TShiftState; X, Y: Integer);
begin
AnotherComponent.Top := X;
AnotherComponent.Left := Y;
end;
```
When I move the mouse the CPU usage for the main ... | [
-0.38010239601135254,
-0.44100213050842285,
0.8359346985816956,
-0.3924480080604553,
0.3606599271297455,
-0.05475853383541107,
0.13954606652259827,
-0.029547028243541718,
-0.24701696634292603,
-0.7075518369674683,
-0.45481154322624207,
0.7998437881469727,
-0.40157970786094666,
-0.143001094... | |
end;
end;
```
Really easy to implement (2 lines added), no timer, works well for me... | [
0.054885029792785645,
0.08896385133266449,
0.4173375368118286,
0.003788827918469906,
-0.0613052137196064,
0.10456808656454086,
0.5871670246124268,
0.09056828171014786,
0.1547316014766693,
-0.4403167963027954,
-0.09464472532272339,
0.38589975237846375,
-0.07332626730203629,
-0.0922642424702... | |
I am using RUBY to screen scrap a web page (created in asp.net) which uses gridview to display data. I am successfully able to read the data displayed on page-1 of the grid but unable to figure out how I can move to the next page in the grid to read all the data.
Problem is the page number hyperlinks are not normal hy... | [
0.5278086066246033,
0.3062436878681183,
0.017950424924492836,
-0.015695422887802124,
-0.3415333926677704,
-0.09948481619358063,
0.38211825489997864,
-0.09302400052547455,
-0.12185737490653992,
-0.931130051612854,
0.028783109039068222,
0.344748854637146,
-0.27198317646980286,
0.326555222272... | |
For one thing, it gives you a much nicer interface to the DOM elements on the page, and it makes clicking links like this easier:
```
ie.link(:text, '6').click
```
Then, of course you have easier methods for navigating the table as well. It's easy enough to automate this process:
```
1..total_number_of_pages.each d... | [
-0.16257630288600922,
-0.026342298835515976,
0.6203963756561279,
0.09822947531938553,
-0.14473885297775269,
-0.13171008229255676,
0.16209855675697327,
-0.38723862171173096,
-0.5538797974586487,
-0.7226437926292419,
0.05028437077999115,
0.5629855394363403,
-0.19232237339019775,
-0.029017860... | |
the best approach. On the other hand, if it's ok to launch a browser instance, then you don't have to worry about all that postback nonsense, and you can just click the link as if you were a user.
Watir: <http://wtr.rubyforge.org/> | [
0.352956622838974,
-0.2305784374475479,
0.18575824797153473,
0.0557803250849247,
-0.4087720513343811,
-0.31204813718795776,
0.7759416103363037,
0.1672830581665039,
-0.08940201997756958,
-0.6982474327087402,
-0.07961365580558777,
0.5177921652793884,
0.005189827643334866,
0.28500789403915405... | |
I am using a .Net2.0 Assembly in Delphi 6 via COM.
One of the methods in one of the interfaces returns IEnumerable.
As long as I import mscorlib.tlb located in
"C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727"
, I can reach both IEnumerable and IEnumerator interfaces in Delphi 6. Here is the part where IEnumerable is ... | [
-0.27600404620170593,
-0.03108520247042179,
0.6974742412567139,
-0.06328101456165314,
0.03548847883939743,
-0.15814311802387238,
0.4026341736316681,
-0.3121936321258545,
-0.07028645277023315,
-1.0935029983520508,
-0.2556517720222473,
0.8102807998657227,
-0.27552708983421326,
0.010998995043... | |
to cast it to IEnumerator 'Interface not supported' exception is thrown.
Has anyone encountered this or a similar problem before? How can it be resolved?
This is standard behavior when interacting with .NET objects through COM interop, as specified here:
<http://msdn.microsoft.com/en-us/library/111chfb8(VS.71).aspx> | [
0.16609792411327362,
-0.14471940696239471,
0.2825982868671417,
0.05412638932466507,
0.051586706191301346,
-0.20335356891155243,
0.22609266638755798,
-0.007719807792454958,
-0.1663389652967453,
-0.7461481094360352,
-0.09980592131614685,
0.3320198059082031,
-0.29761970043182373,
0.1688678115... | |
I'm using VS2008, been using it for quite some time now, and since I [hate using the mouse while developing](http://www.codinghorror.com/blog/archives/000825.html), I'm always using `F6` to build the solution, or `Shift`+`F6` to build the current project. What's weird though is for some strange reason, it simply stoppe... | [
0.6553374528884888,
0.3026595711708069,
0.5430066585540771,
-0.11518936604261398,
0.1513843685388565,
0.20361165702342987,
0.2679492235183716,
0.10143382847309113,
-0.2602390944957733,
-0.8932467699050903,
-0.012112344615161419,
0.5700642466545105,
0.0983835905790329,
0.2402401864528656,
... | |
the binding here, and also check what might have stolen it by checking what's currently bound to those keys.
If you recently installed any add-ins, they're known to set (sometimes unwanted) keyboard shortcuts. | [
0.21185985207557678,
0.016244517639279366,
0.49756327271461487,
0.3250816762447357,
0.3603513538837433,
-0.49381595849990845,
0.1668090671300888,
-0.04688968136906624,
-0.39371368288993835,
-0.3880697190761566,
-0.16565626859664917,
0.4604749381542206,
-0.03368959203362465,
0.0659838393330... | |
I can't find a definitive answer for this. As far as I know, you can't have multiple `__init__` functions in a Python class. So how do I solve this problem?
Suppose I have a class called `Cheese` with the `number_of_holes` property. How can I have two ways of creating cheese objects...
1. One that takes a number of h... | [
0.24776944518089294,
0.3584439158439636,
-0.39097684621810913,
-0.17408403754234314,
-0.14792773127555847,
0.25589579343795776,
0.08793044090270996,
-0.17269515991210938,
-0.31213414669036865,
-0.6031987071037292,
0.12487700581550598,
0.5206097364425659,
-0.3851013481616974,
0.211244180798... | |
0):
if (num_holes == 0):
# Randomize number_of_holes
else:
number_of_holes = num_holes
```
What do you say? Is there another way?
Actually `None` is much better for "magic" values:
```
class Cheese():
def __init__(self, num_holes = None):
if num_holes is None:
... | [
0.05454564094543457,
0.08839760720729828,
-0.06545419991016388,
-0.013432063162326813,
0.11307244747877121,
-0.2982522249221802,
0.19379878044128418,
-0.0739053413271904,
-0.28917396068573,
-0.3068431615829468,
-0.262175589799881,
0.6872708201408386,
-0.248855322599411,
0.1315801739692688,... | |
adding more parameters:
```
class Cheese():
def __init__(self, *args, **kwargs):
#args -- tuple of anonymous arguments
#kwargs -- dictionary of named arguments
self.num_holes = kwargs.get('num_holes',random_holes())
```
To better explain the concept of `*args` and `**kwargs` (you can actu... | [
-0.12090619653463364,
0.3717781603336334,
0.3273830711841583,
-0.33751896023750305,
-0.2932252287864685,
0.5402823090553284,
0.25411468744277954,
-0.28093981742858887,
-0.2693384885787964,
-0.3321024477481842,
-0.301762193441391,
0.5706930160522461,
-0.35436639189720154,
-0.063516028225421... | |
I'm rendering into an OpenGL offscreen framebuffer object and like to save it as an image. Note that the **FBO** is larger than the display size. I can render into the offscreen buffer and use it as texture, which works. I can "scroll" this larger texture through the display using an offset, which makes me confident, t... | [
0.4335131347179413,
0.04475058987736702,
0.7013183832168579,
-0.36137455701828003,
-0.05233987420797348,
0.3142240047454834,
0.28225472569465637,
0.023824991658329964,
-0.07059379667043686,
-0.9228224158287048,
0.05533585324883461,
0.689519464969635,
-0.36117514967918396,
0.058779776096343... | |
raw buffer from ofImage
unsigned char* pixels = imageSaver.getPixels();
glReadPixels(0, 0, 1024, 1024, GL_RGB, GL_UNSIGNED_BYTE, pixels);
imageSaver.saveImage(fileName);
}
```
Please note, that the image content is cropped, the visible part is saved correctly (which means no error in pixel formats, GL... | [
0.004219223279505968,
-0.005539486184716225,
0.5642849802970886,
-0.08284349739551544,
0.07065128535032272,
0.27508488297462463,
0.16792473196983337,
-0.254910945892334,
-0.08986211568117142,
-0.7522953152656555,
-0.15616993606090546,
0.5665200352668762,
-0.13644404709339142,
0.01838253624... | |
and tested, eg. viewport sizes, width and height of buffer, image texture etc.) | [
0.04002349078655243,
0.13106082379817963,
0.7394614219665527,
0.2860950529575348,
0.3381210267543793,
0.31446200609207153,
-0.20010033249855042,
-0.589454710483551,
-0.26658210158348083,
-0.5457243323326111,
-0.13352790474891663,
0.5783222317695618,
0.2766188681125641,
-0.0989961251616478,... | |
I have a bookmarklet which inserts a CSS stylesheet into the target DOM via a "link" tag (external stylesheet).
Recently, this stopped working on Amazon.com, in Internet Explorer only. It works on other sites, and with other browsers (even on Amazon.com). The technique we're using to insert the stylesheet is pretty st... | [
0.44920971989631653,
-0.015776392072439194,
0.7340467572212219,
-0.030997028574347496,
-0.044309888035058975,
-0.23261816799640656,
0.03935331851243973,
-0.3261231780052185,
0.03368682786822319,
-0.6380957365036011,
-0.1309991180896759,
0.4723009765148163,
-0.1128426194190979,
0.1208508536... | |
passing the URL to my stylesheet as an argument. This throws the error:
> Not enough storage is available to
> complete this operation
Points of interest:
* The documentation for `document.createStyleSheet` says an error will be thrown if there are more than 31 stylesheets on the page but (1) it's a different error... | [
0.3918735086917877,
0.0294986329972744,
0.5914469957351685,
0.04276292026042938,
-0.4135529398918152,
-0.14018069207668304,
0.3452340066432953,
-0.022656181827187538,
-0.24533115327358246,
-0.6706464886665344,
0.11665162444114685,
0.24987627565860748,
-0.21183012425899506,
0.09303074330091... | |
relating to external styles.
* The same code, even the `createStyleSheet` call, works on other sites in IE.
This has reached "complete mystery" status for me.
I just tried this
```
javascript:(function(d) { d.createStyleSheet().cssText="* {color:blue !important;}" })(document);
```
and
```
javascript:(function(d... | [
0.4337776303291321,
0.13634175062179565,
0.5099253058433533,
0.01435028575360775,
0.00005874622002011165,
-0.07369676977396011,
0.35781359672546387,
-0.05471442639827728,
-0.09499988704919815,
-0.9793097376823425,
-0.07827786356210709,
0.5942638516426086,
-0.25422990322113037,
-0.029058190... | |
I have three treeViews that have the same data loaded to them when a form is loaded. I can write the data in three different functions, but that seems like duplicating a lot of work. How can I load each treeView with the same data. So far I have tried the following and it does not work correctly. SecondRowNodes is a se... | [
0.2649288773536682,
-0.10214986652135849,
0.48170503973960876,
-0.24919292330741882,
-0.32452628016471863,
0.22041720151901245,
0.4052918553352356,
-0.5203555822372437,
-0.1282901167869568,
-1.0043613910675049,
0.24722562730312347,
0.4521465599536896,
-0.2686505913734436,
0.332688271999359... | |
correctly
TreeNode topNodes = new TreeNode(currentDataSet.HousingAreaTable[housingAreaCounter].HousingAreaName, secondRowNodes);
TreeNode topNodes2 = new TreeNode(currentDataSet.HousingAreaTable[housingAreaCounter].HousingAreaName, secondRowNodes);
TreeNode topNodes3 = new TreeNode(currentDataSet.HousingAreaTable[housi... | [
0.0023282163310796022,
0.12863896787166595,
0.5248029828071594,
-0.13904507458209991,
0.3248637616634369,
0.026992928236722946,
0.5054610967636108,
-0.39674457907676697,
0.0003284361446276307,
-0.6672091484069824,
-0.3357709050178528,
0.546258270740509,
-0.0141984261572361,
-0.079346500337... | |
I have two pages I need, and want to show for the url /index and /review. The only difference between the two pages is on the review I will have a review comment section to show and Submit button. Otherwise the two pages are identical. I thought I could create a user control for the main content.
However, if I could s... | [
0.3876543343067169,
-0.17423373460769653,
0.5378897190093994,
0.08604082465171814,
-0.10998088121414185,
-0.005907566752284765,
-0.03813868388533592,
-0.2384742647409439,
-0.10715646296739578,
-0.5671679377555847,
0.03622857481241226,
0.45866793394088745,
-0.3253682553768158,
0.18802484869... | |
var myModel = new MyModel();
//Note: ShowCommentsSection (and the bool type) is false by default.
return View(myModel);
}
public ActionResult Review()
{
var myModel = new MyModel
{
ShowCommentsSection = true
};
//Note that we are telling the view engine to return the Index view
return View("Index"... | [
-0.10479331761598587,
-0.050644658505916595,
1.1113718748092651,
-0.19657176733016968,
-0.20025868713855743,
0.1119813546538353,
0.15672998130321503,
-0.19354994595050812,
-0.054168734699487686,
-0.5334564447402954,
-0.20596034824848175,
0.6063027381896973,
-0.06466642767190933,
0.42254152... | |
I have a large collection of strings (up to 1M) alphabetically sorted. I have experimented with LINQ queries against this collection using HashSet, SortedDictionary, and Dictionary. I am static caching the collection, it's up to 50MB in size, and I'm always calling the LINQ query against the cached collection. My probl... | [
0.06458749622106552,
0.2883150577545166,
0.41135501861572266,
-0.288135826587677,
-0.19502969086170197,
0.04338563233613968,
0.25371599197387695,
-0.6456023454666138,
-0.2222939282655716,
-0.591206431388855,
0.0007921788492240012,
0.38963812589645386,
-0.2380528450012207,
0.179734170436859... | |
new StringBuilder();
foreach (var stringitem in MyCollection.Where(
x => x.StartsWith(query) && x.Length > q.Length).Take(limit))
{
sb.Append(stringitem);
}
return sb.ToString();
}
```
It is my understanding that the HashSet, Dictionary, etc. implement lookups using binary tree search instead of ... | [
-0.10664866864681244,
-0.1324140727519989,
0.5813401937484741,
-0.33907485008239746,
0.06752824038267136,
-0.09370847046375275,
0.33076024055480957,
-0.5221471786499023,
-0.2983625829219818,
-0.6435845494270325,
-0.15612338483333588,
0.5119075179100037,
-0.49561622738838196,
0.050970450043... | |
That is why you don't see any difference in performance.
If you use a dictionary as index where the first few characters of the string is the key and a list of strings is the value, you can from the search string pick out a small part of the entire collection of strings that has possible matches.
I wrote the class be... | [
-0.040159136056900024,
-0.05019335076212883,
0.03680584579706192,
0.334791898727417,
-0.19557702541351318,
0.010184627026319504,
0.37859541177749634,
-0.135983407497406,
0.029379192739725113,
-0.6552412509918213,
0.1594415158033371,
0.5446719527244568,
0.06312939524650574,
-0.1185900345444... | |
finds the first 1000 matches in about 4 ms. Finding all matches for a one character strings takes about 25 ms.
The class creates indexes for 1, 2, 4 and 8 character keys. If you look at your specific data and what you search for, you should be able to select what indexes to create to optimise it for your conditions.
... | [
-0.24537302553653717,
0.09709310531616211,
0.551266610622406,
0.12271015346050262,
0.226877361536026,
0.28439414501190186,
0.11285655200481415,
-0.4446644186973572,
0.1284647136926651,
-0.7427370548248291,
0.013474118895828724,
0.6553184390068054,
-0.25247547030448914,
0.05655484274029732,... | |
_indexLength = indexLength;
}
public void Add(string value) {
if (value.Length >= _indexLength) {
string key = value.Substring(0, _indexLength);
List<string> list;
if (!this.TryGetValue(key, out list)) | [
-0.31829580664634705,
-0.28230056166648865,
0.6703941822052002,
-0.3565064072608948,
0.2870762050151825,
0.07611431926488876,
0.20922276377677917,
-0.3408525586128235,
-0.19611625373363495,
-0.3161473274230957,
-0.42072001099586487,
0.717256486415863,
-0.4239092171192169,
0.207796007394790... | |
{
Add(key, list = new List<string>());
}
list.Add(value);
}
}
public IEnumerable<string> Find(string query, int limit) { | [
-0.11919882148504257,
-0.2607267498970032,
0.5172935128211975,
-0.27060094475746155,
0.1972600221633911,
-0.09573633968830109,
0.11636941879987717,
-0.418784499168396,
0.13035230338573456,
-0.5868275165557861,
-0.3760068118572235,
0.7690284252166748,
-0.2926817238330841,
-0.143061399459838... | |
return
this[query.Substring(0, _indexLength)]
.Where(s => s.Length > query.Length && s.StartsWith(query))
.Take(limit);
}
}
private Index _index1;
private Index _index2;
private Index _index4;
private Index _index8;
public IndexedList(IE... | [
-0.45083704590797424,
-0.3229367733001709,
0.713473379611969,
-0.17281422019004822,
0.23259685933589935,
-0.007118802517652512,
-0.09181056171655655,
-0.36275142431259155,
-0.015506371855735779,
-0.40551942586898804,
-0.3416304588317871,
0.5839242935180664,
-0.4342237412929535,
0.127157613... | |
{
_index1 = new Index(1);
_index2 = new Index(2);
_index4 = new Index(4);
_index8 = new Index(8);
foreach (string value in values) {
_index1.Add(value);
_index2.Add(value);
_index4.Add(value); | [
-0.3085555136203766,
0.04176725819706917,
0.5392380356788635,
-0.3666696548461914,
0.13530011475086212,
0.2061140537261963,
0.05898589640855789,
-0.3825269043445587,
-0.057672761380672455,
-0.47474053502082825,
-0.6348193287849426,
0.6526688933372498,
-0.600368857383728,
0.1004191413521766... | |
_index8.Add(value);
}
}
public IEnumerable<string> Find(string query, int limit) {
if (query.Length >= 8) return _index8.Find(query, limit);
if (query.Length >= 4) return _index4.Find(query,limit);
if (query.Length >= 2) return _index2.Find(query,limit);
return _index1.F... | [
-0.31572940945625305,
-0.03312892094254494,
0.6744377017021179,
-0.2348371148109436,
0.2462494671344757,
-0.2507713735103607,
0.1591872274875641,
-0.33483195304870605,
0.03460229933261871,
-0.5691524147987366,
-0.44893860816955566,
0.6961464285850525,
-0.4417174458503723,
0.142316788434982... | |
I'm using .NET 3.5 and would like to be able to obtain every \*`n`\*th item from a List. I'm not bothered as to whether it's achieved using a lambda expression or LINQ.
**Edit**
Looks like this question provoked quite a lot of debate (which is a good thing, right?). The main thing I've learnt is that when you think y... | [
0.4700828194618225,
-0.04255986958742142,
0.2549625337123871,
-0.18100905418395996,
-0.013052906841039658,
-0.2015140950679779,
0.4861970841884613,
-0.1883687525987625,
-0.5491673946380615,
-0.7721319198608398,
-0.18020904064178467,
0.6602100729942322,
-0.2354367971420288,
0.03834146261215... | |
I'm creating a new ASP.NET MVC application. So far I've used the Account controller for actions related to a user's account -- Login/Logout, Activation (like Register, but I use Register for other actions in the site so I've renamed it), Add/Update Contact information. Up to now, though, I've been concentrating on the ... | [
0.3494744896888733,
0.09181558340787888,
0.4485611319541931,
-0.2251317799091339,
-0.2089383751153946,
0.21001747250556946,
0.11471584439277649,
0.26882797479629517,
-0.5401880145072937,
-0.6965836882591248,
0.09234761446714401,
0.24045100808143616,
-0.1466502547264099,
0.23657919466495514... | |
using the Account views/controller. Is this a good idea or should I stick with the Account controller? My feeling is that since this is for ordinary users it should be a separate controller since Account would apply to both ordinary and administrative users.
**EDIT**: After reading the first couple of responses, my re... | [
0.34221720695495605,
-0.052292920649051666,
0.423104465007782,
0.06766529381275177,
-0.005935706663876772,
-0.023119062185287476,
0.0030253531876951456,
-0.0871136263012886,
-0.49420100450515747,
-0.33771902322769165,
0.22597970068454742,
0.6612368226051331,
-0.3066266179084778,
-0.1046688... | |
my question: [ASP.NET MVC Account Controller usage guidelines?](https://stackoverflow.com/questions/237249/asp-net-mvc-account-controller-usage-guidelines)
I don't think there's a right or wrong answer here, so I'll give you my opinion.
Technically, either solution (extending the Account controller or creating a new c... | [
0.33983954787254333,
-0.02301589585840702,
0.4062095284461975,
0.0059463693760335445,
0.22594395279884338,
-0.0764348953962326,
-0.014705735258758068,
-0.029084738343954086,
-0.4500107765197754,
-0.5698800683021545,
0.16170437633991241,
0.4392491281032562,
-0.1434004008769989,
0.0926049053... | |
this, for example, if you use an IIS module for authentication or if it makes your log analysis easier.
On the other hand, it might be the case that the users perceive account functions and administrative functions as part of the same family of actions, except that some users have additional features. If so, then that... | [
0.3776436150074005,
-0.022511132061481476,
0.17320913076400757,
0.2614006996154785,
0.0014684118796139956,
-0.3656788170337677,
0.22660169005393982,
-0.10719340294599533,
-0.23769688606262207,
-0.5059346556663513,
0.010051733814179897,
0.2722063958644867,
-0.22953101992607117,
0.0633290708... | |
that it is fairly natural to put an action for changing a user's password on the Account controller, and that action could be invoked by the user herself, not just an administrator. So I wouldn't presume that the Account controller is strictly for administrative tasks. On the other hand, your example of the fund-raisin... | [
0.4336061179637909,
-0.06942126899957657,
-0.08051617443561554,
0.03976990655064583,
0.218714639544487,
0.09970112144947052,
-0.003030254505574703,
-0.013223697431385517,
-0.3632536232471466,
-0.07416998594999313,
-0.11592637747526169,
0.43634599447250366,
-0.10506899654865265,
-0.10150869... | |
On my laptop with Intel Pentium dual-core processor T2370 (Acer Extensa) I ran a simple multithreading speedup test. I am using Linux. The code is pasted below. While I was expecting a speedup of 2-3 times, I was surprised to see a **slowdown** by a factor of 2. I tried the same with gcc optimization levels -O0 ... -O3... | [
0.35196369886398315,
0.042063694447278976,
0.36726632714271545,
0.016972359269857407,
0.04283970221877098,
0.2611231505870819,
0.171405628323555,
0.3396172523498535,
-0.21647056937217712,
-0.9254569411277771,
-0.06171948090195656,
0.6720596551895142,
-0.23763249814510345,
0.107903160154819... | |
reasonably long - about 20 secs - so it seems is not an issue of startup overhead.
NOTE: This code is a lot buggy (indeed it does not make much sense as the output of serial and parallel versions would be different). The intention was just to "get" a speedup comparison for the same number of instructions.
```
#incl... | [
0.37686872482299805,
-0.32099494338035583,
0.4243682324886322,
0.002606011461466551,
0.30319201946258545,
-0.005266243126243353,
0.5024126768112183,
-0.29683879017829895,
-0.3034612238407135,
-0.4731433689594269,
0.037245482206344604,
0.5312067270278931,
-0.01867925003170967,
0.08759150654... | |
Thread(){}
virtual ~Thread(){}
virtual void run(){}
int start(){return pthread_create(&thread, NULL, Thread::thread_func, (void*)this);}
int wait(){return pthread_join(thread, NULL);}
};
#include <iostream>
const int ARR_SIZE = 100000000;
const int N = 20;
int arr[ARR_... | [
-0.007458524778485298,
-0.2503511607646942,
0.6803820729255676,
-0.41474515199661255,
0.3883010149002075,
0.4226035177707672,
0.32439273595809937,
-0.14536269009113312,
-0.4133627414703369,
-0.3698347508907318,
-0.17290592193603516,
0.3813084661960602,
-0.3700145483016968,
0.56473743915557... | |
Thread_a(int* a): arr_(a) {}
void run()
{
for(int n = 0; n<N; n++) | [
0.26261651515960693,
-0.3093685209751129,
0.17942006886005402,
-0.5593240261077881,
0.29197126626968384,
0.3396614193916321,
0.4737851917743683,
-0.010661978274583817,
-0.4232707619667053,
-0.12163233011960983,
0.039885975420475006,
0.3842291235923767,
-0.7010515332221985,
0.55749690532684... | |
for(int i=0; i<ARR_SIZE/3; i++){ arr_[i] += arr_[i-1];}
}
private:
int* arr_;
};
class Thread_b:public Thread{ | [
0.029107186943292618,
-0.07364509254693985,
0.38078245520591736,
-0.589064359664917,
0.0988665372133255,
0.3787568211555481,
0.3849925994873047,
-0.3047548830509186,
-0.27347812056541443,
-0.13969449698925018,
-0.08876755833625793,
0.4368516504764557,
-0.5871103405952454,
0.504907071590423... | |
public:
Thread_b(int* a): arr_(a) {}
void run()
{
for(int n = | [
0.41376692056655884,
-0.28625527024269104,
-0.020495956763625145,
-0.42917880415916443,
0.3434697687625885,
0.23521748185157776,
0.45635226368904114,
0.09945125877857208,
-0.5006366968154907,
-0.1974003165960312,
0.0020165233872830868,
0.4848887622356415,
-0.6356043219566345,
0.59185099601... | |
0; n<N; n++)
for(int i=ARR_SIZE/3; i<2*ARR_SIZE/3; i++){ arr_[i] += arr_[i-1];}
}
private:
int* arr_;
};
class Thread_c:public Thread{ | [
-0.1091589480638504,
-0.014141988940536976,
0.5350329875946045,
-0.5927273035049438,
0.13291305303573608,
0.36356109380722046,
0.38149186968803406,
-0.3399165868759155,
-0.3008033037185669,
-0.03929324448108673,
-0.1701505035161972,
0.5228089094161987,
-0.5672290325164795,
0.56362932920455... | |
public:
Thread_c(int* a): arr_(a) {}
void run()
{ | [
0.5505130887031555,
-0.12512923777103424,
-0.11085479706525803,
-0.3591879606246948,
0.25026172399520874,
0.1426173597574234,
0.4069238603115082,
0.2822367250919342,
-0.3409402370452881,
-0.1603248417377472,
-0.16112376749515533,
0.5431439280509949,
-0.7178576588630676,
0.5632113814353943,... | |
for(int n = 0; n<N; n++)
for(int i=2*ARR_SIZE/3; i<ARR_SIZE; i++){ arr_[i] += arr_[i-1];}
}
private:
int* arr_;
}; | [
-0.3023902475833893,
-0.05405489355325699,
0.36526647210121155,
-0.7193026542663574,
-0.07718182355165482,
0.4487617313861847,
0.5636516213417053,
-0.7177804708480835,
-0.1525106430053711,
-0.12053613364696503,
-0.35625937581062317,
0.5541789531707764,
-0.4638881981372833,
0.03042731992900... | |
{
Thread *a=new Thread_a(arr);
Thread *b=new Thread_b(arr);
Thread *c=new Thread_c(arr);
clock_t start = clock();
if (a->start() != 0) {
return 1; | [
0.08355016261339188,
-0.1882266402244568,
0.4005358815193176,
-0.5558605790138245,
0.320153146982193,
0.16062313318252563,
0.4195811450481415,
-0.17759589850902557,
-0.4835144877433777,
-0.17322245240211487,
-0.3107618987560272,
0.4638926386833191,
-0.5736182928085327,
0.5788304209709167,
... | |
}
if (b->start() != 0) {
return 1;
}
if (c->start() != 0) {
return 1; | [
-0.2720685303211212,
-0.09015654027462006,
-0.13826172053813934,
-0.3256779611110687,
0.34452128410339355,
-0.14416366815567017,
0.29772597551345825,
-0.2670680284500122,
0.2111315131187439,
-0.08109242469072342,
-0.9076518416404724,
0.45042213797569275,
-0.4199647903442383,
-0.08929037302... | |
}
if (a->wait() != 0) {
return 1;
}
if (b->wait() != 0) {
return 1; | [
-0.08497045934200287,
-0.3665211796760559,
0.04546390101313591,
-0.36707043647766113,
0.34938743710517883,
0.015679754316806793,
0.244947612285614,
-0.251121461391449,
0.10196711868047714,
0.12221813946962357,
-0.7373901009559631,
0.5358571410179138,
-0.46024301648139954,
-0.01778000965714... | |
}
if (c->wait() != 0) {
return 1;
}
clock_t end = clock();
double duration = (double)(end - start) / CLOCKS_PER_SEC; | [
0.6305264234542847,
-0.5596139430999756,
0.3010495901107788,
-0.2571834325790405,
0.3805491328239441,
-0.14266516268253326,
0.49070727825164795,
-0.32606232166290283,
-0.2139713317155838,
-0.031164169311523438,
-0.4256354868412018,
0.5899149775505066,
-0.4153726100921631,
0.316529124975204... | |
std::cout << duration << "seconds\n";
delete a;
delete b;
}
{
clock_t start = clock();
for(int n = 0; n<N; n++)
for(int i=0; i<ARR_SIZE; i++){ arr[i] += arr[i-1];} | [
0.0900445505976677,
-0.1655532717704773,
0.33270296454429626,
-0.7627062797546387,
0.12887583673000336,
0.3476942479610443,
0.46250906586647034,
-0.310975581407547,
-0.4572741985321045,
-0.134250208735466,
-0.22772152721881866,
0.4497523307800293,
-0.4332684874534607,
0.294996052980423,
... | |
clock_t end = clock();
double duration = (double)(end - start) / CLOCKS_PER_SEC;
std::cout << "serial: " << duration << "seconds\n";
}
return 0;
}
```
---
See also: [What can make a program run slower when using more threads?](https://stackoverflow.com/questions/612860/what-can-ma... | [
0.46121683716773987,
-0.14359451830387115,
0.4056234061717987,
-0.07608836889266968,
0.2127550095319748,
0.07842989265918732,
0.3279768228530884,
-0.2258259803056717,
-0.4202638864517212,
-0.4672430455684662,
0.044142335653305054,
0.5292418599128723,
-0.17106123268604279,
0.226261973381042... | |
real time will be less for multiprocessor tasks, but the processor time will typically be greater.
When you use multiple threads, the work may be done by more than one processor, but the amount of work is the same, and in addition there may be some overhead such as contention for limited resources. `clock()` measures... | [
0.18730778992176056,
-0.09770117700099945,
0.2936324179172516,
0.18995322287082672,
0.21623097360134125,
0.10659461468458176,
0.3500775098800659,
0.1225486621260643,
-0.48666101694107056,
-0.6896405816078186,
-0.007841154932975769,
0.6039386987686157,
-0.2786265015602112,
-0.11737637221813... | |
were surprised that the value returned by `clock()` was twice that for a single thread rather than being only a little more, or you were expecting it to be less.
Using [`clock_gettime()`](http://linux.die.net/man/3/clock_gettime) instead (you'll need the realtime library librt, `g++ -lrt` etc.) gives:
```
$ time bin/... | [
0.18088793754577637,
-0.21014338731765747,
0.6518678665161133,
-0.01295105367898941,
0.2142070084810257,
0.19558227062225342,
0.28662338852882385,
-0.18332809209823608,
-0.511221170425415,
-0.5692600607872009,
0.05513186380267143,
0.5354785323143005,
0.0069502596743404865,
0.18385224044322... | |
bandwidth limited as tstenner suggests, and the `clock()` value shows that most of the time some of your processors are waiting for data. (does anyone know whether `clock()` time includes such stalls?) | [
0.35462236404418945,
-0.09712690860033035,
-0.0021381801925599575,
0.3267589211463928,
0.12781065702438354,
-0.11442059278488159,
0.13738024234771729,
0.38192734122276306,
-0.3876963257789612,
-0.4727947413921356,
0.0014941252302378416,
0.6473174095153809,
-0.2783254384994507,
0.4090220928... | |
The issue:
Some of the items in the select require more than the specified width of 145px in order to display fully.
**Firefox behavior**: clicking on the select reveals the dropdown elements list adjusted to the width of the longest element.
**IE6 & IE7 behavior**: clicking on the select reveals the dropdown elemen... | [
0.10954179614782333,
-0.22063776850700378,
0.6744505763053894,
-0.07005215436220169,
0.21755380928516388,
-0.2920215427875519,
0.3066086769104004,
-0.37599804997444153,
-0.3107580542564392,
-0.5468814373016357,
-0.33677953481674194,
0.5743312835693359,
-0.21757885813713074,
-0.080428369343... | |
expanded.
Thank you!
The css:
```
select.center_pull {
background:#eeeeee none repeat scroll 0 0;
border:1px solid #7E7E7E;
color:#333333;
font-size:12px;
margin-bottom:4px;
margin-right:4px;
margin-top:4px;
width:145px;
}
```
Here's the select input code (there's no definition for... | [
-0.3006730079650879,
-0.08144903182983398,
1.0521105527877808,
0.13466069102287292,
-0.00008682032057549804,
-0.04149525240063667,
-0.2740575671195984,
-0.3906441330909729,
-0.3592635989189148,
-0.8047603964805603,
-0.34862658381462097,
0.25976666808128357,
-0.06116492301225662,
-0.1554500... | |
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>dropdown test</title>
<style type="text/css">
<!--
select.center_pull {
background:#eeeeee none repeat scroll 0 0;
border:1p... | [
-0.33641141653060913,
-0.26659679412841797,
0.7574452757835388,
0.1652042418718338,
-0.12509125471115112,
0.08465062826871872,
-0.03219783306121826,
-0.5430028438568115,
-0.1609068065881729,
-0.5556191802024841,
-0.36402714252471924,
0.3355374336242676,
0.15838627517223358,
-0.282643735408... | |
set the position property, if the selectbox is child of a container with fixed width.)
Unfortunately IE 7 and less do not support the :focus selector. | [
-0.1086951419711113,
-0.4522998631000519,
0.07347963750362396,
-0.1905122995376587,
0.06557013094425201,
-0.15192796289920807,
-0.06918938457965851,
0.11079174280166626,
0.22270764410495758,
-0.5302206873893738,
-0.420257031917572,
0.6812744140625,
-0.24339695274829865,
-0.2660735249519348... | |
I've got a set of Java2D calls that draw vectors on a graphics context. I'd like for the image to be doubled in size and then rotated 90 degrees.
I'm using the following code to do this:
```
Graphics2D g2 = // ... get graphics 2d somehow ...
AffineTransform oldTransform = g2.getTransform();
AffineTransform newTransfo... | [
0.07700443267822266,
0.07671493291854858,
0.9150519371032715,
-0.2248777598142624,
-0.4025968611240387,
0.3261682093143463,
0.09653755277395248,
-0.6498134732246399,
-0.24624575674533844,
-0.7437798976898193,
0.04961197078227997,
0.7234022617340088,
-0.2249828726053238,
0.05815738067030907... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.