Posts

Donate

MySQL Subquery Result As Aliased Table Name

Here's a query that has a subquery in which the result is aliased as inner table and then the outer query compares the result from the subquery against the field in the outer query. SELECT id,w_id, start , f_count, count_percent FROM tblLogs, ( select max (id) as max_id from tblLogs where w_id = 92 and categ = 'bike' and date( start ) = '2012-01-24' ) as inner_table WHERE DATE( start ) = '2012-01-24' AND w_id =92 AND categ = 'bike' and err = 'none' and remark = '' and inner_table.max_id = tblLogs.id;

Equi-Join In MySQL Example

Here's an example of equi join select distinct site_scripts._id, crw_site.site, crw_subcategory.subcategory from site_scripts, crw_site , crw_subcategory where site_scripts.subcategory_id = 8 and crw_site._id = site_scripts._id and crw_subcategory.subcategory_id = site_scripts.subcategory_id and crw_scripts.country_id = 1 and crw_site._active = 1 order by crw_site.site; Note: The concept can be used as an alternate to inner join...

How To Sort Dictionary<TKey,TValue> Object By Value Or By Key Using LINQ In C#

Here's a code I got from StackOverflow on how to sort dictionary object by value or by key using LINQ in C#. var sortedDict = ( from entry in SortedWebsiteNames orderby entry.Value ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value); var sortedDict = ( from entry in SortedWebsiteNames orderby entry.Value ascending select entry).ToDictionary(pair => pair.Key, pair => pair.Value);

AutoComplete Winforms Search Not Working If Search Item Is One Character Digit In C#

Textbox properites: autocompletemode = append, autcompletesource = customsource. Assuming the autocompletestringcollection of the textbox are as follows: James Philipp Mariah Clara 8 Ryan GregEsguerra If you type the number 8 in the textbox, the textbox autocomplete does not suggest. As defined, it will search the prefix of the source. So, i guess one character does not have a prefix at all. The workaround for this is to add a space character after the digit 8. So, "8" becomes "8 ". Below is the code: private void PopulateWebsiteName() { try { if (dtWebsiteNames != null ) { dtWebsiteNames.Clear(); } dtWebsiteNames = JobsReporting.Scripts.GetWebsiteNamesLocal(); if (dtWebsiteNames.Rows.Count > 0) { foreach (DataRow row in dtWebsiteNames.Rows) { if (row[1].ToString().Trim().Length == 1) { row[1] = row[1]

ASP.NET Website Administration (Exception when adding users)

Upon registering new users, I encountered this error upon saving. An error was encountered. Please return to the previous page and try again. The following message may help in diagnosing the problem: Exception has been thrown by the target of an invocation. at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) at System.Web.Administration.WebAdminMembershipProvider.CallWebAdminMembershipProviderHelperMeth

Simple Pager Template in ASP.NET Web Forms

Here's a simple pager template in ASP.NET Web Forms. < PagerTemplate > Page: <%= gvPRocess.PageIndex + 1%> of <%= gvPRocess.PageCount %> < asp:button ID = "btnFirst" runat = "server" CommandName = "Page" CommandArgument = "First" Text = "<<" /> < asp:button ID = "btnPrev" runat = "server" CommandName = "Page" CommandArgument = "Prev" Text = "<" /> < asp:button ID = "btnNext" runat = "server" CommandName = "Page" CommandArgument = "Next" Text = ">" /> < asp:button ID = "btnLast" runat = "server" CommandName = "Page" CommandArgument = "Last" Text = ">>" /> </ PagerTemplate >

How To Limit Or Reduce RAM Usage Of Mozilla Firefox Browser

Image
Hello, I noticed that Firefox takes a lot of RAM space on my workstation. After googling around, I found a solution on how to limit it's memory consumption. 1. Open Mozilla firefox 2. type about:config in the url/address bar 3. just click i'll be careful i promise 4. filter "browser.cache." 5. change browser.cache.disk.capacity from original value in my pc it's 1059997. I changed it to 30000 since my RAM space is 2GB. 6. Choose OK 7. Close and restart Mozilla firefox (I noticed the memory usage of firefox lowered to a significant level) Cheers! :=)

ASP.NET MVC (Add,Edit,Delete,View/View All) Example in C#

Image
Original Source: Developer Resources Just this evening, i modified an ASP.NET MVC example from Visual Basic.Net to C#. I also completed the steps and added some basic functionalities of my own. The database used is MS SQL Server 2008 and the data source is an ADO.NET Entity object. Below are the screenshots: Here is the snippet for the validation side in C#. This is not sophisticated: protected void ValidateEmployee(Employee EmployeeToValidate) { if (EmployeeToValidate.EmployeeName == null ) { ModelState.AddModelError( "EmployeeName" , "Employee name is required field." ); } if (EmployeeToValidate.Department == null ) { ModelState.AddModelError( "Department" , "Employee Department is required field." ); } if (EmployeeToValidate.EmployeeSalary == null ) { ModelState.AddModelError( "EmployeeSalary"

The remote server returned an error: (500) Internal Server Error (WebCclient) In C#

In our case when we encountered this error using WebClient, the solution was to set the user agent and add it as header to the WebCclient object. newWebClient.Headers.Add( "user-agent" , "Mozilla/5.0 (Windows NT 6.1; rv:2.0) Gecko/20100101 Firefox/4.0" );

SET Variable (User Defined) In MySQL Returns NULL (MySQL Browser)

Source: MySQL bug Forum Steps 1. Open MySQL Browser 2. Click Tools menu 3. Click Options 4. Choose Browser 5. Check Show Advanced Toolbars 6. Click Apply 7. Click close 8. Transactions Toolbar appears on MySQL Browser 9. Click the Transaction button on the transaction toolbar everytime you execute the query Sample query: Set @ names = 'james' ; select @ names ;

Donate