Search Results

Search found 37004 results on 1481 pages for 'public static'.

Page 11/1481 | < Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >

  • Help on using mod_rewrite to serve I18N static site

    - by Guandalino
    My static site www.example.com is translated in different languages and files are organized in this hierarchy: / /de index.html seite-1.html /en index.html page-1.html /it index.html pagina-1.html The root contains no files, just one subdirectory for each language the site is translated in, while subdirectories contain pages translated (both content and file name are) in the language corresponding to subdirectory name, de, en, it, etc. The question is: how to configure mod_rewrite so that when a client visits www.example.com it is taken to the correct version of the site, falling back to english version if the required locale is not supported (i.e. Accept-Language header doesn't exist or specifies a language for which the site is not available, e.g. fr)? Thanks for any pointer, I'm here to provide further details or feedback! Best regards

    Read the article

  • Requring static class setter to be called before constructor, bad design?

    - by roverred
    I have a class, say Foo, and every instance of Foo will need and contain the same List object, myList. Since every class instance will share the same List Object, I thought it would be good to make myList static and use a static function to set myList before the constructor is called. I was wondering if this was bad, because this requires the setter to be called before the constructor? If the person doesn't, the program will crash. Alternative way would be passing myList every time.

    Read the article

  • Unable to access static var from Document Class in AS3

    - by omidomid
    I have a Document class called "CityModule", and an asset with class "City". Below is the coe for each. For some reason, I am unable to access the static variables of the City class from CityModule: CityModule.as: package { public class CityModule extends MovieClip { public function CityModule() { var buildings:Array = City.getBuildings(); } } } } City.as: package { import flash.display.MovieClip; public class City extends MovieClip { private static var _buildings:Array = [ {className:'City.Generic1', type:'generic'}, {className:'City.Generic2', type:'generic'}, {className:'City.Generic3', type:'generic'} ]; public function City(){ //empty } public static function getBuildings():Array{ return _buildings; } } } Doing this gives me a "Call to a possibly undefined method getBuildings" error. If I instantiate an instance of City, I can see any public/ getters/ setters perfectly fine. But static isn't working...

    Read the article

  • static initialization confusion

    - by Happy Mittal
    I am getting very confused in some concepts in c++. For ex: I have following two files //file1.cpp class test { static int s; public: test(){s++;} }; static test t; int test::s=5; //file2.cpp #include<iostream> using namespace std; class test { static int s; public: test(){s++;} static int get() { return s; } }; static test t; int main() { cout<<test::get()<<endl; } Now My question is : 1. How two files link successfully even if they have different class definitions? 2. Are the static member s of two classes related because I get output as 7. Please explain this concept of statics.

    Read the article

  • Tunneling a public IP to a remote machine

    - by Jim Paris
    I have a Linux server A with a block of 5 public IP addresses, 8.8.8.122/29. Currently, 8.8.8.122 is assigned to eth0, and 8.8.8.123 is assigned to eth0:1. I have another Linux machine B in a remote location, behind NAT. I would like to set up an tunnel between the two so that B can use the IP address 8.8.8.123 as its primary IP address. OpenVPN is probably the answer, but I can't quite figure out how to set things up (topology subnet or topology p2p might be appropriate. Or should I be using Ethernet bridging?). Security and encryption is not a big concern at this point, so GRE would be fine too -- machine B will be coming from a known IP address and can be authenticated based on that. How can I do this? Can anyone suggest an OpenVPN config, or some other approach, that could work in this situation? Ideally, it would also be able to handle multiple clients (e.g. share all four of spare IPs with other machines), without letting those clients use IPs to which they are not entitled.

    Read the article

  • Significant amount of the time, I can't think of a reason to have an object instead of a static class. Do objects have more benefits than I think?

    - by Prog
    I understand the concept of an object, and as a Java programmer I feel the OO paradigm comes rather naturally to me in practice. However recently I found myself thinking: Wait a second, what are actually the practical benefits of using an object over using a static class (with proper encapsulation and OO practices)? I could think of two benefits of using an object (both significant and powerful): Polymorphism: allows you to swap functionality dynamically and flexibly during runtime. Also allows to add new functionality 'parts' and alternatives to the system easily. For example if there's a Car class designed to work with Engine objects, and you want to add a new Engine to the system that the Car can use, you can create a new Engine subclass and simply pass an object of this class into the Car object, without having to change anything about Car. And you can decide to do so during runtime. Being able to 'pass functionality around': you can pass an object around the system dynamically. But are there any more advantages to objects over static classes? Often when I add new 'parts' to a system, I do so by creating a new class and instantiating objects from it. But recently when I stopped and thought about it, I realized that a static class would do just the same as an object, in a lot of the places where I normally use an object. For example, I'm working on adding a save/load-file mechanism to my app. With an object, the calling line of code will look like this: Thing thing = fileLoader.load(file); With a static class, it would look like this: Thing thing = FileLoader.load(file); What's the difference? Fairly often I just can't think of a reason to instantiate an object when a plain-old static-class would act just the same. But in OO systems, static classes are fairly rare. So I must be missing something. Are there any more advantages to objects other from the two that I listed? Please explain.

    Read the article

  • Public and Internal members in an Internal class?

    - by Noldorin
    Ok, so this may be a bit of a silly question, and there's certainly the obvious answer, but I was curious if I've missed any subtleties here. Is there any difference in terms of visibility/usability between a public member declared in an internal class and an internal member declared in an internal class? i.e. between internal class Foo { public void Bar() { } } and internal class Foo { internal void Bar() { } } If you declared the method as public and also virtual, and then overrode it in a derived class that is public, the reason for using this modifier is clear. However, is this the only situation... am I missing something else?

    Read the article

  • Static route works on one computer, not the other

    - by Dan
    I have been struggling with this for a couple days now, maybe I just need some people with a fresh perspective to figure out what the issue is. Basically I have a bunch of computers that are being routed through a specific gateway in order to access a web page that is hosted internally on a separate subnet. I set up static routes on all of the computers, and they all work... except one. Here's what a route print -4 looks like for a working computer (Windows 7): =========================================================================== Interface List 14...xx xx xx xx xx xx ......Broadcom 802.11n Network Adapter 11...xx xx xx xx xx xx ......Realtek PCIe GBE Family Controller 1...........................Software Loopback Interface 1 12...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter 13...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter 17...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.xxx.xxx.230 10.xxx.xxx.94 20 10.zzz.zzz.0 255.255.255.0 10.xxx.xxx.147 10.xxx.xxx.94 21 10.xxx.xxx.0 255.255.255.0 On-link 10.xxx.xxx.94 276 10.xxx.xxx.94 255.255.255.255 On-link 10.xxx.xxx.94 276 10.xxx.xxx.255 255.255.255.255 On-link 10.xxx.xxx.94 276 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 10.xxx.xxx.94 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 10.xxx.xxx.94 276 =========================================================================== Persistent Routes: Network Address Netmask Gateway Address Metric 10.zzz.zzz.0 255.255.255.0 10.xxx.xxx.147 1 =========================================================================== And here's a route print -4 from the station that doesn't work (also Windows 7): =========================================================================== Interface List 10...xx xx xx xx xx xx ......Realtek PCIe GBE Family Controller 1...........................Software Loopback Interface 1 12...00 00 00 00 00 00 00 e0 Microsoft 6to4 Adapter 14...00 00 00 00 00 00 00 e0 Microsoft ISATAP Adapter #2 16...00 00 00 00 00 00 00 e0 Teredo Tunneling Pseudo-Interface =========================================================================== IPv4 Route Table =========================================================================== Active Routes: Network Destination Netmask Gateway Interface Metric 0.0.0.0 0.0.0.0 10.xxx.xxx.230 10.xxx.xxx.132 276 10.zzz.zzz.0 255.255.255.0 10.xxx.xxx.147 10.xxx.xxx.132 21 10.xxx.xxx.0 255.255.255.0 On-link 10.xxx.xxx.132 276 10.xxx.xxx.132 255.255.255.255 On-link 10.xxx.xxx.132 276 10.xxx.xxx.255 255.255.255.255 On-link 10.xxx.xxx.132 276 127.0.0.0 255.0.0.0 On-link 127.0.0.1 306 127.0.0.1 255.255.255.255 On-link 127.0.0.1 306 127.255.255.255 255.255.255.255 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 127.0.0.1 306 224.0.0.0 240.0.0.0 On-link 10.xxx.xxx.132 276 255.255.255.255 255.255.255.255 On-link 127.0.0.1 306 255.255.255.255 255.255.255.255 On-link 10.xxx.xxx.132 276 =========================================================================== Persistent Routes: Network Address Netmask Gateway Address Metric 10.zzz.zzz.0 255.255.255.0 10.xxx.xxx.147 1 =========================================================================== Both of these stations are running Windows 7. So essentially what I am trying to do here is route all traffic to the 10.zzz.zzz.0 subnet through the 10.xxx.xxx.147 gateway. Everything else should go through the 10.xxx.xxx.230 gateway. This is the intended behavior, and again it is working everywhere but that one station. I noticed that the Active Route metric costs differ between the two stations, but I am new to the routing table and I am not sure how that is impacting the behavior. I hope I have been able to explain the situation clearly. Any help would be much appreciated. I can provide any additional information if needed!

    Read the article

  • Retrieve contents of a public Dropbox folder?

    - by Sam
    Is there a way to retrieve a list of the contents of a public Dropbox folder (preferably in PHP)? This is what a URL to a public file in Dropbox looks like: http://dl.dropbox.com/u/1234567/publikPholder/textytext.txt One would think that jumping up one level to the directory in the URL... http://dl.dropbox.com/u/1234567/publikPholder/ ...would show all the public files. Nope. Nothing but a 404.

    Read the article

  • loading css or javascript from non-public directory

    - by twmulloy
    is there a way to load css and/or javascript files from outside of the public web directory? for example on my hosting service i have /public_html but don't want these files to exist in the public directory and want them in a directory outside of the public directory in a sibling directory /system (i am using codeigniter) within the /system/application/view/

    Read the article

  • Exporting non-public type through public API

    - by feelgood
    What if I have few factory methods returning non-public type and pairing set of methods which gives variables of this non-public type? This results with titled warning message in NetBeans. In result public API will contain only two pairing sets of methods. The reason is to make my type hierarchy sealed (like seald classes in Scala) and allow users only instantiate these types through factory methods. So we get DSL in some sense. For example, Schedule class represented by calendar fields' contraints. There are some types of contraints - Range, Singleton, List, FullSet - with NumberSet interface as a root. We don't want to expose these types and how Schedule interact with them. We just want the specification from the user. So we make NumberSet package-private. In class Schedule we create few factory-methods for constraints: NumberSet singleton(int value); NumberSet range(int form, int to); NumberSet list(NumberSet ... components); and some methods for creating Schedule object: Schedule everyHour(NumberSet minutes); Schedule everyDay(NumberSet minutes, NumberSet hours); User can only use them in the manner: Schedule s = Schedule.everyDay( singleton(0), list(range(10-15), singleton(8)) ); Is it bad idea?

    Read the article

  • C# "Enum" Serialization - Deserialization to Static Instance

    - by Walt W
    Suppose you have the following class: class Test : ISerializable { public static Test Instance1 = new Test { Value1 = "Hello" ,Value2 = 86 }; public static Test Instance2 = new Test { Value1 = "World" ,Value2 = 26 }; public String Value1 { get; private set; } public int Value2 { get; private set; } public void GetObjectData(SerializationInfo info, StreamingContext context) { //Serialize an indicator of which instance we are - Currently //I am using the FieldInfo for the static reference. } } I was wondering if it is possible / elegant to deserialize to the static instances of the class? Since the deserialization routines (I'm using BinaryFormatter, though I'd imagine others would be similar) look for a constructor with the same argument list as GetObjectData(), it seems like this can't be done directly . . Which I would presume means that the most elegant solution would be to actually use an enum, and then provide some sort of translation mechanism for turning an enum value into an instance reference. How might one go about this?

    Read the article

  • Implementing Static Libraries In iPhone

    - by socialCircus
    Hi All, I have created a static library following this link. But I am facing Problems in using the library. For reference on how to use static libraries in an iPhone project I followed this link . But I am stil struggling with the "How to implement static libraries in any other iPhone project?" question. Thank you all.

    Read the article

  • Why doesn't Visual Studio show an exception message when my exception occurs in a static constructor

    - by Tim Goodman
    I'm running this C# code in Visual Studio in debug mode: public class MyHandlerFactory : IHttpHandlerFactory { private static Dictionary<string, bool> myDictionary = new Dictionary<string, bool>(); static MyHandlerFactory() { myDictionary.Add("someKey",true); myDictionary.Add("someKey",true); // fails due to duplicate key } } Outside of the static constructor, when I get to the line with the error Visual Studio highlights it and pops up a message about the exception. But in the static constructor I get no such message. I am stepping through line-by-line, so I know that I'm getting to that line and no further. Why is this? (I have no idea if that fact that my class implements IHttpHandlerFactory matters, but I included it just in case.) This is VS2005, .Net 2.0

    Read the article

  • Why static fields are not initialized in time?

    - by Tom Brito
    Somebody tell me: class MyClass { private static MyClass myClass = new MyClass(); private static final Object obj = new Object(); public MyClass() { System.out.println(obj); // will print null once } } I wonder, isn't this a bug? Why static objects are not initialized before the constructor runs?

    Read the article

  • Best Static Website Generator

    - by Nick Retallack
    In the age of dynamic websites built with layouts and templates, nobody wants to write plain old repetitive static html anymore. But now that you can outsource dynamic features to services like Disqus, and you could get slashdotted/dugg/reddited at any moment, sometimes a static website is best for scalability. There are quite a few static website generators out there that let you use templates, layouts, alternative markup languages, and other new age stuff. So this question is a bit of a survey. Which do you think is the best, and why? Here are a few examples to start us off: WebGen StaticMatic Static

    Read the article

  • Static analysis tool customization for any language

    - by Sam
    Hi, We are using a Tool in our project. This tool has its own language which is similar to Java. I am looking for a static analysis tool which can be applied to the new language. Are there any static analysis tools which can be customized to any languages? or Is there any document or any reference on how to develop the static analysis tool for our own languages? Thanks.

    Read the article

  • Is it safe to lock a static variable in a non-static class?

    - by Dario Solera
    I've got a class that manages a shared resource. Now, since access to the resource depends on many parameters, this class is instantiated and disposed several times during the normal execution of the program. The shared resource does not support concurrency, so some kind of locking is needed. The first thing that came into my mind is having a static instance in the class, and acquire locks on it, like this: // This thing is static! static readonly object MyLock = new object(); // This thing is NOT static! MyResource _resource = ...; public DoSomeWork() { lock(MyLock) { _resource.Access(); } } Does that make sense, or would you use another approach?

    Read the article

  • Objective-C categories in static library

    - by Vladimir
    Can you guide me how to properly link static library to iphone project. I use staic library project added to app project as direct dependency (target - general - direct dependecies) and all works OK, but categories. A category defined in static library is not working in app. So my question is how to add static library with some categories into other project? And in general, what is best practice to use in app project code from other projects?

    Read the article

  • Why can't I inherit static classes?

    - by User
    I have several classes that do not really need any state. From the organizational point of view, I would like to put them into hierarchy. But it seems I can't declare inheritance for static classes. Something like that: public static class Base { } public static class Inherited : Base { } will not work. Why have the designers of the language closed that possibility?

    Read the article

  • Linking error while using Qt static built libraries

    - by Kamran Amini
    I hope this is not a duplicate. Recently I'm developing a native C++ application using Qt 4.8.3 and VS2008. Since clients run the application on their naked machines, they need to install VC++ 2008 Redistribution package. So I decided to make it statically linked. I changed my project settings (C/C++ Code Generation Runtime Library) to /MTd. Also I compiled Qt again, this time using following commands for a static building; originally found on this blog Static Qt with static CRT (VS 2008) 1- replaced -MD with -MT in lines QMAKE_CFLAGS_RELEASE and QMAKE_CFLAGS_DEBUG in %QDIR%\mkspecs\win32-msvc2008\qmake.conf 2- nmake confclean 3- configure -static -platform win32-msvc2008 -no-webkit 4- nmake sub-src I compiled Qt successfully. But when I tried again to compile my application, it gave me some strange errors. 1>Linking... 1>qtmaind.lib(qtmain_win.obj) : error LNK2005: "public: bool __thiscall QBasicAtomicInt::deref(void)" (?deref@QBasicAtomicInt@@QAE_NXZ) already defined in QtCored4.lib(QtCored4.dll) 1>qtmaind.lib(qtmain_win.obj) : error LNK2005: "public: bool __thiscall QBasicAtomicInt::operator!=(int)const " (??9QBasicAtomicInt@@QBE_NH@Z) already defined in QtCored4.lib(QtCored4.dll) 1>qtmaind.lib(qtmain_win.obj) : error LNK2005: "public: __thiscall QString::~QString(void)" (??1QString@@QAE@XZ) already defined in QtCored4.lib(QtCored4.dll) I changed some lib files but with each change, situation got worse; for example I tried to use QtCored.lib instead of QtCored4.lib because it is newly created after compilation. I think I've missed something in building static Qt libs. Thanks.

    Read the article

  • Obj-c categories in static library

    - by Vladimir
    Can you guide me how to properly link static library to iphone project. I use staic library project added to app project as direct dependency (target - general - direct dependecies) and all works OK, but categories. A category defined in static library is not working in app. So my question is how to add static library with some categories into other project? And in general, what is best practice to use in app project code from other projects?

    Read the article

< Previous Page | 7 8 9 10 11 12 13 14 15 16 17 18  | Next Page >