text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
dwLastChange: longint;
dwInOctets: longint;
dwInUcastPkts: longint;
dwInNUcastPkts: longint;
dwInDiscards: longint;
dwInErrors: longint;
dwInUnknownProtos: longint;
dwOutOctets: longint;
dwOutUcastPkts: longint;
dwOutNUcastPkts: longint;
dwOutDiscards: longint;
dwOutErrors: l... | [
-0.2593546211719513,
-0.6403760313987732,
0.5439603328704834,
-0.31402429938316345,
-0.03577474132180214,
0.2919252812862396,
0.394630491733551,
-0.4466765820980072,
-0.09972206503152847,
-0.5055703520774841,
-0.39233827590942383,
0.4555661678314209,
-0.030816951766610146,
0.35221135616302... | |
longint;
dwIndex: longint;
dwMask: longint;
dwBCastAddr: longint;
dwReasmSize: longint;
unused1: word;
unused2: word;
end;
type
_IfTable = record
nRows: longint;
ifRow: array[1.._MAX_ROWS_] of MIB_IFROW;
end;
type
_IpAddrTable = record
dwNumEntries: longint... | [
-0.4497871398925781,
-0.18223631381988525,
0.6731444001197815,
-0.4798780381679535,
0.09055935591459274,
0.5041374564170837,
0.4414809048175812,
-0.5080283880233765,
-0.4261748492717743,
-0.6298910975456238,
-0.41156256198883057,
0.2025415301322937,
-0.3750050365924835,
0.1549493819475174,... | |
longint;
bOrder: longint): longint; stdcall;
function Get_if_type(iType: integer): string;
function Get_if_admin_status(iStatus: integer): string;
function Get_if_oper_status(iStatus: integer): string;
implementation
function GetIfTable; stdcall; external 'IPHLPAPI.DLL';
function GetIpAddrTable; stdcall; external ... | [
-0.2734740376472473,
-0.46112751960754395,
0.6557826995849609,
0.005175980739295483,
0.07420307397842407,
0.16891640424728394,
0.29321661591529846,
-0.4565424621105194,
-0.24123986065387726,
-0.32477423548698425,
-0.5402043461799622,
0.31532853841781616,
-0.4315192997455597,
0.021229192614... | |
37: sResult := 'ATM';
71: sResult := 'IEEE 802.11';
131: sResult := 'Tunnel';
144: sResult := 'IEEE 1394 (Firewire)';
end;
Result := sResult;
end;
function Get_if_admin_status(iStatus: integer): string;
var
sResult: string;
begin
sResult := 'UNKNOWN';
case iStatus of
1: sResult := 'UP';
... | [
-0.13245195150375366,
0.15871483087539673,
0.29237526655197144,
0.0038090345915406942,
0.2662763297557831,
0.1925315260887146,
0.5180104374885559,
-0.45671263337135315,
-0.11005326360464096,
-0.3809177875518799,
-0.6604278087615967,
0.2670727074146271,
-0.3689107596874237,
-0.0066847302950... | |
1: sResult := 'UNREACHABLE';
2: sResult := 'DISCONNECTED';
3: sResult := 'CONNECTING';
4: sResult := 'CONNECTED';
5: sResult := 'OPERATIONAL';
end;
Result := sResult;
end;
end.
```
To use this unit from another unit, I created the following function, which populated a custom type called `TAdapte... | [
-0.19010236859321594,
-0.1860426664352417,
0.49854040145874023,
0.23837873339653015,
0.1481611430644989,
0.0838756412267685,
0.566087007522583,
-0.5394049882888794,
-0.28442439436912537,
-0.33642563223838806,
-0.2268562614917755,
0.2731527090072632,
-0.17217078804969788,
0.600928008556366,... | |
extended;
dwPhysAddrLen: longint;
bPhysAddr: string;
dwAdminStatus: longint;
dwOperStatus: longint;
dwLastChange: longint;
dwInOctets: longint;
dwInUcastPkts: longint;
dwInNUcastPkts: longint;
dwInDiscards: longint;
dwInErrors: longint;
dwInUnknownProtos: longint;
dwOutO... | [
-0.055262599140405655,
-0.8482800722122192,
0.4214993119239807,
-0.37645554542541504,
-0.289304256439209,
0.36748966574668884,
0.4344460368156433,
-0.41424211859703064,
-0.3199697732925415,
-0.3344889283180237,
-0.5911643505096436,
0.5431009531021118,
0.054791443049907684,
0.23748809099197... | |
string;
sIpAddress: string;
sIpMask: string;
end;
```
//////////
```
function Get_EthernetAdapterDetail(var AdapterDataFound: TAdapterInfo): boolean;
var
pIfTable: ^_IfTable;
pIpTable: ^_IpAddrTable;
ifTableSize, ipTableSize: longint;
tmp: string;
i, j, k, m: integer;
ErrCode: longint;... | [
-0.365030437707901,
-0.31724169850349426,
0.6607537865638733,
-0.1368183195590973,
0.10601881146430969,
0.3818318843841553,
0.3356088697910309,
-0.19166649878025055,
-0.1903109848499298,
-0.6904991865158081,
-0.4801413416862488,
0.5659925937652588,
-0.554624617099762,
-0.09975337982177734,... | |
// First: just get the buffer size.
// TableSize returns the size needed.
ifTableSize := 0; // Set to zero so the GetIfTabel function
// won't try to fill the buffer yet,
// but only return the actual size it needs.
GetIfTable(pIfTable, ifTableSize, 1);
if (ifTableSize < SizeOf(MIB_IFROW) + Size... | [
-0.2191431224346161,
-0.22153626382350922,
0.6161276698112488,
-0.48533183336257935,
0.3423849046230316,
0.15298393368721008,
0.5116963982582092,
-0.36283954977989197,
-0.2558726370334625,
-0.6147739291191101,
-0.3667663037776947,
0.476394921541214,
-0.2460717260837555,
0.00483622029423713... | |
table entry?!
end;
ipTableSize := 0;
GetIpAddrTable(pIpTable, ipTableSize, 1);
if (ipTableSize < SizeOf(MIB_IPADDRROW) + Sizeof(longint)) then
begin
bResult := False;
Result := bResult;
Exit; // less than 1 table entry?!
end;
// Second:
// allocate memory for the buf... | [
-0.6204713582992554,
-0.012199237942695618,
0.7156710028648376,
-0.22581690549850464,
0.2141534984111786,
0.4106653034687042,
0.19807477295398712,
-0.37314677238464355,
-0.31585124135017395,
-0.6300843358039856,
-0.4969760477542877,
0.15134330093860626,
-0.15751515328884125,
0.082579620182... | |
1);
if ErrCode <> ERROR_SUCCESS then
begin
bResult := False;
Result := bResult;
Exit; // OK, that did not work.
// Not enough memory i guess.
end;
GetMem(pIpTable, ipTableSize);
ErrCode := GetIpAddrTable(pIpTable, ipTableSize, 1);
if ErrCode <> ERROR_SUCCESS then
... | [
-0.4913734197616577,
-0.15577223896980286,
0.45173338055610657,
-0.29949986934661865,
0.20158804953098297,
0.15162190794944763,
0.47949540615081787,
-0.37607139348983765,
-0.19674696028232574,
-0.5946942567825317,
-0.46204298734664917,
0.5046494603157043,
-0.29080525040626526,
0.0188101492... | |
Exit;
end;
for k := 1 to pIpTable^.dwNumEntries do
begin
sAddr.S_addr := pIpTable^.table[k].dwAddr;
sMask.S_addr := pIpTable^.table[k].dwMask;
sIPAddressLine := Format('0x%8.8x', [(pIpTable^.table[k].dwIndex)]) +
'=' + Format('%s', [inet_ntoa(sAddr)]);
sIPMaskLine := For... | [
-0.644372284412384,
-0.22743278741836548,
0.8474182486534119,
-0.15538227558135986,
0.08350425958633423,
0.44628965854644775,
0.46348100900650024,
-0.25744518637657166,
-0.19825269281864166,
-0.6297904253005981,
-0.6113099455833435,
0.1776992678642273,
-0.03697236627340317,
0.1854125708341... | |
end;
SetLength(AdapterDataFound, pIfTable^.nRows); //initialize the array or records
for i := 1 to pIfTable^.nRows do
try
//if pIfTable^.ifRow[i].dwType=MIB_IF_TYPE_ETHERNET then
//begin
m := i - 1;
AdapterDataFound[m].dwIndex := 4;//(pIfTable^.ifRow[i].dwIndex);
A... | [
-0.040493082255125046,
-0.6139597296714783,
0.7749751210212708,
-0.07813132554292679,
0.2695828080177307,
0.01822686940431595,
0.3847285211086273,
-0.5791010856628418,
-0.19693370163440704,
-0.7075990438461304,
-0.3814663589000702,
0.6652485132217407,
-0.2458210289478302,
0.240848794579505... | |
IPAddresses.Values[Format('0x%8.8x', [(pIfTable^.ifRow[i].dwIndex)])];
AdapterDataFound[m].sIpMask :=
IPMasks.Values[Format('0x%8.8x', [(pIfTable^.ifRow[i].dwIndex)])];
AdapterDataFound[m].dwMtu := (pIfTable^.ifRow[i].dwMtu);
AdapterDataFound[m].dwSpeed := (pIfTable^.ifRow[i].dwSpeed);... | [
-0.5633265972137451,
-0.44387996196746826,
0.7645549774169922,
-0.03316571190953255,
0.05637628957629204,
0.5126935839653015,
0.4817145764827728,
-0.24213330447673798,
-0.4869045615196228,
-0.9969586730003357,
-0.6110920906066895,
0.5442880392074585,
-0.30764347314834595,
-0.10110130906105... | |
AdapterDataFound[m].dwInErrors := (pIfTable^.ifRow[i].dwInErrors);
AdapterDataFound[m].dwInUnknownProtos := (pIfTable^.ifRow[i].dwInUnknownProtos);
AdapterDataFound[m].dwOutNUcastPkts := (pIfTable^.ifRow[i].dwOutNUcastPkts);
AdapterDataFound[m].dwOutUcastPkts := (pIfTable^.ifRow[i].dwOutUcastPkt... | [
-0.3287111520767212,
-0.4106898605823517,
0.5941410064697266,
-0.22483907639980316,
-0.016534490510821342,
0.3957531750202179,
0.37631362676620483,
-0.5726491212844849,
-0.21368654072284698,
-0.7538371086120605,
-0.7845961451530457,
0.6433435082435608,
-0.2511940598487854,
0.00949603132903... | |
- 1 do
begin
if Length(tmp) > 0 then
tmp := tmp + '-' + format('%.2x', [pIfTable^.ifRow[i].bPhysAddr[j]])
else
tmp := tmp + format('%.2x', [pIfTable^.ifRow[i].bPhysAddr[j]]);
end;
if Length(tmp) > 0 then
begin | [
0.10062010586261749,
-0.05098620802164078,
0.38384851813316345,
-0.280330628156662,
-0.1357700079679489,
0.24817152321338654,
0.4057341516017914,
-0.4223203659057617,
-0.23582403361797333,
-0.2630819082260132,
-0.8123323917388916,
0.3582143783569336,
-0.5374417304992676,
-0.086293883621692... | |
AdapterDataFound[m].bPhysAddr := tmp;
end;
except
bResult := False;
Result := bResult;
Exit;
end;
finally
if Assigned(pIfTable) then
begin
FreeMem(pIfTable, ifTableSize);
end;
FreeAndNil(IPMasks);
FreeAndNil(IPAddresses);
end;
Result := bRes... | [
-0.07788190990686417,
-0.24247345328330994,
0.7915000915527344,
-0.10778380185365677,
0.16057363152503967,
0.31439751386642456,
0.33304232358932495,
-0.38737159967422485,
-0.23695889115333557,
-0.3784846365451813,
-0.7842786908149719,
0.3799913227558136,
-0.3118746280670166,
-0.10274472087... | |
note, I also used this unit and almost exact same code to create a duplicate of `ifconfig -a`, which [can be found on github](https://github.com/MicksMix/ifconfig). I mainly did it as an exercise in teaching myself how to accomplish this task. | [
-0.11802098900079727,
0.04220399260520935,
-0.00647772429510951,
-0.19594541192054749,
-0.07896395772695541,
0.06768933683633804,
0.16544999182224274,
0.40143176913261414,
-0.49245738983154297,
-0.444543719291687,
0.2813553810119629,
0.2543989419937134,
-0.19649073481559753,
0.053057048469... | |
I have a TSqlDataSet which has a blob field, I need to get the data of this blob field in the BeforeUpdateRecord event of the provider and execute an update command, I've tried this:
```
Cmd := TSQLQuery.Create(nil);
try
Cmd.SQLConnection := SQLConnection;
Cmd.CommandText := 'UPDATE MYTABLE SET IMAGE = :PIMAGE WHE... | [
-0.013676288537681103,
0.008059102110564709,
0.6742085814476013,
-0.09180236607789993,
-0.1653584986925125,
0.2808179259300232,
0.2951926589012146,
-0.24646618962287903,
-0.2636736333370209,
-0.7726128101348877,
-0.2283671498298645,
0.3598179817199707,
-0.24035945534706116,
0.2527003288269... | |
following:
```
const
SQL = 'UPDATE MYTABLE SET IMAGE = :PIMAGE WHERE ID = :PID;';
var
Params: TParams;
begin
Params := TParams.Create(nil);
try
Params.CreateParam(ftBlob, 'PIMAGE', ptInput).AsBlob := DeltaDS.FieldByName('IMAGE').NewValue;
Params.CreateParam(ftString, 'PID', ptInput).Value := DeltaDS.Fi... | [
-0.10195258259773254,
-0.09813809394836426,
0.6435242891311646,
-0.1397082656621933,
-0.1666269451379776,
0.4992888867855072,
0.34186840057373047,
-0.590135931968689,
-0.3389497399330139,
-0.6644729971885681,
-0.38074326515197754,
0.2421039342880249,
-0.3997182250022888,
0.2255460321903228... | |
I have this code
```
<?php
session_start();
if (isset($_GET["cmd"]))
$cmd = $_GET["cmd"];
else
die("You should have a 'cmd' parameter in your URL");
$pk = $_GET["pk"];
$con = mysql_connect("localhost","root","geheim");
if(!$con)
{
die('Connection failed because of' .mysql_error());
}
mysql_select_db("ebay",$con);... | [
0.13516129553318024,
0.12678343057632446,
0.7630549073219299,
-0.060755304992198944,
-0.019139936193823814,
0.14366839826107025,
0.06552469730377197,
-0.5818802118301392,
0.24232761561870575,
-0.6995776891708374,
-0.028715550899505615,
0.43695127964019775,
-0.24747592210769653,
0.564104974... | |
+++++++++++++++++++++++++++++++++++++++++ -->
</td>
<td>
<br>
<br>
<style ty</td>
<td>float: right;
</td>
<td>margin: 0px;
</td>
<td>0</td>
<td>0</td>
<td>0</td>
<td>padding:5px;
</td>
<td>0.00</td>
<td>0.00</td>
<td>0.00</td>
<td>0</td>
<td>0</td>
<td>font-size: 12px;
</td>
<td>color: #333333;
}
#h</td>
<td>0000-00-0... | [
-0.18946923315525055,
0.20460067689418793,
0.8518252372741699,
-0.13256989419460297,
-0.05454680323600769,
0.24205707013607025,
0.024858050048351288,
-0.6978499889373779,
-0.22815443575382233,
-0.6342644691467285,
-0.46447572112083435,
0.08391126245260239,
-0.08786711096763611,
-0.08054248... | |
When I discovered [`boost::lexical_cast`](http://www.boost.org/doc/libs/1_47_0/libs/conversion/lexical_cast.htm) I thought to myself "why didn't I know about this sooner!" - I hated having to write code like
```
stringstream ss;
ss << anIntVal;
mystring = ss.str();
```
Now I write
```
mystring = boost::lexical_cas... | [
0.1864161640405655,
-0.11605677753686905,
0.19016431272029877,
-0.09816485643386841,
-0.3419113755226135,
0.0881531834602356,
0.31715071201324463,
-0.3625938296318054,
-0.41290777921676636,
-0.4887695610523224,
-0.05007587745785713,
0.6429460644721985,
-0.14024096727371216,
-0.160071343183... | |
use most / would hate not to have?
Probably the most used part of boost for me is [boost::shared\_ptr](http://www.boost.org/doc/libs/1_37_0/libs/smart_ptr/shared_ptr.htm). | [
0.3717288374900818,
-0.3190907835960388,
0.2013595700263977,
0.05422412231564522,
-0.15491995215415955,
-0.19617216289043427,
-0.3075011670589447,
0.12997733056545258,
0.046601198613643646,
-0.15884315967559814,
-0.01759250834584236,
0.7258350253105164,
-0.002920432249084115,
-0.2795939147... | |
I've got an executable file, and I would like to know which version(s) of the Microsoft .NET Framework this file needs to be started.
Is there an easy way to find this information somewhere?
(So far I tried [ILDASM](https://en.wikipedia.org/wiki/ILDASM#Metadata_storage) and [DUMPBIN](https://support.microsoft.com/kb/... | [
0.4093583822250366,
0.0431176982820034,
0.4299283027648926,
-0.0014552364591509104,
-0.1412215679883957,
-0.4043741822242737,
0.07547304779291153,
0.0702783465385437,
-0.2006622552871704,
-0.7048330903053284,
-0.10717424005270004,
0.4778599143028259,
-0.33884117007255554,
0.139368712902069... | |
the comment is "// Metadata version" and in Reflector the comment is "Target Runtime Version".
Here are examples for a .NET WinForms application named WindowsFormsApplication1.exe:
ILDASM:
```
// Metadata version: v2.0.50727
.assembly extern mscorlib
{
.publickeytoken = (B7 7A 5C 56 19 34 E0 89 ) ... | [
-0.07194966077804565,
-0.2218649685382843,
0.5789623260498047,
-0.08457504957914352,
0.06055804714560509,
-0.06547641009092331,
0.2072347104549408,
-0.12986284494400024,
-0.13614453375339508,
-0.32599911093711853,
-0.2731560468673706,
0.484116792678833,
-0.28735944628715515,
0.271881133317... | |
// .z\V.4..
.ver 2:0:0:0
}
```
Reflector:
```
.module WindowsFormsApplication1.exe
.subsystem 0x0002
// MVID: {CA3D2090-16C5-4899-953E-4736D6BC0FA8}
// Target Runtime Version: v2.0.50727
```
You can also look at the list of referenced assemblies and look for the reference with the highest version number.
Again... | [
0.09763147681951523,
-0.000900785147678107,
0.5503641963005066,
0.015958236530423164,
-0.03446561098098755,
-0.1091689020395279,
0.26534503698349,
-0.37576282024383545,
-0.17664730548858643,
-0.7140835523605347,
-0.09592920541763306,
0.41386792063713074,
-0.43849116563796997,
0.34964954853... | |
56 19 34 E0 89 ) // .z\V.4..
.ver 3:5:0:0
}
```
And using Reflector, looking at the dissambly (still as IL) for each reference listed:
```
.assembly extern System.Core
{
.ver 3:5:0:0
.publickeytoken = (B7 7A 5C 56 19 34 E0 89)
}
```
By finding the reference with the highest versio... | [
0.3900974988937378,
0.18121150135993958,
0.5803883671760559,
0.03509048372507095,
0.014776594005525112,
-0.12706723809242249,
0.47136232256889343,
-0.5224020481109619,
-0.1776227504014969,
-0.5315475463867188,
-0.2775834798812866,
0.38783103227615356,
-0.3928723633289337,
0.217956736683845... | |
installed for the application to run. That being said, I wouldn't treat this as 100% reliable, but I don't think it will change any time soon. | [
0.45449891686439514,
0.07754381746053696,
0.5042974948883057,
0.18327385187149048,
0.23010943830013275,
-0.46885356307029724,
0.4214247763156891,
0.2425006628036499,
0.21990719437599182,
-0.49522799253463745,
0.09738992154598236,
0.7289103269577026,
-0.09188106656074524,
-0.186710074543952... | |
I want to do exactly the same as in [this question](https://stackoverflow.com/questions/74451/getting-actual-file-name-with-proper-casing-on-windows):
> Windows file system is case insensitive. How, given a file/folder name (e.g. "somefile"), I get the actual name of that file/folder (e.g. it should return "SomeFile" ... | [
-0.0038693395908921957,
0.029423315078020096,
0.4482927918434143,
-0.0502295084297657,
-0.11987528204917908,
-0.27000513672828674,
0.24115940928459167,
-0.0447426401078701,
-0.05931173264980316,
-0.6616440415382385,
-0.33679524064064026,
0.6355333924293518,
-0.12425339967012405,
-0.0328091... | |
seems to find the file like John Sibly suggested.
I created a method that will take a path (folder or file) and return the correctly cased version of it (for the entire path):
```
public static string GetExactPathName(string pathName)
{
if (!(File.Exists(pathName) || Directory.Exists(pathName)))
... | [
0.08080846816301346,
-0.10548260062932968,
0.43279775977134705,
0.01839618757367134,
0.3456049859523773,
-0.1638515442609787,
0.4425235986709595,
-0.14911073446273804,
0.0887182280421257,
-0.7089577317237854,
-0.13409093022346497,
0.4893462359905243,
-0.4865665137767792,
0.2655579745769501... | |
return Path.Combine(
GetExactPathName(di.Parent.FullName),
di.Parent.GetFileSystemInfos(di.Name)[0].Name);
} else {
return di.Name.ToUpper();
}
}
```
Here are some test cases that worked on my machine:
```
static void Main(string[] args)
{ | [
0.16188521683216095,
-0.13032853603363037,
0.18547415733337402,
-0.337124228477478,
0.09463571012020111,
0.19692745804786682,
0.5133376717567444,
-0.27501729130744934,
0.012312062084674835,
-0.5269917845726013,
0.1508198380470276,
0.5579656362533569,
-0.48731687664985657,
0.125193715095520... | |
string file1 = @"c:\documents and settings\administrator\ntuser.dat";
string file2 = @"c:\pagefile.sys";
string file3 = @"c:\windows\system32\cmd.exe";
string file4 = @"c:\program files\common files";
string file5 = @"ddd";
Console.WriteLine(GetExactPathName(file1));
Con... | [
-0.2678356468677521,
-0.1269538402557373,
0.9190611243247986,
-0.20272167026996613,
0.2280486822128296,
0.12066999077796936,
0.27638089656829834,
-0.2861303687095642,
0.05148385092616081,
-0.7922161817550659,
-0.6568684577941895,
0.5789663791656494,
-0.436141699552536,
0.1471651941537857,
... | |
}
```
The method will return the supplied value if the file does not exists.
There might be faster methods (this uses recursion) but I'm not sure if there are any obvious ways to do it. | [
0.11299773305654526,
0.25540751218795776,
0.05485377088189125,
0.0195857435464859,
0.2491035908460617,
-0.2379412204027176,
0.3185786306858063,
0.25217562913894653,
0.19171828031539917,
-0.37167781591415405,
-0.08021344244480133,
0.6742855906486511,
-0.35087478160858154,
0.1787943691015243... | |
I'm aware of the Substance look and feels and that they have a Office 2007 look-a-like look and feel. But this look and feel doesn't look like the Office 2007 design at all, the colors are a lot different for example.
Are there other look and feels which mimic the Office 2007 more accurately?
Look!
<http://www.pushin... | [
0.47804632782936096,
0.18021303415298462,
0.4534856975078583,
-0.14697280526161194,
0.07217670977115631,
0.10663821548223495,
0.15703614056110382,
-0.07555960863828659,
-0.16432106494903564,
-0.48674342036247253,
0.33112937211990356,
0.40873512625694275,
0.014126204885542393,
0.00600738497... | |
We are contracting an external consultant out to generate XHTML (Transitional) and CSS for most of the major pages of a new project we are currently working on.
I've been asked to put together a list of guidelines for them so that we can be sure that a certain level of quality can be expected. As a bit of technical ba... | [
0.6231406331062317,
0.09685147553682327,
0.014580239541828632,
0.03477296978235245,
-0.09084618836641312,
-0.1369984745979309,
-0.12974265217781067,
-0.13052162528038025,
-0.276405394077301,
-0.6317235231399536,
-0.43999260663986206,
0.2748284935951233,
0.023515190929174423,
-0.28404584527... | |
a start but quickly realised that this is probably not a unique situation and that a tried and tested list might be out there somewhere that I can at least use as a template! Has anyone got any experience of this?
From a technical standpoint, pages must [pass validation](http://validator.w3.org/) is probably the first ... | [
0.729510486125946,
0.11832220107316971,
0.35321182012557983,
0.07384428381919861,
-0.351311057806015,
-0.5741373300552368,
0.43191826343536377,
-0.1099037453532219,
-0.40052029490470886,
-0.6307572722434998,
0.06107030808925629,
0.25776407122612,
0.062141746282577515,
0.006870097015053034,... | |
tags, inconsistent use of header tags etc.). | [
0.327170729637146,
-0.15298986434936523,
0.1243661642074585,
0.17002049088478088,
0.1970236897468567,
-0.2000778466463089,
0.25563907623291016,
-0.29306480288505554,
-0.24776074290275574,
-0.4577473998069763,
-0.5363322496414185,
0.3560580313205719,
-0.5796607732772827,
0.05377259850502014... | |
I've been using MVC frameworks for a short while now and I really like how the concerns are separated out. I've got into a bad habit of letting the controllers do quite a bit of work. So I'm really looking for some advice.
When I first started using MVC I quite often had the controller doing manipulation on the models... | [
0.495198518037796,
0.1304711550474167,
-0.0355786494910717,
0.08338186144828796,
0.2243531346321106,
-0.046421490609645844,
-0.005858459044247866,
0.04086501896381378,
-0.30757632851600647,
-0.5745089650154114,
0.47211819887161255,
0.5393383502960205,
-0.26260215044021606,
0.17473903298377... | |
that people are keeping their controllers and models lean by having a service layer, which I like the look of.
I'm just trying to understand how a service layer and repository should all work together. Here are my assumptions, can you please let me know if this is a good way of working?
1. The controller can call th... | [
0.5079433917999268,
-0.15309667587280273,
-0.02446145750582218,
0.3543996214866638,
0.12936975061893463,
-0.2116471827030182,
-0.23962418735027313,
0.05341848358511925,
-0.09261937439441681,
-0.2426494061946869,
0.03867731988430023,
0.5907132029533386,
-0.1946951001882553,
0.09868139773607... | |
service layer and the controller will make a simple call to the service layer as and when required
3. Once a service has done it's business logic it will then use the repository as necessary (if data needs to be persisted).
4. Models ideally should be kept lean, ideally actings as nothing more than DTOs
5. Validation o... | [
0.40106263756752014,
-0.13648872077465057,
0.622637152671814,
0.21947979927062988,
-0.17203018069267273,
-0.20665234327316284,
0.4101470410823822,
-0.6047564148902893,
0.11434423923492432,
-0.5179764628410339,
-0.19216667115688324,
0.5319352149963379,
0.10572192817926407,
-0.21625784039497... | |
UI.
I'm trying to turn all my code around to the single responsibility principle, hence trying to sort out my coding practices.
Thanks
First, there is no set of rules that's going to work in every situation. How you model you're application depends a lot on the type and complexity of the project. Having said that, he... | [
0.6056841611862183,
-0.08481435477733612,
0.1150592565536499,
0.3389233946800232,
-0.16727998852729797,
-0.1327114999294281,
0.14769889414310455,
-0.09548955410718918,
-0.1473621428012848,
-0.7662268280982971,
-0.1294541358947754,
0.38480857014656067,
-0.26131829619407654,
0.08344019204378... | |
wrong with calling it from a service.
3. The model **should** contain business logic, actually you should always try to put it in the model first. If you need external data to perform that business logic (from another model or from the repository) then you should create a service.
4. Nothing wrong with validation in th... | [
0.6718472838401794,
0.08939047157764435,
0.05939968675374985,
0.2623443603515625,
-0.12744848430156708,
-0.3701700270175934,
0.4740140736103058,
-0.23878881335258484,
-0.028456948697566986,
-0.4417383372783661,
-0.02978074550628662,
0.8431986570358276,
-0.08852124959230423,
-0.025341466069... | |
I have been learning C++ for three months now and in that time created a number of applications for my company. I consider myself fairly comfortable with C++ / MFC and STL, however I don't just want to be an OK programmer, I want to be a good programmer. I have a few books on best practices but I was wondering if anyon... | [
0.6100187301635742,
0.2707485556602478,
-0.16055439412593842,
-0.04851702228188515,
0.19193165004253387,
-0.16011811792850494,
0.3301660716533661,
0.30287742614746094,
-0.1817522943019867,
-0.39677801728248596,
0.1783258616924286,
0.6972845792770386,
0.37530919909477234,
0.0414269939064979... | |
Bjarne Stroustrup, 3rd Edition](https://rads.stackoverflow.com/amzn/click/com/0201700735) | [
-0.46888455748558044,
0.41964200139045715,
0.2652636766433716,
-0.30476322770118713,
-0.2184741050004959,
-0.22650602459907532,
0.5552962422370911,
-0.3897465467453003,
-0.8686052560806274,
0.15071874856948853,
-0.33549630641937256,
0.11462798714637756,
-0.21062003076076508,
-0.48731774091... | |
I recently bought a new web server 2008 for our company and require a FTP Hosting site that allows customers to upload files and host websites from our server, The site must have the shopping basket / Monthly rates built in.
If I purchased the correct template that is designed for hosting, How do I get it to work with ... | [
0.4235328733921051,
0.35462579131126404,
0.3151892423629761,
-0.07207086682319641,
0.3847848176956177,
0.36452850699424744,
0.22025036811828613,
-0.2290991097688675,
-0.20217293500900269,
-0.6782698631286621,
0.5120964050292969,
0.6803093552589417,
0.19757303595542908,
0.3727739751338959,
... | |
developing software that provides that functionality in a manner that a potential customer would go somewhere else.
You can install software like CPanel and others that make managing server functionality a lot easier. You can try third party shopping basket software but you may find that it is too generic for your spe... | [
0.5802673697471619,
0.0627288892865181,
-0.0007536426419392228,
0.45951199531555176,
0.15523429214954376,
-0.009774770587682724,
-0.1194792240858078,
0.2728903293609619,
-0.36963197588920593,
-0.8156530857086182,
0.03607045114040375,
0.491894006729126,
-0.17420262098312378,
0.1157871484756... | |
Let's say I have an integer that I need to convert to a string (I might be displaying the value to the user by means of a TextBox, for example.
Should I prefer `.ToString()` or `Convert.ToString()`. They both do the same thing (don't they?).
```
int someValue = 4;
// You can do this
txtSomeValue.Text = someValue.ToS... | [
0.25210997462272644,
0.12977007031440735,
0.36232349276542664,
-0.40327584743499756,
-0.06528138369321823,
0.06237310543656349,
0.36754798889160156,
-0.04854600876569748,
-0.21377001702785492,
-0.677259624004364,
0.05996457114815712,
0.8320339918136597,
-0.13894891738891602,
0.130620360374... | |
this is not strictly true...
One test is
```
//This will set the variable test to null:
string test = Convert.ToString(ConfigurationSettings.AppSettings["Missing.Value"]);
//This will throw an exception:
string test = ConfigurationSettings.AppSettings["Missing.Value"].ToString();
```
Got the above ready example fr... | [
0.22627271711826324,
0.17343294620513916,
0.05203293263912201,
-0.15708141028881073,
-0.16924451291561127,
-0.2656542956829071,
0.4393613338470459,
-0.2406979203224182,
-0.03712964057922363,
-0.49344339966773987,
0.051619116216897964,
0.663927435874939,
-0.3378986418247223,
0.0415356904268... | |
This is my code:
```
internal enum WindowsMessagesFlags {
WM_EXITSIZEMOVE = 0x00000232,
WM_DISPLAYCHANGE = 0x0000007e,
WM_MOVING = 0x00000216,
}
protected override void WndProc(ref Message m) {
switch(m.Msg) {
case (int)WindowsMessagesFlags.WM_DISPLAYCHANGE:
Fix... | [
-0.14114311337471008,
-0.07077384740114212,
0.6776710152626038,
-0.21585795283317566,
0.6713173389434814,
0.09104695916175842,
0.34093713760375977,
-0.26536497473716736,
-0.4206823706626892,
-0.6991984844207764,
-0.1283118724822998,
0.5918717980384827,
-0.17076726257801056,
0.3413487076759... | |
SaveWindowProperties();
break;
case (int)WindowsMessagesFlags.WM_MOVING:
KeepProperLocation(ref m);
break;
}
}
```
Is there anyway to prevent the casting?
Sort of - cast m.Msg instead:
```
protected override void WndProc(ref Message m) {
switch((WindowsMessagesFlag... | [
0.198001891374588,
-0.053381677716970444,
0.639354407787323,
-0.362976610660553,
0.41935548186302185,
0.0891512781381607,
0.4769946038722992,
-0.23442420363426208,
-0.40368005633354187,
-0.46509432792663574,
-0.24842293560504913,
0.6322861313819885,
-0.2187398076057434,
0.33223190903663635... | |
FixWindowSnapping();
break;
case WindowsMessagesFlags.WM_EXITSIZEMOVE:
SaveWindowProperties();
break;
case WindowsMessagesFlags.WM_MOVING:
KeepProperLocation(ref m); | [
-0.31227126717567444,
-0.13262180984020233,
0.559272050857544,
-0.3849552571773529,
0.6300478577613831,
0.1425994634628296,
0.5226694345474243,
0.014016029424965382,
-0.32504433393478394,
-0.4758477509021759,
-0.5878205299377441,
0.6738191246986389,
-0.2681705951690674,
0.09353316575288773... | |
break;
}
}
```
The reason you need the cast at all is because in C# enums aren't just numbers - they're numbers associated with the type. This prevents you from doing (without casting):
```
HttpStatusCode status = someWindowsMessageFlag;
```
This is clearly a good thing :) When you need to, however, you can al... | [
0.3075249195098877,
-0.007461645174771547,
0.10187583416700363,
-0.21217642724514008,
0.04576950892806053,
-0.35100001096725464,
0.5424928069114685,
0.03538987413048744,
-0.1777692288160324,
-0.3850869834423065,
-0.3768863081932068,
0.2810404300689697,
-0.30587151646614075,
0.0038008871488... | |
I have an ActiveX plugin that we need (if possible) to run in Firefox. Is there a plugin (or other way) for Firefox that will allow this?
I seem to have found a solution:
<http://code.google.com/p/ff-activex-host/>
"This Firefox plugin makes it possible to use ActiveX controls in Firefox. It is based on the Gecko NPA... | [
0.31067943572998047,
0.016844050958752632,
0.3127034604549408,
0.11463096737861633,
-0.07015977799892426,
-0.30295485258102417,
-0.0071402257308363914,
0.03882969543337822,
-0.24374791979789734,
-0.5734962821006775,
-0.22375860810279846,
0.700111448764801,
-0.5517314076423645,
-0.112594880... | |
I have a new project which simply put, is an attempt to formalize the look and feel of all of our departmental pages. I Googled around and found many tutorials which discussed the pros and cons of several techniques. And from what I've been reading, the thing I'm ooking for is controls. Basically, I want a common heade... | [
0.4764960706233978,
0.05626647174358368,
0.21211645007133484,
0.3691015839576721,
-0.0061382874846458435,
-0.09448674321174622,
-0.2358279973268509,
-0.11093617230653763,
-0.2712879180908203,
-0.6264368295669556,
0.03912748768925667,
0.21394677460193634,
-0.17022210359573364,
0.30645546317... | |
I would then copy and template and start filling in the content. Is there a simpler way of doing this pragmatically?
Thank you.
[Masterpages](http://www.odetocode.com/Articles/419.aspx) would seem to be what you are looking for. | [
0.38616275787353516,
-0.15404020249843597,
0.06669359654188156,
0.2640421986579895,
0.20983606576919556,
-0.10575488209724426,
-0.14085648953914642,
0.12361478805541992,
0.10677500814199448,
-0.6737087965011597,
-0.014762618578970432,
0.24698024988174438,
-0.02688252180814743,
0.0337896682... | |
For months now I've been trying to find a code syntax formatting extension that works for BlogEngine.Net. I'm not fond of the behavior of the default formatting extension, and have tried a couple of others (manoli is among them), but they always seem to interact badly with the TinyMCE editor. Does anyone know of an ext... | [
0.5676663517951965,
0.2574906051158905,
-0.08110122382640839,
0.21675270795822144,
-0.100760817527771,
-0.0989995226264,
0.08267401903867722,
0.23861569166183472,
-0.09886171668767929,
-0.494741290807724,
0.27506914734840393,
0.20958997309207916,
0.20558570325374603,
0.13805341720581055,
... | |
downloaded WLW and am now using it. As far as getting prettily formatted code, I'm using cut-and-paste from a little tool developed and available on [manoli.net](http://manoli.net/csharpformat/). | [
0.5076600313186646,
0.01680375635623932,
0.28082001209259033,
-0.06367671489715576,
0.008213512599468231,
-0.002077108481898904,
-0.14449022710323334,
0.3439355790615082,
-0.3653130531311035,
-0.8505608439445496,
-0.16118557751178741,
0.18592818081378937,
-0.017235523089766502,
0.033797018... | |
Is there a way to query or just access newly added object (using ObjectContext.AddObject method) in Entity Framework? I mean situation when it is not yet saved to data store using SaveChanges
I understand that queries are translated to underlying SQL and executed against data store, and it don't have this new object y... | [
-0.04048267751932144,
-0.10806894302368164,
0.3988006114959717,
0.35470280051231384,
0.13491906225681305,
-0.32899367809295654,
-0.01307615265250206,
0.1382473260164261,
-0.27704694867134094,
-0.6043856739997864,
0.13963232934474945,
0.6714390516281128,
-0.19657647609710693,
-0.00993999000... | |
this code, you have all the entities that are already loaded in the context (including newly added ones) :
```
context.ObjectStateManager.GetObjectStateEntries(EntityState.Added | EntityState.Modified | EntityState.Unchanged).Select(o => o.Entity).OfType<YourObjectType>()
``` | [
-0.1392114758491516,
0.12108255177736282,
0.5659943222999573,
-0.04604645445942879,
0.22805167734622955,
0.02768212929368019,
0.2645205557346344,
-0.17905734479427338,
-0.17889341711997986,
-0.538105845451355,
-0.3319444954395294,
0.5752590298652649,
-0.291168212890625,
0.07612842321395874... | |
I have a GridView populated from an ObjectDataSource with two items in its DataKeyNames field. One is the primary key, ID, the other is a category field (the category field is used to add header rows to delineate categories).
Displaying works fine, but I'm trying to create a Delete action. The object's delete method o... | [
0.3207283318042755,
-0.2921959161758423,
0.18542368710041046,
0.020017549395561218,
-0.27492815256118774,
0.14255329966545105,
-0.024124521762132645,
-0.13135558366775513,
-0.017091676592826843,
-0.7148876786231995,
0.27326148748397827,
0.5336162447929382,
-0.3363134264945984,
0.2784417271... | |
to the delete method, but it's annoying to have a parameter defined that isn't used for anything.
Can I configure the ObjectDataSource and GridView objects to have two values for DataKeyNames but specific which would should be passed to which methods?
The (simplified) definitions for the two objects are:
```
<asp:Ob... | [
-0.21184556186199188,
-0.3739788830280304,
0.5845106244087219,
0.12977346777915955,
-0.20042821764945984,
0.16919635236263275,
0.11373227089643478,
-0.41141682863235474,
-0.25259917974472046,
-0.5404990911483765,
-0.1332916021347046,
0.5513251423835754,
-0.3525518774986267,
0.1547545790672... | |
AutoGenerateColumns="False" DataKeyNames="ID,Category"
DataSourceID="ObjDS1">
<Columns>
<asp:BoundField DataField="ID" Visible="false" HeaderText="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" ItemStyle-Width="85%"/>
<asp:TemplateField>
<Item... | [
-0.12280985713005066,
-0.3796643018722534,
0.09324702620506287,
-0.2361646145582199,
-0.08027131855487823,
0.3086566627025604,
-0.09999445825815201,
-0.2911946475505829,
-0.03457724303007126,
-0.4997435212135315,
-0.2921932339668274,
0.6958647966384888,
-0.5435436367988586,
-0.170095548033... | |
OnClientClick="return confirm('Are you sure you want to delete this?');"
CommandName="Delete">Delete</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
```
All of the | [
-0.10318131744861603,
-0.26452359557151794,
0.6300054788589478,
0.14222918450832367,
0.38736703991889954,
-0.1277731955051422,
0.3084019720554352,
-0.2132556140422821,
-0.03256531432271004,
-0.5061519145965576,
-0.3375387191772461,
0.46058398485183716,
-0.475706547498703,
-0.05274701490998... | |
DataKey values will always be passed to the Delete method because the fields named by [DataKeyNames](http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.datakeynames.aspx) are intended to be the field or fields that uniquely identify that item in the GridView. They're often used for more than tha... | [
0.2404351830482483,
-0.20575302839279175,
0.5959731340408325,
0.20018905401229858,
0.00966999214142561,
-0.05542460456490517,
-0.0776645764708519,
-0.28782644867897034,
-0.41859063506126404,
-0.41117456555366516,
-0.18190185725688934,
0.49146002531051636,
-0.16259177029132843,
0.3966895639... | |
a hidden input in your Template Column, though. It would be more work to get that value out than to ignore the parameter to the Delete method, though. | [
0.15104754269123077,
-0.09641876816749573,
-0.04579254612326622,
0.2961260974407196,
-0.06048788130283356,
-0.04061169922351837,
0.1381109207868576,
-0.03650518134236336,
-0.08600368350744247,
-0.38653361797332764,
0.3235469162464142,
0.48524120450019836,
-0.010339582338929176,
-0.15948985... | |
I'm using Crystal Reports in vs2008, so I'm using datasets with procedures to get the data from the db, my escenario is the following:
In the same Crystal Report, I have to show two reports, basically using the sames datasets, and the same database, but they are different queries (have grouping and summing instead)
... | [
0.2298312932252884,
-0.013714558444917202,
0.2297336459159851,
0.11724317818880081,
-0.343845009803772,
0.039290908724069595,
0.21683190762996674,
-0.25943365693092346,
-0.28453463315963745,
-0.525461733341217,
0.33161282539367676,
0.5215606689453125,
-0.21942755579948425,
0.25613451004028... | |
to the sub report and utilize a whole different command in the sub report. I'm not sure the exact keyboard sequence to insert a sub report in VS2008, but in CR 2008, it's as simple as using the file menu INSERT > SUB REPORT. | [
-0.17450711131095886,
-0.4493677020072937,
0.5090649127960205,
0.036167290061712265,
-0.15103672444820404,
-0.12515857815742493,
0.14346015453338623,
0.05940501391887665,
-0.29472821950912476,
-0.5410141348838806,
-0.009180545806884766,
0.6794062852859497,
-0.2954970896244049,
0.1936600655... | |
I am a PHP developer who is kind of in a pickle. I'm trying to locate and/or build an API capable of speaking to Hotmail, Yahoo and GMAIL in order to retrieve contact lists (with the user's consent, of course). The one I'm having the most trouble finding is a Hotmail API.
Where would I start to look as far as finding ... | [
0.6974433064460754,
0.1952989250421524,
0.1260666698217392,
0.25625646114349365,
-0.024356162175536156,
-0.10182767361402512,
0.36192095279693604,
0.3152673542499542,
-0.13580240309238434,
-0.6029008626937866,
0.19500620663166046,
0.40341100096702576,
-0.1340312659740448,
0.020194893702864... | |
a few services up, however, I've been using Open Inviter for at least one client project, and it seems to perform well.
Some pointers:
* Gmail: [Google Contacts Data API](http://code.google.com/apis/contacts/)
* Yahoo:
+ [Address Book API](http://developer.yahoo.com/addressbook/) **(deprecated)**
+ [Contacts API](ht... | [
0.2365543097257614,
0.03513295575976372,
0.22415119409561157,
0.0958302691578865,
-0.1697547882795334,
-0.0357811264693737,
0.4111911654472351,
0.15072624385356903,
-0.1533372551202774,
-0.901641845703125,
0.0019224525894969702,
0.5311638116836548,
-0.10219136625528336,
0.1753954291343689,... | |
Background
----------
This question is in two parts.
I have a one-way WCF operation hosted in IIS 6. The following is my understanding of how this works:
> \_1. IIS receives a request.
>
>
> \_2. IIS sends an HTTP 202 response (thanks, I'll process this later).
>
>
> \_3. IIS calls my one-way WCF operation.
Now... | [
0.15009981393814087,
-0.16775937378406525,
0.7649335265159607,
-0.1168045625090599,
0.13434641063213348,
0.06946485489606857,
0.22296050190925598,
-0.09801831096410751,
-0.22760578989982605,
-0.8012735247612,
-0.08361273258924484,
0.5692869424819946,
-0.37144264578819275,
-0.04032268747687... | |
cleanup the data persisted in step 4.
Question 1
----------
Is my understanding of when IIS sends the HTTP 202 response correct?
Question 2
----------
If IIS recycles between step 2 and step 4, I could lose the request information before I've had a change to persist it but after the client thinks I've accepted the ... | [
0.08251436054706573,
-0.2085486352443695,
0.5803027749061584,
0.09312073886394501,
-0.1457080990076065,
-0.24694374203681946,
0.4875738024711609,
-0.35505497455596924,
-0.4749150276184082,
-0.49500584602355957,
0.07279873639345169,
0.6535056233406067,
-0.06178528815507889,
0.09163212031126... | |
invovled before the 202 is returned; if you use authentication, for example, it all has to happen before the method is called and before 202 is returned, so that if there are any problems they can be reported.
If you use wsHttpBinding, for example, out of the box, you will see 2-3 message exchanges resulting in 200 b... | [
-0.07622521370649338,
-0.5223428606987,
0.5468338131904602,
0.0011178196873515844,
0.03321798890829086,
-0.3069300353527069,
0.41552141308784485,
-0.42295461893081665,
-0.10081358253955841,
-0.4505279064178467,
-0.1234840378165245,
0.23975083231925964,
-0.16420553624629974,
-0.061132080852... | |
it can do that from the WCF stack.
All that aside - I'm not sure what you are trying to achieve - which IIS recycling do you refer to? I'm not at all an expert on IIS, but I doubt it would recycle the host while something is actively executing; if you are refering to anyone manually restrting the application pool (or... | [
0.42717215418815613,
0.04212532564997673,
0.05092295631766319,
0.24342617392539978,
-0.03562876954674721,
-0.3949369788169861,
0.10212882608175278,
-0.14685998857021332,
-0.45893844962120056,
-0.20149841904640198,
0.22838586568832397,
0.5413249731063843,
-0.10558661818504333,
0.25893330574... | |
reliable messaging in one way or another, which only acknowledges requests once persisted in a durable store; | [
0.07962340861558914,
0.08230676501989365,
0.312049001455307,
0.11119391024112701,
0.3029550015926361,
-0.20944678783416748,
0.22474560141563416,
0.33762842416763306,
-0.14495821297168732,
-0.291425496339798,
-0.5667209029197693,
0.5820246338844299,
0.001123794005252421,
-0.3571897447109222... | |
I'm using a MSSQL database and would like to create a column that only has 4 possible values. Is there any way to define a 2-bit column? I see the bit datatype and then the next smallest is tinyint which is 1 full byte.
If there is no such field, I'd be interesting in finding out why not.
Thanks.
I don't see the reas... | [
0.27100542187690735,
0.09646408259868622,
0.4348641335964203,
0.216936394572258,
0.0422520637512207,
0.3555462956428528,
0.19773469865322113,
0.06032238528132439,
-0.3375561833381653,
-0.5648999810218811,
0.2589927017688751,
0.21080797910690308,
-0.29428473114967346,
0.2052394598722458,
... | |
extra 6 bits per row will again hardly make a difference.
Speed is also not a valid reason. Such bit fields would require additional manipulation to store and retrieve, making the whole process a lot slower than simply dealing with a whole byte.
Lastly, if it's about constraints, then you should use foreign keys or u... | [
0.25769898295402527,
-0.04933806136250496,
0.32317936420440674,
0.23168174922466278,
-0.10794065147638321,
0.1831657439470291,
0.3256120979785919,
0.003593595465645194,
-0.46528130769729614,
-0.6585614085197449,
-0.1547565460205078,
0.5300229787826538,
-0.18079771101474762,
-0.127781406044... | |
little different than simply a 2-bit field. | [
0.20868608355522156,
-0.24160008132457733,
-0.08109378069639206,
0.23300857841968536,
-0.1703546792268753,
-0.3823048770427704,
0.020493099465966225,
0.009339898824691772,
-0.09490236639976501,
-0.2137376219034195,
0.055204860866069794,
0.1946018636226654,
-0.07044228911399841,
-0.10000946... | |
I am working with:
```
#top ul li.corner span.right-corner:hover
{
background-image:url("images/corner-right-over.gif");
width:4px;
height:15px;
float:left;
}
#top ul li.corner span.left-corner:hover
{
background-image:url("images/corner-left-over.gif");
float:left;
width:4px;
height:1... | [
0.23335523903369904,
0.3133035898208618,
0.6605770587921143,
-0.1217162236571312,
-0.19053156673908234,
0.20303693413734436,
0.044598136097192764,
-0.40408703684806824,
-0.021940693259239197,
-0.9065354466438293,
-0.13187375664710999,
0.7171720266342163,
-0.0903223380446434,
0.098156414926... | |
Given numbers like 499, 73433, 2348 what VBA can I use to round to the nearest 5 or 10? or an arbitrary number?
By 5:
```
499 -> 500
2348 -> 2350
7343 -> 7345
```
By 10:
```
499 -> 500
2348 -> 2350
7343 -> 7340
```
etc.
**Integrated Answer**
```
X = 1234 'number to round
N = 5 'rounding factor
round(X/N)... | [
-0.31128764152526855,
0.1003047376871109,
0.2471681386232376,
-0.37393704056739807,
-0.1360006481409073,
0.4480116665363312,
-0.09084692597389221,
-0.5424673557281494,
-0.636226236820221,
-0.24548082053661346,
0.21935448050498962,
0.35156285762786865,
-0.24341289699077606,
0.11434704810380... | |
round(1.5) 'result to 2
msgbox round(2.5) 'yes, result to 2 too
```
*Thank you everyone.* | [
-0.2810947597026825,
0.25692564249038696,
0.5968798398971558,
0.1350380927324295,
-0.27747178077697754,
0.23284190893173218,
0.27057695388793945,
-0.4790554642677307,
-0.37859341502189636,
-0.38990655541419983,
0.19697023928165436,
0.43332117795944214,
-0.09060265123844147,
-0.169817388057... | |
I am working on a program which manipulates images of different sizes. Many of these manipulations read pixel data from an input and write to a separate output (e.g. blur). This is done on a per-pixel basis.
Such image mapulations are very stressful on the CPU. I would like to use multithreading to speed things up. Ho... | [
0.24821323156356812,
0.13288387656211853,
0.2984190285205841,
0.28928646445274353,
-0.1669405698776245,
0.1190561056137085,
-0.11947557330131531,
-0.23235630989074707,
-0.21813958883285522,
-0.8087213039398193,
0.26594609022140503,
0.49535471200942993,
-0.3831787407398224,
0.12694466114044... | |
minimized. I was thinking of having a function forEachRow(fp\* ) which runs a thread for each row, or even a forEachPixel(fp\* ) where fp operates on a single pixel in its own thread. Which is best?
+ Should I use normal functions or functors or functionoids or some lambda functions or ... something else?
+ Some oper... | [
-0.2006603628396988,
-0.00650737015530467,
0.4605487883090973,
-0.23963125050067902,
-0.05710218474268913,
0.5073734521865845,
-0.11377335339784622,
-0.27248692512512207,
-0.06451546400785446,
-0.7173482179641724,
0.18976005911827087,
0.5554887652397156,
-0.6043131351470947,
-0.40369775891... | |
than one pixel in the array.
+ The ouput is only written once per pixel.
* Speed is also important (of course), but optimize executable size takes precedence.
Thanks.
**More information on this topic for the curious: [C++ Parallelization Libraries: OpenMP vs. Thread Building Blocks](https://stackoverflow.com/questio... | [
0.2751774489879608,
-0.17753325402736664,
0.4698878228664398,
0.27384263277053833,
-0.3232617974281311,
0.08709148317575455,
0.04173090681433678,
-0.15824371576309204,
-0.505100429058075,
-0.8378297686576843,
0.09831707924604416,
0.527813196182251,
-0.4061509668827057,
-0.00740837911143899... | |
point, using too many threads can actually make the parallel version slower than just using a linear algorithm. The optimal number of threads is a function of the number of cpus/cores available, and the percentage of time each thread spends blocked on things like I/O. Take a look at [this article](http://www.ddj.com/cp... | [
0.44055384397506714,
-0.07117334753274918,
-0.13490314781665802,
0.13389453291893005,
-0.26234182715415955,
0.14048105478286743,
0.25075146555900574,
-0.06732039898633957,
-0.5576848983764648,
-0.6472889184951782,
-0.12428506463766098,
0.24768321216106415,
-0.602328360080719,
-0.0162136703... | |
creating threads and synchronization.
In general - as long as data isn't changing, you won't have to lock read-only data. If you can be sure that each pixel slot will only be written once and you can guarantee that all the writing has been completed before you start reading from the result, you won't have to lock that... | [
0.35431617498397827,
-0.12888823449611664,
0.38942116498947144,
0.17350909113883972,
-0.3311985433101654,
0.08869662880897522,
-0.11394108086824417,
0.05053660273551941,
-0.5346632599830627,
-0.7885749936103821,
-0.05074917897582054,
0.4480741322040558,
-0.6823248863220215,
0.1286699771881... | |
numPixels; i++)
{
pGrayScaleBitmap[i] = (unsigned BYTE)
(pRGBBitmap[i].red * 0.299 +
pRGBBitmap[i].green * 0.587 +
pRGBBitmap[i].blue * 0.114);
}
```
This automatically splits up into as many threads as you have CPUs, and assigns a section of the array to each thread. | [
-0.08260946720838547,
-0.3094106912612915,
0.3684702515602112,
0.05265152081847191,
0.18547135591506958,
0.39102649688720703,
0.09968823939561844,
-0.18272562325000763,
-0.45820459723472595,
-0.5324195623397827,
0.10197614133358002,
0.11628907918930054,
-0.3854135274887085,
0.3474622964859... | |
I am looking for the best way to make my desktop java program run in the background (**daemon/service**?) across most platforms (Windows, Mac OS, Linux [Ubuntu in particular]).
By "best way" I am hoping to find a way that will:
1. require a **minimum** amount of platform-specific code.
2. not require the user to do a... | [
0.5798421502113342,
-0.06188679113984108,
0.2891375422477722,
-0.11955466121435165,
0.08616970479488373,
-0.13314206898212433,
0.38324570655822754,
-0.12457268685102463,
-0.15185409784317017,
-0.8105205297470093,
-0.10791750252246857,
0.4937021732330322,
0.03098825179040432,
-0.13246411085... | |
any other in the default platform.
For windows it could be an scheduled task that run at startup.
For Linux and OSX I don't know (besides crontab wich is somehow too technical) but I'm pretty sure they both have a way to do the same thing easily.
Unfortunately (as of today) Apple hasn't finished the 1.6 port.
It w... | [
0.22016693651676178,
-0.17254850268363953,
0.24056117236614227,
0.41394323110580444,
-0.26002931594848633,
-0.13139760494232178,
0.5619402527809143,
0.3746127784252167,
-0.07535980641841888,
-0.6107105016708374,
-0.03623047098517418,
0.9360836148262024,
-0.13230496644973755,
0.096982821822... | |
I see parallels between MEF and Lua. Both allow you to register methods and deploy as you need. Are both MEF and Lua forms of IoC / Dependency Injection?
I'll assume you're aware of the huge differences between these technologies and focus on the question:
> "Are both MEF and Lua forms of IoC /
> Dependency Injection... | [
0.24434684216976166,
-0.020762521773576736,
-0.2455199509859085,
-0.05402003601193428,
-0.13981112837791443,
-0.05759839341044426,
0.03168872743844986,
-0.5118423104286194,
0.00684739463031292,
-0.28831857442855835,
-0.008521957322955132,
0.5920971632003784,
-0.5691983103752136,
-0.2185059... | |
a distinguishing characteristic of a system. His definition includes three main types of Dependency Injection: Constructor injection, Setter injection, and Interface injection. In all three types, the idea is to inject a specific implementation of a class or interface into a class or method that needs it. This is prett... | [
0.3059147894382477,
-0.3564888834953308,
-0.03169819712638855,
-0.04042253643274307,
0.033920999616384506,
0.21436424553394318,
0.0021428733598440886,
-0.19605736434459686,
0.03037898801267147,
-0.5859293341636658,
0.18852370977401733,
0.7380025386810303,
-0.6029821038246155,
0.04079197719... | |
largely a dependency injection framework. It allows you to dynamically load and compose external classes that implement specific contracts. Lua, on the other hand, allows extension through scripting but there is very little in the way of a contract. Sure, you could provide a Lua API for your app and that's a contract o... | [
0.16313140094280243,
-0.13108468055725098,
0.014585177414119244,
0.14118294417858124,
0.03692280501127243,
-0.10224075615406036,
-0.002926256973296404,
-0.13503029942512512,
-0.3158734142780304,
-0.17378610372543335,
-0.23546202480793,
0.3022730350494385,
-0.42342066764831543,
0.0570605657... | |
and continuations.
Using this definition, MEF easily passes (control is passed to unknown components at runtime) and you can make an argument for embedded Lua as well. The main program cruises along until it needs a function defined in external script. At that point, control is delivered to the script until it's done ... | [
0.37580204010009766,
-0.11572614312171936,
0.1248021125793457,
0.03911934420466423,
0.07605816423892975,
-0.2480086088180542,
-0.32087016105651855,
-0.13183976709842682,
-0.24139243364334106,
-0.18926118314266205,
-0.002170104766264558,
0.5315098762512207,
-0.2984805405139923,
0.1035971119... | |
Injection as a special case. In a world of GUIs, events, threads, daemons, closures, continuations, and monads, everything uses IoC. Today, when people say 'IoC', they often mean some sort of Dependency Injection. | [
0.30937033891677856,
-0.32517489790916443,
-0.6418538093566895,
0.20581936836242676,
-0.14692144095897675,
-0.1079016774892807,
-0.013717921450734138,
-0.0701407939195633,
0.014229556545615196,
-0.3522883951663971,
-0.09134642034769058,
0.4805995225906372,
-0.4127047061920166,
-0.162539646... | |
I have a string with a length that is a multiple of 8 that contains only 0's and 1's. I want to convert the string into a byte array suitable for writing to a file. For instance, if I have the string "0010011010011101", I want to get the byte array [0x26, 0x9d], which, when written to file, will give 0x269d as the bina... | [
0.23119410872459412,
0.23840638995170593,
0.233234703540802,
-0.1310574859380722,
-0.062253687530756,
0.2538003921508789,
0.2637360095977783,
-0.510504424571991,
-0.08012283593416214,
-0.5175905823707581,
-0.18822965025901794,
0.23696143925189972,
-0.14790448546409607,
0.1165292039513588,
... | |
data
'&\x9d'
``` | [
-0.023302478715777397,
0.34490078687667847,
0.4850543737411499,
0.09015285968780518,
0.3520720899105072,
-0.12465579807758331,
0.02313195914030075,
0.08756476640701294,
-0.2095089852809906,
-0.5092412233352661,
-0.31249919533729553,
0.2505534291267395,
-0.29738494753837585,
0.2434054762125... | |
I am using the following jquery code:
```
$("#top ul li.corner").mouseover(function(){
$("span.left-corner").addClass("left-corner-hover");
$("span.right-corner").addClass("right-corner-hover");
$("span.content").addClass("content-hover");
}).mouseout(function(){
$("span.left-corner").removeClass("left... | [
-0.21391834318637848,
-0.051905449479818344,
0.8789788484573364,
-0.2816663086414337,
0.19286446273326874,
0.27634721994400024,
0.21761652827262878,
-0.3770897388458252,
0.07752124965190887,
-0.7872410416603088,
-0.25563177466392517,
0.5274863243103027,
-0.0794379860162735,
-0.033237140625... | |
data
'&\x9d'
``` | [
-0.023302478715777397,
0.34490078687667847,
0.4850543737411499,
0.09015285968780518,
0.3520720899105072,
-0.12465579807758331,
0.02313195914030075,
0.08756476640701294,
-0.2095089852809906,
-0.5092412233352661,
-0.31249919533729553,
0.2505534291267395,
-0.29738494753837585,
0.2434054762125... | |
I had a discussion with a colleague at work, it was about SQL queries and sorting. He has the opinion that you should let the server do any sorting before returning the rows to the client. I on the other hand thinks that the server is probably busy enough as it is, and it must be better for performance to let the clien... | [
0.12115160375833511,
0.19901277124881744,
0.021615516394376755,
-0.02388450689613819,
0.039035290479660034,
0.17806297540664673,
-0.20649687945842743,
0.055047981441020966,
-0.42199641466140747,
-0.4659461975097656,
0.22743721306324005,
0.33047470450401306,
-0.09700459241867065,
0.22438113... | |
to handle this effectively, you need to upgrade your database server.
First off, the database may already have indexes on the fields you want so it may be trivial for it to retrieve data in sorted order. Secondly, the client can't sort the results until it has all of them; if the server sorts the results, you can proc... | [
-0.2193131446838379,
-0.18451127409934998,
0.2599595785140991,
0.33212044835090637,
-0.030859865248203278,
-0.025311648845672607,
-0.023287992924451828,
-0.18979494273662567,
-0.5519943833351135,
-0.9586071372032166,
0.025264214724302292,
0.5164136290550232,
-0.21938548982143402,
0.1045692... | |
The line-height property usually takes care of vertical alignment, but not with inputs. Is there a way to automatically center text without playing around with padding?
In Opera 9.62, Mozilla 3.0.4, Safari 3.2 (for Windows) it helps, if you put some text or at least a whitespace within the same line as the input field.... | [
-0.10707645118236542,
-0.24597033858299255,
0.648632287979126,
-0.13280431926250458,
-0.11711656302213669,
0.11595267057418823,
0.18684884905815125,
-0.1433190405368805,
-0.07374165207147598,
-0.5893113613128662,
-0.2387094497680664,
0.3897911310195923,
-0.13615447282791138,
-0.20736540853... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.