text
stringlengths
0
30.5k
title
stringclasses
1 value
embeddings
listlengths
768
768
literal `u'\ud800'` in your code will just wreak havoc. Missing things -------------- * C modules are not available, of course. + So no [NumPy](http://numpy.scipy.org/) or [SciPy](http://www.scipy.org/). * os.spawn\* functions are not implemented. Instead use subprocess.call. Performance ----------- * For most wor...
[ 0.4376993179321289, -0.1963198333978653, 0.16560229659080505, 0.09281101077795029, -0.6417339444160461, -0.11098560690879822, 0.7092634439468384, 0.29190540313720703, -0.3139711022377014, -0.8102057576179504, -0.020751290023326874, 0.428297221660614, -0.18853634595870972, 0.042247351258993...
``` Checkbox[,] checkArray = new Checkbox[2, 3]{{checkbox24,checkboxPref1,null}, {checkbox23,checkboxPref2,null}}; ``` I am getting error . How do I initialize it? OK, I think I see what's happening here. You're trying to initialize an array at a class level using this syntax, and ...
[ 0.035978052765131, 0.1750086396932602, 0.05278140679001808, -0.028800074011087418, -0.12292986363172531, -0.00009107870573643595, 0.48558855056762695, -0.25872552394866943, -0.15888409316539764, -0.6625702977180481, -0.10168064385652542, 0.3600321114063263, -0.4408378303050995, 0.183236852...
need to move the init code into the constructor. At the class level do this: ``` CheckBox[,] checkArray; ``` Then in your constructor: ``` public Form1() { InitializeComponent(); checkArray = new CheckBox[2, 3] { { checkbox24,checkboxPref1,null}, {checkbox23,checkboxPref2,null}}; ...
[ -0.10512207448482513, -0.0776178166270256, 0.30235055088996887, -0.04824897646903992, -0.04144595190882683, -0.10366389155387878, 0.21366645395755768, -0.3835912048816681, 0.05394911393523216, -0.6767861247062683, -0.31423041224479675, 0.2824094891548157, -0.49896320700645447, -0.166395261...
I was reading about threading and about locking. It is common practise that you can't (well should not) lock a value type. So the question is, what is the recommended way of locking a value type? I know there's a few ways to go about doing one thing but I haven't seen an example. Although there was a good thread on MS...
[ 0.347892165184021, 0.11275208741426468, 0.3787211775779724, -0.30796942114830017, 0.18595775961875916, -0.08563199639320374, 0.307672381401062, -0.3385107219219208, -0.24527564644813538, -0.2078973352909088, 0.01092433650046587, 0.7291611433029175, -0.5520637035369873, 0.4152546226978302, ...
} } ```
[ 0.17493881285190582, 0.41805654764175415, 0.05209751054644585, -0.04864929988980293, 0.437467485666275, -0.15825650095939636, 0.13202530145645142, 0.5446501970291138, 0.35430577397346497, -0.4846813380718231, -0.2295716553926468, 0.546978771686554, -0.3188462555408478, 0.2798506021499634, ...
Is there an easy way to read an application's already embedded manifest file? I was thinking along the lines of an alternate data stream? Windows manifest files are Win32 resources. In other words, they're embedded towards the end of the EXE or DLL. You can use LoadLibraryEx, FindResource, LoadResource and LockResourc...
[ -0.034780003130435944, 0.1490895301103592, 0.4342298209667206, -0.22318041324615479, -0.01675325073301792, -0.08482041954994202, -0.14396250247955322, -0.23361243307590485, -0.030033141374588013, -0.7494246363639832, -0.1407221406698227, 0.7065290808677673, -0.39497241377830505, 0.10437189...
const BYTE *pResource = (const BYTE *)LockResource(hResData); TCHAR filename[MAX_PATH]; if (IS_INTRESOURCE(lpName)) _stprintf_s(filename, _T("#%d.manifest"), lpName); else _stprintf_s(filename, _T("%s.manifest"), lpName); FILE *f = _tfopen(filename, _T("wb")); fwrite(pResource, cbR...
[ 0.12102469801902771, -0.13176554441452026, 0.7523192763328552, -0.1867108792066574, 0.336767315864563, 0.11845342069864273, 0.2970884442329407, -0.41626304388046265, -0.2208959311246872, -0.3742857277393341, -0.4785456955432892, 0.782007098197937, -0.29687070846557617, 0.1017572432756424, ...
LOAD_LIBRARY_AS_DATAFILE); EnumResourceNames(hModule, RT_MANIFEST, EnumResourceNameCallback, NULL); FreeLibrary(hModule); return 0; } ``` Alternatively, you can use MT.EXE from the Windows SDK: ``` >mt -inputresource:dll_with_manifest.dll;#1 -out:extracted.manifest ```
[ -0.09682322293519974, -0.2083561271429062, 0.31834471225738525, -0.14496824145317078, -0.0279330275952816, -0.1332559585571289, 0.27404654026031494, -0.38644474744796753, -0.3249284029006958, -0.5225318670272827, -0.4041062593460083, 0.8491000533103943, -0.414084255695343, 0.10598208010196...
I have a problem with an application which uses the same stored procedure over and over again to populate people information in dropdown lists. The problem is that sometimes people aren't there anymore as the data changes. I have two views I can use to select from, but I want to dynamically change which view is being u...
[ 0.6821791529655457, 0.1354660540819168, 0.14083808660507202, 0.1600537896156311, 0.23269464075565338, -0.020411476492881775, 0.002758750692009926, 0.07148654758930206, -0.5768591165542603, -0.5569694638252258, 0.3163536787033081, 0.2557176947593689, -0.192643940448761, 0.5553460717201233, ...
I go about passing the view name in to my stored procedure so I can select from it? I've already tried adding: ``` @view varchar(50) select a, b from @view ``` But I get an error stating I must declare the variable @view. Is this even possible to do? If you use only two views and you know their names, you could j...
[ 0.4850747585296631, -0.20622096955776215, 0.38857755064964294, -0.29311540722846985, -0.23908747732639313, 0.2447679042816162, 0.0420248843729496, -0.4374690055847168, -0.01663932017982006, -0.5177822709083557, -0.051743000745773315, 0.7886539101600647, -0.2442549169063568, 0.1723231971263...
I'm working on creating a call back function for an ASP.NET cache item removal event. The documentation says I should call a method on an object or calls I know will exist (will be in scope), such as a static method, but it said I need to ensure the static is thread safe. Part 1: What are some examples of things I co...
[ 0.3488149642944336, -0.15251269936561584, 0.09328164905309677, -0.31351521611213684, 0.1653946191072464, -0.054226383566856384, 0.4043574035167694, -0.25765734910964966, -0.15621185302734375, -0.5006991624832153, -0.07058368623256683, 0.6392902135848999, -0.3856588900089264, 0.232700437307...
get 6 or 7 returned depending on who which invocation sets foo first? (i.e. a race condition) That *addOne* function is indeed thread safe because it doesn't access any data that could be accessed by another thread. Local variables cannot be shared among threads because each thread gets its own stack. You do have to ma...
[ 0.2097010314464569, -0.12016092985868454, 0.5710529088973999, -0.13730905950069427, 0.1397808939218521, -0.049907032400369644, 0.5082508325576782, -0.07991745322942734, -0.21194006502628326, -0.5058839321136475, -0.333084374666214, 0.7693468928337097, -0.4280760586261749, 0.344058841466903...
type, it might be shared among multiple threads. ```
[ 0.6020365357398987, 0.11621949076652527, -0.11069391667842865, 0.1257925033569336, 0.05745074525475502, 0.02959052287042141, 0.12962064146995544, 0.4053535461425781, -0.1629808247089386, -0.6966012120246887, 0.19187048077583313, 0.08512011915445328, -0.616363525390625, 0.5933517217636108, ...
What is the lowest permission level I need on a user to be able to create diagrams in SQL Server Enterprise Manager? I'm currently set as data reader and I am unable to create diagrams. (I wouldn't expect to be able to at this permission level) After some further investigation, with the dbo role, I was able to create ...
[ -0.005757459904998541, 0.30706778168678284, 0.29292765259742737, 0.004474584013223648, 0.011115609668195248, -0.23627927899360657, 0.15014703571796417, -0.19834524393081665, -0.2564946711063385, -0.5994715094566345, 0.004272243939340115, 0.39108678698539734, -0.04399297386407852, 0.2749543...
I'm just coming up the learning curve for Java SE & have no problem with the usual Java convention for package names, e.g. `com.example.library_name_here.package_name_here` Except. I've been noticing a failure to abide by this in some fairly well-known packages. * [JLine](http://jline.sourceforge.net/): `jline.*` *...
[ 0.3792150020599365, 0.16064299643039703, 0.003006037324666977, -0.22356173396110535, -0.22266128659248352, -0.31968575716018677, 0.3873119652271271, 0.03308551013469696, -0.459059476852417, -0.6355037093162537, -0.178994819521904, 0.19184638559818268, 0.025660550221800804, 0.01039002370089...
ownership issues (e.g. you change the project hosting/domain name, or there's already a well-known package that has "squatter's rights" to your domain, or your ownership of the domain runs out & someone else snaps it up). edit: if I use my company's domain name, and we are bought out or have a spin-off, what should we...
[ 0.4396156668663025, 0.0680510401725769, -0.07540274411439896, 0.1940988302230835, 0.07428228855133057, -0.40062806010246277, 0.22296008467674255, -0.06632421165704727, -0.20560605823993683, -0.32692480087280273, -0.4133807420730591, 0.426864355802536, -0.15916089713573456, 0.57094269990921...
you follow the convention, and nobody illicitly uses your slice of the package namespace pie, you shouldn't need to worry about what others have used.
[ 0.6930361390113831, -0.003142826957628131, -0.28228676319122314, -0.05421349033713341, 0.15244653820991516, -0.121977299451828, 0.0636640340089798, 0.2661464810371399, -0.23452647030353546, -0.25233784317970276, -0.1646401584148407, 0.4757886826992035, -0.19320689141750336, -0.296066552400...
What is best practice to create dynamic sidebar or other non content layout places with zend framework. At this moment I created controller witch i called WidgetsController. In this controller i defined some actions with 'sidebar' response segment for my sidebar and in IndexController i call them with $this->view->acti...
[ 0.13460983335971832, -0.3485788404941559, 0.33684560656547546, 0.09001535922288895, -0.4512985944747925, -0.08462006598711014, 0.1515101045370102, -0.4212723970413208, -0.2024850845336914, -0.48451003432273865, 0.27959975600242615, 0.39145758748054504, -0.20420852303504944, 0.0800586789846...
the sidebar echo $this -> partial('/path/to/sidebar.phtml',array('menuitems' => $data)); ``` And then sidebar could process that dynamic data: ``` //sidebar.phtml <div id="sidebar"> <?php foreach($this -> menuitems as $item) : ?> <a href="<?php echo $item['url']; ?>"><?php echo $item['title']; ?></a> <?...
[ -0.03399427980184555, -0.10504289716482162, 0.4522068500518799, -0.09180113673210144, -0.1926293820142746, 0.28287988901138306, 0.11649147421121597, -0.5979875326156616, -0.11154384166002274, -0.20459431409835815, -0.2585388720035553, 0.24826888740062714, -0.38574397563934326, 0.0853390991...
There are the standard A-Z, a-z characters, but also there are hyphens, em dashes, quotes, etc. Plus, there are all of the international characters, like umlauts, etc. So, for an English-based system, what's the complete set? What about sets for other languages? What about UTF8, UTF16, etc? Bonus question: How many ...
[ 0.23246246576309204, 0.11244124919176102, 0.18045273423194885, 0.13046371936798096, -0.24770377576351166, 0.11753186583518982, 0.2577347159385681, 0.1894194334745407, -0.08913849294185638, -0.40249472856521606, -0.2014196515083313, 0.2888239026069641, 0.11214005947113037, -0.09198361635208...
do need to deal with the structural ones. For example, I had a name come in that was separated by an em dash, but it was hard to distinguish that from the minus character. To make the system easier for searching, I want to take all five different types of dashes, and map them onto one unique character (minus), that w...
[ 0.11272387951612473, 0.28195610642433167, 0.12408445030450821, 0.11605975776910782, -0.36439433693885803, -0.07479582726955414, 0.08196120709180832, -0.046734701842069626, -0.21279947459697723, -0.41311517357826233, 0.04804928973317146, -0.03913460671901703, -0.2726643681526184, 0.19537898...
explains the problems (and possible solutions) pretty well (it was originally a two-part blog post by Richard Ishida: [part 1](https://r12a.github.io/blog/200610#20070709) and [part 2](https://r12a.github.io/blog/200707#20070716)) Personally I'd say: support every printable Unicode-Character and to be safe provide jus...
[ -0.13270772993564606, 0.23859189450740814, -0.23285076022148132, 0.092910535633564, -0.14372481405735016, -0.0193271916359663, 0.11801543831825256, -0.18468064069747925, 0.12510818243026733, -0.3402211368083954, -0.3506440222263336, 0.09043662250041962, -0.19838330149650574, -0.07043853402...
I'm using Jeff Atwood's [Last Configuration Section Handler You'll Ever Need](http://www.codinghorror.com/blog/archives/000656.html), but it only seems to work for the default app.config file. If I wanted to separate certain settings into another file, the deserializing doesn't work, since ConfigurationManager.GetSecti...
[ 0.4649149775505066, -0.03214903175830841, 0.2343519926071167, 0.2187526375055313, 0.2966073453426361, -0.0800870731472969, 0.22978617250919342, -0.171438068151474, -0.23087099194526672, -0.83472740650177, -0.087846539914608, 0.7017333507537842, -0.5357801914215088, 0.011861836537718773, ...
<configSections> <section name="Connections" type="BPA.AMP.Configuration.XmlConfigurator, BPA.AMP.Data.Config.DAL"/> <section name="AutoProcessConfig" type="BPA.AMP.Configuration.XmlConfigurator, BPA.AMP.Data.Config.DAL"/> </configSections> <Connections configSource="Config\Connection...
[ -0.22469764947891235, -0.01655619964003563, 0.5347670912742615, 0.06365476548671722, 0.2759389877319336, 0.4009721875190735, -0.3670628070831299, -0.4424934983253479, -0.6059868931770325, -0.4688195288181305, -0.31532159447669983, 0.5264877080917358, -0.2584640085697174, 0.0700505375862121...
XmlNode section) { XPathNavigator xPN; if (section == null || (xPN = section.CreateNavigator()) == null ) return null; // --------------------------------------------------------- Type sectionType = Type.GetType((string)xPN.Evaluate
[ -0.1523236632347107, -0.3370843231678009, 0.5775251984596252, -0.304397314786911, -0.15942268073558807, -0.13488267362117767, 0.3161218762397766, -0.31768080592155457, -0.0029388642869889736, -0.40096840262413025, -0.41915279626846313, 0.3327501714229584, -0.27713990211486816, 0.1713050156...
("string(@configType)")); XmlSerializer xs = new XmlSerializer(sectionType); return xs.Deserialize(new XmlNodeReader(section)); } } ```
[ 0.05764014273881912, -0.2121579498052597, 0.5079699754714966, -0.11453085392713547, -0.08889169991016388, 0.024462979286909103, 0.15929976105690002, -0.27771440148353577, -0.20859231054782867, -0.6772133708000183, -0.6177427172660828, 0.3506079316139221, -0.4891320466995239, 0.391135036945...
Is there a way to monitor a gmail account using imaplib without polling gmail each time I want to see if there is new mail. Or in other words, I just want the script to be notified of a new message so I can process it right away instead of any lag time between polls. I see that the IMAP protocol supports this with the...
[ 0.41598284244537354, 0.09888656437397003, 0.053056344389915466, 0.18344822525978088, -0.09101180732250214, -0.1948278695344925, 0.36047908663749695, 0.24278035759925842, -0.2111615240573883, -0.5833556652069092, 0.23352284729480743, 0.5559232831001282, -0.3469540774822235, -0.0272133685648...
Python), however, it seems that someone has implemented an IDLE extension for Python which has the same interface as imaplib (which you can swap out with no changes to existing code, apparently): <https://github.com/imaplib2/imaplib2>
[ 0.1722305417060852, -0.2518192529678345, -0.03195120766758919, -0.08335308730602264, -0.13293594121932983, -0.014859646558761597, 0.16847072541713715, 0.20165804028511047, -0.25309982895851135, -0.6053208112716675, -0.11775501072406769, 0.47198066115379333, -0.6609947085380554, -0.05033480...
In the process of fixing a poorly imported database with issues caused by using the wrong database encoding, or something like that. Anyways, coming back to my question, in order to fix this issues I'm using a query of this form: > UPDATE `table_name` SET field\_name = > replace(field\_name,’search\_text’,'replace\_...
[ 0.1744476854801178, 0.26304519176483154, 0.33446553349494934, 0.0005691167316399515, 0.0051391227170825005, 0.11848071217536926, -0.00902398582547903, -0.23549515008926392, -0.29462435841560364, -0.7566628456115723, 0.10190115869045258, 0.6609413623809814, -0.6891515254974365, 0.0207444746...
you can imagine, I end up running tens of queries just to fix one table. What I was wondering is if there is a way of either combine multiple find and replaces in one query, like, lets say, look for this set of things, and if found, replace with the corresponding pair from this other set of things. Or if there would ...
[ 0.24024394154548645, 0.1532803326845169, -0.0775291919708252, 0.3881552517414093, 0.12604880332946777, 0.21274146437644958, 0.011784061789512634, 0.04863651469349861, -0.44258761405944824, -0.7203484773635864, 0.24271176755428314, 0.3661687970161438, -0.13389448821544647, 0.077971093356609...
these separately: If the set of replacements is the same for every column in every table that you need to do this on (or there are only a couple patterns), consider creating a user-defined function that takes a varchar and returns a varchar that just calls `replace(replace(@input,'search1','replace1'),'search2','repla...
[ 0.2179497927427292, -0.036900732666254044, 0.47577208280563354, -0.081564761698246, 0.0022463640198111534, 0.2994719445705414, -0.06269406527280807, -0.4276062846183777, -0.3589109778404236, -0.6347384452819824, 0.0005557170952670276, 0.7229186296463013, -0.6145330667495728, -0.12425306439...
columns and generates the queries to execute from that.
[ -0.13844893872737885, 0.4130907356739044, 0.2745058536529541, 0.013334240764379501, 0.06726229935884476, 0.3615015745162964, -0.034769877791404724, -0.28721898794174194, 0.037231653928756714, -0.4435887634754181, -0.3917807936668396, 0.1982227861881256, -0.4468226134777069, 0.0132961831986...
**Background:** Customer X is a low-budget non-profit outfit that nonetheless has a lot of activity configured on virtual hosts, and the virtual hosts multiply very frequently. Customer X also has a lot of users and is interested in getting them over to a single sign on solution. This way, all the users can use the sam...
[ 0.6727091670036316, 0.2975325882434845, 0.39985591173171997, -0.14358000457286835, -0.20371177792549133, -0.22624550759792328, 0.2556971311569214, 0.21727123856544495, -0.15688535571098328, -0.41745448112487793, -0.3546687662601471, 0.12477278709411621, -0.1479957401752472, 0.0864624604582...
in the park. [This question about virtual-hosts with SSL details some of the pitfalls](https://stackoverflow.com/questions/276134/how-can-i-setup-different-ssl-certificates-for-vhosts-on-apache). **Question:** What is the best way to proceed with this scenario (summary): * multiple virtual hosts on apache * setting ...
[ 0.7002649903297424, -0.06143268570303917, 0.12291909754276276, 0.37670761346817017, -0.11962566524744034, -0.6913213133811951, 0.28855347633361816, 0.07214942574501038, -0.23238058388233185, -0.12083341181278229, 0.04308569058775902, 0.24968981742858887, -0.06012945994734764, 0.00335111748...
exact same situation and the way that they solved it was to buy a wildcard domain \*.example.com and have all the virtual hosts have a specific subdomain at example.com to get around this problem. This was with Shibboleth and did work out, although you need the hosts domains to agree to fall under one parent domain fo...
[ 0.23792855441570282, 0.0971529483795166, -0.05063191428780556, 0.33575984835624695, -0.3537294268608093, 0.05397891625761986, 0.4904446601867676, 0.4969164729118347, -0.46520841121673584, -0.6527836322784424, 0.08083149790763855, -0.19935175776481628, -0.25229352712631226, 0.57058262825012...
While developing a new query at work I wrote it and profiled it in SQL Query Analyzer. The query was performing really good without any table scans but when I encapsulated it within a stored procedure the performance was horrible. When I looked at the execution plan I could see that SQL Server picked a different plan t...
[ 0.021633144468069077, -0.11228404194116592, 0.30625560879707336, -0.14917807281017303, 0.11971168220043182, 0.00618203729391098, -0.08459498733282089, -0.1668923795223236, -0.07480578124523163, -0.5821680426597595, 0.41530919075012207, 0.26090529561042786, -0.35768502950668335, 0.238097891...
0, DATEDIFF(dd, 0, TableA.Created)) AS Day, DATEPART(hh, TableA.Created) AS [Hour], SUM(TableB.Quantity) AS Quantity, SUM(TableB.Amount) AS Amount FROM TableA INNER JOIN TableB ON TableA.BID = TableB.ID WHERE (TableA.ShopId = @ShopId) GROUP BY DATEADD(dd, 0, DATEDIFF(dd, 0, TableA.C...
[ 0.25281158089637756, -0.30347728729248047, 0.5355827808380127, 0.015359720215201378, -0.025054920464754105, 0.38286885619163513, 0.1250429004430771, -0.10139919817447662, -0.08852192014455795, -0.4883515238761902, -0.29751384258270264, 0.06881120055913925, 0.0869666114449501, 0.42875516414...
Reads Writes SQL:StmtCompleted 75 41 7 0 ``` And when I run the query as a stored proc using the following command ``` DECLARE @ShopId int SELECT @ShopId = 1 EXEC spStats_GetSalesStatsByHour @ShopId ``` I get the following trace stats ``` Event Class Duration CPU Reads Writes SQL:Stm...
[ 0.18059894442558289, -0.018934713676571846, 0.6483244299888611, -0.18264241516590118, -0.00917684007436037, 0.0067940643057227135, 0.4820321202278137, -0.44187870621681213, -0.14779499173164368, -0.6325096487998962, 0.13098903000354767, 0.4097239375114441, -0.1823168396949768, -0.030667770...
execute it using sp\_executesql like this (it performs like the sproc) ``` DECLARE @SQL nvarchar(2000) SET @SQL = 'SELECT DATEADD(dd, ...' exec sp_executesql @SQL ``` The stored procedure does not contain anything except for the select statement above. What would cause sql server to pick an inferior execution plan j...
[ 0.07751454412937164, -0.01819933019578457, 0.2680418789386749, -0.13818815350532532, -0.27574560046195984, -0.2787821292877197, 0.2977844178676605, -0.44292861223220825, -0.3057446777820587, -0.32963788509368896, 0.22334493696689606, 0.39985761046409607, -0.5070495009422302, -0.02555502019...
procedure p_myproc (@p1 int) as declare @p1_copy int; set @p1_copy = @p1; ``` And then use @p1\_copy in the query. Seems ridiculous but it works. Check my recent question on the same topic: [Why does the SqlServer optimizer get so confused with parameters?](https://stackoverflow.com/questions/414336/why-does-the-sq...
[ -0.16147714853286743, -0.02793481945991516, 0.26546522974967957, 0.12275061756372452, -0.02884094789624214, 0.18882541358470917, -0.053077973425388336, -0.24413013458251953, -0.23122583329677582, -0.08582757413387299, -0.13193471729755402, 0.524959921836853, -0.5518251061439514, 0.13956198...
I am in the preliminary stages of planning a project with a client to redo their current website. I took a look at their current site to see what issues they are currently dealing with and upon inspection I noticed that every page is being rendered entirely using XSLT. I am familiar with XSLT, I have used it to render ...
[ 0.5902656316757202, 0.18569448590278625, 0.5097578763961792, 0.23439498245716095, 0.011534864082932472, -0.057253025472164154, 0.2604266405105591, 0.37422671914100647, 0.003636012552306056, -0.6070338487625122, -0.15477187931537628, 0.5704677700996399, -0.04215401038527489, 0.0197916347533...
Server-side: Advantages: * Clean, concise templates * An easy way to process XML data into HTML * Reasonably fast Disadvantages: * Programming model unfamiliar and uncomfortable for many procedural-language programmers * Awkward if some or all source data is *not* in XML * Can be very slow when not used carefully (sm...
[ -0.17208844423294067, 0.05767611786723137, 0.30668625235557556, 0.2105313539505005, -0.3595663011074066, -0.14521639049053192, 0.06186172738671303, 0.12643824517726898, -0.371031790971756, -0.9278371930122375, -0.1694452315568924, 0.4138171076774597, -0.04212317243218422, -0.11625601351261...
I have a List, it has Foo objects, and each Foo has a start date, and an end date. I want to insert a new Foo object, which has its own start and end date. I want the elements in the list to update their start and end dates accordingly, when the new Foo object is inserted, and for the new Foo object to find its correc...
[ 0.42982128262519836, 0.3530648648738861, 0.31626254320144653, -0.10283129662275314, 0.1479424685239792, -0.04589039832353592, 0.13299590349197388, -0.01900620572268963, -0.22725315392017365, -0.39920851588249207, 0.00007393407577183098, 0.30071645975112915, -0.3556835949420929, 0.328730344...
and find where it needs to be inserted. But be careful, since there are a bunch of edge cases that can mess up your list. Your logic should work in the following situations: ``` 1) The new interval fits into an existing interval -- do nothing 2) The new interval begins and ends before the first interval -- ...
[ 0.2020157277584076, -0.01674666255712509, 0.1274835467338562, -0.06533947587013245, 0.5032891631126404, -0.24650952219963074, 0.35039806365966797, -0.22505097091197968, -0.16134129464626312, -0.5505748391151428, -0.2162669450044632, 0.6371642351150513, -0.15270040929317474, -0.088243432343...
cutting across adjacent intervals -- replace the start or end date on existing Foo. 4) The new interval begins after the end of the previous interval, but ends after the beginning of the next interval -- walk the list with a sentinel until you find a Foo that begins before the ...
[ 0.1200900748372078, 0.023212650790810585, 0.4579095244407654, -0.04882147163152695, -0.09124410152435303, -0.014002041891217232, 0.4170656204223633, -0.05323180928826332, -0.1916639655828476, -0.3012279272079468, -0.29507407546043396, 0.34730687737464905, -0.3374288082122803, 0.30006930232...
between the current Foo and the sentinel, adjusting the end time if necessary. 5) The new interval begins after the end of the last interval -- insert it at the end of the list. ``` It's possible I'm missing an edge case, but this is a model I used when I had to solve a very similar problem.
[ 0.18453621864318848, 0.09779348969459534, 0.6971313953399658, -0.21374554932117462, 0.01393845397979021, -0.025560004636645317, 0.199180006980896, -0.0700506940484047, 0.14862415194511414, -0.686704695224762, 0.1594999134540558, 0.5818784832954407, -0.2847355008125305, 0.25766265392303467,...
Let's say I have a page called `display.php` and the user is viewing `display.php?page=3`. I want to allow the user to do an action like voting via a POST request and then bring them back to the page they were on. So, If I do a POST request to `display.php?page=3` would the page information also be available to the scr...
[ 0.48268723487854004, 0.08369280397891998, 0.45015373826026917, -0.014799119904637337, -0.6631388068199158, 0.04784409701824188, -0.015246901661157608, -0.21842515468597412, -0.168267622590065, -0.5273342728614807, 0.27901431918144226, 0.27645403146743774, -0.08814035356044769, 0.2238226830...
not to say that you *should* do this, but it will work.
[ 0.5528970956802368, 0.22235698997974396, -0.19239114224910736, 0.14384092390537262, -0.12861648201942444, -0.07852990180253983, 0.7016845941543579, -0.33121052384376526, 0.13191448152065277, -0.6247366070747375, -0.02220388688147068, 0.20678821206092834, 0.17024296522140503, -0.16841304302...
What are some best practices on enabling a web application to support multiple resolutions? Specifically resolutions that are wide-screen vs. normal aspect ratio. It doesn't seem like there is an easy answer - other than simply supporting a few fixed resolutions and using some absolute positioning to get the layout to...
[ 0.25698307156562805, -0.061236072331666946, 0.3633211851119995, 0.2699183225631714, 0.3151717483997345, -0.09418307989835739, -0.08440997451543808, -0.03100631944835186, -0.5325411558151245, -0.6200649738311768, 0.1550193876028061, 0.582375705242157, -0.16123108565807343, 0.106468260288238...
explaining different layouts including liquid layout. <http://www.maxdesign.com.au/presentation/liquid/> PS. the above mentioned site (maxdesign.com.au) is using liquid layout itself, so try and change the size of your browser when reading the article.
[ 0.23749560117721558, -0.2737710177898407, 0.22968877851963043, 0.125967875123024, -0.19489814341068268, 0.05703287199139595, 0.041982702910900116, 0.17053502798080444, -0.4687175750732422, -0.8951534628868103, -0.17794638872146606, -0.026986761018633842, -0.2560025751590729, -0.21299763023...
I created a custom autocomplete control, when the user press a key it queries the database server (using Remoting) on another thread. When the user types very fast, the program must cancel the previously executing request/thread. I previously implemented it as AsyncCallback first, but i find it cumbersome, too many h...
[ 0.08245903998613358, -0.16333793103694916, 0.3692128658294678, -0.10095441341400146, 0.1179027184844017, -0.1816142499446869, 0.3820667266845703, -0.09171798080205917, -0.055549606680870056, -0.24981820583343506, -0.16825848817825317, 0.6593128442764282, -0.504547655582428, 0.5431480407714...
thread, it would still complete the operation of the to be terminated thread. I would still end up using Abort() on thread. So i decided to just implement it with pure Thread approach, sans the AsyncCallback. Is this thread.abort() normal and safe to you? ``` public delegate DataSet LookupValuesDelegate(LookupTextEve...
[ 0.07035449892282486, -0.47714632749557495, 0.6186423897743225, -0.04508892074227333, 0.1746681183576584, -0.10926827788352966, 0.605143129825592, -0.2652578055858612, -0.3053211569786072, -0.4293493926525116, -0.34196290373802185, 0.46498891711235046, -0.5804669857025146, 0.409245520830154...
else { // implements the appending of text on textbox here } } private void txt_TextChanged(object sender, EventArgs e) { if (_yarn != null) _yarn.Abort(); _yarn = new Thread( new Mate { LookupValuesDelegate = this.LookupValuesDelegate,
[ 0.2763078212738037, -0.2407921850681305, 0.5394638180732727, -0.26062873005867004, 0.2769557237625122, 0.024291448295116425, 0.5887646675109863, -0.21897825598716736, -0.3684983253479004, -0.7465386390686035, -0.17987757921218872, 0.55845707654953, -0.42134588956832886, 0.5468946099281311,...
LookupTextEventArgs = new LookupTextEventArgs { RowOffset = offset, Filter = txt.Text }, PassDataSet = this.DataSetCallback
[ -0.18612757325172424, -0.4185684621334076, 0.7138510346412659, -0.042124420404434204, -0.013654772192239761, 0.08199354261159897, 0.2801606357097626, -0.21582579612731934, -0.28622156381607056, -0.9184401631355286, -0.5180683732032776, 0.32707327604293823, -0.4948425889015198, -0.206822872...
}.DoWork); _yarn.Start(); } } internal class Mate { internal LookupTextEventArgs LookupTextEventArgs = null; internal LookupValuesDelegate LookupValuesDelegate = null; internal PassDataSet PassDataSet = null; object o = new object(); internal void DoWork() { lock (o) { ...
[ -0.22826890647411346, 0.02550968900322914, 0.5089114308357239, -0.17694401741027832, 0.12145785987377167, 0.1166645810008049, 0.47626954317092896, -0.49286362528800964, -0.1042042151093483, -0.39004185795783997, -0.2769912779331207, 0.5359538197517395, -0.28948351740837097, 0.6118040680885...
PassDataSet(ds); } } } ``` ### NOTES The reason for cancelling the previous thread when the user type keys in succession, is not only to prevent the appending of text from happening, but also to cancel the previous network roundtrip, so the program won't be consuming too much memory resulting from successiv...
[ -0.23583507537841797, -0.3067055344581604, 0.5066425800323486, -0.08590230345726013, 0.05738402530550957, -0.2182328701019287, 0.6085332632064819, -0.3270203173160553, -0.1871945708990097, -0.5576589703559875, -0.3971230387687683, 0.43651431798934937, -0.6945491433143616, 0.420947611331939...
set; get; } static int _currentKeyIndex = 0; void DataSetCallback(DataSet ds, int keyIndex) { if (this.InvokeRequired) this.Invoke(new PassDataSet(DataSetCallback), ds, keyIndex); else { // ignore the returned DataSet if (keyIndex < _currentKeyIndex) return; ...
[ 0.0018872497603297234, -0.32293185591697693, 0.575117290019989, -0.2007705271244049, 0.25233569741249084, -0.10412487387657166, 0.5287100076675415, -0.26216644048690796, -0.03258278965950012, -0.47074154019355774, -0.6527321934700012, 0.5904364585876465, -0.6169487237930298, 0.228081256151...
} } private void txt_TextChanged(object sender, EventArgs e) { Interlocked.Increment(ref _currentKeyIndex); var yarn = new Thread( new Mate { KeyIndex = _currentKeyIndex, LookupValuesDelegate = this.LookupValuesDelegate, LookupTextEventArgs =
[ 0.15786375105381012, -0.4075332581996918, 0.7141607403755188, -0.12635894119739532, 0.43696123361587524, 0.1387849599123001, 0.4782505929470062, -0.12304245680570602, -0.40705427527427673, -0.5791433453559875, -0.019347991794347763, 0.5188166499137878, -0.38609084486961365, 0.8323339223861...
new LookupTextEventArgs { RowOffset = offset, Filter = txt.Text }, PassDataSet = this.DataSetCallback }.DoWork); yarn.Start(); } } internal class Mate { internal
[ -0.06805967539548874, -0.45374053716659546, 0.5253326892852783, -0.2189839482307434, 0.13353939354419708, 0.288726270198822, 0.3035120964050293, -0.4760735332965851, -0.2419387847185135, -0.9512578845024109, -0.3386599123477936, 0.3564307689666748, -0.3390086889266968, 0.3447088897228241, ...
int KeyIndex; internal LookupTextEventArgs LookupTextEventArgs = null; internal LookupValuesDelegate LookupValuesDelegate = null; internal PassDataSet PassDataSet = null; object o = new object(); internal void DoWork() { lock (o) { // the actual code that queries the database ...
[ -0.27250799536705017, 0.03881702572107315, 0.642397403717041, -0.10412639379501343, 0.3125588297843933, 0.07404249161481857, 0.4855639636516571, -0.3072676360607147, -0.13246336579322815, -0.33973419666290283, -0.4147511422634125, 0.5967374444007874, -0.1266101896762848, 0.5161795616149902...
not** safe. `Thread.Abort()` is sketchy enough at the best of times, but in this case your control has no (heh) control over what's being done in the delegate callback. You don't know what state the rest of the app will be left in, and may well find yourself in a world of hurt when the time comes to call the delegate a...
[ 0.5686609745025635, -0.12181324511766434, 0.18620693683624268, 0.3014841079711914, 0.31918972730636597, -0.16156001389026642, 0.5445594191551208, -0.21619711816310883, -0.26712900400161743, -0.43743816018104553, -0.4287739396095276, 0.6046042442321777, -0.3021813929080963, 0.04719327017664...
probably don't expect autocomplete anyway. ### Regarding your updated (Abort()-free) code: You're now launching a new thread for (potentially) *every keypress*. This is not only going to kill performance, it's unnecessary - if the user isn't pausing, they probably aren't looking for the control to complete what they'...
[ 0.2884107828140259, -0.1729930192232132, 0.2929662764072418, 0.0012666229158639908, 0.19247078895568848, -0.2744704484939575, 0.4963049292564392, -0.025885306298732758, -0.578533947467804, -0.5754340887069702, -0.10995375365018845, 0.5764445066452026, -0.3354298174381256, 0.000811119854915...
a chance to finish, even with a fast connection to a fast database. But if you delay making the request until a short period of time after the last keystroke has elapsed, then you have a better chance of hitting that sweet spot where the user has typed all they want to (or all they know!) and is *just* starting to wait...
[ 0.21253053843975067, -0.13299286365509033, 0.27469661831855774, 0.24379569292068481, 0.25880134105682373, 0.028219018131494522, 0.32818007469177246, 0.059789638966321945, -0.381427139043808, -0.5635061860084534, -0.010921545326709747, 0.4044795036315918, 0.1762155443429947, -0.095356844365...
get better results with a 2-3 second delay, or even longer. The most important part of this technique though, is that you `reset the timer on every keystroke`. And unless you expect database requests to actually *hang*, don't bother trying to allow multiple concurrent requests. If a request is currently in-progress, ...
[ 0.3493153750896454, -0.3166285753250122, 0.19322103261947632, 0.2701594829559326, 0.12802019715309143, -0.280443012714386, 0.42804187536239624, -0.11744744330644608, -0.7674667239189148, -0.6061617732048035, -0.03167426958680153, 0.47778597474098206, -0.05972588434815407, -0.03386966511607...
Basically like using the out keyword. But the problem is with the out keyword, you still have to declare a variable outside the method call, like: ``` double result; Double.TryParse ( "76", out result ); ``` where as I want something like: ``` Double.TryParse ( "76", out result ); ``` and there I get a new variab...
[ 0.2030511051416397, 0.0706402063369751, 0.26274073123931885, -0.30481502413749695, -0.23657813668251038, -0.05696996673941612, 0.05307302623987198, -0.37563157081604004, -0.2999285161495209, -0.2253943234682083, -0.09942701458930969, 0.4211765229701996, -0.4723123610019684, -0.030925381928...
I'm building a simple accounting app to be used for personal finance. A user might keep track of purchases, upcoming bills, recurring deposits, etc. It will be verrrrry simple. Two questions: 1) Any advice I should keep in mind? Obviously, I'll use transactions where appropriate, but proper datatypes and other consi...
[ 0.47226858139038086, 0.30413511395454407, 0.18783606588840485, 0.2853573262691498, 0.2517567276954651, 0.06633643060922623, 0.19906054437160492, 0.09693710505962372, -0.2665567398071289, -0.5796647071838379, 0.3397061824798584, 0.5265966057777405, 0.018232205882668495, -0.20598460733890533...
of some custom written online accounting software for school related non-profits I have some advice :) * Use standard double entry accounting/bookkeeping (debits and credits) as the basis for your financial engine. You will find this will serve you well when it comes to not only storing data on transactions but also g...
[ 0.36596375703811646, 0.198648601770401, 0.040933575481176376, 0.5044057369232178, 0.1427849978208542, -0.05248134583234787, -0.17324133217334747, -0.06983595341444016, -0.14054065942764282, -0.29121914505958557, 0.1959759145975113, 0.6587911248207092, 0.1497841626405716, -0.048795033246278...
Pulling in bank data would help this process but you will need to provide the user with a method to compare. You can use bank statements for this process. * The bank is always considered to be right. If there is a discrepancy between the bank and the user records... the fault almost always is with the user records. *...
[ 0.2826050817966461, 0.033545706421136856, 0.026723690330982208, 0.2514205276966095, 0.1255316585302353, 0.1521809697151184, -0.07469137758016586, 0.057307638227939606, -0.252175897359848, -0.23102638125419617, 0.27042627334594727, 0.7281164526939392, -0.06278202682733536, -0.04947493225336...
Be prepared to write ALOT of code. Accounting software has been around for years, the list of "standard features" for a typical accounting package has grown, and there are quite a few players in the market. If you are planning on selling this product you will need to provide those standard features and then find some w...
[ 0.7956327795982361, 0.3825860619544983, 0.002876256126910448, 0.1404646933078766, -0.053107745945453644, -0.293741911649704, 0.23409372568130493, -0.23867003619670868, -0.10136698931455612, -0.5449542999267578, 0.3237524926662445, 0.8504042029380798, 0.11924753338098526, -0.153168007731437...
As I started coding my first app I used NSNumber for money values without thinking twice. Then I thought that maybe c types were enough to deal with my values. Yet, I was advised in the iPhone SDK forum to use NSDecimalNumber, because of its excellent rounding capabilities. Not being a mathematician by temperament, I...
[ 0.09394589066505432, -0.033703844994306564, 0.2152445912361145, 0.03342599794268608, -0.3973737359046936, 0.45641061663627625, -0.159662127494812, 0.23479613661766052, -0.4289417564868927, -0.24783849716186523, 0.27420222759246826, 0.4647192656993866, -0.09711205214262009, 0.09106159210205...
is not really viable, for the monetary structure depends greatly on the locale used. I am 90% sure that I need to go with NSDecimalNumber, but since I found no unambiguous answer on the web (something like: "if you deal with money, use NSDecimalNumber!") I thought I'd ask here. Maybe the answer is obvious to most, but...
[ 0.3415146470069885, 0.19345371425151825, 0.1580674797296524, 0.15725500881671906, -0.08161606639623642, -0.009707106277346611, -0.33664438128471375, 0.17399251461029053, -0.5568116903305054, -0.5028389096260071, 0.16394838690757751, 0.5960094332695007, -0.20993313193321228, -0.092251874506...
into NSDecimalNumber, and I've been very impressed with it. IEEE floating point errors when dealing with base-10 math have been irritating me for a while (1 \* (0.5 - 0.4 - 0.1) = -0.00000000000000002776) and NSDecimalNumber does away with them. NSDecimalNumber doesn't just add another few digits of binary floating po...
[ -0.059661865234375, 0.048333629965782166, 0.49891597032546997, -0.08929499983787537, -0.14121906459331512, -0.08266222476959229, 0.18726329505443573, 0.17995098233222961, 0.06816558539867401, -0.6816858649253845, 0.18173377215862274, 0.776536762714386, 0.3032912611961365, 0.152249291539192...
at. The operations are a little more awkward than simple var = 1 + 2 style math, but they're still manageable. If you're worried about allocating all sorts of instances during your math operations, NSDecimal is the C struct equivalent of NSDecimalNumber and there are C functions for doing the exact same math operations...
[ -0.12184154987335205, 0.04320292919874191, 0.40227144956588745, 0.35045963525772095, -0.32296717166900635, 0.30433252453804016, 0.29251810908317566, -0.3009268343448639, -0.3797798156738281, -0.56739741563797, -0.1858215630054474, 0.7156223058700562, 0.05015619099140167, 0.1659758687019348...
number, including the correct decimal separator. The same goes in reverse for its initWithString:locale: method.
[ -0.3459659516811371, 0.25064587593078613, 0.3902258276939392, 0.03981422632932663, -0.11207824945449829, 0.34796571731567383, -0.022951409220695496, -0.18873560428619385, -0.13928213715553284, -0.09168650209903717, -0.43611305952072144, 0.04814146086573601, 0.11612159013748169, 0.068695783...
recently I have been encountering problems with exposing events from .NET to COM. I have been successful with this example (conceptually taken from <http://blogs.msdn.com/andreww/archive/2008/10/13/exposing-events-from-managed-add-in-objects.aspx>): // The delegate type for our custom event. ``` [ComVisible(false)] ...
[ 0.054261647164821625, -0.19895441830158234, 0.3138153851032257, -0.18206000328063965, -0.11381231248378754, -0.006699777208268642, 0.3665372133255005, -0.19150933623313904, -0.1887579709291458, -0.7699441909790039, -0.16251292824745178, 0.516988217830658, -0.24782991409301758, 0.3517992198...
e) { if (SomeEvent != null) { SomeEvent(sender, e); } } } ``` This works fine, because the IAddInEvents interface is defined as **IDispatch**. However, I need to **publish an event source interface which is IUnknown**. I do not have control over the event interface as it co...
[ 0.0013512305449694395, -0.14120063185691833, 0.49016186594963074, -0.06538945436477661, -0.061647456139326096, -0.37655889987945557, 0.3844038248062134, 0.12850870192050934, 0.2251693606376648, -0.7379148006439209, -0.03638137876987457, 0.6253412365913391, -0.34909915924072266, 0.462660521...
to hook to the events, VB environment (where I am trying to sink the events) crashes, so does the VBA environment which the third-party product (ESRI ArcMap) uses. I have been able to (partially) implement **IConnectionPointContainer** interface (which COM uses in the background to handle events) manually, then I am a...
[ 0.145626962184906, -0.26931652426719666, 0.17294670641422272, 0.0325494110584259, -0.11773310601711273, -0.24924391508102417, 0.2743254601955414, -0.0488264374434948, -0.1625053584575653, -0.8083736300468445, 0.0775071457028389, 0.6063751578330994, -0.27467676997184753, 0.01983983255922794...
has a pretty clear stance on this: ["If you are dealing with currency at all, then you should be using NSDecimalNumber."](http://www.cimgf.com/2008/04/23/cocoa-tutorial-dont-be-lazy-with-nsdecimalnumber-like-me/) His article inspired me to look into NSDecimalNumber, and I've been very impressed with it. IEEE floating p...
[ 0.04004933312535286, 0.3296949863433838, 0.37064212560653687, 0.007050825748592615, -0.18582256138324738, -0.11551084369421005, -0.05967595800757408, 0.21307256817817688, -0.3478173613548279, -0.5656276345252991, 0.34677088260650635, 0.6285322904586792, -0.11618451774120331, -0.01197826676...
symbolic math application, so my desire for 30+ decimal digit precision and no weird floating point errors might be an exception, but I think it's worth looking at. The operations are a little more awkward than simple var = 1 + 2 style math, but they're still manageable. If you're worried about allocating all sorts of ...
[ -0.33877864480018616, 0.3144363760948181, 0.1660681515932083, 0.16447697579860687, -0.19732563197612762, 0.5592901706695557, 0.16369348764419556, -0.07672540098428726, -0.4145428240299225, -0.4528031051158905, 0.22685424983501434, 0.22484026849269867, 0.1274942308664322, 0.0950777232646942...
divisions/s on a MacBook Air, 281,555 additions/s, 12,027 divisions/s on an iPhone). As an added bonus, NSDecimalNumber's descriptionWithLocale: method provides a string with a localized version of the number, including the correct decimal separator. The same goes in reverse for its initWithString:locale: method.
[ -0.1631470024585724, -0.15734174847602844, 0.566612958908081, 0.16025413572788239, 0.047880373895168304, 0.38810160756111145, 0.21437273919582367, -0.1048814132809639, -0.40101614594459534, -0.4353621006011963, -0.4289894700050354, 0.10963455587625504, 0.2643264830112457, 0.260940462350845...
Some places state 2GB period. Some places state it depends up the number of nodes. Quite large if your question is "what's the storage capacity of an mnesia database made up of a huge number of `disc_only_copies` tables" - you're largely limited by available disk space. An easier question to answer is what's the maxim...
[ 0.09862664341926575, 0.0868806317448616, 0.1912953406572342, 0.32579299807548523, 0.22107818722724915, -0.04262450337409973, 0.27261465787887573, -0.23222129046916962, -0.6914809942245483, -0.5428978204727173, -0.40103140473365784, 0.2683463990688324, -0.258391797542572, 0.3459057807922363...
store up to 4Gb of data before they run into problems. (*Mnesia doesn't actually crash if you exceed the on-disk size limit - the ram\_copies portion of the table continues running, so you can repair this by deleting data or making other arrangements at runtime*) However if you consider other mnesia features, then the...
[ -0.21280211210250854, 0.11736380308866501, 0.28086140751838684, 0.13781781494617462, 0.09961573779582977, 0.2124965637922287, 0.2114035189151764, -0.08241741359233856, -0.844569981098175, -1.0253702402114868, -0.45699837803840637, 0.42748433351516724, -0.40724432468414307, 0.11008111387491...
this case you can effectively distribute and redistribute the data in your table over a number of primitive tables. These primitive tables can each have their own configuration - say one ram\_copies table and the rest disc\_only\_copies tables. These primitive tables have the same size limits as mentioned earlier and n...
[ -0.00374148809351027, 0.09374625235795975, -0.11054999381303787, 0.3057291507720947, -0.12117360532283783, 0.19985374808311462, 0.18699778616428375, -0.6768143773078918, -0.8542511463165283, -0.9370514750480652, -0.20031023025512695, 0.503812849521637, -0.21999295055866241, 0.3697566092014...
like living on the extreme bleeding edge, you could apply the [mnesiaex](http://code.google.com/p/mnesiaex/) patches to mnesia and store your table data in an external system such as [Amazon S3](http://code.google.com/p/erlaws/) or [Tokyo Cabinet](http://code.google.com/p/tcerl/). In this case the capacity of the table...
[ 0.3173374533653259, -0.2177371233701706, 0.16190706193447113, 0.3344379663467407, -0.0779535323381424, 0.18906225264072418, 0.20454029738903046, -0.4507942199707031, -0.2866247594356537, -0.7224361300468445, -0.2381918877363205, 0.20295360684394836, -0.26465317606925964, 0.2140763998031616...
I have a windows service written in C# that acts as a proxy for a bunch of network devices to the back end database. For testing and also to add a simulation layer to test the back end I would like to have a GUI for the test operator to be able run the simulation. Also for a striped down version to send out as a demo. ...
[ 0.2524605393409729, 0.14660526812076569, 0.1856716126203537, 0.2908751964569092, 0.20726966857910156, -0.19969888031482697, 0.1537821739912033, -0.3179461359977722, -0.033413611352443695, -0.5899641513824463, 0.327095091342926, 0.536649227142334, -0.0886034369468689, -0.06940416246652603, ...
I Running as a Service](https://stackoverflow.com/questions/200163/am-i-running-as-a-service) and [Install a .NET windows service without InstallUtil.exe](https://stackoverflow.com/questions/255056/install-a-net-windows-service-without-installutil-exe/255062#255062) using [this excellent code](http://groups.google.co.u...
[ 0.2321358174085617, 0.04252874478697777, 0.41627591848373413, -0.21770231425762177, -0.1374373435974121, 0.13012894988059998, 0.509993314743042, -0.33559125661849976, -0.15641285479068756, -0.43130195140838623, -0.16561011970043182, 0.2604787051677704, -0.3194538652896881, 0.18737204372882...
static int Main(string[] args) { bool arg_install = false; bool arg_uninstall = false; bool arg_gui = false; bool rethrow = false; try { foreach (string arg in args)
[ 0.056115422397851944, -0.40366071462631226, 0.3674207031726837, -0.6044573187828064, 0.16185589134693146, 0.1709432601928711, 0.7109324336051941, -0.1795879602432251, -0.13648810982704163, -0.041531216353178024, -0.5486500263214111, 0.8087210059165955, -0.7769202589988708, 0.16571427881717...
{ switch (arg) { case "-i": case "-install": arg_install = true; break;
[ 0.32816076278686523, -0.36164236068725586, 0.1622476428747177, -0.29740533232688904, 0.5885435342788696, -0.2522485852241516, 0.5649164915084839, -0.3652302622795105, -0.1884610503911972, -0.1657395213842392, -0.48063144087791443, 0.8745128512382507, -0.4136233627796173, 0.1663020998239517...
case "-u": case "-uninstall": arg_uninstall = true; break; case "-g": case "-gui":
[ -0.5297363996505737, -0.013003627769649029, 0.35975050926208496, -0.12935185432434082, 0.27410998940467834, 0.1909642219543457, 0.5729713439941406, -0.14684857428073883, -0.007711091544479132, -0.2295072227716446, -0.8344777226448059, 0.946404218673706, -0.4442993700504303, -0.197920978069...
arg_gui = true; break; default: Console.Error.WriteLine("Argument not expected: " + arg); break;
[ -0.6332127451896667, 0.057199232280254364, 0.3638690710067749, -0.39706528186798096, 0.3278985619544983, 0.06738969683647156, 0.649025559425354, 0.07521182298660278, 0.042610857635736465, -0.2342361956834793, -0.6804482340812683, 0.781512975692749, -0.40106964111328125, -0.0612969771027565...
} } if (arg_uninstall) { Install(true, args); } if (arg_install) {
[ 0.2535572350025177, -0.23520345985889435, 0.41357412934303284, -0.48268115520477295, 0.40939730405807495, -0.18627092242240906, 0.6108538508415222, -0.28566667437553406, 0.09587235003709793, -0.4041939377784729, -0.5252005457878113, 1.08122718334198, -0.6328877806663513, -0.024247214198112...
Install(false, args); } if (!(arg_install || arg_uninstall)) { if (arg_gui || Environment.UserInteractive || Debugger.IsAttached) { Application.EnableVisualStyles();
[ 0.09238074719905853, -0.06423065811395645, 0.5141668915748596, -0.5083791613578796, 0.4248933494091034, -0.1075926274061203, 0.6242840886116028, -0.35130760073661804, 0.14699766039848328, -0.6906211376190186, -0.6363095045089722, 0.9841275811195374, -0.7451788783073425, -0.2362659275531768...
Application.SetCompatibleTextRenderingDefault(false); Application.Run(new Form1()); } else { rethrow
[ 0.16005487740039825, -0.07008573412895203, 0.6193922758102417, -0.23260916769504547, 0.22939646244049072, -0.09667909890413284, 0.7840505242347717, -0.37982529401779175, 0.00208693346939981, -0.6067385673522949, -0.43171226978302, 0.6151412129402161, -0.3687065839767456, 0.2962449789047241...
= true; // so that windows sees error... ServiceBase[] services = { new Service1() }; ServiceBase.Run(services); rethrow = false; } }
[ 0.250705361366272, -0.007478609215468168, 0.3732185363769531, -0.5835051536560059, 0.08242350816726685, 0.336324006319046, 0.8547864556312561, -0.16417522728443146, -0.10661902278661728, -0.8393771052360535, -0.35702452063560486, 0.5301156640052795, -0.28478941321372986, 0.2799680531024933...
return 0; } catch (Exception ex) { if (rethrow) throw; Console.Error.WriteLine(ex.Message); return -1; } } static
[ -0.16533054411411285, -0.4025711715221405, 0.07442042976617813, -0.29167765378952026, 0.02269853837788105, 0.03220633044838905, 0.42365577816963196, -0.2283652424812317, -0.08198092132806778, -0.11026006191968918, -0.4554921090602875, 0.4261041581630707, -0.31599175930023193, 0.31740725040...
void Install(bool undo, string[] args) { try { Console.WriteLine(undo ? "uninstalling" : "installing"); using (AssemblyInstaller inst = new AssemblyInstaller(typeof(Program).Assembly, args)) { IDictionary state = new Hashtable();
[ 0.2138286530971527, -0.23526126146316528, 0.1249052882194519, -0.4577151834964752, 0.4102005362510681, 0.08523546904325485, 0.6665899753570557, -0.42603662610054016, -0.13414907455444336, -0.4787498116493225, -0.3505154848098755, 0.5763195753097534, -0.6130048036575317, 0.17336338758468628...
inst.UseNewContext = true; try { if (undo) { inst.Uninstall(state);
[ -0.009832496754825115, -0.267264187335968, 0.36746880412101746, -0.25240832567214966, 0.44313499331474304, 0.03757879137992859, 1.0950558185577393, -0.5088624358177185, -0.011268014088273048, -0.4307391047477722, -0.4239659607410431, 0.6081728935241699, -0.3109619617462158, 0.3428762257099...
} else { inst.Install(state); inst.Commit(state);
[ 0.3195900321006775, -0.12655940651893616, -0.16238684952259064, -0.49859893321990967, 0.5137575268745422, -0.20440183579921722, 0.6432673335075378, -0.23229844868183136, 0.04987678676843643, -0.42715349793434143, -0.277727335691452, 1.0200488567352295, -0.4114937484264374, -0.0037306565791...
} } catch { try {
[ -0.24161452054977417, -0.31069526076316833, -0.25530046224594116, 0.13540427386760712, 0.4633196294307709, -0.17438986897468567, 0.17094896733760834, 0.14789752662181854, -0.12888453900814056, -0.3474290370941162, -0.14031226933002472, 0.40052279829978943, -0.44046711921691895, -0.22865346...
inst.Rollback(state); } catch { } throw; } }
[ -0.3448726534843445, -0.4285988211631775, -0.028037693351507187, -0.11692099273204803, -0.06618954986333847, 0.06143208220601082, 0.12840433418750763, -0.03654441609978676, -0.3836982250213623, -0.2417086511850357, -0.3410015106201172, 0.4882412552833557, -0.2757049798965454, 0.18609814345...