Posts

Showing posts from August, 2013

android - How to Stop OnTouchListener while user is touching the screen? -

Image
I am looking for a way to force the user to increase my finger before the next action. I have a situation when the user chooses something on the scene and I do not want to open it again again and again without lifting your finger. This is my basic question: option 1: Set OnClickListener instead of OnTouchListener. Option 2: Hold ACTION_UP and then apply your action only. Boolean Press Flag = Wrong; Public Boolean On-Touch (see V, Motion Event Event) {int action = event.getAction (); Switch (Action) {Case MotionEvent.ACTION_DOWN: if (pressFlag == incorrect) {// Press Your Action Flag == True; } Else {// nothing} break; Case Motion Event Action_UP: Press Flag == Wrong; break; Default: Break; } Back true; }

ruby on rails - undefined method `each' for #<Comment:0x007f12ef55d0d0> -

I was working on the Blogger blogger on Rail Blogger: and I'm at the point where I am correcting the action of the Blogger app's show. Here's my controller: Diff show @ articles = article. Fix (Param [: id]) @ comment = comment.new @ comments = comment. Address (Param [: id]) end Here is my show view - (which is partially presenting my comments) ` My comments are partial here: articles-path => gt; & lt; div & gt; & lt;% @ comments.each do | Comment | & Comment by: & lt; h4 & gt; & lt;% = comment Author_name% & gt; & lt; / h4 & gt; & lt; p class = "comment" & gt; & lt;% = comment.body% & gt; & lt; / p & gt; & lt;% end %> My problem is that when I show all comments from comments model on the show page through each iterator in comments in comments A I am getting the error, then I get this error: Undefined method `for each '& lt; note: 0x007f12ef55d0d0 ...

laravel - Eloquent filtering of nested -

I have such a DB format: user + id + email + password profile + ID + owner + ID (FK user.id) + Type_ID (FK type ID) + Address_ID (FK address.ID) + org_name + + + phone + email + url etc. posting + ID + profile_id (FK profile id) + title + Description Address + ID + Road + City + Province_ID (FK Provinces ID) + Country_ID (FK country.id) etc. Country ID + No Trying to use a well-known ORM to know a set of posting based on type_id, city, country_id and / or province_ad + m province + id + name + abbreviated country id I am here. These fields are subordinate objects on $ posting-> profiles-> addresses, etc. Do I want to downgrade my debut - merge the address data into it to streamline the profile? Or, what is one way to do this without having to do all of my data without remodeling? Assume that you have defined address for profile Regarding connection to , $ posts = posting :: with (['profile' = & gt; function ($ query) usage ($ type_id) {$ query- ...

python - BadValueError: Expected list or tuple, got None -

I try to clear a ndb.StringProperty (repeated = true) from the settings I am not any , but the error is happening: Badwali error: expected list or tubal, none found This is very straightforward, but the code I'm using is: g.kids_names = none g.put () this is a duplicated property, it is empty Try setting Uchi: []

E-mail form sender name instead of e-mail ? (PHP) -

I have created a PHP Email Fluder and it works fine. However, while testing it, I am only receiving the sender e-mail address as the name. What I need is the name of the sender. Below is the code. Can anyone help me? Thank you ... & lt ;? Php $ from = $ _POST ['from']; $ = $ _POST ['OT']; $ Theme = $ _POST ['theme']; $ Message = $ _POST ['message']; $ Headers = "From:". $ From; If ($ _POST ['radio'] === "plain") {$ header = "content-type: text / plain; charset = UTF-8 \ r \ n"; $ Headers = "From:". $ From; } Otherwise ($ _POST ['radio'] === "html") {$ header = "content-type: text / html; charset = UTF-8 \ r \ n"; $ Headers = "From:". $ From; } Mail ($ $, $ theme, $ message, $ header); ? & Gt; Try something like this: $ Headers = "From: Sender's name & lt;" $ From "& Gt;";

android - Opengl screen limits at different depths -

I am trying to create a 3D particle simulation with the detection of collision using OpenL ES 2.0 and I Can not understand how to collision with screen edges. If I correctly adjust the catastrophe and in the case of the camera I can have the range of X and Y screen between -1.0 and 1.0 more or less when the particle is at 0.0-Z-depth , But the problem is the screen edges when the particle z position is not zero. Basically, I have to check whether the particle is within the screen boundaries at all depths or not. Does anyone know how to do this? Thank you! The answer is frustum planes. Below is a C ++ / Direct 3D example that you can find useful: ClassFostam {public: plane plane [6]; // Planes array of public: // Default Constructor Freism (for (unsigned int i = 0; i , _41, matrix -> or_42, matrix-> _4 3) Vector VPN (matrix-> _31, matrix-> ;232, matrix-> _33) vector white (matrix-> _11, matrix-> 2, matrix-> _13) Vector vapor (matrix-> gt; _21...

php - PHPmyEdit: Pull table data using string value rather than set value -

I am using PHPMyEdit, and the file generated after I read the setup: $ Opts ['hn'] = 'localhost'; $ Opts ['un'] = 'User'; $ Opts ['pw'] = 'pass'; $ Opts ['db'] = 'db'; $ Opts ['tb'] = 'table_name'; I need to act like this: $ foo = $ _POST ['bar']; ... $ opts ['hn'] = 'localhost'; $ Opts ['un'] = 'User'; $ Opts ['pw'] = 'pass'; $ Opts ['db'] = 'db'; $ Opts ['tb'] = $ foo; If I run the code like this, then this table pulls the data properly, but when I try to edit, I copy, it reads: phpMyEdit error: no tables defined . Is there any other situation and was able to detect the solution? $ opts variable defined in php.MyEdit.class.php Has been the file The file generated by the setup document is not designed to support additional '$ _POST' calls. To fill the host, run phpMyEditSetup.php as well as...

Boost (.asio) linking -

So I followed all the kind of "Include Boost Headers and Link to Boost Libraries" section. For ASIO, what do I include # (except asio.hpp, of course) and which library can I link to? In fact, there is a big list of all the boost libraries, and do you need to include them to work? It would be very useful I'm talking with heart. But for the use of boost.asio in Windows, I remember that you need to define WinNT 0X501 or similar and link against boost.system and win32 socket library.

javascript - My jQuery .hide() animation not working as expected -

Loading the animation should look for one second and then hide it is not hidden. I believe this is JS Is failing (as it is to hide the rule). See: Work it correctly: HTML & lt; Div id = "backgroundcolor" style = "position: fixed; width: 100%; height: 100%; left: 0%; top: 0%; z-index: 1996" & gt; & Lt; Div id = "following ballsG" style = "left: 50%; margin-left: -50px; top: 56%; z-index: 1998" & gt; & Lt; Div id = "following ballsG_1" class = "following ballsG" & gt; & Lt; / Div & gt; & Lt; Div id = "following ballsG_2" class = "following ballsG" & gt; & Lt; / Div & gt; & Lt; Div id = "following ballsG_3" class = "Following BallsG" & gt; & Lt; / Div & gt; & Lt; Div id = "following ballsG_4" class = "following ballsG" & gt; & Lt; / Div & gt; & Lt; / Div & gt; & Lt; /...

c++ - Error with type declaration -

I get an error "This announcement has no storage class or type specifier." I have checked for semicolons and I have included the relevant libraries. #include & lt; Iostream & gt; # Include & lt; Fstream & gt; using namespace std; Const int n = 8; Double p [n] = {1.23, .97, .86, .77, .69, .65, .71, .50}; Double pi [n] = {.74, .70, .66, .68, .65, .62, .60, .54}; Double jade [n] = {.25, .35, .45, .55, .65, .75, .85, .95}; Offream mimefile; Myfile.open ("ppilow.txt"); Try to replace // error here myfile.open (" Ppilow.txt "); with the following code: int main (int argc, char * argv []) {myfile.open ("ppilow.txt"); Return 0; } Explanation: You can not keep instructions outside the body of actions. But better to avoid the declaration of global variables, so I advise you to go to this also in the body.

numpy - Interpolation over regular grid in Python -

Image
I am struggling to penetrate the data of "empty" pixels in my 2D matrix. In fact, I understand (but deeply) interpolation techniques such as inverse distance weight, cringing, bikebik etc. I do not know the starting point at all (either in the problem or statement of the python case). Problem definition: I have an MxN matrix (regular grid) in which each pixel represents some measurement value ( figure below and the data used in this data ). I wanted to add data to the "question mark location" (white space consists of the same size but empty pixels) using the data present in the form of "blue pixels" My question: 1) How can I add this data? Can someone give me a general example (for example 3x3 matrix) to understand clearly? 2) Can someone guide me how to take action in the solution of Python environment? 3) How can I compare interpolation techniques in the sense of accuracy using Python? 4) Do you think it is a good idea to use ...

python - Indenting db.commit() in sqlalchemy script -

I know this should be a primary question, but for some reason I do not understand this I do not understand Is not indented under the statement for line code for r in roles: ? Instead, this function is indented under the Definition def insert_roles (): , which I do not understand because nothing is being done except for specifying dict keys and values I will post the entire code and what the book says below about it thanks in advance for any assistance. . . class permission: follow = 0x01 COMMENT = 0x02 WRITE_ARTICLES = 0x04 ModerTom composite = 0x08 admin = 0x80 square role (DB model): __tablename__ = 'roles' id = db.Column (db Integer, primary_key = true) name = db Columns (DB String (64), Exclusive = True) Default = DB. Permission = db.Column (db.Integer) user = db.relationship ('user', backf = 'roll', lazy = 'dynamic')) column (db. Boolean, default = false, index = true)) @staticmethod def Insert_roles (): roles = {'user': (permissio...

javascript - background.html vs. background.js - chrome extension -

I'm really confused here, I'm trying to understand the file extension of the Chrome extension. I am reading this document: My status: I want to set an oath flow so that the user can log in to the extension (other endpoint mydegango backend) Up to now, I have these files: background.js content.js popup.html manifest.json where my message to content.js Sends .js and get feedback back so far! But now while reading a doctor for OHTH, I do not know what background.html is. Is this really a file in which my background.JS code contains JS code? But, if I see it in .html , like: "background": {"persistent": wrong, "script": ["jquery111. Js "," background.html "] The extension is no longer working. In Oath Doctor, it says: Place four library files in the root of your extension directory (or wherever your javascript is stored). Then include .js files in your background page ... Your background page will manage OA...

No output In Eclipse for a simple java program -

I think I wrote this program very well, it does not give me any error, but it does not give me any Not giving output what's wrong in it? I have looked for other programs to check whether some eclipse is wrong with eclipse, but every other program is running. Note: I am a newbie learn java, explain the problem in detail I know that I have spelled wrong spell of heritage. The legacy of the public class {int a; String B; Legacy (int x, string y) {a = x; B = Y; }} Legacy spreads in class B {int c; B (int j, string of, int el) {super (4, "sir"); A = J; K = b; C = L; } Public static void main (String Arij []) (inheritance OBG 1 = new inheritance (4, "sir"); B obj2 = new B (4, "sir", 5); System.out.println ( "The Man details of the "+ obj1.a +" "+ obj1.b); System.out.println (" man's description of "+ obj2.c);}} The error in your code is that the main method is defined in a non-public class B Transfer the m...

mysqli - How to display a set of queston using while loop in php -

I have 10 options like their options in the database: ID question option1 option2 option3 Code that randomly selects 1 question and displays it on the webpage with its options. Now I want to have five random questions displayed on each webpage with their respective options. How can I do this, please help me & lt ;? Php include_once ("db_conx.php"); $ Sql ​​= "SELECT * mymake ORDER BY RAND ()"; $ Query = mysqli_query ($ db_conx, $ sql); $ Numrows = mysqli_num_rows ($ query); If ($ numrows> 0) {while ($ row = mysqli_fetch_array ($ query, MYSQLI_ASSOC)) {$ id = $ row ["id"]; $ Question = $ line ["question"]; $ Option1 = $ line ["option1"]; $ Option2 = $ line ["option2"]; $ Option3 = $ line ["option3"]; }}? & Gt; & Lt ;; Doctype html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Untitled document & lt; ...

qt QWebView fails on loading jQuery page -

I was experiencing this problem recently and no solution was found for this. So, I would appreciate it if you can actually look into it. is a targeted website that runs JQuery when clicking on a specific button. When I connect to the QWebView and QNetworkAccessManager signals, I think this is loading jquery_modules.min_22190.js. This is the minimum code you can try and see: The last thing I see in logs: End "Unknown error ", Code: 0 Kural (" http://www2.thewebsite.be/nl/js/jquery/jquery_modules.min_22190.js ") Top 1 =" Date ":" Saturn, 26 July 2014 08:50:55 GMT "Header 2" = "Server": "Apache" header3 = "X-frame-option": "SAMEORIGIN" header 4 = "cache-control": "Max-age = 604800" header 5 "End": "Saturday, 02 Aug 2014 08:50:55 GMT "Header 6 =" Various ":" Approved-encoding, User-agent "header 7 = "content-encoding": ...

php - How to make dynamic tree menu from database? -

Image
I want to use the library: To create a dynamic menu in HTML using the database. I have created a table with menu structure Once I see the documentation: How do I remove data from the table? What should be included in the array? If so, what are the use examples? Earlier, I created a class that would inquire to remove the menu to see. It's just that I think it is very hard to use such a query, my class is like this: Memory with a single question Is there a better way to save in which I get the same result?

Laravel migrations messed up -

I have created my Laravel migration and I get a serious PHP error: the class can not be changed again when turned on php artisan migrate - path = "workbench / feed / feeds 2 geo / src / migrations" I am removing the migration file and manually I am leaving the table and form the php artisan migrate: but still it is the same. How can I fix migrations? You need to check all your migration class files and check duplicate class names.

java - Simple Audio Play Stop In Android -

I'm the first in Android. I want to make an app An MP3 file starts playing when clicking on an image (play button image) and another image (stop image button) and map 3 stops How to create this app? See a simple example of starting, pausing, and stopping audio play. To start, drag three buttons from pallete, stop playing audio and stop Now the xml file will look like this: File: activity_main.xml & lt; RelativeLayout xmlns: androclass = "http://schemas.android.com/apk / res / Android" xmlns: device = "http://schemas.android.com/tools" Android: layout_width = "match_parent" Android: layout_height = "Match_parent" Android: paddingBottom = "@ Dimen / activity_vertical_margin" Android: paddingLeft = "@ Dimen / activity_horizontal_margin" Android: paddingRight = "@ Dimen / activity_horizontal_margin" Android: paddingTop = "@ Dimen / activity_vertical_margin" tool: reference = "...

wordpress - htaccess password protect confict -

मुझे एक वर्डप्रेस प्रोजेक्ट में एचटीएक्सस प्रमाणीकरण के साथ एक समस्या है मैं एक उपनिर्देशिका (बीटा) की रक्षा करना चाहता हूं लेकिन रूट निर्देशिका (mywebpage) नहीं है तो, मैं निम्न निर्देशिकाओं है mywebpage index.php बीटा index.php .htaccess .htpasswd समस्या यह है कि जब मैं तक पहुँचने का प्रयास मेरी वेबपेज निर्देशिका, मैं अभी भी लॉगिन पॉपअप मिलता है लेकिन जब mywebpage में इंडेक्स फ़ाइल .html फ़ाइल मौजूद तो बस ठीक काम करता है यहां .htaccess फाइल की सामग्री है:। AuthName "MySprts" AuthType बेसिक AuthUserFile "/var/www/web703/html/mywepage/beta/.htpasswd" AuthGroupFile / dev / बातिल वैध-उपयोगकर्ता के & lt आवश्यकता होती है, IfModule mod_rewrite.c & gt; विकल्प + FollowSymLinks RewriteEngine RewriteBase / बीटा / RewriteRule ^ सूचकांक \ .php $ पर - [एल] RewriteCond% {REQUEST_FILENAME} -f RewriteCond% {REQUEST_FILENAME} -d RewriteRule!। /beta/index.php [L] & lt; / ifModule & gt; .htaccess फाइल निर्देशिका आप प्रभाव के लिए यह चाहते में चला ज...

jquery - Change the preview image size image upload in JavaScript -

I started learning JS, so I borrowed online. I tried to modify my requirement in the suite, so I have two upload buttons with a preview that works properly, but the image image I am trying to get, the dimensions of the preview image after uploading Have to change Can anyone tell me where can I make that change? HTML & lt; Input type = "file" & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script src = "jquery.image.upload.preview.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Upload (preview) ({callback: function (res) {res.after.empty ()) (res.img) {Res.after.append ($ (" 200)? "200": res.img.width}))}}} })}) & Lt; / Script & gt; & Lt; Input type = "file" & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></scr...

ios - Any thoughts on why this Swift code does not compile? -

इस वाक्यविन्यास में कुछ भी गलत है? प्रोटोकॉल सीरियलज़ेबल {init (शब्दकोश: [NSObject: AnyObject])} मुझे इस लाइन के साथ एक त्रुटि मिल रही है मैं उदाहरण का पालन कर रहा हूं। मैं इसे काम करने के लिए प्रतीत नहीं कर सकता धन्यवाद! अर्रे और शब्दकोश के लिए वाक्यविन्यास चीनी यह कोड पहले या द्वितीय बीटा में काम नहीं करेगा, लेकिन एक नए संस्करण में काम करेगा। यदि आप किसी पुराने संस्करण में काम करने के लिए कोड चाहते हैं, तो सिर्फ वाक्यविन्यास चीनी निकालें: प्रोटोकॉल सीरियलज़ेबल {init (शब्दकोश: शब्दकोश & lt; NSObject, AnyObject & gt;)}

Updated position Unity3d -

I have a tablet that has to kill the enemy continuously. So, in the bullet script, I have announced the change changing the public enemy; Now, when I try to use enemy.position in the bullet script, then hit it in the bullet script, enemy.position shows the situation on which the enemies were flying and not at the location on which the bulletproof was shot. How can I get an update of the enemy every time the object is Bulletproof Institute. In this way I am changing enemy status: Zero update () {float amttomove = currentSpeed ​​* Time.deltaTime; Conversion Translate (vector 3. left * amitomov); If (transform.position.x & lt; 0f) setposandspeed (); } Zero set popespeed () {x = 11.5f; Z = 0.0f; CurrentSpeed ​​= Random.Range (Min Speed, MaxSpeed); Y = Random Range (0f, 2.5f); Transform.position = new vector 3 (x, y, z); } This is where the bulletscript tried to use the enemy's position: float target_Distance = Vector3.Distance (Projectile.position, Targ...

r - Shiny and Javascript - Uncaught ReferenceError: TRUE is not defined -

I have a shineip that has the original login screen. When the app loads, the " Log in "variable is wrong. When the user successfully logs in within the session, the R login code happens as follows: X $ logged - TRUE At this point, I get warnings in the JavaScript console "Unwanted reference references: Not really defined". I click the link to go to the code, and the javascript code is: (with function () {with (this) {return (x $ logage) = True)}}}} I'm starting a bit, I believe that, first of all, this is a Javascript of my R code, and the other thing is that it does not like Because Javascript is expecting a lower case boolean "true". How can I see it? Equally, R. I do not like Boolean. How do I get it? Equally, The short case does not like Boolean. Define one in the other, eg. As you are going to javascript , before its code ( Javascript ) var true = true, wrong = false; then (function () (with this) {return...

Scala function which computes a stream that contains an Arithmetic sequence -

टेस्ट परीक्षण ("अंकगणित") {जोर देना (गणना: अरिथमेटिक (5, 10) === 30)} मुख्य डीईएफ अंकगणित (ए: इंट , बी: इंट): इंट = {val सी = बी - एक वैल तीसरा = बी + सी वेल चौथा = तीसरा सी वैल पांचवीं चौथी = सी पांचवीं सी} स्काला में एक val fibs = fibFrom (1, 1) .take (7) का उपयोग कर बना सकता है। क्या यह एक धारा का उपयोग करना संभव है जो स्काला में अंकगणित दृश्य बनाता है? यदि सकारात्मक है, तो इसे कैसे कार्यान्वित करें? एक फाइबोनैचि अनुक्रम एक अंकगणितीय अनुक्रम है और आप जो भी क्रम बना सकते हैं आप चाहते हैं: scala & gt; Val s: स्ट्रीम [Int] = 0 # :: s.map (_ + 5) s: स्ट्रीम [Int] = स्ट्रीम (0,?) स्केल & gt; S (10) res0: Int = 50 स्केल & gt; (एस ले लो 10) .toList res1: सूची [इंट] = सूची (0, 5, 10, 15, 20, 25, 30, 35, 40, 45)

ios - Subclassing UIGestureRecognizer and returning custom UIView -

I have created my own UIView subclass with a new prototype. It is not a problem, But when I am trying to get my position of subclassed UIView , it goes wrong. I have a gesture on my UIView and It is not recognized with sub-clinging and using a new variable because UIGestureRecognizers gives a UIView view variable. So I subclassed UIGestureRecognizer but this does not work. I am getting an error: Banner count: BignRettingWithState: Objects: Count:]: 0xe872480 sent to unknown selector, for example, and here my code is UIGestureRecognizers in the subclass: #import & lt; UIKit / UIKit.h & gt; #import "BannerView.h" @ Interface Gesture Rico: UIGestureRecognizer @property (nonatomic, readonly) Bannerview * View; @end How can I solve this problem or I need to handle it in any other way that UIGestureRecognizer knows that I've subclassed UIView and received the variable myself Want to UIView Class

multithreading - c# hight memory used. for ManagementObjectSearcher -

निजी शून्य फॉर्म 1_लोड (ऑब्जेक्ट प्रेषक, EventArgs ई) {t = नया थ्रेड (नया थ्रेडस्टार्ट (सीरियलकेक)); CheckForIllegalCrossThreadCalls = गलत; t.Start (); } सार्वजनिक शून्य सीरियलसीक () {ManagementObjectSearcher theSearcher = नया प्रबंधनऑब्जेक्ट सर्चर ("सेलेक्ट * FROM Win32_DiskDrive WHERE इंटरफ़ेस टाइप = 'यूएसबी'"); {Foreach (SearchContent in ManagementObject currentObject.Get ()) {managementObject theSerialNumberObjectQuery = नया प्रबंधनऑब्जेक्ट ("Win32_PhysicalMedia.Tag = '" + currentObject ["DeviceID"] + "' '') की कोशिश करें; {Serial = theSerialNumberObjectQuery ["SerialNumber"] की कोशिश करो। ToString (); Textbox1.Text = सीरियल; } पकड़ (अपवाद) {// MessageBox.Show ("बिशेलर बूंडू बेंडे एलामेडम"); }} थ्रेड। नींद (यकीन है); serialcek (); } पकड़ (अपवाद पूर्व) {संदेश बॉक्स। शो ("Patladım ben।" + Ex.Message.ToString ()); }} थ्रेड का उपयोग करें लेकिन मैं इसे रोक नहीं सकता धागा हमेशा चलने और आवेदन ...

python - Sending multipart data with rauth / requests -

I am developing an API-client to transfer real estate. The provided interface is using Oauth1 and multipart HTTP posting to upload attachment data. Service Provider wants to have an uploaded attachment in a specific format as mentioned here: (section example for photo ) What do I basically do to create a MIME Multilateral Post for An XML document A binary file So far, I have the rauth , resp file logic Tried to use To distribute both the request , the XML and the binary file. But I can not figure out how to add different MIME types (such as App / XML and Image / JPG) to different Multipart sections. How can I do this like this:? import request files = {'attachment': ('filename.jpg', open ('path / / filename.jpg', 'rb'), 'image / jpeg; name = Filename.jpg ',' content-transfer-encoding ':' binary '}),' metadata ': (' body.xml ', open (' / path / to / body.xml ',' rb '),' App...

php - How to implement an AJAX op while creating a search bar? -

I was trying to create a search bar using AJX, which searches for user in database, AJX works fine Has been doing; It displays the right message when no one is typed or no user is found. The problem is, even though users found that it does not show any user. This is a php file: & lt ;? Php header ('content-type: text / xml'); Echo '& lt ;? Xml version = "1.0" encoding = "UTF-8" standalone = "yes"? & Gt; '; Require_once ("include / connection.php"); Echo '& lt; Feedback & gt; '; User $ = $ _ receive ['user']; If ($ user == "") {"echo username" echo; } And {$ query = "select from email id where e-mail_ id = {$ user}"; $ User_result = mysql_query ($ query, $ connection); If ($ user_result) {echo "yes {$ user} exists"; } Else {resonant "There is no such user that {$ user} exists"; }} Echo '& lt; / Response & gt; '; ? & Gt; ...

ruby on rails - Can I Render A Layout Directly From routes.rb, Without A Controller? -

I would like to set a pair of style guides for the administrator of a website and the public sections. Each will need its own layout, which will contain a mixture of static HTML and partially calls to make a call (no such static page will not cut it). There is no need for controller (s) to serve these pages and I do not want that which is effectively development-only content, it disrupts the rest of the code. I hope to think that there is no way to render the layout directly. Disclaimer: I appreciate it that I should never do sometimes and I know why reasoning is the money. This idea is not good. I am interested in whether it is possible. Is there any layout with no control directly from routes.rb ? For some strange / stupid reason I wanted to render a blank JS file , And writing a controller felt too much for this kind of hack. Thanks for the reply @inikilabs, I used this 3 liner: get 'analytics / some_file.js', for: - & gt; (Env) [200, {'Content...

elasticsearch: use aggregated value for filtering -

I am using nested mapping (bottom), which represents "work" and "request" The nested element to create progress in that direction. I am trying to find all the functions which have not progressed, i.e. all documents, for which "max" aggregation on Nested Objects is empty. It requires to be able to filter on the results of any aggregation - and this is where I am caught somewhere. I can order through the results. But I can not find any way to filter what is such a potential? Mapping: mapping = {properties: {'prefix' = & gt; {Type: "string", store: true, index: "not_analyzed"}, 'last_marker' = & gt; {Type: "string", store: true, index: "not_analyzed"}, 'start_time' = & gt; {Type: "date", store: true, index: "not_analyzed"}, 'end_time' = & gt; {Type: "date", store: true, index: "not_analyzed"}, 'obj_count' = &...

php - Notice: Undefined offset: 1 in -

फ़ंक्शन मिल ($ a, $ b, $ c) {$ y = विस्फोट ($ b, $ a ); $ X = विस्फोट ($ c, $ y [1]); वापसी $ x [0]; } त्रुटि देता है नोटिस: अपरिभाषित ऑफ़सेट: 1 में $ y [1] सेट नहीं है। आपको इसे विस्फोट के माध्यम से चलाने से पहले एक मूल्य की जांच करने की आवश्यकता है । $ y = विस्फोट ($ b, $ a); यदि (एसेट ($ y [1])) {$ x = विस्फोट ($ c, $ y [1]); वापसी (isset ($ x [0]))? $ X [0]: ''; } अन्य {वापसी ''; }

ios - Stuck in a loop while waiting for -

I have a set of digits, and I will run a calculation where the user can tap a button and the closest to them The point count in the set of works correctly. My problem now is that I want the button which only calculates, when the accuracy of the device is good for accuracy - under seventy-five meters accuracy, however, I can check the accuracy When I try, I am stuck in the infinite loop, and I do not get any good option for whatever I am trying to do. Here is my relevant code (and I have tried to do this as a little late {}} while looping {}. {NSLog (@ "% f" is located at the current location location); if (urgent copy of current location & lt; 75 & current location. HorizontalAccuracy! = 0) {NSLog (@ "Accuracy is good!") ; CalcDistance.hidden = break; break;} and continue;} while (current location changeable escurcity> current location location change == 0); It happens that when I run an app on a device, the total hangs, and the log in the s...

php - using strtotime with datetimepicker and adding 1 day -

I am saving my database in this format in column 'time' (user input using the Datatmapiker): Date format: 'mm-dd-y', time format: 'hh: mm tt', example: 07-31-2014 03 : 37 am I also have a column named 'column' if 'time' (the time saved in the column) + 24 hours is more than current time () then 'position' = = time limit Finish 'Below is my attempt, take Qin I think strtotime is not interpreting my timestamp because all this has ended ... Example: 08-19-2014 02:05 am Expired If ((strtotime ($ line ['time']. "+1 days")) & lt; time ()) {$ row ['status'] = 'expired'; Suppose you are getting the date from the database like this format "07/31 -" You need to convert it and it must be formatted as a stratome readable below. list ($ month , "$ Line ['time']); $ line ['time'] = $ year." - "$ line ['time'] = $ year." - $ line [$ tim...

Join 2 structures with the same fieldnames by an 'ID' field in Matlab -

include two structures with the same field names by an 'id' field in matlab I have 2 structures: s2010.name = 'fred'; S2010.wage = 8; S2010 (2) .name = 'alice'; S2010 (2). Wind = 9; S2010 (3) .name = 'Frank'; S2010 (3). Wind = 10; S2011.name = 'alice'; S2011.wage = 10; S2011 (2) .name = 'frank'; S2011 (2). Yes = 11; S2011 (3) .name = 'peter'; S2011 (3). Wedge = 12; I want to include these 2 structures to get the following from their common name: s2years.name = 'alice'; S2years.wage2010 = 9; S2years.wage2011 = 10; S2years (2) .name = 'frank'; S2years (2). Wage2010 = 10; S2years (2) .wage2011 = 11; Note that Fred and Peter do not appear in the framework, I just want to get common names. As a result, I would like to keep wages in different areas for two years. Is there any way to do this? Is it better to convert these 2 sets into second objects (such as datasets / tables)? This seems to attra...

sql - Why do all but the first row in a table show up as '#' when you call .all in rails console? -

I'm learning about models and databases in rail and when I make a table I can call Get a blank array on all the models, but if I make multiple rows and I call all I get an array where only the first row shows the actual value and Remaining # . The console does not display all the row values, and if it does not, how can I see all the values ​​of rows without calling .find on each line? ? irb (main): 001: 0> Todo.all Select Todo Load (0.1ms) "todos". * To "todos" [# & lt; Todo id: 1, todo_item: "Pick milk", created_t: "2014-07-27 15:45:11", updated_t: "2014-07-27 15:45:11" & gt; #, #] irb (main): 001: 0> Todo.Ol. Seconds Todo Load (0.1m. # & lt; Todo id: 2, todo_item: "Pay Internet bill", created_at: " 2014-07-27 15:47:42 ", updated_at:" 2 014-07-27 15:47:42 "& gt; I'm pretty sure that this is a feature of the console, which reduces the output, s...

java - Syntax error on token ";", invalid AssignmentOperator -

निजी सूची & lt; स्ट्रिंग & gt; टोकन = नया अर्रेलिस्ट & lt; स्ट्रिंग & gt; (); मेरे पास कुछ कोड हैं, लेकिन यह मुझे एक त्रुटि प्रदान करता है। मैं एक्लिप्स का उपयोग करता हूं और यह नीचे > चरित्र के नीचे एक लाल रेखांकन दिखाता है मुझे पता नहीं क्यों सब कुछ ठीक लगता है यह संपूर्ण कोड है: सार्वजनिक वर्ग का विश्लेषण {संरक्षित स्ट्रिंग टेक्स्ट = शून्य; सार्वजनिक सूची & lt; स्ट्रिंग & gt; टोकन = नया अर्रेलिस्ट & lt; स्ट्रिंग & gt; (); // त्रुटि ठीक है यहाँ। this.tokenize (); सार्वजनिक विश्लेषण (स्ट्रिंग txt) {// यह कन्स्ट्रक्टर है मैं कक्षा को बाहर की तरह वैरिएबल के साथ कॉल करूँगा। जैसे: एक टेक्स्ट = नए विश्लेषण का विश्लेषण करें ("यहाँ कुछ ग्रंथ।"); // तब मैं कक्षा के अंदर टोकन चर को कॉल करूंगा। (या मैं सिर्फ यह गलत कर रहा हूँ?) This.text = txt; } निजी सूची & lt; स्ट्रिंग & gt; Tokenize () {// कुछ कोड जो "टोकन" चर के मूल्य में परिवर्तन करते हैं }} मुझे इंटरनेट और इस मंच पर एक नजर था, मुझे आमतौर पर कुछ तार्किक ऑपरेटरों ...

java - Find power of real number -

I am trying to find x ^ y where x Is positive and y is a real number. Many sources are online for integer but not much for actual numbers. Example: 6 ^ 4.3 = 2218.4537377949778046576946747662 I do not have to use any Math library. I know that it works: exp (y * log (x)) But I get an exposure without any library Will happen. Is there a series that I can use to get real number power? I am doing it in Java. To make a good agreement between the efficiency and ease of implementation, you can develop "Fastest "The part is the logarithmic. Before the power of x to find the power of 2 , assume that the x = (2 ^ n) .x ' , 1 & lt; = 'X' & lt; 2 . Then ln (x) = nal (2) + ln (x ') . 6 = (2 ^ 2) x 1.5 evaluation from series ln (x ') = 2 argth ((x'-1 ) / (X '+ 1)) LN (1.5) = 2 (0.2 + 0.2 ^ 3/3 + 0.2 ^ 5/5 ...) = 0.4 0.405333333333 0.4054649490476 0.405465107978 0.4054651087878 0.405465108108 ......

javascript - Moment.js Timezone in Unix Format always returns same timestamp -

Whenever I try to return a Unix timestamp, I always specify Timeston (for local time) to me instead of the time zone. ..If I use a format like "H: mm a" then I get the right time. How can I get a time zone for a unix timestamp (or preferably millisecond string) of moment.js? moment.tz.add (['America / Los_Angeles | PST PDT | 80 70 | 0101 | 1Lzm0 1zb0 Op0', 'America / New_York | EST EDT | 50 40 | 0101 | 1st Lease 50 1zb0 Op0 ']); Console.log ("Current time in California is:" + (Moment). Tz ('America / Los_Angeles'). Format ("X")); Console.log ("Current time in New York:" + (moment). Tz ('America / New_York'). Format ("X");

asp.net - Hosting WCF Apps IIS Authentication -

I have written a WCF service and need to host it, I can either host an IIS or a self host And I would like to use Windows authentication by setting bindings in the web.config file below: & lt; Bindings & gt; & Lt; NetHttpBinding & gt; & Lt; Binding & gt; & Lt; Safety Mode = "Transportation" & gt; & Lt; Transport Customer Credential Type = "Windows" /> & Lt; / Safety & gt; & Lt; / Binding & gt; & Lt; / NetHttpBinding & gt; & Lt; / Binding & gt; I am trying to understand what is happening in case of IIS authentication and passing it to a web application, especially: If I host in IIS, do I need to enable Windows certification for the service site in the setting of IIS Administration? If this is the case, why can not the service Windows authentication just like the host itself, from the config file - why IIS needs to be included ? The host itself hosts the web. Nothing more than t...

java - How can i detect which fragment/tab is being utilised? -

There are several tabs in my application, which contain all the list views which are in one piece. These list views are populated using a square. I use a variable called current tab to find out which tab is selected and therefore the requirements of the list can be populated according to its requirements. I have realized that when a tab is selected the previous and next UI are loaded to increase liquidity. I am currently unable to distinguish which list is being run on the scene, as a result I am unable to retrieve its corresponding data. On-tab selection will not work. I'm wondering if there is any other function / method that will allow me to do this. You can try to override setUserVisibleHint: @Override Public Zero setUserVisibleHint (boolean isVisibleToUser) {super.setUserVisibleToUser}; If (isVisibleToUser) this fragment appears to the user}}

html - Adding a fancy "frame" to picture -

Image
How do I change this image frame - box-shadow in CSS? If anyone has some ideas, please tell me :) inside a container device Position located. Apply CSS3 2D conversion & lt; Div class = "container" & gt; & Lt; Div class = "box 1" & gt; & Lt; / Div & gt; & Lt; Div class = "box 2" & gt; & Lt; / Div & gt; & Lt; Div class = "box 3" & gt; & Lt; / Div & gt; & Lt; / Div & gt; Container {width: 200px; Height: 200 pixels; } .box1, .box2, .box3 {boundary: 1px solid # 333; Height: 150px; Width: 150px; Status: Completed; top 10; Left: 10; } .box1 {Transform: rotate (5 degrees); MS-Consequently: Rotate (5deg); / * IE 9 * / -bbkit-transform: rotate (5 degrees); / * Opera, Chrome, and Safari * Box 2 {Transform: Rotate (-5 degree); MS-transform: rotate (-5deg); / * IE 9 * / -wbkit-transform: to rotate (-5 degree); / * Opera, Chrome, and Safari * Box 3 {background color: white; Edit ...

Input from terminal into C file -

Image
इस सवाल का पहले से ही एक उत्तर है: 4 जवाब मैं उपयोगकर्ता इनपुट लेना चाहता हूं टर्मिनल से और फिर उस इनपुट को टर्मिनल से लें और एक नई फाइल में लिखें। इस में मैं अपने सी प्रोग्राम की सिंटैक्स फाइल को दिखाने के लिए use [] का उपयोग कर रहा हूं: #include "common.h" / * सिस्टम हेडर * / #include & LT; stdlib.h & gt; # शामिल करें & lt; math.h & gt; #include & lt; string.h & gt; #include "bio.h" / * इंटरफ़ेस हेडर * / #include "vmath.h" #include "nmg.h" #include "rtgeom.h" #include "bu.h" #include "raytrace.h" # शामिल "Wdb.h" स्थैतिक const char उपयोग [] = "उपयोग:% s कैमरा x1 y1 z1 लुक_टाट x2 y2 z2 लाइट x3 y3 z3 -o output_file brlcad_db.g वस्तु (ओं) \ n"; Int main (int argc, char * argv []) {bu_setprogname (argv [0]); Int c; जबकि ((c = getopt (argc, argv, "cll")) = -1) {स्विच (सी) {मामला "सी": printf ("कैमरा {& lt;% s", argv [1], ...

regex - I believe this Perl script is secure. Can it be improved? -

I have the following Perl script one (not yet because I took it down) a URL like Click on http://www.joereddington.com/testsound/getsound.pl?text=hello%20mum and then find the file http://www.joereddington.com/testsound/hope.wav There is a recording of computer voice "Hello mother" #! Use / usr / bin / perl strict; Use warnings; Use CGI qw (: standard-debug); My $ text = param ('text'); $ Text = ~ s / [^ 0-9a-zA-Z \ s] // g; Print "content-type: text / html \ n \ n"; System ("/ home8 / projedf4 / tts / espeak-1.48.04-source / src / speak \" $ text \ "-w hope.wav"); I am a little worried about users possibly taking advantage of injection attacks and in this way I believe I have done enough with the line $ text = ~ s / [^ 0-9a-zA-Z \ s] // g; Because I'm just really removing everything that can harm the string. But is it enough? I as far as $ text = ~ s / [^ 0- 9a-zA-Z \ s \.], / G; Yes, your code ...

prolog - Stop recursion when variable is reached -

I have a program with searches for something and it has not been found every time, it increases a variable by 1 is. If it never detects what the user is searching for, he will always search for it. Can I stop doing so, if any particular variable has reached? This is the Victkit that searches for: % ----------------------------- - ---------------------------------------% address (X, Y, N): - ... Search for% (X, Y, N): - ... if not found, increment n 1 and repeat it again% ------------------ -------------------------------------------------- - Address (Y, I, G): - Member (Y, I), G. Find (Y, I, G): - Find (Member (Y, I)), Extension (I, O), Find (Y, O, G1), GG1 + 1 Find (Y, I, 50 ): - Failure Then I have to write something Find (X, Y, 50): - Return false So that the program returns to false, if it is not found after 50 iterations. How do I know this? Edit: This is my code: vwg (x, y, g) searching that two person x and for example G-grade Is related to: vwg (vanessaM...

jquery - .data() value of DOM element is undefined except by iframe -

html: & lt; div id = "module" डेटा-लोड = "झूठा "& gt; Index.html: console.log ($ ('# मॉड्यूल') से। खिड़की पर लोड करें। डेटा ('लोड')); // rewards 'undefined' । Index.html में निहित iframe से window.onload: console.log ($ ('# मॉड्यूल')। डेटा ( 'लोड')); क्यों यह पहली बार अपरिभाषित है, लेकिन जब आईफ्रेम डेटा का उपयोग करने के लिए जेएस फ़ाइल का उपयोग करता है, तो इसे परिभाषित किया जाता है? यहां बताया गया है कि कैसे मैं जेएसफिल्ड में बहुत ज्यादा इसे स्थापित किया गया है मेरे घर का भी एक ही .js फ़ाइल का उपयोग करता है, लेकिन जब आइफ्रेम भार, कंसोल आउटपुट गलत है। संपादित करें: थोड़ा और काम करने के बाद, मुझे लगता है कि दूसरा लोड वास्तव में शुरुआती HTML लोड हो रहा है, पहले आइफ्रेम है।

Shortcut in nano editor for adding quotation marks to every word beginning with $ in a bash script? -

I'm new to writing in Bash and I've just finished this long script but I have given the quotation marks to all Adding all the quotation marks by the variable hand starting with Unary operator $ will take some time. Can a small cut be used on it so that all the words in the text file begin with $ , find the quotation marks around them? So if a line appears in the file: dragon myProgue.py $ car1 $ car2 $ speed1 $ speed2 then it will appear after the shortcut As / Pre> I am writing scripts through Nano. Use global search and replace with expression (\ $ \ w +) . Switch to search and replace mode with c - . Switch to regex mode with Alt-R . Type the expression (\ $ \ w +) . Press enter. In the replacement expression type "\ 1" change the expression captured with citations. On mail, press A for everyone.

java - GMap ajax "pointSelect" event doesn't work after validation -

I have a weird problem The GMFS component works primarily until I do not expect ... I support backing After certifying the data, I send the message to the component. After that the map does not respond to Ajax's "point selection" event. It can be moved, zoom in-etc, but I can not go into my code which is responsible for adding the marker. This is my code: primetime & lt; P: = "add_marker" value = "punkt:" for the output label /> & Lt; P: OutputPanel ID = "AdMarker" style = "text-align: center;" & Gt; & Lt; p: gmap id = "add_gmap" widgetVar = "addMap" center = "# {addSpotController.sampleSpot.latitude}, # {addSpotController.sampleSpot.longitude}" zoom = "15" model = "# {addSpotController.model}" type = "Hybrid" style = "width: 600px; height: 400px" streetview = "true" & gt; & Lt; P: Ajax event = "select point"...

java - Display Navigation Bar Throughout Spring MVC/JSP Application -

I am in the process of creating a JSP based website using Spring MVC framework and bootstrap, and I have all of my different The web page is very late in the game. I have decided that I want to add a navigation bar to my website. I have already created the navigation bar but it's easy to "tack" on other web pages, so I do not need to duplicate the code in different files? If I include the navigation bar HTML code in a separate file and include it on the JSP page, will it show up properly? Is there a general standard way for people to expand the navigation bar on their entire website? I am convinced that those who have experience in creating websites should easily answer it. I definitely appreciate any help that can be offered. Thanks! Create a tag like navbar.tag in tags directory that will be in your WEB-INF dir. Add your code there and include it in the desired JSP pages Add to the header to add your tag to JSP: and use your tag like this: ...

Quantmod FRED Metadata in R -

लाइब्रेरी (quantmod) getSymbols ("GDPC1", src = "FRED") मैं एफईआरडी में संख्यात्मक आर्थिक / वित्तीय आंकड़े निकालने की कोशिश कर रहा हूं, लेकिन मेटाडेटा भी। मैं सीपीआई चार्ट की कोशिश कर रहा हूं और मेटा डेटा को लेबल्स / फुटनोट के रूप में देख रहा हूं। क्वांटमोड पैकेज का उपयोग करके इस डेटा को निकालने का कोई तरीका क्या है? शीर्षक: रियल सकल घरेलू उत्पाद सीरीज़ आईडी: जीडीपीसी 1 स्रोत: अमेरिका का वाणिज्य विभाग: आर्थिक विश्लेषण का ब्यूरो: रिलीज: सकल घरेलू उत्पाद मौसमी समायोजन: सीज़नल एडजस्टेड वार्षिक रेट फ्रीक्वेंसी: त्रैमासिक इकाइयां: अरबों का हिसाब 2009 डॉलर दिनांक सीमा: 1 947-01-01 से 2014-01-01 अंतिम अद्यतन: 2014-06-25 7:51 पूर्वाह्न सीडीटी नोट्स: BEA खाता कोड: ए 1 9 1 आरएक्स 1 रियल सकल घरेलू उत्पाद संयुक्त राज्य अमेरिका में स्थित श्रम और संपत्ति द्वारा उत्पादित वस्तुओं और सेवाओं के मुद्रास्फीति समायोजित मूल्य है। अधिक जानकारी के लिए संयुक्त राज्य अमेरिका के राष्ट्रीय आय और उत्पाद खातों (एनआईपीए) के लिए गाइड देखें - (http://www.bea.gov/national/pdf/nipaguid.pdf...

video - HTTP Range header without corrupting mp4 file -

I want to preview the MP files from the HP server so that I want to request some of them different in each file Is encoding Note: I can access any part of the file with the HTC Range header. Thank you. / P> I do this with FFmpeg ffmpeg -ss 00: 01: 00 -i http://example.com/foo.mp4 -t 00:01:00 -c copy outfil.mp4

android - Resource not found Exception using a Library -

I have a project BI that is using as a library and referenced in Project A. I understand that in Project A's GEN directory, two different R files will be generated for Project A and Project B (Library). I am getting the following error during the runtime: 07-27 20: 55: 42.520: D / PrtotbufAstron ..: (20,732): String Resource ID # 0x7f0a00ab 07-27 20: 55: 42.520: W / ResourceType (20,732): getEntry failed because entryIndex 157 type entry is beyond count 1 07-27 20: 55: 42.520: W / ResourceType (20,732): 0x7f0a009d (T = 9E = 157) for failed package 0 Getting (Error - + 2147483647) The Resource ID is actually in the project BK file (Library): Public Stable Int Gymnas = 0x7f 0a017f; The only resource in the project is an auto-generated R file: public stable end-end geminids = 0x7f090199; So I'm not sure why the file allocated to the same resource in the R file of the library and in the project a. Any input is appreciated .

mysql - IN clause with multiple columns -

Is there a way to use a query by using these clauses with more than one column of the following column query? ? Instead of using select from field_a where in field_A (choose from table_b from field 1) select the association * from table_a * where field_a (table_b) Field_2); I have to create something that would look like the following: choose from * table_a where field_a (select field 1, field_2 from table_b); Most of the sub-queries you can get inside the union are: to table_a where in Field_A (select field_1 from the table_ub association, select field_2 from table_b) or: Select * From Table_a where in field_A (select field_1 from table_b) or in field_a (select field_2 from table_b)

sql - MySQL primary key type becomes "index" after inner join -

I am working with a large database (500+ million entries), and trying to optimize the search engine I am here. item_terms (id, data, item_term_results (id, item_term_id, ITEM_ID) item_terms.id is a unique index, and item_term_id is an index. When trying the following query, everything goes well and I actually know what I want, the item I'm searching for, with the good performance being the id . Select from DISTINCT item_term_results.item_id inside item_terms.id = item_term_results.item_term_id item_term_results contain item_terms where item_terms.term = 'Jason' and return That query is a type "constant" on item_terms and "referee" to explain on item_term_results Great But , now I want to add another where:. DISTINCT item_term_results.item_id Select item_term_results combination based on item_terms from item_terms. Id = item_term_results.item_term_id Where item_terms.term = 'Jason' or item_terms.term = 'Bourne' ...

ruby on rails - bundle exec rspec spec/requests/static_pages_spec.rb Error -

Hi all I am working on every heart of the book, like most people got into tease and error in chapter 3. Each time I try type: bundle exec rspec spec / requests / static_pages_spec.rb I found the following error: / home / action / rails_projects / sample_app / Config / environment / test rb: 1: in `& lt; Top (required) & gt; ': Undefined method # & lt; Sampl eApp :: application: 0x007fc2f39dcac0 & gt; Configure for; (NoMethodError) /home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rbature29: From '/' required by /home/action/.gem/ruby/2.0. In 'Block Required' from 0 / gems / activesupport-4.0.8 /lib/active_support/dependencies.rblege29:in/ 'HOME / action / .gem / ruby ​​/ 2.0.0 / gems / activesupport-4.0. 8/lib/active_support/dependencies.rbaxy14:in/home/action/.gem/ruby/2.0.0/gems/activesupport-4.0.8/lib/active_support/dependencies.rbature29:in `load_default '/ home / action `Required 'is required ...