static-methods

ASP.NET how to call clientscript from public static method

青春壹個敷衍的年華 提交于 2019-12-14 01:19:28
问题 I'm going to use following ClientScript function (VS2010,C#) in a public static method, but it gives me some errors (I want to use it for response redirect with "_parent" target ClientScript.RegisterStartupScript(GetType(), "Load", "<script type='text/javascript'>window.parent.location.href = '" + a + "'; </script>"); Error 37 An object reference is required for the non-static field, method, or property 'System.Web.UI.Page.ClientScript.get' Error 38 An object reference is required for the non

Method calling error [closed]

对着背影说爱祢 提交于 2019-12-14 00:07:52
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I need to use two methods in my program which converts temperatures I have a problem with calling my method here is my code: import java.io.*; import javax.swing.JOptionPane; public class Converter { public

Opening a Form multiple times from a static class which is called from different forms

我是研究僧i 提交于 2019-12-13 08:21:17
问题 If I open a Form named FormX that does some processing on its public (not static) variable "Var". "Var" is set from a calling form and processed and returned for output. I open it from multiple forms multiple times during execution. All forms are running simultaneously. It works fine because each FormX is opened using a seperate instance of an object from its parent form. But I have a public static class "Abc" in my project which is accessible to all forms and if I add a code: public static

DialogProc function asking to declare it self static [duplicate]

橙三吉。 提交于 2019-12-13 07:15:53
问题 This question already has answers here : Non-static members not accessible in static function (4 answers) Closed 5 years ago . here is my createdialogparam function which is calling DialogProc function from here- HRESULT AMEPreviewHandler::CreatePreviewWindow() { assert(m_hwndPreview == NULL); assert(m_hwndParent != NULL); HRESULT hr = S_OK; m_hwndPreview = CreateDialogParam( g_hInst,MAKEINTRESOURCE(IDD_MAINDIALOG), m_hwndParent,(DLGPROC)DialogProc, (LPARAM)this); /here the dialog proc

Using classes with only static methods for organizational purposes?

老子叫甜甜 提交于 2019-12-13 05:49:37
问题 I work for a MSSP and a lot of the security alerts we deal with, especially with new clients, can be dealt with according to some simple if-then logic without taking up analyst time to research. To handle these sorts of alerts, I am building a basic python program with a series of logic tests to see if a given alert falls into a 'known' category and can be dealt with automatically. My desired format is to have a separate python file for each client we service for organizational purposes, and

Curious problem involving generics and static methods

非 Y 不嫁゛ 提交于 2019-12-13 02:38:58
问题 I have a number of data classes, which share an abstract base class so i can work with them generically (sort of). They each have a static method called Lerp, which i use frequently along with a couple of other lines. I wanted to refactor this out into a method because of DRY,but it seems there's no way to do so. How do i get around this? Can provide code if neccessary. The code is basically this: XmlNode mineDataMin = mineDataMaster.SelectSingleNode("DataMinimum"); XmlNode mineDataMax =

How to pass values to my object array from my static method

三世轮回 提交于 2019-12-12 17:30:58
问题 I have 3 classes one EyMain that is my main class where I read a "n" value > 100 that creates the number of my object arrays.Then I call writeUSB() method where I fill the object array. public class EyMain { public static void main(String[] args) { int n; do { System.out.println("Give an integer value > 100 : "); n = scannerUserInput.getInteger(); } while (n < 101); ekpaideytikoYliko usb[] = new ekpaideytikoYliko[n]; eYMethods.writeUSB(usb); eYMethods.showDocs(usb); } } My other class is

Fatal Error when calling static method

若如初见. 提交于 2019-12-12 16:27:37
问题 So, here's my situation : I'm using CodeIgniter I've set up a helper, ('string_helper' under 'DK' folder) I've set up the dkString class in dk/string_helper.php static function strInArray($str,$arr) { foreach ($arr as $item) { if (self::inString($str,$item)) return true; } return false; } In my controller: I'm loading the helper ( $this->load->helper('dk/string'); ) Calling the method ( dkString::strInArray($str,$arr); ) Note : I've loaded class's static methods residing in a custom helper,

Is there an alternative to the Curiously Recurring Template Pattern?

不羁岁月 提交于 2019-12-12 13:17:05
问题 I've caused myself some headaches over the past couple of weeks with the curiously recurring template pattern. Following on from these two questions of mine: What’s the correct way of retrieving my custom enumeration classes by their value? Why are my static objects not being instantiated when first access to the static class is a static method on the base class? How can I improve the following example: public class DocketType : Enumeration<DocketType, int, string> { public static DocketType

Static member instance reference issue [duplicate]

折月煮酒 提交于 2019-12-12 12:39:12
问题 This question already has answers here : Member '<method>' cannot be accessed with an instance reference (10 answers) Closed 5 years ago . I have the following static method held in an Analytics class: public static void buttonHit(string eventName, string eventAction, string description) { gua.sendEventHit(eventName,eventAction,description,1); } In a second class I'm trying to fill this out as follows: Analytics analytics; void buttonEventAnalytic() { analytics.buttonHit(event_NameString,