Search Results

Search found 17958 results on 719 pages for 'local delivery'.

Page 61/719 | < Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >

  • Use of unassigned local variable 'dictionary'

    - by codemonkie
    I got the error Use of unassigned local variable 'dictionary' despite I assigned the value in the following code: private static void UpdateJadProperties(Uri jadUri, Uri jarUri, Uri notifierUri) { Dictionary<String, String> dictionary; try { String[] jadFileContent; // Create an instance of StreamReader to read from a file. // The using statement also closes the StreamReader. using (StreamReader sr = new StreamReader(jadUri.AbsolutePath.ToString())) { Char[] delimiters = { '\r', '\n' }; jadFileContent = sr.ReadToEnd().Split(delimiters, System.StringSplitOptions.RemoveEmptyEntries); } // @@NOTE: Keys contain ": " suffix, values don't! dictionary = jadFileContent.ToDictionary(x => x.Substring(0, x.IndexOf(':') + 2), x => x.Substring(x.IndexOf(':') + 2)); } catch (Exception e) { // Let the user know what went wrong. Console.WriteLine("The file could not be read:"); Console.WriteLine(e.Message); } try { if (dictionary.ContainsKey("MIDlet-Jar-URL: ")) { // Change the value by Remove follow by Add } } catch (ArgumentNullException ane) { throw; } } The error is from the line: if (dictionary.ContainsKey("MIDlet-Jar-URL: ")) Can any one help me out here, pls? TIA

    Read the article

  • Delphi access violation assigning local variable

    - by Justin
    This seems like the simplest thing in the world and I'm ready to pull my hair out over it. I have a unit that looks like this ; Unit myUnit; // ... //normal declarations //... Public //bunch of procedures including Procedure myProcedure; const //bunch of constants var //bunch of vars including myCounter:integer; Implementation Uses //(all my uses) // All of my procedures including Procedure myProcedure; try // load items from file to TListBox - this all works except on EReadError do begin // handle exception end; end; //try myCounter:=0; // <-- ACCESS VIOLATION HERE while myCounter //...etc It's a simple assignment of a variable and I have no idea why it is doing this. I've tried declaring the variable local to the unit, to the procedure, globally - no matter where I try to do it I can't assign a value of zero to an integer, declared anywhere, within this procedure without it throwing an access violation. I'm totally stumped. I'm calling the procedure from inside a button OnClick handler from within the same unit, but no matter where I call it from it throws the exception. The crazy thing is that I do the exact same thing in a dozen other places in units all over the program without problems. Why here? I'm at a total loss.

    Read the article

  • Child sProc cannot reference a Local temp table created in parent sProc

    - by John Galt
    On our production SQL2000 instance, we have a database with hundreds of stored procedures, many of which use a technique of creating a #TEMP table "early" on in the code and then various inner stored procedures get EXECUTEd by this parent sProc. In SQL2000, the inner or "child" sProc have no problem INSERTing into #TEMP or SELECTing data from #TEMP. In short, I assume they can all refer to this #TEMP because they use the same connection. In testing with SQL2008, I find 2 manifestations of different behavior. First, at design time, the new "intellisense" feature is complaining in Management Studio EDIT of the child sProc that #TEMP is an "invalid object name". But worse is that at execution time, the invoked parent sProc fails inside the nested child sProc. Someone suggested that the solution is to change to ##TEMP which is apparently a global temporary table which can be referenced from different connections. That seems too drastic a proposal both from the amount of work to chase down all the problem spots as well as possible/probable nasty effects when these sProcs are invoked from web applications (i.e. multiuser issues). Is this indeed a change in behavior in SQL2005 or SQL2008 regarding #TEMP (local temp tables)? We skipped 2005 but I'd like to learn more precisely why this is occuring before I go off and try to hack out the needed fixes. Thanks.

    Read the article

  • transfer database from local machine to hosting server

    - by c11ada
    hey all, im trying to transfer my database from local machine to server, im using the publish to provider wizard in visual web developer to generate a scrip, im then using the generated script on the serever database. i keep getting the following error can some one please tell where im going wrong Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 53 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 58 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 87 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_RemoveUsersFromRoles, Line 92 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 48 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 52 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 79 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 83 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 468, Level 16, State 9, Procedure aspnet_UsersInRoles_AddUsersToRoles, Line 93 Cannot resolve the collation conflict between "Latin1_General_CI_AS" and "SQL_Latin1_General_CP1_CI_AS" in the equal to operation. Msg 15151, Level 16, State 1, Line 1 Cannot find the object 'aspnet_UsersInRoles_AddUsersToRoles', because it does not exist or you do not have permission. Msg 15151, Level 16, State 1, Line 1 Cannot find the object 'aspnet_UsersInRoles_RemoveUsersFromRoles', because it does not exist or you do not have permission. thanks

    Read the article

  • Passing data between ViewControllers versus doing local Fetch in each VC

    - by Tofrizer
    Hi All, I'm developing an iPhone app using Core Data and I'm looking for some general advice and recommendations on whether its acceptable to pass data between ViewControllers versus doing a local fetch in each ViewController as you navigate to it. Ordinarily I would say it all depends on various factors (e.g. performance etc) but the passing data approach is so prevalent in my app and I'm spooked by all the stories about Apple rejecting apps because of not conforming to their standard guidelines. So let me put another way -- is it non-standard to pass data between VC's? The reason I pass data so much is because each ViewController is just another view on to data present in my object model / graph. Once I have a handle on my first object in the first view controller (which I of course do have to fetch), I can use the existing object composition / relationships to drill down into the next level of detail into data and so I just pass these objects to the next VC. Separately, one possible downside with this passing-data-to-each-VC approach is I don't benefit from (what I perceive to be) the optimisation/benefits that NSFetchedResultsController provides in terms of efficient memory usage and section handling. My app is read-only but I do have one table with 5000 rows and I'm curious if I am missing out on NSFetchedResultsController benefits. Any thoughts on this as well? Can I somehow still benefit from NSFetchedResultsController goodness without having to do a full fetch (as I would have already passed in the data from my previous VC)? Thanks a lot.

    Read the article

  • e4x statement conflicts with local variable?

    - by semen
    Hi, griends! Somewhere in code i have decalred variable: [Bindable] var nameWin:String = ""; after this i have an e4x statement podContent.xml_m = xml_m.item.(nameWin=="necessary name"); that should compare item's namewin with "necessary name" and return only items whose nameWin matches with "necessary name". xml_m.item: <item> <nameWin>necessary name</nameWin> <nameCol>??????-?????? ???????????</nameCol> <date>2009 ???</date> <summa>259267.7976</summa> </item> <item> <nameWin>unnecessary name</nameWin> <nameCol>??????-?????? ???????????</nameCol> <date>2010 ??????</date> <summa>104.3254</summa> </item> <item> <nameWin>necessary name</nameWin> <nameCol>??????-?????? ???????????</nameCol> <date>2010 ???</date> <summa>21.5174</summa> </item> if I use in statement xml-child distinct of nameWin (summa, e. g.), it works good. But with nameWin, e4x compares local variable nameWin (which not interested for me at all at this time) with "necessary name" instead of compare item's nameWin with "necessary name". Any ideas? Versions of libraries can be reason?

    Read the article

  • how to save sitecore webpage in html file on local disk or server

    - by Sam
    WebRequest mywebReq ; WebResponse mywebResp ; StreamReader sr ; string strHTML ; StreamWriter sw; mywebReq = WebRequest.Create("http://domain/sitecore/content/test/page10.aspx"); mywebResp = mywebReq.GetResponse(); sr = new StreamReader(mywebResp.GetResponseStream()); strHTML = sr.ReadToEnd(); sw = File.CreateText(Server.MapPath("hello.html")); sw.WriteLine(strHTML); sw.Close(); Hi , I want to save sitecore .aspx page into html file on local disk , but i am getting exception. But if i use any other webpage example(google.com) it works fine. The exception : System.Net.WebException was caught HResult=-2146233079 Message=The remote server returned an error: (404) Not Found. Source=System StackTrace: at System.Net.WebClient.DownloadFile(Uri address, String fileName) at System.Net.WebClient.DownloadFile(String address, String fileName) at BlueDiamond.addmodule.btnSubmit(Object sender, EventArgs e) in c:\inetpub\wwwroot\STGLocal\Website\addmodule.aspx.cs:line 97 InnerException: Any help. Thanks in advance

    Read the article

  • Updating a local sqlite db that is used for local metadata & caching from an service?

    - by Pharaun
    I've searched through the site and haven't found a question/answer that quite answer my question, the closest one I found was: Syncing objects between two disparate systems best approach. Anyway to begun, because there is no RSS feeds available, I'm screen scrapping a webpage, hence it does a fetch then it goes through the webpage to scrap out all of the information that I'm interested in and dumps that information into a sqlite database so that I can query the information at my leisure without doing repeat fetching from the website. However I'm also storing various metadata on the data itself that is stored in the sqlite db, such as: have I looked at the data, is the data new/old, bookmark to a chunk of data (Think of it as a collection of unrelated data, and the bookmark is just a pointer to where I am in processing/reading of the said data). So right now my current problem is trying to figure out how to update the local sqlite database with new data and/or changed data from the website in a manner that is effective and straightforward. Here's my current idea: Download the page itself Create a temporary table for the parsed data to go into Do a comparison between the official and the temporary table and copy updates and/or new information to the official table This process seems kind of complicated because I would have to figure out how to determine if the data in the temporary table is new, updated, or unchanged. So I am wondering if there isn't a better approach or if anyone has any suggestion on how to architecture/structure such system?

    Read the article

  • Newbie question: undefined local variable or method , why??

    - by Mellon
    I am new in Rails (I am using Rails 3.0.3), currently I am following the book "Agile Web Development with Rails" to develop a simple rails application. I followed the book to: --create a model 'Cart' class; --implement 'add_to_cart' method in my 'store_controller', I have a line of code <%=button_to "Add to Cart", :action => add_to_cart, :id => product %> in my /store/index.html.erb As you see, there is :action => add_to_cart in my index.html.erb, which will invoke the add_to_cart method in my *Controllers/store_controller.rb* But after I refresh the browser, I got the error "undefined local variable or method 'add_to_cart'", apparently I do have the method add_to_cart in my 'store_controller.rb', why I got this error??? What is the possible cause??? Here are my codes: store_controller.rb class StoreController < ApplicationController def index @products = Product.find_products_for_sale end def add_to_cart product = Product.find(params[:id]) @cart = find_cart @cart.add_product(product) end private def find_cart session[:cart] ||= Cart.new end end /store/index.html.erb <h1>Your Pragmatic Catalog</h1> <% @products.each do |product| -%> <div class="entry"> <%= image_tag(product.image_url) %> <h3><%=h product.title %></h3> <%= product.description %> <div class="price-line"> <span class="price"><%= number_to_currency(product.price) %></span> <!-- START_HIGHLIGHT --> <!-- START:add_to_cart --> **<%= button_to 'Add to Cart', :action => 'add_to_cart', :id => product %>** <!-- END:add_to_cart --> <!-- END_HIGHLIGHT --> </div> </div> <% end %> Model/cart.rb class Cart attr_reader :items def initialize @items = [] end def add_product(product) @items << product end end

    Read the article

  • List local printers

    - by vladimir
    hi all, i am using this routine to list the local printers installed on on a machine... var p: pointer; hpi: _PRINTER_INFO_2A; hGlobal: cardinal; dwNeeded, dwReturned: DWORD; bFlag: boolean; i: dword; begin p := nil; EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, 0, dwNeeded, dwReturned); if (dwNeeded = 0) then exit; GetMem(p,dwNeeded); if (p = nil) then exit; bFlag := EnumPrinters(PRINTER_ENUM_LOCAL, nil, 2, p, dwneeded, dwNeeded, dwReturned); if (not bFlag) then exit; CbLblPrinterPath.Properties.Items.Clear; for i := 0 to dwReturned - 1 do begin CbLblPrinterPath.Properties.Items.Add(TPrinterInfos(p^)[i].pPrinterName); end; FreeMem(p); TPrinterInfos(p^)[i].pPrinterName returns a 'P' for printer name. i have a PdfCreator installed as a printer. TPrinterInfos is an array of _PRINTER_INFO_2A. how can i fix this?

    Read the article

  • Finding Local IP via Socket Creation / getsockname

    - by BSchlinker
    I need to get the IP address of a system within C++. I followed the logic and advice of another comment on here and created a socket and then utilized getsockname to determine the IP address which the socket is bound to. However, this doesn't appear to work (code below). I'm receiving an invalid IP address (58.etc) when I should be receiving a 128.etc Any ideas? string Routes::systemIP(){ // basic setup int sockfd; char str[INET_ADDRSTRLEN]; sockaddr* sa; socklen_t* sl; struct addrinfo hints, *servinfo, *p; int rv; memset(&hints, 0, sizeof hints); hints.ai_family = AF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; if ((rv = getaddrinfo("4.2.2.1", "80", &hints, &servinfo)) != 0) { fprintf(stderr, "getaddrinfo: %s\n", gai_strerror(rv)); return "1"; } // loop through all the results and make a socket for(p = servinfo; p != NULL; p = p->ai_next) { if ((sockfd = socket(p->ai_family, p->ai_socktype, p->ai_protocol)) == -1) { perror("talker: socket"); continue; } break; } if (p == NULL) { fprintf(stderr, "talker: failed to bind socket\n"); return "2"; } // get information on the local IP from the socket we created getsockname(sockfd, sa, sl); // convert the sockaddr to a sockaddr_in via casting struct sockaddr_in *sa_ipv4 = (struct sockaddr_in *)sa; // get the IP from the sockaddr_in and print it inet_ntop(AF_INET, &(sa_ipv4->sin_addr.s_addr), str, INET_ADDRSTRLEN); printf("%s\n", str); // return the IP return str; }

    Read the article

  • Request-local storage in ASP.NET (accessible to the code from IHttpModule implementation)

    - by IgorK
    I need to have some object hanging around between two events I'm interested in: PreRequestHandlerExecute (where I create an instance of my object and want to save it) and PostRequestHandlerExecute (where I want to get to the object). After the second event the object is not needed for my purposes and should be discarded either by storage or my explicit action. So the ideal context where my object should be stored is per request (with guaranteed no sharing issues when different threads are serving requests... or processes/servers :) ) Take into account that actual implementation I can do is being made from a HttpModule and is supposed to be a pluggable solution for already written web apps (so the option to provide some state using static/instance variables in Global.asax doesn't look good - I will have to modify Global.asax on every web application). Cache seems to be too broad for this use. I tried to see whether httpContext.Application (of type HttpApplicationState) is good for me or not, but cannot get whether it is exactly per HttpApplication instance or not (AFAIK you can have several instances of HttpApplications used on different threads and therefore serving several requests simultaneously - then using storage shared between threads will not work correctly; otherwise I would use it because one HttpApplication instance serves exactly one request at a time). Something could be done with storing state on the HttpModule instances if I know for sure that it's exactly bound 1-to-1 with every HttpApplication instance running (but again I need a proof that HttpApplication instance is 1-to-1 with my HttpModule's instance). Any valuable and reputable links on these topics are much appreciated... Would be great to find something particularly well-suited for per request situation (because otherwise I may end up with something ulgy... probably either some 'broader' scoped storage and some hacks to have different keys in the storage for different requests, OR using a thread-local thing and in this way commit to the theory that IIS/ASP.NET will not ever serve first event from one thread and the second event from the other thread and so on)

    Read the article

  • A local error has occurred while connecting to AD in Windows 2008 server

    - by Sara
    There's Active directory on windows 2000 advance server, I have a web server on Windows 2008 server Enterprise Edition, the following code works fine in Winsows 2003 server but when I installed Win 2008 server, it gives me the following error, the webserver is not subdomain of the AD server. but they have the same range IP address. A local error has occurred.\r\n"} System.Exception system.DirectoryServices.DirectoryServicesCOMException} I want to Authenticate Via AD from my webserver, I even test the port 389 and it was open(by telnet), I even added port 389 UDP and TCP to firewall of webserver to be sure it is open, even I turned the firewall off but nothing changed. I don't know what's wrong with Windows 2008 server that cannot run my code, I search Internet but I found nothing. any solution would be helpful. Thank you public bool IsAuthenticated(string username, string pwd,string group) { string domainAndUsername = "LDAP://192.xx.xx.xx:389/DC=test,DC=oc,DC=com" ; string usr="CN=" + username + ",CN=" + group; DirectoryEntry entry = new DirectoryEntry(domainAndUsername, usr, pwd, AuthenticationTypes.Secure ); try { DirectorySearcher search = new DirectorySearcher(entry); search.Filter = "(SAMAccountName=" + username + ")"; SearchResult result = search.FindOne(); if (result == null) { return false; } } catch (Exception ex) { return false; } return true; }

    Read the article

  • Remotely connecting two non-local computers with sockets

    - by Velizar Hristov
    This question seems like something very obvious to ask, and yet I spent more than an hour trying to find an answer. First I host and wait for someone to connect. Then, from another instance of the application, I try to connect with a socket - for the constructor, I use InetAddress, port. The port is always right, and everything works if I use "localhost" for the address. However, if I type my IP, I get an IOException. I even sent the application to someone else, gave him my IP, and it didn't work. The aim of the application is to connect two computers. It's in Java. Here is the relevant code. Server: ServerSocket serverSocket = new ServerSocket(port); Socket clientSocket = serverSocket.accept(); Client: InetAddress a = InetAddress.getByName(ip); Socket s = new Socket(a, port); I don't get past that. Obviously, the values of int port and String ip are taken from text fields. Edit: the purpose of my application is to connect two non-local computers.

    Read the article

  • Use of unassigned local variable 'xxx'

    - by Tomislav
    I'm writing a database importer from our competitors to ours database:) I have a code generator which create Methods form import to our database like public void Test_Import_Customer_1() // variables string conn; string sqlSelect; string sqlInsert; int extID; string name; string name2; DateTime date_inserted; sqlSelect="select id,name,date_inserted from table_competitors_1"; oledbreader reader = new GetOledbRader(sqlString,conn); while (reader.read()) { name=left((string)myreader["name"],50); //limitation of my field date_inserted=myreader["date_inserted"]; sqlInsert=string.Format("insert into table(name,name2,date_inserted)values '{0}', '{1}', {2})",name,name2,date_inserted); //here is the problem name2 "Use of unassigned local variable" ExecuteSQL(sqlInsert) } As different companies database has different fields i can not set value to each variable and there is a big number of tables to go one variable to next. like sqlSelect_Company_1 = "select name,date_inserted from table_1"; sqlSelect_Company_2 = "select name,name2 from table_2"; is there a way to override the typing of each variable one by one with default values?

    Read the article

  • what is the correct way to force existing activities to reload using the new local

    - by pengwang
    have a settings dialog/activity where I allow the user to change the locale. Within that activity i call Resources res = ctx.getResources(); // Change locale settings on the device DisplayMetrics dm = res.getDisplayMetrics(); android.content.res.Configuration conf = res.getConfiguration(); conf.locale = new Locale(language_code.toLowerCase(), coutry_code.toUpperCase()); res.updateConfiguration(conf, dm); and call onChanged() for my settings ListView... everything changes perfectly. Very nice. Then I hit the back button to go back to the previous activity thinking everything should be switched; nope. Everything is still in the previous locale. So I added the above code in the onResume() of the activity thinking that would do it; nope. Also, when I click the menu button of this activity again (not first time) I do not get called in onCreateOptionsMenu() it just displays the previous menu. My question is what is the correct way to force existing activities to reload using the new local?

    Read the article

  • C++, Ifstream opens local file but not file on HTTP Server

    - by fammi
    Hi, I am using ifstream to open a file and then read from it. My program works fine when i give location of the local file on my system. for eg /root/Desktop/abc.xxx works fine But once the location is on the http server the file fails to open. for eg http://192.168.0.10/abc.xxx fails to open. Is there any alternate for ifstream when using a URL address? thanks. part of the code where having problem: bool readTillEof = (endIndex == -1) ? true : false; // Open the file in binary mode and seek to the end to determine file size ifstream file ( fileName.c_str ( ), ios::in|ios::ate|ios::binary ); if ( file.is_open ( ) ) { long size = (long) file.tellg ( ); long numBytesRead; if ( readTillEof ) { numBytesRead = size - startIndex; } else { numBytesRead = endIndex - startIndex + 1; } // Allocate a new buffer ptr to read in the file data BufferSptr buf (new Buffer ( numBytesRead ) ); mpStreamingClientEngine->SetResponseBuffer ( nextRequest, buf ); // Seek to the start index of the byte range // and read the data file.seekg ( startIndex, ios::beg ); file.read ( (char *)buf->GetData(), numBytesRead ); // Pass on the data to the SCE // and signal completion of request mpStreamingClientEngine->HandleDataReceived( nextRequest, numBytesRead); mpStreamingClientEngine->MarkRequestCompleted( nextRequest ); // Close the file file.close ( ); } else { // Report error to the Streaming Client Engine // as unable to open file AHS_ERROR ( ConnectionManager, " Error while opening file \"%s\"\n", fileName.c_str ( ) ); mpStreamingClientEngine->HandleRequestFailed( nextRequest, CONNECTION_FAILED ); } }

    Read the article

  • Passing HTML form data in the URL on local machine (file://)

    - by atzz
    Hi, I'm building a small HTML/JS application for primary use on local machine (i.e. everything is accessed via file:// protocol, though maybe in the future it will be hosted on a server within intranet). I'm trying to make a form with method="get" and action="target.html", in the hope that the browser will put form data in the URL (like, file://<path>/target.html?param1=aaa&param2=bbb). However, it's not happening (target.html opens fine, but no parameters is passed). What am I doing wrong? Is it possible to use forms over file:// at all? I can always build the url manually (via JS), but being lazy I'd prefer the browser do it for me. ;) Here is my sample form: <form name='config' action="test_form.html" method="get" enctype="application/x-www-form-urlencoded"> <input type="text" name="param1"> <input type="text" name="param2"> <input type="submit" value="Go"> </form>

    Read the article

  • Stopping a SoundPlayer loop at the local level

    - by EvanRyan
    I'm working on setting up an alarm that pops up as a dialog with multiple sound file options the user can choose from. The problem I'm having is creating a sound player at the local level that I can close with a button. The problem I'm having is that the sound keeps looping when I close the form because the SoundPlayer doesn't exist within the button click event. here's what I have: void callsound() { if (SoundToggle == 0) // if sound enabled { if ((SoundFile == 0) && (File.Exists(@"attention.wav"))) { System.Media.SoundPlayer alarm = new System.Media.SoundPlayer(@"attention.wav"); alarm.PlayLooping(); } if ((SoundFile == 1) && (File.Exists(@"aahh.wav"))) { System.Media.SoundPlayer alarm = new System.Media.SoundPlayer(@"aahh.wav"); alarm.PlayLooping(); } } private void button1_Click(object sender, EventArgs e) { //alarm.Stop(); Only works if SoundPlayer declared at class level this.Close(); } Is there a way I can do what I want to do by declaring the SoundPlayer instances where I am? Or is there a way to declare it at the class level, and still be able to change the sound file based on user settings?

    Read the article

  • Receiving 404 error when trying to get to MVC application in local IIS

    - by Corey Sunwold
    I have an existing web site setup on my local IIS built with web forms setup in this format: -MainSite -Application1 -Application2 -Application3 There are separate applications in each location, so MainSite has an application, and Application1 has another application and so on. This way development on different applications in the same site can be broken out. I want to add a new Application that is MVC instead of web forms. I created a new MVC project which runs in Cassini just fine, but when I create a new IIS application for it and point it to the MVC project I am unable to navigate to it in the browser and get a 404 error. I am expecting to be able to navigate to http://MainSite/NewMVCApplication/. I want the root of NewMVCApplication to point to my Contacts Controller. My global.asax in the new MVC application currently looks like this: public class MvcApplication : System.Web.HttpApplication { public static void RegisterRoutes(RouteCollection routes) { routes.IgnoreRoute("{resource}.axd/{*pathInfo}"); routes.MapRoute( "Root", // Route name "", // URL with parameters new { controller = "Contacts", action = "Index", id = "" } // Parameter defaults ); } protected void Application_Start() { RegisterRoutes(RouteTable.Routes); RouteDebug.RouteDebugger.RewriteRoutesForTesting(RouteTable.Routes); } }

    Read the article

  • Get current node's local-name in XSL

    - by green67
    Here's the structure of my XML <FileRoot> <UserSet1> <User> <FirstName></FirstName> <LastName></LastName> </User> <User> <FirstName></FirstName> <LastName></LastName> </User> ... </UserSet1> <InactiveUsers> <User> <FirstName></FirstName> <LastName></LastName> </User> <User> <FirstName></FirstName> <LastName></LastName> </User> ... </InactiveUsers> </FileRoot> In my XSL template <xsl:template match="/*/*"> <File> <xsl attribute name="Name"> <xsl:value-of select="local-name(/*/*)"/> </xsl:attribute> </File> </xsl> After transforming, for both UserSet1 and InactiveUsers, gave me "UserSet1". The expected results should be "UserSet1" for UserSet1, and "InactiveUsers" for InactiveUsers. How do I correctly retrieve the value? Thanks

    Read the article

  • Downloading Large JSON File to local file using Java

    - by user1279675
    I'm attempting to download a JSON from the following URL - http://api.crunchbase.com/v/1/companies.js - to a local file. I'm using Java 1.7 and the following JSON Libraries - http://www.json.org/java/ - to attempt to make it work. Here's my code: public static void download(String address, String localFileName) { OutputStream out = null; URLConnection conn = null; InputStream in = null; try { URL url = new URL(address); out = new BufferedOutputStream( new FileOutputStream(localFileName)); conn = url.openConnection(); in = conn.getInputStream(); byte[] buffer = new byte[1024]; int numRead; long numWritten = 0; while ((numRead = in.read(buffer)) != -1) { out.write(buffer, 0, numRead); numWritten += numRead; System.out.println(buffer.length); System.out.println(" " + buffer.hashCode()); } System.out.println(localFileName + "\t" + numWritten); } catch (Exception exception) { exception.printStackTrace(); } finally { try { if (in != null) { in.close(); } if (out != null) { out.close(); } } catch (IOException ioe) { } } } When I run the code everything seems to work until midway through the loop the program seems to stop and not continue reading the JSON Object. Does anyone know why this would stop reading? How could I fix the issue?

    Read the article

  • Java - multithreaded access to a local value store which is periodically cleared

    - by Telax
    I'm hoping for some advice or suggestions on how best to handle multi threaded access to a value store. My local value storage is designed to hold onto objects which are currently in use. If the object is not in use then it is removed from the store. A value is pumped into my store via thread1, its entry into the store is announced to listeners, and the value is stored. Values coming in on thread1 will either be totally new values or updates for existing values. A timer is used to periodically remove any value from the store which is not currently in use and so all that remains of this value is its ID held locally by an intermediary. Now, an active element on thread2 may wake up and try to access a set of values by passing a set of value IDs which it knows about. Some values will be stored already (great) and some may not (sadface). Those values which are not already stored will be retrieved from an external source. My main issue is that items which have not already been stored and are currently being queried for may arrive in on thread1 before the query is complete. I'd like to try and avoid locking access to the store whilst a query is being made as it may take some time.

    Read the article

  • Use external inline script as local function

    - by Aidan
    Had this closed once as a duplicate, yet the so-called duplicate DID NOT actually address my whole question. I have found this script that, when run inline, returns your IP. <script type="text/javascript" src="http://l2.io/ip.js"></script> http://l2.io/ip.js Has nothing more than a line of code that says document.write('123.123.123.123'); (But obviously with the user's IP address) I want to use this IP address as a return string for a function DEFINED EXTERNALLY, BUT STILL ON MY DOMAIN. That is, I have a "scripts.js" that contains all the scripts I wish to use, and I would like to include it in that list as a local function that calls to the 12.io function, but javascript won't allow the < tags, so I am unsure as to how to do this. I.e. function getIP() { return (THAT SCRIPT'S OUTPUT); } This is the topic this was supposedly a duplicate of, and it is very similar. Get ip address with javascript However, this DOES NOT address defining as a forwarded script it in my own script file.

    Read the article

  • Get Local IP-Address using Boost.Asio

    - by MOnsDaR
    Hey, I'm currently searching for a portable way of getting the local IP-addresses. Because I'm using Boost anyway I thought it would be a good idea to use Boost.Asio for this task. There are serveral examples on the net which should do the trick. Examples: Official Boost.Asio Documentation Some Asian Page I tried both codes with just slight modifications. The Code on Boost.Doc was changed to not resolve "www.boost.org" but "localhost" or my hostname instead. For getting the hostname I used boost::asio::ip::host_name() or typed it directly as a string. Additionally I wrote my own code which was a merge of the above examples and my (little) knowledge I gathered from the Boost Documentation and other examples. All the sources worked, but they did just return the following IP: 127.0.1.1 (Thats not a typo, its .1.1 at the end) I run and compiled the code on Ubuntu 9.10 with GCC 4.4.1 A colleague tried the same code on his machine and got 127.0.0.2 (Not a typo too...) He compiled and run on Suse 11.0 with GCC 4.4.1 (I'm not 100% sure) I don't know if it is possible to change the localhost (127.0.0.1), but I know that neither me or my colleague did it. ifconfig says loopback uses 127.0.0.1. ifconfig also finds the public IP I am searching for (141.200.182.30 in my case, subnet is 255.255.0.0) So is this a Linux-issue and the code is not as portable as I thought? Do I have to change something else or is Boost.Asio not working as a solution for my problem at all? I know there are much questions about similar topics on Stackoverflow and other pages, but I cannot find information which is useful in my case. If you got useful links, it would be nice if you could point me to it. Thanks in advance, MOnsDaR PS: Here is the modified code I used from Boost.Doc: #include <boost/asio.hpp> using boost::asio::ip::tcp; boost::asio::io_service io_service; tcp::resolver resolver(io_service); tcp::resolver::query query(boost::asio::ip::host_name(), ""); tcp::resolver::iterator iter = resolver.resolve(query); tcp::resolver::iterator end; // End marker. while (iter != end) { tcp::endpoint ep = *iter++; std::cout << ep << std::endl; }

    Read the article

< Previous Page | 57 58 59 60 61 62 63 64 65 66 67 68  | Next Page >