Thursday, 15 July 2010

C++: Converting Array class to Class template (Scope issue) -


I am in the initial stage of trying to change an array class, which includes the overloading operator in a templated class. At the moment, I am trying to add the definition of the template to the class and every function. It should be quite simple, however, whenever I run the program, I get a scope error.

The compiler says that 'T' was not declared in this radius (I would comment on the error that happens). The error also occurs on other function definitions. I am using a templated class as a program and it implements the tasks I am trying to do (which is why I am confused). What should I do to resolve this?

Thank you.

  #include & lt; Iostream & gt; # Include & lt; Iomanip & gt; # Include & lt; Cstdlib & gt; # Include & lt; Stdexcept & gt; using namespace std; #ifndef ARRAY_H #define ARRAY_H template & lt; Typename T & gt; Class array {public: arrays (int = 10); Array (Constant Array & amp; nbsp;); ~ Array (); Int getSize () console; Constant Array and Operator = (Constant Ar & amp; amp;;); Bull Operator == (Const Ar and Co.); Bull Operator! = (Constant Array and Right) const {Return! (* It == true); } Int and operator [] (int); Int operator [] (int) const; Private: integer size; Int * ptr; }; #endif Template & lt; Typename t & gt; Array End Lieutenant; T & AG :: Array (Int. Sir Sysi) // Error: T was not declared in this scope ************************************************************ Throw ***** and invalid_gram ("Array Size Mayest Is More Than 0"); Ptr = new int [size]; For (Int i = 0; I   

Before each of your function definitions, you have written: < Previous> template & lt; Typename t & gt;

Your mean:

  template & lt; Typename T & gt;   

That is, it should match the template parameters of your square, which is the capital T .

asp.net mvc - Controling and managing DbContext -


अभी मेरे पास यह संदर्भ है

  नामस्थान Dafoor_MVC.Models {सार्वजनिक वर्ग DafoorDBContext: DbContext {सार्वजनिक डीबीसेट & lt; विभाग & gt; विभाग {प्राप्त करें; सेट; } सार्वजनिक DbSet & lt; पाठ्यक्रम & gt; पाठ्यक्रम {प्राप्त; सेट; } सार्वजनिक DbSet & lt; उत्तर & gt; उत्तर {प्राप्त करें; सेट; }}}   

यह संदर्भ बड़े हो जाएगा क्योंकि मेरे पास लगभग 40 मॉडल हैं जो मैं जोड़ना चाहता हूं।

1- क्या यह 40 मॉडल में एक अच्छा विचार है एक संदर्भ?

2- मुझे यह संदर्भ सभी उपयोगकर्ताओं के बीच साझा करना है, क्योंकि मैं हर बार पूछताछ के साथ डाटाबेस को हिट नहीं करना चाहता अगर रिकॉर्ड पहले से ही एक संदर्भ में है, लेकिन इससे प्रभावित होगा सर्वर मेमोरी, तो मैं कैसे "अंतिम वस्तु का निपटान करने के लिए इस्तेमाल किया वस्तु या वस्तु है कि संदर्भ से निपटने के लिए समय की एक राशि के लिए कहा नहीं मिल सकता है कुछ" कैसे लागू कर सकते हैं? मैं संपूर्ण संदर्भ का निपटारा नहीं करना चाहता।

3-यदि प्वाइंट 2 काम नहीं कर रहा था, तो क्या मैं एक उपयोगकर्ता सत्र में संदर्भ का एक उदाहरण रख सकता हूं ताकि संदर्भ एक उपयोगकर्ता विशिष्ट नहीं होगा स्पिकिशिप

क्या यह एक संदर्भ में 40 मॉडल रखने का एक अच्छा विचार है?

इसमें कुछ भी गलत नहीं है कि यदि वे सभी तार्किक रूप से एक साथ हैं।

मैं यह संदर्भ सभी उपयोगकर्ताओं के बीच साझा करना चाहता हूं < P> नहीं, आप नहीं करते आप प्रत्येक व्यक्तिगत HTTP अनुरोध के संदर्भ को इन्स्तांत करना चाहते हैं, और HTTP अनुरोध को संभालने से पहले इसे निपटाना है। DBContext कैश करें नहीं

क्या मैं एक उपयोगकर्ता सत्र में संदर्भ का एक उदाहरण रख सकता हूँ ताकि संदर्भ एक विशिष्ट उपयोगकर्ता नहीं हो, जो स्पिकिशियल नहीं है

आपको अपने संदर्भ को कैश नहीं करना चाहिए। हालांकि, आप सत्र में संदर्भ का उपयोग करके पुनर्प्राप्त वस्तुओं को संग्रहीत कर सकते हैं। ऑब्जेक्ट्स को नए संदर्भ में पुन: संलग्न करने के बिना आप अपडेट ऑब्जेक्ट्स / ऑब्जेक्ट ग्राफ़ में सक्षम नहीं होंगे।

UPDATE

यहां DBContext को वर्तमान HTTP अनुरोध से परे नहीं रखा जाना चाहिए:



html - Codeigniter with javascript -


is working with codeigniter and trying to submit a form and then closing it with javascript Am I |

I have a popup function;? I call from the parent page:

  & lt; A href = "javascript: popups ('admin / method / variable', 'click', '400', '400')" & gt; Click & lt; / A & gt;   

And here's the function:

  function declines_popup (url, name, width, height) {var top = parseInt ((screen.availHyight / 2) - (height / 2)); Var left = parseInt ((screen.availWidth / 2) - (width / 2)); Var attribute = "location = 1, position = 1, scrollbar = 1, width =" + width + ", height =" + height + ", top =" + up + ", left =" + left; Window.open (url, name, features);}   

and it opens the form:

  & lt; Php echo form_open ('state / validate_rejection/'.file_results->sender_id.'/'.$this->+session->userdata('id'). '/' .file_results- & gt; id, array ( 'Name' = & gt; 'Rejection_form', 'id' = & gt; 'Disapproval_form', 'onsubmit' = & gt; 'window.forms [0]. Submit (); self.close ();') ); ? & Gt;   

  & lt; P & gt; & Lt; Label & gt; Write the reason for the disapproval? & Lt; Span class = 'req' & gt; * Required & lt; / Label & gt; & Lt; Textarea name = "remarks" rows = "8" maximum-width: 380px "autofocus required>   

< / P>

  & lt; input type = "button" square = "button" value = "cancel" /> gt; & lt; input name = "submit_rejection" id = "Submit_rejection" type = "submit" class = "button" value = "send" /> gt;   

As you can see that the form Action is a URL that goes to the controller / method: Here is the method I use: validate the function _rejection () {$ this-> form_validation- & gt; set_rules ('tip ($ The -> form_validation-> run () == true) {$ sender_ id = $ this-> uri-> Segment); if $ ($ - - 'Remarks', 'Remix', 'Trim | Required'); (3)? $ This-> uri-> Segment (3): 0; $ user_id = $ this-> uri-> Segment (4)? $ This-> uri- & Gt; Segment (4): 0; $ file_id = $ this-> Yuri-> Segment (5)? ​​$ This -> Yuri-> Segment (5): 0; // Here the codeigniter model is called a function, and if the query is passed then it goes wrong, if it is $ rejection = $ this-> Files_model- & gt; Reject E ($ sender_id, $ user_id, $ file_id); If ($ rejection == true) {$ this-> Session-> Set_flashdata ('disapproval_succ', 'successfully rejected'); // redirect ('home'); } Other {$ this- & gt; Session-> Set_flashdata ('disavow_file', 'file declery failure'); }} And {$ this-> Session-> Set_flashdata ('remark__validation_errors', validation_errors ()); }}

ND If the form was successfully submitted or unsuccessful, it would set a flash data

Now I want the form to be finalized Or does not the parent's father near Rolod and Popup ?? | Can anybody please help me get this ?? This is a javascript case, but as long as I'm working with coding, thought it would be the best place to post this thread?

Note: For the poor formatting ... im new user and I do not find the code block: S

If I were to you I would use the jQuery dialog. - If hot water is changing then it already exists. The only thing you need to add is to refresh the page.

asp.net - Where to copy referenced assemblies in a .NET project? -


I have a bunch of links in my current .NET 4.5 project (DLLs). However, right now, they all sit in some local folders in my hard drive when someone works on this same project, these reference assemblies are not in the same local folder. I plan that these sects have some folder in my project Copy and place it in source control.

Is this a good plan? And why do these folders usually go into these things?

Nougat is a better way; However, some conventions are not in the newgate. So here's an example that nopCommerce does

  1. Create a dependency folder (inside your project folder)
  2. Keeps assembly of all third parties inside it.

    Enter image details here

    < Img Src = "https://i.stack.imgur.com/KW4cG.png" alt = "Enter image details here">

     Enter image details here

c# - RichTextBox and tab key -


I have created a rich text box and I have seen that when I press the key of the tab, then nothing is doing it is.

By default, the tab focuses on the next control by pressing tabs. Allow true to accept tab characters from the rich textbox.

See this MSDN article.

php - Error: Cannot redeclare class Facebook -


Like many others, I'm having the following error while using the default facebook.php file: < Pre> Fatal Error: Class federation can not be reclassed in class 160: 160: / wamp \ www \ symfony \ src \ acme \ mainbundle \ controller \ facebook.php

The end of the class declaration in Facebook.php

Here is my code:
  need_once ("Facebook.php"); $ Config = array (); $ Config ['appId'] = '479914672022732'; $ Config ['appId'] = 'd451285c1c38126710980d2b7f2b43b4'; // Everything works fine so far This causes the error $ Facebook = new Facebook ($ config);   

How can I fix this error?

Whatever I have tried:

It has been ensured that there are no other functional classes in the project

changing need_once, include_once, etc. .

If a statement is not required to use a file or to make a Facebook verb, then it already exists

research:

As well as many other posts, but they were related to framework such as Dropl, Zend, WordPress, etc.

What I have learned:

A good way to use Facebook Fashion SDK is by using a composer to get it into the project. Then, when defining the Facebook verb variable, be sure to use backslash, so its:

  $ facebook = new / facebook ($ config);    

Why try this if a bundle does this for you?

Check:



c# - SMTP.SendAsync not working correctly -


I am trying to get acquainted with smtp.SendAsync and for some reason I can not find the mailcas to send the ASIN I am here.

Here I have tried.

  // smtp.SendAsync (mm, blank); Error was attempted, operation of ASC was a complete // Task. Before ((=) => smtp.SendAsync (mm, tap)); No error and no email // SMTP S & MALSync (MM)); Error, async operation was attempted, which was completed to each other / Task.Run ((=) => smtp.SendMailAsync (mm)); No error and no email //smtp.Send(mm); Only one works, but it is delayed and that is what I am trying to get away from far away.   

My code:

  Public static zero email (Elevation height, string to email, string to email) {using (bitmap print canvas = shop drawing Margher, Merging, Elevation and Door Uplift, Rotate FlipType.Rocket 90 Fleep Non)) {(var ms = new memorystream ()) {printCanvas.Save (MS, System.Drawings.imaging.imageformat.png); Ms.osition = 0; (MailMessage mm = new mailmessage (new maildirector (via email), new maildood (e-mail)) {mm.Subject = "[Project:" + elevation.ProjectName + "]" + "+" Shop Drawing for Height .Name; Mm.Body = "Your store pictures are attached to this email in the context of the project:" + elevation.ProjectName + "-> height:" + Upgrades .names; = Attachment to new attachment (MS, height. Name + ".PNGG", "image / PNG"); (On) mm.Attachments.Add; (SmtpClient smtp = New SmtpClient ()) using {//smtp.SendAsync (mm, tap)); // task.root (() => smtp.SendAsync (mm, empty)); //smtp.SendMailAsync (mm)); // task.ru (() => smtp.SendMailAsync (mm)); // is the only one who works smtp.Send (mm); }; }; }; }; }    

@Lloyd help wrap the whole body function in a ThreadPool.QueueUserWorkItem from.

  public static void Imelsopdraing Anddurseludebl (IElevation elevation, string of email, string toEmail) {ThreadPool.QueueUserWorkItem (t = & gt; {(bitmap printCanvas = shopDrawing.Merger.MergeElevationAndDoor (height, rotate Flip Type) Rotate90FlipNone) {{using new MS MemoryStream (MS)) {printCanvas.Save (MS, System.Drawing.Imaging.ImageFormat.Png); Ms.Position = 0; Using (MailMessage mm = new MailMessage (new MailAddress (fromEmail), a new mail address (toEmail))) {mm. Subject = "[Project:" + elevation.ProjectName + "]" + "+" shop for height Drawing; name; Mm.Body = "Pictures of your store are related to this email in the context of the project:" + elevation.ProjectName + "-> height:" + elevation.Name; (In the new attachment = attachment (MS, elevation.Name + ".png", "image / png")) {mm. Atkmen (on) ts.Add; (Var smtp = new smtpClient ()) using {smtp.Send (mm); }; }}; }; }; }); }