Daily Archives

Articles indexed Tuesday May 11 2010

Page 20/123 | < Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >

  • linq to sql using foreign keys returning iqueryable(of myEntity]

    - by Gern Blandston
    I'm trying to use Linq to SQL to return an IQueryable(of Project) when using foreign key relationships. Using the below schema, I want to be able to pass in a UserId and get all the projects created for the company the user is associated with. DB tables: Projects Projid ProjCreator FK (UserId from UserInfo table) Companyid FK (CompanyID from Companies table) UserInfo UserID PK Companyid FK Companies CompanyId PK Description I can get the iqueryable(of project) when simply getting the ProjectCreator with this: Return (From p In db.Projects _ Where p.ProjectCreator = Me.UserId) But I'm having trouble getting the syntax to get a iqueryable(of projects) when using foreign keys. Below gives me an IQueryable(of anonymous) but I can't seem to convince it to give me an IQueryable(of project) even if I try to cast it: Dim retval = (From p In db.Projects _ Join c In db.Companies On p.CompanyId Equals c.CompanyId _ Join u In db.UserInfos On u.CompanyId Equals c.CompanyId _ Where u.Login = UserId)

    Read the article

  • ASP.NET MVC: Route to URL

    - by JamesBrownIsDead
    What's the easiest way to get the URL (relative or absolute) to a Route in MVC? I saw this code here on SO but it seems a little verbose and doesn't enumerate the RouteTable. Example: List<string> urlList = new List<string>(); urlList.Add(GetUrl(new { controller = "Help", action = "Edit" })); urlList.Add(GetUrl(new { controller = "Help", action = "Create" })); urlList.Add(GetUrl(new { controller = "About", action = "Company" })); urlList.Add(GetUrl(new { controller = "About", action = "Management" })); With: protected string GetUrl(object routeValues) { RouteValueDictionary values = new RouteValueDictionary(routeValues); RequestContext context = new RequestContext(HttpContext, RouteData); string url = RouteTable.Routes.GetVirtualPath(context, values).VirtualPath; return new Uri(Request.Url, url).AbsoluteUri; } What's a better way to examine the RouteTable and get a URL for a given controller and action?

    Read the article

  • Building asynchronous cache pattern with JSP

    - by merweirdo
    I have a JSP that will take some 8 minutes to render. The code logic itself can not be made more efficient (it will update often and be updated by basically a pointy haired boss). I tried wrapping it with a caching layer like <%@ taglib uri="/WEB-INF/classes/oscache.tld" prefix="oscache" %> <oscache:cache time="60"> <div class="pagecontent"> ..... my logic </div> </oscache:cache> This is nice until the 60 seconds is over. The next query after that blocks until the 8 minutes of rendering is done with again. I would need a way to build a pattern something like: If there is no version of the dynamic content in the cache run the actual logic (and populate the cache for subsequent requests) If there is a non-expired version of the dynamic content in the cache serve the output of the JSP logic from the cache If there is an expired version of the dynamic content in the cache serve the output of the JSP logic still from the cache AND run the JSP logic in the background so that the cache gets updated transparently to the user - avoiding the user have to wait for 8 minutes I found out that at least EHCache might be able to do some asynchronous cache updating but it did not sadly seem to apply to the JSP tags... Also I have to take in 10-20 parameters for the actual logic of the JSP and some of them should be used as a key for caching. Code example and/or pointers would be greatly appreciated. I do not frankly care if the solution provided is extremely ugly. I just want a simple 5 minute caching with asynchronous cache update taking into account some parameters as a key.

    Read the article

  • Getting a cryptic error on my simple Java program, comparing char[i] to a string.

    - by Sergio Tapia
    public static void ejemplosString(String palabra){ char[] letras = palabra.toCharArray(); int contadorVocales = 0; for (int i = 0; i < letras.length; i++) { if (char[i] == 'a') { contadorVocales++; } if (char[i] == "e") { contadorVocales++; } if (char[i] == "i") { contadorVocales++; } if (char[i] == "o") { contadorVocales++; } if (char[i] == "u") { contadorVocales++; } } } Getting the error on every If statement. Any guidance?

    Read the article

  • How to add a new node to a dijit.Tree

    - by Larry Bergman
    I want to add a new node to a dijit.ree as a sibling of the currently selected node. I've found sample code (I'm new to dojo) that adds a new item to the tree using the newItem method of ItemFileWriteStore, but the new item always appears at the bottom of the tree. How would I add to the store at a specified position, in particular the position corresponding to the current selection? Pointers to sample code would be welcome :) Thanks, Larry

    Read the article

  • What are good sites that provide free media resources for hobby game development?

    - by m_oLogin
    Please redirect me if this is a duplicate. I haven't been able to find a suitable question. I really suck at graphics / music / 3D modeling / animation and it's a must-have when you have a hundred hobby game development projects you're working on. I'm looking for different quality sources on the web that provide free resources. [EDIT] Some resources given by the answers: (I'll complete it with time) MUSIC Jamendo (need to ask for permission for uses) OpSound SOUND EFFECTS FreeSound StoneWashed SPRITES LostGarden The protagonist domain Reiner's Tilesets (also contains a couple of 3D models OpenGameArt (beta, not many resources but promising) Flying Yogi ANIMATED SPRITES The Spriters Resource MODELS archive3d TurboSquid 3Dvia Google Sketchup ShareCG Gamasutraexchange.com ANIMATED MODELS TurboSquid TEXTURES CG Textures OpenFrag Other precompiled lists FreeGameDev.net

    Read the article

  • TCP/IP over SSL and silverlight

    - by rahulchandran
    I want to write a silverlight page which connects to a tcp/ip server. The server is layering ssl as well. The problem is I don't see a SSLStream in Silverlight. Is this doable (I need the tcp/ip because this page will constantly get events from the server and no I don't want to poll, in fact I can't the server is third party) Thanks

    Read the article

  • Users getting port 8080?

    - by domainking
    I tested several times, running using different internet browser (IE, FF, Chrome, Safari and Opera), none of those getting 8080. Recently I got some complaints from my users, saying my website giving errors:[my website ip]:8080 error. What is that error? And how do I resolve it?

    Read the article

  • Send HTTP 404 from Application_Error

    - by Dmitriy Nagirnyak
    Hi, First of all, quickly what exactly I want to achieve: translate particular exception into the HTTP 404 so the ASP.NET can handle it further. I am handling exceptions in the ASP.NET (MVC2) this way: protected void Application_Error(object sender, EventArgs e) { var err = Server.GetLastError(); if (err == null) return; err = err.GetBaseException(); var noObject = err as ObjectNotFoundException; if (noObject != null) HandleObjectNotFound(); var handled = noObject != null; if (!handled) Logger.Fatal("Unhandled exception has occured in application.", err); } private void HandleObjectNotFound() { Server.ClearError(); Response.Clear(); // new HttpExcepton(404, "Not Found"); // Throw or not to throw? Response.StatusCode = 404; Response.StatusDescription = "Not Found"; Response.StatusDescription = "Not Found"; Response.Write("The whole HTML body explaining whata 404 is??"); } The problem is that I cannot configure default customErrors to work with it. When it is on then it never redirects to the page specified in customErrors: <error statusCode="404" redirect="404.html"/>. I also tried to raise new HttpExcepton(404, "Not Found") from the handler but then the response code is 200 which I don't understand why. So the questions are: What is the proper way of translating AnException into HTTP 404 response? How does customErrors section work when handling exceptions in Application_Error? Why throwing HttpException(404) renders (blank) page with success (200) status? Thanks, Dmitriy.

    Read the article

  • how does "recent history" work on sites for php? (PHP)

    - by ggfan
    I'm not sure if there is an explanation on SO for beginners, but if so, could you provide the links. I am interested in creating a "recent viewed" function that shows what links they clicked on before. I'm not sure if this is the 'correct' way to do it, but this is what I have so far... user clicks on a link(say ad.php?posting_id=12). if the user doesn't click on the link, no cookie or session is stored for the link if the user clicks on the link, it sets a cookie for $_cookie['ad.php?posting_id=22'] Each time the user clicks, more cookies are set In the recent viewed function, it gets all the $_cookie variables and displays them. if the user wants to clear the history, just destroy all the cookies I'm not sure if this is the way to do it, but is the viable? If not, what are the steps to create a "recent viewed" function

    Read the article

  • UDP security and identifying incoming data.

    - by Charles
    I have been creating an application using UDP for transmitting and receiving information. The problem I am running into is security. Right now I am using the IP/socketid in determining what data belongs to whom. However, I have been reading about how people could simply spoof their IP, then just send data as a specific IP. So this seems to be the wrong way to do it (insecure). So how else am I suppose to identify what data belongs to what users? For instance you have 10 users connected, all have specific data. The server would need to match the user data to this data we received. The only way I can see to do this is to use some sort of client/server key system and encrypt the data. I am curious as to how other applications (or games, since that's what this application is) make sure their data is genuine. Also there is the fact that encryption takes much longer to process than unencrypted. Although I am not sure by how much it will affect performance. Any information would be appreciated. Thanks.

    Read the article

  • symfony autocompletion in netbeans?

    - by fayer
    im using netbeans to code a web application with symfony. it seems that netbeans doesnt support symfony in auto completion. could one fix this problem. cause i want to be able to click on symfony's functions and get to the source, eg helper function and model methods and classes.

    Read the article

  • Parse XML and populate in List Box

    - by cedar715
    I've posted the same question here and I've also got couple of good answers as well. While I was trying the same answers, I was getting compilation errors. Later I got to know that we are using .NET 2.0 and our existing application has no references to LINQ files. After searching in SO, i tried to figured out partly: public partial class Item { public object CHK { get; set; } public int SEL { get; set; } public string VALUE { get; set; } } Parsing: XmlDocument doc = new XmlDocument(); doc.LoadXml("<LISTBOX_ST> <item><CHK></CHK><SEL>00001</SEL><VALUE>val01</VALUE></item> <item><CHK></CHK><SEL>00002</SEL><VALUE>val02</VALUE></item> <item><CHK></CHK><SEL>00003</SEL><VALUE>val03</VALUE></item> <item><CHK></CHK><SEL>00004</SEL><VALUE>val04</VALUE></item> <item><CHK></CHK><SEL>00005</SEL><VALUE>val05</VALUE></item> </LISTBOX_ST>"); List<Item> _lbList = new List<Item>(); foreach (XmlNode node in doc.DocumentElement.ChildNodes) { string text = node.InnerText; //or loop through its children as well //HOW - TO - POPULATE THE ITEM OBJECT ?????? } listBox1.DataSource = _lbList; listBox1.DisplayMember = "VALUE"; listBox1.ValueMember = "SEL"; How to read two child nodes - SEL and VALUE of node and populate the same in the new Item DTO??

    Read the article

  • Can i execute the events in sequence in jquery

    - by Mirage
    I am using accordians. I want that if someone click on hyperlink inside the accordion , then that accordion should slide up slowly and only after that the nect accordion falls down or open $(".accord").live('click', function(){ $('#rr1').next().slideUp('slow'); $('#rr3').next().slideDown('slow'); But i have seen that the other accordion starts opening up at the same time when the other is closing. It it something related to asynchronous thing. I don't know });

    Read the article

  • Django and mod_python intermittent error?

    - by Peter
    I have a Django site at http://sm.rutgers.edu/relive/af_api/index/. It is supposed to display "Home of the relive APIs". If you refresh this page many times, you can see different renderings. 1) The expected page. 2) Django "It worked!" page. 3) "ImportError at /index/" page. If you scroll down enough to ROOT_URLCONF part, you will see it says 'relive.urls'. But apparently, it should be 'af_api.urls', which is in my settings.py file. Since these results happen randomly, is it possible that either Django or mod_python is working unstably?

    Read the article

  • PayPal Cannot send value to paypal

    - by preetu
    Hi PayPal IPN sends a notification to your script directly. Since the notification is coming from PayPal - NOT the customer that placed the order - My Login session doesn't exits this context .Therefore,all my login data doesn't exist in the session.I need my login session values to update my DB with paypal ipn value.How should i mentain my login session should i set browser session or other way can i send login primary key to paypal.

    Read the article

  • New desktop GUI developer; can choose any platform...

    - by alexantd
    I'm planning a client-server product for a tiny, low-volume, high-cost vertical market. One of the components of the product will be a desktop application, simple to moderate in complexity, for data entry and uploading to a central server from remote PCs and/or Macs via SOAP. The server is a Java web app. Customers will be choosing their platform (Windows or Mac) based on what the client app runs on, so my options are wide-open here. However, I will be developing on a Mac and have a strong allergy to MS-specific technologies (sorry). The app will not need to run on any non-desktop-computer devices and I have total freedom to say it will support X but not Y or Z without any negative consequences (quite the luxury, to be sure). I have a lot of experience in server-side development but very little in desktop GUI stuff, and am evaluating my options on the client - basically what do I want to commit to learning over the next 6+ months. I have server-side Java experience as well as a brief dabble in iPhone development, which went OK. Overall I'm looking for: Ease of learning & development IDE support Healthy surrounding ecosystem (libraries, tools, help, etc.) Quality documentation My options as I see them, in rough order of how I'm currently mentally ranking them: Java Swing Cocoa Java SWT JavaFX Adobe AIR XULRunner Am I leaving anything out?

    Read the article

  • Redirect from docroot to an external url in glassfish

    - by tim_wonil
    I've googled around and only found solution where they suggest putting an apache httpd in front of glassfish. Sure, that works. But what if I do not wish to/cannot put any thing in front of glassfish? Without using the index.jsp in the docroot of the domain to have something like: <% String redirectURL = "http://stackoverflow.com/"; response.sendRedirect(redirectURL); %> Can I make browser to be redirected when I point it to: http://my.glassfish.domain/ ?

    Read the article

  • BackgroundWorker acting bizarrely...

    - by vdh_ant
    Hi guys I'm working on some code that calls a service. This service call could fail and if it does I want the system to try again until it works or too much time has passed. I am wondering where I am going wrong as the following code doesn't seem to be working correctly... It randomly only does one to four loops... protected virtual void ProcessAsync(object data, int count) { var worker = new BackgroundWorker(); worker.DoWork += (sender, e) => { throw new InvalidOperationException("oh shiznit!"); }; worker.RunWorkerCompleted += (sender, e) => { //If an error occurs we need to tell the data about it if (e.Error != null) { count++; System.Threading.Thread.Sleep(count * 5000); if (count <= 10) { if (count % 5 == 0) this.Logger.Fatal("LOAD ERROR - The system can't load any data", e.Error); else this.Logger.Error("LOAD ERROR - The system can't load any data", e.Error); this.ProcessAsync(data, count); } } }; worker.RunWorkerAsync(); } Cheers Anthony

    Read the article

< Previous Page | 16 17 18 19 20 21 22 23 24 25 26 27  | Next Page >