instruction
stringlengths
14
27.6k
completion
stringlengths
3
38.3k
__original_row_idx
int64
0
50k
conversations
listlengths
2
2
I'm looking for a web based upload manager, with good support for images. It should be as easy as possible for novice users to "add images to a website". I could use such a thing for two use cases: A CMS for external use, needs proper image support (1-file upload doesn't quite cut it). A Wiki for internal use, to get ...
Copying and pasting images directly into a web application is a highly desired feature, especially for users who want a seamless experience for uploading images, such as screenshots. There are several modern web technologies you can consider that allow for image uploads and can simplify the process for novice users. He...
38,558
[ { "from": "human", "value": "I'm looking for a web based upload manager, with good support for images. It should be as easy as possible for novice users to \"add images to a website\". I could use such a thing for two use cases:\n\nA CMS for external use, needs proper image support (1-file upload doesn't qu...
I want to pass some parameters to a Crystal Report like this: ReportDocument.DataDefinition.FormulaFields[parameterName].Text = 'Text'; This workes fine unless I want to pass a multiline textbox from ASPX (containing \n and \r chars.) The reportviewer reports that "The matching ' for this string is missing.". Is th...
When passing a multiline string from an ASP.NET application to a Crystal Report, handling newline characters like `\n` and `\r` can sometimes lead to issues, particularly with the formatting expected by the report. Since Crystal Reports does not interpret the `\n` and `\r` escape characters in the same way as C# or Jav...
40,211
[ { "from": "human", "value": "I want to pass some parameters to a Crystal Report like this:\nReportDocument.DataDefinition.FormulaFields[parameterName].Text = 'Text';\n\nThis workes fine unless I want to pass a multiline textbox from ASPX \n(containing \\n and \\r chars.)\nThe reportviewer reports that \"T...
I'm trying to create a simple Java application that displays a frame containing a JButton. I'm using JNI to add transparency to the window. The window is transparent but the button is not. Also, when I move the window the button doesn't move with the window. The same thing happens with a JLabel. If I use a Button inste...
The issue you're facing with the `JButton` and `JLabel` not being transparent, even though the main window is, is primarily due to the way Swing components are rendered and how transparency is applied to the underlying window in Windows. In Windows, setting a window to be layered and transparent allows the window itse...
40,220
[ { "from": "human", "value": "I'm trying to create a simple Java application that displays a frame containing a JButton. I'm using JNI to add transparency to the window. The window is transparent but the button is not. Also, when I move the window the button doesn't move with the window. The same thing happe...
Setup I have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other. However, I only have two next to each other, and if the window resizes, there can be some ugly empty space on the screen. Desire Wh...
It sounds like you want to create a responsive multi-column layout for displaying your RSS feeds. While you can achieve a lot with CSS alone, using CSS Grid or Flexbox can simplify the task of creating a balanced column layout without needing to resort to JavaScript or AJAX for resizing. Here's how you can achieve thi...
39,515
[ { "from": "human", "value": "Setup\nI have a website that draws RSS feeds and displays them on the page. Currently, I use percentages on the divs that contain each feed, so that multiples can appear next to each other.\nHowever, I only have two next to each other, and if the window resizes, there can be som...
My laptop has a mysterious "AV Now" button on it, which would usually launch Samsung's "AVStation Now" application. I don't have this application installed, so I'd like to get this button to do something else. So (and this question can be generalised to any keyboard with softbuttons on it), how would I go about writing...
To create a Windows program that can interact with a mysterious "AV Now" button on your laptop, you'll need to follow a few steps to determine how the button works and then set up a global hook to handle its input. Here’s how you can approach this in C#: ### Step 1: Determine How the Button Works 1. **Use a Keylogger...
35,991
[ { "from": "human", "value": "My laptop has a mysterious \"AV Now\" button on it, which would usually launch Samsung's \"AVStation Now\" application. I don't have this application installed, so I'd like to get this button to do something else.\nSo (and this question can be generalised to any keyboard with so...
I am trying to give a ListBox drag and drop ordering functionality and I have hit a wall. I got it to work when I specify the list box items in xaml but it does not work when I bind to a list it no longer works because the items are no longer of a listboxitem type. I found this code http://blog.dobaginski.com/josh/?p=5...
Implementing drag-and-drop functionality for a `ListBox` that is data-bound can be challenging, especially since the items aren't of type `ListBoxItem`. However, you can still achieve this using a combination of event handlers and some adjustments to the data-bound list. Here's a basic approach to handle drag-and-drop ...
31,669
[ { "from": "human", "value": "I am trying to give a ListBox drag and drop ordering functionality and I have hit a wall. I got it to work when I specify the list box items in xaml but it does not work when I bind to a list it no longer works because the items are no longer of a listboxitem type.\nI found this...
The code below gives an error: Property 'Int32 Key' is not defined for type 'ConsoleApplication1.IKeyed`1[TKey]' when the expression e is created but is fine when func f is created, can anyone explain why and if there is a way to fix it? Module Module1 Sub Main() Dim g = New keyedThingGetter(Of KeyedThing...
The issue you are encountering arises from the way that lambda expressions are treated differently in the context of Func versus Expression in VB.NET. Let's break it down: 1. **Func Delegate**: When you create a lambda function assigned to a `Func`, the lambda is treated as a regular delegate. The compiler can resolve...
37,684
[ { "from": "human", "value": "The code below gives an error: Property 'Int32 Key' is not defined for type 'ConsoleApplication1.IKeyed`1[TKey]' when the expression e is created but is fine when func f is created, can anyone explain why and if there is a way to fix it? \nModule Module1\n Sub Main()\n ...
We have a database on SQL Server 2000 which should be truncated from time to time. It looks like the easiest solution would be to create a duplicate database and copy the primary database there. Then the primary database may be safely truncated by specially tailored stored procedures. One way replication would guarante...
Implementing a solution for maintaining a copy of your SQL Server 2000 database for reporting while keeping the primary database for operational data involves several considerations, especially given the challenges of database size, integrity constraints, and the need for a reliable method of replication. Here are some...
40,161
[ { "from": "human", "value": "We have a database on SQL Server 2000 which should be truncated from time to time. It looks like the easiest solution would be to create a duplicate database and copy the primary database there. Then the primary database may be safely truncated by specially tailored stored proce...
I spent ages learning VML and creating charts for a website once, but since VML only works in Internet Explorer, it's not much good these days. I notice stackoverflow has graphs on my profile page, under 'reputation', but I wasnt able to see how they did it. Can anyone suggest a way to create client-side charts or diag...
There are several excellent libraries that allow you to create interactive charts and diagrams on the client side, compatible with all major browsers. Here are some popular options: 1. **Chart.js**: - A simple yet flexible JavaScript charting library for designers and developers. - It supports eight different ty...
35,049
[ { "from": "human", "value": "I spent ages learning VML and creating charts for a website once, but since VML only works in Internet Explorer, it's not much good these days.\nI notice stackoverflow has graphs on my profile page, under 'reputation', but I wasnt able to see how they did it.\nCan anyone suggest...
On input validation, I'm using balloon tips instead of message boxes. My problem is that on Vista, they have the old XP style with the rounded corners, not the newer more rectangle like appearance. I've tried creating them using CreateWindowEx and tooltips_class32 or showing the Edit's associated balloontip using SendM...
To achieve modern balloon tips that match the Vista (and later) visual style, there are a few approaches you could consider when working with native Win32 APIs. Here’s a more structured way to get the desired behavior, including both using the correct tooltip style and ensuring that your implementation is compatible wi...
39,537
[ { "from": "human", "value": "On input validation, I'm using balloon tips instead of message boxes.\nMy problem is that on Vista, they have the old XP style with the rounded corners, not the newer more rectangle like appearance.\nI've tried creating them using CreateWindowEx and tooltips_class32 or showing t...
Im trying to create an app to control a pc remotely using java , i want to use red5 to let the admin control desktops using a flash movie so i need to find java classes to : capture desktop as live video -control mouse and keyboard
Creating an application to control a PC remotely using Java is an interesting project! Below are some general suggestions and libraries that you can use for capturing desktop video and controlling the mouse and keyboard. ### 1. Capture Desktop as Live Video You can use libraries such as **Java Media Framework (JMF)**...
39,137
[ { "from": "human", "value": "Im trying to create an app to control a pc remotely using java , i want to use red5 to let the admin control desktops using a flash movie \nso i need to find java classes to :\n\ncapture desktop as live video\n-control mouse and keyboard\n\n" }, { "from": "gpt", "va...
Where do I get the ULONG LoginID values to pass to WTSConnectSession? I need both a ULONG LogonId and a ULONG TargetLogonId. Is this the same as the SessionID I'll get back from WTSQuerySessionInformation when I pass in WTSSessionId? I suspect not (I tried it and WTSConnectSession did not work.) The MSDN glossay says a...
To connect to a remote session using the `WTSConnectSession` function, you need to provide two specific identifiers: the `LogonId` (of type `ULONG`) and the `TargetLogonId` (also of type `ULONG`). Here's how to interpret these values and obtain them: ### Understanding LogonId and TargetLogonId 1. **LogonId**: This is...
30,806
[ { "from": "human", "value": "Where do I get the ULONG LoginID values to pass to WTSConnectSession? I need both a ULONG LogonId and a ULONG TargetLogonId.\nIs this the same as the SessionID I'll get back from WTSQuerySessionInformation when I pass in WTSSessionId? I suspect not (I tried it and WTSConnectSess...
I ran this setup.py file from distutils.core import setup import py2exe, sys, os sys.argv.append('py2exe') setup( options = {'py2exe': {'bundles_files': 1}}, windows = [{'script': "Driverscript.py"}], zipfile = None, ) This creates the executable file and packages but it wont run every time i try to ...
When using `py2exe`, there can be several issues that cause the resulting executable to crash. Here are some steps you can take to troubleshoot and possibly resolve the problem: 1. **Check for Errors in Your Script**: Make sure that the `Driverscript.py` does not have any unhandled exceptions or bugs that could cause ...
38,892
[ { "from": "human", "value": "I ran this setup.py file\nfrom distutils.core import setup\n\nimport py2exe, sys, os\n\nsys.argv.append('py2exe')\n\nsetup(\n options = {'py2exe': {'bundles_files': 1}},\n\n windows = [{'script': \"Driverscript.py\"}],\n\n zipfile = None,\n\n)\n\nThis creates the execut...
We're currently using Mantis as our bugtracker, and we're pretty much sick and tired with it. The developers want more SVN integration, the customers want an easier system to work with. As such, we're looking for a new bugtracker and at the moment we're looking at Redmine. However, in its default setup it doesn't match...
Your workflow is quite detailed and thorough, which is a great start for defining your requirements for a bug tracking system. Redmine can be configured to better fit your workflow, but it may require some customization, particularly to streamline the user experience for customers and to clarify the roles and responsib...
39,794
[ { "from": "human", "value": "We're currently using Mantis as our bugtracker, and we're pretty much sick and tired with it. The developers want more SVN integration, the customers want an easier system to work with.\nAs such, we're looking for a new bugtracker and at the moment we're looking at Redmine. Howe...
the web layer is coded in asp.net with pages marked as async. Yes, the recommended way to code for aync is using the RegisterAsyncTask I have a problem now - there are a few pages that have used AutoResetEvent and ManualResetEvent for aync and not the standard RegisterAsyncTask. Would these objects servicing the async...
Using `AutoResetEvent` or `ManualResetEvent` for managing asynchronous calls in ASP.NET is not recommended, and it indeed affects how threads are utilized. Here’s why this approach can lead to issues with thread management: 1. **Blocking Threads**: Both `AutoResetEvent` and `ManualResetEvent` are designed for synchron...
41,025
[ { "from": "human", "value": "the web layer is coded in asp.net with pages marked as async. Yes, the recommended way to code for aync is using the RegisterAsyncTask \nI have a problem now - there are a few pages that have used AutoResetEvent and ManualResetEvent for aync and not the standard RegisterAsyncTas...
I'd like to establish an ssh tunnel over ssh to my mysql server. Ideally I'd return a mysqli db pointer just like I was connecting directly. I'm on a shared host that doesn't have the SSH2 libraries but I might be able to get them installed locally using PECL. If there's a way that uses native commands that would be gr...
Creating an SSH tunnel to connect to a MySQL server without the SSH2 PHP extension can be challenging, especially on a shared hosting environment. However, you can still achieve this using native command-line tools and PHP’s `exec` function or similar methods. Below are steps you can follow: ### Step 1: Create the SSH...
36,117
[ { "from": "human", "value": "I'd like to establish an ssh tunnel over ssh to my mysql server.\nIdeally I'd return a mysqli db pointer just like I was connecting directly.\nI'm on a shared host that doesn't have the SSH2 libraries but I might be able to get them installed locally using PECL.\nIf there's a wa...
Since you guys are having lots of questions or not enough info to work with, below is proprietary information and as such be careful as you can. The question – (please refer to if [$7 -eq "AAA"]...then statement - in bold ) has a problem with an output, where I can only output/print count of 'AAA' regardless the vari...
It appears that you're trying to conditionally execute different SQL statements based on the value of the `$7` parameter (which can either be "AAA" or "BBB"). However, the syntax you're using for comparing the value is incorrect in a SQL context. In the context of your script, shell syntax is being mixed with SQL, lead...
37,012
[ { "from": "human", "value": "Since you guys are having lots of questions or not enough info to work with, below is proprietary information and as such be careful as you can. The question – (please refer to if [$7 -eq \"AAA\"]...then statement - in bold ) has a problem with an output, where I can only outpu...
I would like to know how to write a macro that would send an email with attachment in excel with user's signature. The same macro would be used by different users. So it should dynamically read any one (out of multiple html, rtf and txt files) signature file from user's location C:\Documents and Settings\" & Environ("...
Certainly! Below is a step-by-step guide on how to write a VBA macro in Excel that sends an email with an attachment and includes the user's signature dynamically read from the specified path. ### Step 1: Enable the Developer Tab 1. Open Excel. 2. Click on `File`. 3. Choose `Options`. 4. Select `Customize Ribbon`. 5. ...
23,009
[ { "from": "human", "value": "I would like to know how to write a macro that would send an email with attachment in excel with user's signature. \nThe same macro would be used by different users. So it should dynamically read any one (out of multiple html, rtf and txt files) signature file from user's locati...
I am playing around with ASP.NET MVC for the first time, so I apologize in advance if this sounds academic. I have created a simple content management system using ASP.NET MVC. The url to retrieve a list of content, in this case, announcements, looks like: http://www.mydomain.com/announcements/list/10 This will ret...
Certainly! Your ASP.NET MVC application can serve data that can be consumed by other websites, and you have several options for how to achieve this. Let's break down your questions step by step. ### 1. Consuming the Service Yes, any website can consume the service as long as it can access the URL you provided (http://...
34,573
[ { "from": "human", "value": "I am playing around with ASP.NET MVC for the first time, so I apologize in advance if this sounds academic. \nI have created a simple content management system using ASP.NET MVC. The url to retrieve a list of content, in this case, announcements, looks like:\nhttp://www.mydoma...
I'm extending the functionality of a class with a subclass, and I'm doing some dirty stuff that make superclass methods dangerous (app will hang in a loop) in the context of the subclass. I know it's not a genius idea, but I'm going for the low-hanging fruit, right now it's gonna save me some time. Oh it's a dirty job,...
Your approach of overriding the method in the subclass to raise an exception is a valid way to prevent the superclass method from being called directly when dealing with potentially dangerous behavior. This allows you to maintain the intended functionality in the subclass while protecting against unintended use. Here ...
38,953
[ { "from": "human", "value": "I'm extending the functionality of a class with a subclass, and I'm doing some dirty stuff that make superclass methods dangerous (app will hang in a loop) in the context of the subclass. I know it's not a genius idea, but I'm going for the low-hanging fruit, right now it's gonn...
I would like to be able to Serialize a DateTime with a specific Time Zone that is not the server, nor is it client time. Basically, any time zone. Is it possible to override the DateTime serialization, in .Net2.0 webservices? I compile an xmlschema using xsd.exe, so I made an attempt using XmlSchemaImporter. The OnSer...
In .NET 2.0, overriding the serialization behavior of `DateTime` objects directly for a specific time zone is somewhat limited, especially if you're working with web services. However, there are a few strategies you can employ to achieve your goal: ### 1. Custom Wrapper Class Instead of attempting to directly serializ...
39,950
[ { "from": "human", "value": "I would like to be able to Serialize a DateTime with a specific Time Zone that is not the server, nor is it client time. Basically, any time zone.\nIs it possible to override the DateTime serialization, in .Net2.0 webservices?\nI compile an xmlschema using xsd.exe, so I made an ...
What's the best way to convert NetBeans (Matisse) .form files into .java files, without using the NetBeans IDE itself? Ideally I'd like to package the .form files along with my source code, and generate the .java files at build time. This will prevent developers from "accidentally" adding code to the generated .java fi...
Converting NetBeans (Matisse) `.form` files to `.java` files without using the NetBeans IDE can be challenging, but it is possible using some workarounds. Below are steps and considerations for how you might achieve this: ### Using Ant NetBeans provides an Ant task that can be used to convert `.form` files to `.java`...
36,211
[ { "from": "human", "value": "What's the best way to convert NetBeans (Matisse) .form files into .java files, without using the NetBeans IDE itself? Ideally I'd like to package the .form files along with my source code, and generate the .java files at build time. This will prevent developers from \"accidenta...
I need some info about using the Defining Query element within the SSDL of the Entity Framework. Advantages of using it and scenarios where it would be helpful would really help. An example and links will be great.
The **Defining Query** element in the **Store Schema Definition Language (SSDL)** used by Entity Framework (EF) allows you to define views or queries that can be used as entities in your model. This provides a way to leverage complex queries or stored procedures directly in your EF model while retaining some of the ben...
38,462
[ { "from": "human", "value": "I need some info about using the Defining Query element within the SSDL of the Entity Framework.\nAdvantages of using it and scenarios where it would be helpful would really help.\nAn example and links will be great.\n" }, { "from": "gpt", "value": "The **Defining Qu...
I am getting the following error when trying to Save as Document Object while trying to implement a word automation in C#: System.Runtime.InteropServices.COMException (0x80020005): Type mismatch. (Exception from HRESULT: 0x80020005 (DISP_E_TYPEMISMATCH)) at Microsoft.Office.Interop.Word.DocumentClass.SaveAs(Ob...
The error message you're encountering (`System.Runtime.InteropServices.COMException (0x80020005): Type mismatch`) indicates that there's a type mismatch in the arguments being passed to the `SaveAs` method of the Word Interop library. When using the `SaveAs` method, it's important to ensure that the parameters match t...
40,226
[ { "from": "human", "value": "I am getting the following error when trying to Save as Document Object while trying to implement a word automation in C#:\n\nSystem.Runtime.InteropServices.COMException\n\n(0x80020005): Type mismatch.\n (Exception from HRESULT: 0x80020005\n (DISP_E_TYPEMISMATCH))\n at Micro...
I'm coming from a C# background and I really like the type inference that C# 3.0 has. I'm trying to do similar things in VB.NET (some of which appear possible), but in some cases the compiler seems to be not nearly as good at inferring the type. For example, I have a method that returns an object of type System.Guid....
You're correct that type inference in VB.NET operates differently than in C#. In C#, the `var` keyword allows for local type inference in many contexts, including variable declarations and static fields, while in VB.NET, the `Dim` keyword does not automatically infer types in all scenarios, particularly for static fiel...
40,682
[ { "from": "human", "value": "I'm coming from a C# background and I really like the type inference that C# 3.0 has. I'm trying to do similar things in VB.NET (some of which appear possible), but in some cases the compiler seems to be not nearly as good at inferring the type.\nFor example, I have a method t...
I have a border element with rounded corners containing a 3x3 grid. The corners of the grid are sticking out of the border. How can I fix that? I tried using ClipToBounds but didn't get anywhere. Thanks for your help
It sounds like you're dealing with a layout issue where the contents of your border (specifically the corners of your grid) are overflowing the boundary of the border element. To resolve this, you can use a combination of layout properties depending on the framework or technology you are using. Here are a few general a...
39,965
[ { "from": "human", "value": "I have a border element with rounded corners containing a 3x3 grid. The corners of the grid are sticking out of the border. How can I fix that? I tried using ClipToBounds but didn't get anywhere.\nThanks for your help\n" }, { "from": "gpt", "value": "It sounds like y...
Essentially, I have to get a flat file into a database. The flat files come in with the first two characters on each line indicating which type of record it is. Do I create a class for each record type with properties matching the fields in the record? Should I just use arrays? I want to load the data into some sort ...
To efficiently handle the processing of flat files like BAI2 bank statements, you can take an object-oriented approach by defining classes for each record type, thereby encapsulating the properties and behaviors associated with each record. Here's a step-by-step outline of how you can achieve this: ### Step 1: Define ...
37,739
[ { "from": "human", "value": "Essentially, I have to get a flat file into a database. The flat files come in with the first two characters on each line indicating which type of record it is.\nDo I create a class for each record type with properties matching the fields in the record? Should I just use array...
This led on from the question about asking if Apache Maven and IBM Rational ClearCase integrated well. Thought I should write up what I found out - will require various edits, but I shall eventually get round to adding it all I hope. Environment ClearCase - Version 7.0.1.2 of ClearCase. Maven - All of them, from the M...
It sounds like you've done a thorough exploration of integrating Apache Maven, IBM Rational ClearCase, and Hudson (now known as Jenkins) in your development environment. Below is a structured summary of your findings, which could serve as an effective document for sharing insights with colleagues or for future referenc...
39,603
[ { "from": "human", "value": "This led on from the question about asking if Apache Maven and IBM Rational ClearCase integrated well. Thought I should write up what I found out - will require various edits, but I shall eventually get round to adding it all I hope.\nEnvironment\nClearCase - Version 7.0.1.2 of ...
Is it possible to have a WPF window/element detect the drag'n'dropping of a file from windows explorer in C# .Net 3.5? I've found solutions for WinForms, but none for WPF.
Yes, it is definitely possible to handle drag-and-drop operations for files in a WPF application, including dragging files from Windows Explorer. While the approach is a bit different than in WinForms, WPF provides a similar mechanism to handle this. To detect a file being dragged and dropped onto a WPF window or elem...
39,945
[ { "from": "human", "value": "Is it possible to have a WPF window/element detect the drag'n'dropping of a file from windows explorer in C# .Net 3.5? I've found solutions for WinForms, but none for WPF.\n" }, { "from": "gpt", "value": "Yes, it is definitely possible to handle drag-and-drop operati...
This one is a case of not doing your homework.:-) Apart from dynamic loading advantage, does it make sense to include a JavaScript library(jQuery in my case ) from a Google server when I can load it from my server as a single file comprised of the 19kb jQuery zip file + the additional JavaScript code I have written –...
When considering whether to load a JavaScript library like jQuery from a CDN (Content Delivery Network) such as Google's server versus your own server, there are several factors to weigh beyond just the raw size and number of HTTP requests. Let's explore the benefits and drawbacks of each approach: ### Benefits of Usi...
36,086
[ { "from": "human", "value": "This one is a case of not doing your homework.:-) \nApart from dynamic loading advantage, does it make sense to include a JavaScript library(jQuery in my case ) from a Google server when I can load it from my server as a single file comprised of the 19kb jQuery zip file + the a...
I'm trying to wrap my head around the roles of UIViews and UIViewControllers. If I'm creating and inserting subviews programmatically, is it typical to do this from the view or the controller? I'm really just wondering if there's a convention/pattern for this. In my sample application, I'm loading 50 images at runtim...
You're touching on an important aspect of iOS development regarding the separation of concerns between `UIView` and `UIViewController`. Here are some best practices and conventions that can help guide your implementation: ### Separation of Concerns 1. **UIView**: This should primarily handle the drawing and layout of...
40,025
[ { "from": "human", "value": "I'm trying to wrap my head around the roles of UIViews and UIViewControllers. If I'm creating and inserting subviews programmatically, is it typical to do this from the view or the controller?\nI'm really just wondering if there's a convention/pattern for this. In my sample ap...
I couldn't find a documented API that yields this information. A friend suggested I use NtQuerySystemInformation. After looking it up, the information is there (see SYSTEM_THREAD ) but it is undocumented, and not very elegant - I get the information for all threads in the system. Do you know of a more elegant, preferab...
If you're looking for a more elegant and documented way to retrieve information about threads in a specific process, you might want to consider using the Windows API functions that interact with the process and its threads. Here are a few alternatives: 1. **CreateToolhelp32Snapshot / Thread32First / Thread32Next**: ...
38,075
[ { "from": "human", "value": "I couldn't find a documented API that yields this information.\nA friend suggested I use NtQuerySystemInformation. After looking it up, the information is there (see SYSTEM_THREAD ) but it is undocumented, and not very elegant - I get the information for all threads in the syste...
I am trying to convert my web application into a fully dynamic system. One thing I am trying to do is to load a different logo (set in the masterpage template) depending on the host. But, even though the code is hit (in page_init), there is no image displayed on any page inheriting the masterpage - no image, no red x's...
To dynamically set an image in an ASP.NET web application based on the host, you have to use a relative or virtual path rather than an absolute file path from your local file system. When the application runs on a web server, it cannot access files using paths like `C:\...`. Instead, you should use the `ResolveUrl` met...
40,376
[ { "from": "human", "value": "I am trying to convert my web application into a fully dynamic system. One thing I am trying to do is to load a different logo (set in the masterpage template) depending on the host.\nBut, even though the code is hit (in page_init), there is no image displayed on any page inheri...
I'm looking at some GXT code for GWT and I ran across this use of Generics that I can't find another example of in the Java tutorials. The class name is com.extjs.gxt.ui.client.data.BaseModelData if you want to look at all of the code. Here are the important parts: private RpcMap map; public <X> X get(String property...
What you're encountering is a feature of Java generics that allows for a method to be defined with a generic type parameter, in this case `<X>`. This allows the method to be flexible and return a value of any type when called. Let’s break it down: 1. **Generic Method**: The method `get(String property)` is a generic m...
40,173
[ { "from": "human", "value": "I'm looking at some GXT code for GWT and I ran across this use of Generics that I can't find another example of in the Java tutorials. The class name is com.extjs.gxt.ui.client.data.BaseModelData if you want to look at all of the code. Here are the important parts:\nprivate Rpc...
What is the time complexity of dynamic memory allocation using new, malloc, etc.? I know very little about how memory allocators are implemented, but I assume the answer is that it depends on the implementation. Therefore, please answer for some of the more common cases/implementations. Edit: I vaguely remember hear...
You're correct that the time complexity of dynamic memory allocation can vary depending on the specific implementation of the memory allocator. Different systems and libraries utilize different strategies for managing memory on the heap, which can significantly affect the performance characteristics of `new`, `malloc`,...
40,574
[ { "from": "human", "value": "What is the time complexity of dynamic memory allocation using new, malloc, etc.? I know very little about how memory allocators are implemented, but I assume the answer is that it depends on the implementation. Therefore, please answer for some of the more common cases/imple...
Has anyone suddenly encountered login errors from their users trying to connect to salesforce.com from a Flex app using as3salesforce.swc? I get the following error... password removed to protect the innocent... App Domain = null Api Server name = na3.salesforce.com _internalServerUrl = https://na3.salesforce.com/servi...
The error message you are encountering indicates that there is an issue with the login credentials being used to authenticate to Salesforce. Specifically, the `INVALID_LOGIN` message suggests that one of the following conditions could be causing the problem: 1. **Invalid Username or Password**: Ensure that the usernam...
40,772
[ { "from": "human", "value": "Has anyone suddenly encountered login errors from their users trying to connect to salesforce.com from a Flex app using as3salesforce.swc?\nI get the following error... password removed to protect the innocent...\nApp Domain = null\nApi Server name = na3.salesforce.com\n_interna...
Ever since switching from TABLE-layout to DIV-layout, one common problem remains: PROBLEM: you fill your DIV with dynamic text and inevitably there is a super-long word that extends over the edge of your div column and makes your site look unprofessional. RETRO-WHINING: This never happened with table layouts. A table c...
This is a common issue when using `div`-based layouts, especially when dealing with long unbreakable strings of text. In table layouts, cells naturally expand to fit the content, but with `div` layouts, you may run into overflow issues if the content doesn't fit the designated width. Here are several strategies you c...
38,350
[ { "from": "human", "value": "Ever since switching from TABLE-layout to DIV-layout, one common problem remains:\nPROBLEM: you fill your DIV with dynamic text and inevitably there is a super-long word that extends over the edge of your div column and makes your site look unprofessional.\nRETRO-WHINING: This n...
Ever since the publication of Enterprise Integration Patterns people have been using the notation introduced in that book for documenting asynchronous heterogenous messaging systems. But our shop is more or less standardized around a proprietary documentation tool that does exclusively UML. Is one of the standard UML d...
UML (Unified Modeling Language) is a versatile modeling language primarily used for software design, and while it doesn't directly address the specifics of asynchronous messaging systems, it does offer several diagram types that can be adapted to represent such systems. ### UML Diagram Types for Documenting Asynchrono...
39,084
[ { "from": "human", "value": "Ever since the publication of Enterprise Integration Patterns people have been using the notation introduced in that book for documenting asynchronous heterogenous messaging systems.\nBut our shop is more or less standardized around a proprietary documentation tool that does exc...
I'm developing an FTP-like program to download a large number of small files onto an Xbox 360 devkit (which uses Winsock), and porting it to Playstation3 (also a devkit, and uses linux AFAIK). The program uses BSD-style sockets (TCP). Both of the programs communicate with the same server, downloading the same data. ...
It sounds like you are experiencing a significant performance discrepancy between your Xbox 360 and PlayStation 3 implementations of your FTP-like program, particularly in the time taken for the PlayStation 3 to process responses from the server. Here are some ideas you might consider for diagnosing and potentially all...
37,801
[ { "from": "human", "value": "I'm developing an FTP-like program to download a large number of small files onto an Xbox 360 devkit (which uses Winsock), and porting it to Playstation3 (also a devkit, and uses linux AFAIK). The program uses BSD-style sockets (TCP). Both of the programs communicate with the ...
I'm searching for a configuration framework which handles key/values pairs based on conditions. The language and storage type doesn't matter. Example with background color for Application XYZ: Application has the background color "red". On Monday the background color should be green. The background color for User XYZ ...
To address your requirement for a configuration framework that can handle key/value pairs based on conditions, you can consider the following approach. This solution will be language-agnostic and can be adapted to your preferred programming language and storage type. Below is a basic conceptual framework using a combin...
39,512
[ { "from": "human", "value": "I'm searching for a configuration framework which handles key/values pairs based on conditions. The language and storage type doesn't matter.\nExample with background color for Application XYZ:\n\nApplication has the background color\n\"red\".\nOn Monday the background color sho...
Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB. Is there a way to have an insert statement return a value? I have a sequence set up to number entries as they go into the database, but I need that value to come back after the insert so I can do some manipulation to the set I just e...
In Oracle 9i, if you want to retrieve the value generated by a sequence after performing an `INSERT`, you typically need to do this in a two-step process. First, you insert the data into the database while using the sequence to set the ID, and then you can retrieve the last inserted ID in a subsequent query. However, ...
30,641
[ { "from": "human", "value": "Working with an Oracle 9i database from an ASP.NET 2.0 (VB) application using OLEDB. Is there a way to have an insert statement return a value? I have a sequence set up to number entries as they go into the database, but I need that value to come back after the insert so I can...
How are DLLs created out of C++ source code, and how are they used in other sources?
Creating Dynamic Link Libraries (DLLs) in C++ involves a few specific steps, and using them in other applications also has a straightforward process. Below is a comprehensive guide on how to create and use DLLs in C++. ### Creating a DLL in C++ 1. **Write the C++ Code:** First, create your C++ source file. This fi...
39,306
[ { "from": "human", "value": "How are DLLs created out of C++ source code, and how are they used in other sources?\n" }, { "from": "gpt", "value": "Creating Dynamic Link Libraries (DLLs) in C++ involves a few specific steps, and using them in other applications also has a straightforward process....
I'm having problems with my application receiving low memory warnings while the user is deep within a navigation controller stack of views. After the user browses through a bunch of hierarchical options in subsequent UITableViews, he can open a PDF document in a UIWebView (in a different view controller). Everything wo...
Dealing with low memory warnings and implementing lazy loading can be challenging, especially when working with memory-intensive views like UIWebView that display large documents. Here’s a simple guide on how to manage memory effectively and implement lazy loading in your application. ### 1. Responding to Low Memory W...
38,714
[ { "from": "human", "value": "I'm having problems with my application receiving low memory warnings while the user is deep within a navigation controller stack of views. After the user browses through a bunch of hierarchical options in subsequent UITableViews, he can open a PDF document in a UIWebView (in a ...
I want to call my .NET code from unmanaged C++. My process entrypoint is .NET based, so I don't have to worry about hosting the CLR. I know it can be done using COM wrappers for .NET objects, but I would like to access individual static methods of managed classes, so COM isn't my shortest/easiest route.
To call static methods of a .NET class from unmanaged C++, you can utilize the .NET hosting API to invoke the methods directly without creating a COM wrapper. Below are the steps you can follow: ### Steps to Call Static .NET Methods from Unmanaged C++ 1. **Create a .NET Class Library**: First, create a .NET Class ...
36,076
[ { "from": "human", "value": "I want to call my .NET code from unmanaged C++. My process entrypoint is .NET based, so I don't have to worry about hosting the CLR. I know it can be done using COM wrappers for .NET objects, but I would like to access individual static methods of managed classes, so COM isn't ...
I'm a huge fan of robocopy and use it extensively to copy between various servers I need to update. Lately I've been archiving to an Amazon S3 account that I access via a mapped drive using JungleDisk. I then robocopy my files from local PC to S3. Sometimes I get a very strange 'Incorrect function' error message in ro...
The "Incorrect function" or "Illegal MS-DOS function" error messages you are encountering while using Robocopy (or other copy methods) to transfer files to your Amazon S3 account via a mapped drive with JungleDisk can be frustrating. Here are several potential causes and solutions for these issues: 1. **File Path Leng...
25,530
[ { "from": "human", "value": "I'm a huge fan of robocopy and use it extensively to copy between various servers I need to update.\nLately I've been archiving to an Amazon S3 account that I access via a mapped drive using JungleDisk. I then robocopy my files from local PC to S3.\nSometimes I get a very stran...
How do you localize ASP.NET + javascript + Silverlight? I would like to be able to include the same texts in different languages in asp.net pages, javascript on the page, and Silverlight objects on the page. I have tried with the following method, but have no experience with it in practice, and I would like to hear you...
Localizing applications across ASP.NET, JavaScript, and Silverlight can indeed be complex due to the different technologies involved. Your approach is a valid one, but there are indeed alternative approaches and considerations that may simplify the process. Below are some suggestions and alternative strategies for hand...
40,141
[ { "from": "human", "value": "How do you localize ASP.NET + javascript + Silverlight?\nI would like to be able to include the same texts in different languages in asp.net pages, javascript on the page, and Silverlight objects on the page.\nI have tried with the following method, but have no experience with i...
I am looking for any and all suggestions of the best and effective resources that the StackOverflow community has used to better learn MSBuild with an emphasis on integrating unit tests and later static code analysis tools such as FxCop and StyleCop into the build process. I have tried to find good clear documentation ...
Integrating unit tests and static code analysis tools like FxCop and StyleCop into MSBuild can seem complex at first, but there are plenty of resources and guidelines available to help you. Below are some suggestions and useful resources that might assist you in your learning journey, especially with Visual Studio Team...
37,188
[ { "from": "human", "value": "I am looking for any and all suggestions of the best and effective resources that the StackOverflow community has used to better learn MSBuild with an emphasis on integrating unit tests and later static code analysis tools such as FxCop and StyleCop into the build process.\nI ha...
My company is looking into writing a custom application that will need to perform many list item queries across multiple site collections. It will need to run for WSS 3.0 and it 'would be nice' if it worked on WSS 2.0 as well. It won't be designed for MOSS/SPS but again it 'would be nice' if it worked on these platform...
When considering the development of a custom application for querying list items across multiple site collections in WSS 3.0 (and potentially WSS 2.0 and MOSS), you have two main options: using the SharePoint object model/API or SharePoint web services. Here's a breakdown of both approaches based on your criteria of pe...
39,226
[ { "from": "human", "value": "My company is looking into writing a custom application that will need to perform many list item queries across multiple site collections. It will need to run for WSS 3.0 and it 'would be nice' if it worked on WSS 2.0 as well. It won't be designed for MOSS/SPS but again it 'woul...
I've been spoiled by ActiveRecords. So I'm on the lookout for migration system that can be applied to SQL Server, and either is executed as Java application, or a Win32 Executable. (Of course further compatibility with other DB's and host OS's is welcome.) The real desire is having a clear schema change application w...
If you're looking for a database migration system that works well with SQL Server and has a clean, system-agnostic approach, you might want to consider the following options: 1. **Flyway**: - **Overview**: Flyway is a popular database migration tool that supports multiple databases, including SQL Server. It allows ...
36,651
[ { "from": "human", "value": "I've been spoiled by ActiveRecords. So I'm on the lookout for migration system that can be applied to SQL Server, and either is executed as Java application, or a Win32 Executable. (Of course further compatibility with other DB's and host OS's is welcome.)\nThe real desire is ...
When you add a file to Perforce, it attempts to determine what type of file it is (text, binary, utf16, etc.). It's does a good job of this, but apparently never checks the file type again after the initial submission to version control. A coworker recently made a change to a text file that converted it to Unicode (u...
In Perforce, the automatic detection of file types is primarily based on the initial submission and does not change thereafter. This can indeed lead to issues when files are modified in a way that changes their encoding (like converting a text file to UTF-16), which you've experienced. Here are a few approaches you mi...
41,722
[ { "from": "human", "value": "When you add a file to Perforce, it attempts to determine what type of file it is (text, binary, utf16, etc.). It's does a good job of this, but apparently never checks the file type again after the initial submission to version control. A coworker recently made a change to a ...
I have an arraylist that contains items called Room. Each Room has a roomtype such as kitchen, reception etc. I want to check the arraylist to see if any rooms of that type exist before adding it to the list. Can anyone recommend a neat way of doing this without the need for multiple foreach loops? (.NET 2.0) I havent...
In .NET 2.0, since you don't have access to LINQ, you can accomplish your goal of checking whether a room of a specific type exists in an `ArrayList` using a simple loop. However, to avoid multiple `foreach` loops, you can encapsulate the logic in a method that checks for existing room types and adds the new room if it...
40,439
[ { "from": "human", "value": "I have an arraylist that contains items called Room. Each Room has a roomtype such as kitchen, reception etc.\nI want to check the arraylist to see if any rooms of that type exist before adding it to the list.\nCan anyone recommend a neat way of doing this without the need for m...
I want to create a view that consists solely of a UITextView. When the view is first shown, by default, I'd like the keyboard to be visible and ready for text entry. This way, the user does not have to touch the UITextView first in order to begin editing. Is this possible? I see the class has a notification called UITe...
Yes, it is possible to have the keyboard automatically appear when a `UITextView` is shown. Instead of trying to send a notification like `UITextViewTextDidBeginEditingNotification`, you can simply call the `becomeFirstResponder` method on the `UITextView`. This method makes the `UITextView` the first responder and bri...
40,254
[ { "from": "human", "value": "I want to create a view that consists solely of a UITextView. When the view is first shown, by default, I'd like the keyboard to be visible and ready for text entry. This way, the user does not have to touch the UITextView first in order to begin editing.\nIs this possible? I se...
Say I have the following Objective-C class: @interface Foo { int someNumber; NSString *someString; } and for reasons I won't get into here, I want to use KVC to update, in a generic fashion, the values for those variables: [f setValue:object forKey:@"someNumber"]; or [f setValue:object forKey:@"someString"...
In Objective-C, when using Key-Value Coding (KVC) with `setValue:forKey:`, you indeed need to perform type conversions manually when you're setting properties that don't match the expected type exactly. Cocoa does not automatically infer and convert a string to an integer for you; you would need to provide a valid `NSN...
41,451
[ { "from": "human", "value": "Say I have the following Objective-C class:\n@interface Foo {\n int someNumber;\n NSString *someString;\n}\n\nand for reasons I won't get into here, I want to use KVC to update, in a generic fashion, the values for those variables:\n[f setValue:object forKey:@\"someNumbe...
In case one wants to protect VBA applications to make trial(demo) versions and not to expose the scripts, how secure the built in password protection is? Are there any alternatives? Edit: I'm asking about Excel VBA here.
Password protection in Excel VBA provides a basic level of security, but it is relatively weak and can be circumvented by determined individuals using various methods or tools available on the internet. Here are some important points regarding the security of VBA projects in Excel: ### Security of Built-in Password Pr...
38,820
[ { "from": "human", "value": "In case one wants to protect VBA applications to make trial(demo) versions and not to expose the scripts, how secure the built in password protection is? Are there any alternatives?\nEdit: I'm asking about Excel VBA here.\n" }, { "from": "gpt", "value": "Password pro...
This is not to be confused with "How to tell if a DOM element is visible?" I want to determine if a given DOM element is visible on the page. E.g. if the element is a child of a parent which has display:none; set, then it won't be visible. (This has nothing to do with whether the element is in the viewport or not) I co...
To determine if a given DOM element is visible on the page, you can check if it and all of its ancestors up to the `<body>` or `<html>` are not set to `display: none` or `visibility: hidden`. While iterating through each parent is a common approach, there are helper functions available in modern JavaScript that can str...
40,088
[ { "from": "human", "value": "This is not to be confused with \"How to tell if a DOM element is visible?\"\nI want to determine if a given DOM element is visible on the page.\nE.g. if the element is a child of a parent which has display:none; set, then it won't be visible.\n(This has nothing to do with wheth...
class MyBase { protected object PropertyOfBase { get; set; } } class MyType : MyBase { void MyMethod(MyBase parameter) { // I am looking for: object p = parameter.PropertyOfBase; // error CS1540: Cannot access protected member 'MyBase.PropertyOfBase' via a qualifier of type 'MyBase'; the q...
In C#, when you have a protected member in a base class, it can only be accessed from derived classes through instances of those derived types, not directly from instances of the base type. In your example, the `PropertyOfBase` property in `MyBase` is protected, which means it can only be accessed from `MyType` and any...
41,365
[ { "from": "human", "value": "class MyBase\n{\n protected object PropertyOfBase { get; set; }\n}\n\nclass MyType : MyBase\n{\n void MyMethod(MyBase parameter)\n {\n // I am looking for:\n object p = parameter.PropertyOfBase; // error CS1540: Cannot access protected member 'MyBase.Prop...
Ruby on Rails controllers will automatically convert parameters to an array if they have a specific format, like so: http://foo.com?x[]=1&x[]=5&x[]=bar This would get converted into the following array: ['1','5','bar'] Is there any way I can do this with an ActionScript 3 HTTPService object, by using the request para...
In ActionScript 3, you cannot directly append multiple values to the same key in an object like you can in some other languages. However, you can achieve the desired effect by using an array to group your values before sending them in the request. The key idea is to create an array in your request object that represent...
43,264
[ { "from": "human", "value": "Ruby on Rails controllers will automatically convert parameters to an array if they have a specific format, like so:\nhttp://foo.com?x[]=1&x[]=5&x[]=bar\n\nThis would get converted into the following array:\n['1','5','bar']\n\nIs there any way I can do this with an ActionScript ...
In Ruby (forgive me for mentioning it's name) I noticed you could do a anchor link with "link to unless current", which would remove the link if it was the current page. I know there's nothing built into CodeIgniter to do something similar, but I'm trying to come up with the best way to do this. I've got a few options,...
In CodeIgniter, you can create a helper function to generate anchor links that will avoid linking to the current page. This will keep your code clean and reusable throughout your application. Here's a simple helper function that checks the current URI segment and returns a link only if it is not the current page: 1. ...
36,209
[ { "from": "human", "value": "In Ruby (forgive me for mentioning it's name) I noticed you could do a anchor link with \"link to unless current\", which would remove the link if it was the current page.\nI know there's nothing built into CodeIgniter to do something similar, but I'm trying to come up with the ...
This is a generic way to select data from a table and show the results in an HTML table using JSP taglibs. What is the generic way to do this in Grails? That is, take a few lines of SQL and generate an HTML table from scratch in Grails, including the column names as headers. <sql:query var="results" dataSource="${ds...
In Grails, you can achieve similar functionality to what you've described using GORM (Grails Object Relational Mapping) to interact with the database, and GSP (Groovy Server Pages) to render the HTML. Below is a generic way to select data from a table, generate an HTML table, and include column names as headers using G...
38,068
[ { "from": "human", "value": "This is a generic way to select data from a table and show the results in an HTML table using JSP taglibs. What is the generic way to do this in Grails? That is, take a few lines of SQL and generate an HTML table from scratch in Grails, including the column names as headers.\n...
by default is a class: private ? internal ? sealed ?
In C#, the default accessibility of a class depends on the context in which it is defined: 1. **Top-Level Classes**: If a class is defined at the top level (not nested inside another class), it defaults to **internal** access. This means it is accessible only within the same assembly. 2. **Nested Classes**: If a clas...
43,638
[ { "from": "human", "value": "by default is a class:\n\nprivate ?\ninternal ? \nsealed ?\n\n" }, { "from": "gpt", "value": "In C#, the default accessibility of a class depends on the context in which it is defined:\n\n1. **Top-Level Classes**: If a class is defined at the top level (not nested in...
How do I set up a shell script to execute from the Mac OSX dock? It seems that simply creating a shortcut will open the file in my editor. Is there a flag I need to set somewhere to tell it to run instead of opening it for editing?
To set up a shell script to execute from the macOS Dock, you need to wrap it in an application bundle, because the Dock does not directly execute scripts or files. Here's a step-by-step guide on how to do this: ### Step 1: Create Your Shell Script 1. Open the Terminal application on your Mac. 2. Create your shell scr...
37,999
[ { "from": "human", "value": "How do I set up a shell script to execute from the Mac OSX dock? It seems that simply creating a shortcut will open the file in my editor. Is there a flag I need to set somewhere to tell it to run instead of opening it for editing?\n" }, { "from": "gpt", "value": "T...
Can I use Xpath node set function position() in Delphi's function selectNodes() to select only a certain number of element from a node list? If I do like this: selectNodes('Item[1]') its all fine and I get the element with index 1, but when I try selectNodes('Item[position()<10]') I get exception 'unknown method',...
In Delphi, particularly when using the `MSXML` library, the implementation of XPath expressions is often limited to a subset of the full XPath specification. The `selectNodes` function you're using might not support some of the more advanced XPath features, such as using functions like `position()`. That's why you're r...
40,486
[ { "from": "human", "value": "Can I use Xpath node set function position() in Delphi's function selectNodes() to select only a certain number of element from a node list? If I do like this: \nselectNodes('Item[1]') \n\nits all fine and I get the element with index 1, but when I try \nselectNodes('Item[positi...
I want to output a timestamp with a PST offset (e.g., 2008-11-13T13:23:30-08:00). java.util.SimpleDateFormat does not seem to output timezone offsets in the hour:minute format, it excludes the colon. Is there a simple way to get that timestamp in Java? // I want 2008-11-13T12:23:30-08:00 String timestamp = new SimpleDa...
You can achieve the desired output format (with a colon in the timezone offset) using `java.time` package, which was introduced in Java 8. This package provides a more comprehensive and user-friendly API for date and time manipulation, and it supports formatting and parsing of ISO-8601 timestamps, including the colon i...
39,277
[ { "from": "human", "value": "I want to output a timestamp with a PST offset (e.g., 2008-11-13T13:23:30-08:00). java.util.SimpleDateFormat does not seem to output timezone offsets in the hour:minute format, it excludes the colon. Is there a simple way to get that timestamp in Java?\n// I want 2008-11-13T12:2...
I create new project in Netbeans, but when I look the library it still using JDK 1.6 (default) I want to change into JDK 6 Update 10 but how? I already instal JDK 6 Update 10 but when I import org.hibernate the neatbeans didn't know which library that org.hibernate. someone can help me? THX
To change the JDK version in a NetBeans project and properly configure your libraries (like Hibernate), follow these steps: ### Step 1: Change JDK Version for Your Project 1. **Open Your Project**: Launch NetBeans and open your project. 2. **Project Properties**: - Right-click on your project in the "Projects" wind...
39,042
[ { "from": "human", "value": "I create new project in Netbeans, but when I look the library it still using JDK 1.6 (default) I want to change into JDK 6 Update 10 but how? I already instal JDK 6 Update 10 but when I import org.hibernate the neatbeans didn't know which library that org.hibernate.\nsomeone can...
I'm just starting to try out phpunit on some existing code. The naming convention we use is that the MyClass class should be in MyClass.class.php. PHPUnit seems to require that the file should be called MyClass.php. Is there any way around this? I noticed it while trying to generate a skeleton test class: phpunit --sk...
Yes, PHPUnit does have a naming convention where it expects class names to be in files named `MyClass.php` (without any suffix like `.class`). However, you can still work with your existing naming convention, albeit with a little extra configuration. ### Approach 1: Use Autoloading If you're using an autoloader (like...
40,387
[ { "from": "human", "value": "I'm just starting to try out phpunit on some existing code. The naming convention we use is that the MyClass class should be in MyClass.class.php. PHPUnit seems to require that the file should be called MyClass.php. \nIs there any way around this?\nI noticed it while trying to g...
Does anyone have a good way of implementing something like a sequence in SQL server? Sometimes you just don't want to use a GUID, besides the fact that they are ugly as heck. Maybe the sequence you want isn't numeric? Besides, inserting a row and then asking the DB what the number is just seems so hackish.
In SQL Server, you can implement sequences using the built-in `SEQUENCE` object. This is a good alternative to using GUIDs, especially when you want a simple, unique identifier that isn’t necessarily numeric. However, if your sequence needs to be non-numeric, you'll have to manage that through your application logic. ...
41,071
[ { "from": "human", "value": "Does anyone have a good way of implementing something like a sequence in SQL server?\nSometimes you just don't want to use a GUID, besides the fact that they are ugly as heck. Maybe the sequence you want isn't numeric? Besides, inserting a row and then asking the DB what the nu...
Is there an elegant way in Perl to find the newest file in a directory (newest by modification date)? What I have so far is searching for the files I need, and for each one get it's modification time, push into an array containing the filename, modification time, then sort it. There must be a better way.
Yes, there is indeed a more elegant way to find the newest file by modification date in a directory using Perl. You can leverage the `File::stat` module to access the modification time of files directly without the need to sort an array of file modification times. Instead, you can iterate over the files in the director...
40,021
[ { "from": "human", "value": "Is there an elegant way in Perl to find the newest file in a directory (newest by modification date)?\nWhat I have so far is searching for the files I need, and for each one get it's modification time, push into an array containing the filename, modification time, then sort it.\...
Possible Duplicate: PDO Prepared Statements I'm using the mysqli extension in PHP and I'm wondering, is there possibly any way to see a prepared query as it will be executed on the server, e.g. The query is something like this select * from table1 where id = ? and name = ? but I want to see the query after the valu...
In PHP, when using `mysqli` to prepare and execute queries, you can't directly get the finalized query with bound parameters, because prepared statements are designed to separate the query structure from the data. This enhances security by preventing SQL injection. However, if you want to debug your queries by replaci...
36,778
[ { "from": "human", "value": "\nPossible Duplicate:\nPDO Prepared Statements \n\nI'm using the mysqli extension in PHP and I'm wondering, is there possibly any way to see a prepared query as it will be executed on the server, e.g. The query is something like this\nselect * from table1 where id = ? and name =...
In MS Excel there is a tool for an iterative calculation of one cell given a condition in an other connected cell (target search is my obvisoly very poor translation from Swedish). I now want to do this whatever-it-is-called in MS Access. Any hint or at least a correct English term would be of great help.
The tool you're referring to in Excel is commonly known as "Goal Seek." In Excel, Goal Seek allows you to find the input value needed to achieve a specific goal or target in a formula. In Microsoft Access, the concept is slightly different since Access is primarily a database application rather than a spreadsheet one...
43,717
[ { "from": "human", "value": "In MS Excel there is a tool for an iterative calculation of one cell given a condition in an other connected cell (target search is my obvisoly very poor translation from Swedish). I now want to do this whatever-it-is-called in MS Access. Any hint or at least a correct English t...
I’m selecting data on an old database which has an abused status column. The status column has multiple pieces of information in it. Values are like ‘New Contact YYYY’, ‘Online YYYY’, ‘Updated YYYY’, ‘Withdrawn YYYY’, etc…. As you may have guessed, YYYY represents the year … which I need. In the past I’ve done someth...
Yes, there are definitely more efficient ways to extract the year from your status column without chaining a lot of replace functions. Since you know that the year is always at the end of the string and follows a specific format (i.e., four digits), you can use various string manipulation functions available in SQL. Be...
40,312
[ { "from": "human", "value": "I’m selecting data on an old database which has an abused status column. The status column has multiple pieces of information in it. Values are like ‘New Contact YYYY’, ‘Online YYYY’, ‘Updated YYYY’, ‘Withdrawn YYYY’, etc…. As you may have guessed, YYYY represents the year … w...
I'm trying to set up user-friendly captions in a DataSet which will be detected by an Infragistics grid during the binding process. I seem to recall that it was possible to do this in the underlying XSD of the typed dataset but any relevant links to this seem to have fallen off Google's relevant link list. Has anyone d...
To set up user-friendly captions in a Typed DataSet that will be recognized by an Infragistics grid, you can indeed specify captions directly in the XSD file that defines your DataSet. Here's a general approach to do that: ### Step 1: Modify the XSD 1. Open your XSD file in a text or XML editor. 2. Locate the `<xs:el...
36,487
[ { "from": "human", "value": "I'm trying to set up user-friendly captions in a DataSet which will be detected by an Infragistics grid during the binding process. I seem to recall that it was possible to do this in the underlying XSD of the typed dataset but any relevant links to this seem to have fallen off ...
I have a script which logs on to a remote server and tries to rename files, using PHP. The code currently looks something like this example from the php.net website: if (ftp_rename($conn_id, $old_file, $new_file)) { echo "successfully renamed $old_file to $new_file\n"; } else { echo "There was a problem while renamin...
To retrieve error messages from FTP operations in PHP, you can utilize the `ftp_errno()` function, which gets the last error number for the FTP connection. Additionally, you can use the `ftp_error()` function to get a more human-readable error message related to the FTP operations. However, please note that there is no...
40,023
[ { "from": "human", "value": "I have a script which logs on to a remote server and tries to rename files, using PHP.\nThe code currently looks something like this example from the php.net website:\nif (ftp_rename($conn_id, $old_file, $new_file)) {\n echo \"successfully renamed $old_file to $new_file\\n\";\n}...
How do you control the column width in a gridview control in ASP.NET 2.0?
In ASP.NET 2.0, to control the column width of a `GridView` control, you can use a few different approaches: ### 1. Using the `ItemStyle` Property You can set the `ItemStyle` property for each `BoundField` or `TemplateField` in your `GridView`. This allows you to specify a fixed width for columns. Here is an example: ...
36,254
[ { "from": "human", "value": "How do you control the column width in a gridview control in ASP.NET 2.0?\n" }, { "from": "gpt", "value": "In ASP.NET 2.0, to control the column width of a `GridView` control, you can use a few different approaches:\n\n### 1. Using the `ItemStyle` Property\nYou can s...
I have a python script that has to launch a shell command for every file in a dir: import os files = os.listdir(".") for f in files: os.execlp("myscript", "myscript", f) This works fine for the first file, but after the "myscript" command has ended, the execution stops and does not come back to the python script....
Yes, you are correct in your assessment. The `os.execlp` function replaces the current process with the new one, meaning that once you call `os.execlp`, the Python script is no longer running; it has been replaced by `myscript`. To achieve the behavior you want, where you run a command for each file and return control...
43,057
[ { "from": "human", "value": "I have a python script that has to launch a shell command for every file in a dir:\nimport os\n\nfiles = os.listdir(\".\")\nfor f in files:\n os.execlp(\"myscript\", \"myscript\", f)\n\nThis works fine for the first file, but after the \"myscript\" command has ended, the exec...
I'd like to be able to access the contents of my Storage Card which is in my Windows Mobile device. Normally, I'd just remove the card and shove it in a card reader, but its encrypted (and thus, locked to my WM device). Is there an API or some sort of framework allowing read/write access to the Storage Card (while PDA ...
Accessing the contents of an encrypted Storage Card from a Windows Mobile device while it's docked to a PC can be challenging, primarily due to the encryption designed to protect the data on the card. Here are some potential options and workarounds you might consider: 1. **Windows Mobile Device Center (WMDC)**: When y...
41,015
[ { "from": "human", "value": "I'd like to be able to access the contents of my Storage Card which is in my Windows Mobile device. Normally, I'd just remove the card and shove it in a card reader, but its encrypted (and thus, locked to my WM device).\nIs there an API or some sort of framework allowing read/wr...
I'm writing code in Java, using the NetBeans IDE. I keep getting a couple of "Incompatible Type" errors. I declare a variable as String and then assign to it the value from a method that returns a String too. The error says that there was expected a type of "String" but instead found "..." where "..." the name of the m...
The "Incompatible Type" error you are encountering in Java typically indicates that the return type of the method you are calling does not match the type you are trying to assign it to. In your case, you are trying to assign the return value of the method `encode_monoalphabetic_engine` to a variable of type `String`, b...
41,938
[ { "from": "human", "value": "I'm writing code in Java, using the NetBeans IDE. I keep getting a couple of \"Incompatible Type\" errors. I declare a variable as String and then assign to it the value from a method that returns a String too. The error says that there was expected a type of \"String\" but inst...
I keep it in single line, if it's short. Lately I've been using this style for longer or nested ternary operator expressions. A contrived example: $value = ( $a == $b ) ? 'true value # 1' : ( $a == $c ) ? 'true value # 2' : 'false value'; Personally which style ...
The choice of style for nested ternary operators largely depends on readability and maintainability. In your example, you have a couple of options that can enhance clarity. Here’s your original code for reference: ```php $value = ( $a == $b ) ? 'true value # 1' : ( $a == $c ) ...
40,717
[ { "from": "human", "value": "I keep it in single line, if it's short. Lately I've been using this style for longer or nested ternary operator expressions. A contrived example:\n$value = ( $a == $b ) \n ? 'true value # 1'\n : ( $a == $c )\n ? 'true value # 2'\n ...
I have a very long-running stored procedure in SQL Server 2005 that I'm trying to debug, and I'm using the 'print' command to do it. The problem is, I'm only getting the messages back from SQL Server at the very end of my sproc - I'd like to be able to flush the message buffer and see these messages immediately during ...
In SQL Server 2005, the `PRINT` command does not output messages immediately. Instead, it buffers the messages and sends them to the client in batches, which often results in them only being displayed after the entire stored procedure has finished executing. However, there are a few ways to work around this issue and s...
41,384
[ { "from": "human", "value": "I have a very long-running stored procedure in SQL Server 2005 that I'm trying to debug, and I'm using the 'print' command to do it. The problem is, I'm only getting the messages back from SQL Server at the very end of my sproc - I'd like to be able to flush the message buffer a...
It's a really basic question but i can't think at the second. How do i set up a loop that asks each time the function inside runs whether to do it again. So it runs it then says something like; "loop again? y/n"
You can set up a loop that prompts the user for input to determine whether to run a function again using a `while` loop in Python. Here's a simple example to illustrate how you might do this: ```python def my_function(): # Your function logic here print("Function is running.") def main(): while True: ...
42,627
[ { "from": "human", "value": "It's a really basic question but i can't think at the second. How do i set up a loop that asks each time the function inside runs whether to do it again. So it runs it then says something like;\n\"loop again? y/n\"\n" }, { "from": "gpt", "value": "You can set up a lo...
Is there a built in Javascript function to turn the text string of a month into the numerical equivalent? Ex. I have the name of the month "December" and I want a function to return "12".
JavaScript does not have a built-in function specifically for converting month names to their numerical equivalents. However, you can easily create your own function to achieve this. Here's an example of how you could implement such a function: ```javascript function monthNameToNumber(monthName) { const months = [...
41,113
[ { "from": "human", "value": "Is there a built in Javascript function to turn the text string of a month into the numerical equivalent? \nEx. \nI have the name of the month \"December\" and I want a function to return \"12\".\n" }, { "from": "gpt", "value": "JavaScript does not have a built-in fu...
How to Connect to PickBasic database using Ole db driver .. I need it badly help me out
Connecting to a PickBasic database using an OLE DB driver involves a few steps. Here’s a general guide to help you establish this connection. Please note that exact details might vary depending on the specific database system you are using (e.g., D3, UniData, etc.) and the driver you have installed. ### Prerequisites ...
38,394
[ { "from": "human", "value": "How to Connect to PickBasic database using Ole db driver .. I need it badly help me out\n" }, { "from": "gpt", "value": "Connecting to a PickBasic database using an OLE DB driver involves a few steps. Here’s a general guide to help you establish this connection. Plea...
I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?
To get all descendant text nodes of a specific element as a jQuery collection, you can use the following approach. Note that jQuery does not have a built-in method to directly select text nodes, so you'll need to create a custom function to extract the text nodes and wrap them in a jQuery object. Here's a way to do th...
41,897
[ { "from": "human", "value": "I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?\n" }, { "from": "gpt", "value": "To get all descendant text nodes of a specific element as a jQuery collection, you can use the following approach. N...
I was wondering if there's a code generator for Cairngorm that can be installed as a plugin in Eclipse? No code generator like in WebORB, FluorineFX that inspects the DataBase and generates a whole lot of code. I just want a plugin for eclipse where I can give in some options and properties. Then the plugin generates t...
As of my last knowledge update in October 2023, there isn't a widely known or commonly used Eclipse plugin specifically tailored for Cairngorm that functions exactly as you've described, generating the event, command, and delegate structure based on user-provided options. Cairngorm, being a design pattern primarily ass...
41,112
[ { "from": "human", "value": "I was wondering if there's a code generator for Cairngorm that can be installed as a plugin in Eclipse? No code generator like in WebORB, FluorineFX that inspects the DataBase and generates a whole lot of code. I just want a plugin for eclipse where I can give in some options an...
The number is bigger than int & long but can be accomodated in Decimal. But the normal ToString or Convert methods don't work on Decimal.
In .NET, the `Decimal` type can represent very large numbers, but it is not typically used for extremely large integers in the same way that you might use a `BigInteger` from `System.Numerics`. However, if you are dealing with `Decimal` values that are large and need to be converted to a string representation, you can ...
42,045
[ { "from": "human", "value": "The number is bigger than int & long but can be accomodated in Decimal. But the normal ToString or Convert methods don't work on Decimal.\n" }, { "from": "gpt", "value": "In .NET, the `Decimal` type can represent very large numbers, but it is not typically used for e...
I have a connection to a Microsoft SQL Server and want the change the connection authenticated user. Is it possible to do it without closing and reopening the connection? The ideal is something like Oracle set role feature. I'd love if the solution also works for SQL Server 2000.
In Microsoft SQL Server, changing the authenticated user for an existing connection without closing and reopening it is not possible. SQL Server does not provide a built-in feature similar to Oracle's `SET ROLE` that allows you to switch the authenticated user within an active session. Once a connection is established...
41,571
[ { "from": "human", "value": "I have a connection to a Microsoft SQL Server and want the change the connection authenticated user. Is it possible to do it without closing and reopening the connection?\nThe ideal is something like Oracle set role feature. \nI'd love if the solution also works for SQL Server 2...
Does anyone know how to do this? I need to add a header of the form: value1 value2
It seems like you want to add a header with multiple lines of text. The exact method will depend on the context in which you want to add this header (e.g., HTML, Markdown, a programming language, etc.). Here are a few examples in different contexts: ### HTML If you're working with HTML, you can use `<h1>`, `<h2>`, etc...
43,211
[ { "from": "human", "value": "Does anyone know how to do this? I need to add a header of the form:\n\n \n value1\n value2\n \n\n" }, { "from": "gpt", "value": "It seems like you want to add a header with multiple lines of text. The exact method will depend on the context in which you want...
I need to set the fetch mode on my hibernate mappings to be eager in some cases, and lazy in others. I have my default (set through the hbm file) as lazy="true". How do I override this setting in code? MyClass has a set defined of type MyClass2 for which I want to set the FetchMode to EAGER. Currently, I have something...
To override the default fetch mode specified in your Hibernate mapping file (where lazy loading is set to `lazy="true"`), you can use the `Criteria` API or the `JPQL` (Java Persistence Query Language) with the `JOIN FETCH` clause, depending on your use case. ### Using Criteria API If you are using the Criteria API, y...
42,106
[ { "from": "human", "value": "I need to set the fetch mode on my hibernate mappings to be eager in some cases, and lazy in others. I have my default (set through the hbm file) as lazy=\"true\". How do I override this setting in code? MyClass has a set defined of type MyClass2 for which I want to set the Fetc...
Using Microsoft's AntiXssLibrary, how do you handle input that needs to be edited later? For example: User enters: <i>title</i> Saved to the database as: <i>title</i> On an edit page, in a text box it displays something like: &lt;i&gt;title&lt;/i&gt; because I've encoded it before displaying in the text box...
When dealing with user-generated content that needs to be displayed in an edit field, you must carefully balance security with usability. Here's a breakdown of how to handle this situation effectively while minimizing the risk of Cross-Site Scripting (XSS) attacks. ### Understanding the Problem 1. **User Input:** Use...
40,903
[ { "from": "human", "value": "Using Microsoft's AntiXssLibrary, how do you handle input that needs to be edited later?\nFor example:\nUser enters:\n <i>title</i>\nSaved to the database as:\n <i>title</i>\nOn an edit page, in a text box it displays something like: \n &lt;i&gt;title&lt;/i&gt; because I...
I have a const char arr[] parameter that I am trying to iterate over, char *ptr; for (ptr= arr; *ptr!= '\0'; ptr++) /* some code*/ I get an error: assignment discards qualifiers from pointer target type Are const char [] handled differently than non-const?
Yes, the error you are encountering is due to the way the `const` qualifier affects pointer types in C/C++. When you declare a parameter as `const char arr[]`, it means that the array is made up of `const` characters, indicating that the contents of the array should not be modified. Here's the relevant part of your co...
41,549
[ { "from": "human", "value": "I have a const char arr[] parameter that I am trying to iterate over,\nchar *ptr;\nfor (ptr= arr; *ptr!= '\\0'; ptr++) \n /* some code*/\n\nI get an error: assignment discards qualifiers from pointer target type\nAre const char [] handled differently than non-const?\n" }, {...
Can someone explain the structure of a Pid in Erlang? Pids looks like this: <A.B.C>, e.g. <0.30.0> , but I would like to know what is the meaning of these three "bits": A, B and C. A seems to be always 0 on a local node, but this value changes when the Pid's owner is located on another node. Is it possible to directly ...
In Erlang, a Process Identifier (Pid) is a unique identifier for a process within the Erlang runtime system. The structure of a Pid is represented as `<A.B.C>`, where: - **A**: This is the *node identifier* which identifies the node where the process resides. For processes running on the local node, this is usually `0...
41,755
[ { "from": "human", "value": "Can someone explain the structure of a Pid in Erlang?\nPids looks like this: <A.B.C>, e.g. <0.30.0> , but I would like to know what is the meaning of these three \"bits\": A, B and C.\nA seems to be always 0 on a local node, but this value changes when the Pid's owner is located...
I have an application that creates, and destroys thousands of objects. Is it worth caching and reusing objects, or is Delphi's memory manager fast enough that creating and destroying objects multiple times is not that great an overhead (as opposed to keeping track of a cache) When I say worth it, of course I'm looking ...
When considering whether to cache and reuse objects versus creating and destroying them on the fly in Delphi, it’s important to evaluate a few key factors that can impact performance: ### 1. **Cost of Object Creation and Destruction** - **Object Overhead**: Creating and destroying objects can incur overhead due to ...
41,642
[ { "from": "human", "value": "I have an application that creates, and destroys thousands of objects. Is it worth caching and reusing objects, or is Delphi's memory manager fast enough that creating and destroying objects multiple times is not that great an overhead (as opposed to keeping track of a cache) Wh...
Does Silverlight have a VirtualizingStackPanel? If there is no built in type are there any third party controls that implement this?
Silverlight does not have a built-in `VirtualizingStackPanel` like WPF does. `VirtualizingStackPanel` is designed to improve performance by virtualizing item layouts, meaning that it only generates UI elements for items that are currently visible in the viewport, thus saving memory and processing resources. Since Silv...
41,876
[ { "from": "human", "value": "Does Silverlight have a VirtualizingStackPanel?\nIf there is no built in type are there any third party controls that implement this?\n" }, { "from": "gpt", "value": "Silverlight does not have a built-in `VirtualizingStackPanel` like WPF does. `VirtualizingStackPanel...
Is there a way to execute a query(containing built in DB function) using PreparedStatement? Example: insert into foo (location) values (pointfromtext('12.56666 13.67777',4130)) Here pointfromtext is a built in function.
Yes, you can execute a query that contains a built-in database function using a `PreparedStatement` in Java. The `PreparedStatement` allows you to execute parameterized SQL queries, which can include built-in functions like `POINTFROMTEXT`. Here’s how you can do it in Java: 1. **Establish a connection** to the databa...
39,474
[ { "from": "human", "value": "Is there a way to execute a query(containing built in DB function) using PreparedStatement?\nExample:\ninsert into foo (location) values (pointfromtext('12.56666 13.67777',4130))\nHere pointfromtext is a built in function.\n" }, { "from": "gpt", "value": "Yes, you ca...
I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different user_id and without a fixed value for auto_id since that is an auto_increment field, and setting ti to NOW(). Below is my mockup query where '1' is the new user_id. I have be...
Your SQL query is almost correct, but it has a few minor issues. The most notable one is that you have two columns named `ti`, which can cause confusion and errors. Also, the `INSERT INTO` statement should specify the columns you want to insert values into correctly. Here’s a revised version of your query: ```sql INSE...
39,671
[ { "from": "human", "value": "I am trying to insert a new row into my table which holds the same data as the one I am trying to select from the same table but with a different user_id and without a fixed value for auto_id since that is an auto_increment field, and setting ti to NOW(). Below is my mockup quer...
Is there a shortcut for giving a limit and order when accessing a has_many relation in an ActiveRecord model? For example, here's what I'd like to express: @user.posts(:limit => 5, :order => "title") As opposed to the longer version: Post.find(:all, :limit => 5, :order => "title", :conditions => ['user_id = ?', @user....
Yes, you can achieve this using the `ActiveRecord` querying interface, which allows you to chain methods to apply various query constraints like `limit` and `order` dynamically. However, the syntax you've provided is not valid for a `has_many` association directly. When you want to retrieve associated records with spe...
41,657
[ { "from": "human", "value": "Is there a shortcut for giving a limit and order when accessing a has_many relation in an ActiveRecord model?\nFor example, here's what I'd like to express:\n@user.posts(:limit => 5, :order => \"title\")\n\nAs opposed to the longer version:\nPost.find(:all, :limit => 5, :order =...
In JavaScript this was a cross-browser compatibility issue, so both were used, but there are numerous instances in different languages where I see both printed out together as \r\n. Is this still the generally excepted norm that you should just always use both, or is there ever a time where languages understand both an...
In programming and text processing, the representation of new lines can vary based on operating systems and languages. Here's a brief overview of how newline characters work and when to use them: ### Newline Characters - `\n` (Line Feed, LF): This is used as a newline character in Unix/Linux and macOS. - `\r` (Carriag...
41,484
[ { "from": "human", "value": "In JavaScript this was a cross-browser compatibility issue, so both were used, but there are numerous instances in different languages where I see both printed out together as \\r\\n. Is this still the generally excepted norm that you should just always use both, or is there eve...
I'd like to enter the mysteries of Emacs - but gently! Excuse the lack of machismo, but is there a Emacs-clone for Windows which supports mouse-and-menu usage to get me started -- so I can delay learning ALT-META_CTRL-C-C for a while.
Absolutely, it's perfectly fine to start gently with Emacs! If you're looking for an Emacs clone for Windows that supports mouse and menu usage, you might want to try **GNU Emacs** itself, as it has good support for mouse and menus right out of the box. Here's how you can get started: 1. **Download and Install GNU Ema...
42,869
[ { "from": "human", "value": "I'd like to enter the mysteries of Emacs - but gently! Excuse the lack of machismo, but is there a Emacs-clone for Windows which supports mouse-and-menu usage to get me started -- so I can delay learning ALT-META_CTRL-C-C for a while.\n" }, { "from": "gpt", "value":...
I've been using SVN a lot as a single user on a single computer Now I'd like to share my stuff across multiple computers So far I've been checking out from file://c:/myproject I'd like to checkout from svn://mycomputer/myproject How can I map the first into the second?
To transition from using `file://` URLs to `svn://` URLs for sharing your SVN repository across multiple computers, you'll need to set up an SVN server on your machine. Here's a step-by-step guide on how to do that: ### Step 1: Install SVN Server 1. **Install Subversion (SVN):** If you haven't already, you need to...
40,017
[ { "from": "human", "value": "I've been using SVN a lot as a single user on a single computer\nNow I'd like to share my stuff across multiple computers\nSo far I've been checking out from file://c:/myproject\nI'd like to checkout from svn://mycomputer/myproject\nHow can I map the first into the second?\n" ...
I'm looking for a module or some way to obtain the information about the content of a file. The same sort of thing that the Linux "file" command does, but in Perl language.
In Perl, you can use the `File::LibMagic` module to obtain information about the content of a file in a manner similar to the Linux `file` command. This module is a Perl binding to the `libmagic` library, which is the underlying library used by the `file` command. Here's a step-by-step guide on how to use it: 1. **In...
39,586
[ { "from": "human", "value": "I'm looking for a module or some way to obtain the information about the content of a file. \nThe same sort of thing that the Linux \"file\" command does, but in Perl language.\n" }, { "from": "gpt", "value": "In Perl, you can use the `File::LibMagic` module to obtai...
I have input consisting of a list of nested lists like this: l = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]] I want to sort this list based on the sum of all the numbers in the nested lists... so, the values I want to sort by of l would look like this: [39, 6, 13, 50] Then I want to sort based o...
You can achieve this in Python using a combination of recursive functions and the built-in `sorted()` function. The idea is to first create a function to compute the sum of all the numbers in the nested lists and then use that function as a key for sorting. Here's how you can do it: ```python def nested_sum(lst): ...
42,304
[ { "from": "human", "value": "I have input consisting of a list of nested lists like this:\nl = [[[[[39]]]], [1, 2, 3], [4, [5, 3], 1], [[[[8, 9], 10], 11], 12]]\n\nI want to sort this list based on the sum of all the numbers in the nested lists... so, the values I want to sort by of l would look like this:\...