text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
websites that the MeasureString function isn't very precise due to how complex fonts are, with kerning issues and all. The second is that I have no idea what the TextBox control is using as its StringFormat underneath.
Anyway, the result is that I invariably end up with items in the right column that are off by a tab. I suppose I could roll my own text window and do everything myself, but gee, isn't there a simple way to do this?
```
TextBox textBox = new TextBox();
textBox.Font | [
0.4221166670322418,
0.4462490677833557,
0.5346993207931519,
0.10159190744161606,
-0.14608162641525269,
-0.5005689263343811,
0.5769966840744019,
0.25992462038993835,
-0.34347113966941833,
-0.5718379020690918,
-0.06105022132396698,
0.36297133564949036,
-0.24813811480998993,
-0.06132373213768... | |
= new Font("Calibri", 11);
textBox.Dock = DockStyle.Fill;
textBox.Multiline = true;
textBox.WordWrap = false;
textBox.ScrollBars = ScrollBars.Vertical;
Form form = new Form();
form.Text = "Recipe";
form.Size = new Size(400, 600);
form.FormBorderStyle = FormBorderStyle.Sizable; | [
0.09886135905981064,
0.00554343918338418,
0.9642510414123535,
-0.30508726835250854,
0.022278185933828354,
0.34694474935531616,
0.28261232376098633,
-0.544195294380188,
-0.14417071640491486,
-0.6899703741073608,
-0.5707167983055115,
0.3058299720287323,
-0.03457145392894745,
0.22183670103549... | |
form.StartPosition = FormStartPosition.CenterScreen;
form.Controls.Add(textBox);
Graphics g = form.CreateGraphics();
float targetWidth = 230;
foreach (PropertyInfo property in properties)
{
string text = String.Format("{0}:\t", Description);
while (g.MeasureString(text,textBox.Font).Width < targetWidth)
text += "\t";
textBox.AppendText(text + value.ToString() + "\n");
}
g.Dispose();
form.ShowDialog();
```
If you want, | [
0.17327262461185455,
-0.09462796151638031,
0.76614910364151,
-0.3023538887500763,
-0.1940610706806183,
0.039704762399196625,
0.12188006192445755,
-0.660580039024353,
-0.06684650480747223,
-0.9028303623199463,
-0.3851795494556427,
0.37650513648986816,
-0.32001301646232605,
-0.08110366016626... | |
you can translate this VB.Net code to C#. The theory here is that you change the size of a tab in the control.
```
Private Declare Function SendMessage _
Lib "user32" Alias "SendMessageA" _
(ByVal handle As IntPtr, ByVal wMsg As Integer, _
ByVal wParam As Integer, ByRef lParam As Integer) As Integer
Private Sub SetTabStops(ByVal ctlTextBox As TextBox)
Const EM_SETTABSTOPS As Integer = &HCBS
Dim tabs() As Integer = {20, 40, 80}
SendMessage(ctlTextBox.Handle, EM_SETTABSTOPS, _
tabs.Length, tabs(0))
End Sub
```
I converted a version to C# for you, too. Tested and working in VS2005.
Add this using | [
-0.04865885153412819,
-0.27532321214675903,
0.8990911841392517,
-0.12172304093837738,
-0.06005100905895233,
-0.009214211255311966,
0.12997090816497803,
-0.4570589065551758,
-0.41964420676231384,
-0.5110753178596497,
-0.0227249376475811,
0.6755435466766357,
-0.5115630030632019,
-0.125867024... | |
statement to your form:
```
using System.Runtime.InteropServices;
```
Put this right after the class declaration:
```
private const int EM_SETTABSTOPS = 0x00CB;
[DllImport("User32.dll", CharSet = CharSet.Auto)]
public static extern IntPtr SendMessage(IntPtr h, int msg, int wParam, int[] lParam);
```
Call this method when you want to set the tabstops:
```
private void SetTabStops(TextBox ctlTextBox)
{
const int EM_SETTABSTOPS = 203;
int[] tabs = { 100, 40, 80 };
SendMessage(textBox1.Handle, EM_SETTABSTOPS, tabs.Length, | [
0.03491879254579544,
-0.1610887050628662,
0.9520952105522156,
-0.1938464492559433,
0.22490787506103516,
0.23158052563667297,
0.2525750994682312,
-0.5283138155937195,
-0.3953550159931183,
-0.48073694109916687,
-0.3364495038986206,
0.5508190989494324,
-0.6349550485610962,
-0.0264091249555349... | |
tabs);
}
```
To use it, here is all I did:
```
private void Form1_Load(object sender, EventArgs e)
{
SetTabStops(textBox1);
textBox1.Text = "Hi\tWorld";
}
``` | [
-0.23867064714431763,
-0.1780250370502472,
0.5885917544364929,
-0.4365149438381195,
-0.040935177356004715,
-0.09980881959199905,
0.40835991501808167,
-0.25688815116882324,
-0.10523317009210587,
-0.43873393535614014,
-0.3315894901752472,
0.6254348754882812,
-0.6461042165756226,
0.1052357628... | |
I recently came across an issue with Windows 2003 (apparently it also exists in other versions too), where if an SSL/TLS server is requesting client certificate authentication and it has more than 16KB of trusted certificate DNs, Internet Explorer (or any other app that uses schannel.dll) is unable to complete the SSL handshake. (In a nutshell, the server breaks the message into chunks of 2^14 bytes, as per RFC 2246 sec. 6.2.1, but Schannel wasn't written to support that. I've gotten confirmation from Microsoft support that this is a flaw in Schannel and that they're considering fixing it in a | [
-0.035949282348155975,
0.2639681398868561,
0.27935534715652466,
-0.0613294392824173,
-0.2654340863227844,
-0.4714241325855255,
0.666314959526062,
0.13663314282894135,
-0.394159734249115,
-0.5096212029457092,
-0.16918791830539703,
0.16316653788089752,
-0.3445417881011963,
0.1600568443536758... | |
future release.)
So I'm trying to find a way to easily parse through my trusted certificates (I use Apache as my server, so all of them are in PEM format) to get the total ASN.1-format length of the DNs (which is how they get sent over the wire during the handshake), and thereby see if I'm getting too close to the limit. I haven't yet been able to find a way to do this, though: the OpenSSL asn1parse function comes close, but it doesn't seem to provide a way to get the ASN.1 sequence for just the issuer name, which is | [
0.28467512130737305,
-0.001940059126354754,
0.5248057842254639,
0.10842405259609222,
-0.13896256685256958,
-0.5381559133529663,
0.29955002665519714,
-0.21454402804374695,
-0.11601806432008743,
-0.34249186515808105,
-0.11677099019289017,
0.5074186325073242,
-0.16955560445785522,
0.062990508... | |
what I need.
Any suggestions?
Since ASN.1 is self describing, it's fairly easy to write an ASN.1 parser. As you probably know, ASN.1 data contains a tree of values, where each value type is identified by a globally assigned OID (Object ID). You can find a free ASN.1 decoder with source code at: [<http://www.geocities.co.jp/SiliconValley-SanJose/3377/asn1JS.html>](http://www.geocities.co.jp/SiliconValley-SanJose/3377/asn1JS.html). It;'s written in javascript so you can play with it directly in your browser.
As to your exact question - I would:
1. Use the supplied parser, find another one or write my own
2. Find the OID of trusted DNs (check the specification or simply decode a certificate using the | [
0.0875510647892952,
-0.24412672221660614,
0.20283058285713196,
0.1353941708803177,
-0.08112527430057526,
-0.10320346802473068,
0.09163365513086319,
-0.010221480391919613,
-0.08839056640863419,
-0.5362303256988525,
-0.24068990349769592,
0.48435139656066895,
-0.39642298221588135,
-0.34561890... | |
supplied ASN.1 decoder page)
3. Combine the two above to extract the size of trusted DNs inside a certificate. | [
0.22019445896148682,
-0.07801094651222229,
0.3795934319496155,
-0.005613654851913452,
-0.02370344288647175,
-0.3064853549003601,
0.3731469511985779,
-0.7074940800666809,
-0.11659763753414154,
-0.3992893099784851,
-0.3476499021053314,
0.34012797474861145,
-0.22081783413887024,
-0.1778653860... | |
I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE.
What are the steps to create such an executable?
Single Assembly Deployment of Managed and Unmanaged Code
Sunday, February 4, 2007
.NET developers love XCOPY deployment. And they love single assembly components. At least I always feel kinda uneasy, if I have to use some component and need remember a list of files to also include with the main assembly of that component. So when I recently had to develop a managed code component and had to augment | [
0.1683831363916397,
0.2653183043003082,
0.5933554768562317,
-0.03603309392929077,
-0.4264790415763855,
-0.17836280167102814,
0.2136840969324112,
0.1689741015434265,
-0.22024303674697876,
-0.44204187393188477,
0.12836363911628723,
0.529707670211792,
-0.19583110511302948,
0.2977050542831421,... | |
it with some unmanaged code from a C DLL (thx to Marcus Heege for helping me with this!), I thought about how to make it easier to deploy the two DLLs. If this were just two assemblies I could have used ILmerge to pack them up in just one file. But this doesn´t work for mixed code components with managed as well as unmanaged DLLs.
So here´s what I came up with for a solution:
I include whatever DLLs I want to deploy with my component´s main assembly as embedded resources.
Then I set up a class constructor to extract those DLLs like | [
0.3604649603366852,
0.0721726194024086,
-0.07520613074302673,
0.2814699113368988,
-0.175426185131073,
-0.07598096877336502,
0.13350915908813477,
-0.19836261868476868,
-0.1560017615556717,
-0.6986991763114929,
0.07807400822639465,
0.5385140776634216,
-0.2791580855846405,
0.00641998695209622... | |
below. The class ctor is called just once within each AppDomain so it´s a neglible overhead, I think.
```
namespace MyLib
{
public class MyClass
{
static MyClass()
{
ResourceExtractor.ExtractResourceToFile("MyLib.ManagedService.dll", "managedservice.dll");
ResourceExtractor.ExtractResourceToFile("MyLib.UnmanagedService.dll", "unmanagedservice.dll");
}
...
```
In this example I included two DLLs as resources, one being an unmanaged | [
-0.21027030050754547,
0.05071304738521576,
0.37242287397384644,
-0.0022462483029812574,
0.11806759238243103,
0.31553763151168823,
0.21310889720916748,
0.04335043951869011,
-0.26387083530426025,
-0.819674551486969,
-0.32025471329689026,
0.6014568209648132,
-0.45703747868537903,
0.2748250961... | |
code DLL, and one being a managed code DLL (just for demonstration purposes), to show, how this technique works for both kinds of code.
The code to extract the DLLs into files of their own is simple:
```
public static class ResourceExtractor
{
public static void ExtractResourceToFile(string resourceName, string filename)
{
if (!System.IO.File.Exists(filename))
using (System.IO.Stream s = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream(resourceName))
using (System.IO.FileStream fs = new System.IO.FileStream(filename, System.IO.FileMode.Create)) | [
0.04145490750670433,
-0.3812076151371002,
0.552277147769928,
0.1801152527332306,
-0.013940171338617802,
0.1550293266773224,
-0.1318201869726181,
-0.3321585953235626,
-0.414262592792511,
-0.66150963306427,
-0.1833869069814682,
0.5722428560256958,
-0.18701855838298798,
0.16690024733543396,
... | |
{
byte[] b = new byte[s.Length];
s.Read(b, 0, b.Length);
fs.Write(b, 0, b.Length);
} | [
-0.030645903199911118,
-0.03844910115003586,
0.44944554567337036,
-0.42284688353538513,
0.145104318857193,
0.2599693834781647,
0.2726553976535797,
-0.2984050214290619,
-0.3962218165397644,
-0.3664395213127136,
-0.4902547299861908,
0.2619188725948334,
-0.31395748257637024,
0.165820851922035... | |
}
}
```
Working with a managed code assembly like this is the same as usual - almost. You reference it (here: ManagedService.dll) in your component´s main project (here: MyLib), but set the Copy Local property to false. Additionally you link in the assembly as an Existing Item and set the Build Action to Embedded Resource.
For the unmanaged code (here: UnmanagedService.dll) you just link in the DLL as an Existing Item and set the Build Action to Embedded Resource. To access its functions use the DllImport attribute as usual, e.g.
```
[DllImport("unmanagedservice.dll")] public extern static int Add(int a, int b);
```
That´s it! As | [
0.22534556686878204,
-0.08513601869344711,
0.38652199506759644,
-0.10918804258108139,
0.0724530965089798,
-0.25329527258872986,
0.25708499550819397,
-0.2426513135433197,
-0.11778013408184052,
-0.7093392014503479,
-0.2601443827152252,
0.7546343207359314,
-0.25826171040534973,
0.247666746377... | |
soon as you create the first instance of the class with the static ctor the embedded DLLs get extracted into files of their own and are ready to use as if you deployed them as separate files. As long as you have write permissions for the execution directory this should work fine for you. At least for prototypical code I think this way of single assembly deployment is quite convenient.
Enjoy!
<http://weblogs.asp.net/ralfw/archive/2007/02/04/single-assembly-deployment-of-managed-and-unmanaged-code.aspx> | [
0.31444311141967773,
-0.2055027335882187,
0.06247261166572571,
-0.05255609750747681,
-0.20805370807647705,
-0.2834424078464508,
0.19877158105373383,
-0.05851620435714722,
-0.31432369351387024,
-0.6871944665908813,
-0.20708322525024414,
0.5728863477706909,
-0.16142138838768005,
0.2230573594... | |
Can anyone provide a good explanation of the volatile keyword in C#? Which problems does it solve and which it doesn't? In which cases will it save me the use of locking?
I don't think there's a better person to answer this than [Eric Lippert](https://ericlippert.com/2011/06/16/atomicity-volatility-and-immutability-are-different-part-three/) (emphasis in the original):
> In C#, "volatile" means not only "make sure that the compiler and the
> jitter do not perform any code reordering or register caching
> optimizations on this variable". It also means "tell the processors to
> do whatever it is they need to do to ensure that I am reading | [
-0.08085703104734421,
0.3099389374256134,
0.04724811390042305,
0.29718348383903503,
0.06053653731942177,
-0.37831249833106995,
0.2179671674966812,
-0.19856402277946472,
-0.25381454825401306,
0.003094105515629053,
-0.2502792775630951,
0.9588280320167542,
-0.2820635139942169,
-0.217565119266... | |
the
> latest value, even if that means halting other processors and making
> them synchronize main memory with their caches".
>
>
> Actually, that last bit is a lie. The true semantics of volatile reads
> and writes are considerably more complex than I've outlined here; in
> fact **they do not actually guarantee that every processor stops what it
> is doing** and updates caches to/from main memory. Rather, **they provide
> weaker guarantees about how memory accesses before and after reads and
> writes may be observed to be ordered with respect to each other**.
> Certain | [
0.07968348264694214,
0.11967914551496506,
0.4338058829307556,
0.24780045449733734,
0.12801112234592438,
-0.19990059733390808,
0.18823444843292236,
-0.1446586698293686,
-0.007861640304327011,
-0.5761012434959412,
-0.21169576048851013,
0.7375335693359375,
-0.2937636971473694,
0.1199675947427... | |
operations such as creating a new thread, entering a lock, or
> using one of the Interlocked family of methods introduce stronger
> guarantees about observation of ordering. If you want more details,
> read sections 3.10 and 10.5.3 of the C# 4.0 specification.
>
>
> Frankly, **I discourage you from ever making a volatile field**. Volatile
> fields are a sign that you are doing something downright crazy: you're
> attempting to read and write the same value on two different threads
> without putting a lock in place. Locks guarantee that memory read or
> modified inside the | [
0.4293319582939148,
0.10984398424625397,
-0.07652562111616135,
0.03550127148628235,
0.2490731030702591,
-0.36919766664505005,
0.3973159193992615,
-0.13032613694667816,
-0.6452289819717407,
-0.22643369436264038,
-0.34351760149002075,
0.4714665710926056,
-0.4440727233886719,
0.18584223091602... | |
lock is observed to be consistent, locks guarantee
> that only one thread accesses a given chunk of memory at a time, and so
> on. The number of situations in which a lock is too slow is very
> small, and the probability that you are going to get the code wrong
> because you don't understand the exact memory model is very large. I
> don't attempt to write any low-lock code except for the most trivial
> usages of Interlocked operations. I leave the usage of "volatile" to
> real experts.
For further reading see:
* [Understand the Impact | [
-0.034223224967718124,
0.11267516016960144,
0.2591237425804138,
0.2495393007993698,
0.3583924174308777,
-0.1237628236413002,
0.3148060142993927,
-0.16096030175685883,
-0.3786405622959137,
-0.42863762378692627,
-0.17461642622947693,
0.5749916434288025,
-0.17083477973937988,
-0.1000104025006... | |
of Low-Lock Techniques in Multithreaded Apps](https://learn.microsoft.com/archive/msdn-magazine/2005/october/understanding-low-lock-techniques-in-multithreaded-apps)
* [Sayonara volatile](http://joeduffyblog.com/2010/12/04/sayonara-volatile/) | [
-0.9371641278266907,
0.06183876469731331,
-0.11728299409151077,
0.07354575395584106,
0.07023288309574127,
0.09616055339574814,
-0.11962377279996872,
-0.11673979461193085,
-0.18857692182064056,
0.08810965716838837,
-0.5412741303443909,
0.8925437927246094,
0.14034496247768402,
-0.35848167538... | |
Sorry for the Windows developers out there, this solution is for Macs only.
This set of applications accounts for: Usability Testing, Screen Capture (Video and Still), Version Control, Task Lists, Bug Tracking, a Developer IDE, a Web Server, A Blog, Shared Doc Editing on the Web, Team and individual Chat, Email, Databases and Continuous Integration. This does assume your team members provide their own machines, and one person has a spare old computer to be the Source Repository and Web Server. All for under $200 bucks.
**Usability**
[Silverback](http://silverbackapp.com/)
Licenses = 3 x $49.95
"Spontaneous, unobtrusive usability testing software for designers and developers."
**Source Control Server | [
0.29372766613960266,
0.4176734387874603,
0.1484711468219757,
0.3378644585609436,
0.00298604485578835,
-0.09951309114694595,
0.3203219771385193,
-0.05741608515381813,
-0.23635168373584747,
-0.47041380405426025,
-0.08893556147813797,
0.6056473851203918,
-0.05188683047890663,
0.15022809803485... | |
and Clients (multiple options)**
[Subversion](http://subversion.tigris.org/) = Free
Subversion is an open source version control system.
[Versions](http://versionsapp.com/) (Currently in Beta) = Free
Versions provides a pleasant work with Subversion on your Mac.
[Diffly](http://lucidmac.com/products/diffly) = Free
"Diffly is a tool for exploring Subversion working copies. It shows all files with changes and, clicking on a file, shows a highlighted view of the changes for that file. When you are ready to commit Diffly makes it easy to select the files you want to check-in and assemble a useful commit message."
**Bug/Feature/Defect Tracking (multiple options)**
[Bugzilla](http://www.bugzilla.org/) = Free
Bugzilla is a "Defect Tracking System" or "Bug-Tracking System". Defect Tracking Systems allow individual | [
0.6320757269859314,
-0.4781574606895447,
0.5365813374519348,
0.029408851638436317,
-0.12285620719194412,
0.042463283985853195,
0.16824933886528015,
0.07765710353851318,
-0.6716870069503784,
-0.7600460052490234,
-0.06212222948670387,
0.5462084412574768,
-0.5469110608100891,
0.28183436393737... | |
or groups of developers to keep track of outstanding bugs in their product effectively. Most commercial defect-tracking software vendors charge enormous licensing fees.
[Trac](http://trac.edgewall.org/) = Free
Trac is an enhanced wiki and issue tracking system for software development projects.
**Database Server & Clients**
[MySQL](http://dev.mysql.com/downloads/mysql/?rz=gdl#downloads) = Free
[CocoaMySQL](http://cocoamysql.sourceforge.net/) = Free
**Web Server**
[Apache](http://apache.org/) = Free
**Development and Build Tools**
[XCode](http://www.apple.com/macosx/features/300.html#xcode3) = Free
[CruiseControl](http://cruisecontrol.sourceforge.net/) = Free
CruiseControl is a framework for a continuous build process. It includes, but is not limited to, plugins for email notification, Ant, and various source control tools. A web interface is provided to view the details of the current and previous builds.
**Collaboration Tools**
[Writeboard](http://www.writeboard.com/) = Free
[Ta-da List](http://www.tadalist.com/) = Free
[Campfire | [
0.26777905225753784,
-0.15040868520736694,
0.5520350933074951,
0.19782628118991852,
0.21538275480270386,
-0.16130512952804565,
0.05124066025018692,
-0.20585322380065918,
-0.4373336136341095,
-0.23933464288711548,
-0.34428611397743225,
0.6410689353942871,
-0.06752084195613861,
-0.0145695395... | |
Chat](https://signup.37signals.com/campfire/free/signup/new) for 4 users = Free
[WordPress](http://wordpress.org/download/) = Free
"WordPress is a state-of-the-art publishing platform with a focus on aesthetics, web standards, and usability. WordPress is both free and priceless at the same time."
[Gmail](http://www.gmail.com/) = Free
"Gmail is a new kind of webmail, built on the idea that email can be more intuitive, efficient, and useful."
**Screen Capture (Video / Still)**
[Jing](http://www.jingproject.com/) = Free
"The concept of Jing is the always-ready program that instantly captures and shares images and video…from your computer to anywhere."
---
**Lots of great responses:**
TeamCity [Yo|||]
Skype [Eric DeLabar]
FogBugz [chakrit]
IChatAV and Screen Sharing (built-in to OS) [amrox]
Google Docs [amrox]
---
You've got most of it covered.
I always | [
0.45555272698402405,
0.0974532887339592,
0.6950414180755615,
0.3688182830810547,
-0.38397619128227234,
-0.32814905047416687,
0.3196810483932495,
-0.03125111386179924,
-0.21837566792964935,
-0.32109516859054565,
-0.1928558647632599,
0.662898063659668,
-0.21471498906612396,
-0.19082485139369... | |
add space, time and money for 2 more things you might consider strange.
1. A machine set up just like the average user. No development or debugging tools installed. Make it look like someone just bought it from the Apple store. I do image switching but I've know people who swear by switching to an external boot drive.
2. Also include a 'free' lunch for a virgin. This is someone to come in and test your program that is NOT a developer and doesn't know squat about your software. You might have to do this more than once but don't ever use | [
0.8169826865196228,
0.04802882298827171,
-0.2429301142692566,
0.4287419021129608,
0.03532139211893082,
-0.096241794526577,
0.12025171518325806,
0.3184530436992645,
-0.21191604435443878,
-0.5377293229103088,
0.32492026686668396,
0.5102213621139526,
-0.07453186810016632,
-0.06332647055387497... | |
the same person again.
As an added note, make very sure the 'free' applications and web sites you use are truly free, not just free for personal use!
Good luck on your project! | [
0.6071568131446838,
0.06268597394227982,
0.0017990252235904336,
0.48639532923698425,
0.04946882277727127,
-0.5884953141212463,
0.5380319952964783,
0.6185771822929382,
-0.2754046618938446,
-0.5205503702163696,
-0.27669212222099304,
0.5554673671722412,
0.14246907830238342,
0.0551764033734798... | |
Can anyone tell me what exactly does this Java code do?
```
SecureRandom random = SecureRandom.getInstance("SHA1PRNG");
byte[] bytes = new byte[20];
synchronized (random)
{
random.nextBytes(bytes);
}
return Base64.encode(bytes);
```
---
Step by step explanation will be useful so that I can recreate this code in VB. Thanks
Using code snippets you can get to something like this
```
Dim randomNumGen As RandomNumberGenerator = RNGCryptoServiceProvider.Create()
Dim randomBytes(20) As Byte
randomNumGen.GetBytes(randomBytes)
return Convert.ToBase64String(randomBytes)
``` | [
0.21013905107975006,
-0.03162850812077522,
0.30506280064582825,
-0.0749717578291893,
-0.16884124279022217,
-0.1327512115240097,
0.1919686496257782,
-0.38178160786628723,
-0.41101765632629395,
-0.5229264497756958,
0.12015312165021896,
0.4199801981449127,
-0.22202223539352417,
0.376958876848... | |
How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries?
Example:
You have several text boxes and several corresponding check boxes on a form, and when the check box next to the text box is checked, the text box is enabled and you can then search by what is entered into said text box
(Actually I already know this, just playing stackoverflow jeopardy, where I ask a question I know the | [
0.2640329599380493,
0.034181930124759674,
-0.06173092871904373,
0.49082690477371216,
0.3004706799983978,
-0.5852638483047485,
0.12436259537935257,
-0.3135029673576355,
-0.15835025906562805,
-0.3795877993106842,
0.10702723264694214,
0.5265144109725952,
-0.21365348994731903,
0.05081693828105... | |
answer just to increase the world's coding knowledge! answer coming in about 5 mins)
This is actually a pretty large topic, and fraught with all kinds of potential problems. Most intermediate to advanced books on Access will have some kind of section discussing "Query by Form," where you have an unbound form that allows the user to choose certain criteria, and that when executed, writes on-the-fly SQL to return the matching data.
In anything but a flat, single-table data structure, this is not a trivial task because the FROM clause of the SQL is dependent on the tables queried in the WHERE | [
0.508155882358551,
-0.06515562534332275,
0.5450283885002136,
0.48435235023498535,
0.025382569059729576,
-0.06502272933721542,
0.24968750774860382,
-0.2605808675289154,
0.11469947546720505,
-0.5677070021629333,
-0.17538537085056305,
0.2997928857803345,
0.09260478615760803,
-0.13905982673168... | |
clause.
A few examples of some QBF forms from apps I've created for clients:
1. [Querying 4 underlying tables](http://dfenton.com/DFA/examples/Search.gif)
2. [Querying a flat single table](http://dfenton.com/DFA/examples/SearchSimple.gif)
3. [Querying 3 underlying tables](http://dfenton.com/DFA/examples/QBF/CFM.gif)
4. [Querying 6 underlying tables](http://dfenton.com/DFA/examples/QBF/SA.gif)
5. [Querying 2 underlying tables](http://dfenton.com/DFA/examples/QBF/WTS.gif)
The first one is driven by a class module that has properties that reflect the criteria selected in this form, and that has methods that write the FROM and WHERE clauses. This makes it extremely easy to add other fields (as long as those fields don't come from tables other than the ones already included).
The most complex part of the process is writing the FROM clause, as | [
0.39288851618766785,
-0.19048340618610382,
0.5721533298492432,
-0.1295066773891449,
-0.46474847197532654,
0.03131064772605896,
0.2500506639480591,
-0.6239134669303894,
0.0567539781332016,
-0.4528597891330719,
-0.49522414803504944,
0.6338749527931213,
-0.48045334219932556,
-0.03989532962441... | |
you have to have appropriate join types and include only the tables that are either in the SELECT clause or the WHERE clause. If you include anything else, you'll slow down your query a lot (especially if you have any outer joins).
But this is a big subject, and there is no magic bullet solution -- instead, something like this has to be created for each particular application. It's also important that you test it thoroughly with users, since what is completely clear and understandable to you, the developer, is often pretty darned mystifying to end users.
But that's a principle that | [
0.5716814398765564,
0.2730966806411743,
-0.025308916345238686,
0.42159098386764526,
0.10330119729042053,
-0.5475409030914307,
0.3481576144695282,
0.10469108074903488,
-0.04322579875588417,
-0.48700031638145447,
-0.04055631160736084,
0.2017161250114441,
-0.35894444584846497,
0.0047360500320... | |
doesn't just apply to QBF! | [
0.7127379179000854,
0.3598223626613617,
0.33196353912353516,
0.003210319671779871,
-0.1432044953107834,
-0.7115748524665833,
0.7935318946838379,
0.2818599343299866,
-0.08731584995985031,
0.033898770809173584,
0.14454787969589233,
0.2243821769952774,
0.010938536375761032,
0.1911680996417999... | |
I am playing with Microsoft's TreeView control and I am trying to force a data update of some sorts while editing a node's label, similar to UpdateData for a grid.
Basically, in my editor, I have a Save button and this TreeView control: what I want is when I am editing a node's label in the TreeView, if I click on the Save button I want to be able to commit the node's label I was editing.
`volatile` is needed if you are reading from a spot in memory that, say, a completely separate process/device/whatever may write to.
I used to work with | [
-0.12532691657543182,
-0.1373996138572693,
0.03088216669857502,
0.1469443291425705,
0.12728847563266754,
-0.30462488532066345,
-0.00978940725326538,
0.2855866849422455,
0.006530113518238068,
-0.5800283551216125,
0.0012339915847405791,
0.801967203617096,
-0.23218348622322083,
0.192220658063... | |
dual-port ram in a multiprocessor system in straight C. We used a hardware managed 16 bit value as a semaphore to know when the other guy was done. Essentially we did this:
```
void waitForSemaphore()
{
volatile uint16_t* semPtr = WELL_KNOWN_SEM_ADDR;/*well known address to my semaphore*/
while ((*semPtr) != IS_OK_FOR_ME_TO_PROCEED);
}
```
Without `volatile`, the optimizer sees the loop as useless (The guy never sets the value! He's nuts, get rid of that code!) and my code would proceed without having acquired the semaphore, causing problems later on. | [
0.13903877139091492,
0.12011273205280304,
0.29708024859428406,
0.012209766544401646,
0.14773507416248322,
0.08962582051753998,
0.4044552147388458,
-0.2516067326068878,
-0.1907246857881546,
-0.11759083718061447,
-0.04575841501355171,
0.7465998530387878,
-0.5372746586799622,
0.26173919439315... | |
I have an app that I've written in C#/WinForms ([my little app](http://www.thekbase.com "TheKBase")). To make it cross-platform, I'm thinking of redoing it in Adobe AIR. Are there any arguments in favor of WinForms as a cross-platform app? Is there a cross-platform future for Winforms (e.g., Mono, etc.)? Suggestions for cross-platform UI development?
By cross-platform I mean, currently, Mac OSX, Windows and Linux.
This question was [asked again and answered with better success](https://stackoverflow.com/questions/116468/winforms-for-mono-on-mac-linux-and-pc-redux).
> I'm thinking of redoing it in Adobe AIR
Not having spent much time with AIR, my personal opinion is that it is best for bringing a webapp to the desktop and | [
0.5104784369468689,
0.27296575903892517,
0.3435455858707428,
-0.010820424184203148,
-0.2741072177886963,
-0.002834814600646496,
0.02165980264544487,
-0.09633945673704147,
-0.008055745624005795,
-0.701309084892273,
-0.06641045957803726,
0.5870218873023987,
-0.2719745934009552,
0.15150734782... | |
provide a shell to it or run your existing flash/flex project on the desktop.
Btw, if you don't know ActionScript, I mean its details, quirks, etc, don't forget to factor in the time it will take googling for answers.
> Are there any arguments in favor of WinForms as a cross-platform app?
> Is there a cross-platform future for Winforms (e.g., Mono, etc.)?
It's always hard to predict what will happen, but there is at least one project (Plastic SCM) I know of which uses Mono Winforms on Win, Mac and Linux, so it is certainly doable. However, they say they | [
0.4786924421787262,
-0.022869842126965523,
0.03036189265549183,
0.176191046833992,
-0.11979922652244568,
-0.20914225280284882,
0.053119271993637085,
0.2579040229320526,
-0.12119124829769135,
-0.6553413271903992,
-0.0006160035263746977,
0.6950743198394775,
-0.2274114191532135,
-0.0167266484... | |
built most of their controls from the ground up (and claim they want to release them as open source, but not sure if or when), so you will need to put in some work to make things look "pretty".
I played with Winforms on non-windows platforms and unfortunately, it isn't exactly "mature" (especially on Mac). So what you get out of the box may or may not be sufficient for your needs.
If you decide a desktop app is not the best way to provide a cross-platform solution, you can always take your business logic written in C# and create either | [
0.4631582796573639,
0.10621655732393265,
0.40175867080688477,
0.28373265266418457,
0.30363571643829346,
0.054236460477113724,
-0.0770566314458847,
-0.15648560225963593,
0.22107818722724915,
-0.37591591477394104,
0.3396458327770233,
0.7748554348945618,
-0.26015037298202515,
-0.0709109380841... | |
a full-blown webapp with ASP.NET or go with Silverlight, so many other options exist with C#. | [
0.1186956986784935,
-0.461439311504364,
0.3680257201194763,
0.2010280340909958,
-0.2912813723087311,
-0.14384159445762634,
0.024689992889761925,
0.27118778228759766,
-0.32675015926361084,
-0.6357988715171814,
-0.4404582977294922,
0.23117731511592865,
-0.10268431901931763,
0.023858482018113... | |
I save stuff in an [Isolated Storage](http://msdn.microsoft.com/en-us/library/3ak841sy.aspx) file (using class IsolatedStorageFile). It works well, and I can retrieve the saved values when calling the saving and retrieving methods in my [DAL](http://en.wikipedia.org/wiki/Data_access_layer) layer from my GUI layer. However, when I try to retrieve the same settings from another assembly in the same project, it gives me a FileNotFoundException. What do I do wrong? This is the general concept:
```
public void Save(int number)
{
IsolatedStorageFile storage = IsolatedStorageFile.GetMachineStoreForAssembly();
IsolatedStorageFileStream fileStream = | [
0.27426332235336304,
0.12918579578399658,
0.0045939851552248,
-0.1656404286623001,
0.1625438779592514,
0.12071693688631058,
0.39840513467788696,
0.06261356174945831,
-0.0842377319931984,
-0.7029178738594055,
0.012674779631197453,
0.3237958550453186,
-0.33260950446128845,
0.1230795234441757... | |
new IsolatedStorageFileStream(filename, FileMode.OpenOrCreate, storage);
StreamWriter writer = new StreamWriter(fileStream);
writer.WriteLine(number);
writer.Close();
}
public int Retrieve()
{
IsolatedStorageFile storage = IsolatedStorageFile.GetMachineStoreForAssembly();
IsolatedStorageFileStream fileStream = new IsolatedStorageFileStream(filename, FileMode.Open, storage);
StreamReader reader = new StreamReader(fileStream); | [
-0.36504289507865906,
-0.2548101246356964,
0.5217839479446411,
-0.39917486906051636,
0.07604975253343582,
0.2817961573600769,
0.3216395378112793,
-0.1276407241821289,
-0.0379510223865509,
-0.7307451963424683,
-0.29405805468559265,
0.44843414425849915,
-0.6468446850776672,
0.389547139406204... | |
int number;
try
{
string line = reader.ReadLine();
number = int.Parse(line);
}
finally
{
reader.Close();
}
return number; | [
-0.39066511392593384,
-0.3704489767551422,
0.6777323484420776,
-0.3378220498561859,
0.05531122907996178,
0.339860200881958,
0.22289612889289856,
0.018527278676629066,
0.08174625784158707,
-0.603218138217926,
-0.6431778073310852,
0.21351197361946106,
-0.4004928469657898,
0.3627469539642334,... | |
}
```
I've tried using all the GetMachineStoreFor\* scopes.
EDIT: Since I need several assemblies to access the files, it doesn't seem possible to do with isolated storage, unless it's a [ClickOnce](http://en.wikipedia.org/wiki/ClickOnce) application.
When you instantiated the IsolatedStorageFile, did you scope it to IsolatedStorageScope.Machine?
Ok now that you have illustrated your code style and I have gone back to retesting the behaviour of the methods, here is the explanation:
* GetMachineStoreForAssembly() - scoped to the machine and the assembly identity. Different assemblies in the same application would have their own isolated storage.
* GetMachineStoreForDomain() - a misnomer in my opinion. scoped to the machine | [
0.2520598769187927,
0.15831220149993896,
0.0001664326264290139,
-0.14380936324596405,
0.01272522285580635,
-0.1462050825357437,
0.3933151066303253,
-0.10022673010826111,
-0.31657442450523376,
-0.6264726519584656,
-0.002254003193229437,
0.42967647314071655,
-0.6765639185905457,
0.1251449137... | |
and the domain identity *on top of* the assembly identity. There should have been an option for just AppDomain alone.
* GetMachineStoreForApplication() - this is the one you are looking for. I have tested it and different assemblies can pick up the values written in another assembly. The only catch is, the *application identity* must be verifiable. When running locally, it cannot be properly determined and it will end up with exception "Unable to determine application identity of the caller". It can be verified by deploying the application via Click Once. Only then can this method apply and achieve its desired | [
0.39065349102020264,
0.08292099088430405,
0.5888592004776001,
0.09756242483854294,
0.19382138550281525,
-0.3453090488910675,
0.35290589928627014,
-0.09279867261648178,
-0.38799378275871277,
-0.5789480805397034,
-0.25165969133377075,
0.428243488073349,
-0.4688795506954193,
0.293852090835571... | |
effect of shared isolated storage. | [
0.013963629491627216,
0.1638941615819931,
-0.06866756081581116,
0.21686407923698425,
0.21330901980400085,
-0.12293682992458344,
-0.20634271204471588,
-0.16400304436683655,
-0.31794553995132446,
-0.7495999336242676,
-0.09433013200759888,
0.16627532243728638,
0.1079971045255661,
0.2500629723... | |
I have some code like this:
```
If key.Equals("search", StringComparison.OrdinalIgnoreCase) Then
DoSomething()
End If
```
I don't care about the case. Should I use `OrdinalIgnoreCase`, `InvariantCultureIgnoreCase`, or `CurrentCultureIgnoreCase`?
**[Newer .Net Docs now has a table to help you decide which is best to use in your situation.](https://learn.microsoft.com/en-us/dotnet/standard/base-types/best-practices-strings#choosing-a-stringcomparison-member-for-your-method-call)**
From MSDN's "[New Recommendations for Using Strings in Microsoft .NET 2.0](https://learn.microsoft.com/en-us/previous-versions/dotnet/articles/ms973919(v=msdn.10))"
> Summary: Code owners previously using the `InvariantCulture` for string comparison, casing, and sorting should strongly consider using a new set of `String` overloads in Microsoft .NET 2.0. *Specifically, data that is designed to be culture-agnostic and linguistically irrelevant* should begin specifying overloads using either the `StringComparison.Ordinal` | [
0.06156858429312706,
-0.07131309062242508,
0.3663409650325775,
-0.009410028345882893,
0.020776065066456795,
-0.13772094249725342,
0.16114020347595215,
-0.19979038834571838,
-0.08498303592205048,
-0.6197608113288879,
0.07705269753932953,
0.2905917465686798,
-0.1019563227891922,
0.1672736853... | |
or `StringComparison.OrdinalIgnoreCase` members of the new `StringComparison` enumeration. These enforce a byte-by-byte comparison similar to `strcmp` that not only avoids bugs from linguistic interpretation of essentially symbolic strings, but provides better performance. | [
-0.15005357563495636,
0.020506305620074272,
-0.028855731710791588,
0.06528942286968231,
-0.15797415375709534,
0.0729093998670578,
0.05855366960167885,
-0.08282498270273209,
-0.32695308327674866,
-0.4693155288696289,
-0.5476521253585815,
0.4109334647655487,
-0.3298328220844269,
-0.018863270... | |
Is there an easy way to capitalize the first letter of a string and lower the rest of it? Is there a built in method or do I need to make my own?
`TextInfo.ToTitleCase()` capitalizes the first character in each token of a string.
If there is no need to maintain Acronym Uppercasing, then you should include `ToLower()`.
```
string s = "JOHN DOE";
s = CultureInfo.CurrentCulture.TextInfo.ToTitleCase(s.ToLower());
// Produces "John Doe"
```
If CurrentCulture is unavailable, use:
```
string s = "JOHN DOE";
s = new System.Globalization.CultureInfo("en-US", false).TextInfo.ToTitleCase(s.ToLower());
```
See the [MSDN Link](http://msdn2.microsoft.com/en-us/library/system.globalization.textinfo.totitlecase.aspx) for a detailed description. | [
0.27284830808639526,
0.0542113222181797,
0.40588849782943726,
0.05431189388036728,
-0.03875872492790222,
0.14559273421764374,
-0.01778995245695114,
0.0858972817659378,
-0.19339892268180847,
-0.40534529089927673,
-0.17173899710178375,
0.12774556875228882,
-0.06441417336463928,
0.11814125627... | |
When you use Visual Studio's code analysic (FxCop), and want to suppress a message there are 3 options.
1. Suppress a violation in code.
2. Suppress a violation in a GlobalSupression.cs file.
3. Disable the violation check in the project file (via Project -> Properties -> Code Analysic).
The later is very hard to review when checking in to Source Control, and it is hard to get an overview of all disabled violations. So we would like to use option 2.
The problem with option 1 and 2 is that you get one suppression line for each violation. E.g like:
```
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = | [
0.17543762922286987,
-0.1477777063846588,
0.4310801327228546,
0.089605413377285,
-0.2515653669834137,
-0.12077879160642624,
0.6060223579406738,
-0.4994905889034271,
-0.26378852128982544,
-0.4799802899360657,
-0.2849067449569702,
0.6177960634231567,
-0.5512790679931641,
-0.1381651610136032,... | |
"namespace", Target = "Company.Project.Namespace2")]
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace", Target = "Company.Project.Namespace1")]
```
We would love to do something like this ing GlobalSuppressions.cs:
```
[assembly: SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes")]
```
But is this possible?
Suppressing multiple violations with a single **SuppressMessage** attribute is officially not supported. Apparently, this is by design.
I agree, it might be annoying at times, but I can't say I disagree with the decision, since the attribute is their way to force you to say, "Yes, I know what I am doing", which should be evaluated in a case-by-case basis. | [
0.3505333960056305,
0.3019410967826843,
0.16000451147556305,
0.08532574027776718,
0.13360901176929474,
-0.5836209058761597,
0.3493378162384033,
-0.18322008848190308,
-0.2450036257505417,
-0.502979040145874,
-0.029226088896393776,
0.4752112329006195,
-0.21226263046264648,
-0.018609361723065... | |
I am just starting to learn javascript, so I don't have the skills to figure out what I assume is a trivial problem.
I'm working with a Wordpress blog that serves as a FAQ for our community and I am trying to pull together some tools to make managing the comments easier. [Internet Duct Tape's Greasemonkey tools, like Comment Ninja](https://stackoverflow.com/users/4465/levik), are helpful for most of it, but I want to be able to get a list of all the IP addresses that we're getting comments from in order to track trends and so forth.
I just want to be able to select | [
0.9400590658187866,
0.24041080474853516,
0.24048256874084473,
0.03853587061166763,
-0.058610476553440094,
-0.0640181303024292,
0.007021431345492601,
0.25938770174980164,
-0.6751774549484253,
-0.5647108554840088,
0.14703230559825897,
0.5460500121116638,
0.16637861728668213,
-0.0388368442654... | |
a bunch of text on the comments page and click a bookmarklet ([http://bookmarklets.com](https://stackoverflow.com/users/8119/jacob)) in Firefox that pops up a window listing all the IP addresses found in the selection.
**Update:**
I kind of combined a the answers from [levik](https://stackoverflow.com/users/4465/levik) and [Jacob](https://stackoverflow.com/users/8119/jacob) to come up with this:
```
javascript:ipAddresses=document.getSelection().match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g).join("<br>");newWindow=window.open('', 'IP Addresses in Selection', 'innerWidth=200,innerHeight=300,scrollbars');newWindow.document.write(ipAddresses)
```
The difference is that instead of an *alert* message, as in levik's answer, I open a new window similar to Jacob's answer. The *alert* doesn't provide scroll bars which can be a problem for pages with many IP addresses. However, I needed the list to be vertical, unlike Jacob's solution, so I | [
0.06559639424085617,
0.13046224415302277,
0.6861758828163147,
-0.0904579609632492,
-0.19237640500068665,
0.12951582670211792,
0.31102731823921204,
-0.5827655792236328,
-0.40793415904045105,
-0.7851842641830444,
-0.2256087213754654,
0.21783499419689178,
-0.49652546644210815,
-0.241641238331... | |
used the hint from levik's to make a for the join instead of levik's *\n*.
Thanks for all the help, guys.
In Firefox, you could do something like this:
```
javascript:alert(
document.getSelection().match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/g)
.join("\n"))
```
How this works:
* Gets the selection text from the browser ("document.getSelection()" in FF, in IE it would be "document.selection.createRange().text")
* Applies a regular expression to march the IP addresses (as suggested by Muerr) - this results in an array of strings.
* Joins this array into one string separated by return characters
* Alerts that string
The way you get the selection is a little different on IE, but the principle is | [
0.18808312714099884,
-0.049717750400304794,
0.47319474816322327,
-0.20483329892158508,
-0.3106544017791748,
-0.2620982229709625,
0.16852959990501404,
-0.46361589431762695,
-0.4074002504348755,
-0.8133467435836792,
-0.18221144378185272,
0.5098009705543518,
-0.6311813592910767,
-0.1766389906... | |
the same. To get it to be cross-browser, you'd need to check which method is available. You could also do more complicated output (like create a floating DIV and insert all the IPs into it). | [
0.266508549451828,
-0.2759917974472046,
0.12010347098112106,
0.2935846447944641,
-0.12105154246091843,
-0.2901362478733063,
-0.20023424923419952,
0.08849361538887024,
-0.27603739500045776,
-0.7025526165962219,
0.03375519439578056,
0.20679251849651337,
-0.21906709671020508,
0.00700144702568... | |
I was wondering; which logging libraries for Delphi do you prefer?
* [CodeSite](http://www.raize.com/devtools/codesite/)
* [SmartInspect](http://www.gurock.com/products/smartinspect/)
* [Log4Delphi](http://log4delphi.sourceforge.net/)
* [TraceFormat](http://tracetool.sourceforge.net/)
Please try to add a reasoning why you prefer one over the other if you've used more than one.
I'll add suggestions to this question to keep things readable.
**SmartInspect** is really useful. It is the only one I have used. The logging library is good, but the console and the remote TCP/IP logging takes it over the top. I think CodeSite has some similar features. | [
0.4582419693470001,
-0.18581528961658478,
-0.02459176816046238,
0.0994764119386673,
0.03923574835062027,
-0.4948280155658722,
-0.1128602996468544,
0.11437386274337769,
-0.2834954857826233,
-0.7736595273017883,
0.16046620905399323,
0.4974941611289978,
-0.07353957742452621,
-0.23939599096775... | |
We have several wizard style form applications on our website where we capture information from the user on each page and then submit to a backend process using a web service.
Unfortunately we can't submit the information in chunks during each form submission so we have to store it the users session until the end of the process and submit it all at the same time.
Is the amount of server memory/sql server disk space the only constraint on how much I can store in users sessions or is there something else I need to consider?
Edit: The site is built on ASP.NET | [
0.775856614112854,
0.040785279124975204,
0.2946031391620636,
0.3141627013683319,
-0.06618362665176392,
-0.42583170533180237,
0.20927731692790985,
-0.04720483347773552,
-0.0031012047547847033,
-0.8464692234992981,
0.14592134952545166,
0.4464741051197052,
0.0564674437046051,
0.03602749854326... | |
web forms.
Assuming the information is not sensitive then you could store the information in a cookie which would reduce the amount of information required to be stored server side. This would also allow you to access the information via JavaScript.
Alternatively you could use the viewstate to store the information although this can lead to large amounts of data being sent between the server and the client and not my preferred solution.
The amount of session information you should store varies wildly depending on the application, number of expected users, server specification etc. To give a more accurate answer would require | [
0.7285525798797607,
0.00041353562846779823,
0.5877927541732788,
0.4086577594280243,
-0.11579393595457077,
-0.33454379439353943,
0.4388151168823242,
-0.20445427298545837,
-0.3773406147956848,
-0.9128855466842651,
0.10406878590583801,
0.4172016978263855,
-0.2029043436050415,
0.16737417876720... | |
more information :)
Finally, assuming that the information collected throughout the process is not required from page to page then you could store all the information in a database table and only store the records unique id in the session. As each page is submitted the db record is updated and then on the final page all the information is retrieved and submitted. This is not an idea solution if you need to retrieve previous information on each subsequent page due to the number of db reads required. | [
0.5605527758598328,
-0.07468806952238083,
0.24908564984798431,
0.4059138298034668,
-0.3350774943828583,
-0.09511327743530273,
0.2197238951921463,
-0.6803107857704163,
0.009262456558644772,
-0.7207369208335876,
-0.03442215174436569,
0.4981430768966675,
-0.06283944845199585,
0.32031458616256... | |
I'd really like to handle this without monkey-patching but I haven't been able to find another option yet.
I have an array (in Ruby) that I need to sort by multiple conditions. I know how to use the sort method and I've used the trick on sorting using an array of options to sort by multiple conditions. However, in this case I need the first condition to sort ascending and the second to sort descending. For example:
```
ordered_list = [[1, 2], [1, 1], [2, 1]]
```
Any suggestions?
Edit: Just realized I should mention that I can't easily compare the first and second values (I'm | [
0.08503630012273788,
0.23518311977386475,
0.1418524980545044,
-0.1636563539505005,
-0.02193005569279194,
0.27997469902038574,
0.36182963848114014,
-0.2470923513174057,
-0.4218446910381317,
-0.772138774394989,
-0.026339948177337646,
0.24102723598480225,
-0.5645253658294678,
0.05272183194756... | |
actually working with object attributes here). So for a simple example it's more like:
```
ordered_list = [[1, "b"], [1, "a"], [2, "a"]]
```
How about:
```
ordered_list = [[1, "b"], [1, "a"], [2, "a"]]
ordered_list.sort! do |a,b|
[a[0],b[1]] <=> [b[0], a[1]]
end
``` | [
-0.15024687349796295,
-0.1385456621646881,
0.2174633890390396,
-0.0945969894528389,
-0.06123187765479088,
-0.02190684713423252,
0.25954699516296387,
-0.36225461959838867,
-0.4844995439052582,
-0.49606990814208984,
-0.2760707437992096,
0.5390250086784363,
-0.5778555274009705,
-0.14261168241... | |
This is a 3 part question regarding embedded RegEx into SQL statements.
1. How do you embed a RegEx expression into an Oracle PL/SQL
select statement that will parse out
the “DELINQUENT” string in the text
string shown below?
2. What is the performance impact if used within a
mission critical business
transaction?
3. Since embedding regex
into SQL was introduced in Oracle
10g and SQL Server 2005, is it
considered a recommended practice?
---
Dear Larry :
Thank you for using ABC's alert service.
ABC has detected a change in the status of one of your products in the state of KS. Please review the
information below to determine if this status change was | [
0.4915786683559418,
0.15373826026916504,
-0.016378041356801987,
0.31585758924484253,
-0.10169218480587006,
-0.2718406021595001,
0.2554747462272644,
0.0003761349944397807,
0.1068715751171112,
-0.3301292061805725,
0.1120113730430603,
0.5130825638771057,
-0.3106890916824341,
0.076028503477573... | |
intended.
ENTITY NAME: Oracle Systems, LLC
PREVIOUS STATUS: --
CURRENT STATUS: DELINQUENT
As a reminder, you may contact your the ABC Team for assistance in correcting any delinquencies or, if needed, reinstating
the service. Alternatively, if the system does not intend to continue to engage this state, please notify ABC
so that we can discontinue our services.
Kind regards,
Service Team 1
ABC
--PLEASE DO NOT REPLY TO THIS EMAIL. IT IS NOT A MONITORED EMAIL ACCOUNT.--
Notice: ABC Corporation cannot independently verify the timeliness, accuracy, or completeness of the public information
maintained by the responsible government agency or other sources of data upon which these alerts are based.
Why would you need | [
0.4291130006313324,
0.29143235087394714,
0.17087987065315247,
0.06657248735427856,
0.23408199846744537,
-0.12838222086429596,
0.3541249930858612,
0.24485749006271362,
0.0006489020888693631,
-0.24305802583694458,
-0.029976632446050644,
0.3768582046031952,
-0.4442278742790222,
0.210492596030... | |
regular expressions here?
INSTR and SUBSTR will do the job perfectly.
But if you convinced you need Regex'es you can use:
[REGEXP\_INSTR](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions129.htm#i1239887)
[REGEXP\_REPLACE](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions130.htm#i1305521)
[REGEXP\_SUBSTR](http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/functions131.htm#i1239858)
(only available in Oracle 10g and up)
```
SELECT emp_id, text
FROM employee_comment
WHERE REGEXP_LIKE(text,'...-....');
``` | [
-0.03871874511241913,
0.008834829553961754,
0.39032334089279175,
0.034740012139081955,
-0.11357208341360092,
0.16899080574512482,
0.6414667367935181,
0.05589383468031883,
-0.22894950211048126,
-0.2671133875846863,
-0.48871445655822754,
0.7874521613121033,
-0.5651239156723022,
-0.5681267380... | |
In Visual Studio 2005-2015 it is possible to find all lines containing certain references and display them in a "Find Results" window.
Now that these result lines are displayed, is there any keyboard shortcut that would allow adding debug breakpoints to all of them?
***This answer does not work for Visual Studio 2015 or later. A more recent answer can be found [here](https://stackoverflow.com/questions/38061627/how-do-i-add-debug-breakpoints-to-lines-displayed-in-a-find-results-window-in?rq=1).***
You can do this fairly easily with a Visual Studio macro. Within Visual Studio, hit Alt-F11 to open the Macro IDE and add a new module by right-clicking on MyMacros and selecting Add|Add Module...
Paste the following in the source editor:
```
Imports | [
-0.16747166216373444,
0.16567359864711761,
0.6043022274971008,
-0.10421360284090042,
-0.3263359069824219,
-0.05230540782213211,
0.07463338971138,
-0.30671119689941406,
-0.1971389800310135,
-0.539253830909729,
-0.12187650054693222,
0.5622383952140808,
-0.5975608229637146,
-0.141206040978431... | |
System
Imports System.IO
Imports System.Text.RegularExpressions
Imports EnvDTE
Imports EnvDTE80
Imports EnvDTE90
Imports System.Diagnostics
Public Module CustomMacros
Sub BreakpointFindResults()
Dim findResultsWindow As Window = DTE.Windows.Item(Constants.vsWindowKindFindResults1)
Dim selection As TextSelection
selection = findResultsWindow.Selection
selection.SelectAll()
Dim findResultsReader As New StringReader(selection.Text)
Dim findResult As String = findResultsReader.ReadLine()
Dim findResultRegex As New Regex("(?<Path>.*?)\((?<LineNumber>\d+)\):") | [
-0.3064629137516022,
-0.35049179196357727,
0.8462365865707397,
-0.05560944974422455,
-0.028594322502613068,
0.42138463258743286,
0.18787872791290283,
-0.46680358052253723,
-0.3836204707622528,
-0.5492291450500488,
-0.5053708553314209,
0.5416870713233948,
-0.5463472604751587,
0.152736142277... | |
While Not findResult Is Nothing
Dim findResultMatch As Match = findResultRegex.Match(findResult)
If findResultMatch.Success Then
Dim path As String = findResultMatch.Groups.Item("Path").Value
Dim lineNumber As Integer = Integer.Parse(findResultMatch.Groups.Item("LineNumber").Value)
Try | [
-0.31128162145614624,
-0.4557878077030182,
0.6204530596733093,
-0.3499802350997925,
0.15175049006938934,
-0.026750197634100914,
0.42477282881736755,
-0.6393558382987976,
-0.07585940510034561,
-0.5196890234947205,
-0.36664482951164246,
0.4332694709300995,
-0.11447536945343018,
0.07447393238... | |
DTE.Debugger.Breakpoints.Add("", path, lineNumber)
Catch ex As Exception
' breakpoints can't be added everywhere
End Try
End If | [
0.17008835077285767,
-0.3820013701915741,
-0.019268600270152092,
-0.21700292825698853,
0.02507437951862812,
-0.10158055275678635,
0.6166062951087952,
-0.12149926275014877,
-0.10050485283136368,
-0.36029306054115295,
-0.46997109055519104,
0.11508273333311081,
-0.43404868245124817,
0.1392941... | |
findResult = findResultsReader.ReadLine()
End While
End Sub
End Module
```
This example uses the results in the "Find Results 1" window; you might want to create an individual shortcut for each result window.
You can create a keyboard shortcut by going to Tools|Options... and selecting **Keyboard** under the **Environment** section in the navigation on the left. Select your macro and assign any shortcut you like.
You can also add your macro to a menu or toolbar by going to Tools|Customize... and selecting the **Macros** section in the navigation on the left. Once you | [
-0.20457415282726288,
-0.1738145500421524,
0.5611633062362671,
-0.09917864948511124,
0.316272109746933,
0.023798247799277306,
0.13259001076221466,
-0.1746571660041809,
-0.07681245356798172,
-0.8584314584732056,
-0.11189376562833786,
0.7341045141220093,
-0.15492071211338043,
-0.098493970930... | |
locate your macro in the list, you can drag it to any menu or toolbar, where it its text or icon can be customized to whatever you want. | [
0.4182043969631195,
-0.17212241888046265,
0.5231802463531494,
0.022719521075487137,
0.262197345495224,
0.17097024619579315,
-0.28517889976501465,
0.3522776663303375,
-0.44110560417175293,
-0.8606428503990173,
-0.023733610287308693,
0.6813376545906067,
-0.19338078796863556,
0.04674243927001... | |
I've been trying to come up with a way to create a 3 column web design where the center column has a constant width and is always centered. The columns to the left and right are variable. This is trivial in tables, but not correct semantically.
I haven't been able to get this working properly in all current browsers. Any tips on this?
Use [this technique](http://matthewjamestaylor.com/blog/perfect-3-column.htm), and simply specify a fixed width for the centre column. | [
0.04722732678055763,
0.13220003247261047,
0.7208316326141357,
-0.19790224730968475,
-0.019454732537269592,
0.04348791018128395,
0.5999575257301331,
0.18438121676445007,
-0.3933624029159546,
-0.4156615734100342,
0.1970093846321106,
0.28313517570495605,
-0.3302782475948334,
-0.15632583200931... | |
For a System.Windows.Forms.TextBox with Multiline=True, I'd like to only show the scrollbars when the text doesn't fit.
This is a readonly textbox used only for display. It's a TextBox so that users can copy the text out. Is there anything built-in to support auto show of scrollbars? If not, should I be using a different control? Or do I need to hook TextChanged and manually check for overflow (if so, how to tell if the text fits?)
---
Not having any luck with various combinations of WordWrap and Scrollbars settings. I'd like to have no scrollbars initially and have each appear dynamically only | [
0.30705463886260986,
-0.18444153666496277,
0.5159856081008911,
0.11224216967821121,
-0.05104918032884598,
-0.06543195247650146,
0.4189535975456238,
-0.07966343313455582,
-0.13115747272968292,
-0.7352954149246216,
0.1938774436712265,
0.6496859192848206,
-0.38712188601493835,
0.0656027346849... | |
if the text doesn't fit in the given direction.
---
@nobugz, thanks, that works when WordWrap is disabled. I'd prefer not to disable wordwrap, but it's the lesser of two evils.
---
@André Neves, good point, and I would go that way if it was user-editable. I agree that consistency is the cardinal rule for UI intuitiveness.
Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form. It's not quite perfect but ought to work for you.
```
using System;
using System.Drawing;
using System.Windows.Forms;
public class MyTextBox : TextBox {
private bool | [
0.1730150729417801,
0.12135904282331467,
0.3757057785987854,
-0.009714189916849136,
-0.11582011729478836,
0.12252897024154663,
0.6201285719871521,
0.048107847571372986,
0.08178458362817764,
-0.9451086521148682,
-0.12994936108589172,
0.6516430974006653,
-0.3917771577835083,
-0.0029200462158... | |
mScrollbars;
public MyTextBox() {
this.Multiline = true;
this.ReadOnly = true;
}
private void checkForScrollbars() {
bool scroll = false;
int cnt = this.Lines.Length;
if (cnt > 1) {
int pos0 = this.GetPositionFromCharIndex(this.GetFirstCharIndexFromLine(0)).Y;
if (pos0 >= 32768) pos0 -= 65536;
int pos1 = this.GetPositionFromCharIndex(this.GetFirstCharIndexFromLine(1)).Y;
if (pos1 >= 32768) pos1 -= 65536;
int h = pos1 - pos0; | [
-0.5088455080986023,
-0.42691680788993835,
1.3498047590255737,
-0.1155395582318306,
0.20432238280773163,
0.03255810588598251,
0.5314972400665283,
-0.20768140256404877,
-0.46515896916389465,
-0.13880889117717743,
-0.3786337375640869,
0.5345651507377625,
-0.28363385796546936,
0.1820314079523... | |
scroll = cnt * h > (this.ClientSize.Height - 6); // 6 = padding
}
if (scroll != mScrollbars) {
mScrollbars = scroll;
this.ScrollBars = scroll ? ScrollBars.Vertical : ScrollBars.None;
}
}
protected override void OnTextChanged(EventArgs e) {
checkForScrollbars();
base.OnTextChanged(e);
}
protected override void OnClientSizeChanged(EventArgs e) {
checkForScrollbars();
base.OnClientSizeChanged(e);
}
}
``` | [
-0.3580018877983093,
-0.34508535265922546,
1.1930251121520996,
-0.16710405051708221,
0.21342860162258148,
0.04901747778058052,
0.14174963533878326,
-0.5290350914001465,
-0.29021942615509033,
-0.5273281931877136,
-0.34486374258995056,
0.8405916094779968,
-0.2287001758813858,
0.2890152037143... | |
Is there an API call in .NET or a native DLL that I can use to create similar behaviour as Windows Live Messenger when a response comes from someone I chat with?
FlashWindowEx is the way to go. See [here for MSDN documentation](http://msdn.microsoft.com/en-us/library/ms679347%28VS.85%29.aspx)
```
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool FlashWindowEx(ref FLASHWINFO pwfi);
[StructLayout(LayoutKind.Sequential)]
public struct FLASHWINFO
{
public UInt32 cbSize;
public IntPtr hwnd;
public UInt32 dwFlags;
public UInt32 uCount;
public UInt32 dwTimeout;
}
public const UInt32 FLASHW_ALL = 3;
```
Calling the Function:
```
FLASHWINFO fInfo = new FLASHWINFO();
fInfo.cbSize = Convert.ToUInt32(Marshal.SizeOf(fInfo));
fInfo.hwnd = hWnd;
fInfo.dwFlags = FLASHW_ALL;
fInfo.uCount = UInt32.MaxValue;
fInfo.dwTimeout | [
-0.013337361626327038,
-0.0423971451818943,
0.5149365067481995,
-0.2635551691055298,
0.013457980006933212,
-0.13566748797893524,
0.5383400321006775,
-0.547766387462616,
-0.17613326013088226,
-0.5694413781166077,
-0.42483437061309814,
0.7833473682403564,
-0.3911192715167999,
-0.133902370929... | |
= 0;
FlashWindowEx(ref fInfo);
```
This was shamelessly plugged from [Pinvoke.net](http://pinvoke.net/default.aspx/user32/FlashWindowEx.html) | [
-0.13214397430419922,
0.1647872030735016,
0.32191571593284607,
-0.45041757822036743,
0.15395967662334442,
-0.05178115516901016,
0.4260823130607605,
-0.0008854346233420074,
-0.16905657947063446,
-0.17530113458633423,
-0.21624749898910522,
0.4490089416503906,
-0.3164161145687103,
0.123116679... | |
I am trying to scrape an html table and save its data in a database. What strategies/solutions have you found to be helpful in approaching this program.
I'm most comfortable with Java and PHP but really a solution in any language would be helpful.
EDIT: For more detail, the UTA (Salt Lake's Bus system) provides bus schedules on its website. Each schedule appears in a table that has stations in the header and times of departure in the rows. I would like to go through the schedules and save the information in the table in a form that I can then query. | [
0.545785665512085,
0.034595709294080734,
0.04490460827946663,
0.3064870536327362,
0.1559409499168396,
-0.07486999779939651,
0.1578916758298874,
0.436259001493454,
0.014109978452324867,
-0.985969066619873,
0.5754117369651794,
0.2226233333349228,
-0.11597471684217453,
-0.06176340952515602,
... | |
Here's the [starting point](http://www.rideuta.com/ridingUTA/schedules/routeSchedules.aspx) for the schedules
It all depends on how properly your HTML to scrape is? If it's valid XHTML, you can simply use some XPath queries on it to get whatever you want.
Example of xpath in php: <http://blogoscoped.com/archive/2004_06_23_index.html#108802750834787821>
A helper class to scrape a table into an array: <http://www.tgreer.com/class_http_php.html> | [
0.3493502140045166,
-0.5880629420280457,
0.41457289457321167,
0.20051082968711853,
-0.2684050500392914,
-0.0365435965359211,
-0.18279369175434113,
-0.19865265488624573,
-0.4212195575237274,
-0.5834189057350159,
0.35650986433029175,
0.2500271201133728,
0.06383584439754486,
-0.15431752800941... | |
I want to use a specific foreign language font for a Blackberry application. How is such a font created and loaded onto the Blackberry device?
For example: ਪੰਜਾਬੀ
A quick google search shows that the same thing has been asked at [blackberry forums](http://www.blackberryforums.com/developer-forum/100107-using-custom-fonts.html).
The solution they came up with is a class for loading the font from a [fnt file](http://www.fileinfo.net/extension/fnt).
There are [programs available](http://www.google.com/search?hl=en&q=free+.fnt+editor&btnG=Search) to import and edit fnt files. | [
0.33192747831344604,
0.22962170839309692,
0.20266467332839966,
-0.07710325717926025,
0.12190143764019012,
0.48766759037971497,
0.2205359935760498,
0.08787164837121964,
-0.01618410460650921,
-0.6075458526611328,
0.13915318250656128,
0.23377451300621033,
-0.22006559371948242,
-0.175850749015... | |
I get asked this question a lot and I thought I'd solicit some input on how to best describe the difference.
They are actually two very different things. "Delegate" is actually the name for a variable that holds a reference to a method or a lambda, and a lambda is a method without a permanent name.
Lambdas are very much like other methods, except for a couple subtle differences.
1. A normal method is defined in a ["statement"](http://en.wikipedia.org/wiki/Statement_(programming)) and tied to a permanent name, whereas a lambda is defined "on the fly" in an ["expression"](http://en.wikipedia.org/wiki/Expression_(programming)) and has no permanent name.
2. Some lambdas can | [
0.3544505536556244,
-0.33575594425201416,
-0.11860881000757217,
0.323297917842865,
-0.1814195066690445,
-0.034050941467285156,
-0.10518181324005127,
-0.09650048613548279,
-0.031270213425159454,
0.053931012749671936,
-0.035580530762672424,
0.33725932240486145,
-0.45634186267852783,
0.057558... | |
be used with .NET expression trees, whereas methods cannot.
A delegate is defined like this:
```
delegate Int32 BinaryIntOp(Int32 x, Int32 y);
```
A variable of type BinaryIntOp can have either a method or a labmda assigned to it, as long as the signature is the same: two Int32 arguments, and an Int32 return.
A lambda might be defined like this:
```
BinaryIntOp sumOfSquares = (a, b) => a*a + b*b;
```
Another thing to note is that although the generic Func and Action types are often considered "lambda types", they are just like any other delegates. The nice thing about them is that they essentially define a name for | [
0.35888972878456116,
-0.3640209138393402,
-0.11904634535312653,
0.20138435065746307,
-0.28405529260635376,
-0.07192200422286987,
-0.18736061453819275,
-0.2980685532093048,
-0.31159910559654236,
-0.06600936502218246,
-0.06469735503196716,
0.357134610414505,
-0.3921486437320709,
0.0057471576... | |
any type of delegate you might need (up to 4 parameters, though you can certainly add more of your own). So if you are using a wide variety of delegate types, but none more than once, you can avoid cluttering your code with delegate declarations by using Func and Action.
Here is an illustration of how Func and Action are "not just for lambdas":
```
Int32 DiffOfSquares(Int32 x, Int32 y)
{
return x*x - y*y;
}
Func<Int32, Int32, Int32> funcPtr = DiffOfSquares;
```
Another useful thing to know is that delegate types (not methods themselves) with the same signature but different names will not be implicitly casted | [
0.5362082719802856,
-0.038764532655477524,
-0.03977440297603607,
0.29387256503105164,
-0.19784708321094513,
-0.12181656807661057,
0.2105160355567932,
-0.6363627910614014,
-0.3275529146194458,
-0.42014214396476746,
0.044625893235206604,
0.42266133427619934,
-0.2965835630893707,
0.1275601089... | |
to each other. This includes the Func and Action delegates. However if the signature is identical, you can explicitly cast between them.
Going the extra mile.... In C# functions are flexible, with the use of lambdas and delegates. But C# does not have "first-class functions". You can use a function's name assigned to a delegate variable to essentially create an object representing that function. But it's really a compiler trick. If you start a statement by writing the function name followed by a dot (i.e. try to do member access on the function itself) you'll find there are no members there | [
0.38013535737991333,
-0.11523449420928955,
0.07552638649940491,
0.15056361258029938,
-0.11063642054796219,
-0.20229803025722504,
-0.005961000453680754,
-0.23726068437099457,
-0.48234158754348755,
-0.39291271567344666,
0.006250523496419191,
0.4123342037200928,
-0.35791686177253723,
0.008577... | |
to reference. Not even the ones from Object. This prevents the programmer from doing useful (and potentially dangerous of course) things such as adding extension methods that can be called on any function. The best you can do is extend the Delegate class itself, which is surely also useful, but not quite as much.
Update: Also see [Karg's answer](https://stackoverflow.com/questions/73227/what-is-the-difference-between-lambdas-and-delegates-in-the-net-framework#73448) illustrating the difference between anonymous delegates vs. methods & lambdas.
Update 2: [James Hart](https://stackoverflow.com/questions/73227/what-is-the-difference-between-lambdas-and-delegates-in-the-net-framework#74414) makes an important, though very technical, note that lambdas and delegates are not .NET entities (i.e. the CLR has no concept of a delegate or lambda), but rather they | [
-0.10053770244121552,
0.050645940005779266,
0.14796309173107147,
0.30665215849876404,
-0.08433080464601517,
-0.24491871893405914,
-0.1531515121459961,
-0.324381023645401,
-0.2620510458946228,
-0.07009736448526382,
-0.2706317901611328,
0.408720999956131,
-0.2568601965904236,
-0.032054763287... | |
are framework and language constructs. | [
0.47978946566581726,
0.4392085075378418,
-0.0012092828983440995,
0.23383702337741852,
0.07175760716199875,
-0.00881175510585308,
0.20109504461288452,
-0.2148185521364212,
0.19417406618595123,
-0.5932862758636475,
-0.4407085180282593,
0.509377121925354,
0.020705677568912506,
0.0003958979796... | |
In our embedded system (using a PowerPC processor), we want to disable the processor cache. What steps do we need to take?
To clarify a bit, the application in question must have as constant a speed of execution as we can make it.
Variability in executing the same code path is not acceptable. This is the reason to turn off the cache.
I'm kind of late to the question, and also it's been a while since I did all the low-level processor init code on PPCs, but I seem to remember the cache & MMU being pretty tightly coupled (one had to be | [
0.06783109158277512,
0.21224872767925262,
0.3694656789302826,
-0.012594081461429596,
0.14880675077438354,
-0.1799222230911255,
0.2396637350320816,
0.04337688535451889,
-0.18443749845027924,
-0.5853643417358398,
0.032332535833120346,
0.6907192468643188,
-0.3621527850627899,
0.05502737686038... | |
enabled to enable the other) and I *think* in the MMU page tables, you could define the cacheable attribute.
So my point is this: if there's a certain subset of code that must run in deterministic time, maybe you locate that code (via a linker command file) in a region of memory that is defined as non-cacheable in the page tables? That way all the code that can/should benefit from the cache does, and the (hopefully) subset of code that shouldn't, doesn't.
I'd handle it this way anyway, so that later, if you want to enable caching for part of the system, | [
0.15331625938415527,
-0.0877687931060791,
0.3728114068508148,
0.17051741480827332,
0.22448593378067017,
-0.07657440751791,
0.14885923266410828,
0.05130641534924507,
-0.24319303035736084,
-0.9467541575431824,
-0.1537141650915146,
0.6253552436828613,
-0.37556809186935425,
-0.0046549020335078... | |
you just need to flip a few bits in the MMU page tables, instead of (re-)writing the init code to set up all the page tables & caching. | [
0.13322411477565765,
-0.11787980049848557,
0.30793091654777527,
0.41551846265792847,
0.09674575924873352,
-0.20532317459583282,
-0.11115570366382599,
0.06070984899997711,
-0.23922714591026306,
-0.770755410194397,
-0.18627943098545074,
0.23970839381217957,
-0.1161608099937439,
-0.2472430020... | |
How do I duplicate a whole line in **Vim** in a similar way to `Ctrl`+`D` in IntelliJ IDEA/ Resharper or `Ctrl`+`Alt`+`↑`/`↓` in **Eclipse**?
`y``y` or `Y` to copy the line (mnemonic: ***y***ank)
or
`d``d` to ***d***elete the line (Vim copies what you deleted into a clipboard-like "register", like a *cut* operation)
then
`p` to ***p***aste the copied or deleted text *after* the current line
or
`P` to ***p***aste the copied or deleted text *before* the current line | [
0.14364030957221985,
-0.3103736340999603,
0.3355042636394501,
0.30297285318374634,
-0.313058078289032,
0.1807079017162323,
0.04319504275918007,
-0.03422951325774193,
-0.14616741240024567,
-0.4225693643093109,
-0.14487217366695404,
0.24111157655715942,
0.014246229082345963,
-0.0147759672254... | |
What is the difference between Introspection and Reflection in .NET
Introspection was introduced with [FxCop in 2004 as an alternative to Reflection](http://msdn.microsoft.com/en-gb/magazine/cc188721.aspx) :
> What's new in FxCop 1.30 is that it
> now performs analysis through a
> technique called Introspection. The
> use of the Introspection engine allows
> for much faster analysis and supports
> multithreaded analysis. Unlike the
> Reflection engine from previous
> versions, in the Introspection engine
> the assemblies you're analyzing are
> not locked so you won't need to shut
> down FxCop to do a fix and recompile
> of those assemblies. Finally, | [
0.07656058669090271,
-0.21923400461673737,
0.3205995559692383,
0.28875377774238586,
-0.45320528745651245,
0.13733451068401337,
-0.31863465905189514,
-0.00041545493877492845,
-0.09459344297647476,
-0.4921897053718567,
0.49264875054359436,
0.6176077127456665,
-0.439432829618454,
-0.194518804... | |
the
> Introspection engine offers a much
> richer analysis infrastructure
> compared to the Reflection engine. | [
-0.0120721235871315,
-0.09385550767183304,
0.1406579613685608,
0.3277352452278137,
-0.29063767194747925,
0.027654048055410385,
0.14437340199947357,
-0.1715327352285385,
0.2761519253253937,
-0.7234297394752502,
0.11246539652347565,
0.600841760635376,
-0.04086364060640335,
0.1867890655994415... | |
I am having a frequent problems with my web hosting (its shared)
I am not able to delete or change permission for a particular directory. The response is,
```
Cannot delete. Directory may not be empty
```
I checked the permissions and it looks OK. There are 100's of files in this folder which I don't want.
I contacted my support and they solved it saying it was permission issue. But it reappeared. Any suggestions?
The server is Linux.
You can't **rmdir** a directory with files in it. You must first **rm** all files and subdirectories. Many times, the easiest solution is:
```
$ rm -rf old_directory
```
It's entirely possible | [
0.16084761917591095,
0.3325892984867096,
0.48720237612724304,
0.04262449964880943,
0.07533571124076843,
-0.20032668113708496,
0.22840601205825806,
0.1705857664346695,
-0.23496897518634796,
-0.6103644967079163,
-0.29556596279144287,
0.5942826271057129,
-0.26853644847869873,
0.70785582065582... | |
that some of the files or subdirectories have permission limitations that might prevent them from being removed. Occasionally, this can be solved with:
```
$ chmod -R +w old_directory
```
But I suspect that's what your support people did earlier. | [
0.3412606418132782,
0.39868929982185364,
0.08257876336574554,
-0.03733504191040993,
0.48651573061943054,
-0.3458579182624817,
0.10605381429195404,
-0.0021646602544933558,
-0.30251187086105347,
-0.1471184939146042,
-0.41846683621406555,
0.6965512037277222,
-0.21790152788162231,
0.3297982215... | |
We use SAX to parse XML because it does not require the entire XML document to be read into memory in order to parse a single value. I read many articles that insisted SAX can only be used to parse/decode XML and not create it. Is this true?
No, it isn't true, you can encode XML to any Writer in Java using something similar to:
```
char[] ch;
AttributesImpl atts = new AttributesImpl();
Writer writer = new StringWriter();
StreamResult streamResult = new StreamResult(writer);
SAXTransformerFactory tf = (SAXTransformerFactory) TransformerFactory.newInstance();
// SAX2.0 ContentHandler
TransformerHandler transformerHandler = tf.newTransformerHandler();
Transformer serializer = transformerHandler.getTransformer();
serializer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
// serializer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "nodes.dtd");
serializer.setOutputProperty(OutputKeys.INDENT, "yes");
transformerHandler.setResult(streamResult);
transformerHandler.startDocument();
atts.clear();
// atts.addAttribute("", "", "xmlns", "CDATA", "http://www.example.com/nodes");
// atts.addAttribute("", "", | [
0.08171716332435608,
-0.014096318744122982,
0.7091538906097412,
-0.007740713655948639,
0.04146375134587288,
-0.04285084456205368,
0.22719387710094452,
-0.28682607412338257,
-0.027376994490623474,
-0.6026191115379333,
-0.39651602506637573,
0.681037425994873,
-0.3494383990764618,
-0.14558020... | |
"xmlns:xsi", "CDATA", "http://www.w3.org/2001/XMLSchema-instance");
// atts.addAttribute("", "", "xsi:schemaLocation", "CDATA", "/nodes.xsd");
transformerHandler.startElement("", "", "node_list", atts);
// displayName element
if (displayName != null) {
transformerHandler.startElement("", "", "display_name", null);
ch = displayName.toCharArray();
transformerHandler.characters(ch, 0, ch.length);
transformerHandler.endElement("", "", "display_name");
}
// nodes element
transformerHandler.startElement("", "", "nodes", null);
atts.clear();
atts.addAttribute("", "", "node_type", "CDATA", "sometype");
transformerHandler.startElement("", "", "node", atts);
ch = node.getValue().toCharArray();
transformerHandler.startElement("", "", "value", null);
transformerHandler.characters(ch, 0, ch.length);
transformerHandler.endElement("", "", "value");
transformerHandler.endElement("", "", "node");
transformerHandler.endElement("", "", "nodes");
transformerHandler.endElement("", "", "node_list");
transformerHandler.endDocument();
String xml = writer.toString();
``` | [
-0.3169463872909546,
-0.1083264872431755,
0.43911245465278625,
-0.24579523503780365,
-0.06351597607135773,
0.39893898367881775,
0.07267136126756668,
-0.0571628101170063,
0.09730168431997299,
-0.6689261198043823,
-0.7175167798995972,
0.42867472767829895,
-0.4233328700065613,
0.1479077041149... | |
I have an List and I'd like to wrap it into an IQueryable.
Is this possible?
```
List<int> list = new List<int>() { 1, 2, 3, 4, };
IQueryable<int> query = list.AsQueryable();
```
If you don't see the `AsQueryable()` method, add a using statement for `System.Linq`. | [
-0.09329149127006531,
0.06883187592029572,
0.5770487189292908,
-0.04206744208931923,
0.0589364729821682,
0.018755117431282997,
-0.03604910150170326,
-0.19267885386943817,
-0.27611058950424194,
-0.42557474970817566,
-0.23697054386138916,
0.4088086187839508,
-0.4860835075378418,
0.1247120723... | |
Was wondering if there was a way to put a wildcard in the schema.ini for example
[\*.txt]
FMT=TabDelimited
I've got an app that is imported tab delimited files and the only place I can seem to get the FMT="TabDelimited" is in the schema.ini (doesn't work in the connection string for some reason), but I will have no idea what the filenames are other than the txt extension.
BTW I'm connecting using an OdbcConnection and the Microsoft Text Driver.
I guess I could potentially rename the file temporarily to match whatever I decide to put in the schema.ini or potentially modify the schema.ini on the fly | [
0.2355746626853943,
0.014072244055569172,
0.4168376326560974,
0.0778794139623642,
-0.008505590260028839,
0.013272620737552643,
0.3926904797554016,
0.3035185933113098,
-0.2155306190252304,
-0.6649169921875,
-0.042240384966135025,
0.6526736617088318,
-0.4692780077457428,
0.13281284272670746,... | |
and put the correct filename in there, but I'd love to do know if there was a better way. | [
0.3694033622741699,
0.22579137980937958,
0.11633957177400589,
0.2143343836069107,
0.23040789365768433,
-0.1833098977804184,
-0.014764774590730667,
0.08149785548448563,
-0.10853595286607742,
-0.1756846010684967,
0.19428043067455292,
0.13730117678642273,
0.2521519362926483,
0.102989584207534... | |
> **Possible Duplicate:**
>
> [How do you send email from a Java app using Gmail?](https://stackoverflow.com/questions/46663/how-do-you-send-email-from-a-java-app-using-gmail)
How do I send an SMTP Message from Java?
Here's an example for Gmail smtp:
```
import java.io.*;
import java.net.InetAddress;
import java.util.Properties;
import java.util.Date;
import javax.mail.*;
import javax.mail.internet.*;
import com.sun.mail.smtp.*;
public class Distribution {
public static void main(String args[]) throws Exception {
Properties props = System.getProperties();
props.put("mail.smtps.host","smtp.gmail.com");
props.put("mail.smtps.auth","true");
Session session = Session.getInstance(props, null);
Message msg = | [
0.08344145864248276,
0.09449362009763718,
0.5487642884254456,
-0.283608615398407,
-0.2878775894641876,
0.20218637585639954,
0.7199958562850952,
-0.39959096908569336,
-0.47357720136642456,
-0.65532386302948,
-0.3102394938468933,
0.3335805833339691,
-0.6400851011276245,
0.20908747613430023,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.