Posts

php - Get timestamps of current week -

I have the date time of the present day. I need to get two Unix timestamps for the start and end of the current week. How can I use the dateperiod or dateinterval class? $ Start_of_week = strtotime ('last Monday', $ now); // week BEGINNING finally gives you $ end_of_week = strtotime ('next Sunday', $ now) + 86400; // gives you time at the end of the last day of the week

c# - Entity Framework Code First - Cannot insert duplicate key in object 'db' -

I'm using the new EF code in my project first, and I'm getting a weird error, my mode is : abstract class members {public virtual member of public; ... some other stuff} Class users: Members {public virtual string name; ... some other props are not defined by a new key} Category MyDbContext {public DbSet The result of deployment on SQL Server is fine, I have a member table and a user table (TPC). Now in my main I have the following code: Fixed main () {User X, Y; (MyDbContext ctx = new MyDbContext ()) using {x = ctx.Users.Create (); Y = ctx.Users.Create (); X.Name = "SomeUser"; Y.Name = "SomeUser2"; Ctx.SaveChanges (); }} I save changes: "Unchecked exception: System.Data.Entity.Infrastructure.DbUpdateException: An error occurred while updating the entries See Internal Exceptions for Hui De Tuq. ---> System.Data.UpdateException: An error occurred while updating the entries. See internal exceptions for details. ---> System.Data.Sq...

java - How to get the original request url from a servlet/jsp after multiple servlet forwards -

I'm working on the Cruise Booking app using strokes / tiles which multiple Uses the servlet / jsp to display the right jsp for further performance. But, once you are used to present the page, after reaching the final JSP, call $ {pageContext.request.requestURL} in the JSP it Returns the path of JSP For example Original request: forwarded to / booking / getCruiseDetails Is done: / booking / validateCruiseDeteails.jsp is forwarded to: / booking / validate user. JSP Finally it is forwarded: / Booking / Show Cruises Jsp Then, when I call on $ {pageContext.request.requestURL} / bookmark / showcruiseDetails.jsp me / booking / ShowCruiseDetails.jsp How can you get the original (client created) request URL from JSP that has reached through multiple forward I got the following post on stack overflow Used to indicate that solution, but they do not know how to find the original request URL after a number of requests. You can use a filter to request the a...

javascript - What's the significant use of unary plus and minus operators? -

यदि unary + / - ऑपरेटर्स को रूपांतरण के रूप में प्रयोग किया जाता है संख्या () कास्टिंग फ़ंक्शन, तो हमें एकरी ऑपरेटरों की आवश्यकता क्यों है? इन unary ऑपरेटरों की विशेष आवश्यकता क्या है? यूनरी + ऑपरेटर नंबर ऑपरेटर को अपने ऑपरैंड को परिवर्तित करता है। यूनरी - ऑपरेटर नंबर ऑपरेटर को अपने ऑपरेंड को रूपांतरित करता है, और फिर इसे नकार देता है (प्रति) व्यवहार में, यूनरी - को सामान्य अभिव्यक्तियों में केवल नकारात्मक संख्या डालकर उपयोग किया जाता है, उदाहरण: var x = y * -2.0; यह काम पर एक कम मासिक ऑपरेटर है यूनरी + नंबर () कन्स्ट्रक्टर के समतुल्य है, जिसे फ़ंक्शन के रूप में बुलाया जाता है, जैसा कि नमूना द्वारा निहित है। मैं केवल इतिहास पर अनुमान लगा सकता हूं, लेकिन unary +/- ऑपरेटर कई सी-व्युत्पन्न भाषाओं में इसी तरह व्यवहार करते हैं। मुझे संदेह है कि संख्या () व्यवहार यहां भाषा के अलावा है।

css - CodeIgniter - Simple base_url question -

I'm a little confused. I have a simple controller that loads a view. There is a form in the view and links to some CSS files. I really do not want to do ../../ css / global.css in my link tag. I want to use the base_url () method and then go / css / I know that a friend uses the following: & lt; Link href = "{base_url} css / style.css" rel = "stylesheet" type = "text / css" /> However, I can not get it to work, that uses CodeIgniter 1.7, however, I am using the latest (2.something) version. I'm new to CodeIgniter and I was roaming with it, but I can not even add a simple CSS file: ( My view is in /logic/views/index.php , my CSS files / css / . I think your problem is that base_url is a function in ci 2+, so try it instead link href =" & lt; ? Php echo base_url ()? & Gt; css / style.css "rel =" stylesheet "type =" text / css "/> How do you define base_url If you had other...

Using jquery to get all checked checkboxes with a certain class name -

I know that I can get all the checkboxes on the page on this checkbox: $ ('Input [type = checkbox]'). Each (function () {var sThisVal = (this.checked? $ (This) .val (): "");}); But now I'm using it on a page that has some other checkboxes I do not want to include. How can I change the checked-up check box only to the above code on which there is a certain category on them? $ ('theClass: checkbox: check') To class theClass .

visual studio 2010 - #include -

What's wrong with the code snippet below that VS2010 will not compile it? int m = sqrt (n); (I am trying to ensure that there is a prime prime ...) You have to pass a specific floating point type on sqrt - there is no integer overload. Use eg: long double mi = sqrt (static_cast & lt; long double & gt; (n)); As you include cmath not math.h , I'm assuming that you want C ++ For C, you will need to use eg: double M = sqrt ((double) n); You just error means that the compiler can not automatically select a sqrt function for you - you converted the integer passed to a floating point type And the compiler does not know which floating point type and the sqrt function should be selected.