w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Resize content frame in webView without modifying UIWebView frame?
The UIScrollView property is available for UIWebView starting in iOS 5. You can use that to resize your view by implementing the webViewDidFinishLoad: message in your delegate, like this: -(void)webViewDidFinishLoad:(UIWebView *)webView { CGRect newBounds = webView.bounds; newBounds.size.height = webView.scrollView.contentSize.height; webView.bounds = newBounds; } Or [self.webView stringByEvaluatingJavaScriptFromString: [NSString stringWithFormat: @"document.querySelector('meta[name=viewport]').setAttribute('content', 'width=%d;', false); ", (int)self.webView.frame.size.width]];

Categories : Iphone

How do you bind to a listbox.itemtemplate in a style's content template content control
In the ListBoxItem style add ContentTemplate="{TemplateBinding ContentTemplate}" <ContentControl Content="{TemplateBinding Content}" ContentTemplate="{TemplateBinding ContentTemplate}"> <!-- style stuff--> </ContentControl>

Categories : Wpf

Difference between view and template in Grails
Basically Template is a (reusable) part of a View. Useful for splitting View into logical parts and/or for reusing same code from different views. So, if you're rendering a whole page - use View. If you need just a small part - use Template. See docs for Views and Templates - http://grails.org/doc/latest/guide/theWebLayer.html#viewsAndTemplates

Categories : Grails

template not found in grails application
You are getting this error, template not found for name [form] and path [/base/_form.gsp] because Grails is looking for _form.gsp in a path relative by convention to a folder with the same name as the controller that is rendering the parent gsp. This will always be the case if you don't supply an absolute path (starting from views folder) in the render tag. Where is your _form.gsp page? Here are some example paths grails-app/views/_form.gsp -> <g:render template="/form" .. grails-app/views/base/_form.gsp -> <g:render template="/base/form" ... or -> <g:render template="form" .. //if calling from baseController So if _form.gsp lives in color and color is at grails-app/views/color, you would need the following path in your render tag:

Categories : Grails

MultiLingual Email template with grails
Can you work around this by creating a model containing a list with the correct translations? For example: def messages = [:] messages['hello.world'] = messageSource.getMessage( "hello.world", null, new Locale("nb") ) def template = groovyPageRenderer.render( template: '/mail/email', model:[messages:messages] ) And then in the view you just write: <html> <head> <title>${messages['hello.world']}</title> </head> <body> </body> </html>

Categories : Grails

Render Grails template from external source
Looking at this thread it seems that you can transform a String in a template using groovyPagesTemplateEngine. Example: // compile the gsp def compiledContent = groovyPagesTemplateEngine.createTemplate(content, 'SomeUniqueIdForTheContentBeingRendered') // render the gsp def sw = new StringWriter() compiledContent?.make(args)?.writeTo(sw) String renderedContent = sw.toString()

Categories : Grails

How to show data (in front of every content) in div if content come in huge lines in jQuery?
I would do something like this: .data .status, .data .text { float: left; } .data .status { width: 25%; } .data .status span { display: block; } .data .text { width: 75%; } <section class='data'> <div class='status'><span>Changed</span></div> <div class='text'>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Fusce condimentum blandit neque. Nulla facilisi. Sed ornare luctus nulla euismod tincidunt. Cras rhoncus semper mi vitae facilisis. Nulla facilisi. Aliquam feugiat quis dui sit amet pretium. Nunc et accumsan risus, non lobortis mi. Donec pulvinar lacus diam, eu feugiat tortor malesuada a. Aenean pretium quam mi, id tincidunt nulla posuere nec</div> </section> var $data = $('.data'); $data.each(function

Categories : Jquery

how to create a view pager which first show only PagerTitleStrip and after end AsyncTask show viewpager content
initialay make content invisible then in onPostExecute() make it visible use this code class MyTask extends AsyncTask<Void, String, String> { @Override protected void onPreExecute() { super.onPreExecute(); } @Override protected String doInBackground(Void... params) { //do your stuff here return myString; } @Override protected void onPostExecute(String result) { super.onPostExecute(result); //do something with result here //then display content here } }

Categories : Android

grails: show field of object in gsp
With your current approach you can do def show(){ // look up your patient object def patient = Patient.get(123) def patientCityObject = Cities.findByCityName(patient.city) [patientCityObject: patientCityObject ] } GSP: <p>${patientCityObject.cityName}</p> However, If you define the association between your domains then Grails will load your city when you are accessing it. To access you city object associated with Patient, you can define it as follow: class Patient { ... Cities city; ... } Then when you have the patient object, you can easily access its property city. def patient = Patient.get(123) patient.city.cityName This will give you the city object associated with your patient. Then you can pass that into your GSP and use it. To learn mor

Categories : SQL

Printable prints whole frame instead of content
Well, to start off, why would you call Frame.printAll(g) if you are only concerned about printing the image? Instead of doing that, just try drawing the image: g.drawImage(Image, x, y, null);

Categories : Java

HtmlUnit unable to get frame content
You may try to get that frame using next code: HtmlPage framePage = (HtmlPage)pageAfterLogin.getFrameByName("your_frame_name").getEnclosedPage(); After getting source of the frame you may get html elements (like you did on login page) inside this page.

Categories : Java

Web content doesn't fit webview's frame?
Primarily : set the delegate to the WebView In .h file @interface WebViewViewController : UIViewController<UIWebViewDelegate> In .m file webView.delegate =self; webView.scalesPageToFit = NO; NSString *urlAdress = @"http://google.de"; NSURL *url = [NSURL URLWithString:urlAdress]; NSURLRequest *request = [NSURLRequest requestWithURL:url]; [webView loadRequest:request];

Categories : IOS

grails: show list of elements from database in gsp
I am not sure if this is really what you meant, because in that case I suggest you to read some more on the grails :), but anyway, for your case you can use render, redirect as well but here I am taking simplest way: In your controller you have: def getAllElements(){ List<Event> todayEvents = Event.findAllByStartTime(today) [todayEvents :todayEvents ] } and then in the GSP(I assume you know about grails conventions, as if you don't specify view name, it will by default render gsp page with the same name as the function in the controller, inside views/): <g:each in="${todayEvents}" var="eventInstance"> ${eventInstance.<propertyName>} </g:each> something like this.

Categories : Database

Grails How to make address show in two line?
This is a bad approach but you can try studentInstance.location = loc.address1 + "<br> " + loc.city + ", " + loc.zipCode Generally, I would have each of the element of address available in view so that the styling is flexible in view than in controller, something raw would look like: <td><g:message code="location.label"/></td> <td>${model.address1} <br> ${model.city}, ${model.zipCode}</td>

Categories : Grails

how to set the X-Frame-Options in a content hosted by github?
Support answer : We block iframes to prevent clickjacking attacks against our users. We do this by sending the "X-Frame-Options: deny" header for every page. Clickjacking is a legitimate attack vector and at this time we do not have plans to remove the "X-Frame-Options: deny" header or allow exceptions for non-GitHub owned properties. It's unfortunate that such measures are necessary, but we have a responsibility to take all practical steps to protect our users.

Categories : HTML

Overflow content outside of HTML Frame Element
Are they actual frames within a frameset? If so, I don't think it's possible. I would suggest not using frames. See for example http://stackoverflow.com/a/15938545/694325 for reasons why not to use frames.

Categories : Javascript

Which LayoutManager should I use for my main frame's content pane?
Which Layout Manager should I use for my main frame's content pane? That's the easy question. You should use a FlowLayout or a BorderLayout, because most Swing GUI's should have one main JPanel. Complex GUI Your real question is a bit harder. You have a complex GUI layout, which will require more than one JPanel and more than one layout manager. The following comments are my first impression. I reserve the right to make changes based on testing the actual coding of the GUI. Right Side The right side of the GUI requires a JTabbedPane. I can only see one of the JPanels in the JTabbedPane. The layout manager for that JPanel is a GridBagLayout. Left Side The left side of the GUI requires 4 JPanels inside of a JPanel. The layout manager for the left side JPanel is a BoxLayout,

Categories : Java

How to show flash.message in Grails after AJAX call
You have couple options, First you can try to return the message from your controller in a form of json or a map and render it on the screen your self using javascript libraries, which is a bit different if you want to use Grails ajax tags. The other option is using a plugin like one-time-data , which Summary A safe replacement for "flash" scope where you stash data in the session which can only be read once, but at any point in the future of the session provided you have the "id" required. Description This plugin provides a multi-window safe alternative to flash scope that makes it possible to defer accessing the data until any future request (so long as the session is preserved). more Hope it helps

Categories : Ajax

How to show images uploaded by uploadr plugin in Grails
You should use a path in your app like this: <uploadr:add name="ComonUp10" path="uploadFile/" direction="up" maxVisible="8" unsupported="/my/controller/action" rating="true" voting="true" colorPicker="true" maxSize="204800000" /> here uploadFile/ will be a folder inside web-app directory in your grails application. and then you will be able to see already uploaded files as: <% def path = new File("uploadFile/") %> <uploadr:add name="mySecondUploadr" path="${path}" direction="up" maxVisible="5" unsupported="${createLink(plugin: 'uploadr', controller: 'upload', action: 'warning')}"> <% path.listFiles().each { file -> %> <uploadr:file name="${file.name}"> <uploadr:fileSize>${file.size()}</uploadr:fileSize> <uploadr:file

Categories : Grails

UIScrollView mysteriously changing frame and content size
If you're using autolayout you should be changing the constraints, not setting the scrollview's frame. See my answer to a similar question here. It has some links to examples of how to set constraints programmatically. Also, in which method are you setting the frame and contentSize? Since you are using a storyboard, if it is in viewDidLoad or viewWillAppear: it would be better to move this code to viewDidLayoutSubviews instead.

Categories : Iphone

Hide frame on minimise but show again on click
You might need to call the frame's Raise() method to get it out of its minimized state. Also if you are binding to EVT_CLOSE to minimize to tray, then when you actually want to close the application, you'll need to Destroy() it as the Close() method will just keep hiding it. See the following articles: http://www.blog.pythonlibrary.org/2013/07/12/wxpython-how-to-minimize-to-system-tray/ http://www.blog.pythonlibrary.org/2011/12/13/wxpython-101-creating-taskbar-icons/

Categories : Python

grails and spring security acl: show only some instances of a domain class
If I understand you right you need to define belongsTo. This will create mapping in database from Patient to User. Edit: to get current logged in user use class SomeController { def authenticateService def list = { def user = authenticateService.principal() def username = user?.getUsername() ..... ..... } } To map to user change logic in controller or use events to create mapping Edit: edit create action: class PatientController { def authenticateService ... def create() { def patientInstance = new Patient(params) patientInstance.user = authenticateService.principal() ... [patientInstance: patientInstance] } ... }

Categories : Grails

Grails Optimum way to save users avatar photos and show them in GSP?
If they're just small avatars, you could consider persisting them to your database. When you need to display them again you can fetch them from the db and write them to the response's outputstream. Here's an example of how to do this: http://grails.1312388.n4.nabble.com/Load-image-from-database-and-show-it-in-a-gsp-td4644393.html

Categories : Image

Grails Twitter Bootstrap Modal load content in Server-side fashion
If you want your modal to render data from the server without having to refresh the current page, then you'll need some type of "ajax" to retrieve the data and populate the modal. A quick example (i'm assuming you have jquery, and bootstrap css+js): //button to launch your modal <a href="#myModal" role="button" class="btn" data-toggle="modal">Launch demo modal</a> //your modal <div id="myModal" class="modal hide fade" ... ... <div id="modal-body">.. </div> One way to load data into the modal is tying ajax call to the modal "show" event. This is a very basic example, but whenever the modal shows, a call to myController/myAction/someid to load data into modal-body div $(document).ready(function() { $('#myModal').on('show', function () { $.ajax({

Categories : Grails

IntelliJ doesn't show all classes in coverage view of my grails application
I managed to solve part of the problem. By accessing the Grails View, select the service test file I would like to see the coverage and run this test alone (right click> Run 'ServiceTest' With Coverage...) as an integration test. The coverage view of IntelliJ showed me coverage percentage of the service I was testing the way I needed.

Categories : Grails

UITableView Content size is not updated even after reload when I change its frame dynamically
This Problem Generated Because If you change new Frame/design of UITableView then also made changes in UITableView and also your changeable Frame of UITableView is Bigger then your View So may be last two rows you can not be seem. You need to set/update each Time frame of UITableView as. myTableView.frame = CGRectMake(yourX, yourY, self.view.frame.size.width, self.view.frame.size.height - yourY);

Categories : IOS

html: My website does not show the correct frame when navigating links
To cause a link to load in the top level frame set the target of the link to "_top" <a href="http://www.mydomain.com/otherpage.html" target="_top">My Link</a> See the W3Schools Documentation

Categories : HTML

dolist frame-list -- visit each frame and do something not frame dependent
I would say do what you did. Your question is how to do something unrelated to a frame in that frame? If so, then yes, iterate over all frames. Or if you only want to iterate over visible frames or visible and not iconified frames, then do that instead. I feel like I'm missing what you really need to do, but as the need is expressed, yes, iterate over frames to iterate over frames. ;-)

Categories : Emacs

Angular.js flash of template content
Use ng-cloak class to control this flash. Check detail help ins angular's FAQ page — http://docs.angularjs.org/api/ng.directive:ngCloak In template: <div ng-app class="ng-cloak"> … </div> In CSS: .ng-cloak { opacity: 0; }

Categories : Angularjs

add as3 in frames i add in 1 frame for all time line or key frame by key frame?
1) Search the web about how to create a document class in AS3 2) Create document class 3) I'm not sure what directorio is...but if it is an object go to step 4 4) Search the web on how to create a linkeage class for a library object in AS3 5) Create the linkeage class named Directorio 6) Write the following code inside your document class (name is DocumentClass) import flash.display.MovieClip; import flash.events.MouseEvent; public var directorio:Directorio; public function DocumentClass() { directorio = new Directorio(); directorio.addEventListener(MouseEvent.CLICK, exec); } public function exec():void { trace("yes"); } What you're doing is a little like the United States is doing with their debt...instead of thinking of the future of your programming in AS3, you wan

Categories : Actionscript

using ng-show in directive template
This is not a valid way to define directive scope: scope: '@' You can either (a) not define it, (b) set it to true, or (c) set it to {} (an object). See the docs for more info: http://docs.angularjs.org/guide/directive (find the header: "Directive Definition Object") In this case, I imagine if you remove it, you may be OK, because it will allow scope.questions to be visible from your directive. If you reproduce the issue in jsfiddle.net or plnkr.co, it would be much easier to assist you. Edit: Your directive generally should have 1 parent element You should not use scope in your directive's HTML, it's implied I think you said as much in your comment, but you should strive to make your directive more generic by passing in scope.questions[0][0].done instead of looking it up in your

Categories : Angularjs

How to grab content from section within blade template
Instead of doing the normal return of view return View::make('page'); You can instead store the view in a string $view = View::make('page'); So then you can do your code something like this (not tested - but you get the idea): $pages = array(...); // content of the directory foreach ($pages as $page) { $renderedPage[] = view::make($page); }

Categories : Laravel

Display view content before template rendering
It's possible. Probably the fastest thing to do is use handlebars {{log}} helper. It will log the value of a specified object to console during render: {{log this}} If debugging a specific ember-data model, you might also consider enabling logging state manager transitions on it: record.set("stateManager.enableLogging", true)

Categories : Ember Js

kohana sends newline before template content
Try to save your controller and view using UTF-8 without BOM. You can do that with Notepad++, open file and from Encoding menu select: Encode in UTF-8 without BOM.

Categories : Misc

Displaying Custom Content On Different Pages All Using The Same Template
using a content-box.php would probably be your best bet and inside it - target the pages by name. inside of the content-box.php: <?php if(is_page('accommodation')) {//show accommodation box}?> <?php elseif(is_page('restaurant')) {//show restaurant box }?> etc.

Categories : PHP

How do I pass parameters after setting the content of a template?
If I understand you correctly you wish to pass parameters to the view which are set in the if. This can be done easily by 'binding' these variables to the view (i.e. pass by reference) public function action_resetpassword() { $this->template->content = View::factory('user/password/reset') ->bind('message', $message) ->bind('errors', $errors) ->bind('id', $id); // Empty variable is defined here ... if (HTTP_Request::POST == $this->request->method()) { // ... and set here $id = $this->request->param('id'); Inside the view the $id will now have the value of whatever comes from the Request parameter. If this is not what you mean, you should read a bit about variable scope in PHP and this question is not necess

Categories : Misc

generic_inlineformset_factory do not show GenericForeignKey into template
It seems models.py should be: class Steps(models.Model): ... content_type = models.ForeignKey(ContentType) object_id = models.PositiveIntegerField() content_object = generic.GenericForeignKey('content_type', 'object_id') Besides you can look on a this decision

Categories : Django

How to based on value show another iin Tornado template?
I'm not sure if I understand your question correctly but you can define dictionary to map one data to another. You can do it inside template using {% set a=1 %} syntax: <!-- index.html --> <html> <head> <title>Test</title> {% set map_img = {1:'american.png', 2:'british.png'} %} </head> <body> <p>{{data['nation']}} -> {{map_img[data['nation']]}}</p></br> <img src="{{static_url("images/")}}{{map_img[data['nation']]}}"/> </body> </html> But it looks like a bad design for me to declare such a dictionary inside template itself. Consider mapping inside your application and passing result to render method together with other arguments.

Categories : Python

show form data in template
In order to retrieve the value of your dictionary in django, you can use the following syntax: ReporForm.get_optons_display() So for example, if you wanted to check if the database query was 'All' or the key '5' you could simply do: if ReporForm.get_optons_display() == 'ALL': #do something Django Docs An excerpt for an example: Views.py #Query your database to retrieve your instance of 'ReporForm' #I will assume there is a primary key of some type (Reportcode) foo = ReporForm.objects.get(ReportCode = 1234) #Pass foo to the context context = {'foo':foo} #Send this context to your render_to_response so it goes to template reportform.html <b>You have selected the option :</b> '{{ foo.get_optons_display }}'

Categories : Django

How to get template output content into a variable in Angular directive
You should use the ng-style attribute. <p ng-style="{color: widget.style.i.titleColor, 'font-size': ...}">

Categories : Angularjs



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