static

C# - Global Program Object

Scenario I have a non-static class that wraps around Log4Net. This is really handy as it links up to a further application I have that displays logs of different processes that occur in a variety of software that I write (to allow me to see where errors occur, batch processes fail etc.) Problem This is all well and good, but if I want...

get post from wodpress

I have a static website, and i like to take some (+ or - 15) post from my 200 post wordpress and get it in a static website with design and thing really different from the blog i have get that code : <?php $my_id = 1828; $post_id = get_post($my_id); echo $post_id; ?> but how to tell the address of the blog, and how to get the dat...

how does the following code work

Currently I'm trying to invoke it like this: class Test { public static void test() { System.out.println("hi"); } public static void main(String[] args) { Test t = null; t.test(); } } The output of the code is hi ...

Questions about the static keyword with functions and data

I have a few questions about the static keyword in C++ (and probably with other languages as well.) What is the purpose of declaring a function as static? void static foo(int aNumber) { ... } How about a static inline function? void static inline foo(int aNumber) { ... } Is there any benefit to using the static keyword with a functio...

Static initialization in C

I want to have code that looks something like this... static linked_list* globalListHoldingAllSortsOfGoodies = initialize_linked_list(); /* [In a different file...] */ static int placeholder = add_to_global_list(goodies); But non-constant initialization is impossible in C. Is there some way to get the same affect without breaking C8...

Is there a way to have a single static variable for a template class (for all types) without breaking encapsulation

I need a way to have a single static variable for all kinds of types of my template class template <class T> class Foo { static Bar foobar;}; Well, the line above will generate a Bar object named foobar for every type T, but this is not what i want, i basically want a way to declare a variable of type Bar, so every object of type F...

Different approach to single static variable for a template class

I never really had a necessity for a global variable in a template (and actually I don't support a design like this very much) but this topic got me curious. Even though answered, it inspired me trying a different approach. Instead of using inheritance, I came up with this: class Bar {}; class { private: Bar bar; template <cla...

is local static variable provided by embedded compilers?

im working on a c lib which would be nice to also work on embedded systems but im not very deep into embedded development so my question are most embedded compilers able to cope with local static variables - which i would then just assume in further development OR is there a #define which i can use for a #ifdef to create a global variab...

How to rotate an static image in HTML

in my application, i need a static image to be rotated in HTML. Please help me for that ...

Adding functionality to a static website using ruby on rails

Hi, I am new to ruby on rails. I have a website with a lot of static pages. I want to add a number of dynamic pages to the website and these I am going to develop in ruby on rails. The functionality offered by these pages will be triggered when the user clicks on one of the buttons which is on one of the static pages. I am thinking th...

Refering to the class itself from within a class mehod in Objective C

I hope i did not skip this part in the ObjC manual but is it possible to refer to a class from within one of its class methods? Like in PHP you would use "this" to refer to the current instance, while "self" refers to the instance's class the ObjC equivalent of "this" would be "self", so what would be the ObjC equivalent of PHP's "self",...

How to get a static reference to a WPF Window?

I've tried a huge amount of ways to get a static reference of my window across my program. I need to access all of its members at runtime from different classes, so a static reference is needed. What I'd like to have is something like Program.Window1, where Core is static and MyWindow is one of its static members. In WinForms, I usuall...

How to serve static files via Rack?

Hi, I am currently developing a Rack-based application and want to redirect all file requests(e.g. filename.filetype) to a specified folder. Rack::Static only supports file requests for a special folder(e.g. "/media"). Do I have to write an own Rack middleware or does a out-of-the-box solution exist? Best regards ...

Static keyword in function parameter

I've just found this function definition in some embedded code: float round_float_to_4(static float inputval); I'm familiar with other uses for static (global variables, functions and local variables), but this is the first time I see it as specifier for function parameter. I assume that this forces compiler to use fixed memory locati...

Static Method of a Static Class vs. Static Method of a Non-Static Class ( C# )

I was asked the above question in an interview. Could you please explain the differences? ( performance - memory - usage - when to use which ? ) Thank you, Erkan ...

Java Static-block Shutdown Hook with System.exit

This code will deadlock: public class Main { static public final Object a = new Object(); static { Runtime.getRuntime().addShutdownHook(new Thread() { @Override public void run() { if (a == null); } }); System.exit(0); } static public void main(final String[] args) {} } This code will ex...

Static vs global

if i have a c file like below #include<stdio.h> #include<stdlib.h> static int i; int j; int main () { //some implementation } What is the difference between i & j? ...

How to insert text with several pages into iReport? a contract, for example

I am trying to create auto-fillable contract with several pages in latest iReport. The problem is it allows to create one big page or create several static pages with static text, but my text is flexible. thanks. ...

Do C# static functions perform better than nonstatic functions, beyond reduced memory usage?

I assume that public or private static targets must have reduced memory usage, due to the fact that there is only one copy of the static target in memory. It seems like because a method is static that might make the method a potential point for further optimization by the CLR compiler beyond what is possible with a non-static function. ...

Global variable in a static method

This seems basic but Im finding this quite trivial. Simply how would you recommend setting a global variable with a static class (i.e. console-application)? To give you a little more background the main method is calling some custom eventhandlers that I hope to get / set the variables. Any ideas or suggestions you have is appreciated....