text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I have the following code that tries to tie arrays to files. Except, when I run this code, it only creates 2045 files. What is the issue here?
```
#!/usr/bin/perl
use Tie::File;
for (my $i = 0; $i < 10000; $i++) {
@files{$i} = ();
tie @{$files{$i}}, 'Tie::File', "files//tiefile$i";
}
```
Edit: I am on windo... | [
-0.26078253984451294,
0.01262522954493761,
1.2511942386627197,
-0.11535294353961945,
0.020050818100571632,
-0.07166481018066406,
0.26673877239227295,
-0.46150442957878113,
-0.7627158761024475,
-0.7036158442497253,
-0.34403130412101746,
0.34150221943855286,
-0.08768872916698456,
0.576134085... | |
at any one time, since the 2048 limit is hard limit (cannot be modified) in MSVC's `stdio`. | [
-0.1388970911502838,
-0.07890937477350235,
0.6740578413009644,
0.03596422076225281,
0.44307053089141846,
-0.5562536120414734,
-0.024038517847657204,
-0.006807907484471798,
-0.3677941858768463,
-0.49954384565353394,
-0.3067444860935211,
0.5383197069168091,
-0.06570243835449219,
0.3229319751... | |
I have a two-project solution - one project contains my schemas and BizTalk orchestration, and the other contains a DLL that is referenced from my orchestration and does that actual work (it's shared code, so there's no chance I can just incorporate it into the BizTalk assembly). The second assembly is added as a refer... | [
0.219887375831604,
-0.03468304127454758,
0.12519414722919464,
0.07443629950284958,
-0.02354549802839756,
0.017351869493722916,
0.1993967443704605,
-0.4863630533218384,
-0.28338131308555603,
-0.6940559148788452,
0.01544308103621006,
0.486973375082016,
-0.3511918783187866,
-0.261940747499465... | |
my orchestration, I'll get an error that the referenced assembly couldn't be loaded, but once I add it to the GAC and the "Resources" list for my BizTalk app, things run perfectly.
How can I flag this assembly as something that has to be deployed with my BizTalk assembly? Am I just missing a setting on the reference s... | [
-0.020933717489242554,
0.11686874181032181,
0.3399152457714081,
-0.08903530985116959,
-0.022520916536450386,
0.24717198312282562,
0.5377246141433716,
-0.569216251373291,
-0.47711247205734253,
-0.5847208499908447,
-0.19969442486763,
0.5213419198989868,
-0.6857112050056458,
0.067660406231880... | |
-Options:GacOnImport,GacOnInstall -Overwrite
BTSTask ExportApp -ApplicationName:MyApp -Package:MyApp.msi
```
You get an MSI at the end, which you would need to import!
This addresses your problem. | [
-0.15883441269397736,
-0.07973510771989822,
0.4920978844165802,
-0.08296073973178864,
0.022998793050646782,
0.21838729083538055,
0.5219464898109436,
0.26814332604408264,
-0.18102605640888214,
-0.74249267578125,
-0.44524699449539185,
0.38050147891044617,
-0.609495222568512,
0.21936637163162... | |
Why do ASP.NET `LinkButton` controls with `OnClientClick` attribute and disabled by setting `Enabled="false"` still render `onclick` event handler in HTML while `Button` controls don't?
It seems counter-intuitive. Since anchors can't really be disabled in browsers, it makes more sense not to attach an onclick event (a... | [
0.12847109138965607,
-0.0715947300195694,
0.1948937326669693,
0.14343799650669098,
-0.2383260577917099,
-0.37412530183792114,
0.26358041167259216,
0.008724221028387547,
-0.26568591594696045,
-0.5914596319198608,
-0.035041674971580505,
0.4441514015197754,
-0.5012170672416687,
0.027871424332... | |
and check element attributes. This is just the way it is currently implemented so when you need the functionality of a button that can be disabled it is best to stay way from linkbuttons or anchors entirely. | [
0.2539566457271576,
-0.24509292840957642,
0.11609800904989243,
0.17774753272533417,
0.23296156525611877,
-0.38482049107551575,
0.07397132366895676,
0.005737492348998785,
-0.2459457367658615,
-0.4667605459690094,
-0.1860772669315338,
0.5108345150947571,
-0.4911787807941437,
-0.2490311861038... | |
On a Linux system with a wired and a wireless interface (e.g. 192.168.1.x and 192.168.2.x subnets) I want to send a UDP broadcast that goes out via ALL available interfaces (i.e. both through the wired and the wireless interface).
Currently I sendto() to INADDR\_BROADCAST, however it seems that the broadcast only is s... | [
0.4956519901752472,
-0.1346757560968399,
0.32275155186653137,
-0.1619482934474945,
-0.39411792159080505,
-0.28514426946640015,
0.2198045402765274,
0.3890843987464905,
-0.35690513253211975,
-0.8513463735580444,
-0.28142595291137695,
0.6534616947174072,
-0.6256963014602661,
0.381452232599258... | |
exactly one of the reasons that broadcast is unsuitable. It should die along with IPv4 (hopefully). Note that IPv6 doesn't even have a concept of broadcast (multicast is used, instead).
`INADDR_BROADCAST` is limited to the local link. Nowadays, it's only visible use is for DHCP auto-configuration, since at such time, ... | [
0.22644366323947906,
-0.31807461380958557,
0.37706258893013,
-0.06543765962123871,
-0.4805851876735687,
-0.586395800113678,
0.27979299426078796,
0.101895272731781,
-0.3790561854839325,
-0.7941385507583618,
-0.13971003890037537,
0.368672639131546,
-0.5884381532669067,
0.48012757301330566,
... | |
have to iterate over all interfaces, and either use raw sockets or bind the socket to a device using `setsockopt(..., SOL_SOCKET, SO_BINDTODEVICE, "ethX")` to send each packet bypassing the OS routing table (this requires root privileges). Not a good solution.
Instead, since `INADDR_BROADCAST` is not routed anyway, yo... | [
0.24264343082904816,
-0.15002235770225525,
0.5749559998512268,
-0.07611975818872452,
-0.010232780128717422,
-0.24235807359218597,
0.4662991762161255,
-0.10982013493776321,
-0.2112056016921997,
-1.164175033569336,
-0.31528520584106445,
0.7169580459594727,
-0.3156079649925232,
0.139156714081... | |
regarding to `INADDR_BROADCAST`, and complementing the answer with information about `SO_BINDTODEVICE`. | [
0.2298048883676529,
-0.2578109800815582,
0.13623526692390442,
-0.1311141699552536,
-0.293365478515625,
-0.2798445522785187,
0.39636051654815674,
-0.11190089583396912,
-0.23588255047798157,
-0.44836482405662537,
-0.38023510575294495,
0.26436036825180054,
-0.17401331663131714,
0.090342521667... | |
In my table, I have a nullable bit column (legacy system...) and another developer recently made a change to a stored procedure to only show values where the bit column was not true (1). Because this is a nullable column, we noticed that if the column was NULL, the record was not being picked up. WHY is this?
Both th... | [
0.019515952095389366,
0.3998394012451172,
-0.016474366188049316,
0.03630679100751877,
0.04334822669625282,
-0.03083922527730465,
0.4180302023887634,
-0.11802514642477036,
-0.3824462592601776,
-0.6718385815620422,
-0.060158565640449524,
0.3384336531162262,
-0.49183225631713867,
0.0448947474... | |
a nullable bit field so it can have the following values: NULL, 0, or 1
When a SQL statement is created with a where clause such as (VoidedIndicator <> 1) we only get records returned that have VoidedIndicator == 0, but we were expecting both VoidedIndicator == 0 and VoidedIndicator IS NULL. Why is this?
From the [Wik... | [
-0.05267710983753204,
-0.12179601192474365,
-0.02391042187809944,
0.12205018103122711,
-0.15228012204170227,
-0.11985576897859573,
0.3223271071910858,
-0.11316617578268051,
-0.11884895712137222,
-0.3348098397254944,
-0.22421671450138092,
0.32557427883148193,
-0.4480121433734894,
0.29020184... | |
in fact,
> such expressions return Unknown. An
> example is below:
>
>
>
> ```
> -- Rows where num is NULL will not be returned,
> -- contrary to many users' expectations.
> SELECT * FROM sometable WHERE num <> 1;
>
>
> ```
Basically, *any* comparison between NULL and something else, whether it's ... | [
0.06980380415916443,
0.056669604033231735,
-0.16224545240402222,
-0.05377694591879845,
-0.2568669319152832,
0.0574631430208683,
0.4042166471481323,
-0.14166061580181122,
0.13581499457359314,
-0.7333922386169434,
-0.15095151960849762,
0.2938232719898224,
-0.2860918939113617,
0.1681855767965... | |
left operand is not equal to the right
> operand; otherwise, the result is
> FALSE. If either or both operands are
> NULL, see SET ANSI\_NULLS
> (Transact-SQL).
The [SET ANSI\_NULLS](http://msdn.microsoft.com/en-us/library/ms188048(SQL.90).aspx) page then states:
> When SET ANSI\_NULLS is ON, a SELECT
> statement tha... | [
-0.4123232066631317,
-0.265666663646698,
0.487161785364151,
-0.33794885873794556,
0.06887320429086685,
0.05535794422030449,
0.13595513999462128,
-0.42521512508392334,
0.023261280730366707,
-0.6123926043510437,
-0.20807723701000214,
0.47467339038848877,
-0.4170127511024475,
0.36924776434898... | |
of all
> data against a null value evaluate to
> TRUE if the data value is NULL. | [
-0.09142883867025375,
0.22236143052577972,
0.06617488712072372,
0.052437350153923035,
-0.24038513004779816,
-0.1452656388282776,
0.7958043217658997,
-0.13086307048797607,
0.35573095083236694,
-0.6136006712913513,
-0.23519755899906158,
0.6001343727111816,
-0.4291144013404846,
-0.05100557580... | |
Can subversion be hosted on Amazon's hosted cloud service?
Sure. Set up an ec2 instance with linux and install svn on that server. | [
0.33289834856987,
-0.4912199378013611,
0.13378679752349854,
0.527101457118988,
-0.2265598624944687,
-0.31841933727264404,
0.3034994900226593,
0.37949490547180176,
-0.21461594104766846,
-0.30547210574150085,
0.08536290377378464,
0.021122079342603683,
-0.2141880989074707,
-0.0476846881210804... | |
This is a followup to ["How can I get around a ‘die’ call in a Perl library I can’t modify?"](https://stackoverflow.com/questions/451227/how-can-i-get-around-a-die-call-in-a-perl-library-i-cant-modify).
I have a subroutine that calls a Library-Which-Crashes-Sometimes many times. Rather than couch each call within this... | [
0.13593396544456482,
-0.07711616903543472,
0.1066397950053215,
0.07352033257484436,
-0.10027015954256058,
-0.1712026745080948,
0.27277064323425293,
-0.25667449831962585,
-0.2922165095806122,
-0.34063059091567993,
-0.16946272552013397,
0.24247989058494568,
-0.31197428703308105,
0.1614241600... | |
next file if function() fails
```
However, there are error conditions that I can and do catch in function(). What is the most proper/elegant way to design the error-catching in the subroutine and the calling routine so that I get the correct behavior for both caught and uncaught errors?
Block eval can be nested:
```... | [
-0.04548320546746254,
-0.08397683501243591,
0.09339993447065353,
0.021718798205256462,
0.21456459164619446,
-0.07586529850959778,
0.5097399353981018,
-0.3573637902736664,
0.0249177273362875,
-0.5784473419189453,
-0.2966998219490051,
0.5413935780525208,
-0.35360899567604065,
-0.070261187851... | |
one we expect
die $@ unless $@ eq "error that can be handled\n";
#handle the error
};
die "uncaught error";
}
eval { function(); 1 } or do {
warn "caught error $@";
};
``` | [
0.20017579197883606,
-0.42411690950393677,
-0.04113920405507088,
-0.07952586561441422,
0.17898376286029816,
-0.14454646408557892,
0.17471565306186676,
-0.23345552384853363,
0.25035715103149414,
-0.5996881723403931,
-0.0972796231508255,
0.7859892249107361,
-0.4820617735385895,
-0.0920926257... | |
I connect to a lot of different servers in SQL Management Studio, but I find that not only is there no way to delete the old connections (dbnames, usernames, etc.), they also start to show up as duplicates.
Is there any way to clear them/reorder the history? I can't seem to find any easy way.
Thanks!
I had the same i... | [
0.5677459239959717,
0.3847256600856781,
0.06731139868497849,
0.269718736410141,
0.07390953600406647,
-0.26863059401512146,
0.30145683884620667,
0.16186091303825378,
-0.3437528610229492,
-0.7749016880989075,
0.2754804193973541,
0.3264932930469513,
-0.002835426479578018,
0.6391086578369141,
... | |
in the C:\Documents and Settings\%USERNAME%\Application Data\Microsoft\Microsoft SQL Server\100\Tools\Shell folder. | [
-0.20133180916309357,
0.5012649297714233,
0.21242937445640564,
-0.052808117121458054,
0.5471598505973816,
-0.048317208886146545,
-0.059914931654930115,
0.2337164580821991,
0.19547903537750244,
-0.6130573749542236,
-0.5230968594551086,
0.5232811570167542,
-0.23895303905010223,
0.07874567061... | |
I have an array full of patterns that I need matched. Any way to do that, other than a for() loop? Im trying to do it in the least CPU intensive way, since I will be doing dozens of these every minute.
Real world example is, Im building a link status checker, which will check links to various online video sites, to e... | [
0.8167215585708618,
0.10778187960386276,
0.2745410203933716,
0.24413029849529266,
-0.04513821005821228,
-0.1699863225221634,
0.45037075877189636,
-0.11473308503627777,
-0.4336931109428406,
-0.5447790026664734,
0.16750307381153107,
0.20494794845581055,
-0.4220743179321289,
0.148799121379852... | |
match the contents pf the array, against the html output of the page.
First of all, if you literally are only doing **dozens** every **minute**, then I wouldn't worry terribly about the performance in this case. These matches are pretty quick, and I don't think you're going to have a performance problem by iterating th... | [
0.45652511715888977,
-0.14718250930309296,
0.45562437176704407,
-0.166212260723114,
-0.17282292246818542,
-0.09461195021867752,
0.17934024333953857,
-0.3807933032512665,
-0.23547324538230896,
-0.8381571769714355,
-0.06337758898735046,
0.5101713538169861,
-0.6315784454345703,
-0.23525992035... | |
but don't just slap them together with a `|`. This will break badly if any of your patterns **contain** the or operator.
I would recommend at least grouping your patterns using parenthesis like:
```
foreach ($patterns as $pattern)
{
$grouped_patterns[] = "(" . $pattern . ")";
}
$master_pattern = implode($grouped_pa... | [
0.5099270343780518,
-0.07552174478769302,
0.1489500105381012,
0.1831979751586914,
-0.22185935080051422,
-0.17055422067642212,
0.36080026626586914,
-0.08871705085039139,
-0.669119656085968,
-0.7680850625038147,
-0.008783521130681038,
0.2845595180988312,
-0.4762428104877472,
-0.0492501929402... | |
the most important thing to do is pull out the non regex matches into a simple "string contains" check. I would imagine that some of your checks must be simple string checks like looking to see if "This Site is Closed" is on the page.
So doing this:
```
foreach ($strings_to_match as $string_to_match)
{
if (strpos($... | [
0.12902866303920746,
0.12155032157897949,
0.39753884077072144,
-0.2012658566236496,
0.15898622572422028,
-0.34418627619743347,
0.36066359281539917,
-0.3877679705619812,
-0.17961101233959198,
-0.7329553961753845,
-0.23671658337116241,
0.6091373562812805,
-0.542396605014801,
-0.0913997143507... | |
be your best gain. `strpos()` is a **lot** faster than `preg_match()`. | [
0.0739225447177887,
-0.39810633659362793,
0.6953507661819458,
0.10469947010278702,
0.16705353558063507,
-0.27214735746383667,
-0.024637781083583832,
-0.09831932187080383,
0.07264997065067291,
-0.6918467879295349,
0.07197453826665878,
0.9889709949493408,
0.14964471757411957,
-0.322444349527... | |
I have an asp button. It's server-side so I can only show it for logged in users, but i want it to run a javascript function and it seems when it's runat="server" it always calls the postback event.
I also have a regular button (`<input...`>) not running at server and it works fine...
How can I make this button only ... | [
0.03715294227004051,
-0.05743635073304176,
0.5431010723114014,
-0.25825026631355286,
-0.07077853381633759,
0.045278072357177734,
0.44917795062065125,
-0.1735178381204605,
-0.4324077367782593,
-0.654646635055542,
0.014225572347640991,
0.39881807565689087,
-0.3053223192691803,
0.081622175872... | |
Deploying database(\*.sdf) to Pocket PC WM 5.0. Via C# i am attempting to DELETE records. The DELETE query returns that 5 rows are affected(there are 5 rows). However, when i view database in Pocket PC under its Query Tool the rows remain. No error or issue arise at my code level.
What is missing? It is the right dat... | [
-0.20608997344970703,
0.06330879032611847,
0.3115503787994385,
-0.1501631885766983,
0.08634773641824722,
0.06762657314538956,
0.21432854235172272,
-0.24727818369865417,
-0.5252618789672852,
-0.5910216569900513,
0.05304260551929474,
0.6219995021820068,
-0.5551581978797913,
0.084397546947002... | |
to print all of your code](http://msdn.microsoft.com/en-us/library/ms973240.aspx); perhaps you can use this, or something like it:
```
Sub PrintItemsInSelectedProject()
Dim proj As Project
Dim objProj As Object()
objProj = DTE.ActiveSolutionProjects
If objProj.Length = 0 Then
Exit Sub
End ... | [
0.04580051824450493,
-0.05105461925268173,
0.7908459305763245,
0.019298339262604713,
-0.039528150111436844,
0.0731416568160057,
0.41253265738487244,
-0.3083397448062897,
-0.2709009349346161,
-0.3300750255584717,
-0.5422272682189941,
0.3594559133052826,
-0.4297618269920349,
0.18193964660167... | |
If (IsPrintableFile(projitem) = True) Then
If (projitem.IsOpen( _
EnvDTE.Constants.vsViewKindTextView)) Then
projitem.Document.PrintOut()
Else
Dim doc As Document | [
0.14099684357643127,
-0.34297317266464233,
0.6400895118713379,
-0.07120822370052338,
0.3277604281902313,
-0.2893124520778656,
0.3468873202800751,
-0.5396900773048401,
0.14615076780319214,
-0.5298095345497131,
-0.4217132329940796,
0.6456135511398315,
-0.20013488829135895,
-0.067948654294013... | |
doc = projitem.Open( _
EnvDTE.Constants.vsViewKindTextView).Document
doc.PrintOut()
doc.Close(vsSaveChanges.vsSaveChangesNo)
End If
End If
PrintItemsInSelectedProject(projitem.ProjectItems)
Next
End Sub
Function IsPrintableFile( _ | [
-0.21111536026000977,
-0.10145501792430878,
0.7698529362678528,
-0.19451409578323364,
0.2866077423095703,
-0.0953846126794815,
0.25736135244369507,
-0.38169002532958984,
0.10663532465696335,
-0.40484440326690674,
-0.4550226032733917,
0.513927161693573,
-0.2070198506116867,
0.15881738066673... | |
ByVal projItem As ProjectItem) As Boolean
Dim fileName As String
Dim extensions As _
New System.Collections.Specialized.StringCollection
' If you add a file to your project that is of
' a type that can be printed,
' then add the extension of that
' file type to this list.
Dim exts... | [
0.4666465222835541,
-0.3280903398990631,
0.8773463368415833,
-0.17526216804981232,
-0.22416093945503235,
0.29061633348464966,
0.05914611741900444,
-0.35605403780937195,
-0.1549919694662094,
-0.2629081904888153,
-0.4486846923828125,
0.29675981402397156,
-0.3999382257461548,
0.23842017352581... | |
".xslt", _
".config", ".htm", ".html", ".css", _
".js", ".vbs", ".wsf", ".txt", ".cpp", _
".c", ".h", ".idl", ".def", ".rgs", ".rc"}
extensions.AddRange(exts)
fileName = projItem.FileNames(1)
Return extensions.Contains( _
System.IO.Path.GetExtension(fileName).ToLower())
End ... | [
0.15939809381961823,
-0.11352687329053879,
0.9686112403869629,
-0.14627207815647125,
0.27488553524017334,
0.2213687002658844,
0.18786664307117462,
-0.37352463603019714,
-0.27600371837615967,
-0.5438948273658752,
-0.6149147748947144,
0.6471507549285889,
-0.4452747106552124,
0.40452429652214... | |
What is about such concepts as Class, Interface, Mixin in PowerShell? Does it support OOP? If so, where can I read about this?
You can define new types in PowerShell v2.0 using the `Add-Type` cmdlet:
> **DETAILED DESCRIPTION**
>
>
> The Add-Type cmdlet lets you define a .NET class in your Windows PowerShell session.... | [
0.3691052794456482,
-0.1352696418762207,
0.36750319600105286,
0.0999264344573021,
-0.20070669054985046,
-0.13389767706394196,
0.027477331459522247,
-0.05952373147010803,
-0.13471437990665436,
-0.8702114224433899,
-0.03449750691652298,
0.48404255509376526,
-0.43421289324760437,
0.2613256871... | |
can specify the type by specifying an existing assembly or source code files, or you can specify source code in line or saved in a variable. You can even specify only a method and Add-Type will define
> and generate the class. You can use this feature to make Platform Invoke (P/Invoke) calls to unmanaged functions in... | [
0.3290587067604065,
-0.34985455870628357,
0.0031194384209811687,
0.10390221327543259,
0.06979840248823166,
0.207843616604805,
-0.01873612217605114,
-0.2914421260356903,
0.06453375518321991,
-0.7526046633720398,
-0.09167183935642242,
0.46370792388916016,
-0.6617136001586914,
-0.031334355473... | |
(CSharp is the default), compiler options, assembly dependencies, the class namespace, and the names of the type and the
> resulting assembly.
`help Add-Type` for more information.
Also, see:
* [How do I create a custom type in PowerShell for my scripts to use?](https://stackoverflow.com/questions/59819/how-do-i-cr... | [
0.35807546973228455,
-0.05643944814801216,
0.2968892455101013,
-0.0642104297876358,
-0.14378196001052856,
0.047552429139614105,
0.20193715393543243,
-0.35075774788856506,
-0.309264212846756,
-0.39746952056884766,
-0.19715158641338348,
0.477822870016098,
-0.3760283887386322,
-0.099884398281... | |
Hey i'm having problems creating a simple button for a programme which finds the largest word in an array and puts it into a textbox. I've done most of the coding (I hope) was wondering if somebody could help me actually with the code that finds the largest text in the array as I am struggling the most with that.
```... | [
-0.14773660898208618,
0.11977653205394745,
0.5380680561065674,
-0.23406584560871124,
0.007138309068977833,
0.14360667765140533,
0.3020155429840088,
0.11421214789152145,
-0.45887166261672974,
-0.44285666942596436,
-0.3136368691921234,
0.5663584470748901,
-0.17507456243038177,
0.262668877840... | |
Dim UltimateName As String
For i As Integer = 0 To 5
LongName = Members(i).Name
LengthOfLongestName = Len(LongName)
If Members(i).Name.Length > LengthOfLongestName Then
End If
Next i
txtResult.Text = "The | [
0.18193605542182922,
-0.5780528783798218,
0.8219727277755737,
-0.185212180018425,
-0.1500537097454071,
-0.06877492368221283,
0.33859673142433167,
-0.28673237562179565,
-0.00820427667349577,
-0.25012144446372986,
-0.18693649768829346,
0.7405446171760559,
0.04252173379063606,
0.2544256448745... | |
longest name is " & UltimateName & " ."
End Sub
End Class
```
Thanks for your time - its for college homework, struggling big time on it :(
edit: I've edited the code
Since this is homework, I won't write the code for you; instead I'll try to give you some hints that will point you in the right direction.
1. De... | [
-0.016540704295039177,
-0.03784981369972229,
0.33091646432876587,
-0.0292650256305933,
0.017605386674404144,
-0.24226637184619904,
0.39996337890625,
0.12087775021791458,
-0.14959828555583954,
-0.30859628319740295,
-0.1294993758201599,
0.13818353414535522,
-0.07881622016429901,
0.1901129037... | |
inside your loop:
```
If the Length of <the value being checked> exceeds _
the Length of the <longest value so far> Then
Assign <the value being checked> to the <longest value so far>
End If
```
When the loop finishes, the `<longest value so far>` will be the longest value in the array.
**Notes**
* You c... | [
0.48940473794937134,
-0.05813530087471008,
0.4221701920032501,
-0.11346042156219482,
0.010362783446907997,
-0.3166296184062958,
0.5011703372001648,
-0.2520521879196167,
-0.40027737617492676,
-0.39221715927124023,
-0.12454551458358765,
0.2664649188518524,
-0.125813826918602,
0.0210356339812... | |
loop; it should correspond to each consecutive value in your array. You can verify that this is working by [setting a breakpoint](http://msdn.microsoft.com/en-us/library/k80ex6de.aspx).
* You can get the length of a string by saying `myString.Length`
* If you've learned about `Function`s, consider writing a function th... | [
0.24352169036865234,
-0.3486160933971405,
0.05089839920401573,
0.0070945206098258495,
-0.14806140959262848,
-0.17867805063724518,
0.3920680284500122,
-0.17149145901203156,
-0.3720366656780243,
-0.3023158609867096,
-0.06538664549589157,
0.24644167721271515,
-0.34824928641319275,
0.036814615... | |
**I think this is the key concept that you are missing.**
* Instead of comparing `LongName.Length` to `LengthOfLongestName`, you need to compare the length of an entry in your array to `LengthOfLongestName`
* You're on the right track with `Members(0).Name.Length`, but you can't just check element `0`; you have to chec... | [
0.03242470324039459,
-0.11470983922481537,
0.1446288377046585,
-0.007455348968505859,
-0.0770849883556366,
-0.03337111696600914,
0.1604209989309311,
-0.11453615128993988,
-0.328760027885437,
-0.6890813112258911,
0.21566665172576904,
0.40973377227783203,
-0.04905643314123154,
0.076573275029... | |
how to go through all the items in your list:
```
' A For loop that does a message box for each of the numbers from 0 to 5 '
For i as Integer = 0 To 5
MessageBox.Show(i)
Next i
' Code that does a message box with the names of the 2nd, 3rd and last '
' entries in Members '
' (Remember that the first item is at 0, ... | [
0.4809204936027527,
-0.069624163210392,
0.6345236897468567,
-0.15370380878448486,
-0.005716476123780012,
-0.1842619627714157,
0.5376931428909302,
-0.4864063262939453,
-0.6486356854438782,
-0.7612672448158264,
-0.09559385478496552,
-0.06397645175457001,
-0.08213634788990021,
0.2787440419197... | |
(i.e. they should be assigned inside of the `If` statement)
* You have to go to the last index of the array, not 5. See above (the response to your first edit) on how to get that last index.
* You don't really need the `UltimateName` variable; you can just use `LongName` ;-]
* You might want to use `<stringVariable>.Le... | [
0.13893470168113708,
-0.5707670450210571,
0.22922703623771667,
0.009638568386435509,
-0.05767027661204338,
-0.03633209317922592,
0.15115341544151306,
-0.003173965960741043,
-0.20638436079025269,
-0.4917791783809662,
-0.0937035009264946,
0.5679255127906799,
0.07067491114139557,
0.0951787084... | |
I have a program using 3 header files and 3 .cpp files in addition to main.cpp. I'm using VC++ 2008.
Here's the setup. All three headers are guarded with #ifndef HEADERNAME\_H, etc. Also all three headers have corresponding .cpp files, which #include their respective headers.
```
/* main.cpp */
#include "mainHead... | [
0.05715465173125267,
0.5954923033714294,
0.591099202632904,
-0.23994089663028717,
0.5141968131065369,
0.3075314164161682,
0.336056649684906,
-0.16895146667957306,
-0.3946239650249481,
-0.7187188267707825,
-0.09979322552680969,
0.6118940711021423,
-0.3900332450866699,
-0.2612053155899048,
... | |
private:
int varA;
Foo myFoo1;
Foo myFoo2;
Foo myFoo3;
Public:
void setVarA(int); // defined in Moo.cpp
//etc
};
/* Foo.h */
#include "mainHeader.h"
class Foo { ... };
```
I'm getting compiler errors for instantiating the three Foo's inside of Mo... | [
0.11566871404647827,
0.17990392446517944,
0.351976603269577,
-0.22978225350379944,
0.08490771800279617,
0.27651262283325195,
0.5128031373023987,
-0.40634885430336,
-0.12371961027383804,
-0.10862350463867188,
-0.2875254154205322,
0.9439577460289001,
-0.35061848163604736,
0.26397132873535156... | |
uses undefined class 'Foo'
I included Foo.h right there, so why is it undefined? This is the only file that includes Foo.h. I even tried declaring Foo by placing 'class Foo;' before my declaration of class Moo.
I also have #defines in my Foo.h file that are also causing compiler errors when I use them in Moo.h. (unde... | [
0.16053983569145203,
0.2832179069519043,
0.17868322134017944,
0.002939573721960187,
-0.09917052835226059,
-0.23383961617946625,
-0.125911682844162,
0.1058160811662674,
-0.41241535544395447,
-0.3574424982070923,
0.3139866888523102,
0.4441683292388916,
-0.30152812600135803,
0.294380664825439... | |
ANIMATION_H
#define ANIMATION_H
#include "../Headers/MarioGame.h"
#define MAX_ANIMATIONS 58
extern char* fileAnimations[MAX_ANIMATIONS];
extern char marioAnims[MAX_ANIMATIONS][3000];
extern char background [3700000];
class Animation
{
private:
int imageCount;
public:
DWORD lastAnimTick;
int lastAnim;
... | [
-0.017294542863965034,
-0.06911467760801315,
0.5522793531417847,
0.08179455995559692,
0.020142562687397003,
0.5861867070198059,
0.11890551447868347,
-0.21744167804718018,
-0.3522194027900696,
-0.6145968437194824,
-0.3723435699939728,
0.6635812520980835,
-0.19786497950553894,
0.112275980412... | |
all causing errors:
```
//**************************
// Mario.h
//**************************
// Header to Mario class
#ifndef MARIO_H
#define MARIO_H
#include "../Headers/MarioGame.h"
#include "../Headers/Animation.h"
enum { MARIO_TYPE_SMALL,
MARIO_TYPE_BIG,
MARIO_TYPE_LEAF };
class Animation;
c... | [
-0.31885117292404175,
-0.2792179584503174,
0.674669086933136,
0.34175729751586914,
0.07773512601852417,
0.14153172075748444,
0.07140506058931351,
-0.28189024329185486,
-0.2963705062866211,
-0.6807212829589844,
-0.3826194703578949,
0.22986465692520142,
-0.1084141805768013,
-0.01734833791851... | |
float xAccel;
float yAccel;
float xSize;
float ySize;
float halfW;
float halfH;
bool grounded;
bool walking;
bool running;
bool pRunning;
bool jumping; | [
0.09931735694408417,
-0.12886713445186615,
0.10508061945438385,
-0.5059801340103149,
-1.0480085611343384,
0.449722558259964,
0.5623645186424255,
-0.12170535326004028,
-0.1335391253232956,
-0.02399449795484543,
-0.6778155565261841,
0.1092529371380806,
-0.19925948977470398,
-0.11952612549066... | |
bool hunching;
bool gliding;
bool flying;
bool decelerating;
int facing;
DWORD pRunTimer;
int pChargeLevel;
DWORD jumpStart;
DWORD glideStart;
int type;
bool updateXMovement; | [
-0.3472875952720642,
-0.20805108547210693,
0.2262507975101471,
-0.26321840286254883,
-0.35097190737724304,
0.38779497146606445,
0.46128758788108826,
-0.0583869032561779,
-0.0902632400393486,
-0.1869666427373886,
-0.9629257321357727,
0.2585267424583435,
-0.34278273582458496,
-0.226953983306... | |
bool updateYMovement;
bool screenUpLock;
char marioAnims[MAX_ANIMATIONS][3000];
Animation smallStand;
Animation smallWalk;
Animation smallRun;
Animation smallPRun;
Animation smallJump;
Animation smallSkid;
Animation bigStand;
Animation ... | [
-0.13515540957450867,
-0.32834136486053467,
0.48308223485946655,
0.19399961829185486,
-0.005745816510170698,
0.6727290749549866,
0.16509157419204712,
0.37707123160362244,
-0.34511151909828186,
-0.6715021729469299,
-0.5965553522109985,
0.25574347376823425,
-0.001130647142417729,
0.122638322... | |
bigRun;
Animation bigPRun;
Animation bigJump;
Animation bigSkid;
Animation bigHunch;
Animation leafStand;
Animation leafWalk;
Animation leafRun;
Animation leafPRun;
Animation leafJump;
Animation leafSkid;
Animation leafHunch; | [
-0.6228354573249817,
-0.5510892271995544,
0.2884598970413208,
0.2519903779029846,
-0.23405161499977112,
0.2848944664001465,
0.2560843825340271,
0.7166720032691956,
-0.5244058966636658,
-0.47667261958122253,
-0.945964515209198,
-0.1721249222755432,
-0.21965613961219788,
-0.2822627127170563,... | |
Animation leafTailWhack;
Animation leafGlide;
Animation leafFly;
Animation leafFalling;
Animation* lastAnim;
#pragma endregion
public:
//Constructor
Mario();
//Mutators
void setGlideStart( DWORD g );
void setHunching( bool h );
void setGliding( bool g );
... | [
-0.19503818452358246,
-0.4077070653438568,
0.5543836951255798,
0.15015895664691925,
0.01197882741689682,
0.24712960422039032,
0.16137874126434326,
0.0711466521024704,
-0.12421365082263947,
-0.5054649114608765,
-0.6015447378158569,
0.3385789394378662,
-0.4375247657299042,
0.0303396247327327... | |
t );
void setPChargeLevel( int c );
void setPRunTimer( DWORD t );
void setScreenUpLock( bool s );
void setUpdateXMovement( bool m );
void setUpdateYMovement( bool m );
void setDecelerating( bool d );
void setPos( float x, float y );
void setVel( float x, float y );
void setAccel( flo... | [
0.5122573375701904,
-0.37035736441612244,
0.5740011930465698,
-0.2905486524105072,
0.1333305537700653,
0.15603582561016083,
0.4068334698677063,
-0.281093955039978,
-0.10349050164222717,
-0.4117134213447571,
-0.7767804265022278,
0.49527907371520996,
-0.4442906081676483,
-0.08395637571811676... | |
void setJumpStart( DWORD s );
void setGrounded( bool g );
void setWalking( bool w );
void setRunning( bool r );
void setPRunning( bool r );
void setLastXVel( float l );
void setFacing( int f );
void defaultAnimations();
//Accessors
DWORD getGlideStart();
bool getHunching();
... | [
0.36969229578971863,
-0.48633188009262085,
0.6681414842605591,
-0.3372173011302948,
0.14313869178295135,
0.1575116366147995,
0.4486108720302582,
-0.23433616757392883,
-0.18603160977363586,
-0.4214390814304352,
-0.8234083652496338,
0.7737278342247009,
-0.5975839495658875,
0.0319947116076946... | |
bool getScreenUpLock();
bool getUpdateXMovement();
bool getUpdateYMovement();
bool getDecelerating();
float getXPos();
float getYPos();
float getXVel();
float getYVel();
float getXAccel();
float getYAccel();
bool getJumping();
DWORD getJumpStart();
float getXSize();
f... | [
0.20937387645244598,
-0.24044416844844818,
0.469429075717926,
-0.26240891218185425,
-0.06804760545492172,
0.12982533872127533,
0.43500691652297974,
-0.16736043989658356,
-0.15957722067832947,
-0.2717761695384979,
-0.9146484136581421,
0.4296717643737793,
-0.20215119421482086,
-0.07191566377... | |
float getLastXVel();
int getFacing();
int getAnimation();
};
#endif // MARIO_H
```
This would be "mainHeader.h":
```
//**************************
// MarioGame.h
//**************************
// Header to MarioGame functions
// Contains Includes, Defines, Function Declarations, Namespaces for program
#if... | [
-0.2628385126590729,
-0.2214917242527008,
0.6691816449165344,
0.1691904217004776,
0.045170705765485764,
-0.18761883676052094,
-0.23020975291728973,
-0.01964760757982731,
0.17032815515995026,
-0.8166438937187195,
-0.2798387110233307,
0.5015408396720886,
-0.1129860207438469,
-0.0153120374307... | |
"Mario Game" // string that will appear in the title bar
#define NUM_OF_KEYS 5
#define KEY_SPACE 0
#define KEY_UP 1
#define KEY_DOWN 2
#define KEY_RIGHT 3
#define KEY_LEFT 4
#define KEY_CONTROL 5
#define GRIDW 2.0f
#define GRIDH | [
-0.06664703041315079,
-0.07435975223779678,
0.37735578417778015,
0.22868937253952026,
0.3980367183685303,
-0.05073074623942375,
-0.3428071141242981,
-0.10523512959480286,
-0.02512720786035061,
-0.47868427634239197,
-0.26893141865730286,
0.5112952589988708,
0.18173635005950928,
0.0468344762... | |
2.0f
#define PATHING_SIZE 33
//*=====================
// Includes
//*=====================
#include <windows.h>
#include <gl/gl.h>
#include <gl/glu.h>
#include <iostream>
#include <fstream>
#include <vector>
#include <math.h>
#include <WAVEMIX.H>
#include "../Console/guicon.h"
#include "../Headers/Mario.h"
//*==... | [
-0.35438597202301025,
-0.4542872905731201,
0.6217557191848755,
-0.05154644697904587,
-0.05805732682347298,
-0.0348987802863121,
-0.056162215769290924,
-0.34438663721084595,
-0.037127118557691574,
-0.6585379838943481,
-0.4955105781555176,
0.8111107349395752,
-0.503852903842926,
-0.222813308... | |
extern float playerTerminalWalkVel;
extern float playerWalkAccel;
extern float playerRunAccel;
extern float playerTerminalRunVel;
extern float playerDecel;
extern float playerPVel;
extern DWORD playerPRunAchieveTime;
extern float playerJumpUpVel;
extern float playerJumpTime;
extern fl... | [
-0.3493311405181885,
-0.45669159293174744,
0.7796237468719482,
-0.3431227505207062,
-0.41993454098701477,
0.23762285709381104,
0.13082173466682434,
-0.25050628185272217,
-0.000401992816478014,
-0.14333076775074005,
-0.5075771808624268,
0.41658028960227966,
-0.009151755832135677,
0.23771578... | |
// MARIOGAME_H
```
Here's main.cpp:
```
//**************************
// main.cpp
//**************************
// Primary implementation file; handles Win32 interface
#include "../Headers/MarioGame.h"
//*=====================
// WinMain
//*=====================
int WINAPI WinMain(HINSTANCE hinstance, HINSTANCE hp... | [
-0.5515297651290894,
0.19125723838806152,
0.5172955989837646,
0.08138444274663925,
0.11820711195468903,
-0.13233788311481476,
0.030347060412168503,
-0.04218868911266327,
-0.3944752514362335,
-0.4405500292778015,
-0.26458850502967834,
0.6108729243278503,
-0.38118699193000793,
-0.05915766581... | |
specified the second Foo.h is not included due to your guards, also class Foo has not been declared yet because that happens after including mainheader.h | [
0.18815159797668457,
-0.17406617105007172,
0.18733416497707367,
-0.022209465503692627,
0.22983726859092712,
-0.3843476176261902,
0.14182378351688385,
-0.08016809821128845,
-0.018539199605584145,
-0.3356543183326721,
-0.16413916647434235,
0.3301941156387329,
-0.390535831451416,
0.1231625527... | |
I have an app that has a ConcurrentQueue of items that have an ID property and a ConcurrentQueue of tasks for each item, the queue items look like:
```
class QueueItem {
public int ID { get; set; }
public ConcurrentQueue<WorkItem> workItemQueue { get; set; }
}
```
and the queue itself looks like:
```
Concurrent... | [
-0.2209213376045227,
0.06580933928489685,
0.5932561159133911,
0.0613841786980629,
0.06038569658994675,
0.44444844126701355,
0.1348123997449875,
-0.06670540571212769,
-0.429726243019104,
-0.7333879470825195,
0.01123831793665886,
0.3474411070346832,
-0.580359160900116,
0.3289950489997864,
... | |
ConcurrentQueues because I have a separate thread potentially adding queueItems to the itemQueue, and adding workItems to each workItemQueue.
My problem comes when I have no more workItems in a queueItem - I'd like to remove that queueItem from the itemQueue - something like...
```
if (queueItem.workItemQueue.TryDe... | [
-0.4610740840435028,
-0.14712508022785187,
0.48590606451034546,
0.13620084524154663,
0.028029190376400948,
0.3486538827419281,
0.4276551306247711,
0.09437911957502365,
-0.45766258239746094,
-0.4735580384731293,
0.26715287566185,
0.3748520612716675,
-0.6353569030761719,
0.6898978352546692,
... | |
itemQueue.TryDequeue(out queueItem);
if (queueItem.workItemQueue.TryDequeue(out workItem)) {
itemQueue.Enqueue(queueItem);
doWork(workItem);
}
else
break;
}
```
Is there a better way to accomplish what I want using the PFX ConcurrentQueue, or is this a reasonable way to do this, should I use a custo... | [
-0.0950683057308197,
-0.14555130898952484,
0.11249278485774994,
-0.04778500646352768,
-0.01015373133122921,
-0.12496555596590042,
0.26128825545310974,
-0.1681588590145111,
-0.5504032373428345,
-0.47535210847854614,
-0.08155842125415802,
0.19713817536830902,
-0.6457974314689636,
0.419533461... | |
implementation](http://java.sun.com/javase/6/docs/api/java/util/LinkedHashMap.html) if you are interested.
It is essentially a Hash table *and* a linked list, which allows O(1) queue, dequeue and remove.
This isn't implemented in .Net yet, but there are a few implementations floating around the web.
Now, the questi... | [
0.10349902510643005,
-0.15120960772037506,
0.2337382286787033,
-0.14180047810077667,
0.042673032730817795,
-0.05641603469848633,
-0.05178934708237648,
-0.14182151854038239,
-0.5094619989395142,
-0.5568355917930603,
0.20460431277751923,
0.040501829236745834,
-0.6032919883728027,
0.105053111... | |
Is it possible to configure vim to follow symlinks via `gf`?
For example, suppose I have a file `foo.txt` and a symlink `bar` in the same directory. I'd like to be able to edit the file `bar` points to by `gf`'ing over the word 'bar' in `foo.txt`.
More generally, I'd like to be able to use `find` and other path-using... | [
0.5487988591194153,
0.05871379375457764,
0.6106874346733093,
-0.0574151985347271,
-0.030976617708802223,
-0.20857122540473938,
-0.043861594051122665,
-0.19533225893974304,
-0.19581028819084167,
-0.5488341450691223,
0.11773212254047394,
0.7489030957221985,
-0.4124467372894287,
0.23402135074... | |
the `ObjectContext`.
The starting point is to get the EntityType for your base type, in your case Contact.
I have an [EF tips series](http://blogs.msdn.com/alexj/archive/2009/03/26/index-of-tips.aspx) and in [Tip 13](http://blogs.msdn.com/alexj/archive/2009/04/15/tip-13-how-to-attach-an-entity-the-easy-way.aspx) I sh... | [
-0.2900085151195526,
0.005620487965643406,
1.2609633207321167,
-0.009417600929737091,
0.08291733264923096,
-0.209913432598114,
-0.19402320683002472,
-0.3408687710762024,
0.18599575757980347,
-0.4333304166793823,
-0.24069921672344208,
0.7648308277130127,
-0.42241424322128296,
-0.00000235206... | |
EntityType relatedType =
(np.ToEndMember.TypeUsage.EdmType as RefType).ElementType;
//TODO: go repeat the same process... i.e. look at the relatedTypes
// navProps too until you decide to stop.
}
```
Of course how you decide what you want to Include is up to you.
Hope this helps
Alex | [
0.30106058716773987,
0.2266881763935089,
0.1126280426979065,
0.02608455903828144,
0.29933616518974304,
-0.37398776412010193,
0.310677707195282,
-0.12133058905601501,
-0.08435841649770737,
-0.43900465965270996,
-0.12469000369310379,
0.46803441643714905,
-0.6477512717247009,
0.13494710624217... | |
I have a bunch of scripts that run tool flows. Like a Makefile does but in Perl.
As part of those flows, the Perl scripts set environment vars and it's not always easy to know when they happen and hence it can be hard to reproduce individual stages of the flow.
Is there a way to hook into %ENV such that I can registe... | [
0.4614173471927643,
-0.21597419679164886,
0.25541454553604126,
0.07977655529975891,
-0.044844627380371094,
-0.19082780182361603,
0.11753392219543457,
-0.175176739692688,
-0.04638197645545006,
-0.4842180907726288,
0.1896265745162964,
0.6014439463615417,
-0.36211395263671875,
-0.037715375423... | |
and I'm sure I didn't cover all the possible cases, but this should definitely get you started.
```
use strict;
use warnings;
tie %ENV, 'change_noticer', %ENV or die $!;
$ENV{PATH} .= ":test";
print $ENV{PATH}, "\n";
delete $ENV{PATH};
package change_noticer;
use strict;
use warnings;
use Carp;
use Tie::Hash;
use ... | [
0.1731811761856079,
0.01661285199224949,
0.30073001980781555,
-0.33479440212249756,
0.3185805678367615,
0.04505748301744461,
0.5533961057662964,
-0.06412133574485779,
-0.14609819650650024,
-0.681917667388916,
-0.3180820047855377,
0.5190138220787048,
-0.46554768085479736,
0.4439499378204345... | |
= splice @_, 0, 2 ) {
$this->{$k} = $v;
}
return $this;
}
``` | [
0.22093024849891663,
-0.10929558426141739,
0.7814887762069702,
-0.05920136347413063,
0.12173096090555191,
-0.07171729952096939,
0.3334335684776306,
-0.5522573590278625,
0.09203968197107315,
-0.38638603687286377,
0.05113844573497772,
0.22586460411548615,
-0.48775869607925415,
0.662606120109... | |
I am stumped with this problem.
`ActiveSupport::JSON` defines `to_json` on various core objects and so does the JSON gem. However, the implementation is not the same -- the ActiveSupport version takes arguments and the JSON gem version doesn't.
I installed a gem that required the JSON gem and my app broke. The issue ... | [
-0.06263288855552673,
0.051670923829078674,
-0.03333747386932373,
-0.005464569199830294,
-0.007703786250203848,
-0.22615757584571838,
0.5265511274337769,
-0.2102929800748825,
-0.06047723442316055,
-0.4542751610279083,
-0.25681212544441223,
0.9185250401496887,
-0.2951410710811615,
-0.064314... | |
that I read online to fix it, but nothing worked. I ended up re-writing the gem to use `ActiveSupport::JSON.decode` instead of `JSON.parse`.
This works but it's not sustainable...I can't be forking gems every time I want to use a gem that requires the JSON gem.
**Update:** The best solution of this problem is to upgr... | [
0.29407066106796265,
0.05183360353112221,
0.05305070802569389,
-0.035421594977378845,
-0.11948403716087341,
-0.2046215832233429,
0.6545472741127014,
-0.15810386836528778,
-0.03413195535540581,
-0.6551501750946045,
-0.050989363342523575,
0.9935997128486633,
-0.3656584918498993,
-0.038924664... | |
will break everything all over again.*
Do you mean the `require 'json'` statement itself raises that Exception? Or do you mean when you call `@something.to_json(:something => value)` you get the error? The latter is what I would expect, if you have a problem requiring the JSON gem then I'm not sure what's going on.
I... | [
0.369136244058609,
-0.035251252353191376,
0.12411464750766754,
-0.10894127190113068,
-0.02745232544839382,
-0.45569026470184326,
0.5935555100440979,
-0.25714147090911865,
-0.16505950689315796,
-0.4362857937812805,
-0.5966811180114746,
0.9237366318702698,
-0.3351466953754425,
-0.08890967071... | |
is loaded. Putting
```
require 'json'
```
inside the `Rails::Initializer` did the trick (though putting it after the block did NOT).
That allows ActiveSupport to clobber the default JSON implementation instead.
Now if you are using a gem that actually depends on the JSON implementation of `to_json` then you are up... | [
0.36375024914741516,
0.1647724062204361,
-0.2556229829788208,
0.03339967876672745,
-0.3835729956626892,
-0.46209460496902466,
0.5714971423149109,
-0.28136590123176575,
0.08733700960874557,
-0.23713593184947968,
-0.06746633350849152,
0.9231326580047607,
-0.3372938334941864,
0.03417202830314... | |
implementations. This is more or less feasible depending on how the gem uses the method. A worst case scenario is an official fork (ie. `gem` and `gem-rails`). | [
0.2808895707130432,
-0.10455229878425598,
-0.25593218207359314,
0.14049093425273895,
-0.05799936130642891,
-0.30699077248573303,
0.49296334385871887,
0.018630366772413254,
-0.008343115448951721,
-0.16503433883190155,
-0.3610146641731262,
0.3439745604991913,
-0.23642568290233612,
0.11862888... | |
I've got a master page in a root folder of an asp.net application and content pages in subfolders. I'm using forms authentication and am not sure what to do, in web.config, for the master page. Does the forms authentication protect the child pages or the master page?
How does it work?
No. `Web.config` authorization is... | [
0.34080472588539124,
0.19049352407455444,
0.5397891402244568,
0.2721608281135559,
0.16091173887252808,
-0.14541177451610565,
0.08993382751941681,
-0.22891275584697723,
-0.2378755658864975,
-0.5589913725852966,
-0.09371821582317352,
0.19393488764762878,
-0.05126236379146576,
0.3129936754703... | |
It is not totally rigth that I can run a Bash function with 000 permissions, but almost. My code is:
```
#!/bin/bash
function hello {
echo Hello! }
```
The hello-file has permissions:
```
-r-------- 1 UnixBasics hello_file
```
Firtsly, I type with the current permissions:
```
$ . ./hello_file;hello
```
The t... | [
0.0169343501329422,
0.44265156984329224,
0.5951704382896423,
-0.3293019235134125,
-0.15989950299263,
0.09883764386177063,
0.2166939228773117,
-0.5010934472084045,
-0.2582368552684784,
-0.44568076729774475,
0.11121697723865509,
0.7103196382522583,
0.028547445312142372,
0.01636979728937149,
... | |
[1]
-bash: ./hello_file: Permission denied
Hello!
```
It gives one error, but it does not stop running the function. I cannot understand. I now unset the hello-function: "unset hello". I receive the errors:
```
-bash: ./hello_file: Permission denied
-bash: hello: command not found
```
Why did I not get them at th... | [
0.030263954773545265,
0.32617852091789246,
0.133086159825325,
-0.14419345557689667,
-0.04794548079371452,
-0.09320249408483505,
0.33321043848991394,
-0.3565159738063812,
-0.12380802631378174,
-0.503441572189331,
-0.05660006031394005,
0.762701153755188,
-0.35294902324676514,
0.1920666992664... | |
exist, they don't have permission. Once the file was sourced and the function defined, you can run it as much as you want.
---
Update:
> Why did I not get them at the first time? Has it something to do with cache, buffer or something like it?
Yes, like Pax answered, hello was probably previously defined there from ... | [
0.3873777389526367,
0.20812717080116272,
0.13631898164749146,
0.11849042028188705,
0.09382978081703186,
-0.2074999213218689,
0.40160661935806274,
0.07403914630413055,
-0.030665656551718712,
-0.6649245619773865,
-0.08611808717250824,
0.6803292036056519,
-0.19042667746543884,
0.3439398407936... | |
are defined in the current shell instance, and they stay there until you finish that shell session (or unset them).
> Why can I run the Bash script with 000 permissions [1]?
You can't. Note that it presents an error. Quoting your output:
```
$ . ./hello_file;hello [1]
-bas... | [
0.3880496323108673,
0.11522488296031952,
0.07070135325193405,
-0.24696607887744904,
0.01607583835721016,
-0.11086615175008774,
0.4638443887233734,
-0.5869665145874023,
-0.18628303706645966,
-0.6598038077354431,
-0.03119962103664875,
0.7043560147285461,
-0.32828259468078613,
-0.084920287132... | |
sourcing failed with "Permission denied". The "Hello!" output is from a previous sourcing of the file. You just proved it yourself when you unset it and tried the same command-line again.
You can't call that caching... it is how the shell works. You source another file, all its definitions are included in the current ... | [
0.08017061650753021,
0.38360247015953064,
0.008493201807141304,
-0.37621283531188965,
0.12243267148733139,
-0.10112734138965607,
0.2119591385126114,
-0.3206941783428192,
-0.06977573782205582,
-0.3945925831794739,
-0.039926059544086456,
0.7433644533157349,
-0.18576741218566895,
0.1541534662... | |
One of the things I'm working on right now has some similarities to a game. For purposes of illustration, I'm going to explain my problem using an example drawn from a fictitious, hypothetical game.
Let's call it *DeathBlaster 4: The Deathening*. In DB4, you have a number of `Ship` objects which periodically and rando... | [
-0.03904428705573082,
0.12646900117397308,
0.348451167345047,
0.2760222554206848,
-0.19308717548847198,
-0.28469452261924744,
-0.14074674248695374,
0.13609245419502258,
-0.6482820510864258,
-0.6289438605308533,
0.1738216131925583,
0.34652191400527954,
-0.12461506575345993,
0.41953808069229... | |
Phenomena
==========================================
Ships GravityWell BlackHole NebulaField
------------ ------------------------------------------
RedShip +20% speed -50% power -50% shield
BlueShip no effect invulnerable death | [
-0.049051154404878616,
0.100602887570858,
0.807891309261322,
0.3140316307544708,
-0.21681281924247742,
-0.08478448539972305,
-0.20213837921619415,
0.05973835662007332,
-0.35829082131385803,
-0.5950325727462769,
-0.31959807872772217,
0.5385425686836243,
-0.1529281586408615,
0.70311379432678... | |
Effects of Various
GreenShip -20% speed death +50% shield Phenomena on Ships
YellowShip death +50% power no effect
```
Additionally, `Effects` may interact with each other. For example, a `GreenShip` that is in both a `GravityWell` and a `NebulaField` may derive some kind... | [
0.021648725494742393,
-0.14946188032627106,
0.6021468639373779,
0.4591064155101776,
-0.14480169117450714,
0.025717703625559807,
-0.19616378843784332,
-0.16411273181438446,
-0.45127737522125244,
-0.6019099950790405,
-0.2923394441604614,
0.17838434875011444,
-0.04396127909421921,
0.228855207... | |
the synergistic effect is itself an `Effect` -- for example, there might be a `PowerLevelSynergyEffect` that results from this interaction. No information other than the set of `Effects` acting on a `Ship` is needed to resolve what the final result should be.
You may begin to see a problem emerging here. As a naive fi... | [
0.07230804115533829,
-0.07804498076438904,
0.6760498881340027,
0.3441585600376129,
-0.1732998490333557,
-0.15202021598815918,
-0.10458880662918091,
-0.2576756477355957,
-0.3941437602043152,
-0.5108081102371216,
-0.22956150770187378,
0.5862318873405457,
-0.30908408761024475,
0.3813746869564... | |
`Mediator` or `Visitor` of some sort.
But what's the best way to do that? The ideal solution will probably have these properties:
* It's just as easy to add a new `Ship` as it is to add a new `Phenomenon`.
* Interactions that produce no effect are the default and don't require additional code to represent. Convention... | [
-0.14023961126804352,
-0.11803282052278519,
0.9048395752906799,
0.432695597410202,
0.12936927378177643,
-0.03879031538963318,
-0.06287188827991486,
-0.12359341233968735,
-0.5717445015907288,
-0.7411573529243469,
-0.0895276889204979,
0.5652823448181152,
-0.10808800160884857,
0.0680773258209... | |
start? What avenues would you explore?
---
---
**Follow-up update:** Thanks for your responses, everybody. Here's what I wound up doing. My main observation was that the number of different `Effects` seems to be small relative to the number of possible `Phenomena` × `Ships` interactions. That is, although there are ... | [
0.448831707239151,
0.05082586407661438,
0.3532503843307495,
0.07025845348834991,
-0.2801559567451477,
0.3391991853713989,
-0.2409583181142807,
-0.3972107470035553,
-0.5518755316734314,
-0.6266883015632629,
-0.02933902107179165,
0.5923051238059998,
-0.09949600696563721,
0.110145203769207,
... | |
class, the `InteractionResolver`, to determine the result of interactions. It contains a dictionary that maps `Ship-Phenomenon` pairs to `Effects` (which are basically a delegate that performs the effect and some metadata). Each `Ship` is handed an `EffectStack` corresponding to the `Effects` it's experiencing when the... | [
-0.2585632801055908,
-0.11581309139728546,
0.5466016530990601,
0.5649746656417847,
-0.22209064662456512,
-0.04963192343711853,
-0.27415481209754944,
-0.2840748727321625,
-0.1873287856578827,
-0.41718828678131104,
-0.15356257557868958,
0.552656352519989,
0.1704225391149521,
0.10621482878923... | |
to resolve multiple and possibly complex effects is abstracted away by the `InteractionResolver`. Ships only have to apply the effects as necessary.
* This enables additional useful refactorings. For example, the *way* in which a ship processes effects could be differentiated by making an `EffectProcessorStrategy`. The... | [
-0.42640167474746704,
-0.2839694619178772,
0.5133957266807556,
0.019224470481276512,
-0.1804182231426239,
0.19696709513664246,
0.04639380797743797,
-0.36297330260276794,
-0.7029503583908081,
-0.4814631938934326,
-0.19735033810138702,
0.4131340980529785,
-0.21086175739765167,
-0.15050594508... | |
pattern using C# 3 features.
In particular, I would take a look at how they work with delegates to handle the visitor pattern. Using a list or stack of delegates could potentally give you an interesting way to handle multiple effects from multiple objects, and be much easier to extend either side of the class hierarch... | [
0.2068036049604416,
-0.2999918460845947,
0.2631033658981323,
0.2764570116996765,
-0.21997451782226562,
-0.33538857102394104,
0.056559596210718155,
-0.1488027721643448,
-0.8161622881889343,
-0.7925166487693787,
0.028431648388504982,
0.1450228989124298,
-0.35715121030807495,
-0.0187368374317... | |
I have been using unit testing for controllers with the 'poor man's' dependency injection technique. Each controller inherits from a base controller to query data for the master page. How do I unit test the controller with it inheriting from base controller without hitting the database?
```
public class HomeController... | [
-0.03232206031680107,
0.05019555613398552,
0.35310444235801697,
-0.05803101509809494,
0.06427626311779022,
-0.15698771178722382,
0.16420978307724,
-0.4824662208557129,
0.015232088044285774,
-0.958624005317688,
-0.08101194351911545,
0.33534717559814453,
-0.2937154173851013,
0.56251186132431... | |
requestContext)
{
MyDataContext db = new MyDataContext();
ViewData["masterPageData"] = db.GetSomeData();
base.Execute(requestContext);
}
}
```
Code would look something like this:
```
public class HomeController : BaseController
{
IUserRepository _userRepository;
public HomeC... | [
-0.30018848180770874,
0.05110180377960205,
0.57337886095047,
-0.15975990891456604,
-0.05975835770368576,
0.11573418229818344,
0.551296591758728,
-0.4843931496143341,
-0.09765572100877762,
-0.8170668482780457,
-0.42895323038101196,
0.3620325028896332,
-0.1791459023952484,
0.4100991785526275... | |
_userRepository = userRepository;
}
}
public class BaseController : Controller
{
ISomeRepository _someRepository;
public BaseController(ISomeRepository someRepository)
{
_someRepository = someRepository;
}
public BaseController()
{
_someRepository = new SomeRepository();
... | [
-0.3546788990497589,
-0.11538068950176239,
0.2793850600719452,
0.09343234449625015,
-0.03459779545664787,
0.06049151346087456,
0.37362951040267944,
-0.12348159402608871,
-0.21876175701618195,
-0.7526521682739258,
-0.26659318804740906,
0.266350120306015,
-0.23834474384784698,
0.587507128715... | |
= _someRepository.GetSomeData();
base.Execute(requestContext);
}
}
```
That said, if you use a DI framework, you would only need 1 constructor in each class. So you can see how it starts leaning towards using one :). | [
0.3270854651927948,
-0.2394794225692749,
-0.030636345967650414,
0.009359078481793404,
-0.07457946985960007,
-0.12196524441242218,
0.43375882506370544,
-0.30610015988349915,
-0.04979938268661499,
-0.5534816384315491,
-0.08610355854034424,
0.3664091229438782,
-0.35215577483177185,
0.31784969... | |
I have built the site: [www.bgarchitect.co.nz](http://www.bgarchitect.co.nz) which was as much a learning experience in jQuery and CSS/xHTML but is also a real project and as such should work in most browsers (IE6 is still a problem but IE7 should really not have an issue here).
Something that bugs me terribly is get... | [
0.523875892162323,
0.2884289622306824,
0.5272635221481323,
-0.378866583108902,
-0.17218580842018127,
-0.03655562922358513,
0.45442119240760803,
0.02718258649110794,
-0.08002088963985443,
-1.0063645839691162,
-0.02664598822593689,
0.4893433153629303,
-0.1691291332244873,
0.06305484473705292... | |
have used a few jQuery/java-scripts I'm afraid it may be something in there, but the scripts DO work as they should even though i get this error pop up.
Any suggestions, ideas or solutions are greatly appreciated.
Thanks for reading and taking an interest.
Jannis
You have an extra comma somewhere in your javascript.
... | [
0.21570934355258942,
-0.020860550925135612,
0.44588330388069153,
-0.06732723861932755,
0.01630929484963417,
0.3101389706134796,
0.06954960525035858,
-0.004168390762060881,
-0.41975438594818115,
-0.7092300653457642,
-0.1671619713306427,
0.3801414370536804,
-0.18539591133594513,
-0.231555670... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.