Wednesday, 15 September 2010

asp.net mvc - Illegal characters in path. while bundles javascript files -


I am trying to bundle my javascrip files and CSS files into the My MVC project. Throwing an exception while adding it. Illegal characters in the path

 : An uncontrolled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where the code has originated from it. Exception description: System. Archive Exception: Illegal characters in path source error: line 9: public static void RegisterBundles (BundleCollection bundles) Line 10: {Line 11:. Include Bundles.Add (New ScriptBundle ("~ / bundles / jQuery") ("~ / script / jquery- {version} .js", line 12: "~ / js / bootstrap.js", line 13: " ~ / Js / jquery.flexslider-min.js "~ / js / jquery.isotope.js" "~ / js / jquery.fancybox.pack.js? V = 2.1.0" "~ / RS-plugin / js / Jquery.themepunch.plugins.min.js "" ~ / RS-plugin / js / jquery.themepunch.revolution. Min.js "" / / js / revolution.custom.js "" / / js / custom.js ")); Stack trace: [ArgumentException :. Illegal characters en] System.IO.Path.CheckInvalidPathChars (String path, Boolean checkAdditional) 10,631,190 System.Security.Permissions.FileIOPermission.CheckIllegalCharacters (String [] str) using +30 System.Security.Permissions .FileIOPermission.AddPathList (FileIOPermissionAccess , AccessControlActions control, string [] pathListOrig, Boolean checkForDuplicates, Boolean needFullPath, Boolean copyPathList) using 97 System.Security.Permissions.FileIOPermission..ctor (FileIOPermissionAccess, string path) 63 System.Web. InternalSecurityPermissions.PathDiscovery (String path) +29 System.Web.HttpRequest.MapPath (VirtualPath virtualPath, VirtualPath baseVirtualDir, Boolean allowCrossAppMapping) 149 System.Web.HttpServerUtility.MapPath (String path) 104 System.Web.Optimization.BundleTable. & Lt; Get_MapPathMethod & gt; b__0 (string virtualPath) 67 System.Web.Optimization.ItemRegistry.Include (String [] virtualPaths) [644 System.Web.Optimization.Bundle.Include (Strin C] Virtual path) +64 IntensifyTech.IntensifyTechConfig.RegisterBundles (bundled compilation bundles ) c: \ users \ sxxx \ SkyDrive \ Trunk \ IntensifyTech \ IntensifyTech \ App_Start \ IntensifyTechConfig.cs: 11 IntensifyTech.MvcApplication.Application_Start () in C: \ users \ sxxxx \ SkyDrive \ Trunk \ IntensifyTech \ IntensifyTech \ Global.asax. cs: 24 [HttpException (0x80004005): illegal character in the path.] System.Web.HttpApplicationFactory.EnsureAppStartCalledForIntegratedMode (HttpContext context, HttpApplication app) + 9 859725 System.Web. HPAPCirmation Registrar Avent Subscriptions IIS (ITPPR App CONTAx, HTTP Contact Reference, Methodindia [] Handler) +118 System Web. HTTP application. Init Special (HTTPPTecution State, MathDinfo [] Handlers, Interpet App Contact, HTTP Contact Reference) +172 System. Web. Hpapitalizationfitter Gate Special Application (IntPtr appContext, HttpContext References) 336 System.Web.Hosting.PipelineRuntime.InitializeApplication (IntPtr appContext) 296 [HttpException (0x80004005): Invalid character tracer in path.] System.Web.HttpRuntime.FirstRequestInit (HttpContext Reference) + 9873912 System.Web.HttpRuntime.EnsureFirstRequestInit (HttpContext Reference) +101 System.Web.HttpRuntime.ProcessRequestNotificationPrivate (IIS7WorkerRequest wr, HttpContext Reference) +254    

Yes, of course this item:" ~ / js / jquery.fancybox.pack.js? V = 2.1.0 ". This is a virtual path, not a URL, so '?' Characters in this context are invalid.

NSError error code -11819 on iOS when trying to play media using AVPlayer -


When you are trying to run media url using AVPlayer, then I got Epiphalerstats error code -11819 please Give advice.

  - (void) View VariablePath: (NSSTING *) The object of the pipe: (ID) Object changes: (NSDragment *) Convert Reference: (Zero *) Reference {if (References == & Amp ; AVPlayerItemStatusContext) {AVPlayerItem * playerItem = (AVPlayerItem *) object; NSInteger position = [player dead position]; Switch (position) {case AVPlayerStatusFailed: {NSError * error = [playerItem error]; NSLog (@ "% s% d \ n", __FUNCTION__, [error code]); .....}   

}

I found in AVError.h that the AVFoundation error code -11819 corresponds to AVErrorMediaServicesWereReset ("Media operation unavailable because the operation could not be completed").

osx - Can't print mpdf generated pdf files on mac -



It's really weird. I am using PDF MPdF, I did not have any problem in printing PDFs but this problem suddenly came out. It is not certain that there is something in place for updating my code or updating my operating system or wireless printer printer.

System ------------- Application --- ---- Results
OS X 10.8.2 ----- ---- Preview ---------- Can not Print - OS X 10.8.2 - ---- Acrobat ---------- OS X 10.7.x Can print ---------- Reader ---------- Can not print - Windows XP ----- Reader / Address ---- Can print OS X 10.XX --------- Preview -------- Can not Print

Some Information: We were able to print PDF first. There was no complaint from any OS / person. I was working on some SQL query changes. But I refresh my things is still not working.

Then it says that when someone tries to print using "preview" - according to my MacBook pro, it is (printing - connected to print and stays like this) - this Others show something like being on the Mac ... but nothing happens. FYI has not confirmed any such as .... The printing is complete .... It is like printing and printing.

An application was PDF Repere. And with this application I can print my PDF after repair but the problem is not its freeware and the quality is not good

Perhaps this is a broken / damaged material problem.

Target: The target "PDF files" is printed with "Preview"

Any kind of help or suggestion is highly appreciated.

screenshot of my pdf

Finally resolved. MPdf had something like that with CMAP processing stuff but it happens only with the old version of MPDF, in my case it was MPDF 5.0 beta.

The latest version of the MPDF will solve this problem Now I can print my export PDF from any OS and any application. Cheers

c - calculating the no of steps in insertion sort -


Here are two versions of the inclusion sort, which I apply to one with the pseudo code and straight one. I want to know which version takes more steps and space (in some places too complicated)

  zero entry_art (int a [], int n) {int key, i, j ; For (i = 1; i & lt; n; i ++) {key = a [i]; J = i - 1; While (j> = 0 & a [J]> key) {a [j + 1] = a [j]; J--; } A [J + 1] = key; }}   

and this is a

  entry_source (item S [], int n) {int i, j; (I = 1; i & lt; n; i ++) for {J = I; While ((j> 0) & amp; amp; amp; (s [j]   

Here the sample classification array is a = {5, 2, 4, 6, 1, 3}. In my opinion, the second version takes more steps because it swaps the number one by one, while the first loop swaps more numbers in the loop and then swaps the smallest number. For example: to index = 3, both versions take the same steps, but when the index = 4 arrives, to take the number 1 swap, takes more than 1 phase in 2. What do you think?

"Number of numbers" is nothing useful.

Is one step one line? a statement? an expression? An assembler directive? A CPU micro-op?

That is, your "steps" are converted into assembler and then optimized, and the resultant instructions can be different (and potentially variable) runtime costs.


Wise questions you can ask:

1 algorithmic complexity is it?

As noted in response to the comments and arpit of rifle kettler, it aligns algorithm scales as to how the input size

2 how to do

If you want to know which is faster (for some set of input), you should measure it.


If you want to know what more swap does, then why not just type a swap function every time it is called , And detects, then enhances a global counter?

oracle11g - Oracle shared memory realm does not exist -


I'm running Oracle 11 on a Windows 7 machine. This morning I have this strange problem when I try to connect to the database, then it says 'Shared memory area is not present' However, when I use the Database Configuration Assistant, select a database and click the Next Do this, retrieving 'database information'. During that time, when I connect to the database, after 'getting information of database' once in the 'Oracle shutdown in progress' message (and I do not exceed that step in database configuration assistant) I'm able to connect to the database without issue.

I used to compare environmental variables and windows before and after the services and all of it were the same.

The question is, what does 'retrieve database information' in the Database Configuration Assistant, determines that 'shared memory area is not present' problem?

Any suggestion will be useful

PS I have examined other questions related to this topic in StaxHowFlow and found nothing useful or I did not understand it properly. Please do not close this question as a duplicate.

thanks guys

I solved the issue below.

1) Select & gt; Program & gt; Oracle - HOME_NAME & gt; Configuration and Migration Tool & gt;

2) Select the Startup / Shutdown option. 4) Select the Oracle instance tab.

Select starting example when the service is started, the service is stopped, or the two are closed.

I restarted the machine and it worked.

iphone - iOS - Best way to select an area of an image -


I'm looking for the best way to select an image area. Actually I want to load some jpgs, and let the user scale or move it, and get the coordinates on the image of a predecessor in the center of the picture. What is the best way to do that ? Does anyone know a library? Thank you in advance

The best way is to use the UIImagePickerController class.

You can navigate in this way:

  - (zero) Choose Photoform Library {UIImagePickerController * cameraUI = [[UIImagePickerController alloc] init]; CameraUI.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; // Shows controls for moving & amp; Scaling photos // To hide the control instead, use NO. CameraUI.allowsEditing = Yes; CameraUI.delegate = self; [Self-present ViewController: cameraUI animated: yes complete: zero]; }   

and then get the edited image like this:

  - (zero) imagePickerController: (UIImagePickerController *) Picker didFinishPickingMediaWithInfo: (NSDictionary *) information {UIImage * Basic = Info [@ "UIImagePickerControllerEditedImage"]; // whatever you want with the image, [self-sharpening visual controller; unlimited: yes complete: zero]; }    

javascript - HTML Select Tag and changing values in the drop box -


I have a select box, I want to drop down the text to show one thing and when it is selected in the box If it goes, then this one else does not show my value tag either I would appreciate all the help. For example:

For example:

Select the selection box when it is not left below, should say and value is selected:

T2 <

T1: (includes T1A, T1B, and T1C): Tumor 2 cm (3 inches) 4 inches) or less.

T2: The tumor is more than 2 cm but not more than 5 centimeters (2 inches).

T3: The tumor is more than 5 cm.

Option labels are not fully supported (even if they think they are :))

To trick and work it , Add a first blank & lt; Options & gt;
We will use jQuery

  • Hold the selected option value,
  • copy that value to text and empty & lt; Options & gt; Tags

    Value for jQuery

      $ .fn SelectLabelize = function () {var v = $ (': selected', this) .val (); $ ('Option', this) .eq (0) .text (v) .val (v) .prop ('selected', true); }; $ ('Select'). Each (function () {$ (this) .selectLabelize ();}); $ ('Choose'). ('Change', function () {$ (this) .selectLabelize ();});   

    In view of such a HTML :

      & lt; Select & gt; & Lt; Options & gt; & Lt; / Options & gt; & Lt; Optgroup label = "T1" & gt; & Lt; Option value = "T1a" selected & gt; A - Tumor is 2 centimeters (3/4 inches) or less. & Lt; / Option & gt; & Lt; Option value = "t 1b" & gt; B - Tumors are 2 cm (3/4 inches) or less. & Lt; / Option & gt; & Lt; Option value = "t 1c" & gt; C - Tumors are less than 2 cm (3/4 inches) or less. & Lt; / Option & gt; & Lt; / Optgroup & gt; & Lt; Optgroup label = "T2" & gt; & Lt; Option value = "T2" & gt; The tumor is more than 2 cm but not more than 5 cm (2 inches). & Lt; / Option & gt; & Lt; / Optgroup & gt; & Lt; Optgroup label = "T3" & gt; & Lt; Option value = "T3" & gt; The tumor is more than 5 cm & Lt; / Option & gt; & Lt; / Optgroup & gt; & Lt; / Select & gt; Pure JS must be used:  

       code> select function label ( ) {Var v = this.value; this. Options [0]. WinnerHTML = v; this. Option [0] .value = v; this. Options [0]. Selected = true; } Var sel = document.getElementsByTagName ('Select'); Var ev = document.createEvent ('Event'); Ev.initEvent ('change', true, false); (Var i = 0; i & lt; sel.length; i ++) {cell [i] .addEventListener ('change', select label); Sel [i] .dispatchEvent (EV); }    

wordpress - CSS class for specific list item -


I want to add a CSS class to a specific NAV menu item (s) if the latest post of a certain custom post type is a

This is what I have found so far. It works fine but the CSS class is added to all menu items, how can I target specific li from the ID?

  function blog_menu_item_new_posts ($ squares, $ item) {global $ wpdb; $ Latest_post = $ wpdb- & gt; Get_var ("SELECT post_date FROM $ wpdb- & gt; Posts WHERE post_type = 'blogposts' and post_status =' Publish id id DESC limit 0,1"); $ Latest_post_date = strtotime ($ latest_post); $ Threshold = Strottom ("- 1 week"); If ($ latest_post_date> = $ threshold) {array_push ($ class, "new-post"); } Return $ class; } Add_filter ("nav_menu_css_class", "blog_menu_item_new_posts", 10, 2); This code is working to target only a specific menu item from the item (in this) (<)    

case ID 101): function blog_menu_item_new_posts ($ classes, $ items) {global $ wpdb; $ Latest_post = $ wpdb- & gt; Get_var ("SELECT post_date FROM $ wpdb- & gt; Posts WHERE post_type = 'blogposts' and post_status =' Publish id id DESC limit 0,1"); $ Latest_post_date = strtotime ($ latest_post); $ Threshold = Strottom ("- 1 week"); If ($ latest_post_date> = $ threshold) & amp; amp; ($ item-> ID == 101) {array_push ($ classes, "new-post"); } Return $ class; } Add_filter ("nav_menu_css_class", "blog_menu_item_new_posts", 10, 2);

maven 3: Accessing version of "root" corporate POM -


Using Maven 3.0.4.

I have been assigned the task of providing corporate parent POM for our organization. My team will provide support for the development of questions or issues while using this POM. Often they will attach a build log to a support ticket. Therefore, I want my Corporate POM to co-ordinate Corporate Guardian's version with any build console. I am using the Enter plugin for this.

  & lt; GroupId> Org.apache.maven.plugins & lt; / GroupId> & Lt; ArtifactId & gt; Maven-antrun-plugin & lt; / ArtifactId> & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; ID & gt; Echo construction environment & lt; / Id & gt; & Lt; Step & gt; Valid & lt; / Step & gt; & Lt; Goals & gt; & Lt; Goal & gt; Run & lt; / Target & gt; & Lt; / Targets & gt; & Lt; Configuration & gt; & Lt; Goal & gt; & Lt; Echo level = "info" message = "maven $ {maven.version}" function name = "version" /> & Lt; Echo level = "info" message = "corporate POMs $ {wish.the.version.here}" taskname = "version" /> .... & lt; / Target & gt;   

I do not know how many "levels" of POM heritage can come between the corporate parent and the POM used in the build.

  Corporate-originated team-basic application-parent child-module   

or as simple as: <<> Code $ $ {project.version} can not be resized / as the version of present (hair) project I can not use $ {project.parent.version} because I do not know how many legends I could have used hard code for corporate POM version of & lt; Corporate.pom.version & gt; Tried to define the asset, however, when I release my company POM, the release plugin does not know to update that property (which is understandable, it is not a dependency version, There is only one property, the release version can not know to update it).

Ideally, I want to be able to directly get a specific pom version directly, like a property, $ {some.groupId.corporate-parent.version} some. Is there anything like that?

If not, is a POM property being released with a releaseVersion during a release to release the project?

I can return the brute force on the way to manually edit the property before every release. My teammates did not appreciate this approach.

I hope that I do not have to write a custom plugin to do something that does not seem difficult at first glance.

I stopped using maven-antrun-plugin and its Switched instead I can get the necessary information with a simple POM hierarchy transcellal

  & lt; Plugin & gt; & Lt; Group & gt; Org.codehaus.gmaven & lt; / Group & gt; & Lt; ArtifactId & gt; Groovy-Maven-plugin & lt; / ArtifactId> & Lt; Version & gt; 2.0 & lt; / Edition & gt; & Lt; Hanging & gt; & Lt; Execution & gt; & Lt; ID & gt; Echo construction environment & lt; / Id & gt; & Lt; Step & gt; Valid & lt; / Step & gt; & Lt; Goals & gt; & Lt; Goal & gt; But execution & lt; / Target & gt; & Lt; / Targets & gt; & Lt; Configuration & gt; & Lt; Source & gt; & Lt ;! [CDATA [Def root pim = project; Whereas (rootPom.parent! = Null) {rootPom = rootPom.parent; } Project.properties.setProperty ('root.pom.version', rootPom.version); Log.info ("Maven Home:" + project.properties ['maven.home']); Log.info ("Java Home:" + project.properties ['java.home']); Log.info ("User Created:" + project.properties ['user.name']); Log.info ("Corp POM Version:" + Rootpam Edition); ]] & Gt; & Lt; / Source & gt; & Lt; / Configuration & gt; & Lt; / Execution & gt; & Lt; / Hanging & gt; & Lt; / Plugin & gt;   

project.properties.setProperty has stored the property calculated so that it can be accessed by the child's POMs.

The resulting log looks:

  [INFO] Maven home: c: \ dev \ maven \ apache-maven-3.0.4 [INFO] Java home: c: \ Program Files \ Java \ jdk1.7.0_13 \ jre [INFO] User-Created: user944849 [INFO] Corp POM Version: 0.26-SANAPSHOT    

sql server - binding muliple data from sql to label by choosing item in combobox -


How do I get multiple data from SQL if I select an item in the combo box which is from SQL This is my code :

  private sub Simsiosisacleted Indiks (changing systems as the sender. object, by Val a's system. Aventargs) is Simbo course handles. CMBO course if selected index. Text = "advanced computer technology" in call () Alseef CMBO course. Text = "AUTOELECTRICITY" Then callme () elseif cmboCourse.Text = "automotive" Then callme () End If End Sub Private Sub callme () string as Dim str = ( "Data Source = PC1; User ID = sa ; password = pwd; Databasfriend ") dim con new SqlConnection (STR) as dim Strl choose from" tbl_course as = as the string * course "" new SqlDataAdapter (str1, con) DataSet1 dim new dataset () da LBL   

and this is my table

  CourseGord course ATAC Advanced Mputer (Department Course) Technikan AE AutoElectricity AM Automotive   

It binds only one data, I bind the course_code label of automotive to any specific column example and automotive into a course combo box Choose want to force some data, I add the same label Korskod how to choose AUTOELECTRICITY Autioielarsititi

this test is not Has been done, tell me whether this' does not work.

  private sub cmboCourse_SelectedIndexChanged (ByVal as the System.Object, ByVal e System.EventArgs) as handle cmboCourse.SelectedIndexChanged callme (cmboCourse.Text) End Sub Private Sub callme (ByVal course String as defined) Dim String String = ("Data Source = PC1; User ID = Sa; Password = pwd; Databasfriend") Select the thief named New SqlConnection (STR) as the str1 string as "Select" * Dbl from the Tbl_course [Course] = '& & amp; curriculum & amp; # 39; & # 39; & # 39; & # 39; & # 39; & # 39; as dormant new SqlDataAdapter (str1, thief) DataSet1 slow New datasets () da.Fill (DataSet1, "tbl_course") 'lbl.DataBindings.Add ( "text", DataSet1, "course.Course_Code") so dataset1.Tables ( "tbl_course"). Rows.Count & (0) ("Coursecod") Els MSBBC "Course [" & amp; Course and "] Not Found" End if End   / Pre> 

Please enter the code D. Fill (Dataset 1, "Course") You specify the table as 'Course', while the selection statement selects from the 'tbl_course' table, I'm assuming the name is later correct.

Edit 1:

Bug Fix

Edit 2:

Debugging

java - Is there a one-liner for dealing with singular/plural words in common languages? -


I often see that websites work like 1 idea, 1 day balance or 1 answer. It's just lazy to me because it's easy to set up often:

  if (view == 1) print view + "view" and print idea + "idea"   

I want to know if Java, Python, PHP, etc. have a liner in the same language, then there is something I can comment on those who do this and say, its easy Is it possible to add it to your code?

While using it on my site, it seems that many C-based programming languages Ternary supports operators. It's as easy as PHP:

  & lt ;? = $ View 'Roy' ($ View == 1? '': 'S'); ? & Gt;    

php - Running gearman on a Heroku Worker -


I have a PHP app running on the ookok (cedar stack). I am at that point where I have to start leaving the job of workers.

I have seen both RabbitMQ and Gearman It seems that the best solution for my app is to use the gearman

So I'm guessing the Gereman server main The webapp will run on the witch and then Gearman Verpairp will work on different Heroku workers, as well as the php code that should work.

How can I go about doing this with Heroku?

Thanks

Queued is best done with an addon on your question The comment (devcenter.heroku.com/articles/background-jobs-queueing) should give you some insights by Fixer so that you can get information about how to implement your workers.

javascript - window.location.hash not creating browser history entry -


मैं एक सरल चल रहा हूं:

  window.location.hash = "hash";   

पृष्ठ लोड होने के बाद यूआरएल में एक हैश जोड़ने के लिए मुझे मिल, mySite.com/aPage#hash जब मैं बैक बटन पर क्लिक करता हूं, तो मुझे उम्मीद है कि यूआरएल अपने सिक्योरिटी / ए पेज पर वापस लौटाए बिना किसी वास्तविक लोडिंग / वापस जा रहे हैं। इसके बजाय मुझे mySite.com/a पृष्ठ से पहले इतिहास प्रविष्टि पर वापस ले जाया जा रहा है।

यह ठीक काम करता है, जब मैं खिड़की कॉल करता हूं। Location.hash उदा।

मैंने एक परीक्षण बनाया है: कोड देखें:

सेटटिमेंउट फ़ंक्शन के अंदर केवल अंतिम हैश जोड़ा जाता है जैसे मुझे उम्मीद है। किसी भी विचारों को बिना सेट-टाइमआउट के काम करने का तरीका?

कोई भी विचार बिना इसे कैसे काम करें Setteimeout?

एक गतिशील रूप से बनाया गया और href के #yourHash जिसके साथ आप एक माउस क्लिक करें।

  window.onload = function () {location.hash = 'foo'; // कोई इतिहास आइटम नहीं बनाया गया, बस दृश्यता में मदद करने के लिए a = document.createElement ('a'), ev = document.createEvent ("MouseEvents"); A.href = '#bar'; // यह इतिहास आइटम ev.initMouseEvent ("क्लिक करें", सही, गलत, स्वयं, 0, 0, 0, 0, 0, झूठी, झूठी, झूठी, झूठी, 0, शून्य) बना देगा; a.dispatchEvent (EV); // प्रेषण क्लिक करें};   

कोड का डेमो Google Chrome 25 में परीक्षण किया गया।

java - What exactly is a Link(Symbolic or otherwise) -


I was working on the Java project with NIO.2 and I had to face the Files.createLink method. While doing some research on the Java tutorial, I found out that these windows look like shortcuts, but I'm not sure if they are the same. If they are not, how can I create a platform independently to create shortcuts?

Creating a symbolic link

If your file system supports it , you can create a symbolic link using createSymbolicLink (Path, Path, File Entry) method. The second path represents the logic file or directory and may or may not exist. The following code snippet creates a symbolic link with the default permissions:

Source:

android - speakToUser not defined in eclipse -


Can anyone tell me why speakToUser is undetermined in eclipse I did not get much help online I expanded a class abcAccService AccessibilityService , Taking the code from the developer site, I wanted to use the speakToUser function. But I get an undefined function in eclipse, what could be the reason for this.

Thanks

I believe this is you mention this Are:

  // Nifty with this text, as the string made on the user // speak back. SpeakToUser (eventText); ...   

This is not a real way, they do not explain it clearly, but it is just a theoretical method that you need to write yourself.


To create a speakToUser () method you will need to use the class, you can follow one for your help. There is also a sample project included with SDK, which has to go to Eclipse:

  • New -> Other ...
  • Then Android & gt; Android Sample Project
  • Finally select TtsEngine .

ruby on rails - passing extra values into a partial and to a create action through a form -


In my train app, I have an idea / question / show.html.erb page, which expects additional @ questions Variable also reaches an @tars variable to show all the answers of any specific navy.

Inside a loop that displays all the answers to a specific question, I want to display an area to comment for a user (not a question on the answer), so I have a The comment partially made, after the advice of the other SO, I have created a hash for the local people in which the variables have been passed. In the actions of the Controller of Comments, I want to use the answer (a comment is an answer) and the question (which is, to me: Answer), so I answer the question ID in partial and such as

 < Code> & lt;% answer @ tower% & gt; .... (code omit) & lt;% = render: partial = & gt; 'Comment / Form' ,: Local = & gt; {: Answer_id = & gt; Answer.id ,: Question_id = & gt; @ Question.id}%> ... (code omitted) & lt;% end% & gt;   

And I write partial like answer_id and hidden fields in comments by question_id then

 ; pass = lt;% = simple_form_for @comment | F | & Gt%; & Lt;% = f.input: Content, like: text, label: 'comment'% & gt; & Lt;% = f.hidden_field: user_id ,: value = & gt; Current_user.id% & gt; & Lt;% = f.hidden_field: answer_id ,: value = & gt; Answer_id%> & Lt;% = f.hidden_field: question_id ,: value = & gt; Question_ID% & gt; & Lt;% = f.button: Submit% & gt; & Lt;% end% & gt;   

In the actions of the comments controller, I def @question = Question.find (make this parameter

  [: comment] [: question_id] ) @answer = answer.find (parameter [: comment] [: answer_id]) @comment = @ answer.comments.build (parameter [: comment]) If @ comment.save flash [: notice] = "comment made successfully" Redirect_to root_path # redirect_to question_answers_path (@question) (Finally want to redirect to the question) and render: action = & gt; First problem, I think I have done something strange to remove the following question id (and answer id)    

pre> @question = Question.find However, these parameters are available as a result of submitting my form

  (  

Parameters: {"UTF8" => "One ????" "Authenticity_token" = & gt; "VtogfCsI137lbk2l64RXtrfRn / + RT1 / jM8pfDVY29gM =", "Comment" = & gt; {"Content" = & gt; "test", "user_id" = "12", "answer_id" => "25", "question_id" = "gtc:" 22 "}," committed "= >

Then I will have to type this question code such as params [: comment] [: question_id] < P> Second, more challenging problem (challenging for me) is that the rail is telling me

  can not give large-scale protected features: question_id   

I have no reason to store Question_id comment is on the model, etc. So I did not create a column in the database for this. However, when I do this

  @comment = @ answer.comments.build (params [: comment])   

Because one of question_id is Inside parameter: The comment (which is making a hidden field by me), is trying to save it in the Rail Comments table. However, there is only one reason that I really want to use this question in making the action of comment_controller.rb that after saving it it is necessary to use it to redirect the question.

Can you suggest what I can do to fix this problem? I feel that I do not have much experience with the train, I am doing all this in a very strange way, which is probably not working on it. I think this problem is to add a question_add column to the easy-to-use comment model, but there is no 'association' between them, so I think this is a wrong solution.

Your first problem is not a problem There are not too many ways to do this.

The second problem, you have to do this

@comment = @ answer.comments.build (params [: comment] [: content]. Merge (user_id: params [ : Comment] [: user_id], answer_id: params [: comment] [: answer_id]) otherwise you will try to specify the properties that you do not have

or else you Other ways can

  parameters [: comment] .delete ('question_id')   

and then

  @comment = @ answer.comments.build (Params [: Comment])    

r - Can knit2pdf use the global environment? -


In

, @Yehui said that knit uses a global environment, it confused me - My experience was that it is not. I do not really use the knit , however, I usually go straight to PDF.

In a little experiment it seems that the knit uses a global environment (or envir But that does not knit2pdf .

The minimum example: global_test.Rnw file