text stringlengths 0 30.5k | title stringclasses 1
value | embeddings listlengths 768 768 |
|---|---|---|
How do I use the profiler in Visual Studio 2008?
I know theres a build option in Config Properties -> Linker -> Advanced -> Profile (/PROFILE), however I can't find anything about actauly using it, only articles I was able to find appear to only apply to older versions of Visual Studio (eg most say to goto Build->Profile to bring up the profile dialog box, yet in 2008 there is no such menu item).
Is this because Visual Studio 2008 does not include a profiler, and if it does where is it and where is the documentation for it?
The profiler is only | [
0.0840090736746788,
0.04634801670908928,
0.491956889629364,
-0.1705361157655716,
-0.4711732566356659,
-0.19226166605949402,
0.1978747844696045,
-0.2578658163547516,
-0.08139538019895554,
-0.5955663919448853,
0.22740019857883453,
0.7231738567352295,
-0.2532392740249634,
-0.16414840519428253... | |
available in the Team System editions of Visual Studio 2008. The last version that I used that included a profiler was Visual C++ 6.0.
For Visual Studio 2005, you could try [Compuware DevPartner Performance Analysis Community Edition](http://www.compuware.com/media.asp?cid=701000000004ej0). | [
0.03512803092598915,
-0.3278477191925049,
0.17798711359500885,
0.032647859305143356,
-0.46232298016548157,
-0.02429920807480812,
0.29059314727783203,
0.12248087674379349,
-0.09992567449808121,
-0.6600040197372437,
0.23105530440807343,
0.6586494445800781,
-0.16582775115966797,
-0.3429126143... | |
I need to create a 2D int array of size 800x800. But doing so creates a stack overflow (ha ha).
I'm new to C++, so should I do something like a vector of vectors? And just encapsulate the 2d array into a class?
Specifically, this array is my zbuffer in a graphics program. I need to store a z value for every pixel on the screen (hence the large size of 800x800).
Thanks!
You need about 2.5 megs, so just using the heap should be fine. You don't need a vector unless you need to resize it. See [C++ FAQ Lite](https://isocpp.org/wiki/faq/freestore-mgmt#multidim-arrays) for an example | [
0.21478447318077087,
-0.0977877601981163,
0.3112318813800812,
0.099396713078022,
-0.22727172076702118,
0.1895911693572998,
0.07917977124452591,
-0.30504029989242554,
-0.35551658272743225,
-0.8274152278900146,
0.10239266604185104,
0.658301591873169,
-0.22284485399723053,
0.03050796687602996... | |
of using a "2D" heap array.
```
int *array = new int[800*800];
```
(Don't forget to `delete[]` it when you're done.) | [
-0.04079988971352577,
0.08958327025175095,
0.05677779018878937,
-0.23449084162712097,
0.11789274215698242,
-0.2123720496892929,
0.37303948402404785,
-0.4223708212375641,
-0.29310905933380127,
-0.6362940669059753,
-0.5853074789047241,
0.5581188201904297,
-0.36954036355018616,
-0.28089714050... | |
In Eclipse, I can switch through open editors using control-page up/down. This works great, except for editors like XML or JavaScript, where there are Design and Source tabs. For those editors, it just toggles between the different tabs. Is there any way to get Eclipse to ignore them? I know about alt-F6 for "Next Editor", but that doesn't use the same order that the editor tabs are displayed in, so it's confusing.
You're right -- looks like Eclipse has acknowledged it as a [bug](https://bugs.eclipse.org/bugs/show_bug.cgi?id=199499). It's fixed in 3.5. | [
0.24506834149360657,
0.20204125344753265,
0.5514295101165771,
-0.1575089544057846,
-0.3608737587928772,
-0.2913738787174225,
-0.03419388830661774,
0.1608544886112213,
-0.22585758566856384,
-0.8034113049507141,
-0.01857435703277588,
0.7598652839660645,
-0.4025513827800751,
-0.13852885365486... | |
Which of the following is better code in c# and why?
```
((DateTime)g[0]["MyUntypedDateField"]).ToShortDateString()
```
or
```
DateTime.Parse(g[0]["MyUntypedDateField"].ToString()).ToShortDateString()
```
Ultimately, is it better to cast or to parse?
If g[0]["MyUntypedDateField"] is really a DateTime object, then the cast is the better choice. If it's not really a DateTime, then you have no choice but to use the Parse (you would get an InvalidCastException if you tried to use the cast) | [
0.16389639675617218,
0.0677918866276741,
0.06259690225124359,
-0.18461677432060242,
0.03164312243461609,
0.08694490790367126,
0.09529295563697815,
-0.2568083703517914,
0.02744102105498314,
-0.3238867521286011,
-0.07079081982374191,
0.7097085118293762,
-0.5025444030761719,
-0.16602319478988... | |
How can I get PDO to work on my mac (os x 10.5)? I'm using the built in php and php in Zend/Eclipse. Can't seem to find useful drivers for it at all.
I had to install the PDO\_PGSQL driver recently on Leopard, and I ran across a multitude of problems. In my search for answers, I stumbled across this question. Now I have it successfully installed, and so, even though this question is quite old, I hope that what I've found can help others (like myself) who will undoubtedly run into similar problems.
The first thing you'll need to do is | [
0.12828104197978973,
0.11971038579940796,
0.3722236454486847,
0.0048738885670900345,
0.05535641685128212,
-0.06159399077296257,
0.42160269618034363,
0.3383483588695526,
-0.3140641152858734,
-0.739430844783783,
-0.0007612028857693076,
0.6426929831504822,
-0.26016944646835327,
-0.34253329038... | |
[install PEAR](http://pear.php.net/manual/en/installation.getting.php), if you haven't done so already, since it doesn't come installed on Leopard by default.
Once you do that, use the PECL installer to download the PDO\_PGSQL package:
```
$ pecl download pdo_pgsql
$ tar xzf PDO_PGSQL-1.0.2.tgz
```
(Note: you may have to run `pecl` as the superuser, i.e. `sudo pecl`.)
After that, since the PECL installer can't install the extension directly, you'll need to build and install it yourself:
```
$ cd PDO_PGSQL-1.0.2
$ phpize
$ ./configure --with-pdo-pgsql=/path/to/your/PostgreSQL/installation
$ make && sudo make install
```
If all goes well, you should have a file called "`pdo_pgsql.so`" sitting in a directory that should look something like "`/usr/lib/php/extensions/no-debug-non-zts-20060613/`" (the PECL installation should have | [
-0.018071109429001808,
-0.17905095219612122,
0.5125099420547485,
-0.15463539958000183,
0.003209414193406701,
-0.21694229543209076,
0.358796626329422,
0.07600830495357513,
-0.24453215301036835,
-0.2687598764896393,
-0.4612950384616852,
0.7636619210243225,
-0.36747223138809204,
-0.3653752207... | |
outputted the directory it installed the extension to).
To finalize the installation, you'll need to edit your `php.ini` file. Find the section labeled "Dynamic Extensions", and underneath the list of (probably commented out) extensions, add this line:
```
extension=pdo_pgsql.so
```
Now, assuming this is the first time you've installed PHP extensions, there are two additional steps you need to take in order to get this working. First, in `php.ini`, find the `extension_dir` directive (under "Paths and Directories"), and change it to the directory that the `pdo_pgsql.so` file was installed in. For example, my `extension_dir` directive looks like:
```
extension_dir = "/usr/lib/php/extensions/no-debug-non-zts-20060613"
```
The second step, if you're on a | [
-0.03762310743331909,
-0.14526401460170746,
0.6940380930900574,
-0.17411410808563232,
-0.03869421407580376,
-0.17517641186714172,
0.009803223423659801,
-0.013467356562614441,
-0.281884104013443,
-0.5769801139831543,
-0.11521826684474945,
0.5855017900466919,
-0.3661715090274811,
-0.07074843... | |
64-bit Intel Mac, involves making Apache run in 32-bit mode. (If there's a better strategy, I'd like to know, but for now, this is the best I could find.) In order to do this, edit the property list file located at `/System/Library/LaunchDaemons/org.apache.httpd.plist`. Find these two lines:
```
<key>ProgramArguments</key>
<array>
```
Under them, add these three lines:
```
<string>arch</string>
<string>-arch</string>
<string>i386</string>
```
Now, just restart Apache, and PDO\_PGSQL will be up and running. | [
-0.028161782771348953,
0.23079551756381989,
0.31323352456092834,
0.012631372548639774,
0.04811475798487663,
-0.29569485783576965,
0.3515641689300537,
0.06572148203849792,
0.14228802919387817,
-0.5061931610107422,
-0.4404791295528412,
0.7970588207244873,
-0.33247125148773193,
-0.32505121827... | |
I'm just curious if any project exists that attempts to group all (or most) of PHP's built-in functions into a more object-oriented class hierarchy. For example, grouping all the string functions into a single String class, etc.
I realize this won't actually solve any problems (unless the modifications took place at the PHP source code level), since all the built-in functions would still be accessible in the global namespace, but it would certainly make usability much easier.
To Answer your question, Yes there exists several of libraries that do exactly what you are talking about. As far as which one you want | [
0.3711920976638794,
0.11030057817697525,
-0.052556950598955154,
0.3407193124294281,
-0.2879999876022339,
-0.18543468415737152,
0.1849929541349411,
0.18831400573253632,
-0.360911101102829,
-0.27143824100494385,
0.2795248329639435,
0.34379929304122925,
-0.3232641816139221,
0.1441182494163513... | |
to use is an entirely different question. PHPClasses and pear.org are good places to start looking for such libraries.
Update:
As the others have suggested SPL is a good library and wraps many of built in php functions. However there still are lots of php functions that it does not wrap. Leaving us still without a silver bullet.
In using frameworks such as Cakephp and Zend (others too), I have noticed that they attempt to solve some of these problems by including their own libraries and building basics such as DB connectivity into the frame work. So frameworks may be another solution | [
0.5769379734992981,
0.04860351234674454,
0.008528047241270542,
0.3802088499069214,
-0.4083823263645172,
-0.4265193045139313,
0.5133165121078491,
-0.32178831100463867,
-0.38141608238220215,
-0.6570060849189758,
0.08526559919118881,
0.3250542879104614,
-0.15262652933597565,
-0.11276051402091... | |
Is it possible to use [Apache Subversion](http://subversion.apache.org/) (SVN) as general purpose backup tool? (As a kind of [rsync](http://en.wikipedia.org/wiki/Rsync) alternative.)
I found this article to be a pretty cool description of using svn to backup your home directory, and more:
> I use Subversion to backup my Linux boxes. With some minor creativity, it easily covers:
>
>
> * Daily snapshots and offsite backup.
> * Easy addition and removal of files and folders.
> * Detailed tracking of file versions.
>
>
> It also allows for a few bonus features:
>
>
> * Regular log emails to keep track of filesystem activity via Subversion's | [
0.3524194061756134,
-0.33238890767097473,
0.10167945921421051,
0.2647564113140106,
-0.16899117827415466,
-0.4702974557876587,
0.14897139370441437,
0.2555994689464569,
-0.5005007982254028,
-0.36089712381362915,
-0.1725904941558838,
0.5493373870849609,
-0.10533437132835388,
-0.14557546377182... | |
event hooks.
> * Users may request a checkout of their home folders from any respository revision.
> * New or replacement servers can be setup with a few svn checkout commands.
Source: [http://www.mythago.net/svn\_for\_backup.html](http://web.archive.org/web/20080824094836/http://www.mythago.net/svn_for_backup.html)
Also found [this article](http://www.onlamp.com/pub/a/onlamp/2005/01/06/svn_homedir.html) which shows an example of versioning your home directory. This allows you to bring your environment with you by checking out your home directory into a new machine. I used to do something similar and found it very useful. | [
0.19305826723575592,
-0.19426779448986053,
0.14718778431415558,
0.046699054539203644,
-0.07511371374130249,
-0.23181484639644623,
0.2955486476421356,
-0.05531315505504608,
-0.5747281908988953,
-0.4633338153362274,
0.02364024706184864,
0.5476828813552856,
-0.10107960551977158,
-0.0381908342... | |
So I've done the trivial "warmup" apps with GAE. Now I'd like to build something with a more complex directory structure. Something along the lines of:
```
siteroot/
models/
controllers/
controller1/
controller2/
...
templates/
template1/
template2/
...
```
..etc. The controllers will be Python modules handling requests. They would then need to locate | [
0.34995511174201965,
-0.2567400336265564,
0.37187129259109497,
0.207646906375885,
0.19588620960712433,
-0.07897945493459702,
-0.2941751778125763,
-0.01686626859009266,
-0.19536378979682922,
-0.6943836808204651,
-0.11333263665437698,
0.4691365957260132,
-0.2868100702762604,
0.17182099819183... | |
(Django-style) templates in associated folders. Most of the demo apps I've seen resolve template paths like this:
```
path = os.path.join(os.path.dirname(__file__), 'myPage.html')
```
...the \_\_ file \_\_ property resolves to the currently executing script. So, in my above example, if a Python script were running in controllers/controller1/, then the 'myPage.html' would resolve to that same directory -- controllers/controller1/myPage.html -- and I would rather cleanly separate my Python code and templates.
The solution I've hacked together feels... hacky:
```
base_paths = os.path.split(os.path.dirname(__file__))
template_dir = os.path.join(base_paths[0], "templates")
```
So, I'm just snipping off the last element of the path for the currently running script and appending the template directory to the new | [
0.08786135911941528,
0.19526307284832,
0.26383623480796814,
-0.11259818077087402,
-0.06325569748878479,
-0.26626333594322205,
0.09403509646654129,
-0.13317593932151794,
-0.11047709733247757,
-0.9272365570068359,
0.08143390715122223,
0.38113343715667725,
-0.47199249267578125,
0.000224978837... | |
path. The other (non-GAE specific) solutions I've seen for resolving Python paths seem pretty heavyweight (such as splitting paths into lists and manipulating accordingly). Django seems to have an answer for this, but I'd rather stick to the GAE API, vs. creating a full Django app and modifying it for GAE.
I'm assuming anything hard-coded would be non-starter, since the apps live on Google's infinite server farm. So what's a better way?
You can't use relative paths, as Toni suggests, because you have no guarantee that the path from your working directory to your app's directory will remain the same.
The correct solution | [
0.08667933195829391,
-0.24778516590595245,
0.2888689339160919,
0.3091505467891693,
-0.02732228673994541,
0.08703889697790146,
0.4436352252960205,
0.0127642173320055,
-0.2203558385372162,
-0.5436988472938538,
-0.01902921497821808,
0.7262439131736755,
-0.4232752323150635,
-0.2151209861040115... | |
is to either use os.path.split, as you are, or to use something like:
```
path = os.path.join(os.path.dirname(__file__), '..', 'templates', 'myPage.html')
```
My usual approach is to generate a path to the template directory using the above method, and store it as a member of my controller object, and provide a "getTemplatePath" method that takes the provided filename and joins it with the basename. | [
0.2590237557888031,
-0.4155667722225189,
0.44427308440208435,
0.18397940695285797,
0.35863494873046875,
-0.21128423511981964,
-0.061163485050201416,
0.02498455159366131,
0.007418123073875904,
-0.8334473371505737,
0.02060028910636902,
0.695755124092102,
-0.39446452260017395,
0.0476605035364... | |
I want to embed a wikipedia article into a page but I don't want all the wrapper (navigation, etc.) that sits around the articles. I saw it done here: <http://www.dayah.com/periodic/>. Click on an element and the iframe is displayed and links to the article only (no wrapper). So how'd they do that? Seems like JavaScript handles showing the iframe and constructing the href but after browsing the pages javascript (<http://www.dayah.com/periodic/Script/interactivity.js>) I still can't figure out how the url is built. Thanks.
The periodic table example loads the printer-friendly version of the wiki artice into an iframe. <http://en.wikipedia.org/wiki/Potasium>?**printable=yes**
it's done in *function click\_wiki(e)* | [
0.4577149748802185,
0.19982467591762543,
0.3697768747806549,
0.0637015625834465,
-0.3778858184814453,
0.01802661642432213,
0.0948062390089035,
-0.22967840731143951,
-0.27951741218566895,
-0.6300402283668518,
0.06197592243552208,
0.24263909459114075,
-0.40431278944015503,
-0.006178426556289... | |
(line 534, interactivity.js)
> ```
>
> var article = el.childNodes[0].childNodes[n_name].innerHTML;
> ...
> window.frames["WikiFrame"].location.replace("http://" + language + ".wikipedia.org/w/index.php?title=" + encodeURIComponent(article) + "&printable=yes");
>
> ``` | [
0.05729356035590172,
0.07521848380565643,
0.4753503203392029,
0.1488589197397232,
0.35350847244262695,
0.2328709214925766,
0.10577747970819473,
-0.2618700861930847,
-0.07534678280353546,
-0.7864707112312317,
-0.4593171179294586,
-0.015900688245892525,
-0.32737433910369873,
0.19311770796775... | |
I'm looking for a control that the Visual Studio "Toolbox" menu uses. It can be docked and can retract (pin).
Would you know where I can find a control or COM I could use which would look like this?
I would recommend the [DockPanel Suite](http://sourceforge.net/projects/dockpanelsuite) by Weifen Luo. | [
0.5920877456665039,
0.020655380561947823,
-0.0409928523004055,
0.12846402823925018,
0.30314159393310547,
0.23644985258579254,
-0.45601677894592285,
-0.012127522379159927,
-0.36641350388526917,
-0.5637507438659668,
-0.0814804956316948,
0.23071947693824768,
-0.10501540452241898,
-0.182767465... | |
I use more than one machine for development in VS 2008. Is there a tool to automatically synchronize the snippets between the machines? Same concept of synchronizing browsers' bookmark.
[Syncplicity.com](http://Syncplicity.com) | [
0.40757986903190613,
-0.23701715469360352,
0.45416393876075745,
0.4340459108352661,
-0.013781809248030186,
0.049215152859687805,
0.3120599091053009,
-0.0730287954211235,
-0.1302272379398346,
-0.5387121438980103,
0.4071202278137207,
0.36000266671180725,
-0.25613418221473694,
-0.099347829818... | |
I have reached the point where I've decided to replace my custom-built replication system with a system that has been built by someone else, mainly for reliability purposes. Can anyone recommend any replication system that is worth it? Is [FiBRE](http://fibre.sourceforge.net) any good?
What I need might be a little away from a generic system, though. I have five departments with each having it's own copy of the database, and the master in a remote location. The departments all have sporadic internet connection, the master is always online. The data has to flow back and forth from the master, meaning that all | [
0.90796959400177,
0.16501402854919434,
0.4048067331314087,
0.187703937292099,
0.14043009281158447,
0.2907484173774719,
0.06663256138563156,
0.21731379628181458,
-0.6332082748413086,
-0.44275033473968506,
0.09312009811401367,
0.20935788750648499,
0.21741779148578644,
0.6527034044265747,
0... | |
departments need to be equal to the master (when internet connection is available), and to upload changes made during network outage that are later distributed to other departments by the master.
I have used CopyCat to create a replication project. It allows you create your own replication client/server configuration using CodeGear Delphi. This allows you complete flexibilty as to how you want your replication to work.
If you don't use Delphi, or need a prefabricated solution, CopyTiger does the same thing already configured. | [
0.5607870817184448,
-0.1391102820634842,
0.2235855758190155,
0.25984400510787964,
-0.06813245266675949,
-0.34034356474876404,
-0.30295851826667786,
-0.001701228553429246,
-0.5708622336387634,
-0.6728625893592834,
0.15461644530296326,
0.5162777304649353,
-0.3166176974773407,
0.3168601691722... | |
Let's say I have the following simple enum:
```
enum Response
{
Yes = 1,
No = 2,
Maybe = 3
}
```
How can I bind this enum to a DropDownList control so that the descriptions are displayed in the list as well as retrieve the associated numeric value (1,2,3) once an option has been selected?
I probably wouldn't **bind** the data as it's an enum, and it won't change after compile time (unless I'm having one of those *stoopid* moments).
Better just to iterate through the enum:
```
Dim itemValues As Array = System.Enum.GetValues(GetType(Response))
Dim itemNames As Array | [
-0.008756332099437714,
-0.0914730653166771,
0.6398704051971436,
-0.08618269860744476,
-0.07183212786912918,
0.261865496635437,
0.2835933268070221,
-0.6140422821044922,
-0.06419552862644196,
-0.6326220631599426,
-0.38738203048706055,
0.5187953114509583,
-0.355599582195282,
0.159459456801414... | |
= System.Enum.GetNames(GetType(Response))
For i As Integer = 0 To itemNames.Length - 1
Dim item As New ListItem(itemNames(i), itemValues(i))
dropdownlist.Items.Add(item)
Next
```
Or the same in C#
```
Array itemValues = System.Enum.GetValues(typeof(Response));
Array itemNames = System.Enum.GetNames(typeof(Response));
for (int i = 0; i <= itemNames.Length - 1 ; i++) {
ListItem item = new ListItem(itemNames[i], itemValues[i]);
dropdownlist.Items.Add(item);
}
``` | [
-0.14898695051670074,
-0.4108012914657593,
0.8534876704216003,
-0.26656344532966614,
-0.06306817382574081,
0.43808627128601074,
0.32682549953460693,
-0.781481146812439,
-0.5612443089485168,
-0.542797327041626,
-0.4826340973377228,
0.5139102339744568,
-0.3913159966468811,
0.450842946767807,... | |
We're currently in the process of setting up a source control/build/and more-server for .NET development and we're thinking about either utilizing the Team Foundation Server (which costs a lot of dough) or combining several open source options, such as SourceForge Enterprise/GForge and Subversion and CruiseControl.net and so on. Has anyone walked down the full blown OSS road or is it TFS only if you want to get it right and get to work soon?
My work is currently using a mostly OSS build process with Cruise Control as the engine and it is great. I would suggest that if you don't | [
0.3191457986831665,
-0.01976347528398037,
0.28307127952575684,
0.2513678967952728,
0.16871188580989838,
-0.3403160870075226,
-0.07552463561296463,
0.2579260766506195,
-0.053499914705753326,
-0.7207955121994019,
-0.019585372880101204,
0.7868444919586182,
-0.10539509356021881,
-0.19783556461... | |
know why you would need TFS, it's probably not worth the cost.
The thing you have to keep in mind with the OSS stuff is that the software has either been in use by the Java crew for years previously, or the software is a port of similar Java code. It is robust and is suitable for purpose.
Microsoft cannot ship OSS code, which is why they have to re-implement a lot of Open Source stuff. So, no, it is not necessary, and there have been millions of projects shipped on that stack. The flip side is that there is also a | [
0.5366989970207214,
0.29364538192749023,
-0.07453388720750809,
0.1606878638267517,
0.13965019583702087,
-0.3882877230644226,
0.05612875893712044,
0.26919516921043396,
-0.40614286065101624,
-0.6398479342460632,
0.12020261585712433,
0.5016392469406128,
-0.22590292990207672,
-0.01538535952568... | |
lot of nice features that you get with TFS that you won't (easily) get with the OSS stack, such as integration with your bug/feature tracking software. | [
0.2775920331478119,
-0.14816057682037354,
-0.05883507803082466,
0.42841702699661255,
0.1298871487379074,
-0.2988358438014984,
0.011265632696449757,
0.2968311905860901,
-0.23791062831878662,
-0.652129590511322,
-0.20781132578849792,
0.5427690148353577,
-0.26238757371902466,
-0.0508375503122... | |
I want to import an oracle dump into a different tablespace.
I have a tablespace A used by User A. I've revoked DBA on this user and given him the grants connect and resource. Then I've dumped everything with the command
> exp a/\*\*\* owner=a file=oracledump.DMP log=log.log compress=y
Now I want to import the dump into the tablespace B used by User B. So I've given him the grants on connect and resource (no DBA). Then I've executed the following import:
> imp b/\*\*\* file=oracledump.DMP log=import.log fromuser=a touser=b
The result is a log with lots of errors:
> IMP-00017: following statement failed with ORACLE error 20001: | [
0.22694618999958038,
0.4723092317581177,
0.08635466545820236,
0.07521044462919235,
-0.2696059048175812,
0.1494949609041214,
0.2631849944591522,
-0.6194857358932495,
-0.2156081348657608,
-0.340738445520401,
0.08636356145143509,
0.38044852018356323,
-0.452963262796402,
0.29930567741394043,
... | |
"BEGIN DBMS\_STATS.SET\_TABLE\_STATS
> IMP-00003: ORACLE error 20001 encountered
> ORA-20001: Invalid or inconsistent input values
After that, I've tried the same import command but with the option statistics=none. This resulted in the following errors:
> ORA-00959: tablespace 'A\_TBLSPACE' does not exist
How should this be done?
Note: a lot of columns are of type CLOB. It looks like the problems have something to do with that.
Note2: The oracle versions are a mixture of 9.2, 10.1, and 10.1 XE. But I don't think it has to do with versions.
You've got a couple of issues here.
**Firstly**, the different versions of Oracle you're using is the reason for the | [
0.15321284532546997,
0.37884312868118286,
0.11992253363132477,
-0.1497928500175476,
-0.11760499328374863,
-0.06651119887828827,
0.49522918462753296,
-0.24200554192066193,
-0.03548148274421692,
-0.6633489727973938,
0.15201987326145172,
0.692359209060669,
-0.44714245200157166,
0.005793701857... | |
table statistics error - I had the same issue when some of our Oracle 10g Databases got upgraded to Release 2, and some were still on Release 1 and I was swapping .DMP files between them.
The solution that worked for me was to use the same version of `exp` and `imp` tools to do the exporting and importing on the different Database instances. This was easiest to do by using the same PC (or Oracle Server) to issue all of the exporting and importing commands.
**Secondly**, I suspect you're getting the `ORA-00959: tablespace 'A_TBLSPACE' does not exist` because you're trying to | [
0.10098177194595337,
0.20297981798648834,
0.06485383957624435,
0.28272107243537903,
-0.1953652948141098,
0.08880502730607986,
0.09707672894001007,
0.030066436156630516,
-0.5014745593070984,
-0.5161468386650085,
0.2587139904499054,
0.5219830274581909,
-0.5504600405693054,
-0.145282879471778... | |
import a .DMP file from a full-blown Oracle Database into the 10g Express Edition (XE) Database, which, by default, creates a single, predefined tablespace called `USERS` for you.
If that's the case, then you'll need to do the following..
1. With your .DMP file, create a SQL file containing the structure (Tables):
`imp <xe_username>/<password>@XE file=<filename.dmp> indexfile=index.sql full=y`
2. Open the indexfile (index.sql) in a text editor that can do find and replace over an entire file, and issue the following find and replace statements IN ORDER (ignore the single quotes.. '):
`Find: 'REM<space>' Replace: <nothing>`
`Find: '"<source_tablespace>"' Replace: '"USERS"'`
`Find: '...' Replace: 'REM ...'`
`Find: 'CONNECT' Replace: 'REM | [
0.10801317542791367,
0.061769936233758926,
0.6253485083580017,
-0.1091562882065773,
-0.18958675861358643,
0.14647138118743896,
-0.07360048592090607,
-0.19633379578590393,
-0.2630343735218048,
-0.7751385569572449,
-0.5926135182380676,
0.33967188000679016,
-0.7636804580688477,
-0.01004296634... | |
CONNECT'`
3. Save the indexfile, then run it against your Oracle Express Edition account (I find it's best to create a new, blank XE user account - or drop and recreate if I'm refreshing):
`sqlplus <xe_username>/<password>@XE @index.sql`
4. Finally run the same .DMP file you created the indexfile with against the same account to import the data, stored procedures, views etc:
`imp <xe_username>/<password>@XE file=<filename.dmp> fromuser=<original_username> touser=<xe_username> ignore=y`
You may get pages of Oracle errors when trying to create certain objects such as Database Jobs as Oracle will try to use the same Database Identifier, which will most likely fail as you're on a different Database. | [
0.18375647068023682,
0.2884345054626465,
0.5351240038871765,
0.18191242218017578,
-0.3332711458206177,
0.005779716186225414,
0.23335233330726624,
-0.2596316635608673,
-0.027339423075318336,
-0.814699649810791,
-0.06782611459493637,
0.5000415444374084,
-0.8018049597740173,
0.346203595399856... | |
Let's say I have the following simple table variable:
```
declare @databases table
(
DatabaseID int,
Name varchar(15),
Server varchar(15)
)
-- insert a bunch rows into @databases
```
Is declaring and using a cursor my only option if I wanted to iterate through the rows? Is there another way?
First of all you should be absolutely sure you need to iterate through each row — set based operations will perform faster in every case I can think of and will | [
-0.12797501683235168,
0.07583148777484894,
0.5220416188240051,
-0.07695173472166061,
-0.14541907608509064,
0.07724570482969284,
-0.03172965347766876,
-0.14580708742141724,
-0.2632350027561188,
-0.4610211253166199,
0.27167651057243347,
0.602692186832428,
-0.5549262762069702,
0.0864791199564... | |
normally use simpler code.
Depending on your data it may be possible to loop using just `SELECT` statements as shown below:
```
Declare @Id int
While (Select Count(*) From ATable Where Processed = 0) > 0
Begin
Select Top 1 @Id = Id From ATable Where Processed = 0
--Do some processing here
Update ATable Set Processed = 1 Where Id = @Id
End
```
Another alternative is to use a temporary table:
```
Select *
Into #Temp
From ATable
Declare @Id int
While (Select Count(*) From #Temp) > 0
Begin
Select Top 1 @Id = Id | [
0.2110489308834076,
-0.38263633847236633,
0.10256834328174591,
0.04455668851733208,
0.029389087110757828,
0.029819713905453682,
-0.0575704425573349,
-0.5577694177627563,
-0.2281457632780075,
-0.2800433933734894,
0.07977959513664246,
0.2772882580757141,
-0.503227174282074,
-0.01074968744069... | |
From #Temp
--Do some processing here
Delete #Temp Where Id = @Id
End
```
The option you should choose really depends on the structure and volume of your data.
**Note:** If you are using SQL Server you would be better served using:
```
WHILE EXISTS(SELECT * FROM #Temp)
```
Using `COUNT` will have to touch every single row in the table, the `EXISTS` only needs to touch the first one (see [Josef's answer](https://stackoverflow.com/a/65294/963542) below). | [
0.467709481716156,
0.08121022582054138,
0.3466039299964905,
0.10288386791944504,
-0.06516829878091812,
-0.015721237286925316,
0.13718533515930176,
-0.22487463057041168,
-0.27204379439353943,
-0.510250449180603,
-0.2651704251766205,
0.15011602640151978,
-0.37588152289390564,
0.0187715850770... | |
I set up a website to use SqlMembershipProvider as written on [this page](http://msdn.microsoft.com/en-us/library/ms998347.aspx).
I followed every step. I have the database, I modified the Web.config to use this provider, with the correct connection string, and the authentication mode is set to Forms. Created some users to test with.
I created a Login.aspx and put the Login control on it. Everything works fine until the point that a user can log in.
I call Default.aspx, it gets redirected to Login.aspx, I enter the user and the correct password. No error message, nothing seems to be wrong, but I see again the Login form, | [
0.2371853142976761,
0.1466791182756424,
0.48681941628456116,
-0.012281158939003944,
0.16120466589927673,
-0.16754117608070374,
0.6061813235282898,
-0.06046723201870918,
-0.15065695345401764,
-0.6646463871002197,
0.05532027408480644,
0.43445026874542236,
-0.14677666127681732,
0.081109195947... | |
to enter the user's login information. However if I check the cookies in the browser, I can see that the cookie with the specified name exists.
I already tried to handle the events by myself and check, what is happening in them, but no success.
I'm using VS2008, Website in filesystem, SQL Express 2005 to store aspnetdb, no role management, tested with K-Meleon, IE7.0 and Chrome.
Any ideas?
**Resolution:** After some mailing with Rob we have the ideal solution, which is now the accepted answer.
I have checked the code over in the files you have sent me (thanks again for sending them through).
**Note: I | [
0.14221203327178955,
-0.042234089225530624,
0.2743700444698334,
0.19806203246116638,
-0.013128744438290596,
0.04852928966283798,
0.6312219500541687,
0.043961308896541595,
-0.3310859501361847,
-0.6791866421699524,
0.12509095668792725,
0.5295117497444153,
-0.1078876182436943,
-0.028401941061... | |
have not tested this since I have not installed the database etc..**
However, I am pretty sure this is the issue.
You need to set the *MembershipProvider* Property for your ASP.NET controls. Making the definitions for them:
```
<asp:Login ID="Login1" runat="server"
MembershipProvider="MySqlMembershipProvider">
<LayoutTemplate>
<!-- template code snipped for brevity -->
</LayoutTemplate>
</asp:Login>
```
And..
```
<asp:CreateUserWizard ID="CreateUserWizard1" runat="server"
MembershipProvider="MySqlMembershipProvider">
<WizardSteps>
<asp:CreateUserWizardStep runat="server" /> | [
0.12417382746934891,
0.057420819997787476,
0.39610862731933594,
0.030797701328992844,
0.021845955401659012,
-0.44915106892585754,
0.17394569516181946,
-0.45478886365890503,
-0.3876480758190155,
-0.8055766224861145,
0.1723494827747345,
0.34401243925094604,
-0.20224294066429138,
0.0786112770... | |
<asp:CompleteWizardStep runat="server" />
</WizardSteps>
</asp:CreateUserWizard>
```
This then binds the controls to the Membership Provider with the given name (which you have specified in the Web.Config.
Give this a whirl in your solution and let me know how you get on.
I hope this works for you :)
### Edit
I should also add, I know you shouldn't need to do this as the default provider is set, but I *have* had problems in the past with this.. I ended up setting them all to manual and all worked fine. | [
0.3030361235141754,
-0.2631598114967346,
0.6921316981315613,
0.17898859083652496,
-0.00022996233019512147,
-0.44224587082862854,
0.16600480675697327,
-0.23819610476493835,
-0.06150008365511894,
-0.6758105158805847,
-0.10945626348257065,
0.5112682580947876,
-0.2165633738040924,
-0.107764028... | |
I am trying to write a unit test for an action method which calls the `Controller.RedirectToReferrer()` method, but am getting a "No referrer available" message.
How can I isolate and mock this method?
Have you thought about creating a [test double](http://xunitpatterns.com/Test%20Double.html)? | [
0.5458466410636902,
-0.12874211370944977,
-0.03752376139163971,
-0.024264821782708168,
-0.22896872460842133,
-0.03665949031710625,
0.10760485380887985,
0.14309251308441162,
-0.1760617196559906,
-0.43048083782196045,
0.35567399859428406,
0.2671905755996704,
-0.441457599401474,
0.17119598388... | |
I have a sequence of migrations in a rails app which includes the following steps:
1. Create basic version of the 'user' model
2. Create an instance of this model - there needs to be at least one initial user in my system so that you can log in and start using it
3. Update the 'user' model to add a new field / column.
Now I'm using "validates\_inclusion\_of" on this new field/column. This worked fine on my initial development machine, which already had a database with these migrations applied. However, if I go to a fresh machine and run all the migrations, step | [
0.006222034338861704,
0.09207094460725784,
0.19796594977378845,
-0.15624535083770752,
0.14052355289459229,
0.38705575466156006,
0.40443602204322815,
-0.2520052194595337,
-0.12953601777553558,
-0.9766353964805603,
0.13147984445095062,
0.1676907241344452,
-0.4350029230117798,
-0.077245004475... | |
2 fails, because validates\_inclusion\_of fails, because the field from migration 3 hasn't been added to the model class yet.
As a workaround, I can comment out the "validates\_..." line, run the migrations, and uncomment it, but that's not nice.
Better would be to re-order my migrations so the user creation (step 2) comes last, after all columns have been added.
I'm a rails newbie though, so I thought I'd ask what the preferred way to handle this situation is :)
The easiest way to avoid this issue is to use `rake db:schema:load` on the second machine, instead of db:migrate. `rake db:schema:load` uses schema.rb to | [
-0.13637033104896545,
0.19317243993282318,
0.2653413414955139,
-0.2834647595882416,
-0.05095304176211357,
-0.09677669405937195,
0.5317026972770691,
-0.4943716526031494,
0.03259136527776718,
-0.7888200283050537,
-0.00594480661675334,
0.6605868339538574,
-0.5302303433418274,
0.05290444940328... | |
load the most current version of your schema, as opposed to migrating it up form scratch.
If you run into this issue when deploying to a production machine (where preserving data is important), you'll probably have to consolidate your migrations into a single file without conflicts. | [
0.484923779964447,
-0.0897006243467331,
0.06795527786016464,
0.22858649492263794,
0.10880963504314423,
-0.14789868891239166,
-0.21143142879009247,
-0.19418969750404358,
-0.4820557236671448,
-0.583445131778717,
-0.28957200050354004,
0.3107386529445648,
-0.28773942589759827,
0.00840957369655... | |
I need to build something that starts serving a H.264 encoded video to a flash player halfway through the file (to support skipping to a point in the video that has not been buffered yet).
Currently, the videos are in the FLV container format, but transcoding is an option. I managed to re-write the file header and metadata information for a given byte offset. This works for older videos, but not for H.264 encoded files. I suspect this is because the video tags inside the file also have to be altered, which is not feasible (it would take too much | [
0.5964277386665344,
0.15065927803516388,
0.6035344004631042,
0.1849292367696762,
0.09776688367128372,
-0.3010353147983551,
-0.10927024483680725,
-0.2838435471057892,
-0.39584314823150635,
-0.4659377634525299,
-0.22514793276786804,
0.6052913069725037,
-0.10355065762996674,
0.203943997621536... | |
processing power).
What is the "proper" way to do it?
The flash player can only start playing H.264 video once it's downloaded the MOOV atom. Existing pseudo-streaming providers just give you an FLV header - either the first 13 bytes of the file or a hardcoded one - and then serve the file from the given offset. If you want to make an H.264 pseudo-streamer, you'll need to have it output the FLV header, then a MOOV atom, and then serve the rest of the file from the given offset. If you don't use an FLV container, you won't need the FLV | [
0.44936424493789673,
-0.025517819449305534,
0.7321203351020813,
0.2473820447921753,
0.017386600375175476,
-0.3212476372718811,
-0.2679574489593506,
-0.21530641615390778,
-0.3979528546333313,
-0.4442889392375946,
-0.3018990457057953,
0.8344810605049133,
-0.2841528356075287,
-0.0766056030988... | |
header, but you'll still need the MOOV atom.
Unfortunatley, I don't think you'll be able to use the MOOV atom from the file on disk; the information it contains won't be right for the file fragment that you serve. So you'd have to parse the existing atom and generate one of your own which was appropriate to the served part of the file.
If there are complicated structures within the H.264 file it could be even more complicated to pseudo-stream. If parsing the file isn't feasible, I'm afraid you may not be able to pseudo-stream your media. | [
0.5252305269241333,
0.18329086899757385,
0.11010021716356277,
0.37950000166893005,
-0.4434243440628052,
-0.3526150584220886,
-0.031201668083667755,
-0.2113042026758194,
-0.345486044883728,
-0.5011261701583862,
-0.02152928151190281,
0.6969152092933655,
-0.39949285984039307,
0.20554636418819... | |
What I want is lots of nodes which can expand making a mind map.
I'd ideally like to expand and collapse nodes. I would like to be able to navigate by either dragging around the page, or by following expanded nodes.
I have a colleague who needed that kind of functionalities to graph Maven dependencies between projects. He ended up using [FreeMind](http://freemind.sourceforge.net/) to do the visualization. He just had to write an XML file conforming to the FreeMind format. I even think you can just use [OPML](http://www.opml.org/) as the file format and find a ready to use XSLT to transform it to | [
0.24132966995239258,
0.09596791863441467,
0.5644381642341614,
0.06356928497552872,
-0.0018050168873742223,
-0.14736388623714447,
-0.160902202129364,
0.22114959359169006,
-0.3976284861564636,
-0.8946374654769897,
0.11100390553474426,
0.3152961730957031,
-0.27578461170196533,
0.0270227473229... | |
the FreeMind format. Maybe FreeMind actually supports OPML directly (I havent used it for a long time).
Once you have your data in FreeMind, you can either export them, or use the [FreeMind applet](http://freemind.sourceforge.net/docs/Serving%20Freemind%20maps%20in%20a%20browser/freemind%20applet.html) to display an interactive MindMap on your website. | [
0.034524768590927124,
-0.2355673611164093,
0.4525867998600006,
0.26053866744041443,
-0.07694447785615921,
-0.3012743294239044,
0.20635123550891876,
0.20740698277950287,
-0.3985759913921356,
-0.7372470498085022,
-0.02479541301727295,
0.5292186141014099,
-0.19946902990341187,
-0.117129154503... | |
Several times now I've been faced with plans from a team that wants to build their own bug tracking system - Not as a product, but as an internal tool.
The arguments I've heard in favous are usually along the lines of :
* Wanting to 'eat our own dog food' in terms of some internally built web framework
* Needing some highly specialised report, or the ability to tweak some feature in some allegedly unique way
* Believing that it isn't difficult to build a bug tracking system
What arguments might you use to support buying an existing bug tracking system? In particular, what | [
0.9801324009895325,
0.377543568611145,
-0.15425549447536469,
-0.23816312849521637,
0.020282872021198273,
0.4153021574020386,
0.24068108201026917,
-0.012405933812260628,
-0.2859887480735779,
-0.3268541395664215,
0.0077295764349401,
0.46562185883522034,
-0.24068590998649597,
0.27487939596176... | |
features sound easy but turn out hard to implement, or are difficult and important but often overlooked?
First, look at these [Ohloh](http://ohloh.net) metrics:
```
Trac: 44 KLoC, 10 Person Years, $577,003
Bugzilla: 54 KLoC, 13 Person Years, $714,437
Redmine: 171 KLoC, 44 Person Years, $2,400,723
Mantis: 182 KLoC, 47 Person Years, $2,562,978
```
What do we learn from these numbers? We learn that building Yet Another Bug Tracker is a great way to waste resources!
So here are my reasons to build your own internal bug tracking system:
1. You need to neutralize all the bozocoders for | [
0.23497901856899261,
0.06300278007984161,
0.05048079788684845,
0.22384513914585114,
0.4615341126918793,
0.27664491534233093,
0.23211976885795593,
0.17209778726100922,
-0.7296384572982788,
-0.44806766510009766,
0.03179744631052017,
0.47846314311027527,
-0.21045462787151337,
-0.0389710478484... | |
a decade or two.
2. You need to flush some money to avoid budget reduction next year.
Otherwise don't. | [
0.49644774198532104,
-0.11179045587778091,
0.2837326228618622,
0.24091294407844543,
0.21751637756824493,
-0.31004273891448975,
-0.025598512962460518,
0.41789665818214417,
-0.030328137800097466,
-0.7811234593391418,
0.17405550181865692,
0.28229495882987976,
0.12546980381011963,
-0.180967196... | |
To commemorate the public launch of Stack Overflow, what's the shortest code to cause a stack overflow? Any language welcome.
ETA: Just to be clear on this question, seeing as I'm an occasional Scheme user: tail-call "recursion" is really iteration, and any solution which can be converted to an iterative solution relatively trivially by a decent compiler won't be counted. :-P
ETA2: I've now selected a “best answer”; see [this post](https://stackoverflow.com/questions/62188/stack-overflow-code-golf/71833#71833) for rationale. Thanks to everyone who contributed! :-)
All these answers and no Befunge? I'd wager a fair amount it's shortest solution of them all:
```
1
```
Not kidding. Try it yourself: <http://www.quirkster.com/iano/js/befunge.html>
EDIT: I guess | [
-0.24754638969898224,
0.008472626097500324,
0.35730135440826416,
0.19814924895763397,
-0.2997470796108246,
0.16219070553779602,
0.2126285582780838,
0.010123646818101406,
-0.48473936319351196,
-0.4272559583187103,
-0.1401263326406479,
0.4473857879638672,
-0.08566843718290329,
-0.20303927361... | |
I need to explain this one. The 1 operand pushes a 1 onto Befunge's internal stack and the lack of anything else puts it in a loop under the rules of the language.
Using the interpreter provided, you will eventually--and I mean *eventually*--hit a point where the Javascript array that represents the Befunge stack becomes too large for the browser to reallocate. If you had a simple Befunge interpreter with a smaller and bounded stack--as is the case with most of the languages below--this program would cause a more noticeable overflow faster. | [
-0.0010672073112800717,
-0.014608305878937244,
0.049977246671915054,
-0.2644326686859131,
0.05532125011086464,
-0.17683927714824677,
0.32388031482696533,
-0.02800063230097294,
0.1711272895336151,
-0.5327914953231812,
-0.19482558965682983,
0.1916462481021881,
-0.4561416804790497,
0.09161677... | |
I've got a rails application where users have to log in. Therefore in order for the application to be usable, there must be one initial user in the system for the first person to log in with (they can then create subsequent users). Up to now I've used a migration to add a special user to the database.
After asking [this question](https://stackoverflow.com/questions/62038/rails-model-validators-break-earlier-migrations), it seems that I should be using db:schema:load, rather than running the migrations, to set up fresh databases on new development machines. Unfortunately, this doesn't seem to include the migrations which insert data, only those which set up tables, | [
0.057795118540525436,
0.07821016758680344,
0.11591876298189163,
-0.040830984711647034,
0.23364141583442688,
-0.007670741993933916,
0.18615877628326416,
-0.07056870311498642,
-0.4814893901348114,
-0.5672176480293274,
0.05928962677717209,
0.2688850462436676,
-0.23121199011802673,
0.036889370... | |
keys etc.
My question is, what's the best way to handle this situation:
1. Is there a way to get d:s:l to include data-insertion migrations?
2. Should I not be using migrations at all to insert data this way?
3. Should I not be pre-populating the database with data at all? Should I update the application code so that it handles the case where there are no users gracefully, and lets an initial user account be created live from within the application?
4. Any other options? :)
I thought I'd summarise some of the great answers I've had to this question, together with my own thoughts | [
0.2903256416320801,
0.01828327775001526,
0.29936861991882324,
0.2635057270526886,
0.5714815855026245,
0.09052742272615433,
0.10847143083810806,
-0.3148078918457031,
-0.4064466953277588,
-0.41146528720855713,
0.006172895897179842,
0.5861908793449402,
-0.2787700891494751,
-0.0934348106384277... | |
now I've read them all :)
There are two distinct issues here:
1. Should I pre-populate the database with my special 'admin' user? Or should the application provide a way to set up when it's first used?
2. How does one pre-populate the database with data? Note that this is a valid question regardless of the answer to part 1: there are other usage scenarios for pre-population than an admin user.
For (1), it seems that setting up the first user from within the application itself is quite a bit of extra work, for functionality which is, by definition, hardly ever used. It may | [
0.3759109377861023,
0.1632499098777771,
0.30419209599494934,
0.10023286193609238,
0.3095982074737549,
-0.09833984822034836,
-0.08571294695138931,
-0.2317081242799759,
0.04062144458293915,
-0.5429703593254089,
-0.17624972760677338,
0.3250215947628021,
-0.033300939947366714,
-0.0161799639463... | |
be slightly more secure, however, as it forces the user to set a password of their choice. The best solution is in between these two extremes: have a script (or rake task, or whatever) to set up the initial user. The script can then be set up to auto-populate with a default password during development, and to require a password to be entered during production installation/deployment (if you want to discourage a default password for the administrator).
For (2), it appears that there are a number of good, valid solutions. A rake task seems a good way, and there are some | [
0.1489110291004181,
-0.3423722982406616,
0.16634029150009155,
0.19114352762699127,
0.18357041478157043,
-0.06421519070863724,
0.16086746752262115,
-0.15604209899902344,
0.04005506634712219,
-0.6181561946868896,
-0.2963515520095825,
0.7056255340576172,
0.17760205268859863,
-0.25263053178787... | |
plugins to make this even easier. Just look through some of the other answers to see the details of those :) | [
0.22191040217876434,
-0.17057755589485168,
0.10351967066526413,
0.6041421294212341,
0.3167676329612732,
0.1095990240573883,
0.17042839527130127,
0.17004922032356262,
-0.021270224824547768,
-0.7168015837669373,
-0.12090247124433517,
0.6460980176925659,
-0.33079731464385986,
-0.1915445476770... | |
I am developing a web site and need to see how it will look at different resolutions. The catch is that it must work on our Intranet.
Is there a free solution?
For Internet Explorer there's the [Internet Explorer Developer Toolbar](http://www.microsoft.com/en-us/download/details.aspx?id=18359). It lets you select resolutions quite easily. | [
0.42311593890190125,
-0.06470455229282379,
0.5105106830596924,
0.23777569830417633,
0.1449464112520218,
-0.11298717558383942,
-0.19172413647174835,
0.2361893653869629,
-0.5287196040153503,
-0.8450680375099182,
0.16517290472984314,
0.4034436047077179,
-0.13508111238479614,
0.272498846054077... | |
Is there an easy way to avoid dealing with text encoding problems?
You can't really avoid dealing with the text encoding issues, but there are existing solutions in Apache Commons:
* `Reader` to `InputStream`: [`ReaderInputStream`](https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/input/ReaderInputStream.html)
* `Writer` to `OutputStream`: [`WriterOutputStream`](https://commons.apache.org/proper/commons-io/javadocs/api-release/org/apache/commons/io/output/WriterOutputStream.html)
You just need to pick the encoding of your choice. | [
0.026552248746156693,
-0.06175316870212555,
0.2544376254081726,
0.1821317821741104,
-0.06699375808238983,
-0.10246673226356506,
-0.06401602923870087,
-0.06153230741620064,
0.029061274603009224,
-0.8825623989105225,
-0.23035849630832672,
0.5630849599838257,
-0.1426844745874405,
-0.351969718... | |
I am trying to refactor some code I have for software that collects current status of agents in a call queue. Currently, for each of the 6 or so events that I listen to, I check in a Mnesia table if an agent exists and change some values in the row depending on the event or add it as new if the agent doesn't exist. Currently I have this Mnesia transaction in each event and of course that is a bunch of repeated code for checking the existence of agents and so on.
I'm trying to change it so that | [
0.2232981026172638,
-0.14251025021076202,
0.27498555183410645,
0.14613422751426697,
-0.033613648265600204,
0.1579718291759491,
0.4424614906311035,
0.0403120294213295,
-0.5456959009170532,
-0.6152129769325256,
0.17707300186157227,
0.4621444046497345,
-0.36053112149238586,
0.2524209618568420... | |
there is one function like *change\_agent/2* that I call from the events that handles this for me.
My problems are of course records.... I find no way of dynamically creating them or merging 2 of them together or anything. Preferably there would be a function I could call like:
```
change_agent("001", #agent(id = "001", name = "Steve")).
change_agent("001", #agent(id = "001", paused = 0, talking_to = "None")).
```
I wrote some code a while ago that merges two records. Is not entirely dynamic, but whith macros you could easily use it for several records.
It works like this: The merge/2 function takes two records and converts | [
-0.12804090976715088,
-0.03544183820486069,
0.08724640309810638,
-0.09612499177455902,
0.18222299218177795,
0.3121609091758728,
0.016034020110964775,
-0.09659970551729202,
-0.264267235994339,
-0.8281177878379822,
0.05600695684552193,
0.40314382314682007,
-0.49954137206077576,
0.07913512736... | |
them to lists together with the empty record for reference (the record type is defined at compile time, and must be. This is the "undynamic" part). These are then run through the generic function merge/4 which works with lists and takes elements from A if they are defined, otherwise from B if they are defined, or lastly from Default (which is always defined).
Here's the code (please excuse StackOverflow's poor Erlang syntax highlighting):
```
%%%----------------------------------------------------------------------------
%%% @spec merge(RecordA, RecordB) -> #my_record{}
%%% RecordA = #my_record{}
%%% RecordB = #my_record{}
%%%
%%% @doc Merges two #my_record{} instances. The first takes precedence.
%%% | [
-0.04107147455215454,
0.017832577228546143,
0.8137084245681763,
-0.08835144340991974,
0.26695993542671204,
0.13278476893901825,
-0.02038487046957016,
-0.5181593894958496,
-0.345233678817749,
-0.4826098382472992,
-0.2562771141529083,
0.628643810749054,
-0.21129180490970612,
0.15105919539928... | |
@end
%%%----------------------------------------------------------------------------
merge(RecordA, RecordB) when is_record(RecordA, my_record),
is_record(RecordB, my_record) ->
list_to_tuple(
lists:append([my_record],
merge(tl(tuple_to_list(RecordA)),
tl(tuple_to_list(RecordB)), | [
-0.4656989276409149,
-0.09229247272014618,
0.47325843572616577,
-0.15055063366889954,
0.13013257086277008,
0.09150423109531403,
0.325188547372818,
0.09803872555494308,
-0.07979567348957062,
-0.6009254455566406,
-0.37760594487190247,
0.3169625997543335,
-0.22235409915447235,
0.3152670562267... | |
tl(tuple_to_list(#my_record{})),
[]))).
%%%----------------------------------------------------------------------------
%%% @spec merge(A, B, Default, []) -> [term()]
%%% A = [term()]
%%% B = [term()]
%%% Default = [term()]
%%%
%%% @doc Merges the lists `A' and `B' into to a new list taking
%%% default values from `Default'.
%%%
%%% Each element of `A' and | [
0.009226947091519833,
-0.28556621074676514,
0.835353434085846,
-0.32620978355407715,
0.17093339562416077,
0.09863457828760147,
0.21160006523132324,
-0.537185788154602,
-0.01828913763165474,
-0.5149407386779785,
-0.7537072896957397,
0.8214367628097534,
-0.3831104636192322,
0.127875134348869... | |
`B' are compared against the elements in
%%% `Default'. If they match the default, the default is used. If one
%%% of them differs from the other and the default value, that element is
%%% chosen. If both differs, the element from `A' is chosen.
%%% @end
%%%----------------------------------------------------------------------------
merge([D|ATail], [D|BTail], [D|DTail], To) ->
merge(ATail, BTail, DTail, [D|To]); % If default, take from D
merge([D|ATail], [B|BTail], [D|DTail], To) ->
merge(ATail, BTail, DTail, [B|To]); % If only A default, take from B
merge([A|ATail], [_|BTail], [_|DTail], To) ->
merge(ATail, BTail, DTail, [A|To]); % Otherwise take from A
merge([], | [
-0.39778345823287964,
-0.08875725418329239,
-0.05645313858985901,
-0.30291232466697693,
0.032539281994104385,
0.542451798915863,
0.4777317941188812,
-0.32871970534324646,
0.14149512350559235,
-0.4381048381328583,
-0.7395654320716858,
0.34562796354293823,
-0.5512021780014038,
-0.19583135843... | |
[], [], To) ->
lists:reverse(To).
```
Feel free to use it in any way you want. | [
0.3916882276535034,
0.0857112854719162,
0.24950191378593445,
-0.0821601077914238,
-0.06382901221513748,
-0.0825449600815773,
0.1924372762441635,
0.29212716221809387,
-0.42893311381340027,
-0.4596710205078125,
-0.22093069553375244,
0.6116204261779785,
-0.4105193316936493,
-0.131529614329338... | |
What tool would you recommend to detect **Java package cyclic dependencies**,
knowing that the goal is to *list explicitly the specific classes involved in the detected 'across-packages cycle'*?
I know about [classycle](http://classycle.sourceforge.net/) and [JDepend](http://clarkware.com/software/JDepend.html), but they both fail to list the classes involved in a cyclic package dependency. [Metrics](http://metrics.sourceforge.net/) has an interesting graphical representation of cycles, but it is again limited to packages, and quite difficult to read sometime.
I am getting tired to get a:
> *" you have a package cycle dependency between those 3 packages*
>
> *you have xxx classes in each*
>
> *good luck | [
0.2175302952528,
-0.013463590294122696,
-0.1426437795162201,
-0.053340520709753036,
-0.23671111464500427,
-0.18238413333892822,
0.01409477461129427,
-0.03301519528031349,
-0.5493305325508118,
-0.8559641242027283,
0.3941819667816162,
0.4677685499191284,
-0.3299548923969269,
0.09859851002693... | |
finding the right classes and break this cycle "*
Do you know any tool that takes the extra step to actually explain to you why the cycle is detected (i.e. 'list the involved classes')?
---
Riiight... Time to proclaim the results:
@l7010.de: Thank you for the effort. I will vote you up (when I will have enough rep), especially for the 'CAP' answer... but CAP is dead in the water and no longer compatible with my Eclipse 3.4. The rest is commercial and I look only for freeware.
@daniel6651: Thank you but, as said, freeware only (sorry to not have mentioned it in the first | [
0.6409561038017273,
-0.05979694798588753,
0.20359358191490173,
0.42814528942108154,
-0.2528880834579468,
-0.24791592359542847,
0.07940980046987534,
0.061321698129177094,
-0.26729053258895874,
-0.6898769736289978,
0.00709115993231535,
0.6352905035018921,
-0.021681400015950203,
0.08096683025... | |
place).
@izb as a frequent user of findbugs (using the latest 1.3.5 right now), I am one click away to accept your answer... if you could explain to me what option there is to activate for findbug to detect any cycle. That feature is only mentioned for the [0.8.7 version in passing](http://findbugs.sourceforge.net/Changes.html) (look for '*New Style detector to find circular dependencies between classes*'), and I am not able to test it.
Update: It works now, and I had an old findbugs configuration file in which that option was not activated. I still like [CAD](https://stackoverflow.com/questions/62276/java-package-cycle-detection-how-to-find-the-specific-classes-involved#71610) though ;)
THE ANSWER is... see [my own (second) | [
0.14177212119102478,
-0.03336731716990471,
0.4749877154827118,
-0.09089232236146927,
0.001805251115001738,
-0.315971314907074,
0.22325818240642548,
0.005680709145963192,
-0.25357145071029663,
-0.7818019986152649,
0.10232489556074142,
0.3344793915748596,
-0.2820737361907959,
0.0526441819965... | |
answer below](https://stackoverflow.com/questions/62276/java-package-cycle-detection-how-to-find-the-specific-classes-involved#71610)
Findbugs can detect circular class dependencies and has an Eclipse plugin too.
<http://findbugs.sourceforge.net/> | [
-0.006279828958213329,
-0.12965121865272522,
0.21852919459342957,
0.04278026521205902,
-0.2139212042093277,
-0.27187687158584595,
0.1539955735206604,
-0.15559308230876923,
-0.2724451720714569,
-0.2730550765991211,
-0.07298444211483002,
0.4440036416053772,
-0.1755301058292389,
-0.2292429208... | |
The default check-in action for a work-item is "resolve". I'd like to set it to "associate" so that this work item isn't automaticaly closed if I check-in stuff too fast. How can I do that?
Yup, the check-in action can only be associated to a state transition (i.e. Active to Resolved). In my blog post that [Fredrick](https://stackoverflow.com/questions/62294/how-to-modify-the-defaul-check-in-action-in-tfs#62376) linked to (<http://www.woodwardweb.com/vsts/top_tfs_tip_3_r.html>) I talk about how to remove that. You'll need to customize the work item for everyone in your team project to make this happen. For help on that see
<http://msdn.microsoft.com/en-us/library/ms243849(VS.80).aspx> | [
-0.3385283946990967,
-0.2274908721446991,
0.23561783134937286,
-0.1120443120598793,
0.19271329045295715,
-0.23474541306495667,
0.4062120020389557,
-0.4627472758293152,
-0.32521718740463257,
-0.49366870522499084,
-0.38381052017211914,
0.6174220442771912,
-0.3878640830516815,
-0.301450043916... | |
In PHP, how can I replicate the expand/contract feature for Tinyurls as on search.twitter.com?
If you want to find out where a tinyurl is going, use fsockopen to get a connection to tinyurl.com on port 80, and send it an HTTP request like this
```
GET /dmsfm HTTP/1.0
Host: tinyurl.com
```
The response you get back will look like
```
HTTP/1.0 301 Moved Permanently
Connection: close
X-Powered-By: PHP/5.2.6
Location: http://en.wikipedia.org/wiki/TinyURL
Content-type: text/html
Content-Length: 0
Date: Mon, 15 Sep 2008 12:29:04 GMT
Server: TinyURL/1.6
```
example code...
```
<?php
$tinyurl="dmsfm";
$fp = fsockopen("tinyurl.com", 80, $errno, $errstr, 30);
if (!$fp) {
echo "$errstr ($errno)<br />\n";
} else {
$out = "GET /$tinyurl HTTP/1.0\r\n";
$out .= "Host: | [
-0.10134257376194,
-0.043327029794454575,
1.1462241411209106,
-0.1485983431339264,
-0.043919648975133896,
-0.08190739154815674,
0.052090924233198166,
-0.0059254528023302555,
-0.5114601254463196,
-0.43970799446105957,
-0.0870855376124382,
0.25686609745025635,
-0.17622888088226318,
0.1713475... | |
tinyurl.com\r\n";
$out .= "Connection: Close\r\n\r\n";
$response="";
fwrite($fp, $out);
while (!feof($fp)) {
$response.=fgets($fp, 128);
}
fclose($fp);
//now parse the Location: header out of the response
}
?>
``` | [
-0.09040448069572449,
-0.26290252804756165,
1.0240834951400757,
-0.22835130989551544,
0.657619833946228,
0.009926690720021725,
0.058022454380989075,
-0.06853817403316498,
-0.15965329110622406,
-0.47382640838623047,
-0.2390153557062149,
0.3409595787525177,
-0.42288437485694885,
0.2634860277... | |
My designer keeps throwing out the term "liquid" layout. What does this mean?
**Thanks for the clarification, I have always just called this a percentage layout, and thought he was saying that the pieces could be moved around, and that was liquid**
A "liquid" layout is a site layout that expands to fill the entire available area as the browser window is resized. Typically this is done using CSS. Liquid layouts can be quite helpful for certain types of sites, but they also tend to be significantly more effort than fixed width layouts, and their usefulness depends on the site content and | [
0.4582710564136505,
-0.15600423514842987,
0.3028307259082794,
0.08121182769536972,
0.1615239530801773,
-0.08383005112409592,
-0.1671779900789261,
0.1580856740474701,
-0.48297739028930664,
-0.8099852800369263,
-0.29166173934936523,
0.23442138731479645,
-0.005269839894026518,
0.3602237105369... | |
how well implemented they are. | [
0.3827109932899475,
0.318268358707428,
-0.00038764532655477524,
0.09940649569034576,
0.0715896338224411,
-0.11093445122241974,
0.08997537195682526,
-0.008269194513559341,
-0.15181100368499756,
-0.631035327911377,
0.01099399197846651,
0.4398597180843353,
0.46269387006759644,
-0.125366300344... | |
I might be missing something really obvious. I'm trying to write a custom Panel where the contents are laid out according to a couple of dependency properties (I'm assuming they *have* to be DPs because I want to be able to animate them.)
However, when I try to run a storyboard to animate both of these properties, Silverlight throws a Catastophic Error. But if I try to animate just one of them, it works fine. And if I try to animate one of my properties and a 'built-in' property (like Opacity) it also works. But if I try to animate both | [
0.432552695274353,
0.2025466114282608,
0.05458035320043564,
0.3412042260169983,
0.03516039997339249,
0.007761738728731871,
0.18686111271381378,
-0.017253749072551727,
-0.2521231174468994,
-0.6516309380531311,
0.06013864651322365,
0.35881659388542175,
0.09152655303478241,
0.2497325986623764... | |
my custom properties I get the Catastrophic error.
Anyone else come across this?
edit:
The two DPs are ScaleX and ScaleY - both doubles. They scale the X and Y position of children in the panel. Here's how one of them is defined:
```
public double ScaleX
{
get { return (double)GetValue(ScaleXProperty); }
set { SetValue(ScaleXProperty, value); }
}
/// <summary>
/// Identifies the ScaleX dependency property.
/// </summary> | [
0.4045203626155853,
-0.3143145740032196,
0.59597247838974,
0.03846533223986626,
-0.11471056193113327,
0.5268581509590149,
-0.12177542597055435,
-0.3522264361381531,
-0.3677145838737488,
-0.9212350845336914,
0.024789590388536453,
0.4386371076107025,
-0.015551866963505745,
0.3292649984359741... | |
public static readonly DependencyProperty ScaleXProperty =
DependencyProperty.Register(
"ScaleX",
typeof(double),
typeof(MyPanel), | [
0.05263257026672363,
-0.1196247786283493,
0.39872124791145325,
-0.031611762940883636,
0.28437408804893494,
0.3717554807662964,
0.2469605654478073,
-0.031363554298877716,
-0.2242686152458191,
-0.6580464839935303,
-0.18348762392997742,
0.45673009753227234,
-0.4791513681411743,
0.242550849914... | |
new PropertyMetadata(OnScaleXPropertyChanged));
/// <summary>
/// ScaleXProperty property changed handler.
/// </summary>
/// <param name="d">MyPanel that changed its ScaleX.</param>
/// <param name="e">DependencyPropertyChangedEventArgs.</param>
private static void OnScaleXPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
MyPanel _MyPanel = d as MyPanel;
if (_MyPanel != null)
{ | [
0.03216084837913513,
-0.3853705823421478,
0.5090844035148621,
-0.0032438309863209724,
0.2503681778907776,
0.18312595784664154,
0.019233085215091705,
-0.5770834684371948,
-0.15977613627910614,
-0.724169909954071,
-0.28724050521850586,
0.47808516025543213,
-0.32788175344467163,
0.41944125294... | |
_MyPanel.InvalidateArrange();
}
}
public static void SetScaleX(DependencyObject obj, double val)
{
obj.SetValue(ScaleXProperty, val);
}
public static double GetScaleX(DependencyObject obj)
{
return (double)obj.GetValue(ScaleXProperty);
}
```
Edit: I've tried it with and without the call to InvalidateArrange (which is absolutely necessary in any case) and the result is the same. The event handler doesn't even | [
0.1604124903678894,
-0.08990689367055893,
0.402861088514328,
-0.1649937480688095,
0.3090943992137909,
0.16012047231197357,
0.33079099655151367,
-0.19319763779640198,
-0.31258559226989746,
-0.5671201348304749,
-0.23338337242603302,
0.5902858376502991,
-0.3018920421600342,
0.1084434166550636... | |
get called before the Catastrophic error kicks off.
It's a documented bug with Silverlight 2 Beta 2. You can't animate two custom dependancy properties on the same object. | [
0.47344860434532166,
-0.15543124079704285,
0.17822439968585968,
0.1477137953042984,
0.23644258081912994,
-0.5104268789291382,
0.2790556848049164,
0.14540669322013855,
0.10182847827672958,
-0.5216661095619202,
-0.11068978905677795,
0.6447844505310059,
-0.47141820192337036,
-0.04125503450632... | |
I am overriding a lot of SAP's Portal functionality in my current project. I have to create a custom fixed width framework, custom iView trays, custom KM API functionality, and more.
With all of these custom parts, I will not be using a lot of the style functionality implemented by SAP's Theme editor. What I would like to do is create an external CSS, store it outside of the Portal and reference it. Storing externally will allow for easier updates rather than storing the CSS within a portal application. It would also allow for all custom pieces to have their styles | [
0.6199283599853516,
0.2506406009197235,
0.3194587230682373,
0.0037962300702929497,
-0.2255779355764389,
-0.11287893354892731,
0.25946223735809326,
0.16112969815731049,
-0.11925777792930603,
-0.6339588165283203,
-0.11693545430898666,
0.02548551931977272,
-0.04943356290459633,
0.275407493114... | |
in once place.
Unfortunately, I've not found a way to gain access to the HEAD portion of the page that allows me to insert an external stylesheet. Portal Applications can do so using the IResource object to gain access to internal references, but not items on another server.
I'm looking for any ideas that would allow me to gain this functionality. I have [x-posted on SAP's SDN](https://www.sdn.sap.com/irj/sdn/thread?threadID=1046064&tstart=0), but I suspect I'll get a better answer here.
I'd consider it dirty hack, but as a non-Portal developer I'd consider using JavaScript to insert a new link element in the head pointing to your new | [
0.5764403939247131,
0.08153707534074783,
0.5583527684211731,
0.1714322417974472,
-0.21133950352668762,
-0.059172943234443665,
0.08367658406496048,
0.17271758615970612,
-0.05578368157148361,
-0.6809402108192444,
0.117676742374897,
-0.21472451090812683,
-0.023176249116659164,
0.5493819713592... | |
CSS file. Of course you'd have a flash of un-styled content because the script probably won't run until after part of the page has been downloaded and rendered, but it may be an adequate solution. | [
0.35616371035575867,
0.0937112420797348,
0.3135710060596466,
0.42427507042884827,
0.1046973243355751,
-0.3128068149089813,
0.11490926146507263,
0.2967323064804077,
-0.22535622119903564,
-0.40344518423080444,
-0.3847447335720062,
0.2938195765018463,
-0.08238065987825394,
-0.0343133844435215... | |
I am having a problem with the speed of accessing an association property with a large number of records.
I have an XAF app with a parent class called `MyParent`.
There are 230 records in `MyParent`.
`MyParent` has a child class called `MyChild`.
There are 49,000 records in `MyChild`.
I have an association defined between `MyParent` and `MyChild` in the standard way:
In `MyChild`:
```
// MyChild (many) and MyParent (one)
[Association("MyChild-MyParent")]
public MyParent MyParent;
```
And in `MyParent`:
```
[Association("MyChild-MyParent", typeof(MyChild))]
public XPCollection<MyCHild> MyCHildren
{
get { return GetCollection<MyCHild>("MyCHildren"); }
}
```
There's a specific `MyParent` record called `MyParent1`.
For `MyParent1`, there are 630 `MyChild` records.
I have a DetailView for a class called `MyUI`.
The user | [
0.11717057228088379,
0.49605339765548706,
0.4013363718986511,
0.10656637698411942,
0.1588851511478424,
0.48703765869140625,
0.1403316855430603,
0.03412552550435066,
0.026113975793123245,
-0.6069815754890442,
0.30989551544189453,
0.3456818759441376,
0.06640535593032837,
0.5511560440063477,
... | |
chooses an item in one drop-down in the `MyUI` DetailView, and my code has to fill another drop-down with `MyChild` objects.
The user chooses `MyParent1` in the first drop-down.
I created a property in `MyUI` to return the collection of `MyChild` objects for the selected value in the first drop-down.
Here is the code for the property:
```
[NonPersistent]
public XPCollection<MyChild> DisplayedValues
{
get
{
Session theSession;
MyParent theParentValue;
XPCollection<MyCHild> theChildren;
theParentValue = | [
0.06882844865322113,
0.15032106637954712,
0.36270517110824585,
0.13570600748062134,
0.11587051302194595,
0.33308449387550354,
0.3013157844543457,
-0.1594347357749939,
0.0723230242729187,
-0.606984555721283,
-0.22640790045261383,
0.5019897222518921,
0.17903576791286469,
0.2495492696762085,
... | |
this.DropDownOne;
// get the parent value
if theValue == null)
{
// if none
return null;
// return null
}
theChildren = theParentValue.MyChildren;
// get | [
0.12364259362220764,
-0.19604848325252533,
0.43983179330825806,
-0.1290406882762909,
0.37046709656715393,
0.13721825182437897,
0.5075006484985352,
-0.1431334912776947,
-0.05370761826634407,
-0.35525864362716675,
-0.23633164167404175,
0.2843082845211029,
-0.026254763826727867,
0.28771117329... | |
the child values for the parent
return theChildren;
// return it
}
```
I marked the `DisplayedValues` property as `NonPersistent` because it is only needed for the UI of the DetailVIew. I don't think that persisting it will speed up the creation of the collection the first time, and after it's used to fill the drop-down, I don't need it, so I don't want to spend time storing it.
The problem is that it takes 45 seconds to call `theParentValue = this.DropDownOne`.
Specs:
* Vista Business
* 8 GB | [
0.23869986832141876,
0.06109859421849251,
0.5321183204650879,
0.09518558531999588,
0.5147296786308289,
0.027521928772330284,
0.4088779091835022,
-0.16393610835075378,
-0.02328827604651451,
-0.6924826502799988,
-0.1885976940393448,
0.7838718891143799,
0.1297154426574707,
0.33177945017814636... | |
of RAM
* 2.33 GHz E6550 processor
* SQL Server Express 2005
This is too long for users to wait for one of many drop-downs in the DetailView.
I took the time to sketch out the business case because I have two questions:
1. How can I make the associated values load faster?
2. Is there another (simple) way to program the drop-downs and DetailView that runs much faster?
Yes, you can say that 630 is too many items to display in a drop-down, but this code is taking so long I suspect that the speed is proportional to the 49,000 and not to the 630. 100 | [
0.059530109167099,
0.28960153460502625,
0.60450679063797,
0.10880354791879654,
-0.057430148124694824,
0.04794348403811455,
0.3268369138240814,
-0.395210325717926,
-0.47017255425453186,
-0.420723557472229,
0.13889367878437042,
0.8661417365074158,
0.1413622796535492,
-0.10651993751525879,
... | |
items in the drop-down would not be too many for my app.
I need quite a few of these drop-downs in my app, so it's not appropriate to force the user to enter more complicated filtering criteria for each one. The user needs to pick one value and see the related values.
I would understand if finding a large number of records was slow, but finding a few hundred shouldn't take that long.
Firstly you are right to be sceptical that this operation should take this long, XPO on read operations should add only between 30 - 70% overhead, and on this tiny | [
0.2766905426979065,
-0.10701733827590942,
0.33891791105270386,
0.5284275412559509,
0.11799763888120651,
0.2440337985754013,
-0.00642745615914464,
-0.3867078125476837,
-0.30970242619514465,
-0.1791539490222931,
0.04168257117271423,
0.4542417526245117,
-0.035304684191942215,
-0.0570065043866... | |
amount of data we should be talking milli-seconds not seconds.
Some general perf tips are available in the DevExpress forums, and centre around object caching, lazy vs deep loads etc, but I think in your case the issue is something else, unfortunately its very hard to second guess whats going on from your question, only to say, its highly unlikely to be a problem with XPO much more likely to be something else, I would be inclined to look at your session creation (this also creates your object cache) and SQL connection code (the IDataStore stuff), Connections are often slow if | [
0.5250062942504883,
-0.05230877175927162,
0.09255163371562958,
0.6533200144767761,
-0.316715806722641,
-0.35276612639427185,
0.369152694940567,
0.09042960405349731,
-0.4126089811325073,
-0.4938729405403137,
0.34668076038360596,
0.6900538802146912,
0.07958965748548508,
0.23112966120243073,
... | |
hosts cannot not be resolved cleanly and if you are not pooling / re-using connections this problem can be exacerbated. | [
0.03664720430970192,
0.07369480282068253,
0.10342592746019363,
0.42646005749702454,
0.07426107674837112,
-0.22789330780506134,
0.40274083614349365,
0.17723479866981506,
-0.43881821632385254,
-0.7808731198310852,
-0.11216090619564056,
-0.07229850441217422,
-0.4862463176250458,
0.48428699374... | |
When using the Net.Sockets.TcpListener, what is the best way to handle incoming connections (.AcceptSocket) in seperate threads?
The idea is to start a new thread when a new incoming connection is accepted, while the tcplistener then stays available for further incoming connections (and for every new incoming connection a new thread is created). All communication and termination with the client that originated the connection will be handled in the thread.
Example C# of VB.NET code is appreciated.
The code that I've been using looks like this:
```
class Server
{
private AutoResetEvent connectionWaitHandle = new AutoResetEvent(false);
public void Start()
{ | [
0.19871357083320618,
-0.21060438454151154,
0.292740136384964,
-0.09785372763872147,
-0.06377779692411423,
-0.1166534349322319,
0.09061755239963531,
-0.11730887740850449,
-0.3170228898525238,
-0.6722557544708252,
-0.03282113000750542,
0.5416080355644226,
-0.38064074516296387,
0.453503519296... | |
TcpListener listener = new TcpListener(IPAddress.Any, 5555);
listener.Start();
while(true)
{
IAsyncResult result = listener.BeginAcceptTcpClient(HandleAsyncConnection, listener);
connectionWaitHandle.WaitOne(); // Wait until a client has begun handling an event
connectionWaitHandle.Reset(); // Reset wait handle or the loop goes as fast as it can (after first request)
}
}
private void HandleAsyncConnection(IAsyncResult result)
{
TcpListener listener = (TcpListener)result.AsyncState;
TcpClient client = listener.EndAcceptTcpClient(result);
connectionWaitHandle.Set(); //Inform the | [
0.0678756982088089,
-0.28065815567970276,
0.8436930775642395,
-0.2621876001358032,
0.21928583085536957,
0.08535228669643402,
0.461597740650177,
-0.4696647822856903,
-0.30626407265663147,
-0.44993361830711365,
-0.2558634281158447,
0.5058259963989258,
-0.3521839380264282,
0.17830312252044678... | |
main thread this connection is now handled
//... Use your TcpClient here
client.Close();
}
}
``` | [
0.2820412218570709,
0.0009694680338725448,
0.7341817617416382,
-0.008159727789461613,
0.23510609567165375,
-0.417373389005661,
0.1679963767528534,
0.4635477662086487,
-0.315656453371048,
-0.2772645354270935,
-0.026688475161790848,
0.4510272443294525,
-0.3805791735649109,
0.7897360920906067... | |
Nokia has stopped offering its Developer's Suite, relying on other IDEs, including Eclipse. Meanwhile, Nokia changed its own development tools again and EclipseMe has also changed. This leaves most documentation irrelevant.
I want to know what does it take to make a simple Hello-World?
(I already found out myself, so this is a Q&A for other people to use)
Here's what's needed to make a simple hello world -
1. Get [Eclipse](http://www.eclipse.org/downloads/) IDE for Java. I used Ganymede. Set it up.
2. Get Sun's [Wireless Toolkit](http://java.sun.com/products/sjwtoolkit/download.html). I used 2.5.2. Install it.
3. Get Nokia's SDK ([found here](http://developers.nokia.com/info/sw.nokia.com/id/cc48f9a1-f5cf-447b-bdba-c4d41b3d05ce/Series_40_Platform_SDKs.html)), in my case for S40 6230i Edition, and | [
-0.07486577332019806,
0.2429620623588562,
0.43913233280181885,
-0.18733909726142883,
-0.31391945481300354,
0.03863728046417236,
0.6858623027801514,
-0.30507326126098633,
0.14375047385692596,
-0.3562214970588684,
-0.05693362280726433,
0.39799734950065613,
-0.2843691110610962,
-0.01697699725... | |
install it choosing the option to **integrate with Sun's WTK**
4. Follow the instructions at <http://www.eclipseme.org/> to download and install Mobile Tools Java (MTJ). I used version 1.7.9.
5. When configuring devices profiles in MTJ (inside Eclipse) use the Nokia device from the WTK folder and NOT from Nokia's folder.
6. Set the WTK root to the main installation folder - for instance c:\WTK2.5.2; Note that the WTK installer creates other folders apparently for backward compatibility.
7. Get [Antenna](http://antenna.sourceforge.net/) and set its location in MTJ's property page (in Eclipse).
[Here's an HelloWorld sample to test the configuration.](http://wiki.forum.nokia.com/index.php/Hello_World_in_Java_ME)
Note: It worked for me on WindowsXP.
Also note: This | [
0.555915355682373,
-0.24470274150371552,
0.4843257665634155,
-0.2659992575645447,
-0.16021648049354553,
-0.17922547459602356,
0.37860172986984253,
-0.295782208442688,
0.23289331793785095,
-0.5376256704330444,
-0.12024494260549545,
0.5208090543746948,
-0.19826345145702362,
-0.23465803265571... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.