Search Results

Search found 6941 results on 278 pages for 'drupal views'.

Page 217/278 | < Previous Page | 213 214 215 216 217 218 219 220 221 222 223 224  | Next Page >

  • Getting camera preview data without using a preview callback

    - by velocipedestrian
    I have an app that does some processing to camera preview frames before displaying them to the user. I'm currently using preview callbacks to access the image data, but the problem I have is that the onPreviewFrame() function stops getting called if you start recording video using a MediaRecorder, and I want the processing to continue when video is being recorded. I've tried doing the following: public static Bitmap convertViewToBitmap(View view) { Bitmap bitmap = Bitmap.createBitmap(view.getWidth(),view.getHeight(), Bitmap.Config.ARGB_8888); view.draw(new Canvas(bitmap)); return bitmap; } to convert the preview surface to a bitmap, but when I pass the preview SurfaceView to the function it returns an all-black bitmap (it works when I test it on normal views though). Is there any other way I can access the image data if preview callbacks are not available?

    Read the article

  • Sinatra: How do I provide access to a login form while preventing access to the rest of my Sinatra a

    - by Brandon Toone
    I recently created a Sinatra app with a login form (no basic auth). To prevent access to the app unless the user logged in I put a before block in place before do unless request.path_info == '/login' authenticated? end end I quickly realized that this prevented me from accessing resources in the public directory like my style sheet and logo unless authenticated first as well. To get around that I changed my filter to the following: before do unless request.path_info == '/login' || request.path_info == "/stylesheets/master.css" || request.path_info == "/images/logo.png" authenticated? end end If there were lots of resources I needed to provide exceptions to this way of making them would quickly become overwhelming. What is a better way to code this so I can make exceptions for the public directory or even its specific sub-directories and files like /stylesheets, /images, /images/bg.png but not /secret or /secret/eyes-only.pdf? Or ... Is there a completely different best-practice to handle this situation of locking down everything except the stuff related to logging in (handlers, views, resources)?

    Read the article

  • What is the best practice for accessing Model using MVVM pattern

    - by Dzenand
    I have a database that communicates with webservices with my Model (own thread) and exposes Data Objects. My UI application consists of different Views and ViewModels and Custom Controls. I'm using ServiceProvider (IServiceProvider) to access the Model and route the events to the UI thread. Communication between the ViewModels is handeled by a Messenger. Is this way to go? I was also wondering what is the best way to strucutre the DataObjects At the moment i have the DataObjects that have a hierarchy structure but does not support INotifyProperty though the children list are of type of ObservableCollection. I have no possiblity to implement notifypropertychange on the properties. I was wondering the best way of making them MVVM friendly. Implementing a partial class and adding all the properties or commands that are necessary or wrapping all the DataObjects and keep the Model list and MVVM list in sync. All thoughts and ideas are appreciated.

    Read the article

  • Does django take SCRIPT_NAME into account when using the default LOGIN_URL

    - by DanJ
    Hi, I'm using Django 1.0.2 and trying to figure out how to get the @login_required working correctly. When I use the built-in server it redirects to the default login_url, or my LOGIN_URL as defined in settings.py as expected. What is not clear to me is how to deploy to the server where my site is not at the root. In my templates I use the url template tag, and in the views I can access request.META['SCRIPT_NAME'], but for some reason it doesn't seem to apply to the LOGIN_URL used. What am I missing? Thanks.

    Read the article

  • Should a service layer return view models for an MVC application?

    - by erg39
    Say you have an ASP.NET MVC project and are using a service layer, such as in this contact manager tutorial on the asp.net site: http://www.asp.net/mvc/tutorials/iteration-4-make-the-application-loosely-coupled-cs If you have viewmodels for your views, is the service layer the appropriate place to provide each viewmodel? For instance, in the service layer code sample there is a method public IEnumerable<Contact> ListContacts() { return _repository.ListContacts(); } If instead you wanted a IEnumerable, should it go in the service layer, or is there somewhere else that is the "correct" place? Perhaps more appropriately, if you have a separate viewmodel for each view associated with ContactController, should ContactManagerService have a separate method to return each viewmodel?

    Read the article

  • pyramid - How to handle complex URL in a elegant way?

    - by Lingfeng Xiong
    I'm writing a admin website which control several websites with same program and database schema but different content. The URL I designed like this: http://example.com/site A list of all sites which under control http://example.com/site/{id} A brief overview of select site with ID id http://example.com/site/{id}/user User list of target site http://example.com/site/{id}/item A list of items sold on target site http://example.com/site/{id}/item/{iid} Item detailed information # ...... something similar As you can see, nearly all URL are need the site_id. And in almost all views, I have to do some common jobs like query Site model against database with the site_id. Also, I have to pass site_id whenever I invoke request.route_path. So... is there anyway for me to make my life easier? Thanks in advance.

    Read the article

  • testing controller action which returns RedirectToRouteResult

    - by csetzkorn
    Hi, I have an action in my controller: RedirectToRouteResult Create(UserDTO UserDTO) Which at some point decides with which HTML to respond after a post request by redirecting to an action: return ModelState.IsValid ? RedirectToAction("ThanksCreate") : RedirectToAction("Register"); In my unit tests I would like to get hold of the ‘views’ modelstate somehow like this: var modelState = result.ViewData.ModelState; Assert.IsFalse( modelState.IsValid ); where ‘result’ (ViewResult) is the result of the action ‘Create’ depending on the submitted DTO. My dilemma is that my action ‘returns’ a RedirectToRouteResult which I thought is quite nice but it might not be testable or is it? How could I get hold of the ModelState in my scenario? Thanks. Best wishes, Christian enter code here

    Read the article

  • django integrate htmls into templates

    - by dana
    hi guys, i have a django 'templating' question if i have in views.py: def cv(request): if request.user.is_authenticated(): cv = OpenCv.objects.filter(created_by=request.user) return render_to_response('cv/cv.html', { 'object_list': cv, }, context_instance=RequestContext(request)) and in cv.html something like: {% for object in object_list %} First Name {{ object.first_name }} Last Name {{ object.last_name }} Url {{object.url}} Picture {{object.picture}} Bio {{object.bio}} Date of birth {{object.date_birth}} {% endfor %} but i want this content to appear on the profile.html page too, how can i do it? a smple {% include cv.html %} in the profile.html doesn't work. Also, is there another way to 'parse the object list' than explicitly write all the objects, like above? thanks in advance!

    Read the article

  • Rails form helpers: how to add an element to a collection?

    - by Laran Evans
    I have a keychain object. keychain has_many credentials. I'm trying to write the view code to add a new credential to a keychain. This is the code I have: <% form_for(@keychain) do |f| % <tr <td<%= f.select "credentials[]", current_account.services.collect{ |s| [s.friendly_name, s.id] } %</td <td<%= f.text_field 'credentials', :username %</td <td<%= f.password_field 'credentials', :password %</td </tr <% end % But it fails with this message: NoMethodError in Keychains#new Showing app/views/keychains/_keychain_form.html.erb where line #32 raised: undefined method `credentials[]' for # What am I doing wrong?

    Read the article

  • ValidateRequest="false" doesn't work when posting HTML values

    - by Ivan90
    I am developing a personal blog in ASP.NET MVC 1.0. This blog application has Views like "Insert Post", "Edit Post", etc. I need to post a string containing HTML back to the appropriate controller method. That HTML value is being posted from a textarea. I've read that it's necessary to disable ValidateRequest directly on the page with the attribute ValidateRequest = "false" or in the web.config file. When I insert an HTML value in my textarea, I get always the error of 'potential value dangerous'. How can I use ValidateRequest to allow the form element containing HTML values to be posted?

    Read the article

  • MVC, how view should be accessed from controller?

    - by Kirzilla
    Hello, I'm just learning MVC so you could find my question rather strange... My Controller have access to different shared objects through Container object passed to Controller's constructor. To access shared objects I should do $this-container-db to access Database adapter or $this-container-memcache to access Memcached adapter. I want to know should I put View object into Container with shared objects or no? From one side it is really comfortable to take view from this container, but this way I couldn't create multiple Views instances (for example, every time I'm calling Controller's method from View I should have one more View instance). What is the solution? How should I pass View object into Controller and/or how should I create new View instances from Controller? Thank you!

    Read the article

  • django access to parent

    - by SledgehammerPL
    model: class Product(models.Model): name = models.CharField(max_length = 128) (...) def __unicode__(self): return self.name class Receipt(models.Model): name = models.CharField(max_length=128) (...) components = models.ManyToManyField(Product, through='ReceiptComponent') def __unicode__(self): return self.name class ReceiptComponent(models.Model): product = models.ForeignKey(Product) receipt = models.ForeignKey(Receipt) quantity = models.FloatField(max_length=9) unit = models.ForeignKey(Unit) def __unicode__(self): return unicode(self.quantity!=0 and self.quantity or '') + ' ' + unicode(self.unit) + ' ' + self.product.genitive And now I'd like to get list of the most often useable products: ReceiptComponent.objects.values('product').annotate(Count('product')).order_by('-product__count' the example result: [{'product': 3, 'product__count': 5}, {'product': 6, 'product__count': 4}, {'product': 5, 'product__count': 3}, {'product': 7, 'product__count': 2}, {'product': 1, 'product__count': 2}, {'product': 11, 'product__count': 1}, {'product': 8, 'product__count': 1}, {'product': 4, 'product__count': 1}, {'product': 9, 'product__count': 1}] It's almost what I need. But I'd prefer having Product object not product value, because I'd like to use this in views.py for generating list.

    Read the article

  • Need help to format the result page after searching

    - by kshama
    Hi, I have built a small text based search engine on ROR which will display relevant records having a specified search word in it.since few of the records has more than 1000 words i have truncated each result set to 200 characters.My views file search.html.erb looks like this <% @results_with_ranks.each do |result| -%> <% content_id = rtable.find(result[0]).content_id %> <% content= Content.find(content_id) %> <%= truncate content.body, :length => 200 %><br/> <p> Record id <%= content.id %></p> <hr style="color:blue"> <% end -%> I want to provide an option so that whenever any truncated record is selected its entire body has to be displayed. I also want to paginate the result page displaying some fixed number of records per page.Can any body help me in doing this? Thanks in advance.

    Read the article

  • Custom ListView Row, can no longer select rows...

    - by LDK
    Here's my ScrollView: middle: SC.ScrollView.design({ layout: { top: 36, bottom: 32, left: 0, right: 0 }, backgroundColor: '#ccc', contentView: SC.ListView.design({ contentBinding: 'Spanish.wordsController.arrangedObjects', selectionBinding: 'Spanish.wordsController.selection', contentValueKey: "word", contentDisplayProperties: 'word english'.w(), selectOnMouseDown: YES, exampleView: Spanish.CustomListItemView }) }) and here is my custom listView row: Spanish.CustomListItemView = SC.View.extend({ render: function(context, firstTime){ var content = this.get('content'); var word = content.get('word'); var english = content.get('english'); context = context.begin().push('&nbsp;%@ (%@)'.fmt(word,english)).end(); return sc_super(); } }); The above works as expected, except that I can no longer select views. When I comment out "exampleView: Spanish.CustomListItemView" I can select rows, but they are no longer formatted properly. Why can I no longer select rows when I use exampleView?

    Read the article

  • iphone app photo upload to server from app threads

    - by user290380
    I have an app that needs to upload a least 5 photos to a server using API call available with the server. For that I am planning to use threads which will take care of photo upload and the main process can go on with the navigation of views etc. What I cant decide is whether it is OK to spawn five separate threads in iphone or use a single thread that will do the upload. In the later cases obviously it will become quite slow. Basically an HTTP POST request will be made to the server with the NSMutableURLRequest object using NSCOnnection. More threads mean more complexity and sync issues, but I can try to write code as neat as possible if it means better performance than a single thread which is simple but is a real stopper if performance is considered. Anybody with any experience in this kinda app. ??

    Read the article

  • Spring 3.0 MVC mvc:view-controller tag

    - by gouki
    Here's a snippet of my mvc-config.xml <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver"> <property name="prefix" value="/WEB-INF/views/"/> <property name="suffix" value=".jsp"/> </bean> <mvc:view-controller path="/index" view-name="welcome"/> <mvc:view-controller path="/static/login" view-name="/static/login"/> <mvc:view-controller path="/login" view-name="/static/login"/> I have the welcome.jsp on /WEB-INF/view/ directory and login.jsp on /WEB-INF/view/static/. This work for '/index' and '/login' paths. But I'm getting 404 response for '/static/login' when invoked from the browser. I'm expecting that '/static/login/' and '/login' should behave the same. What could be wrong here? Would appreciate any help. Thanks!

    Read the article

  • What's wrong with Xsendfile in Yii

    - by petwho
    I have been trying Xsendfile() method in Yii over 20 times and none of them gave me a result. Here is my code: $file_path = "D:/xampp/htdocs/mywebapp/protected/modules/file_upload".DS. 'views'.DS.'upload'.DS.testfile.".pdf"; Yii::app()->request->xSendFile($file_path ,array( 'saveName'=>$result['gen_name'] .".pdf", 'mimeType'=>'application/pdf', 'terminate'=>true, )); And despite changing the location of testfile.pdf everywhere on my hard drive, none of them works. I am nearly exhausted with this method. Anyone could help me from being headache? I am using windows and xampp 1.7.4. Thanks so much!

    Read the article

  • date picker in two different browsers

    - by Renu123
    Hello, i am workin on asp.net mvc in that i using partial views. i got one proble ie date picker is working properly on IE but it is not working on Mozilla Firefox. the i have used is: <link href="<%=ResolveClientUrl("~/Scripts/Themes/ui-lightness/jquery-ui-1.7.2.custom.css")%>" rel="stylesheet" type="text/css" /> <script src="../Scripts/jquery-1.3.2.js" type="text/javascript"></script> <script src="../Scripts/ui.core.js" type="text/javascript"></script> <script src="../Scripts/ui.datepicker.js" type="text/javascript"></script> and the function on view page is: <script type="text/javascript"> $(document).ready(function() { $("#txtTransationDate").datepicker(); }); </script> <input id="txtTransationDate" name="txtTransationDate" type="text" /> please advice me for it. Thank in advance.

    Read the article

  • How to control a webView

    - by klaus-vlad
    Hi, In one of my xml layouts I use an webview (besides other TextViews) for which I call loadUrl("myURL") to display the content from a url. The desired effect is to have displayed in a screen all the other textViews , and below them the content of web page. However when the webview loads the URL , it starts a new activity and displays the content in that activity, which is not what I need. Any ideas on how I could force the described behavior ? Later edit: I have succeed to have layout with several views mixed, one of them being the webview .Also I have succeed to obtain the described above behavior. But only after I setted a WebView client with setWebViewClient(WebViewClient); . Now I'd like to know why does it work like this only after a webViewClient is set ?

    Read the article

  • Django: How/Where to store a value for a session without unnecessary DB hits

    - by GerardJP
    Hi all, I have an extended userprofile with AUTH_PROFILE_MODULE (ref: http://tinyurl.com/yhracqq) I would like to set a user.is_guru() method similar to user.is_active(). This would results for al views (or rather templates) to e.g. disable/enable certain user messages, displaying of widgets, etc. The boolean is stored in the extended user profile model, but I want to avoid hitting the DB for every view. So the questions is .. Do I use a context_processor, a template tag, session_dict or what have you to, possible cached, store this info for the duration of the users visit. Note: I dont have performance issues, so it's definitely filed under premature optimization. I just want to avoid generating extra work in the future :). Any pointers are very welcome. Thanx and greetz! Gerard.

    Read the article

  • Rails Authlogic Prevent User from Changing their Login/Username

    - by bob
    Hello, I have implemented Authlogic. I believe that this isn't an authlogic specific quesetion. Assume that I have a User model and each User has a column in the database called "login". Upon creating a user, the login column is populated. However, I don't want the user to be able to change their login once they set it. Currently, I have removed the text field in the _form.html.erb file in my views for users. However, it can probably still be accessed through the url right? How can I make it so that once a login is set, it can not be changed at all?

    Read the article

  • How can I implement lazy loading on a page with 500+ images?

    - by Fedor
    I basically have a booking engine unit results page which must show 40 units and per each unit there's 1 large image of the first thumbnail and an X number of accompanying thumbnail images. I've been using the jquery lazy load plugin, but it's not thorough enough ( I'm invoking it on DOM Ready ), plus it doesn't really work in IE ( 50% of the clients use IE so it's a big issue ). What I think I really need to do is not really spit out the image but a fake element such as a span, and possibly modify my code such that if the user views the span, render it into an image element. <span src="/images/foo.gif"> The booking engine relies on JS so I think I might be forced to just rely on ajaxifying all the thumbnails and have event handlers on window scroll, etc in order for the page to be "usable" and load at an average time ( 2-3 seconds instead of 5-30s on high speed DSL/Cable ). I'd appreciate any examples or ideas.

    Read the article

  • Django: How do I go about changing my simple app to use Ajax?

    - by swisstony
    I currently have a web page where the user enters some data and then clicks a submit button. I process the data in views.py and then use the same Django template to return and display the original data and the results. What I would like to do is try to give it a bit more of a modern look and feel. You know the sort of thing, the page doesn't refresh but displays a spinning disk until the results are displayed. I assume this means using Ajax? How difficult is it to modify a simple app like this to use Ajax? What is involved? What are the best tools to use? JQuery?

    Read the article

  • How to highlight ListView item on touch?

    - by AndroidNoob
    I have a simple ListView and I want each of it items to be highlighted on user's touch. I thought this should happen by default but it isn't. Can you advice? ListView xml: <ListView android:id="@+id/list_view" android:layout_width="fill_parent" android:layout_height="fill_parent" android:padding="10dp" android:divider="#206600" android:dividerHeight="2dp" android:smoothScrollbar="true" android:background="#ffffff" > </ListView> And code of my Adapter: private class MyAdapter extends ArrayAdapter<Task> { private LayoutInflater mInflater; public MyAdapter(Context context, int resource, List<Task> list) { super(context, resource, list); mInflater = LayoutInflater.from(context); } @Override public View getView(int position, View convertView, ViewGroup parent) { View v = convertView; if (v == null) { v = mInflater.inflate(R.layout.list_item, null); } Task task = taskList.get(position); /* Setup views from your layout using data in Object here */ return v; }

    Read the article

  • Cocoa touch - creating view template for iPad

    - by teepusink
    Hi, This is kinda a hard question to describe. I'm just starting to make an iPad app. Now with the amount of real estate I have, I'm planning to have different but similar "views" to populate the space. (might be easier to think a newspaper site, where many of the columns are similar) I would like to create a "view template" so I can reuse the view in the different spots. Is it possible to design the view template in Interface Builder? (meaning I design the UIView in Interface Builder and then somehow I can just do [window addSubview:viewController.viewTemplate1]; multiple times? If so how would I load that view template in the different places? If you know of an example code / tutorial that does something similar, that would work too. Thanks, Tee

    Read the article

< Previous Page | 213 214 215 216 217 218 219 220 221 222 223 224  | Next Page >