text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
Datetime >='''+convert(varchar(30), @Start ,120) +''' AND Datetime <= '''+convert(varchar(30),@DeadBand,120) +''' and wwResolution =60000 and wwRetrievalMode = "cyclic" '
if(@dec = 1)
begin
set @SqlQry = @SqlQry+ N' Select top 1 * from openquery(INSQL,''' + R... | [
-0.05708624795079231,
-0.48260563611984253,
0.9531270265579224,
-0.22468633949756622,
0.44434159994125366,
0.04671806842088699,
0.22477422654628754,
-0.3187394440174103,
-0.3194958567619324,
-0.6556127071380615,
-0.2646816670894623,
0.4510262906551361,
-0.2971811592578888,
0.07565410435199... | |
end
if((@dec > 1) and (@dec < @NumberDays))
begin
set @SqlQry = @SqlQry+ N' Select top 1 * from openquery(INSQL,''' + REPLACE(@InnerSqlQry, '''', '''''') + ''' ) | [
-0.16501200199127197,
-0.1369953751564026,
0.7448519468307495,
-0.1411777287721634,
0.1626327931880951,
-0.18721824884414673,
0.2520356774330139,
-0.2806238830089569,
0.011714612133800983,
-0.3849168121814728,
-0.32277652621269226,
0.21180734038352966,
-0.24241407215595245,
0.1329123228788... | |
union '
end
if(@dec = @NumberDays)
begin
set @SqlQry = N' Select top 1 * from openquery(INSQL,''' + REPLACE(@InnerSqlQry, '''', '''''') + ''' ) | [
0.14310549199581146,
-0.1621427685022354,
0.7085781693458557,
-0.038446925580501556,
0.2494984120130539,
-0.08278685808181763,
0.10946846008300781,
-0.3115884065628052,
-0.054067276418209076,
-0.6655437350273132,
-0.31490761041641235,
0.06356196850538254,
-0.4250985085964203,
0.45095396041... | |
union '
end
set @dec = @dec - 1
SET @Start = CONVERT(Varchar(30),dateadd(dd,-@dec,GetDate()))
SET @DeadBand= + CONVERT(Varchar(30),dateadd(ss,90,@Start))
END
print(@sqlQry)
exec(@sqlQry)
```
I've seen quite a few tricks for converting a DATETIME in... | [
0.6010704040527344,
-0.23042699694633484,
0.735980212688446,
-0.12346482276916504,
0.15868335962295532,
0.027044298127293587,
-0.05606910586357117,
-0.17010214924812317,
-0.186642587184906,
-0.6460235118865967,
-0.03935756906867027,
0.19879098236560822,
-0.3274853527545929,
0.5160660147666... | |
quite some time spent finding the fastest. What people seem to forget is that "shortest code" is not always fastest, and often includes Implicit type conversions hidden away. The fastest we came up with is...
DATEADD(DAY, DATEDIFF(MINUTE, 0, ), 0)
The reason I mention it is that once you have the time component, ever... | [
-0.2933734357357025,
-0.2537836730480194,
0.5472156405448914,
-0.011289127171039581,
0.2077016830444336,
-0.09675376117229462,
0.05957765132188797,
0.18944282829761505,
-0.2762353718280792,
-0.6659659743309021,
0.0002671874244697392,
0.3399493396282196,
-0.09309055656194687,
0.076268747448... | |
00:00',
@end_date = '2009 Jan 12 00:00',
@chosen_time = '1900 Jan 01 17:30' -- '1900 Jan 01' is day 0
SELECT
<whatever>
FROM
WideHistory
WHERE
[WideHistory].DateTime >= @start_date
AND [WideHistory].DateTime < @end_date
AND DATEADD(DAY, DATEDIFF(MINUTE, 0, [WideHistory].Date... | [
0.12696142494678497,
-0.073907770216465,
0.7112806439399719,
-0.01135753933340311,
0.12991899251937866,
0.2578563094139099,
0.03545468673110008,
0.2796812057495117,
-0.2076493501663208,
-0.5452864170074463,
-0.26742300391197205,
0.01216772012412548,
0.12277165055274963,
0.4638715982437134,... | |
the database structure would also benefit here. Having a DATE field as well as a TIME field. Often superfluous, but in this case could be beneficial. | [
0.39440321922302246,
-0.0173999834805727,
0.14606882631778717,
0.6062299013137817,
0.30578723549842834,
-0.36232712864875793,
-0.41089358925819397,
0.035100024193525314,
-0.43802931904792786,
-0.5820531249046326,
0.12592200934886932,
0.2963886857032776,
0.034542251378297806,
0.175879120826... | |
I am an ActiveMQ / Camel noob with a specific scenario in mind, I wonder firstly if it is possible and secondly whether someone might provide a little direction.
Basically I need to perform dynamic throttling off the queue. I.E the ability to set **at runtime** the rate a particular group of messages will be consumed ... | [
0.3379652202129364,
-0.12029943615198135,
0.25239866971969604,
-0.040954530239105225,
-0.29959702491760254,
0.18195906281471252,
0.10887906700372696,
0.3000265657901764,
-0.19218464195728302,
-0.5071109533309937,
0.024771692231297493,
0.5330369472503662,
-0.27603137493133545,
-0.0094510074... | |
grouping onto the queue etc, but just can't figure this out from the docs.
Yeah looks like you are looking for broker side throtteling to avoid consumers to block.
Have you raised your request at the ActiveMQ user/dev forum? | [
0.7636374235153198,
-0.45774707198143005,
0.4173034131526947,
0.05907941237092018,
-0.293493390083313,
-0.13547517359256744,
0.16797833144664764,
0.13362647593021393,
-0.30043792724609375,
-0.38694003224372864,
0.17455832660198212,
0.30745211243629456,
-0.1548491269350052,
0.27811172604560... | |
I'm using Visual Studio 2008 to write an installation, and I'm a completely new to installations. I've created an installation and successfully written some custom actions using a C# assembly. One action sets a RunOnce registry value, and now I need to prompt the user to reboot when the installation finishes, but I hav... | [
0.6102269887924194,
0.1788935363292694,
0.17429780960083008,
-0.1775706559419632,
-0.11526018381118774,
0.15621542930603027,
0.34772956371307373,
-0.04351026192307472,
-0.23264819383621216,
-0.6557444334030151,
-0.0013304913882166147,
0.7967289686203003,
-0.2745063602924347,
-0.09327182173... | |
[.NET](http://en.wikipedia.org/wiki/.NET_Framework) installer project.
Thanks. I ended up using a post-build event to run a batch file with the following command. The hard part was tracking down WiRunSQL.vbs, which was in the ["Windows SDK Components for Windows Installer Developers"](http://msdn.microsoft.com/en-us/li... | [
0.3618931174278259,
0.1697589010000229,
0.4490949511528015,
-0.07303004711866379,
0.0014883952680975199,
-0.18675629794597626,
0.4862418472766876,
-0.17700062692165375,
-0.10399895906448364,
-0.6228867769241333,
-0.23288241028785706,
0.4483930766582489,
-0.20408165454864502,
0.205103650689... | |
I've tried various editors, both desktop applications and web-based RTEs, but have not found anything that works very well. All too often, they mess up code, adding in "tag soup". Even the ones that claim to only produce valid code often produce a total mess of span tags and style attributes.
Here are some of the feat... | [
0.4629330337047577,
0.18578116595745087,
0.09938645362854004,
0.0651189535856247,
-0.3717249929904938,
-0.05428813770413399,
0.37420326471328735,
-0.15137265622615814,
-0.16525335609912872,
-0.8214736580848694,
-0.07203597575426102,
0.43052613735198975,
-0.19201530516147614,
-0.16477862000... | |
editors will insert span tags, causing mess like: `<p><span style="...">...</span></p>`
* doesn't change code that I add (I've had editors remove hidden input fields and other stuff)
* doesn't add deprecated attributes, eg border and cellspadding often get added on images and tables.
* would love it if it could pick up... | [
0.42519477009773254,
-0.13881680369377136,
0.6214184165000916,
0.10808057337999344,
-0.36505523324012756,
-0.0977342277765274,
-0.07917019724845886,
-0.15798421204090118,
-0.3349706828594208,
-0.7733777761459351,
0.05811590328812599,
0.6827598214149475,
-0.38772502541542053,
-0.31392040848... | |
KompoZer on the desktop.
Well, I'm not aware of all the existing WYSIWYG editors around, but have you considered the alternative of using a code editor and create the HTML code by hand? I know it may sound crazy at first hand, but believe me, when you start to feel comfortable with it you'll become more productive, the... | [
0.048855748027563095,
-0.09548385441303253,
0.03872709348797798,
0.43934133648872375,
-0.008089154027402401,
-0.317667692899704,
-0.1441217064857483,
0.2666313350200653,
-0.09231571108102798,
-0.6353990435600281,
-0.013098601251840591,
0.5001019239425659,
-0.1465156525373459,
0.05957954749... | |
There was [another thread about this](https://stackoverflow.com/questions/7477/autosizing-textarea), which I've tried. But there is one problem: the `textarea` doesn't shrink if you delete the content. I can't find any way to shrink it to the correct size - the `clientHeight` value comes back as the full size of the `t... | [
-0.044567860662937164,
0.010304820723831654,
0.7511322498321533,
-0.26439401507377625,
0.06446332484483719,
-0.01048797182738781,
0.1534430831670761,
-0.4589022994041443,
-0.2184721976518631,
-0.6158425211906433,
-0.27254533767700195,
0.5923823118209839,
-0.43707478046417236,
0.21266099810... | |
{
adjustedHeight = Math.max(text.scrollHeight, adjustedHeight);
if ( maxHeight )
adjustedHeight = Math.min(maxHeight, adjustedHeight);
if ( adjustedHeight > text.clientHeight )
text.style.height = adjustedHeight + "px";
}
}
window.onload = function() {
document.getElementById... | [
0.04613424837589264,
-0.10890918225049973,
0.9155923128128052,
-0.3529922068119049,
0.13020320236682892,
0.1366468220949173,
0.3898886442184448,
-0.5910406112670898,
0.1765124350786209,
-0.7804501056671143,
-0.1725616455078125,
0.8941171169281006,
-0.4112909734249115,
-0.29699891805648804,... | |
event, handler) {
element.attachEvent('on'+event, handler);
};
}
else {
observe = function (element, event, handler) {
element.addEventListener(event, handler, false);
};
}
function init () {
var text = document.getElementById('text');
function resize () {
text.st... | [
0.20409853756427765,
-0.25106072425842285,
0.4623923897743225,
-0.2826665937900543,
0.2843347489833832,
0.293203741312027,
0.4787091910839081,
-0.40988683700561523,
-0.10705305635929108,
-0.3942507207393646,
-0.49089643359184265,
0.613569438457489,
-0.3074597418308258,
-0.14058297872543335... | |
{
window.setTimeout(resize, 0);
}
observe(text, 'change', resize);
observe(text, 'cut', delayedResize);
observe(text, 'paste', delayedResize);
observe(text, 'drop', delayedResize);
observe(text, 'keydown', delayedResize);
text.focus();
text.select();
resi... | [
0.3182505667209625,
-0.38736867904663086,
0.5549151301383972,
-0.3332121968269348,
0.19785787165164948,
0.2718034088611603,
0.4638366103172302,
-0.37377774715423584,
-0.1551869809627533,
-0.7967455387115479,
-0.5123094320297241,
0.292499840259552,
-0.40494608879089355,
-0.15871623158454895... | |
try it on [jsfiddle](http://jsfiddle.net/hmelenok/WM6Gq/)*
It starts with a single line and grows only the exact amount necessary. It is ok for a single `textarea`, but I wanted to write something where I would have many many many such `textarea`s (about as much as one would normally have lines in a large text document... | [
0.32026371359825134,
-0.21802332997322083,
0.6282753348350525,
-0.20065991580486298,
-0.30368873476982117,
-0.11466751247644424,
0.4111826717853546,
0.21362845599651337,
-0.13223542273044586,
-0.8491203188896179,
0.07942471653223038,
0.25018322467803955,
-0.23947933316230774,
-0.2916085124... | |
I have a client that is paying $1500 per month for hosting of 1 website (1 domain name, email is hosted elsewhere). The website is pretty low traffic. Like, 100 unique visitors a week. The only catch (and why it is so expensive) is that their database is 15 GB, and is replicated from the hosting company to inside my sm... | [
0.6764397025108337,
0.47984907031059265,
0.5653696656227112,
0.014180120080709457,
0.13203686475753784,
-0.07403229922056198,
0.2992611825466156,
0.21245594322681427,
-0.46026813983917236,
-0.5363404750823975,
0.15532229840755463,
0.09460587799549103,
0.07311802357435226,
0.529552280902862... | |
of every 5 minutes.
My client has a T1 that runs into their office. I want to knock out the hosting provider altogether, host their website from a server they already have (more than capable of handling this website), and dump the replication altogether. This would save them $1500 per month, and for a company of 5, it... | [
0.671752393245697,
0.030650973320007324,
0.4521399736404419,
0.24215814471244812,
0.018021969124674797,
-0.11503095179796219,
0.5988527536392212,
-0.0605074018239975,
-0.22621525824069977,
-0.44764700531959534,
-0.015981972217559814,
0.31383633613586426,
-0.06317900866270065,
0.15556335449... | |
can.
What if server goes down for good? There is a duplicate that I can bring up in a couple of hours, and that is all the level of service they really require.
What am I missing here? I want to save them money, but I don't want to screw them over...
EDIT: Some of the answers and comments make it clear that I myself ... | [
0.40635836124420166,
0.37380120158195496,
0.35316768288612366,
0.25443610548973083,
0.18740788102149963,
-0.0390968956053257,
0.3739337623119354,
-0.02354697696864605,
-0.34914758801460266,
-0.5519991517066956,
0.11622315645217896,
0.3686302602291107,
-0.2559055984020233,
0.379174321889877... | |
back to a server @ company A.
Company B is charging Company A $1500 per month for this service.
Company A already has a T1 for connectivity to the internet. They are located inside of a run of the mill business park.
I am proposing doing away with any outside hosting, getting a DNS provider to point the website to ... | [
0.6558736562728882,
0.2192821502685547,
0.4544823169708252,
0.30630379915237427,
0.07376520335674286,
-0.1568370759487152,
0.19523200392723083,
0.3699731230735779,
-0.42604660987854004,
-0.4016633927822113,
0.01408675592392683,
0.08914587646722794,
0.03648125380277634,
0.47451961040496826,... | |
re-read and comment on all the current answers.
Really, any advice is very appreciated.
Sounds to me like your only risk in moving the server in-house is if your T1 goes down. If you have a backup strategy in place for that, go for it.
The other option is to co-loc your own server with your own SQL Server licence on ... | [
0.40399834513664246,
0.028099456802010536,
0.26876771450042725,
0.24722394347190857,
0.06372120976448059,
-0.26592740416526794,
0.10881787538528442,
0.0900188460946083,
-0.4112589955329895,
-0.1997556984424591,
-0.22212135791778564,
0.50116366147995,
-0.021040543913841248,
0.16494181752204... | |
useage accounting so they only way they can bill/screw you is on database size.
Sounds like the traffic is low enough on your site you can get a dual core server, a 1 CPU licence of SQL Server for a one-off cost of a few thousand dollars and then you're only paying the monthly co-loc price. | [
0.5897157788276672,
0.39869749546051025,
0.10251951962709427,
0.2751578390598297,
-0.09093036502599716,
0.13281606137752533,
0.0782897099852562,
0.3569566309452057,
-0.22396813333034515,
-0.44530975818634033,
0.325825035572052,
0.7407670617103577,
-0.012262552045285702,
0.18831458687782288... | |
I'm looking for the best URL schema to use for a web app that has multiple versions, namely several languages and a simplified version for use by mobile phones - both aspects can be combined, so there's an English regular and mobile version, a German regular and mobile version, etc.
Goals (in order of importance):
* ... | [
0.35783079266548157,
0.2790416479110718,
0.6684121489524841,
0.0017321670893579721,
-0.20990866422653198,
-0.24872037768363953,
0.5475218892097473,
0.253568559885025,
-0.16214002668857574,
-0.4591556787490845,
-0.31554311513900757,
0.36512279510498047,
0.014887363649904728,
0.0458385385572... | |
ideas.
My current concept:
* When a new user arrives, the app decides, based on cookies (see below), the Accept-Language: header and the user agent string (used to identify mobile browsers) which version to show, but does not reflect this in the URL (no redirects)
* It defaults to the non-simplified English version
* ... | [
0.32325494289398193,
0.04685770720243454,
0.6604956984519958,
-0.05987502261996269,
0.4624381363391876,
0.11298572272062302,
-0.08669233322143555,
0.4049931466579437,
-0.2666926085948944,
-0.7871233224868774,
-0.3452473282814026,
0.07333993166685104,
-0.011298708617687225,
0.22813069820404... | |
/mobile/ for the simplified version, /normal/ for the non-simplified one, and combinations thereof i.e. /mobile/en/ and /normal/de/
* mod\_rewrite is used to strip these URL prefixes and convert them to GET parameters for the app to parse
* robots.txt disallows /mobile/ and /normal/
Advantages:
* The different langua... | [
0.10975856333971024,
0.03622935712337494,
0.7134301662445068,
0.007713843137025833,
0.20537392795085907,
0.2581143081188202,
0.3150363862514496,
0.1966037154197693,
-0.11335840076208115,
-0.5736021995544434,
-0.5898494124412537,
0.6574959754943848,
-0.3041529059410095,
-0.27122199535369873... | |
will display exactly that version when passed to others
* /mobile/ and /normal/ are ignored by search engines; they would only be duplicate content.
Disadvantages:
* Requires heavy use of mod\_rewrite, which I find rather cryptic
* Users could send their current URL to someone and that person, when visiting it, could... | [
0.40172693133354187,
0.1299225389957428,
0.6733192205429077,
0.18543468415737152,
0.2111249715089798,
-0.1894838958978653,
0.36930617690086365,
0.2377774864435196,
-0.38245368003845215,
-0.9934162497520447,
-0.20143277943134308,
0.5444947481155396,
-0.11225705593824387,
0.11983652412891388... | |
coming to / via a search engine may see a different version than what they found in the search engine? | [
0.6226563453674316,
-0.04430043697357178,
0.11917848140001297,
0.23404894769191742,
0.2913382351398468,
-0.18884794414043427,
0.4648389220237732,
0.40499147772789,
-0.651057243347168,
-0.4046188294887543,
-0.22709904611110687,
0.18156343698501587,
0.09587337076663971,
0.07778453081846237,
... | |
I have read that the public beta version of Windows 7 has an expiration on it, but does the MSDN Premium also expire on the same date?
And if so, do you think that we might see a newer version before the expiration on MSDN?
For the speed improvements alone I am contemplating moving my development PC to Windows 7 over... | [
0.3033514618873596,
0.12664739787578583,
0.8047179579734802,
-0.052629243582487106,
0.1402147263288498,
-0.4552687108516693,
0.46758726239204407,
0.33753591775894165,
0.03518814221024513,
-0.3886735439300537,
-0.08839517831802368,
1.0296752452850342,
0.04000851511955261,
0.3278943598270416... | |
the RTM if we get really lucky. | [
0.28854313492774963,
-0.005877774674445391,
0.5287365913391113,
0.22058968245983124,
0.2224266678094864,
-0.2737506330013275,
0.03362559899687767,
0.1705140769481659,
-0.06818310171365738,
-0.3448696434497833,
-0.05253707244992256,
0.7897116541862488,
0.257180780172348,
-0.0229007676243782... | |
I have a list of non-overlaping ranges (ranges of numbers, e.g. 500-1000, 1001-1200 .. etc), is there an elegant and fast way to do lookup by only passing a number? I could use List.BinarySearch() or Array.BinarySearch() but I have to pass the type of the range object (Array.BinarySearch(T[], T)), I can pass a dummy ra... | [
0.27598440647125244,
-0.008225451223552227,
0.33182618021965027,
-0.006663220003247261,
-0.22396475076675415,
0.2625441551208496,
0.2901204228401184,
-0.24203015863895416,
-0.13569752871990204,
-0.3861154317855835,
0.16370965540409088,
0.7431119680404663,
-0.2824167311191559,
-0.1093573793... | |
Create a dummy Range and suck it up. Urgh.
* Hand-craft a binary search just for this case. Not too bad.
* Generalise the binary search for any IList and a TValue, given an IRangeComparer. I'm not wild on the name "TRange" here - we're not necessarily talking about ranges, but just finding the right place based on a co... | [
0.5489217042922974,
-0.2899690866470337,
0.209244966506958,
0.0971476212143898,
-0.31840452551841736,
-0.2607734203338623,
0.1451525092124939,
0.12615112960338593,
-0.1762431561946869,
-0.3142867684364319,
-0.04471545293927193,
0.7542446255683899,
-0.45814910531044006,
-0.08091066032648087... | |
the range;
/// greater than 0 if value is below the range.
/// </summary>
int Compare(TRange range, TValue value);
}
/// <summary>
/// See contract for Array.BinarySearch
/// </summary>
public static int BinarySearch<TRange, TValue>(IList<TRange> ranges,
TValu... | [
0.2320980429649353,
-0.44842469692230225,
0.785871148109436,
-0.19373579323291779,
0.0640367865562439,
0.3737233579158783,
-0.16354858875274658,
-0.5061538219451904,
-0.07985835522413254,
-0.4863092303276062,
-0.3822283446788788,
0.8338216543197632,
-0.457764595746994,
-0.12148943543434143... | |
IRangeComparer<TRange, TValue> comparer)
{
int min = 0;
int max = ranges.Count-1;
while (min <= max)
{
int mid = (min + max) / 2;
int comparison = comparer.Compare(ranges[mid], value);
if (comparison == 0) | [
-0.1398317962884903,
-0.5364799499511719,
0.5176214575767517,
0.0419088751077652,
0.06105009466409683,
0.14833243191242218,
0.344501256942749,
-0.392438143491745,
0.09264641255140305,
-0.20925767719745636,
-0.39120587706565857,
0.5688794255256653,
-0.33304932713508606,
0.22456641495227814,... | |
{
return mid;
}
if (comparison < 0)
{
min = mid+1;
}
else if (comparison > 0)
{ | [
-0.3298729360103607,
-0.578906774520874,
0.2882014811038971,
-0.06925458461046219,
-0.06720854341983795,
0.8370479941368103,
0.20983794331550598,
0.07343035936355591,
0.4209938645362854,
-0.6083852052688599,
-0.31077951192855835,
0.5460218787193298,
0.4467293620109558,
0.471379816532135,
... | |
max = mid-1;
}
}
return ~min;
}
```
Apologies if I've got any off-by-one errors. I haven't tested it at all, but it does at least compile :) | [
-0.09037431329488754,
0.07175257802009583,
0.23477114737033844,
-0.14931386709213257,
0.3302047550678253,
-0.019414184615015984,
0.32392340898513794,
-0.02374172955751419,
0.0359409935772419,
-0.567756175994873,
0.017579419538378716,
0.671454131603241,
0.04036581888794899,
0.08789650350809... | |
This is a copy paste of a post i made on the processing forum (where i haven't got an answer so far) thought i might as well try here.
Processing is a very cool way to draw stuff, specially for the webpages. Just as a reference <http://processing.org>
Hey, i'm new to processing, i'm using it to make a flashless websi... | [
0.15529495477676392,
0.03834777697920799,
0.4070045053958893,
0.04376931115984917,
-0.055571943521499634,
0.044915709644556046,
-0.411806583404541,
0.34715330600738525,
-0.4318232238292694,
-0.8379305601119995,
0.42269226908683777,
0.05588424950838089,
-0.22242224216461182,
0.0927686542272... | |
of the browser window.
So my problem is this, the canvas is operating on a centered web-page, whenever the browser changes size, so does the coordinates of the mouse within the canvas.
Is there any way to make the coordinates of the mouse relative to the canvas? So that i can change the size of my browser window and ... | [
-0.024098727852106094,
0.05054213106632233,
0.6279566884040833,
-0.03812084347009659,
0.10577675700187683,
-0.10307122021913528,
0.10700635612010956,
0.15507875382900238,
-0.4597412645816803,
-0.8323376774787903,
0.17272190749645233,
0.6848427653312683,
-0.19889973104000092,
0.047858733683... | |
not familiar with processing, but can't you just calculate the difference between the top left corner of the browser window and the top left corner of the canvas?
i.e. (using jquery)
```
$(window).onresize = function() {
//offset return position realive to the document.
var offset = $('#canvas').offset();
window... | [
-0.010004550218582153,
-0.3802511692047119,
0.46757325530052185,
-0.11198157072067261,
-0.007068161386996508,
0.10794046521186829,
-0.053110189735889435,
-0.22996024787425995,
-0.3091197907924652,
-0.8311816453933716,
-0.027216274291276932,
0.7800502181053162,
-0.34713321924209595,
-0.1373... | |
I am creating a matching game for Android, and when the user gets a match, a dialog box should pop up saying "Match!" I cannot figure out how to do this though. If I use Thread.currentthread().sleep, the dialog never appears.
```
android.app.AlertDialog a = new android.app.AlertDialog.Builder(match.this).setTitle("Ma... | [
0.5439374446868896,
0.13832436501979828,
0.41665711998939514,
-0.22402708232402802,
0.07736454904079437,
-0.07760786265134811,
0.245960995554924,
-0.23320160806179047,
0.02374138869345188,
-0.8015781044960022,
0.1329135298728943,
0.5979304909706116,
-0.7457164525985718,
0.08019021153450012... | |
of alerts toasts are great:
```
Toast.makeText(this, "Match!", Toast.LENGTH_LONG).show();
```
Is that what you are looking for?
[Here is the Java Doc.](http://code.google.com/android/reference/android/widget/Toast.html#makeText(android.content.Context,%20java.lang.CharSequence,%20int)) | [
0.27200889587402344,
0.07806339859962463,
0.39362433552742004,
-0.23289631307125092,
0.18024329841136932,
-0.4057285189628601,
0.5794104337692261,
-0.20050977170467377,
-0.0869230404496193,
-0.6501574516296387,
-0.43806904554367065,
0.5527395009994507,
-0.31364914774894714,
-0.423585057258... | |
Without:
* ATL
* MFC
**Note:**
* Client is executing in a **different** thread to that of the server
**Question:**
* How do I **control** the **behaviour** of the client, once an **event notification** is received from the **COM object** (Server)?
* How to implement an event interface from client?
Illustration be... | [
-0.23042850196361542,
-0.19735635817050934,
0.5027885437011719,
-0.1584204137325287,
-0.1863839030265808,
0.11661206930875778,
0.3513118326663971,
-0.3318606913089752,
-0.37742510437965393,
-0.6288827061653137,
-0.18422958254814148,
0.5095965266227722,
-0.3016622066497803,
0.03896367177367... | |
__uuidof(IS8SimulationEvents),
&pConnection);
//result handling omitted
```
The client implements the event interface (`IS8SimulationEvents`) This can be in a separate component, or on the client component itself. The implementation is called when the component fires an event.
After `FindConnec... | [
-0.23979546129703522,
-0.09015575796365738,
0.5291828513145447,
-0.14696446061134338,
0.42082512378692627,
-0.22201819717884064,
0.36498168110847473,
0.05608639866113663,
-0.06298898905515671,
-0.68214350938797,
-0.32019859552383423,
0.6573355793952942,
-0.35063832998275757,
0.404493212699... | |
receive calls. | [
0.2444910854101181,
0.28339245915412903,
0.3972289562225342,
0.07155782729387283,
0.08244125545024872,
-0.16020594537258148,
0.17082132399082184,
0.20484520494937897,
-0.10054892301559448,
-0.626293420791626,
-0.5537529587745667,
0.4464641511440277,
-0.07852177321910858,
-0.146066337823867... | |
I have been using python with RDBMS' (MySQL and PostgreSQL), and I have noticed that I really do not understand how to use a cursor.
Usually, one have his script connect to the DB via a client DB-API (like psycopg2 or MySQLdb):
```
connection = psycopg2.connect(host='otherhost', etc)
```
And then one creates a curs... | [
-0.29374340176582336,
0.13359536230564117,
0.5470673441886902,
-0.010728434659540653,
-0.35237523913383484,
0.03972708061337471,
-0.08298452198505402,
-0.1383121758699417,
-0.23192858695983887,
-0.6511497497558594,
-0.12710152566432953,
0.5480009317398071,
-0.46701112389564514,
0.247856885... | |
cursor.fetchone()
```
or
```
rows = cursor.fetchmany()
```
Now lets say, I do not retrieve all the rows, and decide to execute another query, what will happen to the previous results? Is their an overhead.
Also, should I create a cursor for every form of command and continuously reuse it for those same commands ... | [
-0.33817943930625916,
-0.1519995778799057,
0.9282020330429077,
0.084111288189888,
-0.1826808601617813,
0.04928051307797432,
0.0014981140848249197,
-0.20987814664840698,
-0.30001765489578247,
-0.6842101812362671,
0.18372197449207306,
0.6879551410675049,
-0.31746095418930054,
0.2347989976406... | |
all the rows or DECLARE an actual SQL cursor*. As long as the fetchXXX interfaces do what they're supposed to, DB-API is happy.
AFA psycopg2 cursors are concerned(as you may well know), "unnamed DB-API cursors" will fetch the entire result set--AFAIK buffered in memory by libpq. "named DB-API cursors"(a psycopg2 conce... | [
0.05879279971122742,
-0.13692888617515564,
0.4726739525794983,
0.0015091253444552422,
-0.37142738699913025,
0.2236315757036209,
0.06958264857530594,
-0.42135387659072876,
-0.18856611847877502,
-0.4203487038612366,
-0.005512311588972807,
0.6025466322898865,
-0.49677595496177673,
-0.05543692... | |
sequential, executemany() will perform just as well as execute(). DB-API does "provide" driver authors with the ability to cache executed statements, but its implementation(what's the scope/lifetime of the statement?) is undefined, so it's impossible to set expectations across DB-API implementations.
If you are loadin... | [
0.2537538409233093,
0.0657128244638443,
0.2079528421163559,
0.0945870503783226,
-0.18499650061130524,
0.08505792915821075,
0.4785202741622925,
-0.19065237045288086,
-0.15177500247955322,
-0.40351420640945435,
0.0381886288523674,
0.6694625020027161,
-0.3443280756473541,
-0.02141426503658294... | |
I'm poking around with jQuery and the fadeIn & fadeOut effects. I have the following code to display and to hide a div with a message.
`
```
<script type="text/javascript">
$(document).ready(function() {
$("button").click(function() {
$("#upd").fadeIn(3000);
$("#upd").fadeOut(200... | [
0.6429454684257507,
0.09651161730289459,
0.6499726176261902,
-0.34178465604782104,
-0.13582007586956024,
0.2098589390516281,
0.08926136791706085,
-0.4626481831073761,
0.14033640921115875,
-0.6611983776092529,
-0.022756028920412064,
0.4664798080921173,
-0.49746862053871155,
0.09554606676101... | |
margin: 0px 0px 5px 0px;
padding: 13px 30px 13px 30px;
width: 300px;
}
</style>
```
`
It works perfectly on Internet Explorer, but it doesn't do anything in chrome and I get show and hide behavior in firefox.
Is there a special step for this library to work evenly or at least close to in all the... | [
0.030680043622851372,
-0.38805386424064636,
0.8142266273498535,
-0.136391282081604,
-0.07971791923046112,
0.09742725640535355,
0.11455916613340378,
-0.5495341420173645,
0.06680222600698471,
-0.776766836643219,
0.024068957194685936,
0.6564340591430664,
-0.05547911301255226,
-0.2918488085269... | |
$("#upd").fadeIn(3000,function(){
$(this).fadeOut(2500);
});
});
});
```
jQuery *should* work nearly the same in all browsers by itself. If you're getting strange behavior, you're likely doing something wrong - not jQuery :) | [
0.4488021731376648,
-0.11126810312271118,
0.45027652382850647,
-0.16014495491981506,
0.0928487777709961,
-0.17198282480239868,
0.5228455066680908,
0.078387051820755,
-0.17831914126873016,
-0.6280695199966431,
-0.22027568519115448,
0.35050714015960693,
-0.42723581194877625,
0.31447941064834... | |
I'm getting
```
Validation (): Attribute 'Factory' is not a valid attribute of element 'ServiceHost'.
```
from VS2008 in an empty WCF Service Application after I add Factory="System.ServiceModel.Activation.WebServiceHostFactory" to the @Service directive in the .svc file. I've added System.ServiceModel.Web referenc... | [
0.2172178030014038,
0.19511045515537262,
0.4294548034667969,
-0.3803561329841614,
-0.24583029747009277,
-0.010981923900544643,
0.5766621232032776,
-0.24948160350322723,
-0.238242968916893,
-0.80299973487854,
-0.0006577260210178792,
0.5896768569946289,
-0.19609175622463226,
0.21739481389522... | |
I'm new to using open source libraries in production code so when it says replicate this license or whatever what is the proper way of doing it?
With desktop software is providing a readme somewhere good enough? What about for a website?
IANAL so none of this addresses legal requirements. The individual license will d... | [
1.1286550760269165,
0.5025122761726379,
-0.04108219966292381,
0.2656214237213135,
-0.04873587191104889,
-0.41161495447158813,
0.19763293862342834,
0.11221332848072052,
-0.015454404056072235,
-0.39302822947502136,
0.4064653813838959,
0.5251380205154419,
0.01786212809383869,
0.21318036317825... | |
website or app. A "Powered by Python" logo on every Webpage is invasive. A paragraph with a link to the project URL on a help page is quite acceptable (imho).
**Desktop applications:** on the Help menu put an "About" link that describes the technologies used and gives appropriate credits. IMHO noone reads README files... | [
0.665603518486023,
0.28713729977607727,
0.33345869183540344,
0.26889950037002563,
0.13066145777702332,
-0.19003550708293915,
0.09720439463853836,
-0.06891323626041412,
-0.336326539516449,
-0.4795011878013611,
-0.26587000489234924,
0.4879905581474304,
0.012338598258793354,
-0.25070005655288... | |
and non-invasive). Eitehr as a separate link or on another relevant link.
Any of the credits should include a link to the project or company homepage. | [
0.4013023376464844,
0.028435055166482925,
0.47060635685920715,
0.24484342336654663,
0.24994638562202454,
-0.3688369691371918,
-0.2122308760881424,
-0.12991377711296082,
-0.15495727956295013,
-0.1328039914369583,
-0.40428340435028076,
0.5570500493049622,
0.29790204763412476,
0.0982267707586... | |
I am trying to create a utility keystroke app so i can do things like kill a preprogrammed process or launch something. I am thinking I should hold cmd in any app, then type in a 4 digit command key so I can launch or kill anything quickly while programming, debugging watching a video, etc.
I figured out how to get th... | [
0.19737814366817474,
-0.08156611770391464,
0.41378679871559143,
0.1797993779182434,
0.04352205619215965,
0.00752477440983057,
0.1750079244375229,
0.16526585817337036,
-0.29700902104377747,
-0.5339862704277039,
-0.06658203154802322,
0.7339044809341431,
-0.23096972703933716,
0.00865632295608... | |
its global, so how do I set the hook to be global?
My code is
```
int main()
{
hook = SetWindowsHookEx(WH_KEYBOARD, KeyboardProc, GetModuleHandle(0), 0);
MSG msg;
while(GetMessage(&msg, NULL, 0, 0) > 0)
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
UnhookWindowsHookEx(hook... | [
-0.3791691064834595,
-0.10211806744337082,
0.6811767220497131,
-0.37904229760169983,
0.45251771807670593,
0.22740423679351807,
0.12276356667280197,
0.23266826570034027,
-0.26140114665031433,
-0.6852784156799316,
-0.07485361397266388,
0.5663505792617798,
-0.49347931146621704,
0.133481204509... | |
in mind is that since each instance of the DLL is loaded in a separate process, each will have its own copy of any global variables in the DLL. If you need to share data between these instances, the simplest way is to create a shared data segment in the DLL. The following code is from an RSI monitoring program I wrote.... | [
-0.006356050260365009,
-0.03345164656639099,
0.5109900236129761,
-0.0689428448677063,
-0.2251562625169754,
0.1066165417432785,
-0.057488832622766495,
-0.32860076427459717,
-0.3758973181247711,
-0.5355390906333923,
-0.16800616681575775,
0.1698617935180664,
-0.4241848886013031,
0.25949251651... | |
DWORD dwReason,
LPVOID lpReserved)
{
switch (dwReason)
{
case DLL_PROCESS_ATTACH :
hInstance = (HINSTANCE) hModule;
break;
case DLL_THREAD_ATTACH :
break;
case DLL_THREAD_DETACH :
break;
case | [
-0.21316467225551605,
-0.5202058553695679,
0.7213702201843262,
-0.21136806905269623,
0.41371890902519226,
0.05142888426780701,
0.24862071871757507,
-0.4470916986465454,
-0.23518134653568268,
-0.4256651699542999,
-0.6334776878356934,
0.5379647016525269,
-0.3870128393173218,
0.42158371210098... | |
DLL_PROCESS_DETACH :
break;
}
return TRUE;
}
//
// keyboard hook
//
LRESULT CALLBACK KeyboardProc(int code, // hook code
WPARAM wParam, // virtual-key code
LPARAM lParam) // keystroke-message information
{ | [
-0.42994511127471924,
-0.3936363756656647,
0.7922491431236267,
-0.3140949606895447,
0.3160201907157898,
0.4461360573768616,
-0.07605373114347458,
-0.40590429306030273,
-0.1704849749803543,
-0.3881484270095825,
-0.3208824396133423,
0.7006874680519104,
-0.40296483039855957,
0.124146588146686... | |
if ((lParam & 0x80000000) != 0)
{
++iKeyCount;
}
return CallNextHookEx(hKeyboardHook, code, wParam, lParam);
}
//
// mouse hook
//
LRESULT CALLBACK MouseProc(int code, // hook code
WPARAM wParam, // message identifier
LPARAM lParam) | [
-0.3031451404094696,
-0.3722696900367737,
0.6033810377120972,
-0.5105968713760376,
0.4761750102043152,
0.25826895236968994,
-0.22908778488636017,
-0.3201201856136322,
-0.08364741504192352,
-0.30030879378318787,
-0.14342355728149414,
0.6698841452598572,
-0.5810430645942688,
-0.2823562026023... | |
// mouse coordinates
{
switch (wParam)
{
case WM_LBUTTONDOWN :
case WM_MBUTTONDOWN :
case WM_RBUTTONDOWN :
case WM_LBUTTONDBLCLK :
case WM_MBUTTONDBLCLK :
case WM_RBUTTONDBLCLK :
++iKeyCount;
break;
}
return CallNextHookEx(hMouseHook, code, wParam, lParam);
}
//
// install key... | [
0.11091610044240952,
-0.17535607516765594,
0.6213026642799377,
-0.16428393125534058,
0.5822945833206177,
0.12955740094184875,
0.2196502834558487,
-0.4436226785182953,
-0.10230924189090729,
-0.6077176332473755,
-0.3712746500968933,
0.6673836708068848,
-0.3761020600795746,
0.0071603371761739... | |
= 0;
}
//
// retrieve number of keystrokes
//
int KBM_API FetchKeyCount(bool bClear)
{
int kc = iKeyCount;
if (bClear)
iKeyCount = 0;
return kc;
}
``` | [
0.11717884242534637,
0.1421613097190857,
0.3749156892299652,
-0.25284361839294434,
0.2734544575214386,
0.09083617478609085,
0.30591338872909546,
-0.382418692111969,
-0.2360326498746872,
-0.015494175255298615,
-0.360521525144577,
0.3276691138744354,
-0.49475428462028503,
0.35519811511039734... | |
I am looking for the best way to detect an image within another image. I have a small image and would like to find the location that it appears within a larger image - which will actually be screen captures. Conceptually, it is like a 'Where's Waldo?' sort of search in the larger image.
Are there any efficient/quick ... | [
0.4845248758792877,
0.12218669056892395,
0.32108476758003235,
0.30202993750572205,
0.03606097027659416,
0.050522081553936005,
0.1416257917881012,
0.04002811759710312,
-0.1676577925682068,
-0.8388411402702332,
0.22079704701900482,
0.41360485553741455,
0.003985010087490082,
-0.00031137006590... | |
pixel for pixel.
Wikipedia has an article on [Template Matching](http://en.wikipedia.org/wiki/Template_matching), with sample code.
(While that page doesn't handle changed scales, it has links to other styles of matching, for example [Scale invariant feature transform](http://en.wikipedia.org/wiki/Scale-invariant_feat... | [
0.15856170654296875,
-0.6100520491600037,
0.1715722233057022,
0.2351503074169159,
-0.4422990679740906,
0.3685695230960846,
0.07900169491767883,
-0.6313093900680542,
0.05797614902257919,
-0.6767407655715942,
0.28645411133766174,
0.21809445321559906,
-0.35569918155670166,
-0.1277478486299514... | |
I am having problems with my JScript code. I am trying to loop through all of the rows in a table and add an `onclick` event. I can get the `onclick` event to add but have a couple of problems.
The first problem is that all rows end up getting set up with the wrong parameter for the `onclick` event.
The second proble... | [
0.23944035172462463,
-0.19869334995746613,
0.425376296043396,
-0.2554093301296234,
0.031750522553920746,
-0.1647365242242813,
0.7288655638694763,
-0.5187828540802002,
-0.11800199002027512,
-0.5377551913261414,
-0.15231074392795563,
0.725766658782959,
-0.5428412556648254,
-0.064401626586914... | |
row.onclick=function(){shanesObj.tableRowEvent(orderID);};
}}
shanesObj.tableRowEvent = function(orderID){
alert(orderID);}
```
The table is located at the following location...
<http://www.blackcanyonsoftware.com/OrderTracker/testAJAX.html>
The id's of each row in sequence are... 95, 96, 94...
For some reason, w... | [
-0.04130670800805092,
0.09554625302553177,
0.37853482365608215,
-0.38903239369392395,
0.20346419513225555,
0.04648682475090027,
0.3071736693382263,
-0.1080762967467308,
-0.18351556360721588,
-0.5729581117630005,
-0.19100552797317505,
0.5388042330741882,
-0.7080268263816833,
-0.003373186103... | |
|
CAll addTableEvents
|
CALL onclick
```
So when the variable *orderID* is stumbled upon by the javascript interpreter it searches the scope chain for that variable. There is no *orderID* defined inside your *onclick* function, so the next spot to look is inside *addTableEvents*. You would think *orderID* is de... | [
-0.471763014793396,
0.04351275414228439,
0.4764086902141571,
-0.27743688225746155,
0.14510749280452728,
-0.08262085914611816,
0.20654739439487457,
-0.07082813233137131,
-0.23459170758724213,
-0.822939395904541,
-0.20008733868598938,
0.5622478723526001,
-0.5829943418502808,
-0.0467491634190... | |
which it was assigned, and in this case its the last value of *orderID = row.getAttributeNode("id").value;* in the for loop.
To see this more clearly look at the following
```
shanesObj.addTableEvents = function(){
table = document.getElementById("trackerTable");
for(i=1; i<table.getElementsByTagName("tr").length; i+... | [
0.18070220947265625,
-0.37687763571739197,
0.6472451090812683,
-0.13757655024528503,
0.21876616775989532,
-0.07185500115156174,
0.32353442907333374,
-0.6597695350646973,
-0.28109505772590637,
-0.18406593799591064,
-0.42308375239372253,
0.5970288515090942,
-0.5278587341308594,
-0.1042213439... | |
all the extra and unneeded code and use something like the following,
```
for(i=1; i<table.getElementsByTagName("tr").length; i++){
row = table.getElementsByTagName("tr")[i];
row.onclick=function(){shanesObj.tableRowEvent(this.id);};
}
```
Just access the id attribute directly from the called object... | [
0.0737840086221695,
0.0956554040312767,
0.5577602386474609,
-0.03614336624741554,
0.17796187102794647,
-0.27731114625930786,
0.38312092423439026,
-0.27401092648506165,
0.07150467485189438,
-0.6652881503105164,
-0.16198761761188507,
0.6522695422172546,
-0.2646954357624054,
0.325843781232833... | |
I am not sure, whether I should use for -loop. Perhaps, like
```
for i in range(145):
by 6: //mistake here?
print i
```
```
for i in range(0,150,6):
print i
```
if you are stepping by a constant | [
0.3119150698184967,
-0.12362004071474075,
0.4537124037742615,
-0.2690916359424591,
-0.08632993698120117,
0.41433486342430115,
0.29240304231643677,
-0.4095532298088074,
-0.36226367950439453,
-0.40954533219337463,
0.20095151662826538,
0.5152034163475037,
-0.3460830748081207,
0.13113518059253... | |
I'm using Ant 1.7.1 to tar up the contents of a directory, that contains a .git subdirectory. My current task is
```
<tar
destfile="sali-src-${version}.tgz"
basedir="${basedir}"
compression="gzip"
excludes=".git, .gitignore, *.ipr, *.iws, *.iml">
</tar>
```
But the resultant tarball contains the .git... | [
0.04973069950938225,
0.06752095371484756,
0.31426358222961426,
-0.25623685121536255,
-0.15744340419769287,
0.2720212936401367,
0.3260726034641266,
-0.16883036494255066,
-0.321914941072464,
-0.8487295508384705,
-0.14986790716648102,
0.7195781469345093,
-0.3763406276702881,
0.160676538944244... | |
let count = g.Count()
orderby count descending
select new {Value = g.Key, Count = count};
foreach (var x in q)
{
Console.WriteLine("Value: " + x.Value + " Count: " + x.Count);
}
```
**In response to [this post](https://stackoverflow.com/questions/454601/how-to-count-duplicates-in-list-with-linq#45... | [
0.12855243682861328,
0.050073470920324326,
0.6197474002838135,
0.027217956259846687,
0.09316195547580719,
0.03235809504985809,
0.16888795793056488,
-0.53777676820755,
-0.3247543275356293,
-0.5716592669487,
-0.09810230880975723,
0.41679689288139343,
-0.34528279304504395,
0.26803505420684814... | |
xx by xx into g
```
Since xx is a custom object system doesn't know how to compare one item against another.
As I already wrote, you need to guide compiler and provide some property that will be used in objects comparison or provide custom comparer. Here is an example:
Note that I use **Foo.Name** as a key - i.e. ob... | [
0.2844102680683136,
0.12049967795610428,
-0.0401388481259346,
0.022300098091363907,
-0.3790503740310669,
-0.0734267383813858,
-0.08390294015407562,
-0.028186438605189323,
-0.4007290303707123,
-0.6168090105056763,
0.1561623364686966,
0.38775649666786194,
-0.4736444652080536,
0.2483174502849... | |
If your objects have different Ids it can be a problem.
```
//Using extension methods
var q = list.GroupBy(x => x.Name)
.Select(x => new {Count = x.Count(),
Name = x.Key,
ID = | [
0.014629162847995758,
-0.15180981159210205,
0.2743985652923584,
-0.188548281788826,
0.011368442326784134,
-0.10313936322927475,
0.2609376907348633,
-0.5616320967674255,
-0.2693004906177521,
-0.53140789270401,
-0.1519787758588791,
0.5325807332992554,
-0.4513346254825592,
0.2962853014469147,... | |
x.First().ID})
.OrderByDescending(x => x.Count);
//Using LINQ
var q = from x in list
group x by x.Name into g
let count = g.Count()
orderby count descending
select new {Name = g.Key, Count = count, ID = g.First().ID};
foreach (var x in q)
{
Console.WriteLine("Count: " +... | [
-0.3374350666999817,
-0.11154506355524063,
0.7965693473815918,
-0.4661678969860077,
0.19048625230789185,
-0.033871013671159744,
0.04969056695699692,
-0.70833820104599,
-0.028865976259112358,
-0.36205431818962097,
-0.41309577226638794,
0.4955511689186096,
-0.3426760733127594,
0.303487747907... | |
I am writing a web app in PHP, and it has come time to build an update system, one of the requirements is automatic updates, how should I do this?
I want to do it without a cron, so I'm going to have to check for updates when requests are made to the system, should I do this only when an admin, with significant privs,... | [
0.36839544773101807,
0.5322250127792358,
0.531358540058136,
-0.06437770277261734,
-0.046041831374168396,
-0.12179738283157349,
0.43184131383895874,
0.21700283885002136,
-0.20684970915317535,
-0.6424327492713928,
0.11749022454023361,
0.5867010951042175,
0.010198750533163548,
-0.096059039235... | |
the security updates.
Perhaps you can have a page on your site that returns a small XML file with the most current version number and a URL for download:
`<xml>
<version>1.x.y</version>
<url>http://example.com/current.tgz </url>
</xml>`
Then if the admin chooses to perform and upgrade, your application won't need t... | [
0.41524791717529297,
0.31829559803009033,
0.7242090702056885,
0.24628305435180664,
0.01620912179350853,
-0.22864678502082825,
0.37884512543678284,
0.033819638192653656,
-0.20342504978179932,
-0.51146399974823,
-0.17958715558052063,
0.8142130374908447,
-0.16302098333835602,
-0.1991851776838... | |
I've been working on an alternative compiler front-end for Python where all syntax is parsed via macros. I'm finally to the point with its development that I can start work on a superset of the Python language where macros are an integral component.
My problem is that I can't come up with a pythonic macro definition s... | [
0.26815107464790344,
0.3074471950531006,
-0.032972998917102814,
-0.05044006556272507,
-0.035739779472351074,
0.22877289354801178,
0.16204240918159485,
0.17840038239955902,
-0.2241450548171997,
-0.8633160591125488,
0.07487636804580688,
0.6951800584793091,
-0.47385847568511963,
-0.1574485749... | |
as would alternative syntaxes showing the examples I've posted.
A note about the macro structure, as seen in the examples I've posted: The use of MultiLine/MLMacro and Partial/PartialMacro tell the parser how the macro is applied. If it's multiline, the macro will match multiple line lists; generally used for construc... | [
0.11164823174476624,
0.07684282213449478,
0.2856791913509369,
-0.18199056386947632,
-0.056576646864414215,
0.27651041746139526,
-0.033199243247509,
0.000016849984604050405,
-0.27259561419487,
-0.6923779249191284,
-0.14773599803447723,
0.684209942817688,
-0.3883063793182373,
-0.468788594007... | |
nearly looks like python:
```
macro PrintMacro:
syntax:
"print", OneOrMore(Var(), name='vars')
return Printnl(vars, None)
```
* Make all the macro "keywords" look like creating python objects (`Var()` instead of simple `Var`)
* Pass the name of elements as a "keyword parameter" to items we want a name for. ... | [
-0.1116676852107048,
0.1410824954509735,
0.5807499885559082,
-0.30802223086357117,
0.28564926981925964,
0.010164421983063221,
0.11567004770040512,
-0.23137620091438293,
-0.028583088889718056,
-0.5636774301528931,
0.010140972211956978,
0.4317269027233124,
-0.4138725996017456,
0.046354394406... | |
same:
```
class PrintMacro(Macro):
syntax = 'print', OneOrMore(Var(), name='vars')
...
```
The internal syntax classes like `OneOrMore` would follow this pattern to allow subitems and an optional name:
```
class MacroSyntaxElement(object):
def __init__(self, *p, name=None):
self.subelements = p
self.n... | [
-0.3056774139404297,
-0.12263037264347076,
0.25690871477127075,
-0.2968837022781372,
0.09509692341089249,
0.22269053757190704,
0.06508834660053253,
-0.2439011186361313,
-0.30318161845207214,
-0.5624563694000244,
-0.22564834356307983,
0.6813626885414124,
-0.6493002772331238,
-0.045188631862... | |
# store all elements that have a name as
# nameditems[name] = parsed_element
self.handle(syntaxtree, **nameditems)
```
The handler function would then be defined like this:
```
class PrintMacro(Macro):
...
def handle(self, syntaxtree, vars):
return Printnl(vars, None)
```
I added the syntaxtree... | [
-0.12614944577217102,
-0.03999636322259903,
0.259931355714798,
-0.22986434400081635,
0.06029864028096199,
0.043568238615989685,
0.05191854387521744,
-0.3249090909957886,
-0.08830977231264114,
-0.3579102158546448,
-0.09200339019298553,
0.4932398498058319,
-0.6453835368156433,
-0.15059943497... | |
would then look like this:
```
macro IfMacro(MultiLine):
syntax:
Group("if", Var(), ":", Var(), name='if_')
ZeroOrMore("elif", Var(), ":", Var(), name='elifs')
Optional("else", Var(name='elseBody'))
return If(
[(cond, Stmt(body)) for keyword, cond, colon, body in [if_] + elifs],
None if el... | [
-0.3476576805114746,
-0.28436094522476196,
0.3971348702907562,
-0.32771652936935425,
0.26458463072776794,
0.32773557305336,
0.022279977798461914,
-0.41064995527267456,
0.11989085376262665,
-0.32195430994033813,
-0.36640334129333496,
0.6837742924690247,
-0.4927295446395874,
-0.3620658814907... | |
)
def handle(self, syntaxtree, if_=None, elifs=None, elseBody=None):
# Default parameters in case there is no such named item.
# In this case this can only happen for 'elseBody'.
return If(
[(cond, Stmt(body)) for keyword, cond, body in [if_] + elifs],
None if elseNody is None else Stmt(e... | [
-0.02065117284655571,
-0.09119825065135956,
0.3028583228588104,
-0.18486429750919342,
-0.1075919046998024,
-0.1356123834848404,
0.4946735203266144,
-0.448518306016922,
-0.12165582180023193,
-0.5483937859535217,
-0.23425860702991486,
0.8709135055541992,
-0.2736160159111023,
-0.2275413274765... | |
(parses like standard python)
* Optional items can be easily handled, since you can have a default parameter `None` in the handler
* Flexible use of named items:
+ You don't need to name any items if you don't want, because the syntax tree is always passed in.
+ You can name any subexpressions in a big macro definiti... | [
0.10892779380083084,
0.004928661976009607,
-0.13746216893196106,
-0.13165678083896637,
-0.19108237326145172,
0.014489085413515568,
0.1530233472585678,
-0.13763435184955597,
-0.37250107526779175,
-0.5587150454521179,
-0.368809312582016,
0.39054128527641296,
-0.3655531406402588,
-0.266957968... | |
`Optional("step", Var(), name="step", default=1)`.
I'm not sure about the quote/unquote syntax with "quote:" and "$", but some syntax for this is needed, since it makes life much easier if you don't have to manually write syntax trees. Probably its a good idea to require (or just permit?) parenthesis for "$", so that ... | [
-0.0383465550839901,
-0.11620630323886871,
0.32651084661483765,
-0.21115078032016754,
-0.11863825470209122,
0.21674427390098572,
-0.018684538081288338,
-0.3275164067745209,
-0.12301567196846008,
-0.19001469016075134,
-0.3566255569458008,
1.0377296209335327,
-0.28284338116645813,
-0.4797655... | |
return quote:
xrange($(start), $(end)+1, $(step))
else:
return quote:
xrange($(start), $(end), $(step))
# resulting macro class
class ToMacro(PartialMacro):
syntax = Var(name='start'), "to", Var(name='end'), Optional("inclusive", name='inc'), Optional("step", Var(name='step'))
def handle(syntaxt... | [
-0.058900780975818634,
-0.22400392591953278,
0.5290448069572449,
-0.21676570177078247,
0.006293436046689749,
0.30215585231781006,
0.27608686685562134,
-0.3550748825073242,
0.05561006814241409,
-0.1585884392261505,
-0.6595518589019775,
0.7851369380950928,
-0.3389885723590851,
-0.13336598873... | |
I am planning to start an application which converts the speech to text in Linux.
Are there any existing interfaces so that I can extend them?
or Is there any such existing application in Linux?
Any inputs on this?
EDIT: The application that I am planning to write should be able convert every word that we speak to tex... | [
0.22206349670886993,
0.353649377822876,
0.2694169282913208,
-0.17253553867340088,
-0.15363354980945587,
-0.08460405468940735,
0.40014976263046265,
0.1464255452156067,
-0.007172434125095606,
-0.8305224776268005,
-0.08011505007743835,
0.6391851902008057,
0.17418257892131805,
-0.0847135409712... | |
With more detail, we may be able to provide better answers. For example, there's a big difference between "yes/no" call center-style recognition vs. even partial natural language understanding. | [
-0.007106209639459848,
-0.17579224705696106,
-0.11909207701683044,
0.38113635778427124,
0.08655854314565659,
0.04820723086595535,
0.5752815008163452,
0.044718630611896515,
-0.13121411204338074,
-0.48958316445350647,
-0.23757421970367432,
0.41850513219833374,
0.161024808883667,
-0.270596116... | |
I am currently looking for a way to take a variable in batch and only parse out the filename.
For example, I pass my batch file a -s parameter from another application which is subsequently set to my source variable. The source file variable typically contains something like: C:\Program Files\myapp\Instance.1\Data\fil... | [
0.30437150597572327,
0.0047567784786224365,
0.40998125076293945,
0.030000489205121994,
0.05433584749698639,
0.011060933582484722,
0.17224250733852386,
-0.05855943635106087,
-0.15427814424037933,
-0.6764624714851379,
-0.020374108105897903,
0.8156654238700867,
-0.11176304519176483,
0.0466357... | |
installed).
If its coming in as an argument to the script, i.e. %1, %2, etc, you can extract just the filename and extension into a variable like this:
```
set FILENAME=%~nxN
```
where N is the index of the argument. For example, this script will echo just the filename of the first argument:
```
@echo off
set FILEN... | [
0.24160854518413544,
-0.2174164056777954,
0.5353354811668396,
-0.39507079124450684,
0.24249126017093658,
0.12885147333145142,
0.22524821758270264,
-0.270742803812027,
0.0187714584171772,
-0.549193799495697,
-0.05604821816086769,
0.7869818806648254,
-0.429995059967041,
0.027063515037298203,... | |
When does OS X decide to give your app a spinning beach ball? What can you do when programming an application to avoid this?
The window server will show the spinning wait cursor when the frontmost application, or the application that has a window under the mouse pointer, has not responded to events from the window serv... | [
-0.04057925567030907,
-0.33365604281425476,
0.6876745820045471,
0.3363136053085327,
-0.2832392752170563,
-0.5729841589927673,
-0.023141102865338326,
0.31808868050575256,
-0.7068098783493042,
-0.14648498594760895,
-0.2314370572566986,
0.3122755289077759,
-0.4226628839969635,
0.1884073764085... | |
to the user. | [
0.23236443102359772,
0.06910274922847748,
0.2715305685997009,
0.0343628004193306,
0.055886704474687576,
-0.10611920803785324,
0.01672910526394844,
0.35577791929244995,
0.11583984643220901,
-0.33174774050712585,
-0.40672826766967773,
0.28126612305641174,
-0.0771586000919342,
0.0788360312581... | |
I created a database in PostgreSQL with "encoding = 'UTF8'", and loaded some UTF8 data in it. Selecting works fine, but when I try to do a "WHERE UPPER(name) = 'FOO'" in a query, I get an error
```
ERROR: invalid multibyte character for locale
```
My research seems to indicate that this is because the PostgreSQL in... | [
0.0029480736702680588,
0.08826244622468948,
0.1501907855272293,
0.13903065025806427,
-0.041850391775369644,
-0.03561048582196236,
0.20935793220996857,
0.0397348515689373,
-0.0955771803855896,
-0.4901013672351837,
-0.11006246507167816,
0.34765392541885376,
-0.42604130506515503,
0.2850740551... | |
way to do the equivalent of "UPPER" that works for UTF8?
**Update** I ended up doing the dump, reinitdb, and restore of the database, and it was less painful than I thought it would be, except for a bit of a problem figuring out where the data was supposed to go because the postgres user doesn't set the PGDATA environ... | [
-0.03925855830311775,
-0.35899507999420166,
0.30463847517967224,
0.2806684076786041,
0.03342457488179207,
-0.024864057078957558,
0.26375943422317505,
-0.010601678863167763,
-0.40343648195266724,
-0.7318760752677917,
0.11674085259437561,
0.5431466102600098,
-0.11054549366235733,
-0.03695329... | |
map, because all the memory in a vector is always contiguous (and so plays more nicely with computers' caches and such things), and the number of comparisons needed to find something in a vector might be about the same as for a map. Finding an element in a map needs fewer operations in the limit of very large container... | [
-0.34563490748405457,
-0.37331733107566833,
0.18099185824394226,
0.5663924813270569,
0.04495793581008911,
0.1274368166923523,
-0.025121355429291725,
-0.12927980720996857,
-0.4899320900440216,
-1.1889615058898926,
-0.05005694553256035,
0.15224704146385193,
0.023446841165423393,
-0.112531073... | |
about 5-30 elements.
An alternative is to use a hash container. They are often named `hash_map` or `unordered_map`. Classes named `hash_map` are not part of the official standard (and there are a few variants out there); `std::tr1::unordered_map` is. A hash map is often faster than a normal map for lookups, regardless... | [
-0.27718856930732727,
-0.26368576288223267,
0.006653230637311935,
0.16298368573188782,
0.09542027860879898,
-0.01011771522462368,
0.14455890655517578,
-0.43045926094055176,
-0.3571900725364685,
-0.5916210412979126,
-0.2106344848871231,
0.139076828956604,
0.03211718052625656,
-0.13311493396... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.