Daily Archives

Articles indexed Friday May 28 2010

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

  • LINQ-to-SQL - Join, Count

    - by ile
    I have following query: var result = ( from role in db.Roles join user in db.Users on role.RoleID equals user.RoleID where user.CreatedByUserID == userID orderby user.FirstName ascending select new UserViewModel { UserID = user.UserID, PhotoID = user.PhotoID.ToString(), FirstName = user.FirstName, LastName = user.LastName, FullName = user.FirstName + " " + user.LastName, Email = user.Email, PhoneNumber = user.Phone, AccessLevel = role.Name }); Now, I need to modify this query... Other table I have is table Deals. I would like to count how many deals user created last month and last year. I tried something like this: var result = ( from role in db.Roles join user in db.Users on role.RoleID equals user.RoleID //join dealsYear in db.Deals on date.Year equals dealsYear.DateCreated.Year join dealsYear in ( from deal in db.Deals group deal by deal.DateCreated into d select new { DateCreated = d.Key, dealsCount = d.Count() } ) on date.Year equals dealsYear.DateCreated.Year into dYear join dealsMonth in ( from deal in db.Deals group deal by deal.DateCreated into d select new { DateCreated = d.Key, dealsCount = d.Count() } ) on date.Month equals dealsMonth.DateCreated.Month into dMonth where user.CreatedByUserID == userID orderby user.FirstName ascending select new UserViewModel { UserID = user.UserID, PhotoID = user.PhotoID.ToString(), FirstName = user.FirstName, LastName = user.LastName, FullName = user.FirstName + " " + user.LastName, Email = user.Email, PhoneNumber = user.Phone, AccessLevel = role.Name, DealsThisYear = dYear, DealsThisMonth = dMonth }); but here is even syntax not correct. Any idea? Btw, is there any good book of LINQ to SQL with examples?

    Read the article

  • How to render Max(Substring) with Lambda Extensions

    - by caifa
    Hi everybody. I'm using NHibernate with Lambda Extensions. I'd like to know how to nest a Max function with a Substring. The following statement retrieves Max("invoice_id") var ret = session .CreateCriteria<Invoice>() .SetProjection(Projections.Max("invoice_id")) .UniqueResult(); but in my case the field invoice_id is made in this way: 12345.10 where 12345 is the invoice number, and 10 refers to the current year (2010). So I need to calculate the Max function only over the first 5 digits. How can I do it?

    Read the article

  • Using a .delay() function before .css() manipulation in jQuery

    - by Fabian
    I have this: var $ul = $(this).children("ul"); $ul.animate({opacity: 0}, 1000); $ul.delay(1000).css("display", "none") It's for my dropdown menu, and I want it to fade off before it disappears using the display: none; CSS property. However it appears that the .delay() cannot be used on the .css(); it doesn't work, the $ul just disappears right away. I can't use $ul.animate({opacity: 0, display: "none"}, 1000); either.

    Read the article

  • Redirect on Ajax Jquery Call

    - by Mark Estrada
    Hi, I am newbie to ajax here and I know somebody would have encountered this problem already. I have a legacy app built on Spring MVC, it has a interceptor(filter) that redirects the user to the login page whenever there is no session. public class SessionCheckerInterceptor extends HandlerInterceptorAdapter { public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { HttpSession session = request.getSession(); // check if userInfo exist in session User user = (User) session.getAttribute("user"); if (user == null) { response.sendRedirect("login.htm"); return false; } return true; } } For non-xmlhttp request, this works fine.. but when I try to use ajax in my application, everything gets weird, it is not able to redirect to the login page correctly. As check the value of the xhr.status = 200 textStatus = parseError errorThrown = "Invalid JSON -Markup of my HTML Login Page- $(document).ready(function(){ jQuery.ajax({ type: "GET", url: "populateData.htm", dataType:"json", data:"userId=SampleUser", success:function(response){ //code here }, error: function(xhr, textStatus, errorThrown) { alert('Error! Status = ' + xhr.status); } }); }); I checked on my firebug that there is a 302 HTTP response but I am not sure how to catch the response and redirect the user to the login page. Any idea here? Thanks.

    Read the article

  • How can open source projects obtain license for commercial software without spending a lot of money?

    - by Ikaso
    I just joined an open source project on codeplex. The project is based on the .NET compact framework. So the development tool is Visual Studio. Currently I am using some trial version of Visual Studio which is going to end and I wondered how can I obtain a valid license to work on the project without spending a lot of money. Please pay attention that the Express edition does not help me since my application is running on Windows Mobile 6.5 which is not supported on the Express edition (and the 2010 Express edition supports only Windows Mobile Phone 7 series development). In the general sense, are there some organizations that donate software licenses for open source projects?

    Read the article

  • epub ebook reader

    - by venkateshf1
    I am working on ebook reader with the books in epub format, i need some sample codes regarding that or the java script coding for that.I spent a lot of time in research, any help is appreciated.

    Read the article

  • How to retrieve key and value from JSON object

    - by I Like PHP
    I have a JSON object in this format: { "supplier": { "mov_10": "love actually", "mov_1": "fare" }, "quantity": 20, "success": true, "length":2 } Now I want to create a select box below using the supplier object (using both the keys and values), like this: <select id="selectme"> <option id="mov_10">love actually</option> <option id="mov_1">fare</option> </select> So how do I create it? I just want to know how to reach mov_10 and mov_1 in the object. Sorry for my bad English, but please help me. Thanks.

    Read the article

  • jQuery: using hover to roll-over multiple images at once.

    - by WillKop
    I have a small problem, but I'm a bit stumped. I am using the following code to do rollovers on my webpage $("#mylink1 img").hover( function() { this.src = this.src.replace("_off","_on"); }, function() { this.src = this.src.replace("_on","_off"); } ); This works great for individual images, but I would like to roll over one of them and have the the other one change as well. <a id="mylink1" href="about.cfm"><img src="images/Home_top_navs/aboutus_manage_off.gif" /></a> <a id="mylink1" href="about.cfm"><img src="images/Home_top_navs/aboutus_nav2_off.gif" /></a> Any help would be appreciated! Thank you!

    Read the article

  • Dynamic DataGrid columns in WPF DataGrid based on the underlying set of data (and their type)

    - by StatsMan
    Hello everyone, I've got kind of a conceptual question. I am in the process of wrapping some statistics classes I wrote into WPF. For that I have two DataGrid(-Views, currently in WinForms). In one DataGrid each row represents a column in the other. There I can set-up different variables (as in mathematical/statistical variables) with fields like "Header", "DataType", "ValidationBehaviour", "DisplayType". There I can also set-up how it should be displayed. Some Columns can automatically be set to ComboBoxColumns, some TextBoxColumns, and so on and so forth. So, now once I've set-up these Columns I can go to the other grid and enter my data. I may, for instance, have generated (in grid 1) one Column called "Annual Gross Salary" with input of numerical values. Another Column called "Education" with "0=NoEducation", "1=College Level", "3=Universitary" etc. These labels are displayed as text in the combobox and my statistics engine behind then selects the respective value (0-3) for calculations (i.e. ordinal, nominal variables). Sooo. In WinForms I could basically generate all the columns by hand in code and then add my data in the respective cells/rows. Now in WPF I thought that must be easy to realise. However, yesterday I got started with ICustomPropertyDescriptor which (maybe I was too thick) didn't give me the results I was looking for. Basically, I just need to be able to dynamically generate columns (and rows) with different Layout, Controls (ComboBox, simple Input, DateTimes) based on the data that I have. But I don't really know how to go about it? So here in summary: DataGrid 1 Purpose is to display columns that have been specified in DataGrid 2 In rows, the user can add any kind of data in the rows below the columns that is allowed as to the columns specifications DataGrid 2 Each row in this grid represents a column in DataGrid 1 Contains fields like Name/Header, DataType, Validation Behaviour, Default Value, Data Formatting, etc. Also contains a function to be able to set-up how it should be displayed. The user can select from, for instance, ComboBoxColumn (and also add the available options), DateTime, normal TextBox, CheckBox etc. After finishing adding a row it will automatically appear as a new column in DataGrid 1 I'd appreciate any kind of pointer into the right direction. Thanks very, very much in advance! :)

    Read the article

  • Classic ASP on IIS 7

    - by jagr
    Hi, I am having problems with my app running on IIS 7. The application is a mixture of classic ASP and ASP.NET MVC (don't ask how and why). Anyway, the application is up and running except for some problems that I am experiencing. For example, I have a button on my page and when I click it, javascript is opening a popup which needs to contain .asp page. But that doesn't happen. I get the blank popup with my cursor on busy as it still loads. This is happening almost always to me in IE. In Firefox it is much better but sometimes the app jams there too. If I close the opened, blank popup, and I want to move around the application, my buttons in menu (which are also .asp) doesn't load properly. For example, I have different buttons for different sections and when I move around they should change. When I restart the browser, only then everything works normal for some time, but the problem occurs again after a while. I am very sure that it is not the problem in application itself, because it works properly on the machines of my colleagues without those problems. They have the same OS (Vista Professional) and we compared the settings in IIS and they match. So I am very confused, and I really don't know how to solve the problem. I found a bunch of articles and blog posts about classic ASP and IIS7 but most of them are about enabling asp, which I already did. So I am suspecting that something wrong with IIS, but I don't know what, tried to reinstall it, hoping for some improvement, but I had no luck. If you need more details please ask. Does anyone have any idea what should I try or do?

    Read the article

  • PHP - ldap_search() filter. How to search for user

    - by cvack
    $_SERVER['REMOTE_USER'] returns the username of the user logged in to an Active Directory. I want to retrive this users info by using ldap_search(). This is what I have now: $ad = // ldap_connection id $filter = "(|(sn=$username*)(givenname=$username*))"; $attr = array("displayname", "mail", "mobile", "homephone", "telephonenumber", "streetaddress", "postalcode", "physicaldeliveryofficename", "l"); $dn = // OU, DC etc.. ldap_search($ad,$dn,$filter,$attr); It works, but i'm not sure it will work if two users have almost the same names. How do I only search for their unique username so that i always only get one user?

    Read the article

  • Gaming on Cloud

    - by technomad
    Sometimes I wonder the pundits of cloud computing are way to consumed with the enterprise applications. With all the CAPEX / OPEX, ROI-talk taking the center stage, an opportunity to affect masses directly is getting overlooked. I am a self proclaimed die hard gamer. I come from the generation of gamers who started their journey in DOS games like Wolfenstein 3D and Allan Border Cricket (the latter is still a favorite pastime). In the late 90s, a revolution called accelerated graphics started in DirectX and OpenGL. Games got more advanced. Likes of Quake III and Unreal Tournament became the crown jewels of the industry. But with all these advancements, there started a race. A race of GFX giants ATI and NVIDIA to beat each other for better frame and image quality. Revisions to the graphics chipsets became frequent. Games became eye candies but at the cost of more GPU power / memory. Every eagerly awaited title started demanding more muscle power in graphics and PC hardware. Latest games and all the liquid smooth frame rates became the territory of the once with deep pockets who could spend lavishly on latest hardware. Enthusiasts like yours truly, who couldn’t afford this route, started exploring over-clocking, optimized hardware cooling... etc. to pursue the passion. Ever rising cost of hardware requirements lead to rampant piracy of PC games. Gamers were willing to spend on the latest titles, but the ones with tight budget prefer hardware upgrades against a legal copy of the game. It was also fueled by emergence of the P2P file sharing networks. Then came the era of Xbox and PS3s. It solved the major issue of hardware standardization and provided an alternative to ever increasing hardware costs. I have always admired these consoles, but being born and brought up in a keyboard/mouse environment, I still find it difficult to play first person shooters with a gamepad. I leave the topic of PC v/s Consol gaming for another day, but the bottom line is… PC gamers deserve an equally democratized solution. This is where I think Cloud Computing can come to rescue. It can minimize hardware requirements. Virtually end the software piracy and rationalize costs for gamers. Subscription based models like pay-as-you-play. In game rewards, like extended subscription credits for exceptional gamers (oh yes, I have beaten Xaero on nightmare in Quake III, time and again!) Easy deployment for patches and fixes. Better game AI. The list goes on and on… Fortunately, companies like OnLive are thinking in the same direction. Their gaming service is all set to launch on 17th June 2010 in E3 2010 expo in L.A. I wish them all the luck. I hope they will start a trend which will bring the smiles back on the face of budget gamers with the help of cloud computing.

    Read the article

  • Monotouch bundle font with binary

    - by cvista
    Hi If we went and bought a font for use in our app, is it possible to bundle the font and use it inside the app? We're creating apps that need to generate buttons on the fly and need to use a specific font for it. Cheers w://

    Read the article

  • Can I declare the same value for two attributes at once

    - by graphicdivine
    For example, for accessibility reasons I want my onfocus and onmouseover to have identical values. For the sake of maintainability I want to declare this once only. What I'd like to be able to do is this: <a onmouseover,onfocus="assist('hello');">linktext</a> But, of course, that would be too easy, and doesn't work. What's the best way I can achieve this DRYing out of my tags?

    Read the article

  • div Height: 0 problem in IE

    - by meo
    to clear: both my content i use this: CSS: .clr { clear: both; height: 0; /* i have tried 0.001em to */ line-height: .001em; overflow: hidden; } HTML: <div class="clr">&nbsp;</div> it works perfectly in every navigator. But in IE 7 & 8 the div still have a height of a few pixels. How can i avoid this?

    Read the article

  • Passing windows credentials through web application, to WCF

    - by IP
    I've checked other questions, but I can't find a working answer I have a .Net web application which successfully takes on the callers windows credentials (Thread.CurrentPrincipal is my windows user). Within that app, I call to a WCF service, but my windows identity isn't passed up. Regardless of what I put in the binding: NetTcpBinding binding = new NetTcpBinding(); binding.Security.Mode = SecurityMode.Transport; binding.Security.Transport.ClientCredentialType = TcpClientCredentialType.Windows;

    Read the article

  • Good-looking Java Swing Look&Feel?

    - by eric
    I'm working on an open-source Java Web Start application, and I'd like to give it a consistent theme across platforms. Metal is totally ugly, and I'm not particularly happy with Substance (esp. performance). What are the best Swing Look&Feel options out there today?

    Read the article

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