instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'm using JavaScript to hide an image and show some text thats hidden under it. But, when the text is shown if you scroll over it, it fires the mouseout event on the container, that then hides the text and shows the image again, and it just goes into a weird loop. The html looks like this: <div onmouseover="jsHoverIn('...
It sounds like the issue you're facing is a classic problem with hover behavior in JavaScript when switching visibility between elements. When you show the text, the mouse moves over it, triggering the `mouseout` event of the parent container, which immediately hides the text again, creating an infinite loop of showing...
14,100
[ { "from": "human", "value": "I'm using JavaScript to hide an image and show some text thats hidden under it. But, when the text is shown if you scroll over it, it fires the mouseout event on the container, that then hides the text and shows the image again, and it just goes into a weird loop.\nThe html look...
Does anyone know how to get/set the call divert settings in codes running on Windows mobile 5/6? I am new to windows mobile development and wonder if there is anyway to do it using C# and .NET CF?
Setting and getting call divert settings in Windows Mobile 5/6 is not a straightforward task, as there is no direct API provided in .NET Compact Framework (CF) to manipulate call settings, including call diverts. However, you can interact with the phone system by invoking native APIs through P/Invoke. ### Approach: 1....
12,324
[ { "from": "human", "value": "Does anyone know how to get/set the call divert settings in codes running on Windows mobile 5/6? I am new to windows mobile development and wonder if there is anyway to do it using C# and .NET CF?\n" }, { "from": "gpt", "value": "Setting and getting call divert setti...
I can't figure out a use case for being able to annotate interfaces in Java. Maybe someone could give me an example?
Certainly! Annotating interfaces in Java can be quite useful, especially in scenarios where you want to define metadata or provide additional information that can be used by tools, frameworks, or at runtime. Here are some examples of use cases where you might want to annotate interfaces: ### 1. **Marking Interfaces fo...
11,851
[ { "from": "human", "value": "I can't figure out a use case for being able to annotate interfaces in Java. \nMaybe someone could give me an example?\n" }, { "from": "gpt", "value": "Certainly! Annotating interfaces in Java can be quite useful, especially in scenarios where you want to define meta...
I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this: file = File.open("path-to-file.tar.gz") contents = "" file.each {|line| contents << line } I thought that would be enough to convert it to a string, but then when I try to...
The issue you're experiencing comes from the way you're reading the file. When you use `File.open` with the default mode, it reads the file as text, which can mess up binary files like tar.gz files. You need to open the file in binary mode to ensure that all the bytes are read correctly. Here's how you can read a tar ...
15,644
[ { "from": "human", "value": "I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this:\nfile = File.open(\"path-to-file.tar.gz\")\ncontents = \"\"\nfile.each {|line|\n contents << line\n}\n\nI thought that would be enou...
I want to talk to a flash server which uses RTMP, but I don't want to use Flash, but rather c# or java. I was looking at Red5 but their client API seems to be a bit wobbly. Does anyone have any other ideas?
If you're looking to communicate with an RTMP server without using Flash, both C# and Java have libraries that can help you with RTMP communication. Here are a few options you might consider: ### For C# 1. **RTMP.NET**: - This is a .NET library for RTMP communication. It provides a way to connect and interact with...
15,992
[ { "from": "human", "value": "I want to talk to a flash server which uses RTMP, but I don't want to use Flash, but rather c# or java.\nI was looking at Red5 but their client API seems to be a bit wobbly.\nDoes anyone have any other ideas?\n" }, { "from": "gpt", "value": "If you're looking to comm...
I just set up my new homepage at http://ritter.vg. I'm using jQuery, but very minimally. It loads all the pages using AJAX - I have it set up to allow bookmarking by detecting the hash in the URL. //general functions function getUrl(u) { return u + '.html'; } function loadURL(u) { $.get(getUrl(u),...
Yes, you can handle the back and forward button navigation by using the `hashchange` event in JavaScript. This event is triggered whenever the hash part of the URL changes (which happens when the user navigates using the back or forward buttons). Here's how you can modify your existing code to include this functionalit...
16,274
[ { "from": "human", "value": "I just set up my new homepage at http://ritter.vg. I'm using jQuery, but very minimally.\nIt loads all the pages using AJAX - I have it set up to allow bookmarking by detecting the hash in the URL. \n //general functions\n function getUrl(u) {\n return u + '.html';\n }\n ...
There is a way to keep the scroll on bottom for a multi line textbox? Something like in the vb6 txtfoo.selstart=len(txtfoo.text) I'm trying with txtfoo.selectionstart=txtfoo.text.length without success. Regards.
To keep a multiline text box scrolled to the bottom in a Windows Forms application (using C#), you can achieve this by setting the `SelectionStart` property followed by the `ScrollToCaret` method. This is often used to keep the scroll position at the bottom as new lines of text are added. Here is how you can do it in ...
16,213
[ { "from": "human", "value": "There is a way to keep the scroll on bottom for a multi line textbox?\nSomething like in the vb6 \ntxtfoo.selstart=len(txtfoo.text)\n\nI'm trying with txtfoo.selectionstart=txtfoo.text.length without success.\nRegards.\n" }, { "from": "gpt", "value": "To keep a multi...
OK, I have been working on a random image selector and queue system (so you don't see the same images too often). All was going swimmingly (as far as my crappy code does) until I got to the random bit. I wanted to test it, but how do you test for it? There is no Debug.Assert(i.IsRandom) (sadly) :D So, I got my brain on...
Your approach to testing the random image selector and queue system is quite reasonable, especially considering the challenge of verifying randomness in your application. Here's a breakdown of your methodology, along with some suggestions and considerations: ### Your Approach 1. **Delegate for Randomness**: By extrac...
11,805
[ { "from": "human", "value": "OK, I have been working on a random image selector and queue system (so you don't see the same images too often).\nAll was going swimmingly (as far as my crappy code does) until I got to the random bit. I wanted to test it, but how do you test for it? There is no Debug.Assert(i....
We're running SQL 2005 standard SP2 on a 4cpu box. Suddenly it crashdumps, after which all pooled connections are invalid and it goes into admin-only mode (only sa can connect) The short stackdump is below. After the dump a number of errors show up like '2008-09-16 10:49:34.48 Server Resource Monitor (0xec4) Worke...
The error message and stack dump you've provided indicate that your SQL Server 2005 instance encountered a crash due to a non-yielding resource monitor. This can happen due to various reasons, such as resource contention, insufficient memory, bugs in SQL Server, or issues related to the underlying hardware. Here are s...
14,947
[ { "from": "human", "value": "We're running SQL 2005 standard SP2 on a 4cpu box. Suddenly it crashdumps, after which all pooled connections are invalid and it goes into admin-only mode (only sa can connect)\nThe short stackdump is below. After the dump a number of errors show up like '2008-09-16 10:49:34.48 ...
Is there a tool/plugin/function for Firefox that'll dump out a memory usage of Javascript objects that you create in a page/script? I know about Firebug's profiler but I'd like something more than just times. Something akin to what Yourkit has for Java profiling of memory usage. Reason is that a co-worker is using id's...
Firefox provides a built-in tool called the **Firefox Developer Tools** (accessible by pressing F12 or right-clicking on a page and selecting "Inspect") that includes a **Memory** panel. This panel allows you to analyze the memory usage of JavaScript objects and see how much memory your application is using. Here are...
14,921
[ { "from": "human", "value": "Is there a tool/plugin/function for Firefox that'll dump out a memory usage of Javascript objects that you create in a page/script? I know about Firebug's profiler but I'd like something more than just times. Something akin to what Yourkit has for Java profiling of memory usage....
Has anyone had any recent requirements for programming automated DOS Batch style tasks on a Windows box? I've got some automation to do and I'd rather not sit and write a pile of .BAT files in Notepad if there is a better way of automating these tasks: mainly moving of files under certain date and time conditions, as w...
There are several approaches you could take to automate DOS Batch style tasks on a Windows system, especially if you want to avoid the potential pitfalls of writing .BAT files in a text editor without any syntax highlighting or checking. Here are a few options to consider: ### 1. PowerShell PowerShell is a powerful sc...
12,167
[ { "from": "human", "value": "Has anyone had any recent requirements for programming automated DOS Batch style tasks on a Windows box?\nI've got some automation to do and I'd rather not sit and write a pile of .BAT files in Notepad if there is a better way of automating these tasks: mainly moving of files un...
I believe strongly in using unit-tests as part of building large multi-platform applications. We currently are planning on having our unit-tests within a separate project. This has the benefit of keeping our code base clean. I think, however, that this would separate the test code from the implementation of the unit. W...
Your approach to keeping unit tests in a separate project is a common one and has both advantages and disadvantages. Here are some points to consider: ### Advantages of Separate Unit Test Projects: 1. **Clean Codebase**: Keeping test code separate helps maintain a cleaner implementation codebase, making it easier for ...
12,353
[ { "from": "human", "value": "I believe strongly in using unit-tests as part of building large multi-platform applications. We currently are planning on having our unit-tests within a separate project. This has the benefit of keeping our code base clean. I think, however, that this would separate the test co...
I'm trying to lightbox a page containing a SWF via the nifty AJAX feature in Facebox (for jQuery). The trouble is that the paths now work relative to the main index page, not the directory that houses the flash page. Here's a directory breakdown: ./   - index.html (loads projects/projectName/index.html)   + js/       +...
When you're dealing with relative paths in a situation like this, there are a couple of options you can use to manage the paths correctly when loading content via AJAX. ### 1. Use Absolute Paths The simplest way to ensure your paths are always resolved correctly is to use absolute paths in your HTML file. Instead of...
14,605
[ { "from": "human", "value": "I'm trying to lightbox a page containing a SWF via the nifty AJAX feature in Facebox (for jQuery). The trouble is that the paths now work relative to the main index page, not the directory that houses the flash page. Here's a directory breakdown:\n./\n  - index.html (loads proje...
What are ways of eliminating the use of switch statements in code?
Eliminating the use of switch statements in code can lead to cleaner, more maintainable, and often more extensible code. Here are several strategies to achieve this: 1. **Polymorphism**: Instead of using switch statements to select different behaviors, you can use polymorphism. Create a base class and have subclasses ...
11,013
[ { "from": "human", "value": "What are ways of eliminating the use of switch statements in code?\n" }, { "from": "gpt", "value": "Eliminating the use of switch statements in code can lead to cleaner, more maintainable, and often more extensible code. Here are several strategies to achieve this:\n...
When I load script/console, sometimes I want to play with the output of a controller or a view helper method. Are there ways to: simulate a request? call methods from a controller instance on said request? test helper methods, either via said controller instance or another way?
Yes, in a Ruby on Rails application, you can definitely simulate requests and call methods from controllers and helpers when you're in the Rails console. Here's how you can accomplish each of your tasks: ### 1. Simulating a Request You can simulate a request in Rails using the `ActionController::TestCase::Process` mo...
15,437
[ { "from": "human", "value": "When I load script/console, sometimes I want to play with the output of a controller or a view helper method.\nAre there ways to:\n\nsimulate a request?\ncall methods from a controller instance on said request?\ntest helper methods, either via said controller instance or another...
After having implemented the strategy pattern, I wanted to make an array of the interface-type, to which I can then add any concrete type. For those who don't know the strategy pattern: http://en.wikipedia.org/wiki/Strategy_pattern In this particular example I would want to make a StrategyInterface array, which I can ...
Yes, it is possible to create an array of an interface type and fill it with concrete implementations of that interface in the Strategy pattern. The key is to ensure that your concrete classes implement the interface correctly. Let’s break this down step by step with an example. ### Step 1: Define the Strategy Interfa...
14,936
[ { "from": "human", "value": "After having implemented the strategy pattern, I wanted to make an array of the interface-type, to which I can then add any concrete type. \nFor those who don't know the strategy pattern:\nhttp://en.wikipedia.org/wiki/Strategy_pattern\nIn this particular example I would want to ...
I'd like to add some functionality to a site that would allow users to record video using their webcam and easily store it online. I don't even know if this is possible right now, but I think flash has access to local webcams running through the browser. Do you have any suggestions or resources to get me started on thi...
Recording video directly from a user's webcam and streaming it to a server is indeed possible, but there are better technologies than Java applets or Flash, as both of these are outdated and not widely supported in modern web browsers. Here's a modern approach using **WebRTC** and **MediaStream** API, which are part o...
8,912
[ { "from": "human", "value": "I'd like to add some functionality to a site that would allow users to record video using their webcam and easily store it online. I don't even know if this is possible right now, but I think flash has access to local webcams running through the browser.\nDo you have any suggest...
I'm still learning RegEx at the moment, but for the time being could someone help me out with this? I have a few special requirements for formatting the string: No directories. JUST the file name. File name needs to be all lowercase. Whitespaces need to be replaced with underscores. Shouldn't be hard, but I'm press...
Sure! To help you format a string according to your requirements, we can use a regular expression (RegEx) along with some string manipulation in Python. Below are the steps we will take to achieve this: 1. Extract the file name from the input string. 2. Convert the file name to lowercase. 3. Replace whitespaces with u...
15,134
[ { "from": "human", "value": "I'm still learning RegEx at the moment, but for the time being could someone help me out with this? I have a few special requirements for formatting the string:\n\nNo directories. JUST the file name.\nFile name needs to be all lowercase.\nWhitespaces need to be replaced with u...
I'm setting up a Jabber server for my website. I've already got some user accounts in place in the openfire database, and working IMs between them. I'm now looking to add (some) of the users from my main database (members table, with login, password[plain text]) and allowed_to_IM[0 or 1] fields) to allow them to commu...
Setting up hybrid authentication in Openfire to connect to multiple databases can be a bit tricky, especially if the documentation is sparse. Below, I'll provide a more complete example of how to configure Openfire to authenticate users from both the Openfire database and a separate database containing your main users....
6,448
[ { "from": "human", "value": "I'm setting up a Jabber server for my website. I've already got some user accounts in place in the openfire database, and working IMs between them.\nI'm now looking to add (some) of the users from my main database (members table, with login, password[plain text]) and allowed_to...
I have a client who wants a solution to allow delivery people to text (SMS messaging) in that they have completed a pick up at a particular location. What I'm looking for is Code to read an imbound SMS message or a SMS component if appropiate. This would allow me to create a windows service to read the message and upd...
To create a solution for reading inbound SMS messages and updating a SQL record, you can use several tools and APIs, such as Twilio for SMS handling and .NET for creating the Windows service. Below is a high-level outline of the steps you need to take, along with sample code for each part. ### Steps to Create the Solu...
8,795
[ { "from": "human", "value": "I have a client who wants a solution to allow delivery people to text (SMS messaging) in that they have completed a pick up at a particular location. What I'm looking for is Code to read an imbound SMS message or a SMS component if appropiate. This would allow me to create a wi...
How do I find the name of the namespace or module 'Foo' in the filter below? class ApplicationController < ActionController::Base def get_module_name @module_name = ??? end end class Foo::BarController < ApplicationController before_filter :get_module_name end
In Ruby on Rails, to determine the namespace or module name of a class, you can use the `Module.nesting` method or the `self` keyword along with the `Module` class. Here’s how you can implement the `get_module_name` method in your `ApplicationController` to find the name of the module for the class `Foo::BarController`...
13,766
[ { "from": "human", "value": "How do I find the name of the namespace or module 'Foo' in the filter below?\nclass ApplicationController < ActionController::Base\n def get_module_name\n @module_name = ???\n end\nend\n\n\nclass Foo::BarController < ApplicationController\n before_filter :get_module_name\n...
Inspired by another question asking about the missing Zip function: Why is there no ForEach extension method on the IEnumerable interface? Or anywhere? The only class that gets a ForEach method is List<>. Is there a reason why it's missing, maybe performance?
The absence of a `ForEach` extension method on the `IEnumerable<T>` interface in C# is primarily due to design philosophy, performance considerations, and the nature of the `IEnumerable<T>` interface itself. ### Reasons for the Absence of `ForEach` on `IEnumerable<T>` 1. **Interface Definition**: - `IEnumerable<T>...
12,368
[ { "from": "human", "value": "Inspired by another question asking about the missing Zip function:\nWhy is there no ForEach extension method on the IEnumerable interface? Or anywhere? The only class that gets a ForEach method is List<>. Is there a reason why it's missing, maybe performance?\n" }, { "f...
I am writing a custom maven2 MOJO. I need to access the runtime configuration of another plugin, from this MOJO. What is the best way to do this?
Accessing the runtime configuration of another Maven plugin (MOJO) from your own custom Mojo can be challenging because Maven does not directly expose the configuration of one plugin to another. However, you can achieve this using a few different strategies: ### 1. **Use the Maven Plugin API** You can use the Maven ...
10,231
[ { "from": "human", "value": "I am writing a custom maven2 MOJO. I need to access the runtime configuration of another plugin, from this MOJO.\nWhat is the best way to do this?\n" }, { "from": "gpt", "value": "Accessing the runtime configuration of another Maven plugin (MOJO) from your own custom...
I'm trying to create a Palm OS app to check a web site every X minutes or hours, and provide a notification when a piece of data is available. I know that this kind of thing can be done on the new Palm's - for example, my Centro can have email or web sites download when the application isn't on top - but I don't know ...
Creating a Palm OS application that checks a website periodically for updates requires a few steps. Here's a guide to get you started: ### 1. **Understanding Palm OS Development** Before you start, you need to ensure you have a suitable development environment for Palm OS: - **Development Tools**: You will need a Pa...
8,903
[ { "from": "human", "value": "I'm trying to create a Palm OS app to check a web site every X minutes or hours, and provide a notification when a piece of data is available. I know that this kind of thing can be done on the new Palm's - for example, my Centro can have email or web sites download when the app...
What is the best approach to synchronizing a DataSet with data in a database? Here are the parameters: We can't simply reload the data because it's bound to a UI control which a user may have configured (it's a tree grid that they may expand/collapse) We can't use a changeflag (like a UpdatedTimeStamp) in the databas...
Synchronizing a DataSet with data from a database, especially under the constraints you've outlined, is a challenging scenario. Here are some strategies you might consider for efficiently keeping your DataSet in sync with the database while respecting the user's current UI state and preventing data loss: ### 1. **Use ...
14,005
[ { "from": "human", "value": "What is the best approach to synchronizing a DataSet with data in a database? Here are the parameters: \n\nWe can't simply reload the data because it's bound to a UI control which a user may have configured (it's a tree grid that they may expand/collapse)\nWe can't use a changef...
How do I lock compiled Java classes to prevent decompilation? I know this must be very well discussed topic on the Internet, but I could not come to any conclusion after referring them. Many people do suggest obfuscator, but they just do renaming of classes, methods, and fields with tough-to-remember character sequence...
You're right that protecting Java code from decompilation is a significant concern for many developers, particularly when sensitive information or intellectual property is involved. Let's look at various strategies you can employ to make it more difficult to reverse engineer your Java applications: ### 1. **Code Obfus...
10,951
[ { "from": "human", "value": "How do I lock compiled Java classes to prevent decompilation?\nI know this must be very well discussed topic on the Internet, but I could not come to any conclusion after referring them.\nMany people do suggest obfuscator, but they just do renaming of classes, methods, and field...
I am trying to use the import random statement in python, but it doesn't appear to have any methods in it to use. Am I missing something?
The `import random` statement in Python is used to include the `random` module, which provides a variety of functions for generating random numbers and selecting random items. If you've imported the `random` module and find that it doesn't seem to have any methods available, it's possible that you might not be using it...
13,618
[ { "from": "human", "value": "I am trying to use the import random statement in python, but it doesn't appear to have any methods in it to use.\nAm I missing something?\n" }, { "from": "gpt", "value": "The `import random` statement in Python is used to include the `random` module, which provides ...
I am experimenting with using the FaultException and FaultException<T> to determine the best usage pattern in our applications. We need to support WCF as well as non-WCF service consumers/clients, including SOAP 1.1 and SOAP 1.2 clients. FYI: using FaultExceptions with wsHttpBinding results in SOAP 1.2 semantics wherea...
It sounds like you're encountering some of the well-known idiosyncrasies of WCF (Windows Communication Foundation) when dealing with fault handling, especially with respect to how faults are serialized in SOAP 1.1 vs. SOAP 1.2. The behavior you're observing is indeed not what you would expect based on the SOAP specific...
11,937
[ { "from": "human", "value": "I am experimenting with using the FaultException and FaultException<T> to determine the best usage pattern in our applications. We need to support WCF as well as non-WCF service consumers/clients, including SOAP 1.1 and SOAP 1.2 clients.\nFYI: using FaultExceptions with wsHttpBi...
Is there a way to trigger a beep/alarm/sound when my breakpoint is hit? I'm using Visual Studio 2005/2008.
Yes, you can set up a sound or alarm to trigger when a breakpoint is hit in Visual Studio 2005/2008, but it requires a workaround since there isn't a direct feature for this in those versions. Here are a couple of methods you can use: ### Method 1: Use a Custom Function with Debugger Breakpoint 1. **Create a Function...
12,276
[ { "from": "human", "value": "Is there a way to trigger a beep/alarm/sound when my breakpoint is hit? I'm using Visual Studio 2005/2008.\n" }, { "from": "gpt", "value": "Yes, you can set up a sound or alarm to trigger when a breakpoint is hit in Visual Studio 2005/2008, but it requires a workarou...
What's the best and/or fastest method of doing multijoin queries in Django using the ORM and QuerySet API?
In Django, when dealing with complex queries involving multiple joins across related models, the Django ORM provides several ways to optimize and efficiently execute these queries. Here are some methods and best practices to consider when performing multi-join queries: ### 1. Use `select_related()` `select_related()`...
6,915
[ { "from": "human", "value": "What's the best and/or fastest method of doing multijoin queries in Django using the ORM and QuerySet API? \n" }, { "from": "gpt", "value": "In Django, when dealing with complex queries involving multiple joins across related models, the Django ORM provides several w...
I am trying to find a better way to integrate IRB with my normal ruby devleopment. Currently I rarely use IRB with my code. I only use it to verify syntax or to try something small. I know I can load my own code into ruby as a require 'mycode' but this usually doesn't mesh with my programming style. Sometimes the...
Certainly! If you're looking for a more integrated approach to using IRB (or even alternatives) in your Ruby development, there are several techniques and tools you can use to make debugging and interactive testing much smoother: ### 1. **Using `binding.pry`** One of the best ways to pause execution and interactively...
12,090
[ { "from": "human", "value": "I am trying to find a better way to integrate IRB with my normal ruby devleopment. Currently I rarely use IRB with my code. I only use it to verify syntax or to try something small. \nI know I can load my own code into ruby as a\nrequire 'mycode'\n\nbut this usually doesn't m...
I need to know, from within Powershell, if the current drive is a mapped drive or not. Unfortunately, Get-PSDrive is not working "as expected": PS:24 H:\temp >get-psdrive h Name Provider Root CurrentLocation ---- -------- ---- --------------- H FileSystem H:\ temp ...
In PowerShell, you can determine whether a drive is a mapped network drive or not by checking the properties of the drive using `Get-PSDrive` and by inspecting its attributes. Mapped drives in PowerShell typically have the `Provider` set to `FileSystem`, but they also need to have a network share associated with them. ...
13,865
[ { "from": "human", "value": "I need to know, from within Powershell, if the current drive is a mapped drive or not.\nUnfortunately, Get-PSDrive is not working \"as expected\":\nPS:24 H:\\temp\n>get-psdrive h\n\nName Provider Root CurrentLocation\n---- -------- ---- ---------...
Is REST a better approach to doing Web Services or is SOAP? Or are they different tools for different problems? Or is it a nuanced issue - that is, is one slightly better in certain arenas than another, etc? I would especially appreciate information about those concepts and their relation to the PHP-universe and als...
REST (Representational State Transfer) and SOAP (Simple Object Access Protocol) are two different approaches to web services, each with its own strengths and weaknesses. Understanding the differences and when to use each can help you choose the right one for your application. ### REST vs. SOAP 1. **Architectural Styl...
10,166
[ { "from": "human", "value": "Is REST a better approach to doing Web Services or is SOAP? Or are they different tools for different problems? Or is it a nuanced issue - that is, is one slightly better in certain arenas than another, etc?\nI would especially appreciate information about those concepts and ...
Is there a built-in method in Python to get an array of all a class' instance variables? For example, if I have this code: class hi: def __init__(self): self.ii = "foo" self.kk = "bar" Is there a way for me to do this: >>> mystery_method(hi) ["ii", "kk"] Edit: I originally had asked for class variables erro...
Yes, you can obtain an array of all instance variables of a class in Python by inspecting the `__dict__` attribute of an instance of that class. However, to get a list of instance variable names as strings from the class itself, you typically need to create an instance of the class first, since instance variables are t...
10,489
[ { "from": "human", "value": "Is there a built-in method in Python to get an array of all a class' instance variables? For example, if I have this code:\nclass hi:\n def __init__(self):\n self.ii = \"foo\"\n self.kk = \"bar\"\n\nIs there a way for me to do this:\n>>> mystery_method(hi)\n[\"ii\", \"kk\...
I have a Windows XP SP2 virtual machine which can be accessed via VNC. It's also running Deep Freeze so there should be no problem in forcing it to reboot. I am looking for a way to force the operating system to reboot instead of shutting down or completely remove the ability to shut down the machine using software app...
To force a Windows XP virtual machine to reboot rather than shut down, or to completely remove the ability to shut down the machine via software applications, you can use a combination of Group Policy settings and registry modifications. Since you are running Deep Freeze, which will reset the system on reboot, the chan...
13,025
[ { "from": "human", "value": "I have a Windows XP SP2 virtual machine which can be accessed via VNC. It's also running Deep Freeze so there should be no problem in forcing it to reboot. I am looking for a way to force the operating system to reboot instead of shutting down or completely remove the ability to...
I am trying to style an input-box rendered using jEditable. I want to change the color of the table-cell when the text is double-clicked and made editable. Like this: alt text http://www.hongaijitsu.com/temp/foobar/public/Picture-2.png This is where I am at the moment: jEditable CSS Problem (double-click the text in th...
It sounds like you're facing an issue with the height and width of the input box created by jEditable. The input box inherits inline styles that are set by jEditable, and simply using `!important` on the CSS won't override those inline styles. To achieve the desired effect where the input box matches the size of the ta...
14,106
[ { "from": "human", "value": "I am trying to style an input-box rendered using jEditable.\nI want to change the color of the table-cell when the text is double-clicked and made editable. Like this:\nalt text http://www.hongaijitsu.com/temp/foobar/public/Picture-2.png\nThis is where I am at the moment: jEdita...
Given : Group hasMany Persons but the relationship is independent (ie. Persons can exist without belonging to a Group), should the foreign key in the persons' table (ie group_id) be set to 0 (or NULL) when deleting a group? If you do not, the person will try to belong to a group that doesn't exist. The reason I ask...
In your scenario, where a `Group` has many `Persons` but the relationship is independent (meaning that `Persons` can exist without being linked to a `Group`), it is generally a good practice to set the foreign key (`group_id`) in the `persons` table to `NULL` when a `Group` is deleted. This approach ensures data integr...
15,947
[ { "from": "human", "value": "Given : \n\nGroup hasMany Persons\n\nbut the relationship is independent (ie. Persons can exist without belonging to a Group), should the foreign key in the persons' table (ie group_id) be set to 0 (or NULL) when deleting a group? If you do not, the person will try to belong to ...
JyDT is a good Jython Eclipse plugin. However, it doesn't allow Jython debugging in the Debug perspective. Jython provides a command-line debugger (Pdb) but it operates outside Eclipse.
You're correct that JyDT (Jython Development Tools) is a useful plugin for integrating Jython with the Eclipse IDE, but it has limitations, especially regarding debugging features within the Eclipse environment. While it allows for the development of Jython applications, it doesn't fully support the debugging capabilit...
15,980
[ { "from": "human", "value": "JyDT is a good Jython Eclipse plugin.\nHowever, it doesn't allow Jython debugging in the Debug perspective.\nJython provides a command-line debugger (Pdb) but it operates outside Eclipse.\n" }, { "from": "gpt", "value": "You're correct that JyDT (Jython Development T...
Having a problem getting a TreeView control to display node images. The code below works sometimes but fails to show any image at other times. private TreeNode AddNodeForCore(TreeNode root, Core c) { string key = GetImageKey(c); TreeNode t = root.Nodes.Add(c.Name, c.Name, key, key); t.Tag = c; return t...
It sounds like you're having an intermittent issue with displaying images in your `TreeView` control. The most common reasons for such behavior typically revolve around the `ImageList` not being properly assigned or images not being loaded at the right time. Here's a list of things to consider that might help stabilize...
10,687
[ { "from": "human", "value": "Having a problem getting a TreeView control to display node images. The code below works sometimes but fails to show any image at other times.\n\nprivate TreeNode AddNodeForCore(TreeNode root, Core c) {\n string key = GetImageKey(c);\n TreeNode t = root.Nodes.Add(c.Name, c...
I am using a Visual Studio project with custom build script/batch file (ala make, ant, etc.). When the build is run from the command line we have placed colored highlighting on various output lines. However, when built via Visual Studio (2005 in my case) the output window does not show the color anymore. Is this possib...
When building a project using Visual Studio, the output window does not support ANSI escape codes for colored output as you might see in a terminal. The Visual Studio output window is primarily designed for text and does not interpret these codes in the same way that command-line interfaces do. However, there are a fe...
16,280
[ { "from": "human", "value": "I am using a Visual Studio project with custom build script/batch file (ala make, ant, etc.).\nWhen the build is run from the command line we have placed colored highlighting on various output lines.\nHowever, when built via Visual Studio (2005 in my case) the output window does...
For a report in MS Access (2007) I need to put data of some columns on all odd pages and other columns on all even pages. It is for printing out double sided card files onto sheets of paper. Does somebody have an idea how to do that?
Creating a report in MS Access 2007 where specific columns appear on odd pages and different columns appear on even pages can be a bit tricky, as Access doesn't provide built-in features for page-level formatting based on even or odd pages. However, you can use the following workaround: ### Steps to Format the Report ...
11,030
[ { "from": "human", "value": "For a report in MS Access (2007) I need to put data of some columns on all odd pages and other columns on all even pages. It is for printing out double sided card files onto sheets of paper.\nDoes somebody have an idea how to do that?\n" }, { "from": "gpt", "value": ...
Sybase db tables do not have a concept of self updating row numbers. However , for one of the modules , I require the presence of rownumber corresponding to each row in the database such that max(Column) would always tell me the number of rows in the table. I thought I'll introduce an int column and keep updating this ...
To maintain a "row number" in your Sybase database that reflects the current number of rows after any delete operation, you can create a trigger that updates this column in the remaining rows when a row is deleted. Here’s an example of how you can create a delete trigger to manage the row number column, which we will ...
15,874
[ { "from": "human", "value": "Sybase db tables do not have a concept of self updating row numbers. However , for one of the modules , I require the presence of rownumber corresponding to each row in the database such that max(Column) would always tell me the number of rows in the table.\nI thought I'll intro...
One thing I am concerned with is that I discovered two ways of registering delegates to events. OnStuff += this.Handle; OnStuff += new StuffEventHandler(this.Handle); The first one is clean, and it makes sense doing "OnStuff -= this.Handle;" to unregister from the event... But with the latter case, should I do "OnSt...
You're raising an important point about the nuances of event handling in C# with delegates. Let’s break down both ways of subscribing to events and the implications of each. ### 1. Subscribing with `OnStuff += this.Handle;` This is a common and recommended way to subscribe to events because it refers directly to a me...
16,222
[ { "from": "human", "value": "One thing I am concerned with is that I discovered two ways of registering delegates to events.\n\nOnStuff += this.Handle; \nOnStuff += new StuffEventHandler(this.Handle);\n\nThe first one is clean, and it makes sense doing \"OnStuff -= this.Handle;\" to unregister from the even...
I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is: <junit fork="yes" forkmode="once" printsummary="off"> <classpath refid="test.classpath"/> <formatter type="brief" usefile="false"/> <batchtest todir="${test.results.dir}/xml"> ...
It’s great to hear that your issue with JUnit tests running slower in Ant than in your IDE has resolved itself! However, it’s not uncommon for developers to experience differences in execution time between different environments, and understanding potential factors can help diagnose future problems if they arise again....
13,803
[ { "from": "human", "value": "I am running my junit tests via ant and they are running substantially slower than via the IDE. My ant call is:\n <junit fork=\"yes\" forkmode=\"once\" printsummary=\"off\">\n <classpath refid=\"test.classpath\"/>\n <formatter type=\"brief\" usefile=\"false\"/>\...
Would it be possible to show an image in full screen mode using silverlight. I'm looking out for some thing like the full screen option of the flash video players.
Yes, it is possible to display an image in full screen mode using Silverlight, similar to how Flash video players provide a full-screen option. You can achieve this by using the `Application.Current.Host` properties to request full screen and then scaling your image accordingly. Here’s a basic example of how you might...
11,429
[ { "from": "human", "value": "Would it be possible to show an image in full screen mode using silverlight. I'm looking out for some thing like the full screen option of the flash video players.\n" }, { "from": "gpt", "value": "Yes, it is possible to display an image in full screen mode using Silv...
How does one go about programatically building a TemplateColumn object and adding it to a DataGrid. I know how to add it, but not how to build the contents of the TemplateColumn. There are no useful looking methods on the ITemplate the column class exposes.
In WPF, if you want to programmatically create a `TemplateColumn` for a `DataGrid`, you would typically implement the `ITemplate` interface to define the contents of the column. Here’s a step-by-step guide to help you build a `TemplateColumn` and add it to a `DataGrid`: ### Step 1: Create a Class that Implements `IT...
10,833
[ { "from": "human", "value": "How does one go about programatically building a TemplateColumn object and adding it to a DataGrid. I know how to add it, but not how to build the contents of the TemplateColumn. There are no useful looking methods on the ITemplate the column class exposes.\n" }, { "fr...
When a folder in the Eclipse Package Explorer (one which is linked to a directory somewhere in the filesystem) contains files whose names begin with a . (period), those files do not appear. Can Eclipse be configured to show these files, and if so, how?
In Eclipse, files that begin with a dot (.) are typically considered hidden files in many operating systems, including UNIX-like systems. By default, Eclipse does not display these hidden files in the Package Explorer. However, you can configure Eclipse to show them by adjusting the filters. Here’s how you can do that:...
16,379
[ { "from": "human", "value": "When a folder in the Eclipse Package Explorer (one which is linked to a directory somewhere in the filesystem) contains files whose names begin with a . (period), those files do not appear. Can Eclipse be configured to show these files, and if so, how?\n" }, { "from": "g...
We are developing a Visual Basic 6.0 project. We have written a library, which we were testing using vbunit and vbmock. But soon found that the tests were not maintainable. So, we decided to write tests using MBunit. Now, we want to know the test coverage. How can we do it? thanks
To assess test coverage in a Visual Basic 6.0 project, you can follow several approaches and tools, particularly since you're using MBUnit for your unit testing. Here's a general workflow to help you measure test coverage: ### 1. Use Coverage Analysis Tools Since VB6 does not have built-in code coverage tools, you ma...
11,556
[ { "from": "human", "value": "We are developing a Visual Basic 6.0 project. We have written a library, which we were testing using vbunit and vbmock. But soon found that the tests were not maintainable. So, we decided to write tests using MBunit. Now, we want to know the test coverage. How can we do it?\ntha...
My regular expression needs to be able to find the strings: Visual Studio 2008 Visual Studio Express 2008 Visual Basic 2008 Visual Basic Express 2008 Visual C++ 2008 Visual C++ Express 2008 and a host of other similar variants, to be replaced with this one single string Visual Studio 2005 I tried "Visual (Basic|C++...
The issue you're encountering is due to how you've structured your regular expression, specifically the grouping and the alternation. You want to ensure that the entire pattern is considered as a whole, rather than just parts of it. Here’s a revised regular expression that should work for your use case: ```regex Vis...
15,767
[ { "from": "human", "value": "My regular expression needs to be able to find the strings:\n\nVisual Studio 2008\nVisual Studio Express 2008\nVisual Basic 2008\nVisual Basic Express 2008\nVisual C++ 2008\nVisual C++ Express 2008\n\nand a host of other similar variants, to be replaced with this one single stri...
I need to save a user's login information in encrypted form for this application I'm building, but I'm not sure of the best place to save the file. I don't want to save it into the program application folder as I want it per user. So what is the best folder (or way) to save it into? Edit: Using C++.
When it comes to storing user-specific login information securely in a C++ application, it's essential to follow best practices for both security and organization. Here are some recommendations: ### Best Practices for Storing User Credentials 1. **Do Not Store Plain Text Passwords**: Always hash passwords using a str...
13,453
[ { "from": "human", "value": "I need to save a user's login information in encrypted form for this application I'm building, but I'm not sure of the best place to save the file. I don't want to save it into the program application folder as I want it per user.\nSo what is the best folder (or way) to save it ...
I want to filter a java.util.Collection based on a predicate.
In Java, you can filter a `java.util.Collection` using the `Stream` API, which provides a way to perform functional-style operations on streams of elements. Below is a step-by-step guide on how to filter a collection based on a predicate. ### Example Code Let's assume you have a `Collection` of integers and you want ...
15,064
[ { "from": "human", "value": "I want to filter a java.util.Collection based on a predicate.\n" }, { "from": "gpt", "value": "In Java, you can filter a `java.util.Collection` using the `Stream` API, which provides a way to perform functional-style operations on streams of elements. Below is a step...
I just installed Ganymede and am exploring an old project in it. All of my JSPs are giving me weird validation errors. I'm seeing stuff like - Syntax error on token "}", delete this token Syntax error on token "catch", Identifier expected Syntax error, insert "Finally" to complete TryStatement I'm doing best practice...
It sounds like you're experiencing some issues with Eclipse Ganymede's validation settings for JSP files. This can sometimes happen when Eclipse mistakenly applies Java class validation to your JSP files. Here are some steps you can take to resolve the validation errors: 1. **Check Project Facets**: Make sure your ...
12,096
[ { "from": "human", "value": "I just installed Ganymede and am exploring an old project in it. All of my JSPs are giving me weird validation errors. I'm seeing stuff like - \nSyntax error on token \"}\", delete this token\nSyntax error on token \"catch\", Identifier expected\nSyntax error, insert \"Finally\"...
I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid solution, I tried upping the sql command timeout to sixty seconds, but as I...
The issue you're experiencing can indeed be perplexing, especially when it seems like you've taken the right steps to increase the SQL command timeout but are still encountering intermittent timeout exceptions. ### Possible Causes and Things to Investigate 1. **Different Command Timeout Settings**: - Make sure tha...
12,258
[ { "from": "human", "value": "I have some curious behavior that I'm having trouble figuring out why is occurring. I'm seeing intermittent timeout exceptions. I'm pretty sure it's related to volume because it's not reproducible in our development environment. As a bandaid solution, I tried upping the sql c...
I'm trying to start a service as a user and things work fine, until I try a user that doesn't have a password. Then, it fails to start (due to log-on error). Am I doing something wrong or is this "by design"? The code to register this service: SC_HANDLE schService = CreateService( schSCManager, ...
When you're creating a Windows service that runs under a user account, the account must have a password. This is a security requirement in Windows. If you try to specify a user account that does not have a password, the service will not start, and you'll receive a log-on error. ### Why This Happens: 1. **User Account...
14,312
[ { "from": "human", "value": "I'm trying to start a service as a user and things work fine, until I try a user that doesn't have a password. Then, it fails to start (due to log-on error).\nAm I doing something wrong or is this \"by design\"?\nThe code to register this service:\n SC_HANDLE schService = Cre...
I am wanting to store the "state" of some actions the user is performing in a series of different ASP.Net webforms. What are my choices for persisting state, and what are the pros/cons of each solution? I have been using Session objects, and using some helper methods to strongly type the objects: public static Acc...
When considering how to persist state in an ASP.NET web application, you have several options beyond using session state. Each has its pros and cons, and the right choice often depends on the specific needs of your application. Below are some common techniques for persisting state, along with their advantages and disad...
13,318
[ { "from": "human", "value": "I am wanting to store the \"state\" of some actions the user is performing in a series of different ASP.Net webforms. What are my choices for persisting state, and what are the pros/cons of each solution?\nI have been using Session objects, and using some helper methods to stro...
I have a bunch of tasks in a MySQL database, and one of the fields is "deadline date". Not every task has to have to a deadline date. I'd like to use SQL to sort the tasks by deadline date, but put the ones without a deadline date in the back of the result set. As it is now, the null dates show up first, then the rest ...
You can achieve the desired sorting of tasks in your MySQL query by using the `ORDER BY` clause effectively. Specifically, you can assign a condition to handle the `NULL` values in the "deadline date" field so that they are sorted to the end of the result set. Here's how you can do it: ```sql SELECT * FROM tasks ORD...
15,950
[ { "from": "human", "value": "I have a bunch of tasks in a MySQL database, and one of the fields is \"deadline date\". Not every task has to have to a deadline date.\nI'd like to use SQL to sort the tasks by deadline date, but put the ones without a deadline date in the back of the result set. As it is now, ...
I have an object that I'm testing that raises an event. What is the best way of using Rhino Mocks to check that it was raised? Best I could come up with (I am certain it gets better than this): public void MyCallback(object sender, EventArgs e) { _flag = true;} [Test] public void DoSomethingRaisesEvent() { _flag ...
Using Rhino Mocks to verify that an event was raised can indeed be improved in the example you've provided. The primary goal is to confirm that the event handler is called when the event is raised. To achieve this, you can make use of event argument checks and assertions in a more straightforward manner. Here's a clea...
15,548
[ { "from": "human", "value": "I have an object that I'm testing that raises an event. What is the best way of using Rhino Mocks to check that it was raised? \nBest I could come up with (I am certain it gets better than this):\npublic void MyCallback(object sender, EventArgs e) { _flag = true;}\n\n[Test]\np...
I are using EJB 3 on a fairly large J2EE project, by default with Netbeans sets the persistent provider for the entity beans to TopLink. There is the option to change the provider to one of the following or even add a new persistence library: Hibernate KODO OpenJPA Which persistence provider do you prefer to use? Wha...
Choosing a persistence provider for your J2EE project can have a significant impact on development productivity, application performance, and maintenance. Here’s a brief overview of the four persistence providers you mentioned—TopLink, Hibernate, KODO, and OpenJPA—along with some advantages of each: ### 1. **Hibernate...
11,236
[ { "from": "human", "value": "I are using EJB 3 on a fairly large J2EE project, by default with Netbeans sets the persistent provider for the entity beans to TopLink. There is the option to change the provider to one of the following or even add a new persistence library:\n\nHibernate\nKODO\nOpenJPA\n\nWhich...
I decide to learn more about vim and its syntax highlighting. Using examples for others, I am creating my own syntax file for Markdown. I have seen mkd.vim and it has this problem too. My issue is between list items and code block highlighting. Code Block definition: first line is blank second line begins with at leas...
Your issue appears to stem from the overlap in the conditions for highlighting the code blocks and the unordered list items in your Vim syntax file. The main challenge is that your current definitions for code blocks and list items can conflict, especially when there are blank lines and indented lines. Here's a way to...
11,288
[ { "from": "human", "value": "I decide to learn more about vim and its syntax highlighting.\nUsing examples for others, I am creating my own syntax file for Markdown. I have seen mkd.vim and it has this problem too.\nMy issue is between list items and code block highlighting.\nCode Block definition:\n\nfirst...
Does anyone know of an application or system out there for tracking changes (files added/removed, diffs on text files) to a non-source controlled directory over time? Something that would let you Take a snapshot of a certain directory tree at time A Come back at time period B and see what has changed Come back at tim...
There are several tools and applications you can use to track changes in a directory without requiring it to be under a traditional version control system. Here are some options that you might find useful: 1. **File Integrity Monitoring (FIM) Tools**: - **Tripwire**: A classic FIM tool that creates a baseline snaps...
15,539
[ { "from": "human", "value": "Does anyone know of an application or system out there for tracking changes (files added/removed, diffs on text files) to a non-source controlled directory over time? Something that would let you\n\nTake a snapshot of a certain directory tree at time A\nCome back at time period...
Is there a reliable way to detect whether or not WinHelp is installed on Windows Vista or newer versions of Windows? If possible, I'd like a solution that's not specific to any particular version of Windows. I've posted this question to other message boards and got back answers regarding the size of Winhlp32.exe before...
Detecting whether WinHelp is installed on Windows Vista and newer can be a bit tricky, especially since its availability and installation process vary across different versions of Windows. Here are some general approaches you can take to determine if WinHelp is installed without being version-specific: ### 1. Check fo...
15,006
[ { "from": "human", "value": "Is there a reliable way to detect whether or not WinHelp is installed on Windows Vista or newer versions of Windows? If possible, I'd like a solution that's not specific to any particular version of Windows.\nI've posted this question to other message boards and got back answers...
I am thinking about making a website with some fairly intense JavaScript/canvas usage and I have been looking at Processing.js and it seems to me that it would make manipulating the canvas significantly easier. Does anyone know any reasons why I shouldn't use Processing.js? I understand that older browsers won't be a...
Processing.js is indeed a great library for creating graphics and visualizations with JavaScript, especially if you are familiar with the Processing language. However, there are several considerations you might want to keep in mind before committing to Processing.js for your project: 1. **Performance**: While Processi...
14,554
[ { "from": "human", "value": "I am thinking about making a website with some fairly intense JavaScript/canvas usage and I have been looking at Processing.js and it seems to me that it would make manipulating the canvas significantly easier. Does anyone know any reasons why I shouldn't use Processing.js? I ...
If I want to compile my .NET applications for a 64 bit environment. Do I need 64 bit OS version or 64 bit Visual Studio version Or both?
To compile your .NET applications for a 64-bit environment, you need to consider the following: 1. **64-bit OS Version**: You do **not necessarily** need a 64-bit OS to compile a 64-bit application. The .NET SDK and Visual Studio can run on a 32-bit OS, and you can target a 64-bit platform. However, running on a 64-bi...
16,875
[ { "from": "human", "value": "If I want to compile my .NET applications for a 64 bit environment. Do I need \n\n64 bit OS version\nor \n64 bit Visual Studio version\nOr both?\n\n" }, { "from": "gpt", "value": "To compile your .NET applications for a 64-bit environment, you need to consider the ...
I am creating a standalone asp.net page that needs to be embedded into a sharepoint site using the Page Viewer Web Part. The asp.net page is published to the same server on a different port, giving me the URL to embed. The requirement is that after a user is authenticated using Sharepoint authentication, they navigate...
Embedding an ASP.NET page in SharePoint using the Page Viewer Web Part can introduce a few challenges when it comes to user authentication, especially since you're trying to access the authenticated SharePoint user information. Here are several approaches to tackle the issue of retrieving the currently authenticated u...
12,297
[ { "from": "human", "value": "I am creating a standalone asp.net page that needs to be embedded into a sharepoint site using the Page Viewer Web Part. The asp.net page is published to the same server on a different port, giving me the URL to embed.\nThe requirement is that after a user is authenticated usin...
UPDATE: Focus your answers on hardware solutions please. What hardware/tools/add-in are you using to improve ASP.NET compilation and first execution speed? We are looking at solid state hard drives to speed things up, but the prices are really high right now. I have two 7200rpm harddrives in RAID 0 right now and I'm ...
Improving ASP.NET compilation speed and overall development performance can be significantly influenced by your hardware setup. Since you’re already using RAID 0 with 7200 RPM drives and are considering solid-state drives (SSDs), here are several cost-effective hardware solutions to improve your setup: 1. **Upgrade to...
15,095
[ { "from": "human", "value": "UPDATE: Focus your answers on hardware solutions please.\nWhat hardware/tools/add-in are you using to improve ASP.NET compilation and first execution speed? We are looking at solid state hard drives to speed things up, but the prices are really high right now.\nI have two 7200...
I have a method that takes an IQueryable. Is there a LINQ query that will give me back the size of each column in the IQueryable? To be more clear: this is Linq-to-objects. I want to get the length of the ToString() of each "column".
To calculate the size of each "column" in an `IQueryable` using LINQ-to-Objects, you can iterate over the properties of each object in the IQueryable, convert them to a string, and then measure the length of those strings. Below is an example demonstrating how to achieve this. Assuming you have a collection of objects...
15,674
[ { "from": "human", "value": "I have a method that takes an IQueryable. Is there a LINQ query that will give me back the size of each column in the IQueryable?\nTo be more clear: this is Linq-to-objects. I want to get the length of the ToString() of each \"column\".\n" }, { "from": "gpt", "value...
The age old question. Where should you put your business logic, in the database as stored procedures ( or packages ), or in the application/middle tier? And more importantly, Why? Assume database independence is not a goal.
The decision of where to place business logic—either in the database (using stored procedures or packages) or in the application/middle tier—depends on various factors, including the specific requirements of the application, the team’s expertise, performance considerations, maintainability, and scalability. Let's exami...
11,712
[ { "from": "human", "value": "The age old question. Where should you put your business logic, in the database as stored procedures ( or packages ), or in the application/middle tier? And more importantly, Why?\nAssume database independence is not a goal.\n" }, { "from": "gpt", "value": "The decis...
Has anyone experienced this VSTS Code Coverage "bug?" Do you have any suggestions? I am doing code coverage analysis with Visual Studio, which is generally an easy task now with the tools that are included. However, I have an issue that I can't overcome. Let's say I have assemblies A, B, C, and D and have marked them ...
Your situation with Visual Studio Test (VSTS) code coverage sounds challenging. Here are some suggestions to help you calculate the coverage for the missing assembly D and improve your code coverage reporting: ### 1. Manually Calculate the Number of Blocks in D You can use tools like **dotCover** or **NDepend** to ana...
14,952
[ { "from": "human", "value": "Has anyone experienced this VSTS Code Coverage \"bug?\" Do you have any suggestions? \nI am doing code coverage analysis with Visual Studio, which is generally an easy task now with the tools that are included. However, I have an issue that I can't overcome. Let's say I have ass...
I've been developing a site over the past few weeks using CodeIgniter as the framework. I've been thinking of the best way to accomplish something, which in a lot of other frameworks in other languages is relatively simple: sortable tables. CodeIgniter switches off query strings by default, because your URLs contain me...
You're right that sortable tables can be a bit tricky to implement in CodeIgniter, especially when using its default routing method. However, there are a few good strategies you can consider to implement server-side sorting while keeping your application structured and maintainable. Here are a few options: ### 1. Use ...
15,138
[ { "from": "human", "value": "I've been developing a site over the past few weeks using CodeIgniter as the framework. I've been thinking of the best way to accomplish something, which in a lot of other frameworks in other languages is relatively simple: sortable tables. CodeIgniter switches off query strings...
Does having several levels of base classes slow down a class? A derives B derives C derives D derives F derives G, ... Does multiple inheritance slow down a class?
The impact of having several levels of base classes and the use of multiple inheritance on performance in object-oriented programming can vary depending on several factors, including the programming language being used, the specific implementation of the language's type system, and how inheritance is managed under the ...
15,089
[ { "from": "human", "value": "Does having several levels of base classes slow down a class? A derives B derives C derives D derives F derives G, ...\nDoes multiple inheritance slow down a class?\n" }, { "from": "gpt", "value": "The impact of having several levels of base classes and the use of m...
In bash the ampersand (&) can be used to run a command in the background and return interactive control to the user before the command has finished running. Is there an equivalent method of doing this in Powershell? Example of usage in bash: sleep 30 &
Yes, in PowerShell, you can run a command in the background and return control to the user by using the `Start-Job` cmdlet or by using the `Start-Process` cmdlet. Here's how you can do both: ### Using Start-Job The `Start-Job` cmdlet allows you to run a script block as a background job. Here's an example similar to y...
17,752
[ { "from": "human", "value": "In bash the ampersand (&) can be used to run a command in the background and return interactive control to the user before the command has finished running. Is there an equivalent method of doing this in Powershell?\nExample of usage in bash:\n sleep 30 &\n\n" }, { "from...
How does selenium work? Can you explain the internal working of it.
Selenium is an open-source framework used for automating web applications for testing purposes. It provides a suite of tools and libraries for automating web browsers across different platforms and programming languages. Here's a detailed explanation of how Selenium works internally: ### Core Components of Selenium 1...
14,123
[ { "from": "human", "value": "How does selenium work? Can you explain the internal working of it.\n" }, { "from": "gpt", "value": "Selenium is an open-source framework used for automating web applications for testing purposes. It provides a suite of tools and libraries for automating web browsers...
(Not related to versioning the database schema) Applications that interfaces with databases often have domain objects that are composed with data from many tables. Suppose the application were to support versioning, in the sense of CVS, for these domain objects. For some arbitry domain object, how would you design a da...
Versioning domain objects in a relational database context can be quite complex, especially when dealing with objects that aggregate data from multiple tables. The primary goal is to allow tracking changes over time while keeping the integrity and performance of the database intact. Below is a proposed approach to desi...
10,697
[ { "from": "human", "value": "(Not related to versioning the database schema)\nApplications that interfaces with databases often have domain objects that are composed with data from many tables. Suppose the application were to support versioning, in the sense of CVS, for these domain objects.\nFor some arbit...
I have a custom program which preprocesses a C# file and generates a new C# file as output. I would like to invoke this from msbuild on each of the C# files in the project, then compile the output files instead of the original C# files. How would I go about this?
To achieve your goal of invoking a custom preprocessing program on each C# file in an MSBuild project and then compiling the output files instead of the original ones, you'll want to make use of MSBuild's capabilities to define custom targets and tasks. Here are the general steps to set this up: ### 1. Create a Custo...
11,290
[ { "from": "human", "value": "I have a custom program which preprocesses a C# file and generates a new C# file as output. I would like to invoke this from msbuild on each of the C# files in the project, then compile the output files instead of the original C# files. How would I go about this?\n" }, { ...
Has anyone had any experience targetting WSH in the way that VBScript, JScript, PerlScript, xbScript and ForthScript (among other) do, such that the language can be used from the command line and embedded in server-side web pages? Where do I go to get that kind of information?
Yes, there are various ways to target Windows Script Host (WSH) using different scripting languages. WSH allows you to run scripts in environments like the command line, and some languages can also be embedded in server-side applications. Below are some languages you mentioned and how they relate to WSH: 1. **VBScript...
15,483
[ { "from": "human", "value": "Has anyone had any experience targetting WSH in the way that VBScript, JScript, PerlScript, xbScript and ForthScript (among other) do, such that the language can be used from the command line and embedded in server-side web pages? Where do I go to get that kind of information? \...
Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the DB on the receiving server?
When dealing with embedding HTML code, especially for Flash videos, and passing that through an RSS feed, you need to ensure that the special characters in the HTML code are properly encoded before being included in the feed. This prevents any parsing errors or issues with the RSS format. ### Encoding the HTML Embed C...
13,830
[ { "from": "human", "value": "Im trying to put an html embed code for a flash video into the rss feed, which will then be parser by a parser (magpie) on my other site. How should I encode the embed code on one side, and then decode it on the other so I can insert clean html into the DB on the receiving serve...
I'm working on a django app right and I'm using cherrypy as the server. Cherrypy creates a new thread for every page view. I'd like to be able to access all of these threads (threads responsible for talking to django) from within any of them. More specifically I'd like to be able to access the thread_data for each of t...
In a CherryPy application, each request is indeed handled in a separate thread (or sometimes in a separate process, depending on your configuration). While you can access thread-local data using the `threading.local` mechanism in Python, sharing state across different threads (like thread data) poses challenges because...
11,286
[ { "from": "human", "value": "I'm working on a django app right and I'm using cherrypy as the server. Cherrypy creates a new thread for every page view. I'd like to be able to access all of these threads (threads responsible for talking to django) from within any of them. More specifically I'd like to be abl...
What is the proper technique to have ThreadA signal ThreadB of some event, without having ThreadB sit blocked waiting for an event to happen? i have a background thread that will be filling a shared List<T>. i'm trying to find a way to asynchronously signal the "main" thread that there is data available to be picked up...
To have `ThreadA` signal `ThreadB` of an event without having `ThreadB` block or wait on a synchronization mechanism, you can use the **producer-consumer** pattern with a thread-safe collection. This approach allows `ThreadA` to add items to a shared collection, and `ThreadB` to process those items asynchronously witho...
12,311
[ { "from": "human", "value": "What is the proper technique to have ThreadA signal ThreadB of some event, without having ThreadB sit blocked waiting for an event to happen?\ni have a background thread that will be filling a shared List<T>. i'm trying to find a way to asynchronously signal the \"main\" thread ...
We have a large codebase that takes approx 12 minutes on the developer machines to auto-generate some Java 5 classes using JavaCC and then compiles all the classes as well as running the units test. The project consists of multiple projects which can be built in groups, but we are aiming for a full a build in under 10 ...
Reducing build times in a large codebase is a common challenge, but there are several strategies you can employ to help you achieve your goal of getting the build under 10 minutes. Here are some tips: ### 1. **Incremental Builds** - **Leverage Incremental Compilation:** Ensure that your build system supports increm...
12,676
[ { "from": "human", "value": "We have a large codebase that takes approx 12 minutes on the developer machines to auto-generate some Java 5 classes using JavaCC and then compiles all the classes as well as running the units test.\nThe project consists of multiple projects which can be built in groups, but we ...
How do you implement onmousemove in Firefox? I have it working in IE7 but no alert pops in Firefox. Is is not supported or done differently? <esri:Map ID="Map1" runat="server" MapResourceManager="MapResourceManager1" Height="100%" Width="100%" VirtualDirectory="" PrimaryMapResource="ESRI_Imagery_World_2D" Ext...
The `onmousemove` event in your `<esri:Map>` control is likely not working in Firefox because the way events are handled in different browsers can vary, especially in older browsers like IE7 and newer ones like Firefox. Here are a few suggestions to ensure your `onmousemove` event works properly across browsers: 1. *...
14,609
[ { "from": "human", "value": "How do you implement onmousemove in Firefox? I have it working in IE7 but no alert pops in Firefox. Is is not supported or done differently?\n<esri:Map ID=\"Map1\" runat=\"server\" MapResourceManager=\"MapResourceManager1\" \n Height=\"100%\" Width=\"100%\" VirtualDirectory=\...
So I've decided to try to solve my physics homework by writing some python scripts to solve problems for me. One problem that I'm running into is that significant figures don't always seem to come out properly. For example this handles significant figures properly: from decimal import Decimal >>> Decimal('1.0') + Dec...
You're correct that the behavior you're observing with the `Decimal` class in Python does not automatically yield the expected number of significant figures based on the inputs. The `Decimal` class itself doesn't inherently know how to apply the rules of significant figures, as it primarily focuses on high-precision ar...
12,203
[ { "from": "human", "value": "So I've decided to try to solve my physics homework by writing some python scripts to solve problems for me. One problem that I'm running into is that significant figures don't always seem to come out properly. For example this handles significant figures properly:\nfrom decim...
I have a multi select list box value prompt in Cognos 8.3. It contains values: Adelaide North Adelaide South Adelaide East Adelaide East Sydney North Sydney South Sydney East Sydney West etc. I want to able to add a button onto my prompt page that when clicked, selects predetermined options, such as Adelaide No...
In Cognos 8.3, you can customize prompt pages to enhance user experience, including implementing buttons to select predetermined options in a multi-select list box. However, Cognos 8.3 does not natively support dynamic button actions that would automatically select values in a multi-select list box directly. Instead,...
14,884
[ { "from": "human", "value": "I have a multi select list box value prompt in Cognos 8.3. \nIt contains values: \nAdelaide North \nAdelaide South\nAdelaide East \nAdelaide East\nSydney North \nSydney South\nSydney East \nSydney West \netc.\nI want to able to add a button onto my prompt page that when clicked...
Aside from Episerver.com What other websites do people who develop using EPiServer use as development resources!? Been using coderesort.com but I find that it lacks examples of how to do stuff. Many thanks, J
If you're looking for additional resources for EPiServer development, here are some websites and platforms that can provide valuable information, tutorials, and community support: 1. **Stack Overflow**: Search for EPiServer-related questions or ask your own. The community is active and can provide solutions to specifi...
10,841
[ { "from": "human", "value": "Aside from Episerver.com\nWhat other websites do people who develop using EPiServer use as development resources!? Been using coderesort.com but I find that it lacks examples of how to do stuff.\nMany thanks,\nJ\n" }, { "from": "gpt", "value": "If you're looking for ...
I have the .net framework 3.5 on my development machine and also am using the AJAX toolkit in my code. In order to publish this code to a server for my users, do I need anything on the server in order for my AJAX code to operate correctly?
Yes, to ensure that your AJAX code operates correctly on the server, you need to ensure a few things are in place: 1. **.NET Framework 3.5**: Make sure that the server where you're deploying your application has the .NET Framework 3.5 installed. This is essential because your application will require the framework to ...
16,353
[ { "from": "human", "value": "I have the .net framework 3.5 on my development machine and also am using the AJAX toolkit in my code. In order to publish this code to a server for my users, do I need anything on the server in order for my AJAX code to operate correctly? \n" }, { "from": "gpt", "...
Is here any performance benefit to using multiple threads on a computer with a single CPU that does not having hyperthreading?
Using multiple threads on a computer with a single CPU that does not have hyperthreading can still provide some performance benefits, but these benefits may be limited and context-dependent. Here are a few factors to consider: 1. **I/O Bound Tasks**: If the application is I/O bound (e.g., waiting for disk access, netw...
14,734
[ { "from": "human", "value": "Is here any performance benefit to using multiple threads on a computer with a single CPU that does not having hyperthreading? \n" }, { "from": "gpt", "value": "Using multiple threads on a computer with a single CPU that does not have hyperthreading can still provid...
Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces? For example: public MyMethod() { if (test) ...
Regular expressions are powerful tools for pattern matching, but they do have limitations, particularly when it comes to matching nested structures like parentheses or braces. Regular expressions are generally not capable of matching nested patterns due to their lack of recursion and stack-based memory. This means that...
14,531
[ { "from": "human", "value": "Is it possible to write a regular expression that matches a nested pattern that occurs an unknown number of times? For example, can a regular expression match an opening and closing brace when there are an unknown number of open/close braces nested within the outer braces?\nFor ...
what is an efficient way to get a certain time for the next day in Java? Let's say I want the long for tomorrow 03:30:00. Setting Calendar fields and Date formatting are obvious. Better or smarter ideas, thanks for sharing them! Okami
In Java, one of the most efficient and modern ways to handle date and time is by using the `java.time` package, which was introduced in Java 8. Instead of using `Calendar` and `Date`, you can use `LocalDate`, `LocalTime`, and `LocalDateTime` for a cleaner and more reliable approach. Here’s how you can get the timestam...
12,225
[ { "from": "human", "value": "what is an efficient way to get a certain time for the next day in Java?\nLet's say I want the long for tomorrow 03:30:00.\nSetting Calendar fields and Date formatting are obvious.\nBetter or smarter ideas, thanks for sharing them!\nOkami\n" }, { "from": "gpt", "valu...
I have made a SVG image, or more like mini application, for viewing graphs of data. I want to include this in a HTML page, and call methods on the SVG image. Example: <object id="img" data="image.svg" width="500" height="300"/> <script>document.getElementById("img").addData([1,23,4]);</script> Is it at all possible to...
Yes, it is possible to call methods on an SVG document embedded within an HTML page. However, using the `<object>` tag can make it a bit tricky because the SVG is treated as a separate document and requires accessing its DOM. Here's a step-by-step guide to achieve this: ### Step 1: Create Your SVG In your SVG file,...
11,707
[ { "from": "human", "value": "I have made a SVG image, or more like mini application, for viewing graphs of data. I want to include this in a HTML page, and call methods on the SVG image.\nExample:\n<object id=\"img\" data=\"image.svg\" width=\"500\" height=\"300\"/>\n<script>document.getElementById(\"img\")...
When do you think we can expect the full release version of ASP.NET MVC?
As of my last update in October 2023, ASP.NET MVC has already been released in multiple versions, with the latest version being part of the ASP.NET Core framework. ASP.NET Core combines MVC with Web API into a single programming model, and it is actively maintained and updated by Microsoft. If you're looking for infor...
19,427
[ { "from": "human", "value": "When do you think we can expect the full release version of ASP.NET MVC?\n" }, { "from": "gpt", "value": "As of my last update in October 2023, ASP.NET MVC has already been released in multiple versions, with the latest version being part of the ASP.NET Core framewor...
I recently wrote a parser in Python using Ply (it's a python reimplementation of yacc). When I was almost done with the parser I discovered that the grammar I need to parse requires me to do some look up during parsing to inform the lexer. Without doing a look up to inform the lexer I cannot correctly parse the strin...
Yes, there are several libraries in Python that can help you with context-sensitive parsing, similar to Parsec in Haskell. Here are a few options you might consider: 1. **PyParsing**: This is a library that allows you to construct grammars using a simple, readable syntax. It supports context-sensitive parsing to some ...
14,994
[ { "from": "human", "value": "I recently wrote a parser in Python using Ply (it's a python reimplementation of yacc). When I was almost done with the parser I discovered that the grammar I need to parse requires me to do some look up during parsing to inform the lexer. Without doing a look up to inform the...
I'm looking for open source (preferably c++) algorithms for 2d bin packing of rectangular and or irregular shapes. I've found several papers on the subject but no code.
Finding open-source implementations for 2D bin packing can sometimes be challenging, as many of the algorithms are discussed in academic papers without accompanying code. However, there are some repositories and libraries that contain implementations of 2D bin packing algorithms. Here are a few resources in C++ or with...
11,667
[ { "from": "human", "value": "I'm looking for open source (preferably c++) algorithms for 2d bin packing of rectangular and or irregular shapes. I've found several papers on the subject but no code.\n" }, { "from": "gpt", "value": "Finding open-source implementations for 2D bin packing can someti...
I have a database with user 'dbo' that has a login name "domain\xzy". How do I change it from "domain\xzy" to "domain\abc".
To change the login name associated with the user 'dbo' in a SQL Server database from "domain\xzy" to "domain\abc", you will need to update the associated login. Here's a step-by-step process to do that: 1. **Ensure the new login exists**: First, ensure that the login for `domain\abc` already exists in your SQL Server...
15,173
[ { "from": "human", "value": "I have a database with user 'dbo' that has a login name \"domain\\xzy\". How do I change it from \"domain\\xzy\" to \"domain\\abc\".\n" }, { "from": "gpt", "value": "To change the login name associated with the user 'dbo' in a SQL Server database from \"domain\\xzy\...
So I managed to get a page with Ajax ui.tab and in one of the tab I put jWYSIWYG textarea plugin. Unfortunately, I can only see normal textarea. However, accessing the page directly (ie. not using the ajax tab) works. What happened? p/s: I'm new to jQuery / JavaScript / AJAX / CSS (if that even matter)
It sounds like you are experiencing an issue where the jWYSIWYG editor is not initializing properly when it is loaded inside an AJAX-based tab. This is a common issue with dynamic content where certain scripts need to be re-initialized after the content is loaded. Here’s a general approach to troubleshoot and solve yo...
12,502
[ { "from": "human", "value": "So I managed to get a page with Ajax ui.tab and in one of the tab I put jWYSIWYG textarea plugin. Unfortunately, I can only see normal textarea.\nHowever, accessing the page directly (ie. not using the ajax tab) works.\nWhat happened?\np/s: I'm new to jQuery / JavaScript / AJAX ...
I'm building a widget, and I've been using iframes to present content within it. At some point, I might start serving third party HTML and JS, so I thought iframes would be a good idea. It does make the widget javascript a little more complicated, and I'm concerned that this might not be the best implementation. Do yo...
Using iframes for embedding content can be a good choice for certain scenarios, especially when you're dealing with third-party HTML and JavaScript. However, there are pros and cons to consider when using iframes in your widget implementation: ### Pros of Using Iframes: 1. **Isolation**: Iframes create a separate bro...
9,856
[ { "from": "human", "value": "I'm building a widget, and I've been using iframes to present content within it. At some point, I might start serving third party HTML and JS, so I thought iframes would be a good idea. \nIt does make the widget javascript a little more complicated, and I'm concerned that this m...
When I use the task, the property is only set to TRUE if the resource (say file) is available. If not, the property is undefined. When I print the value of the property, it gives true if the resource was available, but otherwise just prints the property name. Is there a way to set the property to some value if the res...
In Apache Ant, properties are immutable once they are set, which means that you cannot change the value of an existing property. If a property is undefined, it simply means that it hasn't been set yet. The `available` task can only set a property to true if the resource is available, and it won't set it to false or any...
14,625
[ { "from": "human", "value": "When I use the task, the property is only set to TRUE if the resource (say file) is available. If not, the property is undefined.\nWhen I print the value of the property, it gives true if the resource was available, but otherwise just prints the property name.\nIs there a way t...
How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write. I looked on google and found a blog post from 2005 that states that Subversion doesn't store file-permissions. There are...
As of my last update in October 2023, Subversion (SVN) does not natively support storing file permissions within the repository. This means that, after checking out files from the repository, they will generally have the default permissions assigned by the operating system, which is typically read-write for the user. ...
15,238
[ { "from": "human", "value": "How do you store file permissions in a repository? A few files need to be read-only to stop a third party program from trashing it but after checking out of the repository they are set to read-write.\nI looked on google and found a blog post from 2005 that states that Subversion...
So, I'll be getting my T-Mobile G1 within a month or so, and I'm excited to start developing for it. Has anyone started using it yet? Is there a dev wiki or anything set up for it yet?
That's exciting! The T-Mobile G1 was one of the first smartphones to run on the Android operating system, and it opened up many opportunities for developers. At the time, there were indeed resources for developers interested in building applications for it. You could check out the official Android Developers website, ...
12,226
[ { "from": "human", "value": "So, I'll be getting my T-Mobile G1 within a month or so, and I'm excited to start developing for it.\nHas anyone started using it yet? Is there a dev wiki or anything set up for it yet?\n" }, { "from": "gpt", "value": "That's exciting! The T-Mobile G1 was one of the ...
I have a bunch of java files from which I want to remove the javadoc lines with the license [am changing it on my code]. The pattern I am looking for is ^\* \* ProjectName .* USA\.$ but matched across lines Is there a way sed [or a commonly used editor in Windows/Linux] can do a search/replace for a multiline pattern?...
Certainly! You can use `sed` with the `-z` option (if your version supports it) to search for and replace multiline patterns. This option treats the input as a single line, enabling the matching of line breaks. For your case, you can use a command like the following in a Unix-like environment (including Linux and Win...
15,709
[ { "from": "human", "value": "I have a bunch of java files from which I want to remove the javadoc lines with the license [am changing it on my code].\nThe pattern I am looking for is\n^\\* \\* ProjectName .* USA\\.$ \nbut matched across lines\nIs there a way sed [or a commonly used editor in Windows/Linux] ...
I need to convert SAS data tables into flat files (or "ASCII files" as they were called once, as opposed to binary files). And only one flat file for each original SAS table. The challenging thing is that I want the flat file to contain some structural information of the original SAS table also, specifically: Variable...
To convert SAS data tables into flat files while preserving the structural information you've listed, you can create a custom solution using SAS. This involves exporting the data and its metadata into a format that includes all the desired attributes for each variable in the table. A commonly used format for such a req...
12,539
[ { "from": "human", "value": "I need to convert SAS data tables into flat files (or \"ASCII files\" as they were called once, as opposed to binary files). And only one flat file for each original SAS table.\nThe challenging thing is that I want the flat file to contain some structural information of the orig...
While I certainly understand the purpose of buffer annotations, I can't see what kind of errors __callback detects. Any ideas, examples?
The `__callback` annotation is often used in programming languages that support some form of static analysis or type checking, particularly in the context of APIs or systems that involve callbacks (such as JavaScript, C, or others that use function pointers). The purpose of buffer annotations and `__callback` annotatio...
12,851
[ { "from": "human", "value": "While I certainly understand the purpose of buffer annotations, I can't see what kind of errors __callback detects.\nAny ideas, examples?\n" }, { "from": "gpt", "value": "The `__callback` annotation is often used in programming languages that support some form of sta...