instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I have this string 'john smith~123 Street~Apt 4~New York~NY~12345' Using JavaScript, what is the fastest way to parse this into var name = "john smith"; var street= "123 Street"; //etc...
You can use the `split` method in JavaScript to efficiently parse the string based on the delimiter `~`. Here's a simple way to do it: ```javascript var inputString = 'john smith~123 Street~Apt 4~New York~NY~12345'; // Split the string into an array using the delimiter '~' var parts = inputString.split('~'); // Assi...
9,639
[ { "from": "human", "value": "I have this string\n'john smith~123 Street~Apt 4~New York~NY~12345'\n\nUsing JavaScript, what is the fastest way to parse this into\nvar name = \"john smith\";\nvar street= \"123 Street\";\n//etc...\n\n" }, { "from": "gpt", "value": "You can use the `split` method in...
We have made use of Passolo for a number of years, but it's kind of clunky and overpriced. It's got to be able to handle winforms and WPF.... Are there any open source alternatives?
Yes, there are several open-source alternatives to Passolo that can handle localization for WinForms and WPF applications. Here are a few options to consider: 1. **GNU gettext**: This is a widely-used tool for internationalizing and localizing applications. It supports various programming languages and can work with ....
5,909
[ { "from": "human", "value": "We have made use of Passolo for a number of years, but it's kind of clunky and overpriced.\nIt's got to be able to handle winforms and WPF....\nAre there any open source alternatives?\n" }, { "from": "gpt", "value": "Yes, there are several open-source alternatives to...
Does anyone know of an IDE for F# development that does not involve me shelling out $300? I will gladly move to F# VS Express if they ever release one, but spending money to just get started with a new language is not in my budget.
If you're looking for a free IDE for F# development, you have a few good options: 1. **Visual Studio Community Edition**: This is a free version of Visual Studio that supports F#. It's a fully featured IDE and is suitable for individual developers, open-source projects, academic research, and education. You can downlo...
9,766
[ { "from": "human", "value": "Does anyone know of an IDE for F# development that does not involve me shelling out $300? I will gladly move to F# VS Express if they ever release one, but spending money to just get started with a new language is not in my budget.\n" }, { "from": "gpt", "value": "If...
I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I've worked with, if you could even get a value for a boolean, that the value for FALSE is 0. Did TRUE used to be 0? If so, when did we switch?
The assertion that `TRUE` was defined as `0` in some programming languages is a common misconception. In most programming languages, the standard convention is that `FALSE` is represented by `0`, while `TRUE` is represented by a non-zero value, typically `1`. This is true for many languages, including C, C++, Python, a...
8,951
[ { "from": "human", "value": "I have a co-worker that maintains that TRUE used to be defined as 0 and all other values were FALSE. I could swear that every language I've worked with, if you could even get a value for a boolean, that the value for FALSE is 0. Did TRUE used to be 0? If so, when did we switc...
What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is: git log $(git merge-base HEAD branch)..branch The documentation for git-diff indicates that git diff A...B is equivalent to git diff $(git-merge-base A B) B. On the other hand, the do...
The confusion you're encountering stems from the different ways `git diff` and `git log` interpret the triple-dot notation (`...`). 1. **Understanding the Triple-Dot Notation:** - For `git diff`, `A...B` is equivalent to `$(git merge-base A B) B`, meaning it shows differences between the merged base and branch `B`...
7,067
[ { "from": "human", "value": "What is the best way to get a log of commits on a branch since the time it was branched from the current branch? My solution so far is:\ngit log $(git merge-base HEAD branch)..branch\n\nThe documentation for git-diff indicates that git diff A...B is equivalent to git diff $(git-...
I need to flip an image so that a character faces in the right direction. This needs to be done "on the fly' as they say. The issue I am having is that with Gif images, I seem to lose the transparency. (The background goes white) Below is the code: (Alternatively someone could send me to a good example) $img = imagecr...
Flipping a GIF image while maintaining transparency can be a bit tricky due to the way PHP handles image data. The core issue in your code arises from the management of transparency when using `imagecreatefromgif` and `imagecopyresampled`. Here's an improved version of your code that should preserve transparency whil...
6,647
[ { "from": "human", "value": "I need to flip an image so that a character faces in the right direction. This needs to be done \"on the fly' as they say. \nThe issue I am having is that with Gif images, I seem to lose the transparency. (The background goes white)\nBelow is the code: (Alternatively someone cou...
I want to use CSS sprites on a web site instead of separate image files, for a large collection of small icons that are all the same size. How can I concatenate (tile) them into one big image using ImageMagick?
To create a CSS sprite image using ImageMagick, you can use the `convert` command to concatenate your small icon images into a single sprite image. Below is a step-by-step guide to do this. ### Step 1: Prepare Your Icon Images Make sure all your icon images are of the same size and stored in a single directory. ### S...
7,707
[ { "from": "human", "value": "I want to use CSS sprites on a web site instead of separate image files, for a large collection of small icons that are all the same size. How can I concatenate (tile) them into one big image using ImageMagick?\n" }, { "from": "gpt", "value": "To create a CSS sprite ...
I want to use a real IDE for editing javascript files in combination with Firebug. In the 'Add editor' dialog for Firebug I'm allowed to specify executable and arguments. So the question is really how do I open a file in Eclipse/Netbeans from the command line. Extra points for allowing me to choose between opening a n...
To set up Eclipse or NetBeans as the external editor for Firebug, you need to know how to open files from the command line with the options to either launch a new instance or reuse an existing instance. Below are instructions for both IDEs: ### Eclipse **Opening a file in Eclipse from the command line:** 1. **Execut...
5,905
[ { "from": "human", "value": "I want to use a real IDE for editing javascript files in combination with Firebug. In the 'Add editor' dialog for Firebug I'm allowed to specify executable and arguments. So the question is really how do I open a file in Eclipse/Netbeans from the command line. \nExtra points for...
I am new to ActionScript 3 and have run into a problem: Using Flex Builder 3, I have a created a project with a few simple classes. If code in class A instantiates an object of class B (class B is in its own source file) then the code compiles fine, but I get the following run time error: ArgumentError: Error #2012: B...
The runtime error `ArgumentError: Error #2012: B class cannot be instantiated` typically occurs in ActionScript 3 when you attempt to instantiate an abstract class or an interface. Here are a few common reasons for this error and how to address them: 1. **Abstract Class or Interface**: Check if the class B is declared...
7,996
[ { "from": "human", "value": "I am new to ActionScript 3 and have run into a problem:\nUsing Flex Builder 3, I have a created a project with a few simple classes. If code in class A instantiates an object of class B (class B is in its own source file) then the code compiles fine, but I get the following run ...
The problem I'm trying to solve is "What's at this position?" It's fairly trivial to get the x/y position (offset) of a DIV, but what about the reverse? How do I get the id of a DIV (or any element) given an x/y position?
To find the id (or any attributes) of a DIV (or any HTML element) at a given x/y position on the page, you can use the `document.elementFromPoint()` method in JavaScript. This method takes the x and y coordinates as arguments and returns the topmost element at that point. Here’s how you can do this: 1. Get the x and ...
7,690
[ { "from": "human", "value": "The problem I'm trying to solve is \"What's at this position?\"\nIt's fairly trivial to get the x/y position (offset) of a DIV, but what about the reverse? How do I get the id of a DIV (or any element) given an x/y position?\n" }, { "from": "gpt", "value": "To find t...
I have a database with names in it such as John Doe etc. Unfortunately some of these names contain quotes like Keiran O'Keefe. Now when I try and search for such names as follows: SELECT * FROM PEOPLE WHERE SURNAME='O'Keefe' I (understandably) get an error. How do I prevent this error from occurring. I am using Orac...
When dealing with string literals that contain single quotes in SQL, you need to escape those single quotes to avoid syntax errors. In Oracle SQL, you can escape a single quote by doubling it. For example, if you want to search for the surname `O'Keefe`, you should write it as `O''Keefe` in your query. Here is how yo...
8,501
[ { "from": "human", "value": "I have a database with names in it such as John Doe etc. Unfortunately some of these names contain quotes like Keiran O'Keefe. Now when I try and search for such names as follows:\nSELECT * FROM PEOPLE WHERE SURNAME='O'Keefe' \n\nI (understandably) get an error.\nHow do I preve...
When we compile a dll using __stdcall inside visual studio 2008 the compiled function names inside the dll are. FunctionName Though when we compile the same dll using GCC using wx-dev-cpp GCC appends the number of paramers the function has, so the name of the function using Dependency walker looks like. FunctionName@nu...
In GCC, the `@numberOfParameters` suffix that you see in the exported symbols is a result of the calling convention you are using, specifically `__stdcall`. This suffix indicates the amount of stack space that is cleaned up after the function call, which is essential for the `__stdcall` calling convention. To prevent ...
7,588
[ { "from": "human", "value": "When we compile a dll using __stdcall inside visual studio 2008 the compiled function names inside the dll are.\nFunctionName\nThough when we compile the same dll using GCC using wx-dev-cpp GCC appends the number of paramers the function has, so the name of the function using De...
PowerShell is definitely in the category of dynamic languages, but would it be considered strongly typed?
PowerShell is generally considered to be a dynamically typed language. In a dynamically typed language, types are determined at runtime, and you do not have to explicitly declare the type of a variable when you create it. You can assign a value of any type to a variable, and that variable's type can change at runtime. ...
9,084
[ { "from": "human", "value": "PowerShell is definitely in the category of dynamic languages, but would it be considered strongly typed? \n" }, { "from": "gpt", "value": "PowerShell is generally considered to be a dynamically typed language. In a dynamically typed language, types are determined at...
Need a function that takes a character as a parameter and returns true if it is a letter.
You can create a function in Python to check if a given character is a letter. Here's a simple implementation: ```python def is_letter(char): # Check if the character is a single character and if it is alphabetic return len(char) == 1 and char.isalpha() # Example usage print(is_letter('A')) # True print(is_l...
9,817
[ { "from": "human", "value": "Need a function that takes a character as a parameter and returns true if it is a letter.\n" }, { "from": "gpt", "value": "You can create a function in Python to check if a given character is a letter. Here's a simple implementation:\n\n```python\ndef is_letter(char)...
Is it possible to create images with PHP (as opposed to simply linking to them via HTML) and if so, where should I go first to learn about such a thing?
Yes, it is absolutely possible to create images using PHP. The primary way to do this is by using the **GD** library, which is a popular graphics library in PHP for dynamically creating and manipulating images. Another option is the **Imagick** extension, which is a PHP extension for the ImageMagick library, offering m...
3,754
[ { "from": "human", "value": "Is it possible to create images with PHP (as opposed to simply linking to them via HTML) and if so, where should I go first to learn about such a thing?\n" }, { "from": "gpt", "value": "Yes, it is absolutely possible to create images using PHP. The primary way to do ...
How do I grep and show the preceding and following 5 lines surrounding each matched line?
To grep and display the preceding and following 5 lines surrounding each matched line, you can use the `-B` (before) and `-A` (after) options with the `grep` command. Here is the syntax you can use: ```bash grep -B 5 -A 5 'pattern' filename ``` - `-B 5` specifies that you want to display 5 lines before the matching...
5,664
[ { "from": "human", "value": "How do I grep and show the preceding and following 5 lines surrounding each matched line?\n" }, { "from": "gpt", "value": "To grep and display the preceding and following 5 lines surrounding each matched line, you can use the `-B` (before) and `-A` (after) options wi...
I'd like to populate an arraylist by specifying a list of values just like I would an integer array, but am unsure of how to do so without repeated calls to the "add" method. For example, I want to assign { 1, 2, 3, "string1", "string2" } to an arraylist. I know for other arrays you can make the assignment like: int[...
In Java, you cannot directly use curly braces `{}` to initialize an `ArrayList` in the same way you would for a regular array. However, you can use a few different methods to achieve similar functionality without repeatedly calling the `add` method. ### Method 1: Using Arrays.asList One of the most common ways to init...
6,695
[ { "from": "human", "value": "I'd like to populate an arraylist by specifying a list of values just like I would an integer array, but am unsure of how to do so without repeated calls to the \"add\" method.\nFor example, I want to assign { 1, 2, 3, \"string1\", \"string2\" } to an arraylist. I know for oth...
I have updated my ant build.xml file to include a new file and a new folder. After creating the .jar I check if they exist in the jar by 'unzip\extract', and they are there. But when executing the .jar neither the folder or the file gets extracted. Am I missing a step?
When you create a JAR file that includes new files and folders, but those items do not seem to be accessed when executing the JAR, there are a few things to check: 1. **Verify the Resource Access Path**: Ensure that when you are trying to access the new file and folder in your code, you are using the correct path. The...
7,098
[ { "from": "human", "value": "I have updated my ant build.xml file to include a new file and a new folder. After creating the .jar I check if they exist in the jar by 'unzip\\extract', and they are there.\nBut when executing the .jar neither the folder or the file gets extracted.\nAm I missing a step?\n" ...
Given this example: <img class="a" /> <img /> <img class="a" /> <img class="a" id="active" /> <img class="a" /> <img class="a" /> <img /> <img class="a" /> (I've just used img tags as an example, that's not what it is in my code) Using jQuery, how would you select the img tags with class "a" that are adjacent to #acti...
Yes, you can select the adjacent elements using jQuery without having to loop through them manually. jQuery provides the `prevAll()` and `nextAll()` methods, which can be used to retrieve all preceding and following siblings, respectively. Then, you can filter those results to find the elements that match your criteria...
8,218
[ { "from": "human", "value": "Given this example:\n<img class=\"a\" />\n<img />\n<img class=\"a\" />\n<img class=\"a\" id=\"active\" />\n<img class=\"a\" />\n<img class=\"a\" />\n<img />\n<img class=\"a\" />\n\n(I've just used img tags as an example, that's not what it is in my code)\nUsing jQuery, how would...
I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE. What are the steps to create such an executable?
Creating a single executable (EXE) from a C# application that uses a C++ DLL involves several steps. You can achieve this using tools that allow you to package your application and its dependencies. Below are the steps to create a single EXE for your C# program that uses a C++ DLL: ### Steps to Create a Single EXE: 1...
6,415
[ { "from": "human", "value": "I have a Windows C# program that uses a C++ dll for data i/o. My goal is to deploy the application as a single EXE. \nWhat are the steps to create such an executable?\n" }, { "from": "gpt", "value": "Creating a single executable (EXE) from a C# application that uses...
I want the server to always serve dates in UTC in the HTML, and have JavaScript on the client site convert it to the user's local timezone. Bonus if I can output in the user's locale date format.
To achieve serving dates in UTC from your server and converting them to the user's local timezone in the client's JavaScript while formatting it according to the user's locale, you can follow these steps: ### Step 1: Serve Dates in UTC from the Server When you output the date in your HTML, ensure it is in a standard ...
4,671
[ { "from": "human", "value": "I want the server to always serve dates in UTC in the HTML, and have JavaScript on the client site convert it to the user's local timezone.\nBonus if I can output in the user's locale date format.\n" }, { "from": "gpt", "value": "To achieve serving dates in UTC from ...
This came up in Hidden features of Python, but I can't see good documentation or examples that explain how the feature works.
It sounds like you're referring to a specific feature of Python that might not be widely documented or is considered less common. Could you please specify which feature you are asking about? That way, I can provide a clearer explanation, examples, and relevant documentation if available.
11,313
[ { "from": "human", "value": "This came up in Hidden features of Python, but I can't see good documentation or examples that explain how the feature works.\n" }, { "from": "gpt", "value": "It sounds like you're referring to a specific feature of Python that might not be widely documented or is c...
In PHP, if you return a reference to a protected/private property to a class outside the scope of the property does the reference override the scope? e.g. class foo { protected bar = array(); getBar() { return &bar; } } class foo2 { blip = new foo().getBar(); // i know this isn't php } Is this correct...
In PHP, when you return a reference to a protected or private property, the reference does not override the visibility scope of that property. Instead, it still respects the access control mechanisms defined by the language. In your example, the `bar` property is declared as `protected`, which means it can only be acc...
7,431
[ { "from": "human", "value": "In PHP, if you return a reference to a protected/private property to a class outside the scope of the property does the reference override the scope?\ne.g.\nclass foo\n{\n protected bar = array();\n getBar()\n {\n return &bar;\n }\n\n}\n\nclass foo2\n{\n blip = new foo()...
The log4j network adapter sends events as a serialised java object. I would like to be able to capture this object and deserialise it in a different language (python). Is this possible? NOTE The network capturing is easy; its just a TCP socket and reading in a stream. The difficulty is the deserialising part
Deserializing a serialized Java object in Python can be quite challenging due to differences in how Java and Python handle serialization. Java uses its own serialization mechanism, which is not directly compatible with Python. However, there are ways to approach this problem. ### Steps to Deserializing Java Objects in...
6,134
[ { "from": "human", "value": "The log4j network adapter sends events as a serialised java object. I would like to be able to capture this object and deserialise it in a different language (python). Is this possible?\nNOTE The network capturing is easy; its just a TCP socket and reading in a stream. The diffi...
What is a "table-driven method"? As mentioned by Bill Gates in the second Windows Vista commercial at 1:05.
The "table-driven method" refers to a programming approach or design pattern where behavior or decision-making is implemented using a data table instead of hardcoding logic directly into the code. This method allows for more flexibility and easier maintenance, as changes can be made simply by updating the data in the t...
10,252
[ { "from": "human", "value": "What is a \"table-driven method\"?\nAs mentioned by Bill Gates in the second Windows Vista commercial at 1:05.\n" }, { "from": "gpt", "value": "The \"table-driven method\" refers to a programming approach or design pattern where behavior or decision-making is impleme...
Can anyone recommend a good (preferably open source) tool for creating WSDL files for some soap web services? I've tried playing around with some of the eclipse plug ins available and was less than impressed with what I found.
If you're looking for good open-source tools for creating WSDL files for SOAP web services, here are some options that you might find helpful: 1. **SoapUI**: SoapUI is a popular open-source tool for testing SOAP and REST web services. It has a user-friendly interface that allows you to create, modify, and manage WSDL ...
7,669
[ { "from": "human", "value": "Can anyone recommend a good (preferably open source) tool for creating WSDL files for some soap web services?\nI've tried playing around with some of the eclipse plug ins available and was less than impressed with what I found.\n" }, { "from": "gpt", "value": "If you...
If you need more details, let me know. EDIT: Changed title for clarity purposes.
It seems like you might be looking to provide additional context or details for a discussion or inquiry. Please go ahead and share the specific information or questions you have in mind, and I'll do my best to assist you!
11,774
[ { "from": "human", "value": "If you need more details, let me know.\nEDIT: Changed title for clarity purposes.\n" }, { "from": "gpt", "value": "It seems like you might be looking to provide additional context or details for a discussion or inquiry. Please go ahead and share the specific informat...
Is there a preferred way to handle animation when using Flex -- For instance, if I want to render a ball and bounce it around the screen?
When working with Flex, particularly with animations like bouncing a ball around the screen, you can use several approaches, but a common and preferred way is to utilize the `Animate` class and the `Motion` and `Animate` features introduced in Flex 4. Here's a step-by-step guide to create a bouncing ball animation: ##...
4,971
[ { "from": "human", "value": "Is there a preferred way to handle animation when using Flex -- For instance, if I want to render a ball and bounce it around the screen?\n" }, { "from": "gpt", "value": "When working with Flex, particularly with animations like bouncing a ball around the screen, you...
I was introduced to VisualAssist a few years ago and for me there's no going back. Are there any other tools I'm missing out on?
Visual Assist is indeed a popular tool among developers for improving productivity in environments like Visual Studio. If you’re looking for additional tools that can enhance your coding experience, here are some suggestions: 1. **ReSharper**: This is a comprehensive extension for Visual Studio that provides code anal...
7,009
[ { "from": "human", "value": "I was introduced to VisualAssist a few years ago and for me there's no going back. Are there any other tools I'm missing out on?\n" }, { "from": "gpt", "value": "Visual Assist is indeed a popular tool among developers for improving productivity in environments like ...
I need to get the number of digits containing the number 1. I know in java I can take the input as a String and use charAt, but I understand there is no implicit String function in C. How can I accomplish this?
In C, you can accomplish counting the number of digits that contain the digit '1' without needing a string library by reading the input as a string using standard I/O functions. While it is true that C does not have implicit string manipulation functions like Java, you can easily create a simple approach to count the o...
5,945
[ { "from": "human", "value": "I need to get the number of digits containing the number 1. I know in java I can take the input as a String and use charAt, but I understand there is no implicit String function in C. How can I accomplish this?\n" }, { "from": "gpt", "value": "In C, you can accomplis...
I recently "needed" a zip function in Perl 5 (while I was thinking about How do I calculate relative time?), i.e. a function that takes two lists and "zips" them together to one list, interleaving the elements. (Pseudo)example: @a=(1, 2, 3); @b=('apple', 'orange', 'grape'); zip @a, @b; # (1, 'apple', 2, 'orange', 3, '...
In Perl 5, you can create a `zip` function to interleave two lists quite easily. Here’s a simple implementation that uses a loop to achieve this. We can define the `zip` function in a way that takes any number of arrays and combines them: ```perl sub zip { my @arrays = @_; my @result; # Find the minimum l...
5,928
[ { "from": "human", "value": "I recently \"needed\" a zip function in Perl 5 (while I was thinking about How do I calculate relative time?), i.e. a function that takes two lists and \"zips\" them together to one list, interleaving the elements.\n(Pseudo)example: \n@a=(1, 2, 3);\n@b=('apple', 'orange', 'grape...
I have a few lines of PowerShell code that I would like to use as an automated script. The way I would like it to be able to work is to be able to call it using one of the following options: One command line that opens PowerShell, executes script and closes PowerShell (this would be used for a global build-routine) A ...
Certainly! You can achieve both of your requirements by creating a PowerShell script file and then invoking it from the command line or by double-clicking the file. Here's how you can do it: ### Step 1: Create the PowerShell Script 1. Open a text editor (like Notepad). 2. Write your PowerShell code in it. For example...
7,561
[ { "from": "human", "value": "I have a few lines of PowerShell code that I would like to use as an automated script. The way I would like it to be able to work is to be able to call it using one of the following options:\n\nOne command line that opens PowerShell, executes script and closes PowerShell (this w...
Note that this question continues from Is it possible to coax Visual Studio 2008 into using italics for comments? If the long question title got you, here's the problem: How to convert the style property of the Consolas Italic font to Bold without actually modifying any of its actual glyphs? That is, we want the fon...
To modify the style property of the Consolas Italic font to appear as bold without altering the actual glyphs, you will need to follow these steps: ### Step 1: Font Editing Tool You will need a font editing tool that allows you to manipulate the metadata of font files. Although you specified not to mention any tools b...
5,831
[ { "from": "human", "value": "\nNote that this question continues from Is it possible to coax Visual Studio 2008 into using italics for comments?\n\nIf the long question title got you, here's the problem:\n\nHow to convert the style property of the Consolas Italic font to Bold without actually modifying any ...
If you need to open a SqlConnection before issuing queries, can you simply handle all non-Open ConnectionStates in the same way? For example: if (connection.State != ConnectionState.Open) { connection.Open(); } I read somewhere that for ConnectionState.Broken the connection needs to be closed befo...
Yes, you are correct in your understanding of the behavior of `SqlConnection` in ADO.NET. The `SqlConnection` can be in several states, including `Closed`, `Open`, `Connecting`, `Executing`, `Fetching`, and `Broken`. When dealing with `ConnectionState`, it's important to specifically handle the `Broken` state differen...
8,199
[ { "from": "human", "value": "If you need to open a SqlConnection before issuing queries, can you simply handle all non-Open ConnectionStates in the same way? For example:\n if (connection.State != ConnectionState.Open)\n {\n connection.Open();\n }\n\nI read somewhere that for ConnectionStat...
How do you create a weak reference to an object in Python?
In Python, you can create a weak reference to an object using the `weakref` module. A weak reference allows you to reference an object without preventing it from being garbage collected. This can be useful in scenarios where you want to avoid circular references or manage memory more effectively. Here's how you can cr...
6,039
[ { "from": "human", "value": "How do you create a weak reference to an object in Python? \n" }, { "from": "gpt", "value": "In Python, you can create a weak reference to an object using the `weakref` module. A weak reference allows you to reference an object without preventing it from being garba...
I'm using httpc:request to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service. Is there a function in Erlang that is similar to CGI.escape in Ruby for this purpos...
In Erlang, you can URL-encode data similarly to how `CGI.escape` works in Ruby. While Erlang does not have a built-in function that directly mimics `CGI.escape`, you can use the `http_uri` module to help with URL-encoding. Here’s how you can implement URL-encoding in Erlang: 1. Use `http_uri:encode_query/1` if you ha...
9,416
[ { "from": "human", "value": "I'm using httpc:request to post some data to a remote service. I have the post working but the data in the body() of the post comes through as is, without any URL-encoding which causes the post to fail when parsed by the remote service.\nIs there a function in Erlang that is sim...
I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of .NET examples, but no success unmanaged). Thanks.
To find the name of the default printer in Windows using unmanaged C++, you can use the Windows API. The `GetDefaultPrinter` function, introduced in Windows Vista, allows you to retrieve the name of the default printer. Here’s an example of how to do this: ```cpp #include <windows.h> #include <iostream> #include <str...
7,626
[ { "from": "human", "value": "I'm looking for a way to find the name of the Windows default printer using unmanaged C++ (found plenty of .NET examples, but no success unmanaged). Thanks.\n" }, { "from": "gpt", "value": "To find the name of the default printer in Windows using unmanaged C++, you c...
(sorry I should have been clearer with the code the first time I posted this. Hope this makes sense) File "size_specification.rb" class SizeSpecification def fits? end end File "some_module.rb" require 'size_specification' module SomeModule def self.sizes YAML.load_file(File.dirname(__FILE__) + '/size_...
The issue you're encountering is related to how Ruby's YAML deserialization works. When you load YAML data, it creates instances of the classes specified in the YAML file. In your case, it seems that the `SizeSpecification` class is not correctly initialized with the `height` and `width` attributes when the YAML is loa...
8,234
[ { "from": "human", "value": "(sorry I should have been clearer with the code the first time I posted this. Hope this makes sense)\nFile \"size_specification.rb\"\nclass SizeSpecification\n def fits? \n end\nend\n\nFile \"some_module.rb\"\nrequire 'size_specification'\n\nmodule SomeModule\n def self.s...
I'm hoping there's a way to avoid custom configuration files if an application runs in a single AppDomain.
In applications that run within a single AppDomain, you can often avoid custom configuration files by using several alternative approaches. Here are some strategies to consider: 1. **Programmatic Configuration**: Instead of relying on a configuration file, you can set your configuration options directly in code. For e...
4,324
[ { "from": "human", "value": "I'm hoping there's a way to avoid custom configuration files if an application runs in a single AppDomain.\n" }, { "from": "gpt", "value": "In applications that run within a single AppDomain, you can often avoid custom configuration files by using several alternative...
Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is no (due to type erasure), but I'd be interested if anyone can see something I'm missing: class SomeContainer<E> { E createContents() { return what??? } } EDIT: It turns out that S...
You're correct that due to type erasure in Java, you cannot directly create an instance of a generic type `E` at runtime. This means that the information about the specific type parameter is not available when the program is running. However, there are some common strategies that can help you work around this limitatio...
6,141
[ { "from": "human", "value": "Is it possible to create an instance of a generic type in Java? I'm thinking based on what I've seen that the answer is no (due to type erasure), but I'd be interested if anyone can see something I'm missing:\nclass SomeContainer<E>\n{\n E createContents()\n {\n ret...
I have created a foreign key (in SQL Server) by: alter table company add CountryID varchar(3); alter table company add constraint Company_CountryID_FK foreign key(CountryID) references Country; I then run this query: alter table company drop column CountryID; and I get this error: Msg 5074, Level 16, State 4, Line ...
To drop the `CountryID` column from the `company` table, you first need to drop the foreign key constraint that is associated with that column. The syntax you used to drop the foreign key is incorrect. Here’s the correct way to drop the foreign key constraint before you drop the column: 1. Drop the foreign key constra...
10,182
[ { "from": "human", "value": "I have created a foreign key (in SQL Server) by:\nalter table company add CountryID varchar(3);\nalter table company add constraint Company_CountryID_FK foreign key(CountryID) \nreferences Country;\n\nI then run this query:\nalter table company drop column CountryID;\n\nand I ge...
Is there any way to enforce a template in Bugzilla to guide users fill in bugs descriptions ? Actually, i'd like to put some markup texts in the bug description field and avoid the creation of custom fields. I've installed version 3.2rc1.
In Bugzilla, you can indeed enforce a template for bug descriptions without creating custom fields. However, the ability to enforce a specific bug description template directly through the user interface is somewhat limited. Instead, you can utilize the following methods to guide users in filling out bug descriptions: ...
7,176
[ { "from": "human", "value": "Is there any way to enforce a template in Bugzilla to guide users fill in bugs descriptions ?\nActually, i'd like to put some markup texts in the bug description field and avoid the creation of custom fields.\nI've installed version 3.2rc1.\n" }, { "from": "gpt", "va...
Given the following: List<List<Option>> optionLists; what would be a quick way to determine the subset of Option objects that appear in all N lists? Equality is determined through some string property such as option1.Value == option2.Value. So we should end up with List<Option> where each item appears only once.
To determine the subset of `Option` objects that appear in all lists contained within `optionLists`, you can use a combination of LINQ and hash sets for efficient lookups. Here’s a quick approach in C# to achieve this: 1. First, check if `optionLists` is empty. If it is, return an empty list. 2. Create a hash set with...
5,870
[ { "from": "human", "value": "Given the following:\nList<List<Option>> optionLists;\n\nwhat would be a quick way to determine the subset of Option objects that appear in all N lists? Equality is determined through some string property such as option1.Value == option2.Value.\nSo we should end up with List<Opt...
We are working on an S60 version and this platform has a nice Python API.. However, there is nothing official about Python on Android, but since Jython exists, is there a way to let the snake and the robot work together??
Yes, you can use Python with Android applications, though it's not officially supported in the same way that Java or Kotlin are. Jython is one option, but it has limitations, especially in terms of using native Android libraries and components, since it compiles Python code to Java bytecode and doesn't support some fea...
7,612
[ { "from": "human", "value": "We are working on an S60 version and this platform has a nice Python API..\nHowever, there is nothing official about Python on Android, but since Jython exists, is there a way to let the snake and the robot work together??\n" }, { "from": "gpt", "value": "Yes, you ca...
Are there any tools or plugins to design a Panel independently of a Form (Windows, not Web Form) within Visual Studio? I've been using the designer and manually extracting the bits I want from the source, but surely there is a nicer way.
Yes, there are tools and options that can help you design a Panel independently of a Form in a Windows Forms application within Visual Studio. Here are a few methods and tools that you might find useful: 1. **User Controls**: One of the best ways to create reusable UI components in Windows Forms is to create a User Co...
4,527
[ { "from": "human", "value": "Are there any tools or plugins to design a Panel independently of a Form (Windows, not Web Form) within Visual Studio?\nI've been using the designer and manually extracting the bits I want from the source, but surely there is a nicer way.\n" }, { "from": "gpt", "valu...
From my understanding the XMPP protocol is based on an always-on connection where you have no, immediate, indication of when an XML message ends. This means you have to evaluate the stream as it comes. This also means that, probably, you have to deal with asynchronous connections since the socket can block in the midd...
You are correct in your understanding of the XMPP (Extensible Messaging and Presence Protocol) protocol and how it operates. Here are the answers to your points, along with sources for each: 1. **Always-On Connection**: XMPP is designed for persistent, always-on connections, which allows for real-time messaging and pr...
8,118
[ { "from": "human", "value": "From my understanding the XMPP protocol is based on an always-on connection where you have no, immediate, indication of when an XML message ends.\nThis means you have to evaluate the stream as it comes. This also means that, probably, you have to deal with asynchronous connecti...
My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions?
If you suspect that the incoming XML files are invalid or incomplete, here are some steps you can take to troubleshoot and resolve the issue: 1. **Validate XML Structure**: - Use an XML validator tool (online or offline) to check if the incoming XML files are well-formed. Look for mismatched tags, missing closing t...
4,815
[ { "from": "human", "value": "My strongest lead is that the code who deals with the incoming XMLs is actually receiving an invalid/incomplete file hence failing the DOM parsing. Any suggestions?\n" }, { "from": "gpt", "value": "If you suspect that the incoming XML files are invalid or incomplete,...
I'm not sure I'm using all the correct terminology here so be forgiving. I just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code. It's a shared host and we have another site...
Yes, you are correct in your understanding that the `mail()` function in PHP relies on the mail server configuration for sending emails. Here's a breakdown of the situation you described: 1. **Shared Hosting and Mail Function**: The `mail()` function uses the server's mail transfer agent (MTA) to send emails. For this...
6,399
[ { "from": "human", "value": "I'm not sure I'm using all the correct terminology here so be forgiving.\nI just put up a site with a contact form that sends an email using the PHP mail() function. Simple enough. However the live site doesn't actually send the email, the test site does. So it's not my code. \n...
How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.
Loading an external JavaScript file using a bookmarklet is a useful technique, especially for extending functionality on web pages. Bookmarklets are typically limited by the URL length, but you can work around this limitation by using the `javascript:` URL scheme to dynamically inject and load a script. Here's how you...
6,726
[ { "from": "human", "value": "How can I load an external JavaScript file using a bookmarklet? This would overcome the URL length limitations of IE and generally keep things cleaner.\n" }, { "from": "gpt", "value": "Loading an external JavaScript file using a bookmarklet is a useful technique, es...
I'm planning to install Drupal. Is there any reason not to install the latest 6.x version as opposed to the 5.x branch? Are there any really good modules that are 5.x only?
When considering whether to install Drupal 6.x versus 5.x, there are several important factors to take into account: 1. **End of Life for Drupal 5.x**: Drupal 5 has reached its end-of-life status, which means it no longer receives security updates, bug fixes, or support from the Drupal community. This makes it a less ...
8,200
[ { "from": "human", "value": "I'm planning to install Drupal. Is there any reason not to install the latest 6.x version as opposed to the 5.x branch? Are there any really good modules that are 5.x only?\n" }, { "from": "gpt", "value": "When considering whether to install Drupal 6.x versus 5.x, th...
Take this code: <?php if (isset($_POST['action']) && !empty($_POST['action'])) { $action = $_POST['action']; } if ($action) { echo $action; } else { echo 'No variable'; } ?> And then access the file with ?action=test Is there any way of preventing $action from automatically being declared by the GET? Oth...
In the PHP code you provided, you're using `$_POST` to get the `action` variable. When you access the file with a query string like `?action=test`, the `action` variable isn't coming from `$_POST`, but it is being set by the `$_GET` superglobal. Here's the key point: if you want to ensure that the `$action` variable i...
8,097
[ { "from": "human", "value": "Take this code:\n<?php\nif (isset($_POST['action']) && !empty($_POST['action'])) {\n $action = $_POST['action'];\n}\n\nif ($action) {\n echo $action;\n}\nelse { \n echo 'No variable';\n}\n?>\n\nAnd then access the file with ?action=test\nIs there any way of preventing $...
Is there any way to use a constant as a hash key? For example: use constant X => 1; my %x = (X => 'X'); The above code will create a hash with "X" as key and not 1 as key. Whereas, I want to use the value of constant X as key.
In Perl, when you define a constant using `use constant`, the constant is not automatically evaluated in a context where its value is required. When you use `X` as a key in your hash, it's treated as the string `"X"` instead of its associated value (which is `1` in your case). To use the constant's value as a key in t...
9,905
[ { "from": "human", "value": "Is there any way to use a constant as a hash key?\nFor example:\nuse constant X => 1;\n\nmy %x = (X => 'X');\n\nThe above code will create a hash with \"X\" as key and not 1 as key. Whereas, I want to use the value of constant X as key.\n" }, { "from": "gpt", "value"...
Why are there two A/D converters on the USRP2 board if you can only use one RX daughtercard?
The presence of two A/D converters on the USRP2 board, even when only one receive (RX) daughterboard is in use, is primarily for flexibility and future-proofing. Here are a few reasons why this design choice might have been made: 1. **Dual-Channel Support**: The USRP2 board is designed to accommodate advanced signal p...
7,880
[ { "from": "human", "value": "Why are there two A/D converters on the USRP2 board if you can only use one RX\ndaughtercard?\n" }, { "from": "gpt", "value": "The presence of two A/D converters on the USRP2 board, even when only one receive (RX) daughterboard is in use, is primarily for flexibility...
The above error message comes up just before SQL Server marks the database as "Suspect" and refuses to open it. Does anyone know what the message means and how to fix it? I think it's a matter of grabbing the backup, but would be nice if it was possible to recover the data. I've had a look at the kb article but there a...
When a SQL Server database is marked as "Suspect," it indicates that SQL Server has determined that the database is in an unhealthy state. This could be due to various reasons, including corruption, hardware issues, or insufficient resources. The error message that accompanies the database being marked as suspect may p...
6,862
[ { "from": "human", "value": "The above error message comes up just before SQL Server marks the database as \"Suspect\" and refuses to open it. Does anyone know what the message means and how to fix it? I think it's a matter of grabbing the backup, but would be nice if it was possible to recover the data.\nI...
How does the open-source/free software community develop drivers for products that offer no documentation?
The open-source/free software community often faces challenges when developing drivers for products that lack documentation. However, they have several strategies and methodologies that can help facilitate the process. Here are some key approaches: 1. **Reverse Engineering**: - One of the primary methods for devel...
7,299
[ { "from": "human", "value": "How does the open-source/free software community develop drivers for products that offer no documentation?\n" }, { "from": "gpt", "value": "The open-source/free software community often faces challenges when developing drivers for products that lack documentation. Ho...
How can I, as the wiki admin, enter scripting (Javascript) into a Sharepoint wiki page? I would like to enter a title and, when clicking on that, having displayed under it a small explanation. I usually have done that with javascript, any other idea?
To add JavaScript to a SharePoint wiki page, you need to be aware of some limitations and best practices. SharePoint's modern experience tends to restrict direct JavaScript inclusion for security reasons. However, if you are using SharePoint classic experience or if your organization allows it, here’s a method you can ...
6,110
[ { "from": "human", "value": "How can I, as the wiki admin, enter scripting (Javascript) into a Sharepoint wiki page?\nI would like to enter a title and, when clicking on that, having displayed under it a small explanation. I usually have done that with javascript, any other idea?\n" }, { "from": "gp...
Are there any import and export tools that would let us move projects into and out of team system with full history and log? Our current SCM is SVN. PS - Sorry, I know it's a repost, but I didn't get an answer before... :)
Migrating projects between version control systems (VCS) like Subversion (SVN) and Team System (TFS, now known as Azure DevOps) can be complex, especially when you want to preserve full history and logs. Here are some tools and methods you can consider for this process: 1. **SVN2TFS**: This is a command-line tool that...
8,136
[ { "from": "human", "value": "Are there any import and export tools that would let us move projects into and out of team system with full history and log? Our current SCM is SVN.\nPS - Sorry, I know it's a repost, but I didn't get an answer before... :)\n" }, { "from": "gpt", "value": "Migrating ...
My keyboard acts flaky when I use a terminal session on OS X (another question?), so using the command line is often frustrating. Other native applications seem fine and don't suffer the same problem. Is there another terminal application that might work better for me?
If you're experiencing issues with the default Terminal application on macOS, there are several alternative terminal applications you can try that may provide a more stable experience: 1. **iTerm2**: This is one of the most popular alternatives to the built-in Terminal. It offers many features like split panes, better...
6,876
[ { "from": "human", "value": "My keyboard acts flaky when I use a terminal session on OS X (another question?), so using the command line is often frustrating. Other native applications seem fine and don't suffer the same problem. Is there another terminal application that might work better for me?\n" },...
I have Visual Studio web test attached nicely to a data source, but I need to be able to iterate over each entry in the data source. How should I do this?
In Visual Studio, you can iterate over each entry in a data source within a web test by using the built-in Data Binding capabilities of web tests. Here's how to set it up: ### Step-by-Step Guide to Iterate Over Data Source in a Web Test 1. **Create or Open Your Web Test**: - Open Visual Studio and load the existin...
5,565
[ { "from": "human", "value": "I have Visual Studio web test attached nicely to a data source, but I need to be able to iterate over each entry in the data source. How should I do this?\n" }, { "from": "gpt", "value": "In Visual Studio, you can iterate over each entry in a data source within a web...
Did Installing OneCare cause a "Generating user instances in SQL Server is disabled" error? The only change that I've made to my computer is uninstalling AVG and installing the trial for Microsoft OneCare. Did OneCare change the SQLServer installation somehow? This is a very "odd" question but is something I would post...
The error message "Generating user instances in SQL Server is disabled" typically relates to SQL Server Express, where it indicates that the instance is configured not to allow the creation of user instances. User instances are a feature of SQL Server Express that allows users to run applications that access SQL Server...
6,078
[ { "from": "human", "value": "Did Installing OneCare cause a \"Generating user instances in SQL Server is disabled\" error?\nThe only change that I've made to my computer is uninstalling AVG and installing the trial for Microsoft OneCare. Did OneCare change the SQLServer installation somehow?\nThis is a very...
I set a passphrase when creating a new SSH key on my laptop. But, as I realise now, this is quite painful when you are trying to commit (Git and SVN) to a remote location over SSH many times in an hour. One way I can think of is, delete my SSH keys and create new. Is there a way to remove the passphrase, while still ke...
Yes, you can remove the passphrase from your existing SSH key without having to delete and recreate the keys. Here's how you can do it using the `ssh-keygen` command: 1. **Open your terminal.** 2. **Use the following command to remove the passphrase:** ```bash ssh-keygen -p -f /path/to/your/private_key ``` ...
9,769
[ { "from": "human", "value": "I set a passphrase when creating a new SSH key on my laptop. But, as I realise now, this is quite painful when you are trying to commit (Git and SVN) to a remote location over SSH many times in an hour.\nOne way I can think of is, delete my SSH keys and create new. Is there a wa...
I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers. I have been looking online trying to find real differences between the two and have asked on crackoverflow. The only ma...
When responding to an interviewer who expresses a preference for a C# developer, it's important to emphasize your adaptability, your relevant experience in programming languages, and your eagerness to learn and transition into C#. Here's how you might frame your response: --- **Sample Response:** "I understand that ...
5,739
[ { "from": "human", "value": "I have been a VB.net developer for a few years now but I am currently applying to a few companies that use C#. I have even been told that at least one of the companies doesn't want VB.net developers. \nI have been looking online trying to find real differences between the two an...
We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePanel is sending the whole page back to the ser...
Using an UpdatePanel in ASP.NET can sometimes lead to inefficient page updates, especially if you're dealing with a large amount of jQuery or complex client-side interactions. Instead of sending the entire page back to the server, consider using more modern approaches that can help reduce the maintenance overhead and i...
5,348
[ { "from": "human", "value": "We've got a page with a ton of jQuery (approximately 2000 lines) that we want to trim down b/c it is a maintenance nightmare, and it might be easier to maintain on the server. We've thought about using UpdatePanel for this. However, we don't like the fact that the UpdatePanel ...
In SpiderMonkey, how do I get the value of a property of a JSObject from within my C code? static JSBool JSD_getter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) { jsval js_id; JS_GetProperty(cx, obj, "id", &js_id); // js_id has JavaScript type int c_id; JS_ValueToInt32(cx, js_id, ...
To retrieve the value of a property from a `JSObject` in SpiderMonkey using C, you can follow the pattern you've laid out in your `JSD_getter` function. However, there are a couple of best practices and improvements that can be made. Here's the corrected and complete code example for your `JSD_getter` function: ```c ...
7,489
[ { "from": "human", "value": "In SpiderMonkey, how do I get the value of a property of a JSObject from within my C code?\nstatic JSBool\nJSD_getter(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)\n{\n jsval js_id;\n JS_GetProperty(cx, obj, \"id\", &js_id); // js_id has JavaScript ty...
EDIT TO IMPROVE CLARITY Scrum suggests that you split your development into a number of sprints. Each sprint being a fixed duration. At the end of each sprint you ask the client if you should release the software. If they say yes, you perform a Release Sprint, during which you do all the tasks that you woud like to do ...
Scrum recommends dividing development into a series of fixed-duration sprints. At the end of each sprint, you consult with the client to determine whether to release the software. If the client approves, you enter a Release Sprint, during which you complete tasks that are necessary for a successful launch but are often...
10,225
[ { "from": "human", "value": "EDIT TO IMPROVE CLARITY\nScrum suggests that you split your development into a number of sprints. Each sprint being a fixed duration. At the end of each sprint you ask the client if you should release the software. If they say yes, you perform a Release Sprint, during which you ...
In C/C++, what an unsigned char is used for? How is it different from a regular char?
In C and C++, `unsigned char` is a type that represents an 8-bit integer, which can store integer values in the range of 0 to 255 (2^8 - 1). This is in contrast to the regular `char` type, which can be either signed or unsigned, depending on the implementation and compiler options. ### Differences Between `unsigned ch...
6,195
[ { "from": "human", "value": "In C/C++, what an unsigned char is used for? How is it different from a regular char?\n" }, { "from": "gpt", "value": "In C and C++, `unsigned char` is a type that represents an 8-bit integer, which can store integer values in the range of 0 to 255 (2^8 - 1). This is...
In the Windsor IOC container is it possible to register a type that I've already got an instance for, instead of having the container create it?
Yes, in the Windsor IoC (Inversion of Control) container, it is indeed possible to register an existing instance of a type instead of allowing the container to create a new one. You can use the `Kernel` to register an existing instance by using the `Register` method with the `Instance` method. Here's how you can do it:...
9,773
[ { "from": "human", "value": "In the Windsor IOC container is it possible to register a type that I've already got an instance for, instead of having the container create it?\n" }, { "from": "gpt", "value": "Yes, in the Windsor IoC (Inversion of Control) container, it is indeed possible to regist...
I am new to all the anonymous features and need some help. I have gotten the following to work: public void FakeSaveWithMessage(Transaction t) { t.Message = "I drink goats blood"; } public delegate void FakeSave(Transaction t); public void SampleTestFunction() { Expect.Call(delegate { _dao.Save(t); }).Do(new...
It looks like you're trying to use an anonymous method or a lambda expression in a context where a delegate is expected. Given the code snippets you provided, you can simplify it by using a lambda expression directly without the need for an additional delegate definition, which seems to be causing the confusion. Inste...
8,527
[ { "from": "human", "value": "I am new to all the anonymous features and need some help. I have gotten the following to work:\npublic void FakeSaveWithMessage(Transaction t)\n{\n t.Message = \"I drink goats blood\";\n}\n\npublic delegate void FakeSave(Transaction t);\n\npublic void SampleTestFunction()\n...
How do I ignore files in Subversion? Also, how do I find files which are not under version control?
In Subversion (SVN), you can ignore files and directories to prevent them from being added to version control. Here’s how you can do that: ### Ignoring Files in Subversion 1. **Using the `svn:ignore` Property**: You can set the `svn:ignore` property on a directory to specify patterns of files to ignore. Here’s how...
3,883
[ { "from": "human", "value": "How do I ignore files in Subversion?\nAlso, how do I find files which are not under version control?\n" }, { "from": "gpt", "value": "In Subversion (SVN), you can ignore files and directories to prevent them from being added to version control. Here’s how you can do ...
I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of any C libraries or an alternative means of getting the data?
To grab EPG (Electronic Program Guide) data from DVB-T (Digital Video Broadcasting - Terrestrial) streams, you can use several libraries and tools. Here are some C libraries and alternatives that you might find useful: ### C Libraries 1. **libdvbpsi**: - This library is designed for parsing DVB PSI (Program Specif...
6,987
[ { "from": "human", "value": "I'm interested in grabbing the EPG data from DVB-T streams. Does anyone know of any C libraries or an alternative means of getting the data?\n" }, { "from": "gpt", "value": "To grab EPG (Electronic Program Guide) data from DVB-T (Digital Video Broadcasting - Terrestr...
I am currently in an operating systems class and my teacher spent half of the class period talking about PIDs. She mentioned, as many know, that processes know their parent's ID. My question is this: Does a process's PCB know its child's ID? If so, what is the way to go about it obtaining it?
In the context of operating systems, a process control block (PCB) typically contains various information about a process, including its state, process ID (PID), priority, and other scheduling information. However, the specifics of how child processes are represented and how their IDs are managed can vary depending on ...
8,423
[ { "from": "human", "value": "I am currently in an operating systems class and my teacher spent half of the class period talking about PIDs. She mentioned, as many know, that processes know their parent's ID.\nMy question is this:\nDoes a process's PCB know its child's ID? If so, what is the way to go about ...
This is all hypothetical, so please bear with me. Say I'm writing a tool in C# called Foo. The output is foo.exe. I've found some really great library that I like to use called Bar, which I can reference as bar.dll in my project. When I build my project, I have foo.exe and bar.dll in my output directory. Good so fa...
Combining your `foo.exe` and `bar.dll` into a single executable can be achieved, but it's important to note that the standard C# tooling in Visual Studio doesn't directly support merging managed executables and libraries. However, you can use a few different methods to achieve this. Below are two common approaches: ##...
4,733
[ { "from": "human", "value": "This is all hypothetical, so please bear with me.\nSay I'm writing a tool in C# called Foo. The output is foo.exe. I've found some really great library that I like to use called Bar, which I can reference as bar.dll in my project. When I build my project, I have foo.exe and b...
Out of the box SSRS reports cannot have data exposed in the page header. Is there a way to get this data to show?
In SQL Server Reporting Services (SSRS), the standard functionality does not allow for dynamic data to be displayed in the page header or footer. The headers and footers are typically static elements that do not change with each page. However, there are several workarounds that you can use to display dynamic data in th...
5,068
[ { "from": "human", "value": "Out of the box SSRS reports cannot have data exposed in the page header. Is there a way to get this data to show?\n" }, { "from": "gpt", "value": "In SQL Server Reporting Services (SSRS), the standard functionality does not allow for dynamic data to be displayed in ...
Are there any good recommendations anyone can provide for a good Javascript editor on Windows? I currently use combinations of FireBug and TextPad but would hate to miss out on the party if there are better options out there. Thanks.
Certainly! There are several excellent JavaScript editors and Integrated Development Environments (IDEs) available for Windows that can enhance your coding experience beyond using Firebug and TextPad. Here are some popular options: 1. **Visual Studio Code (VS Code)**: - A free, open-source code editor developed by ...
7,046
[ { "from": "human", "value": "Are there any good recommendations anyone can provide for a good Javascript editor on Windows? \nI currently use combinations of FireBug and TextPad but would hate to miss out on the party if there are better options out there. \nThanks.\n" }, { "from": "gpt", "val...
To see what file to invoke the unrar command on, one needs to determine which file is the first in the file set. Here are some sample file names, of which - naturally - only the first group should be matched: yes.rar yes.part1.rar yes.part01.rar yes.part001.rar no.part2.rar no.part02.rar no.part002.rar no.part011.rar ...
To match only the first file in a set of RAR files using Ruby-compatible regular expressions, you can use the following regex: ```ruby ^(?!.*\.part\d+\.rar).+\.rar$ ``` ### Explanation: 1. `^` - Asserts the start of a line. 2. `(?!.*\.part\d+\.rar)` - This is a negative lookahead that asserts that what follows is NO...
8,119
[ { "from": "human", "value": "To see what file to invoke the unrar command on, one needs to determine which file is the first in the file set.\nHere are some sample file names, of which - naturally - only the first group should be matched:\nyes.rar\nyes.part1.rar\nyes.part01.rar\nyes.part001.rar\n\nno.part2....
Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how? I would like to be able to do it in an app-server-agnostic way, if it is possible. The application will be run on many different app servers-- basically whatever the client prefers. If it isn't possible to do this in a...
Restarting a J2EE (Java EE) application programmatically from within the application itself is not a standard feature and can pose significant risks, both in terms of stability and security. Generally, J2EE applications are designed to run within a managed environment provided by an application server, and server manag...
8,152
[ { "from": "human", "value": "Does anyone know if it is possible to restart a J2EE application (from the application)? If so, how?\nI would like to be able to do it in an app-server-agnostic way, if it is possible.\nThe application will be run on many different app servers-- basically whatever the client pr...
Is it possible to use chapters in videos for the iPhone in an application? For example: I have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s. Can I start plating the video at 50s (chapter 2) until the end? Can I make it play just the chapter 2 from 50s to 95s? My questio...
Yes, it is possible to use chapters in videos on an iPhone, but the specific behavior you’re asking about—playing just a specific chapter or starting from a certain timestamp—depends on the video player or application you are using. 1. **Using the Native Videos App**: The built-in Videos app does not support chapter n...
9,299
[ { "from": "human", "value": "Is it possible to use chapters in videos for the iPhone in an application?\nFor example:\nI have a 3 minutes video to play. I have chapter 1 starting at 0s, chapter 2 at 50s, chapter 3 at 95s.\nCan I start plating the video at 50s (chapter 2) until the end? Can I make it play ju...
I've only been able to find two thus far, namely TinyRadius, which itself discourages production use and AXL, which is pay-only. JRadius seems tied to FreeRADIUS, which isn't a library and will need a lot of cajoling to function like one.
It seems like you're looking for Java libraries that provide RADIUS functionality, but are having difficulty finding suitable options. Here’s a brief overview of the libraries you've mentioned and a couple of additional suggestions that might fit your needs: 1. **TinyRadius**: As you noted, TinyRadius is a minimalisti...
8,488
[ { "from": "human", "value": "I've only been able to find two thus far, namely TinyRadius, which itself discourages production use and AXL, which is pay-only.\nJRadius seems tied to FreeRADIUS, which isn't a library and will need a lot of cajoling to function like one.\n" }, { "from": "gpt", "val...
I have a SQL query (MS Access) and I need to add two columns, either of which may be null. For instance: SELECT Column1, Column2, Column3+Column4 AS [Added Values] FROM Table where Column3 or Column4 may be null. In this case, I want null to be considered zero (so 4 + null = 4, null + null = 0). Any suggestions as to ...
In MS Access SQL, you can use the `Nz` function to handle `NULL` values by replacing them with a specified value, such as zero. You can modify your query to use `Nz` for both `Column3` and `Column4` like this: ```sql SELECT Column1, Column2, Nz(Column3, 0) + Nz(Column4, 0) AS [Added Values] FROM Table; ``` Here's wha...
10,470
[ { "from": "human", "value": "I have a SQL query (MS Access) and I need to add two columns, either of which may be null. For instance:\nSELECT Column1, Column2, Column3+Column4 AS [Added Values]\nFROM Table\n\nwhere Column3 or Column4 may be null. In this case, I want null to be considered zero (so 4 + null ...
I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors. As far as I can tell from the man pages, neither curl or wget provide such functionality. Does anyone know about another downloader who does?
If you're looking for a command-line tool to download URLs while ignoring those that return HTTP errors, you can use `wget` in combination with some options. While `wget` does not directly allow you to skip downloads based on HTTP errors, you can achieve this by checking the exit status of the command and redirecting o...
5,973
[ { "from": "human", "value": "I want to download a lot of urls in a script but I do not want to save the ones that lead to HTTP errors.\nAs far as I can tell from the man pages, neither curl or wget provide such functionality.\nDoes anyone know about another downloader who does?\n" }, { "from": "gpt"...
Actionscript 3.0 (and I assume Javascript and ECMAScript in general) lacks pass-by-reference for native types like ints. As a result I'm finding getting values back from a function really clunky. What's the normal pattern to work around this? For example, is there a clean way to implement swap( intA, intB ) in Actio...
In ActionScript 3.0, as well as in JavaScript and ECMAScript, primitive types (like integers) are passed by value, meaning that if you try to modify a parameter inside a function, it won't affect the original variable outside the function. To achieve behavior similar to pass-by-reference, you can use objects or arrays,...
7,191
[ { "from": "human", "value": "Actionscript 3.0 (and I assume Javascript and ECMAScript in general) lacks pass-by-reference for native types like ints. As a result I'm finding getting values back from a function really clunky. What's the normal pattern to work around this? \nFor example, is there a clean wa...
I've seen examples like this: public class MaxSeconds { public static final int MAX_SECONDS = 25; } and supposed that I could have a Constants class to wrap constants in, declaring them static final. I know practically no Java at all and am wondering if this is the best way to create constants.
In Java, there are several ways to define constants, and using a class to hold them is a common practice. Your example of defining a constant with a `public class` is one approach, but there are additional considerations and conventions that can improve the organization and clarity of your code. ### Best Practices for...
5,926
[ { "from": "human", "value": "I've seen examples like this: \npublic class MaxSeconds {\n public static final int MAX_SECONDS = 25;\n}\n\nand supposed that I could have a Constants class to wrap constants in, declaring them static final. I know practically no Java at all and am wondering if this is the bes...
Can we achieve 100% decoupling between components of a system or different systems that communicate with each other? I don't think its possible. If two systems communicate with each other then there should be some degree of coupling between them. Am I right?
You are correct in your assertion that achieving 100% decoupling between components or systems that communicate with each other is inherently challenging, if not impossible, in practical terms. Here are several key points to consider: 1. **Definition of Coupling**: Coupling refers to the degree of direct knowledge tha...
8,484
[ { "from": "human", "value": "Can we achieve 100% decoupling between components of a system or different systems that communicate with each other? I don't think its possible. If two systems communicate with each other then there should be some degree of coupling between them. Am I right?\n" }, { "fro...
Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance. e.g. public DerivedClass : BaseClass {} Now I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in DerivedClass so that only method C is exposed ...
In C#, you cannot directly override a public method from a base class and make it private in a derived class. When you override a method in C#, it maintains the same access modifier as it had in the base class. So if `A` and `B` are public in `BaseClass`, they will remain public in `DerivedClass` even if you attempt to...
6,671
[ { "from": "human", "value": "Suppose I have BaseClass with public methods A and B, and I create DerivedClass through inheritance.\ne.g.\npublic DerivedClass : BaseClass {}\n\nNow I want to develop a method C in DerivedClass that uses A and B. Is there a way I can override methods A and B to be private in D...
Which parsers are available for parsing C# code? I'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code.
There are several parsers and libraries available for parsing C# code that provide information about code structure, syntax, and artifacts, including line and file information. Here are some popular options: 1. **Roslyn (Microsoft.CodeAnalysis)**: - **Description**: Roslyn is the .NET Compiler Platform, which provi...
6,500
[ { "from": "human", "value": "Which parsers are available for parsing C# code?\nI'm looking for a C# parser that can be used in C# and give me access to line and file informations about each artefact of the analysed code.\n" }, { "from": "gpt", "value": "There are several parsers and libraries av...
My gcc build toolchain produces a .map file. How do I display the memory sections using memory map graphically?
To display the memory sections from a `.map` file graphically, you can use several tools, some of which may require a bit of setup. Below are a few options you can explore: ### 1. **Gnuplot** Gnuplot is a versatile graphing utility that can help you visualize data, including memory sections from a `.map` file. Here’s ...
6,163
[ { "from": "human", "value": "My gcc build toolchain produces a .map file. How do I display the memory sections using memory map graphically?\n" }, { "from": "gpt", "value": "To display the memory sections from a `.map` file graphically, you can use several tools, some of which may require a bit ...
I'm a bit lost here and I can't find much documentation.
No problem! I’m here to help. What specifically are you trying to find information about? Let me know what you're looking for, and I'll do my best to assist you.
11,807
[ { "from": "human", "value": "I'm a bit lost here and I can't find much documentation.\n" }, { "from": "gpt", "value": "No problem! I’m here to help. What specifically are you trying to find information about? Let me know what you're looking for, and I'll do my best to assist you." } ]
I'm building a site right now, so far I've painfully forced everything to be compliant and it looks pretty much the same across browsers. However, I'm starting to implement some third party/free javascripts which do things like add attributes (eg. order=2). I could work around this but it's a pain, and I'm starting to ...
It's great to hear that you're putting in the effort to make your site compliant and consistent across browsers! Valid HTML and adherence to web standards can have several benefits, including improved accessibility, better search engine optimization, and potentially fewer issues with browser compatibility. However, wh...
7,861
[ { "from": "human", "value": "I'm building a site right now, so far I've painfully forced everything to be compliant and it looks pretty much the same across browsers. However, I'm starting to implement some third party/free javascripts which do things like add attributes (eg. order=2). I could work around t...
Does anyone know of a .NET library that will process HTML e-mails and can be used to trim out the reply-chain? It needs to be able to accept HTML -or- text mails and then trim out everything but the actual response, removing the trail of messages that are not original content. I don't expect it to be able to handle r...
Hi Steve, There are several libraries and approaches you can consider for processing HTML emails and trimming out the reply chain in .NET. Here are a few options that may meet your requirements: 1. **HtmlAgilityPack**: While it's primarily an HTML parser, you can use it to manipulate HTML content. You can load the em...
7,420
[ { "from": "human", "value": "Does anyone know of a .NET library that will process HTML e-mails and can be used to trim out the reply-chain? It needs to be able to accept HTML -or- text mails and then trim out everything but the actual response, removing the trail of messages that are not original content. ...
How do I validate a UK phone number in C# using a regex?
To validate a UK phone number using a regular expression (regex) in C#, you can create a pattern that matches various formats of UK phone numbers. UK phone numbers can vary in format, but generally, they follow certain structures. Here's a regex pattern that you can use to validate UK phone numbers, along with a C# exa...
3,197
[ { "from": "human", "value": "How do I validate a UK phone number in C# using a regex?\n" }, { "from": "gpt", "value": "To validate a UK phone number using a regular expression (regex) in C#, you can create a pattern that matches various formats of UK phone numbers. UK phone numbers can vary in f...
Some e-Marketing tools claim to choose which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer. I know you can get the immediate preceding page with HTTP_REFERRER, but how do you know where they were 6 ...
To track a user's browsing history beyond the immediate referrer (the previous page they visited), you typically need to implement a more sophisticated tracking mechanism that goes beyond standard HTTP headers like `HTTP_REFERER`. Here are some common techniques used in e-marketing to achieve this: 1. **Cookies**: You...
7,390
[ { "from": "human", "value": "Some e-Marketing tools claim to choose which web page to display based on where you were before. That is, if you've been browsing truck sites and then go to Ford.com, your first page would be of the Ford Explorer.\nI know you can get the immediate preceding page with HTTP_REFERR...
Which of the WCF Service Protocols work well with Java? Do the TCP Service Bindings work with java remoting (either Corba, EJB, JMS, etc.)? What about the WebServices exposed as Service EndPoints. Have these been tested against the common Java WebServices stack for interoperability?
Windows Communication Foundation (WCF) provides several service protocols that can interact with Java applications, though the ease of interoperability can vary depending on the protocols used. Here’s a breakdown: ### WCF Service Protocols and Java Interoperability 1. **BasicHttpBinding**: - This binding is based ...
7,303
[ { "from": "human", "value": "Which of the WCF Service Protocols work well with Java?\nDo the TCP Service Bindings work with java remoting (either Corba, EJB, JMS, etc.)?\nWhat about the WebServices exposed as Service EndPoints. Have these been tested against the common Java WebServices stack for interopera...
When objects from a CallList intersect the near plane I get a flicker..., what can I do? Im using OpenGL and SDL. Yes it is double buffered.
Flickering when objects intersect with the near clipping plane can often be caused by a few issues in OpenGL rendering. Here are some steps and suggestions you can try to resolve this problem: 1. **Depth Buffer Precision**: Ensure you are using a depth buffer with sufficient precision. A common choice is to use a 24-b...
7,943
[ { "from": "human", "value": "When objects from a CallList intersect the near plane I get a flicker..., what can I do?\nIm using OpenGL and SDL.\nYes it is double buffered.\n" }, { "from": "gpt", "value": "Flickering when objects intersect with the near clipping plane can often be caused by a few...
Does anybody know how to apply a "where in values" type condition using LINQ-to-Entities? I've tried the following but it doesn't work: var values = new[] { "String1", "String2" }; // some string values var foo = model.entitySet.Where(e => values.Contains(e.Name)); I believe this works in LINQ-to-SQL though? Any t...
Your LINQ-to-Entities query is actually correct for checking whether the `Name` property of the entities in `model.entitySet` is contained within the specified `values` array. The `Contains` method works properly in LINQ-to-Entities as well as in LINQ-to-SQL. If you're encountering issues with your query, here are a f...
7,471
[ { "from": "human", "value": "Does anybody know how to apply a \"where in values\" type condition using LINQ-to-Entities? I've tried the following but it doesn't work:\nvar values = new[] { \"String1\", \"String2\" }; // some string values\n\nvar foo = model.entitySet.Where(e => values.Contains(e.Name));\n...
I'm looking for a way to get the size of an instance of a reference type. sizeof is only for value types. Is this possible?
In C#, the `sizeof` operator only works with value types, as you noted. Reference types, like classes, do not have a fixed size because they can contain variable amounts of data, such as arrays or collections, and their memory allocation is managed by the .NET runtime's garbage collector. However, if you want to estim...
5,294
[ { "from": "human", "value": "I'm looking for a way to get the size of an instance of a reference type. sizeof is only for value types. Is this possible?\n" }, { "from": "gpt", "value": "In C#, the `sizeof` operator only works with value types, as you noted. Reference types, like classes, do not ...
So, I am using the Linq entity framework. I have 2 entities: Content and Tag. They are in a many-to-many relationship with one another. Content can have many Tags and Tag can have many Contents. So I am trying to write a query to select all contents where any tags names are equal to blah The entities both have a collec...
Great to hear that you found your own answer! However, if you’d like, I can provide a general example of how to write a query in Entity Framework to select all `Content` entities that have any `Tag` with a specific name (like "blah"). Given that you have a many-to-many relationship, you typically have a setup like th...
8,379
[ { "from": "human", "value": "So, I am using the Linq entity framework. I have 2 entities: Content and Tag. They are in a many-to-many relationship with one another. Content can have many Tags and Tag can have many Contents. So I am trying to write a query to select all contents where any tags names are equa...
Specifically in .NET, but I'm leaving it open.
Certainly! It seems like you're interested in discussing .NET or have questions about it. Here are some key topics related to .NET that might interest you: ### 1. **.NET Framework vs. .NET Core vs. .NET 5/6/7** - **.NET Framework**: The original implementation of .NET, mostly used for Windows applications. - **....
5,899
[ { "from": "human", "value": "Specifically in .NET, but I'm leaving it open.\n" }, { "from": "gpt", "value": "Certainly! It seems like you're interested in discussing .NET or have questions about it. Here are some key topics related to .NET that might interest you:\n\n### 1. **.NET Framework vs. ...
What method do you use when you want to get performance data about specific code paths?
When you want to gather performance data about specific code paths in your application, several methods and tools can be used, depending on the programming language, environment, and specific requirements. Here are some commonly used methods: 1. **Profiling**: - **Profiler Tools**: Use built-in or third-party profi...
2,960
[ { "from": "human", "value": "What method do you use when you want to get performance data about specific code paths?\n" }, { "from": "gpt", "value": "When you want to gather performance data about specific code paths in your application, several methods and tools can be used, depending on the pr...
Is it possible to see the history of changes to a particular line of code in a Subversion repository? I'd like, for instance, to be able to see when a particular statement was added or when that statement was changed, even if its line number is not the same any more.
Yes, it is possible to see the history of changes to a particular line of code in a Subversion (SVN) repository, even if the line number has changed due to subsequent modifications. You can achieve this by using the `svn blame` command in combination with some other tools and techniques. Here's how you can do it: ###...
7,225
[ { "from": "human", "value": "Is it possible to see the history of changes to a particular line of code in a Subversion repository?\nI'd like, for instance, to be able to see when a particular statement was added or when that statement was changed, even if its line number is not the same any more.\n" }, ...
I'm using IIS 5.1 in Windows XP on my development computer. I'm going to set up HTTPS on my company's web server, but I want to try doing it locally before doing it on a production system. But when I go into the Directory Security tab of my web site's configuration section, the "Secure communication" groupbox is disabl...
In IIS 5.1 on Windows XP, the "Secure communication" section under the Directory Security tab can be disabled if certain conditions are not met. Here are the steps you can take to enable it: 1. **Ensure you have a valid SSL certificate:** - You need to install a valid SSL certificate on your local machine. While yo...
5,648
[ { "from": "human", "value": "I'm using IIS 5.1 in Windows XP on my development computer. I'm going to set up HTTPS on my company's web server, but I want to try doing it locally before doing it on a production system.\nBut when I go into the Directory Security tab of my web site's configuration section, the...