text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
logic that encrypts it and decrypts it is abstracted away into an ASP.NET profile provider. This profile provider allows both encrypted profile properties as well as plain text ones. The encrypted property values are stored in exactly the same way the plain text ones are - with the obvious exception that they've been encrypted.
That said, the key will need to be able to be summoned for one of three reasons:
1. The authorized web application, running on an authorized server, needs to encrypt data.
2. Same as #1, but for decrypting the data.
3. Authorized members of our business team need to view | [
-0.1012500524520874,
0.08428464084863663,
0.28955623507499695,
0.41950568556785583,
0.11606447398662567,
-0.2366609126329422,
0.24982208013534546,
-0.3587478697299957,
-0.0842890590429306,
-0.2616365849971771,
-0.32721665501594543,
0.7986821532249451,
0.013728720135986805,
0.02580298855900... | |
the encrypted data.
The way I'm imagining it is that nobody would ever actually know the key - there would be a piece of software controlling the actual encrypting and decrypting of data. That said, the key still needs to come from *somewhere*.
Full disclosure - if you couldn't already tell, I've never done anything like this before, so if I'm completely off base in my perception of how this should work, by all means, let me know.
There only two real solutions for (the technical aspect of) this problem.
Assuming it's only the application itself that needs access the key...
1. Hardware Security | [
0.2798886001110077,
0.27521079778671265,
0.19791607558727264,
0.4541681110858917,
0.39540261030197144,
-0.49200960993766785,
0.3820173442363739,
-0.10648981481790543,
-0.18068140745162964,
0.14956514537334442,
-0.5318163633346558,
0.682021975517273,
0.016023656353354454,
0.0393470115959644... | |
Module (HSM) - usually pretty expensive, and not simple to implement. Can be dedicated appliance (e.g. nCipher) or specific token (e.g. Alladin eToken). And then you still have to define how to handle that hardware...
2. DPAPI (Windows Data Protection API). There are classes for this in System.Security.Cryptography (ProtectedMemory, ProtectedStorage, etc). This hands off key management to the OS - and it handles it well. Used in "USER\_MODE", DPAPI will lock decryption of the key to the single user that encrypted it.
(Without getting too detailed, the user's password is part of the encryption/decryption scheme - and no, changing the password | [
0.2753119468688965,
-0.39170053601264954,
0.32226720452308655,
0.18042297661304474,
0.13939028978347778,
-0.3949378728866577,
0.0731230229139328,
-0.5434820055961609,
-0.0974997878074646,
-0.48834747076034546,
-0.4781856834888458,
0.6143627166748047,
-0.24875134229660034,
-0.30099281668663... | |
does not foul it up.)
ADDED: Best to use DPAPI for protecting your master key, and not encrypting your application's data directly. And don't forget to set strong ACLs on your encrypted key... | [
-0.15021568536758423,
-0.20157094299793243,
0.30637702345848083,
0.12903627753257751,
0.18591411411762238,
-0.4589131772518158,
0.3492577373981476,
-0.3678859770298004,
0.09488732367753983,
-0.38302093744277954,
-0.39513567090034485,
0.5325039625167847,
-0.17262448370456696,
-0.39932432770... | |
How would you describe and promote WCF as a technology to a non-technical client/manager/CEO/etc?
What are competing solutions or ideas that they might bring up(such as those they read about in their magazines touting new technology)?
What is WCF *not* good for that you've seen people try to shoehorn it into?
-Adam
Comparing with .asmx: WCF is the next generation of Microsoft's Web service development platform, which addresses many of the issues with older versions, specifically:
* better interoperation, so you can interoperate with Web services that aren't from Microsoft or that are published on the Internet
* much more flexible, so it's easier and faster | [
0.7968010902404785,
0.023391133174300194,
0.45302459597587585,
0.3143483102321625,
-0.3366933763027191,
-0.20668227970600128,
0.07023634016513824,
-0.18921741843223572,
-0.11321965605020523,
-0.66609126329422,
-0.02526540495455265,
0.3654254972934723,
-0.04935123026371002,
0.03952674940228... | |
for developers to get their jobs done
* easier to configure without changing code, reducing the cost of maintenance significantly
It may be that they raise the question of how it relates to SOA, a "service-oriented architecture". WCF is the Microsoft solution for creating applications that participate in these distributed systems. | [
0.5455579161643982,
-0.017313959077000618,
0.26061147451400757,
0.13623066246509552,
-0.12456613779067993,
-0.3012162148952484,
-0.013746852055191994,
-0.13197331130504608,
-0.32533347606658936,
-0.6176263093948364,
-0.2693866491317749,
0.36133384704589844,
-0.1810261458158493,
0.140021160... | |
I have several wpf pages with update/delete/add buttons. I want to display to the user messages like "successful delete", etc. How can I best implement this so the message is defined in a single place (similar to an asp.net master page) and I can update this message from anywhere?
You may want to consider doing a publish/subscribe ("Observer" pattern) -- define a "status changed" event on a base page, and create a custom control that sets up a delegate and event handler to listen for status updates.
Then you could drop the custom control on any page that inherits from the base, | [
0.5016262531280518,
-0.27856430411338806,
0.43488430976867676,
0.08592686802148819,
-0.028401946648955345,
-0.17631690204143524,
0.23792436718940735,
-0.38760051131248474,
-0.3934895396232605,
-0.6472886204719543,
0.19582615792751312,
0.46167248487472534,
-0.25344884395599365,
0.1421929895... | |
and it would automatically listen for and display status messages whenever the event is fired.
**Edit:** I put together a sample implementation of this pattern and [published a blog post](http://weblogs.asp.net/guystarbuck/archive/2008/10/08/shared-message-area-in-wpf-using-publish-subscribe.aspx) walking through the code. | [
0.5407925248146057,
-0.2912013828754425,
0.27311980724334717,
-0.11036714166402817,
-0.13350136578083038,
-0.4296831786632538,
0.5162143707275391,
-0.15358178317546844,
-0.24573537707328796,
-0.5811919569969177,
-0.004013254307210445,
0.17013415694236755,
-0.41105014085769653,
-0.205604255... | |
I can't be sure if my code is sucking, or if it's just that the browsers haven't caught up with the spec yet.
My goal is to simulate list markers using generated content, so as to get e.g. continuation of the counters from list to list in pure CSS.
So the code below, which I *think* is correct according to [the spec](http://www.w3.org/TR/CSS2/generate.html#markers), is like this:
```css
html {
counter-reset: myCounter;
}
li {
counter-increment: myCounter;
}
li:before {
content: counter(myCounter)". ";
display: marker;
width: 5em;
text-align: right;
marker-offset: 1em;
}
```
```html
<ol>
<li>The<li>
<li>quick</li>
<li>brown</li>
</ol>
<ol>
<li>fox</li>
<li>jumped</li>
<li>over</li>
</ol>
```
But | [
0.18767069280147552,
-0.06856761127710342,
0.5097764730453491,
-0.14570502936840057,
-0.17684495449066162,
0.36139005422592163,
0.08607904613018036,
-0.3853789269924164,
-0.24821242690086365,
-0.7698526382446289,
-0.10095544159412384,
0.2936095893383026,
-0.29081404209136963,
-0.0590243227... | |
this doesn't seem to generate markers, in either FF3, Chrome, or IE8 beta 2, and if I recall correctly not Opera either (although I've since uninstalled Opera).
So, does anyone know if markers are *supposed* to work? Quirksmode.org isn't being its usual helpful self in this regard :(.
Apparently marker was introduced as a value in CSS 2 but did not make it to CSS 2.1 because of lacking browser support.
I suppose that didn’t help its popularity …
Source: <http://de.selfhtml.org/css/eigenschaften/positionierung.htm#display> (German) | [
0.2376367151737213,
-0.042168356478214264,
0.2574630379676819,
-0.09658987075090408,
-0.21480964124202728,
-0.16670243442058563,
0.5070192217826843,
0.11436858773231506,
0.028351543471217155,
-0.5200361609458923,
0.17017531394958496,
0.14011597633361816,
-0.14702850580215454,
-0.1947642415... | |
I've got a number of non-technical users that all share a set of project files. It would be ideal to have them using version control, but I think that both subversion and git are too technical for non-technical office staff.
Is there any distributed source control software that would work well for normal people?
If source control is too technical they can use [Subversion with WebDav](http://svnbook.red-bean.com/en/1.2/svn.webdav.autoversioning.html).
The less technical people will just save files normally from whatever application they use, without worrying/thinking about source control. They get the benefit of auto-versioning without doing anything.
When ever they need more functionality they can learn | [
0.6504893898963928,
0.01402491144835949,
0.17888176441192627,
0.1219296008348465,
-0.0988539606332779,
-0.3822009861469269,
0.0214571300894022,
0.20300297439098358,
-0.4768927991390228,
-0.5274340510368347,
-0.0019520814530551434,
0.8056710362434387,
-0.12026182562112808,
0.081331595778465... | |
to use TortoiseSVN to view diffs, revert to old version that were made automatically for them etc...
From the subversion book :
> Because so many operating systems already have integrated WebDAV clients, the use case for this feature borders on fantastical: imagine an office of ordinary users running Microsoft Windows or Mac OS. Each user “mounts” the Subversion repository, which appears to be an ordinary network folder. They use the shared folder as they always do: open files, edit them, save them. Meanwhile, the server is automatically versioning everything. Any administrator (or knowledgeable user) can still use a Subversion client | [
0.0628117024898529,
-0.1289234310388565,
0.44618627429008484,
0.12406972795724869,
-0.023655449971556664,
-0.100108802318573,
0.3402790129184723,
0.11961700022220612,
-0.6550819873809814,
-0.36733511090278625,
-0.10626477003097534,
0.6238921880722046,
-0.10154298692941666,
0.30116865038871... | |
to search history and retrieve older versions of data. | [
0.19747179746627808,
0.009267566725611687,
-0.018352854996919632,
0.3867499828338623,
0.4175163209438324,
-0.18061061203479767,
-0.1541762501001358,
-0.14500315487384796,
-0.34027567505836487,
-0.48219597339630127,
-0.42003193497657776,
0.28060081601142883,
0.24687862396240234,
0.185987338... | |
I'm using PHP's PDO layer for data access in a project, and I've been reading up on it and seeing that it has good innate support for persistent DB connections. I'm wondering when/if I should use them. Would I see performance benefits in a CRUD-heavy app? Are there downsides to consider, perhaps related to security?
If it matters to you, I'm using MySQL 5.x.
You could use this as a rough "ruleset":
**YES**, use persistent connections, if:
* There are only few applications/users accessing the database, i.e. you will not result in 200 open (but probably idle) connections, because there are 200 different users | [
0.4090239405632019,
0.17945170402526855,
0.2521623373031616,
0.16168338060379028,
-0.2825818359851837,
-0.1347314864397049,
0.1514192819595337,
0.10401555895805359,
-0.3070422410964966,
-0.7613722681999207,
0.3162495493888855,
0.4291518032550812,
-0.13441622257232666,
0.10589896142482758,
... | |
shared on the same host.
* The database is running on another server that you are accessing over the network
* An (one) application accesses the database very often
**NO**, don't use persistent connections, if:
* Your application only needs to access the database 100 times an hour.
* You have many webservers accessing one database server
* You're using Apache in prefork mode. It uses one connection for each child process, which can ramp up fairly quickly. (via @Powerlord in the comments)
Using persistent connections is considerable faster, especially if you are accessing the database over a network. It doesn't make so much difference if the | [
0.42943912744522095,
-0.10042113810777664,
0.28373873233795166,
0.2744640111923218,
0.01122452411800623,
-0.039527762681245804,
0.24290473759174347,
-0.13970951735973358,
-0.44721993803977966,
-0.8964956402778625,
0.003434513695538044,
0.3259485065937042,
-0.0839734822511673,
0.41885244846... | |
database is running on the same machine, but it is still a little bit faster. However - as the name says - the connection is persistent, i.e. it stays open, even if it is not used.
The problem with that is, that in "default configuration", MySQL only allows 1000 parallel "open channels". After that, new connections are refused (You can tweak this setting). So if you have - say - 20 Webservers with each 100 Clients on them, and every one of them has just one page access per hour, simple math will show you that you'll need 2000 parallel connections | [
0.14017930626869202,
0.02084994502365589,
0.3658587634563446,
0.5553020238876343,
0.08782085031270981,
-0.261053204536438,
0.2465875893831253,
0.13808299601078033,
-0.5137104988098145,
-0.5367249846458435,
0.3774504065513611,
0.1936352252960205,
-0.29359951615333557,
0.5141048431396484,
... | |
to the database. That won't work.
Ergo: Only use it for applications with lots of requests. | [
0.3947960138320923,
-0.028992166742682457,
0.0842372477054596,
0.40662744641304016,
0.13927677273750305,
-0.24686560034751892,
0.2917269468307495,
0.20973345637321472,
-0.042511165142059326,
-0.3824062943458557,
-0.08364230394363403,
0.4946899712085724,
-0.40578022599220276,
0.326912909746... | |
Navision 5.0 includes a feature to export to Word or Excel. Is it possible to make this work with OpenOffice.org Writer or Calc instead? If so, what has to be done to set it up?
I have been told by my Navision reseller that the feature works best with Office 2007, and export to Excel 2003 works. No mention of Office 2000 (which is what we mostly have installed currently) or OpenOffice.org. I'm hoping to be able to standardise on OpenOffice.org across the company when 3.0 is released, to avoid the expense of upgrading everyone to Microsoft Office 2007.
I know this | [
-0.08346743136644363,
-0.026589957997202873,
0.5782222747802734,
-0.32714253664016724,
-0.2703040838241577,
0.066902294754982,
0.3363505005836487,
0.15599489212036133,
0.09760605543851852,
-0.8062515258789062,
0.026528747752308846,
0.6987047791481018,
-0.06787998974323273,
0.05693294852972... | |
is an old question, but I'll add the answer just in case anyone comes here:
You can export directly to OpenOffice without customizations. The only thing you need is to go into Tools > Manage Style Sheets... and modify the existing StyleSheets so that they open OpenCalc and OpenWrite instead of Excel and Word.
Note: it's been a while since I last configured it, but I seem to remember that you might need to export and reimport the stylesheets to change the associated program.
It's quite easy, and you can actually keep both options (Export to Excel/Export to OpenCalc) so that users who | [
0.2478243112564087,
-0.08410228043794632,
0.4091678261756897,
-0.06347033381462097,
-0.06121246889233589,
-0.2995132505893707,
0.1972295194864273,
0.1213914155960083,
-0.17336435616016388,
-0.8410935401916504,
-0.12291918694972992,
0.7760648727416992,
-0.20812633633613586,
0.09870719909667... | |
need MS Office can use Excel, while the rest use OpenCalc.
This answer applies to the functionality to export to Word and Excel in Dynamics Nav 5.0 and Nav 5.0SP1. I haven't tried it in Dynamics Nav 2009 (Role Tailored Client). | [
-0.0934843048453331,
0.1259058117866516,
0.7899138927459717,
-0.12418319284915924,
0.237447127699852,
0.19634650647640228,
0.3230316936969757,
-0.09159748256206512,
0.038262829184532166,
-0.7566631436347961,
-0.051584649831056595,
0.5101559162139893,
-0.2060929387807846,
-0.091753520071506... | |
I have some code that creates a fairly large xml DOM and writes it off to a file (up to 50-100MB) . It basically creates the DOM and then calls a toString on it and writes it out with ofstream. Is there a way to get streaming output of the generated dom so that it doesn't create the whole structure in memory all at once and then copy it, etc? I will not modify any node after i create it so it can write it out and free up the memory right away. I could write my own xml class | [
0.3147428035736084,
0.08322574943304062,
0.3240594267845154,
-0.023780928924679756,
-0.043461646884679794,
-0.27922967076301575,
0.05441399663686752,
-0.08439598977565765,
-0.029183536767959595,
-0.5605767965316772,
0.028972474858164787,
0.4676855504512787,
-0.14010214805603027,
0.08345939... | |
that does the xml construction but ... i don't think that's a good idea since i'll probably miss something when it comes down to escaping etc.
Ok, turns out libxml2 has a streaming API:
<http://xmlsoft.org/examples/testWriter.c>
It's a little old style (very C-ish) but you can write your wrapper around it. | [
0.3422466814517975,
0.09915295243263245,
-0.24917545914649963,
0.11310195922851562,
0.019959690049290657,
-0.7252321839332581,
0.343161940574646,
0.18215450644493103,
0.18923303484916687,
-0.4034355878829956,
0.24738052487373352,
0.32632309198379517,
-0.21765916049480438,
-0.05833728983998... | |
When I use Emacs I want to be able to easily display and navigate through a list of files I worked on from not just the current session but from previous sessions. (BTW, running Emacs 22.2 on Windows)
From [Joe Grossberg](http://www.joegrossberg.com/archives/000182.html)'s blog (no longer available):
> But if you're using GNU Emacs 21.2
> (the latest version, which includes
> this as part of the standard distro),
> you can just put the following lines
> into your .emacs file
>
>
>
> ```
> ;; recentf stuff
> (require 'recentf)
> (recentf-mode 1)
> (setq recentf-max-menu-items 25)
> (global-set-key "\C-x\ \C-r" 'recentf-open-files)
>
> ```
>
> Then, | [
0.01010756753385067,
0.44638657569885254,
0.5205938816070557,
-0.08435307443141937,
0.1498962640762329,
0.1053919717669487,
0.3938778340816498,
0.12564712762832642,
-0.33824479579925537,
-0.720660388469696,
-0.19540941715240479,
0.5616207718849182,
-0.40375128388404846,
0.1608436554670334,... | |
when you launch emacs, hit
> `CTRL`-`X` `CTRL`-`R`. It will show a list of
> the recently-opened files in a buffer.
> Move the cursor to a line and press
> `ENTER`. That will open the file in
> question, and move it to the top of
> your recent-file list.
>
>
> (Note: Emacs records file names.
> Therefore, if you move or rename a
> file outside of Emacs, it won't
> automatically update the list. You'll
> have to open the renamed file with the
> normal `CTRL`-`X` `CTRL`-`F` method.)
>
>
> Jayakrishnan Varnam has a [page
> | [
-0.22348807752132416,
0.4028712213039398,
0.18600797653198242,
0.23017646372318268,
0.2598029673099518,
0.1517747938632965,
-0.18714062869548798,
-0.23768091201782227,
-0.28630122542381287,
-0.15760880708694458,
-0.41627055406570435,
0.3815264403820038,
-0.6903295516967773,
0.3231639862060... | |
including screenshots](http://web.archive.org/web/20021114012120/http://varnam.org/e-recentf.html) of how this
> package works.
*Note:* You don't need the `(require 'recentf)` line. | [
0.10881556570529938,
-0.20967763662338257,
0.49469906091690063,
-0.06135818362236023,
0.1619342714548111,
-0.4058651030063629,
-0.059870053082704544,
-0.12567754089832306,
-0.30653029680252075,
-0.5968926548957825,
-0.17426541447639465,
0.5120722651481628,
-0.24136745929718018,
-0.25436851... | |
One of the guys I work with needs a custom control that would work like a multiline ddl since such a thing does not exist as far as we have been able to discover
does anyone have any ideas or have created such a thing before
we have a couple ideas but they involve to much database usage
We prefer that it be FREE!!!
From [this thread](http://bytes.com/forum/thread16212.html), there are different ways to do this:
```
double r = 5.1234;
System.out.println(r); // r is 5.1234
int decimalPlaces = 2;
BigDecimal bd = new BigDecimal(r);
// setScale is immutable
bd = bd.setScale(decimalPlaces, BigDecimal.ROUND_HALF_UP);
r = bd.doubleValue();
System.out.println(r); // r is 5.12
```
---
```
f = | [
0.29042738676071167,
0.007926221005618572,
0.40259966254234314,
0.018672944977879524,
0.02255365438759327,
-0.06283382326364517,
0.26653966307640076,
-0.209238663315773,
-0.572855532169342,
-0.25685879588127136,
-0.17184875905513763,
0.4017082452774048,
-0.37726134061813354,
0.197896897792... | |
(float) (Math.round(n*100.0f)/100.0f);
```
---
```
DecimalFormat df2 = new DecimalFormat( "#,###,###,##0.00" );
double dd = 100.2397;
double dd2dec = new Double(df2.format(dd)).doubleValue();
// The value of dd2dec will be 100.24
```
The [DecimalFormat()](http://docs.oracle.com/javase/7/docs/api/java/text/DecimalFormat.html) seems to be the most dynamic way to do it, and it is also very easy to understand when reading others code. | [
0.275922566652298,
-0.0677391067147255,
0.6761599183082581,
-0.1338682621717453,
-0.15407513082027435,
0.02677166275680065,
-0.11142884939908981,
-0.26265445351600647,
-0.20542839169502258,
-0.21998509764671326,
-0.15813322365283966,
0.40775537490844727,
-0.1237785816192627,
0.148402139544... | |
I have a two dimensional array that I need to load data into. I know the width of the data (22 values) but I do not know the height (estimated around 4000 records, but variable).
I have it declared as follows:
```
float[,] _calibrationSet;
....
int calibrationRow = 0;
While (recordsToRead)
{
for (int i = 0; i < SensorCount; i++)
{
_calibrationSet[calibrationRow, i] = calibrationArrayView.ReadFloat();
}
calibrationRow++;
}
```
This causes a NullReferenceException, so when I try to initialize it like this:
```
_calibrationSet = new float[,];
```
I get an "Array creation must have array | [
0.32379183173179626,
0.016964150592684746,
0.7630482912063599,
-0.22928108274936676,
0.033178675919771194,
0.11173375695943832,
0.23544321954250336,
-0.8338417410850525,
-0.15151235461235046,
-0.49465373158454895,
0.1783272922039032,
0.535254716873169,
-0.19531650841236115,
0.3162049353122... | |
size or array initializer."
Thank you,
Keith
You can't use an array.
Or rather, you would need to pick a size, and if you ended up needing more then you would have to allocate a new, larger, array, copy the data from the old one into the new one, and continue on as before (until you exceed the size of the new one...)
Generally, you would go with one of the collection classes - ArrayList, List<>, LinkedList<>, etc. - which one depends a lot on what you're looking for; List will give you the closest thing to what i described initially, while LinkedList<> will avoid | [
0.26430365443229675,
-0.4150930941104889,
-0.05952116847038269,
0.14360985159873962,
-0.04293981194496155,
0.18027552962303162,
-0.2795918881893158,
-0.40475577116012573,
-0.5816376209259033,
-0.6223117113113403,
0.03524074703454971,
0.5070297122001648,
-0.23337532579898834,
0.034292623400... | |
the problem of frequent re-allocations (at the cost of slower access and greater memory usage).
Example:
```
List<float[]> _calibrationSet = new List<float[]>();
// ...
while (recordsToRead)
{
float[] record = new float[SensorCount];
for (int i = 0; i < SensorCount; i++)
{
record[i] = calibrationArrayView.ReadFloat();
}
_calibrationSet.Add(record);
}
// access later: _calibrationSet[record][sensor]
```
Oh, and it's worth noting (as [Grauenwolf](https://stackoverflow.com/questions/50558/how-do-you-initialize-a-2-dimensional-array-when-you-do-not-know-the-size#50591) did), that what i'm doing here doesn't give you the same memory structure as a single, multi-dimensional array would - under the hood, it's an array of | [
0.3090273141860962,
-0.139297217130661,
0.4064268171787262,
0.05592808872461319,
-0.03153279051184654,
0.018679006025195122,
0.3236205279827118,
-0.7150347828865051,
-0.44299405813217163,
-0.4741480350494385,
0.1343408077955246,
0.7000014185905457,
-0.00003309264138806611,
-0.0384897366166... | |
references to other arrays that actually hold the data. This speeds up building the array a good deal by making reallocation cheaper, but can have an impact on access speed (and, of course, memory usage). Whether this is an issue for you depends a lot on what you'll be doing with the data after it's loaded... and whether there are two hundred records or two million records. | [
0.44509217143058777,
0.17935819923877716,
0.33822354674339294,
0.6497377753257751,
-0.028318461030721664,
0.13612224161624908,
-0.030570684000849724,
-0.004869972355663776,
-0.6541207432746887,
-0.6487749218940735,
0.2535055875778198,
0.5998079180717468,
0.00991923175752163,
-0.02502108551... | |
How do you capture the mouse events, move and click over top of a Shockwave Director Object (not flash) in Firefox, via JavaScript. The code works in IE but not in FF.
The script works on the document body of both IE and Moz, but mouse events do not fire when mouse is over a shockwave director object embed.
Update:
```
function displaycoordIE(){
window.status=event.clientX+" : " + event.clientY;
}
function displaycoordNS(e){
window.status=e.clientX+" : " + e.clientY;
}
function displaycoordMoz(e)
{ | [
0.09992682933807373,
-0.40257546305656433,
0.5946950316429138,
0.0695120245218277,
0.24552494287490845,
-0.2730068862438202,
0.0629316195845604,
-0.37877607345581055,
-0.1177423819899559,
-0.7011829614639282,
-0.20732083916664124,
0.8086585402488708,
-0.24747905135154724,
-0.35137838125228... | |
window.alert(e.clientX+" : " + e.clientY);
}
document.onmousemove = displaycoordIE;
document.onmousemove = displaycoordNS;
document.onclick = displaycoordMoz;
```
---
Just a side note, I have also tried using an addEventListener to "mousemove".
You could also catch the mouse event within Director (That never fails) and then call your JS functions from there, using gotoNetPage "javascript:function('" & argument & "')"
ej:
```
on mouseDown me
gotoNetPage "javascript:function('" & argument & "')"
end
```
The mouse move detection is a little bit trickier, as there is no such an event in lingo, but you can use:
```
property pMouseLock
on beginsprite
pMouseLock = _mouse.mouseLock
end
on exitFrame | [
-0.36733803153038025,
-0.1500360518693924,
0.6547406911849976,
-0.23321180045604706,
0.21962030231952667,
-0.30245086550712585,
0.5059614777565002,
-0.2137550711631775,
-0.08861416578292847,
-0.7814733982086182,
-0.30124154686927795,
0.7279041409492493,
-0.20448008179664612,
0.100798524916... | |
if _mouse.mouseLock <> pMouseLock then
gotoNetPage "javascript:function('" & argument & "')"
pMouseLock = _mouse.mouseLock
end if
end
```
regards | [
-0.2234811931848526,
0.14011259377002716,
0.9208297729492188,
-0.03712473437190056,
0.4084717631340027,
-0.0743616372346878,
0.3921619951725006,
-0.37669411301612854,
0.008138008415699005,
-0.38364219665527344,
-0.26635539531707764,
0.6773475408554077,
-0.2746030390262604,
0.00896824616938... | |
Suppose I have the following C code.
```
unsigned int u = 1234;
int i = -5678;
unsigned int result = u + i;
```
What implicit conversions are going on here, and is this code safe for all values of `u` and `i`? (Safe, in the sense that even though *result* in this example will overflow to some huge positive number, I could cast it back to an *int* and get the real result.)
**Short Answer**
Your `i` will be *converted* to an unsigned integer by adding `UINT_MAX + 1`, then the addition will be carried out with the unsigned values, resulting in a large `result` (depending | [
0.14000144600868225,
0.2666459083557129,
0.38051751255989075,
-0.3012959361076355,
0.15470896661281586,
0.14034906029701233,
0.2349732369184494,
-0.5433503985404968,
-0.04895786941051483,
-0.5956240892410278,
0.0274607352912426,
0.5251567959785461,
-0.17871829867362976,
-0.0187100693583488... | |
on the values of `u` and `i`).
**Long Answer**
According to the C99 Standard:
> 6.3.1.8 Usual arithmetic conversions
>
>
> 1. If both operands have the same type, then no further conversion is needed.
> 2. Otherwise, if both operands have signed integer types or both have unsigned integer types, the operand with the type of lesser integer conversion rank is converted to the type of the operand with greater rank.
> 3. Otherwise, if the operand that has unsigned integer type has rank greater or equal to the rank of the type of the other operand, then the operand with signed integer type | [
-0.2874748706817627,
-0.02787178009748459,
0.37916043400764465,
-0.25780537724494934,
0.04050092026591301,
0.054221075028181076,
0.25274696946144104,
-0.670920729637146,
0.18218296766281128,
-0.6366468071937561,
-0.5220435857772827,
0.5071175694465637,
-0.1575666218996048,
0.13946978747844... | |
is converted to the type of the operand with unsigned integer type.
> 4. Otherwise, if the type of the operand with signed integer type can represent all of the values of the type of the operand with unsigned integer type, then the operand with unsigned integer type is converted to the type of the operand with signed integer type.
> 5. Otherwise, both operands are converted to the unsigned integer type corresponding to the type of the operand with signed integer type.
In your case, we have one unsigned int (`u`) and signed int (`i`). Referring to (3) above, since both operands | [
-0.34345561265945435,
-0.013164159841835499,
0.1903933733701706,
-0.28241580724716187,
-0.1411503553390503,
0.2640465795993805,
0.2034396082162857,
-0.49600714445114136,
0.13757069408893585,
-0.8399279713630676,
-0.1629922091960907,
0.4536442458629608,
-0.3665511906147003,
0.31432405114173... | |
have the same rank, your `i` will need to be *converted* to an unsigned integer.
> 6.3.1.3 Signed and unsigned integers
>
>
> 1. When a value with integer type is converted to another integer type other than \_Bool, if the value can be represented by the new type, it is unchanged.
> 2. Otherwise, if the new type is unsigned, the value is converted by repeatedly adding or subtracting one more than the maximum value that can be represented in the new type until the value is in the range of the new type.
> 3. Otherwise, the new type is signed | [
0.06756287068128586,
0.002826922805979848,
0.48134592175483704,
-0.34625834226608276,
-0.040440965443849564,
0.04456794261932373,
0.353048175573349,
-0.4624919593334198,
-0.16106504201889038,
-0.7186152935028076,
-0.20648373663425446,
0.4601476192474365,
-0.2946997582912445,
0.249298632144... | |
and the value cannot be represented in it; either the result is implementation-defined or an implementation-defined signal is raised.
Now we need to refer to (2) above. Your `i` will be converted to an unsigned value by adding `UINT_MAX + 1`. So the result will depend on how `UINT_MAX` is defined on your implementation. It will be large, but it will not overflow, because:
> 6.2.5 (9)
>
>
> A computation involving unsigned operands can never overflow, because a result that cannot be represented by the resulting unsigned integer type is reduced modulo the number that is one greater than the largest | [
0.03503395989537239,
0.010630090720951557,
0.4311875104904175,
-0.1846684217453003,
0.24024496972560883,
0.0021538175642490387,
0.0682331845164299,
-0.38254883885383606,
-0.1988246589899063,
-0.5758050084114075,
-0.16106919944286346,
0.4459940493106842,
-0.30566638708114624,
0.003467444097... | |
value that can be represented by the resulting type.
**Bonus: Arithmetic Conversion Semi-WTF**
```
#include <stdio.h>
int main(void)
{
unsigned int plus_one = 1;
int minus_one = -1;
if(plus_one < minus_one)
printf("1 < -1");
else
printf("boring");
return 0;
}
```
You can use this link to try this online: [https://repl.it/repls/QuickWhimsicalBytes](http://codepad.org/yPhYCMFO)
**Bonus: Arithmetic Conversion Side Effect**
Arithmetic conversion rules can be used to get the value of `UINT_MAX` by initializing an unsigned value to `-1`, ie:
```
unsigned int umax = -1; // umax set to UINT_MAX
```
This is guaranteed to be portable regardless of the signed number representation of the system because | [
0.34674718976020813,
-0.20490367710590363,
0.38420432806015015,
-0.121942900121212,
-0.15407808125019073,
0.036152735352516174,
0.029529055580496788,
-0.32213523983955383,
-0.3792775571346283,
-0.4542437493801117,
-0.21128445863723755,
0.6632222533226013,
-0.13337916135787964,
0.0202969666... | |
of the conversion rules described above. See this SO question for more information: [Is it safe to use -1 to set all bits to true?](https://stackoverflow.com/questions/809227/is-it-safe-to-use-1-to-set-all-bits-to-true) | [
0.2885306775569916,
0.004160559736192226,
-0.06748180836439133,
0.19019611179828644,
0.28083357214927673,
-0.3587644398212433,
0.5314620137214661,
-0.3973199427127838,
-0.18182499706745148,
0.08880769461393356,
-0.24560266733169556,
0.6890183687210083,
-0.4162716567516327,
-0.5681395530700... | |
Syntax aside, what is the difference between
```
try {
}
catch() {
}
finally {
x = 3;
}
```
and
```
try {
}
catch() {
}
x = 3;
```
edit: in .NET 2.0?
---
so
```
try {
throw something maybe
x = 3
}
catch (...) {
x = 3
}
```
is behaviourally equivalent?
Depends on the language as there might be some slight semantic differences, but the idea is that it will execute (almost) always, even if the code in the try block threw an exception.
In the second example, if the code in the catch block returns or quits, the x = 3 will not be executed. | [
0.4402015209197998,
-0.2513226270675659,
0.02334475889801979,
-0.2193719446659088,
-0.33442187309265137,
-0.25219735503196716,
0.38091251254081726,
0.007698421832174063,
-0.32641565799713135,
-0.5333536863327026,
-0.19529277086257935,
0.4571056365966797,
-0.42872241139411926,
-0.1762913316... | |
In the first it will.
In the .NET platform, in some cases the execution of the finally block won't occur:
Security Exceptions, Thread suspensions, Computer shut down :), etc. | [
0.14015257358551025,
-0.4764533042907715,
0.22227582335472107,
0.1179504543542862,
-0.1532694548368454,
-0.4137129485607147,
0.33910059928894043,
-0.07858919352293015,
-0.16253900527954102,
-0.5977372527122498,
-0.30773988366127014,
0.09579566866159439,
-0.6131183505058289,
0.1129813268780... | |
Is there a way to have TortoiseSVN (or any other tool) auto-add any new .cs files I create within a directory to my working copy so I don't have to remember which files I created at the end of the day?
I would probably make a batch file, something like this (untested):
```
dir /b /S *.cs > allcsfiles.txt
svn add --targets allcsfiles.txt
```
I believe svn won't mind you trying to add files which are already versioned..
Anyway, that's probably about as automatic as you will easily get. | [
0.37637269496917725,
0.2990874648094177,
0.37191838026046753,
-0.14262095093727112,
0.0334136001765728,
-0.08004248142242432,
0.26154860854148865,
0.07963112741708755,
-0.5546355843544006,
-0.4592779874801636,
-0.04355562478303909,
0.797760546207428,
-0.17792384326457977,
0.097403965890407... | |
I need to programmatically determine out how many sectors, heads, and cylinders are on a physical disk from Windows XP. Does anyone know the API for determining this? Where might Windows expose this information?
Use [DeviceIoControl](http://msdn.microsoft.com/en-us/library/aa363216%28VS.85%29.aspx) with control code [IOCTL\_DISK\_GET\_DRIVE\_GEOMETRY](http://msdn.microsoft.com/en-us/library/aa365169%28VS.85%29.aspx) or [IOCTL\_DISK\_GET\_DRIVE\_GEOMETRY\_EX](http://msdn.microsoft.com/en-us/library/aa365171%28VS.85%29.aspx).
There's sample code in MSDN to do this [here](http://msdn.microsoft.com/en-us/library/aa363147%28VS.85%29.aspx). | [
0.18312621116638184,
0.35530927777290344,
0.549814760684967,
0.3273964524269104,
0.49588510394096375,
-0.0330064594745636,
-0.34214311838150024,
-0.2260226458311081,
-0.28105005621910095,
-0.6940375566482544,
-0.12248051166534424,
0.4961532652378082,
0.0016432134434580803,
0.19647486507892... | |
In my work environment, Visual Studio currently crashes every time I start our main project unless I delete the .suo (solution options) and .ncb (C++ Intellisense symbols) files.
Obviously, I've found a workaround. Is there a more permanent solution than this?
Have you installed Visual Studio 2005 Service Pack 1? | [
0.08155646175146103,
0.11130963265895844,
0.12023764103651047,
-0.07534780353307724,
-0.06445896625518799,
-0.2651749551296234,
0.33926868438720703,
0.05122056603431702,
-0.307766318321228,
-0.41668227314949036,
-0.236448273062706,
0.518310010433197,
-0.32141169905662537,
-0.19737745821475... | |
My drupal site (internal) will not display the TinyMCE editor when using Google Chrome browser. Has anyone gotten TinyMCE to work with Chrome in Drupal 5?
Just Refresh the edit page and the editor will render in Chrome. | [
0.11225118488073349,
0.13913296163082123,
0.7021499872207642,
-0.05867655202746391,
-0.09068901836872101,
-0.14198602735996246,
0.23331964015960693,
0.3189865052700043,
-0.08009420335292816,
-0.8718904852867126,
-0.013801884837448597,
0.6425239443778992,
-0.25758758187294006,
0.26009121537... | |
First off, there's a bit of background to this issue available on my blog:
* <http://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html>
* <http://www.codebork.com/coding/2008/07/31/message-passing-2.html>
I'm aware that the descriptions aren't hugely clear, so I'll try to summarise what I'm attempting as best I can here. The application is a personal finance program. Further background on the framework itself is available at the end of this post.
There are a number of different types of plug-in that the framework can handle (e.g., accounts, export, reporting, etc.). However, I'm focussing on one particular class of plug-in, so-called data plug-ins, as it is this class that is causing me problems. I have one | [
0.5468392968177795,
0.2944154441356659,
-0.13040928542613983,
0.060900136828422546,
-0.3152630031108856,
-0.18105866014957428,
0.0700346827507019,
-0.050721339881420135,
-0.160392627120018,
-0.6578826308250427,
0.1835675835609436,
0.5756667256355286,
-0.2956821918487549,
-0.086733110249042... | |
class of data plug-in for accounts, one for transactions, etc.
I'm midway through a vast re-factoring that has left me with the following architecture for data plug-ins:
* The data plug-in object (implementing intialisation, installation and plug-in metadata) [implements `IDataPlugin<FactoryType>`]
* The data object (such as an account) [implements, e.g., `IAccount`]
* A factory to create instances of the data object [implements, e.g., `IAccountFactory`]
Previously the data object and the plug-in object were combined into one, but this meant that a new transaction plug-in had to be instantiated for each transaction recorded in the account which caused a number of problems. Unfortunately, that re-factoring has | [
0.1214420348405838,
0.16505441069602966,
-0.038046129047870636,
0.06705660372972488,
-0.04322178661823273,
0.1681174486875534,
-0.03672192990779877,
-0.18277619779109955,
-0.14604590833187103,
-0.5813965201377869,
-0.09486155211925507,
0.468333899974823,
-0.39960217475891113,
0.24444651603... | |
broken my message passing. The data object implements `INotifyPropertyChanged`, and so I've hit a new problem, and one that I'm not sure how to work around: the plug-in object is registering events with the message broker, but it's the data objects that actually fire the events. This means that **the subscribing plug-in currently has to subscribe to each created account, transaction, etc.!** This is clearly not scalable.
As far as I can tell at the moment I have two possible solutions:
1. Make the data plug-in object a go-between for the data-objects and message broker, possibly batching change notifications. I don't | [
0.27373412251472473,
0.18554623425006866,
0.4431695342063904,
0.08061864227056503,
-0.1525692641735077,
-0.10013365000486374,
0.5803319215774536,
0.10056204348802567,
-0.3685191571712494,
-0.32690703868865967,
0.027736667543649673,
0.43821537494659424,
-0.4423535466194153,
0.31144338846206... | |
like this because it adds another layer of complexity to the messaging system that I feel I should be able to do without.
2. Junk the current event-based implementation and use something else that's more easily manageable (in-memory WCF?!).
So I guess I'm really asking:
1. How would you solve this problem?
2. What potential solutions do you think I've overlooked?
3. Is my approach even vaguely on-track/sensible?! :-)
As you will be able to tell from the dates of the blog posts, some variant of this problem has been taxing me for quite a long time now! As such, any and all responses will | [
0.10771505534648895,
0.009254653006792068,
0.1678859144449234,
0.17694035172462463,
-0.06937287747859955,
-0.2418750822544098,
0.518552303314209,
-0.031645119190216064,
-0.2006032019853592,
-0.5068293809890747,
0.17184078693389893,
0.32525038719177246,
-0.33949726819992065,
-0.148531094193... | |
be greatly appreciated.
The background to the framework itself is as follows:
> My plug-in framework consists of three main components: a plug-in broker, a preferences manager and a message broker. The plug-in broker does the bread-and-butter plug-in stuff: discovering and creating plug-ins. The preferences manager manages user preferences for the framework and individual plug-ins, such as which plug-ins are enabled, where data should be saved, etc. Communication is via publish/subscribe, with the message broker sitting in the middle, gathering all published message types and managing subscriptions. The publish/subscribe is currently implemented via the .NET `INotifyPropertyChanged` interface, which provides one | [
0.4130604863166809,
0.1688190996646881,
0.5104110240936279,
-0.09430624544620514,
-0.21152615547180176,
0.1419016569852829,
-0.26963329315185547,
-0.04924626275897026,
0.232383593916893,
-0.8114922046661377,
-0.15600545704364777,
0.44237020611763,
-0.11212679743766785,
-0.02662151865661144... | |
event called `PropertyChanged`; the message broker builds a list of all plug-ins implementing `INotifyPropertyChanged` and subscribes other plug-ins this event. The purpose of the message passing is to allow the account and transaction plug-ins to notify the storage plug-ins that data has changed so that it may be saved.
This is my understanding of your question: You have a plugin object that may have to listen for events on x data objects - you don't want to subscribe to the event on each data object though. I'm assuming that several plugins may want to listen to events on the same data | [
0.3580014407634735,
-0.19837643206119537,
0.38037794828414917,
0.09842037409543991,
-0.042603153735399246,
-0.32584309577941895,
0.19823113083839417,
0.08864342421293259,
-0.32821714878082275,
-0.35814327001571655,
0.06373822689056396,
0.6610905528068542,
-0.335416316986084,
-0.03476527333... | |
object.
You could create a session type object. Each plugin listens for events on the session object. The data object no longer raises the event - it calls the session object to raise the event (one of the parameters would have to be the data object raising the event).
That means that your plugins only have to subscribe to one event, but they get the event from all data objects.
On the other hand, if only one plugin will ever listen to a data object at a time, why not just have the data object call the plugin directly? | [
0.2977604269981384,
-0.1123429462313652,
0.3203010559082031,
0.18522310256958008,
-0.42042264342308044,
-0.11607248336076736,
0.31159061193466187,
-0.10178434103727341,
-0.32954680919647217,
-0.39950186014175415,
-0.1895880252122879,
0.9089875817298889,
-0.4986360967159271,
0.1101316958665... | |
I wrote a simple tool to generate a DBUnit XML dataset using queries that the user enters. I want to include each query entered in the XML as a comment, but the DBUnit API to generate the XML file doesn't support inserting the comment where I would like it (above the data it generates), so I am resorting to putting the comment with ALL queries either at the top or bottom.
So my question: is it valid XML to place it at either location? For example, above the XML Declaration:
```
<!-- Queries used: ... -->
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
...
</dataset>
```
Or below the root | [
0.2594817578792572,
0.27307644486427307,
0.2476041615009308,
-0.16726841032505035,
-0.1391541063785553,
0.1143798679113388,
0.021292489022016525,
-0.2138155698776245,
0.12243430316448212,
-0.6211775541305542,
-0.1517978310585022,
0.16037467122077942,
-0.4162449836730957,
0.1902920752763748... | |
node:
```
<?xml version='1.0' encoding='UTF-8'?>
<dataset>
...
</dataset>
<!-- Queries used: ... -->
```
I plan to initially try above the XML Declaration, but I have doubts on if that is valid XML, despite the claim from [wikipedia](http://en.wikipedia.org/wiki/Xml#Well-formed_documents:_XML_syntax):
> Comments can be placed anywhere in the tree, including in the text if the content of the element is text or #PCDATA.
I plan to post back if this works, but it would be nice to know if it is an official XML standard.
**UPDATE:** See [my response below](https://stackoverflow.com/questions/50824/can-xml-comments-go-anywhere#50976) for the result of my test.
According to the [XML specification](http://www.w3.org/TR/2006/REC-xml-20060816/#sec-comments), a well-formed XML document is:
> `document ::= prolog element Misc*`
where `prolog` | [
-0.31256967782974243,
0.15573805570602417,
0.46872520446777344,
0.010968695394694805,
0.12382251769304276,
-0.03258751705288887,
0.38210830092430115,
-0.13241976499557495,
-0.1692974865436554,
-0.747423529624939,
-0.4165613651275635,
0.2211720198392868,
-0.06276097148656845,
-0.18883755803... | |
is
> `prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?`
and `Misc` is
> `Misc ::= Comment | PI | S`
and
> `XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'`
which means that, if you want to have comments at the top, you cannot have an XML type declaration.
You can, however, have comments after the declaration and outside the document element, either at the top or the bottom of the document, because `Misc*` can contain comments.
The specification agrees with Wikipedia on comments:
> 2.5 Comments
>
>
> [Definition: Comments may appear anywhere in a document outside other markup; in addition, they may appear within the document type | [
-0.19878093898296356,
0.15686100721359253,
0.6133402585983276,
-0.07518083602190018,
-0.07673224061727524,
0.008891758508980274,
-0.014325271360576153,
-0.2284548580646515,
-0.013102945871651173,
-0.7108439803123474,
-0.6309165954589844,
0.33765873312950134,
-0.3471260070800781,
-0.0550192... | |
declaration at places allowed by the grammar. They are not part of the document's character data; an XML processor MAY, but need not, make it possible for an application to retrieve the text of comments. For compatibility, the string "--" (double-hyphen) MUST NOT occur within comments.] Parameter entity references MUST NOT be recognized within comments.
All of this together means that you can put comments **anywhere that's not inside other markup**, except that you **cannot have an XML declaration if you lead with a comment**.
However, while in theory theory agrees with practice, in practice it doesn't, so I'd be curious to | [
0.2957856357097626,
0.18419599533081055,
0.3699871003627777,
0.10117517411708832,
-0.2605254352092743,
-0.501253604888916,
0.21258732676506042,
-0.2449738085269928,
-0.2151394486427307,
-0.617713987827301,
-0.5232247114181519,
0.3724709451198578,
-0.004904908128082752,
0.028874674811959267... | |
see how your experiment works out. | [
0.5837449431419373,
0.11446866393089294,
-0.2805902361869812,
0.0887780413031578,
0.0494406558573246,
-0.4337926506996155,
0.2341948300600052,
0.3829392194747925,
0.11009664833545685,
-0.27164897322654724,
0.21440820395946503,
0.0971163734793663,
0.08150266855955124,
-0.0024375373031944036... | |
Any ideas what the average user's download speed is? I'm working on a site that streams video and am trying to figure out what an average download speed as to determine quality.
I know i might be comparing apples with oranges but I'm just looking for something to get a basis for where to start.
[Speedtest.net](http://speedtest.net/global.php) has a lot of stats broken down by country, region, city and ISP. Not sure about accuracy, since it's only based on the people using their "bandwidth measurement" service. | [
0.25436490774154663,
-0.18132144212722778,
0.34961339831352234,
0.5630523562431335,
-0.04587889090180397,
0.14996904134750366,
0.12374025583267212,
0.9378038048744202,
-0.5845738649368286,
-0.7632479071617126,
0.19629396498203278,
0.3064616024494171,
0.22617508471012115,
0.1399893313646316... | |
I'm using [Helicon's ISAPI Rewrite 3](http://www.helicontech.com/isapi_rewrite/), which basically enables .htaccess in IIS. I need to redirect a non-www URL to the www version, i.e. example.com should redirect to www.example.com. I used the following rule from the examples but it affects subdomains:
```
RewriteCond %{HTTPS} (on)?
RewriteCond %{HTTP:Host} ^(?!www\.)(.+)$ [NC]
RewriteCond %{REQUEST_URI} (.+)
RewriteRule .? http(?%1s)://www.%2%3 [R=301,L]
```
This works for most part, but is also redirect sub.example.com to www.sub.example.com. How can I rewrite the above rule so that subdomains do not get redirected?
Append the following RewriteCond:
```
RewriteCond %{HTTP:Host} ^[^.]+\.[a-z]{2,5}$ [NC]
```
That way it'll only apply the rule to nondottedsomething.uptofiveletters as you can see, subdomain.domain.com will not match the condition | [
0.00681533757597208,
0.006703116465359926,
0.9016250967979431,
-0.12857119739055634,
-0.0834321677684784,
-0.29534912109375,
0.7626746892929077,
-0.16358733177185059,
-0.3486677408218384,
-0.8513915538787842,
-0.12902456521987915,
0.39309272170066833,
-0.32576337456703186,
0.47535386681556... | |
and thus will not be rewritten.
You can change [a-z]{2,5} for a stricter tld matching regex, as well as placing all the constraints for allowed chars in domain names (as [^.]+ is more permissive than strictly necessary).
All in all I think in this case that wouldn't be necessary.
EDIT: sadie spotted a flaw on the regex, changed the first part of it from [^.] to [^.]+ | [
0.3188703656196594,
-0.2126777321100235,
0.365776926279068,
-0.15326625108718872,
-0.02442660555243492,
0.1905892938375473,
0.5027090311050415,
-0.02515845000743866,
-0.05330266058444977,
-0.09308116137981415,
-0.052260156720876694,
0.47743353247642517,
-0.4398304224014282,
0.0824720412492... | |
I'm a C# developer who's fumbling in the first VB code he's written since VB6, so if I am asking a rather obvious question, please forgive me.
I decided to experiment with XML Literals to generate some XML code for me, instead of using XMLDocument
I have 2 questions, the second regarding a workaround due to my inability to figure out the first.
1: Ideal solution
I have a Dictionary of ElementName, ElementValue whose KeyValue pairs I was looping over in the hope of generating the values dynamically, but the following syntax dies a horrible death
```
Dim xConnections As XElement | [
0.20357811450958252,
0.2732756435871124,
0.29509788751602173,
-0.11194422096014023,
0.03392825275659561,
-0.05804919824004173,
0.2175632268190384,
-0.19006489217281342,
0.228984072804451,
-0.5459100604057312,
0.017207112163305283,
0.4179480969905853,
-0.4582451581954956,
0.1086374670267105... | |
For Each connection As Connection In connections.AsList
For Each kvp As KeyValuePair(Of String, String) In connection.DecompiledElements
xConnections = <Connections> <<%= kvp.Key %>><%= kvp.Value %><\<%=kvp.Key %>> </Connections>
Next
Next
```
I have vague memories of the T4 syntax (the <%=%> syntax) being able to handle more complex operations (rather than direct assignment to the <%= ) and a 'Response.Write' like object to write output to, but I can't remember the details.
2: Cludgy workaround
Instead I thought of building a StringBuilder object and assigning its .ToString to the XElement, but | [
-0.22463667392730713,
-0.232562854886055,
0.5961658358573914,
-0.019140804186463356,
-0.2626117467880249,
0.0021627696696668863,
0.23212012648582458,
-0.2981906533241272,
-0.35135146975517273,
-0.5502182841300964,
-0.2044920027256012,
0.4040226936340332,
-0.3458594083786011,
0.420424550771... | |
that also failed with a conversion error.
I would prefer to continue using my key value pair concept in example one above, as I feel cludging together a string as in example 2 above is rather nasty, and I really should go back to using XMLDocument if instead.
Any thoughts or assistance greatly appreciated
If I understand correctly what you are trying to do, you can use the StringBuilder. Use the StringBuilder.Append method and append the XmlElement 'OuterXml' property.
For example:
sb.Append(xmlElement.OuterXml) | [
0.41905757784843445,
-0.21966779232025146,
0.26549962162971497,
-0.1475982367992401,
-0.284965842962265,
-0.15498073399066925,
0.3412531912326813,
-0.35742536187171936,
-0.14671988785266876,
-0.6797451972961426,
-0.024034779518842697,
0.4879891872406006,
-0.5644960999488831,
-0.09213194996... | |
I am working on designing and building a desktop application. I am thinking about using eclipse or netbeans for the base of this application. However, I have never built on either of these platforms. I am personally leaning to using netbeans because it seams like that platform is an easer learning curve. But, I wanted to ask people that have actually build on these platforms before which one is easier to use?
My personal definition of easer is as follows:
* Easy to get started with
* Consistent and logical API
* Good documentation
* Easy to build and deploy
Thanks very much,
Josh
I can't say enough | [
0.2933495342731476,
0.32525017857551575,
0.15256361663341522,
0.14160442352294922,
-0.1409376859664917,
-0.08751305937767029,
-0.1434379667043686,
0.2041965126991272,
0.03526400029659271,
-0.9193008542060852,
0.23756162822246552,
0.7836620807647705,
-0.04274778440594673,
-0.252837568521499... | |
about the Eclipse RCP platform. I would recommend it for any Java desktop app development.
It's free, has great tutorials, and allows cross-platform development of rich desktop applications that use native OS windowing toolkit, meaning that your application will look native in any platform. It also has a clean API that stays out of your way, and makes deploying to any platform a piece of cake.
If your interested check out this book: [http://www.amazon.com/Eclipse-Rich-Client-Platform-Applications/dp/0321334612](https://rads.stackoverflow.com/amzn/click/com/0321334612) | [
0.7399066686630249,
-0.016891777515411377,
-0.10194291919469833,
0.0860406681895256,
-0.21415895223617554,
-0.5236455202102661,
0.17383578419685364,
0.024607554078102112,
-0.3080104887485504,
-0.36636751890182495,
-0.17760038375854492,
0.574465811252594,
0.07801251858472824,
-0.05431229993... | |
One of the things I miss the most in ActionScript is the lack of operator overloading, in particular ==. I kind of work around this issue by adding a "Compare" method to my classes, but that doesn't help in many cases, like when you want to use things like the built in Dictionary.
Is there a good way to work around this problem?
Nope.
But it doesn't hurt to add `equals` methods to your own classes. I try to never use `==` when comparing objects (the same goes for `===`, which is the same thing for objects) since it only checks *identity* .
Sadly | [
-0.2201729118824005,
0.1449529230594635,
-0.019471215084195137,
0.1300150454044342,
-0.4025297164916992,
-0.07015819102525711,
0.7015947103500366,
0.345344603061676,
-0.11381826549768448,
-0.714743435382843,
0.08944108337163925,
0.47525203227996826,
-0.4359784722328186,
-0.2231855541467666... | |
all the collections in Flash and Flex assume that identity is the only measure of equality that is needed.
There are hints in Flex that someone wanted to alleviate this problem at one time, but it seems like it was abandoned: there is an interface called [IUID](http://livedocs.adobe.com/flex/201/langref/mx/core/IUID.html), and it is mentioned in the *Flex Developer's Guide* , but it is not used anywhere. Not even the collections in Flex use it to determine equality. And since you are asking for a solution for Flash, it may not have helped you anyway.
I've written some more about this (in the context of Flex) | [
0.3704141676425934,
-0.1802486628293991,
0.12086033076047897,
0.15120862424373627,
-0.21925345063209534,
-0.11581791192293167,
-0.03296557068824768,
-0.2530871331691742,
-0.3632901906967163,
-0.6100461483001709,
0.08785972744226456,
0.4121517241001129,
-0.2853495478630066,
-0.2436601966619... | |
on my blog: [Is there no equality?](http://blog.iconara.net/2007/11/25/architectural-atrocities-part-8-is-there-no-equality/). | [
0.21523788571357727,
0.32226496934890747,
0.13777881860733032,
-0.17727115750312805,
-0.2855271100997925,
0.46679022908210754,
0.6614065170288086,
0.05243832617998123,
-0.43131428956985474,
-0.24493719637393951,
0.024975834414362907,
0.5136527419090271,
-0.23833076655864716,
0.032706648111... | |
I have 2 time values which have the type `datetime.time`. I want to find their difference. The obvious thing to do is t1 - t2, but this doesn't work. It works for objects of type `datetime.datetime` but not for `datetime.time`. So what is the best way to do this?
Firstly, note that a datetime.time is a time of day, independent of a given day, and so the different between any two datetime.time values is going to be less than 24 hours.
One approach is to convert both datetime.time values into comparable values (such as milliseconds), and find the difference.
```
t1, t2 = datetime.time(...), | [
0.4219600558280945,
-0.15800553560256958,
0.5438942313194275,
-0.08903219550848007,
0.014711339958012104,
-0.007789262104779482,
0.08313504606485367,
-0.13564544916152954,
-0.08874046802520752,
-0.7178171873092651,
0.1245126873254776,
0.4469482898712158,
-0.142586350440979,
0.5102982521057... | |
datetime.time(...)
t1_ms = (t1.hour*60*60 + t1.minute*60 + t1.second)*1000 + t1.microsecond
t2_ms = (t2.hour*60*60 + t2.minute*60 + t2.second)*1000 + t2.microsecond
delta_ms = max([t1_ms, t2_ms]) - min([t1_ms, t2_ms])
```
It's a little lame, but it works. | [
0.22298239171504974,
-0.39746490120887756,
0.5027641654014587,
-0.020193321630358696,
0.6473906636238098,
0.2759367525577545,
0.11547110974788666,
-0.027349332347512245,
-0.17691007256507874,
-0.8125105500221252,
0.16550996899604797,
0.47108858823776245,
-0.25494033098220825,
-0.0026146515... | |
Ruby has two different exceptions mechanisms: Throw/Catch and Raise/Rescue.
Why do we have two?
When should you use one and not the other?
I think <http://hasno.info/ruby-gotchas-and-caveats> has a decent explanation of the difference:
> catch/throw are not the same as raise/rescue. catch/throw allows you to quickly exit blocks back to a point where a catch is defined for a specific symbol, raise rescue is the real exception handling stuff involving the Exception object. | [
0.07324343919754028,
-0.06630563735961914,
-0.20840907096862793,
0.11969026923179626,
-0.5541229844093323,
-0.271035373210907,
0.6272409558296204,
-0.313487708568573,
-0.3481830060482025,
-0.4272250235080719,
-0.07310815155506134,
0.14774735271930695,
-0.3163200914859772,
-0.20033670961856... | |
I am looking for a way to delete all files older than 7 days in a batch file. I've searched around the web, and found some examples with hundreds of lines of code, and others that required installing extra command line utilities to accomplish the task.
Similar things can be [done in BASH](https://stackoverflow.com/questions/25785/delete-all-but-the-most-recent-x-files-in-bash) in just a couple lines of code. It seems that something at least remotely easy could be done for batch files in Windows. I'm looking for a solution that works in a standard Windows command prompt, without any extra utilities. Please no PowerShell or Cygwin either.
Enjoy:
```
forfiles -p "C:\what\ever" | [
0.3458060026168823,
0.15455062687397003,
0.25680461525917053,
0.03527650609612465,
0.2093735635280609,
-0.07332253456115723,
0.09319214522838593,
0.1703619509935379,
-0.41722267866134644,
-0.7224317789077759,
-0.22042903304100037,
0.515717089176178,
-0.1035328134894371,
0.15496225655078888... | |
-s -m *.* -d <number of days> -c "cmd /c del @path"
```
See [`forfiles` documentation](http://ss64.com/nt/forfiles.html) for more details.
For more goodies, refer to *[An A-Z Index of the Windows XP command line](http://www.ss64.com/nt/)*.
If you don't have `forfiles` installed on your machine, copy it from any [Windows Server 2003](http://en.wikipedia.org/wiki/Windows_Server_2003) to your Windows XP machine at `%WinDir%\system32\`. This is possible since the EXE is fully compatible between Windows Server 2003 and Windows XP.
Later versions of Windows and Windows Server have it installed by default.
For Windows 7 and newer (including Windows 10):
The syntax has changed a little. Therefore the updated command is:
```
forfiles /p "C:\what\ever" /s /m *.* /D -<number of days> /C "cmd /c del @path"
``` | [
0.17756542563438416,
-0.19824998080730438,
0.9508286714553833,
-0.16855695843696594,
-0.12577003240585327,
-0.08078570663928986,
0.12314070016145706,
0.02199305035173893,
-0.5528051853179932,
-0.6571371555328369,
-0.5937008261680603,
0.586505115032196,
-0.09266089648008347,
0.1139778122305... | |
See here <http://www.hanselman.com/blog/InSearchOfThePerfectMonospacedProgrammersFontInconsolata.aspx> - for want of a better description - the statement block highlighting - eg in the pics on the link the "statement blocks" are grouped with a vertical line. I understand this is a feature of CodeRush - does R# have either anything similar, or a plugin to do the same?
I use the latest version of ReSharper that is currently available — ReSharper 4.5 — but unfortunately I don't believe there is any feature for drawing a vertical line between matching braces, as in the screen-shots you referenced.
The feature I find useful, which Ben mentioned, is the | [
0.4700091481208801,
-0.1372079849243164,
0.3748690187931061,
0.017465723678469658,
-0.19759884476661682,
0.2634945809841156,
0.3705843687057495,
-0.08046846091747284,
-0.32174158096313477,
-0.45992743968963623,
0.32174405455589294,
0.4421173334121704,
-0.24155423045158386,
-0.1708950698375... | |
matching brace highlighting, however this only takes effect when your cursor is adjacent to an opening or closing brace. | [
-0.47502827644348145,
-0.15510152280330658,
0.610271692276001,
0.014051194302737713,
-0.37938588857650757,
0.04698852449655533,
0.25238093733787537,
-0.09385346621274948,
-0.07644359022378922,
-0.6091822385787964,
-0.41367432475090027,
0.30947819352149963,
-0.389594703912735,
-0.1384905874... | |
Consider the Oracle `emp` table. I'd like to get the employees with the top salary with `department = 20` and `job = clerk`. Also assume that there is no "empno" column, and that the primary key involves a number of columns. You can do this with:
```
select * from scott.emp
where deptno = 20 and job = 'CLERK'
and sal = (select max(sal) from scott.emp
where deptno = 20 and job = 'CLERK')
```
This works, but I have to duplicate the test deptno = 20 and job = 'CLERK', which I would | [
0.05063803121447563,
-0.06199633702635765,
0.13945193588733673,
0.2640298008918762,
0.3872216045856476,
0.25113120675086975,
-0.1418301910161972,
-0.37833312153816223,
-0.3250690698623657,
-0.4681001901626587,
-0.24126246571540833,
0.6085227131843567,
0.005282269325107336,
-0.1240087226033... | |
like to avoid. Is there a more elegant way to write this, maybe using a `group by`? BTW, if this matters, I am using Oracle.
The following is slightly over-engineered, but is a good SQL pattern for "top x" queries.
```
SELECT
*
FROM
scott.emp
WHERE
(deptno,job,sal) IN
(SELECT
deptno,
job,
max(sal)
FROM
scott.emp
WHERE
deptno = 20
and job = 'CLERK'
GROUP BY
deptno,
job
)
```
Also note that this will work in Oracle and | [
0.25457221269607544,
-0.0136466845870018,
0.338613361120224,
0.05722852423787117,
0.16979900002479553,
0.11324920505285263,
0.24919652938842773,
-0.22718718647956848,
-0.4136388301849365,
-0.5821507573127747,
-0.09552173316478729,
0.6217643618583679,
-0.4581072926521301,
0.1709091514348983... | |
Postgress (i think) but not MS SQL. For something similar in MS SQL see question [SQL Query to get latest price](https://stackoverflow.com/questions/49404/sql-query-to-get-latest-price#49424) | [
0.32351961731910706,
-0.22106975317001343,
0.8545084595680237,
0.22050422430038452,
0.006321346387267113,
0.04390816390514374,
-0.2759055197238922,
0.06120695173740387,
-0.03639235347509384,
-0.3643331527709961,
-0.1415269672870636,
0.7058658003807068,
0.2167394906282425,
0.236059933900833... | |
I have two spreadsheets... when one gets modified in a certain way I want to have a macro run that modifies the second in an appropriate manner. I've already isolated the event I need to act on (the modification of any cell in a particular column), I just can't seem to find any concrete information on accessing and modifying another spreadsheet (this spreadsheet is located on a different LAN share also... the user has access to both, though).
Any help would be great. References on how to do this or something similar are just as good as concrete code samples.
In Excel, | [
0.3841416537761688,
0.33175724744796753,
-0.09080792218446732,
-0.03900676593184471,
0.10980802774429321,
-0.12363508343696594,
-0.23190325498580933,
-0.10369106382131577,
-0.16782164573669434,
-0.9519256353378296,
0.25617966055870056,
0.5565975308418274,
-0.48935168981552124,
-0.011649605... | |
you would likely just write code to open the other worksheet, modify it and then save the data.
See [this tutorial](http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=302) for more info.
I'll have to edit my VBA later, so pretend this is pseudocode, but it should look something like:
```
Dim xl: Set xl = CreateObject("Excel.Application")
xl.Open "\\the\share\file.xls"
Dim ws: Set ws = xl.Worksheets(1)
ws.Cells(0,1).Value = "New Value"
ws.Save
xl.Quit constSilent
``` | [
0.5572810769081116,
0.23388132452964783,
0.3765926957130432,
-0.1646738052368164,
0.1717214584350586,
-0.13719962537288666,
0.19903025031089783,
-0.39611706137657166,
-0.14862515032291412,
-0.3749955892562866,
-0.15687383711338043,
0.7252737879753113,
-0.545444130897522,
0.0872657001018524... | |
I was just assigned to do a CMS using ASP.net 3.5 and MySQL. I am kind of new to ASP.NET development (quite sufficient with C#) and **I am wondering what major ASP.NET and general .NET features I am losing when I don't have the option to use Microsoft SQL Server.**
I know already from quick Googling that I lose LINQ (and I was really looking forward to using this to build my model layer!), but I am not sure what other handy features I will lose. Since I've been relying on ASP.net tutorials which assume that you use MS SQL Server, | [
0.037860073149204254,
0.36655181646347046,
0.28722795844078064,
0.11563491076231003,
0.14705146849155426,
-0.23834742605686188,
0.21604326367378235,
0.19838972389698029,
-0.416085809469223,
-0.7808167934417725,
0.09772218763828278,
0.6008477210998535,
0.15543504059314728,
0.129744887351989... | |
I feel a chunk of my ASP.net knowledge just become invalid.
Thanks!
You do not lose LINQ, you lose LINQtoSQL. LINQ itself is more generic as it can be used on anything that implements iQueryable.
You lose the SqlDataSource, not a big deal.
You lose some of the integration the server explorer does for you with sql server, again not a big deal.
As far as im concerned you dont lose anything very important, and you shouldnt be losing any of your .net knowledge. Most examples use sql server as a default but they can easily be changed to use another database.
Also there are a | [
0.20221634209156036,
0.284883588552475,
0.37928012013435364,
0.37313541769981384,
-0.19041667878627777,
-0.40817004442214966,
0.2929682731628418,
0.20012266933918,
-0.217201828956604,
-0.4528500735759735,
0.21222040057182312,
0.5907564759254456,
-0.07584443688392639,
0.2583516538143158,
... | |
few open source .net CMS packages out there already that use MySql take a look at [cuyahoga](http://www.cuyahoga-project.org/) | [
0.04802894592285156,
0.06887000799179077,
0.18767283856868744,
0.008962919935584068,
0.06178572028875351,
-0.24370518326759338,
0.11932070553302765,
0.44081807136535645,
-0.4354005455970764,
-0.5426091551780701,
-0.045638080686330795,
0.18771293759346008,
-0.04514534771442413,
-0.082710333... | |
Say I have a list as follows:
* item1
* item2
* item3
Is there a CSS selector that will allow me to directly select the last item of a list? In this case item 3.
Cheers!
Not that i'm aware of. The traditional solution is to tag the first & last items with class="first" & class="last" so you can identify them.
The CSS psudo-class [first-child](http://www.w3.org/TR/CSS2/selector.html#first-child) will get you the first item but not all browsers support it. CSS3 will have [last-child too](http://www.w3.org/TR/2001/CR-css3-selectors-20011113/#last-child-pseudo) (this is currently supported by Firefox, Safari but not IE 6/7/beta 8) | [
0.16807852685451508,
-0.025027552619576454,
0.3565214276313782,
-0.046276118606328964,
-0.15246671438217163,
0.10422777384519577,
0.1683289259672165,
-0.05372833460569382,
-0.5199089050292969,
-0.49213874340057373,
-0.25755834579467773,
-0.0175995584577322,
-0.03199172392487526,
0.20171768... | |
I have a list of objects I wish to sort based on a field `attr` of type string. I tried using `-`
```
list.sort(function (a, b) {
return a.attr - b.attr
})
```
but found that `-` doesn't appear to work with strings in JavaScript. How can I sort a list of objects based on an attribute with type string?
Use [`String.prototype.localeCompare`](https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Global_Objects/String/localeCompare) a per your example:
```
list.sort(function (a, b) {
return ('' + a.attr).localeCompare(b.attr);
})
```
We force a.attr to be a string to avoid exceptions. `localeCompare` has been supported [since Internet Explorer 6](https://learn.microsoft.com/en-us/scripting/javascript/reference/localecompare-method-string-javascript) and Firefox 1. You may also see the following code | [
0.06278932839632034,
-0.07062763720750809,
0.40034183859825134,
-0.0778319239616394,
0.027639353647828102,
-0.246654212474823,
0.2510867714881897,
0.06385451555252075,
-0.48594120144844055,
-0.6525182127952576,
-0.13891969621181488,
0.6459028720855713,
-0.49079176783561707,
0.1730322539806... | |
used that doesn't respect a locale:
```
if (item1.attr < item2.attr)
return -1;
if ( item1.attr > item2.attr)
return 1;
return 0;
``` | [
-0.15439541637897491,
0.10628631711006165,
0.6366370916366577,
-0.04625798016786575,
0.047905273735523224,
-0.2099049687385559,
0.6556997895240784,
-0.20713041722774506,
0.054055020213127136,
-0.2819192707538605,
-0.7469886541366577,
0.3978758454322815,
-0.48785972595214844,
0.105405002832... | |
I'm tearing my hair out with this one. If I start a block comment `/*` in VS.NET 2005+ then carriage return, Visual Studio insists that I have another asterisk `*`. I know there's an option to turn this off but I just can't find it. Anyone know how to turn this feature off?
**Update: this setting was changed in VS 2015 update 2. See [this answer](https://stackoverflow.com/a/36319097/4294399).**
[This post](http://forums.msdn.microsoft.com/en-US/csharpide/thread/a41e3652-efe2-4f81-ad3e-94994974fcb2/) addresses your question. The gist of it is:
```
Text Editor > C# > Advanced > Generate XML documentation comments for ///
``` | [
0.595453143119812,
-0.1761460155248642,
0.5127065181732178,
-0.16201283037662506,
-0.26225975155830383,
-0.06822986155748367,
0.2457452416419983,
-0.3360890746116638,
-0.46777069568634033,
-0.22768105566501617,
-0.11203467100858688,
0.5014809966087341,
-0.2944524586200714,
0.13276340067386... | |
I want to write a little "DBQuery" function in perl so I can have one-liners which send an SQL statement and receive back and an array of hashes, i.e. a recordset. However, I'm running into an issue with Perl syntax (and probably some odd pointer/reference issue) which is preventing me from packing out the information from the hash that I'm getting from the database. The sample code below demonstrates the issue.
I can get the data "Jim" out of a hash inside an array with this syntax:
```
print $records[$index]{'firstName'}
```
returns "Jim"
but if I copy the hash record in the array to its own | [
0.20380045473575592,
0.23526659607887268,
0.17782053351402283,
-0.1620979607105255,
-0.24426205456256866,
-0.10797657072544098,
0.031050214543938637,
-0.0981992557644844,
0.007713004015386105,
-0.3937920331954956,
0.12028666585683823,
0.3299241065979004,
-0.4427162706851959,
0.270754873752... | |
hash variable first, then I strangely can't access the data anymore in that hash:
```
%row = $records[$index];
$row{'firstName'};
```
returns "" (blank)
Here is the full sample code showing the problem. Any help is appreciated:
```
my @records = (
{'id' => 1, 'firstName' => 'Jim'},
{'id' => 2, 'firstName' => 'Joe'}
);
my @records2 = ();
$numberOfRecords = scalar(@records);
print "number of records: " . $numberOfRecords . "\n";
for(my $index=0; $index < $numberOfRecords; $index++) {
#works
print 'you can print the records like this: ' . $records[$index]{'firstName'} . "\n";
#does NOT work | [
-0.20851072669029236,
0.1503238081932068,
0.3648301064968109,
-0.22160963714122772,
0.17810991406440735,
-0.09490177780389786,
0.22256310284137726,
-0.15460725128650665,
-0.39288797974586487,
-0.5368838906288147,
-0.08688054978847504,
0.5947650671005249,
-0.28560951352119446,
0.28615650534... | |
%row = $records[$index];
print 'but not like this: ' . $row{'firstName'} . "\n";
}
```
The nested data structure contains a hash *reference*, not a hash.
```
# Will work (the -> dereferences the reference)
$row = $records[$index];
print "This will work: ", $row->{firstName}, "\n";
# This will also work, by promoting the hash reference into a hash
%row = %{ $records[$index] };
print "This will work: ", $row{firstName}, "\n";
```
If you're ever presented with a deep Perl data structure, you may profit from printing it using [Data::Dumper](http://search.cpan.org/perldoc?Data::Dumper) to print it into human-readable (and Perl-parsable) form. | [
-0.08623871207237244,
0.23639169335365295,
0.30511313676834106,
-0.07987864315509796,
0.04763279855251312,
0.13502274453639984,
0.1673501878976822,
-0.1641044318675995,
-0.09668732434511185,
-0.26694977283477783,
-0.47461143136024475,
0.3062075674533844,
-0.4113311469554901,
0.085155941545... | |
I'm trying to write a regular expression that validates a date. The regex needs to match the following
* M/D/YYYY
* MM/DD/YYYY
* Single digit months can start with a leading zero (eg: 03/12/2008)
* Single digit days can start with a leading zero (eg: 3/02/2008)
* CANNOT include February 30 or February 31 (eg: 2/31/2008)
So far I have
```
^(([1-9]|1[012])[-/.]([1-9]|[12][0-9]|3[01])[-/.](19|20)\d\d)|((1[012]|0[1-9])(3[01]|2\d|1\d|0[1-9])(19|20)\d\d)|((1[012]|0[1-9])[-/.](3[01]|2\d|1\d|0[1-9])[-/.](19|20)\d\d)$
```
This matches properly EXCEPT it still includes 2/30/2008 & 2/31/2008.
Does anyone have a better suggestion?
**Edit:** I found [the answer](http://regexlib.com/REDetails.aspx?regexp_id=112) on RegExLib
```
^((((0[13578])|([13578])|(1[02]))[\/](([1-9])|([0-2][0-9])|(3[01])))|(((0[469])|([469])|(11))[\/](([1-9])|([0-2][0-9])|(30)))|((2|02)[\/](([1-9])|([0-2][0-9]))))[\/]\d{4}$|^\d{4}$
```
It matches all valid months that follow the MM/DD/YYYY format.
Thanks everyone for the help.
This is not an appropriate use of regular expressions. You'd be better off | [
-0.28210583329200745,
0.12924417853355408,
0.7007192969322205,
-0.03587883710861206,
-0.0069494727067649364,
0.19030636548995972,
0.4117441773414612,
-0.14597965776920319,
-0.3743790090084076,
-0.21023264527320862,
-0.15884718298912048,
0.16503164172172546,
-0.15710707008838654,
0.08869985... | |
using
```
[0-9]{2}/[0-9]{2}/[0-9]{4}
```
and then checking ranges in a higher-level language. | [
0.23947502672672272,
0.06502657383680344,
0.04415165260434151,
-0.05696042627096176,
0.031265322118997574,
-0.043431174010038376,
0.2612374722957611,
-0.5751290321350098,
0.1616746038198471,
-0.4185079038143158,
-0.13988016545772552,
0.6610338687896729,
-0.22247114777565002,
-0.31532517075... | |
How can I retrieve the page title of a webpage (title html tag) using Python?
I'll always use [lxml](http://lxml.de/) for such tasks. You could use [beautifulsoup](http://www.crummy.com/software/BeautifulSoup/) as well.
```
import lxml.html
t = lxml.html.parse(url)
print(t.find(".//title").text)
```
EDIT based on comment:
```
from urllib2 import urlopen
from lxml.html import parse
url = "https://www.google.com"
page = urlopen(url)
p = parse(page)
print(p.find(".//title").text)
``` | [
-0.15392544865608215,
0.09035393595695496,
0.7290316224098206,
-0.032008521258831024,
0.12020782381296158,
-0.0008467681473121047,
-0.07570173591375351,
-0.16915859282016754,
-0.04887011647224426,
-0.6098451614379883,
-0.28257817029953003,
0.2614678144454956,
-0.10218554735183716,
-0.10371... | |
I've build a WCF Service to accept a file and write it to disk. The front-end consists of a page with SWFUpload which is handling the upload on the client side. Apparently, SWFUpload posts the data with a Content Type of: multipart/form-data.
I would think this ok but on the Service side I get an error. The error is "ProtocolException" expecting text/xml. I've tried different message encodings in the bindings but nothing seems to work.
How can I get this file uploaded using multipart/form-data?
@jdiaz,
@JasonS is right, to upload file you need to transfer it as a byte stream. You need to use | [
0.3599930703639984,
0.055256083607673645,
0.5684314966201782,
-0.08104950934648514,
-0.43127503991127014,
-0.08434733003377914,
-0.01383772399276495,
-0.03399939462542534,
-0.14738166332244873,
-0.9317694902420044,
0.1589154452085495,
0.46042612195014954,
-0.2649070620536804,
0.35124975442... | |
[WCF streaming](http://msdn2.microsoft.com/en-us/library/ms733742.aspx). For example on how to upload file via WCF see [an article](http://kjellsj.blogspot.com/2007/02/wcf-streaming-upload-files-over-http.html) from <http://kjellsj.blogspot.com> | [
0.325299471616745,
-0.02145855315029621,
0.6972822546958923,
-0.2664169371128082,
-0.5511608719825745,
-0.25933027267456055,
0.2902965545654297,
-0.1125975027680397,
-0.8067073822021484,
-0.22152328491210938,
-0.445279061794281,
0.24007299542427063,
-0.07359582930803299,
0.2768076360225677... | |
Is there any performance to be gained these days from compiling java to native code, or do modern hotspot compilers end up doing this over time anyway?
There was a similar discussion here recently, for the question [What are advantages of bytecode over native code?](https://stackoverflow.com/questions/48144/what-are-advantages-of-bytecode-over-native-code). You can find interesting answers in that thread. | [
0.12794998288154602,
-0.03051314875483513,
-0.17173689603805542,
0.21182824671268463,
-0.03494520112872124,
-0.194185271859169,
-0.12201708555221558,
0.024019796401262283,
-0.4701836407184601,
-0.3750346601009369,
0.18208260834217072,
0.37121742963790894,
0.23242539167404175,
-0.0215947888... | |
I'm wondering what strategies people use for reduced sign on with legacy applications and how effective they have found them?
We have an ASP.Net based intranet and own a lot of the legacy applications, but not all. We also have BizTalk and are considering the use of it's SSO engine too.
A good compromise between effort/rework and the convenience of single sign on is to continue to maintain a list of users, privileges, roles etc in the legacy app. Make the changes necessary to automatically log the user into your application based on their user account (usually their Windows or network | [
0.5209308862686157,
0.06080443039536476,
0.26586678624153137,
0.1173209547996521,
0.10731922835111618,
-0.033330172300338745,
0.3822370767593384,
0.1472804844379425,
-0.42307212948799133,
-0.6606366038322449,
-0.05219532921910286,
0.318706750869751,
0.05751560255885124,
-0.0815882757306099... | |
account).
I'm currently running a couple of applications that use this method of sign on, and it makes them seem more integrated even though they aren't.
Another advantage we've found is that it stops people from sharing passwords to legacy applications. They're much less likely to hand out an admin password that also gives others access to their email or payroll details! | [
0.5100369453430176,
0.050252627581357956,
0.2027762532234192,
0.020146794617176056,
0.30106034874916077,
-0.07892544567584991,
0.4733140468597412,
0.0379437655210495,
-0.3664140999317169,
-0.3652469515800476,
0.12127572298049927,
0.35110440850257874,
0.16287092864513397,
-0.048280913382768... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.