Tuesday, 15 July 2014

asp.net mvc 3 - Linq Grouping looses the child entities -


मेरे पास निम्न प्रश्न हैं:

  var _customers = (c से _db.UserProfiles । (X = & gt; x.ParentCompanies) को शामिल करें। (X = & gt; x.cprofile) शामिल करें। (X = & gt; x.cprofile.PhoneNumbers) को शामिल करें। (X = & gt; x.cprofile.Addresses) में शामिल करें C.ParentCompanies.Any (pc = & gt; pc.CompanyUsers.Any (cu = & gt; cu.UserName == उपयोगकर्ता नाम)) & amp; amp; c.cprofile! = नल) समूह c द्वारा c.FirstName.Substring (0, 1)। ग्राहक में समूह के ऊपर () को नए संपर्क दृश्यमॉडल का चयन करें {प्रथमलेटर = ग्राहक समूह.केय, ग्राहक = ग्राहक समूह})। क्रमबी (पत्र = & gt; पत्र। फर्स्ट लाटर);   

अगर मैं समूह को निकालता हूं, तो यह अच्छी तरह से काम करता है और सभी बच्चों को शामिल करता है (parentCompanies, cProfile, ...) के रूप में जैसे ही मैं समूह को वापस रखता हूँ, वह सभी बच्चों को खो देता है मैं इस मुद्दे को कैसे हल करता हूं?

अपडेट

मुझे लगता है कि मैं उस दृश्य मॉडल को भी शामिल कराना चाहूंगा जिसका परिणाम मुझे निकाल देना है। / P>

  सार्वजनिक वर्ग संपर्क ViewModel {सार्वजनिक स्ट्रिंग प्रथम लेटर {प्राप्त करें; सेट; } सार्वजनिक IEnumerable & lt; UserProfile & gt; ग्राहक {प्राप्त; सेट; }}}    

शामिल करें केवल क्वेरी परिणामों में आइटम पर लागू होता है (अंतिम प्रक्षेपण अर्थात) और उस परिचालन को शामिल नहीं कर सकता जो कि शामिल करें और बाहरीतम ऑपरेशन (जैसे समूहबय ()) के बीच परिणाम के प्रकार को बदलते हैं

यदि आप उत्सुक लोड करना चाहते हैं, तो समूह क्लाइंट-साइड करें (यानी क्वेरी की गणना करें तो परिणाम पर समूहबीआई विधि को कॉल करें)

c++ - A Base class technique for exception handling -


का उद्देश्य सी ++ में एक अपवाद-तटस्थ जेनेरिक स्टैक डेटा संरचना को लागू करना है, केवल टेम्पलेट तर्क डिस्ट्रिक्टर मानते ही नहीं फेंकना। यह चाल संभावित रूप से टेम्पलेट तर्क संचालन (कन्स्ट्रक्टर, कॉपी कन्स्ट्रक्टर, असाइनमेंट) फेंकने के लिए संभाल करने के लिए एक संगत स्थिति में ढेर को छोड़ने के लिए संभालना है।

समाधान में, हर्ब सटर का कहना है

इस समाधान को सरल रखने के लिए, मैंने अपवाद-सुरक्षित संसाधन स्वामित्व के लिए बेस क्लास तकनीक का प्रदर्शन नहीं करने का निर्णय लिया है।

कुछ googling के बाद, मैं डेव द्वारा पाया इब्राहीम 1 99 7 से डेटिंग करते हैं। अपने समाधान में वह बेस क्लास में स्मृति के आवंटन और हटाने का संचालन करता है, और उपवर्ग में स्टैक ऑपरेशन को लागू करता है। इस तरह, वह यह सुनिश्चित करता है कि प्रतिलिपि निर्माता में प्रतिलिपि को कॉपी स्मृति आवंटन से अलग किया जाता है, इसलिए यदि प्रतिलिपि विफल हो जाती है, तो आधार वर्ग नाशक कहा जाता है, कोई बात नहीं।

संदर्भ के लिए, यहां डेव की प्रतिलिपि है मेरी टिप्पणी के साथ कन्स्ट्रक्टर ने कहा:

  // v_ स्टैक तत्वों को भंडारित आंतरिक सरणी को संदर्भित करता है स्टैक (कॉन्स्ट स्टैक & amp; rhs): स्टैकबेज & lt; T & gt; (rhsCount ()) // कन्स्ट्रक्टर पर्याप्त स्थान आवंटित करता है / डिस्ट्रक्टर कॉल को [] उचित रूप से हटाना {जबकि (गणना () & lt; rhs.Count ()) पुश (rhs.v_ [गणना ()]);   

यदि बेस कन्स्ट्रक्टर सफल होता है, तो बेस डिस्ट्रिक्ट में मेमोरी क्लीन अप की गारंटी होती है, भले ही उप-वर्ग की प्रतिलिपि कन्स्ट्रक्टर फेंकता हो।

मेरे प्रश्न हैं :

  1. क्या इस दृष्टिकोण के लिए कोई अन्य लाभ है, जैसा कि ऊपर उल्लिखित है?
  2. जब मैं इस समस्या का हल मेरे स्वयं: <पूर्व> // v_ स्टैक तत्वों को भंडारित आंतरिक सरणी से संदर्भित करता है / बनाम__ v_ // vused_ में आवंटित स्थान की मात्रा है v_ stack में अब तक उपयोग की जाने वाली जगह की मात्रा ( Const स्टैक & amp; rhs): vsize_ (0), vused_ (0), v_ (0) {ढेर temp (rhs.vused_); // कन्स्ट्रक्टर कॉल्स `नई टी [num_elements]` `डिस्ट्रक्टर्स कॉल` को हटाएं [] v_` std :: copy (rhs.v_, rhs.v_ + rhs.vused_, temp.v_); // स्वैप (अस्थायी) फेंक सकता है; } शून्य स्वैप (स्टैक & amp; आरए) {std :: swap (v_, rhs.v_); Std :: swap (vused_, rhs.vused_); Std :: swap (vsize_, rhs.vsize_); }

    इस दृष्टिकोण के मुकाबले मुझे बेस क्लास के लिए कुछ मुश्किलें हैं I क्या कोई कारण है कि इस टेम्प्-कॉपी-टू-स्वैप दृष्टिकोण से बेस-क्लास तकनीक को प्राथमिकता दी जानी चाहिए? ध्यान दें कि डेव और मेरे पास पहले से ही स्वैप () सदस्य है क्योंकि हम इसे अपने ऑपरेटर = ()

  3. डेव इब्राहीम की तकनीक बहुत अच्छी तरह से प्रतीत नहीं होती है (Google के अनुसार)। क्या इसका एक अलग नाम है, क्या यह मानक अभ्यास है, क्या मैंने कुछ याद किया है?

    नोट:

    • डेव का पुश () मानें एक लूप में std :: copy
    • के उपयोग के बराबर होने के लिए चलो स्मार्ट पॉइंटर्स को उत्तर से बाहर रख दें, क्योंकि उनका उपयोग स्मृति को प्रबंधित करने की स्थिति को दूर करेगा स्पष्ट रूप से इस अभ्यास में

      व्यवहारिक रूप से दो कार्यान्वयन समान हैं। वे दोनों एक प्रबंधित स्मृति आवंटन ऑब्जेक्ट सेटअप करते हैं जो गुंजाइश पर बाहर निकलने पर साफ़ होगा यदि कन्स्ट्रक्टर विफल रहता है। एक अस्थायी चर में कॉपी करना अधिक महंगा हो सकता है, लेकिन जैसा कि टिप्पणियों में लिखा गया है, std :: move शायद इस तरह की अतिरिक्त लागत को समाप्त कर देगा आपके विशिष्ट प्रश्नों के उत्तर में:

      1. इब्राहीम का उदाहरण आपके वास्तविक वर्ग के कार्यान्वयन विवरणों से ढेर आबंटन को आगे बढ़ाता है। आपके कोड में, अगर आप अपने सरणी की प्रतिलिपि करने से पहले / बाद में अधिक जटिल मेमोरी हेरफेर करते हैं तो सभी संस्थाओं के सही प्रबंधन को सुनिश्चित करना थोड़ा अधिक कठिन हो सकता है। अन्यथा मुझे पहले विवरण के व्यवहार के संबंध में स्पष्ट रूप से कोई स्पष्ट विवरण दिखाई नहीं देता है।
      2. इब्राहीम के कार्यान्वयन को एक ही स्थान के लिए साफ़ किया गया है। यदि एकाधिक वर्ग स्टैकबेज & lt; T & gt; का उपयोग करते हैं, तो वे प्रत्येक को सुरक्षित रूप से अपनी गतिशील मेमोरी मान सकते हैं यदि वे अपवाद फेंक देते हैं अपने कार्यान्वयन में आपको इसे प्राप्त करने के लिए अस्थायी ऑब्जेक्ट और स्वैप कोड को फिर से लिखना होगा (कम से कम भागों) प्रभावी रूप से, यह कार्यान्वयन स्टैकबेज के कई उप-वर्गों को लागू करने के लिए लाइनों की संख्या कम करता है। हालांकि, यदि आप कुछ अन्य बेस क्लास के शीर्ष पर अतिरिक्त मेमोरी आवंटन चाहते हैं, तो आपके कार्यान्वयन में कई विरासत से बचा जाता है। आपका कोड टेम्पलेट कोड ब्लोइंग को समय / आकार संकलित करने से बचा जाता है - हालांकि मैं आम तौर पर इसे अधिकांश मामलों में बड़े नकारात्मक होने पर विचार नहीं करता है। मैं शायद आपके कोड के करीब कुछ को डिफ़ॉल्ट के रूप में इस्तेमाल करूंगा जब तक कि मैं बहुत सामान्य उपयोग केस कोड लिखने की कोशिश नहीं कर रहा था।
      3. मुझे नहीं पता कि इस दृष्टिकोण का कोई विशिष्ट नाम है - मैं इसे अपडेट करूँगा अगर मुझे एक मिल जाए - लेकिन मैंने इसे कम से कम एक सी ++ प्रोग्रामिंग पुस्तक में पहले देखा है।

file - Open the "open"-dialogbox from cmd -


I want to know that I can open "Open" - Dialog box from CMD, so I can use it to open Right file for (I already know how to open files directly from CMD, but not those who are interested in it)

Currently I am doing a project where I have a program (like program .XA). This program needs a model (eg modelfile.mod) I execute in CMD by writing the program: program.exe modelfile.mod, and it works. I have several models with different names, but the program file always has the same name. Every time I need to perform the program in CMD, I would like to make a batch, where I can select the modf which I would like to execute, after which it will run the program with the modf selected as the input .

So I need to know how to open the "open" dialog box from CMD, and how to get the name of the file selected for use in the execution of the program.

  @echo off setlocal set ps_cmd = powershell "class = "Post-lesson" itemprop = "text"> 

Add-Type -AssemblyName System.windows.forms | Out-Null; $ f = New Object System.window.form.openfileDialoghood; $ f.Filter = 'Model Files (* .mod) | * .mod | All Files (*. *) * *. * '; $ F.showHelp = $ true; $ f.ShowDialog () | Out-null; $ f.FileName "for / F "delims =" In %% I ('% ps_cmd%') set the defined filename = "%% I" if you defined the filename (the echo you chose% filename%) Other ( You choose not Skvet!) Goto: EOF

or if you want to break the powers Elseedilets for easy maintenance:

  @echo off setlocal set "Ps = add-type -AssemblyName System.windows.forms | out-null;" set "ps =% ps% $ f = new object system. Windows.form.openfile dialog;" set "ps =% ps% $ f .Filter = 'Model Files (* .mod) | *. Mod | All Files (*. *) | *. *'; "Set" ps =% ps% $ f.showHelp = $ true; "Set" ps =% ps% $ f.ShowDialog () | Out-null; "Set" ps =% ps% $ f.FileName "for / f" delims = "%% I ( 'powershell'% ps% '') in" filename = %% I "set that defines the file name (echo you % have chosen filename%) other (echo you chose not Skvet!) goto: EOF   

set see the documentation for cruelly taken.) other properties written (PowerShell commands, like Title and Initial Directory .

methods - Repeated tasks - spawn new processes or run continuously? -


We have around 10 different Python scripts that download data from the Web, read the data from the database and that database Back in the data write in They do it repeatedly every 10 seconds (or 10 seconds after completion of the final work).

The question is, what is the best way to run these tasks? I can think of some ways:

  1. There is some time that runs the work then sleeps for the interval. It can be carefully guarded like a supervisor, to ensure that it is always there.

  2. By executing the script only once, and once every 10 seconds, another process.

  3. Ask for a script run for 1 hour (every 10 seconds for one hour), and on keeping a watchdog, make sure the job runs once again. .

    I would like to avoid long-running procedures which actually do something because I do not want to work in memory over a long period of time.

    Additional information

    1. The scripts are different because they retrieve data from each different source, and queries, Calculate and separate data in the database.

    2. The work is done every 10 seconds, because the data is being retrieved in real-time, and we should not only update it continuously, but also keep it All historical data in the database

    3. There are lots of resources being used by scripts - MySQL connections, HTTP connections, readies connections, etc. In particular, using the first long-standing approach, we have encountered problems, MySQL connections (things like MySQL servers have gone, although all connections were closed). Therefore, leaning toward scripts to run in less time.

      What are some common approaches to this?

      Unless your script is in some way memory leak (not quite likely), they should all be identical. Therefore, for quite ease ( your time programming / debugging time is more expensive than some milliseconds at the time of machine, even every 10 seconds!) I go to a script which Checks every 10 seconds.

      OTOH looks like busy work in every 10 seconds, can not you set up so that whatever you are monitoring tells you when changes happen? Or batch records so that you can get a day's worth, can you?

c# - Passing object to a WebMethod through jquery ajax -


I am trying to pass an object defined to any page method. I'm trying to pass data to collect it from three text boxes. [System.Web.Services.WebMethod] Public Fixed String saveDataToServer (Object CSobage) {// Function Body} {/ P>

Page Method / Code>

JavaScript / jQuery

  $ ("# osmSendMsg"). Click (function () {debugger; var cntDetails ({# CntName: $ ("# osmContactName", "wait", "/ ContactUs.aspx / saveDataToServer", "csObj");});   

PostDataToServer

  // Post data to server (AJAX call). Function PostDataSource (DataTaused, Stormat Gateto Show, StormTyocol, JasonObjectName) { Debugger; / * Includes JSON object in datacentend SubmitType 1 == Submit normal; 2 == Submit and print Strmessageto Show the text that you please wait In the window. * / Var tempurl = strMethodToCall; var tempdata; $ .ajax ({url: tempurl, type: "post", async: false, data type: "jason", data: "{" + json object name +: "+ JSON.stringify (dataToSend) +"} ", // Timeout: 30000, Content Type:" Application / Jason; Charset = UTF-8 ", Success: Function (Data) {tempdata = data;}, Error: Task (result) {tempdata = null;}}; // Ajax call return end of tempdata;} // closing of post data   

is now reaching the call web method. no problem. I am getting an object too. But how do I process the object?

Inside the data

As you can see, The same is what I am getting, I also tried to declare a class and pass it as a parameter .. but all its assets are empty. If you see that the data is visible as a key, then the value pair. I can convert it to a dictionary, but I believe it is a complex solution.

key - value added

A simple solution was welcomed Will go!

Please find the appropriate way to do this, you too can do it.

reporting services - Type Problems with Filter Expression in SSRS -


SQL Server 2008 R2 is using the bid to design the report.

I have a table and I'm just trying to show a certain line that there are better ways to do this, but I am coming across an error with the expression of the filter And how do I get my initial work done, I want to understand the filtering

I used to type the filter expression ("integer" to be typed):

  line number (none) = 1   < P> This error returned:  
  type can not compare system data. String and system. IN 32 I got a solution of it, from 1 to "= 1" has been evaluated as a string to replace 1.  

So I did it:

  Row number (nothing) == 1   

This has not changed anything I have tried the same thing in the first part of the expression:

  = line number (nothing) = = 1  < / Pre> 

It changed the problem of a deployment (still makes, which is disappointing):

  error pvInvalidDefinition: definition of report '/ ReportName' is invalid   

I then subscribed CIN to Roenambar Tried to sum: CINT (Ronamembar (none) = = 1

Then I can apply it, but the error only changes first one:

  Data type can not be compared to system.String and System.Int32.   

No matter what I try here I can not either report or report to me I get an error that I am comparing a string to an int.

royn number one east Coax, so it seems that it should work. I have tried to use the name of the dataset in place "nothing" but this does not change what I see.

I know there are several ways to solve my initial problem, but I am curious why the filter expression is invalid.

"post-text" itemprop = "text">

It is better to hide a line with visibilty property. Just click on a text box and visit visibily tab. Now let's go to the expression by clicking on Show or Hands.

Hide this default Then type an expression there to hide the row. = IIf (no (line number = 1), TRUE, FALSE)

Let me know if you have any error

c++ - Cartesian product of several vectors -


Similar questions have been asked before but I can not find an exact match for my question.

I have 4 vectors, each of which contains 200-500 4 digits integer. The exact number of elements in each vector varies, but I can fix it for a specific value. I need to find all possible combinations of elements in these 4 vectors.

Example:

v1 [10, 30] v2 [11, 45] v3 [63, 56] v4 [82, 9 8]

Something like this will happen:

[10, 11, 63, 82]; [30, 11, 63, 82]; [10, 45, 63, 82]; [10, 45, 56, 82] etc.

Is there a common name for this algorithm, so can I get its online reference? Otherwise any suggestions for implementing it in C ++ would be useful. Performance is not more of a problem because I need to run the algorithm only once, is anything made in STL?

not much of the algorithm ... <(vector & lt; int & gt; :: constiiterator for i2 = v2.begin (vector & lt; int & gt; :: const_iterator i1 = v1.begin (); i1! = V1.end (); ++ i1);); I2! = V2.end (); ++ i2) for vector const_iterator i3 = v3.begin (); i3! = V3.end (); ++ i3) (vector & lt; int & gt; :: const_iterator i4 = v4.begin (); i4! = V4.end (); ++ i4) COAT & lt; & Lt; "[" & Lt; & Lt; * I1 & lt; & Lt; "," & Lt; & Lt; * I2 & lt; & Lt; "," & Lt; & Lt; * I3 & lt; & Lt; "," & Lt; & Lt; * I4 & lt; & Lt; "]" & Lt; & Lt; Endl;

Python array combining -


I'm trying to close some Python code in Java. I am not familiar with Python and have never seen it before in any language:

  return [c,] + s   

What does it mean? Particularly [C,] Is it adding two array or something? S is an array of integers and c is integer Full function is below (from Wikipedia)

  DIF signal (self, m, z): self Urine (m) s, u = [none] * self N, random Randint (0, shelf) c = v = self. For e (u) i in category (z + 1, self.n) + category (z): s [i] = random.randint (0, auto.) V = self.E (v ^ self.g (S [i], self.k [i] .e, self.k [i] .n) if (i + 1)% self.n == 0: c = vs [z] = self.g (v ^ U, self.k [z] .d, self.k [z] .n) return [c,] + s   

Thanks a lot!

Comma is unnecessary It's just making an element list:

  & gt; & gt; > [1,] [1]>> [1] == [1,] is true   

practice tuples Comes from making Python; an element requires a comma as a comma Is:

 > (1) 1>>>> (1,) (1,)>> <1>> gt; & gt; ; (1) == (1,) Incorrect   

[c,] + s statement c as the first element.

matlab - Error in curve fitting and other syntax issues -


I have a set of vector 'measured_data' that contains 200 sample data that are positive floating point values. I have a hard time finding a model that fits this data. The following code returns an error in each step, i.e. the prediction of the comment (), throws another error in the next command ... so nothing is working. I went through the well documented and understood me I do not know what the problem is and where I am going. I would be really grateful if a person could pass through code and help reduce problems. Thanks.

  Undefined function for the input argument of 'double' type 'prediction' without error in the title (line 157) model 2_pread = approximate (model 2_koff, model2_data, 1);   

Code

  model1 = ar (measured_data, 2, 'yw'); Model2 = ar (measured_data, 5, 'or'); Coeffs1 = model1.a; Model1_coeff = [coeffs1 (2) coeffs1 (3)] coeffs2 = model2.a; Model2_coeff = [coeffs2 (2) coeffs2 (3) coeffs2 (4) coeffs2 (5)] x (1) = 0.0; X (2) = 0.0; Y (1) = 0.0; Y (2) = 0.0; Y (3) = 0.0; Y (4) = 0.0; Fix for Model1 by inserting coefficient values ​​of% I = 3: 200x (i) = coeff1 (2) * x (i-1) + coeff2 (3) * x (i-2); End model 1_data = x; Fix for model2 by inserting coefficient values ​​of% i = 5: 200 y (i) = coeff2 (2) * y (i-1) + coeff2 (3) * y (i-2) + coeff2 (4) * . Y (i-3) + Koff 2 (5) * y (i-4); End model 2_data = y; Model1_pred = Estimated (model 1_copf, model1_data, 1); Model1_residual = model1_data-model1_pred; Model1_err = resid (model1_coeff, measured_data); % Forecast error model 2_ er = resident (model2_coeff, measured_data); Subplot (1,2,1); Plot (model1_err); Subplot (1,2,2); Plot (model2_err); Model1_mse = sqrt (meaning ((measured_data-model1_coeff) ^ 2).); % Mean class error model2_mse = sqrt (meaning ((measured_data-model2_coeff). ^ 2)); Comparison (measured_data, model1_coeff, 'g', model2_coeff, 'b');  

If you are inputting wrong type input it is possible to get this error. For example, the standard example in the documentation works fine for me, but if I try something unnecessarily then I can get the same error:

  predict (1,1, 1)   

Check this:

  1. The first input is an idmodel or idnlmodel object (idpoly, which you will get from AR, ok).
  2. The second input (data) is an isadet object (timaries).

Zimbra unable to email from mobile after upgrade to 8.0.3 -


We recently upgraded our Zimbabo FOSS email server to version 8.0.3, and when all cell phones (Android and iPhone) are upgraded, the error recipient "email@domain.com" was rejected by the server It was given because it does not allow relaying. '

I can not find anything that looks has changed. Does anyone know that this is a known issue with Version 8.0.3?

Thank you for any help with this issue ... I am not making any difference, or even finding anything that really relates to it ... < / P>

edit

  as an update: I got the following information in my Zimbra.log ... Mar 26 16:58:21 Server Postfix / smtpd [22783]: NOQUEUE: Disclaimer: RCPT from: 29.sub-174-237-227.myvzw.com [174.237.227.2 9]: 554 5.7.1 Service Unavailable; Client host [174.237.227.29] blocked using zen.spamhaus.org; Http://www.spamhaus.org/query/bl?ip=174.237.227.29; Me@server.net> = & Lt; To do = & lt; Me@server.net> Proto = ESMTP Hello = & lt; [10.246.232.147] & gt; After researching the above edits, we came to know that the problem (apparently) was related. SpamHaus.org blocks Email Relaying through Zoomabb cell providers I closed the spammer and now everything is working fine ...  

Hopefully someone else has it If the problem helps ...

java - Why do I get a ClassCastException and how do I fix it? -


Why do I get Class Cast Extension and how do I fix it? The code I got is the following exception message:

Exceptions to the thread "main" java.lang.ClassCastException :

  java.lang String can not be inserted into Java   

Here is my code:

   

Code> Import java.util *; Public class highscore {public static zero principal (string agre []) {array list & lieutenant; String & gt; Name = new ArrayList (); ArrayList & LT; Integer & gt; Score = new arrivate (); Start (name, score); Sort (name, score); Display (name, score); } Public Static Zero Start (ArrayList Name, ArrayList Score) {Scanners = New Scanner (System.in); Enter a name for {System.out.println ("Score #" + (i + 1 + + ":") for (Int i = 0; I ++); Names.add ( In.next ()); System.out.println ("Enter score for score #" + (i + 1) + ":"); Scores.add (in.next ());}} ( Constants = i; 0; i

The problem is that you score in the Reading String , and trying to put the score in an ArrayList of integer .

You will either need to read the score in the form of an integer, or parse the score in round.

See the API link below



How to convert XML to hash in Rails where empty array and nil values are preserved -


When I convert a XML structure into the hash from the train to Hash.from_xml (@xml) I do not distinguish the parser between the empty arrays and zero values, while the xml shows the nodes that are immediately eliminated from the form of an empty array as \ , e.g. & lt; Audio_languages ​​/ & gt; vs. properties with which the attribute zero = "true" is defined as zero values.

XML structure (which controls how I generate) looks like this:

  & lt; Feedback & gt; & Lt; Medias & gt; & Lt; Media & gt; & Lt; ID & gt; 1 & lt; / Id & gt; & Lt; Name & gt; Media-1 & lt; / Name & gt; & Lt; Audio_languages ​​/ & gt; & Lt; Avg_rating nil = "true" & gt; & Lt; / Avg_rating & gt; & Lt; / Media & gt; & Lt; Media & gt; & Lt; ID & gt; 2 & lt; / Id & gt; & Lt; Name & gt; Media-2 & lt; / Name & gt; & Lt; Audio_languages ​​/ & gt; & Lt; Avg_rating nil = "true" & gt; & Lt; / Avg_rating & gt; & Lt; / Media & gt; & Lt; / Medias & gt; & Lt; / Reaction & gt; Expected output from   

Hash.from_xml (@xml) will be:

  {"response" = & gt; {"Medias" = & gt; {"Media" = & gt; [{"Id" = & gt; "1", "name" = & gt; "Media-1", "audio_languages" = & gt; [], "Avg_rating" = & gt; Niil}, {"id" = & gt; "2", "name" = & gt; "Media-2", "Audio_Languages" = & gt; [], "Avg_rating" = & gt; Instead, I get zero values ​​for  audio_languages ​​ and  avg_rating : ]}}}   

P>

  {"response" = & gt; {"Media" = & gt; {"Media" = & gt; [{"Id" = & gt; "1", "name" = & gt; "Media-1", "audio_languages" = & gt; Zero, "AVG_RATING" = & gt; Zero}, {"id" = & gt; "2", "name" = & gt; "media-2", "audio_languages" = & gt; Zero, "AVG_RATING" = & gt; Zero}]}}}    

I used the libxml and I I have finished parsing the nodes using I if I checked the nodes sign I'm checking to figure out if I want to convert a zero value to an empty array such as

  #Usage:. Hash.from_xml_with_libxml (xml) is required 'xml / lib xml' # # http://movesonrails.com/articles/2008/02/25/libxml-for-active-resource-2-0 Adapted from class hash class & Lt; & Lt; Self def by_xml_with_libxml (xml, strict = true) LibXML :: XML.default_load_external_dtd = false LibXML :: XML.default_pedantic_parser = strict results = LibXML :: XML :: Parser.string (xml) .parse return {result.root.name. To_s = & gt; Xml_node_to_hash_with_libxml (result.root)} End Def xml_node_to_hash_with_libxml (node) # If we are the foundation of the document, hash start the node.element? If node children? Result_hash = {} node. Do every_child | Children Result = xml_node_to_hash_with_libxml (child) if child.name == "text" if! Child.next? And! Child.prev? If results_ship [child.name] .is_a (object :: array) results_ship [child.name] , are arrays, and # like & lt nodes; AVERAGE_RATING "zero" = "true" /> Nil values ​​are if node.to_s.match (/ ^ \ & lt; (. +) \ / \ & Gt = $ /) & amp; Amp; Zero == node. Warranty ["zero"] Return [] End return zero end and back node content. CT_O_S End End End End    

android - Prevent layout to resize after background -


I

I'm setting up a backgound to RelativeLayout. The point is that the layout has been changed after the size of the image, which I do not want. I want to shape the layout after two text scenes.

Still layout to prevent the small size of the background?

This XML-code

  & lt; RelativeLayout android: id = "@ + id / HUD" Android: Layout_width = "Match_parent" Android: Layout_height = "Wrap_content" android: background = "@ + Drobl / Hud_bak Ground" Android: Leaut_vet = "1" & gt; & Lt; TextView android: id = "@ + id / lblScore" Android: Layout_width = "Wrap_content" Android: Layout_height = "Wrap_content" Android: layout_alignParentLeft = "true" Android: layout_centerVertical = "true" android: text = "Score:" / Gt; & Lt; TextView android: id = "@ + id / txtScore" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" Android: layout_alignBaseline = "@ + id / lblScore" Android: layout_alignBottom = "@ + id / lblScore" Android: layout_toRightOf = "@ + id / lblScore" android: text = "00" / & gt; & Lt; / RelativeLayout & gt;   

Regards

I think all you need Android Android had to change: layout_width = Android "match_parent": layout_width = relativeLayout the "wrap_content for", so size will be according alone textViews

Why add :. Layout_weight = "1"? Is this just a part of your layout file?

If so, it is in a vertical linear Lyaut, so use it:

  android: layout_width = "match_parent" android: layout_height = "0px" < / code>  

and if it is in a horizontal linear layout, so use it:

  android: layout_width = "wrap_content" Android: layout_height = "0px" < / Code>   

JavaScript seeting selectedIndex to be blank for select do not work -


I'm trying to make a default selection to clear a dropdown selection.

If I select the dropdown with HTML, it works, however, when I generate the same dropdown with Javascript, it does not work.

Please

  & lt; Id = "myDropdown" & gt; & Lt; Options & gt; Option 1 & lt; / Options & gt; & Lt; Options & gt; Option 2 & lt; / Options & gt; & Lt; Options & gt; Option 3 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Div id = "yo" & gt; & Lt; / Div & gt; Document.getElementById ("myDropdown"). SelectedIndex = 1 var for my_select = document.createElement ("I select") (var i = 0; i & lt; 3; i ++) {my_select.options [i] = new option (i, i)} my_select .selectedIndex = -1 document.getElementById ("yo"). AppendChild (my_select)   

Note that the first dropdown is empty, and the second is not.

Apparently you select a of selectedIndex element that has not yet been entered in the DOM

If you move my_select.selectedIndex = 1 after the attachment So it works fine.

  var my_select = Document.createElement ("select"); For (var i = 0; i   

.

Java program only returns the input, does not show calculation result in methods -


For calculating factor, Euler number and Euler power x, I have been prepared under the "Factorial" class and the "vergate" class

When I execute the program; It gives me the same input number for each method. Is anyone advised that what is the problem, thank you very much for your kind assistance?

This is the actual category:

  The factual {public zero instruction () {System.out.printf ("Enter your choice: \ N", "1 to calculate a factual value of integers. \ N", "To calculate mathematical constant e For 2. \ N "," 3, e ^ x. \ N "," to end 4. 4); } // End of instructions // ******* A ******** Public Double Count InputValue (int n) {int ans = 1; For (int i = 1; i & lt; = n; i ++) {ans = ans * i; } Return ans; } // End method calculation InputValue // ****** b ******* Public double calculation_account_A_ value (double conditions) {double e = 1; For (Int i = 1; i & lt; terms; i ++) E = = ((double) 1 / (Count InputValue (i))); Return e; } // ******** C ********** Public double compute_ex (double rule) // method E Power x {int x = 1; Double e = 1; For (int i = 1; i & lt; terms; i ++) E + = (MathPo (X, I) / (GNU (value)); X ++; Return e; }}   

and class behavior including main:

  import java.util.Scanner; // programmable scanner uses public class behavior {Private stationary scanner input; Public static zero main (string [] args) {factual myfactorial = new factor (); Myfactorial.instructions (); System.out.printf ("?"); Int likes; Input = new scanner (System.in); Like = input.nextInt (); Switch (like) {case 1: System.out.printf ("Enter numbers for factual calculation"); Int number = 1; Number = input.nextInt (); Myfactorial.calculateInputValue (number); // If the integer is larger or 0, then print equal to "numeric:% d" (number> = 0) System.out.printf ("factorial is equal:% d \ n", number); // Otherwise, the print "input value is not valid." Else System.out.printf ("Error: input value is not valid. \ N"); break; Case 2: System.out.printf ("Enter the number of words to calculate e continuity. \ N"); Number = input.nextInt (); Myfactorial.calculate_e_value (number); System.out.printf ("e value% 2d \ n", is the number); break; Case 3: System.out.printf ("Enter x value of X. stability. \ N"); Number = input.nextInt (); Myfactorial.compute_ex (number); System.out.printf ("e power x% 2d \ n", is the number); break; Default: myfactorial.instructions (); }}}}    

You should retrieve one method in each variable and then print it . For example:

  int val = myfactorial.calculateInputValue (number); If (Val & gt; = 0) System.out.printf ("Factorial equivalent:% d \ n", val);   

You call this method everywhere and print the returned value. This will solve your problem.

custom roles and user adminstration in ASP.net MVC 4 -


I am implementing my frist web application on asp.net mvc 4 and show me the difference according to my users roles (Show some menus for certain roles and hide them from others) Basically what I want is to manage my users and roles I understand that security is an important part of my application, so I Safe O you do not want to risk the safety I, while other options for it.

My question is, what was previously made on some MVC 4? Is it worthy of a small site for me? (I do not expect more than 50 concurrent users) Is it better to implement my own user administrator? If so, where can I start? What I've found so far is a subscription provider, but I think it's too big for this, rather instead of user registration, new users will be connected by the system administrator.

Thanks for taking the time to read this, any feedback would be appreciated!

I would recommend the default membership provider as it does with the use of the best practices of the security industry ( I.e. salted hash) However, if this is redundant, then there is a simple subscription provider called

java - Stopping and Restarting a Stopwatch -


This compares the time to find Square Route using the method of Math. Sqrt and Newton. I'm going to add methods to do that allow the client to stop and restart the stopwatch, but I'm not sure how to do this. Unfortunately, the discovery of other questions did not result in much luck. As it is for a class, I do not want me to be fully answered, but some advice, or a tutorial link, which will be good for completing my goal Thanks for any help. Public class stopwatch {Private finals start long; Public stopwatch () {start = System.currentTimeMillis (); } Public Repeat Time () {Long Time = System.currentTimeMillis (); Return (now - start) / 1000.0; } Public static zero main (string [] args) {int n = integer Paracet (Argos [0]); Double column = 0.0; Stopwatch swMath = new stopwatch (); For (int i = 0; i

It is very good that you are honest about that of a class And that you do not want to respond to it is a good start to learn :)

Here's how I will contact this work:

First of all , I just define the missing method. Again, I start writing (as inline commentary) methods should do. What does it mean to reset the stopwatch, and what does it mean to stop it? You can draw parallel to the "real life" stopwatch, you should start it, and after defining the rules, it will be possible to translate it into code.

It may be a little more precise than your expectation, but I'm sure you will be there with the right attitude, as you think! Good luck!

objective c - Any way to see who is triggering changes re: key value observing? -


I am using a key value to perform special tasks while changing certain properties (e.g., the custom UIView's relay Subvuctions change its frame or boundary whenever it is ever) Is there any way to see that (ie, the function) is triggering this change? My Inspection Validate: Object of: Change: Reference: does not help because I do not think I can see who caused a change in Frame or Edit

Edit

In my specific example, I did not know who / what is changing the dimensions of my UIView. 1: Screenshot of my stack trace, paused when the frame / border is called within the inspection value ...

Also keep in mind that it is only for debugging purposes is.

stack trace

In general, no, in addition to looking at the stack trace, you do not know how KVC mutation (and therefore the KVO notification) could be the reason. In this case, - [UIView (geometry) _applyAutoresizingMaskWithOldSuperviewSize] appears to be a criminal, but more commonly it seems that the process of triggering the notification is the process of inconsistent and carrying out. Since this change has not come from your code, I'm not sure how it will know where it came from.

There are some tips that over your code of observation on the "Knowledge" stack above your code above the heap. You can hide a flag / value in the [[NSThread currentThread] threadDictionary] and then check in your supervisor method (remember that the flag is clearly removed before stack frame returns Let's do this), and on top of it, it will not give you any information about such cases, where your code is not directly triggering the change.

php - How to use/write mysql_real_escape_string in PDO? -


इस सवाल का पहले से ही एक उत्तर है: < / P>

  • 3 जवाब

    मेरे कोड में मैं कोशिश कर रहा हूँ एक पीडीओ वक्तव्य में mysql_real_escape_string अनुवाद करें। क्या पीडीओ में mysql_real_escape_string लिखने के लिए किसी पर कोई टिप है?

    I mysql_real_escape_string का उपयोग दो पंक्तियों में: $ userName = mysql_real_escape_string ($ _ POST ['उपयोगकर्ता नाम']); $ Password = sha1 (mysql_real_escape_string ($ _ POST ['पासवर्ड']));

      & lt;? Php ob_start (); session_start (); शामिल ( "../ डेटाबेस / db.php"); $ UserName = mysql_real_escape_string ($ _ POST ['उपयोगकर्ता नाम']); $ Password = sha1 (mysql_real_escape_string ($ _ POST ['पासवर्ड'])); गूंज "& lt; br & gt; उपयोगकर्ता:" $ UserName; गूंज "& lt; br & gt; pw:"। $ पासवर्ड; $ Query = "tbladmin से * चुनें * जहां admin_usr_name = '$ userName' और admin_pwd = '$ password'"; $ Res = mysql_query ($ क्वेरी); // $ पंक्तियाँ = $ res- & gt; प्राप्त करें (पीडीओ :: FETCH_ASSOC); $ पंक्तियां = mysql_fetch_assoc ($ res); गूंज "& lt; br & gt; numrows" Mysql_num_rows ($ res) "& Lt; br & gt;"; // $ find = $ query- & gt; तैयार करें ("tbladmin से * चुनें, जहां admin_usr_name = '$ userName' और admin_pwd = '$ password'"); // $ खोज- & gt; निष्पादित करें (); // if ($ find- & gt; fetchColumn () & gt; 0) // {// प्रतिध्वनि 'आपने इसे बनाया, स्वागत'; // $ _SESSION ['उपयोगकर्ता नाम'] = $ पंक्तियां ['admin_usr_name']; // $ _SESSION ['admin_id'] = $ पंक्तियाँ ['admin_id']; // हेडर ("स्थान: ../pages/content.php"); //} // else // {// प्रतिध्वनि 'उपयोगकर्ता नाम और पासवर्ड मैच न करें & lt; br / & gt; पुनः प्रयास करें'; // हेडर ("स्थान: ../index.php?loginerror=yes"); //} यदि (mysql_num_rows ($ res) & gt; 0) {$ _SESSION ['उपयोगकर्ता नाम'] = $ पंक्तियां ['admin_usr_name']; $ _SESSION ['admin_id'] = $ पंक्तियां ['admin_id']; हैडर ("स्थान: ../pages/content.php"); } Else {गूंज 'उपयोगकर्ता नाम और पासवर्ड मैच न करें & lt; br / & gt; पुनः प्रयास करें'; शीर्षलेख ("स्थान: ../index.php?loginerror=yes"); }   

    ? & Gt;

    यह है कि मैं पीडीओ के साथ क्या करने की कोशिश कर रहा हूं

      $ host = "localhost"; $ User = "root"; $ Password = "root"; $ Db = "ब्लॉग"; $ Dsn = "mysql: मेजबान = $ होस्ट; dbname = $ db; वर्णसेट = यूटीएफ 8"; $ Opt = सरणी (PDO :: ATTR_ERRMODE = & gt; PDO :: ERRMODE_EXCEPTION, PDO :: ATTR_DEFAULT_FETCH_MODE = & gt; PDO :: FETCH_ASSOC); $ Pdo = नया पीडीओ ($ डीएसएन, $ उपयोगकर्ता, $ पासवर्ड, $ ऑप्ट); $ Username = $ _POST ['उपयोगकर्ता नाम']; $ पासवर्ड = $ _POST ['पासवर्ड']; $ Query = "tbladmin से चुनें * जहां admin_usr_name =: userName और admin_pwd =: passWord"; {$ Databas = नया पीडीओ ($ डीएसएन, $ उपयोगकर्ता, $ पासवर्ड) का प्रयास करें; } पकड़ (PDOException $ e) {गूंज 'कनेक्शन विफल:'। $ ई & gt; getMessage (); } $ स्टेटमेंट = $ डेटाबेस- & gt; तैयार ($ क्वेरी); $ स्टेटमेंट- & gt; निष्पादित करें (ऐरे (': उपयोगकर्ता नाम' = & gt; $ उपयोगकर्ता नाम, ': पासवर्ड' = & gt; $ पासवर्ड)); $ पंक्ति = $ कथन- & gt; प्राप्त करें ();   

    मुझे हमेशा यह त्रुटि मिलती है: कोई सदस्य फ़ंक्शन तैयार करें () गैर-ऑब्जेक्ट पर

    बिंदु तैयार किए गए बयानों का उपयोग करके पैरामीटरयुक्त क्वेरीज़ और बाध्य मानों के साथ आपको mysql_real_escape_string जैसी चीज़ों की ज़रूरत नहीं है।

    बद्ध मूल्यों और पैरामीटरयुक्त प्रश्नों / तैयार बयान का उपयोग कैसे करें।

    मुद्दा यह है कि आप एक एसक्यूएल क्वेरी लिखेंगे:

      $ query = $ pdo- & gt; तैयार करें ("चुनें उपयोगकर्ता से कहां उपयोगकर्ता नाम = और पासवर्ड =?");   

    तब आप के स्थान पर बाध्य मूल्यों में गुजरेंगे? प्रतीकों, इस प्रकार प्रश्न केवल कभी भी सचमुच के रूप में चलाया जाता है:

      $ query- & gt; बाईंदपरम (1, $ उपयोगकर्ता नाम); $ Query- & gt; बाइंड पैरा (2, $ पासवर्ड);   

    किसी भी प्रकार की एसक्यूएल इंजेक्शन प्रयास जैसे कि 1 '; उपयोगकर्ताओं को ड्रॉप - ऊपर दिए गए चर के अंदर अब काम नहीं करेगा क्योंकि इसे शाब्दिक कहा जाएगा

css - Scroll html page to specific tag and stay in focus even though dynamic content is being added in the page -


I have a page that's dynamically a & lt; Img & gt; Inserts the images in the form of a & lt; Div & gt; , many of these & lt; Div & gt; . Each & lt; Div & gt; above and lt; H1 & gt; The text has a unique ID, such as when I use that ID in an anchor tag, the page will scroll down to & lt; H1 & gt; and & lt; Div & gt; Show Container The problem occurs when the Ajax code takes seconds to fetch the page from someone else, for example, and for example, many & lt; Div & gt; The height of the containers varies, before the images the page scrolls with the "office" tag, the time of the insert Containers that I can scroll to other & lt; Div & gt; The height of the containers was trying to be lost as a change.

Is there a way to focus the browser & lt; Div & gt; , and scroll up and down according to the dynamic changes in the page? And when the user clicks or scrolls manually, can the focus break?

Thank you.

I think the best option is to set the height of the divisions with images so that the page is always fixed Height Then when it scrolls down, the images will not be out of position when loading.

You can also look at javascript to see if there is a URL in #, and then stop jumping to the page is completely full.

Check the hash with

  (if location.hash) {// stopped scroll window. ScrollTo (0, 0); // Add the function to wait until the page is fully loaded / scroll to the anchor}    

css - Height issue on mobile device -


I'm coding a website for mobile. This is the first time I have done this, so I do not know that I What am i doing

Everything is fine if the text fits to the height of the page, but when it is higher than the altitude height of the mobile screen, the page gets messed up (it adds padding to the right of the page and I have Some white space).

I tried

  body {height: auto}   

and

  body { Height: 100%}   

I'm sure I'm doing something wrong please help. Thank you

I believe your problem is because the screen is automatically fitting because size Closed, to avoid this, you should include this simple part of the code at the top of your page

  & lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1.0" & gt;   

This is freed from the auto-fitting of some mobile browsers. An example of Mozilla is

In addition, take a look at responsive CSS media queries as they are mobile (the best way to handle mobile phones)

Hope that helps.

perl - how to one line text format and convert to multi line text? -


I'm using noob so I want some help. For example, I have anonosis sequence in the file. In a line so I need 60 aminoids in one line. How can I do that using Pearl?

  open your $ infiline, '', '/ path / to / sequence file' "Or $$! Open your $ outfile, '& gt;', "/ path / to / newfile" or $$! While joining {print $ outfile (my $ line = & lt; $ infile & gt;) ("\ n", partition (/ \ / s,, $ line)). "\ N"; } $ Infile; Around $ outfill;    

php - Want to order eventbrite events list so upcoming events show up first -


How can I modify the following calls so that incoming events appear first. Currently this order is very random; I need to show the most recent events at the top and no previous event should be displayed ...

  & lt; Div class = "events-links" & gt; By & lt;? Include "eventbrit / eventbrit.fp"; $ Authentication_tokens = array ('app_key' = & gt; 'APP_KEY', 'user_key' = & gt; 'USER_KEY'); $ Eb_client = New EventBack ($ authentication_token); $ Event = $ eb_client- & gt; User_list_avents (); ? & Gt; & Lt; Span class = "motivational" & gt; Upcoming events & lt; / Span & gt; & Lt ;? = Eventbrite :: eventList ($ event, 'eventListRow'); ? & Gt; & Lt; / Div & gt;   
  • These are not my tokens; I have changed them just before posting random characters :)

    If you use The user_list_events method, you can filter your code by adjusting the event_statuses field. Valid options include: live, start, or end up to display only upcoming events, for example: event_statuses = live .

    Result will soon be displayed in upcoming events from the upcoming event.

algorithm - Rearranging data for quadtree/octree -


मेरे पास एक एल्गोरिथम समस्या है!

मैं एक voxel octree raycaster को लागू करने पर काम कर रहा हूं, और केवल छोड़ी गई वस्तु ओकट्री के पत्ते के स्तर को पॉप्युलेट करने के लिए डेटा को दोबारा बदल रही है, ताकि डेटा को वृक्ष के निचले स्तर के निर्माण के लिए औसत किया जा सके।

मैं 2 डी (क्वाटट्री) में शुरुआत में सोच रहा हूं सुविधा। मेरे पास आरेखण की बाईं ओर जैसे डेटा का आदेश दिया गया है, और मैं वर्तमान में इसे सही तरह से पुनर्व्यवस्थित कर रहा हूं। उदाहरण 8x8 है।

वर्तमान

हालांकि, मुझे एहसास हुआ कि मुझे डेटा को नोड क्रम में ऑर्डर करने की आवश्यकता है, जैसे नीचे दिए गए चित्र में:

Wanted

दूसरे शब्दों में, मैं एक सरणी से जाना चाहता हूं जहां डेटा इस तरह के इंडेक्स के अनुरूप है:

  [0 1 2 3 4 5 6 7 8 9 .. 63]   

एक ऑर्गेन में जिसके पास इस क्रम में डेटा होगा:

  [0 1 4 5 16 17 20 21 2 3 ... 63]   

एक 8x8 quadtree उदाहरण के लिए।

मुझे यह पता नहीं लगा कि यह कैसे करना है। मेरी मुख्य समस्या एक मनमानी वृक्ष आकार के साथ काम कर रही है। मैं शायद नेस्टेड लूपों का एक सेट हार्ड-कोड अगर मुझे पहले से आकार पता था, लेकिन यह स्पष्ट रूप से एक महान या सुरुचिपूर्ण समाधान नहीं है मैं सोच रहा हूं कि इसमें एक पुनरावर्ती तरीके से इसे प्राप्त किया जा सकता है।

यह चित्र के रूप में वर्णित तरीके से डेटा को सॉर्ट करने के लिए यह मेरा त्वरित और गंदे स्केच है यह मूल रूप से मूल आंकड़ों में चार स्थितियों का ट्रैक रखता है, और फिर इन सरलीकरण को आगे बढ़ाता है क्योंकि नई सरणी भर जाती है। जहां तक ​​मैं यह कहने में सक्षम हूं, यह ठीक काम करता है, लेकिन मेरी जरूरतों के अनुरूप नहीं है।

  int w = 8; Int [] से पहले = नया int [w * w * w]; Int [] के बाद = नए int [w * w * w]; के लिए (इंट i = 0; i & lt; w * w * w; i ++) {पहले [i] = i; } Int toFill = 0; Int front = 0; Int back = w; Int frontZ = w * w; Int backZ = w * w + w; {के लिए (इंट i = 0; i & lt; w / 2; i ++) {for (int j = 0; j & lt; w / 2; j ++) {tofill ++] = सामने ++ के बाद; [ToFill ++] = सामने ++ के बाद; [ToFill ++] के बाद = वापस ++; [ToFill ++] के बाद = वापस ++; के बाद [toFill ++] = फ्रंटज़ ++; के बाद [toFill ++] = फ्रंटज़ ++; [ToFill ++] के बाद = backZ ++; [ToFill ++] के बाद = backZ ++; } सामने + = w; वापस + = w; फ्रंटज़ + + डब्ल्यू; BackZ + = w; } सामने + = w * w; वापस + = w * w; फ्रंटZ + = w * w; BackZ + = w * w; } जबकि (toFill & lt; w * w * w); के लिए (इंट i = 0; i & lt; w * w * w; i ++) {println ("बाद" + i + "" के बाद [i]); }   

किसी भी विचार की सराहना!

समस्या के लिए मैंने कहा , पीएचएस ने मुझे संकेत दिया कि उसे ज़ेड-ऑर्डर वक्र कहा जाता है इसके लिए धन्यवाद, मुझे यह प्रश्न मिला: जहां 2 डी केस के लिए एक एल्गोरिथ्म प्रस्तुत किया गया है। मैने इसे आजमाया और इसने कार्य किया।

यहां 3 डी केस के कुछ लागूकरण भी हैं:

Is there a reason JavaScript developers don't use Array.push()? -


I generally use expressions like JavaScript in the following:

  Arr = [] Arr [arr.length] = "something" arr [arr.length] = "one more thing"   

whether push will not be more suitable ?

  arr = [] arr.push ("some") arr.push ("one other thing")    

I actually asked the same question at the beginning of this year renewed with new test cases

It is that the push in Chrome is very high, and is equal to FF. Also can be faster in IE 9, but I would be interested to see how it works in IE 10.

I would say that most developers would agree to set the length of Array, and then it would be faster to use straightforward work, as is the case with most programming languages, but javascript is different. , They are just key / value maps like all other Javascript objects. Therefore, prior allocation is essentially falling on deaf ears.

Personally, I push (:

php - Stop from jumping to top of page -


When I click on a link, there is a way to prevent the page from jumping from top, Looks like: echo "& lt; a href = \" $ _ server [PHP_SELF]? Action = delete and key = $ exact \ "& gt; remove & lt; / a & gt;";

This is a link where I want to remove an entry from the list,

I am just using PHP.

Thanks

You use either an anchor or an anchor of a link Which sends the user back to the page, reload.

Name anchor:

Ajax method (one of several options):

.htaccess display_startup_errors setting depends on php script config file -


I am creating my own structure as a learning process, a config file, where people can set Whether the structure is in development or not.

  & lt; PHP $ project [security] [dev_mode] = true; ? & Gt;   

Display_startup_errors is defined in .htaccess, to indicate that syntax errors should be shown. I would like that if users do not need to mess with the .htaccess file, so that they can adjust the settings in the config file. Anyone if and how is any possible possible. Check the contents of the Htaccess php file and work accordingly?

A solution

try

  & lt ;? Php $ iDevMode = ($ project ['security'] ['dev_mode'])? 1: 0; Ini_set ('display_errors', $ iDevMode); ? & Gt;   

To toggle by definition This is an ugly ternary operation (you can convert it to a if statement for practice) and your program will need to process very soon.

Also keep in mind that a notice for encapsulating your associative array references in PHP quotation marks, as I have above.

performance - Android Not Enough Heap Allocated -


I have an application that is communicating with an Ardino and this is a NATI example for controlling RDO Runs. The problem is that I am not running out of memory, but according to the ADB lockset, the size of the total heap is very low for the size of the pile, I am always about 10% free, so any request on the Neti server is a GC When I get a bunch

  D / DelWiki (2862): WAIT_FOR_CONCURRENT_GC 18 9ms blocked   

Even ordinary Whatever the request does not (at least through me) At least one loses GC poses on second set in my manifest and the simulator device has 512 MB of VM heap but it is not allocating anywhere.

  android: largeHeap = " True "  

near that number (this is approximately 10MB allocated) I do not have a memory leak because 10% is free of charge, it goes +/- 2-3% . Even with 2 gigas rams (closed with all other applications) on the phone, if I'm always running at least, then this is a solution for a free 2x 3 MB pile?

Device size RAM really does not matter, because having 2 GB RAM does not mean That's going to get you 2 GB heap.

The minimum stack size specified by Google in its recommendations is 16MB, you will not get a small pile than that.

largeHeap works only on Android 3.0 and above, and it does not guarantee size of a larger size.

> You can not do a lot to get the big app, but you can re-write your app using NDK, in which the size of the pile does not matter because you are using the Dalvik VM Runs outside, and therefore (almost) all can use the device's RAM.

However, walking with 10% free help space is not bad.

android - Gridview with both image and text in each cell - OnClickListener ClassCastException error -


I am working with a gridview where each cell contains both an image and a line of text. I would like to, when the user chooses that item in the gridview, the image changes. I had this work when there was no image, but there was no image, but after changing the cell to include both image and text, I am getting the error:

  java. Lang.ClassCastException: android .widget.LinearLayout   

There is an error on the line where I am trying to get the imageView of selected items.

  imageView ivCheck = (imageView) parent.getChildAt (status);   

In my understanding, this is because what I am currently doing is unable to separate the textview from the image view ... However, in any way I do this I am unsure of

Code below:

grid.xml:

  & lt ;? Xml version = "1.0" encoding = "UTF-8"? & Gt; & Lt; GridView xmlns: android = "http://schemas.android.com/apk/res/android" android: id = "@ + id / Grid" Android: layout_width = "fill_parent" Android: layout_height = "fill_parent" android: padding = "L0dp" Android: VerticalSpacing = "L0dp" Android: HorizontalSpacing = "L0dp" Android: numColumns = "2" Android: columnWidth = "90dp" Android: StretchMode = "ColumnWidth" android: gravity = "center" & gt; & Lt; / GridView & gt;   

icon.xml: & lt; LinearLayout xmlns: android = "http://schemas.android.com/apk/res/android" android: id = "@ + id / widget44" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" android: orientation = "Vertical" Android: layout_x = "201px" Android: layout_y = "165px" Android: gravity = "center_horizontal" & gt; & Lt; ImageView Android: id = "@ + id / icon_image" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" & gt; & Lt; / ImageView & gt; & Lt; TextView android: id = "@ + id / icon_text" Android: layout_width = "wrap_content" Android: layout_height = "wrap_content" android: text = "TextView" android: gravity = "center_horizontal" Android: textColorHighlight = "# 656,565" & gt ; & Lt; / TextView & gt; & Lt; / LinearLayout & gt;

The relevant java code:

  gridview.setAdapter (New ImageAdapter (this)); gridview.setOnItemClickListener (New OnItemClickListener () {public void onItemClick (AdapterView & LT ;? & gt; parents, see V, int position, long id) {// tag set, and subsequently failed to match println (parents (+ I.e. + 0; i ++); {imageView ivCheck = (imageView), "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ ) parent.getChildAt (i); // error here   

I've read many tutorials on creating GridViews with both images and text, but the difficulty as well find one with a onclicklistener Is the way The image in the selected cell will change. I really appreciate any help you have!

Use of the scene To do this, simply use the visual v parameter that you want to change

just like this:.

  LinearLayout icon = (LinearLayout) V; ImageView image = icon.findViewById (R.id.icon_image); // Here with the image accessories   

Note that if the changes you made will not be saved, Scrolling away Item! The reason for this is that Gridview runs on the screen due to scrolling when going to recycle view . You want to allow users to modify items in GridView and also remember when they scroll away and you want to make changes to adapters to come back It will require that it populates GridView .

Mootools and Joomla 2.5 Custom Template -


Creating a custom template for Joomla 2.5 and I want to know whether it is safe to disable mute for my template?

If it's safe, how can I disable mootools?

You can find many in Joomla! Extension Directory () As already mentioned that is safe to do this because MooTools are actually required for Joomla! 2.5.x backend i.e. / admin .

You should know that there are some aspects of Joomla! 2.5 Mootools need to be loaded at the front end and many extensions "hope" (although they are not particularly good).

Usually Mootools is loaded by a PHP call of the form JHTML :: _ ('behavior.mootools'); or JHTML :: _ ('behavior.framework')

The main elements that load Mootools are included in front-end:

  1. Contacts ( com_contact )
  2. Content (in the blog, in code views, com_content )
  3. Advanced Search ( com_finder )
  4. Newsfeed ( com_newsfeeds )
  5. WebLink ( com_weblinks )

    The popular third-party components used in front-end include: 1. A "???" RokSprocket
    2.
    3. 4. 4. And many other people ...

    It is a reminder that the core has been in the "core" for them a long time And the developers expect that it will be there, okay or not, so you have to check any extension and see if any main components are adversely affected, then you delete it.

mobile - To continously check for the signal in android and then launch the app -


I am working on a project that receives signals on Android through Bluetooth, when the car engine ignites . Once the Android indicates that the mobile will go for silent mode and disconnect all calls and then send the msg to the caller. The problem I am experiencing is that Android Mobile should continually search for signals, and when it is received, the app that I have coded should start. How to check the signal continuously? Do I have to use Android's concept of service? how to use it? Please help me I am new to Android. It is very important for me ... I have searched a lot in Stakeoverflow, but I did not take anyone for my purpose.

should be used to check

twitter bootstrap - Android Browser - h1 tags rendering in what looks like wingdings , p tags render just fine -


I have a bootstrap site that is working properly on all browsers.
While browsing on my Android phone, the H1 and H3 tags look like a winged font. I tried to support the custom font and use the same CSS as the paragraph style but it is of no avail.

  h1, h2, h3, h4 {font-family: Raleway, Georgia, Times, Serif; -webkit-text-stroke: 1px; -webkit-font-smoothing: antialiage; } P, Blockquote, body {font-family: helvetica, ariel, non-serif; }   

I do not see any post anywhere on this issue. I've seen it on some of my sites, quite upset thanks.

This is a bug in Bootstrap 2.3.1 ()

is my Android Broken on phone (HTC matte) but looks perfect on Chrome on Windows 7. Are @Media Queries to Exclude Chrome Phone Browsers?

Add it to your CSS

>

  h1, h2, h3, h4, h5, h6 {text-rendering: auto; }    

mysql - Removing redundant information, difficult SQL query -


मेरे पास प्रारूप में एक टेबल है:

  `उपयोगकर्ता` - id - views - ईमेल   

यहां मेरे पास कुछ प्रविष्टियां दी गई हैं:

  `id`` ईमेल` पसंद करती है` 9570800 -anroy@gmail.com 888 5355388 -बत्तिंज @ Gmail.com 3042 8610061 -cmendez@naia.org 450 6189810 -dancox_photog@yahoo.co.uk 0 6625684 -david.d @ gmail.com 0 16841675 -david.d @ gmail.com 40 9716153 -डिव्हिड डी। @ Gmail.com 0 9716353 0 97161453 0   

मैं चाहता हूं कि हटाएं सभी प्रविष्टियों को डुप्लिकेट ईमेल करें और उच्चतम likes < / code>। उदाहरण के लिए, उपर्युक्त में, -david.d। Gmail.com के लिए डुप्लिकेट का मतलब 6625684 और 9716153 दोनों हटा दिए जाएंगे, और 16841675 रखा जाएगा (चूंकि यह डुप्लिकेट से सबसे अधिक पसंद है।

इसके अलावा, अगर ईमेल रिक्त है (

<पूर्व> MyTable से कम हटाएं जितना अधिक MyTable के रूप में कम उपयोग (ईमेल) कहां बड़ा.ईमेल & lt; & gt; '' और अधिक.लिखे & gt ; Less.likes;

git - GitHub Team Usage -


Hello I have gone through GitHub now GeethHub looks very nice and easy to pick up

I understand

  • A remote representative (a remote repo) original which includes the latest files in the application.
  • Each team member can make original
  • Each team member can edit files of your local local branches, reduce the branch and change your local Merge with Master .
  • Team member can now master to original / master .

    What happens now if 2 team members do not edit the same file.

    Origin V1

    > The member has made a V2 and now the original V2

    the member is still V1, but V3 has made and pushes that Due to the membership being rolled back to the original V1, it will not be because

    or is it where to join the phase to phase and push, comes into play?

    IE does not 'replace' all the files with your push .. but only you get adde If you try to push your remote ( origin) Remote ( orig in your example) and before you try to dismiss your push, the file has been updated on that remote, it will be rejected. You must already drag from the remote to the remote and before you can push.

    Otherwise, if there is no conflict, then the file is updated only when any master . Keep in mind that the whole process here is not only pushing a master :-) (or merge) Sorry for the mem, but I had to.

    No Master Merges In Only

    At Its Simplicity If you have a chance to update before updating a file on the remote, you will not be able to push. If the file you have changed does not succeed with your push on the remote, it will not be successful.

    To keep up with the master in an original flow, it is often necessary to pull in your branch.

How can I create a view like this in sencha touch 2? -


I would like to create a scene in the touch of the SANCHA I am a newbie. Please help me. I can not find a tap event on component.

Enter image details here

My code

  config: {default: {margin: 10}, layout: {type: 'hbox'}, item : 'Vbox'}, item: [{xtype: 'component', flex: 10, html: 'flex: 1', style: 'background-color: light tree'}, {xtype: 'spacer', flex: 1 }, {Type: 'vbox'}, {Xtype: 'component', flex: 10, html: 'flex: 2', style: 'background-color: pink'}]}, {flex: 1, layout} : [[Xtype: 'component', flex: 10, html: 'flex: 3', style: 'background color: orange', handler: funk Action () {console.log ( 'tape!'); }}, {Xtype: 'spacer', flex: 1}, {xtype: 'component', flex: 10, html: 'flex: 4', style: 'background color: light blue'}]}]    

Try Ext.dataview.DataView You will find examples from Github.

c# - Anybody knows is it possible to setup Castle Windsor with CallbackContracts -


I am working on WCF services with Castle Windsor and I can register after setting up the container like this: IWindsorContainer Container = New Windsor Container (); Container.edability and lieutenant; WCFFILITY & GT (.) Contact (Component.For & lt; IActivityLogsRepository & gt; (). Activity Logs for Repository & gt; (), Component. & Lt; IActivityLogsService & gt; (.) Activity Activity from Implementation & gt; Named ("Company.Service Implementation. Activity Logs Service"),

But my problem begins with the use of the callback contract as told here

I found this from the Castle document

and I did something like

  for the component. T; Ansal Service & gt; (). Implemented; Sample Services & gt; (.) Lifestyle.prevection session (),   

My server is config file < Pre> gt; & gt; basicHttpBinding & gt; & lt; binding name = "big HttpBinding" closeTimeout = "00:10:00" openTimeout = "00:10:00" sendTimeout = " 00:10:00 Maxbfarceases = "2147483647" Maxbuffarpool Size = "2147483647" Max Rieseva Messageism = "2147483647" & gt; Reader Quotes Maxdep = "2147483647" Maxstring Lantant = "2147483647" MaxArray Lang = "2147483647" MaxBytesPerRead = "2147483647" Maximum Name Tablescapes Camel = "2147483647" /> & Lt; / Binding & gt; & Lt; / BasicHttpBinding & gt; & Lt; NetTcpBinding & gt; & Lt; Compulsive name = "big net TCP binding" maxBufferPoolSize = "5242880" MaxbufrSissices = "5242880" MaxReserveSystemSystem = "5242880" / & gt; & Lt; / NetTcpBinding & gt; & Lt; / Binding & gt; & Lt; Services & gt; & Lt; Service behaviorConfiguration = "LargeBehavior" name = "MyCompany.ServiceImplementation.SampleService" & gt; & Lt; Endpoint address = "net.tcp: // local host: 808 / MyCompany.WcfServices / SampleService.svc" binding = "netTcpBinding" bindingConfiguration = "large netting padding" name = "net TCP" contract = "Compression of service. "/> & Lt; Endpoint address = "mex" binding = "maxcp binding" binding configuration = "" name = "max" contract = "imetadataexchange" /> & Lt; Host & gt; & Lt; BaseAddresses & gt; & Lt; BaseAddress = "net.tcp: // localhost: 808 / maquomani.ccf services /" /> Add & lt; / BaseAddresses & gt; & Lt; / Host & gt;

Does anyone know if Setup Castle Windsor facility is possible with this callback, and if so, how is it possible to get it?

Thanks < / P>

I do not think (99% fixed) it is currently supported.

android - How do I get Intellij preview to display my custom view -


How can I get a preview of Intelism to display my custom view? I have a very simple class that overrides text view:

  Public category TouchableTextView TextView {int width; Inti height; Integer position; Public TouchableTextView (android.content.Context Reference, String Text) {Super (Reference); SetTypeface (Typeface.SERIF); SetText (text); SetTextSize (getResources () getDimension (R.dimen.big_text_size)); SetTextColor (.getResources () getColor (R.color.text_dark)); this. Measurement (0, 0); Width = this.getMeasuredWidth (); Height = this.getMeasuredHeight (); }}   

I can definitely use some help on this.

You must overload one of the view class consultants. For example you can provide TouchableTextView (Reference Reference, AttributeSet Attrs) . IDE can not instantiate your view using a constructor with a custom "text" parameter.

javascript - PHP constant SQL query -


To get the latest values, I need to read my database continuously every 1 second. It is my code: / P>

  & lt ;? Connect to php // "test" database $ conn = new mysqli ('localhost', 'root', '', 'test'); // Check connection if (mysqli_connect_errno ()) {exit ('connect failed:'. Mysqli_connect_error ()); } // SELECT SQL query $ sql = "SELECT * FROM` value`"; // Execute the query and return the result to $ result = $ conn- & gt; Store the query ($ sql); If (! $ Result) print 'error!'; // If $ result has at least one row ($ result-> num_rows & gt; 0) {// output line of each row resulting in $ $ ($ line = $ result-> fetch_assoc ( )) {$ Product = $ line; Print_r ($ generation); }} And {print '0 result'; } $ Conn- & gt; Close (); ? & Gt;   

My HTML code refreshes every 1 second: Reload the function () {setInterval (getData, 1000); } Function getData () {$ .get ('test.php', function) {var output = data; document.getElementById ("output"). InnerHTML = "Info:" + output;}); } .... & lt; Body onload = "reload ();" & Gt; & Lt; P id = "output" & gt; & Lt; / P & gt; & Lt; / Body & gt;

Everything works fine but after about 5-10 minutes the MYSQL server crashes, I'm assuming it is being overloaded. My idea is that I keep the php script every time that connects every second, am I doing it wrong? Any suggestions on any better implementation?

I think that when you have finished the script, you can "close" the database Looking for something. / P>

You can include a hostname by adding mysqli p: To use a so-called permanent database connection

  // Connect to the "test" database $ conn = new mysqli ('P: localhost', 'root', '', 'test');   

Read more about continuous connections here:

JSFL typewriter effects for Flash CS6 -


Hopefully this is a quick one - I have not touched the flash after CS3 and used to use the following JSF typewriter effect.

I'm not sure there is a bug but the effect in CS6 actually works backwards - like this selection is reversed have make? In the last letters, the first animating becomes alive for the first time rather than inside.

Does anyone know about the solution? JSFL Below


  var doc = fl.getDocumentDOM (); Doc.breakApart (); Doc.distributeToLayers (); Doc.selectAll (); Var obs = doc.selection; Doc.get Timeline () InsertFrames (obs.length * 2, true, 1); Var tl = doc.getTimeline (); Var total = obs.length; Var i = Total + 1; While (i--) {tl.setSelectedLayers (i, true); Tl.cutFrames (0); Tl.pasteFrames (i * 2); Tl.clearFrames (0, (i * 2)); }   

The order in which the layers work, it is reversed at any point In case, only layer selection works for me:

  tl.setSelectedLayers (total - i, true);    

filereader - How to check which pattern use in file by java? -


I am reading different files from different operating systems. I have many lines in the file but I got to know that After "\ n" or "\ r" or something like this, when I read the file by following the instructions from

what should I add to the print in the console. I need help. I am trying to read but still need help from experts thanks.

If you are simply printing on the console, you can just use \ n In order to give you a bit background, how many times the files are actually in those two different parts (and when you should manually find or write in a file) in Unix-based systems, \ n files by new lines file Are displayed in. In Windows, new lines are represented by \ r \ n. But when you're printing on the console, \ n will perform properly

Additionally, the sample example you provided is just manually adding a new line so you can say that a new Where is the line Especially in that case, you can mark the new line as long as you are compatible with it.

making a variable a class in javascript -


In my application, I have some tags that look like this

x Beer x wine x sticky beer

If you click on 'X' then this tag should be deleted.

With a link around 'X', as you have seen below, this tag has been created & lt;% =% & gt; Code is Ruby inside, for example, the Paramarijet method will make the sticky beer tag like 'Gummi-bear'.

  & lt; A href = "#" class = "link tag" data-span = "& lt;% = tag.name.parameterize%>" data-questions = "<% = @ question.id% & gt; "Data-tag =" & lt;% = tag.name%> & gt; & Gt; X & lt; / A & gt; & Lt; Span class = "& lt;% = tag.name.parameterize%>" & Gt; & Lt;% = tag.name% & gt; & Lt; / Span & gt;   

I have javascript click events installed on the 'X' link, I can immediately remove the 'X' on the click, but I can not remove the actual tag name until a page refresh Which is what i want To immediately remove the tag name, I created a span class around the tag name, which is one of the html data attributes on the 'x' link. I have saved the data attribute in a variable (this.span)

  this.spanVariable = $ (r.target) .attr ("data-span"); For example, if this sticky bear tag was clicked on, then spanVariable will now be 'sticky-bear'.   

/ P>

And then I would like to empty the html of the 'Gummy-Bear' class, so I want to do something to evaluate the JavaScript variable so that this class Be made I thought I can evaluate JavaScript inside # {} but I do not think: (

  $ ('. {{This.spanVariable}'). Html ('') ;   

What I am trying to do, is basically a way to evaluate the value, this can be a class which is also a jquery object (i Jquery manner).

Try it out:

  $ ('.' + This.spanVariable).   

Running this way Avoid the situation, call some Ajax, and do the stuff when he gives it:

  $ ('.xclass') .click (function (e) {var spanVariable = $ (This) .data ("span"); $ .ajax ("/ my / server / endpoint? Tag =" + spanVariable, {dataType: 'json', success: function (result) {$ ('.' + Result .spanVariable) .remove (); $ ['[data-span =' + result.spanVariable + ']'). Remove ();}, Error: function () {Console.log ('not removed tag Could go ... ');}}});    

php - send array variable via ajax post request -


I am trying to process a form via AJAX request. The problem is that I have an array variable inside the form and when I work through serialize to send it through AJAX, it gives it:

  email_id% 5B% 5D = 1 & amp; Email_id% 5B% 5D = 2 & amp; Test = 23   

This is the result. Sierialize

I am also using multiple selection tags for array variables.

Why am I getting this error and what should I do to avoid and correct it? "name_id []" id = "email_id_0" id = "email_id_0" style = "width: 350px; margin-right: 5;" & gt; & Lt; / Select & gt; Function Set List (str) {var postDatas = $ ('# form' + str + '') Serialize (); Warnings (postDatas); // $ ('# crm-feedback'). Html ('& lt; img src = "images / ajax-loader.gif" />'); $ .ajax ({url: 'somewhere / file.php', type: 'post', data: postdates, success: function (data) {// $ ('# crm-feedback'). Html ('saved! '). CSS (' color ',' green '); warning ("test");}}); }

Thanks.

Try the following

  var array = document.getElementById ( "& Lt; your array alm"); Var formidata = new form data (); (Var i = 0; i & lt; array.label; i ++) {formdata.append ("& lt; of & gt;", array [i]); } $ .AJX ({url: "& lt; url>", Data type: "& lt; expected return datatype", type: "POST", data: formdata, success: function (result, status) { // process success}, error: function (result, status) {// process failure}});    

Python-list is too large and can't be deleted -


I have an iterator / generator that creates an 'event' in an event with a name, a timestamp and a value is. I want to store them in NumPy arrays, this is done in the _LoadTriples () :

  def _LoadTriples (abortEvt, count = [1]): this = _YieldTriples () While True: if abortEvt.is_set (): it.close () break0 = time.time () self.allEvents.append (np.fromiter (this, dtype = [(['sigNameIdx', 'i'], ( 'Time', 'f'), ('value', 'f8')], count = count [-1]) distance = time.time (time) - t if the fear <0.2: count.append (count [-1] * 2) Eleph der & gt; 0.4 and count [-1]! = 1: count.append (count [1] / 2) Other: count.append (count [-1])   

_YieldTriples is the generator, the abortEvt event that tells me that when users are back I can add NumPy arrays to Triples (name, timestamp, value) here. self.allEvents is an empty list here. Is a list because I am likely to break the recurrence and I can numpy.fromiter . So about every 0.3 seconds I can stop running.

All this works well. But , in one instance it happens that Pygmy uses 300 MB of memory for the list! When I stop running, my list requires a maximum of 10 MB, depending on when I closed it, but self.allEvents.append (np.fromiter (...)) After some calls, used 300MB and I do not know why.

Besides this, this memory is not free till I keep the entire program in check, even if I delete self.allEvents directly after that call. . There should be some context in it that prevents me from releasing it. Is there a way to look at objects in which object is the reference to the list?

More to mention one thing: The function is called as a new threading.Thread , but the main column waits for it ...

EDIT: I have not mentioned that no extra memory has been allocated in the list after using 300 MB. It appears that this memory is reserved after some exceptions in the list.

You should try: def _LoadTriples (abortEvt, count = None): If not counting: count = [1] ...

Problems with dynamic default arguments can be very fast

How to slide pages in Corona SDK -


I am using Corona SDK. I have a set of pages and I want to slide between them swipe using left-right. Page has a set of controls (mostly text)

What's the best way to slide / swipe this in Corona?

java - Switch on String 1.7 -


I imported a group project into Eclipse and found the following error:

'switch Can not be 1.7 '

At the value of the string for the source level given below, which is fine. I think the switch on the string was added to 1.7. When I fix my error to change my workspace or project compliance in 1.7, I end up with errors in every line of code.

Here is an error that appears at the top of the console:

java.lang.UnsupportedClassVersionError: driver: unsupported head.monore version 51.0

Why is any idea why and how can I fix it?

Ensure that you are not just setting your workspace to Java 1.7, but also that your Near Java 1.7 JDK is below it.

matlab - Applying functions to differently formatted files within a folder -


I have a folder full of files, column columns on the left side of each file. Some files have yyyymmdd dates, and others have mm / dd / yyyy dates in I minutebars1 () to yyyymmdd To type, and type minutebars2 () to mm / dd / yyyy I tried to do this with a statement, trying to say it, That if successfully read any course with a format within the loop running through all the files, then apply the correct function, though post below A code is not working, I get an error textscan lines Buddha as created went format string . How should this be done correctly?

 % reads all file names fPath = uigetdir ('.', 'Select the directory containing the CSV files'); If fPath == 0, error ('no folder selected'), end fNames = dir (fullfile (fPath, '*. Csv')); FNames = strcat (fPath, filesep, {fNames.name}); Process of each file for% I = 1: Length (fNames) fid = fopen (fNames {i}, 'rt'); If textscan (fid, '% i,% d:% d:% * d.% * D,% f,% d,% * c') for 1 minute pot 1 (fNames {i})% minutebars1 ( ); In the end if textscan (% fid, '% d /% d /% d,% d:% d:% d,% f,% d,% * c') for% 2 minutes bars2t (fNames {i}) Minbars2 (); End fclose (fid); Read the first line as a string and check that it is in the format << code>   

Code> fgetl and for reading a line, and for the regexp pattern test. Get the first line of the file% fid = fopen (fnames {i}, 'RT'); Str = fgetl (fid); Fclose (fid); Test for pattern mm / dd / yyyy (if regexp (str, '\ d \ d \ \ d \ d \ \ d \ d \ d \ d') minbars2 (fNames {i}); And minute 1 (FN name {i}); End

sql - Sum a sequence of device-labeled, data using most recent data for device -


I am using Postgrad 9.2.

I have the following problem:

  Time | Price | Devices - Yoga 1 v1 1 v1 2 v2 2 v1 + v2 3 v3 3 v1 + v2 + v3 v4 v1 + v4 + v3 v5 2 v1 + v5 + v3 v6 v6 v5 v5 + v3 v7 v7 V6 + v5 + v3   

Essentially, the time for each N device should be sum in the most recent value. In the above example, there are 3 devices.

I have tried many ways to use window operations and have failed. I have written a stored procedure which I need, but it can slow down the slobation with lack of experience with plpgsql. files> timeeries.combine_series (id int [], starttime timestamp, endtime timestamp) reset offset record $$ DECLARE retval double precision = 0; Line_data timeseries.total_active_energy% ROWTYPE; Maximum count integer = 0; Sz integer = 0; Last valve double precision []; V_rec record; Initially select in sz array_length ($ 1,1); Selection for line_data from time to time. Multiplier_active_Energy Time WHERE & gt; = Starttime and time & lt; Endtime and Device_ID = Loop Revlv = line_data at any ($ 1) order. Active_Power; 1..sz loop in i if $ 1 [i] = row_data.device_id then last night [i] = row_data.active_power; ELSE retval = retVal + COALESCE (final val [i], 0); end if; End loop; SELECT row_data.time, retal in v_rec; Back to next v_rec; End loop; Return; End; $$ LANGUAGE plpgsql; Click

Call: from> timeseries.combine_series ('{552,553,554}' ​​:: int [], '2013-05- 01 ':: Timestamp,' 2013-05-02 ':: Timestamp) AS (timestamp with time zone, double double precision);

Create sample data

  or change the template table (ts int, active_power real, device_id int, should_be int); Include T values ​​(1,2,554,2), (2,3,553,5), (3, 95, 5, 11), (4,7,553,9), (5,6,552,15), (6 , 8,554,21), (7,5,553,19), (8,7,553,21), (9, 6, 52, 21), (10,7,552,22);    

I am creating a reply to my previous question, where you have a simple case Had presented. Read the description of the aspect of the task of the window functions of the solution:

This question presents a "counter-cross-tabulated" data-set. To get where you want to be, you can reduce cross authoring in your simple, previous form.
Additional modules of PostgreSQL are working very fast for that. Run this command to install once per database :

  create Extension Tablefun;   

Then you only need it (including unnecessary columns in the result for debugging):

  SELECT ts, active_power, device_id, should_be, COALESCE (max. (SE) * (A) (part under PhD), 0) + COALESCE (maximum (B) over (division by GRP_b), 0) COALESCE (maximum (C) over (split by grp_c), 0) Count (A) as Grp_a, count (B) as AS grp_b, count (C) from crosstab as 'grp_c (' SELECT ts, active_power, device_id, should_be, device_id, active_power by t order 1, 2 ',' value (552), (553), (554) "AS T (   

Returns the desired results by TS et, Active Abuse Int, Digitized Int, BIAB ANAT, AIT, BIT, CAT) by Wind Bay (order by TS) sub order.
This query is a little bit of the dynamite gathered, it should perform well. Note that this solution builds on a small, given list crosstab () :
< / P>

About additional columns in your example:

Advanced order Sstab-Fu:


visual studio 2010 - Add Quotes to HTML Attributes -


I have been given an HTML document that was originally created using Word. The generated HTML can use some cleaning and is too long so it is tedious to do it manually. I will also need to do this with other HTML documents from this source in the future so that an easy solution is useful beyond this single frequency .

One of the HTML attributes is unquoted. I want to avoid adding all the quotation marks by hand and looking for an easy way to do this.

Here is a screen shot showing a snippet of the file: Enter image details here

The screen shot is from Visual Studio 2010. Visual Studio recognizes that there is a verification error and adding it is a quote, but I can not find the tool to automatically add quotation marks. Is there a choice in Visual Studio that will take care of adding quotes?

I originally came to ask questions in the visual studio to ask questions, but I'm really looking for a good solution. I'm not stuck in Visual Studio, if there are any other recommendations They will be appreciated.

An HTML clean, a Java package that generates valid HTML / XHTML with tags SOP . Take a look at the net cover.

java - Setting a particular date into a prepared statement -


I am trying to put any date in my prepared statement in this format (like 11/08/1989, 04 / 15/1955)

This is my code:

  pstmnt = conn.prepareStatement ("Include user_info values ​​(?,?,?,?,?, ?) "); Pstmnt.setInt (1, max_id); Pstmnt.setString (2, f_name); Pstmnt.setString (3, l_name); Pstmnt.setString (4, email); Pstmnt.setString (5, user name); Pstmnt.setDate (6,?); Pstmnt.addBatch ();   

I am sure how many metrics have been deprecated to complete this process.

Any thoughts?

you java.sql.Date object to setDate () is required to pass the method.

  pstmt.setDate (6, new java.sql.Date ((new simplified format ("MM / dd / yyyy"). Pars ("11/08/1989"). Time Remove ()));    

hdl - Are there any advantages to having fewer levels of wrappers in verilog? -


Specifically, I'm asking that there are some advantages of lower level in hierarchical design.

Thank you!

Thank you!

OK, so it depends on how you have installed your barriers and what tool do you use Are there. So if you allow the device to "level" your design on compilation / synthesis / PNR (location and route) (make sure that xilinx's vivado and ise also makes it and rhythm) between a flat design and a There should be no difference in performance Hierarchical design The reason for this is that the tool basically ignores the limitations of files, when adding logic and places and not so.

If you prepare a pure list on the other side or even the tool keeps them out and try again and share them individually, you remember the shared logic Or can be trapped with at least optimal location or routing status.

Overall, if you are interested in displaying your design, do as much of equipment as you can, the more freedom you do, the more work you do. Therefore, if you use wrappers (a good idea for human readability), make sure that the device is given freedom by using the flatten option.

javascript - Moment.js only within the last week -


I'm using moment.js "timeAgo" to display some dates. But I only want to use the moment.js if the date is within the last week. (7 days ago) After that point I would like to display the date normally. Example: Instead of (3 years ago) (20 June 2010).

I have the default working with this code. Any help would be great.

  var date = moment.unix (& lt ;? php echo $ date;? & Gt;) FromNow (); . ("# Date") $ enclosed (date);    

var someDate = moment.unix ( 7) {$ ("# date"). Attachment (someDate.format ("dddd, MMMM Do YYYY")); } And {$ ("# date"). Attachment (someDate.timeAgo ()); }

java - Explicit initialization of primitives -


I understand that Java primitives are the default starting value; For example 0 int .

From my research it seems that I should not rely on these values. Should I always give a clear initial look and if so, where?

Here is a part of my program:

  public class calculator {// Start price where it has been declared? Private int values; Public Calculator () {// Start Price in Constructor? } Public Zero Addition (int other) {value + other; }}    

Using basic values ​​created by Java is absolutely fine, you do not need it Let's start the example of your class or the stable field. Java language specificity is required, so any implementation of language should follow. In other words, if you use the default value of member variables, your code will remain 100% portable. This applies to both types of primitive and context (later started with null .)

For more information, see page 81.

4.12.5 The starting value of the variable

Before each variable can be value in a program, its value must be: - Each class variable, instance variable, or array component Is started with the original value when it is created

The only case where you must start clearly, when you declare local variables:

Before a local variable is used explicitly, an original If need be, by early or assignment, in a certain way, which can be verified by using the rules of certain assignments.

However, because failure to launch a local is a compile time error, the compiler points to every missing start-up before running your program.

ios - UIView Components Not Moving With View -


I have created a UIView in a storyboard. See for more information. My issue is when the user "logs in" then I present a new view which is brought from the left side of the screen and the main view is closed on the left side, such as push navigation, but all programmatically

So I decided to animate this "navigation" using the following code. See = [[UIView alloc] initWithFrame: CGRectMake (0, 0, 320, 480)]; View.backgroundColor = [UIColor whiteColor]; // Add content to view [add addview view: label]; View.frame = CGRectMake (320, 0, 0, 480); See.clipsbybound = yes; [Self.view addSubview: view]; // show view [UIView Animative Withdrawan: .5 Animation: ^ {self.view.frame = CGRectMake (0,0,0,480); // Move the self view from the left view. Frame = CGRactam (0, 0, 320, 480); // move the new view into place}];

My view is being displayed successfully but the current view, self.view is not going from the left side of the screen as I want. It moves, but it does not take its components with it ... when I // view.frame - CGRectMake (0,0,320,480); Comment inside the animation, so I do not show the new scene I get in the simulator on login.

The white background of the scene leaves the screen but does not leave the components. This causes a problem because when I put two together, it does not seem that "new view" is replacing the old scene with the navigation push controller, but instead it has to be slide. There is a way to move these components with self.view when I take it to the screen

Thanks for the help!

I'm not sure that you can move self.view . Even if this is possible, this is not a good idea ...

Still your code

  self.view.frame = CGRectMake (0, 0,0480);   

The view slides does not show this view in the zero-width rectangle, which states that its subview is still in the scale view Also why are default subvues combine in the top-left corner of their supervision, and since the top-left of self.view have not gone (still (0, 0)), they They remain the same. The correct way to slide a view from the screen is:

  self.view.frame = CGRectMake (-320,0,320,480); // width & amp; The height is definitely unchanged   

However, this will not work, because you have a subview of view self. View is created ... which means that this line:

  view.frame = CGRectMake (0, 0, 320, 480);   

view.frame related to self.view that the screen is now off! So both of them have gone, another good reason is that you should not play with self.view.frame .

IMHO, you should make a view v1 as the main view, and v2 log in such a scene that will appear. Make both sublayes of self.view , hide v1 behind v1 and when the user logs in, then slide v1 as shown above the screen. Or perhaps by putting v1 on the right side of v2, and sliding both of them (so v1 will exit because sliding in v2, similar to navigation controller).