Search Results

Search found 24293 results on 972 pages for 'static ip'.

Page 31/972 | < Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >

  • Can static and dynamically typed languages be seen as different tools for different types of jobs?

    - by Erik Reppen
    Yes, similar questions have been asked but always with the aim of finding out 'which one is better.' I'm asking because I came up as a dev primarily in JavaScript and don't really have any extensive experience writing in statically typed languages. In spite of this I definitely see value in learning C for handling demanding operations at lower levels of code (which I assume has a lot to do with static vs dynamic at the compiler level), but what I'm trying to wrap my head around is whether there are specific project contexts (maybe certain types of dynamic data-intensive operations?) involving things other than performance where it makes a lot more sense to go with Java or C# vs. something like Python.

    Read the article

  • Why are there two different kinds of linking, i.e. static and dynamic?

    - by davidk01
    I've been bitten for the n-th time now by a library mismatch between a build and deployment environment. The build environment had libruby.so.2.0 and the deployment environment had libruby.a. One ruby was built with RVM, the other was built with ruby-build. The reason I ran into a problem was because zookeeper was compiled in a build environment that had the shared library but the deployment environment only had the static library. In all the years I've been writing application code I have never once wished that the binaries I was using where linked against shared objects. What is the reason the dichotomy persists to this day on modern operating systems?

    Read the article

  • What is the impact of a CMS on page load time versus a static site?

    - by PleaseStand
    I am creating a 20-page site that will go on shared hosting. Each page will be about 20 KB (including HTML, CSS, and images common to all pages). To avoid manually adding navigation elements to each page, I am considering using a CMS. However, I am concerned that on a busy server, using a CMS would make the site load more slowly. In a shared hosting environment where PHP is run as a CGI binary, how much does a CMS (WordPress, Drupal, etc.) generally affect page load time, compared to both "plain HTML" static sites and those using PHP as merely a templating language?

    Read the article

  • Getting visitors country from their IP

    - by Ali Abdulkarim Salem
    i want to get visitors country via their IP.. right now I'm using this ( http://api.hostip.info/country.php?ip=...... ) here's my code <?php if (isset($_SERVER['HTTP_CLIENT_IP'])) { $real_ip_adress = $_SERVER['HTTP_CLIENT_IP']; } if (isset($_SERVER['HTTP_X_FORWARDED_FOR'])) { $real_ip_adress = $_SERVER['HTTP_X_FORWARDED_FOR']; } else { $real_ip_adress = $_SERVER['REMOTE_ADDR']; } $cip = $real_ip_adress; $iptolocation = 'http://api.hostip.info/country.php?ip=' . $cip; $creatorlocation = file_get_contents($iptolocation); ?> Well, it's working properly, but the thing is, this returns the country code like US or CA., and not the whole country name like United States or Canada So, is there any good alternative to hostip.info offers this? I know that I can just write some code that will eventually turn this two letters to whole country name, but I'm just too lazy to write a code that contains all countries... P.S: For some reason I don't want to use any ready made CSV file or any code that will grab this information for me, something like ip2country ready made code and CSV.

    Read the article

  • Using Fancybox with Google Static Maps

    - by Levi Hackwith
    Setup I have multiple links on a page with the class location_link Each Links rel attribute is equal to a city state combo (i.e.,Omaha, NE) Once the page is loaded, a JavaScript function loops through all of the location_link items and binds a click event to them using jQuery. This click event fires a call to the Fancybox constructor that is supposed to show a Google Map of the location that link is associated with The Problem: Whenever I click on one of the "location links", I get the following error message: The requested content cannot be loaded. Please try again later. Code I've Already Written: function setUpLocationLinks() { locationLinks = $("a.location_link"); locationLinks.click( function() { var me = $(this); console.log(me.attr("href")); $.fancybox( { "showCloseButton" : true, "hideOnContentClick" : true, "titlePosition" : "inside", "title" : me.attr("rel"), "type" : "image" } ) return false; } ); } Research I've Already Done: The Google Static Map API no longer requires an API Key. The following is from the Google Static Maps API Page Note: The Google Static Maps API no longer requires a Maps API key! (Google Maps API Premier customers should instead sign their URLs using a new cryptographic key which will be sent to you. See the Premier documentation for more information.) The The Image URL I'm using does resolve and pulls back the data I need When I put the above mentioned URL into a standard <img> tag, the map shows up just fine. I'd like to pull this off without having to create some sort of dummy <img> tag that I'm constantly switching the src attribute out of. Hopefully, you'll find this information helpful. Please let me know if you have any other questions.

    Read the article

  • Problem using delegates, static, and dependencyproperties

    - by red-X
    I'm trying to animate a private variable named radius, which works. However while its changing I'm trying to execute a function which is getting to be quite of a problem. the code i have is below, it wont run because it has the following error An object reference is required for the non-static field, method, or property 'AppPart.SetChildrenPosition()' specifically new SetChildrenPositionDelegate(SetChildrenPosition) this part in this sentance part.Dispatcher.BeginInvoke(new SetChildrenPositionDelegate(SetChildrenPosition), new Object()); thnx to anyone able to help me. class AppPart : Shape { public string name { get; set; } public List<AppPart> parts { get; set; } private double radius { get { return (double)GetValue(radiusProperty); } set { SetValue(radiusProperty, value); } } public static readonly DependencyProperty radiusProperty = DependencyProperty.Register( "radius", typeof(double), typeof(AppPart), new PropertyMetadata( new PropertyChangedCallback(radiusChangedCallback))); private delegate void SetChildrenPositionDelegate(); private void SetChildrenPosition() { //do something with radius } private static void radiusChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e) { AppPart part = d as AppPart; part.Dispatcher.BeginInvoke(new SetChildrenPositionDelegate(SetChildrenPosition), new Object()); } private void AnimateRadius(double start, double end) { DoubleAnimation ani = new DoubleAnimation(); ani.From = start; ani.To = end; ani.FillBehavior = FillBehavior.HoldEnd; ani.Duration = new Duration(new TimeSpan(0, 0, 0, 3, 0)); ani.Completed += delegate { Console.WriteLine("ani ended"); }; this.BeginAnimation(AppPart.radiusProperty, ani); } }

    Read the article

  • Static Data Structures on Embedded Devices (Android in particular)

    - by Mark
    I've started working on some Android applications and have a question regarding how people normally deal with situations where you have a static data set and have an application where that data is needed in memory as one of the standard java collections or as an array. In my current specific issue i have a spreadsheet with some pre-calculated data. It consists of ~100 rows and 3 columns. 1 Column is a string, 1 column is a float, 1 column is an integer. I need access to this data as an array in java. It seems like i could: 1) Encode in XML - This would be cpu intensive to decode in my experience. 2) build into SQLite database - seems like a lot of overhead for static access to data i only need array style access to in ram. 3) Build into binary blob and read in. (never done this in java, i miss void *) 4) Build a python script to take the CSV version of my data and spit out a java function that adds the values to my desired structure with hard coded values. 5) Store a string array via androids resource mechanism and compute the other 2 columns on application load. In my case the computation would require a lot of calls to Math.log, Math.pow and Math.floor which i'd rather not have to do for load time and battery usage reasons. I mostly work in low power embedded applications in C and as such #4 is what i'm used to doing in these situations. It just seems like it should be far easier to gain access to static data structures in java/android. Perhaps I'm just being too battery usage conscious and in my single case i imagine the answer is that it doesn't matter much, but if every application took that stance it could begin to matter. What approaches do people usually take in this situation? Anything I missed?

    Read the article

  • Configure IIS7 to server static content through ASP.NET Runtime

    - by Anton Gogolev
    I searched high an low and still cannot find a definite answer. How do I configure IIS 7.0 or a Web Application in IIS so that ASP.NET Runtime will handle all requests -- including ones to static files like *.js, *.gif, etc? What I'm trying to do is as follows. We have kind of SaaSy site, which we can "skin" for every customer. "Skinnig" means developing a custom master page and using a bunch of *.css and other images. Quite naturally, I'm using VirtualPathProvider, which operates like this: public override System.Web.Hosting.VirtualFile GetFile(string virtualPath) { if(PhysicalFileExists(virtualPath)) { var virtualFile = base.GetFile(virtualPath); return virtualFile; } if(VirtualFileExists(virtualPath)) { var brandedVirtualPath = GetBrandedVirtualPath(virtualPath); var absolutePath = HttpContext.Current.Server.MapPath(brandedVirtualPath); Trace.WriteLine(string.Format("Serving '{0}' from '{1}'", brandedVirtualPath, absolutePath), "BrandingAwareVirtualPathProvider"); var virtualFile = new VirtualFile(brandedVirtualPath, absolutePath); return virtualFile; } return null; } The basic idea is as follows: we have a branding folder inside our webapp, which in turn contains folders for each "brand", with "brand" being equal to host name. That is, requests to http://foo.example.com/ should use static files from branding/foo_example_com, whereas http://bar.example.com/ should use content from branding/bar_example_com. Now what I want IIS to do is to forward all requests to static files to StaticFileHandler, which would then use this whole "infrastructure" and serve correct files. However, try as I might, I cannot configure IIS to do this.

    Read the article

  • Creating and using a static lib in xcode (MacOSX)

    - by Alasdair Morrison
    I am trying to create a static library in xcode and link to that static library from another program. So as a test i have created a BSD static C library project and just added the following code: //Test.h int testFunction(); //Test.cpp #include "Test.h" int testFunction() { return 12; } This compiles fine and create a .a file (libTest.a). Now i want to use it in another program so I create a new xcode project (cocoa application) Have the following code: //main.cpp #include <iostream> #include "Testlib.h" int main (int argc, char * const argv[]) { // insert code here... std::cout << "Result:\n" <<testFunction(); return 0; } //Testlib.h extern int testFunction(); I right clicked on the project - add - existing framework - add other Selected the .a file and it added it into the project view. I always get this linker error: Build TestUselibrary of project TestUselibrary with configuration Debug Ld build/Debug/TestUselibrary normal x86_64 cd /Users/myname/location/TestUselibrary setenv MACOSX_DEPLOYMENT_TARGET 10.6 /Developer/usr/bin/g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/myname/location/TestUselibrary/build/Debug -L/Users/myname/location/TestUselibrary/../Test/build/Debug -F/Users/myname/location/TestUselibrary/build/Debug -filelist /Users/myname/location/TestUselibrary/build/TestUselibrary.build/Debug/TestUselibrary.build/Objects-normal/x86_64/TestUselibrary.LinkFileList -mmacosx-version-min=10.6 -lTest -o /Users/myname/location/TestUselibrary/build/Debug/TestUselibrary Undefined symbols: "testFunction()", referenced from: _main in main.o ld: symbol(s) not found collect2: ld returned 1 exit status I am new to macosx development and fairly new to c++. I am probably missing something fairly obvious, all my experience comes from creating dlls on the windows platform. I really appreciate any help.

    Read the article

  • Configuring NAT and static IP on Cisco 877W

    - by David M Williams
    Hi all, I'm having trouble setting up a static IP reservation on a network. What I want to do is assign IP 192.168.1.105 to MAC address 00:21:5d:2f:58:04 and then port forward 35394 to it. If it helps, output from show ver says Cisco IOS software, C870 software (C870-ADVSECURITYK9-M), version 12.4(4)T7, release software (fc1) ROM: System bootstrap, version 12.3(8r)YI4, release software I have done this - service dhcp ip routing ip dhcp excluded-address 192.168.1.1 192.168.1.99 ip dhcp excluded-address 192.168.1.200 192.168.1.255 ip dhcp pool ClientDHCP network 192.168.1.0 255.255.255.0 default-router 192.168.1.1 dns-server 192.168.1.1 lease 7 ip dhcp pool NEO host 192.168.1.105 255.255.255.0 hardware-address 0021.5D2F.5804 ip nat inside source static tcp 192.168.1.105 35394 <PUBLIC_IP> 35394 extendable However, the machine is getting assigned IP address 192.168.1.101 not .105 ... any suggestions? Thanks !

    Read the article

  • Static variable for communication among like-typed objects

    - by Dan Ray
    I have a method that asynchronously downloads images. If the images are related to an array of objects (a common use-case in the app I'm building), I want to cache them. The idea is, I pass in an index number (based on the indexPath.row of the table I'm making by way through), and I stash the image in a static NSMutableArray, keyed on the row of the table I'm dealing with. Thusly: @implementation ImageDownloader ... @synthesize cacheIndex; static NSMutableArray *imageCache; -(void)startDownloadWithImageView:(UIImageView *)imageView andImageURL:(NSURL *)url withCacheIndex:(NSInteger)index { self.theImageView = imageView; self.cacheIndex = index; NSLog(@"Called to download %@ for imageview %@", url, self.theImageView); if ([imageCache objectAtIndex:index]) { NSLog(@"We have this image cached--using that instead"); self.theImageView.image = [imageCache objectAtIndex:index]; return; } self.activeDownload = [NSMutableData data]; NSURLConnection *conn = [[NSURLConnection alloc] initWithRequest:[NSURLRequest requestWithURL:url] delegate:self]; self.imageConnection = conn; [conn release]; } //build up the incoming data in self.activeDownload with calls to didReceiveData... - (void)connectionDidFinishLoading:(NSURLConnection *)connection { NSLog(@"Finished downloading."); UIImage *image = [[UIImage alloc] initWithData:self.activeDownload]; self.theImageView.image = image; NSLog(@"Caching %@ for %d", self.theImageView.image, self.cacheIndex); [imageCache insertObject:image atIndex:self.cacheIndex]; NSLog(@"Cache now has %d items", [imageCache count]); [image release]; } My index is getting through okay, I can see that by my NSLog output. But even after my insertObject: atIndex: call, [imageCache count] never leaves zero. This is my first foray into static variables, so I presume I'm doing something wrong. (The above code is heavily pruned to show only the main thing of what's going on, so bear that in mind as you look at it.)

    Read the article

  • PHP: Get instance of static class by string value

    - by Tirithen
    I'm working on a php web api that was handed to me with a lot of code that needs to be refactored. The ones that wrote the code wanted to include a static configuration class to an api resource and then get an instance of that class something like this: <?php $obj = "User"; $confObjectSuffix = "_conf"; $confObject = $obj.$confObjectSuffix; if ($confObject::inst()->checkMethod($method)) { ..... This gives the error "Parse error: syntax error, unexpected T_PAAMAYIM_NEKUDOTAYIM in ....." since $confObject is a string and not a object. I wrote some testcode: <?php $class = "User_conf"; echo "<pre>"; print_r($$class::Inst()); echo "</pre>"; class User_conf { private static $INSTANCE = null; public static function Inst() { if(User_conf::$INSTANCE === null) { User_conf::$INSTANCE = new User_conf(); } return User_conf::$INSTANCE; } } But can't get it to work with $$ either, is there some other way around this? I don't want to rewrite more than necessary.

    Read the article

  • Creating and using a static lib in xcode

    - by Alasdair Morrison
    I am trying to create a static library in xcode and link to that static library from another program. So as a test i have created a BSD static C library project and just added the following code: //Test.h int testFunction(); //Test.cpp #include "Test.h" int testFunction() { return 12; } This compiles fine and create a .a file (libTest.a). Now i want to use it in another program so I create a new xcode project (cocoa application) Have the following code: //main.cpp #include <iostream> #include "Testlib.h" int main (int argc, char * const argv[]) { // insert code here... std::cout << "Result:\n" <<testFunction(); return 0; } //Testlib.h extern int testFunction(); I right clicked on the project - add - existing framework - add other Selected the .a file and it added it into the project view. I always get this linker error: Build TestUselibrary of project TestUselibrary with configuration Debug Ld build/Debug/TestUselibrary normal x86_64 cd /Users/myname/location/TestUselibrary setenv MACOSX_DEPLOYMENT_TARGET 10.6 /Developer/usr/bin/g++-4.2 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -L/Users/myname/location/TestUselibrary/build/Debug -L/Users/myname/location/TestUselibrary/../Test/build/Debug -F/Users/myname/location/TestUselibrary/build/Debug -filelist /Users/myname/location/TestUselibrary/build/TestUselibrary.build/Debug/TestUselibrary.build/Objects-normal/x86_64/TestUselibrary.LinkFileList -mmacosx-version-min=10.6 -lTest -o /Users/myname/location/TestUselibrary/build/Debug/TestUselibrary Undefined symbols: "testFunction()", referenced from: _main in main.o ld: symbol(s) not found collect2: ld returned 1 exit status I am new to macosx development and fairly new to c++. I am probably missing something fairly obvious, all my experience comes from creating dlls on the windows platform. I really appreciate any help.

    Read the article

  • [Qt] How to get rid of OCI.dll dependency when compiling static

    - by STL
    Hi, My application accesses an Oracle database through Qt's QSqlDatabase class. I'm compiling Qt as static for the release build, but I can't seem to be able to get rid of OCI.dll dependency. I'm trying to link against oci.lib (as available in Oracle's Instant Client with SDK). Here's my configure line : configure -qt-libjpeg -qt-zlib -qt-libpng -nomake examples -nomake demos -no-exceptions -no-stl -no-rtti -no-qt3support -no-scripttools -no-openssl -no-opengl -no-phonon -no-style-motif -no-style-cde -no-style-cleanlooks -no-style-plastique -static -release -opensource -plugin-sql-oci -plugin-sql-sqlite -platform win32-msvc2005 I link against oci.h and oci.lib in the SDK's folder by using : set INCLUDE=C:\oracle\instantclient\sdk\include;%INCLUDE% set LIB=C:\oracle\instantclient\sdk\lib\msvc;%LIB% Then, once Qt is compiled, I use the following lines in my *.pro file : QT += sql CONFIG += static LIBS += C:\oracle\instantclient\sdk\lib\msvc\oci.lib QTPLUGIN += qsqloci Then, in my main.cpp, I add the following commands to statically compile OCI plugin in the application : #include <QtPlugin> Q_IMPORT_PLUGIN(qsqloci) After compiling the project, I test it on my workstation and it works (as I have Oracle Instant Client installed). When I try on another workstation, I always get the message: This application has failed to start because OCI.dll was not found. Re-installing this application may fix this problem. I don't understand why I still need OCI.dll, as my statically linked application is supposed to link to oci.lib instead. Is there any Qt people here that might have a solution for me ? Thanks a lot ! STL

    Read the article

  • Static library not included in resulting LLVM executable

    - by Matthew Glubb
    Hi, I am trying to compile a c program using LLVM and I am having trouble getting some static libraries included. I have successfully compiled those static libraries using LLVM and, for example, libogg.a is present, as is ogg.l.bc. However, when I try to build the final program, it does not include the static ogg library. I've tried various compiler options with the most notable being: gcc oggvorbis.c -O3 -Wall -I$OV_DIR/include -l$OV_DIR/lib/libogg.a -l$OV_DIR/lib/libvorbis.a -o test.exe This results in the following output (directories shortened for brevity): $OV_DIR/include/vorbis/vorbisfile.h:75: warning: ‘OV_CALLBACKS_DEFAULT’ defined but not used $OV_DIR/include/vorbis/vorbisfile.h:82: warning: ‘OV_CALLBACKS_NOCLOSE’ defined but not used $OV_DIR/include/vorbis/vorbisfile.h:89: warning: ‘OV_CALLBACKS_STREAMONLY’ defined but not used $OV_DIR/include/vorbis/vorbisfile.h:96: warning: ‘OV_CALLBACKS_STREAMONLY_NOCLOSE’ defined but not used llvm-ld: warning: Cannot find library '$OV_DIR/lib/ogg.l.bc' llvm-ld: warning: Cannot find library '$OV_DIR/lib/vorbis.l.bc' WARNING: While resolving call to function 'main' arguments were dropped! I find this perplexing because $OV_DIR/lib/ogg.l.bc DOES exit, as does vorbis.l.bc and they are both readable (as are their containing directories) by everyone. Does anyone have any idea with what I am doing wrong? Thanks, Matt

    Read the article

  • Questions about serving static files from a servlet

    - by Geo
    I'm very new to servlets. I'd like to serve some static files, some css and some javascript. Here's what I got so far: in web.xml: <servlet> <description></description> <display-name>StaticServlet</display-name> <servlet-name>StaticServlet</servlet-name> <servlet-class>StaticServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>StaticServlet</servlet-name> <url-pattern>/static/*</url-pattern> </servlet-mapping> I'm assuming in the StaticServlet I'd have to work with request.getPathInfo to see what was requested, get a mime type, read the file & write it to the client. If this is not the way to go, or is not a viable way of doing things, please suggest a better way. I'm not really sure where to place the static directory, because if I try to print new File(".") it gives me the directory of my Eclipse installation. Is there a way to find out the project's directory?

    Read the article

  • noncopyable static const member class in template class

    - by Dukales
    I have a non-copyable (inherited from boost::noncopyable) class that I use as a custom namespace. Also, I have another class, that uses previous one, as shown here: #include <boost/utility.hpp> #include <cmath> template< typename F > struct custom_namespace : boost::noncopyable { F sqrt_of_half(F const & x) const { using std::sqrt; return sqrt(x / F(2.0L)); } // ... maybe others are not so dummy const/constexpr methods }; template< typename F > class custom_namespace_user { static ::custom_namespace< F > const custom_namespace_; public : F poisson() const { return custom_namespace_.sqrt_of_half(M_PI); } static F square_diagonal(F const & a) { return a * custom_namespace_.sqrt_of_half(1.0L); } }; template< typename F > ::custom_namespace< F > const custom_namespace_user< F >::custom_namespace_(); this code leads to the next error (even without instantiation): error: no 'const custom_namespace custom_namespace_user::custom_namespace_()' member function declared in class 'custom_namespace_user' The next way is not legitimate: template< typename F ::custom_namespace< F const custom_namespace_user< F ::custom_namespace_ = ::custom_namespace< F (); What should I do to declare this two classes (first as noncopyable static const member class of second)? Is this feaseble?

    Read the article

  • Initialize Static Array of Structs in C

    - by russell_h
    I implementing a card game in C. There are lots of types of cards and each has a bunch of information, including some actions that will need to be individually scripted associated with it. Given a struct like this (and I'm not certain I have the syntax right for the function pointer) struct CARD { int value; int cost; // This is a pointer to a function that carries out actions unique // to this card int (*do_actions) (struct GAME_STATE *state, int choice1, int choice2); }; I would like to initialize a static array of these, one for each card. I'm guessing this would look something like this int do_card0(struct GAME_STATE *state, int choice1, int choice2) { // Operate on state here } int do_card1(struct GAME_STATE *state, int choice1, int choice2) { // Operate on state here } extern static struct cardDefinitions[] = { {0, 1, do_card0}, {1, 3, do_card1} }; Will this work, and am I going about this the right way at all? I'm trying to avoid huge numbers of switch statements. Do I need to define the 'do_cardN' functions ahead of time, or is there some way to define them inline in the initialization of the struct (something like a lambda function in python)? I'll need read-only access to cardDefinitions from a different file - is 'extern static' correct for that? I know this is a lot of questions rolled into one but I'm really a bit vague about how to go about this. Thanks.

    Read the article

  • C++: static assert for const variables?

    - by shoosh
    Static asserts are very convenient for checking things in compile time. A simple static assert idiom looks like this: template<bool> struct StaticAssert; template<> struct StaticAssert<true> {}; #define STATIC_ASSERT(condition) do { StaticAssert<condition>(); } while(0) This is good for stuff like STATIC_ASSERT(sizeof(float) == 4) and: #define THIS_LIMIT (1000) ... STATIC_ASSERT(THIS_LIMIT > OTHER_LIMIT); But using #define is not the "C++" way of defining constants. C++ would have you use an anonymous namespace: namespace { const int THIS_LIMIT = 1000; } or even: static const int THIS_LIMIT = 1000; The trouble with this is that with a const int you can't use STATIC_ASSERT() and you must resort to a run-time check which is silly. Is there a way to properly solve this in current C++? I think I've read C++0x has some facility to do this...

    Read the article

  • static variable lose its value

    - by user542719
    I have helper class with this static variable that is used for passing data between two classes. public class Helper{ public static String paramDriveMod;//this is the static variable in first calss } this variable is used in following second class mathod public void USB_HandleMessage(char []USB_RXBuffer){ int type=USB_RXBuffer[2]; MESSAGES ms=MESSAGES.values()[type]; switch(ms) { case READ_PARAMETER_VALUE: // read parameter values switch(prm){ case PARAMETER_DRIVE_MODE: // paramet drive mode Helper.paramDriveMod =(Integer.toString(((USB_RXBuffer[4]<< 8)&0xff00))); System.out.println(Helper.paramDriveMod+"drive mode is selectd ");//here it shows the value that I need. ..........}}//let say end switch and method and the following is an third class method use the above class method public void buttonSwitch(int value) throws InterruptedException{ boolean bool=true; int c=0; int delay=(int) Math.random(); while(bool){ int param=3; PARAMETERS prm=PARAMETERS.values()[param]; switch(value){ case 0: value=1; while(c<5){ Thread.sleep(delay); protocol.onSending(3,prm.PARAMETER_DRIVE_MODE.ordinal(),dataToRead,dataToRead.length);//read drive mode System.out.println(Helper.paramDriveMod+" drive mode is ..........in wile loop");//here it shows null value }}//let say end switch and method what is the reason that this variable lose its value?

    Read the article

  • How to Set up Virtual Static Subdomain

    - by Chip D
    Given current rewrite rules at http://www.example.com/: Options +FollowSymlinks +Includes RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} !^www\.example\.com [NC] RewriteCond %{HTTP_HOST} !^$ RewriteRule ^/?(.*) http://www.example.com/$1 [L,R,NE] # Remove all "index.html"s. RewriteCond %{THE_REQUEST} \ /(.+/)?index\.html(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.html$ /%1 [R=301,L] # Remove all "index.php"s. RewriteCond %{THE_REQUEST} \ /(.+/)?index\.php(\?.*)?\ [NC] RewriteRule ^(.+/)?index\.php$ /%1 [R=301,L] I'm attempting to serve some site assets (.png|.ico|.jpg|.gif|.css|.js) from a static subdomain like http://static.example.com which my Apache 1.3 shared host (GoDaddy) has mapped to a subdirectory for file management (http://www.example.com/static/). Currently these assets live in same-site subdirectories such as images/, js/, css/, etc. (1) Something...maybe the "+www" rewrite rule?...is not letting me access the subdomain. Is this likely caused by my rewrite rules above, or do I need to set up DNS changes with the host to enable access to the subdirectory, in addition to changing the rewrite rules? (2) Do I have to move those assets to that subdirectory and change all references sitewide? Would that perform the fastest? (3) Or can .htaccess make this much easier? (4) Should my first rewrite rule above include L,R=301,NE instead of [L,R,NE]?

    Read the article

  • static member specialization of templated child class and templated base class

    - by b3nj1
    I'm trying to have a templated class (here C) that inherits from another templated class (here A) and perform static member specialization (of int var here), but I cant get the right syntax to do so (if it's possible #include <iostream> template<typename derived> class A { public: static int var; }; //This one works fine class B :public A<B> { public: B() { std::cout << var << std::endl; } }; template<> int A<B>::var = 9; //This one doesn't works template<typename type> class C :public A<C<type> > { public: C() { std::cout << var << std::endl; } }; //template<> template<typename type> int A<C<type> >::a = 10; int main() { B b; C<int> c; return 0; } I put an example that works with a non templated class (here B) and i can get the static member specialization of var, but for C that just doesn't work. Here is what gcc tells me : test.cpp: In constructor ‘C<type>::C()’: test.cpp:29:26: error: ‘var’ was not declared in this scope test.cpp: At global scope: test.cpp:34:18: error: template definition of non-template ‘int A<C<type> >::a’ I'm using gcc version 4.6.3, thanks for any help

    Read the article

  • How to opendns with dynamic ip

    - by Joshua Robison
    OpenDNS is almost completely useless with a dynamic ip and most people have dynamic ip addresses. There isn't even a decent client for Linux to update your IP. There is a script you can install but it only seems to update on startup and all my child needs to do is unplug and replug the cable from the wall or router and a new ip is created totally killing the opendns service . I'm not even sure the Mac or windows ip update clients can protect from such a simple maneuver . How can I get my ip address to constantly update with opendns, is my question.

    Read the article

  • Help writing server script to ban IP's from a list

    - by Chev_603
    I have a VPS that I use as an openvpn and web server. For some reason, my apache log files are filled with thousands of these hack attempts: "POST /xmlrpc.php HTTP/1.0" 404 395 These attack attempts fill up 90% of my logs. I think it's a WordPress vulnerability they're looking for. Obviously they are not successful (I don't even have Wordpress on my server), but it's annoying and probably resource consuming as well. I am trying to write a bash script that will do the following: Search the apache logs and grab the offending IP's (even if they try it once), Sort them into a list with each unique IP on a seperate line, And then block them using the IP table rules. I am a bash newb, and so far my script does everything except Step 3. I can manually block the IP's, but that's tedious and besides, this is Linux and it's perfectly capable of doing it for me. I also want the script to be customizable so that I (or anyone else who wants to use it) can change the variables to suit whatever situation I/they may deal with in the future. Here is the script so far: #!/bin/bash ##IP LIST GENERATOR ##Author Chev Young ##Script to search Apache logs and list IP's based on custom filters ## ##Define our variables: DIRECT=~/Script ##Location of script&where to put results/temp files LOGFILE=/var/log/apache2/access.log ## Logfile to search for offenders TEMPLIST=xml_temp ## Temporary file name IP_LIST=ipstoban ## Name of results file FILTER1=xmlrpc ## What are we looking for? (Requests we want to ban) cd $DIRECT if [ ! -f $TEMPLIST ];then touch $TEMPLIST ##Create temp file fi cat $LOGFILE | grep $FILTER1 >> $DIRECT/$TEMPLIST ## Only interested in the IP's, so: sed -e 's/\([0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+\).*$/\1/' -e t -e d $DIRECT/$TEMPLIST | sort | uniq > $DIRECT/$IP_LIST rm $TEMPLIST ## Clean temp file echo "Done. Results located at $DIRECT/$IP_LIST" So I need help with the next part of the script, which should ban the IP's (incoming and perhaps outgoing too) from the resulting $IP_LIST file. I don't care if it utilizes UFW or IPTables directly, as long as it bans the IP's. I'd probably run it as a cron task. What I'm having trouble with is understanding how to use line of the result file as a seperate variable to do something like: ufw deny $IP1 $IP2 $IP3, ect Any ideas? Thanks.

    Read the article

  • How to configure traffic from a specific IP hardcoded to an IP to forward to another IP:PORT using i

    - by cclark
    Unfortunately we have a client who has hardcoded a device to point at a specific IP and port. We'd like to redirect traffic from their IP to our load balancer which will send the HTTP POSTs to a pool of servers able to handle that request. I would like existing traffic from all other IPs to be unaffected. I believe iptables is the best way to accomplish this and I think this command should work: /sbin/iptables -t nat -A PREROUTING -s $CUSTIP -j DNAT -p tcp --dport 8080 -d $CURR_SERVER_IP --to-destination $NEW_SERVER_IP:8080 Unfortunately it isn't working as expected. I'm not sure if I need to add another rule, potentially in the POSTROUTING chain? Below I've substituted the variables above with real IPs and tried to replicate the layout in my test environment in incremental steps. $CURR_SERVER_IP = 192.168.2.11 $NEW_SERVER_IP = 192.168.2.12 $CUST_IP = 192.168.0.50 Port forward on the same IP /sbin/iptables -t nat -A PREROUTING -p tcp -d 192.168.2.11 --dport 16000 -j DNAT --to-destination 192.168.2.11:8080 Works exactly as expected. IP and port forward to a different machine /sbin/iptables -t nat -A PREROUTING -p tcp -d 192.168.2.11 --dport 16000 -j DNAT --to-destination 192.168.2.12:8080 Connections seem to timeout. Restrict IP and port forward to only be applied to requests from a specific IP /sbin/iptables -t nat -A PREROUTING -p tcp -s 192.168.0.50 -d 192.168.2.11 --dport 16000 -j DNAT --to-destination 192.168.2.12:8080 Times out as well. Probably for the same reason as the previous entry. Does anyone have any insights or suggestions? thanks,

    Read the article

< Previous Page | 27 28 29 30 31 32 33 34 35 36 37 38  | Next Page >