text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
number of internal links pointing to the page within the site and the number of pages in the site.
Thing you must consider is it's specific to a **web page, not to a web site**. So you need to optimize every pages.
Google sends **Googlebot**, its indexing robot, to spider your website, the bot is instructed not to cr... | [
0.18345887959003448,
-0.0985579639673233,
0.5899490714073181,
0.3525550067424774,
-0.13894174993038177,
-0.12106916308403015,
0.31057238578796387,
0.2530505061149597,
-0.623497724533081,
-0.7678436636924744,
-0.11058136075735092,
0.3032400608062744,
-0.19326387345790863,
0.1105293408036232... | |
I'm using the [Silverlight UnitTest framerwork](http://code.msdn.microsoft.com/silverlightut/) does anyone have a good example have how to unit test an application with it?
I'm using it quite successfully to unit test a silverlight class library.
Any pointers and links would be greatly appreciated.
Thanks,
Nath
Nath,... | [
0.7609867453575134,
0.15213130414485931,
-0.12883318960666656,
0.2376251220703125,
-0.1397421807050705,
-0.2533741891384125,
0.08368086814880371,
-0.08377303928136826,
-0.08049072325229645,
-0.6615827083587646,
0.2717088460922241,
0.3216587007045746,
-0.022034917026758194,
0.21068747341632... | |
I have big issue with url-rewriting for IIS 7.0.
I've written simple module for rewriting for my NET3.5/IIS7 web application. Here is a part of the code.
```
public void Init(HttpApplication context)
{
context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest... | [
-0.29434722661972046,
-0.1103663519024849,
0.7479676604270935,
-0.2066657692193985,
0.083408884704113,
-0.040345411747694016,
0.6077744364738464,
-0.32917308807373047,
-0.11397170275449753,
-0.9260214567184448,
-0.3293907642364502,
0.7119978070259094,
-0.3379612863063812,
0.134837657213211... | |
}
```
And I register my module in web.config :
```
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="MyModule" type="MyModule" preCondition="" />
```
Under IIS 7.0 (Vista) using Classic ASP Pipeline it works perfect, but when I change pipeline mode to... | [
0.26443538069725037,
0.19290027022361755,
0.5104106068611145,
-0.14547251164913177,
0.23988743126392365,
-0.16374312341213226,
0.6677621006965637,
-0.1990351676940918,
-0.0600418783724308,
-0.9508669376373291,
-0.01667942851781845,
0.803780734539032,
-0.15728843212127686,
0.050594590604305... | |
x64- and iis 7.0) and it works perfect in both modes.
It looks that there's an configuration issue or what?
I think
```
target="(name=myDictionary)"
```
should do the trick in the `@scr.reference` annotation. See <http://felix.apache.org/site/apache-felix-maven-scr-plugin.html> | [
-0.08759976178407669,
-0.037328533828258514,
0.6471390128135681,
-0.17313794791698456,
0.1360287368297577,
-0.6548673510551453,
0.31971704959869385,
-0.01572284661233425,
-0.12346077710390091,
-0.5857909917831421,
-0.21053563058376312,
0.5515214800834656,
-0.3170073926448822,
0.15951116383... | |
Do we really need a server side architecture to create a RIA application?
My idea is the following:
* Create a complete RIA application using only Html pages, JQuery and a full client side UI set of components (choose your poison between the large number of different components available open source and not)
* Server... | [
0.3585301637649536,
-0.09258870780467987,
0.3050854206085205,
0.2751334607601166,
-0.4018813669681549,
0.02798508293926716,
0.1240716353058815,
-0.09656120836734772,
-0.022178739309310913,
-0.5968007445335388,
0.33203208446502686,
0.49869200587272644,
-0.23824535310268402,
-0.1703720837831... | |
side will be just an interface between trasnsport (Json) and the business logic layer, with very few logic in it.
Client side we'll have a huge JavaScript application, but with modern browsers and PCs (for speed) and modern development environment for ease of maintenance (VS2008 and other tools debug JavaScript very w... | [
0.1602053940296173,
-0.2107333540916443,
0.5273960828781128,
0.16665171086788177,
-0.09046614170074463,
-0.25640133023262024,
-0.034696053713560104,
-0.03325193375349045,
0.19175146520137787,
-0.5062145590782166,
0.055476780980825424,
0.49492084980010986,
-0.04640955105423927,
-0.414920598... | |
fad. And I think it would be a legitimate goal in either case. You don't mention whether this is an existing application, but if it is, then I'd say, first memeorize the Fowler Refactoring book, and then go for it.
A lot of the churn in software is useful if you know how to properly apply what you'll need to know to a... | [
0.5928879976272583,
0.16014322638511658,
0.3059152364730835,
0.13327814638614655,
-0.008265510201454163,
-0.10751871019601822,
-0.007144948001950979,
-0.10026553273200989,
-0.062135301530361176,
-0.42589735984802246,
-0.07613671571016312,
0.7642502188682556,
-0.11868719756603241,
0.2073555... | |
lot of technologies.) | [
0.5432913899421692,
0.1769319772720337,
0.1703825742006302,
0.4496210217475891,
0.4845258891582489,
0.15216946601867676,
-0.09721795469522476,
0.14666306972503662,
-0.2842691242694855,
-0.5463021397590637,
-0.09716235101222992,
0.4046615958213806,
-0.11053771525621414,
0.30007851123809814,... | |
I am using ANTLRWorks to create ANTLR grammars. I have a valid grammar and the parser and lexer source files are generated as well. I have also tried debugging the generated code and the output is as expected in the debugger output.
But when I try to invoke the \_\_Test\_\_ class generated by the debugger nothing is ... | [
0.0916224867105484,
0.25982558727264404,
0.19514451920986176,
-0.18060213327407837,
-0.30696243047714233,
0.053315673023462296,
0.5538351535797119,
0.0009889359353110194,
-0.02784973755478859,
-1.028433084487915,
0.22047947347164154,
0.5502307415008545,
-0.38286375999450684,
0.034782443195... | |
antlrworks?
You could as easily have asked about implementing a first-class backend getting the server side right, while avoiding the latest trendy client-side fad. And I think it would be a legitimate goal in either case. You don't mention whether this is an existing application, but if it is, then I'd say, first meme... | [
0.6595566272735596,
0.0959121584892273,
0.2731962502002716,
-0.06318722665309906,
-0.20985186100006104,
0.08299741894006729,
0.3059379756450653,
0.20322518050670624,
-0.22257502377033234,
-0.6322184801101685,
0.23488333821296692,
0.46160030364990234,
-0.3303583264350891,
-0.013573820702731... | |
ends, and we increasingly have at hand useful tools for applying them (which can be accomplished more or less easily with a lot of technologies.) | [
0.43136194348335266,
-0.06349729746580124,
0.3032280206680298,
0.29018768668174744,
0.06420336663722992,
0.006924289278686047,
0.2563496232032776,
-0.12210287898778915,
0.0590454526245594,
-0.6705322861671448,
-0.10597462952136993,
0.4857591688632965,
0.06494443863630295,
0.059625145047903... | |
Windows Forms:
For `System.Drawing` there is a way to get the font height.
```
Font font = new Font("Arial", 10 , FontStyle.Regular);
float fontHeight = font.GetHeight();
```
But how do you get the other text metrics like average character width?
Use Graphics.MeasureString Method
```
private void MeasureStringMi... | [
0.008955715224146843,
0.02600625902414322,
0.7378873229026794,
-0.3472970724105835,
-0.21593309938907623,
0.3823334276676178,
0.3454255163669586,
-0.5365580320358276,
-0.05395498126745224,
-0.8536073565483093,
-0.11935744434595108,
0.5236039161682129,
-0.07638976722955704,
-0.3501391112804... | |
Pen(Color.Red, 1), 0.0F, 0.0F, stringSize.Width, stringSize.Height);
// Draw string to screen.
e.Graphics.DrawString(measureString, stringFont, Brushes.Black, new PointF(0, 0));
}
``` | [
0.38343825936317444,
-0.10699427127838135,
0.5652369260787964,
-0.2755097448825836,
0.17427606880664825,
0.22219546139240265,
-0.09445805847644806,
-0.6545045375823975,
0.06877836585044861,
-0.8823319673538208,
0.0015820747939869761,
0.64471036195755,
-0.13326619565486908,
0.14516092836856... | |
Are there any tools that auto-generate the hibernate POJOs by gathering information from the database?
I made a perl script to do this after the schema got changed for the third or fourth time in a project i'm working with and just wondered if there is any established tool that will do this for me as my script is rath... | [
0.26203516125679016,
0.12907712161540985,
0.13771608471870422,
0.21522323787212372,
-0.20695345103740692,
-0.059216707944869995,
0.18362338840961456,
0.0035716101992875338,
-0.27751579880714417,
-0.23554211854934692,
0.3890264630317688,
0.6492590308189392,
-0.2552674412727356,
-0.204367294... | |
id_int int no yes
id_user id_tiny tinyint no no
value float float no no
```
I would like the program to autogenerate the following java:
```
package com.some.company.schema;
import java.io.Serializable;
public class Statement implements Serializable {
private static fi... | [
0.16406555473804474,
0.08967886120080948,
0.45664548873901367,
-0.2651759088039398,
0.15888409316539764,
0.1902223825454712,
0.16817767918109894,
-0.1004033163189888,
0.0317067913711071,
-0.3743678033351898,
-0.11809663474559784,
0.5390585064888,
-0.2252938449382782,
0.4789443910121918,
... | |
public void setId(Integer id){
this.id = id;
}
public Integer getId(){
return this.id;
}
public void setUser(User user){
this.user = user;
}
public User getUser(){
return this.user;
}
public void setValue(Float value){
this.value = value;
} | [
0.24739818274974823,
-0.5035629272460938,
0.39739903807640076,
0.019721971824765205,
0.18300990760326385,
-0.1004786565899849,
0.17438828945159912,
-0.346505731344223,
-0.013172576203942299,
-0.5498278737068176,
-0.36638909578323364,
0.67123943567276,
-0.6033191680908203,
-0.06051729246973... | |
public Float getValue(){
return this.value;
}
}
```
And the corresponding Hibernate mapping file:
```
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping>
... | [
0.043656811118125916,
0.1604083776473999,
0.4573362171649933,
-0.044515807181596756,
0.03815453127026558,
0.1090819239616394,
-0.1298690289258957,
-0.24722705781459808,
0.11833302676677704,
-0.4971093237400055,
-0.3426155745983124,
0.6068415641784668,
-0.17262284457683563,
0.09465052932500... | |
<property name="value" column="value" not-null="true" />
</class>
</hibernate-mapping>
```
See [hibernate reverse engineering](https://docs.jboss.org/tools/latest/en/hibernatetools/html/reverseengineering.html) | [
0.25847190618515015,
0.22264038026332855,
0.18462376296520233,
-0.34421011805534363,
0.11700498312711716,
0.06332193315029144,
0.30546751618385315,
-0.30350998044013977,
-0.05751250311732292,
-0.06910812109708786,
-0.29599204659461975,
0.20402412116527557,
-0.0886918157339096,
0.2398434728... | |
I am connecting to a MySQL DB trough a terminal who only have a program with an ODBC connection to a MySQL DB. I can put querys in the program, but not access MySQL directly.
I there a way to query the DB to obtain the list of fields in a table other than
```
select * from table
```
??
(don't know why but the sele... | [
0.08003898710012436,
0.19096426665782928,
0.3224141001701355,
0.05207701772451401,
-0.18312470614910126,
-0.15611010789871216,
0.1510406881570816,
0.18869085609912872,
0.14980296790599823,
-0.7396643757820129,
0.17991647124290466,
0.5377894639968872,
-0.3986142575740814,
0.4697670340538025... | |
I have a problem with an ASP.NET application that is driving me nuts.
When a user leaves a page inactive for a period of time the session was timing out and error were being thrown due to session variables not being resolvable (I will error trap this anyway but this is not the problem).
I coded a 'defribulator' which ... | [
0.06089136749505997,
-0.08017171174287796,
0.4552077651023865,
0.08878771215677261,
-0.24314524233341217,
-0.16231828927993774,
0.6737850308418274,
0.04567013308405876,
-0.47383421659469604,
-0.5093274116516113,
0.06429313123226166,
0.3360000252723694,
-0.2693580389022827,
0.06891821324825... | |
one of the other Devs experienced a timeout - How is this possible?
On further investigation I think that the problem occurs when the Forms Authentication timeout is exceeded - even though the defribulator has been (apparently) keeping the session alive. I have read that the Authentication ticket will only be reissued... | [
0.13953210413455963,
-0.04863293841481209,
0.8327541947364807,
0.06351905316114426,
0.0643729567527771,
-0.3936190605163574,
0.5043805241584778,
-0.4671003520488739,
-0.46236690878868103,
-0.2838027775287628,
0.1348472535610199,
0.2239268720149994,
0.03449655696749687,
-0.1415928304195404,... | |
the authentication timeout to 8 hours or so but that is a poor fix.
Can anyone shed any light on this?
Thanks in advance
[Edit 24/11/2008] Reviewing the Log Files has proved enlightening and confusing. I can see the defribulator firing after 10 minutes of inactivity but while the Session\_Id appears to be consitent ... | [
0.18645603954792023,
0.2133185863494873,
0.8875024914741516,
0.1339908093214035,
-0.06548622995615005,
-0.31321999430656433,
0.7437363862991333,
-0.25301456451416016,
-0.07323623448610306,
-0.42436209321022034,
0.1873936504125595,
0.5556728839874268,
0.03947410359978676,
-0.251035243272781... | |
working fine at the moment! The Authentication ticket is being regenerated when the defrib runs (the ID changes) and the session is being maintained. Was it a server issue - can't tell. I have experienced this problem before and never got to the bottom of it and it is very frustrating - surely it should not be this dif... | [
0.5564740300178528,
0.17430710792541504,
0.5945785641670227,
0.08764125406742096,
-0.001201782375574112,
-0.1648768037557602,
0.7817567586898804,
0.10062170028686523,
-0.27889201045036316,
-0.4453526437282562,
0.19710665941238403,
0.655109167098999,
-0.036380134522914886,
-0.12692734599113... | |
again for everyones input - if I make any progress I will post it back here.
This may also happen when iis recycles or terminates the application pool.
You may want to check [Troubleshoot Forms Authentication](http://support.microsoft.com/kb/910439/) It could be that the client lost their cookie.
If you manually gen... | [
0.07632582634687424,
-0.1800037920475006,
0.22784052789211273,
0.20740081369876862,
0.08633986115455627,
-0.4411354064941406,
0.4783555269241333,
-0.1488502025604248,
-0.3105284869670868,
-0.6475312113761902,
-0.05449126288294792,
0.49218305945396423,
-0.11489170789718628,
0.11216345429420... | |
How can I verify a given xpath string is valid in C#/.NET?
I'm not sure just running the XPath and catching exceptions is a valid solution (putting aside the bile in my throat for a moment) - what if tomorrow I run into some other input I haven't tested against?
> How can I verify a given XPath string is valid in C#/.... | [
0.5583472847938538,
0.38080671429634094,
0.4172198176383972,
0.0521993413567543,
-0.09043276309967041,
-0.292775422334671,
0.47221046686172485,
-0.19641628861427307,
-0.17194174230098724,
-0.31325989961624146,
-0.08393686264753342,
0.633461058139801,
-0.2877005338668823,
-0.069312997162342... | |
In a comment on this [answer to another question](https://stackoverflow.com/questions/306130/python-decorator-makes-function-forget-that-it-belongs-to-a-class#306277), someone said that they weren't sure what `functools.wraps` was doing. So, I'm asking this question so that there will be a record of it on StackOverflow... | [
0.3970070779323578,
-0.09979500621557236,
0.3777703046798706,
-0.061605751514434814,
0.25711366534233093,
-0.13978810608386993,
0.01452559418976307,
-0.17700055241584778,
-0.4696415662765503,
-0.3664749264717102,
-0.32089659571647644,
0.5988649725914001,
-0.36337050795555115,
0.06822646409... | |
"""does some math"""
return x + x * x
```
it's exactly the same as saying
```
def f(x):
"""does some math"""
return x + x * x
f = logged(f)
```
and your function `f` is replaced with the function `with_logging`. Unfortunately, this means that if you then say
```
print(f.__name__)
```
it will print `w... | [
0.10553767532110214,
0.1483471691608429,
0.5515878796577454,
0.016944292932748795,
0.21234360337257385,
-0.11036772280931473,
0.21586424112319946,
0.01040760986506939,
-0.4568324089050293,
-0.2599021792411804,
-0.21945808827877045,
0.7785274386405945,
-0.34182465076446533,
-0.0286260806024... | |
for that function, it won't be listed as taking one argument `x`; instead it'll be listed as taking `*args` and `**kwargs` because that's what with\_logging takes.
If using a decorator always meant losing this information about a function, it would be a serious problem. That's why we have `functools.wraps`. This takes... | [
0.4294531047344208,
-0.14382575452327728,
0.3148885667324066,
-0.08227100223302841,
-0.050814948976039886,
-0.12553510069847107,
0.08170780539512634,
-0.25055310130119324,
-0.514087975025177,
-0.4777446687221527,
-0.06553875654935837,
0.6975019574165344,
-0.4112863838672638,
0.126728773117... | |
print(func.__name__ + " was called")
return func(*args, **kwargs)
return with_logging
@logged
def f(x):
"""does some math"""
return x + x * x
print(f.__name__) # prints 'f'
print(f.__doc__) # prints 'does some math'
``` | [
0.11631167680025101,
0.15327289700508118,
0.550498902797699,
0.023249372839927673,
0.21503008902072906,
-0.05536070838570595,
0.11180325597524643,
-0.22685976326465607,
-0.295869916677475,
-0.135804682970047,
-0.25287795066833496,
0.762593150138855,
-0.3416321277618408,
-0.2765482068061828... | |
I want to write a function that accepts two objects as parameters and compare only the fields contained within the objects. I do not know what type the objects will be at design time, but the objects passed will be classes used within our application.
Is it possible to compare object's fields without knowing their typ... | [
0.306354284286499,
-0.021344805136322975,
0.07565532624721527,
0.2866114377975464,
-0.12499307841062546,
0.20771424472332,
0.04107071831822395,
-0.12674453854560852,
0.024920467287302017,
-0.6672033071517944,
0.2525729835033417,
0.7300591468811035,
-0.28546905517578125,
0.11980893462896347... | |
I'd like to find all the types inheriting from a base/interface. Anyone have a good method to do this? Ideas?
I know this is a strange request but its something I'm playing with none-the-less.
Use Assembly.GetTypes() to get all the types, and Type.IsAssignableFrom() to check for inheritance. Let me know if you need co... | [
0.3368033170700073,
-0.21811503171920776,
0.4291604161262512,
0.1845472902059555,
-0.015026687644422054,
-0.41859641671180725,
0.13201062381267548,
0.003223820123821497,
-0.21096192300319672,
-0.7664515376091003,
0.0842483788728714,
0.6979942321777344,
-0.2706236243247986,
0.06226260587573... | |
generic...
```
using System;
using System.Collections;
using System.Linq;
using System.Reflection;
class Test
{
static void Main()
{
Assembly assembly = typeof(string).Assembly;
Type target = typeof(IEnumerable);
var types = assembly.GetTypes()
.Wher... | [
0.2404591292142868,
-0.18747444450855255,
0.21020768582820892,
-0.16680653393268585,
0.06219440698623657,
0.26873043179512024,
0.6131600737571716,
-0.2742849588394165,
-0.03481466695666313,
-0.34778961539268494,
-0.24936269223690033,
0.46892020106315613,
-0.6187798976898193,
0.443489462137... | |
{
Console.WriteLine(type.Name);
}
}
}
``` | [
-0.17545191943645477,
0.2558365762233734,
0.3256208598613739,
-0.19224968552589417,
0.4367047846317291,
-0.2529148459434509,
0.09903205931186676,
0.08499206602573395,
0.2765160799026489,
-0.5538657903671265,
-0.22205126285552979,
0.6252512335777283,
-0.32009461522102356,
0.2857951819896698... | |
I do a lot of XSLT programming. I also do Java, PL/SQL, JavaScript, and a few others. I can easily find communities of Java and JavaScript programmers via the web. PL/SQL is a little more difficult, but between [OTN](http://www.oracle.com/technology/index.html) and [AskTom](http://asktom.oracle.com/), I do pretty well.... | [
0.7194020748138428,
0.279987633228302,
0.23924537003040314,
-0.014063176698982716,
-0.3140678107738495,
-0.3468967378139496,
0.26944443583488464,
0.1975870132446289,
-0.07663541287183762,
-0.49987536668777466,
0.054522544145584106,
0.5642470121383667,
-0.075508251786232,
-0.088596358895301... | |
the big names in XSLT (such as Michael Kay) participate. | [
0.29381880164146423,
-0.03209802135825157,
0.4686909317970276,
0.35299038887023926,
0.2588571012020111,
-0.4648791551589966,
0.1115073412656784,
0.18870145082473755,
0.05466001480817795,
-0.14129936695098877,
-0.1572747826576233,
0.40104973316192627,
-0.33219417929649353,
-0.45947968959808... | |
I got the following class :
```
class ConstraintFailureSet(dict, Exception) :
"""
Container for constraint failures. It act as a constraint failure itself
but can contain other constraint failures that can be accessed with a dict syntax.
"""
def __init__(self, **failures) :
dict.__... | [
0.0646832063794136,
0.2560693025588989,
0.4465975761413574,
-0.023244308307766914,
-0.10617861151695251,
0.04917202517390251,
0.24491102993488312,
-0.28654953837394714,
-0.13904529809951782,
-0.39056241512298584,
0.04445855692028999,
0.5155948400497437,
-0.3357502818107605,
0.2826684117317... | |
I can't try super() since Exception are old based class...
EDIT : And, yes, I've tried to switch the order of inheritance / init.
EDIT2 : I am using CPython 2.4 on Ubuntu8.10. You newer know is this kind of infos is usefull ;-). Anyway, this little riddle has shut the mouth of 3 of my collegues. You'd be my best-frie... | [
-0.10553152859210968,
0.32460305094718933,
0.25590774416923523,
0.12409315258264542,
0.006204542703926563,
-0.2726665139198303,
0.6160469651222229,
0.11541930586099625,
-0.20391181111335754,
-0.6784987449645996,
-0.13590022921562195,
0.5512984395027161,
-0.2693382799625397,
0.3169899880886... | |
they are not compatible and thus you cannot inherit from both at the same time.
In later versions of Python you should get an Exception the moment you try to define the class:
```
>>> class foo(dict, Exception):
... pass
...
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: Erro... | [
0.1567152887582779,
-0.09054906666278839,
-0.01267316099256277,
-0.17555151879787445,
-0.09534887969493866,
-0.14221684634685516,
0.23267953097820282,
-0.32455891370773315,
-0.1530066579580307,
-0.3376631438732147,
0.101629838347435,
0.5257120132446289,
-0.4214515686035156,
0.2816863954067... | |
Many people string together find and sed, or perl, or any number of other unix commands to find and replace across multiple files. But, there's a simple command that can do it for you without the hassle?
Edit:
The Digital Ninja points out that it's rpl.
However this is not a built in command but, for debian based ... | [
0.48390668630599976,
-0.20246382057666779,
0.01754962094128132,
0.1016312688589096,
-0.3121328353881836,
-0.04491938278079033,
0.13475093245506287,
0.021780282258987427,
-0.3874233067035675,
-0.4758213460445404,
-0.08902351558208466,
0.4484829306602478,
-0.44880902767181396,
-0.10958019644... | |
I have an ARM kit beside me and a Linux kernel source code patched with Xenomai on my machine. I understand I can send data to the kit through an USB cable and a (windows-based, of course) software, but I'm stumped as to exactly *what* I should be sending that would make the kit run Linux.
(clarifications from comment... | [
0.43710795044898987,
-0.08864600211381912,
0.18339043855667114,
0.12082669138908386,
0.13240069150924683,
-0.08079850673675537,
-0.10334684699773788,
-0.2549654245376587,
-0.3982384502887726,
-0.6619330644607544,
-0.19616733491420746,
0.4803895354270935,
-0.1785360425710678,
-0.08545304834... | |
Currently this expression `"I ([a-zA-z]\d]{3} "` returns when the following pattern is true:
```
I AAA
I Z99
```
I need to modify this so it will return a range of alphanumerics after the I from 2 to 13 that do not have a space.
Example:
```
I AAA
I A321
I ASHG310310
```
Thanks,
Dave
Without the quotes:
... | [
-0.08776561170816422,
0.4376196265220642,
0.3104550838470459,
-0.18607743084430695,
-0.09592990577220917,
-0.1857507973909378,
0.5309755206108093,
0.04760553315281868,
-0.1228172555565834,
-0.3078881800174713,
-0.16325318813323975,
0.39815613627433777,
-0.24540838599205017,
0.2581594288349... | |
One of the tenants of DDD is to not allow your objects to enter an invalid state. To me this means there shouldn't be a public parameterless constructor because that's going to be an object in an invalid state 99% of the time.
Is this a good way to move forward? It becomes a huge PITA when you just want to new-up a c... | [
0.30514878034591675,
0.29797521233558655,
-0.21758612990379333,
0.3187323808670044,
-0.3886386454105377,
-0.28368303179740906,
0.6475652456283569,
0.501201331615448,
-0.1580592542886734,
-0.47376808524131775,
0.07347378134727478,
0.3419809639453888,
-0.010625836439430714,
0.586733222007751... | |
> **Possible Duplicate:**
>
> [How can I convert my java program to an .exe file ?](https://stackoverflow.com/questions/147181/how-can-i-convert-my-java-program-to-an-exe-file)
I've used JSmoothGen in the past, but recently we've seen a number of machines that refuse to run the .exes that it generates. It also seem... | [
0.2547183334827423,
-0.0538007952272892,
0.02671441249549389,
-0.10139628499746323,
-0.23630090057849884,
-0.28019750118255615,
0.15470628440380096,
0.3258988559246063,
-0.11995246261358261,
-0.907188355922699,
-0.05729124695062637,
0.5379341840744019,
-0.2645877003669739,
-0.0687743872404... | |
Say I have a xml document that looks like this
```
<foo>
<bar id="9" />
<bar id="4" />
<bar id="3" />
</foo>
```
I would like to use linq to reset the id's to 0, 1 ,2.
What would be the easiest way to do this?
Thanks
```
XElement xml = GetXml();
var i = 0;
foreach (var e in xml.Elements("bar"))
e.SetAttributeValu... | [
0.43502557277679443,
0.39621084928512573,
0.902775228023529,
0.010067670606076717,
0.3202393054962158,
-0.018964145332574844,
-0.10755930095911026,
-0.3448141813278198,
-0.010855454951524734,
-0.4818604588508606,
-0.24237047135829926,
0.3544839322566986,
-0.283968985080719,
0.1238917037844... | |
Is there any way to install Setuptools for Python 2.6 in Windows without having an exe installer?
There isn't one built at the moment, and the maintainer of Setuptools has stated that it will probably be a while before he'll get to it.
Does anyone know of a way to install it anyway?
First Option - Online Installati... | [
0.7684829831123352,
-0.2621782720088959,
0.3127517104148865,
0.08644821494817734,
0.2234630286693573,
-0.6400532722473145,
0.19632698595523834,
-0.1175076887011528,
-0.28520941734313965,
-0.7892647385597229,
-0.5209916234016418,
0.9049243330955505,
-0.3156018555164337,
-0.4064858555793762,... | |
that your PATH includes the appropriate C:\Python2X\Scripts directory
Second Option:
1. Download [setuptools-0.6c9.tar.gz](https://pypi.org/project/setuptools/0.6c9/)
2. Download [setuptools-0.6c9-py2.6.egg](http://pypi.python.org/packages/2.6/s/setuptools/setuptools-0.6c9-py2.6.egg#md5=ca37b1ff16fa2ede6e19383e7b5924... | [
0.2865549623966217,
-0.22220471501350403,
0.24710071086883545,
-0.10015270859003067,
0.12081427872180939,
-0.36290204524993896,
0.6136014461517334,
-0.24163995683193207,
-0.06271030008792877,
-0.7666592001914978,
-0.5737334489822388,
0.9096350073814392,
-0.1834215223789215,
-0.654465913772... | |
dos (command) prompt
Please provide feedback. | [
-0.04526839405298233,
-0.11567624658346176,
0.0924883782863617,
0.30201050639152527,
0.07878938317298889,
-0.40832942724227905,
0.12075933068990707,
0.06587763130664825,
0.3281925320625305,
-0.6564192771911621,
-0.22745002806186676,
1.126121163368225,
-0.0968547910451889,
0.099810048937797... | |
If you have a `java.io.InputStream` object, how should you process that object and produce a `String`?
---
Suppose I have an `InputStream` that contains text data, and I want to convert it to a `String`, so for example I can write that to a log file.
What is the easiest way to take the `InputStream` and convert it t... | [
0.09972964227199554,
0.1500903069972992,
0.48267096281051636,
-0.021427851170301437,
0.09420146048069,
-0.20916198194026947,
0.10407785326242447,
-0.2438962459564209,
-0.026455577462911606,
-0.6947751045227051,
-0.09954536706209183,
0.5470055937767029,
-0.2976686358451843,
0.08199851959943... | |
use try-with-resources for that
String theString = IOUtils.toString(inputStream, encoding);
```
Alternatively, you could use `ByteArrayOutputStream` if you don't want to mix your Streams and Writers | [
0.3597151041030884,
-0.2551027834415436,
0.0740739032626152,
0.19176757335662842,
0.3082531988620758,
-0.03462894260883331,
-0.050155673176050186,
0.03401016816496849,
-0.1489216536283493,
-0.674309492111206,
0.11675937473773956,
0.5006489753723145,
-0.3785191476345062,
0.02045577391982078... | |
I'm using the following code to try to read the results of a `df` command in Linux using `popen`.
```
#include <iostream> // file and std I/O functions
int main(int argc, char** argv) {
FILE* fp;
char * buffer;
long bufSize;
size_t ret_code;
fp = popen("df", "r");
if(fp == NULL) { // head off... | [
0.12073168903589249,
0.16714587807655334,
0.545897901058197,
-0.4984818994998932,
0.17631852626800537,
0.08549705147743225,
0.472213476896286,
-0.022518422454595566,
-0.10010527074337006,
-0.6940314173698425,
-0.21498245000839233,
0.698075532913208,
-0.4916115403175354,
0.21399427950382233... | |
}
// get the size of the results
fseek(fp, 0, SEEK_END);
bufSize = ftell(fp);
rewind(fp);
// allocate the memory to contain the results
buffer = (char*)malloc( sizeof(char) * bufSize );
if(buffer == NULL) {
std::cerr << "Memory error." << std::endl;
exit(2);
}
// r... | [
-0.2291317880153656,
-0.05794517695903778,
0.616425096988678,
-0.47019341588020325,
0.3907603919506073,
0.4724196493625641,
0.23828065395355225,
-0.46519047021865845,
-0.13906410336494446,
-0.5224646925926208,
-0.4614214599132538,
0.4488011300563812,
-0.2047988772392273,
0.0025585941039025... | |
if(ret_code != bufSize) {
std::cerr << "Error reading output." << std::endl;
exit(3);
}
// print the results
std::cout << buffer << std::endl;
// clean up
pclose(fp);
free(buffer);
return (EXIT_SUCCESS);
}
```
This code is giving me a "Memory error" with an exit status of... | [
-0.1323472559452057,
0.24788357317447662,
0.5234915614128113,
-0.36389800906181335,
0.384805291891098,
0.24216647446155548,
0.43800047039985657,
-0.328205943107605,
-0.14281755685806274,
-0.6096220016479492,
-0.24820517003536224,
0.5807610154151917,
-0.2706390619277954,
0.21756964921951294... | |
on [Ubuntu Forums](http://ubuntuforums.org/showthread.php?t=285287) and [C++ Reference](http://en.cppreference.com/w/cpp/io/c/fread), so I'm not married to it. If anyone can suggest a better way to read the results of a system() call, I'm open to new ideas.
**EDIT to the original:** Okay, `bufSize` is coming up negati... | [
0.36856406927108765,
0.1644611954689026,
0.22251737117767334,
0.002138169715180993,
-0.2999750077724457,
-0.11023688316345215,
0.24039651453495026,
-0.10089731216430664,
-0.14657869935035706,
-0.6230868101119995,
0.025885215029120445,
0.43659064173698425,
-0.3282133638858795,
0.31032848358... | |
returned a negative signed number, which was then treated as a huge unsigned number".
According to [the documentation](http://en.cppreference.com/w/cpp/io/c/ftell), `std::ftell()` returns -1 on failure. One obvious reason it would fail is that *you cannot seek in a pipe or FIFO*.
There is no escape; you cannot know t... | [
0.0576653815805912,
0.09165298938751221,
0.4070998430252075,
-0.23252683877944946,
0.0023461298551410437,
0.22244897484779358,
0.27693575620651245,
-0.2787861227989197,
-0.3498001992702484,
-0.2956395447254181,
-0.25063103437423706,
0.3417597711086273,
-0.38718774914741516,
0.1914582550525... | |
`statvfs()`. | [
0.06065330281853676,
-0.2153177410364151,
0.5412508845329285,
0.00304845767095685,
-0.2712567150592804,
-0.42326050996780396,
-0.00532566336914897,
0.09219695627689362,
-0.3298420011997223,
-0.7804665565490723,
-0.4295305907726288,
0.20989257097244263,
-0.4636557996273041,
0.09991534054279... | |
I'm trying to make a program in Visual C# that has my one created class, and at application launch it creates an array of my class object, and this array of my object can be used all over the program. So any function, or a control's event can access the array of objects and their member variables.
I created my class as... | [
0.2047184854745865,
0.11218112707138062,
-0.018366999924182892,
-0.06465130299329758,
-0.1195286214351654,
-0.011401910334825516,
0.37576165795326233,
-0.037964049726724625,
-0.13801592588424683,
-0.37700212001800537,
0.07958287745714188,
0.3614974617958069,
-0.414765328168869,
0.270305693... | |
to load data from a file into the member variables of the object array.
Is there a certain place the object array needs to be declared and constructed so it exists in every context? If so, can you tell me where this is?
I currently declare it in the main function before form1 is run.
My class definition looks like t... | [
0.07386798411607742,
-0.09582514315843582,
0.47398412227630615,
-0.11631503701210022,
-0.043201547116041183,
0.02411285601556301,
0.20491424202919006,
-0.2704174518585205,
-0.1883726269006729,
-0.6738622188568115,
-0.03633004426956177,
0.34422799944877625,
-0.15905192494392395,
0.178616687... | |
(int i = 0; i < 50; i++)
{
MyArrayObject[i] = new MyClass();
}
```
Thanks in advance for any help.
Your problem is that you are defining it within the main function, hence it will only exist inside the main function. you need to define it inside the class, not inside the function
```
public partial class Form1:... | [
-0.278030127286911,
-0.10754002630710602,
0.5250847339630127,
-0.3534785509109497,
0.007024962455034256,
-0.005377257242798805,
0.3757484257221222,
-0.3229905068874359,
0.01216332707554102,
-0.6445776224136353,
-0.20075391232967377,
0.3105468451976776,
-0.3017612397670746,
0.25507804751396... | |
I'm currently using `Win32ShellFolderManager2` and `ShellFolder.getLinkLocation` to resolve windows shortcuts in Java. Unfortunately, if the Java program is running as a service under Vista, `getLinkLocation`, this does not work. Specifically, I get an exception stating "Could not get shell folder ID list".
Searching ... | [
-0.008231990039348602,
0.15083622932434082,
0.13132065534591675,
-0.04548920691013336,
-0.03317101299762726,
-0.2499726563692093,
0.6473559141159058,
0.17606474459171295,
-0.2362373024225235,
-0.8462265729904175,
0.010843278840184212,
0.5867062211036682,
-0.1393616795539856,
0.178269103169... | |
not have to do the work if anyone has done it before, since the format is rather scary.
Added comments (some explanation as well as credit to each contributor so far),additional check on the file magic, a quick test to see if a given file might be a valid link (without reading all of the bytes), a fix to throw a ParseE... | [
0.3501649796962738,
0.12918882071971893,
0.5262378454208374,
-0.22720012068748474,
-0.11329984664916992,
-0.23237314820289612,
0.23075880110263824,
-0.2573823630809784,
-0.37025415897369385,
-0.7423546314239502,
-0.31879985332489014,
0.4004848599433899,
-0.41943076252937317,
0.031473405659... | |
Windows shortcut (typically visible to Java only as a '.lnk' file).
*
* Retrieved 2011-09-23 from http://stackoverflow.com/questions/309495/windows-shortcut-lnk-parser-in-java/672775#672775
* Originally called LnkParser
*
* Written by: (the stack overflow users, obviously!)
* Apache Commons VFS dependency remov... | [
-0.2508441209793091,
0.06896083801984787,
0.04919682815670967,
-0.029547039419412613,
-0.08850826323032379,
0.3493582010269165,
0.31920626759529114,
-0.24671222269535065,
-0.23386912047863007,
-0.4250430762767792,
-0.3287939131259918,
0.24589447677135468,
-0.46766844391822815,
-0.317788869... | |
from the book 'Swing Hacks: Tips and Tools for Killer GUIs'
* by Joshua Marinacci and Chris Adamson
* ISBN: 0-596-00907-0
* http://www.oreilly.com/catalog/swinghks/
*/
public class WindowsShortcut
{
private boolean isDirectory;
private boolean isLocal;
private String real_file;
/**
... | [
0.5907395482063293,
-0.1267683506011963,
0.16597487032413483,
0.2534922957420349,
-0.1933901458978653,
-0.33924809098243713,
0.23822952806949615,
-0.30352699756622314,
-0.20683971047401428,
-0.30947014689445496,
-0.157450869679451,
0.3982698321342468,
-0.4014335870742798,
-0.28854981064796... | |
* Exceptions may be thrown and Exceptions are extremely slow to generate,
* therefore any code needing to loop through several files should first check this.
*
* @param file the potential link
* @return true if may be a link, false otherwise
* @throws IOException if an IOException is thrown whi... | [
0.17756317555904388,
-0.1070868968963623,
0.1029871255159378,
0.006077812984585762,
-0.155860036611557,
-0.08140675723552704,
0.4017265737056732,
-0.30568763613700867,
-0.22470857203006744,
-0.30518585443496704,
-0.07911458611488342,
0.32096102833747864,
-0.4411029517650604,
0.018376886844... | |
final int minimum_length = 0x64;
InputStream fis = new FileInputStream(file);
boolean isPotentiallyValid = false;
try {
isPotentiallyValid = file.isFile()
&& file.getName().toLowerCase().endsWith(".lnk")
&& fis.available() >= minimum_length | [
-0.08338180929422379,
-0.6462282538414001,
0.8287157416343689,
-0.2080448716878891,
0.381657212972641,
0.26266705989837646,
0.24006707966327667,
-0.46178916096687317,
-0.3341611325740814,
-0.6416783332824707,
-0.22423115372657776,
0.5923441648483276,
-0.1304534673690796,
-0.059391554445028... | |
&& isMagicPresent(getBytes(fis, 32));
} finally {
fis.close();
}
return isPotentiallyValid;
}
public WindowsShortcut(File file) throws IOException, ParseException {
InputStream in = new FileInputStream(file);
try {
parseLink(getBytes(in));
... | [
-0.10205662250518799,
-0.19749779999256134,
0.5777540802955627,
-0.2149776816368103,
0.2777489423751831,
0.20232050120830536,
0.3830578923225403,
-0.24448777735233307,
-0.045612357556819916,
-0.5984542965888977,
-0.24529415369033813,
0.6551806926727295,
-0.33040815591812134,
0.084441967308... | |
finally {
in.close();
}
}
/**
* @return the name of the filesystem object pointed to by this shortcut
*/
public String getRealFilename() {
return real_file;
}
/**
* Tests if the shortcut points to a local resource.
* @return true if the 'local' | [
0.08878427743911743,
-0.24349042773246765,
0.7312999367713928,
-0.08668048679828644,
0.2397155910730362,
0.03131841868162155,
0.38587215542793274,
0.025462955236434937,
-0.09985151886940002,
-0.5724809169769287,
-0.30092838406562805,
0.6192760467529297,
0.12069763988256454,
0.1128946095705... | |
bit is set in this shortcut, false otherwise
*/
public boolean isLocal() {
return isLocal;
}
/**
* Tests if the shortcut points to a directory.
* @return true if the 'directory' bit is set in this shortcut, false otherwise
*/
public boolean isDirectory() {
return isD... | [
0.06491868197917938,
-0.25315067172050476,
0.2633366882801056,
-0.12919795513153076,
0.2112063765525818,
0.12084074318408966,
0.2802765667438507,
-0.2461846023797989,
0.026345856487751007,
-0.47664836049079895,
-0.32082638144493103,
0.6823826432228088,
-0.17447057366371155,
0.0099574774503... | |
* Gets all the bytes from an InputStream
* @param in the InputStream from which to read bytes
* @return array of all the bytes contained in 'in'
* @throws IOException if an IOException is encountered while reading the data from the InputStream
*/
private static byte[] getBytes(InputStream in) th... | [
-0.05463405326008797,
-0.052258335053920746,
0.40558740496635437,
-0.13404864072799683,
0.032434895634651184,
0.5400420427322388,
0.1699795126914978,
-0.418901652097702,
-0.40612903237342834,
-0.5044425129890442,
-0.45428696274757385,
0.40691375732421875,
-0.13504362106323242,
-0.184376880... | |
from an InputStream
* @param in the InputStream from which to read bytes
* @param max maximum number of bytes to read
* @return array of all the bytes contained in 'in'
* @throws IOException if an IOException is encountered while reading the data from the InputStream
*/
private static byte[... | [
0.015073727816343307,
-0.044708166271448135,
0.3437120020389557,
-0.043921347707509995,
-0.0615788958966732,
0.6288501024246216,
0.10720621794462204,
-0.5055859088897705,
-0.3096294403076172,
-0.4261099696159363,
-0.44423434138298035,
0.29078930616378784,
-0.20903714001178741,
-0.321461021... | |
ByteArrayOutputStream bout = new ByteArrayOutputStream();
byte[] buff = new byte[256];
while (max == null || max > 0) {
int n = in.read(buff);
if (n == -1) {
break;
} | [
-0.09857729077339172,
-0.22874946892261505,
0.29591208696365356,
-0.21619798243045807,
0.055267028510570526,
0.060571447014808655,
0.313047856092453,
-0.4024474024772644,
-0.3796616494655609,
-0.14436349272727966,
-0.12226756662130356,
0.6182793974876404,
-0.10322725027799606,
0.1536862403... | |
bout.write(buff, 0, n);
if (max != null)
max -= n;
}
in.close();
return bout.toByteArray();
}
private static boolean isMagicPresent(byte[] link) {
final int magic = 0x0000004C; | [
0.22650086879730225,
-0.3842179775238037,
0.5086523294448853,
-0.10286600887775421,
0.2713657021522522,
-0.08393728733062744,
0.6774584054946899,
-0.2613545060157776,
0.32123175263404846,
-0.3831624686717987,
-0.06192485988140106,
1.0046132802963257,
-0.397745281457901,
0.1902291625738144,... | |
final int magic_offset = 0x00;
return link.length >= 32 && bytesToDword(link, magic_offset) == magic;
}
/**
* Gobbles up link data by parsing it and storing info in member fields
* @param link all the bytes from the .lnk file
*/
private void parseLink(byte[] link) throws ParseExcepti... | [
-0.039645250886678696,
-0.07346999645233154,
0.7319045066833496,
-0.022655732929706573,
-0.042317453771829605,
0.23340295255184174,
0.3528275787830353,
-0.5930923223495483,
-0.2923561930656433,
-0.27667513489723206,
-0.16361671686172485,
0.5091081261634827,
-0.27682071924209595,
0.12851899... | |
throw new ParseException("Invalid shortcut; magic is missing", 0);
// get the flags byte
byte flags = link[0x14];
// get the file attributes byte
final int file_atts_offset = 0x18;
byte file_atts = link[file_atts_offset]; | [
0.24740725755691528,
-0.11485946923494339,
0.27577558159828186,
-0.18894249200820923,
-0.20445354282855988,
-0.15164199471473694,
0.38727766275405884,
-0.6614797711372375,
-0.05258212611079216,
-0.3427683115005493,
-0.1422874629497528,
0.5629434585571289,
-0.19523264467716217,
-0.027167271... | |
byte is_dir_mask = (byte)0x10;
if ((file_atts & is_dir_mask) > 0) {
isDirectory = true;
} else {
isDirectory = false;
} | [
-0.3175681531429291,
-0.21202488243579865,
0.3686192035675049,
-0.295098215341568,
-0.02036709524691105,
0.19718487560749054,
0.06975604593753815,
-0.3793732821941376,
-0.0878007784485817,
-0.4940895438194275,
-0.36320826411247253,
0.730724036693573,
-0.19416579604148865,
-0.15520711243152... | |
// if the shell settings are present, skip them
final int shell_offset = 0x4c;
final byte has_shell_mask = (byte)0x01;
int shell_len = 0;
if ((flags & has_shell_mask) > 0) {
// the plus 2 accounts | [
0.4201293885707855,
-0.2346210777759552,
0.4942796528339386,
-0.28260836005210876,
0.2959171533584595,
0.08102461695671082,
0.33654317259788513,
-0.06671129167079926,
-0.07822610437870026,
-0.6257921457290649,
-0.16549336910247803,
1.0024911165237427,
-0.17884236574172974,
-0.2750110626220... | |
for the length marker itself
shell_len = bytesToWord(link, shell_offset) + 2;
}
// get to the file settings
int file_start = 0x4c + shell_len;
final int file_location_info_flag_offset_offset = 0x08;
int | [
0.20525576174259186,
-0.32521551847457886,
0.5669754147529602,
-0.28270798921585083,
0.3615492582321167,
0.12308795750141144,
-0.04389794170856476,
-0.33702221512794495,
-0.17056913673877716,
-0.3392106890678406,
-0.27014124393463135,
0.7232457995414734,
-0.007808357011526823,
0.1129572466... | |
file_location_info_flag = link[file_start + file_location_info_flag_offset_offset];
isLocal = (file_location_info_flag & 2) == 0;
// get the local volume and local system values
//final int localVolumeTable_offset_offset = 0x0C;
final int basename_offset_offset = 0x10;
... | [
0.0049043274484574795,
-0.24344415962696075,
1.1060515642166138,
-0.09573286026716232,
0.3944564759731293,
0.04093807563185692,
-0.12892238795757294,
-0.05207118019461632,
-0.20449508726596832,
-0.783340334892273,
-0.4460090398788452,
0.5479230284690857,
-0.18197675049304962,
0.28917151689... | |
final int finalname_offset_offset = 0x18;
int finalname_offset = link[file_start + finalname_offset_offset] + file_start;
String finalname = getNullDelimitedString(link, finalname_offset);
if (isLocal) {
int basename_offset = link[file_start + basename_offset_offset] ... | [
-0.2596408724784851,
-0.5328055024147034,
1.0265382528305054,
-0.5185404419898987,
0.11287142336368561,
0.08686142414808273,
-0.18070879578590393,
-0.18671642243862152,
0.1857287883758545,
-0.4497109651565552,
-0.8297214508056641,
0.6560347080230713,
0.044168516993522644,
0.032086044549942... | |
real_file = basename + finalname;
} else {
int networkVolumeTable_offset = link[file_start + networkVolumeTable_offset_offset] + file_start;
int shareName_offset_offset = 0x08;
int shareName_offset = link[networkVolumeTable_offset + shareName_offset_offset] | [
-0.0341411754488945,
-0.34911149740219116,
0.7561269998550415,
-0.14147524535655975,
0.3657505512237549,
0.03243089094758034,
0.07152438163757324,
0.044477954506874084,
-0.1626930981874466,
-0.778425931930542,
-0.3446783423423767,
0.9980411529541016,
-0.2548692524433136,
0.0880485624074935... | |
+ networkVolumeTable_offset;
String shareName = getNullDelimitedString(link, shareName_offset);
real_file = shareName + "\\" + finalname;
}
} catch (ArrayIndexOutOfBoundsException e) {
throw new ParseException("Could not be parsed, | [
-0.10927872359752655,
-0.47946062684059143,
0.40018364787101746,
-0.24986062943935394,
0.14414137601852417,
-0.12591129541397095,
0.3956947326660156,
-0.3491522967815399,
-0.05953489616513252,
-0.43108808994293213,
-0.14525830745697021,
0.5158969759941101,
-0.33647212386131287,
0.048168774... | |
probably not a valid WindowsShortcut", 0);
}
}
private static String getNullDelimitedString(byte[] bytes, int off) {
int len = 0;
// count bytes until the null character (0)
while (true) {
if (bytes[off + len] == 0) {
break; | [
0.13245980441570282,
-0.38426485657691956,
0.5588217377662659,
-0.15743038058280945,
0.3993387222290039,
-0.26681819558143616,
0.1988145262002945,
0.05823656544089317,
-0.04553965479135513,
-0.1263638138771057,
-0.6502160429954529,
0.500860869884491,
-0.20673224329948425,
0.146051853895187... | |
}
len++;
}
return new String(bytes, off, len);
}
/*
* convert two bytes into a short note, this is little endian because it's
* for an Intel only OS.
*/
private static int bytesToWord(byte[] bytes, int off) { | [
0.08057355135679245,
-0.2689897119998932,
0.2437000572681427,
-0.2964863181114197,
0.059826985001564026,
0.014367726631462574,
0.2887323498725891,
0.0074658747762441635,
-0.023698728531599045,
-0.37674131989479065,
-0.09798387438058853,
0.6693981289863586,
-0.07828887552022934,
0.084448114... | |
return ((bytes[off + 1] & 0xff) << 8) | (bytes[off] & 0xff);
}
private static int bytesToDword(byte[] bytes, int off) {
return (bytesToWord(bytes, off + 2) << 16) | bytesToWord(bytes, off);
}
}
``` | [
-0.20576675236225128,
-0.09531544893980026,
0.41865286231040955,
-0.3142022490501404,
0.27635860443115234,
0.089944988489151,
0.25790077447891235,
-0.4040747582912445,
-0.05378012731671333,
-0.08760351687669754,
-0.5397330522537231,
0.6870459318161011,
-0.33468714356422424,
0.0956564992666... | |
How can I initialize a const / static array of structs as clearly as possible?
```
class SomeClass
{
struct MyStruct
{
public string label;
public int id;
};
const MyStruct[] MyArray = {
{"a", 1}
{"b", 5}
{"q", 29}
};
};
```
Firstly, do you *really* ... | [
-0.02130884863436222,
-0.025516903027892113,
0.17436307668685913,
-0.050458602607250214,
-0.01923258975148201,
-0.022610154002904892,
0.39361533522605896,
-0.17419300973415375,
0.07401072978973389,
-0.5586564540863037,
-0.19078277051448822,
0.3012329638004303,
-0.16901473701000214,
0.08545... | |
a mutable struct? They're almost always a bad idea. Likewise public fields. There are some very occasional contexts in which they're reasonable (usually both parts together, as with `ValueTuple`) but they're pretty rare in my experience.
Other than that, I'd just create a constructor taking the two bits of data:
```
... | [
-0.24839793145656586,
-0.15524214506149292,
0.0391535609960556,
0.15301933884620667,
-0.10027893632650375,
0.025705059990286827,
0.3473169207572937,
-0.12020896375179291,
-0.06727688014507294,
-0.4743759036064148,
-0.2107062190771103,
0.5801058411598206,
-0.21495278179645538,
0.58102494478... | |
{
this.label = label;
this.id = id;
}
public string Label { get { return label; } }
public string Id { get { return id; } }
}
static readonly IList<MyStruct> MyArray = new ReadOnlyCollection<MyStruct>
(new[] { | [
-0.06867808848619461,
-0.29592934250831604,
0.4563550651073456,
-0.13689568638801575,
0.17252978682518005,
0.09665127843618393,
0.10143034160137177,
-0.52756667137146,
-0.12101967632770538,
-0.7289230227470398,
-0.08016117662191391,
0.5563888549804688,
-0.4705524146556854,
0.26884329319000... | |
new MyStruct ("a", 1),
new MyStruct ("b", 5),
new MyStruct ("q", 29)
});
}
```
Note the use of [ReadOnlyCollection](http://msdn.microsoft.com/en-us/library/ms132474.aspx) instead of exposing the array itself - this will make it immutable, avoiding [the problem exposing arrays directl... | [
-0.1590716391801834,
0.2528362572193146,
0.659390926361084,
-0.1465425193309784,
-0.03304450213909149,
-0.0913509726524353,
0.25890520215034485,
-0.25940853357315063,
-0.07641629874706268,
-0.5385043025016785,
-0.3094113767147064,
0.3867608308792114,
-0.3700147569179535,
0.1703588366508484... | |
I have a webservice @ <http://recpushdata.cyndigo.com/Jobs.asmx> but I'm not able to access it though I am adding it as a WebReference properly.
Any Help would be great.
My guess is that this is a bug of some sorts. In SQL 2005 I was able to create such an indexed view without a problem (code is below). When I tried t... | [
0.4620789885520935,
0.04006868600845337,
0.37583640217781067,
-0.005162568297237158,
-0.16296346485614777,
-0.3396642804145813,
0.20660997927188873,
0.30580922961235046,
-0.3849528431892395,
-0.7539349794387817,
0.42738333344459534,
0.5818037986755371,
-0.08345863968133926,
0.1965820342302... | |
you selected from the view.
```
CONVERT(CHAR(8), datetime_column, 112)
```
Works in SQL 2005:
```
CREATE TABLE dbo.Test_Determinism (
datetime_column DATETIME NOT NULL DEFAULT GETDATE())
GO
CREATE VIEW dbo.Test_Determinism_View
WITH SCHEMABINDING
AS
SELECT
DATEADD(dd, DATEDIFF(dd, 0, [datetim... | [
-0.2502951920032501,
-0.20530672371387482,
0.3723968267440796,
-0.08173388242721558,
-0.40647098422050476,
0.17021620273590088,
-0.053181327879428864,
-0.45914798974990845,
-0.08146053552627563,
-0.490193247795105,
-0.1466679871082306,
0.41628897190093994,
-0.10462682694196701,
0.063266232... | |
GWT seems like a really nice technology for Java developers who don't like (or don't know) HTML/JS/CSS to build rich web interfaces. On the server-side Grails also looks really nice, it's often described as "Rails for Java developers". I've read that Grails' "convention over configuration" approach, together with the b... | [
-0.01949128322303295,
-0.16532881557941437,
0.08251159638166428,
0.26817071437835693,
-0.5652624368667603,
-0.18283575773239136,
0.2724635601043701,
0.059635259211063385,
-0.2299361377954483,
-0.5458969473838806,
0.07534341514110565,
0.6962944269180298,
-0.19800890982151031,
-0.18310526013... | |
server-side? I'd be interested to learn about experiences of anyone that has build an application with these technologies? Recommendations on resources (books/websites) for building a GWT-Grails website would also be very welcome.
Cheers,
Don
Grails already has a gwt plugin: [check it out](http://grails.org/GWT+Plugin... | [
0.18406787514686584,
0.06742054224014282,
0.5485060214996338,
0.012703889049589634,
-0.5131781101226807,
-0.33291658759117126,
0.27482786774635315,
0.43584537506103516,
-0.2028336077928543,
-0.15245425701141357,
0.18644903600215912,
0.4887295663356781,
0.11611253023147583,
-0.1674058586359... | |
I'm using the StAX event based API's to modify an XML stream. The stream represents an HTML document, complete with DTD declaration. I would like to copy this DTD declaration into the output document (written using an `XMLEventWriter`). When I ask the factory to disregard DTD's it will not download the DTD, but remove ... | [
0.3073091506958008,
0.054036375135183334,
0.3295641839504242,
0.09016574919223785,
-0.20157261192798615,
-0.005068320780992508,
0.07128789275884628,
-0.004285975359380245,
0.12075860798358917,
-0.7041285634040833,
-0.13951577246189117,
0.6787265539169312,
-0.3077203929424286,
0.14651690423... | |
disabled and I don't need that). Does anyone know how to disable the fetching of external DTD's.
You should be able to implement a custom XMLResolver that redirects attempts to fetch external DTDs to a local resource (if your code parses only a specific doc type, this is often a class resource right in a JAR).
```
cla... | [
-0.08944994956254959,
-0.27280575037002563,
0.19213493168354034,
0.1568482518196106,
0.10303608328104019,
0.10393508523702621,
0.30015963315963745,
-0.09875345975160599,
-0.5117264986038208,
-0.7207496762275696,
-0.2216329276561737,
0.7165559530258179,
-0.41958868503570557,
0.0876029878854... | |
String baseURI,
String namespace)
throws XMLStreamException
{
if ("The public ID you expect".equals(publicID)) {
return getClass().getResourceAsStream("doc.dtd");
} | [
0.09700930118560791,
-0.6252104043960571,
0.2991217374801636,
-0.15340355038642883,
0.06461217254400253,
-0.0444333478808403,
0.08423877507448196,
-0.11692002415657043,
0.3688463568687439,
-0.3816816210746765,
-0.1793248951435089,
0.6750995516777039,
-0.41586124897003174,
-0.15833191573619... | |
else {
return null;
}
}
```
Note that some documents only include the "systemID", so you should fall back to checking that. The problem with system identifier is that it's supposed to be "system" specific URL, rather than a well-known, stable URI. In practice, it's often used as if it were a URI though.
... | [
0.15035869181156158,
-0.10490906983613968,
0.48933058977127075,
0.12398507446050644,
-0.09078729897737503,
-0.40567317605018616,
0.04070332273840904,
-0.1060071587562561,
-0.25148245692253113,
-0.6985464096069336,
-0.4981031119823456,
0.1520201563835144,
-0.2915806174278259,
0.235973626375... | |
What is the difference between a `const_iterator` and an `iterator` and where would you use one over the other?
`const_iterator`s don't allow you to change the values that they point to, regular `iterator`s do.
As with all things in C++, always prefer `const`, unless there's a good reason to use regular iterators (i.e... | [
-0.23539197444915771,
0.16735219955444336,
0.19870537519454956,
-0.05144354701042175,
-0.059022363275289536,
-0.22009465098381042,
-0.23850169777870178,
-0.05043676868081093,
0.05060604587197304,
-0.24057243764400482,
-0.21122506260871887,
0.7775869369506836,
-0.1960148811340332,
-0.087916... | |
I'm new to development on the iPhone. Just about every sample project (as well as the default project templates) have one or more delegates and controllers. Can someone give me a breakdown of what the delegates are responsible for vs. what the controllers are supposed to do?
The simplest way I can think to differentiat... | [
0.41136375069618225,
-0.025192730128765106,
0.13740310072898865,
0.09727977216243744,
0.14117613434791565,
-0.1157182827591896,
0.14368067681789398,
0.019868914037942886,
-0.2588815987110138,
-0.6568892002105713,
-0.12428434938192368,
0.18371479213237762,
-0.1422087848186493,
-0.1551005691... | |
usually contains UI elements (views, controls, etc.) and data, and both receives and send messages to the various objects within it. In many cases, a controller **is** a delegate and can implement several delegate protocols to receive events from multiple objects.
Keep in mind that many UI elements and controls let yo... | [
0.2916799485683441,
-0.37522172927856445,
0.2392149567604065,
0.5668131709098816,
-0.04002644866704941,
-0.2682689130306244,
-0.054569974541664124,
-0.057205282151699066,
-0.379905104637146,
-0.7959425449371338,
-0.20627255737781525,
0.09126673638820648,
-0.12664619088172913,
0.12740521132... | |
delegates to handle their events. | [
0.18749262392520905,
0.2352331429719925,
0.005910117644816637,
0.217612162232399,
-0.11695121973752975,
-0.12038490921258926,
-0.1712101846933365,
-0.3126510679721832,
-0.693821132183075,
-0.3874450922012329,
-0.4466632902622223,
0.47874704003334045,
-0.07733534276485443,
-0.02568857371807... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.