Posts

javascript - Retrieve css values in Angular JS directives -

I am an angular JS NewBi and I try to write some encoded directories in style button groups. I have a "restricted: 'A' Directorate in which I need to retrieve the parents' padding so that they are usable within. I also try to avoid JQuery, Angular JS looks very clean and I do not want to mess up this feeling. In essence my link function includes: parentScope = element.parent (). Area (); ParentScope $ Watch (parentHeight = element.parent () [0]. CSS ("padding"), function (newvalue, oldview, scope) {var parentHeight = element.parent () [0] .offsetWidth, parentPadding = newValue;} I am getting an undefined error. What is the correct way to access CSS values ​​in the instructions? $ should be given a name for the watch circle (the string) or the function (). If this is the name of the member then its response to the change If this task is to respond to changes in your return value, the result of the assigned assignment is assigned, so you are defi...

javascript - jQuery - Illegal invocation when post -

I am creating a contact form and when I execute it, I receive the following error: Unkit Type Error: Invalid Orientation This is my code, what is wrong, if you want to see the problem live: $ (Document) .ready (function () {var submit = $ ('# contact input [type = "submit"]'); var name = $ ('# contact input [name = "name"]'); Var email = $ ('# contact input [name = "email"]'); var company = $ ('#' Input id [name = "company"] '); var phone = $ (' # contact input [name = "phone"] '); var Skype = $ (' # contact input [name = "skype"] '); Var budget = $ ('#contact ul.budget span.value'); var message = $ ('# contact textarea'); // verification $ (submit). (Function () {event.preventDefault () ; Var go ahead = true; If (name.val (). Length == 0) {$ (name) .addClass ('animated bounce'); go ahead = false;} if (email.val (). Length = = 0) {$ (Forwa...

javascript - Raphaeljs resize canvas to fit content -

I have content in Raphael which is more than the canvas size, I want to extend the canvas and around the canvas Can contain a container so that the user can view all the contents. & lt; Div class = "canvas_container" id = "canvas_container" & gt; & Lt; Svg & gt; & Lt; / Svg & gt; & Lt; / Div & gt; Is there any way that I can resize the canvas of Raphael because all the content has been loaded so that it all goes well? In fact, a "fit to scale" is set to set scrollable overflow to my canvas_container divas, so if I can resize Raphael to fit everything, then it should work. You can iterate all the elements in your Rafael canvas and calculate the size of your image You can get the bounding boxes and then resize the canvas.

ruby on rails - Undefined method errors "errors" for nil:Class -

NoMethodError " The error says where the error is. & lt;% if object.errors.any? & Gt%; & Lt; Ul id = "form-error" & gt; & Lt;% object.errors.full_messages.each Do | Message | & Gt%; & Lt; Li & gt; & Lt;% = Message% & gt; & Lt; / Li & gt; My Question Controller, where I think is the error. Class Questions Controller & lt; ApplicationController before_filter: Certification only: [:, your_questions :, Edit: create, update] # def Index # @question = Question.new # @questions = Question.unsolved (parameter) # end def self.unsolved (parameters) command ('Created_at DESC') where (Solved: incorrect). .paginate (page: parameter [: page], per_page: 3) make def def @question = current_user.questions.build (parameter [: question]) if @question. Flash save [: success] = 'Your question has been posted!' Redirect_to @question rest @questions = Question.unsolved (parameter) render 'index...

How to Convert Javascript Code to C# Code -

I have a JavaScript method I wrote on C # but it does not work. Javascript code var __AM = 65521; Function CC (A) {var C = 1, B = 0, D, E; (E = 0; e & lt; a.length; e ++) {d = a.charCodeAt (e); C = (C + D)% __AM; B = (B + C)% __AM; } Return b My written C # code Private string CC (string A) {var __AM = 65521; Int e; Long d; Long C = 1, B = 0; (E = 0; e & lt; a.Length; e ++) {var p = encoding.unicode.getbits (A [E]. Ostring ()); D = Convert. ToInt32 (P. First ()); C = (C + D)% __AM; B = (B + C)% __AM; } Return b.ToString () + c.ToString (); } JS Test cc ("4JipHEz53sU1406413803"); Result: 1132332429 C # Exam CC ("4JipHEz53sU1406413803"); Result: 172781421 How can I get JS value in C #? This code works: Private string cc (string A) {var __AM = 65521; Int e; Long d; Long C = 1, B = 0; (E = 0; e & lt; a.Length; e ++) {d = (int) a [E]; C = (C + D)% __AM; B = (B + C)% __AM; } Return (b & lt; & lt; 16 | c). Ostri...

c++ - Is there any way to allow multithreading on a program with a loop like this one? -

Is Is there a way to allow Maltithreding on a program with such a loop? Int a = 100000, b = 50, c; While (a) {c = b * a + c; a -;} Windows 7 / code :: blocks default Mingw C ++ compiler / dual-core 4 threaded i5 CPU with the IDE This is not per programming problem. is using 100% of the two core program 1 core with four-core or hyperthreading on your CPU, which is reported as using 25% in Windows Task Manager. You will not be able to 'increase your CPU usage' without threading. (aside, as you are looking at it as' distributed among four threads, because the operating system, if you wish, then changed his mind, which is to run your program Such scheduling issues can not be altered in individual programs (and will not have a significant effect.)

css - Universal selector usage and differences -

इसमें, आप यह देखते हैं: * {-webkit-box-sizing: सीमा-बॉक्स; -मोज़ बॉक्स-आकार: सीमा-बॉक्स; बॉक्स-आकार: सीमा-बॉक्स; }: पहले,: {-webkit-box-sizing: सीमा-बॉक्स; -मोज़ बॉक्स-आकार: सीमा-बॉक्स; बॉक्स-आकार: सीमा-बॉक्स; } उस के बीच का अंतर क्या है, और यह: *, *: पहले, *: के बाद {-webkit-box-sizing: सीमा-बॉक्स; -मोज़ बॉक्स-आकार: सीमा-बॉक्स; बॉक्स-आकार: सीमा-बॉक्स; } इतना अधिक विशेष रूप से, मैं पूछ रहा हूं कि चयनकर्ताओं के बीच क्या अंतर है: : before,: after और *: पहले, *: के बाद इसके अलावा - अगर वे दोनों एक ही हैं, तो उन्हें अलग क्यों है और इसे दोहराएं ? इसे और अधिक सीएसएस लेता है। यह वास्तव में कम नहीं है यदि वे समान हैं। विभाजन के अनुसार दो गति में घोषणा अप रेंडरिंग यह समझ में आता है क्योंकि सार्वभौम चयनकर्ता पहले से ही धीमा है ताकि सभी तत्वों के लिए ब्राउज़र को देखने और एक ही समय में सभी छद्म-तत्व ब्राउज़र को और भी धीमा कर दे। मैंने डेवलपर से पूछा कि कौन प्रतिबद्ध करता है उन्होंने परिवर्तन किया और उन्होंने कहा कि विभाजन के परीक्षण के दौरान सफारी और क्रोम में...