Search Results

Search found 34060 results on 1363 pages for 'webpage access'.

Page 33/1363 | < Previous Page | 29 30 31 32 33 34 35 36 37 38 39 40  | Next Page >

  • .Net website create directory to remote server access denied

    - by tmfkmoney
    I have a web application that creates directories. The application works fine when creating a directory on the web server, however, it does not work when it tries to create a directory on our remote fileserver. The fileserver and the webserver are in the same domain. I have created a local user in our domain, "DOMAIN\aspnet". The local user is on both servers. I am running my .Net app pool under the domain user. I have also tried using windows impersonate in the web.config to run under the domain user. I have verified that the domain user has full control to the remote directory. In an effort to debug this I have also given the "everyone" full control to the remote directory. In an effort to debug this I have also added the domain user to the administrators group. I have a simple .net test page on the web server to test this. Through the test page I am able to read the directory on the file server and get a list of everything in it. I am not able to upload files or to create directories on the file server. Here's code that works: var path = @"\\fileserver\images\"; var di = new DirectoryInfo(path); foreach (var d in di.GetDirectories()) { Response.Write(d.Name); } Here's code that doesn't work: path = Path.Combine(path, "NewDirectory"); Directory.CreateDirectory(path); Here's the error I'm getting: Access to the path '\fileserver\images\NewDirectory' is denied. I'm pretty stuck on this. Any ideas?

    Read the article

  • Access is denied

    - by Lasse Gaardsholt
    Hi, I got this code for my sharepoint, but I get a Access is Denied, can anyone help me out here ? <!-- Load and display list - iframe version --> <!-- Questions and comments: [email protected] --> <DIV id="ListPlaceholder"><IMG src="/_layouts/images/GEARS_AN.GIF"></DIV> <!-- Paste the URL of the source list below: --> <iframe id="SourceList" style="display:none;" src="xXxXxX" onload="DisplayThisList()"></iframe> <script type="text/javascript"> function DisplayThisList() { var placeholder = document.getElementById("ListPlaceholder"); var displaylist = null; var sourcelist = document.getElementById("SourceList"); try { if(sourcelist.contentWindow) // Internet Explorer { displaylist = sourcelist.contentWindow.document.getElementById("WebPartWPQ1") ; } } catch(err) { alert(err.message); } displaylist.removeChild(displaylist.getElementsByTagName("table")[0]); placeholder.innerHTML = displaylist.innerHTML; } </script>

    Read the article

  • Access reading error when using class member variable

    - by bsg
    Hi, I have a class with private member variables declared in a header file. In my constructor, I pass in some filenames and create other objects using those names. This works fine. When I try to add another member variable, however, and initialize it in the constructor, I get an access reading violation. I sent the code to someone else and it works fine on his computer. Any idea what could be wrong? Here is the offending code: The .h file: class QUERYMANAGER { INDEXCACHE *cache; URLTABLE *table; SNIPPET *snip; int* iquery[MAX_QUERY_LENGTH]; int* metapointers[MAX_QUERY_LENGTH]; int blockpointers[MAX_QUERY_LENGTH]; int docpositions[MAX_QUERY_LENGTH]; int numberdocs[MAX_QUERY_LENGTH]; int frequencies[MAX_QUERY_LENGTH]; int docarrays[MAX_QUERY_LENGTH][256]; int qsize; public: QUERYMANAGER(); QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname); ~QUERYMANAGER(); This is the .cpp file: #include "querymanagernew.h" #include "snippet.h" using namespace std; QUERYMANAGER::QUERYMANAGER(char *indexfname, char *btfname, char *urltablefname, char *snippetfname, char *snippetbtfname){ cache = new INDEXCACHE(indexfname, btfname); table = new URLTABLE(urltablefname); snip = new SNIPPET(snippetfname, snippetbtfname); //this is where the error occurs qsize = 0; } I am totally at a loss as to what is causing this - any ideas? Thanks, bsg

    Read the article

  • Date Picker Control Not Displaying Proper Date (Access 2003)

    - by JPM
    Hi everyone, I just have a quick question. I am maintaining an app for my summer co-op position, and a new requirement came down today where the user requested to have a date control added to a form to mark the date of when an employee is "laid off". This control is enabled/disabled by a toggle button, and has its control source bound to a field that I added in the database. All the functionality has been added and tested, but.... The issue I am having is that the date picker is on a tab control (the 2nd page) and I am having problems trying to get the control to display the date that is stored in the field I created. I know the control is storing any changes made using it, but since the user asked to move the control over to the 2nd tab (it was on the first), it just shows today's date, not the date entered using the control. To make things a little more strange, if I place the control anywhere except the tab control, it seems to be working fine. I've even placed a textbox on the tab and set its control source to the database field, and it displays just fine. What gives? And I have registered the .ocx with Access, and as I mentioned before, the actual database is storing the data. Just not displaying it. Any ideas as to what I am doing wrong?

    Read the article

  • Access 2007 and Special/Unicode Characters in SQL

    - by blockcipher
    I have a small Access 2007 database that I need to be able to import data from an existing spreadsheet and put it into our new relational model. For the most part this seems to work pretty well. Part of the process is attempting to see if a record already exists in a target table using SQL. For example, if I extract book information out of the current row in the spreadsheet, it may contain a title and abstract. I use SQL to get the ID of a matching record, if it exists. This works fine except when I have data that's in a non-English language. In this case, it seems that there is some punctuation that is causing me problems. At least I think it's punctuation as I do have some fields that do not have punctuation and are non-English that do not give me any problems. Is there a built-in function that can escape these characters? Currently I have a small function that will escape the single quote character, but that isn't enough. Or, is there a list of Unicode characters that can interfere with how SQL wants data quoted? Thanks in advance.

    Read the article

  • CGContextDrawImage returning bad access

    - by Marcelo
    Hello guys, I've been trying to blend two UIImage for about 2 days now and I've been getting some BAD_ACCESS errors. First of all, I have two images that have the same orientation, basically I'm using the CoreGraphics to do the blending. One curious detail, everytime I modify the code, the first time I compile and run it on device, I get to do everything I want without any sort of trouble. Once I restart the application, I get error and the program shuts down. Can anyone give me a light? I tried accessing the baseImage sizes dynamically, but it gives me bad access too. Here's a snippet of how I'm doing the blending. UIGraphicsBeginImageContext(CGSizeMake(320, 480)); CGContextRef context = UIGraphicsGetCurrentContext(); CGContextTranslateCTM(context, 0, 480); CGContextScaleCTM(context, 1.0, -1.0); CGContextDrawImage(context, rect, [baseImage CGImage]); CGContextSetBlendMode(context, kCGBlendModeOverlay); CGContextDrawImage(context, rect, [tmpImage CGImage]); [transformationView setImage:UIGraphicsGetImageFromCurrentImageContext()]; UIGraphicsEndImageContext();

    Read the article

  • MSForms.ListBox Type Mismatch in Access

    - by Jason
    I have an Access database where I use a Tab control (without tabs) to simulate a wizard. One of the tab pages has an MSForms.ListBox control called lstPorts, and a button named cmdAdd which adds the contents of a textbox to the List Box. I then try to keep the contents of the ListBox sorted. However, the call to the Sort method causes a type mismatch. Here is the cmdAdd_Click() code behind: Private Sub cmdAdd_Click() Dim test As MSForms.ListBox lstPorts2.AddItem (txtPortName) Call SortListBox(lstPorts2) End Sub Here is the SortListBox Sub: Public Sub SortListBox(ByRef oLb As MSForms.ListBox) Dim vaItems As Variant Dim i As Long, j As Long Dim vTemp As Variant 'Put the items in a variant array vaItems = oLb.List For i = LBound(vaItems, 1) To UBound(vaItems, 1) - 1 For j = i + 1 To UBound(vaItems, 1) If vaItems(i, 0) > vaItems(j, 0) Then vTemp = vaItems(i, 0) vaItems(i, 0) = vaItems(j, 0) vaItems(j, 0) = vTemp End If Next j Next i 'Clear the listbox oLb.Clear 'Add the sorted array back to the listbox For i = LBound(vaItems, 1) To UBound(vaItems, 1) oLb.AddItem vaItems(i, 0) Next i End Sub Any help out there? Since the Sort routine explicitly references the MSForms.ListBox, most of the results from Google aren't applicable. Jason

    Read the article

  • Seperating and counting CSV entries from database (Access/ASp Classic)

    - by Katherine Perotta
    hey i could really use some help with this one. I have a faq with multiple "tags" and I would like to separate and count them. They are currently in the database as follows: ID-----------------TITLE--------------CONTENT-----------TAGS Sample Records: 1---------------sampletitle 1---------amplecontent--------tag1,tag2,tag3 2---------------sampletitle 2---------moresamplestuff-----tag3,tag4,tag5 How could I go about counting the number of times each tag is used? In the end, would it be easier to just create a separate table called TAGS, with a single tag corresponding to a single ID in FAQ? The only reason I don't prefer doing something like that is because I have so much data already it would take quite a while. However, if there's no alternative or if its easier than doing string parsing like that, im willing to do it. The goal is to display each unique tag and the number of times it is used. Would it be better to do the heavy lifting in the database or ASP? I have gotten as far as getting a list of all tags and displaying them in an array (with each tag separated). So at this point what I need to do is count each value and then remove the duplicates (while preserving the count number somewhere). This is in ASP classic using an Access database. Thanks!

    Read the article

  • VB.NET Update Access Database with DataTable

    - by sinDizzy
    I've been perusing some hep forums and some help books but cant seem to get my head wrapped around this. My task is to read data from two text files and then load that data into an existing MS Access 2007 database. So here is what i'm trying to do: Read data from first text file and for every line of data add data to a DataTable using CarID as my unique field. Read data from second text file and look for existing CarID in DataTable if exists update that row. If it doesnt exist add a new row. once im done push the contents of the DataTable to the database. What i have so far: Dim sSQL As String = "SELECT * FROM tblCars" Dim da As New OleDb.OleDbDataAdapter(sSQL, conn) Dim ds As New DataSet da.Fill(ds, "CarData") Dim cb As New OleDb.OleDbCommandBuilder(da) 'loop read a line of text and parse it out. gets dd, dc, and carId 'create a new empty row Dim dsNewRow As DataRow = ds.Tables("CarData").NewRow() 'update the new row with fresh data dsNewRow.Item("DriveDate") = dd dsNewRow.Item("DCode") = dc dsNewRow.Item("CarNum") = carID 'about 15 more fields 'add the filled row to the DataSet table ds.Tables("CarData").Rows.Add(dsNewRow) 'end loop 'update the database with the new rows da.Update(ds, "CarData") Questions: In constructing my table i use "SELECT * FROM tblCars" but what if that table has millions of records already. Is that not a waste of resources? Should i be trying something different if i want to update with new records? Once Im done with the first text file i then go to my next text file. Whats the best approach here: To First look for an existing record based on CarNum or to create a second table and then merge the two at the end? Finally when the DataTable is done being populated and im pushing it to the database i want to make sure that if records already exist with three primary fields (DriveDate, DCode, and CarNum) that they get updated with new fields and if it doesn't exist then those records get appended. Is that possible with my process? tia AGP

    Read the article

  • Return the Column Name for row with last non-null value "Ms Access 2007"

    - by bri1969
    I have a Table, which contains a list of league players. Each season, we record their Points per Dart. Their total PPD for that season is stored in other tables and extracted through other queries, which in turn are imported to the master table "Player History" at the end of the season for use as historical data. The current query retrieves each players PPD for each season they played, when they played last, and how many seasons played. The code for Last season Played has become too long and unstable to use. it was originally created, and split into two separate columns because a single SQL was to long. (LSP1) and LSP2) which work, but as I add seasons, Access does not like the length of code. In short, i need to find a more simple code that will look at each row, and look in that row for the last non null cell and report which column that last non null value is in. So if a player played seasons 30 & 31, but did not play 32..but did play 33, the Column with the code should be titled Last Season Played, and for that Player, it would state "33" in that cell, indicating that this player last played season "33" I will provide both tables and the query.. Please help

    Read the article

  • Some ASP.NET and Access

    - by Fazleh
    Good Day all, I have a big problem but i think its minor for you guys in Stackoverflow. I am creating a web application that has two main parts. The Payment part and Requisition part. It backbone is using access and the script is in ASP.NET. I managed to sort out most of the application. But I have been having a few problems. I have pasted the link to the project in http://www.mediafire.com/download/p09fefreifidud3/Inyatsi.rar so it will be easy for someone to see what I am blabbing about. Now for my problems: The AddRequisition.aspx/AddPayment.aspx: both have a reference number. I wanted it to be unique number(but not a primary key). I wanted it to be in the following format: DDMMYY(TransactionNo)(UserID) eg: 24061101PK. I have tried and tried but have not been able to sort it out. The AmountINWords gets the value from Amount. It converts the Amount into words. Thats not all. It picks what currncy was picked in the CurrencyPaidIn and pust the respective currency inside. eg. 123.45 USD becomes One Hundred and twenty three dollars and forty five cents. I tried using queries but as you will see that went all wrong. Those are the only two things that I cant seem to get my head around. I do know that there are some things that are not conventional ASP.NET and some text boxes are not the right size. I was thinking of sorting out those after I get those two fixed because they are simple to do. I really need some help with this application please. If someone can just have a look at the code and add a few things here and there. Thanks in advance. Faz

    Read the article

  • Need access to views on the OnSeekBarChangeListener (which is in an own class)

    - by sandkasten
    first of all I hope you understand my english because I'am not a native speaker. Okay, I'am new to android development and try following: For my app I need a SeekBar, so I create a Seekbar via XML and implement an OnSeekBarChangeListener. In the compay I work for its forbidden (because of the styleguid) to create something like this: seekbar.setOnSeekBarChangeListener(new OnSeekBarChangeListener() { @Override public void onProgressChanged(SeekBar arg0, int arg1, boolean arg2) { /// Do something } ... }); So I need to create a own class for the OnSeekBarChangeListener. So far no problem. public class SeekBarChangeListener extends SeekBar implements SeekBar.OnSeekBarChangeListener { public SeekBarChangeListener(Context context) { super(context); } public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { } public void onStartTrackingTouch(SeekBar seekBar) { } public void onStopTrackingTouch(SeekBar seekBar) { /// Do something. Following Code wont work CheckBox RemeberUsername = (CheckBox)findViewById(R.id.RemeberUsername); /// Always gets NULL } } I need a way to get access to some controls. Normaly the findViewById works fine but not in this case (what I can totaly understand, because how should the listender know about the views?). Some good hints? Or is there no oter way like the first code snippet to get the controls? Hope someone can help me out.

    Read the article

  • Saving large webpage as Image

    - by Nalaka526
    I'm trying to save webpage as an image. The web page I'm trying to save is bit long and has many images (http://www.boston.com/bigpicture/2012/10/hurricane_sandy_the_superstorm.html) I tried Google Chrome Screen Capture Extention and few other Chrome Screen Capture Plugins but all gave empty image as output. How to overcome this? Is there any other known Plugin (non Chrome is OK) to save large web page as an Image?

    Read the article

  • Google Chrome "This webpage is not available" error on Snow Leopard

    - by Oscar Del Ben
    Hi, I'm using Snow Leopard and I've just downloaded Google Chrome for Mac. However it doesn't load any page: This webpage is not available. Error 104 (net::ERR_CONNECTION_FAILED): The attempt to connect to the server failed. I've googled about it but I had no luck, only answers for Windows. Needless to say I have no firewalls and every other browser or application can connect to the internet.

    Read the article

  • allow client using webpage to run and use 1 server side executable

    - by richardboon
    In simplest term here’s what I must do: When user connects to a webpage (port 80) via their browser, the web server will run a customized-proprietary third party windows executable [located on the server]; then display and allow the user full control to that program (inside the browser). Note: I cannot rewrite/redistribute that 3rd party desktop gui program.

    Read the article

  • Is it possible to build a webpage in Fireworks

    - by Lee Carlton
    I've been building a simple webpage in Fireworks that is very similar to one that we have on our website currently. I just want to make sure that before I go to far I will actually be able to upload this page online through an FTP client. I'm worried because it saves it as a .png file and I don't have a ton of experience with web design.

    Read the article

  • How to serve a webpage on connection to WiFi network

    - by samwatt
    Hi, I would like to be able to serve a local webpage (on a LAN) when someone connects to a WiFi network. This happens quite often in libraries, cafes etc, so i'm sure it can be done, but I have no idea how and can't seem to find much through searching the web. That, and my very limited networking knowledge means I'm hoping you guys can point me in the right direction. Many thanks!

    Read the article

  • How to serve a webpage on connection to WiFi network

    - by samwatt
    Hi, I would like to be able to serve a local webpage (on a LAN) when someone connects to a WiFi network. This happens quite often in libraries, cafes etc, so i'm sure it can be done, but I have no idea how and can't seem to find much through searching the web. That, and my very limited networking knowledge means I'm hoping you guys can point me in the right direction. Many thanks!

    Read the article

  • Error: java.security.AccessControlException: Access denied

    - by RMD
    Hi, I have to connect to a https url with username and password to read a file. I am not able to connect to the server (see the error log below). I do not have much java experience so I need help with this code. I would really appreciate some help to solve this! Thank you. Raquel CODE: import lotus.domino.; import java.net.; import java.io.*; import javax.net.ssl.HttpsURLConnection; public class JavaAgent extends AgentBase { public void NotesMain() { try { String username = "123"; String password = "456"; String input = username + ":" + password; String encoding = new sun.misc.BASE64Encoder().encode (input.getBytes()); //Open the URL and read the text into a Buffer String urlName = "https://server.org/Export.mvc/GetMeetings?modifiedSince=4/9/2010"; URL url = new URL(urlName); HttpsURLConnection connection = (HttpsURLConnection)url.openConnection(); connection.setRequestMethod("POST"); connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded"); connection.setRequestProperty("Content-Length", String.valueOf (encoding.length())); connection.setUseCaches(false); connection.setDoInput(true); connection.setDoOutput(true); connection.setAllowUserInteraction(true); connection.setRequestProperty("Authorization", "Basic " + encoding); connection.setRequestProperty("Cookie", "LocationCode=Geneva"); connection.connect(); BufferedReader rd = null; try{ rd = new BufferedReader(new InputStreamReader(connection.getInputStream())); } catch (IOException e) { System.out.println("Read failed"); System.exit(-1); } String line; while((line = rd.readLine()) != null) { System.out.println(line.toString()); } rd.close(); connection.disconnect(); } catch(Exception e) { e.printStackTrace(); } } } LOG: java.security.AccessControlException: Access denied (java.lang.RuntimePermission exitVM.-1) at java.security.AccessController.checkPermission(AccessController.java:108) at java.lang.SecurityManager.checkPermission(SecurityManager.java:532) at COM.ibm.JEmpower.applet.AppletSecurity.superDotCheckPermission(AppletSecurity.java:1449) at COM.ibm.JEmpower.applet.AppletSecurity.checkRuntimePermission(AppletSecurity.java:1311) at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1611) at COM.ibm.JEmpower.applet.AppletSecurity.checkPermission(AppletSecurity.java:1464) at java.lang.SecurityManager.checkExit(SecurityManager.java:744) at java.lang.Runtime.exit(Runtime.java:99) at java.lang.System.exit(System.java:275) at JavaAgent.NotesMain(Unknown Source) at lotus.domino.AgentBase.runNotes(Unknown Source) at lotus.domino.NotesThread.run(Unknown Source)

    Read the article

  • Data access pattern

    - by andlju
    I need some advice on what kind of pattern(s) I should use for pushing/pulling data into my application. I'm writing a rule-engine that needs to hold quite a large amount of data in-memory in order to be efficient enough. I have some rather conflicting requirements; It is not acceptable for the engine to always have to wait for a full pre-load of all data before it is functional. Only fetching and caching data on-demand will lead to the engine taking too long before it is running quickly enough. An external event can trigger the need for specific parts of the data to be reloaded. Basically, I think I need a combination of pushing and pulling data into the application. A simplified version of my current "pattern" looks like this (in psuedo-C# written in notepad): // This interface is implemented by all classes that needs the data interface IDataSubscriber { void RegisterData(Entity data); } // This interface is implemented by the data access class interface IDataProvider { void EnsureLoaded(Key dataKey); void RegisterSubscriber(IDataSubscriber subscriber); } class MyClassThatNeedsData : IDataSubscriber { IDataProvider _provider; MyClassThatNeedsData(IDataProvider provider) { _provider = provider; _provider.RegisterSubscriber(this); } public void RegisterData(Entity data) { // Save data for later StoreDataInCache(data); } void UseData(Key key) { // Make sure that the data has been stored in cache _provider.EnsureLoaded(key); Entity data = GetDataFromCache(key); } } class MyDataProvider : IDataProvider { List<IDataSubscriber> _subscribers; // Make sure that the data for key has been loaded to all subscribers public void EnsureLoaded(Key key) { if (HasKeyBeenMarkedAsLoaded(key)) return; PublishDataToSubscribers(key); MarkKeyAsLoaded(key); } // Force all subscribers to get a new version of the data for key public void ForceReload(Key key) { PublishDataToSubscribers(key); MarkKeyAsLoaded(key); } void PublishDataToSubscribers(Key key) { Entity data = FetchDataFromStore(key); foreach(var subscriber in _subscribers) { subscriber.RegisterData(data); } } } // This class will be spun off on startup and should make sure that all data is // preloaded as quickly as possible class MyPreloadingThread { IDataProvider _provider; MyPreloadingThread(IDataProvider provider) { _provider = provider; } void RunInBackground() { IEnumerable<Key> allKeys = GetAllKeys(); foreach(var key in allKeys) { _provider.EnsureLoaded(key); } } } I have a feeling though that this is not necessarily the best way of doing this.. Just the fact that explaining it seems to take two pages feels like an indication.. Any ideas? Any patterns out there I should have a look at?

    Read the article

  • VS2008 C++ MFC Access Violation ONLY when stepping through debug mode

    - by HotOil
    Hi. This is crazy. It started happening in my main project, so I created a tiny sample brand-new project to reproduce it in and sure enough.. It does NOT happen in a sample project I created that is only a Win32 console app. I'm running this on Win7x64, if that matters. VS2008 SP1. Here goes. I create a small dialog app with a button. Put a breakpoint in the handler function for that button. The button handler function looks like this: void CTestProjectDlg::OnBnClickedButton1() { int i=2; m_csHello.Format(_T("Hello World!")); << breakpoint here UpdateData(FALSE); } Click the button, hit the breakpoint. F10 to step, and boom: "First-chance exception at 0x0398f77b in TestProject.exe: 0xC0000005: Access violation." It gives me the option to Break or Continue. If I Continue, it just hits it again, only not "First Chance". Yes I have that exception checked in the Debug-Exceptions dlg. If I Break, the call stack just shows me the line where the breakpoint is. If I F10 again.. I get the exception again, only now the callstack shows me in the _AfxDispatchCmdMsg() function, and my original OnBnClickedButton1() is not in the callstack anymore. It doesn't matter where I put the breakpoint. If, instead of F10, I just continue with F5, it works normally. Now.. if I build a Release version and run in debugging mode: I hit the breakpoint, and all the pointers, variable values look normal. F10, and these turn to garbage. The this pointer is now zero. The m_csHello is now However, in Release mode, an exception is not caught, and it all runs fine. The "hello World string gets displayed in the dialog box as it should. I have put in an inquiry to see if some patch was installed on my box by the IT dept in the last day or two. This wasn't happening 2 days ago. What do you think? Is VS2008 corrupted? Thanks.

    Read the article

  • access exception when invoking method of an anonymous class using java reflection

    - by Asaf David
    Hello I'm trying to use an event dispatcher to allow a model to notify subscribed listeners when it changes. the event dispatcher receives a handler class and a method name to call during dispatch. the presenter subscribes to the model changes and provide a Handler implementation to be called on changes. Here's the code (I'm sorry it's a bit long). EventDispacther: package utils; public class EventDispatcher<T> { List<T> listeners; private String methodName; public EventDispatcher(String methodName) { listeners = new ArrayList<T>(); this.methodName = methodName; } public void add(T listener) { listeners.add(listener); } public void dispatch() { for (T listener : listeners) { try { Method method = listener.getClass().getMethod(methodName); method.invoke(listener); } catch (Exception e) { System.out.println(e.getMessage()); } } } } Model: package model; public class Model { private EventDispatcher<ModelChangedHandler> dispatcher; public Model() { dispatcher = new EventDispatcher<ModelChangedHandler>("modelChanged"); } public void whenModelChange(ModelChangedHandler handler) { dispatcher.add(handler); } public void change() { dispatcher.dispatch(); } } ModelChangedHandler: package model; public interface ModelChangedHandler { void modelChanged(); } Presenter: package presenter; public class Presenter { private final Model model; public Presenter(Model model) { this.model = model; this.model.whenModelChange(new ModelChangedHandler() { @Override public void modelChanged() { System.out.println("model changed"); } }); } } Main: package main; public class Main { public static void main(String[] args) { Model model = new Model(); Presenter presenter = new Presenter(model); model.change(); } } Now, I except to get the "model changed" message. However, I'm getting an java.lang.IllegalAccessException: Class utils.EventDispatcher can not access a member of class presenter.Presenter$1 with modifiers "public". I understand that the class to blame is the anonymous class i created inside the presenter, however I don't know how to make it any more 'public' than it currently is. If i replace it with a named nested class it seem to work. It also works if the Presenter and the EventDispatcher are in the same package, but I can't allow that (several presenters in different packages should use the EventDispatcher) any ideas?

    Read the article

  • Data access pattern, combining push and pull?

    - by andlju
    I need some advice on what kind of pattern(s) I should use for pushing/pulling data into my application. I'm writing a rule-engine that needs to hold quite a large amount of data in-memory in order to be efficient enough. I have some rather conflicting requirements; It is not acceptable for the engine to always have to wait for a full pre-load of all data before it is functional. Only fetching and caching data on-demand will lead to the engine taking too long before it is running quickly enough. An external event can trigger the need for specific parts of the data to be reloaded. Basically, I think I need a combination of pushing and pulling data into the application. A simplified version of my current "pattern" looks like this (in psuedo-C# written in notepad): // This interface is implemented by all classes that needs the data interface IDataSubscriber { void RegisterData(Entity data); } // This interface is implemented by the data access class interface IDataProvider { void EnsureLoaded(Key dataKey); void RegisterSubscriber(IDataSubscriber subscriber); } class MyClassThatNeedsData : IDataSubscriber { IDataProvider _provider; MyClassThatNeedsData(IDataProvider provider) { _provider = provider; _provider.RegisterSubscriber(this); } public void RegisterData(Entity data) { // Save data for later StoreDataInCache(data); } void UseData(Key key) { // Make sure that the data has been stored in cache _provider.EnsureLoaded(key); Entity data = GetDataFromCache(key); } } class MyDataProvider : IDataProvider { List<IDataSubscriber> _subscribers; // Make sure that the data for key has been loaded to all subscribers public void EnsureLoaded(Key key) { if (HasKeyBeenMarkedAsLoaded(key)) return; PublishDataToSubscribers(key); MarkKeyAsLoaded(key); } // Force all subscribers to get a new version of the data for key public void ForceReload(Key key) { PublishDataToSubscribers(key); MarkKeyAsLoaded(key); } void PublishDataToSubscribers(Key key) { Entity data = FetchDataFromStore(key); foreach(var subscriber in _subscribers) { subscriber.RegisterData(data); } } } // This class will be spun off on startup and should make sure that all data is // preloaded as quickly as possible class MyPreloadingThread { IDataProvider _provider; MyPreloadingThread(IDataProvider provider) { _provider = provider; } void RunInBackground() { IEnumerable<Key> allKeys = GetAllKeys(); foreach(var key in allKeys) { _provider.EnsureLoaded(key); } } } I have a feeling though that this is not necessarily the best way of doing this.. Just the fact that explaining it seems to take two pages feels like an indication.. Any ideas? Any patterns out there I should have a look at?

    Read the article

  • Data Access Layer - static list objects and caching

    - by Truegilly
    Hello, i am devloping a site using .net MVC i have a data access layer which basically consists of static list objects that are created from data within my database. The method that rebuilds this data first clears all the list objects. Once they are empty it then add the data. Here is an example of one of the lists im using. its a method which generates all the UK postcodes. there are about 50 methods similar to this in my application that return all sorts of information, such as towns, regions, members, emails etc. public static List<PostCode> AllPostCodes = new List<PostCode>(); when the rebuild method is called it first clears the list. ListPostCodes.AllPostCodes.Clear(); next it re-bulilds the data, by calling the GetAllPostCodes() method /// <summary> /// static method that returns all the UK postcodes /// </summary> public static void GetAllPostCodes() { using (fab_dataContextDataContext db = new fab_dataContextDataContext()) { IQueryable AllPostcodeData = from data in db.PostCodeTables select data; IDbCommand cmd = db.GetCommand(AllPostcodeData); SqlDataAdapter adapter = new SqlDataAdapter(); adapter.SelectCommand = (SqlCommand)cmd; DataSet dataSet = new DataSet(); cmd.Connection.Open(); adapter.FillSchema(dataSet, SchemaType.Source); adapter.Fill(dataSet); cmd.Connection.Close(); // crete the objects foreach (DataRow row in dataSet.Tables[0].Rows) { PostCode postcode = new PostCode(); postcode.ID = Convert.ToInt32(row["PostcodeID"]); postcode.Outcode = row["OutCode"].ToString(); postcode.Latitude = Convert.ToDouble(row["Latitude"]); postcode.Longitude = Convert.ToDouble(row["Longitude"]); postcode.TownID = Convert.ToInt32(row["TownID"]); AllPostCodes.Add(postcode); postcode = null; } } } The rebuild occurs every 1 hour. this ensures that every 1 hour the site will have fresh set of cached data. the issue ive got is that occasionally if during a rebuild, the server will be hit by a request and an exception is thrown. The exception is "Index was outside the bounds of the array." it is due to when a list is being cleared. ListPostCodes.AllPostCodes.Clear(); - // throws exception - although its not always in regard to this list. Once this exception is thrown application dies, All users are affected. I have to restart the server to fix it. i have 2 questions... If i utilise caching instead of static objects would this help ? Is there any way i can say "while the rebuild is taking place, wait for it to complete until accepting requests" any help is most appricaiated ;) truegilly

    Read the article

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