w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
MVC4 and page life cycle?
No, there is no page life cycle per se (because there is no 'page' object), but there is a request processing pipeline, which usually goes something like this: Incoming request is picked up by the System.Web.Routing.UrlRoutingModule which uses the request url to map the request to a controller action method. The appropriate controller is instantiated The OnActionExecuting-methods of action filters on the controller and/or action are invoked Model binding and input validation may occur The action method itself is invoked Any OnActionExecuted and OnResultExecuting-methods of action filters are invoked The ActionResult returned by the action method (typically, a ViewResult which renders HTML) is executed. Any OnResultExecuted-methods of action filters are invoked. The list above is just a

Categories : Asp Net Mvc

brightcove not showing when rendered (not page refresh - plain Backbone.js View re-render)
You should avoid using <script> tags inside your template. The external script should definitely be outside of your template and you can replace the following: <script> window.BCVideo = BCVideoFunction(); //BCVideoFunction as module pattern. </script> With: <% window.BCVideo = BCVideoFunction(); %>

Categories : Javascript

OracleConnection life cycle
The important question under this is: does the ODP OracleConnection implement connection-pooling? If it does (and many ADO.NET providers do), then the "best practice" code is absolutely fine; it might look like you are opening a connection, but with connection pooling that Open() is actually "get an underlying connection from the pool, or connect if there isn't one available". The Dispose() (at the end of using) releases the underlying connection back to the pool. With this approach, then, there is no need to track the state of the connection - you let the pool worry about that. It looks like connection pooling is enabled in ODP by default, with connection-string parameters to tweak it (source)

Categories : C#

Android inter-Activity life cycle
Follow the diagram you will understand what happens when one activity goes in background and other comes to foreground. In step 2 MainActivity disappeared from the screen, but was left in memory and was not destroyed. But in the step 3 ActivityTwo was destroyed just after it disappeared from the screen. And in the step 4 in the end MainActivity was destroyed. This is bcos when Activity_A invokes Activity_B, Activity_B is put on the top of the Task and receives focus. Activity_A remains in the Task but is in the Stopped state (is not visible and not focused). After this, when the user clicks the Back button when Activity_B is opened, Activity_B is deleted from the task and destroyed. And Activity_A is now on the top of the Task and gains focus. Activities are stored in the task in the

Categories : Android

activity's life cycle is beyond its application process?
If you reopen the app via the activities list, it will attempt to restart via the last open activity. It's a "feature" of Android that can be incredibly annoying (and frequently just wrong)- Android assumes every app can serialize its entire state when exited for later reopening. You either need to do that (via onSaveInstanceState and onRestoreInstanceState) or you need to catch when you're relaunched and explicity launch your main activity. This shouldn't happen if you're relaunched via the app launcher, as that should always launch your specified activity.

Categories : Android

ASP Life-Cycle, InnerHtml and Dynamic Controls
The javascript innerHtml attribute will be rendered after the ASP.net lifecycle has completed, as it happens on the serverside. As such, it will have no effect on C# code within the lifecycle. With respect to postbacks, consider the postback a totally new request - your controls will need to be regenerated after all of the serverside events have completed.

Categories : Javascript

Android activity life cycle with asynctask
For me is not actually clear what is question about. For a reference two important points if some newbee comes here and read. it takes some time list to load because it is long operation. Purpose of AsyncTask is to keep UI not blocked. It's purpose is not to magicaly speed up things to infinity (btw even if it is light speed is a limit). onStop() in this code is useless, it does nothing. super.onStop() would be called even if you delete completely your overriden onStop method because base class ListActivity is extended from Activity which has this method and it will be called. You didn't add anything by just calling super.onStop() Just for records onPreExecuting and onPostExecute are executing on main (UI) thread..doInBackground is running in separate thread but Android wrapped everythin

Categories : Android

Interfere in Jersey REST life cycle
There are 4 basic http methods in REST, namly GET, PUT, POST, DELETE. Your annotation tells Jersey what method to call when a http request occurs. Jersey looks up the target URI in the request and matches it against your model. If the request is a http get it will execute the method annotiated with @Get from the class with the correct @Path annotiaton. Usually you dont want to grant access to your resources in this annotated method directly. A common (may not perfect) way is to implement a DAO class that handles access to your resources, and of course does the validation before it returns the resource back to the @Get annotated method, which will itself only pass the resource to the client. So you will get another layer in your application between persisting (SQL, etc) and the client inter

Categories : Java

How does the Android life cycle demo make a dialogue box?
Not sure about this specific example, but in general, to make an activity look like a dialog, place the theme in your manifest (under your activity): <activity android:theme="@android:style/Theme.Dialog" />

Categories : Android

Object life cycle in java and memory management?
Only one object is created. string s1 = "java"; string s2 = "ja" + "va"; s.o.p(s1==s2); The statement yields true. String s1="java"; string s2 = "ja"; String s3 = s2 +"va"; s.o.p(s1==s3); The statement yields false. So minimum one apparent should be permanent, then '+' operator generates new string object (in non constant pool using new()). So, the question you asked does not have one also permanent. This means it creates only one object.

Categories : Java

basics of android activity life cycle functions
Thats' because there's a chance that onStart might not get called even when onResume actually is, there's a scenario when the activity might go to onPause only, without going to onStop [it only happens when activity is partially visible, not completelly covered by another activity], hence when comming back to activity only onResume will be called and not onStart. Same with onPause, its always executed before onStop but onStop might not be called after onPause, as mentioned before, it could be called without onStop being actually called. If you press HOME you will not see the behavior i just explained because the activity is not partially visible, in order to reproduce it you have to find a way to make another component come on top without completely covering the activity... Hope this hel

Categories : Android

Execution life cycle of MXML+actionScript files
Is MXML file first convert to .as file and the able to run or some other conversions happen? Yes, the mxml compiler will convert MXML files into Actionscript classes. The mxml compiler generates a lot of code, which by default is not saved in your project. You can, however, add the -keep-generated-actionscript option (or just -keep) to the compiler options of your project you can see the generated code. Here is a reference to the various compiler options. Right click your project in Flash Builder, select "Properties", and select "Flex Compiler" to see/edit the compiler options.

Categories : Actionscript

Activity life cycle creating,starting and running procedure
No. If you "sleep" your first Activity, assuming you are talking about the UI thread and not a background thread, then your whole UI will sleep for that time...meaning your second Activity won't be started yet and your song won't play. What you could do is put it all in one Activity and put your image and calculator in the same position, or wherever you want in the layout, and hide your calculator from the beginning in your xml with android:visibility="invisible" // or gone depending on what you need Then you can change the visibility of both views when you need. I don't know exactly what you want so I don't know if this solution is suitable. You also could look into putting your song in a Service

Categories : Android

jsf Life Cycle:storing component tree and form value in Restore View
How can I see what is saving in ui component tree in restore view phase? This question is ultimately confusing. There's nothing being saved during restore. Instead, the state is being restored. The save of the state happens during render response phase. You can see it happen in the saveView() method of the JSF-implementation specific implementation of StateManager. In case of Mojarra, it's StateManagerImpl#saveView(). Where does form values(like form input field value) are saved in restore view phase? The view state does not contain any form values. The submitted values are just obtained as HTTP request parameters the usual way during apply request values phase. If you're familiar with basic Servlet API, you surely understand how that works. And how ui component tree ext

Categories : JSF

Weird behavior of activity (life cycle) when called on SCREEN_OFF intent fired
It would seem to me that you need to know if the screen is actually on or off when onResume is being called, to determine how you should handle the event. You want to check: That your activity is in the foreground. That the screen is on. Getting if Screen ON/OFF and if Application is in Background/Foreground gives clear answers to how to do both of these.

Categories : Android

render a full web page in node.js code
Use the Mikeal's Request module to make http requests once you captured the response you then can inspect the html however you like. To make that easier though you should use cheerio, this will give you a jQuery style api to manipulate the html.

Categories : HTML

Delete Drupal system blocks from the blocks listing page
Why would you want to delete them? Ideally, only administrators would be able to get to the configuration place to touch that list. If you really had, to could implement this hook hook_block_list_alter in a custom module. https://api.drupal.org/api/drupal/modules!block!block.api.php/function/hook_block_list_alter/7

Categories : Drupal

Rails render JS partial printing code to page
You can try it with some modification : respond_to do |format| format.js end Inside the action and in the view action_name.js.erb write your js code ar if you want to put your erb then use escape_javascript. Check the following link : Why escape_javascript before rendering a partial?

Categories : Javascript

Testing specific text on page render a code smell?
I do both in my tests: check selectors and check copy. Its good if tests fail due to copy changes. Its a bit more maintenance but the people who change copy should also be running tests or you should have a continuous integration setup to notify immediately if tests fail. It gets a bit more complicated if you start running a/b or multivariant tests but it isn't insurmountable...Like I said, just more maintenance. IMO, the tradeoff of maintenance vs confidence in code coverage is well worth it.

Categories : Ruby On Rails

model validation errors not rendered with render :action => "index"
i think i resolved this issue, but im not sure if my fix is proper. I forgot to mention that on the main index.erb.html i have a search bar and a submit buttom embedded in an ajax form that calls the create function inside the controller <%= form_tag(@track, :remote=>true, :method => :post, :class => 'new_track') do %> <%= text_field_tag "track_query", nil, :placeholder => 'enter a query or a link', :id => "search_bar", :name => "track[query]", :size => 30, :required => true %> <%= submit_tag "add" , :name => 'commit'%> </p> <% end %> i also now have the error div in the same page (I deleted the render partial and just stuck an empty div to be populated in the index.erb.html): <div id = "error_message"> </div>

Categories : Ruby On Rails

Twig: render Symfony2 controllers which extend blocks in the parent template
exactly what @Pazi says in the comment: Do you need a controller? It looks pretty simple to just include the template by itself, without using a controller. You might use the include tag to include the subtemplates. {% include 'MyControllerBundle:Default:header.html.twig' %} For reusing the javascript block from the rendered sub controllers, you could create a base template that contains the javascripts block. Then extend that base template file in your header and footer. Or just including the base template in them should work, too.

Categories : Symfony2

Drupal blocks - two javascripts which work independently as blocks don't work when placed on same page
So it appears that you're not using closures around your code, this is important as any code not in a closure is global. As such right now both output functions exist... but which does the browser use... that is anyone's guess. A closure looks like this: (function(){ "use strict"; window.getRisk = function(){ your code }; function output() {your code }; }()); (function(){ "use strict"; window.getRiskJp = function() { your code }; function output(){ your code }; }()); Please note that I am defining the functions that need to be visible outside the closure on the window object otherwise they will not be visible for callbacks.

Categories : Javascript

Laggy Code in Game of Life 3D
Make sure that this piece of code is actually the performance bottle neck. Even though you are using xxxGL, drawing may be time consuming. Review the list types you are using and make sure they are efficient for the operations you are performing on them. For example, depending on the type of the cell list, for (int i = 0; i < cell.Count(); i++) { if (cell[i].dies) { if (animated && delay == 50) { cell.RemoveAt(i); cellsdied += 1; i--; } else { cell[i].willdie = true; } } } this code may be really slow because of the RemoveAt(i), i-- style you are using to iterate. 3.Consider keeping some of your data

Categories : C#

how to make a meteor template helper re-run/render after another template has rendered?
You need a dependency in the template that you want to rerun. There are few possibilities, depending on what data you want to get. For example, you can set a reactive marker in the content template that will notify renderNav that it's done with drawing. Template.contentWidnow.rendered = function() { ... // Set this on the very end of rendered callback. Session.set('contentWindowRenderMark', '' + new Date().getTime() + Math.floor(Math.random() * 1000000) ); } Template.renderNav.contentData = function() { // You don't have to actually use the mark value, // but you need to obtain it so that the dependency // is registered for this helper. var mark = Session.get('contentWindowRenderMark'); // Get the data you need and prepare for displayin

Categories : Javascript

remove empty lines from HTML, except in blocks
Let's assume you have loaded the html as text (HTML): HTML = """ html html html code-start code code code code-end """ new_html = "" is_code = False for line in HTML.split(' '): # disable empty line remover when code starts if line == 'code-start': is_code = True # check for empty line/is_code if is_code or line != '': new_html += line+' ' # enable empty line remover when code ends if line == 'code-end': is_code = False print new_html Of course you have to replace code-start and code-end with valid html tags. This is just a quick and dirty approach but should help you.

Categories : Python

How to simplify this code using cycle
You can add an attribute to those div's you have like rel="1", rel="2" and so on and add a common class like class="iWantToHover", so when you rewrite the code it should look like this; $(".iWantToHover").hover(function() { var r = $(this).attr('rel'); for (int i = 1; i < 5; i++) { if (r === i) { $('#vysuv_'+i).fadeIn(750); } else { $('#vysuv_'+i).fadeOut(750); } } } That should give you an idea about it. This was my first answer... You can use the jQuery selectors[1] like; $("#vysuv_obal_4").hover(function() { $("[id~='#vysuv']").fadeOut(750); }); [1] http://www.w3schools.com/jquery/jquery_ref_selectors.asp

Categories : Jquery

How to find where is the import cycle in go code?
And the collective answer based on comments above: Its a known issue, recently fixed so look out for a new release or compile the go tool from source. (Contributed by: @MatrixFrog, @infantDev, @jnml and @nemo)

Categories : Go

How to design content blocks which render HTML content as tumblr does?
You are talking about template engines. There are many. See Wikipedia’s comparison of web template engines. For more about the concepts, see the article Web template system.

Categories : HTML

Why can I not save a page rendered as a PDF?
Probably PDF was incorrectly embed into HTML content. Should be something like: <embed width="100%" height="100%" name="plugin" src="http://..." type="application/pdf"> on your page. You can install Adobe web plugin. It works fine. Plugin's save menu occurs in the right bottom corner.

Categories : Pdf

How to retain the 0 value after the view page is rendered?
You need to define this in your timepicker configuration like $('#timepicker').timepicker({ showPeriod: true, showLeadingZero: true }); You can find more information on Francois Gelinas page on TimePicker

Categories : Jquery

PhantomJS: getting the rendered dimensions of a page
Try using the page.onLoadFinished callback: var wp = require('webpage'); var page = wp.create(); page.viewportSize = { width: 1024, height: 768}; page.open(url); page.onLoadFinished = function() { var f = "rendered.png"; //Produces an image with height 4073px page.render(f); //height is only 150 var height = page.evaluate(function() { return document.body.offsetHeight }), width = page.evaluate(function() { return document.body.offsetWidth }); console.log(height,width); }; This should return the correct height and width after the page content has finished loading. I think the difference is that page.onLoadFinished waits for all content to finish loading and not just for a 200 OK response which is equivalent to the success status.

Categories : Javascript

Django home page URL being rendered as a different URL
You are including the same URLpatterns twice. Your main urls.py should just be: urlpatterns = patterns('', url(r'', include('app.urls')), ) Then your URLs will resolve/reverse as expected.

Categories : Python

Chome API - get rendered page source
You can use http://api.jquery.com/html/ to get the html contents of any element. Run .html() on the highest level element you want to get all source code inside. eg: var myHTML = $('my-container').html();

Categories : Javascript

Get HTML content from page rendered by javascript
something like this? console.log(document.getElementsByTagName('html')[0].innerHTML); or document.documentElement.outerHTML per dan

Categories : C#

How to keep url intact while changing the rendered page in ExpressJS
Well, you can make your route handler as dynamic as you want: app.get('/', function (req, res) { //here you can render a different page based on whatever //such as the referer header //what day of the week it is //a random page, whatever }); If by "called from" you mean the user clicks a link to your site on the page at 'http://abc.com', the request your express app receives will have abc.com as the Referer header in req.get('Referer'), so you could use that value to render a dynamic response but the URL in the browser would remain 'yoursite.example/'.

Categories : Node Js

JSF/Primefaces AJAX page rendered callback
As your actually loading content within an iframe, you can solve this problem by adding a little bit of javascript to your page, and especially the onloadevent handler. For example: <iframe id="navigation" src="#{layout.navigation}" onload="hideDialog()" style="position: absolute; top: 0px; left: 0px; bottom: 0px; right: 0px; width: 100%; height: 100%; border: none; margin: 0; padding: 0; overflow: hidden; z-index: 999999;"> </iframe> The code above will cause the hideDialog() function to be executed when the content within the iframe has finished loading. The function you call (e.g. hideDialog()) can contain a reference to the dialog generated by JSF/primefaces and hide it. <script> function hideDialog() { if(statusDialog != undefined) statusDialog.hide(); } </s

Categories : Ajax

Page not rendered from Express POST route
If you are trying to render an express page through your $http call , it will just not work. You should only request data through ajax,not pages. If you need to redirect to page , use the $window service , in the ajax callback. $window.location="/search"; if your express controller renders json there should be no problem. but since you are using the method res.render i understand it is not the case.

Categories : Node Js

CSS3 Run Page Transition When Html Rendered
As you only care about IE10+ (and other major browsers I assume), you can use the HTML5 event DOMContentLoaded. document.addEventListener('DOMContentLoaded', function () { document.body.classList.add('loaded'); }, false); This is supported in Chrome 0.2+, FF 1.7+, IE 9+, Opera 9+ and Safari 3.1+.

Categories : Javascript

res.redirect not working after the page is rendered with data
It sounds like you want this flow: User clicks link to /api/resetpassword... express runs the resetPasswordPage function resetPasswordPage responds with the reset password form HTML page, pre-filled out based on the query parameters I think at this point you don't like the URL in the browser address bar, which is why you think you need a redirect. But you need those query string parameters, and if you do a redirect to just /resetPassword, you'll lose them. So you either have to live with the URL (which I would recommend as it's the simplest) or rely on session state and the session cookie. However, marking the session with something like passwordResetOK=true probably exposes you to a whole bunch of CSRF attacks that the _csrf query string parameter is there to prevent. You don't need any

Categories : Javascript

How to sign out so that when the page is rendered it does not know the user is authenticated?
Instead of returning a View, use RedirectToAction or RedirectToRoute. public class LogOffController : Controller { public ActionResult Index() { FormsAuthentication.SignOut(); return RedirectToAction("Index", "MyController"); } }

Categories : C#



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.