text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
I am writing an app which - similarly to many apps out there - is 90% regular CRUD things and 10% "juice", where we need nasty business logic and more flexibility and customization.
Regarding this 90%, I was trying to stick to the DRY principle as much as I can. As long as controllers go, I have found resource\_contro... | [
0.2888352870941162,
-0.05215086787939072,
0.58938068151474,
0.3399069309234619,
-0.05295005440711975,
0.07471783459186554,
0.09561929106712341,
0.18841958045959473,
0.07559888064861298,
-0.8973661661148071,
0.20145536959171295,
0.5766919255256653,
-0.09763564169406891,
0.09504394233226776,... | |
and then I must have another layout layer, common for all CRUD views and finally a "core" part:
* On index.html.erb all I need to generate a simple table with the fields and labels I indicate.
* For new and edit, also generic form edition, indicating labels and fields (with a possibility of providing custom fields if ... | [
0.45685648918151855,
0.25872206687927246,
0.4937642216682434,
0.1659281998872757,
-0.21164149045944214,
-0.3567952811717987,
-0.006014090497046709,
0.054949838668107986,
-0.135917529463768,
-0.9046175479888916,
0.11837433278560638,
0.5808336138725281,
0.0699191763997078,
-0.031199503690004... | |
try with `dojo.addOnLoad()`. Together, the last two `<script>` sections of your `<head>` would become:
```
<script>
dojo.addOnLoad(function(){
dojo.require("dojox.data.CsvStore");
dojo.require("dijit.Tree");
dojo.require("dojo.parser"); /* I don't think you really need this line */
var stat... | [
0.052009206265211105,
0.016647661104798317,
0.306022971868515,
-0.1998986303806305,
0.3034074306488037,
-0.18900804221630096,
0.4509516656398773,
-0.36294037103652954,
0.07143343985080719,
-0.6508945822715759,
-0.39745742082595825,
0.42467501759529114,
-0.30465269088745117,
-0.061413478106... | |
a guarantee that the rest of the javascript was loaded prior to executing the abstract function passed as parameter of `addOnLoad()`.
Because it's an issue of timing, your own original code may work sometimes, maybe not others: it would depend on the download speed and the order in which your browser pieces together t... | [
0.4006135165691376,
0.09718687832355499,
0.15933062136173248,
0.040515173226594925,
0.05643119290471077,
-0.4684445261955261,
0.39676210284233093,
-0.3394987881183624,
-0.17013266682624817,
-0.36780184507369995,
-0.20016570389270782,
0.7917988300323486,
-0.3073049783706665,
-0.346383959054... | |
case, you may want to put that `<script>` block immediately before the closing `</body>` tag... (That option would work on other browsers as well.) | [
0.24954651296138763,
-0.1961645781993866,
0.12398367375135422,
-0.15468575060367584,
0.07837783545255661,
-0.3351796567440033,
0.2980985641479492,
0.3574835956096649,
-0.13804544508457184,
-0.7875442504882812,
-0.5522372722625732,
0.30889418721199036,
-0.13592387735843658,
-0.1895588487386... | |
I am trying to go through the [following tutorial](http://www.asp.net/learn/mvc/tutorial-11-cs.aspx) on asp.net. When I get down to this code:
```
<%@ Page Language="C#" MasterPageFile="~/Views/Shared/Site.Master" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="MvcApplication1.Views.Home.Index" %>
<%@... | [
0.24077078700065613,
0.08234294503927231,
0.8604888319969177,
-0.3348918855190277,
0.3063734173774719,
0.061637796461582184,
0.37663108110427856,
-0.4688354432582855,
-0.0912703350186348,
-0.8146737217903137,
-0.3220425248146057,
0.5694358348846436,
0.05945004150271416,
0.10768017917871475... | |
in intellisense as if I am not including a reference or something. Also further down Html.Encode Html doesn't show in intellisense. What am I doing wrong?
I am using the latest version of MVC.
Try doing a Build on your MVC project. Until the code behind has been compiled for the first time the intellisense won't work. | [
0.2785174250602722,
-0.003972734324634075,
0.4236975312232971,
0.10284332931041718,
-0.31070399284362793,
-0.4584912955760956,
0.3377002775669098,
0.43409475684165955,
-0.07782004028558731,
-0.8607492446899414,
0.26792579889297485,
0.5566380023956299,
-0.3909441828727722,
0.029216606169939... | |
From an [SO answer](https://stackoverflow.com/questions/423823/whats-your-favorite-programmer-ignorance-pet-peeve#answer-424035)1 about Heap and Stack, it raised me a question: Why it is important to know where the variables are allocated?
At [another answer](https://stackoverflow.com/questions/79923/what-and-where-ar... | [
-0.04795221984386444,
-0.30138739943504333,
0.06185373291373253,
0.09983320534229279,
-0.16306684911251068,
-0.22103288769721985,
0.018155645579099655,
-0.21614056825637817,
-0.31442511081695557,
-0.5318734645843506,
-0.12186845391988754,
0.4398867189884186,
-0.10645722597837448,
-0.095700... | |
cost associated with garbage collecting the heap.
For instance, the JIT *could* notice that a newly created object was never used outside the current method (the reference could never escape elsewhere) and allocate it on the stack. It doesn't do that at the moment, but it would be a legal thing to do.
Likewise the C#... | [
0.35397064685821533,
0.05673195794224739,
-0.06705166399478912,
0.4191642701625824,
0.04795728996396065,
-0.12313003838062286,
0.1740485280752182,
-0.06541582196950912,
-0.06527909636497498,
-0.5930305123329163,
-0.09926997125148773,
0.4351923167705536,
-0.036923158913850784,
0.38509589433... | |
of behaviour.) | [
0.25840964913368225,
0.13382713496685028,
-0.22180932760238647,
-0.4287586808204651,
-0.06549056619405746,
0.3775360584259033,
0.8273312449455261,
-0.4818769097328186,
-0.1351935714483261,
-0.35008713603019714,
-0.1197686418890953,
0.8187082409858704,
-0.4067208766937256,
-0.02710258774459... | |
I am creating a reverse proxy and I am trying to find the optimal buffer for a response size for a chunked transfer-encoding. Currently I have it set at 4 kb. Is this number OK, or is there a better size that I should be using. I would like this backed up with some tests if at all possible.
I would also accept a prope... | [
0.034715842455625534,
0.03387303650379181,
0.4392445385456085,
-0.04948432371020317,
-0.07573559135198593,
0.2481878101825714,
-0.03769828751683235,
-0.07628767192363739,
-0.37204569578170776,
-0.6450667381286621,
0.09812823683023453,
0.24005502462387085,
-0.0956478863954544,
0.14552916586... | |
chunk size given the environment.
J2ME used to default to 2KB chunks (that's client-to-server). But I have no idea what .NET defaults to. Unfortunately the [HTTP Spec](http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.6.1) on chunking offers no guidance either. | [
-0.11139597743749619,
0.005127951968461275,
-0.03751750290393829,
-0.03015240468084812,
-0.48653846979141235,
-0.12492948025465012,
0.18506936728954315,
0.3350200951099396,
-0.3334811329841614,
-0.35998550057411194,
-0.2772504687309265,
0.12788042426109314,
-0.11845862120389938,
0.32229587... | |
I am playing with Google App Engine and Python and I cannot list the files of a static directory. Below is the code I currently use.
**app.yaml**
```
- url: /data
static_dir: data
```
**Python code to list the files**
```
myFiles = []
for root, dirs, files in os.walk(os.path.join(os.path.dirname(__file__), 'data... | [
0.33381199836730957,
0.2255023717880249,
0.7614919543266296,
-0.4018615186214447,
-0.05681168660521507,
-0.0824323296546936,
0.4604831635951996,
0.18225164711475372,
-0.39413025975227356,
-0.751148521900177,
-0.013347296044230461,
0.6795035004615784,
-0.33338022232055664,
-0.05611601099371... | |
files under the data directory. However, when I upload and run the exact same code in GAE, it doesn`t work. It seems to me that the directory structure of my application is not exactly replicated in Google App Engine. **Where are the static files?**
Thanks!
<https://developers.google.com/appengine/docs/python/config/... | [
0.15831561386585236,
0.14685122668743134,
0.5648307204246521,
-0.0898275226354599,
-0.3486260771751404,
0.004316431004554033,
0.25149163603782654,
0.12641453742980957,
-0.3651805520057678,
-0.49120262265205383,
-0.21257731318473816,
0.5598230957984924,
-0.5529801845550537,
0.28152471780776... | |
police this rule if you could manipulate your static file store. | [
0.34597048163414,
-0.2748938202857971,
0.16973592340946198,
0.3134191334247589,
0.10812832415103912,
-0.37112537026405334,
0.27330297231674194,
-0.22428198158740997,
-0.4905130863189697,
-0.2513391375541687,
0.17936266958713531,
0.2601044774055481,
-0.613307535648346,
-0.12498258054256439,... | |
I want customers to use their openId on my site. I googled for this but didn't find any good tutorial. I use PHP and MySQL.
There is one at Plaxo. But it says we should download something from JanRain.com.
I saw the openId module of Drupal. It doesn't want anything to be downloaded.
Can anyone tell me what to do exa... | [
0.5195264220237732,
0.08516089618206024,
0.18856605887413025,
0.14536386728286743,
-0.2825523316860199,
-0.1274840086698532,
0.3088909089565277,
0.2821524143218994,
-0.1670571267604828,
-0.8041648864746094,
0.12477347999811172,
0.3394272029399872,
0.05231780931353569,
0.2862696051597595,
... | |
I am using jQuery and JavaScript, I need to call the jQuery function inside my JavaScript code.
My jQuery code:
```
function display(id){
$.ajax({
type:'POST',
url: 'ajax.php',
data:'id='+id ,
success: function(data){
$("#response").html(data);
}//success
}... | [
0.08467801660299301,
0.24106360971927643,
0.5096907615661621,
-0.09137699007987976,
-0.3327292501926422,
0.11658506840467453,
-0.010746214538812637,
-0.19224974513053894,
-0.09727567434310913,
-0.7029188871383667,
0.3061234652996063,
0.7225780487060547,
0.10453348606824875,
-0.129903078079... | |
?
}
```
My ajax.php file has:
```
<?php
session_start();
....
echo "$salary";
?>
```
My JavaScript function has:
```
my.js
function showName(){
var id = 12;
var a = display(id); //Here I need to call the jQuery function display().
}
```
How do I call the jQuery function inside JavaScript co... | [
0.14755187928676605,
0.16328586637973785,
0.3230012357234955,
-0.2988021969795227,
-0.48411571979522705,
-0.006267692893743515,
0.03748389706015587,
-0.28932875394821167,
-0.0526709109544754,
-0.541431725025177,
0.13456785678863525,
0.6120607256889343,
-0.23832955956459045,
-0.045437626540... | |
url: 'ajax.php',
data:'id='+id ,
success: anotherFunction; //Ajax response
});
}
```
Then in your my.js code:
```
display(2);
function anotherFunction(response){
// Here you do whatever you need to do with the response
$("#response").html(data);
}
```
Remember that display() will trigger your Aj... | [
-0.07526932656764984,
-0.1401088833808899,
0.3370629549026489,
-0.16007253527641296,
-0.32763269543647766,
-0.1751706749200821,
0.08018987625837326,
0.17014840245246887,
-0.282729834318161,
-0.7458475828170776,
-0.19837988913059235,
0.6110813617706299,
-0.0878940299153328,
-0.1259346157312... | |
Yesterday I made a simulation using Python. I had a few difficulties with **variables and debugging**.
Is there any software for Python, which provides a decent debugger?
Related question: [What is the best way to debug my Python code?](https://stackoverflow.com/questions/299704/what-is-the-best-way-to-debug-my-pytho... | [
-0.0889117568731308,
0.02806514874100685,
0.013769182376563549,
0.01216545607894659,
0.023702919483184814,
-0.2520841658115387,
0.31247955560684204,
-0.20285680890083313,
-0.3265039622783661,
-0.3307049572467804,
-0.08764129877090454,
0.6324437260627747,
-0.3228910267353058,
-0.02991766855... | |
import pprint
import inspect, pdb
startframe = startframe or sys.last_traceback
frames = inspect.getinnerframes(startframe)
frame = [tb for (tb, _, lineno, fname, _, _) in frames
if search in (lineno, fname)][0]
if trace:
pprint(frame.f_locals)
pdb.set_trace(frame)
... | [
-0.13431033492088318,
-0.18717128038406372,
0.5885891318321228,
-0.2340116649866104,
-0.06685520708560944,
0.1745544970035553,
0.010771097615361214,
-0.4298027753829956,
-0.27329981327056885,
-0.5819587707519531,
-0.14973506331443787,
0.4171719253063202,
-0.5896350741386414,
0.163018986582... | |
"<pyshell#62>", line 1, in <module>
screwyFunc()
File "<pyshell#55>", line 3, in screwyFunc
return 2/a
ZeroDivisionError: integer division or modulo by zero
>>> findlocals('screwyFunc')
{'a': 0}
``` | [
-0.23876090347766876,
-0.04751085117459297,
0.22813034057617188,
-0.03232473134994507,
0.29981666803359985,
0.31294021010398865,
-0.06947851181030273,
-0.06301285326480865,
-0.18509262800216675,
-0.013324319384992123,
-0.25440943241119385,
0.5066088438034058,
-0.47890329360961914,
0.192748... | |
My visual assist x didn't work after I installed visual c# 2008.
Is there any good add-ins like VAX?
The [Visual Studio 2008 Comparison Chart](http://msdn.microsoft.com/en-us/vstudio/aa700921.aspx) shows that the Express editions do not support addins.
You will have to purchase at least the Standard edition to use ad... | [
-0.15966570377349854,
0.01210414431989193,
0.5524566173553467,
-0.04160319268703461,
-0.36365410685539246,
0.1808113157749176,
0.32278549671173096,
0.10252632945775986,
-0.004625956527888775,
-0.4842577576637268,
0.044750552624464035,
0.8531985282897949,
-0.45122990012168884,
-0.2099068164... | |
I want a list of all the checked out files, by all users, in a project in TFS 2005.
All I can see now are *my* checked out files - in the pending changes window. I remember that in Source Safe there was such an option - is there one in TFS 2005?
The [October 2008 edition of the TFS Power Tools](http://msdn.microsoft.co... | [
0.3664907217025757,
-0.17766015231609344,
-0.06000049412250519,
-0.14369267225265503,
-0.06835653632879257,
-0.45896145701408386,
0.2271445244550705,
-0.24604663252830505,
-0.32576045393943787,
-0.555172324180603,
-0.11466612666845322,
0.6311850547790527,
-0.24227488040924072,
-0.351625472... | |
On an ASP.NET MVC website, what's the best way to implement access logging? I want to answer the following questions:
1. What are the most popular pages?
2. Which pages were accessed in the last 24 hours?
3. etc.
I *could* log in to the server using Remote Desktop and poke through the IIS logs myself (even using Micr... | [
0.40072667598724365,
-0.12662248313426971,
0.6108208894729614,
0.2694529592990875,
-0.2718700170516968,
-0.3892107605934143,
0.4039618968963623,
-0.09877346456050873,
-0.5019451975822449,
-0.6277740597724915,
0.06751151382923126,
0.33888331055641174,
-0.27439388632774353,
-0.00709526194259... | |
Configure IIS (IIS7 on Windows 2008) to log to a table in my database, and then define an NHibernate mapping for this table?
4. Something else?
here is an alternate approach: <http://code-inside.de/blog-in/2008/04/17/aspnet-mvc-using-a-actionfilter-for-logging/> | [
-0.22080305218696594,
-0.31052377820014954,
0.5749069452285767,
-0.21804557740688324,
-0.22555702924728394,
-0.19502007961273193,
0.45284801721572876,
-0.35567742586135864,
-0.4983036518096924,
-0.46764838695526123,
-0.007390445563942194,
0.5482745170593262,
-0.5848665237426758,
-0.0635367... | |
It's been at least 5 years since I worked with Java, and back then, any time you wanted to allocate an object that needed cleaning up (e.g. sockets, DB handles), you had to remember to add a `finally` block and call the cleanup method in there.
By contrast, in C++ (or other languages where object lifetimes are determi... | [
0.15542232990264893,
-0.020527616143226624,
-0.08899134397506714,
-0.22365161776542664,
-0.16252462565898895,
-0.25825536251068115,
0.4504048824310303,
-0.06473740190267563,
-0.45832696557044983,
-0.6319041848182678,
-0.25354838371276855,
0.25432100892066956,
-0.20721964538097382,
0.414438... | |
the destructor gets called automatically, even if an exception is thrown. This approach goes by the fairly awful name of RAII -- "Resource Acquisition Is Initialisation".
It's been my experience that doing things "the RAII way" has saved me a lot of mental overhead in terms of not having to worry about whether and whe... | [
0.3277362287044525,
-0.2579804062843323,
0.03564126417040825,
-0.028628386557102203,
-0.34714794158935547,
-0.14228858053684235,
0.3666057586669922,
-0.10295339673757553,
0.025506215170025826,
-0.5934836864471436,
-0.46957430243492126,
0.9270921945571899,
-0.36112529039382935,
-0.057733148... | |
RAII" was rebuked [on this thread](https://stackoverflow.com/questions/457884/what-are-the-things-java-got-wrong#475089), but so far I haven't been able to find any details by googling.)
So if someone could point me to some introductory material on how to go about this in Java that would be great!
EDIT: The answer bel... | [
0.46751418709754944,
-0.19746942818164825,
0.09215264022350311,
-0.06214609742164612,
-0.1925162374973297,
-0.2544921934604645,
0.3395649492740631,
-0.33581164479255676,
-0.0029708517249673605,
-0.4002709686756134,
0.13035720586776733,
0.6529543995857239,
-0.2948763966560364,
-0.3555232882... | |
statement (which is syntactic sugar over try/finally) to Java, but I don't think that's going to be part of Java 7 any more. (Most of the language improvements seem to have been dropped.)
It's worth understanding that there are reasons why deterministic destruction hasn't been implemented in Java and .NET in the form ... | [
0.08606389164924622,
0.019422920420765877,
-0.08629628270864487,
-0.027354823425412178,
-0.5204443335533142,
-0.08642309159040451,
0.6602810621261597,
-0.011404776945710182,
-0.2674202024936676,
0.04528539255261421,
0.006919443141669035,
0.47419506311416626,
-0.3183285892009735,
0.14676481... | |
In Visual C++ , when I build a dll , the output files are .dll and .lib.
Is the name of the dll built into the .lib file .
The reasson I ask this question is : When I built my exe by importing this dll and run the exe , the exe tries to locate the dll to load it in the process address space .
As we just specify th... | [
0.22792118787765503,
0.11293591558933258,
0.23810726404190063,
-0.41428500413894653,
-0.15333938598632812,
-0.07815045863389969,
-0.009177695959806442,
0.07920379936695099,
-0.09287664294242859,
-0.6174817681312561,
-0.2729867994785309,
0.5382521152496338,
-0.6327847838401794,
0.0014462075... | |
and saw that it does not contain the name of the dll .
The LIB file is turned into an import table in the EXE. This *does* contain the name of the DLL.
You can see this if you run `dumpbin /all MyDLL.lib`. Note that `dumpbin MyDll.lib` by itself doesn't show anything useful: you should use `/all`.
This shows all of t... | [
0.19394032657146454,
0.01991242542862892,
0.1072789654135704,
-0.1550469547510147,
-0.2863403558731079,
-0.1282067596912384,
-0.021422600373625755,
0.0008165817707777023,
-0.047588977962732315,
-0.5812243223190308,
-0.026347404345870018,
0.34160447120666504,
-0.6292903423309326,
0.42736759... | |
LIB file contains a `.idata$4` section which defines the symbols to be put in the EXE's import table, including the DLL name:
```
Archive member name at 83E: MyDll.dll/
497C3B9F time/date Sun Jan 25 10:14:55 2009
uid
gid
0 mode
2E size
correct header end
Version : 0
Machi... | [
-0.37476804852485657,
0.21190723776817322,
0.5745217800140381,
-0.4929737448692322,
-0.0454241968691349,
-0.0984460860490799,
0.2828555107116699,
-0.04822736978530884,
0.0824524536728859,
-0.6718910932540894,
-0.2714132070541382,
0.5159941911697388,
-0.749398410320282,
0.0697987899184227,
... | |
2009
SizeOfData : 0000001A
DLL name : MyDll.dll
Symbol name : ?fnMyDll@@YAHXZ (int __cdecl fnMyDll(void))
Type : code
Name type : name
Hint : 2
Name : ?fnMyDll@@YAHXZ
``` | [
-0.43923720717430115,
-0.07893841713666916,
0.5987154245376587,
-0.12629593908786774,
-0.43391892313957214,
0.22139380872249603,
0.013416405767202377,
0.2076846808195114,
-0.19442322850227356,
-0.5786755084991455,
-0.02098546363413334,
0.13382123410701752,
-0.18692663311958313,
0.299590617... | |
```
int n = 5;
for(int i = 0;i!=n;i++)//condition !=
{
//executing 5times
}
int n = 5;
for(int i = 0;i<n;i++)//condition <
{
//executing 5times
}
```
Which one is preferred?
> This was example from "Accelerated C++
> : practical programming by example /
> Andrew Koenig, Barbara E. Moo." Just
> wanted to know wh... | [
0.1738239824771881,
0.09167782217264175,
-0.07582621276378632,
-0.11417532712221146,
-0.17368543148040771,
-0.15939779579639435,
0.2517276704311371,
-0.5145267248153687,
-0.25007420778274536,
-0.4671657383441925,
0.023717915639281273,
0.4687829911708832,
-0.43083640933036804,
-0.0436983294... | |
the < will be instantly understood.
2. The != depends on an exact condition. If the interior of the loop is modified during maintenance and i accidentally incremented inside the loop then you would end up with an infinite loop. Generally it's always better to make your termination condition as wide as possible - it's s... | [
0.40599846839904785,
-0.3147967755794525,
0.25168219208717346,
-0.09149028360843658,
-0.013632677495479584,
-0.3672286868095398,
0.5098577737808228,
-0.39712122082710266,
0.005390222650021315,
-0.42332392930984497,
-0.12212405353784561,
0.5862205028533936,
-0.4407307803630829,
0.3478624522... | |
How do I iterate between 0 and 1 by a step of 0.1?
This says that the step argument cannot be zero:
```
for i in range(0, 1, 0.1):
print(i)
```
Rather than using a decimal step directly, it's much safer to express this in terms of how many points you want. Otherwise, floating-point rounding error is likely to gi... | [
-0.05770401284098625,
0.010086867958307266,
0.4033788740634918,
-0.11592879146337509,
0.0910097137093544,
0.0897279679775238,
-0.13369448482990265,
-0.5915191173553467,
0.0567379929125309,
-0.3001590073108673,
0.1001436784863472,
0.4092758893966675,
0.06603582203388214,
0.04400178045034408... | |
the right endpoint:
```
>>> np.linspace(0,1,11)
array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1. ])
>>> np.linspace(0,1,10,endpoint=False)
array([ 0. , 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9])
```
If you really want to use a floating-point step value, use `numpy.arange`:
```
>>> ... | [
-0.6720447540283203,
0.11459770053625107,
0.748072624206543,
-0.05760549381375313,
0.09858383238315582,
0.4105430841445923,
-0.1977439820766449,
-0.5669940710067749,
-0.1730041801929474,
-0.32230064272880554,
-0.14230071008205414,
0.3201320469379425,
-0.10759665817022324,
-0.27861100435256... | |
`arange` to produce a length-4 array when it should only produce 3 numbers:
```
>>> numpy.arange(1, 1.3, 0.1)
array([1. , 1.1, 1.2, 1.3])
``` | [
-0.21650663018226624,
0.2564658522605896,
0.06554387509822845,
-0.23492306470870972,
-0.15360073745250702,
0.4569462239742279,
0.3114300072193146,
-0.47836899757385254,
-0.13674339652061462,
-0.3465085029602051,
-0.2197423279285431,
0.3966253995895386,
-0.5485055446624756,
0.15480819344520... | |
What does it take for online documentation to be helpful and interesting to read?
**Disclamer:**
While this question has selfish origins (I'm writing documentation, and, naturally, want it to be *the* best one out there), I'm sure other people can take avantage of the answers. Additionally, while documentation isn't ... | [
0.42194876074790955,
0.15271495282649994,
0.21636922657489777,
0.07162098586559296,
-0.13958409428596497,
-0.22641775012016296,
0.044427309185266495,
-0.21562959253787994,
-0.05702851340174675,
-0.4478391706943512,
0.18109501898288727,
0.4322308599948883,
0.13068285584449768,
-0.0002417196... | |
called WhizBangDaemon which you know pretty much nothing about, and you have decided to try and learn it on your spare time. What kind of sections should there be, for the documentation to be helpful and interesting enough and to keep you reading it?
Please feel free to provide links to good existing examples, and exp... | [
0.9239195585250854,
0.03226088732481003,
-0.14091551303863525,
0.5429732203483582,
-0.18680742383003235,
-0.46218618750572205,
0.2452051043510437,
0.15035200119018555,
-0.3352700173854828,
-0.2364048808813095,
0.24468880891799927,
0.46521326899528503,
-0.03621843829751015,
-0.0102046886458... | |
parts (could be related to the first point)**
* **concise and to the point**
* **search facilities**
* **#anchors for linking**
* **downloadable format available**
Many successful open source projects demonstrate how good online documentation can look like.
Some aspects are:
* Up to date. If the documentation is
not ... | [
0.3402477502822876,
0.0047539914958179,
0.15423713624477386,
0.4089970886707306,
0.031135933473706245,
-0.11690615862607956,
0.1934663951396942,
0.04110058397054672,
-0.40859395265579224,
-0.6083618402481079,
-0.5113496780395508,
0.3301256000995636,
0.5086461901664734,
0.13034774363040924,... | |
question over and over again. Be
aware what the users may ask for and
what they already have asked for.
* For the interested users, provide
some in detailed information in a *core documentation*.
* Also consider to think about the
audience of the documentation. As an
author of documentation, I think it’s
very useful to... | [
0.688967764377594,
0.4025431275367737,
0.0751059427857399,
0.3100340962409973,
0.023980092257261276,
0.06539188325405121,
0.17901355028152466,
0.0010902649955824018,
-0.2095939815044403,
-0.7137922644615173,
0.037816449999809265,
0.6945592164993286,
0.3417683243751526,
0.21953637897968292,... | |
HowTos and FAQs and that would spice up the documentation. When the software evolves, you can *refactor* the core documentation to a more readability.
The most hard part is to keep the documentation up to date. Write the documentation with future changes in mind. | [
0.5964252948760986,
0.17792126536369324,
0.23100517690181732,
0.25788047909736633,
0.2661904990673065,
-0.4492338001728058,
0.1817024052143097,
-0.10369938611984253,
-0.052729181945323944,
-0.8454157710075378,
-0.17241336405277252,
0.7670115232467651,
0.1699594408273697,
-0.108071677386760... | |
I have an asp.net mvc application and i am trying to assign value to my textbox dynamically, but it seems to be not working (I am only testing on IE right now). This is what I have right now..
`document.getElementsByName('Tue').Value = tue;` (by the way tue is a variable)
I have also tried this variation but it didnt... | [
0.47027787566185,
0.06819577515125275,
0.31577447056770325,
-0.2297186702489853,
-0.002038406440988183,
-0.2959039509296417,
0.39520975947380066,
-0.04143725335597992,
-0.1577138900756836,
-0.6637914180755615,
0.0188557468354702,
0.5303213000297546,
-0.28941354155540466,
0.4790361225605011... | |
Im looking for an algorithm to be used in a racing game Im making. The map/level/track is randomly generated so I need to find two locations, start and goal, that makes use of the most of the map.
* The algorithm is to work inside a two dimensional space
* From each point, one can only traverse to the next point in fo... | [
0.08805880695581436,
-0.2146945595741272,
0.28820815682411194,
0.16688786447048187,
0.2035137116909027,
0.2612880766391754,
0.17906592786312103,
-0.2571476697921753,
0.006986154709011316,
-0.7363666296005249,
0.3234933614730835,
0.14102864265441895,
-0.33886653184890747,
-0.153442472219467... | |
between A and B should be longer if there is a wall (or other blocking area) between them.
Im unsure on where to start, comments are very welcome and proposed solutions are preferred in pseudo code.
**Edit:** Right. After looking through [gs's code](https://stackoverflow.com/questions/477591/algorithm-to-find-two-poi... | [
-0.010235934518277645,
0.04982989281415939,
0.4934816360473633,
-0.4312840700149536,
-0.32436618208885193,
0.22001677751541138,
0.15455782413482666,
-0.1115218997001648,
-0.3168209493160248,
-0.3756299912929535,
0.028768567368388176,
0.3444610834121704,
-0.3263222277164459,
-0.257737696170... | |
The only interesting lines (I guess) is the Dijkstra variant itself on lines 78-118.
But speed is not the main issue here. I would really appreciate the help if someone would be kind enough to point out the differences in the algorithms.
* In Hosam Alys algorithm, is the only difference that he scans from the borders... | [
0.0389290377497673,
-0.3517894446849823,
0.40553852915763855,
0.2555592358112335,
-0.1331995278596878,
0.04040796309709549,
0.1597861796617508,
0.11209185421466827,
-0.5561146140098572,
-0.9984609484672546,
0.08405593782663345,
-0.18828490376472473,
-0.16843004524707794,
-0.067946441471576... | |
the starting point:
```
bestSolution = { start: (0,0), end: (0,0), distance: 0 };
for each point p on the border
flood-fill all points in the map to find the most distant point
if newDistance > bestSolution.distance
bestSolution = { p, distantP, newDistance }
end if
end loop
```
I guess this woul... | [
-0.20317091047763824,
-0.22747769951820374,
1.2519428730010986,
0.06346273422241211,
0.2803269922733307,
0.006456405855715275,
0.12275991588830948,
-0.2451234608888626,
-0.20585986971855164,
-0.7506051659584045,
-0.2566806674003601,
0.10760320723056793,
0.1324956715106964,
0.35561892390251... | |
points over the perimeter, `(L*W)` is the number of points, and `4` is the assumption that flood-fill would access a point a maximum of 4 times (from all directions). Since `n` is equivalent to the number of points, this is equivalent to `(L + W) * 8 * n`, which should be better than `O(n`2`)`. (If the map is square, t... | [
-0.21502237021923065,
-0.09854023903608322,
0.6548101902008057,
-0.07598885893821716,
0.03463352844119072,
0.17005902528762817,
0.4374624490737915,
-0.37172576785087585,
-0.4214151203632355,
-0.6622486710548401,
-0.1022050678730011,
0.22951851785182953,
-0.21529430150985718,
0.226512029767... | |
map (as opposed to points on the border only). This should be in order of `O(4n`2`)`, which is still better than both F-W and Dijkstra's.
*Note:* [Flood filling](http://en.wikipedia.org/wiki/Flood_fill) is more suitable for this problem, since all vertices are directly connected through only 4 borders. A breadth first... | [
-0.34949126839637756,
-0.13437186181545258,
0.6106817722320557,
-0.12423642724752426,
0.08081840723752975,
-0.02830592915415764,
0.3723781704902649,
-0.17140595614910126,
-0.6030147075653076,
-1.1605730056762695,
-0.16932404041290283,
0.16208377480506897,
-0.1367829293012619,
0.08543296903... | |
thanks to @Georg for [his review](https://stackoverflow.com/questions/477591/algorithm-to-find-two-points-furthest-away-from-each-other#478076).
P.S. Any comments or corrections are welcome. | [
-0.26467835903167725,
0.1087203398346901,
0.4223056435585022,
0.4309615194797516,
-0.01376800611615181,
-0.3436868488788605,
0.1452678143978119,
0.2861100435256958,
-0.48974189162254333,
-0.27489805221557617,
-0.2746925950050354,
-0.2625004053115845,
0.14491136372089386,
0.2959013283252716... | |
I am working with asp.net website project that some of pages need authentication. I am using asp.net membership.
I read some answers. e.g. make all of those pages in folder and create inner web.config that describe the privilege. This is one way solve the problem but I need way that is more fixable and effective.
If ... | [
0.2998932898044586,
0.07197780907154083,
0.29053282737731934,
0.20074209570884705,
-0.14182254672050476,
-0.45404210686683655,
0.10428418964147568,
-0.1372966468334198,
-0.1738077849149704,
-0.762260377407074,
0.1633850485086441,
0.3131209909915924,
-0.16024360060691833,
0.1143509894609451... | |
must be in role x", and if the user isn't in that role, redirect to the login page (you can get this by calling [FormsAuthentication.LoginUrl](http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication.loginurl.aspx)).
Your actual pages should inherit from this class rather than from System.Web.UI... | [
-0.10082598030567169,
-0.18343587219715118,
0.7744458913803101,
0.13848146796226501,
0.03152414411306381,
-0.19090604782104492,
0.21034139394760132,
-0.19336283206939697,
0.006549439858645201,
-0.8026112914085388,
-0.5182346701622009,
0.2333758920431137,
-0.14731094241142273,
0.01986601203... | |
database table, check the users role/authentication against the requirements and redirect as required.
---
Note that you can create page level security in the web config like so:
```
<configuration>
<location path="LockedPage.aspx">
<system.web>
<authorization>
<!-- Deny access to anonymous users... | [
-0.2097281962633133,
0.16135679185390472,
0.4205394983291626,
0.2815636098384857,
0.25783878564834595,
-0.21763284504413605,
0.06025851145386696,
0.009587260894477367,
-0.23547716438770294,
-0.9496133923530579,
-0.2220461070537567,
0.3329487144947052,
-0.1963074803352356,
0.282191544771194... | |
Is it somehow possible on Swing to set a TitledBorder transparent so that a background image shines through?
Found the answer.
Use the method
```
setOpaque(false)
```
on the underlying panel. | [
0.7309497594833374,
-0.19845524430274963,
0.48273882269859314,
0.349958211183548,
-0.06328118592500687,
-0.21711453795433044,
-0.05049487575888634,
-0.2969629764556885,
-0.036059048026800156,
-0.3972804546356201,
0.009476164355874062,
0.7004855871200562,
-0.026749175041913986,
-0.286512881... | |
I'm using jQuery and I want to check the existence of an element in my page. I have written following code, but it's not working:
```
if($("#btext" + i) != null) {
//alert($("#btext" + i).text());
$("#btext" + i).text("Branch " + i);
}
```
How do I check the existence of the element?
Check the [jQuery FAQ](h... | [
0.20996232330799103,
0.10066210478544235,
0.33065924048423767,
-0.0847541019320488,
0.004754967056214809,
-0.24766121804714203,
0.3300495743751526,
-0.16889843344688416,
-0.18710726499557495,
-0.4452034831047058,
-0.10559859871864319,
0.42146843671798706,
-0.23741210997104645,
-0.005716764... | |
In a software system a one-to-one relationship must be modeled between two objects where an active status exists for the relationship.
In other words, ObjectA has a one-to-one relationship to ObjectB (without a back pointer) where the relationship can be either active or inactive. There might also be additional attri... | [
-0.017314597964286804,
-0.23552048206329346,
0.08546000719070435,
0.240169957280159,
0.09307662397623062,
-0.09305711090564728,
0.28881606459617615,
0.18843390047550201,
-0.18730413913726807,
-0.5242144465446472,
-0.10118293017148972,
0.6119611263275146,
-0.5076990723609924,
0.030040476471... | |
would want to model more than just a reference.
The a containing instance of b will work in simple situations, where the relationship is not part of the behavior of the system, but just a technical implementation.
If you want to activate/deactivate/activate (without knowing/remembering the objectB activated), the "nul... | [
-0.1808083951473236,
-0.1158522218465805,
-0.06957688182592392,
0.36570656299591064,
0.1605045050382614,
0.16351208090782166,
0.13624203205108643,
-0.32446256279945374,
-0.1551075428724289,
-0.5746064186096191,
-0.08212777227163315,
0.40883108973503113,
-0.5885173678398132,
0.0918416827917... | |
class citizen of the model.
You could then do something like this (but this could be complete overkill, and just to show a modelling of relationships as part of your domain):
[](https://i.stack.imgur.com/Au4hn.jpg)
(source: [googlecode.com](http://agilesquadblog.goog... | [
-0.13453757762908936,
-0.3120356500148773,
0.23511339724063873,
-0.09188690036535263,
-0.17543497681617737,
-0.12049595266580582,
0.2374488264322281,
-0.3610564172267914,
-0.20229753851890564,
-0.5994526743888855,
-0.16189399361610413,
0.45882758498191833,
-0.8149356245994568,
0.2796945571... | |
void Deactivate();
bool IsActive { get; }
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ActivatableRelationshipExample
{
public interface IRelationShip<TSource,TDestination> : IActivatable
{
TDestination Destination { get; }
TSo... | [
-0.04892196133732796,
0.03691194951534271,
0.5890860557556152,
-0.08445800095796585,
-0.16767758131027222,
0.2833872139453888,
0.2596409320831299,
-0.38001808524131775,
-0.1898588091135025,
-0.3874960243701935,
-0.22342853248119354,
0.4974351227283478,
-0.5460016131401062,
0.54291158914566... | |
// and fill it with an ObjectBProxy instance
// in the constructor. thought this would
// explain the example a bit better
private readonly ObjectBProxy proxy;
public ObjectA(ObjectB b)
{
proxy = new ObjectBProxy(b);
} | [
0.07752397656440735,
0.07077836245298386,
0.2956259846687317,
-0.2739146053791046,
0.01901080831885338,
0.028971467167139053,
0.278687983751297,
-0.09205306321382523,
-0.07604394853115082,
-0.6855159997940063,
-0.11003278195858002,
0.21817076206207275,
-0.5697165131568909,
0.43038690090179... | |
public void AMethodUsingB()
{
proxy.BMethod();
}
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ActivatableRelationshipExample
{
public class ObjectB
{
public virtual void BMethod()
{
}
}
}
using... | [
0.2894608974456787,
0.5425875782966614,
0.18234597146511078,
-0.17749682068824768,
0.09683212637901306,
0.21985505521297455,
0.3823290467262268,
-0.33081769943237305,
0.014541315846145153,
-0.39365795254707336,
-0.3537074625492096,
0.4366702437400818,
-0.5916444659233093,
0.566332399845123... | |
{
private readonly UniDirectionalRelationship<ObjectB> relation;
public ObjectBProxy(ObjectB to)
{
this.relation = new UniDirectionalRelationship<ObjectB>(to);
}
public override void BMethod()
{
if (relation.IsActive)
{ | [
0.2674463391304016,
-0.1311483085155487,
0.4720030128955841,
-0.38168081641197205,
0.3881189525127411,
-0.10314350575208664,
0.3387722074985504,
-0.4125559628009796,
0.13192059099674225,
-0.3632107377052307,
-0.5475311279296875,
0.5786692500114441,
-0.5905938744544983,
0.4281651973724365,
... | |
relation.Destination.BMethod();
} else
{
// do some specific logic here
}
}
public void Activate()
{ | [
-0.09403937309980392,
-0.3752634525299072,
0.057150863111019135,
-0.1873643696308136,
0.2668457329273224,
-0.19969208538532257,
0.268189936876297,
-0.1384393721818924,
-0.2076811045408249,
-0.21868398785591125,
-0.44777432084083557,
0.6027554869651794,
-0.508026659488678,
0.208411693572998... | |
relation.Activate();
}
public void Deactivate()
{
relation.Deactivate();
}
public bool IsActive
{
get { return relation.IsActive; }
} | [
0.011093600653111935,
-0.39331674575805664,
0.38535863161087036,
-0.467372864484787,
0.07503298670053482,
-0.08207471668720245,
0.5358791947364807,
-0.2348712831735611,
-0.06780053675174713,
-0.2527051270008087,
-0.6656200885772705,
0.8455616235733032,
-0.6002362966537476,
-0.0031262396369... | |
}
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ActivatableRelationshipExample
{
public class RelationshipNotActiveException : Exception
{
public RelationshipNotActiveException(string message) : base(message)
{
}
public Relat... | [
-0.12631548941135406,
-0.08453508466482162,
0.45541951060295105,
-0.037805404514074326,
-0.33393996953964233,
0.37227126955986023,
0.1803576797246933,
-0.43821460008621216,
-0.2581704556941986,
-0.25556764006614685,
-0.15379881858825684,
0.6711123585700989,
-0.4868085980415344,
0.240566208... | |
{
private bool active = true;
private readonly TDestination destination;
public UniDirectionalRelationship(TDestination destination)
{
if(destination == null)
{
throw new ArgumentNullException("destination","destination cannot be null"); | [
-0.21957452595233917,
-0.3691259026527405,
0.42297297716140747,
-0.1827770471572876,
0.1121813952922821,
0.14031286537647247,
0.632716178894043,
-0.2668554484844208,
0.08425551652908325,
-0.27221277356147766,
-0.3916154205799103,
0.6426998376846313,
-0.3769063353538513,
0.308918833732605,
... | |
}
this.destination = destination;
}
public void Activate()
{
active = true;
}
public void Deactivate()
{
active = false; | [
-0.02929936908185482,
-0.3342573046684265,
0.30865389108657837,
-0.37439680099487305,
0.5694760680198669,
-0.30548223853111267,
0.6218952536582947,
0.03655342385172844,
-0.14791907370090485,
-0.3160635828971863,
-0.7322341203689575,
0.6064237952232361,
-0.5891628861427307,
0.23285189270973... | |
}
public virtual bool IsActive
{
get { return active; }
}
public virtual TDestination Destination
{
get
{ | [
-0.01986631751060486,
-0.6827890276908875,
0.22905246913433075,
0.05160737782716751,
0.04657403752207756,
-0.0036479425616562366,
0.46533605456352234,
0.2563496530056,
0.1337188333272934,
-0.36534538865089417,
-0.39121556282043457,
0.8210493922233582,
-0.2223692536354065,
0.026472663506865... | |
if (active)
{
return destination;
}
throw new RelationshipNotActiveException("the relationship is not active");
} | [
-0.24427232146263123,
-0.4152810573577881,
0.3523804247379303,
-0.3208674192428589,
0.1839977502822876,
-0.06355241686105728,
0.3554680347442627,
0.019098926335573196,
-0.06535777449607849,
-0.2817133069038391,
-0.20863229036331177,
0.5920696258544922,
-0.3666283190250397,
0.23932111263275... | |
}
public virtual object Source
{
get { throw new NotSupportedException("Source is not supported"); }
}
}
}
``` | [
0.0009993478888645768,
-0.0827755257487297,
0.10215160250663757,
0.09838911890983582,
0.17977921664714813,
-0.2937324643135071,
0.2747304141521454,
0.24430501461029053,
0.18513841927051544,
-0.6466476917266846,
-0.4031505882740021,
0.7781249284744263,
-0.2772943377494812,
0.190302148461341... | |
While trying to deploy a simple asp.net mvc project on an IIS 6 server, I keep getting this error "**The provider requires SessionState to be enabled**".
To rule out that I am doing something wrong, I am now trying to deploy just the template you get when you start a new asp.net mvc solution in vs2008. And yes, I have... | [
0.24430274963378906,
-0.021980538964271545,
0.4263972043991089,
-0.14832381904125214,
-0.07625485956668854,
-0.36133214831352234,
0.8209404945373535,
-0.03572588041424751,
-0.41597819328308105,
-0.9369063377380371,
-0.07974044233560562,
0.6450360417366028,
-0.3389906883239746,
0.2502458989... | |
overlooking something obvious ?
Not really an answer, but what I did was to add a new site to IIS, and let that run on port 81. It's for internal test / demo purpose, so that's not much of a problem.
Then I set up a virtual directory as you can read from many guides out there, setup wildcard isapi rule to the .net 3.5... | [
0.21023811399936676,
0.07580327987670898,
0.17457851767539978,
-0.07402251660823822,
0.00676289526745677,
-0.29436832666397095,
0.3561287820339203,
-0.020543981343507767,
-0.2766684591770172,
-0.6490920186042786,
0.3350585103034973,
0.7388371825218201,
-0.20616687834262848,
-0.001777904690... | |
the default website in IIS 6, something must be going wrong, but can't tell you what...
And thanks Chad for trying to help me ! | [
0.20859037339687347,
-0.06914753466844559,
0.3893781304359436,
0.48277878761291504,
-0.014203587546944618,
-0.7608709931373596,
0.6676534414291382,
0.686185896396637,
-0.1092398464679718,
-0.6528536677360535,
0.0003174048906657845,
0.48879942297935486,
-0.06293170154094696,
0.1920923143625... | |
I have a request for a contracting gig and one of the requirements in the first draft of the specs says the software (a GUI application for end-users) should run on Win 2000 and Mac OS 7.5. I have no idea why they would want to support such ancient systems, but I guess it leaves me with Java as the only option other th... | [
0.6510106325149536,
0.3663730025291443,
0.15596279501914978,
-0.04058060050010681,
0.2746488153934479,
-0.1665959507226944,
-0.07488571107387543,
-0.0034553809091448784,
0.1734452098608017,
-0.4770447313785553,
0.04047665372490883,
0.8246602416038513,
0.0947161614894867,
-0.076974101364612... | |
making software run on both targets. Actually, supporing those ancient systems as well as modern ones might even be harder than supporting Mac and Win, right?
As another sideline, I'd also appreciate facts that could be used to talk the client out of this and make him go with OS X and XP. Like "hey, only 2% of all Mac... | [
0.7773771286010742,
0.20697440207004547,
0.040638502687215805,
0.15346340835094452,
-0.0024908275809139013,
-0.10708104819059372,
0.3567517399787903,
0.0988975539803505,
-0.03844517096877098,
-0.3133774697780609,
-0.01936706341803074,
0.8430325984954834,
-0.02814924158155918,
-0.0113597922... | |
uses OS 9 and I bet, there's people even more old-fashioned, so let's just play it safe and write down 7.5". There's no technical judgement whatsoever involved, and that's OK. It's just that, in those cases, you have to explain carefully what tradeoffs there are and if you succeed, it usually gets you much more realist... | [
0.46268659830093384,
0.36183401942253113,
0.4201068580150604,
0.2094983458518982,
0.2974388003349304,
-0.1187838762998581,
0.02515212632715702,
0.49701762199401855,
-0.11054027080535889,
-0.3092532455921173,
-0.011435850523412228,
1.2626254558563232,
-0.1887105405330658,
-0.450804620981216... | |
that would pay for all the crazy stuff and then yet some, and less experienced competitors won't see all the implications and put a lower number in their offer, get the gig and it all ends in tears for everybody. You can go "heh heh, told you so", but don't get the cash, either.
---
**Edit**: Thanks for still posting... | [
0.6846464276313782,
-0.12207700312137604,
0.3196253180503845,
0.2749928832054138,
0.022697903215885162,
-0.2553287446498871,
0.5171274542808533,
0.4351326823234558,
-0.09034561365842819,
-0.2638576626777649,
0.18073242902755737,
0.8652737736701965,
0.08832043409347534,
-0.3048384189605713,... | |
not *actually going to code for Mac OS 7.5* ... ;-) Really, really overseeing all the implications would be well out of my depth anyway.
It's up to 1.1.8 for all Mac OS Classic (not X) | [
0.6266508102416992,
-0.025762755423784256,
0.3193632960319519,
0.10317154973745346,
0.09098830819129944,
-0.4155429005622864,
0.7583304643630981,
0.3014909327030182,
-0.0894378200173378,
-0.48483672738075256,
-0.48458585143089294,
0.8932105302810669,
-0.2778918147087097,
-0.025382015854120... | |
I'm writing some documentation that will occasionally include C# or C++ code snippets.
In Visual Studio, the Edit/Copy command includes syntax coloring. You can see this if you paste the text into, e.g., Word or Outlook. In fact, if you use the "Paste Special..." command, you can see that it's "Rich Text (RTF)".
Howe... | [
0.714658260345459,
0.04359513148665428,
0.3126378059387207,
-0.08625668287277222,
0.04104384407401085,
-0.052365031093358994,
-0.13139300048351288,
0.24010100960731506,
-0.3148360252380371,
-1.0940001010894775,
-0.1109851524233818,
0.48675936460494995,
-0.24621149897575378,
-0.175590202212... | |
job. I've used it a few times, but I use a Javascript to do the highlighting on my blog these days (so it's "plaintext readable"). | [
0.3141665756702423,
-0.0281616672873497,
0.15559378266334534,
-0.19238309562206268,
0.11311212927103043,
0.02614336833357811,
-0.10911735147237778,
0.33301493525505066,
-0.22024030983448029,
-0.37922796607017517,
-0.07546234875917435,
0.690066933631897,
0.11484242230653763,
-0.440196990966... | |
I have the following code:
```
var tempIdx = document.getElementById('cityBuild').selectedIndex;
var tempBuilding = document.getElementById('cityBuild').options[tempIdx].value;
// Do stuff with tempBuilding
```
I spent some time trying to do it in jQuery under the assumption it'd be easier, it wasn't. I tried what ... | [
0.5206396579742432,
-0.04008353501558304,
0.36810925602912903,
0.04191836342215538,
-0.16723787784576416,
-0.05919894203543663,
0.2301141619682312,
-0.43887799978256226,
-0.1384747475385666,
-0.6966262459754944,
-0.09469246119260788,
0.37447425723075867,
-0.22573263943195343,
0.06817872077... | |
I created the following code to calculate the duration between two timestamps which can come in two different formats:
```
public class dummyTime {
public static void main(String[] args) {
try {
convertDuration("2008-01-01 01:00 pm - 01:56 pm");
convertDuration("2008-01-01 8:30 pm - 2008-01-02 09:3... | [
0.24155552685260773,
-0.340374231338501,
0.5347849726676941,
-0.2447875440120697,
-0.12448490411043167,
-0.08069030195474625,
0.2920280992984772,
-0.3046533465385437,
-0.06768648326396942,
-0.278195321559906,
0.024063341319561005,
0.34567520022392273,
-0.18236306309700012,
0.26428386569023... | |
= new SimpleDateFormat("HH:mm");
Date beg, end;
String duration = null;
beg = getDateTime(ts[0]);
end = getDateTime(ts[1], beg);
duration = formatNew.format(end.getTime() - beg.getTime());
System.out.println(duration + " /// " + time + " /// " + beg + " /// "
+ end);
return du... | [
0.1412598043680191,
-0.6775071620941162,
0.9211380481719971,
-0.47195425629615784,
0.038121677935123444,
0.2807309627532959,
0.35847556591033936,
-0.748906672000885,
-0.31358280777931213,
-0.5686624050140381,
-0.44754737615585327,
0.45178794860839844,
-0.4114213287830353,
0.441352874040603... | |
"yyyy-MM-dd hh:mm aa");
DateFormat formatOldTimeOnly = new SimpleDateFormat("hh:mm aa");
Date date = null;
try {
date = formatOldDateTime.parse(dateTime);
} catch (ParseException e) {
date = formatOldTimeOnly.parse(dateTime);
}
return date;
}
private static Date getDateTime(St... | [
-0.03697971627116203,
-0.3506752848625183,
0.8191509246826172,
-0.459212988615036,
0.2571682333946228,
0.11731338500976562,
0.170464888215065,
-0.2468966692686081,
-0.10416487604379654,
-0.33213478326797485,
-0.4924396574497223,
0.5433116555213928,
-0.3817127048969269,
0.3006036877632141,
... | |
end.setYear(orig.getYear());
end.setMonth(orig.getMonth());
end.setDate(orig.getDate());
}
return end;
}
}
```
The output it generates is:
```
01:56 /// 2008-01-01 01:00 pm - 01:56 pm /// Tue Jan 01 13:00:00 CET 2008 /// Tue Jan 01 13:56:00 CET 2008
14:00 /// 2008-01-01 8:30 pm - 2008-01-02 ... | [
0.01973138563334942,
0.00537061458453536,
0.6753244400024414,
-0.062319591641426086,
-0.16875553131103516,
-0.19550833106040955,
0.02672390639781952,
-0.45025989413261414,
0.09133470803499222,
-0.3782211244106293,
-0.23466992378234863,
0.520180344581604,
-0.16777141392230988,
-0.1753437370... | |
are
deprecated too.
Many many thanks, this issue has been driving me crazy for several hours.
1. At my computer this is off by 2 hours, because I'm at GMT+2, and you're probably at GMT+1. Note that `formatNew.format(end.getTime() - beg.getTime());` receives date, i.e. treats your 56 minutes as 1970-01-01-00:56:00 GMT+... | [
0.5163668394088745,
-0.02691008895635605,
0.9128090739250183,
-0.13546700775623322,
-0.0676301047205925,
-0.2672763168811798,
0.403245210647583,
0.04245901107788086,
-0.3584228456020355,
-0.5872167348861694,
-0.15961341559886932,
0.5235944390296936,
0.1335035115480423,
0.18588966131210327,... | |
I have a large array of vertices, some of them are edges, some are redundant (inside the shape) and I want to remove those.
The simplest algorithm I could think of is checking one by one if they hit the shape formed by the others. But it should be a very slow algorithm.
I thought about picking one from the edge (the ... | [
0.18547624349594116,
0.321621298789978,
-0.01621781848371029,
-0.080440454185009,
-0.08445385098457336,
0.28847745060920715,
0.1863030195236206,
-0.07420327514410019,
-0.3216497302055359,
-0.8306839466094971,
0.14946596324443817,
-0.037259820848703384,
-0.15942025184631348,
0.2685784995555... | |
more than one way to represent a polyhedron and converting between the representations can be expensive. In this case, you are starting with points and want to end with vertices, so the [Graham scan](http://en.wikipedia.org/wiki/Graham_scan) algorithm to compute the vertices of the [convex hull](http://en.wikipedia.org... | [
-0.11878512054681778,
0.11413102596998215,
0.28796619176864624,
0.04733247682452202,
-0.3943771719932556,
0.1983364075422287,
0.17770424485206604,
-0.34405529499053955,
-0.34605613350868225,
-0.779842734336853,
-0.2251606434583664,
-0.1064038872718811,
-0.28732824325561523,
0.0915759131312... | |
I'm trying to use `System.Xml.Linq` to create XHTML documents. Thus, the vast majority of the nodes in my trees ought to use this namespace:
```
http://www.w3.org/1999/xhtml
```
I can create `XElement` nodes scoped to this namespace easily enough, using an `XNamespace`, like this:
```
XNamespace xhtml = "http://www... | [
0.015134444460272789,
0.47211572527885437,
0.6192365884780884,
-0.16540423035621643,
-0.12801885604858398,
-0.22909152507781982,
-0.10371971875429153,
-0.06391419470310211,
-0.1611068844795227,
-0.5750656723976135,
-0.35374221205711365,
0.1943393349647522,
-0.39693623781204224,
0.190555587... | |
by descendants, using the reserved `xmlns` attribute. I'd like to do something similar using `System.Xml.Linq`.
Is this possible?
I've decided to use a static class called `XHtml`, that looks like this:
```
public static class XHtml
{
static XHtml()
{
Namespace = "http://www.w3.org/1999/xhtml";
}
... | [
0.16140998899936676,
0.033427245914936066,
0.5035250782966614,
0.13490615785121918,
0.0738205537199974,
0.12377738952636719,
-0.04731316491961479,
-0.19652323424816132,
-0.34603461623191833,
-0.4853440821170807,
-0.40300804376602173,
0.11535187065601349,
-0.285468727350235,
0.5007842183113... | |
XElement Element(string name, params object[] content)
{
return new XElement(Namespace + name, content);
}
public static XElement Element(string name, object content)
{
return new XElement(Namespace + name, content);
}
public static XAttribute Attribute(string name, object valu... | [
-0.05055787041783333,
0.030037114396691322,
0.5597682595252991,
-0.023307614028453827,
-0.2477152943611145,
0.3587311804294586,
0.1271926760673523,
-0.2766568660736084,
0.20704902708530426,
-0.43473896384239197,
-0.8945550918579102,
0.4840739667415619,
-0.47350990772247314,
0.2403939217329... | |
{
return new XText(text);
}
public static XElement A(string url, params object[] content)
{
XElement result = Element("a", content);
result.Add(Attribute("href", url));
return result;
}
}
```
This seems to be the cleanest way of doing things, particularly as I can then... | [
0.3041495680809021,
-0.016176583245396614,
0.3282301127910614,
-0.21820314228534698,
-0.13783539831638336,
-0.22469855844974518,
0.48829156160354614,
-0.22778256237506866,
0.0897543653845787,
-0.4953800439834595,
-0.6087088584899902,
0.38402852416038513,
-0.41822493076324463,
0.38559550046... | |
I checked out [both](https://stackoverflow.com/questions/361161/rails-form-validation) of [these](https://stackoverflow.com/questions/423160/rails-form-validation-conditional-bypass) previously-asked questions, and they're a help but not a full solution for my case.
Essentially I need to validate a user-submitted URL... | [
0.0838698074221611,
0.11370798945426941,
0.5200514793395996,
-0.09391863644123077,
-0.11842819303274155,
-0.33761122822761536,
0.1787436157464981,
-0.3806825578212738,
-0.11329658329486847,
-0.43092942237854004,
-0.2821210026741028,
0.3999612033367157,
0.034210726618766785,
-0.098581962287... | |
does not already start with http:// (say they enter google.com, for example), it should pass the validation but add the http:// prefix while being processed.
I'm having a hard time determining how to make this work cleanly and efficiently.
FYI, you don't have to pass an array to `validates_format_of`. Ruby will do arr... | [
0.23408056795597076,
0.19723540544509888,
0.478677362203598,
0.09081646054983139,
-0.3730165362358093,
-0.28304851055145264,
0.24466010928153992,
-0.3872769773006439,
-0.09392143785953522,
-0.577119767665863,
-0.04306688904762268,
0.4829411208629608,
-0.3287810981273651,
-0.129546463489532... | |
when nil, "", /^(http|https|ftp):\/\//
# Allow nil/blank. If it starts with http/https/ftp, pass it through also.
break
else
# Append http
self[attribute] = "http://#{self[attribute]}"
end
end
end
end
``` | [
-0.1263558715581894,
0.004884425085037947,
0.50197833776474,
-0.010183854959905148,
-0.009943848475813866,
-0.18449437618255615,
0.2531113028526306,
-0.01065212395042181,
-0.03598179668188095,
-0.7477699518203735,
-0.20149613916873932,
0.3422214090824127,
-0.1781412810087204,
0.41745007038... | |
Okay this is not a question of "how to get all uniques" or "How to remove duplicates from my array in php". This is a question about the time complexity.
I figured that the `array_unique` is somewhat O(n^2 - n) and here's my implementation:
```
function array_unique2($array)
{
$to_return = array();
$curren... | [
0.03528369963169098,
0.21050727367401123,
0.40379971265792847,
-0.13691005110740662,
0.15453565120697021,
-0.26793137192726135,
0.3290131092071533,
-0.32126811146736145,
-0.3264336585998535,
-0.3935505449771881,
0.2301715910434723,
0.5734276175498962,
-0.18211808800697327,
0.12200737744569... | |
= $i+1; $a < count($array); $a++ )
{
if ( $array[$i] == $array[$a] )
{
$current_is_unique = false;
break;
} | [
0.03650914877653122,
-0.2389206439256668,
0.1476002037525177,
-0.5007953643798828,
0.23793737590312958,
-0.12375251203775406,
0.32699546217918396,
-0.45248064398765564,
-0.20245161652565002,
0.1542203426361084,
-0.22541439533233643,
0.11152733117341995,
-0.47766438126564026,
0.498257398605... | |
}
if ( $current_is_unique )
{
$to_return[$current_index] = $array[$i];
}
}
return $to_return;
}
```
However when benchmarking this against the `array_unique` i got the following result:
Testing (array\_unique2)... Operation took 0.52146291732788 s.
Testing (array... | [
-0.1110152080655098,
-0.10785510390996933,
-0.07815923541784286,
-0.06601917743682861,
0.11247482150793076,
0.00967966578900814,
0.36223429441452026,
-0.5227879881858826,
-0.2360856831073761,
-0.33476826548576355,
0.40278592705726624,
0.5806944370269775,
-0.1071004793047905,
0.171735838055... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.