Search Results

Search found 6488 results on 260 pages for 'global thermonuclear war'.

Page 28/260 | < Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >

  • how to obtain the relative path of a resource in a j2ee project

    - by Neeraj
    I have a Dynamic Web Project having a flat file (or say text file). I have created a servlet in which I need to use this file. My code is as following: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // String resource = request.getParameter ("json") ; if ( resource != null && !resource.equals ( "" ) ) { //use getResourceAsStream ( ) to properly get the file. InputStream is = getServletContext ().getResourceAsStream ("rateJSON") ; if ( is != null ) { // the resource exists response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); StringWriter sw = new StringWriter ( ) ; for ( int c = is.read ( ) ; c != -1; c = is.read ( ) ) { sw.write ( c ) ; } PrintWriter out = response.getWriter(); out.print (sw.toString ()) ; out.flush(); } } } The problem is that the InputStream is has null value. I'm not sure how to get the correct relative path. I'm using JBOSS as the app server. I have added the resource file in the WebContent directory of a Dynamic Web Project. As a different approch, I tried this: protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // TODO Auto-generated method stub ServletConfig config = getServletConfig(); String contextName = config.getInitParameter("ApplicationName"); System.out.println("context name"+ contextName); String contextPath = config.getServletContext().getRealPath(contextName); System.out.println("context Path"+contextPath); //contextPath = contextPath.substring(0, contextPath.indexOf(contextName)); contextPath += "\\rateJSON.txt"; System.out.println(contextPath); String resource = request.getParameter ("json") ; System.out.println("Hi there1"+resource); if ( resource != null && !resource.equals ( "" ) ) { System.out.println("Hi there"); //use getResourceAsStream ( ) to properly get the file. //InputStream is = getServletContext ().getResourceAsStream (resource) ; InputStream is = getServletConfig().getServletContext().getResourceAsStream(contextPath); if ( is != null ) { // the resource exists System.out.println("Hi there2"); response.setContentType("application/json"); response.setHeader("Pragma", "No-cache"); response.setDateHeader("Expires", 0); response.setHeader("Cache-Control", "no-cache"); StringWriter sw = new StringWriter ( ); for ( int c = is.read ( ) ; c != -1; c = is.read ( ) ) { sw.write ( c ) ; System.out.println(c); } PrintWriter out = response.getWriter(); out.print (sw.toString ()) ; System.out.println(sw.toString()); out.flush(); } } } The value of contextPath is now: C:\JBOSS\jboss-5.0.1.GA\server\default\tmp\4p72206b-uo5r7k-g0vn9pof-1-g0vsh0o9-b7\Nationwide.war\WEB-INF\rateJSON But at this location the rateJSON file is not there? It seems JBOSS is not putting this file in the App.war or doesn't deploy it??? Could someone please help me?

    Read the article

  • What did programmers do before variable scope, where everything is global?

    - by hydroparadise
    So, I am having to deal with seemingly archiac language (called PowerOn) where I have a main method, a few datatypes to define variables with, and has the ability to have sub-procedures (essentially void methods) that does not return a type nor accepts any arguements. The problem here is that EVERYTHING is global. I've read of these type of languages, but most books take the aproach "Ok, we use to use a horse and cariage, but now, here's a car so let's learn how to work on THAT!" We will NEVER relive those days". I have to admit, the mind is struggling to think outside of scope and extent. Well here I am. I am trying to figure out how to best manage nothing but global variables across several open methods. Yep, even iterators for for loops have to be defined globaly, which I find myself recycling in different parts of my code. My Question: for those that have this type experience, how did programmers deal with a large amount of variables in a global playing field? I have feeling it just became a mental juggling trick, but I would be interested to know if there were any known aproaches.

    Read the article

  • Which application server should i choose for my project ?

    - by Dimitri
    Hi folks, I am currently developing an application for some researchers in my university.It's a small java program that you can use by command line. The next step is to package that program and deploy it to an application server. Some clients program will submit requests to the server who will call the tool that I wrote. Lately, we will add more tools to the server and he has to dispatch the requests to the right tool. Which application server fits my needs ? I have looked for Tomcat, Jetty and Glassfish but it seems that they are only used for web application. Is it possible to use those servers in some context different from web context? Which package archive should i use (jar, war) ? Any advice?

    Read the article

  • How to run Java Web Application from commandLine prompt or any where

    - by soso
    hello, I have created two (java web applcaion ). one acts as a Server , I created ( web service) into. the second acts as client , I created ( Web service client) into . I created them in netBeans, and they run . but now I want to run them out net beans , how I can do this? I want any way to run out netBeans such as command prompt or an where. if you have idia about running (.war) file , please tell me. thanks in advance.

    Read the article

  • Sitecore Rich Text Html Editor Profile - set global default

    - by misteraidan
    OK I can't believe this can't be found anywhere so I'm asking the question. Is there a way to set the default Html Editor Profile in Sitecore so I don't have the override the Source field on each individual Rich Text field? e.g. I want to make this the default option for the Html editor: /sitecore/system/Settings/Html Editor Profiles/Rich Text Medium

    Read the article

  • Initializing a Global Struct in C

    - by Scott
    What is the best way to accomplish the following in C? #include <stdio.h> struct A { int x; }; struct A createA(int x) { struct A a; a.x = x; return a; } struct A a = createA(42); int main(int argc, char** argv) { printf("%d\n", a.x); return 0; } When I try to compile the above code, the compiler reports the following error: "initializer element is not constant" The bad line is this one: struct A a = createA(42); Can someone explain what is wrong? I'm not very experienced in C. Thanks!

    Read the article

  • ASP.NET MVC 2.0 JsonRequestBehavior Global Setting

    - by beckelmw
    ASP.NET MVC 2.0 will now, by default, throw an exception when an action attempts to return JSON in response to a GET request. I know this can be overridden on a method by method basis by using JsonRequestBehavior.AllowGet, but is it possible to set on a controller or higher basis (possibly the web.config)? Update: Per Levi's comment, this is what I ended up using- protected override JsonResult Json(object data, string contentType, System.Text.Encoding contentEncoding) { return Json(data, contentType, JsonRequestBehavior.AllowGet); }

    Read the article

  • jquery treeview global saving position

    - by kusanagi
    i use such treeview http://docs.jquery.com/Plugins/Treeview/treeview, it saves perfect opened nodes when i click to subnodes links, but if i click on link, that is not in treeview the treeview is closes. for example- in treeview i have product categories, when click on category it loads list of products, but if i click on product details (this link not in treeview) then treeview is close. any ideas?

    Read the article

  • Code analysis: Global project/assembly suppression

    - by klausbyskov
    I have several CA1704:IdentifiersShouldBeSpelledCorrectly warnings that I want to suppress. Basically they refer to the company name which is deemed to be spelled incorrectly. The company name is part of several namespaces in my project, and in order to suppress all the warnings I need to add a lot of suppressions to the GlobalSuppressions file. Is there any way to suppress all warning in a single line in order to aviod my GlobalSuppressions file to become overly cluttered?

    Read the article

  • dataannotation metadatatype register dll in global.aspx (linq to sql)

    - by mazhar
    I am trying to use dataannotation validation(I am not able to Fire the annotations as yet) in my mvc application. with reference to this article I want to confirm http://www.asp.net/mvc/tutorials/validation-with-the-data-annotation-validators-cs I am using vs 2008 professional edition . Do I really need to download Microsoft.web.mvc.dataannotation dll (The other dll is already present in the vs). to use(fire) datannotation on the page.? I am using partial views as well on the pages with dataviewmodel class(I will be using formviewmodel class for validation?)

    Read the article

  • BlackBerry - KeyListener with global scope

    - by Abs
    Hello all, I am new to BlackBerry App development. I want to be able to listen for keypress events whenever the BlackBerry (8900 in my case) is on and on all screens is this possible? If so, it would be great for someone to direct me in the right direction. I am already having a look at Interface KeyListener. import net.rim.device.api.system.*; Thanks all

    Read the article

  • Matlab: convert global coordinates to figure coordinates

    - by noam
    If I get coordinates via coords = get(0,'PointerLocation'); How can I convert them into points gotten via ginput? i.e, I would like to get the same values from coords = get(0,'PointerLocation'); coords=someConversion(coords); As I would have gotten by calling coords=ginput(1); And clicking inside the figure in the same spot as the mouse was in the previous bit of code.

    Read the article

  • javascript using 'this' in global object

    - by Marco Demaio
    What does 'this' keyword refer to when used in gloabl object? Let's say for instance we have: var SomeGlobalObject = { rendered: true, show: function() { /* I should use 'SomeGlobalObject.rendered' below, otherwise it won't work when called from event scope. But it works when called from timer scope!! How can this be? */ if(this.rendered) alert("hello"); } } Now if we call in an inline script in the HTML page: SomeGlobalObject.show(); window.setTimeout("Msg.show()", 1000); everything work ok. But if we do something like AppendEvent(window, 'load', Msg.show); we get an error because this.rendered is undefined when called from the event scope. Do you know why this happens? Could you explain then if there is another smarter way to do this without having to rewrite every time "SomeGlobalObject.someProperty" into the the SomeGlobalObject code? Thanks! AppendEvent is just a simple cross-browser function to append an event, code below, but it does not matter in order to answer the above questions. function AppendEvent(html_element, event_name, event_function) { if(html_element.attachEvent) //IE return html_element.attachEvent("on" + event_name, event_function); else if(html_element.addEventListener) //FF html_element.addEventListener(event_name, event_function, false); }

    Read the article

  • WPF Global Resources in App.xaml

    - by Ryan
    I have created a custom Treeview control and am trying to access the HierarchicalDataTemplate resource of this control from another window in the same project. I have placed <ResourceDictionary Source="/Controls/TreeView/Themes/Generic.xaml"/> into my App.xaml file. Everytime I run, I get an error saying that it can not find the resource key "scene" - the name of the HierarchicalDataTemplate from my custom control. How can I access this template? Thanks

    Read the article

  • Application hangs after changing language From “En-Us” to any global language in control panel

    - by user1764824
    I created a WinForms application using C#. When I try to change the culture info, my application gets hanged. Microsoft.Win32.SystemEvents.UserPreferenceChanged += new Microsoft.Win32.UserPreferenceChangedEventHandler(SystemEvents_UserPreferenceChanged); void SystemEvents_UserPreferenceChanged(object sender, Microsoft.Win32.UserPreferenceChangedEventArgs e) { if (!PreviousInstance()) { CultureInfo ObjCulture = new CultureInfo(CultureInfo.InvariantCulture.IetfLanguageTag, false); Thread.CurrentThread.CurrentCulture = ObjCulture; Application.CurrentCulture = ObjCulture; } } public void INIT() { CultureInfo objCultureInfo = null; try { objCultureInfo = new CultureInfo("en-US", false); objCultureInfo.NumberFormat.NumberDecimalSeparator = "."; objCultureInfo.NumberFormat.NegativeSign = "-"; objCultureInfo.NumberFormat.NumberNegativePattern = 1; //1 stands for -100. Application.CurrentCulture = objCultureInfo; } } After Changing Language ... My Application gets Hanged and i cant Debug anything When i Try to Evaluate things This Event Called only once.. But if try in a small application it comes every time when Language is changed... ... Nothing shown in Eventviewer either. How can I solve this problem? ..

    Read the article

  • Global Entity Framework Context in WPF Application

    - by OffApps Cory
    Good day, I am in the middle of development of a WPF application that is using Entity Framework (.NET 3.5). It accesses the entities in several places throughout. I am worried about consistency throughout the application in regard to the entities. Should I be instancing separate contexts in my different views, or should I (and is a a good way to do this) instance a single context that can be accessed globally? For instance, my entity model has three sections, Shipments (with child packages and further child contents), Companies/Contacts (with child addresses and telephones), and disk specs. The Shipments and EditShipment views access the DiskSpecs, and the OptionsView manages the DiskSpecs (Create, Edit, Delete). If I edit a DiskSpec, I have to have something in the ShipmentsView to retrieve the latest specs if I have separate contexts right? If it is safe to have one overall context from which the rest of the app retrieves it's objects, then I imagine that is the way to go. If so, where would that instance be put? I am using VB.NET, but I can translate from C# pretty good. Any help would be appreciated. I just don't want one of those applications where the user has to hit reload a dozen times in different parts of the app to get the new data. Update: OK so I have changed my app as follows: All contexts are created in Using Blocks to dispose of them after they are no longer needed. When loaded, all entities are detatched from context before it is disposed. A new property in the MainViewModel (ContextUpdated) raises an event that all of the other ViewModels subscribe to which runs that ViewModels RefreshEntities method. After implementing this, I started getting errors saying that an entity can only be referenced by one ChangeTracker at a time. Since I could not figure out which context was still referencing the entity (shouldn't be any context right?) I cast the object as IEntityWithChangeTracker, and set SetChangeTracker to nothing (Null). This has let to the current problem: When I Null the changeTracker on the Entity, and then attach it to a context, it loses it's changed state and does not get updated to the database. However if I do not null the change tracker, I can't attach. I have my own change tracking code, so that is not a problem. My new question is, how are you supposed to do this. A good example Entity query and entity save code snipped would go a long way, cause I am beating my head in trying to get what I once thought was a simple transaction to work. Any help would elevate you to near god-hood.

    Read the article

  • How to create a Global Rule that stores a document’s folder path in a custom metadata field

    - by Nicolas Montoya
    Normal 0 false false false EN-US X-NONE X-NONE MicrosoftInternetExplorer4 /* Style Definitions */ table.MsoNormalTable {mso-style-name:"Table Normal"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-qformat:yes; mso-style-parent:""; mso-padding-alt:0in 5.4pt 0in 5.4pt; mso-para-margin:0in; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:11.0pt; font-family:"Calibri","sans-serif"; mso-ascii-font-family:Calibri; mso-ascii-theme-font:minor-latin; mso-fareast-font-family:"Times New Roman"; mso-fareast-theme-font:minor-fareast; mso-hansi-font-family:Calibri; mso-hansi-theme-font:minor-latin; mso-bidi-font-family:"Times New Roman"; mso-bidi-theme-font:minor-bidi;} How to create a Global Rule that stores a document’s folder path in a custom metadata field Efficiency purists would argue that redundancy is not necessary. In real life, we are willing to pay a price for performance –i.e. to have information at our fingertips. We have run into customers opting to store a document folder path as a document metadata field. They have their reasons, half of the ECM community will agree with them, and the other half would raise an eye brow. In the end, they are getting creative to achieve their document management goals. The below steps outlines how to create a Global Rule that would store a document’s folder path in a custom metadata field: Create a Global Rule via Configuration Manager > Rules Tab > Add Then check “Is global rule with priority”. Then check “Use rule activation condition”. The go to “Edit” and check the actions for this Script Properties: Then click OK, and the following rule activation condition will appear: Then Goto to the Fields Tab and add a Rule Field: Select the target Custom Metadata Field and click Ok, then check the “Is derived field”, then “Edit”, then go to the Custom Tab in the Script Properties window and enter the below custom script: <$if #active.dCollectionPath$> <$dprDerivedValue=#active.dCollectionPath$> <$else$> <$dprDerivedValue=#active.xCollectionIDPath$> <$endif$> For more information on the dCollectionPath property, check Section 8.2 Folder Services from the Oracle® Fusion Middleware Services Reference Guide for Oracle Universal Content Management 11g Release 1 (11.1.1) http://docs.oracle.com/cd/E21043_01/doc.1111/e11011/c08_folders002.htm The above rule will keep the Custom Metadata Field updated with the Folder Path information when a document is checked in via the Content Server (CS) Web Interface or the Desktop Integration Suite (DIS).

    Read the article

  • Global Handler in IIS7 (Classic Mode) gives "Failed to Execute" error

    - by Akash Kava
    I have made a custom handler called MyIndexHandler and I want it to handle *.index requests, now as I want this handler to be executed by any website, I installed my handler with following two steps in IIS manager. Add MyIndexHandler.dll in GAC Add Managed Module for *.index, the drop down in IIS displays my index handler correctly so it means it did find it correctly from the GAC. I added Script map for aspnet_isapi.dll for *.index (this is required for classic mode) Now in any of my website if I try xyz.index, my handler does not get called and it returns "Failed to execute URL", now this only happens when IIS is unable to find the mapped handler, but I already have defined mapped handler at IIS level and when i try to add entry in web.config manually for this handler, it tells me you can not define multiple handler, it means that IIS finds my handler, mapping but for some reason it does not execute it.

    Read the article

  • Best practice for storing global data in PHP?

    - by user281434
    Hi I'm running a web application that allows a user to log in. The user can add/remove content to his/her 'library' which is displayed on a page called "library.php". Instead of querying the database for the contents of the users library everytime they load "library.php", I want to store it globally for PHP when the user logs in, so that the query is only run once. Is there a best practice for doing this? fx. storing their library in an array in a session? Thanks for your time

    Read the article

  • XSLT Global count of grouped items

    - by Chris
    Hi there, I have a set of items which i am grouping using the muenchian method using keys. This is working great however when i try to do things with the first x number of items it is doing it on the x number of items in each group rather than across the whole set of results. How would i get the individual position of each item accross the whole collection? <xsl:key name="pictures-by-productid" match="/dsQueryResponse/Rows/Row" use="@ProductId" /> <xsl:template match="/"> <div style="border:1px solid red; float:left;"> <xsl:apply-templates select="/" mode="sub"> </xsl:apply-templates> </div> </xsl:template> and the second template <xsl:template match="/" mode="sub"> <xsl:for-each select="/dsQueryResponse/Rows/Row[count(. | key('pictures-by-productid', @ProductId)[1]) = 1]"> <xsl:for-each select="key('pictures-by-productid', @ProductId)"> <xsl:sort select="@PictureType" /> <div style="float:left; margin:2px;"> <img src="{@ThumbNailUrl}" width="58" /> <br /> Download <xsl:number value="position()" format="1. " /> <xsl:value-of select="." /> </div> </xsl:for-each> </xsl:for-each> </xsl:template> Thanks Chris

    Read the article

  • GLOBAL loading inside each single button with Jquery in ajax calls of asp.net mvc

    - by Ricky
    I have the following scenario: I have a button\link with a image inside like this: <button type="submit" id="myButton" class="button"><img src="../../Content/images/check.png" id="defaultImage" /> SaveData!!!</button> We are OK here! Now what I need to do is: I want on the click that the image change for a loading element that is previously loaded in the page like this: <img id="loadingImage" src="../../Content/images/loader.gif" style="display: none;" alt="loading"/> And then when the load complete turn back the old button image, I ended with this code: function loader() { var $button = $('#myButton'); if (btnState == '1') { $button.find('img').hide(); $button.prepend($('#loadingImage')); $('#loadingImage').css({ 'display': 'inherit' }); btnState = '0'; } else { $button.find('img').hide(); $button.prepend($('#defaultImage')); $('#defaultImage').show(); btnState = '1'; } } This does the trick for ONE SINGLE button(since I pass its ID in the function) but, when I have for example a grid with a button on each line, I found inviable when managing a screen with many buttons do this for each of then. The main question is: How can I make this method general for all buttons/links on one specific class in the page? The goal is: Click a button, get the image and change it and stop(can be manual). I just don't wanna have to Hook ALL buttons.

    Read the article

  • Crystal Reports: global variable running total not displaying in header

    - by phill
    Using Crystal Reports I'm trying to display the running total of a database field in the header where all the labels are. I've attempted to do this by placing the running total (RTversion) into a formula field with the following: Shared stringvar CurrentVers; CurrentVers := {#CurrentVers}; and then in the page header section I have the following: Shared stringvar CurrentVers; EvaluateAFter({#currentVers}); CurrentVers; with {#CurrentVers} running the 1st largest number. Is this incorrect? Update: The goal is to display the latest version in the header near the labels to show what the current verseion is for comparison.

    Read the article

  • How to apply global filter on Entity Framework?

    - by Hernan
    I have a table in my model named Customers with a field IsActive. Whenever I run a query on Customers, only the active customers should be retrieved. I can include the filter in every query, but that doesn't look very. I would like to be able to override the Customers property at the Object Context lever, but I am not sure if this is possible. Any help would be very appreciated! Thanks

    Read the article

< Previous Page | 24 25 26 27 28 29 30 31 32 33 34 35  | Next Page >