components

Componetizing jQuery functions calls. Best practices?

柔情痞子 提交于 2019-12-08 02:45:08
问题 I'm building a site that is going to consist of components. A component defined as a particular set of HTML and CSS and jQuery. Each page of the site will consist of many components. Per best practices, we're putting our javascript block at the bottom of the page. We load the needed .js files, and then I'm planning on calling the functions needed: doThisThing(); doThatThing(); Let's say I have Component X. I want to call a function whenever that component appears on the rendered page. From a

JSF how to force hard reload of current page

青春壹個敷衍的年華 提交于 2019-12-08 02:34:19
问题 I use JSF 1.2. I have a view in which I have a h:commandButton with the following action: #{myBean.saveSomeData} When I click on the button, I want to save some data and like the data that are saved can change the display of my view, i would like to force hard reload (like a CTRL+F5 in my browser for example) of my page. To do that, I thought to this code : public void saveSomeData() { ... Save some data ... FacesContext context = FacesContext.getCurrentInstance(); String viewId = context

React communication problem from child to parent

感情迁移 提交于 2019-12-08 02:04:39
问题 I'm building a guessing game, where the questions and selection logic is in a component called Questions. I'm having trouble getting App to read the Questions code. I want the state in App to update based on selections in the child component. I've been trying to reverse engineer a solution from How to pass data from child component to its parent in ReactJS? and https://malithjayaweera.com/2018/01/reactjs-passing-data-react-components/, but I'm not clear on how to apply it to my project. App:

Problems with inflating a composite component that extends a Layoutclass

眉间皱痕 提交于 2019-12-08 00:25:43
问题 I'm trying to extend a LinearLayout to use as a composite component. I have followed this tutorial: link Which seems fairly straight forward. However when I try to inflate my component it fails all the time. The error I get from logCat is that my class can't be found. It seems strange to me that as far as I can see android searches for my component among it's own components (I'm unsure about the correct wording here, please se below). The code I have written is as follows: main (the current

Angular 2 dynamic component click event

匆匆过客 提交于 2019-12-08 00:15:39
问题 I'm trying to create components dynamically but i want to add a click action to it and i don't know how. I was trying to do this: constructor(public navCtrl: NavController, private resolver: ComponentFactoryResolver) { this.lastSelectedResource = this.defaultImage; } public createNew() { this.container.detach(0); } ngAfterContentInit() { let widgetFactory = this.resolver.resolveComponentFactory(CreateComponent); let widgetReference = this.container.createComponent(widgetFactory);

Why is angular.js not smart enough to compile DOM when adding dynamic elements?

Deadly 提交于 2019-12-07 23:38:44
问题 I really like how AngularJS enables custom tags/elements by allowing you to declare directives inside your app, however, when I append a custom tag dynamically, nothing happens: angular.module('myApp', []).directive('test', (($compile) -> restrict: 'E' link: (scope, element, attributes) -> $(element).html('<h1>this is a test!</h1>') )) $('body').append('<test></test>') How can I build an instance of my custom tag dynamically? 回答1: Why are you calling jquery outside of angular? Normally you

how to use generics in Scala

扶醉桌前 提交于 2019-12-07 19:39:40
问题 I have coded this component, to alternate between different languages: import scala.collection.mutable.Map sealed trait Language case object English extends Language { val messages: Map[String, String] = Map("M01" -> "Ready for cooking - press START", "M02" -> "Close the door to start cooking") } case object French extends Language { val messages: Map[String, String] = Map("M01" -> "Pret pour la cuisson - presse START", "M02" -> "Fermez la porte pour commencer la cuisson") } class Lang { /

What is the recommended way of adding components downloaded from nuget to toolbox?

青春壹個敷衍的年華 提交于 2019-12-07 17:55:46
问题 I have a C# Windows Forms project in which I use a component that I obtained through nuget. Now I was wondering what is the correct way of adding this component to the toolbox in the designer. Should I make a separate copy of the component on my hdd and add it from there or should I just add it from the project's packages folder or maybe do something different entirely? I was wondering if: having a separate copy of the component won't cause problems if I use a newer version of the component

Message Log Component in C#

谁说我不能喝 提交于 2019-12-07 16:02:38
What I want to have is a box that displays a list of messages in chronological order (most recent at the bottom) like is common in FTP apps and IDEs. Here's the FileZilla message log: Example of message log in FileZilla http://img571.imageshack.us/img571/9247/messageloginfilezilla.png At the moment, I'm getting similar functionality from a read only text box, but this isn't perfect. Bonus points for the following: Context menu has the option of "copy this message" Filtering by "level" Option to write log to file You could log into Event Log . It has quite usable interface. You can also use

Driving DTR with System.IO.Ports.SerialPort in .NET

☆樱花仙子☆ 提交于 2019-12-07 15:22:33
问题 I have a sensor that uses RS232 over USB to receive commands from a PC and send data to the PC. The sensor needs to be reset (using the DTR line) before a command can be sent to it. I tried to use the built-in .net serial port, but it does not seem to drive the DTR line as expected. I am beginning to wonder if the DTREnable property actually drives the DTR pin, or if it only enables it during handshaking. Other SerialPort implementations that I could find on the web also uses the Win32 API,