|
Hi,
I have a class file: dbtest and a have create a static public function that returns values from database.
Since its an static public function so i can access it as dbsale.function().
Now I wanted to know the disadvantages of this approach when say there are some 1000 call at a time for this function.
I have searched a lot and found examples of using static public functions but no where I found it to be used for calling a database operation.
Thanks in advance.
Regards
Vijay V.
Yash Softech
|
|
|
|
|
hi,
Now what u want?
Regards
Anil Pal
|
|
|
|
|
I wanted to know the disadvantages of this approach when say there are some 1000 call at a time for this function.
Vijay V.
Yash Softech
|
|
|
|
|
I think I can equate this multi-user thing to a multithreaded environment. You can use public static functions, there will be no problem. But if you are using static objects inside your function, then there's a one. There are big chances your static objects get overwritten with calls from other clients. If you are using local objects or instance members inside the function, then there wouldn't be any problem.
This is all a guess. I haven't tried this in Asp.net
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Thanks ViNic for your reply.......
Can u focus on the following code is this one is correct?
BinaryTree.cs file inside appcode
public class BinaryTree
{
public static ArrayList dlist = new ArrayList();
public static void FetchDownlineID(long uid)
{
BinaryTree bt = new BinaryTree();
bt = BinaryTree.fetchIdInfo(uid);//fetches user info
if (bt.Aid > 0)
{
dlist.Add(bt.Aid);
BinaryTree.FetchDownlineID(bt.Aid);
}
if (bt.Bid > 0)
{
dlist.Add(bt.Bid);
BinaryTree.FetchDownlineID(bt.Bid);
}
if (bt.Cid > 0)
{
dlist.Add(bt.Cid);
BinaryTree.FetchDownlineID(bt.Cid);
}
}
}
now this function is called on pageload as user's open page & result is bind to gridview...
as follows----------
public partial class User_DownlineLists : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
bindGridView();
}
protected void bindGridView()
{
if (Session["User"] != null)
{
long id = UserDetails.FetchUserId(Session["User"].ToString());
BinaryTree.dlist.Clear();
BinaryTree.FetchDownlineID(id);
Sort();//this function sort list datewise
GridView1.DataSource = BinaryTree.dlist;
GridView1.DataBind();
}
else
{
Response.Redirect("~/Home.aspx");
}
}
}
Vijay V.
Yash Softech
|
|
|
|
|
No, This looks truly bad to me.
VijayVishwakarma wrote: public static ArrayList dlist = new ArrayList();
public static void FetchDownlineID(long uid)
You might have read a "rant" from me just above your message. That says why you should not do it. Though every member would create a new object of your BianryTree, it's dlist would be shared.
VijayVishwakarma wrote: if (bt.Aid > 0)
{
dlist.Add(bt.Aid);
When one client does the above code, Another client could potentially execute the below code.
BinaryTree.dlist.Clear(); .
You get the idea?
Starting to think people post kid pics in their profiles because that was the last time they were cute - Jeremy.
|
|
|
|
|
Thanks a lot....
Vijay V.
Yash Softech
|
|
|
|
|
My evet handler is this
protected void GV_Main_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes.Add("onclick", "onGridViewRowSelected('" + m_iRowIdx.ToString() + "')");
}
m_iRowIdx++;
}
Which perform a selected row color change.This call a java script
Which is like this
< script language="javascript" type="text/javascript> var gridViewCtlId = '<%=GV_Main.ClientID%>';
var gridViewCtl = null;
var curSelRow = null;
function getGridViewControl()
{
if (null == gridViewCtl)
{
gridViewCtl = document.getElementById(gridViewCtlId);
}
}
function onGridViewRowSelected(rowIdx)
{
var selRow = getSelectedRow(rowIdx);
if (curSelRow != null)
{
//curSelRow.style.backgroundColor = '#ffffff';
curSelRow.style.backgroundColor = '';
}
if (null != selRow)
{
curSelRow = selRow;
//curSelRow.style.backgroundColor = '#ff0022';
curSelRow.style.backgroundColor = '#D1DDF1';
}
}
function getSelectedRow(rowIdx)
{
getGridViewControl();
if (null != gridViewCtl)
{
return gridViewCtl.rows[rowIdx];
}
return null;
}
When a run application on dafault page 1 it is work fine ,but as I change page is is not working .Grigview use paging
Please tell me my error or give me a solution.
Thanks
adilkhan
|
|
|
|
|
can you tell me if your gridview is in content placeholder? If yes, Check the page source to find the id of the gridview. If u are using content placeholder, then the id of the gridview will change to ctl_01_gridview or something.
So the javascript is not able to find the gridview.
Check this first.
Vijay V.
Yash Softech
|
|
|
|
|
thanks to gave me a solution .
yes this in content placeholder but i alert this ID,its alert fine once when default page occrue.ut as i click on on next page of GridView alert is not fired ,means that second time java script not call.
adilkhan
|
|
|
|
|
Hello
first of sorry for the bad english but im dyslexic
im working on a simpel httpHandler at the momment but my problem is that i simply cant regiser it in my web.config, i have tryed adding a assembly name (im on the WWD so i dont think i can actly make assembys?) bouth whith my application name and whith the App_Code (bouth whith the handler in the App_Code folder And whith it in the root, and if is the App_Code folder DotNet wont let me build my page at all)
after 3 houres of forum searching im truey lost, i whent on the MSDN and copy pasted there helloworld exampel but its not working eather...
i tryed whith following in my Root web.config (not that i have any sub cfg's now.
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.sample" type="HelloWorldHandler,HelloWorldHandler"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" validate="false" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpHandlers>
And whith:
<add verb="*" path="*.sample" type="HelloWorldHandler,HelloWorldHandler"/>
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
Parser Error Message: Could not load file or assembly 'HelloWorldHandler' or one of its dependencies. The system cannot find the file specified.
=== Pre-bind state information ===
LOG: User = vexis\vexi
LOG: DisplayName = HelloWorldHandler
(Partial)
LOG: Appbase = file:LOG: Initial PrivatePath = C:\Users\vexi\Documents\webs\vxm\bin
Calling assembly : (Unknown).
===
LOG: This bind starts in default load context.
LOG: Using application configuration file: C:\Users\vexi\Documents\webs\vxm\web.config
LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v2.0.50727\config\machine.config.
LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: The same bind was seen before, and was failed with hr = 0x80070002.
i can see its trying to get the assimbly from my local web dir but WWD dont create a folder named bin whith the compiled code so im kind of lost for what to do now?
Help appreciated
Salomon B. Sumbundu
Denmark
|
|
|
|
|
Hi,
Ok thats fine do one thing, first create a simple app with Httphandler.
Follow simple steps below:
1.Create class and inherit it from "IHttpModule " interface
2.Imlement the below method
public void Init(HttpApplication context)
{
//context.BeginRequest += new EventHandler(context_BeginRequest);
}
void context_BeginRequest(object sender, EventArgs e)
{
//HttpApplication app = (HttpApplication)sender;
}
3. Add below code in yr web.config file
<httpModules>
<add name="yrclassName" type="classname"/>
</httpModules>
Regards
Anil Pal
|
|
|
|
|
thanks alot mate realy nice :]
but do the httphandler and moduels work the same way? im building a image handler (it is working if im targting it direct in the url), you think a modul are better sutted for such a job?
ways thanks agen
|
|
|
|
|
Found it!
i missed the IIS 7 changes >_<<br mode="hold" />
http://msdn.microsoft.com/en-us/library/bb515251.aspx[^]
Handlers are now defined in
<system.webServer>
<handlers>
<Handler here (whith name="" now)>
</handlers>
</system.webServer>
i guss i shod have looked harder but thanks for youre time thou ^^ (found it when googgling "httpmodule vs httphandler" 4 houres of random httpmodule didnt work, werd and imho MS shod revisit there tuturials)
|
|
|
|
|
is there anyone who can help me in developing web application...it's main feature is Online Custom
t-shirt designing...ie.,customer can create his own design by himself...If anyone has idea about it plz help.....thnx....!!
How to do Online Custom t-shirt designing using .net ?
|
|
|
|
|
what the problem .. .just create one .. .
you can use Silverlight, Flex etc to get your design done in the browser itself.
|
|
|
|
|
Thnx....bt I am new in this developing world..so,without example i cant understand it..dont mind to give me some source code for the same..
How to do Online Custom t-shirt designing using .net ?
|
|
|
|
|
What's importance of Security Cheek/text box.
Like facebook, For sign up at first have to submit user information, after that the user should fill up a security text box with some characters from a given picture. I want to know how does this text help me to develop my social network web site.
shahdat
modified on Friday, April 10, 2009 1:52 AM
|
|
|
|
|
MD. SHAHDAT HOSAIN wrote: What's importance of Security Cheek/text box.
what does it mean ? Do you want any validation ?
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
MD. SHAHDAT HOSAIN wrote: For sign up at first have to submit user information, after that the user should fill up a security text box with some characters from a given picture. I want to know how does this text help me to develop my social network web site.
Aha.. You are Talking about CAPTCHA Image. I am giving you two reference hope this will helps you to know about CAPTCHA and how to implement it.
CAPTCHA Image
A CAPTCHA Server Control for ASP.NET
Hope this will help you
cheers,
Abhijit
CodeProject MVP
|
|
|
|
|
Hi,
I have be searching the forum for examples of code that allows you to get the FTP path information for a group of files that have the same file name but different date e.g. file12082009 and add then to a datatable so once I have the file information for each file in the datatable I can then download any new ftp file that is not in the datatable.
Basically every time I download a file I would like the file information only to be added to the datatable but only download files that are not in the datatable.
I currently have code that will download the file from the FTP using vb.net which works fine.
|
|
|
|
|
It's easy to do the property, but my brick wall here is using the property as an attribute in the markup tag for that control.
This markup:
tc:TypeUser runat="server" ID="me" DataType="System.Int32"
causes this error:
Cannot create an object of type 'System.Type' from its string representation 'System.Int32' for the 'DataType' property.
|
|
|
|
|
hello my question is that we use google maps , now i want to set up the pin point of my area of google map in my website.Is their any way to embed the link in my asp.net site
thanks in advance
|
|
|
|
|
|