text
stringlengths
20
1.01M
url
stringlengths
14
1.25k
dump
stringlengths
9
15
lang
stringclasses
4 values
source
stringclasses
4 values
High Performance Architecture for the Internet of Things Learn about some of the most common challenges associated with the real-time processing and storage of IoT-generated data; the common technology components, including in-memory computing technologies; and how they fit into an IoT architecture. Download Now. Sponsored Content. bin/kafka-topics.sh --create --zookeeper localhost:2181 - -replication-factor 1 --partitions 1 --topic iot-data- event - Create tables in Cassandra database using below commands. CREATE KEYSPACE IF NOT EXISTS TrafficKeySpace WITH replication = {'class':'SimpleStrategy', 'replication_factor':1}; CREATE TABLE TrafficKeySpace.Total_Traffic (routeId text, vehicleType text, totalCount bigint, timeStamp timestamp,recordDate text,PRIMARY KEY (routeId,recordDate,vehicleType)); CREATE TABLE TrafficKeySpace.Window_Traffic (routeId text, vehicleType text, totalCount bigint, timeStamp timestamp,recordDate text,PRIMARY KEY (routeId,recordDate,vehicleType)); CREATE TABLE TrafficKeySpace.poi_traffic(vehicleid text , vehicletype text , distance bigint, timeStamp timestamp,PRIMARY KEY (vehicleid));. <dependency> <groupId>org.apache.kafka</groupId> <artifactId>kafka_2.10</artifactId> <version>0.8.1</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-core</artifactId> <version>2.6.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.6.6</version> </dependency> <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-annotations</artifactId> <version>2.6.6</version> </dependency> We use IoTData class to define the attributes of connected vehicle. public class IoTData implements Serializable{ private String vehicleId; private String vehicleType; private String routeId; private String longitude; private String latitude; }. public class IoTDataEncoder implements Encoder<IoTData> { public byte[] toBytes(IoTData iotEvent) { try { String msg = objectMapper.writeValueAsString(iotEvent); return msg.getBytes(); } catch (JsonProcessingException e) {} } }. public class IoTDataProducer { properties.put("zookeeper.connect", zookeeper); properties.put("metadata.broker.list", brokerList); properties.put("request.required.acks", "1"); properties.put("serializer.class", "com.iot.app.kafka.util.IoTDataEncoder"); Producer<String, IoTData> producer = new Producer<String, IoTData>(new ProducerConfig(properties)); }. private void generateIoTEvent(Producer<String, IoTData> producer, String topic) { IoTData event = new IoTData(vehicleId, vehicleType, routeId, latitude, longitude, timestamp, speed,fuelLevel); KeyedMessage<String, IoTData> data = new KeyedMessage<String, IoTData>(topic, event); producer.send(data); } IoT Producer application is ready. We can build and run this application using below commands. mvn package mvn exec:java - Dexec.mainClass="com.iot.app.kafka.producer.IoTDataProducer" or java -jar iot-kafka-producer-1.0.0.jar. <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-core_2.10</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-streaming_2.10</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-streaming- kafka_2.10</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>org.apache.spark</groupId> <artifactId>spark-sql_2.10</artifactId> <version>1.6.2</version> </dependency> <dependency> <groupId>com.datastax.spark</groupId> <artifactId>spark-cassandra- connector_2.10</artifactId> <version>1.6.0</version> </dependency> We need to write custom deserializer class which will deserialize IoTData JSON String to IoTData object. We need to implement fromBytes method for kafka.serializer.Decoder interface. public class IoTDataDecoder implements Decoder<IoTData> { public IoTData fromBytes(byte[] bytes) { try { return objectMapper.readValue(bytes, IoTData.class); } catch (Exception e) {} } }. SparkConf conf = new SparkConf() .setAppName(prop.getProperty("com.iot.app.spark.app.name")) .set("spark.cassandra.connection.host",prop.getProperty("com. iot.app.cassandra.host")) Our application will collect streaming data in batch of five seconds. Create Java Streaming Context using SparkConf object and Duration value of five seconds. Set checkpoint directory in Java Streaming context. Read IoT date stream using KafkaUtils.createDirectStream API. JavaStreamingContext jssc = new JavaStreamingContext(conf,Durations.seconds(5)); jssc.checkpoint(prop.getProperty("com.iot.app.spark.checkpoint.dir")); JavaPairInputDStream<String, IoTData> directKafkaStream = KafkaUtils.createDirectStream( jssc, String.class, IoTData.class, StringDecoder.class, IoTDataDecoder.class, kafkaParams, topicsSet );. JavaDStream<IoTData> nonFilteredIotDataStream = directKafkaStream.map(tuple -> tuple._2()); JavaPairDStream<String,IoTData> iotDataPairStream = nonFilteredIotDataStream.mapToPair(iot -> new Tuple2<String,IoTData>(iot.getVehicleId(),iot)).reduceByKey(( a, b) -> a);. private static final Function3<String, Optional<IoTData>, State<Boolean>, Tuple2<IoTData,Boolean>> processedVehicleFunc = (String, iot, state) -> { Tuple2<IoTData,Boolean> vehicle = new Tuple2<>(iot.get(),false); if(state.exists()){ vehicle = new Tuple2<>(iot.get(),true); }else{ state.update(Boolean.TRUE); } return vehicle; };. JavaMapWithStateDStream<String, IoTData, Boolean, Tuple2<IoTData,Boolean>> iotDStreamWithStatePairs = iotDataPairStream.mapWithState( StateSpec.function(processedVehicleFunc) .timeout(Durations.seconds(3600))); JavaDStream<Tuple2<IoTData,Boolean>> filteredIotDStreams = iotDStreamWithStatePairs.map(tuple2 -> tuple2).filter(tuple -> tuple._2.equals(Boolean.FALSE));. JavaPairDStream<AggregateKey, Long> countDStreamPair = filteredIotDataStream .mapToPair(iot -> new Tuple2<>(new AggregateKey(iot.getRouteId(), iot.getVehicleType()), 1L)) .reduceByKey((a, b) -> a + b); Below function maintains running sum for AggregateKey over the time. long totalSum = currentSum.or(0L) + (state.exists() ? state.get() : 0); Tuple2<AggregateKey, Long> total = new Tuple2<>(key, totalSum); state.update(totalSum);. private static final Function<Tuple2<AggregateKey, Long>, TotalTrafficData> totalTrafficDataFunc = (tuple -> { TotalTrafficData trafficData = new TotalTrafficData(); trafficData.setRouteId(tuple._1().getRouteId()); trafficData.setVehicleType(tuple._1().getVehicleType()); trafficData.setTotalCount(tuple._2()); trafficData.setTimeStamp(new Date()); trafficData.setRecordDate(new SimpleDateFormat("yyyy-MM-dd").format(new Date())); return trafficData; }); For saving data in Cassandra database we are using datastax’s spark Cassandra connector library. This library provides API to save DStream or RDD to Cassandra. Provide column mapping and call saveToCassandra() method. Map<String, String> columnNameMappings = new HashMap<String, String>(); columnNameMappings.put("routeId", "routeid"); columnNameMappings.put("vehicleType", "vehicletype"); columnNameMappings.put("totalCount", "totalcount"); columnNameMappings.put("timeStamp", "timestamp"); columnNameMappings.put("recordDate", "recorddate"); javaFunctions(trafficDStream).writerBuilder("traffickeyspace" , "total_traffic", CassandraJavaUtil.mapToRow(TotalTrafficData.class, columnNameMappings)).saveToCassandra();. JavaPairDStream<AggregateKey, Long> countDStreamPair = filteredIotDataStream .mapToPair(iot -> new Tuple2<>(new AggregateKey(iot.getRouteId(), iot.getVehicleType()), 1L)) .reduceByKeyAndWindow((a, b) -> a + b, Durations.seconds(30), Durations.seconds(10));. POIData poiData = new POIData(); poiData.setLatitude(33.877495); poiData.setLongitude(-95.50238); poiData.setRadius(30); Broadcast<Tuple3<POIData, String, String>> broadcastPOIValues = jssc.sparkContext().broadcast(new Tuple3<>(poiData,"Route- 37",. public static double getDistance(double lat1, double lon1, double lat2, double lon2) { final int r = 6371; Double latDistance = Math.toRadians(lat2 - lat1); Double lonDistance = Math.toRadians(lon2 - lon1); Double a = Math.sin(latDistance / 2) * Math.sin(latDistance / 2) + Math.cos(Math.toRadians(lat1))* Math.cos(Math.toRadians(lat2)) * Math.sin(lonDistance / 2) * Math.sin(lonDistance / 2); Double c = 2 * Math.atan2(Math.sqrt(a), Math.sqrt(1 - a)); double distance = r * c; return distance; }. JavaDStream<IoTData> iotDataStreamFiltered = nonFilteredIotDataStream .filter(iot -> (iot.getRouteId().equals(broadcastPOIValues.value()._2()) && iot.getVehicleType().contains(broadcastPOIValues.value()._3() ) && GeoDistanceCalculator.isInPOIRadius(Double.valueOf(iot.getLat itude()), Double.valueOf(iot.getLongitude()), broadcastPOIValues.value()._1().getLatitude(), broadcastPOIValues.value()._1().getLongitude(), broadcastPOIValues.value()._1().getRadius()))); JavaPairDStream<IoTData, POIData> poiDStreamPair = iotDataStreamFiltered .mapToPair(iot -> new Tuple2<>(iot, broadcastPOIValues.value()._1()));. javaFunctions(trafficDStream).writerBuilder("traffickeyspace" , "poi_traffic",CassandraJavaUtil.mapToRow(POITrafficData.class , columnNameMappings)).withConstantTTL(120) .saveToCassandra(); All the three methods are completed and now we can invoke these methods from IotDataProcessor class and then we will start Java Streaming Context. IoTTrafficDataProcessor iotTrafficProcessor = new IoTTrafficDataProcessor(); iotTrafficProcessor.processTotalTrafficData(filteredIotDataSt ream); iotTrafficProcessor.processWindowTrafficData(filteredIotDataS tream); iotTrafficProcessor.processPOIData(nonFilteredIotDataStream,b roadcastPOIValues); jssc.start(); jssc.awaitTermination(); IoTDataProcessor application is ready. It’s time to build and run the application. Execute maven package command to generate jar file. mvn package. spark-submit --class "com.iot.app.spark.processor.IoTDataProcessor” iot-spark- processor-1.0.0.jar. <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter- websocket</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data- cassandra</artifactId> </dependency>. @Repository public interface TotalTrafficDataRepository extends CassandraRepository<TotalTrafficData>{ @Query("SELECT * FROM traffickeyspace.total_traffic WHERE recorddate = ?0 ALLOW FILTERING") Iterable<TotalTrafficData> findTrafficDataByDate(String date); } We will write CassandraConfig class which will connect to Cassandra cluster and get connection for database operations. public class CassandraConfig extends AbstractCassandraConfiguration{ @Bean public CassandraClusterFactoryBean cluster() { CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean(); cluster.setContactPoints(environment.getProperty("com.iot.app .cassandra.host")); cluster.setPort(Integer.parseInt(environment.getProperty("com .iot.app.cassandra.port"))); return cluster; } } We want to refresh data on dashboard automatically in fixed interval. We will use Web socket to push updated data to UI. public class WebSocketConfig extends AbstractWebSocketMessageBrokerConfigurer { public void registerStompEndpoints(StompEndpointRegistry registry) { registry.addEndpoint("/stomp").withSockJS(); } public void configureMessageBroker(MessageBrokerRegistry config) { config.enableSimpleBroker("/topic"); } }. private SimpMessagingTemplate template; @Scheduled(fixedRate = 5000) public void trigger() { Response = new Response(); response.setTotalTraffic(totalTrafficList); response.setWindowTraffic(windowTrafficList); response.setPoiTraffic(poiTrafficList); this.template.convertAndSend("/topic/trafficData", response); } Below is the IotDataDashboard class which is a Spring Boot application class and runs on port 8080. public class IoTDataDashboard { public static void main(String[] args) { SpringApplication.run(IoTDataDashboard.class, args); } } IoT Data Dashboard UI page is a html page which is available at resources/static folder. We need to add jQuery, Sockjs and Stomp javascript libraries so it can receive messages on Web Socket. <script type="text/javascript" src="js/jquery- 1.12.4.min.js"></script> <script type="text/javascript" src="js/sockjs- 1.1.1.min.js"></script> <script type="text/javascript" src="js/stomp.min.js"></script> Add code to receive data from Web Socket and parse the Response object as JSON data. var totalTrafficList = jQuery("#total_traffic"); stompClient.connect({ }, function(frame) { stompClient.subscribe("/topic/trafficData", function(data) { var dataList = data.body; var resp=jQuery.parseJSON(dataList); totalTrafficList.html(t_tabl_start+totalOutput+t_tabl _end) }. <script type="text/javascript" src="js/bootstrap.min.js"></script> <script type="text/javascript" src="js/Chart.min.js"></script> <head> <title>IoT Traffic Data Dashboard</title> <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> <link rel="stylesheet" type="text/css" href="css/style.css"> </head> IoT Data Dashboard application is ready. We can build and run this application using below commands. mvn package mvn exec:java -Dexec.mainClass=" com.iot.app.springboot.dashboard.IoTDataDashboard" Or java -jar iot-springboot-dashboard-1.0.0.jar. Community comments Apache Flink by Luis Silveira / Re: Apache Flink by Tomasz Gawęda / Re: Apache Flink by Hareesh Jagannathan / Thanks!! by Hareesh Jagannathan / Insightful article by Abhishek Yada / IoT Dashboard Issue by Bala ss / Re: IoT Dashboard Issue by Amit Baghel / Re: IoT Dashboard Issue by ajay beesam / Re: IoT Dashboard Issue by Amit Baghel / IoT application by Pethuru Chelliah / Alternative to simplify by Craig Kauffman / Getting Logging Problem. by ajay beesam / How can it recover after it's down? by han slam / Re: How can it recover after it's down? by Amit Baghel / Data Processor by SS Samant / Apache Flink by Luis Silveira / Your message is awaiting moderation. Thank you for participating in the discussion. Congratulations for this great article, Amit. IMHO, for a real-time traffic monitoring with subsecond latency requirements, I would suggest you to adopt Apache Flink instead of Apache Spark. Flink has a high throughput low-latency pure streaming engine, while Spark RDDs process stream of events inside a micro-batch perspective. Re: Apache Flink by Tomasz Gawęda / Your message is awaiting moderation. Thank you for participating in the discussion. Author didn't mention any subsecond latency requirement. What's more, latency in sending data is often bigger :) Such monitoring is often used to train and use machine learning models, in Spark this is unified, especially in Structured Streaming. One class for batch and streaming data, used also by ML library. Maybe it's the topic for new article for author? :) / Your message is awaiting moderation. Thank you for participating in the discussion. I have implemented the processor using Apache flink. Full code snippet is available at below location. (github.com/harsh86/iot-traffic-monitor-flink). I am a newbie to flink would apprciate feedbacks. Thanks!! by Hareesh Jagannathan / Your message is awaiting moderation. Thank you for participating in the discussion. Great Article. Loved the completness of the article and authors ability to guide reader into his tought process. Insightful article by Abhishek Yada / Your message is awaiting moderation. Thank you for participating in the discussion. Hello, Excellent piece on a end-to-end Spark appl. IoT Dashboard Issue by Bala ss / Your message is awaiting moderation. Thank you for participating in the discussion. Great Article. / Your message is awaiting moderation. Thank you for participating in the discussion. From the error "unconfigured table schema_keyspaces" it looks like you are using Cassandra 3.x. Please check the version compatibility of Spring Boot, Spring-Data-Cassandra and Cassandra DB. IoT application by Pethuru Chelliah / Your message is awaiting moderation. Thank you for participating in the discussion. Well-written technical article! Alternative to simplify by Craig Kauffman / Your message is awaiting moderation. Thank you for participating in the discussion. IoT to Kafka, MemSQL Pipelines to Kafka parallelized, MemSQL Transform to Spark for Calc / Agg /Enrich ( or Tensorflow etc), land in MemSQL (vs Cassandra, same speed on landing but much better access speeds, standard SQL and scans for Dashboards etc). This would use two proprietary technologies ( MemSQL Pipelines with Transforms to replace Spark Streaming complexity and MemSQL Db to replace Cassandra limitations). The trade would be open source to propriety gaining simplicity (vendor supports the interfaces) and pure speed and scale. MemSQL is at least as fast on landing (upserts at the same speed as a write), and much faster on data access with full ANSI SQL to access. Scale is to Pbs level. This should keep from passing from Cassandra to another warehouse for speed access and scans. I'm not trying to push a vendor on you, but 3rd gen Db solves a lot of the 2011 - 2015 architecture issues. faster, better cheaper is hard to beat. I am happy to show this alternative arch to anyone interested. Actually working on an IoT from Traffic sensor architecture right now for a non-usa entity. Getting Logging Problem. by ajay beesam / Your message is awaiting moderation. Thank you for participating in the discussion. Excellent article. / Your message is awaiting moderation. Thank you for participating in the discussion. Would you please tell me how you solved the "org/apache/spark/Logging" while running the "IoT Data Processor". It will great helpfull to me. Re: IoT Dashboard Issue by Amit Baghel / Your message is awaiting moderation. Thank you for participating in the discussion. Spark version used in this article is 1.6.2. If you are using 2.x then you will have to update classes as per new APIs in 2.x. Please check stackoverflow.com for code or build related issues. stackoverflow.com/questions/40287289/java-lang-... How can it recover after it's down? by han slam / Your message is awaiting moderation. Thank you for participating in the discussion. It's good article, but there one issue is that it's will restart with totalcount to 0 in the db when iot-spark-processor it's restart Re: How can it recover after it's down? by Amit Baghel / Your message is awaiting moderation. Thank you for participating in the discussion. Thanks han. You would need to modify processor code and enable checkpointing to get JavaStreamingContext from checkpoint data. Please check document at spark.apache.org/docs/1.6.2/streaming-programmi... Data Processor by SS Samant / Your message is awaiting moderation. Thank you for participating in the discussion. Hi Amit, thanks for the great article. Most of the code part is easy to understand, however I got stuck with data processing part in spark streaming. How do I extract message from the IoTData that matches specific pattern, lets say data producer send an alert now I need find that specific alert from the data streams and send it to the dashboard straight-away. Hint or steps to extract the alert from the stream will be much appreciated.
https://www.infoq.com/articles/traffic-data-monitoring-iot-kafka-and-spark-streaming/?itm_source=articles_about_2&itm_medium=link&itm_campaign=2
CC-MAIN-2019-35
en
refinedweb
No so small as the calculator, but small enough (120 lines of code). It can do any Python expression as a formula, support cell reference and ranges. If it won't be simple, it simply won't be. [Hire me, source code] by Miki Tebeka, CEO, 353Solutions def f():and you run it, nothing is printed. print "F" yield 1 if __name__ == "__main__": f()
http://pythonwise.blogspot.com/2007/07/
CC-MAIN-2019-35
en
refinedweb
In this post, we are going to build a RNN-LSTM completely from scratch only by using numpy (coding like it’s 1999). LSTMs belong to the family of recurrent neural networks which are very usefull for learning sequential data as texts, time series or video data. While traditional feedforward networks consist of an input layer, a hidden layer, an output layer and the weights, bias, and activation function between each layer, the RNN network incorporates a hidden state layer which is connected to itself (recurrent). Hence, between layer_1 and layer_2 we do not merely pass the weighted+bias input but also, include the previous hidden state. In case we unroll the LSTM, we are able to think of it as a chain of feedforward networks that are connected to themselves over time. As we massively increase the number of backpropagation steps due to the hidden state we experience the problem of vanishing gradient. This implies that the weights of the last layers of the network will be more affected than the weights of the first layer as the magnitude of the gradient decreases with each propagation step. To update the weights recursively for each layer correctly, we need to maintain the gradient value as we backpropagate through the network. The solution to this problem is provided by replacing the RNN cell (hidden state) with an LSTM cell. This cell which uses an input, forget and output gate as well as a cell state. A gate can be understood as a layer which merely performs a series of matrix operations. For a better understanding – it might be helpful to think of the LSTM cell as a single layer mini neural network. Each gate has its weight matrix which makes the LSTM cell as such fully differentiable. Hence, we can compute the derivative of the gates and update the weight matrix via gradient descent. In an ideal scenario, the LSTM cell memorizes the data that is relevant and forgets any long-term information that is no longer needed whenever a new input arrives. The cell state represents the long-term memory and stores the relevant information from all time steps. The hidden state acts as working memory and is analogous to the latent state in RNNs. The forget gate defines merely whether to keep or to omit information that is stored in the cell state. Whereas the input gate determines the amount of information at the current time step that should be stored in the cell state. The output gate on the hand acts as an attention mechanism and decides what part of the data the neural network should focus. The whole process of learning what to learn what information to keep and what to forget happens (magically) by adjusting the weights via gradient descent. LSTM networks can be applied to almost any kind of sequential data. One of the most popular use case is natural language processing, which we will also tackle in this post by solely using numpy. First, we start by defining the RNN class. In a second step, we define the LSTM cell which replaces the hidden state layer from the previously defined RNN. Given that, we will write some data loading functions which we are going to need to train our model. In the last step, we will train our model using backpropagation and produce an output sample using our model that is build and trained without any additional libraries. The RNN class below includes the sigmoid activation function, forward and backpropagation as well as the RMSprop and weight update routine. Since we want to capture the sequential dependence of the data through time, we shift our output by one-time step. The hyperparameter learning rate controls the convergence speed of the weight updates. The comments in the code snippets below are mostly particular and contribute to a better understanding of each step. import numpy as np class RecurrentNeuralNetwork: #input (in t), expected output (shifted by one time step), num of words (num of recurrences), array of expected outputs, learning rate def __init__ (self, input, output, recurrences, expected_output, learning_rate): #initial input self.x = np.zeros(input) #input size self.input = input #expected output (shifted by one time step) self.y = np.zeros(output) #output size self.output = output #weight matrix for interpreting results from hidden state cell (num words x num words matrix) #random initialization is crucial here self.w = np.random.random((output, output)) #matrix used in RMSprop in order to decay the learning rate self.G = np.zeros_like(self.w) #length of the recurrent network - number of recurrences i.e num of inputs self.recurrences = recurrences #learning rate self. = learning_rate #array for storing inputs self.ia = np.zeros((recurrences+1,input)) #array for storing cell states self.ca = np.zeros((recurrences+1,output)) #array for storing outputs self.oa = np.zeros((recurrences+1,output)) #array for storing hidden states self.ha = np.zeros((recurrences+1,output)) #forget gate self.af = np.zeros((recurrences+1,output)) #input gate self.ai = np.zeros((recurrences+1,output)) #cell state self.ac = np.zeros((recurrences+1,output)) #output gate self.ao = np.zeros((recurrences+1,output)) #array of expected output values self.expected_output = np.vstack((np.zeros(expected_output.shape[0]), expected_output.T)) #declare LSTM cell (input, output, amount of recurrence, learning rate) self.LSTM = LSTM(input, output, recurrences, learning_rate) #activation function. simple nonlinearity, converts influx floats into probabilities between 0 and 1 def sigmoid(self, x): return 1 / (1 + np.exp(-x)) #the derivative of the sigmoid function. We need it to compute gradients for backpropagation def dsigmoid(self, x): return self.sigmoid(x) * (1 - self.sigmoid(x)) #Here is where magic happens: We apply a series of matrix operations to our input and compute an output def forwardProp(self): for i range(1, self.recurrences+1): self.LSTM.x = np.hstack((self.ha[i-1], self.x)) cs, hs, f, c, o = self.LSTM.forwardProp() #store cell state from the forward propagation self.ca[i] = cs #cell state self.ha[i] = hs #hidden state self.af[i] = f #forget state self.ai[i] = inp #inpute gate self.ac[i] = c #cell state self.ao[i] = o #output gate self.oa[i] self.sigmoid(np.dot(self.w, hs)) #activate the weight*input self.x = self.expected_output[i-1] return self.oa def backProp(self): #Backpropagation of our weight matrices (Both in our Recurrent network + weight matrices inside LSTM cell) #start with an empty error value totalError = 0 #initialize matrices for gradient updates #First, these are RNN level gradients #cell state dfcs = np.zeros(self.output) #hidden state, dfhs = np.zeros(self.output) #weight matrix tu = np.zeros((self.output,self.output)) #Next, these are LSTM level gradients #forget gate tfu = np.zeros((self.output, self.input+self.output)) #input gate tiu = np.zeros((self.output, self.input+self.output)) #cell unit tcu = np.zeros((self.output, self.input+self.output)) #output gate tou = np.zeros((self.output, self.input+self.output)) #loop backwards through recurrences for i in range(self.recurrences, -1, -1): #error = calculatedOutput - expectedOutput error = self.oa[i] - self.expected_output[i] #calculate update for weight matrix #Compute the partial derivative with (error * derivative of the output) * hidden state tu += np.dot(np.atleast_2d(error * self.dsigmoid(self.oa[i])), np.atleast_2d(self.ha[i]).T) #Now propagate the error back to exit of LSTM cell #1. error * RNN weight matrix error = np.dot(error, self.w) #2. set input values of LSTM cell for recurrence i (horizontal stack of array output, hidden + input) self.LSTM.x = np.hstack((self.ha[i-1], self.ia[i])) #3. set cell state of LSTM cell for recurrence i (pre-updates) self.LSTM.cs = self.ca[i] #Finally, call the LSTM cell's backprop and retreive gradient updates #Compute the gradient updates for forget, input, cell unit, and output gates + cell states + hiddens states fu, iu, cu, ou, dfcs, dfhs = self.LSTM.backProp(error, self.ca[i-1], self.af[i], self.ai[i], self.ac[i], self.ao[i], dfcs, dfhs) #Accumulate the gradients by calculating total error (not necesarry, used to measure training progress) totalError += np.sum(error) #forget gate tfu += fu #input gate tiu += iu #cell state tcu += cu #output gate tou += ou #update LSTM matrices with average of accumulated gradient updates self.LSTM.update(tfu/self.recurrences, tiu/self.recurrences, tcu/self.recurrences, tou/self.recurrences) #update weight matrix with average of accumulated gradient updates self.update(tu/self.recurrences) #return total error of this iteration return totalError def update(self, u): #Implementation of RMSprop in the vanilla world #We decay our learning rate to increase convergence speed self.G = 0.95 * self.G + 0.1 * u**2 self.w -= self.learning_rate/np.sqrt(self.G + 1e-8) * u return #We define a sample function which produces the output once we trained our model #let's say that we feed an input observed at time t, our model will produce an output that can be #observe in time t+1 def sample(self): #loop through recurrences - start at 1 so the 0th entry of all output will be an array of 0's for i in range(1, self.recurrences+1): #set input for LSTM cell, combination of input (previous output) and previous hidden state self.LSTM.x = np.hstack((self.ha[i-1], self.x)) #run forward prop on the LSTM cell, retrieve cell state and hidden state cs, hs, f, inp, c, o = self.LSTM.forwardProp() #store input as vector maxI = np.argmax(self.x) self.x = np.zeros_like(self.x) self.x[maxI] = 1 self.ia[i] = self.x #Use np.argmax? #store cell states self.ca[i] = cs #store hidden state self.ha[i] = hs #forget gate self.af[i] = f #input gate self.ai[i] = inp #cell state self.ac[i] = c #output gate self.ao[i] = o #calculate output by multiplying hidden state with weight matrix self.oa[i] = self.sigmoid(np.dot(self.w, hs)) #compute new input maxI = np.argmax(self.oa[i]) newX = np.zeros_like(self.x) newX[maxI] = 1 self.x = newX #return all outputs return self.oa In the next step, we define the LSTM cell which is a neural network by itself and hence is similarly constructed as the RNN. class LSTM: # LSTM cell (input, output, amount of recurrence, learning rate) def __init__ (self, input, output, recurrences, learning_rate): #input size self.x = np.zeros(input+output) #input size self.input = input + output #output self.y = np.zeros(output) #output size self.output = output #cell state intialized as size of prediction self.cs = np.zeros(output) #how often to perform recurrence self.recurrences = recurrences #balance the rate of training (learning rate) self.learning_rate = learning_rate #init weight matrices for our gates #forget gate self.f = np.random.random((output, input+output)) #input gate self.i = np.random.random((output, input+output)) #cell state self.c = np.random.random((output, input+output)) #output gate self.o = np.random.random((output, input+output)) #forget gate gradient self.Gf = np.zeros_like(self.f) #input gate gradient self.Gi = np.zeros_like(self.i) #cell state gradient self.Gc = np.zeros_like(self.c) #output gate gradient self.Go = np.zeros_like(self.o) #activation function. simple nonlinearity, converts influx floats into probabilities between 0 and 1 #same as in rnn class def sigmoid(self, x): return 1 / (1 + np.exp(-x)) #The derivativeative of the sigmoid function. We need it to compute gradients for backpropagation def dsigmoid(self, x): return self.sigmoid(x) * (1 - self.sigmoid(x)) #Within the LSTM cell we are going to use a tanh activation function. #Long story short: This leads to stronger gradients (derivativeatives are higher) which is usefull as our data is centered around 0, def tangent(self, x): return np.tanh(x) #derivativeative for computing gradients def dtangent(self, x): return 1 - np.tanh(x)**2 #Here is where magic happens: We apply a series of matrix operations to our input and compute an output def forwardProp(self): f = self.sigmoid(np.dot(self.f, self.x)) self.cs *= f i = self.sigmoid(np.dot(self.i, self.x)) c = self.tangent(np.dot(self.c, self.x)) self.cs += i * c o = self.sigmoid(np.dot(self.o, self.x)) self.y = o * self.tangent(self.cs) return self.cs, self.y, f, i, c, o def backProp(self, e, pcs, f, i, c, o, dfcs, dfhs): #error = error + hidden state derivativeative. we clip the value between -6 and 6 to prevent vanishing e = np.clip(e + dfhs, -6, 6) #multiply error by activated cell state to compute output derivativeative do = self.tangent(self.cs) * e #output update = (output derivative * activated output) * input ou = np.dot(np.atleast_2d(do * self.dtangent(o)).T, np.atleast_2d(self.x)) #derivativeative of cell state = error * output * derivativeative of cell state + derivative cell #compute gradients and update them in reverse order! dcs = np.clip(e * o * self.dtangent(self.cs) + dfcs, -6, 6) #derivativeative of cell = derivativeative cell state * input dc = dcs * i #cell update = derivativeative cell * activated cell * input cu = np.dot(np.atleast_2d(dc * self.dtangent(c)).T, np.atleast_2d(self.x)) #derivativeative of input = derivative cell state * cell di = dcs * c #input update = (derivative input * activated input) * input iu = np.dot(np.atleast_2d(di * self.dsigmoid(i)).T, np.atleast_2d(self.x)) #derivative forget = derivative cell state * all cell states df = dcs * pcs #forget update = (derivative forget * derivative forget) * input fu = np.dot(np.atleast_2d(df * self.dsigmoid(f)).T, np.atleast_2d(self.x)) #derivative cell state = derivative cell state * forget dpcs = dcs * f #derivative hidden state = (derivative cell * cell) * output + derivative output * output * output derivative input * input * output + derivative forget #* forget * output dphs = np.dot(dc, self.c)[:self.output] + np.dot(do, self.o)[:self.output] + np.dot(di, self.i)[:self.output] + np.dot(df, self.f)[:self.output] #return update gradients for forget, input, cell, output, cell state, hidden state return fu, iu, cu, ou, dpcs, dphs def update(self, fu, iu, cu, ou): #Update forget, input, cell, and output gradients self.Gf = 0.9 * self.Gf + 0.1 * fu**2 self.Gi = 0.9 * self.Gi + 0.1 * iu**2 self.Gc = 0.9 * self.Gc + 0.1 * cu**2 self.Go = 0.9 * self.Go + 0.1 * ou**2 #Update our gates using our gradients self.f -= self.learning_rate/np.sqrt(self.Gf + 1e-8) * fu self.i -= self.learning_rate/np.sqrt(self.Gi + 1e-8) * iu self.c -= self.learning_rate/np.sqrt(self.Gc + 1e-8) * cu self.o -= self.learning_rate/np.sqrt(self.Go + 1e-8) * ou return That’s for the definition of our RNN-LSTM network. Now we merely load some sequential data, in this case, a research paper of mine and try to predict the next word of each given the word. We export the preprocessed text data and store it as a plain text file. def read_text_file(): #Open textfile and return a separated input and output variable(series of words) with open("main.txt", "r") as text_file: data = text_file.read() text = list(data) outputSize = len(text) data = list(set(text)) uniqueWords, dataSize = len(data), len(data) returnData = np.zeros((uniqueWords, dataSize)) for i in range(0, dataSize): returnData[i][i] = 1 returnData = np.append(returnData, np.atleast_2d(data), axis=0) output = np.zeros((uniqueWords, outputSize)) for i in range(0, outputSize): index = np.where(np.asarray(data) == text[i]) output[:,i] = returnData[0:-1,index[0]].astype(float).ravel() return returnData, uniqueWords, output, outputSize, data #Write the predicted output (series of words) to disk def export_to_textfile(output, data): finalOutput = np.zeros_like(output) prob = np.zeros_like(output[0]) outputText = "" print(len(data)) print(output.shape[0]) for i in range(0, output.shape[0]): for j in range(0, output.shape[1]): prob[j] = output[i][j] / np.sum(output[i]) outputText += np.random.choice(data, p=prob) with open("output.txt", "w") as text_file: text_file.write(outputText) return Finally, we can put all pieces together, read the text file from disk, train our model and take a look at the predicted output. For a given error threshold our model performs a forward propagation step and predicts an output sample. print("Initialize Hyperparameters") iterations = 10000 learningRate = 0.001 print("Reading Inputa/Output data from disk") returnData, numCategories, expectedOutput, outputSize, data = read_text_file() print("Reading from disk done. Proceeding with training.") #Initialize the RNN using our hyperparameters and data RNN = RecurrentNeuralNetwork(numCategories, numCategories, outputSize, expectedOutput, learningRate) #training time! for i in range(1, iterations): #Predict the next word of each word RNN.forwardProp() #update all our weights using our error error = RNN.backProp() #For a given error threshold print("Reporting error on iteration ", i, ": ", error) if error > -10 and error < 10 or i % 10 == 0: #We provide a seed word seed = np.zeros_like(RNN.x) maxI = np.argmax(np.random.random(RNN.x.shape)) seed[maxI] = 1 RNN.x = seed #and predict the upcoming one output = RNN.sample() print(output) #finally, we store it to disk export_to_textfile(output, data) print("Done Writing") print("Train/Prediction routine complete.") The lines of code that I produced in this post are far from what I expected in the first place. Nevertheless, building fundamental models like the RNN-LSTM helps to clarify it’s idea and functionality which is easily overlooked.
http://wp.firrm.de/index.php/2018/04/13/building-a-lstm-network-completely-from-scratch-no-libraries/
CC-MAIN-2019-35
en
refinedweb
- Tutoriais - 2D UFO tutorial - Setting Up The Play Field Setting Up The Play Field Verificado com a versão: 5.2 - Dificuldade: Principiante In this assignment we'll set up the play field for our 2D UFO game including adding sprites for the background and player. Setting Up The Play Field Principiante 2D UFO tutorial Transcrições - 00:02 - 00:04 Now that we have our main scene saved - 00:04 - 00:06 let's create our game board, or play field. - 00:07 - 00:09 To do this we'll need to add in our - 00:09 - 00:12 first sprite, called Background. - 00:14 - 00:17 We can do this by navigating to the folder Sprites - 00:17 - 00:19 which was imported when we imported our assets. - 00:20 - 00:24 In Sprites we'll see a sprite named Background. - 00:26 - 00:29 Drag Background from the project view - 00:29 - 00:31 in to the hierarchy. - 00:31 - 00:34 This will create a new game object - 00:34 - 00:36 called Background. - 00:37 - 00:39 This new game object is created - 00:39 - 00:41 with a sprite renderer - 00:41 - 00:43 component attached. - 00:44 - 00:46 Game objects are the entities - 00:46 - 00:48 which scenes are made out of in Unity. - 00:49 - 00:51 Each piece of a game scene, - 00:51 - 00:54 whether it's the player, a wall in the level, - 00:54 - 00:57 or a coin can be it's own game object. - 00:59 - 01:01 All game objects are created - 01:01 - 01:03 with a transform component attached. - 01:04 - 01:06 The transform component is used to - 01:06 - 01:09 store and manipulate the position, - 01:09 - 01:12 rotation and scale of the object. - 01:15 - 01:17 To add additional functionality to - 01:17 - 01:19 the game object we can add - 01:19 - 01:21 additional components. - 01:21 - 01:23 Adding a component allows a game - 01:23 - 01:25 object to do something. - 01:25 - 01:27 For example adding an audio - 01:27 - 01:29 source component to a game object - 01:29 - 01:31 allows it to play sound. - 01:32 - 01:34 The sprite renderer component - 01:34 - 01:36 allows a game object to display - 01:36 - 01:38 a 2D image, - 01:38 - 01:40 shown in it's Sprite Field. - 01:42 - 01:44 Dragging a sprite in to the scene - 01:44 - 01:47 or hierarchy is a shortcut provided by Unity. - 01:47 - 01:49 Since we can't have a sprite in the - 01:49 - 01:52 scene that's not attached to a game object - 01:52 - 01:54 Unity creates a game object - 01:54 - 01:58 with the appropriate sprite renderer attached - 01:58 - 02:00 and automatically references the - 02:00 - 02:03 dragged sprite asset to be displayed. - 02:04 - 02:06 Because we drag the sprite in to the - 02:06 - 02:08 hierarchy window it - 02:08 - 02:10 should appear at origin, - 02:10 - 02:14 or the position (0, 0, 0) in our world. - 02:16 - 02:18 To make sure the sprite is at origin - 02:18 - 02:20 reset the transform component - 02:20 - 02:23 using the context sensitive gear menu - 02:23 - 02:26 in the upper-right of the transform component. - 02:27 - 02:29 This will reset the position of the game - 02:29 - 02:32 object to the coordinates (0, 0, 0) - 02:32 - 02:35 in our scene if it's not already there. - 02:37 - 02:39 The origin point of the world - 02:39 - 02:41 is where all of the coordinates - 02:41 - 02:43 in the scene are calculated from. - 02:45 - 02:47 Currently we can only see part - 02:47 - 02:49 of the background in the scene view. - 02:51 - 02:53 With the game object still selected - 02:53 - 02:55 move the cursor over the scene view - 02:55 - 02:57 and type the F key. - 02:57 - 02:59 This allows us to see the entire - 02:59 - 03:01 game object in the scene view. - 03:03 - 03:05 You can also choose Frame Selected - 03:05 - 03:07 from the Edit menu. - 03:09 - 03:11 Looking at our current scene we can - 03:11 - 03:13 see grid lines which provide - 03:13 - 03:15 a reference for spacing in the scene. - 03:16 - 03:18 For the purposes of this project - 03:18 - 03:20 we'll turn these off. - 03:21 - 03:23 Select the Gizmos menu - 03:23 - 03:27 in the scene view and deselect Show Grid. - 03:33 - 03:36 Now let's create our Player object. - 03:38 - 03:40 In this assignment our player will - 03:40 - 03:43 be represented by our UFO sprite. - 03:44 - 03:46 Drag the UFO sprite - 03:46 - 03:47 in to the hierarchy. - 03:48 - 03:50 A game object called UFO - 03:50 - 03:52 will be created with an - 03:52 - 03:54 attached sprite renderer component - 03:54 - 03:57 to display the sprite we dragged in. - 03:58 - 04:00 Let's rename our newly created - 04:00 - 04:04 game object from UFO to Player. - 04:06 - 04:08 With the UFO highlighted - 04:08 - 04:10 navigate to the inspector - 04:10 - 04:14 and click in the text field at the top. - 04:14 - 04:17 With the text highlighted type Player. - 04:20 - 04:23 Now we have two sprites in our game. - 04:24 - 04:26 Because sprites are not 3D objects - 04:26 - 04:28 we need to manually determine - 04:28 - 04:30 which sprites will be - 04:30 - 04:32 rendered on top or - 04:32 - 04:34 in front of one another. - 04:34 - 04:37 The way we do this is by assigning - 04:37 - 04:40 each of our sprites to a sorting layer. - 04:41 - 04:44 If we click on the Sorting Layer drop down - 04:44 - 04:47 in our sprite renderer component - 04:47 - 04:49 we can see that there are - 04:49 - 04:51 four sorting layers already - 04:51 - 04:53 defined in our project. - 04:54 - 04:56 These are Default, - 04:56 - 05:00 Background, Pickups and Player. - 05:00 - 05:02 These sorting layers are part of - 05:02 - 05:04 the project settings. - 05:05 - 05:07 They were imported when we chose to - 05:07 - 05:10 import our asset package as a complete project - 05:10 - 05:12 in episode one. - 05:12 - 05:14 To add your own sorting layers - 05:14 - 05:17 select Add Sorting Layer - 05:17 - 05:19 and then click the + button. - 05:21 - 05:24 Sorting layers can be reordered - 05:24 - 05:26 by clicking and dragging. - 05:26 - 05:28 We already have all the sorting layers - 05:28 - 05:30 we need so we can delete - 05:30 - 05:32 this one we have just created - 05:32 - 05:36 by highlighting it and clicking the - button. - 05:39 - 05:41 The order of the layers here is important. - 05:42 - 05:44 Layers are rendered in - 05:44 - 05:46 list order from top to bottom. - 05:47 - 05:49 With the bottom layer being rendered - 05:49 - 05:51 last and therefore - 05:51 - 05:53 appearing in front of - 05:53 - 05:55 the previous layers. - 05:55 - 05:57 This means that objects in - 05:57 - 05:59 the Background sorting layer will be - 05:59 - 06:03 rendered on top of objects in Default - 06:03 - 06:05 and that objects in Pickups - 06:05 - 06:07 will be rendered on top - 06:07 - 06:10 of objects in Background, and so on. - 06:11 - 06:13 For this project we will use - 06:13 - 06:15 the layers and their order - 06:15 - 06:18 as defined in the project settings. - 06:19 - 06:21 Highlight the Background object. - 06:22 - 06:24 In it's sprite renderer component - 06:24 - 06:27 set the sorting layer to Background. - 06:28 - 06:30 Then highlight the Player object to Player. - 06:32 - 06:34 and set it's sorting layer. - 06:37 - 06:39 Next we want to adjust the - 06:39 - 06:41 scale of our Player. - 06:42 - 06:45 We can do this in a number of ways. - 06:46 - 06:48 One way is to use the Scale tool. - 06:50 - 06:53 With the tool selected simply grab the - 06:53 - 06:55 access handle we want to change and drag - 06:55 - 06:58 the handle rescaling the Player. - 07:00 - 07:02 We can also click and drag on the - 07:02 - 07:05 title of the fields we want to change. - 07:08 - 07:10 Or we can type a number directly - 07:10 - 07:13 in to the fields we want to change. - 07:14 - 07:16 We can tab between fields - 07:16 - 07:18 and hit enter or return to - 07:18 - 07:20 confirm our choice. - 07:20 - 07:22 Let's use 0.75 for the X - 07:22 - 07:27 and Y fields to scale the Player to 75% - 07:27 - 07:29 of it's original size. - 07:29 - 07:31 Note that because we're working - 07:31 - 07:33 in 2D space changing the - 07:33 - 07:36 scale value for the Z axis - 07:36 - 07:38 will have no effect. - 07:38 - 07:40 We can think of each sprite as a - 07:40 - 07:43 pane of glass with an image painted on it. - 07:43 - 07:46 It's flat without depth or volume. - 07:46 - 07:49 You may have noticed that if we change either the - 07:49 - 07:51 X or Y scale values to - 07:51 - 07:53 negative numbers the image - 07:53 - 07:56 will be reversed along the horizontal - 07:56 - 07:58 or vertical axis respectively. - 08:00 - 08:03 So far we've been working in the scene view, - 08:03 - 08:05 which you can think of as our work area. - 08:06 - 08:08 If we click over to the game view - 08:08 - 08:10 we can see what our player will - 08:10 - 08:13 actually see when they're playing the game. - 08:14 - 08:17 Notice when we switch to the game view - 08:17 - 08:19 our view is much tighter on - 08:19 - 08:23 the player and we can't see the whole background. - 08:24 - 08:26 In the case of the game that we're trying to design - 08:26 - 08:29 this is going to make it pretty difficult to play - 08:29 - 08:31 so what we're going to do is we're going to - 08:31 - 08:34 adjust the view of the camera - 08:34 - 08:36 so that it can see more of the board. - 08:37 - 08:39 Let's start by highlighting - 08:39 - 08:41 the main camera. - 08:41 - 08:43 With the main camera highlighted we'll - 08:43 - 08:45 see that it's also a game object with - 08:45 - 08:47 a header and transform - 08:47 - 08:50 but it has a camera component attached. - 08:51 - 08:53 When we created this project we - 08:53 - 08:55 set the project type to 2D. - 08:56 - 08:58 With a 2D project all new - 08:58 - 09:01 cameras will use orthographic projection - 09:01 - 09:03 to render the scene. - 09:03 - 09:05 Using orthographic projection - 09:05 - 09:07 means that objects will not appear - 09:07 - 09:09 larger or smaller based on - 09:09 - 09:11 their distance from the camera. - 09:11 - 09:13 To visualise how this works - 09:13 - 09:16 let's temporarily exit 2D mode. - 09:16 - 09:18 In the scene view we can see - 09:18 - 09:20 our camera and our sprites. - 09:21 - 09:23 We can rotate the view by - 09:23 - 09:26 alt or option + dragging in the scene. - 09:27 - 09:29 If we highlight the camera game object - 09:29 - 09:31 we can see the camera's frustum. - 09:32 - 09:35 The frustum is the camera's viewable area. - 09:36 - 09:38 If we briefly change our - 09:38 - 09:41 camera's projection to perspective - 09:41 - 09:43 we can see that the shape of the - 09:43 - 09:45 frustum changes and - 09:45 - 09:47 so does our view of the scene. - 09:48 - 09:50 If we temporarily move our - 09:50 - 09:52 Player game object towards - 09:52 - 09:55 the camera along the Z axis - 09:56 - 09:58 we will see that it's size - 09:58 - 10:01 grows larger in the camera preview. - 10:06 - 10:08 If we switch back to orthographic - 10:08 - 10:10 projection however we can see that - 10:10 - 10:12 although the object is - 10:12 - 10:14 closer to the camera - 10:14 - 10:17 it does not appear larger in the frame. - 10:18 - 10:22 Let's reset the Player's position to (0, 0, 0) - 10:22 - 10:25 and make sure the camera is using orthographic projection - 10:25 - 10:27 before we return the scene view - 10:27 - 10:29 to 2D mode. - 10:30 - 10:32 Next let's get a better view - 10:32 - 10:35 of our play field for our camera. - 10:35 - 10:37 Click on the game view. - 10:39 - 10:41 To change how much is visible to - 10:41 - 10:43 an orthographic camera we - 10:43 - 10:45 adjust it's Size field. - 10:46 - 10:48 Let's click on the Size property - 10:48 - 10:50 of our camera and drag. - 10:53 - 10:55 By dragging we can find that a value - 10:55 - 10:59 of around 16.5 works nicely. - 11:01 - 11:03 Now we can see that the Player - 11:03 - 11:05 is at the centre of the board, - 11:05 - 11:07 and the board is sitting on a blue background. - 11:09 - 11:11 This blue background is the default - 11:11 - 11:13 for new scenes when working in 2D mode. - 11:13 - 11:15 Let's change this to something better - 11:15 - 11:17 suited to our game. - 11:17 - 11:19 We can see that the camera has a - 11:19 - 11:21 property called Background. - 11:21 - 11:25 This allows us to select the background colour. - 11:25 - 11:27 Click on the colour swatch to open - 11:27 - 11:29 the colour picker. - 11:31 - 11:34 To choose a colour we can click and drag - 11:34 - 11:36 or enter a value numerically. - 11:36 - 11:38 Let's use numeric values to set - 11:38 - 11:40 the background colour. - 11:40 - 11:42 For the colours red, green and blue - 11:42 - 11:48 let's use the values 32, 32, 32. - 11:48 - 11:51 This will give us a nice dark grey background colour. - 11:52 - 11:54 Congratulations, we now have a - 11:54 - 11:57 Player game object and a background play field. - 11:58 - 12:00 In the next lesson we'll learn how to add - 12:00 - 12:02 a script to our Player - 12:02 - 12:05 to enable them to move around the playing field - 12:05 - 12:07 using 2D physics. Tutoriais relacionados - Introduction to 2D UFO Project (Lição)
https://unity3d.com/pt/learn/tutorials/projects/2d-ufo-tutorial/setting-play-field?playlist=25844
CC-MAIN-2019-35
en
refinedweb
54150/mininam-error-ovs-vsctl-bridge-named-ovs-vsctl-bridge-named I'm facing an issue while trying to run MiniNAM GUI for my mininet script. When I run my python script, it creates network and then gives an error ovs-vsctl: no bridge named s1, ovs-vsctl: no bridge named s2 Terminal logs: *** Creating network *** Adding controller Unable to contact the remote controller at 127.0.0.1:6653 Unable to contact the remote controller at 127.0.0.1:6633 Setting remote controller to 127.0.0.1:6653 *** Adding hosts: h1 h2 h3 h4 h5 h6 h7 h8 r1 r2 r3 *** Adding switches: s1 s2 s3 s4 *** Adding links: (h1, s1) (h2, s1) (h3, s2) (h4, s2) (h5, s3) (h6, s3) (h7, s4) (h8, s4) (r1, r2) (r1, r3) (r2, s1) (r2, s2) (r3, s3) (r3, s4) *** Configuring hosts h1 h2 h3 h4 h5 h6 h7 h8 r1 r2 r3 *** Starting CLI: ovs-vsctl: no bridge named s1 mininet> ovs-vsctl: no bridge named s2 ovs-vsctl: no bridge named s3 ovs-vsctl: no bridge named s4 def run(): # Our Network object, and its initiation net = Mininet( topo=NetworkTopo(), controller=lambda name: RemoteController( name, ip='127.0.0.1' ), link=TCLink, switch=OVSKernelSwitch, autoSetMacs=True ) mininam = MiniNAM(cheight=600, cwidth=1000 , net=net) Use the following command to install tkinter ...READ MORE Try installing it from the terminal with ...READ MORE Requests is not available for use by ...READ MORE You're missing a close paren in this ...READ MORE suppose you have a string with a ...READ MORE if you google it you can find. ...READ MORE Syntax : list. count(value) Code: colors = ['red', 'green', ...READ MORE can you give an example using a ...READ MORE You need to download and install the ...READ MORE Hi @Vasgi, for the code you're trying ...READ MORE OR
https://www.edureka.co/community/54150/mininam-error-ovs-vsctl-bridge-named-ovs-vsctl-bridge-named
CC-MAIN-2019-35
en
refinedweb
Saves 26 of file io/CFileGZOutputStream.h. #include <mrpt/io/CFileGZOutputStream.h> Used in CStream::Seek. Definition at line 32 of file io/CStream.h. Constructor: opens an output file with compression level = 1 (minimum, fastest). Definition at line 32 of file CFileGZOutputStream.cpp. References mrpt::format(), MRPT_END, MRPT_START, open(), and THROW_EXCEPTION. Constructor, without opening the file. Definition at line 27 of file CFileGZOutputStream.cpp. Destructor. Definition at line 61 of file CFileGZOutputStream.cpp. Close the file. Definition at line 62 of file CFileGZOutputStream.cpp. Referenced by mrpt::pbmap::PbMap::savePbMap(), and ~CFileGZOutputStream(). Returns true if the file was open without errors. Definition at line 94 of file CFileGZOutputStream.cpp. Referenced by mrpt::io::zip::compress_gz_file(), is_open(), mrpt::maps::CGasConcentrationGridMap2D::save_Gaussian_Wind_Grid_To_File(), and mrpt::nav::CPTG_DiffDrive_CollisionGridBased::saveColGridsToFile(). 85 of file CFileGZOutputStream.cpp. References m_f, and THROW_EXCEPTION. This method is not implemented in this class. Implements mrpt::io::CStream. Definition at line 103 of file CFileGZOutputStream.cpp. References THROW_EXCEPTION. Returns true if the file was open without errors. Definition at line 64 of file io/CFileGZOutputStream.h. References fileOpenCorrectly(). Open a file for write, choosing the compression level. Definition at line 44 of file CFileGZOutputStream.cpp. References mrpt::format(), m_f, MRPT_END, and MRPT_START. Referenced by CFileGZOutputStream(), mrpt::io::zip::compress_gz_file(), mrpt::nav::CAbstractPTGBasedReactive::enableLogFile(), and TEST(). mrpt::io::CStream::printf_vector(). Prints a vector in the format [A,B,C,...] using CStream::printf, and the fmt string for each vector element T. Definition at line 102 of file io/CStream.h. 71 of file CFileGZOutputStream.cpp. References THROW_EXCEPTION.. References mrpt::io::CStream::Read(). This method is not implemented in this class. Implements mrpt::io::CStream. Definition at line 98 of file CFileGZOutputStream.cpp. References THROW_EXCEPTION. Introduces a pure virtual method responsible for writing to the stream. Write attempts to write up to Count bytes to Buffer, and returns the number of bytes actually written. Implements mrpt::io::CStream. Definition at line 76 of file CFileGZOutputStream.cpp. References m_f, and THROW_EXCEPTION. Referenced by mrpt::io::zip::compress_gz_file(), and TEST(). Definition at line 29 of file io/CFileGZOutputStream.h. Referenced by close(), fileOpenCorrectly(), getPosition(), open(), and Write().
https://docs.mrpt.org/reference/devel/classmrpt_1_1io_1_1_c_file_g_z_output_stream.html
CC-MAIN-2019-35
en
refinedweb
Vue Timeago: timeago component for Vue.js vue-timeago Time to check out a simple and small component for, you guessed it, time. Use the timeago component in Vue.js projects, to monitor elapsed time since a certain date, with i18n support. For all supported languages, see /locales, it's easy to add a new language support. If you want to play around with it, check the Demo page. The author has disabled Vue-devtools usage on this page but you can try it in your own environment. Example To make use of this plugin, start by installing it in your project. Install yarn add vue-timeago Import it into your project and choose a locale as shown import VueTimeago from 'vue-timeago' Vue.use(VueTimeago, { name: 'timeago', // component name, `timeago` by default locale: 'en-US', locales: { // you will need json-loader in webpack 1 'en-US': require('vue-timeago/locales/en-US.json') } }) The example provided is displaying 3 different simple usage instances <!-- time is a dateString that can be parsed by Date.parse() --> <timeago :</timeago> <!-- Auto-update time every 60 seconds & time before this will not be converted = 60 --> <timeago :</timeago> <!-- custom locale --> <!-- use a different locale instead of the global config --> <timeago :</timeago> The since prop is a string value representing a date. The string should be in a format recognized by the Date.parse() method. So you can pass your own dates in a few different ways. created() { // use the current time this.time = Date.now() }, data () { return { //or set a standard time time: 'Jul 9, 2017', } } } More options are available at the API section. If you want to check out the source code of this plugin or submit a request, head to its repository available here. Created by @egoist.
https://vuejsfeed.com/blog/vue-timeago-timeago-component-for-vue-js
CC-MAIN-2019-35
en
refinedweb
How to override mouse controls for the QOrbitCameraController class? Hi All, I am using QOrbitCameraController class to set camera controls for my Qt3DWindow. The current workflow of the mouse is such, I want to change this such that the right mouse button functionality is triggered on the left mouse button press. I tried setting event listeners for the this class, but wasn't sure how to proceed. Here is the code snippet where I use the class, //); Is there any way I can do that? Please guide me. I am using Qt 5.7 on windows. - mrjj Lifetime Qt Champion last edited by Hi I dont think you can. The actual mouse function seems to be hidden away in some PRIVATE file so it leaves no room for subclassing and override. I dont know is there is a way to set them via interface. It seems if we could swap Qt3DInput::QAction *m_leftMouseButtonAction; Qt3DInput::QAction *m_rightMouseButtonAction; that would be it. class QOrbitCameraControllerPrivate : public Qt3DCore::QEntityPrivate { public: QOrbitCameraControllerPrivate(); void init(); Qt3DRender::QCamera *m_camera; Qt3DInput::QAction *m_leftMouseButtonAction; Qt3DInput::QAction *m_rightMouseButtonAction; Qt3DInput::QAction *m_altButtonAction; Qt3DInput::QAction *m_shiftButtonAction; But if it's private, then it won't be accessible to the application. The default behavior of the camera will not be popular with the users if used in a product. And if there is no way to override it, are we stuck with this? I wonder why they did it like this. Hi, The only way to do this is to copy the code of the class and do what you want there. The problem you will have with almost all of the classes in the Qt3DExtras namespace. They seem not to be designed to be expandible or even to derive from them. I think they are just there to make the Qt3D cpp-examples look easy and short but their code should be in fact counted as part of the examples. -Michael. Any way we can atleast block the actions of a mouse click event? For eg, block the left click and move.. so that user can't move the camera left, right or up, down? I know, quite a bit old. But it took me a long time to find the right solution... Take a look at this: stack overflow : My Qt eventFilter() doesn't stop events as it should It does the trick for me. -JET
https://forum.qt.io/topic/71550/how-to-override-mouse-controls-for-the-qorbitcameracontroller-class/6
CC-MAIN-2019-47
en
refinedweb
I'm relatively new to Linq and Dapper and I'm trying to find the most effecient way to make an insert happen. I have a list object that looks like this: public class Programs { public int Id { get;set; } public int Desc { get;set; } } The list object is populated from a string field on the page which typically contains a string of Id's (e.g. 234, 342, 345, 398). Now in the database 234, 342, 345 already exist so the only one that I really need to insert is 398 along with the record Id. I already have a method that exists that goes and gets the currently existing program Id's in the database. Do I go get the program Id's and then compare the two lists before I execute the insert statement? Can I use Linq to do the comparison? Is there a better way? The method that gets the program Id's looks like this: public static List<Programs> GetPrograms(int id) { var sql = new StringBuilder(); sql.Append("select Id, Desc from dbo.Programs where Id = @id"); return con.Query<Programs>(sql.ToString(), new { Id = id }, commandType: CommandType.Text).ToList(); } After doing some looking at all the options, it seems like some options for my situation are to do one of the following: Since my objective was to accomplish this task using Linq and Dapper, I have opted for the first option. Here is the linq statement I made to get only the values I needed: save.ProgramList = hiddenFieldProgramIds.Value.Split(',') .Select(n => new Programs(){ id = int.Parse(n) }) .Where(n => !program.ProgramList.Select(d => d.id).Contains(n.id)).ToList(); Then the dapper call is just a straight forward insert statement using a var based on the previous advice. var sql = @"insert into dbo.programTable(Id) select @id"; con.Execute(sql, new { id = id }, commandType: commandType.Text, commandTimeout: 5000);
https://dapper-tutorial.net/knowledge-base/20982736/comprobacion-de-duplicados-antes-de-actualizar-con-dapper-linq-c-sharp
CC-MAIN-2019-47
en
refinedweb
RESTful APIs With the Play Framework — Part 2 RESTful APIs With the Play Framework — Part 2 We continue our look at creating RESTful APIs with this helpful framework by developing web services and exploring how to handle JSON in our code. Join the DZone community and get the full member experience.Join For Free In the first part of this series of articles, we talked about the main features of the Play Framework, its basic structure, and how to deploy our applications. In this part, we will talk about how to develop RESTful Services. If you remember (if not, we invite you to read the first part of this series of articles) we mentioned that Play Framework is Reactive, which means that we can develop Asynchronous and Synchronous Services. For the purposes of this second article, we will focus on Synchronous Services. Developing Web Services Let's look in more detail at the index action in HomeController. public Result index(){ return ok(views.html.index.render()); } Remember that RESTful is a first-class citizen in the Play Framework, which means that all actions are RESTful Services. The structure of an action is simple, it always returns an object of type Result (play.mvc.Result). A Result is the representation of an HTTP result with a state code, headers, and a body that is sent to the client. For example, in the index action, we use the ok method to return a Result that renders HTML in the body. Instead of rendering HTML in the body, we can send plain text. For this, we will add a new action in our HomeController call it plainText. public Result plainText(){ return ok("This is just a text message."); } Once we have added the action, we must add this to the routes file in order to execute it. GET /plainText controllers.HomeController.plainText Now we can compare the differences between call the index and plain actions from Insomnia. Index Response Index Headers plainText Response plainText Headers The first difference, as you can imagine, between both is the body, since for the index we render HTML, while for plainText we just show plain text. The following difference lies in the Header Content-Type, for index return "text/html" and for plainText "text/plain." Handling JSON When we develop Web Services we seek to use an information exchange protocol, such as JSON. The Play Framework is based on the Jackson library for the handling JSON, using the JsonNode object \, and leaning on the play.libs.Json API. To start our journey developing RESTful Services that return JSON, we will start by importing play.libs.Json in our HomeController. import play.libs.Json; The first thing we will do is render some JSON using the HashMap object, adding an action called jsonMap to ourHomeController, which will look like this: public Result jsonMap(){ HashMap<String, Object> result = new HashMap<String, Object>(){ { put("str", "String"); put("int", 123); } }; return ok(Json.toJson(result)); } As you can see, the only thing we did here was create a HashMap, to which we added two elements "str" and "int" with their respective values. Then, using the toJson method of the JSON API, we indicated that we want to return the HashMap in JSON format. To see how the consumption of this new service looks from Insomnia, we will define the call to this action in our routes file. GET /json/map controllers.HomeController.jsonMap jsonMap Response jsonMap Headers This is an example to render a HashMap as JSON. To continue, we will do the same thing with an object. For this, we will define a class called Invoice, which will be inside the package com.auth0.beans that we will create at the same level as the controllers directory, which can be seen in the image below. Note: for readability of the article we do not include the get and set methods of the Invoice class. package com.auth0.beans; import java.math.BigDecimal; import java.time.LocalDate; public class Invoice { private String name; private String address; private String idNumber; private String code; private LocalDate date; private BigDecimal amount; public Invoice(){} public Invoice(String name, String address, String idNumber, String code, LocalDate date, BigDecimal amount){ this.name = name; this.address = address; this.idNumber = idNumber; this.code = code; this.date = date; this.amount = amount; } } Then we will add the action jsonObject in our HomeController, in which we will create an object Invoice and we will use the same method toJson of the JSON API to return it as a response to the client. The action would be like the following code: public Result jsonObject(){ Invoice invoice = new Invoice("Perico de los Palotes", "City", "123456-7" "002245", LocalDate.now(), new BigDecimal(1293)); return ok(Json.toJson(invoice)); } We will define the call to this action in our routes file GET/json/objectcontrollers.HomeController.jsonObject jsonObject Response jsonObject Headers To finish with the JSONs Handling, we will do it by obtaining a JSON in the request of our RESTful service. For them we will add the jsonCatch action in our HomeController. In it we will obtain a JsonNode from the body of our request, then we will use the fromJson method of the Json API to convert this JsonNode into the object we want, in this case Invoice. To finish we will return a String with some of the data of our Invoice object to guarantee that we have obtained the information that we sent in the test. The final result would look like the following code: public Result jsonCatch(){ JsonNode jsonNode = request().body().asJson(); Invoice invoice = Json.fromJson(jsonNode, Invoice.class); DateTimeFormatter f = DateTimeFormatter.ofPattern("dd/MM/yyyy"); return ok(invoice.getCode() + " | " + invoice.getIdNumber() + " | " + f.format(invoice.getDate())); } We will define the call to this action in our routes file GET/json/catchcontrollers.HomeController.jsonCatch jsonCatch Request and Response jsonCatch Headers Results in More Detail We have seen, throughout our examples, that actions always return the Result object, which we have previously indicated is the representation of an HTTP response with a status code, headers, and a body that is sent to the client. The Controller object already has a series of methods that allows us to create Result, those methods inherit them from the Results class (play.mvc.Results). In the case of the examples that we have listed in this article, only the ok method has been used, which returns the status code 200. Addiontionally, in the body we have rendered HTML, text, and JSON. But there are other methods in Results that can help us. For example, in circumstances where we need to return a status code different than 200, some of the most common are: notFound(); //Return state code 404 badRequest(); //Return state code 400 internalServerError(); //return state code 500 status(203); //return a custom state code Imagine that, if in our jsonCatch action we don't obtain the JSON that we expect in the body, we should indicate a badRequest. To exemplify this, we will add a new action called jsonBadRequest to our HomeController public Result jsonBadRequest(){ JsonNode jsonNode = request().body().asJson(); if(jsonNode == null){ return badRequest("Expecting Json data"); }else{ Invoice invoice = Json.fromJson(jsonNode, Invoice.class); DateTimeFormatter f = DateTimeFormatter.ofPattern("dd/MM/yyyy"); return ok(invoice.getCode() + " | " + invoice.getIdNumber() + " | " + f.format(invoice.getDate())); } } In this example, we are returning a bit of plain text in the badRequest, just like in ok. Here we can also render HTML, text, or send JSON. In order to try this new action in Insomnia, we must add it to our routes file. GET/json/badRequestcontrollers.HomeController.jsonBadRequest jsonBadRequest Request and Response jsonBadRequest Headers To further delve into the methods inherited from Results you can see the official documentation of play.mvc.Results. As we mentioned previously, in the index example, an HTML template is rendered. To adapt it to what we want, we have to make it no longer render the HTML, but, instead, render what we want. In this article, we have talked about how to develop Synchronous RESTful Services in the Play Framework by returning and obtaining JSON. You can access the source code by visiting the repository on. In the next series of these articles, we will be talking about the use of JWT for a more secure information exchange. Opinions expressed by DZone contributors are their own. {{ parent.title || parent.header.title}} {{ parent.tldr }} {{ parent.linkDescription }}{{ parent.urlSource.name }}
https://dzone.com/articles/restful-apis-with-play-frameworkpartnbsp2
CC-MAIN-2019-47
en
refinedweb
Here is what the folks at caad.arch.rwth-aachen.de got when they combined context aware panels (…) and a bit of math (…) and documented it with Image-O-Matic Month: February 2013 Move improvements to the Keyboard Shortcut Tutor Another set of improvements have been made to the Keyboard Shortcut Tutor. It now: - Works with ribbon buttons that contain drop-down lists such as Wall and Roof - Works with sketch commands (Line, Rectangle, Circle, etc.) - Shows the shortcut reminder immediately after most commands are invoked - Gives focus to the Revit window after showing the reminder You can download this version at ‘Family Security Guard’ app now available for download Deadline extended for the Image-O-Matic contest This! ‘Move Physical to Analytical’ app now available Keyboard Shortcut Tutor improved – new install available I have made some improvements to the Keyboard Shortcut Tutor that you can download here: The major change is that the reminder dialog is now shown after the command is complete instead of immediately after the ribbon button is pushed. This was needed to avoid a conflict with commands like Create Group and New Sheet that present a modal dialog box. For example, if you invoke the Wall tool from the ribbon, the reminder will now be shown after you finish creating walls. Also fixed is the dialog background color is now always white but in the previous version appeared as black with certain Windows display settings. This made the black text in the dialog unreadable. the Revit Keyboard Shortcut Tutor today! Finding Text Size as a Built-In Parameter The()); What views use which view templates? (2013 edition and better formatting) View Templates got a big makeover in Revit 2013, so the previous post needs to be modified slightly to run in Revit 2013. I’ve also improved the format of the output so it looks like this: ---------------- Summary --------------------------- Architectural Elevation: 4 Architectural Plan: 2 Architectural Reflected Ceiling Plan: 2 Site Plan: 1 Structural Framing Plan: 0 Structural Framing Elevation: 0 Architectural Section: 0 Site Section: 0 Structural Section: 0 Architectural Presentation 3D: 0 Architectural Presentation Elevation: 0 Export to Civil Engineering: 0 ---------------- Details --------------------------- 'Architectural Elevation' is View Template for 4 views Elevation East Elevation North Elevation West Elevation South 'Architectural Plan' is View Template for 2 views FloorPlan Level 1 FloorPlan Level 2 'Architectural Reflected Ceiling Plan' is View Template for 2 views CeilingPlan Level 1 CeilingPlan Level 2 'Site Plan' is View Template for 1 views FloorPlan Site 'Structural Framing Plan' is View Template for 0 views 'Structural Framing Elevation' is View Template for 0 views 'Architectural Section' is View Template for 0 views 'Site Section' is View Template for 0 views 'Structural Section' is View Template for 0 views 'Architectural Presentation 3D' is View Template for 0 views 'Architectural Presentation Elevation' is View Template for 0 views 'Export to Civil Engineering' is View Template for 0 views The view parameter “Default View Template” has been renamed “View Template” and the API has a new property View.ViewTemplateId. 2013 also obsoleted Document.get_Element, replacing it with Document.GetElement.)) { ElementId id = view.ViewTemplateId; if (id != ElementId.InvalidElementId) { Element e = doc.GetElement(id);)) { sr.WriteLine("---------------- Summary ---------------------------"); foreach (KeyValuePair<string, IList<string>> pair in items) { sr.WriteLine(pair.Key + ": " + pair.Value.Count); } sr.WriteLine(); sr.WriteLine("---------------- Details ---------------------------"); foreach (KeyValuePair<string, IList<string>> pair in items) { sr.WriteLine("'" + pair.Key + "' is View Template for " + pair.Value.Count + " views"); foreach (string name in pair.Value) { sr.WriteLine(name); } sr.WriteLine(); } } Process.Start(filename); } What views use which view templates? (2012 edition) Steve wrote at Revit OpEd: When! Sometimes when you can’t upgrade your RVT to a newer version of Revit, you can use the Revit API to accomplish something similar (or even better!) than what you would do in the newer release of Revit. Here is a Revit 2012 macro that outputs a text file listing all view templates with the count and names of the views that use it as the default view template: 'Architectural Elevation' is Default View Template for 4 views Elevation East, Elevation North, Elevation West, Elevation South, 'Architectural Plan' is Default View Template for 2 views FloorPlan Level 1, FloorPlan Level 2, 'Architectural Reflected Ceiling Plan' is Default View Template for 2 views CeilingPlan Level 1, CeilingPlan Level 2, 'Site Plan' is Default View Template for 1 views FloorPlan Site, 'Structural Framing Plan' is Default View Template for 0 views 'Structural Framing Elevation' is Default View Template for 0 views 'Architectural Section' is Default View Template for 0 views 'Site Section' is Default View Template for 0 views 'Structural Section' is Default View Template for 0 views 'Architectural Presentation 3D' is Default View Template for 0 views 'Architectural Presentation Elevation' is Default View Template for 0 views 'Export to Civil Engineering' is Default View Template for 0 views)) { Parameter p = view.get_Parameter("Default View Template"); if (p != null) { ElementId id = p.AsElementId(); if (id != ElementId.InvalidElementId) { Element e = doc.get_Element(p.AsElementId());)) { foreach (KeyValuePair<string, IList<string>> pair in items) { sr.WriteLine("'" + pair.Key + "' is Default View Template for " + pair.Value.Count + " views"); string s = ""; foreach (string name in pair.Value) { s += name + ", "; } sr.WriteLine(s); sr.WriteLine(); } } Process.Start(filename); }. Set adaptive component parameters with placement point coordinates A reader asked how to compute and schedule the placement point coordinates of adaptive component families. Here is a sample using the Parameter API and Dynamic Model Update to get and set those values. private void Module_Startup(object sender, EventArgs e) { AdaptivePointParamUpdater updater = new AdaptivePointParamUpdater(this.Application.ActiveAddInId); try { UpdaterRegistry.RegisterUpdater(updater); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), new ElementClassFilter(typeof(FamilyInstance)), Element.GetChangeTypeElementAddition()); UpdaterRegistry.AddTrigger(updater.GetUpdaterId(), new ElementClassFilter(typeof(FamilyInstance)), Element.GetChangeTypeGeometry()); } catch{} } public class AdaptivePointParamUpdater : IUpdater { static AddInId m_appId; static UpdaterId m_updaterId; public AdaptivePointParamUpdater(AddInId id) { m_appId = id; m_updaterId = new UpdaterId(m_appId, new Guid("1BF1F6A2-4C06-42d4-97C1-D1B4EB593EFF")); } public void Execute(UpdaterData data) { Document doc = data.GetDocument(); Autodesk.Revit.ApplicationServices.Application app = doc.Application; foreach (ElementId id in data.GetAddedElementIds()) { adaptivePointParams(data.GetDocument(), id); } foreach (ElementId id in data.GetModifiedElementIds()) { adaptivePointParams(data.GetDocument(), id); } } public string GetAdditionalInformation(){return "Data about adaptive parameters";} public ChangePriority GetChangePriority(){return ChangePriority.FloorsRoofsStructuralWalls;} public UpdaterId GetUpdaterId(){return m_updaterId;} public string GetUpdaterName(){return "AdaptivePoints";} private void adaptivePointParams(Document doc, ElementId id) { FamilyInstance fi = doc.GetElement(id) as FamilyInstance; if (fi != null && AdaptiveComponentInstanceUtils.IsAdaptiveComponentInstance(fi)) { int ctr = 1; foreach (ElementId elementId in AdaptiveComponentInstanceUtils.GetInstancePlacementPointElementRefIds(fi)) { ReferencePoint rp = doc.GetElement(elementId) as ReferencePoint; XYZ position = rp.Position; if (ctr == 1) { fi.get_Parameter("point1x").Set(Math.Round(position.X,3)); fi.get_Parameter("point1y").Set(Math.Round(position.Y,3)); fi.get_Parameter("point1z").Set(Math.Round(position.Z,3)); } else if (ctr == 2) { fi.get_Parameter("point2x").Set(Math.Round(position.X,3)); fi.get_Parameter("point2y").Set(Math.Round(position.Y,3)); fi.get_Parameter("point2z").Set(Math.Round(position.Z,3)); } ctr++; } } } } Thanks Marco for using Image-O-Matic What have you been doing with Image-O-Matic? Care to share for the chance to win a custom designed Revit API application? Macro to quickly fix the To/From Room parameter for doors Steve, the wizard of revitoped.blogspot.com, suggested: It would be cool to use the API to allow a user to pick a door and room to resolve the to/from settings. A user was lamenting the labor hassle of fixing to/from settings because people are mirroring and copying doors which doesn’t necessarily inherit the correct room ownership. This macro works as follows - Select a door or door tag - Select the To Room (either the Room or the Room Tag) - Repeat as desired, press the ESC key when done public void FlipRoom() { UIDocument uidoc = this.ActiveUIDocument; Document doc = uidoc.Document; FamilyInstance door = null; string doorMark = ""; while (true) // create an infinite loop that will be ended by the "return" statement in the catch block { try { Element element = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element, "Select a door or door tag")); if (element is FamilyInstance) // if door is selected door = element as FamilyInstance; else if (element is IndependentTag) // if door tag is selected { IndependentTag tag = element as IndependentTag; door = doc.GetElement(tag.TaggedLocalElementId) as FamilyInstance; } doorMark = door.get_Parameter("Mark").AsString(); } catch { return; // end the command when the user presses ESC when prompted for a door } // after the user has selected a door, prompt for selection of a room Element e = doc.GetElement(uidoc.Selection.PickObject(ObjectType.Element, "Select To Room for door " + doorMark)); // Get the room element from the selected object Room room = null; if (e is RoomTag) { RoomTag rt = e as RoomTag; room = rt.Room; } else if (e is Room) { room = e as Room; } if (room != null && door.ToRoom.Id.IntegerValue != room.Id.IntegerValue) // if the selected room is not already the To Room { using (Transaction t = new Transaction(doc,"Door " + doorMark + " to room = " + room.Number)) { t.Start(); door.FlipFromToRoom(); // Flip the settings of "From Room" and "To Room" for the door t.Commit(); } } } } Setting door position relative to nearby walls?). Bulk Family Parameter Editing Improvements Thanks to everyone for their enthusiasm and feedback on my recent posts about exporting family parameters to Excel and modifying the parameter data. I’ve added the Shared Parameter GUIDs, the ability to modify parameters stored as text, integer, and double values, and UI for specifying folders and files. Are there other changes that would be valuable to make before I publish the tool? API code for all languages (when possible) with TaskDialog Ids and WriteJournalComment Arnost makes a good comment below reminding us to think about how Revit and our API applications will work with non-English versions of Revit. Please remember that the text will not always be in English! It comes from resources and will be properly localized in foreign versions of Revit. Using the string locally is all right, but it is better to rely on Dialog Id, which should also be available (although not always is) in the event argument. He was writing in response to the code I posted: t.Message == "The floor/roof overlaps the highlighted wall(s). Would you like to join geometry and cut the overlapping volume out of the wall(s)?" It would be better to avoid including the English text in the API logic, but sometimes we have no choice. Here are 5 task dialogs – 2 have a DialogId and for 3 that property is empty. And when there is no DialogId the only option is to base the comparison on the text string of the message. ‘C 02-Feb-2013 14:16:39.716; 1:< TaskDialogShowingEventArgs,The floor/roof overlaps the highlighted wall(s). Would you like to join geometry and cut the overlapping volume out of the wall(s)?,, ‘C 02-Feb-2013 14:16:21.362; 1:< TaskDialogShowingEventArgs,Would you like to attach the highlighted walls to the roof?,, ‘C 02-Feb-2013 14:15:41.234; 1:< TaskDialogShowingEventArgs,Would you like to rename corresponding views?,, ‘C 02-Feb-2013 14:21:03.890; 2:< TaskDialogShowingEventArgs,Do you want to save changes to uni2.rvt?,TaskDialog_Save_File, ‘C 02-Feb-2013 14:22:10.362; 1:< TaskDialogShowingEventArgs,You are trying to load the family Table-Dining Round w Chairs, which already exists in this project. What do you want to do?,TaskDialog_Family_Already_Exists, Here’s the macro code to write the TaskDialog message text and id to the journal file. private void Module_Startup(object sender, EventArgs e) { UIApplication uiapp = new UIApplication(this.Application); uiapp.DialogBoxShowing += new EventHandler<DialogBoxShowingEventArgs>(taskDialogInfo); } private void taskDialogInfo(object o, DialogBoxShowingEventArgs e) { TaskDialogShowingEventArgs t = e as TaskDialogShowingEventArgs; if (t != null) this.Application.WriteJournalComment("TaskDialogShowingEventArgs," + t.Message + "," + t.DialogId + ",",true); } In most cases it can be more convenient to show the data ( t.Message and t.DialogId) in a TaskDialog, but you can’t show a TaskDialog during the DialogBoxShowing event when Revit is trying to show its own dialog box. Using “Step Into” to look at the values in Sharp Develop usually works, but you can’t step into a function that is triggered when an event occurs. So WriteJournalComment is a great solution in this case. How to Automatically Dismiss a Revit dialog For;
https://boostyourbim.wordpress.com/2013/02/
CC-MAIN-2019-47
en
refinedweb
dependencies { compile('org.springframework.boot:spring-boot-starter-mail') } Send GMAIL emails from Java and Spring Carvia Tech | November 02, 2019 | 4 min read | 1 views In this article we will learn how to send emails from Java and Spring boot applications using GMAIL provider, along with additional concepts like TLS vs SSL, App Passwords in GMAIL, plain-text vs rich multimedia emails. MailSender vs JavaMailSender GMAIL account setup GMAIL 2 factor security setup Sending plain text emails with Spring Sending multimedia rich text emails with Spring Sending emails with attachment in Spring TLS and SMTP configuration Gradle Configuration We need to include the mail starter for spring boot project: spring-boot-starter-mail will transitively pull in java mail dependencies. MailSender vs JavaMailSender MailSender in package org.springframework.mail is an interface that provides strategy for sending simple emails. For all richer functionality like MIME message or messages with attachments, we shall consider using JavaMailSender (it extends MailSender) in package org.springframework.mail.javamail. The production implementation for JavaMailSender is JavaMailSenderImpl. The recommended way of using this interface is the MimeMessagePreparator mechanism, possibly using a MimeMessageHelper for populating the message. TLS vs SSL option SSL and TLS are cryptographic protocols that provide data encryption and authentication between a server and a client over a network. SSL was originally developed by Netscape back in 1995, and it had version SSL 1.0, SSL 2.0 and SSL 3.0 But SSL is deprecated now (as of 2015). TLS is successor to SSL, TLS 1.0 was introduced in 1999 based on SSL 3.0, TLS is currently at v1.2 at the time of writing this article. We shall always prefer to use TLSv1.2 over SSL for security reasons. Less secure apps in GMAIL You can enable less secure apps option in GMAIL if you do not want to enable 2 factor authentication. Thiw will allow you to use your gmail password directly in the SMTP configuration for sending emails. But this option is less secure and should be avoided. So In order to allow us to send email via gmail, you will have to login to your gmail or sender’s gmail account and then visit this link : When you will visit this link, you will see this Click on the slider to allow less secure apps. Once, this is ON we will be able to send email via gmail account. App password setup in GMAIL The preferred approach for sending emails using GMAIL is to setup App password using GMAIL security options. Goto and then select Security and then choose Signing in to Google and then select App passwords. In the App passwords screen, select app as Mail and device as Custom Device, provide name something as "java mail program" Then click on generate. This will generate app password which should be used instead of real account password in email SMTP authentication. JavaMailSender Bean First step is to create a Bean of type JavaMailSender that is configured with GMAIL smpt properties. We will be using TLS on port 587 for this tutorial. @Configuration public class GmailConfig { @Bean("gmail") public JavaMailSender gmailMailSender() { JavaMailSenderImpl mailSender = new JavaMailSenderImpl(); mailSender.setHost("smtp.gmail.com"); mailSender.setPort(587); mailSender.setUsername("[email protected]"); mailSender.setPassword("---app password----"); Properties props = mailSender.getJavaMailProperties(); props.put("mail.transport.protocol", "smtp"); props.put("mail.smtp.auth", "true"); props.put("mail.smtp.starttls.enable", "true"); props.put("mail.debug", "false"); return mailSender; } } Send plain text email Now we will create a service that will use the previously created JavaMailSender bean for sending email using GMAIL. @Service public class MailService { private static final Logger logger = LoggerFactory.getLogger(MailService.class); @Autowired @Qualifier("gmail") private JavaMailSender mailSender; public void sendMail(String from, String subject, String toAddresses, String ccAddresses, String bccAddresses, String body) { MimeMessagePreparator preparator = mimeMessage -> { MimeMessageHelper message = new MimeMessageHelper(mimeMessage); message.setTo(toAddresses.split("[,;]")); message.setFrom(from, "<From Name>"); message.setSubject(subject); if (StringUtils.isNotBlank(ccAddresses)) message.setCc(ccAddresses.split("[;,]")); if (StringUtils.isNotBlank(bccAddresses)) message.setBcc(bccAddresses.split("[;,]")); message.setText(body, false); }; mailSender.send(preparator); logger.info("Email sent successfully To {},{} with Subject {}", toAddresses, ccAddresses, subject); } } Send rich multimedia email The only change we need to make for multimedia emails is: message.setText(body, true); This will use given message body content as html and format the email. You can generate HTML using velocity, freemarker or any other template engine. Sending attachment with email MimeMessageHelper provides addAttachment(…) method to support file attachments in emails. The following code illustrates how a list of files can be attached to email message using Spring framework support. List<File> attachments = ArrayList<>(); atatchments.add(...); //Add more files attachments.forEach(file -> { try { FileSystemResource resource = new FileSystemResource(file); message.addAttachment(file.getName(), resource); } catch (MessagingException e) { throw new RuntimeException("Problem attaching file to email", e); } }); That’s all. Top articles in this category: - Top 30 Hibernate and Spring Data JPA interview questions - Citibank Java developer interview questions - Top 50 Multi-threading Java Interview Questions for Investment Bank - Cracking core java interviews - question bank - Goldman Sachs Java Interview Questions for Senior Developer - Morgan Stanley Investment Banking Java Interview Questions - Sapient Global Market Java Interview Questions and Coding Exercise Find more on this topic: .
https://www.javacodemonk.com/send-gmail-emails-from-java-and-spring-5caea8f3
CC-MAIN-2019-47
en
refinedweb
Jeanfrancois Arcand wrote: > Hi, > > I would like to propose two modifications: > > [1] XML Validation > ---------------------------- > I would like to make two changes to the way xml validation is implemented: > > (1) make the attribute available at the context level (turned off by > default) > (2) add supports for turning on/off web.xml validation and tld > validation separately. > > > The host implementation will stay the same (the current one). This way > it will be possible to turn on/off validation of TLDs without impacting > performance (e.g.web.xml) Ah ok. > [2] Overridable list of javax packages in WebappClassloader. > -------------------------------------------------------------------------------- > > Right now, the WebappClassloader.packageTriggers contains "javax". I > guess this restriction comes from the J2EE specs, except that we should > allow users to override packages that start with javax but are *not* > included in J2EE (ex: JSF, JSTL). I would like to add a mechanism that > contains a list of overridable packages: > >> /** >> * Adds the given package name to the list of packages that may >> always be >> * overriden, regardless of whether they belong to a protected >> namespace >> */ >> public void addOverridablePackage(String packageName){ >> if (overridablePackages == null){ >> overridablePackages = new ArrayList(); >> } >> overridablePackages.add(packageName); >> } > > > and add in WebappClassloader.filter(...) > >> if (overridablePackages != null){ >> for (int i = 0; i < overridablePackages.size(); i++) { >> if (packageName. >> startsWith((String)overridablePackages.get(i))) >> return false; >> } >> } > > > > > and then either add an attribute in context.xml (or globally in > server.xml...I have no prefs). As an example, putting JSTL 1.0 under > common/lib and bundling JSTL 1.1 in WEB-INF/lib will possibly cause > problems, because the API starts with javax.servlet.jsp.jstl.*, and the > 1.0 api will get loaded instead of 1.1 (I know , API are not supposed to > changes, but the reality is different :-) ) > Well, the second one wouldn't change many things. packageTrigger is mostly useless right now, ever since I added "delegate first to the system classloader". Indeed, this would allow overriding specific stuff like JSTL. Rémy --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
https://mail-archives.apache.org/mod_mbox/tomcat-dev/200403.mbox/%[email protected]%3E
CC-MAIN-2019-47
en
refinedweb
QTableWidget Example using Python 2.4, QT 4.1.4, and PyQt import sys from Qt import * lista = ['aa', 'ab', 'ac'] listb = ['ba', 'bb', 'bc'] listc = ['ca', 'cb', 'cc'] mystruct = {'A':lista, 'B':listb, 'C':listc} class MyTable(QTableWidget): def __init__(self, thestruct, *args): QTableWidget.__init__(self, *args) self.data = thestruct self.setmydata() def setmydata(self): n = 0 for key in self.data: m = 0 for item in self.data[key]: newitem = QTableWidgetItem(item) self.setItem(m, n, newitem) m += 1 n += 1 def main(args): app = QApplication(args) table = MyTable(mystruct, 5, 3) table.show() sys.exit(app.exec_()) if __name__=="__main__": main(sys.argv) this example. It saved me quite some searching time. (.. On my machine I had to alter "from Qt import *" into "from PyQt4.QtGui import *") Bastian, yes I think from PyQt4.QtGui import * is the correct import statement now. I think from Qt import * was the old way. Thanks for your comment. How can I copy and pasty all the data from the whole table? Fantastic examples you have here. One thing I would do differently is to make use of enumerate() to index your for loops. I would rework the above like... def setmydata(self): for n, key in enumerate(self.data): for m, item in enumerate(self.data[key]): newitem = QTableWidgetItem(item) self.setItem(m, n, newitem) Ryan, Thanks. I agree your modification is much better. I learned about enumerate a couple years after I originally wrote this. (Also, I added one blank line in your comment before your code block so the formatting would come out correctly.) A Question: How to add "Cut & Paste" to QTableWidget?
https://www.saltycrane.com/blog/2006/10/qtablewidget-example-using-python-24/
CC-MAIN-2019-47
en
refinedweb
This document will walk you through: Use use_libfuzzer GN argument together with sanitizer to generate build files: Notice: current implementation also supports use_afl argument, but it is recommended to use libFuzzer for development. Running libFuzzer locally doesn't require any special configuration and quickly gives meaningful output for speed, coverage and other parameters. # With address sanitizer gn gen out/libfuzzer '--args=use_libfuzzer=true is_asan=true is_debug=false enable_nacl=false' --check Supported sanitizer configurations are: Create a new .cc file and define a LLVMFuzzerTestOneInput function: #include <stddef.h> #include <stdint.h> extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { // put your fuzzing code here and use data+size as input. return 0; } url_parse_fuzzer.cc is a simple example of real-world fuzzer. Define fuzzer_test GN target: import("//testing/libfuzzer/fuzzer_test.gni") fuzzer_test("my_fuzzer") { sources = [ "my_fuzzer.cc" ] deps = [ ... ] } Build with ninja as usual and run: ninja -C out/libfuzzer url_parse_fuzzer ./out/libfuzzer/url_parse_fuzzer Your fuzzer should produce output like this: INFO: Seed: 1787335005 INFO: -max_len is not provided, using 64 INFO: PreferSmall: 1 #0 READ units: 1 exec/s: 0 #1 INITED cov: 2361 bits: 95 indir: 29 units: 1 exec/s: 0 #2 NEW cov: 2710 bits: 359 indir: 36 units: 2 exec/s: 0 L: 64 MS: 0 The ... NEW ... line appears when libFuzzer finds new and interesting input. The efficient fuzzer should be able to finds lots of them rather quickly. The ... pulse ... line will appear periodically to show the current status. Your fuzzer may immediately discover interesting (i.e. crashing) inputs. To make it more efficient, several small steps can take you really far: seed_corpus = "src/fuzz-testcases/"attribute to your fuzzer targets and add example files in appropriate folder. Read more in Seed Corpus section of efficient fuzzer guide. Make sure corpus files are appropriately licensed. dict = "protocol.dict"attribute and key=valuedicitionary file format, mutations can be more effective. See Fuzzer Dictionary. -max_len=64(or takes the longest testcase in a corpus). ClusterFuzz takes random value in range from 1to 10000for each fuzzing session and passes that value to libFuzzers. If corpus contains testcases of size greater than max_len, libFuzzer will use only first max_lenbytes of such testcases. See Maximum Testcase Length. If the code that you are a fuzzing generates error messages when encountering incorrect or invalid data then you need to silence those errors in the fuzzer. If the target uses the Chromium logging APIs, the best way to do that is to override the environment used for logging in your fuzzer: struct Environment { Environment() { logging::SetMinLogLevel(logging::LOG_FATAL); } }; Environment* env = new Environment(); ClusterFuzz builds and executes all fuzzer_test targets in the source tree. The only thing you should do is to submit a fuzzer into Chrome. [1]You need to download prebuilt instrumented libraries to use msan (crbug/653712): GYP_DEFINES='use_goma=1 msan=1 use_prebuilt_instrumented_libraries=1' gclient runhooks [2]By default UBSan doesn't crash once undefined behavior has been detected. To make it crash the following additional option should be provided: UBSAN_OPTIONS=halt_on_error=1 ./fuzzer <corpus_directory_or_single_testcase_path> Other useful options (used by ClusterFuzz) are: UBSAN_OPTIONS=symbolize=1:halt_on_error=1:print_stacktrace=1 ./fuzzer <corpus_directory_or_single_testcase_path>
https://chromium.googlesource.com/chromium/src/+/d18e0892dcabb921e226354f0c50c95a8b15f4b1/testing/libfuzzer/getting_started.md
CC-MAIN-2019-47
en
refinedweb
Bricked a 3.0 unit? Hello all, I think I have bricked a 3.0 WiPy module. It just hangs when trying to upload files and does not finish a reset when pushing the reset button. The firmware update tool will not connect to the device and I cannot get Atom to connect to it either, usually claiming the port is not open. I've tried this on two different computers so far. Any thoughts on how to recover it? I've been developing my application using a file I named xServer.py but recently moved the code of xServer.py into main.py as I wanted to use the default UART0 for communication between a visual studio application and the module over the USB cable. The problems started after I uploaded the main.py file. Here is the code I uploaded: from network import Bluetooth from machine import UART BluetoothInstance = Bluetooth() #create a bluetooth instance BluetoothInstance.set_advertisement(name='SurfaceProBluetooth', service_uuid=b'1234567890123456') #set advertisement stuff BluetoothInstance.advertise(True) #turn on advertisements so device can be found uart = UART(0, baudrate=9600, bits=8, parity=None, stop=1) #init UART0 (default) #BluetoothInstance.callback(trigger=Bluetooth.CLIENT_CONNECTED | Bluetooth.CLIENT_DISCONNECTED, handler=conn_cb) Service1 = BluetoothInstance.service(uuid=1, isprimary=True) #create a service of BluetoothInstance Characteristic1 = Service1.characteristic(uuid=1, value=0x1234) #create a characteristic of service1 Characteristic1Data = 0 #must define Characteristic1Data here, initialise it with null def Characteristic1_CallBack_Handler(chr): #define call back handler of Characteristic1 for read/write event global Characteristic1Data #data variable which needs to be declared global inside handler deffinition events = chr.events() #figure out if handler was triggered from read OR write event?? not sure if events & Bluetooth.CHAR_WRITE_EVENT: #if write event print('Write Event') Characteristic1Data = chr.value() #write the value sent to the data variable #uart.write(Characteristic1Data) #write data out of UART port else: #else read event print('Read Event') return Characteristic1Data Characteristic1_CallBack = Characteristic1.callback(trigger=Bluetooth.CHAR_WRITE_EVENT | Bluetooth.CHAR_READ_EVENT, handler=Characteristic1_CallBack_Handler) Thanks everyone, safe boot procedure by holding pin 12 high during reset completely solved my problem! - Xykon administrators last edited by Xykon @nick9995 You can also try the new beta firmware updater and choose the "Erase flash file system" option in the Communication screen. This should remove all uploaded scripts from your module. Make sure you follow the instructions. If the firmware updater cannot connect please provide more details about your Operating System. - jmarcelino last edited by @nick9995 Please try the safe boot procedure: @nick9995 How do you connect the WiPy3 to your computer? Are you using an expansion board or another USB/UART bridge. If the computer claims, that the port is not open, then the problem is in between computer and WiPy. Usual sources are the cable, the expansion board/USB-UART bridge or the USB driver on the computer.
https://forum.pycom.io/topic/3166/bricked-a-3-0-unit/2
CC-MAIN-2019-47
en
refinedweb
Package org.eclipse.ui.testing Class TestableObject - java.lang.Object - org.eclipse.ui.testing.TestableObject public class TestableObject extends ObjectA testable object. Allows a test harness to register itself with a testable object. The test harness is notified of test-related lifecycle events, such as when is an appropriate time to run tests on the object. This also provides API for running tests as a runnable, and for signaling when the tests are starting and when they are finished. The workbench provides an implementation of this facade, available via PlatformUI.getTestableObject(). - Since: - 3.0 Method Detail getTestHarness public ITestHarness getTestHarness()Returns the test harness, or nullif it has not yet been set. - Returns: - the test harness or null setTestHarness public void setTestHarness(ITestHarness testHarness)Sets the test harness. - Parameters: testHarness- the test harness runTest public void runTest(Runnable testRunnable)Runs the given test runnable. The default implementation simply invokes runon the given test runnable. Subclasses may extend. - Parameters: testRunnable- the test runnable to run testingStarting public void testingStarting()Notification from the test harness that it is starting to run the tests. The default implementation does nothing. Subclasses may override. testingFinished public void testingFinished()Notification from the test harness that it has finished running the tests. The default implementation does nothing. Subclasses may override.
https://help.eclipse.org/2019-06/topic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/ui/testing/TestableObject.html
CC-MAIN-2019-47
en
refinedweb
Hello, I'm trying to read dictionary words from a file and store the output in a struct element of type unsigned char *. I keep getting a bunch of memory related errors and segmentation faults which Im sure are totally related to me trying to access something that's not really there. I'm just not sure how to get around my errors. Here's my truncated code (the parts that concern my problem so far) What I would like to do eventually is to calculate the hash value of a given word, which is argv[2] in this example, and calculate the hash value of each word in the given filename (argv[1]), and compare whether they match or no. If match, display "found", otherwise, "not found". #include <stdlib.h> #include <stdio.h> #include <cuda.h> #include <cutil.h> #include "common.h" #define MAX_THREADS_PER_BLOCK 128 typedef struct { unsigned const char *data; unsigned const char *hash; } testvector; int main(int argc, char *argv[]) { if(argc!=3) printf("usage: ./sha1test <filename> <searchword>\n"); else{ FILE* fp_in = fopen(argv[1], "r"); int count = 0; testvector *tv; tv = (testvector *) malloc(sizeof(testvector)); if(!fp_in) printf("can't open file\n"); unsigned char gHash[20]; sha1_cpu ((unsigned char*)argv[2], strlen((const char*)argv[2]), gHash); printf("Your word is:\t%s\n",argv[2]); //display <searchword> printf("The hash is:\t"); //display its calculated hash int ii; for(ii=0; ii<20; ii++) printf("%x", gHash[ii]); printf("\n"); //read words from file and calculate their hash values while(!feof(fp_in)){ size_t bytes = 128; unsigned char d[bytes]; fgets((char *)(&d[0]),bytes,fp_in); // d = (unsigned char *) malloc(50*sizeof(unsigned char)); count++; free(d); } fclose(fp_in); } return 0; } Would appreciate any help.
https://www.daniweb.com/programming/software-development/threads/197424/read-from-file-word-by-word-and-store-in-unsigned-char
CC-MAIN-2017-43
en
refinedweb
JavaScript fundamentals before learning React After all my teachings about React, be it online for a larger audience or on-site for companies transitioning to web development and React, I always come to the conclusion that React is all about JavaScript. Newcomers to React but also myself see it as an advantage, because you carry your JavaScript knowledge for a longer time around compared to your React skills. During my workshops, the larger part of the material is about JavaScript and not React. Most of it boils down to JavaScript ES6 and beyond – features and syntax – but also ternary operators, shorthand versions in the language, the this object, JavaScript built-in functions (map, reduce, filter) or more general concepts such as composability, reusability, immutability, closures, truth tables, or higher-order functions. These are the fundamentals, which you don’t need necessarily to master before starting with React, but which will definitely come up while learning or practicing it. The following walkthrough is my attempt giving you an almost extensive yet concise list about all the different JavaScript functionalities that complement your React knowledge. If you have any other things which are not in the list, just leave a comment for this article and I will keep it up to date. Table of Contents - Entering React after learning JavaScript - React and JavaScript Classes - Arrow Functions in React - Functions as Components in React - React Class Component Syntax - Template Literals in React - Map, Reduce and Filter in React - var, let, and const in React - Ternary Operator in React - Import and Export Statements in React - Libraries in React - Async/Await in React - Higher-Order Functions in React - Shorthand Object Assignment - Destructuring in React - Spread Operator in React - There is more JavaScript than React The Road to learn React Build a Hacker News App along the way. No setup configuration. No tooling. No Redux. Plain React in 200+ pages of learning material. Pay what you want like 50.000+ readers.Get the Book Entering React after learning JavaScript When you enter the world of React, you are often confronted with a React Class Component: import React, { Component } from 'react'; import logo from './logo.svg'; import './App.css'; class App extends Component { render() { return ( <div className="App"> <header className="App-header"> <img src={logo} <h1> Hello React </h1> <a href=""> Learn React </a> </header> </div> ); } } export default App; In a React class component, there are lots of things to digest for beginners which are not necessarily React: class statements, class methods and inheritance due to being a class. Also JavaScript import statements are only adding complexity when learning React. Even though the main focus point should be JSX (React’s syntax) – everything in the return statement – in the very beginning, often all the things around demand explanations as well. This article is supposed to shed some light into all the things around, most of it JavaScript, without worrying too much about React. React and JavaScript Classes Being confronted with a React class component, requires the prior knowledge about JavaScript classes. One would assume that this is given knowledge, but it isn’t, because JavaScript classes are fairly new in the language. Previously, there was only JavaScript’s prototype chain which has been used for inheritance too. JavaScript classes build up on top of the prototypical inheritance giving the whole thing a simpler representation with syntactic sugar. In order to understand JavaScript classes, you can take some time learning about them without React: class Developer { constructor(firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } getName() { return this.firstname + ' ' + this.lastname; } } var me = new Developer('Robin', 'Wieruch'); console.log(me.getName()); A class describes an entity which is used as a blueprint to create an instance of this entity. Once an instance of the class gets created with the new statement, the constructor of the class is called which instantiates the instance of the class. Therefore, a class can have properties which are usually located in its constructor. In addition, class methods (e.g. getName()) are used to read (or write) data of the instance. The instance of the class is represented as the this object within the class, but outside the instance is just assigned to a JavaScript variable. Usually classes are used for inheritance in object-oriented programming. They are used for the same in JavaScript whereas the extends statement can be used to inherit with one class from another class. The more specialized class inherits all the abilities from the more general class with the extends statement, and can add its specialized abilities to it: class Developer { constructor(firstname, lastname) { this.firstname = firstname; this.lastname = lastname; } getName() { return this.firstname + ' ' + this.lastname; } } class ReactDeveloper extends Developer { getJob() { return 'React Developer'; } } var me = new ReactDeveloper('Robin', 'Wieruch'); console.log(me.getName()); console.log(me.getJob()); Basically that’s all it needs to fully understand React class components. A JavaScript class is used for defining a React component, but as you can see, the React component is only a “React component” because it inherits all the abilities from the actual React Component class which is imported from the React package: import React, { Component } from 'react'; class App extends Component { render() { return ( <div> <h1>Welcome to React</h1> </div> ); } } export default App; That’s why the render() method is mandatory in React class components: The React Component from the imported React package instructs you to use it for displaying something in the browser. Furthermore, without extending from the React Component, you wouldn’t be able to use other lifecycle methods. For instance, there wouldn’t be a componentDidMount() lifecycle method, because the component would be an instance of a vanilla JavaScript class. And not only the lifecycle methods would go away, React’s API methods such as this.setState() for local state management wouldn’t be available as well. However, as you have seen, using a JavaScript class is beneficial for extending the general class with your specialized behavior. Thus you can introduce your own class methods or properties. import React, { Component } from 'react'; class App extends Component { getGreeting() { return 'Welcome to React'; } render() { return ( <div> <h1>{this.getGreeting()}</h1> </div> ); } } export default App; Now you know why React uses JavaScript classes for defining React class components. They are used when you need access to React’s API (lifecycle methods, this.state and this.setState()). In the following, you will see how React components can be defined in a different way without using a JavaScript class. After all, JavaScript classes welcome one using inheritance in React, which isn’t a desired outcome for React, because React favors composition over inheritance. So the only class you should extend from your React components should be the official React Component. Arrow Functions in React When teaching someone about React, I explain JavaScript arrow functions pretty early. They are one of JavaScript’s language additions in ES6 which pushed JavaScript forward in functional programming. // JavaScript ES5 function function getGreeting() { return 'Welcome to JavaScript'; } // JavaScript ES6 arrow function with body const getGreeting = () => { return 'Welcome to JavaScript'; } // JavaScript ES6 arrow function without body and implicit return const getGreeting = () => 'Welcome to JavaScript'; JavaScript arrow functions are often used in React applications for keeping the code concise and readable. I love them, teach them early, but always try to refactor my functions from JavaScript ES5 to ES6 functions along the way. At some point, when the differences between JavaScript ES5 functions and JavaScript ES6 functions become clear, I stick to the JavaScript ES6 way of doing it with arrow functions. However, I always see that too many different syntaxes can be overwhelming for React beginners. So I try to make the different characteristics of JavaScript functions clear before going all-in using them in React. In the following sections, you will see how JavaScript arrow functions are commonly used in React. Functions as Components in React React uses the best of different programming paradigms. That’s only possible because JavaScript is a many-sided programming language. On the object-oriented programming side, React’s class components are a great way of leveraging the abilities of JavaScript classes (inheritance for the React component API, class methods and class properties such as this.setState() and this.state). On the other side, there are lots of concepts from functional programming used in React (and its ecosystem) too. For instance, React’s function components are another way of defining components in React. The question which led to function components in React: What if components could be used like functions? function (props) { return view; } It’s a function which receives an input (e.g. props) and returns the displayed HTML elements (view). Under the hood, the function only needs to use the rendering mechanism of the render() method from React components: function Greeting(props) { return <h1>{props.greeting}</h1>; } Function components are the preferred way of defining components in React. They have less boilerplate, add less complexity, and are simpler to maintain than React class components. You can easily migrate your class components to function components with React Hooks. Previously, the article mentioned JavaScript arrow functions and how they improve your React code. Let’s apply these kind of functions to your function components. The previous Greeting component has two different looks with JavaScript ES5 and ES6: // JavaScript ES5 function function Greeting(props) { return <h1>{props.greeting}</h1>; } // JavaScript ES6 arrow function const Greeting = (props) => { return <h1>{props.greeting}</h1>; } // JavaScript ES6 arrow function // without body and implicit return const Greeting = (props) => <h1>{props.greeting}</h1>; JavaScript arrow functions are a great way of keeping your function components in React concise. Even more when there is no computation in between and thus the function body and return statement can be left out. React Class Component Syntax React’s way of defining components evolved over time. In its early stages, the React.createClass() method was the default way of creating a React class component. Nowadays, it isn’t used anymore, because with the rise of JavaScript ES6, the previously used React class component syntax became the default (only before React function components were introduced). However, JavaScript is evolving constantly and thus JavaScript enthusiast pick up new ways of doing things all the time. That’s why you will find often different syntaxes for React class components. One way of defining a React class component, with state and class methods, is the following: class Counter extends Component { constructor(props) { super(props); this.state = { counter: 0, }; this.onIncrement = this.onIncrement.bind(this); this.onDecrement = this.onDecrement.bind(this); }> ); } } However, when implementing lots of React class components, the binding of class methods in the constructor – and having a constructor in the first place – becomes a tedious implementation detail. Fortunately, there is a shorthand syntax for getting rid of both: class Counter extends Component { state = { counter: 0, };> ); } } By using JavaScript arrow functions, you can auto-bind class methods without having to bind them in the constructor. Also the constructor can be left out, when not using the props, by defining the state directly as a class property. ( Note: Be aware that class properties are not in the JavaScript language yet.) Therefore you can say that this way of defining a React class component is way more concise than the other version. Template Literals in React Template literals are another JavaScript language specific feature that came with JavaScript ES6. It is worth to mention it shortly, because when people new to JavaScript and React see them, they can be confusing as well. When learning JavaScript, it’s the following syntax that you grow up with for concatenating a string: function getGreeting(what) { return 'Welcome to ' + what; } const greeting = getGreeting('JavaScript'); console.log(greeting); // Welcome to JavaScript Template literals can be used for the same which is called string interpolation: function getGreeting(what) { return `Welcome to ${what}`; } You only have to use backticks and the ${} notation for inserting JavaScript primitives. However, string literals are not only used for string interpolation, but also for multiline strings in JavaScript: function getGreeting(what) { return ` Welcome to ${what} `; } Basically that’s how larger text blocks can be formatted on multiple lines. For instance, it can be seen with the recent introduction of GraphQL in JavaScript, because GraphQL queries are composed with template literals. Also React Styled Components makes use of template literals. Map, Reduce and Filter in React What’s the best approach teaching the JSX syntax for React beginners? Usually I start out with defining a variable in the render() method and using it as JavaScript in HTML in the return block. import React from 'react'; const App = () => { var greeting = 'Welcome to React'; return ( <div> <h1>{greeting}</h1> </div> ); }; export default App; You only have to use the curly braces to get your JavaScript in HTML. Going from rendering a string to a complex object isn’t any different. import React from 'react'; const App = () => { var user = { name: 'Robin' }; return ( <div> <h1>{user.name}</h1> </div> ); } export default App; Usually the next question then is: How to render a list of items? That’s one of the best parts about explaining React in my opinion. There is no React specific API such as a custom attribute on a HTML tag which enables you to render multiple items in React. You can use plain JavaScript for iterating over the list of items and returning HTML for each item. import React from 'react'; const App = () => { var users = [ { name: 'Robin' }, { name: 'Markus' }, ]; return ( <ul> {users.map(function (user) { return <li>{user.name}</li>; })} </ul> ); }; export default App; Having used the JavaScript arrow function before, you can get rid of the arrow function body and the return statement which leaves your rendered output way more concise. import React from 'react'; const App = () => { var users = [ { name: 'Robin' }, { name: 'Markus' }, ]; return ( <ul> {users.map(user => <li>{user.name}</li>)} </ul> ); } export default App; Pretty soon, every React developer becomes used to the built-in JavaScript map() methods for arrays. It just makes so much sense to map over an array and return the rendered output for each item. The same can be applied for custom tailored cases where filter() or reduce() make more sense rather than rendering an output for each mapped item. import React from 'react'; const App = () => { var users = [ { name: 'Robin', isDeveloper: true }, { name: 'Markus', isDeveloper: false }, ]; return ( <ul> {users .filter(user => user.isDeveloper) .map(user => <li>{user.name}</li>) } </ul> ); }; export default App; In general, that’s how React developers are getting used to these JavaScript built-in functions without having to use a React specific API for it. It is just JavaScript in HTML. var, let, and const in React Also the different variable declarations with var, let and const can be confusing for beginners to React even though they are not React specific. Maybe it is because JavaScript ES6 was introduced when React became popular. In general, I try to introduce let and const very early in my workshops. It simply starts with exchanging var with const in a React component: import React from 'react'; const App = () => { const users = [ { name: 'Robin' }, { name: 'Markus' }, ]; return ( <ul> {users.map(user => <li>{user.name}</li>)} </ul> ); }; export default App; Then I give the rules of thumb when to use which variable declaration: - (1) don’t use varanymore, because letand constare more specific - (2) default to const, because it cannot be re-assigned or re-declared - (3) use letwhen re-assigning the variable While let is usually used in a for loop for incrementing the iterator, const is normally used for keeping JavaScript variables unchanged. Even though it is possible to change the inner properties of objects and arrays when using const, the variable declaration shows the intent of keeping the variable unchanged though. Ternary Operator in React But it doesn’t end with displaying JavaScript strings, objects, and arrays in React. What about an if-else statement for enabling conditional rendering? You cannot use an if-else statement directly in JSX, but you can return early from the rendering function. Returning null is valid in React when displaying nothing. import React from 'react'; const App = () => { const users = [ { name: 'Robin' }, { name: 'Markus' }, ]; const showUsers = false; if (!showUsers) { return null; } return ( <ul> {users.map(user => <li>{user.name}</li>)} </ul> ); }; export default App; However, if you want to use an if-else statement within the returned JSX, you can do it by using a JavaScripts ternary operator: import React from 'react'; const App = () => { const users = [ { name: 'Robin' }, { name: 'Markus' }, ]; const showUsers = false; return ( <div> {showUsers ? ( <ul> {users.map(user => ( <li>{user.name}</li> ))} </ul> ) : null} </div> ); }; export default App; Another way of doing it, if you only return one side of the conditional rendering anyway, is using the && operator: import React from 'react'; const App = () => { const users = [ { name: 'Robin' }, { name: 'Markus' }, ]; const showUsers = false; return ( <div> {showUsers && ( <ul> {users.map(user => ( <li>{user.name}</li> ))} </ul> )} </div> ); }; export default App; I will not go into detail why this works, but if you are curious, you can learn about it and other techniques for conditional rendering over here: All the conditional renderings in React. After all, the conditional rendering in React only shows again that most of React is only JavaScript in JSX and not anything React specific. Import and Export Statements in React Fortunately, the JavaScript community settled on one way to import and export functionalities from files with JavaScript ES6 with import and export statements. However, being new to React and JavaScript ES6, these import and export statements are just another topic which requires explanation when getting started with your first React application. Pretty early you will have your first imports for CSS, SVG or other JavaScript files. The create-react-app project already starts with those import statements: import React from 'react'; import logo from './logo.svg'; import './App.css'; function App() { return ( <div className="App"> <header className="App-header"> <img src={logo} <h1> Hello React </h1> <a href=""> Learn React </a> </header> </div> ); } export default App; It’s great for the starter project, because it offers you a well-rounded experience how other files can be imported and (exported). Also the App component gets imported in the src/index.js file. However, when doing your first steps in React, I try to avoid those imports in the beginning. Instead, I try to focus on JSX and React components. Only later the import and export statements are introduced when separating the first React component or JavaScript function in another file. So how do these import and export statements work? Let’s say in one file you want to export the following variables: const firstname = 'Robin'; const lastname = 'Wieruch'; export { firstname, lastname }; Then you can import them in another file with a relative path to the first file: import { firstname, lastname } from './file1.js'; console.log(firstname); // output: Robin So it’s not necessarily about importing/exporting components or functions, it’s about sharing everything that is assignable to a variable (leaving out CSS or SVG imports/exports, but speaking only about JS). You can also import all exported variables from another file as one object: import * as person from './file1.js'; console.log(person.firstname); // output: Robin Imports can have an alias. It can happen that you import functionalities from multiple files that have the same named export. That’s why you can use an alias: import { firstname as username } from './file1.js'; console.log(username); // output: Robin All the previous cases are named imports and exports. But there exists the default statement too. It can be used for a few use cases: - to export and import a single functionality - to highlight the main functionality of the exported API of a module - to have a fallback import functionality const robin = { firstname: 'Robin', lastname: 'Wieruch', }; export default robin; Leave out the curly braces for the import to import the default export: import developer from './file1.js'; console.log(developer); // output: { firstname: 'Robin', lastname: 'Wieruch' } Furthermore, the import name can differ from the exported default name. You can also use it in conjunction with the named export and import statements: const firstname = 'Robin'; const lastname = 'Wieruch'; const person = { firstname, lastname, }; export { firstname, lastname, }; export default person; And import the default or the named exports in another file: import developer, { firstname, lastname } from './file1.js'; console.log(developer); // output: { firstname: 'Robin', lastname: 'Wieruch' } console.log(firstname, lastname); // output: Robin Wieruch You can also spare additional lines and export the variables directly for named exports: export const firstname = 'Robin'; export const lastname = 'Wieruch'; These are the main functionalities for ES6 modules. They help you to organize your code, to maintain your code, and to design reusable module APIs. You can also export and import functionalities to test them. Libraries in React React offers state management and side-effect features, but apart from this, it is only a component library which renders HTML for your browser. Everything else can be added from APIs (e.g. browser API, DOM API), JavaScript functionalities (e.g. map, filter, reduce) or external libraries. It’s not always simple to choose the right library for complementing your React application, but once you have a good overview of the different options, you can pick the one which fits best to your tech stack. For instance, fetching data in React can be done with the native fetch API: import React, { Component } from 'react'; class App extends Component { state = { data: null, }; componentDidMount() { fetch('') .then(response => response.json()) .then(data => this.setState({ data })); } render() { ... } } export default App; But it is up to you to use another library to fetch data in React. Axios is one popular choice for React applications: import React, { Component } from 'react'; import axios from 'axios'; class App extends Component { state = { data: null, }; componentDidMount() { axios.get('') .then(response => this.setState({ data: response.data })); } render() { ... } } export default App; So once you know about your problem which needs to be solved, React’s extensive and innovative ecosystem should give you plenty of options solving it. There again it’s not about React, but knowing about all the different JavaScript libraries which can be used to complement your application. Async/Await in React In a React Function Component, fetching data looks slightly different with React Hooks: import React from 'react'; import axios from 'axios'; const App = () => { const [data, setData] = React.useState(null); React.useEffect(() => { const fetchData = () => { axios.get('') .then(response => setData(response.data)); }; fetchData(); }, []); return ( ... ); }; export default App; In the previous code snippet, we have used the most common way to resolve a promise with a then-block. The catch-block for error handling is missing for keeping the example simple. Please read one of the referenced tutorials to learn more about fetching data in React with error handling. Anyway, you can also use async/await which got introduced to JavaScript not long ago: import React from 'react'; import axios from 'axios'; const App = () => { const [data, setData] = React.useState(null); React.useEffect(() => { const fetchData = async () => { const response = await axios.get(''); setData(response.data); }; fetchData(); }, []); return ( ... ); }; export default App; In the end, async/await is just another way of resolving promises in asynchronous JavaScript. Higher-Order Functions in React Higher-order functions are a great programming concept especially when moving towards functional programming. In React, it makes total sense to know about these kind of functions, because at some point you have to deal with higher-order components which can be explained best when knowing about higher-order functions in the first place. Higher-order functions can be showcased in React early on without introducing higher-order components. For instance, let’s say a rendered list of users can be filtered based on the value of an input field. import React from 'react'; const App = () => { const users = [{ name: 'Robin' }, { name: 'Markus' }]; const [query, setQuery] = React.useState(''); const handleChange = event => { setQuery(event.target.value); }; return ( <div> <ul> {users .filter(user => user.name.includes(query)) .map(user => ( <li>{user.name}</li> ))} </ul> <input type="text" onChange={handleChange} /> </div> ); }; export default App; It’s not always desired to extract functions, because it can add unnecessary complexity, but on the other side, it can have beneficial learning effects for JavaScript. In addition, by extracting a function you make it testable in isolation from the React component. So let’s showcase it with the function which is provided to the built-in filter function. import React from 'react'; function doFilter(user) { return user.name.includes(query); } const App = () => { const users = [{ name: 'Robin' }, { name: 'Markus' }]; const [query, setQuery] = React.useState(''); const handleChange = event => { setQuery(event.target.value); }; return ( <div> <ul> {users.filter(doFilter).map(user => ( <li>{user.name}</li> ))} </ul> <input type="text" onChange={handleChange} /> </div> ); }; export default App; The previous implementation doesn’t work because the doFilter() function needs to know about the query property from the state. So you can pass it to the function by wrapping it with another function which leads to a higher-order function. import React from 'react'; function doFilter(query) { return function(user) { return user.name.includes(query); }; } const App = () => { const users = [{ name: 'Robin' }, { name: 'Markus' }]; const [query, setQuery] = React.useState(''); const handleChange = event => { setQuery(event.target.value); }; return ( <div> <ul> {users.filter(doFilter(query)).map(user => ( <li>{user.name}</li> ))} </ul> <input type="text" onChange={handleChange} /> </div> ); }; export default App; Basically a higher-order function is a function which returns a function. By using JavaScript ES6 arrow functions, you can make a higher-order function more concise. Furthermore, this shorthand version makes it more attractive composing functions into functions. const doFilter = query => user => user.name.includes(query); Now, the doFilter() function can be exported from the file and tested in isolation as pure (higher-order) function. After learning about higher-order functions, all the fundamental knowledge is established to learn more about React’s higher-order components, if you want to learn about this advanced technique in React. Moving functions around your code base is a great way to learn about the benefits of having functions as first class citizens in JavaScript. It’s powerful when moving your code towards functional programming. Shorthand Object Assignment There is one little addition in the JavaScript language which leaves beginners confused. In JavaScript ES6, you can use a shorthand property syntax to initialize your objects more concisely, like following object initialization: const name = 'Robin'; const user = { name: name, }; When the property name in your object is the same as your variable name, you can do the following: const name = 'Robin'; const user = { name, }; Shorthand method names are also useful. In JavaScript ES6, you can initialize methods in an object more concisely: // without shorthand method names var userService = { getUserName: function (user) { return user.firstname + ' ' + user.lastname; }, }; // shorthand method names const userService = { getUserName(user) { return user.firstname + ' ' + user.lastname; }, }; Finally, you are allowed to use computed property names in JavaScript ES6: // normal usage of key property in an object var user = { name: 'Robin', }; // computed key property for dynamic naming const key = 'name'; const user = { [key]: 'Robin', }; You are able to use computed property names to allocate values by key in an object dynamically, a handy way to generate lookup tables (also called dictionaries) in JavaScript. Destructuring in React Another language feature introduced in JavaScript is called destructuring. It’s often the case that you have to access plenty of properties from your state or props in your component. Rather than assigning them to a variable one by one, you can use destructuring assignment in JavaScript. const state = { counter: 1, list: ['a', 'b'] }; // no object destructuring const list = state.list; const counter = state.counter; // object destructuring const { list, counter } = state; That’s especially beneficial for React’s Function Components, because they always receive the props object in their function signature. Often you will not use the props but only its content, so you can destructure the content in the function signature. // no destructuring function Greeting(props) { return <h1>{props.greeting}</h1>; } // destructuring function Greeting({ greeting }) { return <h1>{greeting}</h1>; } The destructuring works for JavaScript arrays too: const list = ['a', 'b']; // no array destructuring const itemOne = list[0]; const itemTwo = list[1]; // array destructuring const [itemOne, itemTwo] = list; As you have already seen, React Hooks are using the array destructuring to access state and state updater function. import React from 'react'; const Counter = () => { const [count, setCount] = React.useState(0); return ( <div> <p>You clicked {count} times</p> <button onClick={() => setCount(count + 1)}> Click me </button> </div> ); }; export default Counter; Another great feature is the rest destructuring. It is often used for splitting out a part of an object, but keeping the remaining properties in another object. const state = { counter: 1, list: ['a', 'b'] }; // rest destructuring const { list, ...rest } = state; console.log(rest); // output: { counter: 1 } console.log(list); // output: ['a', 'b'] Afterward, the list can be used to be rendered, for instance in a React component, whereas the remaining state (here counter) is used somewhere else. That’s where the JavaScript spread operator comes into play to forward the rest object to the next component. In the next section, you will see this operator in action. Spread Operator in React The spread operator comes with three …, but shouldn’t be mistaken for the rest operator. It depends on the context where it is used. Used within a destructuring (see above), it is as rest operator. Used somewhere else it is a spread operator. const userCredentials = { firstname: 'Robin' }; const userDetails = { nationality: 'German' }; const user = { ...userCredentials, ...userDetails, }; console.log(user); // output: { firstname: 'Robin', nationality: 'German' } The spread operator literally spreads all the key value pairs of an object. In React, it comes in handy when props are just being passed down to the next component. import React from 'react'; const App = () => { const users = [ { name: 'Robin', nationality: 'German' }, { name: 'Markus', nationality: 'American' }, ]; return ( <ul> {users.map(user => <li> <User name={user.name} nationality={user.nationality} /> </li>)} </ul> ); }; const User = ({ name, nationality }) => <span>{name} from {nationality}</span>; export default App; Rather than passing all properties of an object property by property, you can use the spread operator to pass all key value pairs to the next component. import React from 'react'; const App = () => { const users = [ { name: 'Robin', nationality: 'German' }, { name: 'Markus', nationality: 'American' }, ]; return ( <ul> {users.map(user => <li> <User {...user} /> </li>)} </ul> ); }; const User = ({ name, nationality }) => <span>{name} from {nationality}</span>; export default App; Also you don’t need to worry about the object’s structure beforehand, because the operator simply passes everything to the next component. There is more JavaScript than React In conclusion, there is lots of JavaScript which can be harnessed in React. Whereas React has only a slim API surface area, developers have to get used to all the functionalities JavaScript has to offer. The saying is not without any reason: “being a React developer makes you a better JavaScript developer”. Let’s recap some of the learned aspects of JavaScript in React by refactoring a higher-order component. function withLoading(Component) { return class WithLoading extends React.Coomponent { render() { const { isLoading, ...rest } = this.props; if (isLoading) { return <p>Loading</p>; } return <Component { ...rest } />; } } } This higher-order component is only used for showing a conditional loading indicator when the isLoading prop is set to true. Otherwise it renders the input component. You can already see the (rest) destructuring from the props and the spread operator in for the next Component. The latter can be seen for the rendered Component, because all the remaining properties from the props object are passed to the Component as key value pairs. The first step for making the higher-order component more concise is refactoring the returned React Class Component to a Function Component: function withLoading(Component) { return function ({ isLoading, ...rest }) { if (isLoading) { return <p>Loading</p>; } return <Component { ...rest } />; }; } You can see that the rest destructuring can be used in the function’s signature too. Next, using JavaScript ES6 arrow functions makes the higher-order component more concise again: const withLoading = Component => ({ isLoading, ...rest }) => { if (isLoading) { return <p>Loading</p>; } return <Component { ...rest } />; } And adding the ternary operator shortens the function body into one line of code. Thus the function body can be left out and the return statement can be omitted. const withLoading = Component => ({ isLoading, ...rest }) => isLoading ? <p>Loading</p> : <Component { ...rest } /> As you can see, the higher-order component uses various JavaScript and not React relevant techniques: arrow functions, higher-order functions, a ternary operator, destructuring and the spread operator. Basically that’s how JavaScript’s functionalities can be used in React applications in a nutshell. Often people say that learning React has a steep learning curve. But it hasn’t when only leaving React in the equation and leaving all the JavaScript out of it. React doesn’t add any foreign abstraction layer on top as other web frameworks are doing it. Instead you have to use JavaScript. So hone your JavaScript skills and you will become a great React developer.
https://www.robinwieruch.de/javascript-fundamentals-react-requirements/?fbclid=IwAR0U2EQu9Nb6xHbLmhbdiD6i3BV8a_4LddgqsIcTU1w1DAXks3Rg0sCVraE
CC-MAIN-2019-35
en
refinedweb
Red Hat Bugzilla – Bug 194132 Review Request: yum-metadata-parser Last modified: 2013-01-09 20:25:27 EST Spec URL: SRPM URL: Description: C based parser for repomd to speed things up in yum. Note that this is only available in CVS right now, but will end up being required (well, desired at least) with yum 2.9.0 and the plan is to have a release of this at the same time. I expect we'll be moving the files to under the yum namespace at that point, too, but I want to start this ball rolling to avoid trying to do a last minute review :) NEEDSWORK: - %{?dist} doesn't work in brew Question: - Is this really a development library, or a runtime library? (is there a difference?) I can't build it until the new yum becomes available. %{?dist} will just evaluate to nothing while the buildsys doesn't have it defined. Thus, having it isn't really problematic. Development/Libraries matches what's used for most other python modules, so it's at least consistent (although never really used). And it builds fine without the new yum, you just can't really take advantage of it (hence, the runtime requires) rpmlint fails. E: yum-metadata-parser non-executable-script /usr/lib64/python2.4/site-packages/sqlitecachec.py 0644 I think it's being triggered by the #! at the top of the file -- removed it in CVS. When I first saw it earlier, I thought rpmlint was just being silly (as it's a module, not actually a script). At the same time, it is a pretty spurious error to have as an error. *shrug* Ok, then approved. In RAWHIDE.
https://bugzilla.redhat.com/show_bug.cgi?id=194132
CC-MAIN-2017-39
en
refinedweb
Opened 4 years ago Closed 4 years ago Last modified 4 years ago #20257 closed Bug (fixed) QuerySet that prefetches related object with a ManyToMany field cannot be pickled. Description After upgrading from 1.4 to 1.5, exceptions were thrown when trying to pickle certain querysets. This means that the caching framework doesn't work for these querysets. In 1.4 the following code runs fine. In 1.5 this error occurs: PicklingError: Can't pickle <class 'people.models.SocialProfile_friends'>: it's not found as people.models.SocialProfile_friends models.py from django.db import models class Person(models.Model): name = models.CharField(max_length=200) class SocialProfile(models.Model): person = models.ForeignKey(Person) friends = models.ManyToManyField('self') tests.py from django.test import TestCase from people.models import Person import pickle class SimpleTest(TestCase): def test_pickle_failure(self): bob = Person(name="Bob") bob.save() people = Person.objects.all().prefetch_related('socialprofile_set') pickle.dumps(people) Change History (7) comment:1 Changed 4 years ago by comment:2 Changed 4 years ago by The problem is that fields for automatic models (for example the intermediary m2m table) can't be pickled in 1.5. In master this is fixed by introducing Field.reduce. In 1.4 the field wasn't used directly, only the field.name was used so there was no problems. So, to fix this, one of the following three things needs to be done: - alter QuerySet.__getstate__and __setstate__to do something similar that sql.query:Query's state methods do. That is, store the field's name in getstate and restore back the real field instance in setstate. - remove direct storage of the field in QuerySet - backpatch Field.reduce changes from master I think the Field.reduce changes are too risky to backpatch, and I assume there was a good reason to store the field directly in QuerySet instead of field.name. So, changes to getstate and setstate seem like the best choice to me. comment:3 Changed 4 years ago by comment:4 Changed 4 years ago by comment:5 Changed 4 years ago by This is currently blocking our team from upgrading to Django 1.5. Just wondering if this will be included in the 1.5.2 release? Thanks for the fix! comment:6 Changed 4 years ago by @michaelmior, Yes it will be. You can see the commit above is prefixed with [1.5.x] indicating it was committed to the stable/1.5.x branch. comment:7 Changed 4 years ago by Thanks @timo! I noticed that after. I apologize if it's bad form to ask, but any ETA on the 1.5.2 release? I'm happy to pitch in if there are release blockers that need to be resolved. Hi, Thanks for the detailed report. I can reproduce the issue in the stable/1.5.xbranch but it appears to have been fixed in master. The testcase works on the stable/1.4.xbranch so it is a regression. Using git bisect, I found that the problem was introduced by commit 056ace0f395a58eeac03da9f9ee7e3872e1e407b.
https://code.djangoproject.com/ticket/20257
CC-MAIN-2017-39
en
refinedweb
Feb 05, 2008 10:21 AM|.NET|LINK Hi, I've got a JPG image on my desktop "C:\Documents and Settings\win user\Desktop\marktest.jpg" which I'm trying to resize through ASP.NET and then upload the resized image to the server. I currently have one test page which uses a CodeFile.... GDI-UploadImage.aspx GDI-UploadImage.aspx.cs The code for the "GDI-UploadImage.aspx" file is: <%@ Page <html lang="en-GB"> <head> <meta http- <title>ASP.NET 2.0 [GDI+ Upload Image Example]</title> </head> <body> <form id="form2" runat="server"> <asp:FileUpload <br /><br /> <asp:Button <br /><br /> <asp:Label</asp:Label> </form> </body> </html> The code for the "GDI-UploadImage.aspx.cs" file is: System.IO; using System.Drawing; using System.Drawing.Drawing2D; using System.Drawing.Imaging; public partial class GDI_UploadImage : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { // } protected void UploadFile(Object s, EventArgs e) { // did the user upload any file? if (fileUpload.HasFile) { // get the name of the file string fileName = fileUpload.FileName; // Create the in-memory bitmap where you will draw the image. Bitmap image = new Bitmap(490, 220); Graphics g = Graphics.FromImage(image); // Add a graphic from a file. System.Drawing.Image carImage = System.Drawing.Image.FromFile(fileName); g.DrawImage(carImage, 10, 10, 200, 200); // Save image to the server image.Save(Server.MapPath(@"Uploaded-Files\" + fileName), System.Drawing.Imaging.ImageFormat.Jpeg); // Clean up. g.Dispose(); image.Dispose(); // inform the user about the file upload success label.Text = "File <b style='color: red;'>" + fileName + "</b> uploaded."; } else { label.Text = "No file uploaded!"; } } }Any help appreciated, I've been asking around for ages and apparently this is impossible!? Even if someone could provide a work-around that would be greatly appreciated.Kind regards, Mark Contributor 3572 Points Feb 05, 2008 11:04 AM|mcmcomasp|LINK im fairly certain that your going to have to upload the file before you can do any resizing on it, after all your using "server side" code, logically the object you want to manipulate should exist on the server before the code can access it. that being said what i would recommend is something like: 1. user selects file from disk and uploads to a temp folder on your server 2. your app (once file is uploaded) moves the user to a new form where they can resize the image 3. they click a "save" or "commit" button which will save the re-sized image to whereever you want it to be saved too, then you can delete the temp (larger) image. let me know if this kind of thing could be a good workaround. hth, mcm Feb 14, 2008 05:22 AM|.NET|LINK For anyone interested - the other post I had has resolved this issue.... 3 replies Last post Feb 14, 2008 05:22 AM by .NET
https://forums.asp.net/t/1215576.aspx?Resizing+Optimising+BEFORE+uploading
CC-MAIN-2017-39
en
refinedweb
@ThreadSafe @Generated(value="com.amazonaws:aws-java-sdk-code-generator") public class AmazonEC2Client extends AmazonWebServiceClient implements AmazonEC2 Amazon Elastic Compute Cloud (Amazon EC2) provides resizable computing capacity in the Amazon Web Services (AWS) cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. LOGGING_AWS_REQUEST_METRIC ENDPOINT_PREFIX addRequestHandler, addRequestHandler, configureRegion, getEndpointPrefix, setEndpoint, setRegion @Deprecated public AmazonEC2Client() AmazonEC2ClientBuilder.defaultClient() All service calls made using this new client object are blocking, and will not return until the service call completes. DefaultAWSCredentialsProviderChain @Deprecated public AmazonEC2Client(ClientConfiguration clientConfiguration) AwsClientBuilder.withClientConfiguration(ClientConfiguration) All service calls made using this new client object are blocking, and will not return until the service call completes. clientConfiguration- The client configuration options controlling how this client connects to Amazon EC2 (ex: proxy settings, retry counts, etc.). DefaultAWSCredentialsProviderChain @Deprecated public AmazonEC2Client(AWSCredentials awsCredentials) AwsClientBuilder.withCredentials(AWSCredentialsProvider)for example: AmazonEC2ClientBuilder.standard().withCredentials(new AWSStaticCredentialsProvider(awsCredentials)).build(); All service calls made using this new client object are blocking, and will not return until the service call completes. awsCredentials- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. @Deprecated public AmazonEC2Client(AWSCredentials awsCredentials,- The AWS credentials (access key ID and secret key) to use when authenticating with AWS services. clientConfiguration- The client configuration options controlling how this client connects to Amazon EC2 (ex: proxy settings, retry counts, etc.). @Deprecated public AmazonEC2Client(AWSCredentialsProvider awsCredentialsProvider) AwsClientBuilder.withCredentials(AWSCredentialsProvider) All service calls made using this new client object are blocking, and will not return until the service call completes. awsCredentialsProvider- The AWS credentials provider which will provide credentials to authenticate requests with AWS services. @Deprecated public AmazonEC2Client(AWSCredentialsProvider awsCredentialsProvider,.). @Deprecated public AmazonEC2Client(AWSCredentialsProvider awsCredentialsProvider, ClientConfiguration clientConfiguration, RequestMetricCollector requestMetricCollector) AwsClientBuilder.withCredentials(AWSCredentialsProvider)and AwsClientBuilder.withClientConfiguration(ClientConfiguration)and AwsClientBuilder.withMetricsCollector(RequestMetricCollector).). requestMetricCollector- optional request metric collector public static AmazonEC2ClientBuilder builder() public AcceptReservedInstancesExchangeQuoteResult acceptReservedInstancesExchangeQuote(AcceptReservedInstancesExchangeQuoteRequest request) Accepts the Convertible Reserved Instance exchange quote described in the GetReservedInstancesExchangeQuote call. acceptReservedInstancesExchangeQuotein interface AmazonEC2 acceptReservedInstancesExchangeQuoteRequest- Contains the parameters for accepting the quote. public AcceptVpcPeeringConnectionResult acceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest request). acceptVpcPeeringConnectionin interface AmazonEC2 acceptVpcPeeringConnectionRequest- Contains the parameters for AcceptVpcPeeringConnection. public AcceptVpcPeeringConnectionResult acceptVpcPeeringConnection() acceptVpcPeeringConnectionin interface AmazonEC2 AmazonEC2.acceptVpcPeeringConnection(AcceptVpcPeeringConnectionRequest) public AllocateAddressResult allocateAddress(AllocateAddressRequest request) Allocates an Elastic IP address. An Elastic IP address is for use either in the EC2-Classic platform or in a VPC. By default, you can allocate 5 Elastic IP addresses for EC2-Classic per region and 5 Elastic IP addresses for EC2-VPC per region. If you release an Elastic IP address for use in a VPC, you might be able to recover it. To recover an Elastic IP address that you released, specify it in the Address parameter. Note that you cannot recover an Elastic IP address that you released after it is allocated to another AWS account. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide. allocateAddressin interface AmazonEC2 allocateAddressRequest- Contains the parameters for AllocateAddress. public AllocateAddressResult allocateAddress() allocateAddressin interface AmazonEC2 AmazonEC2.allocateAddress(AllocateAddressRequest) public AllocateHostsResult allocateHosts(AllocateHostsRequest request) Allocates a Dedicated Host to your account. At minimum you need to specify the instance size type, Availability Zone, and quantity of hosts you want to allocate. allocateHostsin interface AmazonEC2 allocateHostsRequest- Contains the parameters for AllocateHosts. public AssignIpv6AddressesResult assignIpv6Addresses(AssignIpv6AddressesRequest request)in interface AmazonEC2 assignIpv6AddressesRequest- public AssignPrivateIpAddressesResult assignPrivateIpAddresses(AssignPrivateIpAddressesRequest request). assignPrivateIpAddressesin interface AmazonEC2 assignPrivateIpAddressesRequest- Contains the parameters for AssignPrivateIpAddresses. public AssociateAddressResult associateAddress(AssociateAddressRequest request) Associates an Elastic IP address with an instance or a network interface.in interface AmazonEC2 associateAddressRequest- Contains the parameters for AssociateAddress. public AssociateDhcpOptionsResult associateDhcpOptions(AssociateDhcpOptionsRequest request)in interface AmazonEC2 associateDhcpOptionsRequest- Contains the parameters for AssociateDhcpOptions. public AssociateIamInstanceProfileResult associateIamInstanceProfile(AssociateIamInstanceProfileRequest request) Associates an IAM instance profile with a running or stopped instance. You cannot associate more than one IAM instance profile with an instance. associateIamInstanceProfilein interface AmazonEC2 associateIamInstanceProfileRequest- public AssociateRouteTableResult associateRouteTable(AssociateRouteTableRequest request) about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide. associateRouteTablein interface AmazonEC2 associateRouteTableRequest- Contains the parameters for AssociateRouteTable. public AssociateSubnetCidrBlockResult associateSubnetCidrBlock(AssociateSubnetCidrBlockRequest request) Associates a CIDR block with your subnet. You can only associate a single IPv6 CIDR block with your subnet. An IPv6 CIDR block must have a prefix length of /64. associateSubnetCidrBlockin interface AmazonEC2 associateSubnetCidrBlockRequest- public AssociateVpcCidrBlockResult associateVpcCidrBlock(AssociateVpcCidrBlockRequest request)in interface AmazonEC2 associateVpcCidrBlockRequest- public AttachClassicLinkVpcResult attachClassicLinkVpc(AttachClassicLinkVpcRequest request)Vpcin interface AmazonEC2 attachClassicLinkVpcRequest- Contains the parameters for AttachClassicLinkVpc. public AttachInternetGatewayResult attachInternetGateway(AttachInternetGatewayRequest request) Attaches an Internet gateway to a VPC, enabling connectivity between the Internet and the VPC. For more information about your VPC and Internet gateway, see the Amazon Virtual Private Cloud User Guide. attachInternetGatewayin interface AmazonEC2 attachInternetGatewayRequest- Contains the parameters for AttachInternetGateway. public AttachNetworkInterfaceResult attachNetworkInterface(AttachNetworkInterfaceRequest request) Attaches a network interface to an instance. attachNetworkInterfacein interface AmazonEC2 attachNetworkInterfaceRequest- Contains the parameters for AttachNetworkInterface. public AttachVolumeResult attachVolume(AttachVolumeRequest request) an overview of the AWS Marketplace, see Introducing AWS Marketplace. For more information about EBS volumes, see Attaching Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide. attachVolumein interface AmazonEC2 attachVolumeRequest- Contains the parameters for AttachVolume. public AttachVpnGatewayResult attachVpnGateway(AttachVpnGatewayRequest request) Attaches a virtual private gateway to a VPC. You can attach one virtual private gateway to one VPC at a time. For more information, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide. attachVpnGatewayin interface AmazonEC2 attachVpnGatewayRequest- Contains the parameters for AttachVpnGateway. public AuthorizeSecurityGroupEgressResult authorizeSecurityGroupEgress(AuthorizeSecurityGroupEgressRequest request) . Each rule consists of the protocol (for example, TCP), plus either a CIDR range or a source group. For the TCP and UDP protocols, you must also specify the destination port or port range. For the ICMP protocol, you must also specify the ICMP type and code. You can use -1 for the type or code to mean all types or all codes. You can optionally specify a description for the rule. Rule changes are propagated to affected instances as quickly as possible. However, a small delay might occur. authorizeSecurityGroupEgressin interface AmazonEC2 authorizeSecurityGroupEgressRequest- Contains the parameters for AuthorizeSecurityGroupEgress. public AuthorizeSecurityGroupIngressResult authorizeSecurityGroupIngress(AuthorizeSecurityGroupIngressRequest request). You can optionally specify a description for the security group rule. authorizeSecurityGroupIngressin interface AmazonEC2 authorizeSecurityGroupIngressRequest- Contains the parameters for AuthorizeSecurityGroupIngress. public BundleInstanceResult bundleInstance(BundleInstanceRequest request). bundleInstancein interface AmazonEC2 bundleInstanceRequest- Contains the parameters for BundleInstance. public CancelBundleTaskResult cancelBundleTask(CancelBundleTaskRequest request) Cancels a bundling operation for an instance store-backed Windows instance. cancelBundleTaskin interface AmazonEC2 cancelBundleTaskRequest- Contains the parameters for CancelBundleTask. public CancelConversionTaskResult cancelConversionTask(CancelConversionTaskRequest request)in interface AmazonEC2 cancelConversionTaskRequest- Contains the parameters for CancelConversionTask. public CancelExportTaskResult cancelExportTask(CancelExportTaskRequest request)in interface AmazonEC2 cancelExportTaskRequest- Contains the parameters for CancelExportTask. public CancelImportTaskResult cancelImportTask(CancelImportTaskRequest request) Cancels an in-process import virtual machine or import snapshot task. cancelImportTaskin interface AmazonEC2 cancelImportTaskRequest- Contains the parameters for CancelImportTask. public CancelImportTaskResult cancelImportTask() cancelImportTaskin interface AmazonEC2 AmazonEC2.cancelImportTask(CancelImportTaskRequest) public CancelReservedInstancesListingResult cancelReservedInstancesListing(CancelReservedInstancesListingRequest request) Cancels the specified Reserved Instance listing in the Reserved Instance Marketplace. For more information, see Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide. cancelReservedInstancesListingin interface AmazonEC2 cancelReservedInstancesListingRequest- Contains the parameters for CancelReservedInstancesListing. public CancelSpotFleetRequestsResult cancelSpotFleetRequests(CancelSpotFleetRequestsRequest request)in interface AmazonEC2 cancelSpotFleetRequestsRequest- Contains the parameters for CancelSpotFleetRequests. public CancelSpotInstanceRequestsResult cancelSpotInstanceRequests(CancelSpotInstanceRequestsRequest request)in interface AmazonEC2 cancelSpotInstanceRequestsRequest- Contains the parameters for CancelSpotInstanceRequests. public ConfirmProductInstanceResult confirmProductInstance(ConfirmProductInstanceRequest request) Determines whether a product code is associated with an instance. This action can only be used by the owner of the product code. It is useful when a product code owner needs to verify whether another user's instance is eligible for support. confirmProductInstancein interface AmazonEC2 confirmProductInstanceRequest- Contains the parameters for ConfirmProductInstance. public CopyImageResult copyImage(CopyImageRequest request) Initiates the copy of an AMI from the specified source region to the current region. You specify the destination region by using its endpoint when making the request. For more information about the prerequisites and limits when copying an AMI, see Copying an AMI in the Amazon Elastic Compute Cloud User Guide. copyImagein interface AmazonEC2 copyImageRequest- Contains the parameters for CopyImage. public CopySnapshotResult copySnapshot(CopySnapshotRequest request)).in interface AmazonEC2 copySnapshotRequest- Contains the parameters for CopySnapshot. public CreateCustomerGatewayResult createCustomerGateway(CreateCustomerGatewayRequest request) may about VPN customer gateways, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloudin interface AmazonEC2 createCustomerGatewayRequest- Contains the parameters for CreateCustomerGateway. public CreateDefaultVpcResult createDefaultVpc(CreateDefaultVpcRequest request)Vpcin interface AmazonEC2 createDefaultVpcRequest- Contains the parameters for CreateDefaultVpc. public CreateDhcpOptionsResult createDhcpOptions(CreateDhcpOptionsRequest request). If you want your instance to about DHCP options, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide. createDhcpOptionsin interface AmazonEC2 createDhcpOptionsRequest- Contains the parameters for CreateDhcpOptions. public CreateEgressOnlyInternetGatewayResult createEgressOnlyInternetGateway(CreateEgressOnlyInternetGatewayRequest request) in interface AmazonEC2 createEgressOnlyInternetGatewayRequest- public CreateFlowLogsResult createFlowLogs(CreateFlowLogsRequest request)in interface AmazonEC2 createFlowLogsRequest- Contains the parameters for CreateFlowLogs. public CreateFpgaImageResult createFpgaImage(CreateFpgaImageRequest request). createFpgaImagein interface AmazonEC2 createFpgaImageRequest- public CreateImageResult createImage(CreateImageRequest request)in interface AmazonEC2 createImageRequest- Contains the parameters for CreateImage. public CreateInstanceExportTaskResult createInstanceExportTask(CreateInstanceExportTaskRequest request)in interface AmazonEC2 createInstanceExportTaskRequest- Contains the parameters for CreateInstanceExportTask. public CreateInternetGatewayResult createInternetGateway(CreateInternetGatewayRequest request)in interface AmazonEC2 createInternetGatewayRequest- Contains the parameters for CreateInternetGateway. public CreateInternetGatewayResult createInternetGateway() createInternetGatewayin interface AmazonEC2 AmazonEC2.createInternetGateway(CreateInternetGatewayRequest) public CreateKeyPairResult createKeyPair(CreateKeyPairRequest request)in interface AmazonEC2 createKeyPairRequest- Contains the parameters for CreateKeyPair. public CreateNatGatewayResult createNatGateway(CreateNatGatewayRequest request)in interface AmazonEC2 createNatGatewayRequest- Contains the parameters for CreateNatGateway. public CreateNetworkAclResult createNetworkAcl(CreateNetworkAclRequest request) Creates a network ACL in a VPC. Network ACLs provide an optional layer of security (in addition to security groups) for the instances in your VPC. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide. createNetworkAclin interface AmazonEC2 createNetworkAclRequest- Contains the parameters for CreateNetworkAcl. public CreateNetworkAclEntryResult createNetworkAclEntry(CreateNetworkAclEntryRequest request)in interface AmazonEC2 createNetworkAclEntryRequest- Contains the parameters for CreateNetworkAclEntry. public CreateNetworkInterfaceResult createNetworkInterface(CreateNetworkInterfaceRequest request) Creates a network interface in the specified subnet. For more information about network interfaces, see Elastic Network Interfaces in the Amazon Virtual Private Cloud User Guide. createNetworkInterfacein interface AmazonEC2 createNetworkInterfaceRequest- Contains the parameters for CreateNetworkInterface. public CreateNetworkInterfacePermissionResult createNetworkInterfacePermission(CreateNetworkInterfacePermissionRequest request) Grants an AWS authorized partner account permission to attach the specified network interface to an instance in their account. You can grant permission to a single AWS account only, and only one account at a time. createNetworkInterfacePermissionin interface AmazonEC2 createNetworkInterfacePermissionRequest- Contains the parameters for CreateNetworkInterfacePermission. public CreatePlacementGroupResult createPlacementGroup(CreatePlacementGroupRequest request)in interface AmazonEC2 createPlacementGroupRequest- Contains the parameters for CreatePlacementGroup. public CreateReservedInstancesListingResult createReservedInstancesListing(CreateReservedInstancesListingRequest request) with a capacity reservation can be sold in the Reserved Instance Marketplace. Convertible Reserved Instances and Standard Reserved Instances with a regional benefitin interface AmazonEC2 createReservedInstancesListingRequest- Contains the parameters for CreateReservedInstancesListing. public CreateRouteResult createRoute(CreateRouteRequest request)outein interface AmazonEC2 createRouteRequest- Contains the parameters for CreateRoute. public CreateRouteTableResult createRouteTable(CreateRouteTableRequest request) Creates a route table for the specified VPC. After you create a route table, you can add routes and associate the table with a subnet. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide. createRouteTablein interface AmazonEC2 createRouteTableRequest- Contains the parameters for CreateRouteTable. public CreateSecurityGroupResult createSecurityGroup(CreateSecurityGroupRequest request). createSecurityGroupin interface AmazonEC2 createSecurityGroupRequest- Contains the parameters for CreateSecurityGroup. public CreateSnapshotResult createSnapshot(CreateSnapshotRequest request). createSnapshotin interface AmazonEC2 createSnapshotRequest- Contains the parameters for CreateSnapshot. public CreateSpotDatafeedSubscriptionResult createSpotDatafeedSubscription(CreateSpotDatafeedSubscriptionRequest request) Creates a data feed for Spot instances, enabling you to view Spot instance usage logs. You can create one data feed per AWS account. For more information, see Spot Instance Data Feed in the Amazon Elastic Compute Cloud User Guide. createSpotDatafeedSubscriptionin interface AmazonEC2 createSpotDatafeedSubscriptionRequest- Contains the parameters for CreateSpotDatafeedSubscription. public CreateSubnetResult createSubnet(CreateSubnetRequest request) Creates a subnet in an existing VPC. When you create each subnet, you provide the VPC ID and the IPv4 CIDR block you wantin interface AmazonEC2 createSubnetRequest- Contains the parameters for CreateSubnet. public CreateTagsResult createTags(CreateTagsRequest request) Adds or overwrites one or morein interface AmazonEC2 createTagsRequest- Contains the parameters for CreateTags. public CreateVolumeResult createVolume(CreateVolumeRequest request). For more information, see Creating an Amazon EBS Volume in the Amazon Elastic Compute Cloud User Guide. createVolumein interface AmazonEC2 createVolumeRequest- Contains the parameters for CreateVolume. public CreateVpcResult createVpc(CreateVpcRequest request) Creates a VPC with the specified IPv4 CIDR block. The smallest VPC you can create uses a /28 netmask (16 IPv4 addresses), and the largest uses a /16 netmask (65,536 IPv4 addresses). To help you decide how big includes only a default DNS server that we provide (AmazonProvidedDNS). For more information about DHCP options,Vpcin interface AmazonEC2 createVpcRequest- Contains the parameters for CreateVpc. public CreateVpcEndpointResult createVpcEndpoint(CreateVpcEndpointRequest request) services. createVpcEndpointin interface AmazonEC2 createVpcEndpointRequest- Contains the parameters for CreateVpcEndpoint. public CreateVpcPeeringConnectionResult createVpcPeeringConnection(CreateVpcPeeringConnectionRequest request). The owner of the peer VPC must accept the peering request to activate the peering connection. The VPC peering connection request expires after 7 days, after which it cannot be accepted or rejected. If you try to create a VPC peering connection between VPCs that have overlapping CIDR blocks, the VPC peering connection status goes to failed. createVpcPeeringConnectionin interface AmazonEC2 createVpcPeeringConnectionRequest- Contains the parameters for CreateVpcPeeringConnection. public CreateVpcPeeringConnectionResult createVpcPeeringConnection() createVpcPeeringConnectionin interface AmazonEC2 AmazonEC2.createVpcPeeringConnection(CreateVpcPeeringConnectionRequest) public CreateVpnConnectionResult createVpnConnection(CreateVpnConnectionRequest request) Creates a VPN connection between an existing virtual private gateway and a VPN customer gateway. The only about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide. createVpnConnectionin interface AmazonEC2 createVpnConnectionRequest- Contains the parameters for CreateVpnConnection. public CreateVpnConnectionRouteResult createVpnConnectionRoute(CreateVpnConnectionRouteRequest request) Creates a static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway. For more information about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide. createVpnConnectionRoutein interface AmazonEC2 createVpnConnectionRouteRequest- Contains the parameters for CreateVpnConnectionRoute. public CreateVpnGatewayResult createVpnGateway(CreateVpnGatewayRequest request) Creates a virtual private gateway. A virtual private gateway is the endpoint on the VPC side of your VPN connection. You can create a virtual private gateway before creating the VPC itself. For more information about virtual private gateways, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide. createVpnGatewayin interface AmazonEC2 createVpnGatewayRequest- Contains the parameters for CreateVpnGateway. public DeleteCustomerGatewayResult deleteCustomerGateway(DeleteCustomerGatewayRequest request) Deletes the specified customer gateway. You must delete the VPN connection before you can delete the customer gateway. deleteCustomerGatewayin interface AmazonEC2 deleteCustomerGatewayRequest- Contains the parameters for DeleteCustomerGateway. public DeleteDhcpOptionsResult deleteDhcpOptions(DeleteDhcpOptionsRequest request)in interface AmazonEC2 deleteDhcpOptionsRequest- Contains the parameters for DeleteDhcpOptions. public DeleteEgressOnlyInternetGatewayResult deleteEgressOnlyInternetGateway(DeleteEgressOnlyInternetGatewayRequest request) Deletes an egress-only Internet gateway. deleteEgressOnlyInternetGatewayin interface AmazonEC2 deleteEgressOnlyInternetGatewayRequest- public DeleteFlowLogsResult deleteFlowLogs(DeleteFlowLogsRequest request) Deletes one or more flow logs. deleteFlowLogsin interface AmazonEC2 deleteFlowLogsRequest- Contains the parameters for DeleteFlowLogs. public DeleteInternetGatewayResult deleteInternetGateway(DeleteInternetGatewayRequest request) Deletes the specified Internet gateway. You must detach the Internet gateway from the VPC before you can delete it. deleteInternetGatewayin interface AmazonEC2 deleteInternetGatewayRequest- Contains the parameters for DeleteInternetGateway. public DeleteKeyPairResult deleteKeyPair(DeleteKeyPairRequest request) Deletes the specified key pair, by removing the public key from Amazon EC2. deleteKeyPairin interface AmazonEC2 deleteKeyPairRequest- Contains the parameters for DeleteKeyPair. public DeleteNatGatewayResult deleteNatGateway(DeleteNatGatewayRequest request) Deletes the specified NAT gateway. Deleting a NAT gateway disassociates its Elastic IP address, but does not release the address from your account. Deleting a NAT gateway does not delete any NAT gateway routes in your route tables. deleteNatGatewayin interface AmazonEC2 deleteNatGatewayRequest- Contains the parameters for DeleteNatGateway. public DeleteNetworkAclResult deleteNetworkAcl(DeleteNetworkAclRequest request) Deletes the specified network ACL. You can't delete the ACL if it's associated with any subnets. You can't delete the default network ACL. deleteNetworkAclin interface AmazonEC2 deleteNetworkAclRequest- Contains the parameters for DeleteNetworkAcl. public DeleteNetworkAclEntryResult deleteNetworkAclEntry(DeleteNetworkAclEntryRequest request) Deletes the specified ingress or egress entry (rule) from the specified network ACL. deleteNetworkAclEntryin interface AmazonEC2 deleteNetworkAclEntryRequest- Contains the parameters for DeleteNetworkAclEntry. public DeleteNetworkInterfaceResult deleteNetworkInterface(DeleteNetworkInterfaceRequest request) Deletes the specified network interface. You must detach the network interface before you can delete it. deleteNetworkInterfacein interface AmazonEC2 deleteNetworkInterfaceRequest- Contains the parameters for DeleteNetworkInterface. public DeleteNetworkInterfacePermissionResult deleteNetworkInterfacePermission(DeleteNetworkInterfacePermissionRequest request)in interface AmazonEC2 deleteNetworkInterfacePermissionRequest- Contains the parameters for DeleteNetworkInterfacePermission. public DeletePlacementGroupResult deletePlacementGroup(DeletePlacementGroupRequest request) Deletes the specified placement group. You must terminate all instances in the placement group before you can delete the placement group. For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide. deletePlacementGroupin interface AmazonEC2 deletePlacementGroupRequest- Contains the parameters for DeletePlacementGroup. public DeleteRouteResult deleteRoute(DeleteRouteRequest request) Deletes the specified route from the specified route table. deleteRoutein interface AmazonEC2 deleteRouteRequest- Contains the parameters for DeleteRoute. public DeleteRouteTableResult deleteRouteTable(DeleteRouteTableRequest request) Deletes the specified route table. You must disassociate the route table from any subnets before you can delete it. You can't delete the main route table. deleteRouteTablein interface AmazonEC2 deleteRouteTableRequest- Contains the parameters for DeleteRouteTable. public DeleteSecurityGroupResult deleteSecurityGroup(DeleteSecurityGroupRequest request)in interface AmazonEC2 deleteSecurityGroupRequest- Contains the parameters for DeleteSecurityGroup. public DeleteSnapshotResult deleteSnapshot(DeleteSnapshotRequest request)in interface AmazonEC2 deleteSnapshotRequest- Contains the parameters for DeleteSnapshot. public DeleteSpotDatafeedSubscriptionResult deleteSpotDatafeedSubscription(DeleteSpotDatafeedSubscriptionRequest request) Deletes the data feed for Spot instances. deleteSpotDatafeedSubscriptionin interface AmazonEC2 deleteSpotDatafeedSubscriptionRequest- Contains the parameters for DeleteSpotDatafeedSubscription. public DeleteSpotDatafeedSubscriptionResult deleteSpotDatafeedSubscription() deleteSpotDatafeedSubscriptionin interface AmazonEC2 AmazonEC2.deleteSpotDatafeedSubscription(DeleteSpotDatafeedSubscriptionRequest) public DeleteSubnetResult deleteSubnet(DeleteSubnetRequest request) Deletes the specified subnet. You must terminate all running instances in the subnet before you can delete the subnet. deleteSubnetin interface AmazonEC2 deleteSubnetRequest- Contains the parameters for DeleteSubnet. public DeleteTagsResult deleteTags(DeleteTagsRequest request) Deletes the specified set of tags from the specified set of resources. To list the current tags, use DescribeTags. For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide. deleteTagsin interface AmazonEC2 deleteTagsRequest- Contains the parameters for DeleteTags. public DeleteVolumeResult deleteVolume(DeleteVolumeRequest request)Volumein interface AmazonEC2 deleteVolumeRequest- Contains the parameters for DeleteVolume. public DeleteVpcResult deleteVpc(DeleteVpcRequest request)Vpcin interface AmazonEC2 deleteVpcRequest- Contains the parameters for DeleteVpc. public DeleteVpcEndpointsResult deleteVpcEndpoints(DeleteVpcEndpointsRequest request) Deletes one or more specified VPC endpoints. Deleting the endpoint also deletes the endpoint routes in the route tables that were associated with the endpoint. deleteVpcEndpointsin interface AmazonEC2 deleteVpcEndpointsRequest- Contains the parameters for DeleteVpcEndpoints. public DeleteVpcPeeringConnectionResult deleteVpcPeeringConnection(DeleteVpcPeeringConnectionRequest request). deleteVpcPeeringConnectionin interface AmazonEC2 deleteVpcPeeringConnectionRequest- Contains the parameters for DeleteVpcPeeringConnection. public DeleteVpnConnectionResult deleteVpnConnection(DeleteVpnConnectionRequest request)in interface AmazonEC2 deleteVpnConnectionRequest- Contains the parameters for DeleteVpnConnection. public DeleteVpnConnectionRouteResult deleteVpnConnectionRoute(DeleteVpnConnectionRouteRequest request) Deletes the specified static route associated with a VPN connection between an existing virtual private gateway and a VPN customer gateway. The static route allows traffic to be routed from the virtual private gateway to the VPN customer gateway. deleteVpnConnectionRoutein interface AmazonEC2 deleteVpnConnectionRouteRequest- Contains the parameters for DeleteVpnConnectionRoute. public DeleteVpnGatewayResult deleteVpnGateway(DeleteVpnGatewayRequest request)in interface AmazonEC2 deleteVpnGatewayRequest- Contains the parameters for DeleteVpnGateway. public DeregisterImageResult deregisterImage(DeregisterImageRequest request)in interface AmazonEC2 deregisterImageRequest- Contains the parameters for DeregisterImage. public DescribeAccountAttributesResult describeAccountAttributes(DescribeAccountAttributesRequest request)in interface AmazonEC2 describeAccountAttributesRequest- Contains the parameters for DescribeAccountAttributes. public DescribeAccountAttributesResult describeAccountAttributes() describeAccountAttributesin interface AmazonEC2 AmazonEC2.describeAccountAttributes(DescribeAccountAttributesRequest) public DescribeAddressesResult describeAddresses(DescribeAddressesRequest request) Describes one or more of your Elastic IP addresses. An Elastic IP address is for use in either the EC2-Classic platform or in a VPC. For more information, see Elastic IP Addresses in the Amazon Elastic Compute Cloud User Guide. describeAddressesin interface AmazonEC2 describeAddressesRequest- Contains the parameters for DescribeAddresses. public DescribeAddressesResult describeAddresses() describeAddressesin interface AmazonEC2 AmazonEC2.describeAddresses(DescribeAddressesRequest) public DescribeAvailabilityZonesResult describeAvailabilityZones(DescribeAvailabilityZonesRequest request)in interface AmazonEC2 describeAvailabilityZonesRequest- Contains the parameters for DescribeAvailabilityZones. public DescribeAvailabilityZonesResult describeAvailabilityZones() describeAvailabilityZonesin interface AmazonEC2 AmazonEC2.describeAvailabilityZones(DescribeAvailabilityZonesRequest) public DescribeBundleTasksResult describeBundleTasks(DescribeBundleTasksRequest request) Describes one or more of your bundlingin interface AmazonEC2 describeBundleTasksRequest- Contains the parameters for DescribeBundleTasks. public DescribeBundleTasksResult describeBundleTasks() describeBundleTasksin interface AmazonEC2 AmazonEC2.describeBundleTasks(DescribeBundleTasksRequest) public DescribeClassicLinkInstancesResult describeClassicLinkInstances(DescribeClassicLinkInstancesRequest request) Describes one or more of your linked EC2-Classic instances. This request only returns information about EC2-Classic instances linked to a VPC through ClassicLink; you cannot use this request to return information about other instances. describeClassicLinkInstancesin interface AmazonEC2 describeClassicLinkInstancesRequest- Contains the parameters for DescribeClassicLinkInstances. public DescribeClassicLinkInstancesResult describeClassicLinkInstances() describeClassicLinkInstancesin interface AmazonEC2 AmazonEC2.describeClassicLinkInstances(DescribeClassicLinkInstancesRequest) public DescribeConversionTasksResult describeConversionTasks(DescribeConversionTasksRequest request) Describes one or more of your conversion tasks. For more information, see the VM Import/Export User Guide. For information about the import manifest referenced by this API action, see VM Import Manifest. describeConversionTasksin interface AmazonEC2 describeConversionTasksRequest- Contains the parameters for DescribeConversionTasks. public DescribeConversionTasksResult describeConversionTasks() describeConversionTasksin interface AmazonEC2 AmazonEC2.describeConversionTasks(DescribeConversionTasksRequest) public DescribeCustomerGatewaysResult describeCustomerGateways(DescribeCustomerGatewaysRequest request) Describes one or more of your VPN customer gateways. For more information about VPN customer gateways, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide. describeCustomerGatewaysin interface AmazonEC2 describeCustomerGatewaysRequest- Contains the parameters for DescribeCustomerGateways. public DescribeCustomerGatewaysResult describeCustomerGateways() describeCustomerGatewaysin interface AmazonEC2 AmazonEC2.describeCustomerGateways(DescribeCustomerGatewaysRequest) public DescribeDhcpOptionsResult describeDhcpOptions(DescribeDhcpOptionsRequest request) Describes one or more of your DHCP options sets. For more information about DHCP options sets, see DHCP Options Sets in the Amazon Virtual Private Cloud User Guide. describeDhcpOptionsin interface AmazonEC2 describeDhcpOptionsRequest- Contains the parameters for DescribeDhcpOptions. public DescribeDhcpOptionsResult describeDhcpOptions() describeDhcpOptionsin interface AmazonEC2 AmazonEC2.describeDhcpOptions(DescribeDhcpOptionsRequest) public DescribeEgressOnlyInternetGatewaysResult describeEgressOnlyInternetGateways(DescribeEgressOnlyInternetGatewaysRequest request) Describes one or more of your egress-only Internet gateways. describeEgressOnlyInternetGatewaysin interface AmazonEC2 describeEgressOnlyInternetGatewaysRequest- public DescribeElasticGpusResult describeElasticGpus(DescribeElasticGpusRequest request) Describes the Elastic GPUs associated with your instances. For more information about Elastic GPUs, see Amazon EC2 Elastic GPUs. describeElasticGpusin interface AmazonEC2 describeElasticGpusRequest- public DescribeExportTasksResult describeExportTasks(DescribeExportTasksRequest request) Describes one or more of your export tasks. describeExportTasksin interface AmazonEC2 describeExportTasksRequest- Contains the parameters for DescribeExportTasks. public DescribeExportTasksResult describeExportTasks() describeExportTasksin interface AmazonEC2 AmazonEC2.describeExportTasks(DescribeExportTasksRequest) public DescribeFlowLogsResult describeFlowLogs(DescribeFlowLogsRequest request) Describes one or more flow logs. To view the information in your flow logs (the log streams for the network interfaces), you must use the CloudWatch Logs console or the CloudWatch Logs API. describeFlowLogsin interface AmazonEC2 describeFlowLogsRequest- Contains the parameters for DescribeFlowLogs. public DescribeFlowLogsResult describeFlowLogs() describeFlowLogsin interface AmazonEC2 AmazonEC2.describeFlowLogs(DescribeFlowLogsRequest) public DescribeFpgaImagesResult describeFpgaImages(DescribeFpgaImagesRequest request) Describes one or more available Amazon FPGA Images (AFIs). These include public AFIs, private AFIs that you own, and AFIs owned by other AWS accounts for which you have load permissions. describeFpgaImagesin interface AmazonEC2 describeFpgaImagesRequest- public DescribeHostReservationOfferingsResult describeHostReservationOfferings(DescribeHostReservationOfferingsRequest request). describeHostReservationOfferingsin interface AmazonEC2 describeHostReservationOfferingsRequest- public DescribeHostReservationsResult describeHostReservations(DescribeHostReservationsRequest request) Describes Dedicated Host Reservations which are associated with Dedicated Hosts in your account. describeHostReservationsin interface AmazonEC2 describeHostReservationsRequest- public DescribeHostsResult describeHosts(DescribeHostsRequest request) Describes one or more of your Dedicated Hosts. The results describe only the Dedicated Hosts in the region you're currently using. All listed instances consume capacity on your Dedicated Host. Dedicated Hosts that have recently been released will be listed with the state released. describeHostsin interface AmazonEC2 describeHostsRequest- Contains the parameters for DescribeHosts. public DescribeHostsResult describeHosts() describeHostsin interface AmazonEC2 AmazonEC2.describeHosts(DescribeHostsRequest) public DescribeIamInstanceProfileAssociationsResult describeIamInstanceProfileAssociations(DescribeIamInstanceProfileAssociationsRequest request) Describes your IAM instance profile associations. describeIamInstanceProfileAssociationsin interface AmazonEC2 describeIamInstanceProfileAssociationsRequest- public DescribeIdFormatResult describeIdFormat(DescribeIdFormatRequest request): instance | reservation | snapshot | volume.atin interface AmazonEC2 describeIdFormatRequest- Contains the parameters for DescribeIdFormat. public DescribeIdFormatResult describeIdFormat() describeIdFormatin interface AmazonEC2 AmazonEC2.describeIdFormat(DescribeIdFormatRequest) public DescribeIdentityIdFormatResult describeIdentityIdFormat(DescribeIdentityIdFormatRequest request): instance | reservation | snapshot | volume. These settings apply to the principal specified in the request. They do not apply to the principal that makes the request. describeIdentityIdFormatin interface AmazonEC2 describeIdentityIdFormatRequest- Contains the parameters for DescribeIdentityIdFormat. public DescribeImageAttributeResult describeImageAttribute(DescribeImageAttributeRequest request) Describes the specified attribute of the specified AMI. You can specify only one attribute at a time. describeImageAttributein interface AmazonEC2 describeImageAttributeRequest- Contains the parameters for DescribeImageAttribute. public DescribeImagesResult describeImages(DescribeImagesRequest request)in interface AmazonEC2 describeImagesRequest- Contains the parameters for DescribeImages. public DescribeImagesResult describeImages() describeImagesin interface AmazonEC2 AmazonEC2.describeImages(DescribeImagesRequest) public DescribeImportImageTasksResult describeImportImageTasks(DescribeImportImageTasksRequest request) Displays details about an import virtual machine or import snapshot tasks that are already created. describeImportImageTasksin interface AmazonEC2 describeImportImageTasksRequest- Contains the parameters for DescribeImportImageTasks. public DescribeImportImageTasksResult describeImportImageTasks() describeImportImageTasksin interface AmazonEC2 AmazonEC2.describeImportImageTasks(DescribeImportImageTasksRequest) public DescribeImportSnapshotTasksResult describeImportSnapshotTasks(DescribeImportSnapshotTasksRequest request) Describes your import snapshot tasks. describeImportSnapshotTasksin interface AmazonEC2 describeImportSnapshotTasksRequest- Contains the parameters for DescribeImportSnapshotTasks. public DescribeImportSnapshotTasksResult describeImportSnapshotTasks() describeImportSnapshotTasksin interface AmazonEC2 AmazonEC2.describeImportSnapshotTasks(DescribeImportSnapshotTasksRequest) public DescribeInstanceAttributeResult describeInstanceAttribute(DescribeInstanceAttributeRequest request)Attributein interface AmazonEC2 describeInstanceAttributeRequest- Contains the parameters for DescribeInstanceAttribute. public DescribeInstanceStatusResult describeInstanceStatus(DescribeInstanceStatusRequest request) Describes the status of one orin interface AmazonEC2 describeInstanceStatusRequest- Contains the parameters for DescribeInstanceStatus. public DescribeInstanceStatusResult describeInstanceStatus() describeInstanceStatusin interface AmazonEC2 AmazonEC2.describeInstanceStatus(DescribeInstanceStatusRequest) public DescribeInstancesResult describeInstances(DescribeInstancesRequest request) Describes one or more of yourin interface AmazonEC2 describeInstancesRequest- Contains the parameters for DescribeInstances. public DescribeInstancesResult describeInstances() describeInstancesin interface AmazonEC2 AmazonEC2.describeInstances(DescribeInstancesRequest) public DescribeInternetGatewaysResult describeInternetGateways(DescribeInternetGatewaysRequest request) Describes one or more of your Internet gateways. describeInternetGatewaysin interface AmazonEC2 describeInternetGatewaysRequest- Contains the parameters for DescribeInternetGateways. public DescribeInternetGatewaysResult describeInternetGateways() describeInternetGatewaysin interface AmazonEC2 AmazonEC2.describeInternetGateways(DescribeInternetGatewaysRequest) public DescribeKeyPairsResult describeKeyPairs(DescribeKeyPairsRequest request) Describes one or more of your key pairs. For more information about key pairs, see Key Pairs in the Amazon Elastic Compute Cloud User Guide. describeKeyPairsin interface AmazonEC2 describeKeyPairsRequest- Contains the parameters for DescribeKeyPairs. public DescribeKeyPairsResult describeKeyPairs() describeKeyPairsin interface AmazonEC2 AmazonEC2.describeKeyPairs(DescribeKeyPairsRequest) public DescribeMovingAddressesResult describeMovingAddresses(DescribeMovingAddressesRequest request) Describes your Elastic IP addresses that are being moved to the EC2-VPC platform, or that are being restored to the EC2-Classic platform. This request does not return information about any other Elastic IP addresses in your account. describeMovingAddressesin interface AmazonEC2 describeMovingAddressesRequest- Contains the parameters for DescribeMovingAddresses. public DescribeMovingAddressesResult describeMovingAddresses() describeMovingAddressesin interface AmazonEC2 AmazonEC2.describeMovingAddresses(DescribeMovingAddressesRequest) public DescribeNatGatewaysResult describeNatGateways(DescribeNatGatewaysRequest request) Describes one or more of the your NAT gateways. describeNatGatewaysin interface AmazonEC2 describeNatGatewaysRequest- Contains the parameters for DescribeNatGateways. public DescribeNetworkAclsResult describeNetworkAcls(DescribeNetworkAclsRequest request) Describes one or more of your network ACLs. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide. describeNetworkAclsin interface AmazonEC2 describeNetworkAclsRequest- Contains the parameters for DescribeNetworkAcls. public DescribeNetworkAclsResult describeNetworkAcls() describeNetworkAclsin interface AmazonEC2 AmazonEC2.describeNetworkAcls(DescribeNetworkAclsRequest) public DescribeNetworkInterfaceAttributeResult describeNetworkInterfaceAttribute(DescribeNetworkInterfaceAttributeRequest request) Describes a network interface attribute. You can specify only one attribute at a time. describeNetworkInterfaceAttributein interface AmazonEC2 describeNetworkInterfaceAttributeRequest- Contains the parameters for DescribeNetworkInterfaceAttribute. public DescribeNetworkInterfacePermissionsResult describeNetworkInterfacePermissions(DescribeNetworkInterfacePermissionsRequest request) Describes the permissions for your network interfaces. describeNetworkInterfacePermissionsin interface AmazonEC2 describeNetworkInterfacePermissionsRequest- Contains the parameters for DescribeNetworkInterfacePermissions. public DescribeNetworkInterfacesResult describeNetworkInterfaces(DescribeNetworkInterfacesRequest request) Describes one or more of your network interfaces. describeNetworkInterfacesin interface AmazonEC2 describeNetworkInterfacesRequest- Contains the parameters for DescribeNetworkInterfaces. public DescribeNetworkInterfacesResult describeNetworkInterfaces() describeNetworkInterfacesin interface AmazonEC2 AmazonEC2.describeNetworkInterfaces(DescribeNetworkInterfacesRequest) public DescribePlacementGroupsResult describePlacementGroups(DescribePlacementGroupsRequest request) Describes one or more of your placement groups. For more information about placement groups and cluster instances, see Cluster Instances in the Amazon Elastic Compute Cloud User Guide. describePlacementGroupsin interface AmazonEC2 describePlacementGroupsRequest- Contains the parameters for DescribePlacementGroups. public DescribePlacementGroupsResult describePlacementGroups() describePlacementGroupsin interface AmazonEC2 AmazonEC2.describePlacementGroups(DescribePlacementGroupsRequest) public DescribePrefixListsResult describePrefixLists(DescribePrefixListsRequest request). describePrefixListsin interface AmazonEC2 describePrefixListsRequest- Contains the parameters for DescribePrefixLists. public DescribePrefixListsResult describePrefixLists() describePrefixListsin interface AmazonEC2 AmazonEC2.describePrefixLists(DescribePrefixListsRequest) public DescribeRegionsResult describeRegions(DescribeRegionsRequest request) Describes one or more regions that are currently available to you. For a list of the regions supported by Amazon EC2, see Regions and Endpoints. describeRegionsin interface AmazonEC2 describeRegionsRequest- Contains the parameters for DescribeRegions. public DescribeRegionsResult describeRegions() describeRegionsin interface AmazonEC2 AmazonEC2.describeRegions(DescribeRegionsRequest) public DescribeReservedInstancesResult describeReservedInstances(DescribeReservedInstancesRequest request) Describes one or more of the Reserved Instances that you purchased. For more information about Reserved Instances, see Reserved Instances in the Amazon Elastic Compute Cloud User Guide. describeReservedInstancesin interface AmazonEC2 describeReservedInstancesRequest- Contains the parameters for DescribeReservedInstances. public DescribeReservedInstancesResult describeReservedInstances() describeReservedInstancesin interface AmazonEC2 AmazonEC2.describeReservedInstances(DescribeReservedInstancesRequest) public DescribeReservedInstancesListingsResult describeReservedInstancesListings(DescribeReservedInstancesListingsRequest request)in interface AmazonEC2 describeReservedInstancesListingsRequest- Contains the parameters for DescribeReservedInstancesListings. public DescribeReservedInstancesListingsResult describeReservedInstancesListings() describeReservedInstancesListingsin interface AmazonEC2 AmazonEC2.describeReservedInstancesListings(DescribeReservedInstancesListingsRequest) public DescribeReservedInstancesModificationsResult describeReservedInstancesModifications(DescribeReservedInstancesModificationsRequest request)in interface AmazonEC2 describeReservedInstancesModificationsRequest- Contains the parameters for DescribeReservedInstancesModifications. public DescribeReservedInstancesModificationsResult describeReservedInstancesModifications() describeReservedInstancesModificationsin interface AmazonEC2 AmazonEC2.describeReservedInstancesModifications(DescribeReservedInstancesModificationsRequest) public DescribeReservedInstancesOfferingsResult describeReservedInstancesOfferings(DescribeReservedInstancesOfferingsRequest request)in interface AmazonEC2 describeReservedInstancesOfferingsRequest- Contains the parameters for DescribeReservedInstancesOfferings. public DescribeReservedInstancesOfferingsResult describeReservedInstancesOfferings() describeReservedInstancesOfferingsin interface AmazonEC2 AmazonEC2.describeReservedInstancesOfferings(DescribeReservedInstancesOfferingsRequest) public DescribeRouteTablesResult describeRouteTables(DescribeRouteTablesRequest request) about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide. describeRouteTablesin interface AmazonEC2 describeRouteTablesRequest- Contains the parameters for DescribeRouteTables. public DescribeRouteTablesResult describeRouteTables() describeRouteTablesin interface AmazonEC2 AmazonEC2.describeRouteTables(DescribeRouteTablesRequest) public DescribeScheduledInstanceAvailabilityResult describeScheduledInstanceAvailability(DescribeScheduledInstanceAvailabilityRequest request)in interface AmazonEC2 describeScheduledInstanceAvailabilityRequest- Contains the parameters for DescribeScheduledInstanceAvailability. public DescribeScheduledInstancesResult describeScheduledInstances(DescribeScheduledInstancesRequest request) Describes one or more of your Scheduled Instances. describeScheduledInstancesin interface AmazonEC2 describeScheduledInstancesRequest- Contains the parameters for DescribeScheduledInstances. public DescribeSecurityGroupReferencesResult describeSecurityGroupReferences(DescribeSecurityGroupReferencesRequest request) [EC2-VPC only] Describes the VPCs on the other side of a VPC peering connection that are referencing the security groups you've specified in this request. describeSecurityGroupReferencesin interface AmazonEC2 describeSecurityGroupReferencesRequest- public DescribeSecurityGroupsResult describeSecurityGroups(DescribeSecurityGroupsRequest request) Describesin interface AmazonEC2 describeSecurityGroupsRequest- Contains the parameters for DescribeSecurityGroups. public DescribeSecurityGroupsResult describeSecurityGroups() describeSecurityGroupsin interface AmazonEC2 AmazonEC2.describeSecurityGroups(DescribeSecurityGroupsRequest) public DescribeSnapshotAttributeResult describeSnapshotAttribute(DescribeSnapshotAttributeRequest request) Describes the specified attribute of the specified snapshot. You can specify only one attribute at a time. For more information about EBS snapshots, see Amazon EBS Snapshots in the Amazon Elastic Compute Cloud User Guide. describeSnapshotAttributein interface AmazonEC2 describeSnapshotAttributeRequest- Contains the parameters for DescribeSnapshotAttribute. public DescribeSnapshotsResult describeSnapshots(DescribeSnapshotsRequest request)in interface AmazonEC2 describeSnapshotsRequest- Contains the parameters for DescribeSnapshots. public DescribeSnapshotsResult describeSnapshots() describeSnapshotsin interface AmazonEC2 AmazonEC2.describeSnapshots(DescribeSnapshotsRequest) public DescribeSpotDatafeedSubscriptionResult describeSpotDatafeedSubscription(DescribeSpotDatafeedSubscriptionRequest request) Describes the data feed for Spot instances. For more information, see Spot Instance Data Feed in the Amazon Elastic Compute Cloud User Guide. describeSpotDatafeedSubscriptionin interface AmazonEC2 describeSpotDatafeedSubscriptionRequest- Contains the parameters for DescribeSpotDatafeedSubscription. public DescribeSpotDatafeedSubscriptionResult describeSpotDatafeedSubscription() describeSpotDatafeedSubscriptionin interface AmazonEC2 AmazonEC2.describeSpotDatafeedSubscription(DescribeSpotDatafeedSubscriptionRequest) public DescribeSpotFleetInstancesResult describeSpotFleetInstances(DescribeSpotFleetInstancesRequest request) Describes the running instances for the specified Spot fleet. describeSpotFleetInstancesin interface AmazonEC2 describeSpotFleetInstancesRequest- Contains the parameters for DescribeSpotFleetInstances. public DescribeSpotFleetRequestHistoryResult describeSpotFleetRequestHistory(DescribeSpotFleetRequestHistoryRequest request) Describes the events for the specified Spot fleet request during the specified time. Spot fleet events are delayed by up to 30 seconds before they can be described. This ensures that you can query by the last evaluated time and not miss a recorded event. describeSpotFleetRequestHistoryin interface AmazonEC2 describeSpotFleetRequestHistoryRequest- Contains the parameters for DescribeSpotFleetRequestHistory. public DescribeSpotFleetRequestsResult describeSpotFleetRequests(DescribeSpotFleetRequestsRequest request) Describes your Spot fleet requests. Spot fleet requests are deleted 48 hours after they are canceled and their instances are terminated. describeSpotFleetRequestsin interface AmazonEC2 describeSpotFleetRequestsRequest- Contains the parameters for DescribeSpotFleetRequests. public DescribeSpotFleetRequestsResult describeSpotFleetRequests() describeSpotFleetRequestsin interface AmazonEC2 AmazonEC2.describeSpotFleetRequests(DescribeSpotFleetRequestsRequest) public DescribeSpotInstanceRequestsResult describeSpotInstanceRequests(DescribeSpotInstanceRequestsRequest request) Describes the Spot instance requests that belong to your account. 4 hours after they are canceled and their instances are terminated. describeSpotInstanceRequestsin interface AmazonEC2 describeSpotInstanceRequestsRequest- Contains the parameters for DescribeSpotInstanceRequests. public DescribeSpotInstanceRequestsResult describeSpotInstanceRequests() describeSpotInstanceRequestsin interface AmazonEC2 AmazonEC2.describeSpotInstanceRequests(DescribeSpotInstanceRequestsRequest) public DescribeSpotPriceHistoryResult describeSpotPriceHistory(DescribeSpotPriceHistoryRequest request) Describes the Spot price history. For more information, see Spot Instance Pricing History in the Amazon Elastic Compute Cloud User Guide.in interface AmazonEC2 describeSpotPriceHistoryRequest- Contains the parameters for DescribeSpotPriceHistory. public DescribeSpotPriceHistoryResult describeSpotPriceHistory() describeSpotPriceHistoryin interface AmazonEC2 AmazonEC2.describeSpotPriceHistory(DescribeSpotPriceHistoryRequest) public DescribeStaleSecurityGroupsResult describeStaleSecurityGroups(DescribeStaleSecurityGroupsRequest request) [EC2in interface AmazonEC2 describeStaleSecurityGroupsRequest- public DescribeSubnetsResult describeSubnets(DescribeSubnetsRequest request) Describes one or more of your subnets. For more information about subnets, see Your VPC and Subnets in the Amazon Virtual Private Cloud User Guide. describeSubnetsin interface AmazonEC2 describeSubnetsRequest- Contains the parameters for DescribeSubnets. public DescribeSubnetsResult describeSubnets() describeSubnetsin interface AmazonEC2 AmazonEC2.describeSubnets(DescribeSubnetsRequest) public DescribeTagsResult describeTags(DescribeTagsRequest request) Describes one or more of the tags for your EC2 resources. For more information about tags, see Tagging Your Resources in the Amazon Elastic Compute Cloud User Guide. describeTagsin interface AmazonEC2 describeTagsRequest- Contains the parameters for DescribeTags. public DescribeTagsResult describeTags() describeTagsin interface AmazonEC2 AmazonEC2.describeTags(DescribeTagsRequest) public DescribeVolumeAttributeResult describeVolumeAttribute(DescribeVolumeAttributeRequest request) Describes the specified attribute of the specified volume. You can specify only one attribute at a time. For more information about EBS volumes, see Amazon EBS Volumes in the Amazon Elastic Compute Cloud User Guide. describeVolumeAttributein interface AmazonEC2 describeVolumeAttributeRequest- Contains the parameters for DescribeVolumeAttribute. public DescribeVolumeStatusResult describeVolumeStatus(DescribeVolumeStatusRequest request)in interface AmazonEC2 describeVolumeStatusRequest- Contains the parameters for DescribeVolumeStatus. public DescribeVolumeStatusResult describeVolumeStatus() describeVolumeStatusin interface AmazonEC2 AmazonEC2.describeVolumeStatus(DescribeVolumeStatusRequest) public DescribeVolumesResult describeVolumes(DescribeVolumesRequest request)in interface AmazonEC2 describeVolumesRequest- Contains the parameters for DescribeVolumes. public DescribeVolumesResult describeVolumes() describeVolumesin interface AmazonEC2 AmazonEC2.describeVolumes(DescribeVolumesRequest) public DescribeVolumesModificationsResult describeVolumesModifications(DescribeVolumesModificationsRequest request)". describeVolumesModificationsin interface AmazonEC2 describeVolumesModificationsRequest- public DescribeVpcAttributeResult describeVpcAttribute(DescribeVpcAttributeRequest request) Describes the specified attribute of the specified VPC. You can specify only one attribute at a time. describeVpcAttributein interface AmazonEC2 describeVpcAttributeRequest- Contains the parameters for DescribeVpcAttribute. public DescribeVpcClassicLinkResult describeVpcClassicLink(DescribeVpcClassicLinkRequest request) Describes the ClassicLink status of one or more VPCs. describeVpcClassicLinkin interface AmazonEC2 describeVpcClassicLinkRequest- Contains the parameters for DescribeVpcClassicLink. public DescribeVpcClassicLinkResult describeVpcClassicLink() describeVpcClassicLinkin interface AmazonEC2 AmazonEC2.describeVpcClassicLink(DescribeVpcClassicLinkRequest) public DescribeVpcClassicLinkDnsSupportResult describeVpcClassicLinkDnsSupport(DescribeVpcClassicLinkDnsSupportRequest request)in interface AmazonEC2 describeVpcClassicLinkDnsSupportRequest- Contains the parameters for DescribeVpcClassicLinkDnsSupport. public DescribeVpcEndpointServicesResult describeVpcEndpointServices(DescribeVpcEndpointServicesRequest request) Describes all supported AWS services that can be specified when creating a VPC endpoint. describeVpcEndpointServicesin interface AmazonEC2 describeVpcEndpointServicesRequest- Contains the parameters for DescribeVpcEndpointServices. public DescribeVpcEndpointServicesResult describeVpcEndpointServices() describeVpcEndpointServicesin interface AmazonEC2 AmazonEC2.describeVpcEndpointServices(DescribeVpcEndpointServicesRequest) public DescribeVpcEndpointsResult describeVpcEndpoints(DescribeVpcEndpointsRequest request) Describes one or more of your VPC endpoints. describeVpcEndpointsin interface AmazonEC2 describeVpcEndpointsRequest- Contains the parameters for DescribeVpcEndpoints. public DescribeVpcEndpointsResult describeVpcEndpoints() describeVpcEndpointsin interface AmazonEC2 AmazonEC2.describeVpcEndpoints(DescribeVpcEndpointsRequest) public DescribeVpcPeeringConnectionsResult describeVpcPeeringConnections(DescribeVpcPeeringConnectionsRequest request) Describes one or more of your VPC peering connections. describeVpcPeeringConnectionsin interface AmazonEC2 describeVpcPeeringConnectionsRequest- Contains the parameters for DescribeVpcPeeringConnections. public DescribeVpcPeeringConnectionsResult describeVpcPeeringConnections() describeVpcPeeringConnectionsin interface AmazonEC2 AmazonEC2.describeVpcPeeringConnections(DescribeVpcPeeringConnectionsRequest) public DescribeVpcsResult describeVpcs(DescribeVpcsRequest request) Describes one or more of your VPCs. describeVpcsin interface AmazonEC2 describeVpcsRequest- Contains the parameters for DescribeVpcs. public DescribeVpcsResult describeVpcs() describeVpcsin interface AmazonEC2 AmazonEC2.describeVpcs(DescribeVpcsRequest) public DescribeVpnConnectionsResult describeVpnConnections(DescribeVpnConnectionsRequest request) Describes one or more of your VPN connections. For more information about VPN connections, see Adding a Hardware Virtual Private Gateway to Your VPC in the Amazon Virtual Private Cloud User Guide. describeVpnConnectionsin interface AmazonEC2 describeVpnConnectionsRequest- Contains the parameters for DescribeVpnConnections. public DescribeVpnConnectionsResult describeVpnConnections() describeVpnConnectionsin interface AmazonEC2 AmazonEC2.describeVpnConnections(DescribeVpnConnectionsRequest) public DescribeVpnGatewaysResult describeVpnGateways(DescribeVpnGatewaysRequest request) Describes one or more of your virtual private gateways. For more information about virtual private gateways, see Adding an IPsec Hardware VPN to Your VPC in the Amazon Virtual Private Cloud User Guide. describeVpnGatewaysin interface AmazonEC2 describeVpnGatewaysRequest- Contains the parameters for DescribeVpnGateways. public DescribeVpnGatewaysResult describeVpnGateways() describeVpnGatewaysin interface AmazonEC2 AmazonEC2.describeVpnGateways(DescribeVpnGatewaysRequest) public DetachClassicLinkVpcResult detachClassicLinkVpc(DetachClassicLinkVpcRequest request) Unlinks (detaches) a linked EC2-Classic instance from a VPC. After the instance has been unlinked, the VPC security groups are no longer associated with it. An instance is automatically unlinked from a VPC when it's stopped. detachClassicLinkVpcin interface AmazonEC2 detachClassicLinkVpcRequest- Contains the parameters for DetachClassicLinkVpc. public DetachInternetGatewayResult detachInternetGateway(DetachInternetGatewayRequest request) Detaches an Internet gateway from a VPC, disabling connectivity between the Internet and the VPC. The VPC must not contain any running instances with Elastic IP addresses or public IPv4 addresses. detachInternetGatewayin interface AmazonEC2 detachInternetGatewayRequest- Contains the parameters for DetachInternetGateway. public DetachNetworkInterfaceResult detachNetworkInterface(DetachNetworkInterfaceRequest request) Detaches a network interface from an instance. detachNetworkInterfacein interface AmazonEC2 detachNetworkInterfaceRequest- Contains the parameters for DetachNetworkInterface. public DetachVolumeResult detachVolume(DetachVolumeRequest request)Volumein interface AmazonEC2 detachVolumeRequest- Contains the parameters for DetachVolume. public DetachVpnGatewayResult detachVpnGateway(DetachVpnGatewayRequest request)in interface AmazonEC2 detachVpnGatewayRequest- Contains the parameters for DetachVpnGateway. public DisableVgwRoutePropagationResult disableVgwRoutePropagation(DisableVgwRoutePropagationRequest request) Disables a virtual private gateway (VGW) from propagating routes to a specified route table of a VPC. disableVgwRoutePropagationin interface AmazonEC2 disableVgwRoutePropagationRequest- Contains the parameters for DisableVgwRoutePropagation. public DisableVpcClassicLinkResult disableVpcClassicLink(DisableVpcClassicLinkRequest request) Disables ClassicLink for a VPC. You cannot disable ClassicLink for a VPC that has EC2-Classic instances linked to it. disableVpcClassicLinkin interface AmazonEC2 disableVpcClassicLinkRequest- Contains the parameters for DisableVpcClassicLink. public DisableVpcClassicLinkDnsSupportResult disableVpcClassicLinkDnsSupport(DisableVpcClassicLinkDnsSupportRequest request) Disables ClassicLink DNS support for a VPC. If disabled, DNS hostnames resolve to public IP addresses when addressed between a linked EC2-Classic instance and instances in the VPC to which it's linked. For more information about ClassicLink, see ClassicLink in the Amazon Elastic Compute Cloud User Guide. disableVpcClassicLinkDnsSupportin interface AmazonEC2 disableVpcClassicLinkDnsSupportRequest- Contains the parameters for DisableVpcClassicLinkDnsSupport. public DisassociateAddressResult disassociateAddress(DisassociateAddressRequest request)in interface AmazonEC2 disassociateAddressRequest- Contains the parameters for DisassociateAddress. public DisassociateIamInstanceProfileResult disassociateIamInstanceProfile(DisassociateIamInstanceProfileRequest request) Disassociates an IAM instance profile from a running or stopped instance. Use DescribeIamInstanceProfileAssociations to get the association ID. disassociateIamInstanceProfilein interface AmazonEC2 disassociateIamInstanceProfileRequest- public DisassociateRouteTableResult disassociateRouteTable(DisassociateRouteTableRequest request)in interface AmazonEC2 disassociateRouteTableRequest- Contains the parameters for DisassociateRouteTable. public DisassociateSubnetCidrBlockResult disassociateSubnetCidrBlock(DisassociateSubnetCidrBlockRequest request)in interface AmazonEC2 disassociateSubnetCidrBlockRequest- public DisassociateVpcCidrBlockResult disassociateVpcCidrBlock(DisassociateVpcCidrBlockRequest request)in interface AmazonEC2 disassociateVpcCidrBlockRequest- public EnableVgwRoutePropagationResult enableVgwRoutePropagation(EnableVgwRoutePropagationRequest request) Enables a virtual private gateway (VGW) to propagate routes to the specified route table of a VPC. enableVgwRoutePropagationin interface AmazonEC2 enableVgwRoutePropagationRequest- Contains the parameters for EnableVgwRoutePropagation. public EnableVolumeIOResult enableVolumeIO(EnableVolumeIORequest request) Enables I/O operations for a volume that had I/O operations disabled because the data on the volume was potentially inconsistent. enableVolumeIOin interface AmazonEC2 enableVolumeIORequest- Contains the parameters for EnableVolumeIO. public EnableVpcClassicLinkResult enableVpcClassicLink(EnableVpcClassicLinkRequest request) Enables a VPC for ClassicLink. You can then link EC2-Classic instances to your ClassicLink-enabled VPC to allow communication over private IP addresses. You cannot enable your VPC for ClassicLink if any of your VPC'sin interface AmazonEC2 enableVpcClassicLinkRequest- Contains the parameters for EnableVpcClassicLink. public EnableVpcClassicLinkDnsSupportResult enableVpcClassicLinkDnsSupport(EnableVpcClassicLinkDnsSupportRequest request) about ClassicLink, see ClassicLink in the Amazon Elastic Compute Cloud User Guide. enableVpcClassicLinkDnsSupportin interface AmazonEC2 enableVpcClassicLinkDnsSupportRequest- Contains the parameters for EnableVpcClassicLinkDnsSupport. public GetConsoleOutputResult getConsoleOutput(GetConsoleOutputRequest request) Gets the console output for the specified instance. Instances do not have a physical monitor through which you can view their console output. They also lack physical controls that allow you to power up, reboot, or shut them down. To allow these actions, we provide them through the Amazon EC2 API and command line interface. Instance console output is buffered and posted shortly after instance boot, reboot, and termination. Amazon EC2 preserves the most recent 64 KB output which is available for at least one hour after the most recent post. For Linux instances, the instance console output displays the exact console output that would normally be displayed on a physical monitor attached to a computer. This output is buffered because the instance produces it and then posts it to a store where the instance's owner can retrieve it. For Windows instances, the instance console output includes output from the EC2Config service. getConsoleOutputin interface AmazonEC2 getConsoleOutputRequest- Contains the parameters for GetConsoleOutput. public GetConsoleScreenshotResult getConsoleScreenshot(GetConsoleScreenshotRequest request) Retrieve a JPG-format screenshot of a running instance to help with troubleshooting. The returned content is Base64-encoded. getConsoleScreenshotin interface AmazonEC2 getConsoleScreenshotRequest- Contains the parameters for the request. public GetHostReservationPurchasePreviewResult getHostReservationPurchasePreview(GetHostReservationPurchasePreviewRequest request)in interface AmazonEC2 getHostReservationPurchasePreviewRequest- public GetPasswordDataResult getPasswordData(GetPasswordDataRequest request)ain interface AmazonEC2 getPasswordDataRequest- Contains the parameters for GetPasswordData. public GetReservedInstancesExchangeQuoteResult getReservedInstancesExchangeQuote(GetReservedInstancesExchangeQuoteRequest request) Returns details about the values and term of your specified Convertible Reserved Instances. When a target configuration is specified, it returns information about whether the exchange is valid and can be performed. getReservedInstancesExchangeQuotein interface AmazonEC2 getReservedInstancesExchangeQuoteRequest- Contains the parameters for GetReservedInstanceExchangeQuote. public ImportImageResult importImage(ImportImageRequest request) Import single or multi-volume disk images or EBS snapshots into an Amazon Machine Image (AMI). For more information, see Importing a VM as an Image Using VM Import/Export in the VM Import/Export User Guide. importImagein interface AmazonEC2 importImageRequest- Contains the parameters for ImportImage. public ImportImageResult importImage() importImagein interface AmazonEC2 AmazonEC2.importImage(ImportImageRequest) public ImportInstanceResult importInstance(ImportInstanceRequest request)in interface AmazonEC2 importInstanceRequest- Contains the parameters for ImportInstance. public ImportKeyPairResult importKeyPair(ImportKeyPairRequest request)in interface AmazonEC2 importKeyPairRequest- Contains the parameters for ImportKeyPair. public ImportSnapshotResult importSnapshot(ImportSnapshotRequest request) Imports a disk into an EBS snapshot. importSnapshotin interface AmazonEC2 importSnapshotRequest- Contains the parameters for ImportSnapshot. public ImportSnapshotResult importSnapshot() importSnapshotin interface AmazonEC2 AmazonEC2.importSnapshot(ImportSnapshotRequest) public ImportVolumeResult importVolume(ImportVolumeRequest request) Creates an import volume task using metadata from the specified disk image.For more information, see Importing Disks to Amazon EBS. For information about the import manifest referenced by this API action, see VM Import Manifest. importVolumein interface AmazonEC2 importVolumeRequest- Contains the parameters for ImportVolume. public ModifyHostsResult modifyHosts(ModifyHostsRequest request)sin interface AmazonEC2 modifyHostsRequest- Contains the parameters for ModifyHosts. public ModifyIdFormatResult modifyIdFormat(ModifyIdFormatRequest request) Modifies the ID format for the specified resource on a per-region basis. You can specify that resources should receive longer IDs (17-character IDs) when they are created. The following resource types support longer IDs: instance | reservation | snapshot | volume.atin interface AmazonEC2 modifyIdFormatRequest- Contains the parameters of ModifyIdFormat. public ModifyIdentityIdFormatResult modifyIdentityIdFormat(ModifyIdentityIdFormatRequest request). The following resource types support longer IDs: instance | reservation | snapshot | volume.atin interface AmazonEC2 modifyIdentityIdFormatRequest- Contains the parameters of ModifyIdentityIdFormat. public ModifyImageAttributeResult modifyImageAttribute(ModifyImageAttributeRequest request). modifyImageAttributein interface AmazonEC2 modifyImageAttributeRequest- Contains the parameters for ModifyImageAttribute. public ModifyInstanceAttributeResult modifyInstanceAttribute(ModifyInstanceAttributeRequest request) Modifies the specified attribute of the specified instance. You can specify only one attribute at a time. To modify some attributes, the instance must be stopped. For more information, see Modifying Attributes of a Stopped Instance in the Amazon Elastic Compute Cloud User Guide. modifyInstanceAttributein interface AmazonEC2 modifyInstanceAttributeRequest- Contains the parameters for ModifyInstanceAttribute. public ModifyInstancePlacementResult modifyInstancePlacement(ModifyInstancePlacementRequest request)in interface AmazonEC2 modifyInstancePlacementRequest- Contains the parameters for ModifyInstancePlacement. public ModifyNetworkInterfaceAttributeResult modifyNetworkInterfaceAttribute(ModifyNetworkInterfaceAttributeRequest request) Modifies the specified network interface attribute. You can specify only one attribute at a time. modifyNetworkInterfaceAttributein interface AmazonEC2 modifyNetworkInterfaceAttributeRequest- Contains the parameters for ModifyNetworkInterfaceAttribute. public ModifyReservedInstancesResult modifyReservedInstances(ModifyReservedInstancesRequest request) Modifies the Availability Zone, instance count, instance type, or network platform (EC2-Classic or EC2-VPC) of your Standard Reserved Instances. The Reserved Instances to be modified must be identical, except for Availability Zone, network platform, and instance type. For more information, see Modifying Reserved Instances in the Amazon Elastic Compute Cloud User Guide. modifyReservedInstancesin interface AmazonEC2 modifyReservedInstancesRequest- Contains the parameters for ModifyReservedInstances. public ModifySnapshotAttributeResult modifySnapshotAttribute(ModifySnapshotAttributeRequest request) Adds or removes permission settings for the specified snapshot. You may add or remove specified AWS account IDs from a snapshot's list of create volume permissions, but you cannot do both in a singleAttributein interface AmazonEC2 modifySnapshotAttributeRequest- Contains the parameters for ModifySnapshotAttribute. public ModifySpotFleetRequestResult modifySpotFleetRequest(ModifySpotFleetRequestRequest request) Modifies the specified Spot fleet request. bids. modifySpotFleetRequestin interface AmazonEC2 modifySpotFleetRequestRequest- Contains the parameters for ModifySpotFleetRequest. public ModifySubnetAttributeResult modifySubnetAttribute(ModifySubnetAttributeRequest request) Modifies a subnet attribute. You can only modify one attribute at a time. modifySubnetAttributein interface AmazonEC2 modifySubnetAttributeRequest- Contains the parameters for ModifySubnetAttribute. public ModifyVolumeResult modifyVolume(ModifyVolumeRequest request) the DescribeVolumesModifications API. For information about tracking status changes using either method, see Monitoring Volume Modifications. With previous-generation instance types, resizing an EBS volume may require detaching and reattaching the volume or stopping and restarting the instance.. If you reach the maximum volume modification rate per volume limit, you will need to wait at least six hours before applying further modifications to the affected EBS volume. modifyVolumein interface AmazonEC2 modifyVolumeRequest- public ModifyVolumeAttributeResult modifyVolumeAttribute(ModifyVolumeAttributeRequest request)Attributein interface AmazonEC2 modifyVolumeAttributeRequest- Contains the parameters for ModifyVolumeAttribute. public ModifyVpcAttributeResult modifyVpcAttribute(ModifyVpcAttributeRequest request) Modifies the specified attribute of the specified VPC. modifyVpcAttributein interface AmazonEC2 modifyVpcAttributeRequest- Contains the parameters for ModifyVpcAttribute. public ModifyVpcEndpointResult modifyVpcEndpoint(ModifyVpcEndpointRequest request) Modifies attributes of a specified VPC endpoint. You can modify the policy associated with the endpoint, and you can add and remove route tables associated with the endpoint. modifyVpcEndpointin interface AmazonEC2 modifyVpcEndpointRequest- Contains the parameters for ModifyVpcEndpoint. public ModifyVpcPeeringConnectionOptionsResult modifyVpcPeeringConnectionOptions(ModifyVpcPeeringConnectionOptionsRequest request)in interface AmazonEC2 modifyVpcPeeringConnectionOptionsRequest- public MonitorInstancesResult monitorInstances(MonitorInstancesRequest request) Enables detailed monitoring for a running instance. Otherwise, basic monitoring is enabled. For more information, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide. To disable detailed monitoring, see . monitorInstancesin interface AmazonEC2 monitorInstancesRequest- Contains the parameters for MonitorInstances. public MoveAddressToVpcResult moveAddressToVpc(MoveAddressToVpcRequest request)pcin interface AmazonEC2 moveAddressToVpcRequest- Contains the parameters for MoveAddressToVpc. public PurchaseHostReservationResult purchaseHostReservation(PurchaseHostReservationRequest request) Purchase a reservation with configurations that match those of your Dedicated Host. You must have active Dedicated Hosts in your account before you purchase a reservation. This action results in the specified reservation being purchased and charged to your account. purchaseHostReservationin interface AmazonEC2 purchaseHostReservationRequest- public PurchaseReservedInstancesOfferingResult purchaseReservedInstancesOffering(PurchaseReservedInstancesOfferingRequest request). For more information, see Reserved Instances and Reserved Instance Marketplace in the Amazon Elastic Compute Cloud User Guide. purchaseReservedInstancesOfferingin interface AmazonEC2 purchaseReservedInstancesOfferingRequest- Contains the parameters for PurchaseReservedInstancesOffering. public PurchaseScheduledInstancesResult purchaseScheduledInstances(PurchaseScheduledInstancesRequest request) Purchases one or morein interface AmazonEC2 purchaseScheduledInstancesRequest- Contains the parameters for PurchaseScheduledInstances. public RebootInstancesResult rebootInstances(RebootInstancesRequest request) Requests a reboot of one or morein interface AmazonEC2 rebootInstancesRequest- Contains the parameters for RebootInstances. public RegisterImageResult registerImage(RegisterImageRequest request) subsequent instances launched from such an AMI will not be able to connect to package update infrastructure. To create an AMI that must retain billing codes,in interface AmazonEC2 registerImageRequest- Contains the parameters for RegisterImage. public RejectVpcPeeringConnectionResult rejectVpcPeeringConnection(RejectVpcPeeringConnectionRequest request)in interface AmazonEC2 rejectVpcPeeringConnectionRequest- Contains the parameters for RejectVpcPeeringConnection. public ReleaseAddressResult releaseAddress(ReleaseAddressRequest request)in interface AmazonEC2 releaseAddressRequest- Contains the parameters for ReleaseAddress. public ReleaseHostsResult releaseHosts(ReleaseHostsRequest request) When you no longer want to use an On-Demand Dedicated Host it can be released. On-Demand billing is stopped and the host goes into released state. The host ID of Dedicated Hosts that have been released can no longer be specified in another request,sin interface AmazonEC2 releaseHostsRequest- Contains the parameters for ReleaseHosts. public ReplaceIamInstanceProfileAssociationResult replaceIamInstanceProfileAssociation(ReplaceIamInstanceProfileAssociationRequest request)in interface AmazonEC2 replaceIamInstanceProfileAssociationRequest- public ReplaceNetworkAclAssociationResult replaceNetworkAclAssociation(ReplaceNetworkAclAssociationRequest request) Changes which network ACL a subnet is associated with. By default when you create a subnet, it's automatically associated with the default network ACL. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide. replaceNetworkAclAssociationin interface AmazonEC2 replaceNetworkAclAssociationRequest- Contains the parameters for ReplaceNetworkAclAssociation. public ReplaceNetworkAclEntryResult replaceNetworkAclEntry(ReplaceNetworkAclEntryRequest request) Replaces an entry (rule) in a network ACL. For more information about network ACLs, see Network ACLs in the Amazon Virtual Private Cloud User Guide. replaceNetworkAclEntryin interface AmazonEC2 replaceNetworkAclEntryRequest- Contains the parameters for ReplaceNetworkAclEntry. public ReplaceRouteResult replaceRoute(ReplaceRouteRequest request) Replaces an existing route within a route table in a VPC. You must provide only one of the following: Internet gateway or virtual private gateway, NAT instance, NAT gateway, VPC peering connection, network interface, or egress-only Internet gateway. For more information about route tables, see Route Tables in the Amazon Virtual Private Cloud User Guide. replaceRoutein interface AmazonEC2 replaceRouteRequest- Contains the parameters for ReplaceRoute. public ReplaceRouteTableAssociationResult replaceRouteTableAssociation(ReplaceRouteTableAssociationRequest request)in interface AmazonEC2 replaceRouteTableAssociationRequest- Contains the parameters for ReplaceRouteTableAssociation. public ReportInstanceStatusResult reportInstanceStatus(ReportInstanceStatusRequest request)in interface AmazonEC2 reportInstanceStatusRequest- Contains the parameters for ReportInstanceStatus. public RequestSpotFleetResult requestSpotFleet(RequestSpotFleetRequest request) Creates a Spot fleet request. You can submit a single request that includes multiple launch specifications that vary by instance type, AMI, Availability Zone, or subnet. By default, the Spot fleet requests Spot instances in the Spot. For more information, see Spot Fleet Requests in the Amazon Elastic Compute Cloud User Guide. requestSpotFleetin interface AmazonEC2 requestSpotFleetRequest- Contains the parameters for RequestSpotFleet. public RequestSpotInstancesResult requestSpotInstances(RequestSpotInstancesRequest request) Creates a Spot instance request.. requestSpotInstancesin interface AmazonEC2 requestSpotInstancesRequest- Contains the parameters for RequestSpotInstances. public ResetImageAttributeResult resetImageAttribute(ResetImageAttributeRequest request) Resets an attribute of an AMI to its default value. The productCodes attribute can't be reset. resetImageAttributein interface AmazonEC2 resetImageAttributeRequest- Contains the parameters for ResetImageAttribute. public ResetInstanceAttributeResult resetInstanceAttribute(ResetInstanceAttributeRequest request)Attributein interface AmazonEC2 resetInstanceAttributeRequest- Contains the parameters for ResetInstanceAttribute. public ResetNetworkInterfaceAttributeResult resetNetworkInterfaceAttribute(ResetNetworkInterfaceAttributeRequest request) Resets a network interface attribute. You can specify only one attribute at a time. resetNetworkInterfaceAttributein interface AmazonEC2 resetNetworkInterfaceAttributeRequest- Contains the parameters for ResetNetworkInterfaceAttribute. public ResetSnapshotAttributeResult resetSnapshotAttribute(ResetSnapshotAttributeRequest request) Resets permission settings for the specified snapshot. For more information on modifying snapshot permissions, see Sharing Snapshots in the Amazon Elastic Compute Cloud User Guide. resetSnapshotAttributein interface AmazonEC2 resetSnapshotAttributeRequest- Contains the parameters for ResetSnapshotAttribute. public RestoreAddressToClassicResult restoreAddressToClassic(RestoreAddressToClassicRequest request)in interface AmazonEC2 restoreAddressToClassicRequest- Contains the parameters for RestoreAddressToClassic. public RevokeSecurityGroupEgressResult revokeSecurityGroupEgress(RevokeSecurityGroupEgressRequest request) in interface AmazonEC2 revokeSecurityGroupEgressRequest- Contains the parameters for RevokeSecurityGroupEgress. public RevokeSecurityGroupIngressResult revokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest request) Removes one or more ingress rules from a security group. To remove a rule, the values that you specify (for example, ports) must match the existing rule's values exactly. [EC2-Classic security groupsin interface AmazonEC2 revokeSecurityGroupIngressRequest- Contains the parameters for RevokeSecurityGroupIngress. @Deprecated public RevokeSecurityGroupIngressResult revokeSecurityGroupIngress() revokeSecurityGroupIngressin interface AmazonEC2 AmazonEC2.revokeSecurityGroupIngress(RevokeSecurityGroupIngressRequest) public RunInstancesResult runInstances(RunInstancesRequest request). To ensure faster instance launches, break up large requests into smaller batches. For example, create 5 separate launch requests for 100 instances each instead of 1in interface AmazonEC2 runInstancesRequest- Contains the parameters for RunInstances. public RunScheduledInstancesResult runScheduledInstances(RunScheduledInstancesRequest request)in interface AmazonEC2 runScheduledInstancesRequest- Contains the parameters for RunScheduledInstances. public StartInstancesResult startInstances(StartInstancesRequest request) Starts an Amazon EBS-backed AMI that you've previously stopped. Instances that use Amazon EBS volumes as their root devices can be quickly stopped and started. When an instance is stopped, the compute resources are released and you are not billed for hourly instance usage. However, your root partition Amazon EBS volume remains, continues to persist your data, and you are charged for Amazon EBS volume usage. You can restart your instance at any time. Each time you transition an instance from stopped to started, Amazon EC2 charges a full instance hour, even if transitions happen multiple times within a single hour.in interface AmazonEC2 startInstancesRequest- Contains the parameters for StartInstances. public StopInstancesResult stopInstances(StopInstancesRequest request).in interface AmazonEC2 stopInstancesRequest- Contains the parameters for StopInstances. public TerminateInstancesResult terminateInstances(TerminateInstancesRequest request) Shuts down one or morein interface AmazonEC2 terminateInstancesRequest- Contains the parameters for TerminateInstances. public UnassignIpv6AddressesResult unassignIpv6Addresses(UnassignIpv6AddressesRequest request) Unassigns one or more IPv6 addresses from a network interface. unassignIpv6Addressesin interface AmazonEC2 unassignIpv6AddressesRequest- public UnassignPrivateIpAddressesResult unassignPrivateIpAddresses(UnassignPrivateIpAddressesRequest request) Unassigns one or more secondary private IP addresses from a network interface. unassignPrivateIpAddressesin interface AmazonEC2 unassignPrivateIpAddressesRequest- Contains the parameters for UnassignPrivateIpAddresses. public UnmonitorInstancesResult unmonitorInstances(UnmonitorInstancesRequest request) Disables detailed monitoring for a running instance. For more information, see Monitoring Your Instances and Volumes in the Amazon Elastic Compute Cloud User Guide. unmonitorInstancesin interface AmazonEC2 unmonitorInstancesRequest- Contains the parameters for UnmonitorInstances. public UpdateSecurityGroupRuleDescriptionsEgressResult updateSecurityGroupRuleDescriptionsEgress(UpdateSecurityGroupRuleDescriptionsEgressRequest request) [EC2in interface AmazonEC2 updateSecurityGroupRuleDescriptionsEgressRequest- Contains the parameters for UpdateSecurityGroupRuleDescriptionsEgress. public UpdateSecurityGroupRuleDescriptionsIngressResult updateSecurityGroupRuleDescriptionsIngress(UpdateSecurityGroupRuleDescriptionsIngressRequest request)in interface AmazonEC2 updateSecurityGroupRuleDescriptionsIngressRequest- Contains the parameters for UpdateSecurityGroupRuleDescriptionsIngress. public <X extends AmazonWebServiceRequest> DryRunResult<X> dryRun(DryRunSupportedRequest<X> request) throws AmazonServiceException, AmazonClientException dryRunin interface AmazonEC2 AmazonEC2 request- The originally executed request public AmazonEC2Waiters waiters() waitersin interface AmazonEC2 public void shutdown() AmazonWebServiceClient shutdownin interface AmazonEC2 shutdownin class AmazonWebServiceClient
http://docs.aws.amazon.com/AWSJavaSDK/latest/javadoc/com/amazonaws/services/ec2/AmazonEC2Client.html
CC-MAIN-2017-39
en
refinedweb
Open Visual Studio 2012 IDE in an administrator mode (Right Click and select Run as an Administrator) and select File à New Project to select Windows Phone application development template that is available under the Windows Phone tab in the left menu as shown in the screen below. Now we can see the project created with a list of default files and folders that are basically required to run the application as shown in the screen below. Since we selected the blank project we will not see much of the inbuilt data that will be preloaded in most of the other templates that are available with the Visual Studio IDE. Now run the application directly and we can see we don't have any application bar triggered at the bottom of the page. Now we will write our code which basically triggers the Application bar at run time based on the number of items we require. So let's do it by navigating to the code behind and write the below code which creates the Application Bar at runtime using the ApplicationBar class as shown in the screen below. using System; using System.Collections.Generic; using System.Linq; using System.Net; using System.Windows; using System.Windows.Controls; using System.Windows.Navigation; using Microsoft.Phone.Controls; using Microsoft.Phone.Shell; using ProgAppBarSample.Resources; namespace ProgAppBarSample { public partial class MainPage : PhoneApplicationPage { // Constructor public MainPage() { InitializeComponent(); this.ApplicationBar = new ApplicationBar(); this.ApplicationBar.IsVisible = true; this.ApplicationBar.Opacity = 1; this.ApplicationBar.IsMenuEnabled = true; this.ApplicationBar.Mode = ApplicationBarMode.Minimized; ApplicationBarIconButton apButon = new ApplicationBarIconButton(); apButon.IconUri = new Uri("/Images/home.png", UriKind.Relative); apButon.Text = "Home"; this.ApplicationBar.Buttons.Add(apButon); ApplicationBarIconButton apButon1 = new ApplicationBarIconButton(); apButon1.IconUri = new Uri("/Images/About.png", UriKind.Relative); apButon1.Text = "About"; this.ApplicationBar.Buttons.Add(apButon1); ApplicationBarMenuItem mItem = new ApplicationBarMenuItem(); mItem.Text = "Contact"; this.ApplicationBar.MenuItems.Add(mItem); } } } Basically the code above has 2 app bar item and one menu item that will be created on run time on the application load. Now build and execute the application by simple pressing F5 key from the keyboard and we can see Visual Studio will build the application and open the Emulator to display the output as shown in the screen below. Hall of Fame Twitter Terms of Service Privacy Policy Contact Us Archives Tell A Friend
http://www.dotnetspark.com/kb/5522-programmatically-create-application-bar.aspx
CC-MAIN-2017-39
en
refinedweb
how to get spice or vnc connect_port in openstack/ocata Hi, I am trying to use remote-viewer to access an instance running in ocata. My neutron is dhcp-flat type, and i can see that the qemu-kvm is listening on 5901 from compute1. I want to use python api to get instance connect_info. In nova/api.py, def get_spice_console(self, context, instance, console_type): """Get a url to an instance Console.""" connect_info = self.compute_rpcapi.get_spice_console(context, instance=instance, console_type=console_type) self.consoleauth_rpcapi.authorize_console(context, connect_info['token'], console_type, connect_info['host'], connect_info['port'], connect_info['internal_access_path'], instance.uuid, access_url=connect_info['access_url']) return {'url': connect_info['access_url']} get_spice_console gets connect_info from self.compute_rpcapi.get_spice_console, and nova-compute would return connection info getting from libvirt xml, authorize_console be called so nova-spiceproxy can get connect_info from nova-consoleauth. api.get_spice_console returns a url, but how can i get the connect_info(ip, port) from my nova client? from keystoneauth1 import loading from keystoneauth1 import session from novaclient import client loader = loading.get_plugin_loader('password') auth = loader.load_from_options(auth_url='', username='admin', password='11111111', project_name='admin', user_domain_name='Default', project_domain_name='Default') sess = session.Session(auth=auth) nova = client.Client(2, session=sess) nova.servers.get_spice_console('4de610f2-37f4-4b29-958a-2bc2c50aaeb8', 'spice-html5') # OUT: {u'console': {u'url': u'', u'type': u'spice-html5'}} cirros_console = nova.servers.get_spice_console('4de610f2-37f4-4b29-958a-2bc2c50aaeb8', 'spice-html5') cirros_console # OUT: {u'console': {u'url': u'', u'type': u'spice-html5'}} the question is how to get spice connect_info(ip, port) from a instance id using nova client? then my nova client can instruct remote-viewer to connect the instance.
https://ask.openstack.org/en/question/105479/how-to-get-spice-or-vnc-connect_port-in-openstackocata/
CC-MAIN-2017-39
en
refinedweb
For example, I have a some class: public class Test<T> { public T setField() { return this; } } Casting this to T makes only sense if you use a recursive type bound. Still you need to add a cast and suppress the warning: abstract class Test<T extends Test<T>> { @SuppressWarnings("unchecked") public T setField() { return (T)this; } } Define derived classes like: public class DerivedTest extends Test<DerivedTest> { ... } and now this works without any casts needed in the client code: DerivedTest d = new DerivedTest().setField();
https://codedump.io/share/3Csx5mHvJxjR/1/how-to-return-this-in-the-generic-class
CC-MAIN-2017-39
en
refinedweb
Developer’s guide¶ This section is intended as a guide to how Brian functions internally for people developing Brian itself, or extensions to Brian. It may also be of some interest to others wishing to better understand how Brian works internally. - Overview of Brian2 - Coding guidelines - Clocks - Units - Equations and namespaces - Variables and indices - State update - New magic and clock behaviour - Preferences system - Code generation - Adding support for new functions
http://brian2.readthedocs.io/en/2.0a8/developer/index.html
CC-MAIN-2017-39
en
refinedweb
class Solution(object): def countBattleships(self, board): """ :type board: List[List[str]] :rtype: int """ count = 0 row,col = len(board), len(board[0]) for i in range(row): for j in range(col): if board[i][j] == 'X': if (j-1 >= 0 and board[i][j-1] == 'X') or (i-1 >= 0 and board[i-1][j] =='X'): continue count += 1 return count A Solution in Python class Solution(object): Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.
https://discuss.leetcode.com/topic/92018/a-solution-in-python
CC-MAIN-2017-39
en
refinedweb
Webapps on App Engine, part 4: Templating Posted by Nick Johnson | Filed under python, coding, app-engine, tech, framework This is part of a series on writing a webapp framework for App Engine Python. For details, see the introductory post here. In the first three posts of this series, we covered all the components of a bare bones webapp framework: routing, request/response encoding, and request handlers. Most people expect a lot more out of their web framework, however. Individual frameworks take different approaches to this, from the minimalist webapp framework, which provides the bare minimum plus some integration with other tools, to the all-inclusive django, to the 'best of breed' Pylons, which focuses on including and integrating the best libraries for each task, rather than writing their own. For our framework, we're going to take an approach somewhere between webapp's and Pylons': While keeping our framework minimal and modular, we'll look at the best options to use for other components - specifically, templating and session handling. In this post, we'll discuss templating. To anyone new to webapps, templates may seem somewhat unnecessary. We can simply generate the output direct from our code, right? Many CGI scripting languages used this approach, and the results are often messy. Sometimes, which page to be generated isn't clear until after a significant amount of processing has been done, and dealing with errors and other exceptional conditions likewise becomes problematic. Finally, this approach tends to lead to gobs of print statements cluttering up the code, making both the structure of the page and the flow of the code unclear. Templating systems were designed to eliminate these issues. Instead of generating the page as we process the request, we wait until we're done, construct a dictionary of variables to pass to the template, and select and render the template we need. The templating system then takes care of interpreting the template, substituting in the variables we passed where necessary. Templating doesn't have to be complicated - here's a simple templating system: def render_template(template, values): return template % values # Example template = """Hello, %(name)s! How are you this %(time_of_day)s?""" self.response.body = render_template(template, values) This 'templating system' simply uses Python's string formatting functionality to generate its result. It quickly becomes apparrent that this isn't sufficient for templating web pages, though - we need more functionality. At a minimum, we need some form of flow control, so we can include sections of a page conditionally, such as login/logout links, and some form of looping construct, so we can include repeated sections, such as results from datastore queries. It helps if our templating system provides some features for template reuse, too, such as including other templates, or extending them. How powerful should our templates be, though? This is a source of some disagreement. Some templating systems, like Django's, take a very minimalist approach, and contain only the bare minimum of functionality required to render templates. Any form of calculation - even things as simple as basic math and comparisons - should be done in code, with the results passed to the template. Other templating systems, like Mako, provide a much more full-featured templating language, and trust you not to abuse it. Here's what sample templates look like in a few templating languages: %} You're probably already familiar with Django's template syntax from previous posts. Because it's included with App Engine, it's often the easy default. As we've already mentioned, it's very restrictive about what you can do: It provides a few primitives, and relies on an extensible library of tags and filters (the bits after the | in {{...}}) to make it useful. Mako: <%inherit <% rows = [[v for v in range(0,10)] for row in range(0,10)] %> <table> % for row in rows: ${makerow(row)} % endfor </table> <%def <tr> % for name in row: <td>${name}</td>\ % endfor </tr> </%def> Mako is another popular templating engine, and takes the opposite approach to Django: Templates are created by inserting actual Python code, inside special processing directives of the form <% .. %>. It even goes so far as to permit and encourage defining functions inside templates! Mako works around Python's use of indentation for control flow by defining new keywords such as 'endfor'. Cheetah <html> <head><title>$title</title></head> <body> <table> #for $client in $clients <tr> <td>$client.surname, $client.firstname</td> <td><a href="mailto:$client.email">$client.email</a></td> </tr> #end for </table> </body> </html> Cheetah is another templating system that takes the "we provide the gun, you point it at your foot" approach. It's similar to Mako in many ways, but doesn't require variable substitutions to be embedded in curly braces, and instead of using processing directives, it treats lines starting with a # as Python code. It also uses special directives such as 'end for' for nesting. Jinja2 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"> <html lang="en"> <html xmlns=""> > Jinja2 claims to have "Django-like syntax (but faster)". Notably, the syntactic elements for loops, control flow, etc, are a lot more Python-like, but they're still limited to what the language supports, and it still relies on specially defined tests, filters, etc. Tenjin <html> <body> <h1>${title}</h1> <table> <?py i = 0 ?> <?py for item in items: ?> <?py i += 1 ?> <?py color = i % 2 == 0 and '#FFCCCC' or '#CCCCFF' ?> <tr bgcolor="#{color}"> <td>#{i}</td> <td>${item}</td> </tr> <?py #endfor ?> </table> </body> </html> Tenjin claims to be the fastest Python templating framework - and it has benchmarks (although not exhaustive ones) to back it up. It takes the general approach, with Python expressions and statements embedded directly into the markup. Notably, indentation of the Python statements maters, producing a somewhat confused mix of markup and Python code. Chameleon <table border="1"> <tr tal: <td tal: <span tal:1 * 1 = 1</span> </td> </tr> </table> Chameleon is based on the Zope Page Templates specification, which takes an interesting approach. Chameleon templates are valid XML documents, unlike many templating engines, and it uses namespaces for attributes and tags to define the template behaviour. For example, the "tal:repeat" tag indicates that the tag it's on and all its children should be repeated for each value in the Python iterator passed as an argument. tal:replace replaces an element with the value of the expression, while other expressions permit setting attributes and replacing body content, and a 'meta' namespace handles operations such as including other templates. Chameleon extends the Zope standard in several ways: expressions can be arbitrary Python expressions, and values can be substituted using a ${...} syntax in addition to the XML syntax, which avoids a lot of boilerplate in some situations. Chameleon templates are compiled to Python code on first use - so you're not doing XML DOM manipulation on every template generation. Chameleon recently got App Engine support when the author refactored out some code that relied on modules not available in App Engine. I haven't mentioned all Python's templating systems here, by a long shot - this is merely a representative sample. For a more complete list, see this page. Our framework Examining the different templating engines leads to an interesting observation: Those templating engines that take the Django approach of "only what's necessary" tend to, of necessity, be a lot larger and more involved - and hence have a steeper learning curve - than those that allow you to leverage your Python knowledge in some fashion. For that reason and others, I'm not a big fan of them - I'd rather provide someone with a powerful but lightweight system, and trust them not to shoot themselves in the foot, than use a more complicated system designed to make foot-shooting an impossibility. With that consideration and others in mind, we'll look at what is required to use Chameleon in our framework. Using Chameleon Installation is straightforward: Download the tarball from the PyPi page, and copy the Chameleon-1.1.1/src/chameleon directory into a directory on the system path (eg, your app's root folder). To use Chameleon, we first define a template loader: from chameleon.zpt import loader template_path = os.path.join(os.path.dirname(__file__), "..", "templates") template_loader = loader.TemplateLoader(template_path, auto_reload=os.environ['SERVER_SOFTWARE'].startswith('Dev')) Template loaders serve to cache loaded and compiled templates, which is essential for performance. As such, it makes sense to define our loader once at module level, and use it for all requests. To render a template, we fetch a template from the loader, then call it with keyword arguments corresponding to the parameters we want to pass to the template: def TestHandler(RequestHandler): def get(self): template = template_loader.load("test.pt") self.response.body = template(name="test") In terms of integrating templates into our framework, there's not a great deal we can do without locking users of our framework into using our preferred templating system. You can bundle the templating system with the framework, and even make it create a loader when it's first used. The approach you take depends on where you want to be on the flexibility / ease-of-use axis. In the next post, we'll discuss session handling, the options available on App Engine, and how to integrate it into our framework.Previous Post Next Post
http://blog.notdot.net/2010/02/Webapps-on-App-Engine-part-4-Templating
CC-MAIN-2017-39
en
refinedweb
Equalling a just declared matrix to a submatrix does not give a newly allocated matrix (modifying the new matrix modifies the old matrix). I mean: // it just creates a random (gaussian) matrix LaGenMatDouble A = StatUtil::RandnMatrix(2,3,0.0,1.0); LaGenMatDouble B = A(LaIndex(0,1),LaIndex(1,2)); cout << "A is" << endl << A << "B is" << endl << B; B(0,0) = 10; cout << "A is" << endl << A << "B is" << endl << B; A is -0.531466 -1.82688 0.302208 0.849202 -0.983648 -0.00441152 B is -1.82688 0.302208 -0.983648 -0.00441152 A is -0.531466 10 0.302208 0.849202 -0.983648 -0.00441152 B is 10 0.302208 -0.983648 -0.00441152 I don't know if that's the behavior you were looking for, but it's not what I expected. Regards, Manuel A. Vázquez ([email protected]) Christian Stimming 2007-07-09 Logged In: YES user_id=531034 Originator: NO Thanks for reporting this issue. As you can see in the example program below, the unwanted reference copy is created only when writing LaGenMatDouble B = A(LaIndex,LaIndex); i.e. only when assigning directly at declaration. It does not appear when assigning later, C=A(LaIndex,LaIndex), where a deep copy as expected is created. I'm actually a bit at a loss as to why this happens - the constructor and operator= of that class clearly will create a deep copy . Maybe I can think of a solution, but so far I don't have an idea. For the record, providing full example programs for such bugs would make bugfixing much easier. // Compile as follows: gcc bla.cpp -o bla -I/usr/include/lapackpp -llapackpp using namespace std; int main(int argc, char* argv[]){ // Just an example matrix LaGenMatDouble A(2,3); A(0,0)=0; A(0,1)=1; A(0,2)=2; A(1,0)=3; A(1,1)=4; A(1,2)=5; A.debug(1); LaGenMatDouble B = A(LaIndex(0,1),LaIndex(1,2)); // huh? Is a reference to A LaGenMatDouble C; C = A(LaIndex(0,1),LaIndex(1,2)); // correctly creates a copy of A cout << "A is" << endl << A << "B is" << endl << B << "C is" << endl << C; B(0,0) = 10; cout << "A is" << endl << A << "B is" << endl << B << "C is" << endl << C; return 0; } Christian Stimming 2007-07-14 Logged In: YES user_id=531034 Originator: NO Thanks for reporting this issue. It turns out this is caused by an unexpected optimization of C++, and this cannot easily be fixed in the current lapackpp structure. A workaround is explained in the updated documentation here ; basically, you must write LaGenMatDouble B; B = A(LaIndex(0,1),LaIndex(1,2)); All other possibilities will not work with the current lapackpp matrix classes. Sorry for that. This bug will stay open until someone can come up with a permanent solution. Anonymous
http://sourceforge.net/p/lapackpp/bugs/18/
CC-MAIN-2015-35
en
refinedweb
Tk_SetClass, Tk_Class - set or retrieve a window's class #include <tk.h> Tk_SetClass(tkwin, class) Tk_Uid Tk_Class(tkwin) Token for window. New class name for window. the documentation for Tk_GetUid for details). If tkwin has not yet been given a class, then Tk_Class will return NULL. class, unique identifier, window, window manager
http://search.cpan.org/~srezic/Tk-804.032/pod/pTk/SetClass.pod
CC-MAIN-2015-35
en
refinedweb
- NAME - DESCRIPTION - METHODS - SEE ALSO - AUTHOR - BUGS - SUPPORT NAME Webservice::InterMine::Query::Roles::Runnable - Composable behaviour for runnable queries DESCRIPTION This module provides composable behaviour for running a query against a webservice and getting the results. METHODS results_iterator Returns a results iterator for use with a query. The following options are available: as => $format. json[objects|rows] - raw data structures The two json formats allow low-level access to the data-structures returned by the webservice. count - a single row containing the count In preference to using the iterator, it is recommended you use Webservice::InterMine::Query::Roles::Runnable::count instead. size => $size The number of results to return. Leave undefined for "all" (default). start => $start The first result to return (starting at 0). The default is 0. columnheaders => 0/1/friendly/path Whether to return the column headers at the top of TSV/CSV results. The default is false. There are two styles - friendly: "Gene > pathways > name" and path: "Gene.pathways.name". The default style is friendly if a true value is entered and it is not "path". json => $json_processor Possible values: (inflate|instantiate|raw|perl) What to do with JSON results. The results can be returned as inflated objects, full instantiated Moose objects, a raw json string, or as a perl data structure. (default is perl). summaryPath => $pathas well. summarise($path, <%opts>) / summarize($path, <%opts>). iterator A synonym for results_iterator. See Webservice::InterMine::Query::Roles::Runnable::results_iterator. results( %options ) returns the results from a query in the result format specified. This method supports all the options of results_iterator, but returns a list (in list context) or an array-reference (in scalar context) of results instead. all(%options) Return all rows of results. This method takes the same options as results, but any start and size arguments given are ignored. Note that the server code limits result-sets to 10,000,000 rows in size, no matter what. first(%options) Return the first result (row or object). This method takes the same options as results, but any size arguments given are ignored. May return undef if there are no results. one(%options) Return one result (row or result object), throwing an error if more than one is received. get_count A convenience method that returns the number of result rows a query returns. count Alias for get_count url Get the url for a webservice resource. get_upload_url get the url to use to upload queries to the webservice. save Save this query in the user's history in the connected webservice. For queries this will be saved into query history, and templates will be saved into your personal collection of private templates. SEE ALSO Webservice::InterMine::Cookbook for guide on how to use these modules. Webservice::InterMine::Query Webservice::InterMine::Service Webservice::InterMine::Query::Template AUTHOR Alex Kalderimis <[email protected]> BUGS Please report any bugs or feature requests to [email protected]. SUPPORT You can find documentation for this module with the perldoc command. perldoc Webservice::InterMine::Query::Roles::Runnable You can also look for information at: Webservice::InterMine Documentation This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
https://metacpan.org/pod/Webservice::InterMine::Query::Roles::Runnable
CC-MAIN-2015-35
en
refinedweb
Configure settings for a Web application (SharePoint Server 2010) Applies to: SharePoint Server 2010 Topic Last Modified: 2010-04-12 After you create a Web application, you can use Central Administration, Windows PowerShell 2.0 cmdlets, or the Stsadm command-line tool to configure Web application settings. Web application settings affect all site collections in the Web application. This article describes the general settings that you can configure for a Web application, and introduces other articles that describe additional Web application settings. You typically configure the Web application general settings when you create a new Web application. You can access the general settings in Central Administration by clicking Manage Web applications in the Application Management section, clicking the Web application that you want to configure, and then clicking General Settings on the ribbon. Many of these settings can also be configured by using Windows PowerShell 2.0 cmdlets. For information about how to use Windows PowerShell 2.0 cmdlets for Microsoft SharePoint Server 2010 administrative tasks, see Windows PowerShell for SharePoint Server 2010, and the individual articles that are referenced in this article for particular settings. The following list describes general settings for a Web application: Resource throttling Resource throttling settings let you fine-tune the Web application for improved performance. We do not recommend that you adjust the default settings unless you have tested the server configuration and know that making these changes will definitely improve performance. Workflow SharePoint Server 2010 provides a set of predefined workflows that you can use to guide and track common tasks such as document review or approval. In addition to using the predefined workflows, you can define your own workflows by using Microsoft Office SharePoint Designer 2007 or create code-based custom workflows by using Visual Studio. You can configure workflow settings that apply to all sites in a Web application. For more information about using and configuring workflows, see Workflow administration (SharePoint Server 2010). Outgoing e-mail You can configure outgoing e-mail for a specific Web application so that users can track changes and updates to individual site collections. For more information, see Configure outgoing e-mail (SharePoint Server 2010). Mobile account You can configure and manage a mobile account to enable users to subscribe to alerts that are sent via Short Message Service (SMS). The alerts are sent to users' mobile phones when changes are made in a SharePoint list or item. For more information, see Configure a mobile account (SharePoint Server 2010). SharePoint Designer You can specify whether to allow users to edit sites by using Microsoft SharePoint Designer 2010. By default, this setting is On. Additional settings for SharePoint Designer 2010 are as follows: Allow Site Collection Administrators to Detach Pages from the Site Template. You can specify whether to allow site collection administrators to detach pages from the original site definition by using SharePoint Designer 2010. By default, this setting is On. Allow Site Collection Administrators to Customize Master Pages and Layout Pages. You can specify whether to allow site collection administrators to customize master pages and layout pages by using SharePoint Designer 2010. By default, this setting is On. Allow Site Collection Administrators to see the URL Structure of their Web Site. You can specify whether to allow site collection administrators to manage the URL structure of a Web site by using SharePoint Designer 2010. By default, this setting is On. General settings The General Settings option on the General Settings drop-down menu lets you view and modify the following settings for a Web application. Default Time Zone You can define the default time zone that is used for all sites in the Web application. Default Quota Template A quota template consists of storage limit values that specify how much data can be stored in a site collection, and the storage size limit that triggers an e-mail alert to the site collection administrator. Use this setting to select a default quota template for all site collections in the Web application. For more information, see Plan quota management (SharePoint Server 2010). Person Name Smart Tag and Presence Settings When the Person Name smart tag and Online Status is enabled, online presence information is displayed next to member names and the Person Name smart tag appears when users move the pointer over a member name anywhere on the Web site. This setting is enabled by default. Alerts You can specify alert settings for the Web application. By default, alerts are enabled and each user is limited to 500 alerts. For more information, see Configure alert settings for a Web application (SharePoint Server 2010). RSS Settings You can enable Really Simple Syndication (RSS) feeds for viewing RSS feeds from blogs, news sources, and other venues. By default, RSS feeds are enabled. Blog API Settings You can select whether to enable the MetaWeblog API for the Web application. By default, the MetaWebLog API is enabled and the setting to accept a user name and password from the API is set to No. Browser File Handling You can specify whether additional security headers are added to documents that are served to Web browsers. These security headers specify that a browser shows a download prompt for certain types of files (for example, .html), and to use the server's specified Multipurpose Internet Mail Extensions (MIME) type for other types of files. The Permissive setting specifies that no headers are added. The Strict setting adds headers that force the browser to download certain types of files. The forced download improves security for the server by disallowing the automatic execution of Web content. By default, the setting is Strict. Web Page Security Validation The Web Page Security Validation setting establishes an amount of time after which a user is required to retry the last operation. By default, security validation is set to On with a 30-minute expiration time. Send User Name and Password in E-Mail This option lets users retrieve their user name and password by e-mail. If this option is turned off, a new user cannot access the site until an administrator changes the user's password and notifies them of the new password. By default, this setting is On. Master Page Setting for Application _Layouts Pages You can allow pages in the _Layouts folder to reference site master pages. Pages in the Application _Layouts folder are available to all sites in the farm. If this setting is Yes, most pages in the _Layouts folder will reference the site master page and show the customizations that have been made to that master page. By default, this setting is Yes. Recycle Bin You can specify whether the Recycle Bins in the Web application are turned on. For more information, see Configure Recycle Bin settings (SharePoint Server 2010). Maximum Upload Size You can specify the maximum size to allow for any single upload to any site. By default, the maximum upload size is set to 50 megabytes (MB). Customer Experience Improvement Program You can collect Web site analytics about Web page usage on the Web application. By default, this setting is Yes. The following list references additional articles that describe how to configure settings for a Web application: Manage permission policies for a Web application (SharePoint Server 2010) Administrators can define policies to establish different levels of access to sites within Web applications to various users. This article describes how to create and manage permissions policies. Manage permissions for a Web application (SharePoint Server 2010) Administrators can control user actions by enabling or disabling the associated permission on the Web application. This article describes how to establish permissions on a Web application. Turn on or turn off self-service site creation (SharePoint Server 2010) Self-service site creation lets designated users create sites in defined URL namespaces. This article describes how to configure this feature for a Web application. Configure Recycle Bin settings (SharePoint Server 2010) Recycle Bins help users and site collection administrators recover data. This article describes how to configure Recycle Bins for a Web application. Configure alert settings for a Web application (SharePoint Server 2010) The alerts feature helps users keep track of changes that were made to a Web site. The feature does this through an e-mail notification service. This article describes how to configure alerts. Define managed paths (SharePoint Server 2010) By defining managed paths, you can specify which paths in the URL namespace of a Web application are used for site collections. This article describes how to configure managed paths for a Web application. Add or remove a service application connection to a Web application (SharePoint Server 2010) A service application connection associates the service application to Web applications via membership in a service application connection group (also referred to as application proxy group). This article describes how to add or remove service application connections to a service application connection group.
https://technet.microsoft.com/en-us/library/cc262107(d=printer).aspx
CC-MAIN-2015-35
en
refinedweb
Name | Synopsis | Description | Return Values | Errors | Files | Usage | Attributes | See Also #include <stdlib.h> void closefrom(int lowfd); int fdwalk(int (*func)(void *, int), void *cd);).
http://docs.oracle.com/cd/E19082-01/819-2243/6n4i098vd/index.html
CC-MAIN-2015-35
en
refinedweb
all components of Type type in the GameObject or any of its parents. The search for components is carried out recursively on parent objects, so it includes parents of parents, and so on. #pragma strict // Disable the spring on all HingeJoints // in this game object and all its parent game objects public var hingeJoints: HingeJoint[]; hingeJoints = HingeJoint[]gameObject.GetComponentsInParent(HingeJoint); for (var joint: HingeJoint in hingeJoints) { joint.useSpring = false; } // Disable the spring on all HingeJoints // in this game object and all its parent game objects using UnityEngine; using System.Collections; public class ExampleClass : MonoBehaviour { public HingeJoint[] hingeJoints; void Example() { hingeJoints = (HingeJoint[]) gameObject.GetComponentsInParent(typeof(HingeJoint)); foreach (HingeJoint joint in hingeJoints) { joint.useSpring = false; } } } Generic version. See the Generic Functions page for more details.
http://docs.unity3d.com/ScriptReference/GameObject.GetComponentsInParent.html
CC-MAIN-2015-35
en
refinedweb
I am new to java and in this assignment I need to make a spot to enter the customer's name and amount of kilowatt usage. I need to do this for three people, the first time through it works fine but after that there is no place to put the customer's name during the process. In our class we write it up in notebook and run from the command prompt. The input only appears in command prompt while output shows in the joption pane. Code java: // import javax.swing.JOptionPane; import java.util.Scanner; public class Electric1//Exercise 1 not complete { public static void main(String args[]) { Scanner input = new Scanner(System.in); String name; int kilowatts; String message = ""; double pay; System.out.print("What is your name?"); name = input.nextLine(); kilowatts = System.out.print("How many kilowatts did you use?"); pay = kilowatts * .056; message = String.format("%s, you owe $%.2f", name, pay); JOptionPane.showMessageDialog(null, message); } }
http://www.javaprogrammingforums.com/%20whats-wrong-my-code/7153-problem-loop-printingthethread.html
CC-MAIN-2015-35
en
refinedweb
Opened 8 years ago Closed 8 years ago #4710 closed (fixed) ModPythonRequest.is_secure(): accept greater range of HTTPS env. settings Description Hi, In django/core/handlers/modpython.py, the method ModPythonRequest.is_secure() method checks the setting of the HTTPS environment variable. Currently it assumes that this will be set to the string "on" if SSL is active. However, it is common to use other values, in particular "1" - do a google search for `apache "SetEnv HTTPS 1"' to see examples of this. The current version of is_secure will incorrectly return False in this case. The submitted patch fixes this issue. In addition, it removes case insensitivity, and makes it easy to extend, if it turns out other values (like "true" or something) need to be accepted. Thanks, Aaron Maxwell SnapLogic - Open Source Data Integration Attachments (2) Change History (9) Changed 8 years ago by amax@… comment:1 Changed 8 years ago by Graham.Dumpleton@… - Needs documentation unset - Needs tests unset - Patch needs improvement unset Just to clarify, which version of Apache are you using? In Apache 2.X, the HTTPS variable is set in the request subprocess environment by the SSL engine in Apache. /* * Annotate the SSI/CGI environment with standard SSL information */ /* the always present HTTPS (=HTTP over SSL) flag! */ apr_table_setn(env, "HTTPS", "on"); The mod_python request handler will inherit this value. There should never be a need for a user to explicitly use SetEnv to set the value of HTTP when using mod_python, at least on Apache 2.X. So perhaps indicate which version of Apache and mod_python you are using so the scope of the problem can be determined. comment:2 Changed 8 years ago by amax@… Apache version is Apache/2.0.52, with mod_python 3.3.1. The httpd came with RHEL 4; we compiled the mod_python from source. There is a VirtualHost declaration for the site, in which we had been explicitly setting the value with SetEnv. I tried just not setting HTTPS (everywhere in the apache config, not just in that vhost), to see if our apache would set it, but it appears not. Interesting issue here, not sure why the HTTPS variable is not being set automatically for us. Does the version of mod_ssl have anything to do with it? Perhaps there is something else in our configuration. Thanks, Aaron comment:3 Changed 8 years ago by Graham.Dumpleton@… The addition of HTTPS is done in the Apache fixup phase, ie., last phase before actual response handler is called. This should mean it will always be set before Django mod_python code is triggered from mod_python PythonHandler if SSL is enabled. It shouldn't matter whether a VirtualHost is being used, or even some other specialised means for managing virtual hosts such as the various vhost modules or rewrite rules. By rights where the mod_python code currently has: def is_secure(self): # Note: modpython 3.2.10+ has req.is_https(), but we need to support previous versions return self._req.subprocess_env.has_key('HTTPS') and self._req.subprocess_env['HTTPS'] == 'on' it should probably use: def is_secure(self): try: return self._req.is_https() except: return self._req.subprocess_env.has_key('HTTPS') and self._req.subprocess_env['HTTPS'] == 'on' There is no reason for it not to try the better is_https() method and fall back to looking for HTTPS instead. If you make this change instead, does that work? If that doesn't pickup a secure connection is present, can only assume that your web server isn't actually receiving an SSL connection. Is this web server the actual facing SSL enabled server, or does it sit behind another web server using mod_proxy or similar? As a side note, because HTTPS is only set in the fixup phase it will be after the authen phase and thus anyone hooking in with PythonAuthenHandler to use Django for authentication would not pick up things as a secure connection if relying on HTTPS to be present. The is_https() should be okay though. Back to the change, a combination of your change and is_https() check would probably be the best. Thus: def is_secure(self): try: return self._req.is_https() except: return self._req.subprocess_env.has_key('HTTPS') and self._req.subprocess_env['HTTPS'].lower() in ['on', '1'] Still be interesting to know why HTTPS not being set. I don't think I am wrong in believing it should be. comment:4 Changed 8 years ago by amax@… Yep, that does it. Tried both (the first try/except, and the second, combined one), with no SetEnv HTTPS in the apache conf, and in both cases the request responds properly. Experimenting a bit verified that it's the self._req.is_https() returning here in our case. For the record, this server is the actual facing server, not behind a proxy or anything. Don't know at all about the HTTPS var, but if I find out (probably not likely) I'll post here. Thanks Aaron comment:5 Changed 8 years ago by SmileyChris - Patch needs improvement set - Triage Stage changed from Unreviewed to Accepted Changed 8 years ago by SmileyChris patch taking in Graham's suggestion of trying is_https() first comment:6 Changed 8 years ago by SmileyChris - Patch needs improvement unset - Triage Stage changed from Accepted to Ready for checkin comment:7 Changed 8 years ago by mtredinnick - Resolution set to fixed - Status changed from new to closed patch
https://code.djangoproject.com/ticket/4710
CC-MAIN-2015-35
en
refinedweb
java.lang.Object org.netlib.lapack.Sgehd2org.netlib.lapack.Sgehd2 public class Sgehd2 Following is the description from the original Fortran source. For each array argument, the Java version will include an integer offset parameter, so the arguments may not match the description exactly. Contact [email protected] with any questions. * .. * * Purpose * ======= * * SGEHD2 reduces a real general matrix A to upper Hessenberg form H by * an orthogonal <= max(1,N). * * A (input/output) * =============== * *). * * ===================================================================== * * .. Parameters .. public Sgehd2() public static void sgehd2(int n, int ilo, int ihi, float[] a, int _a_offset, int lda, float[] tau, int _tau_offset, float[] work, int _work_offset, intW info)
http://icl.cs.utk.edu/projectsfiles/f2j/javadoc/org/netlib/lapack/Sgehd2.html
CC-MAIN-2013-20
en
refinedweb
Task Parallelism (Task Parallel Library) The Task Parallel Library (TPL), as its name implies, is based on the concept of the task. The term. For both of these reasons, in the .NET Framework, tasks are the preferred API for writing multi-threaded, asynchronous, and parallel code. The Parallel.Invoke method provides a convenient way to run any number of arbitrary statements concurrently. Just pass in an Action delegate for each item of work. The easiest way to create these delegates is to use lambda expressions. The lambda expression can either call a named method, or provide the code inline. The following example shows a basic Invoke call that creates and starts two tasks that run concurrently. For more information, see How to: Use Parallel.Invoke to Execute Parallel Operations. For greater control over task execution, or to return a value from the task, you have to work with Task objects more explicitly. A task is represented by the System.Threading.Tasks.Task class. A task that returns a value is represented by the System.Threading.Tasks.Task<TResult> class, which inherits from Task. The task object handles the infrastructure details, and provides methods and properties that are accessible from the calling thread throughout the lifetime of the task. For example, you can access the Status property of a task at any time to determine whether it has started running, ran to completion, was canceled, or has thrown an exception. The status is represented by a TaskStatus enumeration. When you create a task, you give it a user delegate that encapsulates the code that the task will execute. The delegate can be expressed as a named delegate, an anonymous method, or a lambda expression. Lambda expressions can contain a call to a named method, as shown in the following example. // Create a task and supply a user delegate by using a lambda expression. var taskA = new Task(() => Console.WriteLine("Hello from taskA.")); // Start the task. taskA.Start(); // Output a message from the joining thread. Console.WriteLine("Hello from the calling thread."); // Message from taskA should follow. /* Output: * Hello from the calling thread. * Hello from taskA. */ You can also use the Run methods to create and start a task in one operation. To manage the task, the Run methods use the default task scheduler, regardless of which task scheduler is associated with the current thread. The Run methods are the preferred way to create and start tasks when more control over the creation and scheduling of the task is not needed. You can also use the StartNew method to create and start a task in one operation. Use this method when creation and scheduling do not have to be separated and you require additional task creation options or the use of a specific scheduler, or when you need to pass additional state into the task through its AsyncState property, as shown in the following example. Task and Task<TResult> each expose a static Factory property that returns a default instance of TaskFactory, so that you can call the method as Task.Factory.StartNew(). Also, in this example, because the tasks are of type System.Threading.Tasks.Task<TResult>, they each have a public Result property that contains the result of the computation. The tasks run asynchronously and may complete in any order. If Result is accessed before the computation finishes, the property will block the thread until the value is available. Task<double>[] taskArray = new Task<double>[] { Task<double>.Factory.StartNew(() => DoComputation1()), // May be written more conveniently like this: Task.Factory.StartNew(() => DoComputation2()), Task.Factory.StartNew(() => DoComputation3()) }; double[] results = new double[taskArray.Length]; for (int i = 0; i < taskArray.Length; i++) results[i] = taskArray[i].Result; For more information, see How to: Return a Value from a Task. When you use a lambda expression to create a delegate, you have access to all the variables that are visible at that point in your source code. However, in some cases, most notably within loops, a lambda doesn't capture the variable as expected. It only captures the final value, not the value as it mutates after each iteration. You can access the value on each iteration by providing a state object to a task through its constructor, as shown in the following example: class MyCustomData { public long CreationTime; public int Name; public int ThreadNum; } static void TaskDemo2() { // Create the task object by using an Action(Of Object) to pass in custom data // in the Task constructor. This is useful when you need to capture outer variables // from within a loop. As an experiement, try modifying this code to // capture i directly in the lambda, and compare results. Task[] taskArray = new Task[10]; for(int i = 0; i < taskArray.Length; i++) { taskArray[i] = new Task((obj) => { MyCustomData mydata = (MyCustomData) obj; mydata.ThreadNum = Thread.CurrentThread.ManagedThreadId; Console.WriteLine("Hello from Task #{0} created at {1} running on thread #{2}.", mydata.Name, mydata.CreationTime, mydata.ThreadNum); }, new MyCustomData () {Name = i, CreationTime = DateTime.Now.Ticks} ); taskArray[i].Start(); } } This state is passed as an argument to the task delegate, and it can be accessed from the task object by using the AsyncState property. Also, passing in data through the constructor might provide a small performance benefit in some scenarios. Every task receives an integer ID that uniquely identifies it in an application domain and can be accessed by using the Id property. The ID is useful for viewing task information in the Visual Studio debugger Parallel Stacks and Parallel Tasks windows. The ID is lazily created, which means that it isn't created until it is requested; therefore, a task may have a different ID every time that the program is run. For more information about how to view Task IDs in the debugger, see Using the Parallel Stacks Window and Using the Parallel Stacks Window. Most APIs that create tasks provide overloads that accept a TaskCreationOptions parameter. By specifying one of these options, you tell the task scheduler how to schedule the task on the thread pool. The following table lists the various task creation options. The options may be combined by using a bitwise OR operation. The following example shows a task that has the LongRunning and PreferFairness option. The Task.ContinueWith method and Task<TResult>.ContinueWith method let you specify a task to be started when the antecedent task finishes. The delegate of the continuation task is passed a reference to the antecedent, so that it can examine its status. In addition, a user-defined value can be passed from the antecedent to its continuation in the Result property, so that the output of the antecedent can serve as input for the continuation. In the following example, getData is started by the program code. Then, analyzeData is started automatically when getData finishes, and reportData is started when analyzeData finishes. getData produces as its result a byte array, which is passed into analyzeData. analyzeData processes that array and returns a result whose type is inferred from the return type of the Analyze method. reportData takes the input from analyzeData, and produces a result whose type is inferred in a similar manner and which is made available to the program in the Result property. Task<byte[]> getData = new Task<byte[]>(() => GetFileData()); Task<double[]> analyzeData = getData.ContinueWith(x => Analyze(x.Result)); Task<string> reportData = analyzeData.ContinueWith(y => Summarize(y.Result)); getData.Start(); //or... Task<string> reportData2 = Task.Factory.StartNew(() => GetFileData()) .ContinueWith((x) => Analyze(x.Result)) .ContinueWith((y) => Summarize(y.Result)); System.IO.File.WriteAllText(@"C:\reportFolder\report.txt", reportData.Result); The ContinueWhenAll and ContinueWhenAny methods enable you to continue from multiple tasks. For more information, see Continuation Tasks and How to: Chain Multiple Tasks with Continuations. When user code that is running in a task creates a new task and does not specify the AttachedToParent option, the new task is not synchronized with the outer task in any special way. Such tasks are called a detached nested task. The following example shows a task that creates one detached nested task. var outer = Task.Factory.StartNew(() => { Console.WriteLine("Outer task beginning."); var child = Task.Factory.StartNew(() => { Thread.SpinWait(5000000); Console.WriteLine("Detached task completed."); }); }); outer.Wait(); Console.WriteLine("Outer task completed."); /* Output: Outer task beginning. Outer task completed. Detached task completed. */ Note that the outer task does not wait for the nested task to finish. When user code that is running in a task creates a task with the AttachedToParent option, the new task is known as a child task of the originating task, which is known as the parent task. You can use the AttachedToParent option to express structured task parallelism, because the parent task implicitly waits for all child tasks to finish. The following example shows a task that creates one child task: var parent = Task.Factory.StartNew(() => { Console.WriteLine("Parent task beginning."); var child = Task.Factory.StartNew(() => { Thread.SpinWait(5000000); Console.WriteLine("Attached child completed."); }, TaskCreationOptions.AttachedToParent); }); parent.Wait(); Console.WriteLine("Parent task completed."); /* Output: Parent task beginning. Attached task completed. Parent task completed. */ A task can use the DenyChildAttach option to prevent other tasks from attaching to the parent task. For more information, see Nested Tasks and Child Tasks. The System.Threading.Tasks.Task type and System.Threading.Tasks.Task<TResult> type provide several overloads of a Task.Wait and Task<TResult>.Wait method that enable you to wait for a task to finish. In addition, overloads of the static Task.WaitAll method and Task.WaitAny method let you wait for any or all of an array of tasks to finish. Typically, you would wait for a task for one of these reasons: The main thread depends on the final result computed by a task. You have to handle exceptions that might be thrown from the task. The following example shows the basic pattern that does not involve exception handling. For an example that shows exception handling, see How to: Handle Exceptions Thrown by Tasks. Some overloads let you specify a time-out, and others take an additional CancellationToken as an input parameter, so that the wait itself can be canceled either programmatically or in response to user input. When you wait for a task, you implicitly wait for all children of that task that were created by using the TaskCreationOptions AttachedToParent option. Task.Wait returns immediately if the task has already completed. Any exceptions raised by a task will be thrown by a Wait method, even if the Wait method was called after the task completed. For more information, see How to: Wait on One or More Tasks to Complete. The Task and Task<TResult> classes provide several methods that can help you compose multiple tasks to implement common patterns and to better use the asynchronous language features that are provided by C#, Visual Basic, and F#. This section describes the WhenAll, WhenAny, Delay, and FromResult<TResult> methods. The Task.WhenAll method asynchronously waits for multiple Task or Task<TResult> objects to finish. It provides overloaded versions that enable you to wait for non-uniform sets of tasks. For example, you can wait for multiple Task and Task<TResult>, objects to complete from one method call. The Task.WhenAny method asynchronously waits for one of multiple Task or Task<TResult> objects to finish. As in the Task.WhenAll method, this method provides overloaded versions that enable you to wait for non-uniform sets of tasks. The WhenAny method is especially useful in the following scenarios. Redundant operations. Consider an algorithm or operation that can be performed in many ways. You can use the WhenAny method to select the operation that finishes first and then cancel the remaining operations. Interleaved operations. You can start multiple operations that must all finish and use the WhenAny method to process results as each operation finishes. After one operation finishes, you can start one or more additional tasks. Throttled operations. You can use the WhenAny method to extend the previous scenario by limiting the number of concurrent operations. Expired operations. You can use the WhenAny method to select between one or more tasks and a task that finishes after a specific time, such as a task that is returned by the Delay method. The Delay method is described in the following section. The Task.Delay method produces a Task object that finishes after the specified time. You can use this method to build loops that occasionally poll for data, introduce time-outs, delay the handling of user input for a predetermined time, and so on. By using the Task.FromResult<TResult> method, you can create a Task<TResult> object that holds a pre-computed result. This method is useful when you perform an asynchronous operation that returns a Task<TResult> object, and the result of that Task<TResult> object is already computed. For an example that uses FromResult<TResult> to retrieve the results of asynchronous download operations that are held in a cache, see How to: Create Pre-Computed Tasks. When a task throws one or more exceptions, the exceptions are wrapped in a AggregateException. That exception is propagated back to the thread that joins with the task, which is typically the thread that is waiting for the task to finish or accesses the Result property. This behavior serves to enforce the .NET Framework policy that all unhandled exceptions by default should tear down the process. The calling code can handle the exceptions by using the Wait, WaitAll, or WaitAny method or the Result property on the task or group of tasks, and enclosing the Wait method in a try-catch block. The joining thread can also handle exceptions by accessing the Exception property before the task is garbage-collected. By accessing this property, you prevent the unhandled exception from triggering the exception propagation behavior which tears down the process when the object is finalized. For more information about exceptions and tasks, see Exception Handling (Task Parallel Library) and How to: Handle Exceptions Thrown by Tasks. The Task class supports cooperative cancellation and is fully integrated with the System.Threading.CancellationTokenSource class and the System.Threading.CancellationToken class, which are new in the .NET Framework 4. Many of the constructors in the System.Threading.Tasks.Task class take a CancellationToken as an input parameter. Many of the StartNew and Run overloads also take a CancellationToken. You can create the token, and issue the cancellation request at some later time, by using the CancellationTokenSource class. Pass the token to the Task as an argument, and also reference the same token in your user delegate, which does the work of responding to a cancellation request. For more information, see Task Cancellation and How to: Cancel a Task and Its Children. The TaskFactory class provides static methods that encapsulate some common patterns for creating and starting tasks and continuation tasks. The most common pattern is StartNew, which creates and starts a task in one statement. When you create continuation tasks from multiple antecedents, use the ContinueWhenAll method orContinueWhenAny method or their equivalents in the Task<TResult> class. For more information, see Continuation Tasks. To encapsulate Asynchronous Programming Model BeginX and EndX methods in a Task or Task<TResult> instance, use the FromAsync methods. For more information, see TPL and Traditional .NET Framework Asynchronous Programming. The default TaskFactory can be accessed as a static property on the Task class or Task<TResult> class. You can also instantiate a TaskFactory directly and specify various options that include a CancellationToken, a TaskCreationOptions option, a TaskContinuationOptions option, or a TaskScheduler. Whatever options are specified when you create the task factory will be applied to all tasks that it creates, unless the Task is created by using the TaskCreationOptions enumeration, in which case the task's options override those of the task factory. In some cases, you may want to use a Task to encapsulate some asynchronous operation that is performed by an external component instead of your own user delegate. If the operation is based on the Asynchronous Programming Model Begin/End pattern, you can use the FromAsync methods. If that is not the case, you can use the TaskCompletionSource<TResult> object to wrap the operation in a task and thereby gain some of the benefits of Task programmability, for example, support for exception propagation and continuations. For more information, see TaskCompletionSource<TResult>. Most application or library developers do not care which processor the task runs on, how it synchronizes its work with other tasks, or how it is scheduled on the System.Threading.ThreadPool. They only require that it execute as efficiently as possible on the host computer. If you require more fine-grained control over the scheduling details, the Task Parallel Library lets you configure some settings on the default task scheduler, and even lets you supply a custom scheduler. For more information, see TaskScheduler. The TPL has several new public types that are useful in both parallel and sequential scenarios. These include several thread-safe, fast and scalable collection classes in the System.Collections.Concurrent namespace, and several new synchronization types, for example, System.Threading.Semaphore and System.Threading.ManualResetEventSlim, which are more efficient than their predecessors for specific kinds of workloads. Other new types in the .NET Framework 4, for example, System.Threading.Barrier and System.Threading.SpinLock, provide functionality that was not available in earlier releases. For more information, see Data Structures for Parallel Programming. We recommend that you do not inherit from System.Threading.Tasks.Task or System.Threading.Tasks.Task<TResult>. Instead, we recommend that you use the AsyncState property to associate additional data or state with a Task or Task<TResult> object. You can also use extension methods to extend the functionality of the Task and Task<TResult> classes. For more information about extension methods, see Extension Methods (C# Programming Guide) and Extension Methods (Visual Basic). If you must inherit from Task or Task<TResult>, you cannot use Run, Run, or the System.Threading.Tasks.TaskFactory, System.Threading.Tasks.TaskFactory<TResult>, or System.Threading.Tasks.TaskCompletionSource<TResult> classes to create instances of your custom task type because these mechanisms create only Task and Task<TResult> objects. In addition, you cannot use the task continuation mechanisms that are provided by Task, Task<TResult>, TaskFactory, and TaskFactory<TResult> to create instances of your custom task type because these mechanisms also create only Task and Task<TResult> objects.
http://msdn.microsoft.com/en-us/library/dd537609(v=vs.110).aspx
CC-MAIN-2013-20
en
refinedweb
Books ; Free Struts Books The Apache... Servlet and Java Server Pages (JSP) technologies.  ... for you Java programmers who have some JSP familiarity, but little or no prior Sample\Practice project on JSP and Web services Sample\Practice project on JSP and Web services I wanted to implement\Practice a project using web services. where can I get these details Please visit the following link: Java Programming Books Java Programming Books  ..., Enterprise Edition. This book, and the accompanying Java Pet Store sample... open Java standards model for Java? Servlet, JavaServer Pages? (JSP?), Enterprise Sample program of JSP Sample program of JSP <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" " Project in jsp Project in jsp Hi, I'm doing MCA n have to do a project 'Attendance Consolidation' in JSP.I know basic java, but new to jsp. Is there any JSP source code available for reference...? pls help me" " Java Free download Java Free download Hi, What is the url for downloading Java for free? Is java Free? Can I get the url to download Java without paying anything? Actually I am student and learning Java. I have to download and install Java on my java/jsp code to download a video java/jsp code to download a video how can i download a video using jsp/servlet . Books of Core java Server Faces... to Java developers working in J2SE with a JSP/Servlet engine like Tomcat, as well...JSF Books   JSP&Servlet application required? - JSP-Servlet sample JSP&Servlet application required? hey all iam new... tutorial or a project that integrate both jsp&servlets any help? Hi JSP PDF books ; The free servlet and JSP Books Slides and exercises from Marty Hall's world...JSP PDF books Collection is jsp books in the pdf format sample jsp-servlet-service-db program sample jsp-servlet-service-db program <%@ page language="java...; <%@ page language="java" contentType="text/html; charset...; <%@ page language="java" contentType="text/html; charset=ISO-8859-1 My Favorite Java Books Java NotesMy Favorite Java Books My standard book questions When I think... language and want to learn Java, these are good books. Head First Java.... Favorite Java books from JavaLobby poll I've extracted many of the books from jsp tables are required in SQL for online examination system project in jsp in java my email id is [email protected] EJB Books ; Java for the Web with Servlets, JSP, and EJB This is a big... EJB Books Professional EJB Books Written online examination system project in jsp online examination system project in jsp I am doing project in online examination system in java server pages. plz send me the simple source code in jsp for online examination system My emailid is [email protected] server Faces Books Java server Faces Books  ...; Store-Java Buy two books direct from O'Reilly and get the third free by using code OPC10 in our shopping cart. This deal includes books Download file - JSP-Servlet Servlet download file from server I am looking for a Servlet download file example File Download in jsp File Download in jsp file upload code is working can u plz provide me file download | - JSP-Servlet download here is the code in servlet for download a file. while...; /** * * @author saravana */ public class download extends HttpServlet...(); System.out.println("inside download servlet"); BufferedInputStream Java XML Books ; Free Java XML Books... Java XML Books Java and XML Books One night java project java project Connecting to MySQL database and retrieving and displaying data in JSP page by using netbeans Java & JEE books Page11 Java & JEE books Page11 Herong's Tutorial Notes on JVM Java HotSpot VM is developed by Sun.... JSP and JSTL Tutorials This free JSP and JSTL download image using url in jsp download image using url in jsp how to download image using url in jsp Ajax Books Java+XML books under his belt and the Freemans are responsible for the excellent... Ajax Books AJAX - Asynchronous JavaScript and XML - some books and resource links These books upload and download files - JSP-Servlet upload and download files HI!! how can I upload (more than 1 file) and download the files using jsp. Is any lib folders to be pasted? kindly... and download files in JSP visit to : php download free php download free From where i download php free. jsp jsp hai sir, i have to send the data which i have in hrid table to data base and at the same time to the next form . i will give u the code. first form(project Manager.jsp) <%@ page language = "java" import = "java.sql. Need E-Books - JSP-Servlet How do i start to create Download Manager in Java - JSP-Servlet How do i start to create Download Manager in Java Can you tell me from where do i start to develop Download manager in java project project Sir, I have required coding and design for bank management system in php mysql. I hope u can give me correct information. Please visit the link: JSP Bank Application The above link will be helpful for you Java Projects - Servlet Interview Questions Free Java Projects Hi All, Can any one send the List of WebSites which will provide free JAVA projects with source code on "servlets" and "Jsp" relating to Banking Sector? don't know JSP Tutorials ; Free JSP Books Download the following JSP books. Free JSP Download BooksFree JSP Books for instant downloads... with working source code. Introduction to JSP Java Server Pages Oracle 9i free download Oracle 9i free download where to download oracle 9i for database connectivity in j2ee Send Email From JSP & Servlet J2EE Tutorial - Send Email From JSP & Servlet... (java servlet development kit). (We are using Tomcat server. ... and JSP . It is a joint effort by SunMicroSystems & Apache JSP Tutorials Resource - Useful Jsp Tutorials Links and Resources . You should be able to program in Java. This tutorial teaches JSP...; Introduction To JSP Java Server Pages... is based on Java, an object-oriented language. JSP offers a robust platform project query project query I am doing project in java using eclipse..My project is a web related one.In this how to set sms alert using Jsp code. pls help me Introduction to the JSP Java Server Pages ; Free JSP Books Download the following JSP books. Free JSP Download BooksFree JSP Books for instant downloads.... Introduction to JSP Java Server Pages or JSP for short is Sun's MySQL Books MySQL Books List of many MySQL books. MySQL Books Hundreds of books and publications related to MySQL are in circulation that can help you get the most of out MySQL. These books Java & JEE books Page16 Java & JEE books Page16  ... to programming using java is a free on line textbook. It is suitable for use... The Java 2 Platform, Enterprise Edition (J2EE), has rapidly established a new JAVA JAZZ UP - Free online Java magazine JAVA JAZZ UP - Free online Java magazine Our this issue contains: Java Jazz Up Issue 1 Index Java Around the Globe Using Java means a better user project - Java Beginners java project project for internet banking Hi friend, I am sending you a link. This link will help you. Please visit for more information. Thanks Project - JSP-Servlet Project Can you send me the whole project on jsp or servlet so that i can refer it to create my own : the topic is Advertisement Management System Atleast tell me how many modules does it include MINI PROJECT MINI PROJECT CAN ANYONE POST A MINI PROJECT IN JAVA? Hi... You can have the following projects as per ur requirement. Free and easy to download.. All projects are JAVA based Sale and purchase in java swing Java Misc.Online Books Misc.Online Books  ... vision of a software project is dealing with one's coworkers and customers..., C++, or Java. We show how the particular core concepts are realized about project code - Java Beginners about project code Respected Sir/Mam, I need to develop an SMS... or programs. User interface: Web based. Technology: JSP ,servlets User interface.... This can be developed using any kind of components using JAVA. The following Ask Questions? If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for. Ask your questions, our development team will try to give answers to your questions.
http://roseindia.net/tutorialhelp/comment/99871
CC-MAIN-2013-20
en
refinedweb
Mar 12, 2008 01:47 AM|LINK Hi folks, i've got the following code, which works. <%= Html.RenderUserControl("/views/shared/Membership.ascx") %> Ok.. nothing fancy .. some html is rendered to the screen .. kewl. So i tried to do the following... <%= Html.RenderUserControl<MyNamespace.BlahBlah.Views.Shared.Membership>(null, null) %> and nothing gets rendered. hmm. Why would this be? The first line is the exact same class as the type listed in the < T > section. Secondly, the Html.RenderUserControl<T> takes TWO arguments, a) object controlData b) object propertySettings the controlData is any data that the control needs to use, to help it render out. I see that as the view data for that control. If there's no view data, then i can assume i set this as null. But what are PropertySettings? I have no idea, so i'm assuming i set that to null. Mar 13, 2008 10:12 PM|LINK *polite bump* :) Member 432 Points Microsoft Mar 17, 2008 10:39 AM|LINK [1] I guess RenderUserControl<T> fails becase it's instantiating the control's code-behind class (not the subclass defined by the ASCX file), so there'll be nothing for it to render. You could argue that it's expected behavior (since you're supplying T=code-behind-class, it's your own fault), but lots of people are going to be confused by this. What do others think - would you call it a bug? [2] If you supply any values as propertySettings, they'll be applied to any public properties exposed by the control class. Set it to NULL if you don't have any properties you want to set. Mar 18, 2008 06:25 AM|LINK I've made sure that the class <T> is the view class by writing out the full namespace :( has anyone else had any luck with RenderUserControl<T> ? also, how does RenderUserControl compare to RenderComponent? Member 432 Points Microsoft Mar 18, 2008 08:30 AM|LINK pure.kromeI've made sure that the class <T> is the view class by writing out the full namespace :( PK, are you sure? It's not a matter of namespace. Do you understand the difference between the code-behind class and the ASCX class that doesn't even exist until in-server compilation? If you write RenderUserControl<My.Project.Namespace.MyViewUserControl>(null, null), it's just going to render a blank, because the code-behind class probably doesn't contain any instructions to render anything. The only way to make it work is to reference the ASCX class which has a horrible name like RenderUserControl<ASP.views_home_myviewusercontrol_ascx>(null, null). I'd suggest the RenderUserControl<T> overload should be removed, because this is just going to cause no end of confusion. I can't think of any way it could be easier to use, given that you can have multiple ASCX files "inheriting" the same code-behind class. Member 171 Points Mar 18, 2008 09:27 AM|LINK SteveSandersononly way to make it work is to reference the ASCX class which has a horrible name like RenderUserControl<ASP.views_home_myviewusercontrol_ascx>(null, null) I've yet to test this out, so thanks for this hint, as just like pure.krome I had a couple of blank moments, rendering empty user controls. SteveSandersonI'd suggest the RenderUserControl<T> overload should be removed Though I really hope some form of strongly typed RenderUserControl method remains. This specific issue, I'd really like to see some advice from the MVC team. It is confusing. I'd assumed I'd just got the naming convention wrong for the ascx file in the Shared folder. Mar 18, 2008 06:46 PM|LINK I apologize for the confusion here - this would be my fault, entirely. One of the things I had planned to do was to strip out the typed RenderUserControl since, as you mention, it didn't actually render. It was sloppy on my part and I've just sent Eilon (the lead dev) a note to be sure to remove. Again - sorry about the confusion, my fault entirely. Rob Mar 19, 2008 01:22 AM|LINK Hi guys, @StevenSanderson: err.. *blush* i'll need to double check but what your saying does make sence though .. *blush*. Blonde moment (again!) @Rob: kewlies.. i'll not use it then if it will be removed from future versions @Rob (again ... or anyone else): how does RenderUserControl compare to RenderComponent? cheers :) 7 replies Last post Mar 19, 2008 01:22 AM by pure.krome
http://forums.asp.net/p/1232257/2241399.aspx/1?Re+Html+RenderUserControl+vs+Html+RenderUserControl+lt+T+gt+
CC-MAIN-2013-20
en
refinedweb
Creating InfoPath Form Templates That Work With Forms Services Browser-compatible forms deployed to Microsoft Office Forms Server 2007 and Microsoft Office SharePoint Server 2007 with InfoPath Forms Services support features and controls that cover the majority of InfoPath form usage scenarios. However, browser-compatible forms delivered by InfoPath Forms Services do not support all InfoPath features. Some features and controls are not implemented on the server. Other features do not have a meaningful representation on the server. The sections that follow specify which features are supported in browser-compatible forms, which features cannot be used in browser-compatible forms, and which features can be specified for browser-compatible forms, but will not function in a Web browser. Features Supported by Both InfoPath and InfoPath Forms Services The following sections list the features that are supported by browser-compatible form templates deployed to InfoPath Forms Services that can open in both InfoPath and the browser. Controls The following controls are supported in form templates that can be opened both InfoPath and the browser. Text Box Rich Text Box (only editable in Microsoft Internet Explorer) Drop-Down List Box List Box Date Picker (Rendered as a text box on browsers other than Internet Explorer) Check Box Option Button Button Section Optional Section Repeating Section Repeating Table File Attachment Hyperlink Expression Box Declarative Features Other declarative features that work in both InfoPath and the browser: Rules Calculations Validation Business logic code must be based on the InfoPath managed code object model provided by the Microsoft.Office.InfoPath namespace. Business logic code running on the server is subject to the following restrictions: Because each server request may be handled by a different front end and because InfoPath Forms Services will load only one instance of the business logic, programmers cannot rely on data stored in global or static variables. To accommodate this, business logic must store state into a property bag, access to which is provided by the FormState property. A subset of the members of the Microsoft.Office.InfoPath namespace provide features, such as Information Rights Management (IRM), that are not supported on the server. For more information on which object model members are and are not supported, see the "Object Model Members that Work in InfoPath and InfoPath Forms Services" and "Object Model Members that Work Only in InfoPath" sections later in this topic. Business logic written in VBScript, JScript, and the InfoPath 2003-compatible object model provided by members of the Microsoft.Office.Interop.InfoPath.SemiTrust namespace is not supported on the server. Features Not Supported by InfoPath Forms Services The following sections list the features that are not supported by browser-compatible form templates deployed to InfoPath Forms Services that can open in both InfoPath and the browser. When using the Design Checker feature in InfoPath design mode to confirm compatibility with InfoPath Forms Services, features that are not supported will produce either errors or messages. Features that produce errors will prevent the form template from being published as a browser-enabled form. Features that produce messages are allowed, but that particular feature will not run when the form is opened in a browser. Controls The following controls and control features are not supported in form templates that can be opened both InfoPath and the browser. Filters on repeating controls Master/Detail Vertical Label Horizontal Repeating Table Combo Box Multiple-Select List Box Picture Ink Picture Plain List Bulleted List Choice Section Choice Group Repeating Choice Group Repeating Recursive Section Other Features That are Not Supported or Not Fully Supported by InfoPath Forms Services Other features that are not supported on InfoPath Forms Services: ActiveX Controls HTML Taskpanes Placeholder text in controls. For example, "Click here to enter text" (no text is shown in the browser) Database data connections are limited to read-only access to SQL server databases User roles Digital signature extensibility through the object model. Digitally signing on the server is supported through an ActiveX control which runs only in Microsoft Internet Explorer. Human Workflow Services (HWS) integration. HWS has been deprecated by BizTalk server XML Schema error message overrides. This is a rarely used feature which allows the form designer to provide a different message than the one provided by MSXML or System.Xml when a document doesn't validate (generally because of a type mismatch). This feature is not supported in the designer user interface and requires hand editing of the form definition (.xsf) file. Features with No Direct Parallel on the InfoPath Forms Services Other features that are not supported on InfoPath Forms Services: Pop-up dialogs during modeless validation Outlook Integration COM Add-Ins Merge Forms Auto-Save, Crash Detection and Recovery Mail Envelope Export to Excel Tablet / Ink Features including Ink Picture control Undo / Redo Information Rights Management (IRM) Modal dialogs from business logic XSLT extensibility (xd:preserve blocks) External automation Offline query caching Spell-checking Restricted security mode Object Model Members that Work in Both InfoPath and InfoPath Forms Services InfoPath provides a new managed-code object model with a core set of functionality for creating custom business logic in form templates. When deployed to Microsoft Office Forms Server 2007 or to Office SharePoint Server 2007 with InfoPath Forms Services, business logic created using this new object model will run in both a Web browser and in InfoPath. Optionally, you can write business logic that uses an additional level of functionality available from this object model that will run only in form templates opened for editing in Office InfoPath 2007. To write business logic that will run when a form is opened in both a Web browser and in InfoPath, select the Enable browser-compatible features only check box on the Design a Form Template dialog box when creating a new form template. To write business logic that can use additional functionality only when opened in InfoPath, clear the Enable browser-compatible features only check box when creating a new form template. You can also change this setting after creating a form template, by clicking Change Compatibility Settings on the Design Checker task pane, and then selecting or clearing the Design a form template that can be opened in a browser or InfoPath check box. If you choose to create a browser-compatible form template, the compiler will display an error if you have used any classes or members that are not compatible with InfoPath Forms Services. The following classes and members of the InfoPath managed code object model provided by the Microsoft.Office.InfoPath namespace are supported in both InfoPath and InfoPath Forms Services. Object Model Members that Work Only in InfoPath The following classes and members of the InfoPath managed code object model provided by the Microsoft.Office.InfoPath namespace are supported only in Office InfoPath 2007.
http://msdn.microsoft.com/en-us/library/aa945450(VS.80).aspx
CC-MAIN-2013-20
en
refinedweb
Try it: Convert data from one type to another A value converter is a convenient way to convert data from one type to another. When you bind a property value of an object in Microsoft Expression Blend to a data value or to another property value, the value types must match. For example, you might want to convert a text box string such as "123" to its corresponding integer value for a slider bar, or convert a property such as Visibility.Hidden to a Boolean value such as false. A value converter implements the IValueConverter interface in code in a Microsoft .NET Framework class. Both the Convert and ConvertBack methods must be implemented because the data binding engine calls these methods when it moves a value between the binding source and the binding destination. For more information, see IValueConverter Interface on MSDN. To apply a value converter, complete the Value Converter field in the CreateDataBinding dialog box when you are binding data to a property. This procedure provides an example of a .NET class, written in C#, that can be added only to a project that already uses C# for its code-behind files. However, there is more than one way to add code to a project. You could alternatively use Microsoft Visual Studio to compile the class into a .dll and then add a reference to the .dll file in your project. For more information, see Add or remove a reference. Right-click your project in the Projects panel, and then click Add New Item. In the New Item dialog box, click Class, enter DoubleValueConverter.cs in the Name field, and then click OK. A new code file is created, in the language that your solution is using. For the purposes of this procedure, this language is C#. The file is added to your project and opened on the artboard. In the DoubleValueConverter.cs file, delete the following class definition: Replace the deleted code with the following code, which contains the following two value converter classes: DoubleToIntegerValueConverter Provides a two-way conversion between a double value and an integer. DoubleToRomanNumeralValueConverter Provides a one-way conversion from a double value to a string representation of a Roman numeral. /// <summary> /// DoubleToIntegerValueConverter provides a two-way conversion between /// a double value and an integer. /// </summary> public class DoubleToIntegerValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return System.Convert.ToInt32(value); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return System.Convert.ToDouble(value); } } /// <summary> /// DoubleToRomanNumeralValueConverter provides a one-way conversion from /// a double value to a string representation of a Roman numeral. /// </summary> public class DoubleToRomanNumeralValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return this.ConvertToRomanNumeral(System.Convert.ToInt32(value)); } public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return null; } private List<IntegerStringPair> romanStrings = null; private string ConvertToRomanNumeral(int input) { StringBuilder myBuilder = new StringBuilder(); foreach (IntegerStringPair thisPair in this.PairSet) { while (input >= thisPair.Value) { myBuilder.Append(thisPair.StringValue); input -= thisPair.Value; } } return myBuilder.ToString(); } private List<IntegerStringPair> PairSet { get { if (this.romanStrings == null) { this.romanStrings = new List<IntegerStringPair>(); this.romanStrings.Add(new IntegerStringPair(1000, "M")); this.romanStrings.Add(new IntegerStringPair(900, "CM")); this.romanStrings.Add(new IntegerStringPair(500, "D")); this.romanStrings.Add(new IntegerStringPair(400, "CD")); this.romanStrings.Add(new IntegerStringPair(100, "C")); this.romanStrings.Add(new IntegerStringPair(90, "XC")); this.romanStrings.Add(new IntegerStringPair(50, "L")); this.romanStrings.Add(new IntegerStringPair(40, "XL")); this.romanStrings.Add(new IntegerStringPair(10, "X")); this.romanStrings.Add(new IntegerStringPair(9, "IX")); this.romanStrings.Add(new IntegerStringPair(5, "V")); this.romanStrings.Add(new IntegerStringPair(4, "IV")); this.romanStrings.Add(new IntegerStringPair(1, "I")); } return this.romanStrings; } } } /// <summary> /// IntegerStringPair provides an easy way to store integer and string pairs. /// </summary> public class IntegerStringPair { private int value; private string stringValue; public int Value { get { return this.value; } } public string StringValue { get { return this.stringValue; } } public IntegerStringPair(int value, string stringValue) { this.value = value; this.stringValue = stringValue; } } Build (CTRL+SHIFT+B) your solution to see if there are any errors. In the following procedure, the value converters in the preceding procedure are applied to the value of a Slider object when the value is bound to two TextBox objects. The result is that the text boxes display the integer and Roman numeral representations of the Slider value. as follows: two text box controls on the artboard next to the slider object. With the first text box object selected, locate the Text property under Common Properties in the Properties panel. You will bind the Text property to the value of the slider. Click Advanced property options , and then click Data Binding from the list that appears. In the Create Data Binding dialog box, click the Element Property tab. This is where you bind internal values to properties. Expand the tree of elements under Scene elements, and then select the [Slider] object. Under Properties, select Value : (Double). This binds the content of the text box to the value of the slider. Click Show advanced properties , and then, next to Value converter, click Add new value converter . In the Add Value Converter dialog box, select DoubleToIntegerValueConverter, and then click OK. In the Create Data Binding dialog box, click OK. The first Label object will now display an integer representation of the slider. Repeat steps 6 through 13 with the second text box, but this time, select DoubleToRomanNumeralValueConverter in the Add Value Converter dialog box. Run your project (F5). Move the slider to see the values updated in the two labels. Without using the value converter, a text box that displays the value of a slider would display many decimal places.
http://msdn.microsoft.com/en-us/library/cc295312(v=expression.30).aspx
CC-MAIN-2013-20
en
refinedweb
24 June 2005 04:43 [Source: ICIS news] SINGAPORE (CNI)--One of the key issues confronting the chlorine industry is the release of Persistent Organic Pollutants (POPs) into the environment, which anti-industry activists have long been campaigning against, Robert Simon, senior director of International Affairs at the World Chlorine Council (WCC) said. Speaking at the 9th Asian Chlor-alkali Conference, Simon said that there have been recent developments in the industry that should allay such concerns. Levels of by-products released by chlorine processes have decreased by more than 90% in several countries in the past year, he said. ?xml:namespace> He pointed out dioxin air emissions (DAE) from industrial sources fell to less than 500 grams in 2004 from over 12,000 grams in 1987. This is vastly contrasted with the DAE from the burning of natural resources, which nearly doubled to 2,000 grams in 2004 as compared with 1987. “Levels of dioxin in the environment have been declining even though polyvinyl chloride (PVC) production has been increasing in the past few years,” he said. However, in spite of the positive trends, he said that the WCC is committed to the Stockholm Convention and supports the treaty. The Stockholm Convention represents an obligation for countries to reduce, and where feasible, eliminate by-products in the industrial production. The treaty is expected to be implemented in most countries by 2006. The 9th Asian Chlor-alkali Conference is organised by Asian Chemical News (ACN)* and Tecnon Orbichem. The event concludes on Friday. *ACN.
http://www.icis.com/Articles/2005/06/24/687520/asian+chlor-alkali+pops+a+key+issue+to+chlorine+industry.html
CC-MAIN-2013-20
en
refinedweb
MoveClass MoveClass Moveclass. Puzzleand Moveinterface. Puzzleinterface, you'll need to support the functions that we've used in our generic puzzle solver routines. /** A simple puzzle. */ public interface Puzzle { /** List all the legal moves from the current state. */ public Iterator moves(); /** Make a legal move */ public void makeMove(Move m) throws Exception; /** Reset the puzzle to its initial state */ public void reset(); /** Check if the puzzle is solved. */ } // Puzzle Moveinterface? Well, since moves are puzzle-specific, perhaps nothing. makeMove(Move m)in our Puzzleinterface. package coinpuzzle; ... public class CoinPuzzleMove implements Move { /** The position of the coin that we're moving. */ int position; /** The direction in which we're moving it. int direction; } // CoinPuzzleMove CoinPuzzleclass package coinpuzzle; // Permit direct access to the fields of the move ... public class CoinPuzzle implements Puzzle { ... public void makeMove(Move m) throws Exception { CoinPuzzleMove cpm; // Convert the move if (m instanceof CoinPuzzleMove) { cpm = (CoinPuzzleMove) m; } else { throw new Exception("Illegal type of move"); } // Verify that the move is legal if (!legal(cpm)) { throw new Exception("Illegal move"); } // Make the move coin = topCoin(cpm.position); removeTopCoin(cpm.position); placeCoin(coin,newPosition(cpm.position,cpm.direction)); } // makeMove ... } // CoinPuzzle implementsinstead of extedns). Stackclass that works on Objects, we can use it for any subclass of Object. sort()routine that works for any list of comparable objects, we can use it for any comparable objects. staticbefore the callee? static! Integerclass, but doesn't have an associated Integerobject. main()method is associated with the class as a whole, but not with particular objects in the class. statickeyword. value(). What value are you requesting? The value of the last object you used? The value of some random object? Something completely different. removeLeast()as efficient as possible. insert()as efficient as possible. OrderedVectorclass. removeLeast()removes the first element. insert()is then an O(n) operation as we may have to shift all the elements to insert an element in the "correct" place. removeLeast()is also an O(n) operation, as we need to shift everything left after the removal. removeLeast()removes the last element. insert()is still an O(n) operation as we may still have to shift. removeLeast()becomes an O(1) operation. min()routine to find the smallest element. insert()is either O(1) or O(n), depending on whether or not we have to grow the vector. removeLeast()is now an O(n) operation. Disclaimer Often, these pages were created "on the fly" with little, if any, proofreading. Any or all of the information on the pages may be incorrect. Please contact me if you notice errors. Source text last modified Wed Nov 12 14:26:34 1997. This page generated on Wed Nov 12 14:28:21 1997 by SiteWeaver. Contact our webmaster at [email protected]
http://www.math.grin.edu/~rebelsky/Courses/152/97F/Outlines/outline.37.html
CC-MAIN-2013-20
en
refinedweb
custom function in Ext.application not working after build package custom function in Ext.application not working after build package I need a global variable in my views and store. after searching the forum I found this solution: Code: Ext.application({ name: 'PhotoMoonTool', .... getSection: function() { url_args = window.location.toString().split("?"); if (url_args[1]) { url_args = Ext.Object.fromQueryString(url_args[1]); return url_args.section + '/'; } else { return ''; } } .... }); Code: .... itemTpl: [ '<img src="'+ PhotoMoonTool.app.getSection() +'images/{folder_name}/{img_name}001{name_zusatz}.jpg" >' + ] .... and but if I build a webapp ("sencha app build package" or "sencha app build production") I get some errors (getSection is not defined). see here: and (this is production) any hint how I can solve this? thanks a lot. j - Join Date - Mar 2007 - Location - Frederick MD, NYC, DC - 16,167 - Vote Rating - 29 That's because your classes are defined before the application actually gets instantiated. You should elevate such required methods into a utils namespace. Include that before any other classes, and it will work fine. I did this for both the SenchaCon 2011 and DiscoverMusic applications.. Thank you for reporting this bug. We will make it our priority to review this report.
http://www.sencha.com/forum/showthread.php?200553-custom-function-in-Ext.application-not-working-after-build-package&p=793783
CC-MAIN-2013-20
en
refinedweb
umask(2) umask(2) NAME [Toc] [Back] umask - set and get file creation mask SYNOPSIS [Toc] [Back] #include <sys/stat.h> mode_t umask(mode_t cmask); DESCRIPTION [Toc] [Back] umask() sets the process's file mode creation mask to umask() and returns the previous value of the mask. Only the file access permission bits of the masks are used. The bits set in cmask specify which permission bits to turn off in the mode of the created file, and should be specified using the symbolic values defined in stat(5). EXAMPLES [Toc] [Back] The following creates a file named path in the current directory with permissions S_IRWXU|S_IRGRP|S_IXGRP, so that the file can be written only by its owner, and can be read or executed only by the owner or processes with group permission, even though group write permission and all permissions for others are passed in to creat(). #include <sys/types.h> #include <sys/stat.h> int fildes; (void) umask(S_IWGRP|S_IRWXO); fildes = creat("path", S_IRWXU|S_IRWXG|S_IRWXO); RETURN VALUE [Toc] [Back] The previous value of the file mode creation mask is returned. SEE ALSO [Toc] [Back] mkdir(1), sh(1), mknod(1M), chmod(2), creat(2), mknod(2), open(2). STANDARDS CONFORMANCE [Toc] [Back] umask(): AES, SVID2, SVID3, XPG2, XPG3, XPG4, FIPS 151-2, POSIX.1 Hewlett-Packard Company - 1 - HP-UX 11i Version 2: August 2003
http://nixdoc.net/man-pages/HP-UX/man2/umask.2.html
CC-MAIN-2013-20
en
refinedweb
strchr - string scanning operation #include <string.h> char *strchr(const char *s, int c); The strchr() function locates the first occurrence of c (converted to an unsigned char) in the string pointed to by s. The terminating null byte is considered to be part of the string. Upon completion, strchr() returns a pointer to the byte, or a null pointer if the byte was not found. No errors are defined. None. None. None. strrchr(), <string.h>. Derived from Issue 1 of the SVID.
http://pubs.opengroup.org/onlinepubs/7908799/xsh/strchr.html
CC-MAIN-2013-20
en
refinedweb
When planning for a new Active Directory (AD) or upgrade AD, or merging AD one of the topics that will get on the table is planning DNS. DNS is the Domain Naming system, used to translate names into network (IP) addresses. Certainly this is the case if you need to plan for integration with an extranet, DMZ (demilitarized zone, typically between intranet and internet), or publishing website and applications: Below more detailed explanation. Luckily enough there is some nice reading material out there to prove the statement, so make sure you bookmark this page ;) But first we need to clarify a few things... 'internal', See here for more explanation: You can also 'unlink' the AD domain name from the DNS name, then you get a disjoint namespace, as explained in previous link. For Example Check this forum discussion: And also: But also for documentation some 2nd level domains are reserved: Some customers use the same DNS zone for internal and external usage. But there are some important disadvantages: You might face some practical issues like: Plus, you'll face some consequences regarding network security, by the lack of segregation of (DNS) duties. So: Single DNS domain is absolutely not advised when you need to manage internal and external resources. It's completely the opposite of the previous approach. From DNS level, this is fairly simple setup, but you need to duplicate or multiply DNS configurations. And from a user perspective it might be complex or confusing, or not transparent, and inconsistent Design Option Management Complexity Example More complicated than previous option.. To conclude, please find some useful reference info in one spot below: Initially posted at: Note-to-self: DNS naming best practices for internal domains and networks
https://social.technet.microsoft.com/wiki/contents/articles/34981.active-directory-best-practices-for-internal-domain-and-network-names.aspx
CC-MAIN-2021-43
en
refinedweb
Explain React Native? React Native is an open-source JavaScript framework introduced by Facebook. It is used for developing a real, native mobile application for iOS and Android platforms. It uses only JavaScript to build a mobile app. It is like React, which uses native components rather than using web components as building blocks. It is cross-platform, which allows you to write code once and can run on any platform. React Native application is based on React, a JavaScript library developed by Facebook and XML-Esque markup (JSX) for creating the user interface. It targets the mobile platform rather than the browser. It saves your development time as it allows you to build apps by using a single language JavaScript for both Android and iOS platforms. What are the advantages of React Native? React Native provides many advantages for building mobile applications. Some of the essential benefits of using React Native are given below: -. What are the disadvantages of React Native? Some of the big disadvantages of React Native for building mobile applications are given below: -. What is JSX? JSX is a syntax notation for JavaScript XML(XML-like syntax extension to ECMAScript). It stands for JavaScript XML. It provides expressiveness of JavaScript along with HTML like template syntax. For example, the below text inside h1 tag return as javascript function to the render function. render(){ return( <div> <h1> Welcome to React world!!</h1> </div> ); } What are components? Components are the building blocks of any React app and a typical React app will have many of these. Simply put, a component is a JavaScript class or function that optionally accepts inputs i.e. properties(props) and returns a React element that describes how a section of the UI (User Interface) should appear. const Greeting = () => <h1>Hello World today!</h1>; This is a functional component (called Greeting) written using ES6’s arrow function syntax that takes no props and returns an H1 tag with the text “Hello World today!” How to install React Native App in ios? To install React Native, we will have to follow these steps: - Start with installing node and watchman - Then, install React native CLI with npm - Install Xcode and its Command-line tools - Create a React Native project by using the following command - React-native init MyNewProject - cd MyNewProject - react-native run-ios List the essential components of React Native. React native have the following core components: Basic UI components in React Native - View: View in React Native is equivalent to tag in HTML. It is a content area where the actual UI components (Text, Image, TextInput, etc) would be displayed. View is used to organize the content in a good manner - Text: Text is a very basic built-in Component which displays text in the Application - Image: A component for displaying images - TextInput: This component is used to take user input into the App - ScrollView: It is a scrolling container that can host multiple components and views that can be scrolled - StyleSheet: Similar to CSS stylesheets, Provides an abstraction layer similar to CSS stylesheet. User Interface Components in React Native: - Button: A basic button component for handling touches that should render nicely on any platform - Switch: Renders a Boolean input - Slider: A component used to select a single value from a range of values - Picker: Renders the native picker component on iOS and Android ListView Components in React Native: - FlatList: A component for rendering performant scrollable lists - SectionList: Like FlatList, but for sectioned lists Android Specific components in React Native - DatePickerAndroid: Opens the standard Android date picker dialog - DrawerLayoutAndroid: Renders a DrawerLayout on Android - BackHandler: Detect hardware button presses for back navigation - ProgressBarAndroid: Renders a ProgressBar on Android - ToastAndroid: Create an Android Toast alert - ViewPagerAndroid: Container that allows flipping left and right between child views. How many threads run in React Native? The React Native app contains the following thread: -. What are props in React Native?. Example Here, we have created a Heading component, with a message prop. The parent class App sends the prop to the child component Heading. // Parent Component export default class App extends Component { render () { return ( <View style={{alignItems: 'center' > <Heading message={'Custom Heading for Parent class?}/> </View> ) } } // Child component export default class Heading extends Component { render () { return ( <View style={{alignItems: 'center' > <Text>{this.props.message}</Text> </View> ) } } const styles = StyleSheet.create({ welcome: { fontSize: 30, } }); Heading.propTypes = { message: PropTypes.string } Heading.defaultProps = { message: 'Heading One' } What are State in React Native?(). Example Here, we are going to create a Text component with state data. The content of the Text component will be updated whenever we click on it. The event onPress calls the setState function, which updates the state with > ); } } How to run react native app on Android? o run React Native in Android, we have to follow these: - List Step to Create and start a React Native App? The following steps are necessary to create and start a React Native app: Step-1: Install Node.js Step-2: Install react-native environments by using the following command. $ npm install -g create-react-native-app Step-3: Create a project by using the following command. $ create-react-native-app MyProject Step-4: Next, navigate in your project by using the following command. $ cd MyProject Step-5: Now, run the following command to start the project. $ npm start Are all React components usable in React Native? Web React components use DOM elements to display (ex. div, h1, table, etc.), but React Native does not support these. We will need to find libraries/components made specifically for React Native. But today React is focusing on components that can be shared between the web version of React and React Native. This concept has been formalized since React v0.14. How Virtual DOM works in React Native?.. Do we use the same code base for Android and iOS? Yes, we can use the same codebase for Android and iOS, and React takes care of all the native component translations. For example, a React Native ScrollView use ScrollView on Android and UiScrollView on iOS. Can we combine native iOS or Android code in React Native? Yes, we can combine the native iOS or Android code with React Native. It can combine the components written in Objective-C, Java, and Shift. When would you use ScrollView over FlatList or vice-versa? - Do you need to render a list of similar items from an array or the data is very big? Use FlatList - Do you need to render generic content in a scrollable container and the data is small? Use ScrollView How do you dismiss the keyboard in react native? Use built-in Keyboard Module: import { Keyboard } from ‘react-native’; Keyboard.dismiss(); What is AppRegistry? Why is it required early in “require” sequence? AppRegistry is the JS entry point to running all React Native apps. App root components should register themselves with AppRegistry.registerComponent, then the native system can load the bundle for the app and then actually run the app when it’s ready by invoking AppRegistry.runApplication. import { Text, AppRegistry } from 'react-native'; const App = (props) => ( <View> <Text>App1</Text> </View> ); AppRegistry.registerComponent('Appname', () => App); To “stop” an application when a view should be destroyed, call AppRegistry.unmountApplicationComponentAtRootTag with the tag that was passed into runApplication. These should always be used as a pair. AppRegistry should be required early in the require sequence to make sure the JS execution environment is setup before other modules are required. Explain the use of Flexbox in React Native? Flexbox is designed to provide a consistent layout on different screen sizes. It offers three main properties: - flexDirection - justifyContent - alignItems Differentiate between Real DOM and Virtual DOM. What is the difference between React and React Native? The essential differences between React and React Native are: - React is a JavaScript library, whereas React Native is a JavaScript framework based on React. - Tags can be used differently in both platforms. - React is used for developing UI and Web applications, whereas React Native can be used to create cross-platform mobile apps. Which language is used in React Native? Javascript with ES6 syntax support. If you are from android or ios development background, it’s an advantage What are the differences between Class and Functional Component? The essential differences between the class component and functional component are: Syntax: The declaration of both components is different. A functional component takes props, and returns React element, whereas the class components require to extend from React. //Functional Component function WelcomeMessage(props) { return <h1>Welcome to the , {props.name}</h1>; } //Class Component class MyComponent extends React.Component { render() { return ( <div>This is main component.</div> ); } } State: The class component has a state while the functional component is stateless. Lifecycle: The class component has a lifecycle, while the functional component does not have a lifecycle. How React Native handle different screen sizes? React Native provides many ways to handle screen sizes. Some of them are given below: - Flexbox: It is used to provide a consistent layout on different screen sizes. It has three main properties: - flexDirection - justifyContent - alignItems - Pixel Ratio: It is used to get access to the device pixel density by using the PixelRatio class. We will get a higher resolution image if we are on a high pixel density device. - Dimensions: It is used to handle different screen sizes and style the page precisely. It needs to write the code only once for working on any device. - AspectRatio: It is used to set the height or vice versa. The aspectRatio is present only in React-Native, not a CSS standard. - ScrollView: It is a scrolling container which contains multiple components and view. The scrollable items can be scroll both vertically and horizontally. When would you prefer a class component over functional components? We prefer class component when the component has a state and lifecycle; otherwise, the functional component should be used. How do you re-render a FlatList? By using extraData property on the FlatList component. <FlatList data={data } style={FlatListstyles} extraData={this.state} renderItem={this._renderItem} /> By passing extraData={this.state} to FlatList we make sure FlatList will re-render itself when the state.selected changes. Without setting this prop, FlatList would not know it needs to re-render any items because it is also a PureComponent and the prop comparison will not show any changes. What is “autolinking” in react-native? React Native libraries often come with platform-specific (native) code. Autolinking is a mechanism that allows your project to discover and use this code. Autolinking is a replacement for react-native link. If you have been using React Native before version 0.60, please unlink native dependencies if you have any from a previous install. Each platform defines its own platforms configuration. It instructs the CLI on how to find information about native dependencies. This information is exposed through the config command in a JSON format. It’s then used by the scripts run by the platform’s build tools. Each script applies the logic to link native dependencies specific to its platform. What is AsyncStorage and how do you use it? - AsyncStorage is a simple, asynchronous key-value pair used in React Native applications. - It is a local only storage. - It comes in two parts: core and storage backend. - Core is a consumer of the storage, provides you a unified API to save and read data. - Storage backend implements an interface that core API understands and uses. Its functionality depends on storage itself. an increase in the application’s performance. Differentiate between the React component and the React element. React Element – It is a simple object that describes a DOM node and its attributes or properties you can say. It is an immutable description object and you can not apply any methods on it.Eg – <button class=”blue”></button> React Component – It is a function or class that accepts an input and returns a React element. It has to keep references to its DOM nodes and to the instances of the child components. const SignIn = () => ( <div> <p>Sign In</p> <button>Continue</button> <button color='blue'>Cancel</button> </div>); What is InteractionManager and what is its importance? InteractionManager is a native module in React native that defers the execution of a function until an “interaction” finished. Importance: React Native has JavaScript UI thread as the only thread for making UI updates that can be overloaded and drop frames. In that case, InteractionManager helps by ensuring that the function is only executed after the animations occurred. Describe HOC. A higher-order component (HOC) is an advanced technique in React for reusing component logic. HOCs are not part of the React API, per se. They are a pattern that emerges from React’s compositional nature. How is data loaded on the server by React Native? React Native uses Fetch API to fetched data for networking needs. What is meant by Gesture Responder System? It is an internal system of React Native, which is responsible for managing the lifecycle of gestures in the system. React Native provides several different types of gestures to the users, such as tapping, sliding, swiping, and zooming. The responder system negotiates these touch interactions. Usually, it is used with Animated API. Also, it is advised that they never create irreversible gestures. How to use Axios in the React Native? Axios is a popular library for making HTTP requests from the browser. It allows us to make GET, POST, PUT, and DELETE requests from the browser. Therefore, React Native uses Axios to make requests to an API, return data from the API, and then perform actions with that data in our React Native app. We can use Axios by adding the Axios plugin to our project using the following command. # Yarn $ yarn add axios # npm $ npm install axios --save Axios have several features, which are listed below: - It makes XMLHttpRequests from the browser. - It makes Http requests from the React Native framework. - It supports most of the React Native API. - It offers a client-side feature that protects the application from XSRF. - It automatically transforms response and request data with the browser. What are refs in React? When to use Refs? Refs are escape hatch that provides a direct way to access DOM nodes or React elements created in the render method. Refs get in use when: - To manage focus, text selection, or media playback - To trigger imperative animations - To integrate with third-party DOM libraries What are animations in React Native? The animation is a method in which images are manipulated to appear as moving objects. React Native animations allows you to add extra effects, which provide great user experience in the app. We can use it with React Native API, Animated.parallel, Animated.decay, and Animated.stagger. React Native has two types of animation, which are given below. - Animated: This API is used to control specific values. It has a start and stops methods for controlling the time-based animation execution. - LayoutAnimated: This API is used to animate the global layout transactions. What do you understand from “In React, everything is a component.” Components are the building blocks of a React application’s UI. These components split up the entire UI into small independent and reusable pieces. Then it renders each of these components independent of each other without affecting the rest of the UI..
https://blog.codehunger.in/react-native-interview-questions/
CC-MAIN-2021-43
en
refinedweb
In practice, I encountered the operation of matrix stacking. I originally wanted to write a function myself. Later, I thought that there should be a library function, so I searched for it import numpy as np a = np.array([1,2,3]) b = np.array([4,5,6]) np.stack ((a, b)) ා default row stack Output: array([[1, 2, 3], [4, 5, 6]]) np.vstack((a, b)) Output: array([[1, 2, 3], [4, 5, 6]]) np.hstack((a, b)) Output: array([1, 2, 3, 4, 5, 6]) Briefly explain the above code: in fact, it is mainly a function, stack (), which actually contains various stacking methods. Our example is for two-dimensional matrix, in fact, most of our operations are for two-dimensional matrix. For convenience, we define two functions vstack() to vertically stack (vertically) ), hsstack() to stack horizontally The stack() function has a parameter, axis, which can set the stack dimension. The default value is 0. In fact, it has the same effect as vstack(). When it is set to 1, the result is as follows np.stack((a,b),axis=1) Output: array([[1, 4], [2, 5], [3, 6]]) From the perspective of effect, it is equivalent to taking the second dimension of a, that is, column by column, and assembling a matrix by row. So, can the effect of hstack() be realized by stack()? I haven’t explored it here. Welcome to know about the guidance of children’s boots, but the effect of hstack() is the same as that of concatenate np.concatenate((a,b)) Output: array([1, 2, 3, 4, 5, 6]) The above example of Python numpy matrix stacking is the whole content shared by Xiaobian. I hope I can give you a reference, and I hope you can support developeppaer more.
https://developpaper.com/stack-instance-of-python-numpy-matrix/
CC-MAIN-2021-43
en
refinedweb
Hello friends, welcome back to my blog. Today in this blog post, I am going to tell you, How to upload, preview and save image inside folder in react js? For reactjs new comers, please check the below link: Friends here is the code snippet for How to upload, preview and save image Save import axios from 'axios'; //For Image Upload import ImageUploading from "react-images-uploading"; class App extends React.Component { onChange = (imageList) => { // data for submit // Create an object of formData const formData = new FormData(); // Update the formData object formData.append( "myFile", imageList[0].file, imageList[0].file.name ); // Details of the uploaded file console.log(imageList[0].file); // Request made to the backend api // Send formData object to my php file for save in folder axios.post("", formData); }; render() { return ( <div className="maincontainer"> <h1 className="mr-5 ml-5 mt-5">TheRichPost</h1> <div className="container mb-5 mt-5"> <ImageUploading onChange={this.onChange} > {({ image //Upload folder $target_dir = "uploads/"; $target_file = $target_dir . basename($_FILES["myFile"]["name"]); $imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION)); // Check if image file is a actual image or fake image $check = getimagesize($_FILES["myFile"]["tmp_name"]); if($check !== false) { //Move File To Uploads Folder if (move_uploaded_file($_FILES["myFile"]["tmp_name"], $target_file)) { echo "The file ". basename( $_FILES["myFile"]["name"]). " has been uploaded."; } else { echo "Sorry, there was an error uploading your file."; } } else { echo "File is not an image."; } ?> Now we are done friends. If you have any kind of query or suggestion or any requirement then feel free to comment below. Guys in my next post, I will tell you, how to upload and save multiple
https://therichpost.com/how-to-upload-preview-and-save-image-inside-folder-in-react-js/
CC-MAIN-2021-43
en
refinedweb
std::ranges::pop_heap From cppreference.com Swaps the value in the position first and the value in the position last-1 and makes the subrange [first, last-1) into a max heap. This has the effect of removing the first element from the heap defined by the range [first, last). 1) Elements are compared using the given binary comparison function compand projection object proj. 2) Same as (1), but uses ras the equal to [edit] Complexity Given N = ranges::distance(first, last), at most 2log(N) comparisons and 4log(N) projections. [edit] Notes The max heap is a range of elements [f, l), arranged with respect to comparator comp and projection proj, that has the following properties: - With N == l - f, for all 0 < i < N, p == f[(i - 1) / 2], and q == f[i], the expression std::invoke(comp, std::invoke(proj, p), std::invoke(proj, q)) evaluates to false. - a new element can be added using ranges::push_heap(), in 𝓞(log N) time. - the first element can be removed using ranges::pop_heap(), in 𝓞(log N) time. [edit] Example Run this code #include <algorithm> #include <array> #include <iostream> #include <iterator> #include <string_view> template <class I = int*> void print(std::string_view rem, I first = {}, I last = {}, std::string_view term = "\n") { for (std::cout << rem; first != last; ++first) { std::cout << *first << ' '; } std::cout << term; } int main() { std::array v { 3, 1, 4, 1, 5, 9, 2, 6, 5, 3 }; print("initially, v: ", v.cbegin(), v.cend()); std::ranges::make_heap(v); print("make_heap, v: ", v.cbegin(), v.cend()); print("convert heap into sorted array:"); for (auto n {std::ssize(v)}; n >= 0; --n) { std::ranges::pop_heap(v.begin(), v.begin() + n); print("[ ", v.cbegin(), v.cbegin() + n, "] "); print("[ ", v.cbegin() + n, v.cend(), "]\n"); } } Output: initially, v: 3 1 4 1 5 9 2 6 5 3 make_heap, v: 9 6 4 5 5 3 2 1 1 3 convert heap into sorted array: [ 6 5 4 3 5 3 2 1 1 9 ] [ ] [ 5 5 4 3 1 3 2 1 6 ] [ 9 ] [ 5 3 4 1 1 3 2 5 ] [ 6 9 ] [ 4 3 3 1 1 2 5 ] [ 5 6 9 ] [ 3 2 3 1 1 4 ] [ 5 5 6 9 ] [ 3 2 1 1 3 ] [ 4 5 5 6 9 ] [ 2 1 1 3 ] [ 3 4 5 5 6 9 ] [ 1 1 2 ] [ 3 3 4 5 5 6 9 ] [ 1 1 ] [ 2 3 3 4 5 5 6 9 ] [ 1 ] [ 1 2 3 3 4 5 5 6 9 ] [ ] [ 1 1 2 3 3 4 5 5 6 9 ]
https://en.cppreference.com/w/cpp/algorithm/ranges/pop_heap
CC-MAIN-2021-43
en
refinedweb
To recap, the HMTL5 week input is supported by a number of browsers and enables the user to select a week of the year: It works with values formatted according to the ISO 8601 standard, which, in the case of a week of the year is in the format yyyy-Www, where yyyy is the full year -W is literal, and ww represents the ISO 8601 week of the year. In the instance above, the value is set to 2021-W01 - the first week of 2021. The input tag helper renders input type="week" for properties that have a DataType attribute set to "week". You have a decision to make in respect of how you want to represent the week in your server code. You could work with it as a string, or a DateTime, or you can create your own custom type to represent the week: public class Week { public int Year { get; set; } public int WeekNumber { get; set; } public static Week TryParse(string input) { var result = input.Split("-W"); if (result.Length != 2) { return null; } if (int.TryParse(result[0], out int year) && int.TryParse(result[1], out int week)) { return new Week { Year = year, WeekNumber = week }; } return null; } public override string ToString() { return $"{Year}-W{WeekNumber:D2}"; } } The TryParse method takes a string and attempts to generate a valid instance of the Week type. The overridden ToString method generates the correctly formatted value that will be applied to the week input when using the input tag helper. Next, you need a way to call the TryParse method in user input. So, based on the recommendation to use a TypeConverter, here is the WeekConverter: public class WeekConverter : TypeConverter {) { if (value is string input) { return Week.TryParse(input); } return base.ConvertFrom(context, culture, value); } } The class derives from the TypeConverter and overrides two methods: CanConvertFrom() and ConvertFrom(). The first method returns a bool indicating whether this converter can manage conversions from the specified type. This converter is intended to be used in model binding, so it is designed to convert from strings. The ConvertFrom method contains the code that tests whether the input is a string, and if so, uses the Week.TryParse method to attempt to return a new Week instance. Finally, you need to register the WeekConverter. You do this by applying the TypeConverterAttribute to the Week class: [TypeConverter(typeof(WeekConverter))] public class Week { ... } Note that this attribute is not applied to the PageModel property like the ModelBinder attribute. It must be applied to the class definition. There is an open issue on Github that will enable the declaration of the TypeConverterAttribute on model properties and parameters, but in the meantime, it is not supported as part of the model binding infrastructure. The PageModel property has the BindProperty and DataType attributes applied: [BindProperty, DataType("week")] public Week CustomWeek { get; set; } Now the TypeConverter takes care of assigning the posted value from the input to the PageModel property: Summary As I mentioned at the beginning, the recommendation is to use a TypeConverter when you need to map a single value in a request to a complex object. Doing so does not have to be complex at all, as this article shows. Since type converters are used by the model binding system anyway, once you have implemented your own and configured it on the class, it "just works".
https://www.mikesdotnetting.com/article/354/implementing-a-custom-typeconverter-in-razor-pages
CC-MAIN-2021-43
en
refinedweb
First, it has nothing to do with the number of files that you link together. It just happened in my previous case that several of the extra objects that I was linking in were causing the problem (sorry). It turns out that my problem is with certain C++ operators and objects, particularly (but I doubt limited to) 'new' and 'cerr'. The dynamic loader does not seem to be able to resolve these names. I create my module with the following: g++ -c testmodule.C -o testmodule.o ld -o testmodule.so testmodule.0 -lg++ Whenever I try to load the object in Python I get the error: ld.so: Undefined symbol: ___builtin_new For example, the following simple module dynamically creates an integer and passes its value back to python. ----------C++---------- #include "allobjects.h" object* test_demoTest(object* self, object* args) { char* myString; int* myInt; if(!getargs(args, "s", &myString)) { return NULL; } myInt = new int; *myInt = 42; return mkvalue("(si)", myString,*myInt); } static struct methodlist testMethods[] = { {"demoTest", test_demoTest}, {NULL, NULL} // Sentinel }; extern "C" void inittest() { (void) initmodule("test", testMethods); } ----------Python---------- import test print test.demoTest('Hello world.') -------------------- and the output should be: ('Hello world.', 42) Sure, for this case I could just use malloc (yuck) insead of new, but I will still have the same problem when I want dynamic creation of classes. I also get an undefined symbol error if I use 'cerr' or 'cout', etc., which leads me to believe that something that is supposed to get linked in, isn't, although I would have thought that these C++ constructs would have been covered by the inclusion of '-lg++' in the making of the .so file. Anyway, I'll keep hacking on this one and let ya'll know if I figure anything out. This has got to be possible, right?
https://legacy.python.org/search/hypermail/python-1994q2/0201.html
CC-MAIN-2021-43
en
refinedweb
Hello to all, welcome to therichpost.com. In this post, I will show you, Angular 9 image cropper working example. Post Working:In this post, I am showing how to crop image in Angular 9. Here is the working code snippet and please follow carefully: 1. Very first, here are common basics steps to add angular 9 application on your machine: $ npm install -g @angular/cli $ ng new angularimage // Set Angular9 Application on your pc cd angularimage // Go inside project folder ng serve // Run project //Check working Local server 2. Now run below command into your terminal to include image cropper package into your angular 9 application: npm install ngx-image-cropper --save 3. Now add below code into your app.module.ts file: import { ImageCropperModule } from 'ngx-image-cropper'; @NgModule({ imports: [ ... ImageCropperModule ], 4. Add, below code into your app.component.ts file: import { ImageCroppedEvent } from 'ngx-image-cropper'; export class YourComponent { imageChangedEvent: any = ''; croppedImage: any = ''; fileChangeEvent(event: any): void { this.imageChangedEvent = event; } imageCropped(event: ImageCroppedEvent) { this.croppedImage = event.base64; } imageLoaded() { // show cropper } cropperReady() { // cropper ready } loadImageFailed() { // show message } } 5. Finally add below code into app.component.html file: <image-cropper [imageChangedEvent]="imageChangedEvent" [maintainAspectRatio]="true" [aspectRatio]="4 / 3" format="png" (imageCropped)="imageCropped($event)" (imageLoaded)="imageLoaded()" (cropperReady)="cropperReady()" (loadImageFailed)="loadImageFailed()" ></image-cropper> <img [src]="croppedImage" /> This is it and if you have any kind of query then please let me know. Don’t forget to run ng serve command. Jas Thank you Recent Comments
https://therichpost.com/angular-9-image-cropper-working-example/
CC-MAIN-2021-43
en
refinedweb
Specifically: (1) import foo # where foo is a dynamically loaded module reload(foo) causes a core dump, at least on systems using SVR4 shared libraries for dynamic module loading. (2) import sys del sys.modules['sys'] import sys dumps core. (3) import math reload(math) raises ImportError: No module named math (4) import stdwin import sys del sys.modules['stdwin'] import stdwin does not actually seem to fail but looks very scary because stdwin cannot be initialized twice in the same process. In Python version 1.0.1++ (to be released as 1.0.2) I've added the following checks: - Calling reload() for dynamically loaded modules (case 1) is forbidden and raises an ImportError - Ditto for built-in modules (case 3) - Attempts to force a reinitialization of a few privileged built-in modules like sys, __main__ and __builtin__ by deleting them from sys.modules (case 2) raises ImportError - Similar attempts for non-privileged built-in modules (case 4) are not caught. This may still dump core depending on whether the module's init*() function can be called more than once or not. (Forbidding this would require more work as it would require maintaining a table of flags telling whether a particular module was already initialized.) - Calling reload() for frozen modules is fixed and should now work as expected (except I haven't tested it yet :). --Guido van Rossum, CWI, Amsterdam <[email protected]> URL: <>
https://legacy.python.org/search/hypermail/python-1994q2/0211.html
CC-MAIN-2021-43
en
refinedweb
Just. TL;dr the video of the workshop is posted below. So learning to program is not hard, and based on my experience the best language to start from is Golang due to its simplicity (while I don’t like the language for its limited ability to express ideas in a more functional form, but it is a great language for a beginner). One of the company I worked for even once made everyone (both dev and non-devs) to pick up the language within a week by just following the tour. Previous incarnations The first time I did this was during a friend’s convocation. We met up for the event, and my friends were in a discussion related to their research. So another friend and I who were not joining the discussion got bored, and since we were in a computer lab with Internet access anyway, so I offered to teach her very basic programming while waiting for the rest. She agreed, and we opened up repl.it and I did my first iteration of this programme with Python. The whole walkthrough took around 30mins. The second time I did this, was to give an overview of how Rust works to programmers who are new and interested in the language. So the structure is similar but the focus was more on introducing the language. Back to the workshop I conducted, I chose Python as a delivery language because I recently submitted my statistical analysis work to the organization in the form of Jupyter Notebook. If they are interested in playing with the notebook, it would be nice if they learn a thing or two in Python. Another additional prerequisite, besides CPython, is having poetry installed, as well as a preferred text editor (default choice is vscode but any editor would do, not too obsessed with tools here). The whole programme is split into 4 parts, namely - Operations and assignments - Branching - Repetitions - Reuse You can read this post as a companion piece to the workshop video I linked to the beginning part of this post. Operations and assignments First thing first, we shall start by opening up a repl (read -> evaluate -> print -> loop), which is a useful tool to have immediate feedback when starting to learn a new language. (Practically JavaScript is the best as the repl is built into every browser, but would advise against learning that as the first language for sanity purpose). With poetry installed, just create a new project $ poetry new --src learn-python $ cd learn-python Next start a new repl $ poetry run python Poetry was chosen as a prerequisite due to its use of virtual environment. Besides the fact that my submitted work was managed by poetry, it is generally a good practice to contain one’s work in an environment that does not affect other projects, or even the system. While this tutorial is not likely to affect anything, it is still a good habit to get used to. The --src flag, on the other hand, is just personal preference, as I like all source code stored within a specific folder. Now that the repl is started, we can now do crazy things in it. I usually start with arithmetic operations (Things next to >>> is things we type, and press enter to submit). Notice the result of a computation is returned below the things we typed, after pressing enter. >>> 1 + 1 2 >>> 2 * 30 60 When we divide numbers, as the delivery language is Python, we could just >>> 3 / 5 0.6 You might have heard about casting, or having to do some tricks like making one of the operand in this division a decimal number, in order to get 0.6. But since Python is dynamically typed, it is rather forgiving in this regard. Also we briefly discussed about integer division and the remainder (modulo) operator. >>> 3 // 5 0 >>> 3 % 5 3 Raising a number to a power with ** >>> 4 ** 2 16 Previously we saw decimal numbers, we can also do some sort of operations to the number, like rounding up to certain decimal places. Notice how it is different from simple arithmetic operations above, we see a name round followed by parentheses, and another number in it (instead of something like 1 / 3 round 4). We will see why this is in this form later, but remember the form). >>> 1 / 3 0.33333333333 >>> round(1 / 3, 4) 0.3333 Besides numerical operations, we also have alphabetical characters (or anything you can type on your keyboard except a few special ones), and when we have a bunch/collection of them together, we call them a string. In Python, they are all enclosed in either matching single quotes ' or a double quotes " >>> 'c' 'c' >>> 'hello world' 'hello world' A quick tip here, if you know your string contains an ' then enclose them with double quotes, otherwise single quotes >>> "O'Connor" "O'Connor" >>> '"best" friend forever' '"best" friend forever' Extended read: escape sequence. Unlike numbers, the quotation marks here is crucial as it denotes the character or string (a collection of characters) is to be treated as such. Without the quotes, they will be treated differently, as Python would think it represents something, or you are calling some language constructs (both of which would be introduced later). Like numbers, we can perform some operations on it, for instance, joining two strings together (we call this concatenating, or concat for short) >>> "hello" + " world" "hello world" or, turn everything to uppercase. This is the third form of performing an operation, which is somewhat similar to the previous one where we round numbers. >>> 'hello'.upper() ’HELLO‘ A sidenote, so far after we enter our computer request into the repl, it returns and prints the result. However, this is usually not how most program runs. In order to print things to the screen, we use a >>> print(1 + 1) 2 Though it doesn’t behave differently in this environment, but if we don’t print in the actual program we build later, the result of computation will not be shown at all. Now that we know how to perform computations, how each type of data looks like, now we are interested in storing them. Often times we would have a big computation problem to be performed in steps. Hence, we are interested in storing the result of intermediate steps into something. This is when assignment comes in to play. So the symbol, or the operator (like + we saw just now) for assignment is =. We put a name (begins with an alphabet, and an be any number or underscore of any length) on the left hand side, and a value on the right. The name on the left hand side is often called a variable. >>> a_number = 20 >>> a_decimal = 0.3 >>>>> a_string = "Hello world" This is how we store intermediate result of computation >>> a_hard_computation = 42 + 0 One might think the symbol is somewhat related to the same symbol in mathematics, however it is not true. For instance, if we want to represent this straight line formula in Python We would have to break mx into m * x, because Python allow more than one character as the name of a variable. Hence, the implicit multiplication symbol between the two needs to be made explicit. >>> y = m * x + c A big difference compared to Mathematics is that, everything on the right-hand side needs to be defined in prior. If Python does not know what m, x, and/or c is, it will throw an error complaining they are not defined. Unlike in mathematics, we can leave any of those variable unknown, and solve for them given enough information. In this case if we need to find the value of x given others are known, we would have to do the algebra work ourselves, such that >>> x = (y - c) / m Yes, like Mathematics, we can use parentheses to prioritize evaluation. The name of a variable can be made with multiple words, as long as they are joined with either an underscore, or difference in case, or just mix everything together join_multiple_words: we call this snake case joinMultipleWords: we call this camel case joinmultiplewords: don’t do this, otherwise I haunt you in your sleep even though Python will never complain Now that we know how to store value to be used next, we are now interested in moving on to the next bullet point, branching. Branching If you have ever read an interactive story book, you will see towards the end of a page you get to choose which page to read next depending on a choice you made. The most basic way to emulate this kind of behaviour in Python is through an if statement, which has a form that looks like below (things enclosed in angle brackets are placeholders which we want to fill in later) if <condition>: <do something> else: <do another thing> Before we talk about what goes into the <condition> placeholder. Let us revisit what kind of data can we represent in Python. We have - Integer number 1, 3, 42 - Decimal number 0.3, 3.1412 - Characters 'a', 'c' - Strings 'hello' Besides that we now have a new type, with only two different possible values, True or False. These are what we call Booleans (named after George Boole). Notice so far we see if, else, True, False, where they actually carry some meaning (we call these reserved keywords). Therefore, we shall not name our variable with these, i.e. we cannot have >>> if = 42 Now that we know what a boolean is, we should now talk about operations we can do with them. If you heard about logic gates, you may know these operations >>> True and True True >>> True or False True >>> False and False False All the common boolean operations are available and behaves as expected. We also have not operator >>> not False True Now on some operations that ends up with a boolean values, usually happens when we compare things. For instance, we want to check if a given number is odd >>> a_number = 42 >>> a_number % 2 == 1 False >>> not (a_number % 2 == 0) False >>> a_number % 2 != 0 False The three different form of comparison all does the same thing – checking if a_number is odd. Notice how we do a non-equal operation, which is !=, as we cannot easily type the ≠ symbol easily on our keyboard. Another reminder, an equality operator requires two = symbols (a rather common mistakes when you program don’t behave as expected). We also have other inequality operators too (namely less than, less than or equal, greater than, greater than or equal) >>> a_number = 42 >>> a_number < 42 False >>> a_number <= 42 True >>> a_number > 42 False >>> a_number >= 42 True Now we know what returns a boolean, we can now insert these computations into the <condition> placeholder, for instance we have a check for even number if a_number % 2 == 0: <do something> else: <do another thing> The <do something> and <do another thing> are just a sequence of computation one would want to perform in those two cases. The first sequence would be executed if a_number is True according to the condition, otherwise the second sequence is executed. We can insert a sequence of computation, one line after another to replace the <do something> and <do another thing> placeholders, as long as they are all indented. An indentation is the same number of spaces or tabs from the beginning of a line. Indentation has a meaning in Python, and in our case it shows that these two blocks of code belong to the if statement or the else clause. So in our repl, we write them as follows >>> a_number = 42 >>> if a_number % 2 == 0: ... print("I am happy") ... else: ... print("I am sad") ... I am happy Notice only one of the two print operations is done. Sometimes, we are interested in extending the check further. So if we want to check if a number is 100, we should print other things. This is where we see a new keyword elif which is a short form of else if (because programmers are lazy). As a rule of thumb, we always handle the most specified requirement first. >>> a_number = 42 >>> if a_number == 100: ... print("I score full marks") ... elif a_number % 2 == 0: ... print("I am happy") ... print(3 * 5) ... else: ... print("I am sad") ... I am happy So similarly to a simple if statement, we can keep chaining new conditions to an existing one, if the first condition fails, we check the second, the third, and if all fails, the sequence of computation in else clause is executed. However, we now see elif is optional, and else is too. It is perfectly fine to omit the else part entirely. >>> a_number = 32 >>> if a_number == 1000: ... print("This will never happen") ... print("not kidding, this will never get printed") ... Of course, we can also put True or False directly as the condition, but often times it is redundant. >>> if True: ... print('do this regardless') ... do this regardless >>> if False: ... print("don't do this ever") ... don't do this ever Also we can insert logical operators we mentioned earlier to compose multiple boolean result as condition. >>> if n % 2 == 0 and n == 100: ... print('do special thing') Besides chaining multiple conditions, we can also perform another layer of branching within if, elif and/or else. >>> a_number = 42 >>> if a_number % 2 == 0: ... print('things happen before nested if') ... ... if a_number == 42: ... print('special things to do when number is 42') ... print('things to do after nested if') things happen before nested if special things to do when the number is 42 things to do after nested if Notice I inserted a blank line before another the second if statement. If is usually done for readability purpose. Otherwise, if everything is stuck together like the third print statement, it can be very hard to see to which part of the code it is associated with (in this case the first if). Inserting another if-statement within another is what we call nesting. You can also see how indentation plays a role here. In the example, the first and third print statement corresponds to the a_number % 2 == 0 condition, and the second one corresponds to the a_number == 42 condition. Nested-if statement can happen in the if part, or elif part, or even the else part. Feel free to experiment. This concludes branching, now we move on to repetitions. Repetitions As you get fluent with everything we cover so far, you might come across a need to repeat similar computations, or print similar things to the screen. You may find yourself doing this (no variation) >>> print(1) 1 >>> print(1) 1 >>> print(1) 1 >>> print(1) 1 >>> print(1) 1 or (repeating computations with small variation) >>> print(1) 1 >>> print(2) 2 >>> print(3) 3 >>> print(4) 4 >>> print(5) 5 You bet lazy programmers like us will invent some sort of structure to make our lives easier. Yes, there is a way to do this easily, with the use of while loop. Generally, a while loop looks like this while <condition>: <do something> This should somewhat remind you of if statement we discussed earlier, as it looks very similar. This is how we perform the first task where we print the same thing exactly 5 times. >>> counter = 0 >>> while counter < 5: ... print(1) ... counter = counter + 1 ... 1 1 1 1 1 Before we get to the meaning of the code, there are two things we want to talk about. First on the re-assignment or an update to the counter variable by referring to itself counter = counter + 1 So assuming counter is 0, when we see this computation instruction for the first time, as I mentioned previously, everything on the right hand side must be known. So replacing the value of counter on the right hand side counter = 0 + 1 Now counter is 0 + 1, which is 1. This is again, why assignment operator = is not the same equal sign used in Mathematics. Now as for why we want a counter? Remember we want to repeat the procedure exactly 5 times. Therefore, it is crucial to keep track of that somewhere, hence, we made a new variable counter for this purpose. Also another sidenote, we programmers are a weird bunch, we usually start counting from 0. While there are exceptions (some niche languages might start from 1, like R/Mathlab programmers iirc), but for this we just remember to always start counting from 0. And the second task can be done as follows >>> counter = 0 >>> while counter < 5: ... counter = counter + 1 ... print(counter) ... So how did we invent that condition for the loop, why do we keep updating the value of counter? For this, you can rewrite the thing as follows to see what would happen if we don’t update counter. >>> counter = 0 >>> while counter < 5: ... print("hello world") ... hello world hello world hello world hello world ... (You can press CTRL+C to halt that endless stream of hello world printed to your screen, so we can continue) Congratulations, you have just written your first infinite loop. Now you should somewhat understand why it is crucial to have counter to update itself before we conclude a while loop, and how the condition in while statement ensures we don’t end up in infinite loop. Just like branching, indentation here means the corresponding computations belongs to the while condition. So the computation instruction will run one after another, and then go back to check the condition again with updated values. In the example, after going through the loop for 1 round, the counter got updated to 1. When we perform the condition check with the new value of counter, it would still pass, hence another round of execution. It then repeats until counter got updated to 5. Now the condition check returns a False with this updated value of counter, hence exits the loop. So the rule of thumb here is, always remember to update the components involved in the condition check before ending a loop. Just like if statements, we can nest while loop(s) in an existing while loop while <condition>: while <another condition>: <computation> How it works would be up to your imagination, and another thing you may find more interesting, you can nest an if-statement in it too (or vice-versa). >>> counter = 0 >>> while counter < 5: ... if counter == 3: ... print('I am a proud 3') ... ... # remember to update counter ... counter = counter + 1 ... I am a proud 3 A new thing you find in the snippet above is the # symbol. Anything follows the symbol is considered part of a comment, and would be ignored during execution. Us programmers usually drop a lot of those in our program to explain things or to curse co-workers jot notes so other readers can understand the code better. Next we want to talk about lists. We actually see a variation of lists already, remember we had a bunch/collection of character, which we call string? Yes it is a type of list. However, when we talk about list, we are usually referring to >>> [1, 2, 3] [1, 2, 3] >>> ['a', 'b', 'c'] ['a', 'b', 'c'] >>> [0.2, 0.3] [0.2, 0.3] >>> [True, True] [True, True] A list is constructed with a pair of square brackets, where each element of the list being separated with a , symbol. Also, as Python is rather lenient (dynamically typed language), we can also do >>> [1, 'a', 3] [1, 'a', 3] These are some of the things we can do to lists >>> [1, 2, 3] + [3, 4] [1, 2, 3, 3, 4] >>> len([1, 2, 3]) 3 len is just an operation to find out how many elements in a list. Why is this useful, you may ask, you can use that in looping too. However, instead of while, we do for here. >>> things = [1, 2, 3] >>> for item in things: ... print(item) ... 1 2 3 You might see there’s no counter, no condition, and the things after for keyword does not look like a condition at all. What happens here is that, just like a while loop, after the last computation operation (in this case a for. What it does is that it extract the items in the things list one after another whenever it is executed. So the first time it is executed, it returns a 1, followed by 2 in the second run, and finally 3. The loop will exit once it has no more item to be extracted from the list. No more keeping track of counter, or remembering to update, yay! However, you can re-implement the similar thing with while loop too if you hate your life. >>> counter = 0 >>> things = [1, 2, 3, 4, 5] >>> while counter < len(things): ... print(things[counter]) ... counter = counter + 1 ... 1 2 3 4 5 Something to unpack here, you may now understand what counter does in the update and condition part. However, what is with the things[counter] code? That is how we access an individual item within a list for computation. >>> things = [1, 2, 3, 4, 5] >>> things[0] 1 >>> things[2] 3 >>> things[3] + 5 9 Remember we said start counting from 0? This is another reason why. The first element of a list is 0. So back to the while loop above, in the first iteration, counter is 0 so 1 was printed, then subsequent items are printed as the loop carries on. If there is an intuition you can build throughout this session, you may find that things you find may fit will often fit. We have seen how things can nest within each other, yes, we can nest if, while or even for within a for loop as well. Now how is it useful? Imagine we have >>> things = [ [1, 2, 3], [4, 5] ] Oh, you just realized we can do a list of lists (: And if you have not realized, yes, this is how we do nested for >>> for sublist in things: ... for item in sublist: ... print(item) ... 1 2 3 4 5 So a quick walkthrough, when we first begin execution, we extract [1, 2, 3] into sublist. Then we go through the inner/nested for loop, and we extract 1 out of sublist and assign it to item. Next, we print item, which is 1. Continue the inner loop execution until we exhaust all the members of the list, then we go back to the outer loop to grab [4, 5] and assign into sublist. Then we repeat the inner loop again with new sublist. Next we talk about reuse, which is another way to do similar things, but in a more controlled way. Reuse One of the thing you see me do repetitively throughout the whole session, is testing if a number is even. Also, if you have been paying attention, you know programmers are lazy. Assuming we still need that kind of computation, and we don’t want to keep typing the same thing over and over again. some_number % 2 == 0 What we can do is to write a function, and the general form is def <function name>(<arguments>): <do things> and for the check if a number is even >>> def is_even(a_number): ... return a_number % 2 == 0 Like if, while or for, we can have multiple computations done within a function as well, just that for this case we only need one line. If you want the result of the computation being used, remember to prepend the result computation with return keyword. (It is OK to not have a line with return too). Also watch your indentation. And now that we have that defined, how do we actually use it? We actually called quite a number of functions already, for instance a round, len etc. >>> print(1 + 300) 301 >>> round(0.33333333333, 4) 0.3333 >>> len([1, 2, 3]) 3 You may have already guessed it, we can call our new function as follows >>> a_number = 42 >>> is_even(a_number) True >>> is_even(3) False As we have our function returning a value, and it is in Boolean, so it can be used as condition in if/ elif/ while. >>> if is_even(4): ... print("hello") ... hello >>> while is_even(3): ... print('do this') ... But what about "hello".upper()? It is also some form of function call, but as an object method. While we are not covering it here, it is nice to know that it is just a variation of function call. Related reading: object orientation in Python A function can choose to not return a value, for instance you can have a function to >>> def essay(): ... print("hello world") ... print("lorem ipsum dolor sit amet") ... print('my day is good') ... No return statement, and also no function arguments (nothing in the parentheses). Therefore calling it would require nothing to be passed in too. >>> essay() hello world lorem ipsum dolor sit amet my day is good You can also require multiple arguments (separate them with commas) while calling your function too >>> def get_y(m, x, c): ... return m * x + c ... >>> get_y(10, 10, 1) 101 Nesting if, while, for is fine >>> def foo(): ... a_number = 32 ... if 42 == a_number: ... print('bar') ... Nesting a function into if, while, for is also fine, but usually we don’t do that (imagine the confusion caused when it is placed in a while loop and it gets defined multiple times). >>> if True: ... def bar(): ... print('baz') ... Now that we are done with all the basics, we are ready for a real world program. Exit the repl by pressing CTRL+D. Open up a code editor and create file into the folder we created in the beginning of the session (this example uses vscode, but if you use other editor like nano replace code to nano). $ code fizzbuzz.py (In)Famous programming puzzle So this is a real world program, which is a rather famous programming quiz in job interview. The problem statement is given by - For a list of 1-50 - Print “Fizz” if the number is divisible by 3 - Print “Fuzz” if the number is divisible by 5 - Print “FizzBuzz” if the number is divisible by both 3 and 5 - Otherwise just print the number Let’s build the program in parts. One thing to remember about writing programs is that you don’t usually build everything in one go. So we start by creating a list of 1-50. Typing out a list of 1 to 50 seems like a dumb thing, so Python provides a range function that does exactly that, almost. Since we are going to loop it, let’s create a for loop for that for item in range(50): print(50) Save the file, and go back to your terminal, run the program $ poetry run python fizzbuzz.py 0 2 3 ... 47 48 49 Nice, we have the numbers printed out, but it starts from 0, which is annoying to non-coder. No big deal, just remember to add 1 next time. Now we see what can we do next, if you read the problem statement, you will see divisible by <something> keep coming out. Let’s do a function and add it to the top of the file def divisible(dividend, divisor): return dividend % divisor == 0 Next, go through the 3 conditions, and remember, always perform the most specific condition first. if divisible(item + 1, 3) and divisible(item + 1, 5): print("fizz buzz") elif divisible(item + 1, 3): print("fizz") elif divisible(item + 1, 5): print("buzz") else: print(item + 1) So this should do the trick, check your indentation, and re-run the program $ poetry run python fizzbuzz.py 1 2 fizz 4 buzz fizz ... Check if the output is correct, and ensure your file looks like this def divisible(dividend, divisor): return dividend % divisor == 0 for item in range(50): if divisible(item + 1, 3) and divisible(item + 1, 5): print("fizz buzz") elif divisible(item + 1, 3): print("fizz") elif divisible(item + 1, 5): print("buzz") else: print(item + 1) Some enhancements you may want to consider adding to the program are - There are a lot of item +1, can we somehow stop repeating the same computation over and over? - Assuming you don’t know about rangefunction, can this be rewritten with just a counterand whileloop? (Hint, you can start your counter by 1too so no item + 1nonsense) There, my friend, you have completed your first real program. You may now proceed to finally learn a language for real, it could be golang, or python, or any other language. In any language you encounter, there would be some sort of variation to the 4 things above, they may be in different name (for instance Rust uses match statement to do branching in addition to if), or different forms (assignment practically doesn’t exist in functional language like Haskell but there are similar let statement that sort of do “assignment” nonetheless). You might encounter more advanced concepts (remember my link to object oriented Python just now?), you can see them as a more efficient way to do the 4 different things we covered (assignment, branching, repetition, reuse). Now you share my pain and joy of learning new languages (: (if you find this post helpful, you can help by bugging me on social media to fix language problems, e.g. tenses, active/passive voice etc)
https://cslai.coolsilon.com/2020/12/16/4-fundamental-things-in-programming-pre-101/?color_scheme=default
CC-MAIN-2021-43
en
refinedweb
gettext alternatives and similar packages Based on the "Translations and Internationalizations" category. Alternatively, view gettext alternatives based on common mentions on social networks and blogs. linguist8.0 2.4 gettext VS linguistElixir Internationalization library Ex_Cldr7.8 8.8 gettext VS Ex_CldrElixir implementation of CLDR/ICU trans7.5 5.3 gettext VS transEmbedded translations for Elixir Codepagex6.6 0.6 gettext VS CodepagexElixir string encoding conversion - like iconv but pure Elixir ecto_gettext2.9 0.2 gettext VS ecto_gettextLibrary for localization Ecto validation errors with using Gettext. getatrex2.4 0.0 gettext VS getatrexGettext Automatic Translator in Elixir exkanji1.9 0.0 gettext VS exkanjiA Elixir library for translating between hiragana, katakana, romaji, kanji and sound. It uses Mecab. exromaji1.6 0.0 gettext VS exromajiA Elixir library for translating between hiragana, katakana, romaji and sound. parabaikElixirConverterParabaikElixirConverter is just a Elixir version of Parabaik converter Do you think we are missing an alternative of gettext or a related project? README Gettext Gettext is an internationalization (i18n) and localization (l10n) system commonly used for writing multilingual programs. Gettext is a standard for i18n in different communities, meaning there is a great set of tooling for developers and translators. This project is an implementation of the Gettext system in Elixir. Installation Add :gettextto your list of dependencies in mix.exs(use $ mix hex.info gettextto find the latest version): def deps do [ {:gettext, ">= 0.0.0"} ] end Optionally add the :gettextcompiler to your Mix compilers so your backends are recompiled when .pofiles change: def project do [ compilers: [:gettext] ++ Mix.compilers() ] end Documentation for Gettext is available on Hex. Usage To use Gettext, define a Gettext module: defmodule MyApp.Gettext do use Gettext, otp_app: :my_app end and invoke the Gettext API, which consists of the *gettext macros: import MyApp.Gettext # Simple translation gettext("Here is one string to translate") # Plural translation number_of_apples = 4 ngettext("The apple is ripe", "The apples are ripe", number_of_apples) # Domain-based translation dgettext("errors", "Here is an error message to translate") Translations in Gettext are stored in Portable Object files ( .po). Such files must be placed at priv/gettext/LOCALE/LC_MESSAGES/DOMAIN.po, where LOCALE is the locale and DOMAIN is the domain (the default domain is called default). For example, the translation to pt_BR of the first two *gettext calls in the snippet above must be placed in the priv/gettext/pt_BR/LC_MESSAGES/default.po file with contents: msgid "Here is one string to translate" msgstr "Aqui está um texto para traduzir" msgid "Here is the string to translate" msgid_plural "Here are the strings to translate" msgstr[0] "Aqui está o texto para traduzir" msgstr[1] "Aqui estão os textos para traduzir" .po are text-based files and can be edited directly by translators. Some may even use existing tools for managing them, such as Poedit or poeditor.com. Finally, because translations are based on strings, your source code does not lose readability as you still see literal strings, like gettext("here is an example"), instead of paths like translate("some.path.convention"). Read the documentation for the Gettext module for more information on locales, interpolation, pluralization, and other features. Workflow Gettext is able to automatically extract translations from your source code, alleviating developers and translators from the repetitive and error-prone work of maintaining translation files. When extracted from source, translations are placed into .pot files, which are template files. Those templates files can then be merged into translation files for each specific locale your application is being currently translated to. In other words, the typical workflow looks like this: Add gettextcalls to your source code. No need to touch translation files at this point as Gettext will return the given string if no translation is available: gettext("Welcome back!") Once changes to the source are complete, automatically sync all existing entries to .pot(template files) in priv/gettextby running: mix gettext.extract .potfiles can then be merged into locale-specific .pofiles: # Merge .pot into all locales mix gettext.merge priv/gettext # Merge .pot into one specific locale mix gettext.merge priv/gettext --locale en It is also possible to both extract and merge translations in one step with mix gettext.extract - gettext README section above are relevant to that project's source code only.
https://elixir.libhunt.com/gettext-alternatives
CC-MAIN-2021-43
en
refinedweb
Show Webcam Stream in Fullscreen Hi, how can i show a webcam stream live on the UI? I have got an ESP32-microcontroller with a RTSP-Stream Server and a Webserver? Which is the best way to get a fast picture? Is it possible to set a connection to a wlan accesspoint or should i always use the Settingsmanager from iOS to do this? Thanks a lot. Cu kami @kami I think it is possible to connect to a WiFi hotspot (see here) But, Pythonista3 has to be configured for it Important To use the NEHotspotConfigurationManager class, you must enable the Hotspot Configuration capability in Xcode. For the fun, I've tried this from objc_util import * def handler(_cmd,obj1_ptr): if obj1_ptr: obj1 = ObjCInstance(obj1_ptr) print(obj1) # error return NEHotspotConfiguration = ObjCClass('NEHotspotConfiguration').alloc() NEHotspotConfiguration.initWithSSID_passphrase_isWEP_('my_ssid', 'my_pwd', False) NEHotspotConfiguration.joinOnce = False NEHotspotConfigurationManager = ObjCClass('NEHotspotConfigurationManager').sharedManager() handler_block = ObjCBlock(handler, restype=None, argtypes=[c_void_p, c_void_p]) NEHotspotConfigurationManager.applyConfiguration_completionHandler_(NEHotspotConfiguration,handler_block) But it gives an error Error Domain=NEHotspotConfigurationErrorDomain Code=8 "internal error." UserInfo={NSLocalizedDescription=internal error.} Sincerely, I can't help more Okay thanks. But maybe you can help me with the Video Stream? Cu kami There are RTSP-Stream Python clients, thus you could try If I had a camera with RTSP-Stream Server , I would try Perhaps, in an ui.WebView, Safari supporting WebRtc to stream cameras? @kami Looks like if you can serve HLS, you can show it in an AVPlayerView
https://forum.omz-software.com/topic/5783/show-webcam-stream-in-fullscreen/?
CC-MAIN-2021-43
en
refinedweb
Vue 导航 This guide covers how routing works in an app built with Ionic and Vue. The IonRouterOutlet component uses the popular Vue Router library under the hood. With Ionic and Vue Router, you can create multi-page apps with rich page transitions. Everything you know about routing using Vue Router carries over into Ionic Vue. Let's take a look at the basics of an Ionic Vue app and how routing works with it. A Brief Note While reading this guide, you may notice that most of these concepts are very similar to the concepts found in Vue Router without Ionic Framework. You observation would be correct! Ionic Vue leverages the best parts of Vue Router to make the transition to building apps with Ionic Framework as seamless as possible. As a result, we recommend relying on Vue Router features as much as possible rather than trying to build your own routing solutions. A Simple Route Here is a sample routing configuration that defines a single route to the "/home" URL. When you visit "/home", the route renders the HomePage component. router/index.ts import { createRouter, createWebHistory } from '@ionic/vue-router'; import { RouteRecordRaw } from 'vue-router'; import HomePage from '@/views/Home.vue'; const routes: Array<RouteRecordRaw> = [ { path: '/', name: 'Home', component: HomePage }, ] const router = createRouter({ history: createWebHistory(process.env.BASE_URL), routes }); export default router; On the app's initial load, the app will render the HomePage component as that is what is configured here. Handling Redirects What if we wanted to land a different path on our initial load? For this, we can use router redirects. Redirects work the same way that a typical route object does, but just includes some different keys: const routes: Array<RouteRecordRaw> = [ { path: '/', redirect: '/home' }, { path: '/home', name: 'Home', component: HomePage }, ] In our redirect, we look for the index path of our app. Then if we load that, we redirect to the home route. Navigating to Different Routes This is all great, but how does one actually navigate to a route? For this, we can use the router-link property. Let's create a new routing setup: const routes: Array<RouteRecordRaw> = [ { path: '/', redirect: '/home' }, { path: '/home', name: 'Home', component: HomePage }, { path: '/detail', name: 'Detail', component: DetailPage } ] Say we start on the home route, and we want to add a button that takes us to the detail route. We can do this using the following HTML to navigate to the detail route: <ion-buttonGo to detail</ion-button> We can also programmatically navigate in our app by using the router API: <template> <ion-page> <ion-content> <ion-button @Go to detail</ion-button> </ion-content> </ion-page> </template> <script lang="ts"> import { IonButton, IonContent, IonPage } from '@ionic/vue'; import { defineComponent } from 'vue'; import { useRouter } from 'vue-router'; export default defineComponent({ name: 'HomePage', components: { IonButton, IonContent, IonPage }, setup() { const router = useRouter(); return { router }; } }) </script> Both options provide the same navigation mechanism, just fitting different use cases. Lazy Loading Routes The current way our routes are setup makes it so they are included in the same initial chunk when loading the app, which is not always ideal. Instead, we can set up our routes so that components are loaded as they are needed: const routes: Array<RouteRecordRaw> = [ { path: '/', redirect: '/home' }, { path: '/home', name: 'Home', component: HomePage }, { path: '/detail', name: 'Detail', component: () => import('@/views/DetailPage.vue') } ] Here, we have the same setup as before only this time DetailPage has been replaced with an import call. This will result in the DetailPage component no longer being part of the chunk that is requested on application load. Shared URLs versus Nested Routes A common point of confusion when setting up routing is deciding between shared URLs or nested routes. This part of the guide will explain both and help you decide which one to use. Shared URLs Shared URLs is a route configuration where routes have pieces of the URL in common. The following is an example of a shared URL configuration: const routes: Array<RouteRecordRaw> = [ { path: '/dashboard', component: DashboardMainPage, }, { path: '/dashboard/stats', component: DashboardStatsPage } ]; The above routes are considered "shared" because they reuse the dashboard piece of the URL. Nested Routes Nested Routes is a route configuration where routes are listed as children of other routes. The following is an example of a nested route configuration: const routes: Array<RouteRecordRaw> = [ { path: '/dashboard/:id', component: DashboardRouterOutlet, children: [ { path: '', component: DashboardMainPage }, { path: 'stats', component: DashboardStatsPage }, ] } ]; The above routes are nested because they are in the children array of the parent route. Notice that the parent route renders the DashboardRouterOutlet component. When you nest routes, you need to render another instance of ion-router-outlet. Which one should I choose? Shared URLs are great when you want to transition from page A to page B while preserving the relationship between the two pages in the URL. In our previous example, a button on the /dashboard page could transition to the /dashboard/stats page. The relationship between the two pages is preserved because of a) the page transition and b) the url. Nested routes are mostly useful when you need to render content in outlet A while also rendering sub-content inside of a nested outlet B. The most common use case you will run into is tabs. When you load up a tabs Ionic starter application, you will see ion-tab-bar and ion-tabs components rendered in the first ion-router-outlet. The ion-tabs component renders another ion-router-outlet which is responsible for rendering the contents of each tab. There are very few use cases in which nested routes make sense in mobile applications. When in doubt, use the shared URL route configuration. We strongly caution against using nested routing in contexts other than tabs as it can quickly make navigating your app confusing. Working with Tabs When working with tabs, Ionic Vue needs a way to know which view belongs to which tab. The IonTabs component comes in handy here, but let's look at what the routing setup for this looks like: const routes: Array<RouteRecordRaw> = [ { path: '/', redirect: '/tabs/tab1' }, { path: '/tabs/', component: Tabs, children: [ { path: '', redirect: 'tab1' }, { path: 'tab1', component: () => import('@/views/Tab1.vue') }, { path: 'tab2', component: () => import('@/views/Tab2.vue') }, { path: 'tab3', component: () => import('@/views/Tab3.vue') } ] } ] Here, our tabs path loads a Tabs component. We provide each tab as a route object inside of the children array. In this example, we call the path tabs, but this can be customized. Let's start by taking a look at our Tabs component: <template> <ion-page> <ion-content> <ion-tabs> <ion-tab-bar <ion-tab-button <ion-icon : <ion-label>Tab 1</ion-label> </ion-tab-button> <ion-tab-button <ion-icon : <ion-label>Tab 2</ion-label> </ion-tab-button> <ion-tab-button <ion-icon : <ion-label>Tab 3</ion-label> </ion-tab-button> </ion-tab-bar> </ion-tabs> </ion-content> </ion-page> </template> <script lang="ts"> import { IonTabBar, IonTabButton, IonTabs, IonContent, IonLabel, IonIcon, IonPage } from '@ionic/vue'; import { ellipse, square, triangle } from 'ionicons/icons'; export default { name: 'Tabs', components: { IonContent, IonLabel, IonTabs, IonTabBar, IonTabButton, IonIcon, IonPage }, setup() { return { ellipse, square, triangle, } } } </script> If you have worked with Ionic Framework before, this should feel familiar. We create an ion-tabs component, and provide an ion-tab-bar. The ion-tab-bar provides and ion-tab-button components, each with a tab property that is associated with its corresponding tab in the router config. Child Routes within Tabs When adding additional routes to tabs you should write them as sibling routes with the parent tab as the path prefix. The example below defines the /tabs/tab1/view route as a sibling of the /tabs/tab1 route. Since this new route has the tab1 prefix, it will be rendered inside of the Tabs component, and Tab 1 will still be selected in the ion-tab-bar. const routes: Array<RouteRecordRaw> = [ { path: '/', redirect: '/tabs/tab1' }, { path: '/tabs/', component: Tabs, children: [ { path: '', redirect: 'tab1' }, { path: 'tab1', component: () => import('@/views/Tab1.vue') }, { path: 'tab1/view', component: () => import('@/views/Tab1View.vue') }, { path: 'tab2', component: () => import('@/views/Tab2.vue') }, { path: 'tab3', component: () => import('@/views/Tab3.vue') } ] } ] IonRouterOutlet The IonRouterOutlet component provides a container to render your views in. It is similar to the RouterView component found in other Vue applications except that IonRouterOutlet can render multiple pages in the DOM in the same outlet. When a component is rendered in IonRouterOutlet we consider this to be an Ionic Framework "page". The router outlet container controls the transition animation between the pages as well as controls when a page is created and destroyed. This helps maintain the state between the views when switching back and forth between them. Nothing should be provided inside of IonRouterOutlet when setting it up in your template. While IonRouterOutlet can be nested in child components, we caution against it as it typically makes navigation in apps confusing. See Shared URLs versus Nested Routes for more information. IonPage The IonPage component wraps each view in an Ionic Vue app and allows page transitions and stack navigation to work properly. Each view that is navigated to using the router must include an IonPage component. > Components presented via IonModal or IonPopover do not typically need an IonPage component unless you need a wrapper element. In that case, we recommend using IonPage so that the component dimensions are still computed properly. Accessing the IonRouter Instance There may be a few use cases where you need to get access to the IonRouter instance from within your Vue application. For example, you might want to know if you are at the root page of the application when a user presses the hardware back button on Android. For use cases like these, you can inject the IonRouter dependency into your component: import { useIonRouter } from '@ionic/vue'; ... export default { setup() { const ionRouter = useIonRouter(); if (ionRouter.canGoBack()) { // Perform some action here } } } URL Parameters Let's expand upon our original routing example to show how we can use URL parameters: const routes: Array<RouteRecordRaw> = [ { path: '/', redirect: '/home' }, { path: '/home', name: 'Home', component: HomePage }, { path: '/detail/:id', name: 'Detail', component: DetailPage } ] Notice that we have now added :id to the end of our detail path string. URL parameters are dynamic portions of our route paths. When the user navigates to a URL such as /details/1 the "1" is saved to a parameter named "id" which can be accessed in the component when the route renders. Let's look at how to use it in our component: <template> <ion-page> <ion-header> <ion-toolbar> <ion-title>Details</ion-title> </ion-toolbar> </ion-header> <ion-content> Detail ID: {{ id }} </ion-content> </ion-page> </template> <script lang="ts"> import { IonContent, IonHeader, IonPage, IonTitle, IonToolbar } from '@ionic/vue'; import { defineComponent } from 'vue'; import { useRoute } from 'vue-router'; export default defineComponent({ name: 'Detail', components: { IonContent, IonHeader, IonPage, IonTitle, IonToolbar }, setup() { const route = useRoute(); const { id } = route.params; return { id }; } }) </script> Our route variable contains an instance of the current route. It also contains any parameters we have passed in. We can obtain the id parameter from here and display it on the screen. Router History Vue Router ships with a configurable history mode. Let's look at the different options and why you might want to use each one. createWebHistory: This option creates an HTML5 history. It leverages the History API to achieve URL navigation without a page reload. This is the most common history mode for single page applications. When in doubt, use createWebHistory. createWebHashHistory: This option adds a hash ( #) to your URL. This is useful for web applications with no host or when you do not have full control over the server routes. Search engines sometimes ignore hash fragments, so you should use createWebHistoryinstead if SEO is important for your application. createMemoryHistory: This option creates an in-memory based history. This is mainly used to handle server-side rendering (SSR). More Information For more info on routing in Vue using Vue Router, check out their docs at.
https://ionicframework.com/jp/docs/zh/vue/navigation
CC-MAIN-2021-43
en
refinedweb
What is Hadoop Cluster? Learn to Build a Cluster in Hadoop In this blog, we will get familiar with Hadoop cluster the heart of Hadoop framework. First, we will talk about what is a Hadoop cluster? Then look at the basic architecture and protocols it uses for communication. And at last, we will discuss what are the various benefits that Hadoop cluster provide. So, let us begin our journey of Hadoop Cluster. 1. What is Hadoop Cluster? A Hadoop cluster is nothing but a group of computers connected together via LAN. We use it for storing and processing large data sets. Hadoop clusters have a number of commodity hardware connected together. They communicate with a high-end machine which acts as a master. These master and slaves implement distributed computing over distributed data storage. It runs open source software for providing distributed functionality. 2. What is the Basic Architecture of Hadoop Cluster? Hadoop cluster has master-slave architecture. i. Master in Hadoop Cluster It is a machine with a good configuration of memory and CPU. There are two daemons running on the master and they are NameNode and Resource Manager. a. Functions of NameNode - Manages file system namespace - Regulates access to files by clients - Stores metadata of actual data Foe example – file path, number of blocks, block id, the location of blocks etc. - Executes file system namespace operations like opening, closing, renaming files and directories The NameNode stores the metadata in the memory for fast retrieval. Hence we should configure it on a high-end machine. b. Functions of Resource Manager - It arbitrates resources among competing nodes - Keeps track of live and dead nodes You must learn about the Distributed Cache in Hadoop ii. Slaves in the Hadoop Cluster It is a machine with a normal configuration. There are two daemons running on Slave machines and they are – DataNode and Node Manager a. Functions of DataNode - It stores the business data - It does read, write and data processing operations - Upon instruction from a master, it does creation, deletion, and replication of data blocks. b. Functions of NodeManager - It runs services on the node to check its health and reports the same to ResourceManager. We can easily scale Hadoop cluster by adding more nodes to it. Hence we call it a linearly scaled cluster. Each node added increases the throughput of the cluster. Client nodes in Hadoop cluster – We install Hadoop and configure it on client nodes. c. Functions of the client node - To load the data on the Hadoop cluster. - Tells how to process the data by submitting MapReduce job. - Collects the output from a specified location. 3. Single Node Cluster VS Multi-Node Cluster As the name suggests, single node cluster gets deployed over a single machine. And multi-node clusters gets deployed on several machines. In single-node Hadoop clusters, all the daemons like NameNode, DataNode run on the same machine. In a single node Hadoop cluster, all the processes run on one JVM instance. The user need not make any configuration setting. The Hadoop user only needs to set JAVA_HOME variable. The default factor for single node Hadoop cluster is one. In multi-node Hadoop clusters, the daemons run on separate host or machine. A multi-node Hadoop cluster has master-slave architecture. In this NameNode daemon run on the master machine. And DataNode daemon runs on the slave machines. In multi-node Hadoop cluster, the slave daemons like DataNode and NodeManager run on cheap machines. On the other hand, master daemons like NameNode and ResourceManager run on powerful servers. Ina multi-node Hadoop cluster, slave machines can be present in any location irrespective of the physical location of the master server. 4. Communication Protocols Used in Hadoop Clusters The HDFS communication protocol works on the top of TCP/IP protocol. The client establishes a connection with NameNode using configurable TCP port. Hadoop cluster establishes the connection to the client using client protocol. DataNode talks to NameNode using the DataNode Protocol. A Remote Procedure Call (RPC) abstraction wraps both Client protocol and DataNode protocol. NameNode does not initiate any RPC instead it responds to RPC from the DataNode. Don’t forget to check schedulers in Hadoop 5. How to Build a Cluster in Hadoop Building a Hadoop cluster is a non- trivial job. Ultimately the performance of our system will depend upon how we have configured our cluster. In this section, we will discuss various parameters one should take into consideration while setting up a Hadoop cluster. For choosing the right hardware one must consider the following points - Understand the kind of workloads, the cluster will be dealing with. The volume of data which cluster need to handle. And kind of processing required like CPU bound, I/O bound etc. - Data storage methodology like data compression technique used if any. - Data retention policy like how frequently we need to flush. Sizing the Hadoop Cluster For determining the size of Hadoop clusters we need to look at how much data is in hand. We should also examine the daily data generation. Based on these factors we can decide the requirements of a number of machines and their configuration. There should be a balance between performance and cost of the hardware approved. Configuring Hadoop Cluster For deciding the configuration of Hadoop cluster, run typical Hadoop jobs on the default configuration to get the baseline. We can analyze job history log files to check if a job takes more time than expected. If so then change the configuration. After that repeat the same process to fine tune the Hadoop cluster configuration so that it meets the business requirement. Performance of the cluster greatly depends upon resources allocated to the daemons. The Hadoop cluster allocates one CPU core for small to medium data volume to each DataNode. And for large data sets, it allocates two CPU cores to the HDFS daemons. 6. Hadoop Cluster Management When you deploy your Hadoop cluster in production it is apparent that it would scale along all dimensions. They are volume, velocity, and variety. Various features that it should have to become production-ready are – robust, round the clock availability, performance and manageability. Hadoop cluster management is the main aspect of your big data initiative. A good cluster management tool should have the following features:- - It should provide diverse work-load management, security, resource provisioning, performance optimization, health monitoring. Also, it needs to provide policy management, job scheduling, back up and recovery across one or more nodes. - Implement NameNode high availability with load balancing, auto-failover, and hot standbys - Enabling policy-based controls that prevent any application from gulping more resources than others. - Managing the deployment of any layers of software over Hadoop clusters by performing regression testing. This is to make sure that any jobs or data won’t crash or encounter any bottlenecks in daily operations. 7. Benefits of Hadoop Clusters Here is a list of benefits provided by Clusters in Hadoop – - Robustness - Data disks failures, heartbeats and re-replication - Cluster Rrbalancing - Data integrity - Metadata disk failure - Snapshot i. Robustness The main objective of Hadoop is to store data reliably even in the event of failures. Various kind of failure is NameNode failure, DataNode failure, and network partition. DataNode periodically sends a heartbeat signal to NameNode. In network partition, a set of DataNodes gets disconnected with the NameNode. Thus NameNode does not receive any heartbeat from these DataNodes. It marks these DataNodes as dead. Also, Namenode does not forward any I/O request to them. The replication factor of the blocks stored in these DataNodes falls below their specified value. As a result, NameNode initiates replication of these blocks. In this way, NameNode recovers from the failure. ii. Data Disks Failure, Heartbeats, and Re-replication NameNode receives a heartbeat from each DataNode. NameNode may fail to receive heartbeat because of certain reasons like network partition. In this case, it marks these nodes as dead. This decreases the replication factor of the data present in the dead nodes. Hence NameNode initiates replication for these blocks thereby making the cluster fault tolerant. iii. Cluster Rebalancing The HDFS architecture automatically does cluster rebalancing. Suppose the free space in a DataNode falls below a threshold level. Then it automatically moves some data to another DataNode where enough space is available. iv. Data Integrity Hadoop cluster implements checksum on each block of the file. It does so to see if there is any corruption due to buggy software, faults in storage device etc. If it finds the block corrupted it seeks it from another DataNode that has a replica of the block. v. Metadata Disk Failure FSImage and Editlog are the central data structures of HDFS. Corruption of these files can stop the functioning of HDFS. For this reason, we can configure NameNode to maintain multiple copies of FSImage and EditLog. Updation of multiple copies of FSImage and EditLog can degrade the performance of Namespace operations. But it is fine as Hadoop deals more with the data-intensive application rather than metadata intensive operation. vi. Snapshot Snapshot is nothing but storing a copy of data at a particular instance of time. One of the usages of the snapshot is to rollback a failed HDFS instance to a good point in time. We can take Snapshots of the sub-tree of the file system or entire file system. Some of the uses of snapshots are disaster recovery, data backup, and protection against user error. We can take snapshots of any directory. Only the particular directory should be set as Snapshottable. The administrators can set any directory as snapshottable. We cannot rename or delete a snapshottable directory if there are snapshots in it. After removing all the snapshots from the directory, we can rename or delete it. 8. Summary There are several options to manage a Hadoop cluster. One of them is Ambari. Hortonworks promote Ambari and many other players. We can manage more than one Hadoop cluster at a time using Ambari. Cloudera Manager is one more tool for Hadoop cluster management. Cloudera manager permits us to deploy and operate complete Hadoop stack very easily. It provides us with many features like performance and health monitoring of the cluster. Hope this helped. Share your feedback through comments. You must explore Top Hadoop Interview Questions
https://data-flair.training/blogs/what-is-hadoop-cluster/
CC-MAIN-2019-13
en
refinedweb
Your message dated Thu, 07 Feb 2019 03:13:19 +0000 with message-id <[email protected]> and subject line Bug#920171: Removed package(s) from unstable has caused the Debian Bug report #539912, regarding gcc-6: for c99, POSIX requires that option -D have a lower precedence than .) -- 539912: Debian Bug Tracking System Contact [email protected] with problems --- Begin Message ---Package: gcc-4.3 Version: 4.3.3-15 Severity: normal Note: this is a bug concerning the c99 utility, but since c99 uses gcc, I report the bug against gcc. Also note that both gcc-4.4 and gcc-snapshot have the same problem. I've also reported the bug on GCC's bugzilla: In POSIX specifies: . However, gcc doesn't take the precedence rule into account: $ cat tst.c int main(void) { #ifdef FOO return 1; #else return 0; #endif } $ c99 tst.c -UFOO -DFOO=1 $ ./a.out zsh: exit 1 ./a.out whereas FOO should be undefined and the return value should be 0, not 1. -- System Information: Debian Release: squeeze/sid APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: amd64 (x86_64) Kernel: Linux 2.6.30-1-amd64 (SMP w/2 CPU cores) Locale: LANG=POSIX, LC_CTYPE=en_US.ISO8859-1 (charmap=ISO-8859-1) Shell: /bin/sh linked to /bin/dash Versions of packages gcc-4.3 depends on: ii binutils 2.19.51.20090723-1 The GNU assembler, linker and bina ii cpp-4.3 4.3.3-15 The GNU C preprocessor ii gcc-4.3-base 4.3.3-15 The GNU Compiler Collection (base ii libc6 2.9-23 GNU C Library: Shared libraries ii libgcc1 1:4.4.1-1 GCC support library ii libgomp1 4.4.1-1 GCC OpenMP (GOMP) support library Versions of packages gcc-4.3 recommends: ii libc6-dev 2.9-23 GNU C Library: Development Librari Versions of packages gcc-4.3 suggests: ii gcc-4.3-doc 4.3.2.nf1-1 documentation for the GNU compiler pn gcc-4.3-locales <none> (no description available) pn gcc-4.3-multilib <none> (no description available) pn libgcc1-dbg <none> (no description available) pn libgomp1-dbg <none> (no description available) pn libmudflap0-4.3-dev <none> (no description available) pn libmudflap0-dbg <none> (no description available) -- no debconf information --- ---
https://www.mail-archive.com/[email protected]/msg55239.html
CC-MAIN-2019-13
en
refinedweb
Example 21-6 is the MudPlace class that implements the RemoteMudPlace interface and acts as a server for a single place or room within the MUD. It is this class that holds the description of a place and maintains the lists of the people and items in a place and the exits from a place. This is a long class, but many of the remote methods it defines have simple or even trivial implementations. The go( ), createPlace( ), and linkTo( ) methods are among the more complex and interesting methods; they manage the network of connections between MudPlace objects. Note that the MudPlace class is Serializable, so that a MudPlace (and all places it is connected to) can be serialized along with the MudServer that refers to them. However, the names and people fields are declared transient, so they are not serialized along with the place. package je3.rmi; import java.rmi.*; import java.rmi.server.*; import java.rmi.registry.*; import java.io.*; import java.util.*; import je3.rmi.Mud.*; /** * This class implements the RemoteMudPlace interface and exports a * bunch of remote methods that are at the heart of the MUD. The * MudClient interacts primarily with these methods. See the comment * for RemoteMudPlace for an overview. * The MudPlace class is Serializable so that places can be saved to disk * along with the MudServer that contains them. Note, however that the * names and people fields are marked transient, so they are not serialized * along with the place (because it wouldn't make sense to try to save * RemoteMudPerson objects, even if they could be serialized). **/ public class MudPlace extends UnicastRemoteObject implements RemoteMudPlace, Serializable { String placename, description; // information about the place Vector exits = new Vector( ); // names of exits from this place Vector destinations = new Vector( ); // where the exits go to Vector things = new Vector( ); // names of things in this place Vector descriptions = new Vector( ); // descriptions of those things transient Vector names = new Vector( ); // names of people in this place transient Vector people = new Vector( ); // the RemoteMudPerson objects MudServer server; // the server for this place /** A no-arg constructor for de-serialization only. Do not call it */ public MudPlace( ) throws RemoteException { super( ); } /** * This constructor creates a place, and calls a server method * to register the object so that it will be accessible by name **/ public MudPlace(MudServer server, String placename, String description) throws RemoteException, PlaceAlreadyExists { this.server = server; this.placename = placename; this.description = description; server.setPlaceName(this, placename); // Register the place } /** This remote method returns the name of this place */ public String getPlaceName( ) throws RemoteException { return placename; } /** This remote method returns the description of this place */ public String getDescription( ) throws RemoteException { return description; } /** This remote method returns a Vector of names of people in this place */ public Vector getNames( ) throws RemoteException { return names; } /** This remote method returns a Vector of names of things in this place */ public Vector getThings( ) throws RemoteException { return things; } /** This remote method returns a Vector of names of exits from this place*/ public Vector getExits( ) throws RemoteException { return exits; } /** * This remote method returns a RemoteMudPerson object corresponding to * the specified name, or throws an exception if no such person is here **/ public RemoteMudPerson getPerson(String name) throws RemoteException, NoSuchPerson { synchronized(names) { // What about when there are 2 of the same name? int i = names.indexOf(name); if (i == -1) throw new NoSuchPerson( ); return (RemoteMudPerson) people.elementAt(i); } } /** * This remote method returns a description of the named thing, or * throws an exception if no such thing is in this place. **/ public String examineThing(String name) throws RemoteException, NoSuchThing { synchronized(things) { int i = things.indexOf(name); if (i == -1) throw new NoSuchThing( ); return (String) descriptions.elementAt(i); } } /** * This remote method moves the specified RemoteMudPerson from this place * in the named direction (i.e. through the named exit) to whatever place * is there. It throws exceptions if the specified person isn't in this * place to begin with, or if they are already in the place through the * exit or if the exit doesn't exist, or if the exit links to another MUD * server and the server is not functioning. **/ public RemoteMudPlace go(RemoteMudPerson who, String direction) throws RemoteException, NotThere, AlreadyThere, NoSuchExit, LinkFailed { // Make sure the direction is valid, and get destination if it is Object destination; synchronized(exits) { int i = exits.indexOf(direction); if (i == -1) throw new NoSuchExit( ); destination = destinations.elementAt(i); } // If destination is a string, it is a place on another server, so // connect to that server. Otherwise, it is a place already on this // server. Throw an exception if we can't connect to the server. RemoteMudPlace newplace; if (destination instanceof String) { try { String t = (String) destination; int pos = t.indexOf('@'); String url = t.substring(0, pos); String placename = t.substring(pos+1); RemoteMudServer s = (RemoteMudServer) Naming.lookup(url); newplace = s.getNamedPlace(placename); } catch (Exception e) { throw new LinkFailed( ); } } // If the destination is not a string, then it is a Place else newplace = (RemoteMudPlace) destination; // Make sure the person is here and get their name. // Throw an exception if they are not here String name = verifyPresence(who); // Move the person out of here, and tell everyone who remains about it. this.exit(who, name + " has gone " + direction); // Put the person into the new place. // Send a message to everyone already in that new place String fromwhere; if (newplace instanceof MudPlace) // going to a local place fromwhere = placename; else fromwhere = server.getMudName( ) + "." + placename; newplace.enter(who, name, name + " has arrived from: " + fromwhere); // Return the new RemoteMudPlace object to the client so they // know where they are now at. return newplace; } /** * This remote method sends a message to everyone in the room. Used to * say things to everyone. Requires that the speaker be in this place. **/ public void speak(RemoteMudPerson speaker, String msg) throws RemoteException, NotThere { String name = verifyPresence(speaker); tellEveryone(name + ":" + msg); } /** * This remote method sends a message to everyone in the room. Used to * do things that people can see. Requires that the actor be in this place. **/ public void act(RemoteMudPerson actor, String msg) throws RemoteException, NotThere { String name = verifyPresence(actor); tellEveryone(name + " " + msg); } /** * This remote method creates a new thing in this room. * It requires that the creator be in this room. **/ public void createThing(RemoteMudPerson creator, String name, String description) throws RemoteException, NotThere, AlreadyThere { // Make sure the creator is here String creatorname = verifyPresence(creator); synchronized(things) { // Make sure there isn't already something with this name. if (things.indexOf(name) != -1) throw new AlreadyThere( ); // Add the thing name and descriptions to the appropriate lists things.addElement(name); descriptions.addElement(description); } // Tell everyone about the new thing and its creator tellEveryone(creatorname + " has created a " + name); } /** * Remove a thing from this room. Throws exceptions if the person * who removes it isn't themself in the room, or if there is no * such thing here. **/ public void destroyThing(RemoteMudPerson destroyer, String thing) throws RemoteException, NotThere, NoSuchThing { // Verify that the destroyer is here String name = verifyPresence(destroyer); synchronized(things) { // Verify that there is a thing by that name in this room int i = things.indexOf(thing); if (i == -1) throw new NoSuchThing( ); // And remove its name and description from the lists things.removeElementAt(i); descriptions.removeElementAt(i); } // Let everyone know of the demise of this thing. tellEveryone(name + " had destroyed the " + thing); } /** * Create a new place in this MUD, with the specified name and description. * The new place is accessible from this place through * the specified exit, and this place is accessible from the new place * through the specified entrance. The creator must be in this place * in order to create a exit from this place. **/ public void createPlace(RemoteMudPerson creator, String exit, String entrance, String name, String description) throws RemoteException,NotThere,ExitAlreadyExists,PlaceAlreadyExists { // Verify that the creator is actually here in this place String creatorname = verifyPresence(creator); synchronized(exits) { // Only one client may change exits at a time // Check that the exit doesn't already exist. if (exits.indexOf(exit) != -1) throw new ExitAlreadyExists( ); // Create the new place, registering its name with the server MudPlace destination = new MudPlace(server, name, description); // Link from there back to here destination.exits.addElement(entrance); destination.destinations.addElement(this); // And link from here to there exits.addElement(exit); destinations.addElement(destination); } // Let everyone know about the new exit, and the new place beyond tellEveryone(creatorname + " has created a new place: " + exit); } /** * Create a new exit from this mud, linked to a named place in a named * MUD on a named host (this can also be used to link to a named place in * the current MUD, of course). Because of the possibilities of deadlock, * this method only links from here to there; it does not create a return * exit from there to here. That must be done with a separate call. **/ public void linkTo(RemoteMudPerson linker, String exit, String hostname, String mudname, String placename) throws RemoteException, NotThere, ExitAlreadyExists, NoSuchPlace { // Verify that the linker is actually here String name = verifyPresence(linker); // Check that the link target actually exists. Throw NoSuchPlace if // not. Note that NoSuchPlace may also mean "NoSuchMud" or // "MudNotResponding". String url = "rmi://" + hostname + '/' + Mud.mudPrefix + mudname; try { RemoteMudServer s = (RemoteMudServer) Naming.lookup(url); RemoteMudPlace destination = s.getNamedPlace(placename); } catch (Exception e) { throw new NoSuchPlace( ); } synchronized(exits) { // Check that the exit doesn't already exist. if (exits.indexOf(exit) != -1) throw new ExitAlreadyExists( ); // Add the exit, to the list of exit names exits.addElement(exit); // And add the destination to the list of destinations. Note that // the destination is stored as a string rather than as a // RemoteMudPlace. This is because if the remote server goes down // then comes back up again, a RemoteMudPlace is not valid, but the // string still is. destinations.addElement(url + '@' + placename); } // Let everyone know about the new exit and where it leads tellEveryone(name + " has linked " + exit + " to " + "'" + placename + "' in MUD '" + mudname + "' on host " + hostname); } /** * Close an exit that leads out of this place. * It does not close the return exit from there back to here. * Note that this method does not destroy the place that the exit leads to. * In the current implementation, there is no way to destroy a place. **/ public void close(RemoteMudPerson who, String exit) throws RemoteException, NotThere, NoSuchExit { // check that the person closing the exit is actually here String name = verifyPresence(who); synchronized(exits) { // Check that the exit exists int i = exits.indexOf(exit); if (i == -1) throw new NoSuchExit( ); // Remove it and its destination from the lists exits.removeElementAt(i); destinations.removeElementAt(i); } // Let everyone know that the exit doesn't exist anymore tellEveryone(name + " has closed exit " + exit); } /** * Remove a person from this place. If there is a message, send it to * everyone who is left in this place. If the specified person is not here, * this method does nothing and does not throw an exception. This method * is called by go( ), and the client should call it when the user quits. * The client should not allow the user to invoke it directly, however. **/ public void exit(RemoteMudPerson who, String message) throws RemoteException { String name; synchronized(names) { int i = people.indexOf(who); if (i == -1) return; names.removeElementAt(i); people.removeElementAt(i); } if (message != null) tellEveryone(message); } /** * This method puts a person into this place, assigning them the * specified name, and displaying a message to anyone else who is in * that place. This method is called by go( ), and the client should * call it to initially place a person into the MUD. Once the person * is in the MUD, however, the client should restrict them to using go( ) * and should not allow them to call this method directly. * If there have been networking problems, a client might call this method * to restore a person to this place, in case they've been bumped out. * (A person will be bumped out of a place if the server tries to send * a message to them and gets a RemoteException.) **/ public void enter(RemoteMudPerson who, String name, String message) throws RemoteException, AlreadyThere { // Send the message to everyone who is already here. if (message != null) tellEveryone(message); // Add the person to this place. synchronized (names) { if (people.indexOf(who) != -1) throw new AlreadyThere( ); names.addElement(name); people.addElement(who); } } /** * This final remote method returns the server object for the MUD in which * this place exists. The client should not allow the user to invoke this * method. **/ public RemoteMudServer getServer( ) throws RemoteException { return server; } /** * Create and start a thread that sends out a message to everyone in this * place. If it gets a RemoteException talking to a person, it silently * removes that person from this place. This is not a remote method, but * is used internally by a number of remote methods. **/ protected void tellEveryone(final String message) { // If there is no one here, don't bother sending the message! if (people.size( ) == 0) return; // Make a copy of the people here now. The message is sent // asynchronously and the list of people in the room may change before // the message is sent to everyone. final Vector recipients = (Vector) people.clone( ); // Create and start a thread to send the message, using an anonymous // class. We do this because sending the message to everyone in this // place might take some time, (particularly on a slow or flaky // network) and we don't want to wait. new Thread( ) { public void run( ) { // Loop through the recipients for(int i = 0; i < recipients.size( ); i++) { RemoteMudPerson person = (RemoteMudPerson)recipients.elementAt(i); // Try to send the message to each one. try { person.tell(message); } // If it fails, assume that that person's client or // network has failed, and silently remove them from // this place. catch (RemoteException e) { try { MudPlace.this.exit(person, null); } catch (Exception ex) { } } } } }.start( ); } /** * This convenience method checks whether the specified person is here. * If so, it returns their name. If not it throws a NotThere exception **/ protected String verifyPresence(RemoteMudPerson who) throws NotThere { int i = people.indexOf(who); if (i == -1) throw new NotThere( ); else return (String) names.elementAt(i); } /** * This method is used for custom de-serialization. Since the vectors of * people and of their names are transient, they are not serialized with * the rest of this place. Therefore, when the place is de-serialized, * those vectors have to be recreated (empty). **/ private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { in.defaultReadObject( ); // Read most of the object as normal names = new Vector( ); // Then recreate the names vector people = new Vector( ); // and recreate the people vector } /** This constant is a version number for serialization */ static final long serialVersionUID = 5090967989223703026L; }
http://books.gigatux.nl/mirror/javaexamples/0596006209_jenut3-chp-21-sect-7.html
CC-MAIN-2019-13
en
refinedweb
news.digitalmars.com - digitalmars.D.bugsDec 30 2006 [Issue 780] New: The assignment of 'this' is allowed (8) Dec 30 2006 [Issue 779] New: init.c:103: virtual Expression* VoidInitializer::toExpression(): Assertion `0' failed. (2) Dec 30 2006 [Issue 778] New: -inline: Assertion failure: '!v->csym' on line 450 in file 'glue.c' (3) Dec 30 2006 [Issue 777] New: -inline: assert() with a non-constant message causes code to not compile (4) Dec 30 2006 [Issue 776] New: Unittest section inside a template does not alway execute. (3) Dec 30 2006 [Issue 775] New: array literals can't be used as template arguments (5) Dec 30 2006 [Issue 774] New: indexing / slicing a const arrays causes: "Error: non-constant expression" (3) Dec 30 2006 [Issue 773] New: Redundant "Error: " in std.conv.ConvError (2) Dec 29 2006 [Issue 772] New: Bogus error using relation operator as static if expression within template (5) Dec 29 2006 [Issue 769] New: Property not properly compiled - (error on valid code) (4) Dec 29 2006 [Issue 768] New: A switch to print predefined version identifiers (7) Dec 29 2006 [Issue 767] New: compiler shall print dependencies and pragma(lib) (11) Dec 29 2006 [Issue 766] New: dmd.exe crash (3) Dec 28 2006 [Issue 765] New: ArrayBoundsError when assigning slice of pointer (3) Dec 28 2006 [Issue 764] New: (typeof(o)).classinfo causes parser error (4) Dec 28 2006 [Issue 763] New: Segfault compiling template code on Linux (4) Dec 28 2006 [Issue 762] New: Newsgroup links still use the old web interface (2) Dec 28 2006 [Issue 761] New: std.format.doFormat fails for items of a char[][] containing %s (3) Dec 28 2006 [Issue 760] New: std.c.stdlib does not include system(3) (2) Dec 28 2006 [Issue 759] New: rdmd does not accept "*.d" or "name.d" as program argument (2) Dec 27 2006 [Issue 758] New: Segmentation fault when compiling. (6) Dec 27 2006 [Issue 756] New: IFTI for tuples only works if tuple parameter is last (4) Dec 27 2006 [Issue 755] New: std.utf.decode() throws exception with typo (5) Dec 27 2006 [Issue 754] New: hex strings crash DMD when reporting syntax errors (3) Dec 27 2006 [Issue 753] New: Minor Misspelling in Class Spec Page (2) Dec 26 2006 [Issue 752] New: Assertion failure: 'e->type->ty != Ttuple' on line 4518 in file 'mtype.c' (13) Dec 26 2006 [Issue 751] New: Compiler segfault on template expansion (3) Dec 26 2006 .obj files conflict (5) Dec 26 2006 [Issue 750] New: Recursive typeof in function declaration crashes DMD (3) Dec 25 2006 [Issue 748] New: internal error with mixed static / dynamic array (4) Dec 24 2006 [Issue 735] New: dmd segfault (7) Dec 23 2006 Bad AA behavior (9) Dec 23 2006 [Issue 734] New: Multidimensional arrays use incorrect initializer (3) Dec 23 2006 [Issue 733] New: std.conv.toFloat does not catch errors (2) Dec 23 2006 [Issue 732] New: Boxer unit test fails (2) Dec 23 2006 [Issue 731] New: Positive and negative NaN in template arguments causes link conflict (3) Dec 23 2006 [Issue 730] New: broken operator handling of ifloat/idouble/ireal (5) Dec 23 2006 [Issue 729] New: scope(...) statement in SwitchBody causes compiler to segfault (5) Dec 23 2006 [Issue 728] New: incorrect initialisation of member arrays if an explicit struct initializer is used (2) Dec 23 2006 [Issue 727] New: -inline: missing return in short function causes incorrect code generation (2) Dec 23 2006 [Issue 726] New: incorrect error line for "override" mixin (2) Dec 23 2006 [Issue 725] New: expression.c:6516: virtual Expression* MinAssignExp::semantic(Scope*): Assertion `e2->type->isfloating()' failed. (2) Dec 23 2006 [Issue 724] New: templated circular typedef in function causes: template.c:2735: TemplateDeclaration* TemplateInstance::findTemplateDeclaration(Scope*): Assertion `s->parent' failed. (3) Dec 23 2006 [Issue 723] New: bad mixin of class definitions at function level: func.c:535: virtual void FuncDeclaration::semantic3(Scope*): Assertion `0' failed (3) Dec 23 2006 [Issue 722] New: mixin as return value: expression.c:775: virtual void Expression::toMangleBuffer(OutBuffer*): Assertion `0' failed. (3) Dec 22 2006 [Issue 720] New: bug in array literal parsing with append (3) Dec 22 2006 [Issue 719] New: compiler segment faults if struct template is insanciated from another module (2) Dec 22 2006 [Issue 718] New: Internal error: ../ztc/cgcod.c 562 (7) Dec 22 2006 [Issue 717] New: toobj.c:191: virtual void ClassDeclaration::toObjFile(): Assertion `!scope' failed. (3) Dec 22 2006 [Issue 716] New: -inline: conditinal compilation of an empty foreach body causes the compiler to segfault (5) Dec 22 2006 [Issue 715] New: incorrect IEEE 754 handling of -0i and +0i (3) Dec 22 2006 [Issue 714] New: accessing <enum>.max from another module causes a compiler segmentfault (2) Dec 22 2006 [Issue 713] New: circular const definitions with module operator "." cause the compiler to segfault (3) Dec 22 2006 [Issue 712] New: incorrect scope of class level mixins if interfaces are involved (2) Dec 22 2006 [Issue 711] New: combining mixins and overriding causes inifite loops (2) Dec 22 2006 [Issue 710] New: compiler assertion failure w/ templates (3) Dec 21 2006 [Issue 709] New: inline assembler: "CVTPD2PI mm, xmm/m128" fails to compile (2) Dec 21 2006 [Issue 708] New: inline assembler: "CVTPS2PI mm, xmm/m128" fails to compile (2) Dec 21 2006 [Issue 707] New: incorrect error lines for failed aliases (2) Dec 21 2006 [Issue 706] New: incorrect type deduction for array literals in functions (2) Dec 21 2006 [Issue 705] New: Mixins and auto (2) Dec 21 2006 [Issue 704] New: destructors are called even if the constructor throws an exception (7) Dec 21 2006 [Issue 703] New: SuperExp::scanForNestedRef Assertion (3) Dec 21 2006 bug in array literal parsing (1) Dec 21 2006 [Issue 702] New: inline assembler: "SMSW r32" fails to compile (2) Dec 20 2006 [Issue 701] New: Inline asm using incorrect offsets when used in inner function (6) Dec 19 2006 [Issue 699] New: long variadic arguments and the "-profile" flag (4) Dec 19 2006 [Issue 698] New: variadic arguments have a limit (7) Dec 18 2006 [Issue 697] New: No const folding on asm db,dw, etc (6) Dec 17 2006 Compiler internal error (6) Dec 17 2006 [Issue 694] New: Doc mistake: a == null is not a.opCmp(null) (3) Dec 17 2006 compiler assertion failure w/ templates (2) Dec 16 2006 [Issue 693] New: 'this' can't be used as an alias parameter for a mixin (7) Dec 16 2006 [Issue 692] New: rules for assigning to complex types are too strict (7) Dec 16 2006 [Issue 691] New: Object.print ought to be removed or at least deprecated (3) Dec 16 2006 [Issue 690] New: ABI not fully documented (11) Dec 16 2006 dmd infinite loop (2) Dec 16 2006 [Issue XXX] ToBeFiled: 'this' can't be used as an alias parameter (1) Dec 16 2006 [Issue XXX] ToBeFiled: rules for assigning to complex types are too (1) Dec 16 2006 Bugzilla still down (8) Dec 15 2006 d.puremagic.com down (1) Dec 14 2006 [Issue 689] New: Clean up the spec printfs! :) (7) Dec 13 2006 [Issue 688] New: Implicit function template match doesn't work for classes (5) Dec 13 2006 [Issue 687] New: DDoc doesn't document anonymous enums (2) Dec 13 2006 [Issue 686] New: [Regression] opCast of a struct or union is called in nonsensical circumstances (3) Dec 12 2006 [Issue 685] New: dmd assertion failure (3) Dec 12 2006 [Issue 684] New: dmd should compile this (3) Dec 12 2006 [Issue 683] New: dmd segv, this ain't the same as bug 682 (5) Dec 12 2006 [Issue 682] New: dmd segfault with vararg template (2) Dec 12 2006 [Issue 681] New: Array -- Implicit type doc updates needed (3) Dec 12 2006 [Issue 680] New: incorrect placement of _D in symbol D85TypeInfo_S_D3std9dateparse9DateParse8classifyMFAaZE3std9dateparse9DateParse2DP6DateID6__initZ (1) Dec 12 2006 [Issue 679] New: Spec needs allowances for copying garbage collection (3) Dec 12 2006 Is this correct behavyor? (template tuples) (1) Dec 11 2006 [Issue 678] New: should this be a bug?? (10) Dec 11 2006 [Issue 677] New: [Tracker] Get the documentation cleaned up for 1.0 (7) Dec 11 2006 [Issue 676] New: These two funcs shouldn't conflict (6) Dec 11 2006 TypeInfo for arrays seem wrong (1) Dec 11 2006 [Issue 675] New: %a format is wrong for denormals. [bug in DMC?] (4) Dec 10 2006 [Issue 674] New: -v1 and -d options allowed at the same time (3) Dec 10 2006 T[] -> T* implicit converstion still working? (2) Dec 10 2006 [Issue 673] New: ABI as documented is 32 bit specific.. how about 64 bits? (10) Dec 09 2006 [Issue 672] New: Compiler endless loop with nested class object (3) Dec 09 2006 [Issue 671] New: Weird class reference declaration compiles (7) Dec 09 2006 [Issue 669] New: (a == b) misuses opCmp and opEquals (5) Dec 09 2006 [Issue 668] New: Use of *.di files breaks the order of static module construction (13) Dec 09 2006 [Issue 667] New: incorrect value for std.socket.SocketShutdown.BOTH (2) Dec 09 2006 [Issue 666] New: missing pthread functions (4) Dec 09 2006 [Issue 665] New: missing functions in std.c.linux.linux (2) Dec 09 2006 [Issue 664] New: is(func T == return) ignores variadic arguments (17) Dec 07 2006 [Issue 663] New: Slice assignment does not bounds check when it should (3) Dec 07 2006 [Issue 662] New: Support functions as basictypes and enum properties (4) Dec 06 2006 [Issue 661] New: Error using a zero-init struct's init property (3) Dec 06 2006 [Issue 658] New: struct pointers in with() (6) Dec 06 2006 [Issue 655] New: Operator overload uses opIndex instead of opIndexAssign (4) Dec 05 2006 [Issue 654] New: Const string member using implicit type inference gives garbage in certain situation (3) Dec 05 2006 Documentation bug (2) Dec 05 2006 Compiler crash (3) Dec 05 2006 [Issue 653] New: AAs are slightly broken (3) Dec 05 2006 bug or feature? (4) Dec 05 2006 print error messages but no line number (2) Dec 05 2006 [Issue 652] New: Implement write and writeln in std.stdio (5) Dec 05 2006 [Issue 651] New: Assertion failure: 'global.errors' on line 2622 in file 'template.c' (3) Dec 05 2006 [Issue 650] New: Assertion failure: '0' on line 774 in file 'expression.c' (3) Dec 04 2006 [Issue 649] New: format() hangs in thread (6) Dec 04 2006 [Issue 648] New: DDoc: unable to document mixin statement (16) Dec 04 2006 [Issue 647] New: Ddoc: documenting anonymous enum prevents documentation of values from being emitted. (5) Dec 04 2006 [Issue 645] New: Race condition in std.thread.Thread.pauseAll (3) Dec 04 2006 [Issue 644] New: Ddoc: aliases used as parameters/fields revert to base type in generated docs. (6) Dec 04 2006 [Issue 643] New: dmd crashes with fwd-referenced .sizeof via aliases (3) Dec 04 2006 [Issue 642] New: error: mixin "static this" into where it cannot be (8) Dec 03 2006 Bug #146 (3) Dec 03 2006 [Issue 641] New: Complex string operations in template argument ICEs dmd (4) Dec 03 2006 [Issue 640] New: Strage error messages around structInstance.init (4) Dec 03 2006 [Issue 639] New: Escaped tuple parameter ICEs dmd (4) Dec 03 2006 [Issue 638] New: additional leading D in symbol D_D3std9dateparse9DateParse8classifyFAaZE3std9dateparse9DateParse2DP6DateID6__initZ (2) Dec 03 2006 [Issue 637] New: internal symbols are missing the leading underscore (4) Dec 03 2006 [Issue 636] New: Excessive "1: " in error message (2) Dec 03 2006 [Issue 635] New: regression: looping "Error: outer class Outer 'this' needed to 'new' nested class Inner" (3) Dec 02 2006 d1.0blocker nominations still not being answered (1) Dec 02 2006 [Issue 634] New: writef doesn't work on enums (2) Dec 02 2006 [Issue 633] New: Enum promotion rules are not specified (3) Dec 02 2006 [Issue 632] New: Typedef promotions spec ambiguous - ultimate base type or lowest common denominator? (4) Dec 02 2006 [Issue 631] New: Spelling errors in DMD distribution (5) Dec 02 2006 [Issue 630] New: Obscure, unimplemented features related to in/out contracts (5) Dec 02 2006 [Issue 629] New: Misleading error message "Can only append to dynamic arrays" (2) Dec 02 2006 [Issue 628] New: Assertion failure: '0' on line 91 in file 'init.c' (3) Dec 02 2006 [Issue 627] New: Concatenation of strings to string arrays with ~ corrupts data (5) Dec 02 2006 [Issue 626] New: std.format.doFormat accepts non-string arrays with any format specifier (3) Dec 02 2006 Assertion failure: '!vthis->csym' on line 412 in file 'glue.c' (1) Dec 01 2006 [Issue 625] New: static import and renamed import of mixin don't work (4) Nov 30 2006 [Issue 623] New: Assertion failure: 'global.errors' on line 2622 in file 'template.c' (2) Nov 30 2006 [Issue 622] New: There should be a warning for unininitalized class reference (5) Nov 30 2006 toString identification with imported std.thread (1) Nov 30 2006 [Issue 621] New: When inside a loop, if you call break inside a try block the finally block is never executed (5) Nov 30 2006 [Issue 620] New: Can't use property syntax with a template function (10) Nov 29 2006 [Issue 619] New: Alias of templated struct instance crashes 0.175 (3) Nov 29 2006 [Issue 618] New: The following program crashes dmd.exe 0.175 (4) Nov 28 2006 Overload issue between char[] and char*, inwhich the postfix should solve (3) Nov 28 2006 [Issue 617] New: IFTI doesn't use normal promotion rules for non-template parameters (6) Nov 28 2006 [Issue 616] New: ICE defining templates with unallowed template parameter types (2) Nov 27 2006 [Issue 615] New: dmd does not properly read dmd.conf with Unix line-ending characters (3) Nov 27 2006 [Issue 614] New: Real and imaginary properties of complex numbers not allowed as template arguments (6) Nov 27 2006 The IX PPPR (Pending Peeves Progress Review) (1) Nov 27 2006 [Issue 613] New: Error message still states that '===' and '!==' are merely deprecated (3) Nov 27 2006 [Issue 612] New: Associative arrays ignore opEquals, contrary to the spec (2) Nov 27 2006 [Issue 611] New: IsExpression fails when inside implemented interface (4) Nov 27 2006 [Issue 610] New: Undocumented behaviour: ~ and ~= can now concatenate an array with a single element (2) Nov 27 2006 [Issue 609] New: Const struct member is a non-constant expression (5) Nov 27 2006 [Issue 608] New: Concatenation of const arrays (except strings defined by string literals) is a non-constant expression (2) Nov 27 2006 [Issue 607] New: toString can't handle char[] (3) Nov 26 2006 [Issue 606] New: auto x = property: variable x cannot be declared to be a function (5) Nov 26 2006 [Issue 605] New: Problem w/ function overload resultion and enums. (2) Nov 26 2006 [Issue 604] New: static, renamed, and selective imports aren't private (2) Nov 26 2006 [Issue 603] New: Undocumented behaviour: case and default create a scope (13) Nov 26 2006 [Issue 602] New: Compiler allows a goto statement to skip an initalization (9) Nov 26 2006 [Issue 601] New: statement.html - Formatting/markup errors in BNF (5) Nov 25 2006 [Issue 600] New: error occurs when using template's tuple argument with typetuple having values (2) Nov 25 2006 [Issue 599] New: ExpressionTuple doesn't match template's alias parameters (5) Nov 25 2006 [Issue 598] New: missing reentrant Linux functions (2) Nov 25 2006 Why is a cast needed here? (4) Nov 25 2006 [Issue 597] New: std.socket TcpSocket and UdpSocket are missing. (4) Nov 25 2006 [Issue 596] New: Support array, arrayliteral and struct in switch and case (15) Nov 25 2006 [Issue 595] New: can't append to array/arrayliteral statically (4) Nov 25 2006 [Issue 594] New: can't cast arrayliteral statically (3) Nov 25 2006 [Issue 593] New: can't deduce from arrayliteral (3) Nov 24 2006 auto x = property: variable x cannot be declared to be a function (4) Nov 23 2006 [Issue 592] New: expand in std.zip reassign values to archievemember's members prevent from correctly unzip some zip files (5) Nov 23 2006 [Issue 591] New: version=LittleEndian crash the compiler (2) Nov 23 2006 [Issue 590] New: std.stream has no way to create a text-mode file (1) Nov 23 2006 [Issue 589] New: std.string.newline should be char[] not char[2] (2) Nov 23 2006 Array initialization - compiler error (2) Nov 23 2006 [Issue 588] New: lazy argument and nested symbol support to std.demangle (6) Nov 23 2006 std.perf functions unintuitive (windows version) (2) Nov 23 2006 optlink error: filenames with spaces (2) Nov 23 2006 [Issue 587] New: DMD crashes compiling char[][] initialization (7) Nov 23 2006 [Issue 586] New: Cannot index tuple with non-type elements (5) Nov 22 2006 [Issue 585] New: dmd crashes with segmentation fault (4) Nov 22 2006 Mixin problem when compiled as a lib (1) Nov 22 2006 [Issue 584] New: Misleading error message "non-constant expression" in tricky template code (4) Nov 21 2006 [Issue 583] New: Throw statements in contracts (2) Nov 21 2006 dmd core dumped (2) Nov 21 2006 [Issue 582] New: Cannot slice mixed tuples (4) Nov 21 2006 Synchronized object must not be deleted. causes useless error message (5) Nov 21 2006 [Issue 581] New: Error message without line number in tricky template code (4) Nov 20 2006 [Issue 580] New: Inconsistent constant->enum conversion rules (2) Nov 19 2006 [Issue 579] New: BufferedFile fails open big files (3) Nov 19 2006 [Issue 577] New: statement.html - NonEmptyStatement grammar lists DebugStatement and VersionStatement, which are not defined (2) Nov 19 2006 [Issue 576] New: version.html - ConditionalStatement grammar doesn't make sense (2) Nov 19 2006 [Issue 574] New: DMD uses D calling convention for returning complex floats from functions with C calling convention (2) Nov 19 2006 [Issue 573] New: Segfault from version(release) statement (6) Nov 19 2006 [Issue 572] New: syntax error when using template instantiation with typeof (4) Nov 18 2006 [Issue 571] New: class instance member template returns strange value (5) Nov 18 2006 [Issue 570] New: Bogus recursive mixin error (3) Nov 18 2006 [Issue 569] New: Bogus forward reference error in template inside variadic template (3) Nov 18 2006 [Issue 568] New: Support to implicitly deduce class template in function template (3) Nov 18 2006 [Issue 567] New: Compiler crash with conflicting templates (5) Nov 18 2006 [Issue 566] New: Adding non-static members and functions to classes doesn't error (8) Nov 18 2006 [Issue 565] New: Cannot forward reference types within template parameter list (2) Nov 18 2006 [Issue 564] New: Setting predefined versions on the command line causes crashes (4) Nov 18 2006 [Issue 563] New: DebugSpecification doesn't work (3) Nov 18 2006 [Issue 562] New: Source file without BOM starting with non-ASCII compiles and runs (2) Nov 18 2006 [Issue 561] New: Incorrect duplicate error messagae when trying to create instance of interface (4) Nov 18 2006 [Issue 560] New: Cannot escape reference to variadic parameter (3) Nov 18 2006 [Issue 559] New: Final has no effect on methods (5) Nov 18 2006 [Issue 558] New: Final has no effect on classes (3) Nov 18 2006 [Issue 557] New: ICE returning a tuple from a function (Assertion failure: '0' on line 694 in file 'glue.c') (3) Nov 18 2006 [Issue 556] New: is (Type Identifier : TypeSpecialization) doesn't work as it should (3) Nov 18 2006 [Issue 555] New: Integral ireal literals can't be specified (4) Nov 18 2006 [Issue 554] New: Division by zero results in two identical errors (2) Nov 18 2006 [Issue 553] New: Assertion failure: '0' on line 609 in file 'constfold.c' on modulo of complex number (2) Nov 18 2006 [Issue 552] New: Internal error: ..\ztc\cg87.c 1327 on in-function modulo of imaginary number (2) Nov 18 2006 [Issue 551] New: Modulo operator works with imaginary and complex operands (4) Nov 18 2006 [Issue 550] New: Shifting by more bits than size of quantity is allowed (6) Nov 17 2006 [Issue 549] New: A class derived from a deprecated class is not caught (2) Nov 17 2006 [Issue 548] New: Accessing a value of a deprecated enum is not caught (2) Nov 17 2006 [Issue 547] New: Accessing a deprecated member variable through an explicit object reference is not caught (2) Nov 17 2006 [Issue 546] New: Error message for accessing a deprecated variable is doubled (5) Nov 17 2006 [Issue 545] New: Attempt to access a static built-in property of a deprecated struct, union, enum or typedef is not caught (2) Nov 17 2006 [Issue 544] New: Variable declared of a deprecated type (other than a class) is not caught (2) Nov 17 2006 [Issue 543] New: Function return of a deprecated type is not caught (2) Nov 17 2006 [Issue 542] New: Function parameter of a deprecated type (other than a class) is not caught (2) Nov 17 2006 [Issue 541] New: Incorrect line number for a function parameter of a deprecated class type (2) Nov 17 2006 [Issue 540] New: Nested template member function error - "function expected before ()" (8) Nov 17 2006 New: BufferedFile fails open big files (1) Nov 17 2006 [Issue 539] New: can't instantiate nested template of same name (4) Nov 16 2006 [Issue 538] New: Can't return an expression tuple from a function (10) Nov 16 2006 [Issue 537] New: ICE from unnamed tuple parameter (2) Nov 16 2006 [Issue 536] New: Assertion failure: template.c 2735 - trying to instantiate an undefined template with the same name as the module (2) Nov 16 2006 [Issue 535] New: writef doesn't work on interfaces (7) Nov 16 2006 [Issue 534] New: IPF trying to initialize an associative array (3) Nov 16 2006 [Issue 533] New: Cannot use int from tuple as an index (5) Nov 16 2006 [Issue 532] New: Wrong name mangling for template alias params of local vars (7) Nov 16 2006 [Issue 531] New: Nested template not usable directly in alias (4) Nov 16 2006 [Issue 530] New: segfault assigning array literal to a non-array const (4) Nov 16 2006 [Issue 529] New: segfault when passing .tupleof to variadic template (2) Nov 16 2006 [Issue 528] New: cstream.flush() returns EOF early for din. (1) Nov 15 2006 [Issue 527] New: Compiler crash when use array in template argument (2) Nov 15 2006 [Issue 526] New: Segmentation fault when use typetuple in template argument (4) Nov 15 2006 [Issue 525] New: can't use array variable in tuple index (6) Nov 15 2006 [Issue 524] New: Compiler crash when compiling (6) Nov 15 2006 [Issue 523] New: I think this is a GC bug (3) Nov 15 2006 [Issue 522] New: frontend: 64-bit format string cleanup (3) Nov 15 2006 [Issue 521] New: frontend: incorrect error(Loc, const char*, char*) declaration in mars.h (2) Nov 15 2006 [Issue 520] New: Invariants allowed to call public functions (2) Nov 15 2006 [Issue 519] New: Invariant not called from autogenerated constructor (11) Nov 15 2006 [Issue 518] New: Destructors cannot be const or auto - or scope (2) Nov 15 2006 [Issue 517] New: std.compiler outdated (2) Nov 15 2006 [Issue 516] New: Mutually calling constructors allowed (10) Nov 15 2006 [Issue 515] New: Spec incorrect in where .offsetof can be applied (8) Nov 15 2006 [Issue 514] New: Misleading error message for static const initialisation (2) Nov 15 2006 [Issue 513] New: using struct initializer on static array crashes the compiler (2) Nov 15 2006 [Issue 512] New: Assigning to constants in a forwarded constructor doesn't work (2) Nov 15 2006 [Issue 511] New: Various problems in the documentation (60) Nov 15 2006 [Issue 510] New: Nonworking implicit conversions between arrays and pointers (3) Nov 15 2006 [Issue 509] New: [wd]char[1] does not convert to [wd]char (4) Nov 15 2006 [Issue 508] New: All members of an array need not be initialised (4) Nov 15 2006 [Issue 507] New: Error: 'this' is required, but ... is not a base class of ... (3) Nov 14 2006 [Issue 506] New: static import and renamed import of mixin don't work (2) Nov 14 2006 [Issue 505] New: rdmd and dmd do not correctly preserve program arguments with spaces. (3) Nov 14 2006 [Issue 504] New: foreach with a file failes (3) Nov 13 2006 [Issue 503] New: Names of arguments to atan2 are backwards (2) Nov 13 2006 [Issue 502] New: reimplementing methods for interface (6) Nov 13 2006 [Issue 501] New: Bad interaction between 'with' and IFTI in template methods (2) Nov 13 2006 [Issue 500] New: Cannot assign to delegate during definition (5) Nov 13 2006 [Issue 499] New: Multiple overrides of the destructor when using signals (6) Nov 12 2006 [Issue 498] New: Signal mixins need to import (2) Nov 12 2006 [Issue 497] New: frontend: 64-bit cleanup of sprintf buffer sizes (3) Nov 12 2006 [Issue 496] New: frontend: 64-bit cleanup of utf_decode* (3) Nov 11 2006 [Issue 495] New: ICE passing variadic arglist to another variadic template (4) Nov 11 2006 [Issue 494] New: template's variadic argument can't use as type (3) Nov 09 2006 [Issue 493] New: Partial IFTI does not work (12) Nov 08 2006 [Issue 492] New: Use the fully qualified module name for output files rather than the source file path. (2) Nov 08 2006 [Issue 491] New: Create directories necessary for writing files when using -Dd and -Hd option (2) Nov 08 2006 [Issue 490] New: Static struct initializer without static attribute aborts dmd with assertion (3) Nov 08 2006 [Issue 489] New: .classinfo not working with fqn (3) Nov 08 2006 [Issue 488] New: regression: recursive typeof segmentfaults (2) Nov 08 2006 [Issue 487] New: regression: multiple definition of `_D7dstress3run1t13template_32_A31__T3sumVee00000000000000800040Z3sume' (2) Nov 07 2006 [Issue 486] New: Writefln on null object should not trigger access error. (2) Nov 07 2006 [Issue 485] New: struct sizeof not possible from type (2) Nov 06 2006 [Issue 484] New: Compiler segfault with template variadic used as a template alias. (3) Nov 06 2006 [Issue 483] New: ICE-invalid with tuple. mangleof. (3) Nov 05 2006 [Issue 482] New: _arguments for variadic not available in precondition (5) Nov 04 2006 [Issue 481] New: Letting compiler determine length for fixed-length arrays (18) Nov 04 2006 [Issue 480] New: too many initializers error message doesn't give line number (4) Nov 04 2006 Internal error: ../ztc/cod1.c 2751 (2) Nov 03 2006 [Issue 479] New: can't compare arrayliteral statically with string (3) Nov 03 2006 [Issue 478] New: can't compare arrayliteral statically with variable (2) Nov 03 2006 [Issue 477] New: Malformed URL in documentation (2) Nov 03 2006 Internal error on missing return in literal delegate (1) Nov 02 2006 [Issue 476] New: DMD doesn't resolve its location properly on Windows (2) Nov 02 2006 [Issue 475] New: DMD segfault on recursive variadic template (3) Nov 01 2006 [Issue 474] New: in ASM block last line can't be a label (6) Nov 01 2006 _d_notify_release !?!?! (4) Oct 31 2006 [Issue 473] New: Arrays should have a way to take out an element or slice (2) Oct 31 2006 [Issue 472] New: zero sized _init_* symtab-objects (4) Oct 31 2006 [Issue 471] New: Protection attributes of mixin instances are applied in a wrong scope. (3) Oct 30 2006 [Issue 470] New: undocumented encoding of inifiles (3) Oct 29 2006 Compiler asserts instead of giving an error message with non-static (3) Oct 28 2006 [Issue 469] New: Incorrect documentation in std.date (2) Oct 28 2006 [Issue 468] New: argument wrongfully identified as type in template instantiation (3) Oct 28 2006 [Issue 467] New: double inheritance from the same interface (5) Oct 28 2006 [Issue 466] New: dmd prevent this from link , if so please prevent it from compiling (3) Oct 27 2006 [Issue 465] New: errors when trying to use static templated methods (3) Oct 27 2006 -cov option on Linux creates dependency on _ModuleInfo_6object (1) Oct 27 2006 Is a template like copy-paste? (4) Oct 27 2006 [Issue 464] New: 64bit clean dchar.c (3) Oct 26 2006 [Issue 463] New: private module members have global bindings instead of local ones (3) Oct 26 2006 Bug from cpuid wrapper thread in D.announce: char[12] str = ""; (2) Oct 25 2006 [Issue 462] New: invalid typeinfo usage breaks dmd compiler (3) Oct 25 2006 [Issue 461] New: Constant not understood to be constant when circular module dependency exists. (5) Oct 25 2006 [Issue 460] New: Assertion failure: '!needThis()' on line 143 in file 'tocsym.c' (3) Oct 25 2006 [Issue 459] New: Setting LIB in dmd/bin/sc.ini has no effect on linking (6) Oct 25 2006 [Issue 458] New: set version=D_Unittest if -unittest was issued (2) Oct 25 2006 [Issue 457] New: notifyRelease: debugging artifacts (2) Oct 24 2006 [Issue 456] New: DMD accepts keywords in module names if no ModuleDeclaration is used (3) Oct 24 2006 [Issue 455] New: DMD accepts illegal identifiers in module names if no ModuleDeclaration is used (2) Oct 24 2006 [Issue 454] New: Setting LIB environment variable has no effect on Windows (4) Oct 24 2006 [Issue 453] New: When importing modules compiler can not distinguish between directory and file (8) Oct 24 2006 [Issue 452] New: Struct initialization fails with compiler assertion (2) Oct 24 2006 [Issue 451] New: frontend: redundant function definitions (1) Oct 24 2006 [Issue 450] New: frontend: please use <stdint.h> to increase portability (1) Oct 24 2006 [Issue 449] New: frontend: html.h and complex_t.h are unprotected against multiple inclusion (1) Oct 24 2006 [Issue 448] New: frontend: redefinition of size_t (1) Oct 24 2006 [Issue 447] New: frontend: writeable (8) Oct 23 2006 [Issue 446] New: Anonymous class and "return without calling constructor" (3) Oct 23 2006 Bug or miss feature in nested class? (5) Oct 21 2006 [Issue 445] New: debugging artifact: DeclarationExp::scanForNestedRef (2) Oct 20 2006 small mistake in (2) Oct 20 2006 Strange error message with alias (4) Oct 19 2006 [Issue 444] New: Inside a foreach with delegates, void return does not compile (3) Oct 19 2006 [Issue 443] New: assignment in return when using cdouble is broken (3) Oct 18 2006 [Issue 442] New: Crash on foreach of mixed-in aggregate. (2) Oct 18 2006 [Issue 441] New: Crash on foreach of mixed-in aggregate. (5) Oct 17 2006 "Comment processing conceptually happens before tokenization." (6) Oct 17 2006 [Issue 440] New: dmd.170 fails to mark final methods as implementations of abstract ones (5) Oct 17 2006 [Issue 439] New: Cannot use an array as new[] size argument. (2) Oct 17 2006 [Issue 438] New: Compiler allows returning value from void function (4) Oct 17 2006 [Issue 437] New: dmd loops while compiling this code (3) Oct 16 2006 [Issue 436] New: OutOfMemoryException undocumented, misdocumented (2) Oct 15 2006 [Issue 435] New: Constructors should be templatized (11) Oct 15 2006 [Issue 434] New: Compiler crash on template function syntax error (4) Oct 14 2006 [Issue 433] New: A deprecated, same-named alias screws up resolution of imports (2) Oct 14 2006 [Issue 432] New: invalid expression causes compiler seg-fault (3) Oct 12 2006 [Issue 431] New: Invalid case selected when switching on a long (4) Oct 12 2006 [Issue 430] New: incorrect UTF-8 detection for drafted UTF-16/32 source files (2) Oct 11 2006 [Issue 429] New: Unable to distinguish between empty and uninitialized dynamic arrays (5) Oct 11 2006 [Issue 428] New: environment settings in dmd.conf uppercase names (2) Oct 11 2006 [Issue 427] New: source files starting with a number are accepted by dmd (3) Oct 11 2006 [Issue 426] New: source files starting with a non-ASCI letter are rejected by dmd (3) Oct 10 2006 [Issue 425] New: dmd compilation generate/leave empty folders. (3) Oct 10 2006 [Issue 424] New: Unexpected OPTLINK Termination at EIP=0044C37B (34) Oct 09 2006 [Issue 423] New: dmd ignores empty commandline arguments (11) Oct 09 2006 [Issue 422] New: -version=X and -debug=X accept identifiers containing illegal characters (3) Oct 09 2006 [Issue 421] New: 'not a lvalue' crashes DMD (2) Oct 09 2006 [Issue 420] New: mixin make dmd break (3) Oct 09 2006 [Issue 419] New: Anonymous classes are not working. (3) Oct 09 2006 [Issue 418] New: -version=X and -debug=X command line arguments are rejected if the identifier begins with a non-ASCI letter (3) Oct 09 2006 [Issue 417] New: infinite loop in std.zlib.Compress.flush when passing Z_FULL_FLUSH (4) Oct 09 2006 [Issue 416] New: regression: unittest failure in phobos, math(501) (4) Oct 09 2006 [Issue 415] New: conflicting template functions overloads (7) Oct 09 2006 [Issue 414] New: interfaces shouldn't be able to inheit from classes (3) Oct 09 2006 [Issue 413] New: overloaded function resolution with null parameter (2) Oct 09 2006 [Issue 412] New: overloaded function resolution with null parameter (6) Oct 08 2006 [Issue 411] New: array alloc with size from another array (4) Oct 08 2006 [Issue 410] New: regression: segfault after "is not an lvalue" (4) Oct 08 2006 [Issue 409] New: function resolving with global function if member matches (4) Oct 08 2006 [Issue 408] New: Template instance matching doesn't work sometimes (4) Oct 08 2006 [Issue 407] New: casting array literals to int causes compiler seg-fault (3) Oct 07 2006 name shadowing in if statement (2) Oct 07 2006 [Issue 406] New: std.loader is broken on linux (2) Oct 06 2006 [Issue 405] New: typeof in TemplateParameterList causes compiletime segmentfault (3) Oct 06 2006 Conditional ? bug (9) Oct 06 2006 [Issue 404] New: Regression: missing source location in "Error: array initializers as expressions are not allowed" (2) Oct 05 2006 [Issue 402] New: compiler crash with mixin and forward reference (3) Oct 05 2006 [Issue 401] New: add more std.gc APIs, e.g. std.gc.allocatedMemory(); (4) Oct 05 2006 About Format String Attack for D's *writef*() (5) Oct 04 2006 [Issue 400] New: forward reference error; no propety X for type Y (4) Oct 04 2006 -op creates spurious directories (2) Oct 04 2006 [Issue 399] New: -w misses unreacheable "case" statement (4) Oct 04 2006 [Issue 398] New: No way to abort compilation in a doubly recursive mixin (4) Oct 03 2006 [Issue 397] New: writing an file to a partition without enough free space creates "ghosts" files (2) Oct 03 2006 shortening an example in the docs (2) Oct 03 2006 [Issue 396] New: aliased identifier in asm blocks cause compiler segment faults (3) Oct 02 2006 [Issue 395] New: std.regexp incorrectly handles UTF text (2) Oct 02 2006 [Issue 394] New: associative array of interfaces causes crash (2) Oct 02 2006 Documentation for std.pref not provided online, nor in distro (2) Oct 02 2006 [Issue 393] New: wordcount example does not use <code> (2) Oct 02 2006 [Issue 392] New: Phobos build issues (patch) (3) Oct 02 2006 [Issue 391] New: .sort and .reverse break utf8 encoding (17) Sep 30 2006 Please fix bugzilla 107 (1) Sep 29 2006 [Issue 390] New: Cannot forward reference enum nested in struct (5) Sep 29 2006 [Issue 389] New: Cannot link to std.path.altsep (3) Sep 29 2006 [Issue 388] New: incorrect forum link (2) Sep 28 2006 [Issue 387] New: When EOF of din is reached, a line of output is lost (20) Sep 28 2006 [Issue 386] New: anonying "import conflicts" for years!!! Please fix it ASAP!!! (3) Sep 28 2006 [Issue 385] New: unprotected command line parsing (2) Sep 27 2006 [Issue 384] New: Different behaviour when compiling as separate object files (3) Sep 27 2006 [Issue 383] New: frontend's 32bitism in tohash/calcHash related code (6) Sep 27 2006 [Issue 382] New: Critical "Previous definition different" bug (4) Sep 27 2006 [Issue 381] New: array literals are broken; Internal error: ..\ztc\cod1.c 2525 (3) Sep 27 2006 [Issue 380] New: cannot use typeof(*this) in a static context (3) Sep 27 2006 [Issue 379] New: wrong thisptr type in typedef'ed struct (5) Sep 27 2006 [Issue 378] New: Assertion failure: '0' on line 216 in file 'init.c' (7) Sep 27 2006 wrong function overload (2) Sep 27 2006 [Issue 377] New: Compiler error when using -inline only (5) Sep 27 2006 [Issue 376] New: assertion in template.c:2141 and wrong return value (6) Sep 26 2006 [Issue 374] New: -ofd: outputs to root directory instead of current on that drive (2) Sep 26 2006 [Issue 373] New: Spec problems with TypeInfo: error and omission. (3) Sep 26 2006 [Issue 372] New: -op does not create subdirectories (2) Sep 26 2006 [Issue 371] New: ICE on mutual recursive typeof in function declarations (3) Sep 26 2006 [Issue 370] New: Compiler stack overflow on recursive typeof in function declaration. (7) Sep 26 2006 [Issue 369] New: "immediate"-function types allowed as part of delegate/function types. (3) Sep 26 2006 [Issue 368] New: "immediate"-function types allowed as the return type of functions. (3) Sep 25 2006 [Issue 367] New: Bad ddoc comments in std.stream (2) Sep 25 2006 [Issue 366] New: Adding trailing zeros to a real literal makes it smaller! (6) Sep 24 2006 [Issue 365] New: Regression: Bad code generation for floating point == and != (8) Sep 23 2006 Big bug with scope() in nested { } (5) Sep 23 2006 [Issue 364] New: Mysterious access violation when using delegate()[1]... parameter (2) Sep 23 2006 [Issue 363] New: XHTML support (6) Sep 22 2006 [Bugzilla issue] Bug in the 'newsgroup post to bugzilla comment' (3) Sep 21 2006 [Issue 361] New: Compile-time floating-point calculations are sometimes inconsistent (2) Sep 21 2006 [Issue 360] New: Compile-time floating-point calculations are sometimes inconsistent (21) Sep 21 2006 strange _sort_ of bug (3) Sep 20 2006 [Issue 357] New: D keywords in import/module are (unnecessary) forbidden (7) Sep 20 2006 [Issue 356] New: std,math.tan doesn't preserve NaN payloads [fix included] (3) Sep 19 2006 [Issue 355] New: ICE from enum : nonexistent type (5) Sep 19 2006 Small bug in article on digitalmars.com (1) Sep 16 2006 [Issue 354] New: Internal error: e2ir.c 772 with bad template use (3) Sep 16 2006 [Issue 353] New: null passed as a char[] template argument, concatenated with a string literal, is a non-constant expression (3) Sep 16 2006 [Issue 352] New: Assertion failure: expression.c 753 - concatenating strings in a template calling another template (3) Sep 16 2006 [Issue 351] New: Recursive string template doesn't work if the terminating specialisation is given first (3) Sep 16 2006 [Issue 350] New: Modulo doesn't work for negative values (4) Sep 14 2006 [Issue 349] New: Function matching with enums is erratic (3) Sep 14 2006 [Issue 348] New: string concat in dynamically loaded dll code crashes program (4) Sep 14 2006 [Issue 347] New: TOK116 has no effect in expression (a) (2) Sep 14 2006 Incorrect code generation -O2 gdc (2) Sep 12 2006 [Issue 346] New: 'is' operator inconsistant with arrays (5) Sep 11 2006 [Issue 345] New: updated std.uni.isUniAlpha to Unicode 5.0.0 (4) Sep 10 2006 [Issue 344] New: Typo in docs for std.math.ilogb (2) Sep 10 2006 [Issue 343] New: Compile error using mixin containing struct (3) Sep 10 2006 null to delegate cast? (4) Sep 10 2006 [Issue 342] New: Please add "import std.stdio;" to object.d and remove extern(C) printf; (4) Sep 10 2006 [Issue 341] New: Undocumented function void print() in object.d (3) Sep 10 2006 [Issue 340] New: [Tracker] Forward reference bugs and other order-of-declaration issues (17) Sep 10 2006 [Issue 339] New: Alias of function pointer type cannot be forward referenced (5) Sep 10 2006 [Issue 338] New: Wrong regular expression \s \S descripion (2) Sep 10 2006 [Issue 337] New: IFTI and overloading are incompatible (10) Sep 10 2006 [Issue 336] New: incorrect WIKI makro in std.c.time (2) Sep 10 2006 [Issue 335] New: incorrect std.c.time.CLK_TCK value (Linux) (2) Sep 08 2006 [Issue 334] New: Void Initializer ICE (3) Sep 08 2006 [Issue 333] New: std.c.locale (3) Sep 07 2006 [Issue 332] New: typesafe variadic functions and lazy argument support for std.demangle (3) Sep 07 2006 [Issue 331] New: performance bug in std.uni.toUniLower / std.uni.toUniUpper (2) Sep 07 2006 [Issue 330] New: std.string.tolower / std.string.toupper broken for non-ASCII strings (3) Sep 07 2006 [Issue 329] New: throwing within a finally statement (2) Sep 06 2006 [Issue 328] New: Access violation when setting length of an array of fairly large static arrays (2) Sep 06 2006 [Issue 327] New: Compiler accepts ';' by itself as a statement (9) Sep 06 2006 [Issue 326] New: calculation bug (4) Sep 06 2006 [Issue 325] New: Overriding members and overloading with alias causes bogus error messages in with(). (3) Sep 05 2006 lazy in main (3) Sep 05 2006 [Issue 324] New: DMD Optimization Bug (access violation due to bad stack pointer) (2) Sep 05 2006 Invariant grammar (2) Sep 04 2006 Buggy DStress test cases (2) Sep 03 2006 [Issue 323] New: Error: need opCmp for class Bar (28) Sep 03 2006 bug? Error: need opCmp for class Bar (2) Sep 03 2006 [Issue 322] New: Spawning threads which allocate and free memory leads to pause error on collect (6) Sep 02 2006 d1.0blocker - anyone at home? (8) Sep 03 2006 [Issue 321] New: Wrong license in Phobos (for Synesis contribs) (4) Sep 02 2006 [Issue 320] New: Delegates should be allowed as foreach aggregates (3) Sep 02 2006 [Issue 319] New: local variable can hide member variable (5) Sep 02 2006 [Issue 318] New: wait does not release thread resources on Linux (6) Sep 02 2006 [Issue 317] New: Need full translation of the Windows API headers (9) Sep 01 2006 [Issue 316] New: No way to selectively expose imported symbols (2) Sep 01 2006 Internal error: ..\ztc\cod1.c 2521 (2) Sep 01 2006 Documentation error in comparison.html (3) Aug 31 2006 Documentation error in d/phobos/object.html (2) Aug 31 2006 cannot export whole class (2) Aug 30 2006 Unable to explicitly cast imaginary float to a real floating-point (dmd v0.165) (5) Aug 28 2006 [Issue 315] New: Exception handling is broken for delegates on Linux (5) Aug 27 2006 [Issue 314] New: Static, renamed, and selective imports are always public (47) Aug 27 2006 [Issue 313] New: Fully qualified names bypass private imports (18) Aug 26 2006 [Issue 311] New: Object files missing certain template instantiations (5) Aug 24 2006 [Issue 310] New: Code compiled by dmd dies without explanation / exception. Code is attached. (3) Aug 24 2006 [Issue 309] New: std.boxer incorrectly handles interface instances (major problem in dmd reflection?) (4) Aug 24 2006 Final makes no difference? (10) Aug 24 2006 [Issue 308] New: Documentation of float.max_exp, min_exp is misleading (7) Aug 22 2006 [Issue 306] New: dmd 165 breaks existing code (4) Aug 22 2006 [Issue 305] New: version and static if blocks introduce new scope for 'scope' statement (3) Aug 21 2006 [Issue 304] New: Internal error: e2ir.c 145 (7) Aug 21 2006 base 1 bug in std.string.toString? (3) Aug 21 2006 [Issue 303] New: delegate in finally (4) Aug 21 2006 [Issue 302] New: in/out contract inheritance yet to be implemented (16) Aug 20 2006 [Issue 301] New: Lazy Delegate Evaluation messes with writefln (2) Aug 20 2006 [Issue 300] New: Lazy Delegate Evaluation (2) Aug 20 2006 [Issue 299] New: improved linux.mak for Phobos (3) Aug 20 2006 [Issue 298] New: etc/gamma is included in phobos.lib but isn't part of libphobos.a (2) Aug 20 2006 [Issue 297] New: Shadowing declarations allowed in foreach type lists (3) Aug 19 2006 odd syntax for foreach (4) Aug 19 2006 [Issue 296] New: Template constant can not be used as size of static array. (3) Aug 19 2006 [Issue 295] New: Property call followed by sliceAssign not working for custom opSliceAssign (3) Aug 18 2006 Buggy inline assembler (8) Aug 18 2006 DMD 0.164: Possible bug in order of evaluation (4) Aug 17 2006 casting objects (1) Aug 17 2006 DMD-0.164 regressions (5) Aug 17 2006 [Issue 294] New: DDoc: Function templates get double and incomplete documentation (5) Aug 17 2006 [Issue 293] New: Expression uint.max + 1 yields 0 (zero) (7) Aug 17 2006 [Issue 292] New: Small inconsistency on the "rationale" page (2) Aug 17 2006 Ddoc and version (7) Aug 17 2006 [Issue 291] New: assertion (6) Aug 16 2006 [Issue 290] New: "U" shaped import name conflicts when using Fully Qualified names (5) Aug 15 2006 [Issue 289] New: Compiler allows (and crashes on) dynamic arrays of typedefs of "immediate"-function types (3) Aug 15 2006 [Issue 288] New: type of opEquals (5) Aug 14 2006 [Issue 287] New: DMD optimization bug arround dynamic array length (6) Aug 14 2006 [Issue 286] New: update Phobo's zlib from 1.2.1 to 1.2.3 (10) Aug 12 2006 [Issue 285] New: Struct method null pointer assert has line number of "0" (6) Aug 12 2006 [Issue 284] New: Wrong type of template value parameter (3) Aug 12 2006 #193 has been reopened (3) Aug 11 2006 [Issue 283] New: listdir does not decend into subdirs on linux (6) Aug 11 2006 "(" and ")" cause problems in ddoc comments (2) Aug 10 2006 [Issue 282] New: Bizarre circular import nested name invisibility issue (10) Aug 09 2006 [Issue 281] New: dmd generates the object code ld cannot link when working with templates (5) Aug 09 2006 [Issue 280] New: Doc of GC (4) Aug 08 2006 Operaror 'new' inside WinMain crashes at runtime (7) Aug 05 2006 [Issue 279] New: Nested class can't access var in outer function scope, if nested in class (3) Aug 04 2006 documentation mentions bit instead of bool (1) Aug 03 2006 [Issue 278] New: dmd.conf search path dosn't work (25) Aug 03 2006 [Issue 277] New: Named mixin operator resolution (6) Aug 02 2006 D Bugzilla System issues (4) Aug 02 2006 [Issue 276] New: Compiler erroneously thinks an aggregate inner template will add a field to it (3) Aug 02 2006 [Issue 275] New: Undefined identifier in instances of templates with forward mixins (2) Aug 01 2006 [Issue 274] New: Different template alias arguments are treated as the same. (2) Aug 01 2006 [Issue 273] New: DDoc generates no documentation for short-hand function template (2) Jul 31 2006 while/synchronized (1) Jul 30 2006 DMD-0.163 versus GDC-0.19 (1) Jul 29 2006 [Issue 272] New: foreach inside anonymous function crashes dmd.exe (3) Jul 29 2006 [Issue 271] New: Incorrect constant evaluation of TypeInfo equality comparisons (5) Jul 29 2006 [Issue 270] New: Compiler allows and crashes on typedefs of "immediate"-function types (11) Jul 29 2006 [Issue 269] New: Dollar unmentioned in spec (3) Jul 29 2006 [Issue 268] New: Bug with SocketSet and classes (22) Jul 28 2006 Bug in HTOD handling << (6) Jul 22 2006 newsgroup moved to new server... (10) Jul 22 2006 [Issue 265] New: Selective import from renamed import behaves strangely (4) Jul 22 2006 [Issue 264] New: No selective static imports (2) Jul 21 2006 [Issue 262] New: Missing DDoc comments in on Socket.blocking (6) Jul 21 2006 [Issue 261] New: _blocking flag not set in Socket.blocking on non-Windows systems (2) Jul 20 2006 [Issue 260] New: conflicting imports (10) Jul 20 2006 int opEquals(Object), and other legacy ints (31) Jul 20 2006 writef / writefln and stderr (4) Jul 20 2006 [Issue 259] New: Comparing signed to unsigned does not generate an error (55) Jul 19 2006 [Issue 258] New: Undefined identifier error for circular import (4) Jul 19 2006 irritating opCmp behaviour for TypeInfo (2) Jul 18 2006 [Issue 257] New: package vars accessible from sub-modules, package funcs not (3) Jul 17 2006 [Issue 256] New: Implicit unsigned to signed doesn't always work. (2) Jul 16 2006 foreach on aggregate class in some delegate litterals (2) Jul 16 2006 [Issue 255] New: Odd performance difference w/ complex doubles. (5) Jul 16 2006 [Issue 254] New: Interfaces with the same function can give 3 different error messages (3) Jul 16 2006 typedef, implicit cast, bug or feature? (2) Jul 15 2006 [Issue 253] New: Invalid <dl> tag generated by Ddoc (2) Jul 14 2006 [Issue 252] New: -w and switch returns = compile errors (6) Jul 14 2006 Software life cycle (8) Jul 13 2006 Bug in htod comment (1) Jul 13 2006 [Issue 251] New: foreach does not allow updating inside with block (8) Jul 12 2006 [Issue 250] New: enum : bool allowed with odd results (3) Jul 10 2006 [Issue 249] New: circular typedef and alias bugs (19) Jul 10 2006 [Issue 248] New: Assertion failure: attrib.c 913 - version without (...) in imported module (3) Jul 09 2006 IFTI Bug (6) Jul 09 2006 name resolution and static function (4) Jul 09 2006 [Issue 247] New: Cannot return from nested functions in contracts (3) Jul 08 2006 [Issue 246] New: class members not initialized (2) Jul 08 2006 Identifier (...) is too long by X characters (18) Jul 08 2006 This code causes an Internal Error (2) Jul 07 2006 Initialization error in classes (5) Jul 07 2006 [Issue 245] New: Typo in Regexp article (2) Jul 06 2006 [Issue 242] New: template implicit template properties doesn't work (7) Jul 06 2006 [Issue 241] New: Template function ICE (5) Jul 05 2006 [Issue 240] New: No file or line information in error message "cannot implicitly convert expression (-1) of type ulong to double" (6) Jul 05 2006 char buffer resize appears broken on linux 1.162 (4) Jul 05 2006 [Issue 239] New: Internal errorÇ changing string literal elements. (2) Jul 03 2006 [Issue 238] New: Cannot initialise const field from foreach loop on associative array (3) Jul 02 2006 [Issue 237] New: std.stream.File.close() doesn't reset isopen flag (4) Jul 02 2006 [Issue 236] New: Class literal expression always says "base classes expected" (3) Jul 02 2006 [Issue 235] New: goto & scope: cannot goto forward into different try block level (12) Jul 02 2006 [Issue 234] New: dynamic arrays in combination with SSE instructions cause segment faults (2) Jul 01 2006 [Issue 233] New: Infinite loops with assembly crash DMD (3) Jun 30 2006 Nested function seems unoverloadable (3) Jun 29 2006 [Issue 232] New: Invalid v-tables :( (4) Jun 29 2006 [Issue 231] New: long is 4-byte aligned in unittest with 4 character module name (13) Jun 28 2006 [Issue 230] New: long.min cannot be parsed (5) Jun 27 2006 [Issue 228] New: Crash on inferring function literal return type with undefined identifier (4) Jun 26 2006 [Issue 227] New: Internal Compiler error: array concatenation/append on struct (6) Jun 26 2006 bug? array concatenation/append on struct (2) Jun 26 2006 phobos.lib errors/bug? (2) Jun 26 2006 unsafe toString() behavior (11) Jun 26 2006 [Issue 226] New: The basic types in declarations need to be updated. (2) Jun 26 2006 [Issue 225] New: object.d uses uint instead of hash_t (2) Jun 25 2006 Problem with asm and short (2) Jun 25 2006 [Issue 224] New: Incorrect warning "no return at end of function" (3) Jun 24 2006 [Issue 223] New: Error message for void.init doesn't specify error location (8) Jun 24 2006 ***** D method override mechanisms borked ****** (42) Jun 23 2006 [Issue 222] New: "Internal error: ..\ztc\cod1.c 1656" with && and || (6) Jun 23 2006 Possible implicit type conversion bug with arithmetic op= (2) Jun 23 2006 [Semi-OT] Trackers in Bugzilla? (2) Jun 23 2006 Bugzilla #113 fix - ineffective code (dmd161) (1) Jun 23 2006 [Issue 221] New: Inconsistent name mangling of bool (a relic of 'bit') (4) Jun 23 2006 [Issue 220] New: ICE with template and mangleof (13) Jun 22 2006 Strange DMD Assertion failure (6) Jun 22 2006 [Issue 219] New: Compiler crash using string literal in non-extern(D) function call (2) Jun 22 2006 [Issue 218] New: Clean up old code for packed bit array support (2) Jun 22 2006 [Issue 217] New: typeof not working properly in internal/object.d (4) Jun 22 2006 ice returning a delegate (1) Jun 22 2006 Documentation on arrays has to be improved (1) Jun 21 2006 [Issue 216] New: ridiculous error message (5) Jun 21 2006 ICE using const as offset in inline assembly (2) Jun 21 2006 [Issue 215] New: static initialization problem - invalid code, bogus error message (3) Jun 20 2006 colon after version is ignored (1) Jun 20 2006 [Issue 214] New: seg-v from scope() in switch (2) Jun 20 2006 DMD 0.161 Access Violation (1) Jun 20 2006 [Issue 213] New: template X is not a member of Y (3) Jun 20 2006 [Issue 212] New: segmentation fault with specific templated code - linux only (3) Jun 19 2006 [Issue 211] New: Linking error with alias mixin params and anonymous methods (7) Jun 19 2006 [Issue 210] New: Strange results when covariantly implementing an interface method defined with an interface return type (2) Jun 19 2006 [Issue 209] New: "Diamond" import name conflicts when using Fully Qualified names (39) Jun 18 2006 [Issue 208] New: Warning when compiling with "-release -w -inline" with import std.format; (2) Jun 18 2006 [Issue 207] New: isUniAlpha fails for values < 'A' (4) Jun 18 2006 [Issue 206] New: attributes private, package, etc appear to be ignored (19) Jun 18 2006 [Issue 205] New: Covariant return types don't work properly (3) Jun 17 2006 [Issue 204] New: Improve error message. (13) Jun 17 2006 [Issue 203] New: std.format.doFormat() pads width incorrectly on Unicode strings (4) Jun 17 2006 [Issue 202] New: std.uni.isUniAlpha() uses a broken binary search (3) Jun 17 2006 What about documentation inconsistencies? (2) Jun 16 2006 [Issue 201] New: the source for etc.gamma is not in the download (3) Jun 16 2006 [Issue 200] New: Statement *must* follow label (6) Jun 16 2006 [Issue 199] New: Label causes scope to collapse into parent (32) Jun 16 2006 seg-v in 4 lines (DMD 0.160 Linux/XP) (7) Jun 16 2006 [Issue 198] New: DDoc: superclass/interface decl expansion (5) Jun 15 2006 [Issue 197] New: mixin mixin repeated twice when error. (3) Jun 15 2006 [Issue 196] New: Static assertion involving typedef's base type fails strangely (4) Jun 14 2006 Wrong DirEntry dates (2) Jun 14 2006 [Issue 195] New: DDoc generates bad output when example contains "protected" attribute (4) Jun 14 2006 [Issue 194] New: DDoc: method-attributes ignored within templated class (6) Jun 14 2006 [Issue 193] New: DDoc generates incorrect expansion for template decls; breaks CandyDoc (5) Jun 13 2006 Returning to bug 113: std.format.doFormat and small hex numbers (1) Jun 13 2006 strange behavior with pointers to function with default args (1) Jun 13 2006 Typo corrections for the webdocs (2) Jun 11 2006 [Bug 192] New: std.zip produces invalid archives on BigEndian targets (2) Jun 11 2006 [Bug 191] New: Cannot refer to member variable in default value for method parameter (16) Jun 11 2006 [Bug 190] New: Cannot forward reference typedef/alias in default value for function parameter (1) Jun 09 2006 undocumented restriction in scope statement (2) Jun 09 2006 Should enhancement requests be allowed in bugzilla? (16) Jun 09 2006 [Bug 189] New: std.path enhancements (5) Jun 09 2006 [Bug 187] New: two errors meaning the same thing from assert(false, 1) (2) Jun 08 2006 Required to link windows header modules (?) (16) Jun 08 2006 [Bug 186] New: 'and' and 'or' as alternatives for && and || (2) Jun 08 2006 [Bug 185] New: typedefs not properly initialised when changing dynamic array length (2) Jun 08 2006 [Bug 184] New: Cannot forward reference typedef within struct (1) Jun 07 2006 simple problem with sc.ini (1) Jun 07 2006 [Bug 183] New: unsupported opcode rsm (2) Jun 07 2006 [Bug 182] New: SSE opcodes pshufd, pshufhw, pshuflw and pshufw are unsupported (2) Jun 07 2006 [Bug 181] New: Spec contradicts itself on whether an array may be partially initialized (1) Jun 07 2006 [Bug 180] New: DMD accepts a function with a non-void return type but no return statements (6) Jun 07 2006 The VIII PPPR (Pending Peeves Progress Review) (2) Jun 07 2006 [Bug 179] New: Covariance screws up when overriding two interfaces or a class and an interface (2) Jun 07 2006 DMD-0.160 regressions (6) Jun 06 2006 [Bug 178] New: Fixed-path locations for specific modules (2) Jun 06 2006 [Bug 177] New: remove inheritance protection (3) Jun 06 2006 ZipArchive doesn't generate valid zip files (5) Jun 06 2006 [Bug 176] New: message "module and package have the same name" (1) Jun 05 2006 can't get function pointer to static member (2) Jun 05 2006 Links on comparision page doesn't work (2) Jun 01 2006 [Bug 173] New: incorrect size calculation for movq (2) Jun 01 2006 link error for 2+ static this() (10) Jun 01 2006 [Bug 172] New: "Internal error: e2ir.c 736" on valid code (2) May 31 2006 [Bug 170] New: std.gc.disable() does not work. (1) May 31 2006 std.gc.disable not implemented or not working? (2) May 30 2006 [Bug 169] New: Compilation of module fails with -unittest (4) May 30 2006 [Bug 168] New: incorrect docs for name mangling template value char arguments (2) May 30 2006 [Bug 167] New: .offsetof doesn't work when a struct/union/class is the target (1) May 30 2006 [Bug 165] New: type inference fails with sizeof and circular imports (1) May 29 2006 extern(Windows) alias bug (8) May 29 2006 Internal compiler errors (2) May 29 2006 [Bug 160] New: static if short-circuit && doesn't work for template arguments (2) May 28 2006 BUG: rdmd cmd line argument bug (8) May 28 2006 DMD-0.158 regressions (3) May 27 2006 [Bug 159] New: forward reverence with invalid struct (5) May 27 2006 [Bug 158] New: weird crash when nesting unions and structs; code order dependent (3) May 26 2006 htod and size_t (3) May 26 2006 std.zlib.Compress / UnCompress are not working (4) May 26 2006 Bug in DWT's syncExec/asyncExec, or possibly DMD or std.thread (1) May 25 2006 DMD 0.158 - Compiler endless loop (2) May 24 2006 [Bug 156] New: Inheriting nested classes and "-inline" throws access violation (4) May 24 2006 [Bug 155] New: Nested classes can't return delegates to their parents. (2) May 23 2006 [Bug 154] New: invalid code generation on linux with custom allocators/deallocators + 'auto' doubts (3) May 23 2006 [Bug 153] New: Assertion failure :: template.c:2111 (3) May 23 2006 Access violation (4) May 23 2006 [Bug 152] New: static assert fails with recursive templates (2) May 23 2006 [Bug 151] New: Pragma without ';' results in undefined symbols (6) May 23 2006 seg-v from template and enum w/ imports (1) May 21 2006 Linker bug - can't handle '.' in the DLL name (3) May 21 2006 [Bug 150] New: std.gc.minimize doesn't minimize physical memory usage (1) May 20 2006 [Bug 149] New: Incorrect error message for a class left open (2) May 20 2006 Setting class variable from inline assembly (4) May 20 2006 [Bug 148] New: Incorrect "statement is not reachable" warning with goto and for loop (2) May 19 2006 [Bug 147] New: circular imports break with -cov (2) May 18 2006 [Bug 146] New: Wrong filename in DWARF debugging information for templates (2) May 18 2006 [Semi-OT] Requesting improvements to the Bugzilla installation (1) May 18 2006 [Bug 145] New: Can't refer to global scope after a cast (4) May 17 2006 [Bug 144] New: Alias and function names fail to collide (2) May 17 2006 [Bug 143] New: 'package' does not work at all (2) May 17 2006 [Bug 142] New: Assertion failure: '0' on line 610 in file 'template.c' (5) May 16 2006 documentation not generated for alias (1) May 16 2006 incorrect deprecated error (2) May 17 2006 Possible bug in boxing unit? (2) May 15 2006 possible bug with function pointers and aliases (3) May 14 2006 ddoc: enum members documentation not correctly generated (1) May 14 2006 ddoc: Params for all elements? (5) May 14 2006 doc not generated for template instance alias (1) May 14 2006 [Bug 141] New: inline assembler treats "const float" and "float" differently (2) May 13 2006 Method Inheritance (4) May 13 2006 [Bug 140] New: Conflicting identifiers between imported modules are reported in the wrong file (2) May 13 2006 [Bug 139] New: Forward reference of enum type doesn't work or crashes compiler (2) May 13 2006 [Bug 138] New: surplus "jmp short" generated within inline assembler code (1) May 12 2006 Documentation bug (2) May 12 2006 [Bug 137] New: std.format.doFormat doesn't like arrays of static arrays (1) May 11 2006 [Bug 136] New: Corrupt GDB backtrace (5) May 11 2006 [Bug 135] New: typeof(x)() doesn't compile (3) May 10 2006 Exception handling is broken for delegates on Linux (2) May 10 2006 [Bug 134] New: Invalid hyperlink in regexp docs (3) May 10 2006 [Bug 133] New: Assertion toobj.c:258 (3) May 10 2006 [Bug 132] New: class template, alias and class inheritance combo leads to segfault (6) May 08 2006 ddoc $(BR) (7) May 08 2006 d_time and writefln (6) May 08 2006 std.date again (10) May 08 2006 ddoc: copyright section (2) May 08 2006 ddoc documentation (3) May 07 2006 Minor Doc Fixes: in section Functions - Function Inheritance and (4) May 06 2006 [Bug 131] New: DocComments/Expression -- ^^ logical xor feature request (2) May 06 2006 [Bug 130] New: DocComments/Expression -- assert(0) paragraph (1) May 05 2006 [Bug 129] New: DDoc makes enum values cryptic (1) May 05 2006 [Bug 128] New: DMD crash with static if and anonymous classes (6) May 04 2006 [Bug 127] New: bugs.html should reference bugzilla (2) May 04 2006 [Bug 126] New: spec for Add expression (pointer to bit) (3) May 04 2006 [Bug 125] New: forward reverence with covariant return type (1) May 02 2006 [Bug 124] New: Enhancement: Operator overloading without temporaries (1) May 02 2006 Interfaces + mixins => problem (2) May 01 2006 [Bug 123] New: Use of function, modulus, and dollar sign (length) fails to compile with static and const (3) Apr 30 2006 [Bug 122] New: DDoc newline behaviour produces suboptimal results (1) Apr 30 2006 [Bug 121] New: DDoc does not emit "abstract" keyword (2) Apr 30 2006 [Bug 120] New: Phobos modules fail to compile with -w switch (2) Apr 30 2006 DMD-0.155 regressions (3) Apr 29 2006 [Bug 119] New: macro error in "mars.h" (2) Apr 29 2006 I wonder (1) Apr 28 2006 [Bug 118] New: wrong code generation for MOVLHPS (2) Apr 28 2006 [Bug 117] New: debug output in expression.c (2) Apr 27 2006 [Bug 116] New: Inline Assembler offset keyword (1) Apr 27 2006 [Bug 115] New: dmd-0.154.bin: iasm.c:1892: void asm_merge_symbol(OPND*, Dsymbol*): Assertion `ei' failed. (3) Apr 24 2006 readLine behavior on non seekable streams (1) Apr 24 2006 [Bug 114] New: Multithreaded applications crash upon garbage collection (3) Apr 23 2006 Moving structs containing strings ... (12) Apr 22 2006 doFormat bug (2) Apr 21 2006 [Bug 113] New: std.format.doFormat and small hex numbers (3) Apr 20 2006 [Bug 111] New: appending a dchar to a char[] (5) Apr 20 2006 dchar issues? (3) Apr 19 2006 [Bug 110] New: Assertion failure, Line 1135, expression.c (3) Apr 18 2006 [Bug 109] New: incorrect name mangling for template value arguments (1) Apr 16 2006 Simple command line compiler crash (1) Apr 16 2006 Bugzilla - thanks to Brad Roberts (12) Apr 16 2006 [Bug 108] New: std.string wrap is prepending space (2) Apr 15 2006 [Bug 107] New: Wrong filename in error message (2) Apr 14 2006 [Bug 106] New: template - mixin sequence (3) Apr 14 2006 DMD-0.154 regressions (1) Apr 13 2006 Problem with allowing exceptions to be thrown from dtors (7) Apr 13 2006 [Bug 105] New: abiguity for opCall (3) Apr 13 2006 It runs slower and slower (5) Apr 13 2006 [Bug 104] New: Forward reference error occurs when the -g switch is invoked (4) Apr 12 2006 Forward Reference -g bug (minor) code reduction challange (8) Apr 12 2006 Error: static if conditional cannot be at global scope (4) Apr 12 2006 [Bug 103] New: -Dd does not generate subdirectories (7) Apr 11 2006 DMD-0.153 regressions (preliminary) (3) Apr 11 2006 Very strange? Code generation bug? (5) Apr 11 2006 [Bug 102] New: Forward reference nested class wheel. (1) Apr 11 2006 [Bug 101] New: Pre and Post contracts segfault without -release switch in conjunction with --gc-sections. (2) Apr 11 2006 [Bug 100] New: Assert statement error (4) Apr 10 2006 [Bug 99] New: superfluous output for failed static asserts (3) Apr 10 2006 [Bug 98] New: std.date.parse month off by one (2) Apr 09 2006 DOC BUG: Minor error in openRJ docs (1) Apr 08 2006 keyword list (1) Apr 08 2006 [Bug 97] New: DDoc bug on enums (2) Apr 08 2006 [Bug 96] New: Unable to overload functions injected from mixins. (2) Apr 08 2006 [Bug 95] New: foreach() over empty AA yields Access Violation (6) Apr 08 2006 [Bug 94] New: incorrect symbols generated for "class Object" (3) Apr 08 2006 [Bug 93] New: Template regex example fails without -release switch (9) Apr 07 2006 [Bug 92] New: std.format %x, %o and %b assume 64-bit negative values (2) Apr 06 2006 [Bug 91] New: Inherited classes require base class to have a default constructor. (5) Apr 06 2006 [Bug 90] New: local object.d overrides real object.d causing crash (3) Apr 06 2006 [Bug 89] New: -H option generates bad code for pragma(msg) (2) Apr 06 2006 [Bug 88] New: Add .isizeof property for compile-time instance size determination (8) Apr 05 2006 D Bugzilla: can't change account email? (1) Apr 05 2006 [Bug 87] New: Function declaration fails in GCC 4.1 (3) Apr 04 2006 DMD-0.151 regressions (6) Apr 04 2006 [Bug 86] New: Minor loss of precision in std.math.tgamma (2) Apr 04 2006 [Bug 85] New: Array of classes doesn't function as array of interfaces (2) Apr 04 2006 [Bug 84] New: Regression: Internal error when assigning to multidimentional array (3) Apr 03 2006 bug in ``isNumeric'' (1) Apr 03 2006 [Bug 83] New: Assertion failure: 3567 'expression.c', crossaliasing problem (3) Apr 03 2006 std.perf docs (2) Apr 03 2006 Possible std.math.exp() bug (10) Apr 03 2006 posible delegate/inerfunktion bug (2) Apr 02 2006 [Bug 82] New: incorrect statement is not reachable (2) Apr 02 2006 Can't call opIndex on class property (4) Apr 01 2006 [Bug 80] New: Cannot instantiate nested class in nested function (2) Apr 01 2006 [Bug 79] New: Assertion failure: mtype.c 364 - using a forward-referenced alias of an undefined type (4) Mar 31 2006 Bug in string or AA handling (3) Mar 31 2006 [Bug 78] New: spaces in module identifier accepted (4) Mar 31 2006 [Bug 77] New: After a compile error occurs, all template instances fail (7) Mar 29 2006 DMD message of the day ... (5) Mar 29 2006 compiler message (1) Mar 28 2006 Cannot compile with -cov or -profile (1) Mar 28 2006 [Bug 76] New: Using a non-template struct as a template (2) Mar 26 2006 [Bug 75] New: Template aliases in unittests (incorrect code generation) (2) Mar 26 2006 Interface Covariance Bug? (6) Mar 25 2006 [Bug 74] New: compiler error using if auto condition and -inline (2) Mar 25 2006 Garbage collection from associative arrays (5) Mar 24 2006 [doc] string literals, need more examples. (1) Mar 24 2006 [Bug 73] New: Functions used to initialize variables are not inlined. (6) Mar 24 2006 [Bug 72] New: valgrind: use of unitialized values in the gcx module (5) Mar 24 2006 [Bug 71] New: valgrind: Invalid read of size 4 in elf_renumbersyms (1) Mar 24 2006 [Bug 70] New: valgrind: Conditional jump or move depends on uninitialised value(s) in elf_findstr (1) Mar 23 2006 [Bug 68] New: phobos recls_fileinfo_unix.cpp compile error (4) Mar 23 2006 std.md5 example (1) Mar 22 2006 [Bug 67] New: Imported functions are not inlined. (15) Mar 22 2006 The VII PPPR (Pending Peeves Progress Review) (11) Mar 22 2006 [Bug 66] New: Bad length in value of T[a..b] = scalar (3) Mar 22 2006 [Bug 65] New: Strange results overriding interface return with class return (8) Mar 22 2006 [Bug 64] New: Unhandled errors should go to stderr (5) Mar 22 2006 [Bug 62] New: Error message: 'TOK41 has no effect'. (2) Mar 21 2006 [Bug 61] New: DStress test enum_39 (4) Mar 21 2006 [Bug 60] New: Passing bool to variadic function in debug build fails to link (4) Mar 21 2006 easy to fix getche() (1) Mar 20 2006 DMD-0.150 regressions (5) Mar 20 2006 [Bug 59] New: implicit conversion from integer to cfloat not caught by the compiler (3) Mar 20 2006 stupid errors (23) Mar 20 2006 Trivial doc error in %g format. (4) Mar 20 2006 template Foo(T, T val) fails to work (1) Mar 20 2006 [Bug 58] New: C/C++ bool to D bool conversion (2) Mar 19 2006 [Bug 57] New: DMD should support linking with something other than "gcc" (3) Mar 19 2006 -cov and linking bugs (2) Mar 19 2006 [Bug 56] New: Minor Wording Error (2) Mar 19 2006 compiler stops silently - version 150 - cryptall.zip (2) Mar 18 2006 stops compiling (18) Mar 18 2006 [Bug 55] New: doFormat precision fails on integers < 10 (4) Mar 16 2006 printf bug ??! (5) Mar 16 2006 [Bug 54] New: Compiler segfault on zero length static array (5) Mar 16 2006 [Bug 53] New: DDoc: Struct templates documented without template parameters (1) Mar 15 2006 Bad links on digitalmars.com (2) Mar 15 2006 Bits (pardon the pun) of the documentation that are out of date (3) Mar 14 2006 [Bug 52] New: ambiguous function pointer silently excepted (2) Mar 14 2006 [Bug 51] New: String cast overrides the char type of decorated string literals. (4) Mar 14 2006 Inline assembly movd reg32/mem, xmmreg instruction produces incorrect machine code (2) Mar 14 2006 [Bug 50] New: Error instantiating an inner class with a proper context (3) Mar 14 2006 [Bug 49] New: Error instantiating a mixin with a private constructor (6) Mar 14 2006 [Bug 48] New: Acess with Fully-Qualified Names disregards protection attributes (2) Mar 14 2006 [Bug 47] New: Entity name shadowing: compiler not acting according to spec. (1) Mar 13 2006 [Bug 46] New: Included man files should be updated (2) Mar 13 2006 [Bug 45] New: Bug in conversion of floating point literals (6) Mar 12 2006 link errors with 0.149, templates, and writefln (7) Mar 12 2006 compiler message cannot convert GType to GType (16) Mar 12 2006 [Bug 44] New: forward referenced anonymous union in struct size discrepancy (3) Mar 12 2006 [Bug 40] New: DecimalFloat spec doesn't match dmd behavior (1) Mar 12 2006 [Bug 39] New: ArrayMemberInitialization, StructMemberInitializer inconsistencies from dmd's behavior (1) Mar 12 2006 [Bug 38] New: Template crashes DMD (2) Mar 12 2006 [Bug 37] New: Inconsistent type information generated for .classinfo accessing (1) Mar 11 2006 [Bug 36] New: Odd enum forward-reference (?) alias bug (2) Mar 11 2006 [Bug 35] New: missleading error message for circular constructor paths (2) Mar 11 2006 [Bug 34] New: C style cast illegal (3) Mar 10 2006 Forward reference wheel. (3) Mar 10 2006 [Bug 33] New: No short-circuit evaluation for compile-time expressions? (4) Mar 10 2006 [Bug 32] New: missing return value and no compile error (2) Mar 10 2006 Top-Down Structs (11) Mar 09 2006 [Bug 31] New: Keyword 'function' and pointer test broken for IsExpression (8) Mar 09 2006 [Bug 30] New: alias with function pointer and two modules (3) Mar 09 2006 [Bug 29] New: undefined behaviour of: scope(...){ return X; } (4) Mar 09 2006 Template crashes DMD 0.149 (4) Mar 09 2006 [Bug 28] New: Documentation (2) Mar 08 2006 [Bug 27] New: undefined reference to: __ULLNGDBL (2) Mar 08 2006 imports - 2 years later (22) Mar 08 2006 [Bug 26] New: inout foreach does not modify BitArrays (3) Mar 08 2006 DMD-0.149 regressions (7) Mar 08 2006 [Bug 25] New: DMD segfault on foreach in template (4) Mar 07 2006 [Bug 24] New: Arithmetic operators are allowed on boolean expressions (12) Mar 07 2006 Documentation bugs (10) Mar 06 2006 [Bug 23] New: DDoc Error: "static if conditional cannot be at global scope." (2) Mar 06 2006 [Bug 22] New: ModuleInfo not being generated for object files with "dmd -c" (1) Mar 06 2006 [Bug 21] New: unexpected results for: double -> real with value 1.7976931348623157e+308 (2) Mar 06 2006 [Bug 20] New: volatile introduces new scope (4) Mar 06 2006 [Bug 19] New: memory.html: uint used instead of size_t (2) Mar 05 2006 Internal error: e2ir.c 1289 (6) Mar 05 2006 [Bug 18] New: int foo[0] accept -- what's its semantics? (6) Mar 05 2006 [Bug 17] New: incomplete docs on delete expression's interaction with the state of memory (2) Mar 05 2006 auto declaration & compiler warning "no function return" (3) Mar 05 2006 [Bug 16] New: Documentation for 'extern' attribute on variable declarations (2) Mar 05 2006 [Bug 15] New: Problem with inner struct templates (2) Mar 05 2006 [Bug 14] New: Unable to alias member variables (1) Mar 05 2006 [Bug 13] New: Difficulty accessing byte and short inout parameters from inline asm (3) Mar 05 2006 [Bug 12] New: Assertion in pthread (2) Mar 04 2006 ArrayMemberInitialization, StructMemberInitializer (1) Mar 04 2006 [Bug 10] New: Mixin variables not being properly initialized (1) Mar 04 2006 Bugzilla - an experiment in trackability (32) Mar 04 2006 DecimalFloat (4) Mar 04 2006 [Bug 9] New: web based forums auto-url linking stops too early (1) Mar 04 2006 Assertion in pthread (1) Mar 03 2006 Building libraries on Linux (3) Mar 03 2006 Invalid method called - reduced test case (5) Mar 03 2006 DDoc: "Error: static if conditional cannot be at global scope" (1) Mar 02 2006 DMD calling incorrect method (5) Mar 02 2006 std.boxer linker error (6) Mar 02 2006 inout foreach on BitArrays (3) Mar 02 2006 doc error: expression.html NAN != (2) Mar 02 2006 DOC: undefined type of idouble + double (4) Mar 01 2006 invalid header output for '\\' (1) Mar 01 2006 mixins 2 (2) Mar 01 2006 mixins (2) Feb 28 2006 Bool {post,pre}{inc,dec}-operators (8) Feb 28 2006 Lots of bool operations shouldn't compile (14) Feb 27 2006 alias object.bit conflicts with std.format.bit (1) Feb 26 2006 Phobos doc (2) Feb 26 2006 bool: funny error message (2) Feb 26 2006 Doc: .size instead of .sizeof (2) Feb 25 2006 a auto object produced in a version scope. (2) Feb 25 2006 compiler segfault: long identifier (3) Feb 24 2006 BUG: bad mixin behavior (2) Feb 24 2006 minor (4) Feb 23 2006 C-style casts in Interfaces doc (2) Feb 23 2006 Shebangs and line numbers (3) Feb 22 2006 static assert fouls up template promotion when between static if (4) Feb 20 2006 writef format bug (2) Feb 20 2006 bug in std.string.replace (1) Feb 20 2006 Comparing TypeInfo_Pointer (2) Feb 20 2006 bug: method override via overload (7) Feb 20 2006 bug in std.file.listdir (fix included) (2) Feb 19 2006 Out parameters and initialization (29) Feb 18 2006 No .o or executable left behind? (2) Feb 18 2006 Code coverage and std.c.* (2) Feb 18 2006 libphobos 0.147 doesn't build under linux (2) Feb 17 2006 typeinfo crashes dmd (2) Feb 17 2006 =?ISO-8859-1?Q?=22=E4uto_a=3D=2Ea=22_crashes_dmd?= (2) Feb 17 2006 circular constant definitions bring about endless error messages (3) Feb 17 2006 circular constant definitions not rejected by dmd 0.147 (2) Feb 17 2006 non-constant expression causes internal error (2) Feb 17 2006 Assertion failure: '0' on line 704 in file 'expression.c' (2) Feb 17 2006 botched CatchParameter syntax (2) Feb 16 2006 Problem using inout parameters from inline asm (1) Feb 16 2006 Internal error: e2ir.c 736 dmd0.147 (7) Feb 16 2006 continue identifier; on foreach broken for opApply (6) Feb 16 2006 wrong line numbers when the file starts with "#!" (1) Feb 16 2006 Fatal flaw in MmFile on linux (1) Feb 15 2006 assert bug (7) Feb 15 2006 Linker Error: "Previous Definition Different" (1) Feb 15 2006 Inline assembler bugs (2) Feb 15 2006 duplicate union initialization (1) Feb 15 2006 Custom allocator + empty class = crash (2) Feb 14 2006 -H bug with templates (1) Feb 13 2006 mtype.c:3301 Assertion `sym->memtype' failed. (4) Feb 12 2006 dmd-0.146 regressions (1) Feb 12 2006 Wrong header generation (1) Feb 12 2006 Crash (5) Feb 11 2006 enum forward reference (3) Feb 11 2006 Bug in std.format.doFormat? (6) Feb 11 2006 Doc bug in arrays.html (2) Feb 11 2006 Recursive alias crashes dmd.exe (2) Feb 11 2006 wrong size of static wchar[] (1) Feb 11 2006 Private bug (3) Feb 10 2006 delete and CommaExp. (7) Feb 10 2006 isabs not working (4) Feb 10 2006 0.146 -run bug (5) Feb 10 2006 excess warning? (2) Feb 10 2006 excess warning? (1) Feb 10 2006 Concatenating with a string array (8) Feb 09 2006 Implicit conversion bug? (8) Feb 09 2006 assertion failure in template.c (2) Feb 09 2006 bug(?) with recursive aliases (3) Feb 09 2006 bug with inner struct templates (2) Feb 08 2006 Abstract fields crash compiler (1) Feb 07 2006 struct forward reference (6) Feb 07 2006 Undefined behaviour using interfaces (1) Feb 06 2006 const declaration creshes dmd 0.145 (2) Feb 06 2006 Name mangling is broken for integral template value arguments. (5) Feb 05 2006 Bad enum compiler crash (0.145) (2) Feb 04 2006 Bug in asm version of std.math.poly since 0.143 (3) Feb 02 2006 Ambiguous type inference crashes compiler (2) Feb 02 2006 Failed detect library on defferent drive (1) Feb 02 2006 Failed detect library on defferent drive (1) Jan 31 2006 dmd-0.145 regressions (5) Jan 30 2006 lvalue array.length error (4) Jan 30 2006 Oh for christ's sake (32) Jan 30 2006 Problem with mixins and overriding (2) Jan 30 2006 std.writef, std.format: "%a" is wrong for negative zero (2) Jan 29 2006 Inconsistent 'field' syntax? (1) Jan 29 2006 ModuleInfo bug (1) Jan 29 2006 Winsock2 / getaddrinfo (1) Jan 27 2006 structed addrinfo: bad order of members (1) Jan 27 2006 BUG: .sizeof doesn't work with nested structs (2) Jan 27 2006 Block Statement scope (4) Jan 27 2006 dmd crasher: member static array sized using enum (3) Jan 26 2006 std.stream.BufferedStream has upsizing bug (1) Jan 26 2006 alias declaration crashes dmd. (1) Jan 25 2006 _arguments in constructor (3) Jan 25 2006 DMD 144 Windows command line not in Locale (6) Jan 25 2006 template bug in docu (2) Jan 25 2006 assert fail expression.c line 674 (2) Jan 25 2006 Internal error: ..\ztc\cgcod.c 1497 (2) Jan 25 2006 . is still required for recursion when a template alias is used. (2) Jan 25 2006 Constant folding for array casts (2) Jan 24 2006 BUG: compiler GPF on template code (2) Jan 24 2006 roll-up of old bugs: compiler GPF on vararg code (5) Jan 24 2006 roll-up of old bugs: access specifiers broken for templates (1) Jan 24 2006 roll-up of old bugs: auto dtor not called on exception (1) Jan 24 2006 roll-up of old bugs: auto dtor not called on exception (3) Jan 24 2006 mixin virtual function bug (2) Jan 23 2006 dmd-0.144 regressions (1) Jan 23 2006 -cov and circular init deps (3) Jan 22 2006 .offsetof - Doc bug or DMD bug? (3) Jan 20 2006 uuid.lib is broken in new DMC 8.46 (1) Jan 20 2006 Y2038 compiler bug (2) Jan 20 2006 static if doesn't use short-circuit evaluation for &&. (3) Jan 17 2006 BUG: Constructor chaining and const member intialization (3) Jan 15 2006 Problem on GC and Big arrays on heap (2) Jan 15 2006 Wrong method called. (5) Jan 15 2006 0.143 phobos library fails in unit test mode (2) Jan 15 2006 Incorrect output using bit[][] (1) Jan 14 2006 Bug with -D and static if (4) Jan 14 2006 Internal error: ..\ztc\cgcs.c 213 (2) Jan 13 2006 assert() doesn't convert floating point literals of mixed type correctly (2) Jan 12 2006 Another linking oddity (1) Jan 12 2006 Module & class static-ctor invocation? (13) Jan 12 2006 [ ] isn't parsed correctly from a template char[] argument (3) Jan 12 2006 [ .. ] isn't parsed correctly in nested template char[] parameters (2) Jan 10 2006 visibility bug (11) Jan 09 2006 behaviour when return is missing? (6) Jan 08 2006 Adding expandTilde to phobos' std.path (5) Jan 07 2006 Fix for the linux spawnvp link bug (1) Jan 06 2006 fields and methods (7) Jan 05 2006 std.uri bugs? (2) Jan 03 2006 template alias bug? (3) Jan 03 2006 A zeroing sort - sort_zeroing.zip (2) Jan 02 2006 Typo in example (3) Jan 02 2006 Internal error: ..\ztc\cod1.c 1293 (1) Jan 02 2006 Object file generation (9) Jan 02 2006 assertion failure, with, templates (2) Jan 01 2006 unexpected warning (2) Jan 01 2006 dmd-0.142 regressions (1) Other years: 2017 2016 2015 2014 2013 2012 2011 2010 2009 2008 2007 2006 2005 2004 1970
http://www.digitalmars.com/d/archives/digitalmars/D/bugs/index2006.html
CC-MAIN-2017-22
en
refinedweb
Constrained minimization to find equilibrium compositions Posted February 05, 2013 at 09:00 AM | categories: optimization | tags: thermodynamics, reaction engineering | View Comments Updated April 04, 2016 at 01:35 PM adapated from Chemical Reactor analysis and design fundamentals, Rawlings and Ekerdt, appendix A.2.3.: \(I + B \rightleftharpoons P1\) Reaction 2: \(I + B \rightleftharpoons P2\) Here we define the Gibbs free energy of the mixture as a function of the reaction extents. import numpy as np The equilibrium constants for these reactions are known, and we seek to find the equilibrium reaction extents so we can determine equilibrium compositions. The equilibrium reaction extents are those that minimize the Gibbs free energy. We have the following constraints, written in standard less than or equal to form: \(-\epsilon_1 \le 0\) \(-\epsilon_2 \le 0\) \(\epsilon_1 + \epsilon_2 \le 0.5\) In Matlab we express this in matrix form as Ax=b where\begin{equation} A = \left[ \begin{array}{cc} -1 & 0 \\ 0 & -1 \\ 1 & 1 \end{array} \right] \end{equation} and\begin{equation} b = \left[ \begin{array}{c} 0 \\ 0 \\ 0.5\end{array} \right] \end{equation} Unlike in Matlab, in python we construct the inequality constraints as functions that are greater than or equal to zero when the constraint is met. def constraint1(E): e1 = E[0] return e1 def constraint2(E): e2 = E[1] return e2 def constraint3(E): e1 = E[0] e2 = E[1] return 0.5 - (e1 + e2) Now, we minimize. from scipy.optimize import fmin_slsqp X0 = [0.2, 0.2] X = fmin_slsqp(gibbs, X0, ieqcons=[constraint1, constraint2, constraint3], bounds=((0.001, 0.499), (0.001, 0.499))) print(X) print(gibbs(X)) Optimization terminated successfully. (Exit mode 0) Current function value: -2.55942394906 Iterations: 7 Function evaluations: 31 Gradient evaluations: 7 [ 0.13336503 0.35066486] -2.55942394906. We also set all elements where the sum of the two extents is greater than 0.5 to near zero, since those regions violate the constraints. import numpy as np import matplotlib.pyplot as plt a = np.linspace(0.001, 0.5, 100) E1, E2 = np.meshgrid(a,a) sumE = E1 + E2 E1[sumE >= 0.5] = 0.00001 E2[sumE >= 0.5] = 0.00001 # now evaluate gibbs G = np.zeros(E1.shape) m,n = E1.shape G = gibbs([E1, E2]) CS = plt.contour(E1, E2, G, levels=np.linspace(G.min(),G.max(),100)) plt.xlabel('$\epsilon_1$') plt.ylabel('$\epsilon_2$') plt.colorbar() plt.plot([0.13336503], [0.35066486], 'ro') plt.savefig('images/gibbs-minimization-1.png') plt.savefig('images/gibbs-minimization-1.svg') plt.show() You can see we found the minimum. We can compute the mole fractions pretty easily. e1 = X[0]; e2 = X print('y_I = {0:1.3f} y_B = {1:1.3f} y_P1 = {2:1.3f} y_P2 = {3:1.3f}'.format(yI,yB,yP1,yP2)) y_I = 0.031 y_B = 0.031 y_P1 = 0.258 y_P2 = 0.680 1 summary I found setting up the constraints in this example to be more confusing than the Matlab syntax. Copyright (C) 2016 by John Kitchin. See the License for information about copying. Org-mode version = 8.2.10
http://kitchingroup.cheme.cmu.edu/blog/2013/02/05/Constrained-minimization-to-find-equilibrium-compositions/
CC-MAIN-2017-22
en
refinedweb
Content-type: text/html #include <sys/ddi.h> #include <sys/sunddi.h> intbiomodified(struct buf *bp); Solaris DDI specific (Solaris DDI). bp Pointer to the buffer header structure. The biomodified() function returns status to indicate if the buffer is modified. The biomodified() function is only supported for paged- I/O request, that is the B_PAGEIO flag must be set in the b_flags field of the buf(9S) structure. The biomodified() function will check the memory pages associated with this buffer whether the Virtual Memory system's modification bit is set. If at least one of these pages is modified, the buffer is indicated as modified. A filesystem will mark the pages unmodified when it writes the pages to the backing store. The biomodified() function can be used to detect any modifications to the memory pages while I/O is in progress. A device driver can use biomodified() for disk mirroring. An application is allowed to mmap a file which can reside on a disk which is mirrored by multiple submirrors. If the file system writes the file to the backing store, it is written to all submirrors in parallel. It must be ensured that the copies on all submirrors are identical. The biomodified() function can be used in the device driver to detect any modifications to the buffer by the user program during the time the buffer is written to multiple submirrors. The biomodified() function returns the following values: 1 Buffer is modified. 0 Buffer is not modified. -1 Buffer is not used for paged I/O request. biomodified() can be called from any context. bp_mapin(9F), buf(9S) Writing Device Drivers
http://backdrift.org/man/SunOS-5.10/man9f/biomodified.9f.html
CC-MAIN-2017-22
en
refinedweb
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location. Microsoft.VisualStudio.TestTools.Common Namespace Return to top This namespace provides classes that are used by the testing framework or user interface of Visual Studio 2010 Ultimate or Visual Studio 2010 Premium, in addition to classes and interfaces that a developer can modify to extend the functionality, such as ITestElement and TestElement. Show:
https://msdn.microsoft.com/en-us/library/microsoft.visualstudio.testtools.common
CC-MAIN-2017-22
en
refinedweb
Save a graphical screen shot on Windows systems. More... #include <windows.h> #include "png.h" Save a graphical screen shot on Windows. Extract the "WIN32" flag from the compiler. Save a window to a PNG file. Returns TRUE if the PNG file is written, and FALSE if something went wrong. References bit_depth, data, FALSE, fp, height, info_ptr, PNG_COLOR_TYPE_RGB, PNG_COMPRESSION_TYPE_DEFAULT, PNG_FILTER_TYPE_DEFAULT, PNG_INTERLACE_NONE, PNG_LIBPNG_VER_STRING, row_pointers, TRUE, and width.
http://buildbot.rephial.org/builds/restruct/doc/scrnshot_8c.html
CC-MAIN-2017-22
en
refinedweb
I'm wondering how to call an external program in such a way that allows the user to continue to interact with my program's UI (built using tkinter, if it matters) while the Python program is running. The program waits for the user to select files to copy, so they should still be able to select and copy files while the external program is running. The external program is Adobe Flash Player. Perhaps some of the difficulty is due to the fact that I have a threaded "worker" class? It updates the progress bar while it does the copying. I would like the progress bars to update even if the Flash Player is open. I tried the subprocess module. The program runs, however it prevents the user from using the UI until the Flash Player is closed. Also, the copying still seems to occur in the background, it's just that the progress bar does not update until the Flash Player is closed. def run_clip(): flash_filepath = "C:\\path\\to\\file.exe" # halts UI until flash player is closed... subprocess.call([flash_filepath]) Next, I tried using the concurrent.futures module (I was using Python 3 anyway). Since I'm still using subprocess to call the application, it's not surprising that this code behaves exactly like the above example. def run_clip(): with futures.ProcessPoolExecutor() as executor: flash_filepath = "C:\\path\\to\\file.exe" executor.submit(subprocess.call(animate_filepath)) Does the problem lie in using subprocess? If so, is there a better way to call the external program? Thanks in advance. You just need to keep reading about the subprocess module, specifically about Popen. To run a background process concurrently, you need to use subprocess.Popen: import subprocess child = subprocess.Popen([flash_filepath]) # At this point, the child process runs concurrently with the current process # Do other stuff # And later on, when you need the subprocess to finish or whatever result = child.wait() You can also interact with the subprocess' input and output streams via members of the Popen-object (in this case child). Similar Questions
http://ebanshi.cc/questions/2148317/run-external-program-concurrently-in-python
CC-MAIN-2017-22
en
refinedweb
An easy function that returns the deserialized version from a XML document that was stored in a string. using System.Xml; using System.IO; using System.Xml.Serialization; public yourXmlClassesType ParseXML(string xmlFile) { var xml = xmlFile; var serializer = new XmlSerializer(typeof(yourXmlClassesType)); using (var reader = new StringReader(xml)) { yourXmlClassesType parsedContent = (yourXmlClassesType)serializer.Deserialize(reader); return parsedContent; } } To use it imagine you have the serialized classes (Read more here:) you have to modify the function above. So replace "yourXmlClassesType" to the name of your final masterclass. That's it! We provide special containers which include the full snippet and a link to this site. So for example when you make a tutorial and you are using code from this site, you can use one of the following snippet embeddings: posted on 2016-10-23 15:45:34 viewed 80 times snippet's UUID is 580cbefeb41e4
https://vsnippets.com/snippet.php?s=580cbefeb41e4
CC-MAIN-2017-22
en
refinedweb
is a relational database management system contained in a small (~350 KB) C programming library. In contrast to other database management systems, SQLite is not a separate process that is accessed from the client application, but an integral part of it.To create a SQLite database, use the CreateSQLiteDatabase(). import arcpy # Set local variables sqlite_database_path = 'C:/Data/Counties.sqlite' # Execute CreateSQLiteDatabase arcpy.gp.CreateSQLiteDatabase(sqlite_database_path, "ST_GEOMETRY") It's not too hard. All file paths must end in '.sqlite' extension. The database supports two spatial types: "ST_GEOMETRY" or "SPATIALITE". ST_GEOMETRY is Esri's storage type, whereas SPATIALITE is the SpatiaLite geometry type. ST_GEOMETRY is the default geometry storage type. This database can be fully used with the python sqlite3 module that comes as a default with any python installation. This means you can create a database using ArcPy, then perform all updates through native SQL instead of update/insert cursors. Some notes: - ":memory:" stored databases are not supported, they must be written to disk - SQLite version 3.16.2 Enjoy
http://anothergisblog.blogspot.com/2013/08/creating-sqlite-database-via-102-arcpy.html
CC-MAIN-2017-22
en
refinedweb
Download presentation Presentation is loading. Please wait. Published byCaroline Slaten Modified over 2 years ago 1 Copyright 2009 Digital Enterprise Research Institute. All rights reserved. Digital Enterprise Research Institute Linked Broken Data? Dr Axel Polleres Digital Enterprise Research Institute, NationaI University of Ireland, Galway Based on joint work with Aidan Hogan, Andreas Harth, Renaud Delbru, Giovanni Tummarello, Stefan Decker 2 Digital Enterprise Research Institute 2 Brief self-intro… DERI’s Mission is “to exploit semantics for –People –Organisations –Systems to collaborate and interoperate on a global scale” Located at: Founded June 2003 with 1 fulltime member Status May 2009: +126 members Research Areas: –Semantic Web, Social Networks, Web Services, … Web Science Strong network of industrial collaborators! Computers People Physical World 3 Digital Enterprise Research Institute DERI has as it’s partners a list of companies spanning large multinational to early-stage companies. Funding for these collaborative projects comes from the companies, SFI, and Enterprise Ireland, the EU SSC Semantic Search Company Strong network of industrial collaborators 4 Digital Enterprise Research Institute in the DERI House: Telecommunications - DTE eBusiness Financial Services - DEB Information Mining and Retrieval Unit - UIMR Natural Language Processing Unit - UNLP Reasoning and Querying Unit - URQ Semantic Colla- borative Software Unit - USCS Service Oriented Architecture Unit - USOA Social Software Unit - USS Health Care Life Sciences - DHCLS eLearning - DEL eGovernment - DEG Data Intensive Infrastructure Unit – UDI2 eScience - DES Sensor Middleware Unit – USM 5 Digital Enterprise Research Institute "If HTML and the Web made all the online documents look like one huge book, RDF, schema and inference languages will make all the data in the world look like one huge database„ Tim Berners-Lee, Weaving the Web, 1999 Database? Not quite! RDBMS Social Interactions: Aggregated view vs. privacy concerns Dynamics: historical data changes, trends Sensors: limited resources distribution incomplete data … and btw. WWW, 100s billion+ pages going up Still, we want an integrated view! RDBMS Heterogeneity: Health records Digital Libraries, CMS, blogs… CMS Unit for Reasoning and Querying Query Languages Standards (SPARQL, RIF, OWL2) Interoperability (XML, RDF, RDB) Reasoning (Rules, Context & Policies) Scalability & “Web Tolerance”! 6 Digital Enterprise Research Institute Today’s talk is about… 6 Reasoning on today’s Semantic Web… 7 Digital Enterprise Research Institute The Web map 2008 © Tim Berners-Lee 7 8 Digital Enterprise Research Institute The Web map 2008 © Tim Berners-Lee 8 more and more structured data (RDF) available on the Web thanks to … … vocabularies (RDFS+OWL) becoming established … exporters, (GRDDL, RDFa), Linked Open Data, etc. … In this talk: What can we do with it already in terms of Reasoning? 9 Digital Enterprise Research Institute 9 Outline Brief intro of RDF/OWL/Linked Open Data Reasoning over Web Data: Challenges Inconsistencies Common mistakes Reasoning over Web Data: Dealing with the challenges Reasoning in Sindice.com Reasoning in SWSE.com How to avoid common mistakes upfront: RDFAlerts, Pedantic-Web Group What I’d hope you to take-home 10 Digital Enterprise Research Institute Example: Finding experts/reviewers? Tim Berners-Lee, Dan Connolly, Lalana Kagal, Yosi Scharf, Jim Hendler: N3Logic: A logical framework for the World Wide Web. Theory and Practice of Logic Programming (TPLP), Volume 8, p249-269 Who are the right reviewers? Who has the right expertise? Which reviewers are in conflict? Observation: Most of the necessary data already on the Web! More and more of it follows the Linked Data principles, i.e.: 1. Use URIs as names for things 2. Use HTTP dereferenceable URIs so that people can look up those names. 3. When someone looks up a URI, provide useful information. 4. Include links to other URIs so that they can discover more things. 10 11 Digital Enterprise Research Institute RDF on the Web (i) directly by the publishers (ii) by e.g. GRDDL transformations, D2R, RDFa exporters, etc. FOAF/RDF linked from a home page: personal data (foaf:name, foaf:phone, etc.), relationships foaf:knows, rdfs:seeAlso ) 11 12 Digital Enterprise Research Institute RDF on the Web (i) directly by the publishers (ii) by e.g. GRDDL transformations, D2R, RDFa exporters, etc. e.g. L3S’ RDF export of the DBLP citation index, using FUB’s D2R () 12 Gives unique URIs to authors, documents, etc. on DBLP! E.g.,, Provides RDF version of all DBLP data + query interface! 13 Digital Enterprise Research Institute Data in RDF: Triples DBLP: rdf:type swrc:Article. dc:creator. … foaf:homepage. … foaf:name “Dan Brickley”^^xsd:string. Tim Berners-Lee’s FOAF file: foaf:knows. rdf:type foaf:Person. foaf:homepage. 13 RDF Data online: Example 14 Digital Enterprise Research Institute Linked Open Data Excellent tutorial here:- berlin.de/bizer/pub/LinkedDataTutorial/ 14 March 2008 March 2009 … 15 Digital Enterprise Research Institute How can I query that data? SPARQL SPARQL – W3C approved standardized query language for RDF: look-and-feel of “SQL for the Web” allows to ask queries like –“All documents by Tim Berners-Lee” –“Names of all persons who co-authored with authors of…/Berners-LeeCKSH08 or known by co-authors” … Example: SELECT ?D FROM WHERE {?D dc:creator } 15 16 Digital Enterprise Research Institute “Names of all persons who co-authored with authors of…/Berners-LeeCKSH08 or known by co-authors” SELECT ?Name WHERE { dc:creator ?Author. ?D dc:creator ?Author. ?D dc:creator ?CoAuthor. ?CoAuthor foaf:name ?Name } 16 SPARQL more complex patters: e.g. UNIONs 17 Digital Enterprise Research Institute SPARQL more complex patters: e.g. UNIONs “Names of all persons who co-authored with authors of…/Berners-LeeCKSH08 or known by co-authors” SELECT ?Name WHERE { dc:creator ?Author. ?D dc:creator ?Author. ?D dc:creator ?CoAuthor. { ?CoAuthor foaf:name ?Name. } UNION { ?CoAuthor foaf:knows ?Person. ?Person rdf:type foaf:Person. ?Person foaf:name ?Name } } Doesn’t work… no foaf:knows relations in DBLP Needs Linked Data! E.g. TimBL’s FOAF file! 17 18 Digital Enterprise Research Institute DBLP: rdf:type swrc:Article. dc:creator. … foaf:homepage. Tim Berners-Lee’s FOAF file: foaf:knows. foaf:homepage. 18 Back to the Data: Even if I have the FOAF data, I cannot answer the query: Different identifiers used for Tim Berners-Lee Who tells me that Dan Brickley is a foaf:Person? Linked Data needs Reasoning! 19 Digital Enterprise Research Institute Reasoning on Semantic Web Data Vocabularies (i.e. collections of classes and properties that belong together, e.g. foaf: ): Properties: foaf:name foaf:homepage, foaf:knows Classes: foaf:Person, foaf:Document Typically should have formal descriptions of their structure: RDF Schema, and OWL These formal descriptions often “called” ontologies. Ontologies add “semantics” to the data. Ontologies are themselves written in RDF, using special vocabularies ( rdf:, rdfs:, owl: ) with special semantics Ontologies are themselves part of the Linked Data Web! 19 20 Digital Enterprise Research Institute Ontologies: Example FOAF foaf:knows rdfs:domain foaf:Person Everybody who knows someone is a Person foaf:knows rdfs:range foaf:Person Everybody who is known is a Person foaf:Person rdfs:subclassOf foaf:Agent Everybody Person is an Agent. foaf:homepage rdf:type owl:inverseFunctionalProperty. A homepage uniquely identifies its owner (“key” property) … 20 21 Digital Enterprise Research Institute RDFS+OWL inference by rules 1/2 Semantics of RDFS can be partially expressed as (Datalog like) rules: rdfs1: { ?S rdf:type ?C } :- { ?S ?P ?O. ?P rdfs:domain ?C. } rdfs2: { ?O rdf:type ?C } :- { ?S ?P ?O. ?P rdfs:range ?C. } rdfs3: { ?S rdf:type ?C2 } :- {?S rdf:type ?C1. ?C1 rdfs:subclassOf ?C2. } cf. informative Entailment rules in [RDF-Semantics, W3C, 2004], [Muñoz et al. 2007] 21 22 Digital Enterprise Research Institute RDFS+OWL inference by rules 2/2 OWL Reasoning e.g. inverseFunctionalProperty can also (partially) be expressed by Rules: owl1: { ?S1 owl:SameAs ?S2 } :- { ?S1 ?P ?O. ?S2 ?P ?O. ?P rdf:type owl:InverseFunctionalProperty } owl2: { ?Y ?P ?O } :- { ?X owl:SameAs ?Y. ?X ?P ?O } owl3: { ?S ?Y ?O } :- { ?X owl:SameAs ?Y. ?S ?X ?O } owl4: { ?S ?P ?Y } :- { ?X owl:SameAs ?Y. ?S ?P ?X } cf. pD* fragment of OWL, [ter Horst, 2005], or, more recent: OWL2 RL 22 23 Digital Enterprise Research Institute RDFS+OWL inference by rules: Example: By rules of the previous slides we can infer additional information needed, e.g. TimBL’s FOAF: foaf:knows. FOAF Ontology: foaf:knows rdfs:range foaf:Person by rdfs2 rdf:type foaf:Person. TimBL’s FOAF: foaf:homepage. DBLP: foaf:homepage. FOAF Ontology: foaf:homepage rdfs:type owl:InverseFunctionalProperty. by owl1 owl:sameAs. 23 Who tells me that Dan Brickley is a foaf:Person? solved! Different identifiers used for Tim Berners-Lee solved! 24 Digital Enterprise Research Institute RDFS+OWL inference, what’s missing? Note: Not all of OWL Reasoning can be expressed in Datalog straightforwardly, e.g.: foaf:Person owl:disjointWith foaf:Organisation Can be written/and reasoned about with FOL/DL reasoners: Problem: Inconsistencies! Complete FOL/DL reasoning is not necessarily suitable for Web data… 24 25 Digital Enterprise Research Institute Why is complete reasoning non-optimal anyways? Our use case: Search the Semantic Web! Hypothetically: The explosive semantics of inconsistencies in DL/FOL reasoning would spoil our results. What if we throw all into one big KB? one inconsistency… a owl:differentFrom a. :me ex:age “old”^^xs:integer. … would make everything true. 25 26 Digital Enterprise Research Institute Inconsistencies/wrong inferences on Web Data 4 main reasons Publishers deliberately publish spoilt data (“SPAM”) Opinions differ “URI-sense” ambiguities Accidently wrong/inconsistent 26 Least common Most common 27 Digital Enterprise Research Institute Publishers deliberately publish spoilt data (“SPAM”) Examples: a owl:differentFrom a. Can occur for “testdata” being published, deliberate SPAM can become an issue, as the SW grows! 27 28 Digital Enterprise Research Institute Opinions differ Fictitous Example Ontology: Originofthings.example.org: o1:surpremePower owl:disjointWith o1:naturalPhenomenom. o1:originsFrom rdf:type owl:functionalProperty. o1:god rdf:type o1:surpremePower. o1:evolution rdf:type o1:naturalPhenomenom. darwin.example.org: ex:mankind o1:originsFrom o1:evolution. creationism.example.org: ex:mankind o1:originsFrom o1:god FlyingSpaghettimonster.org fsm::theSpaghettiMonster rdf:type surpremePower. ex:mankind o1:originsFrom fsm:theSpaghettiMonster. 28 29 Digital Enterprise Research Institute “URI-sense” ambiguities foaf:knows i.e., why do I have to use a different URI for myself and my homepage? Many people don’t understand/like this and make mistakes. But is this really a mistake or a design error? 29 30 Digital Enterprise Research Institute Accidentially inconsistent data :me ex:age "old"^^xs:integer. can e.g. arise from an exporter, that collects age from a form Source1 (faulty): TimBL foaf:homepage TimBL rdf:type foaf:Person. W3.org: W3C foaf:homepage W3C rdf:type foaf:Organisation. Did occur in our Web crawls at some point, people don’t have the right semantics in mind! Suspiciously resembles problems with e.g. flawed HTML … browsers, normal search engines still have to deal with it So do we! 30 31 Digital Enterprise Research Institute Accidently wrong (non-inconsistent data) FOAF Ontology: foaf:mbox rdf:type owl:InverseFunctionalProperty Careless FOAF exporters produce something like this for any empty email address: ex:alice foaf:mbox “mailto:” ex:bob foaf:mbox “mailto:” … IFP reasoning (Rules: owl1-4) on Web Data equates too many things! Dangerous! 31 32 Digital Enterprise Research Institute How can I reason about Web Data in a Semantic Search Engine? Datawarehouse approach, e.g. SWSE crawling, harvesting, SPARQL interface, RDFS+resricted OWL reasoning Search/Lookup indices for the Semantic Web, e.g. Sindice Indexing RDF sources on the Web, go there and query yourself 32 33 Digital Enterprise Research Institute Requirements: Scale Both engines crawl millions, even billions of triples (rapidly increasing) … latest numbers talk about orders of 100B RDF triples online. “Humble” Inference Both want to do at least limited inferencing to deliver valuable implicit information/connections Tolerance Both should be tolerant/cautious against common faults – Filter if possible deliberate mess – Filter (repair?) Accidential errors – Keep inconsistencies local 33 34 Digital Enterprise Research Institute 2 approaches Sindice: Uses a standard rule-based OWL engine (OWLIM, ter Horst’s pD* rules) Inferencing “per document”, only importing necessary ontologies Keeps an “ontology cache” for all crawled ontologies for efficiency No cross-document inferences SWSE+SAOR: Works on whole crawl (huge file) – Existing solutions, e.g. OWLIM don’t work on that, infer too much Our own reasoner: SAOR (scalable authoritative OWL reasoner) 34 35 Digital Enterprise Research Institute 35 Reasoning in Sindice: Implicit import Based on W3C best practices – Linked Data Principles By dereferencing class or property URI :me rdf:type foaf:Person. :me foaf:name "Renaud Delbru". → foaf:name rdf:type owl:DatatypeProperty. → owl:DatatypeProperty rdf:type rdf:Property. 36 Digital Enterprise Research Institute 36 Reasoning in Sindice: Ontology Cache: Update Strategy 1.Import closure of Doc1 is materialised 37 Digital Enterprise Research Institute 37 1.Import closure of Doc1 is materialised 2.Compute deductive closure of aggregate context O A, O B, O C Reasoning in Sindice: Ontology Cache: Update Strategy 38 Digital Enterprise Research Institute 38 1.Import closure of Doc1 is materialised 2.Compute deductive closure of aggregate context O A, O B, O C 3.Store ∆ A,B,C in a separate named RDF triple set Reasoning in Sindice: Ontology Cache: Update Strategy 39 Digital Enterprise Research Institute 39 A new document is coming, importing only O A and O C : 1.Compute deductive closure of O A and O C Reasoning in Sindice: Ontology Cache: Update Strategy 40 Digital Enterprise Research Institute 40 A new document is coming, importing only O A and O C : 1.Compute deductive closure of O A and O C 2.Store ∆ A,C in a separate named RDF triple set Reasoning in Sindice: Ontology Cache: Update Strategy 41 Digital Enterprise Research Institute 41 A new document is coming, importing only O A and O C : 1.Compute deductive closure of O A and O C 2.Store ∆ A,C in a separate named RDF triple set 3.Update deductive closure of O A, O B, O C so that the inferred triples are never duplicated a)Substract ∆ A,C from ∆ A,B,C b)add inclusion relation i.e., ∆ A,B,C := ∆ A,B,C - ∆ A,C + ∆ A,C owl:imports ∆ A,B,C Reasoning in Sindice: Ontology Cache: Update Strategy 42 Digital Enterprise Research Institute 42 1.A document imports O A and O B Reasoning in Sindice: Ontology Cache: Querying Strategy new 43 Digital Enterprise Research Institute 43 1.A document imports O A and O B 2.Import closure is derived, and corresponding ontology network activated new Reasoning in Sindice: Ontology Cache: Querying Strategy 44 Digital Enterprise Research Institute 44 1.A document imports O A and O B 2.Import closure is derived, and corresponding ontology network activated 3.The related ∆ A,B,C is derived and activated new Reasoning in Sindice: Ontology Cache: Querying Strategy 45 Digital Enterprise Research Institute 45 1.A document imports O A and O B 2.Import closure is derived, and corresponding ontology network activated 3.The related ∆ A,B,C is derived and activated 4.It is then found that ∆ A,B,C includes ∆ A,C which is also activated Our Observation: “caching” Tbox inferences makes indexing (mostly ABox) much faster new Reasoning in Sindice: Ontology Cache: Querying Strategy 46 Digital Enterprise Research Institute Reasoning in Sindice.com: Pros: Works well, can be distributed Stable against local inconsistencies/errors Can use “off-the-shelf” reasoners (OWLIM is just the current choice) Cons: might miss important inferences covering the “gist” of linked data e.g. Ontology o2: o2:hasAncestor rdf:type owl:transitiveProperty. o2:hasParent subPropertyOf ex:hasAncestor. axel.rdf: o2:hasParent mechthild.rdf: o2:hasParent Inference of ancestor relation between axel and franz needs both rdf datafiles! Not covered by “ontology closure” alone Extending “fetching closure” to instances too expensive… … boils down to reasoning over the whole crawl … looses nice property of “keeping mess local” 46 47 Digital Enterprise Research Institute SAOR - Reasoning for SWSE Take the challenge to reason over the whole crawl dataset … HUGE! Approach: SAOR – Scalable Authoritative OWL Reasoning 47 48 Digital Enterprise Research Institute Idea Apply a subset of OWL reasoning using a tailored ruleset. Forward-chaining rule based approach based on [ter Horst, 2005], but tweaked. Reduced output statements for the SWSE use case… Must be scalable, must be reasonable … incomplete w.r.t. OWL BY DESIGN! SCALABLE: Tailored ruleset – file-scan processing – avoid joins AUTHORITATIVE: Avoid Non-Authoritative inference (“hijacking”, “non-standard vocabulary use”) 48 49 Digital Enterprise Research Institute Scalable Reasoning Scan 1: Scan all data (1.1b statements), separate T-Box statements, load T-Box statements (8.5m) into memory, perform authoritative analysis. Scan 2: Scan all data and join all statements with in-memory T-Box. Only works for inference rules with 0-1 A-Box patterns No T-Box expansion by inference Needs “tailored” ruleset 49 50 Digital Enterprise Research Institute Rules Applied: Tailored version of [ter Horst, 2005] 50 51 Digital Enterprise Research Institute Other SAOR rules with 2 or 3 Abox statements in the antecedent: 51 ( ) We avoid these for the moment in the real search engine… … experiments including these rules in [Hogan et al. 2009, IJWSIS] and also in our “pedantic-web” validator, more later. 52 Digital Enterprise Research Institute Good “excuses” to avoid G2 rules The obvious: G2 rules would need joins, i.e. to trigger restart of file-scan, Restricting to G0, G1 allows distribution again! The interesting one: Take for instance IFP rule: Maybe not such a good idea on real Web data More experiments including G2, G3 rules in [Hogan, Harth, Polleres, ASWC2008] 52 53 Digital Enterprise Research Institute Authoritative Reasoning Document D authoritative for concept C iff: C not identified by URI – OR De-referenced URI of C coincides with or redirects to D FOAF spec authoritative for foaf:Person ✓ MY spec not authoritative for foaf:Person ✘ Only allow extension in authoritative documents my:Person rdfs:subClassOf foaf:Person. (MY spec) ✓ BUT: Reduce obscure memberships foaf:Person rdfs:subClassOf my:Person. (MY spec) ✘ Similarly for other T-Box statements. In-memory T-Box stores authoritative values for rule execution Ontology Hijacking 53 54 Digital Enterprise Research Institute Rules Applied The 17 rules applied including statements considered to be T-Box, elements which must be authoritatively spoken for (including for bnode OWL abstract syntax), and output count 54 55 Digital Enterprise Research Institute Authoritative Resoning covers rdfs: owl: vocabulary misuse:. Naïve rules application would infer O(n 3 ) triples By use of authoritative reasoning SAOR/SWSE doesn’t stumble over these :rdfs :owl Hijacking 55 56 Digital Enterprise Research Institute Performance Graph showing SAOR’s rate of input/output statements per minute for reasoning on 1.1b statements (ISWC 2009 Billion Triples challenge): reduced input rate correlates with increased output rate and vice-versa 56 57 Digital Enterprise Research Institute Results SCAN 1: 6.47 hrs In-mem T-Box creation, authoritative analysis: SCAN 2: 9.82 hrs Scan reasoning – join A-Box with in-mem authoritative T-Box: 1.925b new statements inferred in 16.29 hrs Other issues: More valuable insights on our experiences from Web data… Experiments involving G2 and G3 rules in [Hogan et al. 2009, IJWSIS] Detailed comparison to OWL RL This is one machine,naïve approach… 2 related papers in this years’ ISWC with similar approach but parallelisation show that you can do much faster with adding computing power. 57 1.1b + 1.9b inferred = 3 billion triples in SWSE 58 Digital Enterprise Research Institute SWSE in one slide… Enjoy the data… GUI: SPARQL interface: 58 59 Digital Enterprise Research Institute Search result example: 59 60 Digital Enterprise Research Institute Insights/Lessons learned…: Some more insights into our results on Reasoning with Web data: Based on a crawl “6 hops from TimBL’s FOAF file. We did some in-depth analysis of common mistakes on that arguably representative SW crawl. 60 61 Digital Enterprise Research Institute Data Analysis: Example Inconsistencies due to wrong/misused datatypes: e.g. :me ex:age “old”^^xs:integer. Common on the Web: Don’t affect SAOR reasoning so far, but we want to add Datatype support. 61 62 Digital Enterprise Research Institute Data Analysis: Example There is a significant used of undefined (dereferencing doesn’t give a definition) classes and properties: Message: If you need a new property e.g. in FOAF, define your own new ontology and extend it, not just invent things in other’s namespaces! 62 63 Digital Enterprise Research Institute Data Analysis: Example Reasoning inconsistency: TimBL rdf:type foaf:Person. TimBL rdf:type foaf:Organisation. foaf:Person owl:disjointWith foaf:Organisation. Common on the Web (after inference): Mostly from exporters which carelessly use properties with respective domains/ranges. 63 64 Digital Enterprise Research Institute Data Analysis: Example Reasoning noise: ex:alice foaf:mbox “mailto:” ex:bob foaf:mbox “mailto:” Common on the Web: “Suspicious” IFP values can often been identified by heuristics (threshold of number of equated instances, etc.) However, possibly expensive to evaluate. Better: Make people aware, provide validation tools for checking their datasets! 64 65 Digital Enterprise Research Institute RDFAlerts Checks and analyses common mistakes Short Demo. 65 66 Digital Enterprise Research Institute Visit: 66 Already several successes in finding/fixing: FOAF, dbpedia, NYtimes, even W3C specs… etc. 67 Digital Enterprise Research Institute Take home: Practical reasoning over web data ≠ science fiction. Linked Data & Linked Ontologies are as messy as the normal HTML Web We showed some ways to deal with them: Rule-based Reasoning on Web Data typically gives good approximation… … actually still too much, if not done cautiously Not all problems solved yet Dropping sameAs reasoning, we’d miss some important inferences, heuristics might help (e.g. for controlled equality reasoning) Important: Making data publishers aware to produce better quality data might help (RDFAlerts, pedantic-web) 67 Similar presentations © 2017 SlidePlayer.com Inc.
http://slideplayer.com/slide/3547275/
CC-MAIN-2017-22
en
refinedweb
Build a Simple Application with .Net RIA Services (Silverlight 3) – Part 1 This is the first post in a series of posts about building applications with Microsoft .Net RIA Services and Silverlight 3. In this post I will create a new application, create a simple data model and use the Domain Service and Domain Context to retrieve data and bind it to a DataGrid. Before you start, make sure you have Silverlight 3 Beta and .NET RIA Services March 2009 Preview installed, and you have already installed and configured SQL Server. In this sample I am using the Bank Schema I’ve used in the past. Create a Silverlight Navigation Application Create a new Silverlight Navigation Application. After you click OK, the New Silverlight Application Dialog is shown. Click OK again to create an ASP.Net project that links to the new Silverlight Application. A new solution is created. Notice the new assemblies that the Silverlight project is referencing, and notice the new assemblies among them. Build a Domain Service Add a new Data Model to your server side project (BankApp.Web). This data model can be a LINQ to SQL model, an Entity Data Model, or you can use any other business object representation. In this sample I am using a LINQ to SQL data model based on the Bank Schema. Make sure to build the project so that Visual Studio will generate the data classes and data context before the next step. Add a new Domain Service. Add a new Item to the server project, and select the Domain Service template in the Web category. After you add this item, the New Domain Service Class Dialog is shown. Select the Data Context (BankDataContext in this sample), select the entities you want to expose and whether you want to allow editing and click OK. This adds the BankDomainService.cs that contains the code that exposes the data to the client, and BankDomainService.metadata.cs that contains additional metadata, mostly for presentation and validation. A few references were also added:> Build the solution. This executes a build target the generates the client side code that is required in order to consume the Domain Service. If you click the Show All Files button for the client application, you’ll notice the generated code. Display Domain Data in the Application Add a DataGrid Control to the client application. To do that, add a reference to System.Windows.Controls.Data.dll that contains the DataGrid Control. Then, open the Views\AboutPage.xaml and add an xmlns prefix to the CLR namespace of the DatGrid. <navigation:Page x:Class="BankApp.HomePage" … xmlns:data="clr-namespace:System.Windows.Controls; assembly=System.Windows.Controls.Data" … > Add the Xaml markup for the DataGrid Control: <Grid x: <StackPanel> … <StackPanel Style="{StaticResource ContentTextPanelStyle}"> … </StackPanel> <data:DataGrid </data:DataGrid> </StackPanel> </Grid> Handle the Loaded Event of the Page. First, Add a method to handle the Loaded event of the page. <navigation:Page x:Class="BankApp.HomePage" … In the method that handles the event, use the client Domain Context to retrieve data from the service and bind to the DataGrid. private void Page_Loaded(object sender, RoutedEventArgs e) { BankDomainContext context = new BankDomainContext(); this.dataGrid.ItemsSource = context.Customers; context.LoadCustomers(); } Now, run the application and let it go and retreive the data and present it in the DataGrid. In this post I created a new application, created a simple data model and used the Domain Service and Domain Context to retrieve data and bind it to a DataGrid. In the next post I’ll explore more controls that ship with the .Net RIA Services. Enjoy! Great post. I look forward to part 3 How to do this when you have Oracle as database? Anybody know how to handle Enums with RIA Services? I try to execute your SQL code and I've got: "Msg 208, Level 16, State 1, Line 3 Invalid object name 'Bank.dbo.Customers'." Is it right? Where I can find the Bank database ? Thanks Ciekawy artykul, bede tu teraz wpadal czesciej, pozdrawiam bzerwiusz Is it possible to have seperate (multiple) data classes working with silverlight RIA? things work fine when it's all int he same project but when I create a seperate data project in the solution I can't retrieve data from it at all. context.LoadCustomers() not defined?!?!?!
http://blogs.microsoft.co.il/bursteg/2009/04/04/build-a-simple-application-with-net-ria-services-silverlight-3-part-1/
CC-MAIN-2014-42
en
refinedweb
MP4Read - Read an existing mp4 file #include <mp4.h> MP4FileHandle MP4Read( const char* fileName, u_int32_t verbosity = 0 );)
http://www.makelinux.net/man/3/M/MP4Read
CC-MAIN-2014-42
en
refinedweb
Hello, For the past few months I've been working with a lot of different libraries. During this process, I have written some classes & functions that I would like to keep. I have put all of these in my own static library (PJLib). Because some of those libraries (HALCON, ORiN2, ...) are of commercial use, I won't have access to them anymore at the end of this month. Is there any possibility that I can exclude the classes & functions that depend on these libraries from the build of PJLib, in the case that they are not found on the disk? This way, I can keep PJLib up to date without having to keep different versions. It is quite likely that I will have access to HALCON again very soon, so I don't want to throw out the code. It will also make it easier to share my code with others ... Thanks a lot! If you are actually wanting to COMPILE code depending on whether certain libraries are present, then there really is only one solution for this. And that is to use the #ifdef / #endif type preprocessor stuff. It does mean your users will need to somewhere enable/disable the matching #defines, so centralizing this in a single header file is recommended. If you are talking about making your application, but having it make use of certain proprietary/commercial DLLs that may or may not be present on the user machines, that's a different story entirely. Originally Posted by OReubens If you are talking about making your application, but having it make use of certain proprietary/commercial DLLs that may or may not be present on the user machines, that's a different story entirely. Ok, I really don't know what I'm talking about, so I hope to find a starting point here. What I want to do is still include the same static library as I always do in my projects, but when certain libraries (that are used by this library) are not found, I want the compiler to ignore the functions/classes that use these. So that I can build my project anyway ... (without making use of those functions of course) if you talk about actual code libraries, then we're talking about including code in the executable image. This can only be done by #ifdef preprocesor instructions. There is NO way you can make the compiler "detect" which libraries are present, because the compiler does not know this. If you talk about the simple import libraries, then this is basically the same deal. you include code that will make sure a DLL gets loaded alongside yoru own executable, and that all the links to this DLL get matched up. If this is what you talk about, then the solution is to either use implicit loading of DLL's via LoadLibrary/GetProcAddress. And this will mean you need to do some extra work to get this to function. Alternatively, you can use a semi-automated process called DelayLoading, but you'll also need to put some code in place to handle the cases where the expected DLL's aren't present. This may take some work since this isn't what the delayloading system was designed to do (although there are provisions for it in so far as you provide your own fallbacks). For what you are asking, the LoadLibrary/GetProcAddress is the easier solution of the two. THe reason you can't solve this "in the compiler": Suppose a library isn't present. What is the compiler going to do with a call being made to a function in that library ? What is the expected result of that call not being present. Should the compiler give a warning message and abort your program ? Or return zero ? or return an errornumber ? or ? At the very least, you'll somehow need to provide "fallbacks" for every function in the libraries in the case the libraries aren't there. THis could be disabling some menu items, this could be returning "dummy" solutions, this could be messages.... Aha, I think I understand! So I should encapsulate the library-dependent parts with #ifdef's, and then manually set those? The reason I thought there might be a simple (automatic) way to do this, was because when using CMake to build bigger projects, it first checks whether it finds the needed libraries on the system ... There are many ways you could "encapsulate" the technology behind it. And you may be able to use pre-compile steps to do the figuring out for you and generating code/header files doing so, in a way this is going to be what that CMake setup is going to do. They probably have a source file for "if library X is available" and another one "if library X isn't available", and then depending on presense include one or the other in the compilation and liking steps. This would not use #ifdef's it just compiles different CPP's depending on need. At the core of it all however, it boils down to having some bit of c++ code that takes care of the case with and the case without the library. YOU need to provide the code what to do for both cases. Mh yeah ... This stuff is getting really confusing for me. I just wanted the code to be left out of my own Library (PJLib) when the 3D parties aren't found. Then this code would not be able to be used in any program making use of PJLib, and I would not need to provide an alternative. I guess this is a little too complicated for me right now so I might just split up my library in a few parts anyway and go from there. Thanks for the help! Forum Rules
http://forums.codeguru.com/showthread.php?524388-stop-Refreshing-of-images-drawn-by-setpixel()-and-saving-it-how-to-do&goto=nextoldest
CC-MAIN-2014-42
en
refinedweb
This application explains basic concepts of image processing including brightening, converting to gray and adding notes to an image using System.Drawing.Imaging namespace classes. Following code shows how to display an image in a picture box. private Bitmap b = The screen shot above shows an image before and after increasing brightness. This is the main function, where we do the main processing. If you look into the code you will notice, I am using unsafe code, where I am doing the main processing. This is really important because unsafe mode allow it to run that piece of code without CLR, which make the code to run much faster. Here its important because we care about the speed of the routine. public ©2014 C# Corner. All contents are copyright of their authors.
http://www.c-sharpcorner.com/UploadFile/ShrutiShrivastava/ImageProcessing12192005061519AM/ImageProcessing.aspx
CC-MAIN-2014-42
en
refinedweb
Python Programming, news on the Voidspace Python Projects and all things techie. rest2web 0.5.1 rest2web 0.5.1 is now available. This is a minor feature enhancement release. What Is rest2web? Maintaining websites or project documentation in HTML is a pain. rest2web takes out the pain, and brings back the joy. rest2web is a simple tool that lets you build your website from a single template (or as many as you want), and keep the contents in ReStructured Text. (You can still keep pages in HTML if needed.) It has an easy to use. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2006-12-19 18:21:31 | | Categories: Projects, Python More ConfigObj Fixes in Subversion Nicola Larosa has checked in some more changes to ConfigObj. The latest changes are to ConfigObj, validate and the docs : The changes are : - Fixed validate doc to talk of boolean instead of bool; changed the is_bool function to is_boolean (Sourceforge bug #1531525). Thanks to the reporter for this one. - Added a missing self. in the _handle_comment method and a related test, per Sourceforge bug #1523975. Thanks to the reporter for this one too. - Allowed arbitrary indentation in the indent_type parameter, removed the NUM_INDENT_SPACES and MAX_INTERPOL_DEPTH (a leftover) constants, added indentation tests (including another docutils workaround, sigh), updated the documentation. Thanks for this one go to Jorge Vargas, even if I ended up not using his patch that added a new indent_size parameter. - Made the import of compiler conditional so that ConfigObj will run on IronPython There are still some further changes to go in. Nicola and I are discussing how and if all the proposed features should be added. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2006-12-17 21:14:46 | | Categories: Python, Projects, IronPython New Windows Forms Tutorial Entry In celebration of the new IronPython section I've added a new entry to the Windows Forms Tutorial Series. This is entry number eleven : It uses a few new controls to create a slightly more complex GUI than we've seen before in this series. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2006-12-17 20:44:39 | | Categories: IronPython, Writing, Website New IronPython Section I've created a new section on Voidspace : I've moved the Windows Forms tutorials here and setup an aggregator for IronPython related blogs. If you spot any typos, or know of any good blogs I should add to the Planet feed then let me know. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2006-12-17 20:44:03 | | Categories: Website, IronPython Selfless as a Metaclass Having created a decorator that removes the need to explicitly declare self in methods, wouldn't it be nice to be able to apply it automatically ? An Introduction to Metaclasses is a brief tutorial that explains the basics of metaclasses. It creates a metaclass factory which produces metaclasses that decorate all the methods in a class with a function. This is illustrated by creating a metaclass called Selfless that automatically wraps every method in classes with the selfless decorator from the previous entry. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2006-12-16 23:34:14 | | Categories: Python, Hacking Selfless Python Have you ever had friends who wouldn't try Python because of the explicit declaration of self ? Well, me neither actually; but I do know at least one Polish Ruby programmer [1] who dislikes it. But if you did know people like that, your worries would be over... To follow this frippery you'll need the Byteplay module. Below is a decorator named selfless. It automatically adds the self argument to methods on classes, so they can be defined without it. The Test class proves that it works. def _transmute(opcode, arg): if ((opcode == opmap['LOAD_GLOBAL']) and (arg == 'self')): return opmap['LOAD_FAST'], arg return opcode, arg def selfless(function): code = Code.from_code(function.func_code) code.args = tuple(['self'] + list(code.args)) code.code = [_transmute(op, arg) for op, arg in code.code] function.func_code = code.to_code() return function class Test(object): @selfless def __init__(x=None): self.x = x @selfless def getX(): print self.x @selfless def setX(x): self.x = x test = Test() test.getX() test.setX(7) test.getX() Because self isn't passed explicitly to the functions, the interpreter treats self as a global. selfless (and its sidekick _transmute) change the LOAD_GLOBAL op-codes into LOAD_FAST. We then tell the code object that it takes an extra argument, self. The byteplay Code automatically handles setting the correct stack-size on the new code object it creates. In the next exciting instalment we'll (well, me actually...) create a metaclass that applies this automatically to all methods in a class. If you're interesting in bytecodes and code objects, you may be interested in Anonymous Code Blocks in Python. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2006-12-16 21:31:14 | | Categories: Python, Hacking Archives This work is licensed under a Creative Commons Attribution-Share Alike 2.0 License. Counter...
http://www.voidspace.org.uk/python/weblog/arch_d7_2006_12_16.shtml
CC-MAIN-2014-42
en
refinedweb
! Site for lab work is: Java Programming (CITS1200) Code : public class FifteenPuzzle { //Instance Variables public SimpleCanvas sc; //Constructor public FifteenPuzzle (int[][] intialGrid){ sc = new SimpleCanvas (); //Colour java.awt.Color tBlue = new java.awt.Color(0,0,255); sc.setForegroundColour(tBlue); for (int i=0; i < 400;i++) sc.drawLine(0,i,400,i); // Lines java.awt.Color black = new java.awt.Color(0,0,0); sc.setForegroundColour(black); sc.drawLine(100,0,100,400); sc.drawLine(200,0,200,400); sc.drawLine(300,0,300,400); sc.drawLine(0,100,400,100); sc.drawLine(0,200,400,200); sc.drawLine(0,300,400,300); //Lines //Input } //Methods public void moveTile (int x, int y){ } //public int [][] getCurrentGrid(){ //} }
http://www.javaprogrammingforums.com/%20whats-wrong-my-code/399-java-error-another-identifier-expected-printingthethread.html
CC-MAIN-2014-42
en
refinedweb
Python modules are either *.pyfiles or directories containing __init__.py. When defining paths to python modules, you will usually need to deal with the latter ones. A module is meant to be under python path if you can run python and import that module. For example, if you can run the following, then django is under your python path. python >>> import django Stay tuned to get deeper into python paths. Installing modules If a module is installable, usually all you need to do is to extract its setup directory, cdto it, and run python setup.py install This will copy the module into the site-packages directory of the current python installation. It might be that you have multiple Python versions on your computer. According to django documentation, you can find the currently used site-packages by python -c "from distutils.sysconfig import get_python_lib; print get_python_lib()" Or you can use PEAK EasyInstall for installing python modules even faster. But sometimes you will need the latest and greatest versions of your modules directly from version control system. To make them accessible from python you should either check them out directly to site-packages (very messy and inflexible) or keep them somewhere else and do some additional magic. Sym-linking You can create symbolic links (symlinks) in unix-based systems like Linux or Mac OS X. A symlink is like a shortcut to a file or directory. If you create a symlink in site-packages which points to a python module which is located somewhere else, it will work as if the module was copied into site-packages. To create a symlink, type the following in a console/terminal: ln -s <source> <target> For example, if you want python to access djangowhich is under /Library/Subversion/django_src/trunk/django, you need to write something like this (considering that your site-packages are at /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/) ln -s /Library/Subversion/django_src/trunk/django /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django To delete the symlink, simply remove it (this won't delete the original module): rm /Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/django But as I've already mentioned, this works only in unix-based environments and you can't use shortcuts in Windows for the same purpose. *.pth files Python supports *.pthfiles which contain the paths to the parent directories of your python modules one per line. Those files should be placed in site-packages and can be called whatever you want them to call. For example, you can create a file my-project.pthand write /Library/Subversion/django_src/trunk /Library/Subversion/myproject_src/trunk or C:\Subversion\django_src\trunk C:\Subversion\myproject\trunk into it. Then django and your project files will be importable in python. However, you might have no permissions to create files under site-packages or you might need to activate different locations of python modules for different projects. PYTHONPATH variable The other way is to set additional paths for python just before running the externally kept modules. This is done by setting the python paths to the environment variable PYTHONPATH. Note again that python paths point not to the modules themselves, but to their parent directories! The syntax slightly differs among different platforms. Linux and Mac OS X: # checking value echo $PYTHOPATH # setting value export PYTHONPATH="/Library/Subversion/django_src/trunk" # appending to the existing value export PYTHONPATH="$PYTHONPATH;/Library/Subversion/django_src/trunk" Windows: # checking value echo %PYTHOPATH% # setting value set PYTHONPATH="C:\\Subversion\\django_src\\trunk" # appending to the existing value set PYTHONPATH="%PYTHOPATH%;C:\\Subversion\\django_src\\trunk" Multiple paths can be separated by a colon (";"). PYTHONPATHcan be used in scripts and webserver configuration files, but it is not very comfortable in daily use. Adding paths to sys.path For the projects that you develop and which should run as standalone applications, you can set the required python paths relatively inside your python code. Note that all python paths which you set in the PYTHONPATHvariable or *.pthfiles as well as the path of default python libraries and the path of site-packages get listed in python variable sys.path. When you import a module, it is loaded from the first location which contains the required module. So if you have two paths to different django versions in your python paths and you import django, the django version from the first location will be used. You can read the list of loaded python paths like this: >>> import sys >>> sys.path You can also freely modify it, for example: >>> import sys >>> sys.path.append("/Library/Subversion/django_src/trunk") >>> import django And this is an example, how to get and use paths relative to the currently loaded file: import os, sys SVN_PATH = os.path.abspath(os.path.join(os.path.dirname(__file__), "..", "..")) DJANGO_PATH = os.path.join(SVN_PATH, "django_src", "trunk") PROJECT_PATH = os.path.join(SVN_PATH, "myproject", "trunk") sys.path += [DJANGO_PATH, PROJECT_PATH] I hope this introduction was useful for developers and made the big picture about the paths clearer. Some more related information can be found at the official python documentation. I'm going to be directing noobs to this post from now on, thanx. Hi Aidas, that's a very useful overview, thanks! Interesting post. What method are you using? Arthur, Depending on a situation, mostly I am using pth files and sys.path. The former is for setting paths to django, different third-party projects and utilities. The latter is used in Apache settings, tweaked manage.py, and settings.py. The path section really helped me to use paths more hackingly!!! Argh! Thank you a Million for "Note again that python paths point not to the modules themselves, but to their parent directories!" I have been pulling out what little hair I have left trying to figure out why a pth file was not working! "But as I've already mentioned, this works only in unix-based environments and you can't use shortcuts in Windows for the same purpose." Yes you can. Symlinks work just fine in Windows: Acetech has many years of experience in custom software development. Find out more about custom software development at
http://djangotricks.blogspot.com/2008/09/note-on-python-paths.html
CC-MAIN-2014-42
en
refinedweb
Ryan is a software engineer for Siebel Systems. He can be contacted at ryan@ ryanstephens.com. In theory, comparing two relational data sets is straightforward. The problem statement is simple enough: Given two data sets, A and B, measure how similar they are. But here is where the apparent simplicity begins to fade-what does "similar" mean? The definition of similarity depends on the sort of differences you want to capture. Two (or more) data sets can differ in both magnitude and content. For example, B may contain many more rows than A, and that is worth knowing, but the rows also may or may not contain combinations of values similar to those in A, and that is worth knowing, too. If you want to capture such differences, you can start with a simple approach. Match up unique keys in the two tables, count the number of columns that contain unequal values, and report the average number of differences. Find the difference in the number of rows in each data set to capture any difference in magnitude. This will give you a rough idea of how similar two data sets are. This approach may be sufficient for some data sets, but it has a few shortcomings. To begin with, it does not work when both data sets do not share common unique keys-which rows do you compare? It also lacks a general scheme for comparing relative similarity in data sets of different size; the average column difference is data dependent. Thus, in finding a solution to this problem, there are two competing goalsmeasure similarity without imposing requirements on the data (such as unique keys), and provide an intuitive way to represent the difference. It would also be nice if the solution requires only enough information about the data to make accurate measurements, and is therefore general enough to apply to a variety of data types. In this article, I show how borrowing techniques from the field of Information Retrieval lets you measure the similarity between data sets efficiently, accurately, and with minimal development. Information Retrieval & Computational Geometry Information Retrieval (IR) is a field devoted primarily to efficient, automated indexing and retrieval of documents. There are a variety of sophisticated techniques for quickly searching documents with little or no human intervention. A survey of those techniques is beyond the scope of this article (see "Matrices, Vector Spaces, and Information Retrieval" by M. Berry, SIAM Review Volume 41, No. 2, 1999 for a great tour of them), but the common thread in many of them is that they are based on a geometric representation of data called the "vector space model." In the vector space model, documents are represented by vectors (arrays of numbers) in a high-dimensionality vector space. This representation is possible by imposing a few simplifications on the putative notion of a "document." First, since most documents are simply ordered sets of words, ignore the word order and you are left with sets of words (sets that allow duplicates, that is). Next, to make things simpler still, replace each unique word with a word/frequency pair, where the frequency indicates the frequency of that word in the current document. Despite this seeming oversimplification, word frequencywithout regard for orderstill retains a significant amount of information about a document's contents. Take this one step further and decouple the word-frequency pairs. An easy way to do this is to have a vector of words as your "dictionary." Then you can represent documents as integer vectors, where an entry at a given index contains the frequency in that document for the word at the same index in the dictionary. So if dict[5] in the dictionary is "hiking" and doc[5] in my document vector is "7," it means that the document represented by doc[] contains the word "hiking" seven times. This is where geometry comes in. Now that you have a vector of n integers, you have a point in n-dimensional space. Consider a simple dictionary that contains only two words: "running" and "swimming." It might look like this: dict[0] = "running" dict[1] = "swimming" Now imagine that you have a document (say a magazine article) that has the word "running" three times and "swimming" twice. That vector would look like: doc[0] = 3 doc[1] = 2 Figure 1 provides a visual representation of this, which is a vector in a two-dimensional space. Other documents with the same terms would be represented by vectors in the same space and would appear as other points on the 2D vector space. Documents that are similar, based on relative word frequency, appear closer to one another than those that do not. Therefore, you can use a couple of standard geometric measures to measure how "close" two vectors are, which is their respective documents' similarity: Euclidean distance and cosine. Euclidean distance, which involves the square root of the sum of the squares of the differences (see Figure 2), is a good measure of the magnitude of the difference between the two documents. For example, if you have document A that contains "running" 20 times and "swimming" zero times, and another document B that contains "swimming" 30 times and "running" zero times, the two documents have a distance of about 36. If, on the other hand, document C contains "running" 15 times and "swimming" twice, the distance to A is about 5. Intuitively, this makes sensedocuments that use the same words roughly the same number of times are probably more similar than those that don't. This doesn't capture the whole picture though. In the same example, what if document B contains the word "running" 100 times? Intuitively, it should be very similar to document A because both documents are clearly more about running than anything else, but using the distance formula, you are still 80 units away. This is not right. The cosine measure takes care of this. The cosine treats both vectors as unit vectors by normalizing them, then gives you a measure of the angle between the two vectors; see Figure 3. The notation ||x|| means the vector norm, which is xTx. Now revisit the aforementioned example. With vectors d1{20,0} and d2={0,30}, the cosine=0, which means these two vectors are perpendicular (regardless of their length). Table 1 contains the possible values for cosine and their directional meanings. Similarly, suppose d1 represents a magazine article and d2 a book. With d1={3,2} and d2={305,220}, the cosine is 0.9993, which means these two vectors are pointing almost exactly in the same direction and, therefore, the two documents are similar in content. Intuitively, the cosine measure preserves the ratios of terms relative to one another. There are a couple of items worth pointing out here. First, based on the descriptions above, cosine appears to be a much better measure. It provides an accurate, intuitive measure of similarity without regard for magnitude. But magnitude is important. If one data set is 10 times the size of the other (and this is something, based on the type of data you are dealing with, that you may want to measure), cosine will not tell you. Second, there is one problem with using frequency as the numerical basis for this: What about frequently used words that carry little or no meaning? Words like "and," "or," "the," and so on, will have extremely high frequencies and therefore significantly affect the similarity measures, but tell you nothing about a given document. Not surprisingly, there are a number of weighting schemes used in IR that neutralize these terms so they don't skew the results. This will not be a problem in this article's techniques, but the schemes for dealing with these approaches are elegant. Now that the basis for IR similarity measures has been set, you can investigate how to recast the data set similarity problem as a geometric problem. Recasting the Problem As is often the case in programming and computer science, representing one problem as another enables a whole class of solutions. Think of a relational data set as a document. Each unique column/value pair is a term and the number of occurrences of it in a given data set is its frequency. With a little bookkeeping code and a handful of simple data structures, you can use the geometric formulas just described to measure similarity between data sets. Before you do anything else, figure out what your data sets look like. Determining which tables and columns you are going to compare will be (and should be) the most time-consuming task in this whole exercise. For simplicity, I assume you are comparing two identical tables. Additionally, the data sets in this article should be simple SELECT statements. You can, of course, include multiple tables in your data sets using joins, but doing so adds more complexity. Just as in comparing documents, not all terms are useful. I mentioned earlier how words like "and" and "the" are useless when comparing documents. The same goes for data sets: If most records in a data set have the same value, then it does little good when comparing them. Unique terms, at the other extreme, are equally useless when comparing two data sets. To jump back to the magazine article analogy, suppose the "running" and "swimming" articles were written by different authors. If I know the first article contains the first author's name twice and the second one contains the second author's name three times, this tells me nothing about the similarity of the articles' content because they are unique to each document. Apply this same intuition to data sets. Use columns that contain heterogenous, evenly distributed values, but that are not unique. For example, if one of the data sets you want to compare contains, say, 100,000 rows, a good candidate column for this technique may hold five or 10 different values, each with a significant number of rows. You can get a feel for data distribution with SQL's COUNT and GROUP BY clauses. Say you want to see the distribution of the TYPE column on a FIELD table; you could do it like this: SELECT DISTINCT TYPE, COUNT(TYPE) FROM FIELD GROUP BY TYPE This produces the breakdown of the data distribution in Figure 4(a). This data is sufficiently evenly distributed, though not perfect. It is somewhat skewed toward the TEXT, BOOL, and ID values, but there are enough of the other types to make it a useful column. For the sake of comparison, a column with poor distribution may look like Figure 4(b). This sort of distribution is not completely useless, but chances are that other columns have more meaningful data. The goal of this analysis is to find columns that characterize the data, and because of that, a column's usefulness is partially subjective. You know what the data in your table are used for, so it may be that a heavily slanted distribution is okay. Generally speaking, however, more evenly distributed column values contribute more to your similarity measures. What I have described is a best-guess, eyeball approach to analyzing data distribution. If you want a solid mathematical measure of data distribution, see the accompanying text box entitled "Entropy." Once you have examined the data distribution for each of the columns in your data sets, you should know which columns will be useful in comparing them. The next step is transforming this data into a geometric representation. Before you use IR techniques on relational data sets, you have to transform the data into a different representation. Thus, this is the critical step in this exercise. From the previous explanation of similarity measures, you already know that you need to convert this data into a frequency vector format. The pseudocode for doing so is straightforward: for each row for each column make a key of the column name and value add the key to the dictionary if it's not there already increment the corresponding index in the doc vector This algorithm uses two structuresa dictionary and an integer vector. The dictionary does two things. First, it keeps track of the terms. A term, for our purposes, is a unique column name/value combination. The dictionary has a single entry for each of them. Second, it makes manipulation of the document vectors easier and more efficient. Each index in the doc vector corresponds to a term in the dictionary. There is one dictionary and as many document vectors as there are data sets to be compared. Build each document vector by examining each term in the data set, looking it up in or adding it to the dictionary and getting the index of it in the process, then incrementing the corresponding index in the document vector for each occurrence of the term. All of this is easy to do with C# and a handful of the ADO.NET classes. My DataSource class (available electronically; see "Resource Center," page 5) uses the classes OdbcConnection, OdbcCommand, and OdbcDataReader in the System.Data namespace to do all the database work, and ArrayLists for the dictionary and document vectors. Take note of the SqlToDocument method. It executes a SQL statement against the current data source, then converts the results to a dictionary/frequency vector format. Listing One is the most important part of the code. Create each of your document vectors with SqlToDocument like this: myDS1.SqlToDocument( sql1, dict, doc1 ); myDS2.SqlToDocument( sql2, dict, doc2 ); Once you have created both document vectors, the transformation is complete. Now you have two frequency vectors that are in sync with the dictionary, or to put it another way, the indices of each vector refer to the same term. Measure their similarity with Euclidean distance or cosine: double dist = ds1.Distance( doc1, doc2 ); double cos = ds1.Cosine( doc1, doc2 ); At this point, you have your distance or cosine measure. So what now? It depends on what types of data differences you want to measure. The Results If you use the techniques described so far, you have two numbers, distance and cosine, that each tell something about the difference between the data sets. Distance indicates the magnitude of the difference and cosine reports the similarity of the data in each of the data sets. Both numbers describe important aspects of the relationship between data sets. Consider the case just described, where you have a magazine article and a book about the same topic. In terms of data sets, the "book" data set would have rows with the same combination of values, but with more of them. The corresponding vectors may look like Figure 5. Cosine tells you that the vectors point in roughly the same direction and that the documents are therefore similar in content, and distance will tell you that one is much larger than the other. You can use the two values together to infer the relationship between the two data sets. When you use more than three terms, the corresponding vectors are not something you can visualize, but the calculations work regardless. Cosine and Euclidean distance work for any number of dimensions. Conclusion One technique won't work for everybody so experiment and see what sort of calculation makes the most sense for your data. For example, for one of my applications, I had to use a different approach to distance by normalizing it to some basis and then using that normalized value. I did this by using one vector as the baseline and calculating its distance from the origin. I then calculated the distance between the two vectors and reported that distance as the percentage of the baseline distance. This let me get an idea of what a value for distance means, in terms of the size of the baseline vector. You can use this and similar approaches based on the type of data you are using and the kinds of differences you want to measure. The two complementary measurement calculations permit effective comparison of data quantity and quality, and with some experimentation, you should be able to tailor it to suit your particular needs. DDJ while (reader.Read()) { for (int j = 0; j < reader.FieldCount; j++) { name = reader.GetName( j ); val = reader.GetValue( j ).ToString(); key = name + "|" + val; idxDict = dict.IndexOf( key ); if (idxDict < 0) { idxDict = dict.Add( key ); doc.Insert( idxDict, 1 ); } else { idxKey = dict.IndexOf( key ); freq = (int)doc[idxKey]; freq++; doc[idxKey] = freq; } } }Back to article
http://www.drdobbs.com/architecture-and-design/information-retrieval-computational-geo/184405928
CC-MAIN-2014-42
en
refinedweb
Neil Mitchell wrote: > Does it really have to change statically? > > >>I use code like: >>#ifdef __WIN32__ >> (Windows code) >>#else >> (Linux code) >>#endif > > > In Yhc, we use a runtime test to check between Windows and Linux. It > has various advantages - we only have one code base, everything is > type checked when we compile, and we've never run into any problems > once despite developing on two different platforms. > >;a=headblob;f=/src/compiler98/Util/FilePath.hs There's a lot to be said for using runtime tests instead of conditional compilation, I agree. However, it can't be used exclusively: you can't choose between two foreign calls this way, for example, because one of the calls won't link. Cheers, Simon
http://www.haskell.org/pipermail/haskell-cafe/2006-March/014939.html
CC-MAIN-2014-42
en
refinedweb
When we select source code in visual studio it selects the complete source code as shown below. public class Customer { private int CustomerCode; private string CustomerName; private string Address; private string PhoneNumber; private bool IsGold; private short PostalCode; private int FileNumber; private string PenName; private string AlterNateAddress; private string PagerNumber; private bool IsActive; } But what if we want to select partial code in a rectangular fashion as shown in the below figure. As you select probably you would also like to modify that selected portion code as shown in the below figure. To do a rectangular selection press your ALT button of the keyboard as you select the code using the left button of your mouse. Once the code is selected start your modification as pre your wish. Video for the Tip above: -
http://www.nullskull.com/faq/1297/visual-studio-tip-1--how-to-select-code-in-a-rectangular-fashion.aspx
CC-MAIN-2014-42
en
refinedweb
Importing React Through the Ages by Kent C. Dodds Before we get started, here's a brief look of valid (today) ways to import React and use the useState hook: // globalwindow.React.useState()// CommonJSconst React = require('react')React.useState()// ESModules default importimport React from 'react'React.useState()// ESModules named importimport {useState} from 'react'useState()// ESModules namespace importimport * as React from 'react'React.useState() Below I'll explain where each of these mechanisms came from and why I prefer the last one. Before the dawn of time I started writing React code back in the React.createClass days. Here's how we did things back then: var React = require('react')var Counter = React.createClass({propTypes: {initialCount: React.PropTypes.number.isRequired,step: React.PropTypes.number,},getDefaultProps: function () {return {step: 1}},getInitialState: function () {var initialCount = this.props.hasOwnProperty('initialCount')? this.props.initialCount: 0return {count: initialCount}},changeCount: function (change) {this.setState(function (previousState) {return {count: previousState.count + change}})}increment: function () {this.changeCount(this.props.step)},decrement: function () {this.changeCount(-this.props.step)},render: function () {return (<div><div>Current Count: {this.state.count}</div><button onClick={this.decrement}>-</button><button onClick={this.increment}>+</button></div>)},}) Yup, var, React.createClass, require, function. Good times. Classes and Modules Eventually, we got ES6 (and later) which included modules, classes, and some other syntax niceties: import React from 'react'class Counter extends React>)}} This is when the "how should I import React" question started popping up. A lot of people preferred doing this: import React, {Component} from 'react'class Counter extends>)}} Normally this sort of thing isn't even a question. You just do what the library exposes. But React never actually exposed ESModules. It exposes itself as either a global variable called React or a CommonJS module which is the React object which has Component on it (along with other things). But because of the way the code is compiled, both approaches technically work and neither is technically "wrong." One other note... Looking at the code above you might wonder why we can't change that to: - import React, {Component} from 'react'+ import {Component} from 'react' The reason you need React in there is because (at the time) JSX was compiled to use React: - <button onClick={this.increment}>+</button>+ React.createElement('button', {onClick: this.increment}, '+') So if you use JSX, you need to have React imported as well. It wasn't long after this that function components became a thing. Even though at the time these couldn't actually be used to manage state or side-effects, they became very popular. I (and many others) got very accustomed to refactoring from class to function and back again (many people just decided it was easier to use class components all the time). For me, I preferred using function components as much as possible and this is likely the reason that I preferred using import React from 'react' and React.Component rather than import React, {Component} from 'react'. I didn't like having to update my import statement any time I refactored from class components to function components and vice-versa. Oh, and I know that IDEs/editors like VSCode and WebStorm have automatic import features, but I never found those to work very well (I ran into stuff like this all the time). Oh, and one other interesting fact. If you were using TypeScript instead of Babel, then you'd actually be required to do import * as React from 'react' unless you enabled allowSyntheticDefaultImports. The Age of Hooks Then hooks took the scene and the way I wrote components evolved again: import React from 'react'function Counter({initialCount = 0, step}) {const [count, setCount] = React.useState(initialCount)const decrement = () => setCount((c) => c - step)const increment = () => setCount((c) => c + step)return (<div><div>Current Count: {count}</div><button onClick={decrement}>-</button><button onClick={increment}>+</button></div>)} This brought up another question on how to import React. We had two ways to use hooks: import React from 'react'// ...const [count, setCount] = React.useState(initialCount)// alternatively:import React, {useState} from 'react'// ...const [count, setCount] = useState(initialCount) So again, should we do named imports, or just reference things directly on React? Again, for me, I prefer to not have to update my imports every time I add/remove hooks from my files (and again, I don't trust IDE auto-import), so I prefer React.useState over useState. The new JSX transform and the future of React + ESM Finally, React 17 was released with basically no real breaking changes but an announcement of great import (pun intended): There's a new JSX transform that means you no longer need to import React to transform JSX. So now you can write: function App() {return <h1>Hello World</h1>} And this will get compiled to: // Inserted by a compiler (don't import it yourself!)import {jsx as _jsx} from 'react/jsx-runtime'function App() {return _jsx('h1', {children: 'Hello world'})} So the import happens automatically now! That's great, but that also means that if you want to migrate to use this new capability, you'll need to remove any import React from 'react' that's just for JSX. Luckily the React team made a script to do this automatically, but they had to make a decision on how to handle situations where you're using hooks. You have two options: import * as React from 'react'const [count, setCount] = React.useState(initialCount)// orimport {useState} from 'react'const [count, setCount] = useState(initialCount) Both of these work today, are technically correct, and will continue to work into the future when React finally exposes an official ESModules build. The React team decided to go with the named imports approach. I disagree with this decision for reasons mentioned above (having to update my import all the time). So for me, I'm now using the import * as React from 'react' which is a mouthful for my hands to type, so I have a snippet: // snippets/javascript.json{"import React": {"prefix": "ir","body": ["import * as React from 'react'\n"]},} So here's the current state of things: To clarify:— Dan (@dan_abramov) September 23, 2020. For me, I'm sticking with import * as React from 'react' so I don't have to worry about my imports. And that's my overly long blog post answer for a very common question I get. Hope it was helpful!
https://epicreact.dev/importing-react-through-the-ages/
CC-MAIN-2021-43
en
refinedweb
Developer forums (C::B DEVELOPMENT STRICTLY!) > Plugins development Plug-Ins : some suggested "case" conventions (1/3) > >> killerbot: When ones creates a plug-in for Code::Blocks (focusing here on contrib plug-ins that should work under Windows and linux), the plug-in project will contain several files : 1) Source files 2) Project files (*.cbp, Makefile.am's ..) 3) manifest file 4) resource files This causes the plug-in name (or it's ID, or whatever you like to call it) to show up in several places. The majority of those places require that name to be identical, meaning using the same case !! [On windows this is no issue, but on linux it is very important]. Let's have a look at those places where that name shows up. But first let's decide on a name for our test case plug-in : "TestCase". --- Quote ---This would be the *suggestion* : start every word in the name with an uppercase : JustLikeThis --- End quote --- Allrighty, let's continue our excursion : 1) manifest.xml --- Code: ---<Plugin name="TestCase"> --- End code --- --> it states the plug-in name 2) the zip file of the resources : "TestCase.zip" This zip file is created as a post-build step, so the correct command needs to show up in the following project files : TestCase.cbp (to build on windows with CB) TestCase-unix.cbp (to build on linux with CB) Makefile.am : to build on linux and windows Some example snippets out of those project files : --- Code: --- <ExtraCommands> <Add after="zip -j9 ..\..\..\devel\share\codeblocks\TestCase.zip resources\manifest.xml resources\*.xrc" /> <Mode after="always" /> </ExtraCommands> --- End code --- --- Code: --- <ExtraCommands> <Add after="zip -j9 ../../../devel/share/codeblocks/TestCase.zip resources/manifest.xml resources/*.xrc" /> <Mode after="always" /> </ExtraCommands> --- End code --- --- Code: ---EXTRA_DIST = MyFirst.xrc MySecond.xrc manifest.xml pkgdata_DATA = TestCase.zip CLEANFILES = $(pkgdata_DATA) TestCase.zip: PWD=`pwd` cd $(srcdir) && zip $(PWD)/TestCase.zip manifest.xml *.xrc > /dev/null --- End code --- 3) The code registering the plug-in and loading the resource : TestCase.cpp : --- Code: ---// Register the plugin namespace { PluginRegistrant<TestCase> reg(_T("TestCase")); }; /* ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- ----- */ TestCase::TestCase() { //ctor if(!Manager::LoadResource(_T("TestCase.zip"))) { NotifyMissingFile(_T("TestCase.zip")); } }// end of constructor --- End code --- 4) the output "shared" library (*.so or *.dll) Again some example snippets from the project files --- Code: ---<Option output="..\..\..\devel\share\CodeBlocks\plugins\TestCase.dll" prefix_auto="0" extension_auto="0" /> --- End code --- --- Code: ---<Option output="../../../devel/share/codeblocks/plugins/libTestCase.so" /> --- End code --- --- Code: ---lib_LTLIBRARIES = libSymTab.la libTestCase_la_LDFLAGS = -module -version-info 0:1:0 -shared -no-undefined -avoid-version libTestCase_la_LIBADD = libTestCase_la_SOURCES = --- End code --- And for consistency it's also nice if you project names are alike : --- Code: --- <Project> <Option title="TestCase" /> --- End code --- takeshi miya: I'd say: 1) CamelCase 2) lowercase 3) CamelCase 4) lowercase 5) CamelCase In short, lowercase for all filenames, and CamelCase for everything else (project names, classes...). mandrav: --- Quote from: Takeshi Miya on October 24, 2006, 03:01:38 pm ---I'd say: 1) CamelCase 2) lowercase 3) CamelCase 4) lowercase 5) CamelCase In short, lowercase for all filenames, and CamelCase for everything else (project names, classes...). --- End quote --- You missed the point completely. All 5 points must match, case-sensitively (even under windows). thomas: --- Quote from: mandrav on October 24, 2006, 03:51:16 pm ---You missed the point completely. All 5 points must match, case-sensitively (even under windows). --- End quote --- How dare you say that! Takeshi knows. takeshi miya: --- Quote from: mandrav on October 24, 2006, 03:51:16 pm ---You missed the point completely. --- End quote --- Sorry, but yes, I understood Lieven's post as something to discuss and to change... Not how it is now. The title "suggested case conventions" doesn't sounds like "enforced case conventions". If this was meant as a documentation and not to discuss, one would expected it in the Wiki. --- Quote from: thomas on October 24, 2006, 04:04:01 pm ---How dare you say that! Takeshi knows. --- End quote --- Bleh, but thanks for the attitude anyways. Navigation [0] Message Index [#] Next pageGo to full version
https://forums.codeblocks.org/index.php/topic,4290.0/wap2.html?PHPSESSID=53833cb6248503dbfea4891d0a1012aa
CC-MAIN-2021-43
en
refinedweb
In this article, we will cover NumPy.choose(). Along with that, for an overall better understanding, we will look at its syntax and parameter. Then we will see the application of all the theory part through a couple of examples. But at first, let us try to get a brief understanding of the function through its definition. Numpy Choose is a function to select options from the multiple arrays according to our need. Suppose you have multiple Numpy arrays grouped under a single array, and you want to get values from them collectively at once. In such cases the function NumPy.choose() comes handy. Up next, we will see the parameter associated with it, and followed by which we will look at the different parameters. Syntax of Numpy.Choose() np.choose(a,c) == np.array(][I] ]) Above, we can see the general syntax of our function. It may seem a bit complicated at first sight. But worry not. We will be discussing each of the parameters associated with it in detail. Parameter of Numpy.Choose() a: int array This Numpy array must contain numbers between 0 to n-1. Here n represents the number of choices unless a mode(an optional parameter) is associated with it. choices: a sequence of array “a” and all of the choices must be broadcastable to the same shape. If choices are itself an array, then its outermost dimension is taken as defining the “sequence”. out: array It is an optional parameter. If it is declared the output will be inserted in the pre-existing array. It should be of appropriate d-type and shape. mode:{raise(defalut), wrap,clip} It is an optional parameter. The function of this parameter is to decide how index numbers outside[0,n-1] will be treated. It has 3 conditions associated with it, which are: “raise”: In this case an exception is raised. “wrap”: In this case the value becomes value |N| “clip”: In this case value <0 are mapped to 0, values >n-1 are mapped to n-1. Return of Numpy.Choose() merged array: array This function returns a merged array as output. NOTE: If a and each choice array are not broadcastable to the same shape then in that case “VALUE ERROR” is displayed. Numpy Choose Elements of Array Example – We have covered the syntax and parameters of NumPy.choose() in detail. Now let us see them in action through different examples. These examples will help us in understanding the topic better. We will start with an elementary level and then look at various variations. #input import numpy as ppool a=[[1,23,3,6],[3,5,6,9]] print(ppool.choose([1,0,1,0],a)) Output: [ 3 23 6 6] In the above example, we have first imported the NumPy module. Then we have declared a Numpy array. After which, we have used our general syntax and a print statement to get the desired result. The output here justifies our input. We can understand it as follows: we have declared our choices as [1,0,1,0]. This means that the first component of our element will be the 1st element of sub-array number 2. Then, the second element will be the second element of array number 1. Next term will 3rd element of array number sub-array number 2, and the last element will be the 4th element of sub-array 2. Example of Choosing Values from Numpy Array #input import numpy as ppool a=[[1,23,3],[3,5,6],[45,78,90]] print(ppool.choose([1,2,0],a)) Output: [ 3 78 3] Again in this example, we have followed a similar procedure as in the above example. Here we have 3 sub-array instead of 2 and 3 choices instead of 4. The reason behind this is that we have 3 elements in the array. If we declare 4 choices, then there would be no 4th term to fill its space, and all we would get is an error. That’s something everyone should take care of while dealing working with this function. According to outputs, numpy choose() function selected values from the 2nd, 3rd, and 1st array respectively. Numpy Choose Random from an Array Example We all know a case where we need to choose a choice from a list of options. Luckily, in numpy, there is a method to achieve it precisely. Given that you have an array, numpy.choose() will select a random option from the Numpy array. The following example can help you to understand it – Code – import numpy as np x = np.random.choice(5, 3) print(x) Output – [2 3 2] (Random output) Explanation – First, we import the module numpy in the first line. Then numpy.random.choice returns the random number from 0 to 5 and form an array of lengths 3. Must Read Understanding Python Bubble Sort Numpy Determinant | What is NumPy.linalg.det() Numpy log in Python Conclusion In this article, we have covered NumPy.choose(). Besides that, we have also looked at its syntax and parameters. For better understanding, we looked at a couple of examples. We varied the syntax and looked at the output for each case. In the end, we can conclude that Numpy. choose() helps us getting elements from the different sub-arrays at once. I hope this article was able to clear all doubts. But in case you have any unsolved queries feel free to write them below in the comment section. Done reading this, why not read fliplr next.
https://www.pythonpool.com/numpy-choose/
CC-MAIN-2021-43
en
refinedweb
I have a Dask DataFrame with a date-time column and other numeric columns. The successive entries in the DataFrame rows differ by a fixed time interval t mins. I want to aggregate the data hourly so that the average of the rows for the other columns data is computed for every hour. How can this be done, can groupby with date-time include specifying aggregation interval? Answer You probably want the resample method. In your case import dask # Synthetic data df = dask.datasets.timeseries() # Compute the average for each hour df.resample('H').mean().compute()
https://www.tutorialguruji.com/python/dask-dataframe-aggregate-data-based-on-timestamp/
CC-MAIN-2021-43
en
refinedweb
Asked by: Binding Update become blank on UWP Question - User179531 posted Hello all, I am a beginner and just starting to use Xamarin.Forms for cross platform. At first, the thing work fine in Android, but not working in Universal Windows Platform. I have create the Xamarin.Forms follow UWP instruction at The problem: - When I change the data in binding object, the label become empty. FirstPage.xaml <StackLayout Orientation="Vertical"> <ListView x: <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <Grid Padding="5"> <Label Text="{Binding UserName}" /> </Grid> </ViewCell.View> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> <Button Text="change username" Clicked="changeUserNameClicked" /> </StackLayout> User.cs namespace XamarinPCL { public class User { public string username { get; set; } } } UserViewModel.cs namespace XamarinPCL { public class UserViewModel : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; public void NotifyPropertyChanged(String propertyName) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } private User _user; public String UserName { get { return _user.username; } set { _user.username = value; NotifyPropertyChanged("UserName"); } } public UserViewModel(User user) { _user = user; } } } FirstPage.cs using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; using System.Collections.ObjectModel; namespace XamarinPCL { public partial class FirstPage : ContentPage { ObservableCollection<UserViewModel> _userVM = new ObservableCollection<UserViewModel>(); UserViewModel _uvm1 = new UserViewModel(new User() { username = "user 1" }); UserViewModel _uvm2 = new UserViewModel(new User() { username = "user 2" }); public FirstPage() { InitializeComponent(); } protected override void OnAppearing() { base.OnAppearing(); _userVM.Add(_uvm1); _userVM.Add(_uvm2); LvUser.ItemsSource = _userVM; } private void changeUserNameClicked(object sender, EventArgs e) { _uvm1.UserName = "i changed"; } } } When I click on the item, the row #1 become empty, any idea?Monday, December 28, 2015 4:11 AM All replies - User128591 posted It's a bug, currently must set grid's row or column's width and heightMonday, December 28, 2015 10:01 AM - User179531 posted @Gruan said: It's a bug, currently must set grid's row or column's width and height Which grid do you mean? the grid inside the ViewCell? However, I have modified the ListView and also the Grid <ListView x: <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <Grid Padding="5" HeightRequest="50" WidthRequest="300"> <Label Text="{Binding UserName}" /> </Grid> </ViewCell.View> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> but still show blank, any solution? ps: I am using Xamarin.Forms 2.0.0.6490Tuesday, December 29, 2015 1:53 AM - User128591 posted Grid's column or row's width and height. Issue : Image in ListView's ViewCell on UWP Hi, I'm trying add image into ListView's ViewCell. On Android / WP it's all work fine. But on UWP , something is very inconceivable, Environment: Xamarin.Forms 2.0.0.6490 UWP 10586 First, Image direct in ViewCell.View, it will show: ~~~ If wrapp it with Grid, it not show: ~~~ If wrap it with StackLayout and Grid, it will show again: ~~~ If define a row with exactly Height, image not show, whatever with or without Stacklayout : ~~~ if set row height as auto or not define height, image will show again!Tuesday, December 29, 2015 3:16 AM - User179531 posted Thank you Gruan, you are really helpful. After reading your case, I manage to make my sample work, solution as below. <ListView x: <ListView.ItemTemplate> <DataTemplate> <ViewCell> <ViewCell.View> <Grid Padding="5"> <Grid.RowDefinitions> <RowDefinition Height="auto"/> </Grid.RowDefinitions> <Label Text="{Binding UserName}" Grid. </Grid> </ViewCell.View> </ViewCell> </DataTemplate> </ListView.ItemTemplate> </ListView> But it is very inconvenience to require this kind of workaround to complete a small job, and sometime we cannot know which combination will destroy it again. I had struggled in this problem for almost 2 days to make it work (which done easily in actual UWP), I feel maybe Xamarin.Forms is still not mature to build for UWP. I am worrying whether it will have more bug like this for me to challenge later on, so in your opinion, do you think I should go for actual UWP or use Xamarin.Forms and shared for ios/android/uwp.Tuesday, December 29, 2015 3:44 AM - User176749 posted Still today isn't Mature. I also spent a lot of time to fix uwp and my case is more complicatedThursday, January 19, 2017 1:28 AM
https://social.msdn.microsoft.com/Forums/en-US/1a3828bf-b727-434b-b957-da12fb32d7f3/binding-update-become-blank-on-uwp?forum=xamarinforms
CC-MAIN-2021-43
en
refinedweb
User:Andy Crowd My achievements My packages in AUR: list them. My sandbox pages: A list of other sub/fun Fast Notes & current problems that need to be solved - Current links as tmp-memo I need to use - Download Chinese fonts A="$(curl | grep -i ttf | sed 's/[^*]*href=\"//g' | cut -d\" -f1)" - Interesting link about mimetypes-database. - Show list of unique category names. Could simplify and added as option --lc in lsdesktopf to search only in /usr/share/applications/and $HOME/.local/share/applications/. - reviewer and test linux Versions one more link to same. - Now available new updated version in AUR4 lsdskAUR. Link to forum forum. - I'm an idiot moments - nice and cool - Compare VOIP - Future project: Live CD + auto-configuration of pulseaudio + detect user-names in Windows C:\users\folder and create them in Linux by using C:\users\user_nameas a home path. - Just some links from Talk:Securely_wipe_disk Fix for MPEG: No audio stream found -> no sound. - A4 = 210x297 mm - command line for sane scanimage -x 120 -y 210 --resolution 300 --mode Color --format=tiff >image2.tiff - Sakis3g and QT bug fix: export QT_X11_NO_MITSHM=1before X start URL extraction new version 2gisAUR $ curl "" | awk -Fzip '{if(match($0,"2GISShell") != 0){AA=substr($2,index($2,"http"));if(match(AA,"http") != 0)print AA"zip"}}' Convert media scripts My scripts for conversion of media files m4a to ogg m4a_to_ogg.sh #!/bin/bash for I in "$HOME"/Media/Music/*.m4a;do PP=${I##*/}; if [ -d "$HOME/Media/Music/OGG" ]; then #### ffmpeg -i "$I" -acodec vorbis -strict -2 -ac 2 "$HOME/Media/Music/OGG/${PP/.m4a/.ogg}" ; #### IR=$(du "$HOME/Media/Music/OGG/${PP/.m4a/.ogg}" | awk '{print $1}') if [ "$IR" != "0" ]; then if [ -d "$HOME/Media/Music/Converted" ]; then mv -vi "$I" "$HOME/Media/Music/Converted"; else echo The '"$HOME/Media/Music/Converted"' folder is missing break fi else echo Something gone wrong size of converted "$PP" file is 0 break; fi; else echo Path doesn"'"t exist: '"$HOME/Media/Music/OGG/"' break fi done Auto-gen configuration files Perfect to use them on a Live CD Conky All moved to github HDDTemp Moved to github TMP for before deletion . ************************************************ ****. Restore original file names by using backup file with checksums and comparing with List only unique files by checksum generated file. awk -F"|" -v W="$(cat compmd5_new.tmp)" '//{split(W,Z," "); for(i in Z)if(index(i/2,".") != 0){if(Z[i] == $4){F=Z[i+1];gsub(/[^\/*]*\//,"",F); print $1"|"$2"|"$3"|"F};}}' compmd5_1.tmp This is the same as above but will also handle filenames with spaces correctly awk -F"|" -v W="$(cat compmd5_new.tmp|awk '{print "|"$1"|"substr($0,index($0," "))}')" '//{split(W,Z,"|");for(i in Z)if(index(i/2,".") == 0){if(Z[i] == $4){F=Z[i+1];gsub(/[^\/*]*\//,"",F);print $1"|"$2"|"$3"|"F};}}' checksums.list | grep -v ^$ Link to forum where I was looking for help: linuxforum Populate array by image extensions, may be not work correctly if some part of extension exist in the list, e.g. h extension will be found in html. RR="jpg gif"; QQ=($(awk -F'|' -v KK="$RR" '{SS=$3;gsub(/[^*\.]*\./,"",SS);if ( index(KK,SS) != 0 ) print $3}' checksums.list)) for (( i=0;i <= ${#QQ[@]};i++ ));do if [ ! -z ${QQ[i]} ];then echo ${QQ[i]};fi;done This will clean up special symbols, sort restored names, add a number to the duplicate names. #!/bin/bash} }' else echo 'Path to file is missing!' fi I will probably rewrite my post_rec_scripts to use checksum file, already sorted file names. With grep and awk commands populate the array This way of populating an array is many times faster as with a while command but has limitations that might cause errors. A common way of populating an array as in this example causes problems due using space between words as a separator and a file names that contains them will not be restored and errors will be shown. A $SearchFor variable is more intuitive to edit then if all patters are in the same line with grep. SearchFor="-e compressed -e archive"; ArrayOfFiles=($(grep -i $SearchFor info-mime-size-db.txt | awk -F'|' '{print $1 }')); Without grep you have to use if inside of gawk command and add patterns. Suitable if file with data is a really a very big and you can chose in which part of string you want search compared to grep that uses a whole string. ArrayOfFiles=($( gawk -F '|' '{if ($3 ~ "image/jpeg" || $3 ~ "image/gif" || $3 ~ "image/png") print $1 }' info-mime-size-db.txt)) You can find out which of recovered files contains spaces in their names and save information about them in a file for future use. $ find . -type f -name "* *" >> filenames-with-spaces.txt $ gawk -F'|' '{if ($1 ~ " ") print $1 }' info-mime-size-db.txt >> filenames-with-spaces.txt Calculate duplicate files with awk Sort out duplicates, tests with any check summer md5sum f*.pdf | awk '// {Count[$1]++;CNames[I++]=$1}END{ for (i in Count) {if( Count[i] > 1 )print Count[i]" "CNames[A++];}}' Note about misc github-wiki - will be home of my python3 scripts. Original name only from photorec recovered path A lot of cuts but no need to use an external program/utility and can be used with loops(while/for): AA='./recup_dir.1/f864563104_wmcloc_kmon-0.1.0.tar.gz'; ZZ=${AA/*\//}; BB="${ZZ/_*/}_"; echo ${ZZ/$BB/} Cuts away generated names by photorec from original, cannot be used with external loops: $ awk -F'|' '{AA=$1;sub(/^.*\//,"",AA);if ( AA ~ "_") {BB=index(AA,"_")+1; print substr(AA,BB )} }' info-mime-size-db.txt All in one Used folder and files auto create test ground section for aa.txt in the example below. By using IFS bash script special standard variable to change separator it is possible fill in an array with strings that contains spaces. Works perfect, will create test pattern ./recup_dir.1010/f872681448_wmavgload-0.6.1.tar.gz | OName= wmavgload-0.6.1.tar.gz | ./recup_dir.1010/f872688972.txt| FName= f872688972.txt | Full path with filename|Destination name, cut to orig if exist in it| In array it will use step by two with | as a separator, e.g. IFS="|" C="0"; A=ArrayItem[C] B=ArrayItem[C+1] C=$((C+2)) #!/bin/bash awk -F'|' '//{AA=$1; sub(/^.*\//,"",AA); BB=AA; if ( AA ~ "_") { GUline=index(AA,"_")+1; OName=substr(AA,GUline ); print $1 " | OName= " OName " |" } else {SIName=index(AA," "); if (SIName) { SWName=AA; print $1 "| SWName= " SWName " |" } print $1 "| FName= " BB " |" }; }' info-mime-size-db.txt - Can cut path to show only base filename. - Can cut generated name by photorec from original. - If generated filename doesn't contain original as part of it then output generated into array. - Can fill in array with strings that contain spaces by setting up and use a new separator with help of IFS special bash variable. See also: internal bash variables. Base name only Example base name only: $ awk -F'|' '{print $1}' info-mime-size-db.txt | sed 's/[^*/]*\///g' With printf will show errors like not enough arguments to satisfy format string if variable contains some of symbols that it uses as expressions e.g %: $ awk -F'|' '{AA=$1;sub(/^.*\//,"",AA);printf AA "\n"}' info-mime-size-db.txt With $ awk -F'|' '{AA=$1;sub(/^.*\//,"",AA);print AA }' info-mime-size-db.txt See also: awk manual Two more alternatives to fill in an array with data without using of grep: gawk -F '|' '{if ($1 ~ "bmp" || $1 ~ "zip") print $1 }' info-mime-size-db.txt gawk -F '|' '{AA=index($1,"png");if (AA) print $1 }' info-mime-size-db.txt Simple walk through folders This will copy files from one destination to another, based on the name or the file extension, it doesn't use or do checks for any other information about files as e.g. a mime-type or a pre-made file with the descriptions. You can modify the script depends on what kind of files you will need. This script is slow because is must go through each folder and search for files. You can download the example script «search-folder-by-folder.sh» from the SourceForge. Config Alsa Note - ALSA advanced settings linuxSoundALSA Make install - preparation automoc4 (req. for kde lang compile) libtoolize --force aclocal autoheader automake --force-missing --add-missing autoconf ./configure make # make install One more make example for installation export LIBS=-lXext ./configure --prefix=/usr --x-libraries=/usr/lib # make make prefix="$pkgdir/usr" "libexecdir=$pkgdir/usr/bin" install # make all-recursive See also xmkmf imake cmake List installed from custom or official repositories RepoName="custom" List all installed that are not in custom repository $ pacman -Ss | grep -i 'installed' | grep '/' | grep -v -e ^"$RepoName" -e ^' ' | awk -F'[// ]' '{print $2}' List all that are in custom repository $ pacman -Ss | grep -i 'installed' | grep '/' | grep "$RepoName" | grep -v ^' ' | awk -F'[/\/ ]' '{print $2}' repair purposes, but some of them can have place for the addition storage that can be connected to them such as Secure Digital SD cards where can be stored only initial "factory" ISO and optionally also the internal storage device back up image. Virtual Box The information about path to harddisks and the snapshots is stored between <HardDisks> .... </HardDisks> tags in the file with the .vbox extension. You can edit them manually or use this script where you will need only change the path or use defaults, assumed that .vbox is in the same directory. It will print out new configuration to stdout. #!/bin/bash NewPath="${PWD}/" Snapshots="${NewPath}/" Filename="$1" awk -v SetPath="$NewPath" -v SnapPath="$Snapshots" '{if(index($0,"vdi") != 0){A=$3;split(A,B,"="); L=B[2]; gsub(/\"/,"",L); sub(/^.*\//,"",L); sub(/^.*\\/,"",L); if(index($3,"{") != 0){SnapS=SnapPath}else{SnapS=""}; print $1" "$2" location=\""SetPath SnapS L"\" "$4" "$5} else print $0}' $Filename Thanks To Trible for showing some of advanced awk functionality, find duplicate x/y in a text file. awk -F '|' '// { Count[$3 "|" $5]++; } END { for (i in Count) { printf "%s|%s\n", i, Count[i]; }}' /path/to/file To gregm for help about how to count a duplicate strings in an array due population of it in a python script. To dugan about how to search integer duplicates in an array and information about using of a default fill in array without actually predefining it with a data. from collections import defaultdict DD = defaultdict(int) To Alad for info about a bash spell check. I really needed it. To 蔡依林 for the unbelievable Great voice and always the best performance ever! Crash > test > Ouch > solution > if empty > Wiki
https://wiki.archlinux.org/title/User:Andy_Crowd
CC-MAIN-2021-43
en
refinedweb
How-to: Use virtual actors in Dapr The Dapr actor runtime provides support for virtual actors through following capabilities: Actor method invocation You can interact with Dapr to invoke the actor method by calling HTTP/gRPC endpoint. POST/GET/PUT/DELETE<actorType>/<actorId>/method/<method> You can provide any data for the actor method in the request body and the response for the request is in response body which is data from actor method call. Refer api spec for more details. Alternatively, you can use the Dapr SDK in .NET, Java, or Python. Actor state management Actors can save state reliably using state management capability. You can interact with Dapr through HTTP/gRPC endpoints for state management. To use actors, your state store must support multi-item transactions. This means your state store component must implement the TransactionalStore interface. The list of components that support transactions/actors can be found here: supported state stores. Only a single state store component can be used as the statestore for all actors. Actor timers and reminders Actors can schedule periodic work on themselves by registering either timers or reminders. The functionality of timers and reminders is very similar. The main difference is that Dapr actor runtime is not retaining any information about timers after deactivation, while persisting the information about reminders using Dapr actor state provider. This distintcion allows users to trade off between light-weight but stateless timers vs. more resource-demanding but stateful reminders. The scheduling configuration of timers and reminders is identical, as summarized below: dueTime is an optional parameter that sets time at which or time interval before the callback is invoked for the first time. If dueTime is omitted, the callback is invoked immediately after timer/reminder registration. Supported formats: - RFC3339 date format, e.g. 2020-10-02T15:00:00Z - time.Duration format, e.g. 2h30m - ISO 8601 duration format, e.g. PT2H30M period is an optional parameter that sets time interval between two consecutive callback invocations. When specified in ISO 8601-1 duration format, you can also configure the number of repetition in order to limit the total number of callback invocations. If period is omitted, the callback will be invoked only once. Supported formats: - time.Duration format, e.g. 2h30m - ISO 8601 duration format, e.g. PT2H30M, R5/PT1M30S ttl is an optional parameter that sets time at which or time interval after which the timer/reminder will be expired and deleted. If ttl is omitted, no restrictions are applied. Supported formats: - RFC3339 date format, e.g. 2020-10-02T15:00:00Z - time.Duration format, e.g. 2h30m - ISO 8601 duration format. Example: PT2H30M The actor runtime validates correctess of the scheduling configuration and returns error on invalid input. When you specify both the number of repetitions in period as well as ttl, the timer/reminder will be stopped when either condition is met. Actor timers You can register a callback on actor to be executed based on a timer. The Dapr actor runtime ensures that the callback methods respect the turn-based concurrency guarantees. This means that no other actor methods or timer/reminder callbacks will be in progress until this callback completes execution. The Dapr actor runtime saves changes made to the actor’s state when the callback finishes. If an error occurs in saving the state, that actor object is deactivated and a new instance will be activated. All timers are stopped when the actor is deactivated as part of garbage collection. No timer callbacks are invoked after that. Also, the Dapr actor runtime does not retain any information about the timers that were running before deactivation. It is up to the actor to register any timers that it needs when it is reactivated in the future. You can create a timer for an actor by calling the HTTP/gRPC request to Dapr as shown below, or via Dapr SDK. POST/PUT<actorType>/<actorId>/timers/<name> Examples The timer parameters are specified in the request body. The following request body configures a timer with a dueTime of 9 seconds and a period of 3 seconds. This means it will first fire after 9 seconds, then every 3 seconds after that. { "dueTime":"0h0m9s0ms", "period":"0h0m3s0ms" } The following request body configures a timer with a period of 3 seconds (in ISO 8601 duration format). It also limits the number of invocations to 10. This means it will fire 10 times: first, immediately after registration, then every 3 seconds after that. { "period":"R10/PT3S", } The following request body configures a timer with a period of 3 seconds (in ISO 8601 duration format) and a ttl of 20 seconds. This means it fires immediately after registration, then every 3 seconds after that for the duration of 20 seconds. { "period":"PT3S", "ttl":"20s" } The following request body configures a timer with a dueTime of 10 seconds, a period of 3 seconds, and a ttl of 10 seconds. It also limits the number of invocations to 4. This means it will first fire after 10 seconds, then every 3 seconds after that for the duration of 10 seconds, but no more than 4 times in total. { "dueTime":"10s", "period":"R4/PT3S", "ttl":"10s" } You can remove the actor timer by calling DELETE<actorType>/<actorId>/timers/<name> Refer api spec for more details. Actor reminders Reminders are a mechanism to trigger persistent callbacks on an actor at specified times. Their functionality is similar to timers. But unlike timers, reminders are triggered under all circumstances until the actor explicitly unregisters them or the actor is explicitly deleted or the number in invocations is exhausted. Specifically, reminders are triggered across actor deactivations and failovers because the Dapr actor runtime persists the information about the actors’ reminders using Dapr actor state provider. You can create a persistent reminder for an actor by calling the HTTP/gRPC request to Dapr as shown below, or via Dapr SDK. POST/PUT<actorType>/<actorId>/reminders/<name> The request structure for reminders is identical to those of actors. Please refer to the actor timers examples. Retrieve actor reminder You can retrieve the actor reminder by calling GET<actorType>/<actorId>/reminders/<name> Remove the actor reminder You can remove the actor reminder by calling DELETE<actorType>/<actorId>/reminders/<name> Refer api spec for more details. Actor runtime configuration You can configure the Dapr actor runtime configuration to modify the default runtime behavior. Configuration parameters actorIdleTimeout- The timeout before deactivating an idle actor. Checks for timeouts occur every actorScanIntervalinterval. Default: 60 minutes actorScanInterval- The duration which specifies how often to scan for actors to deactivate idle actors. Actors that have been idle longer than actor_idle_timeout will be deactivated. Default: 30 seconds drainOngoingCallTimeout- The duration when in the process of draining rebalanced actors. This specifies the timeout for the current active actor method to finish. If there is no current actor method call, this is ignored. Default: 60 seconds drainRebalancedActors- If true, Dapr will wait for drainOngoingCallTimeoutduration to allow a current actor call to complete before trying to deactivate an actor. Default: true reentrancy(ActorReentrancyConfig) - Configure the reentrancy behavior for an actor. If not provided, reentrancy is diabled. Default: disabled Default: 0 remindersStoragePartitions- Configure the number of partitions for actor’s reminders. If not provided, all reminders are saved as a single record in actor’s state store. Default: 0 //DrainOngoingCallTimeout(Duration.ofSeconds(60)); ActorRuntime.getInstance().getConfig().setDrainBalancedActors(true); ActorRuntime.getInstance().getConfig().setActorReentrancyConfig(false, null);.DrainOngoingCallTimeout = TimeSpan.FromSeconds(60); options.DrainRebalancedActors = true; options.RemindersStoragePartitions = 7; // reentrancy not implemented in the .NET SDK at this time }); // Register additional services for use with actors services.AddSingleton<BankService>(); } See the .NET SDK documentation. from datetime import timedelta from dapr.actor.runtime.config import ActorRuntimeConfig, ActorReentrancyConfig ActorRuntime.set_actor_config( ActorRuntimeConfig( actor_idle_timeout=timedelta(hours=1), actor_scan_interval=timedelta(seconds=30), drain_ongoing_call_timeout=timedelta(minutes=1), drain_rebalanced_actors=True, reentrancy=ActorReentrancyConfig(enabled=False), remindersStoragePartitions=7 ) ) Refer to the documentation and examples of the Dapr SDKs for more details. Partitioning reminders Preview featureActor reminders partitioning is currently in preview. Use this feature if you are runnining into issues due to a high number of reminders registered. Actor reminders are persisted and continue to be triggered after sidecar restarts. Prior to Dapr runtime version 1.3, reminders were persisted on a single record in the actor state store: Applications that register many reminders can experience the following issues: - Low throughput on reminders registration and deregistration - Limit on total number of reminders registered based on the single record size limit on the state store Since version 1.3, applications can now enable partitioning of actor reminders in the state store. As data is distributed in multiple keys in the state store. First, there is a metadata record in actors\|\|<actor type>\|\|metadata that is used to store persisted configuration for a given actor type. Then, there are multiple records that stores subsets of the reminders for the same actor type. If the number of partitions is not enough, it can be changed and Dapr’s sidecar will automatically redistribute the reminders’s set. Enabling actor reminders partitioning Actor reminders partitioning is currently in preview, so enabling it is a two step process. Preview feature configuration Before using reminders partitioning, actor type metadata must be enabled in Dapr. For more information on preview configurations, see the full guide on opting into preview features in Dapr. Below is an example of the configuration: apiVersion: dapr.io/v1alpha1 kind: Configuration metadata: name: myconfig spec: features: - name: Actor.TypeMetadata enabled: true Actor runtime configuration Once actor type metadata is enabled as an opt-in preview feature, the actor runtime must also provide the appropriate configuration to partition actor reminders. This is done by the actor’s endpoint for GET /dapr/config, similar to other actor configuration elements. //.RemindersStoragePartitions = 7; // reentrancy not implemented in the .NET SDK at this time }); // Register additional services for use with actors services.AddSingleton<BankService>(); } See the .NET SDK documentation. from datetime import timedelta ActorRuntime.set_actor_config( ActorRuntimeConfig( actor_idle_timeout=timedelta(hours=1), actor_scan_interval=timedelta(seconds=30), remindersStoragePartitions=7 ) )"` RemindersStoragePartitions int `json:"remindersStoragePartitions,omitempty"` } var daprConfigResponse = daprConfig{ []string{defaultActorType}, actorIdleTimeout, actorScanInterval, drainOngoingCallTimeout, drainRebalancedActors, 7, } func configHandler(w http.ResponseWriter, r *http.Request) { w.Header().Set("Content-Type", "application/json") w.WriteHeader(http.StatusOK) json.NewEncoder(w).Encode(daprConfigResponse) } The following, is an example of a valid configuration for reminder partitioning: { "entities": [ "MyActorType", "AnotherActorType" ], "remindersStoragePartitions": 7 } Handling configuration changes For production scenarios, there are some points to be considered before enabling this feature: - Enabling actor type metadata can only be reverted if the number of partitions remains zero, otherwise the reminders’ set will be reverted to an previous state. - Number of partitions can only be increased and not decreased. This allows Dapr to automatically redistribute the data on a rolling restart where one or more partition configurations might be active. Demo Feedback Was this page helpful? Glad to hear it! Please tell us how we can improve. Sorry to hear that. Please tell us how we can improve.
https://docs.dapr.io/developing-applications/building-blocks/actors/howto-actors
CC-MAIN-2021-43
en
refinedweb
huex alternatives and similar packages Based on the "Miscellaneous" category. Alternatively, view huex alternatives based on common mentions on social networks and blogs. AtomVM9.5 8.0 huex VS AtomVMTiny Erlang VM porcelain9.4 0.1 huex VS porcelainWork with external processes like a boss ex_rated8.5 3.0 huex VS ex_ratedExRated, the Elixir OTP GenServer with the naughty name that allows you to rate-limit calls to any service that requires it. hammer8.5 0.0 huex VS hammerAn Elixir rate-limiter with pluggable backends Apex8.1 0.0 huex VS ApexAwesome printing for Elixir ex_phone_number7.9 4.8 huex VS ex_phone_numberElixir port of libphonenumber Countries7.7 2.8 huex VS CountriesCollection of Country Information for Elixir. ex2ms7.4 3.2 huex VS ex2ms:ets.fun2ms for Elixir, translate functions to match specifications codec-beam7.2 0.6 huex VS codec-beamGenerate Erlang VM byte code from Haskell ecto_autoslug_field7.1 3.8 huex VS ecto_autoslug_fieldAutomatically create slugs for Ecto schemas. exsync7.0 1.2 huex VS exsyncYet another elixir reloader. phone6.9 4.2 huex VS phoneElixir phone number parser for numbers in international standard. funnel6.5 0.0 huex VS funnelStreaming Elixir API built upon ElasticSearch's percolation. elixir-browser6.2 0.0 huex VS elixir-browserBrowser detection for Elixir exquisite6.1 0.0 huex VS exquisiteLINQ-like match_spec generation for Elixir. std_json_io5.8 0.0 huex VS std_json_ioA simple library for Elixir that provides json over STDIO pact5.8 0.0 huex VS pactBetter dependency injection in Elixir exldap5.7 1.3 huex VS exldapA module for working with LDAP from Elixir molasses5.4 0.0 huex VS molassesFeature toggle library for elixir bupe5.3 0.0 huex VS bupeBUPE is a Elixir ePub generator and parser (supports EPUB v3) reprise5.1 0.0 huex VS repriseSimplified module reloader for Elixir exprint4.9 0.0 huex VS exprintA printf / sprintf library for Elixir. It works as a wrapper for :io.format. gen_task4.9 0.0 huex VS gen_taskGeneric Task behavior that helps encapsulate errors and recover from them in classic GenStage workers. countriex4.5 0.0 huex VS countriexAll sorts of useful information about every country. A pure elixir port of the ruby Countries gem erlang_term4.4 0.0 huex VS erlang_termErlang Term Info address_us4.3 1.3 huex VS address_usUS Address Parsing for Elixir. expyplot3.8 0.0 huex VS expyplotMatplotlib for Elixir Jisho-Elixir3.5 0.0 huex VS Jisho-ElixirA Japanese dictionary API; a wrapper around Jisho's API () ratx3.4 0.0 huex VS ratxRate limiter and overload protection for erlang application expool3.4 0.0 huex VS expoolExtremely simple Process pooling and task submission in Elixir vessel3.3 0.0 huex VS vesselElixir MapReduce interfaces with Hadoop Streaming integration dye3.0 0.0 huex VS dyeDyeing your terminal! egaugex2.8 0.0 huex VS egaugexA simple egauge parser to retrieve and parse data from egauge devices presentex2.5 0.0 huex VS presentexElixir -> HTML/JavaScript based presentation framework intended for showing Elixir code ratekeeper2.3 0.0 huex VS ratekeeperRatekeeper is a library for scheduling rate-limited actions. mixgraph2.1 0.0 huex VS mixgraphAn interactive dependency plotter for your Hex Package mixstar2.1 0.0 huex VS mixstarElixir Mix task to starring GitHub repository with `mix deps.get`ting dependent library exlibris1.8 0.0 huex VS exlibrisA collection of random library functions. gimei_ex1.8 0.0 huex VS gimei_exElixir port of gimei library. growl1.6 0.0 huex VS growlSimple wrapper for growl, the notification system for OSX PhoneNumber1.6 0.0 huex VS PhoneNumberPhone number validating for Elixir Ralitobu1.5 0.0 huex VS RalitobuRate Limiter with Token Bucket algorithm (Elixir) netrc1.4 0.0 huex VS netrcReads netrc files implemented in Elixir url_unroller1.3 0.0 huex VS url_unrollerA simple url unroller (un-shortener) in elixir charm1.3 0.0 huex VS charmANSI rainbow for elixir, be a magician spawndir1.3 0.0 huex VS spawndirSpawn processes from the file system. darksky-elixir1.2 0.0 huex VS darksky-elixirDark Sky API wrapper in Elixir. exfcm1.0 0.0 huex VS exfcmExFCM is a simple wrapper around Firebase Cloud Messaging keys1value1.0 0.0 huex VS keys1valueErlang set associative map for key lists onetime0.8 0.0 huex VS onetimeAn onetime key-value store for Elixir Do you think we are missing an alternative of huex or a related project? Popular Comparisons README Huex Elixir client for Philips Hue connected light bulbs. Installation Add Huex as a dependency in your mix.exs file. def deps do [{:huex, "~> 0.8"}] end Also add HTTPoison as part of your applications, in your mix.exs file. def application do [mod: {YourApp, []}, applications: [:httpoison]] end After you are done, run mix deps.get in your shell to fetch and compile Huex. Usage First Connection In order to issue queries and commands to the bridge, we need to request an authorization for a so-called devicetype (see Hue Configuration API) which is a string formatted as such: my-app#my-device. Before requesting the authorization: you must press the link button on your bridge device to start a 30 second window during which you may request an authorization as follow: bridge = Huex.connect("192.168.1.100") |> Huex.authorize("my-app#my-device") # A random username is now set IO.puts bridge.username # YApVhLTwWUTlGJDo... # The bridge connection is now ready for use IO.inspect Huex.info(bridge) # %{"config" => ...} Subsequent Connections Once a devicetype has been authorized with the bridge, there's no need to perform the authorization process again. In other words, you must store the generated username received set by authorize/2. With the username at hand, you can connect right away: bridge = Huex.connect("192.168.1.100", "YApVhLTwWUTlGJDo...") IO.inspect Huex.info(bridge) # %{"config" => ...} Bridge IP address discovery You may use Huex.Discovery.discover/0 to retrieve a list of bridges on your network using SSDP: Huex.Discovery.discover # ["192.168.1.43"] This optional feature depends on nerves_ssdp_client which must be added explicitly to your own application dependencies in mix.exs: def deps do [{:huex, "~> 0.7"}, {:nerves_ssdp_client, "~> 0.1"}] end Queries Query functions return the message received from the bridge API. IO.inspect Huex.info(bridge) # %{"config" => %{"UTC" => "1970-01-01T03:00:40", "dhcp" => true, # "gateway" => "192.168.1.1", "ipaddress" => "192.168.1.100", # ... # "schedules" => %{}} IO.inspect Huex.lights(bridge) # %{"1" => %{"name" => "Lobby"}, "2" => %{"name" => "Living Room"}, # "3" => %{"name" => "Bedroom"}} IO.inspect Huex.light_info(bridge, 1) # %{"modelid" => "LCT001", "name" => "Lobby", # ... # "swversion" => "66009663", "type" => "Extended color light"} Commands Command functions return a Huex.Bridge struct and are thus chainable. bridge |> Huex.turn_off(1) # Turn off light 1 |> Huex.turn_on(2) # Turn on light 2 |> Huex.set_color(2, {10000, 255, 255}) # HSV |> Huex.set_color(2, {0.167, 0.04}) # XY |> Huex.set_color(2, Huex.Color.rgb(1, 0.75, 0.25)) # RGB (see limitations) |> Huex.set_brightness(2, 0.75) # Brightness at 75% Error Handling For error handling, the Huex.Bridge struct has a status attribute which is either set to :ok or :error by command functions. When an error occured, the complete error response is stored in the error attribute of the Huex.Bridge struct. Examples Look into the examples directory for more advanced usage examples. Current Limitations Color space conversion from RGB to XY currently feels a little fishy: I can't seem to get bright green or red using the given formula. To Do - [ ] Reliable color conversion from RGB Contributors In order of appearance: - Xavier Defrang (xavier) - Brandon Hays (tehviking) - Brian Davis (mrbriandavis) - Pete Kazmier (pkazmier) - Derek Kraan (derekkraan) - Arijit Dasgupta (arijitdasgupta) huex README section above are relevant to that project's source code only.
https://elixir.libhunt.com/huex-alternatives
CC-MAIN-2021-43
en
refinedweb
For this problem, to add elements of two given arrays we have some constraints based on which the added value will get changed. the sum of two given arrays a[] & b[] is stored into to third array c[]in such a way that they gave the some of the elements in single digit. and if the number of digits of the sum is greater than 1, then the element of the third array will split into two single-digit elements. For example, if the sum occurs to be 27, the third array with store it as 2,7. Input: a[] = {1, 2, 3, 7, 9, 6} b[] = {34, 11, 4, 7, 8, 7, 6, 99} Output: 3 5 1 3 7 1 4 1 7 1 3 6 9 9 Output array and run a loop from the 0th index of both arrays. For each iteration of the loop, we consider the next elements in both arrays and add them. If the sum is greater than 9, we push the individual digits of the sum to output array else we push the sum itself. Finally, we push the remaining elements of the larger input array to the output array. #include <iostream> #include<bits/stdc++.h> using namespace std; void split(int n, vector<int> &c) { vector<int> temp; while (n) { temp.push_back(n%10); n = n/10; } c.insert(c.end(), temp.rbegin(), temp.rend()); } void addArrays(int a[], int b[], int m, int n) { vector<int> out; int i = 0; while (i < m && i < n) { int sum = a[i] + b[i]; if (sum < 10) { out.push_back(sum); } else { split(sum, out); } i++; } while (i < m) { split(a[i++], out); } while (i < n) { split(b[i++], out); } for (int x : out) cout << x << " "; } int main() { int a[] = {1, 2, 3, 7, 9, 6}; int b[] = {34, 11, 4, 7, 8, 7, 6, 99}; int m =6; int n = 8; addArrays(a, b, m, n); return 0; }
https://www.tutorialspoint.com/add-the-elements-of-given-arrays-with-given-constraints
CC-MAIN-2021-43
en
refinedweb
Poisson - Drift-Diffusion solver (PDD)¶ - Example 1: Example of a simple 2J solar cell calculated with the PDD solver - Example 2: Tutorial: 2J solar cell with QWs in the bottom cell The PDD package provide all tools necesary to build a solar cell structure and calculate its properties by solving simultaneously the Poisson equation and the drfit diffusion equations. Normally, these functions will not need to be accessed directly, but are called internally by Solcore when using the higher level methods in the solar cell solver. For using the PDD package, it is enough to include the following line in your code: import solcore.poisson_drift_diffusion as PDD With this, all the functionality of the package will be available to the user. The actual functions and calculations are spread in several modules: - File: solcore/PDD/DriftDiffusionUtilities.py - Contains the python interface that dumps all the information of the device structure into the fortran variables and that executes the chosen calculation, getting the data from the fortran variables at the end. This module contains the following methods called internally by the solar_cell_solver: - equilibrium_pdd - short_circuit_pdd - iv_pdd - qe_pdd - File: solcore/PDD/DeviceStructure.py - Contains several functions necessary to build a structure that can be read by the PDD solver. The most important of this functions is CreateDeviceStructure that scans the junction layers and extracts from the materials database all the parameters required by the PDD solver. Finally, it contains the default properties that are used if they are not found for a particular material. In general, these default properties correspond to those of GaAs at 293 K. - File: solcore/PDD/QWunit.py - Contains utilities that transform the sequence of layers into a structure that, in turn, can be used to solve the Schrodinger equation and the kp model. It also prepares the properties of the structure (bandedges, efective density of states, etc) in order to have a meaningful set of properties for the DD solver, using the GetEffectiveQW. Drift Diffusion Fortran solver File: solcore/PDD/DDmodel-current.f95 This is the current version of the Fortran code that, once compiled, performs all the heavy numerical calculations. Normally you would not need to care about this file except if you intend to modify the numerical solver itself. ———————
http://docs.solcore.solar/en/master/Solvers/DDsolver.html
CC-MAIN-2021-43
en
refinedweb
TL;DR In this tutorial, we’re going to learn the basics of Nrwl’s tool Nx, as well as how to create a custom workspace CLI schematic. You can see the finished code in this repository. Note: This tutorial assumes some basic knowledge of Angular and the Angular CLI. If you've never touched Angular before, check out our Real World Angular series. Concerns of Enterprise Teams Developing applications on a large enterprise team is different than developing alone or on a small team. While small groups might be able to get away with ad hoc decisions on application structure or coding best practices, the same cannot be said when you’re working with dozens or perhaps hundreds of other people. In addition, enterprise teams need to assume that their code will stick around for many years to come. This means they’ll need to do as much work as possible at the beginning of an application’s development to minimize the cost of maintenance down the road. We can summarize the concerns of enterprise teams like this: - Consistency — how do we make sure everyone in the organization (which may be thousands of people) follows the same best practices for structuring and writing code? - Safety — how do we ensure that our code will not be subject to attacks or prone to errors? - Increased size and complexity — how can we structure our code so that it can grow without sacrificing clarity or performance? - Changing requirements — how can we keep up with the demands of the business to continually update the application without letting technical debt get out of control? While small teams and small organizations share these same concerns to some extent, the risks can be catastrophic at the enterprise scale. To learn more about the problems large teams face, check out Victor Savkin’s excellent ng-conf 2018 talk Angular at Large Organizations. Nx: The Enterprise Toolkit for Angular Nx is a set of tools for the Angular CLI built by the consulting firm Nrwl to help with exactly these issues of consistency, safety, and maintainability. In addition to including a schematic to implement monorepo-style development of applications and libraries, Nx includes a set of libraries, linters, and code generators to help large teams create and enforce best practices across their organizations. "Nx by @nrwl_io is a set of tools to help enterprise @angular devs with consistency, safety, and maintainability." Tweet This Out of the box, Nx contains tools to help with: - State management and NgRx - Data persistence - Code linting and formatting - Migrating from AngularJS to Angular - Analyzing dependencies visually - Creating and running better tests - Creating workspace-specific schematics While we can’t delve into every feature of Nx, we are going to take a look in just a bit at that last one: workspace-specific schematics. Before we do that, though, let’s learn how to get started with Nx. Nx Basics Let’s learn the basics of getting up and running with Nx. We’ll need to know how to install Nx, how to generate a workspace, and how to create applications and libraries. Install Nx We’ll start by installing Nx, which is really just a collection of Angular CLI schematics. You’ll need Node 8.9 or greater and NPM 5.5.1 or greater for this, which you can install from the Node website. First, make sure you have the latest version of the Angular CLI installed globally: npm i -g @angular/cli (Note that npm i -g is just shorthand for npm install --global.) Then, install Nx globally: npm i -g @nrwl/schematics Installing Nx globally is actually only required to create workspaces from scratch from the command line. If you’re unable to install things globally at work, don’t worry. You can add Nx capabilities to an existing CLI project by running this command: ng add @nrwl/schematics Note: You can also use Angular Console instead of the CLI throughout this tutorial if you'd prefer to work with a GUI instead of the command line. Create a Workspace Now that we’ve got Nx installed, we’re ready to create our first workspace. What exactly is a workspace, though? A workspace is an example of a monorepo (short for monorepository) — a repository that holds several related applications and libraries. Let’s imagine we’ve been tasked to create a pet adoption system. Let’s think about some of the different pieces we might need for this: - A front end application for potential adopters to browse through the pets - A front end application for administrators to update available pets and receive inquiries - Shared UI components between the front ends - Shared data access libraries between the front ends - A Node server to serve up the pet and adoption inquiry data While we could keep each of these in a separate repository, it would get messy keeping all of the versions in sync, managing dependencies, and ensuring that all developers working on the project have the correct access they need. Monorepos solve these problems and more. With Nx, a workspace is a monorepo structure for the Angular CLI to keep your applications and libraries organized. After installing Nx globally, we can run this command: create-nx-workspace pet-adoption-system When we run this command with version 7 or later of the CLI and Nx, we'll get two prompted questions. The first is whether we’d like to use a separate name for npm scope, which lets us import internally using a shorthand. For example, we could set the scope to "adoption-suite", which would mean our imports would start with @adoption-suite. We’re not going to do this in this tutorial, so we can just hit enter to leave it as the default, which is pet-adoption-system. The second prompt is whether we’d like to use npm or Yarn for package management. I’ll be using npm in this tutorial, but you’re welcome to use Yarn instead. This will create a new CLI workspace that will look a bit different from what you’re used to. Instead of the usual src folder, you’ll see folders named apps, libs, and tools at the root of the project. You’ll also see some extra files like nx.json to configure Nx, .prettierrc to configure the Prettier formatting extension, and .editorconfig to set some editor presets. Nx does a lot of set-up for you so you can focus on writing code instead of on tooling. Create an Application Let’s create an application in our new workspace and add routing to it. ng generate app adoption-ui --routing Version 7 of Nx adds prompts regarding directory placement, style extension, and choice of unit and end-to-end test runners. This is great because we can now easily set up an application using SCSS, Jest for unit testing, and Cypress for end-to-end testing with zero extra work. In this tutorial, feel free to leave all the prompts at their defaults. We won’t be using them here. Nx’s app schematic is almost identical to the built-in CLI version, but it does have a couple of differences. For example, the routing option we added configures the root NgModule with routing instead of creating a separate module. This has increasingly become best practice in the Angular community to avoid "module pollution," so it’s really nice Nx does this for us by default. After we’ve run the command, we’ll now have an apps/adoption-ui folder with the familiar CLI structure inside of it. Notice that the AppModule is set up with routing and that there is a separate apps/adoption-ui-e2e folder for Protractor. This differs a bit from the regular CLI setup, where the e2e folder is inside of the app folder. Create a Library Libraries are ideal places to house things like UI components or data access services for use in multiple applications. We can add new libs to an Nx Workspace by using the AngularCLI generate command, just like adding a new app. Nx has a schematic named lib that can be used to add a new Angular module lib to our workspace: ng generate lib shared-components We’ll get several prompts at the command line regarding tooling, testing, setup, and routing. Since we’re not actually going to be using this library, the answers to these questions are irrelevant -- go ahead and just accept all of the defaults. However, it’s good to know how easily customizable libs are from the command line, from routing and lazy loading to tooling and setup. Running this command will create a libs/shared-components with its own src folder and config files. We can easily add components to this library by passing a project option to the CLI. Let's take advantage of the g shortcut for generate and the c shortcut component and run the following command: ng g c pet-list --export=true --project=shared-components Since this is a shared library, I’ve added export=true to export the component from the NgModule. Now that we know the basics of Nx, let’s explore one of its lesser known but incredibly powerful features: the ability to create custom workspace schematics. Creating a Custom Auth Schematic You’re actually already familiar with schematics — they’re what the Angular CLI uses to create new components, services, and more when you run the ng generate command. You can also write your own schematics from scratch, whether or not you’re using Nx. The beauty of Nx, though, is that it does all the hard work of wiring up your custom schematics so that it’s easy to run them in your workspace. Custom schematics are frequently used for two broad purposes: - To enforce styles or standards at your organization. - To generate custom code specific to your organization. "Custom @angular CLI schematics are used to enforce styles or standards and to generate custom code." Tweet This We’re going to focus on the former in this tutorial because generating custom code with the schematics API requires some knowledge of the TypeScript abstract syntax tree and is a little out of our scope in this tutorial. Some examples of good ideas for custom schematics that enforce styles or standards are: - Enforcing directory structure or application architecture. - Enforcing patterns for data access like NgRx. Since authentication is a subject dear to our hearts here at Auth0, let’s create a schematic for developers to use when adding an authentication module to their applications. We’d like it to do four things: - Adhere to a naming convention of prefixing "auth-" to the files. - Create an authentication module and import it into the project’s AppModule. - Create an empty service that will hold our authentication code. - Create an empty CanActivateguard that will hold an authentication route guard. We can accomplish all of this in a single schematic that will accept the name of the module and the project we’re adding it to as arguments. This will let our developers working on the pet adoption system quickly add the correct scaffolding to any application they’re building on the project. Let’s get started! Generate the Custom Schematic The first step to creating a custom schematic is to use Nx to generate the initial code. We can do this by running this command: ng g workspace-schematic auth-module (Notice that I've used the g shortcut for generate again.) The workspace-schematic schematic (I know, it’s so meta) creates the auth-module folder inside of tools/schematics. This new folder contains two files: schema.json and index.ts. Update the Schema Schema.json contains metadata for our custom schematic like the options used with it. If we open it, we’ll see this default code: // tools/schematics/auth-module/schema.json { "$schema": "", "id": "auth-module", "type": "object", "properties": { "name": { "type": "string", "description": "Library name", "$default": { "$source": "argv", "index": 0 } } }, "required": ["name"] } By default, we’re able to pass a name property, which is a string, to our schematic. The $default parameter tells us that it will assume that the first argument given to this command is the value for the name property. Feel free to change the description of the name property to something more specific, like, "Auth module name." Let’s also add another property to this file to specify the project to which we’ll add our new authentication module. Underneath the name property, add the following: // tools/schematics/auth-module/schema.json // ...above code remains the same // add under the name property: "project": { "type": "string", "description": "Project to add the auth module to" } // ...below code remains the same Let’s make it required, too, by adding it to the required array. The finished file will look like this: // tools/schematics/auth-module/schema.json { "$schema": "", "id": "auth-module", "type": "object", "properties": { "name": { "type": "string", "description": "Auth module name", "$default": { "$source": "argv", "index": 0 } }, "project": { "type": "string", "description": "Project to add the auth module to" } }, "required": ["name", "project"] } We could add any other options with their types here if we needed them. If you look at schema.json for the official component schematic, for example, you’ll see familiar boolean options like spec and inlineTemplate. Write the Custom Schematic We’re now ready to write the custom schematic implementation. This lives in the generated index.ts file. Let’s open it up and begin to create our auth-module schematic. We’ll see the following code generated by Nx: // tools/schematics/auth-module/index.ts import { chain, externalSchematic, Rule } from '@angular-devkit/schematics'; export default function(schema: any): Rule { return chain([ externalSchematic('@nrwl/schematics', 'lib', { name: schema.name }) ]); } Let’s break down what’s happening here so that we can build off of it. First, we’re importing the chain and externalSchematic functions, as well as the Rule type, from @angular-devkit/schematics. We then use all of those imports in the exported function. What are these things, though? We often say that schematics are like blueprints when you’re building a house. In that analogy, a Rule is a page or section of a blueprint. Rules are the individual pieces of the schematic that tell the CLI how to modify the file system, represented as a Tree in schematics. Trees allow us to mutate the file system with file creations, updates, and deletions. Generally, anything we can do with the file system we can do with the tree. Unlike the file system, though, trees use a transactional structure. No changes are made to the actual file system until the entire schematic runs. If part of the schematic fails, any changes to the file system are rolled back. Rules, then, are functions that take in the current tree and return either a modified tree or another rule. This means that rules are also composable. We can combine rules using the chain function like we’re doing in this example. There are other operators, too, like branchAndMerge and mergeWith. You’ll see these functions throughout the official CLI schematics code. We can also use the externalSchematic function here to refer to an outside schematic and compose its rules onto our custom schematic. In the boilerplate generated by Nx, we start with a rule that simply runs the lib schematic built into Nx, which is in the @nrwl/schematics collection. The heart of the schematic is the exported function: // tools/schematics/auth-module/index.ts export default function(schema: any): Rule { return chain([ externalSchematic('@nrwl/schematics', 'lib', { name: schema.name }) ]); } This function takes in a schema and returns a Rule. The schema should match the structure in schema.json. At the core, all schematics are just functions that return rules that modify the file system. You’ll often see many rules defined in a schematic, as well as helper functions, but in the end, only one function gets exported. This function will have any necessary rules chained, branched, or merged together. The simplest possible custom schematic is one that takes advantage of chaining together existing rules. This is particularly useful at large organizations to enforce best practices and architecture patterns. For example, you may want to ensure that everyone on the team always generates components with inline styles and with an accompanying model as a TypeScript interface. You could easily chain together the component schematic with the interface schematic to make this easy for everyone in the organization to do. We’re going to follow a similar pattern here. We want to make sure that everyone who adds authentication to a project always adds a separate module, a service, and a CanActivate guard. We’ll use our new tools—the chain and externalSchematic functions—to do this. Let’s first replace Nx lib with a call to the module schematic, keeping it inside of the array being passed into the chain function: // tools/schematics/auth-module/index.ts // ...above code remains the same // replace nx lib with this: externalSchematic('@schematics/angular', 'module', { project: schema.project, name: schema.name, routing: true, module: 'app.module.ts' }) Notice that we’re first passing in the collection ( @schematics/angular), followed by the schematic name ( module), followed by an options object. The options object contains values for any options for the external schematic. We’re passing in the project, name, and root module name of app.module.ts. We’re also setting the routing flag to true to add routing to the authentication module. This makes it easy for someone to add routes to the authentication module, such as a callback route or routes for logging in and out. For the calls to the service and guard schematics, we’ll need to import path at the top of our file: // tools/schematics/auth-module/index.ts // ...previous imports import * as path from 'path'; This will let us specify file paths regardless of whether the user is using a Windows or Linux-based operating system. Add the following to the array after the module schematic (don’t forget a comma!): // tools/schematics/auth-module/index.ts // ...above code remains the same externalSchematic('@schematics/angular', 'service', { project: schema.project, name: schema.name, path: path.join( 'apps', schema.project, 'src', 'app', schema.name, 'services' ) }) // ...end of the array and chain function When we run this schematic, it will generate our service inside of apps/{project}/src/app/{schema}/services. You could easily change this to a different structure if you’d like. Do you notice how easy these schematics make standardizing and enforcing code organization? Our last call is to the guard schematic and it’s almost identical. Add this after the service schematic (and, again, don’t forget the comma!): // tools/schematics/auth-module/index.ts // ...above code remains the same externalSchematic('@schematics/angular', 'guard', { project: schema.project, name: schema.name, path: path.join( 'apps', schema.project, 'src', 'app', schema.name, 'services' ) }) // ...end of the array and chain function This will generate a guard in the same place as the authentication service. Our schematic is nearly finished now. It will create a module, service, and guard with the name we give it and for the project we specify. Let’s add one final touch: let’s throw an error if the user doesn’t prefix their new authentication module with auth-. To do this, we can add the following if statement inside of our function on line 5, just before we return our chain of rules: // tools/schematics/auth-module/index.ts // ...above code remains the same // add above the returned chain function: if (!schema.name.startsWith('auth-')) { throw new Error(`Auth modules must be prefixed with 'auth-'`); } // ...below code remains the same We’ll now see an error if we don’t adhere to the naming guidelines. Neat! The finished code for our custom schematic looks like this: import { chain, externalSchematic, Rule } from '@angular-devkit/schematics'; import * as path from 'path'; export default function(schema: any): Rule { if (!schema.name.startsWith('auth-')) { throw new Error(`Auth modules must be prefixed with 'auth-'`); } return chain([ externalSchematic('@schematics/angular', 'module', { project: schema.project, name: schema.name, routing: true, module: 'app.module.ts' }), externalSchematic('@schematics/angular', 'service', { project: schema.project, name: schema.name, path: path.join( 'apps', schema.project, 'src', 'app', schema.name, 'services' ) }), externalSchematic('@schematics/angular', 'guard', { project: schema.project, name: schema.name, path: path.join( 'apps', schema.project, 'src', 'app', schema.name, 'services' ) }) ]); } Remember that we’re only generating the scaffolding of our authentication setup with this schematic. To learn how to properly implement authentication in your service and guard, check out our Angular authentication tutorial. We’ve also got an NgRx authentication tutorial for you if you’re taking advantage of NgRx in your project. To use either of these tutorials to set up Auth0 in your application, first sign up for a free Auth0 account here. Run the Custom Schematic Now that we’ve got the schematic written, let’s test it out. Nx already did the work of wiring it up to be used in our workspace, so we don’t need to worry about that. To run our new auth-module schematic, run the following command: npm run workspace-schematic -- auth-module auth-adoption --project=adoption-ui This command runs the workspace-schematic script that’s part of Nx. We use the -- operator to pass options into that script like the names of the module and project. (If you’re using Yarn, you can ditch the -- operator and run yarn workspace-schematic auth-module with the rest of the options.) Once the schematic runs, we’ll see the resulting files inside of the src folder of the adoption-ui application. Our auth-adoption module and its routing module will be there, as well as the services folder containing the auth-adoption service and route guard. Don’t forget to also test out our naming requirement. Try to run the command again but without the auth- prefix. You should see Auth modules must be prefixed with 'auth-' as an error in your console. You’ll also see an error if you fail to specify the project name. All of the finished code can be found in this repository. Conclusion Our custom authentication schematic accomplishes a lot with under 50 lines of code: - It automatically scaffolds an authentication module, service, and route guard. - It enforces both an architecture standard and a naming standard. - It can easily be reused by developers for future products. Since writing custom schematics for the first time can be a bit of a challenge, it helps to have Nx do a lot of the heavy lifting. That’s really what Nx does best: automating and simplifying Angular development at scale. To learn more about custom schematics, check out the introduction on the Angular blog, this great tutorial on Generating Custom Code by Manfred Steyer, and this presentation on custom schematics by Brian Love. And, of course, the best place to see examples of custom schematics is the source code for the Angular schematics. We’ve really only scratched the surface of what Nx can do. To learn more about Nx, including features like the visual dependency graph, dependency constraints, and the ability to run only affected tests, check out the official Nx documentation, the nx-examples repo, and this free video course on Nx by Justin Schwartzenberger. Special thanks to Jason Jean from Nrwl for doing some pair programming with me to answer my questions about Nx and custom schematics. Thanks, Jason!
https://auth0.com/blog/create-custom-schematics-with-nx/
CC-MAIN-2021-43
en
refinedweb
Subject: Re: [boost] [config/multiprecision/units/general] Do we have a policy for user-defined-literals? From: Peter Sommerlad (peter.sommerlad_at_[hidden]) Date: 2013-05-06 06:06:55 Hi, Vicente made me aware of that post. Since I am guilty, I'd like to answer. First of all, John Maddock is right in almost everything... my fault. However, let me defend what's there and confess what shouldn't be there. As John wrote: > I've been experimenting with the new C++11 feature "user-defined-literals", and they're pretty impressive ;-) that's how I started as well.... 1. using the parsing version for chrono literals is bullshit, John is right. The standard proposal I submitted does only define the regular numeric literal operators: operator"" h(unsigned long long) and operator"" h(long double), etc. 2. one can use the template version of operator"" for two things: * parsing integer values in non-standard bases, i.e., ternary * determining the best fitting type for integral values like the compiler does for integers, this can not be done through the cooked version, because it requires a template parameter for the meta function. 2.a the latter is a reason where it can make sense for a concrete chrono implementation to use the parsing version for the suffixes, since it depends on the implementation which integral range is useful/used for representing the duration (at least in the standard version), where it is open which integral type is used for the representation (i.e. at least 23 bits for hours). But that is really only interesting when you actually use that many hours. 3. the parsing can be "simplified" with using a more complex expression like John proposes, instead of the monstrous template dispatching I implemented. I haven't tested which is faster for which compiler yet and unfortunately doesn't have the time to do so soon. John's version is definitely shorter than the many overloads but requires an additional template parameter, so it is not a direct replacement to my coded version. However, this way it avoids the pow multiplications. (see also inline below). So thank you for teaching me something. Regards Peter. On 28.04.2013, at 10:12, John Maddock <john_at_[hidden]> wrote: >>. > > I hadn't seen that before, thanks for the heads up. > > If we have UDL utilities in boost then I agree they should have their own top-level namespace in Boost, whether it makes sense to group all literals in there is another matter. My gut feeling is that users will find boost::mylib::literals or boost::mylib::suffixes easier, but I can see how it would make sense for the std to go your way. > > BTW, I believe your implementation of parse_int is unnessarily complex, looks like that whole file can be reduced to just: > > template <unsigned base, unsigned long long val, char... Digits> > struct parse_int > { > // The default specialization is also the termination condition: > // it gets invoked only when sizeof...Digits == 0. > static_assert(base<=16u,"only support up to hexadecimal"); > static constexpr unsigned long long value{ val }; > }; > > template <unsigned base, unsigned long long val, char c, char... Digits> > struct parse_int<base, val, c, Digits...> > { > static constexpr unsigned long long char_value = (c >= '0' && c <= '9') > ? c - '0' > : (c >= 'a' && c <= 'f') > ? c - 'a' > : (c >= 'A' && c <= 'F') > ? c - 'A' > : 400u; > static_assert(char_value < base, "Encountered a digit out of range"); > static constexpr unsigned long long value{ parse_int<base, val * base + char_value, Digits...>::value }; > }; > > Typical usage is: > > template <char...PACK> > constexpr unsigned long long operator "" _b() > { > return parse_int<2, 0, PACK...>::value; > } > > constexpr unsigned bt = 1001_b; > > static_assert(bt == 9, ""); > > More than that though: I can't help but feel that base 8, 10 and 16 parsing is much better (faster) handled by the compiler, so parse_int could be reduced to base-2 parsing only which would simplify it still further. The latter will be standardized to be 0b101010 in C++14. So not many useful things remain, unless you want ternary literals :-) > What's the rationale for the chrono integer literals parsing the ints themselves rather than using cooked literals? none. It was a ridiculous experiment by me and I forgot to adapt it back again to the cooked version. > > Cheers, John. > > _______________________________________________ > Unsubscribe & other changes: -- Prof. Peter Sommerlad Institut für Software: Bessere Software - Einfach, Schneller! HSR Hochschule für Technik Rapperswil Oberseestr 10, Postfach 1475, CH-8640 Rapperswil tel:+41 55 222 49 84 == mobile:+41 79 432 23 32 fax:+41 55 222 46 29 == mailto:peter.sommerlad_at_[hidden] Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2013/05/203446.php
CC-MAIN-2021-43
en
refinedweb
Below are the details of changes made for Igor Pro 6.1 since the last revision of Igor Pro 6.0. System Requirements On Macintosh, Igor Pro 6.1 requires Mac OS X 10.4 or later and runs natively on both PowerPC and Intel-based Macintoshes. On Windows, Igor Pro 6.1 runs under Windows XP, Windows Vista and Windows 7. Version Compatibility Igor Pro 6.1 can read files created by all earlier versions of Igor. If you don't use features new in Igor Pro 6.1, then experiment files that it writes are readable by earlier versions. Once you use features added in Igor Pro 6.1. On Macintosh, the Igor 6.1 switch from PICT to PDF can result in missing graphics when changed notebooks are viewed with Igor 6.0 or earlier. See Notebook Improvements 6.1 for more information. Some obsolete features of earlier versions of Igor Pro are no longer supported. See Features Removed From Igor Pro 6.1 . Some behaviors have changed slightly in Igor Pro 6. These changes may affect some existing Igor experiments. See Behavior Changes In Igor Pro 6.1 for details. Features Removed From Igor Pro 6.1 Macintosh: The obsolete PostScript PICT export format has been removed.. Guide To Igor Pro 6.1 Improvements Here are the Igor Pro 6.1 improvements discussed on this page. Long File Names on Macintosh Graphics Export Improvements Procedure Window Improvements Control Panel Improvements Curve Fitting Improvements Image Processing Improvements Data Import And Export Improvements File Command Improvements Miscellaneous Improvements New And Improved Example Experiments New And Improved WaveMetrics Procedure Files New Graphics The principal change in 6.1 is the use of more modern graphics code for drawing graphs, tables and page layouts. On Macintosh this involves the radical change of using Apple's Quartz routines rather than the ancient QuickDraw routines . On Windows just slightly more advanced code is used with a small amount of GDI+ instead of GDI . On Macintosh, the new code does not support exporting graphics in Apple's old PICT format. If you need to export as PICT, you can make Igor use the old graphics code by executing this: SetIgorOption UseOldGraphics=1 When this command is executed, all graphs and page layout windows are redrawn using the old code. You can also turn the old graphics code on if you have a problem with the new code. In this case, please let us know why you needed to do that so we can address the problem. New features related to the new graphics code: Draw text, Draw Pictures and TextBox, Tag and Legend annotations can now be rotated at arbitrary angles. Note: The rotation point for TextBox, Tag and Legend annotations is set by the equivalent anchor point at the nearest multiple of 90 degrees. Contour labels automatically use arbitrary rotation. Dashed line drawing is improved. Fill patterns as used by draw tools and graph fill modes can use a transparent background to support overlap of different patterns. See Drawing Improvements 6.1 and Graphing Improvements 6.1. There are 12 additional marker types and you can define your own markers. See Graphing Improvements 6.1. Macintosh only changes: Text and line drawing is antialiased. PDF is now the native picture format and replaces the obsolete QuickDraw PICT format. PDF pictures can be imported from files (using Misc→Pictures) or from the clipboard (using Edit→Paste) and can be placed in graphs, page layouts and formatted notebooks. EPS pictures placed in graphs and layouts are auto-converted to PDF on the fly and consequently can be used without a postscript printer and are rendered on the screen in high resolution with no need for a preview portion. The transparency of imported PNG or TIFF pictures is honored except for Igor PDF and EPS export formats. Long File Names on Macintosh Igor Pro now supports long file names (up to 255 characters) on Macintosh as well as Windows. Previously it was limited to 31-character file names on Macintosh. Most WaveMetrics XOPs now also support long file names on Macintosh. The following Igor Pro features will not work with long file names on Mac OS X because Igor calls Apple routines that do not support long file names for these features: - FTPDownload - NewMovie - ImageSave when using QuickTime - ImageLoad when using QuickTime. User Interface Changes Changing a global variable using a control now marks the experiment as being modified. Checking the Auto-compile menu also compiles the procedures immediately. On Macintosh, the preference setting for cmd-H (Miscellaneous Settings dialog, Text Editing Settings Category) has been changed. When unchecked, cmd-E becomes "Enter Selection for Find" which is standard on OS X. Also, the find string is placed on the global find pasteboard and read from it on activate. Consequently, the Windows→Send Behind and Windows→Bring to Front are now ctrl-cmd-E and shift-ctrl-cmd-E. The Edit→Insert Text menu item is now Edit→Insert File. This change was made because you can now insert the contents of a picture file into a formatted text notebook. Igor now also loads extensions, procedures, and help files from a new "Igor Pro User Files" folder, whose location guarantees write access by the user even if they don't have administrator privileges: You can change this location using the Miscellaneous Settings dialog. The Igor Pro 6 User Files folder and the standard Igor Pro Folder can be shown in the Finder/Windows Explorer by selecting new items in Igor's Help Menu. Tip: Holding down the shift key changes one Help menu item so that both folders are opened at the same time, making it easy to drag shortcuts/aliases from the Igor Pro Folder hierarchy into the appropriate User Files folders: Igor Extensions, Igor Help, Igor Procedures, and User Procedures. For further discussion of Igor Pro User Files, see Special Folders.. Added a server-friendly license activation option so that multi-user license holders don't need to enter the license activation on every computer. You need administrator privileges to install a "server license". Graph axis mouse wheel support: Vertical wheel expands or contracts the axis range about the mouse location. Press option with the mouse near an axis end to scale that end. Horizontal wheel shifts range up or down and does not depend on mouse position. Both horizontal and vertical work by 20% increments. On Windows, horizontal wheel support requires Vista. Added mouse wheel support for cursor info panel. Hover over mover area to adjust point index. Hover over name area to switch between traces; hold option (alt) to switch both cursors between traces. Change in behavior: Option (alt) drag in a graph now offsets only those axes that overlap with the (original) mouse location. In order to improve speed and responsiveness when editing large control panels, various optimizations have been done involving the use of the tool palette. These involve redrawing only those items that need updating. If you discover any redraw problems such as droppings left behind as an object is dragged around, please let us know how to reproduce it. Macintosh only: When in New Graphics mode, export modes that previously used QuickDraw PICT format now use PDF instead and the names used in the mode popup menu of the export and save graphics dialog have been changed to match. LoRes PDF replaces PICT, Quartz PDF replaces HiRes PICT and Igor PDF replaces PDF. Note that LoRes PDF is not of much use and just fills the spot that PICT used to occupy. In general, as long as your destination program supports PDF, you should always export as Quartz PDF. (However, if you have a publisher that insists on CMYK, you will need to use Igor PDF.) Macintosh only: In any text document, right-clicking on a misspelled word will add a Spelling submenu with guesses if any are available. Guesses will be grayed out if document is read-only. If spelling is correct, menu will show "Look Up in Dictionary." Macintosh only: Enabled Services menu. The state of the color checkbox in the export graphics dialogs is no longer sticky and not set by preferences. This had caused too much confusion. If you really want to decolorize on export, you will have to uncheck the Color setting each time. Got rid of the warning about high resolution taking a lot of memory when you export a graphic from the Export Graphics dialog. The From Target checkbox in the Insert Points and Delete Points dialogs no longer changes the values in the Dimension, First Point and Number of Points controls. The DelayUpdate feature of page layouts is now a global setting instead of a per-document setting. Previously the DelayUpdate setting was set individually for each document. It was not saved so it reverted to the default state (on) whenever you recreated a page layout. Now it is set globally for all layouts. When you change the DelayUpdate setting using the Misc icon in the page layout tool palette, it is changed for all existing and future layouts instead of just the layout you set. Procedure windows in independent modules will no longer appear in the Find Text dialog unless you execute: SetIgorOption IndependentModuleDev=1 Behavior Changes Changed wave[val]= expr to round val in user functions (as has been done in macros forever). Macintosh only: When in New Graphics mode, export modes that previously used QuickDraw PICT format now use PDF instead. See the /e flag for SavePICT. The only mode that still uses a QuickDraw format is the bitmap PICT. Some older programs, for example Microsoft Office prior to 2008, may require the old PICT format. In an emergency, you can cause Igor to revert to the old graphics using SetIgorOption UseOldGraphics=1 To avoid crashing, DoIgorMenu is no longer allowed to invoke the "New Experiment", "Open Experiment", or "Revert Experiment" items in the "File" menu while running in a function or macro (an error is returned). Use the Operation Queue, instead. When Igor automatically looks through all files in a given folder, such as when it opens help files in the Igor Help Files folder or procedure files in the Igor Procedures folder, it now ignores files whose names start with dot. This is to avoid problems caused by Apple's annoying habit of creating such files on non-HFS server volumes whenever you write a file to the volumes. Macintosh: Temporary files created by Igor now end with ".noindex" to prevent Spotlight from indexing them and interfering with the save process. Notebook subwindows in control panels now save their normal ruler (formatted text notebooks) or text formats (plain text notebooks) in recreation macros. In ThreadSafe user-defined functions, acessing. Dialog Improvements The Pictures dialog has been revamped and is now also used as subdialog to insert pictures in axis labels or textboxes. Change to Copy Proc Picture in Pictures dialog: No longer has side effect of converting a picture type other than PNG or JPEG into PNG. If option key is pressed, can create Proc Picture using the native format. But, this should be used carefully if at all since such formats are generally not cross-platform. Modify Axis dialog now shows fractions of seconds in the manual range limit boxes in the Range tab. The behavior of the axis range settings when you have multiple axes selected has been improved. The Tick Label Rotation and Axis Label Rotation settings on the Label Options tab now support setting arbitrary angles between -90 and 270 degrees. The Annotation dialog can adjust inter-line spacing with a new Line Spacing dialog which inserts or edits the new \sb and \sa escape codes. The Save Graphics and Export Graphics dialogs now remember your custom size settings as preferences. The Save Graphics dialog now offers transparency for PNG file export. On Macintosh, it also offers to suppress smoothing of fonts, which may be required to get text to have transparent background. The Save Graphics dialog now does not offer custom resolution setting for QuickTime-based formats. This was never supported, and now the dialog is smart enough to know it. New Graph Dialog: Axis fields in the trace list (more options mode only) are now menus. The space allocated to the various parts of the list is now controlled by draggable dividers in the column titles. Changed New Notebook dialog to use the entered name as the window name in addition to using it as the file name (if the notebook is later saved to disk). Graphing Improvements Log axes now support round to nice values. SetAxis/A/N=2 is same as SetAxis/A/N=1 for now. Free axes now used to calculate margins if they have a zero offset and all axes on a given plot edge are used in the calculation. Also we now measure rather than estimate axis label size in calculating margins. This is mainly for multi-line axis labels. In case the above causes problems, can turn the new features off or on using: SetIgorOption NewAxisMargin= <val> // bit 0 to enable free axes if zero offset, bit 1 to measure axis label rather than estimate Extended range of date/time for display (such as axis ticks and tables) and input. Previously had been limited to 1904 to 2040. Now there is no practical limit except on Windows where dates must be greater than Jan 1, 1601. Added new modes for image display of complex data. See ModifyImage imCmplxMode keyword. You can now use overlapping fill patterns where one or more is transparent. However this does not work when exported on Windows as EMF or WMF. To use transparent patterns, use the new ModifyGraph keyword patBkgColor. New Graphics mode only. You can now cause dashed lines to use round endcaps using the new ModifyGraph keyword lOptions. New graphics only. There are 12 additional marker types (number 51 through 62). New graphics only. You can now create custom markers. See the SetWindow keyword markerHook. New graphics only. You can now insert pictures in-line in fancy text (TextBoxes, axis labels etc.) New graphics only. This is used to insert math expressions that would be hard to create using standard Igor escape codes. See the \$PICT$ escape code for TextBox. Axis labels can now be multi-line. Textbox "\\W1dd" is a marker with no line stroke. Added ModifyGraph useBarStrokeRGB=1 and barStrokeRGB=(r,g,b) to draw Histogram Bars with an outline that is a different color than the fill color. Updated Modify Trace Appearance dialog. Added ModifyGraph zpatNum=zwave to vary the fill pattern for each point in Histogram Bars and Fill To Zero mode. Updated Set as f(z) dialog. Tags attached to traces can auto-rotate parallel or perpendicular to the attachment point. Contour labels use this feature with new values for the ModifyContour labelHV keyword. Tags can now specify an arrow pointing back at the tag or in both directions using /L=3 or 4. Trace Instance numbers are no longer limited to #999. They're now limited to #9999999. ModifyGraph zColor subtly changes the mapping of f(z) values to colors, similar to the way Igor 6 now maps color table colors for images (see Image Plot Improvements for Igor 6.0 ). This eliminates the problem that only half of the first and last colors are used. Details follow: Igor versions before 6.1 mapped the values to colors by rounding to the nearest color table index: index= round((z-zmin)/(zmax-zmin)*(numColors-1)) which meant only half of the first and last colors were used. In this example the fz wave supplies the z values, zmin is 3, zmax is 17, and the dbZ14 color table has 14 colors, indexed from 0 to 13. Make/O/N=300 yy=1, fz // yy = 1 SetScale/I x 0,20,"", yy fz fz= x // fz = 0 to 20 Display yy; AppendToGraph/L=fzLeft fz ModifyGraph zColor(yy)={fz,3,17,dBZ14} z values greater than zmax (greater than 17) are shown as white: ModifyGraph zColorMax(yy)=(65535,65535,65535) z values less than zmin (less than 3) are shown as black: ModifyGraph zColorMin(yy)=(0,0,0) Notice that the first and last colors (cyan and magenta) are half the width of the others: Igor 6.1 maps the f(z) values to colors by truncating to the nearest color table index: index= floor((z-zmin)/(zmax-zmin)*numColors) which uses the first and last colors for as many values as the other colors: The old way can be re-instated by executing: SetIgorOption preIgor6ColorScaling=1.For more about zColor, zColorMax and zColorMin, see Setting Trace Properties from an Auxiliary (Z) Wave. Table Improvements Allowed column widths in tables to be odd numbers of pixels since we no longer use dotted lines for grid lines. Changed the Show Column Info Tags feature to show tags when you hover over the name area of a wave column as well as over the data area. If you start to change the value of a cell in a table and then change the viewed layer or chunk, the cell entry is accepted before the viewed layer or chunk is changed. Same if you start to change the viewed dimensions while an entry is in progress.). Improved feedback when user tries to change a locked wave in a table. Page Layout Improvements SavePICT/W=(0,0,0,0) exports using a full page. Improved Page Layout WYSIWYG for graph alignment. The desktop region in page layout windows is now drawn as solid gray instead of as a gray pattern. Added 12.5 percent and 6.5 percent zoom levels for page layouts. This is intended to make it easier to work with very large page sizes. The page layout fidelity setting no longer has any effect on drawing graph objects. Notebook Improvements Changed notebook object picture updating to be cross-platform. Previously, the Notebook specialUpdate keyword could update pictures of graphs, tables and page layouts that were created from windows in the current experiment but only on Macintosh and only for the Mac PICT format. This now works on both Macintosh and Windows and for all supported clipboard formats. To create a picture that can update, copy the window to the clipboard and paste into a formatted notebook. With the exception of Macintosh PICTs, existing pictures in Notebooks do not have the information needed for the update and will need to be regenerated. Backwards compatibility note: Although these pictures in Notebooks will be visible when passed back to Igor Pro 6.0, when Macintosh PICTs are updated, they will be converted to the new Macintosh standard format, PDF. This is not supported prior to 6.1 and therefore these pictures will show up as gray boxes.. You can open UTF-16 (two-byte Unicode) text files as plain text notebooks.. The Notebook operation supports a writeProtect keyword to turn write-protect on or off. You can insert the contents of a picture file into a formatted text notebook. To support this the Edit→Insert Text menu item is now Insert File. The Notebook operation has an insertPicture keyword for programmatically inserting the contents of a picture file into a formatted text notebook. You can now save a picture in a notebook as a picture file. You must select one picture and one picture only and then choose File→Save Graphics. The Notebook operation has a savePicture keyword for programmatically saving the contents of a notebook picture in a file. info dialogs. Help Improvements Added Built-in Structure Reference section to the Igor Reference help file. This means you can right-click the name of a built-in structure, such as WMWinHookStruct, and choose "Help For WMWinHookStruct" from the contextual menu. The Igor Help Browser's Search Igor Files tab has a new checkbox for searching the Igor Pro User Files folders. Many of the technical notes have been updated, including fixing missing graphics on Windows. Tech Note 021 Ternary Graphs has been marked Obsolete. It has been replaced by the Ternary Diagram Package, available via Windows→New→Packages→Ternary Diagram. Added "Show File in Finder/Windows Explorer" button to Help info dialogs. Graphics Export Improvements Relaxed plot size limits when exporting graphs using special plot size modes. Improved the ability to export huge graphics by automatically scaling back resolution as numeric limits are reached. Font embedding for Igor PDF and EPS export now supports multibyte fonts (i.e., Japanese.) Added support for underline text in Igor pdf export. Macintosh only: Transparent PNGs created via SavePICT/TRAN=1 now use the full alpha channel to support antialiasing and font smoothing. However, due to limitations of the OS, this does not work well for smooth text under OS X 10.4 or Japanese 10.5. For these operating systems, you can use /TRAN=2 to turn off the problematic font smoothing. Axis labels now honor embedded superscript (\S), subscript (\B) and mainline (\M) escape codes in wave units. For example: Make jack=sin(x/8); SetScale x, 0, 0, "g/cm\\S3\\M", jack Display jack the IgorRGBtoCMYKPanel.ipf procedure file: #include <IgorRGBtoCMYKPanel> The IgorRGBtoCMYKPanel procedure implements a table-like editor to override the conversions Igor will perform when exporting RGB graphics in the CMYK format. See Exporting Colors (Macintosh) or Exporting Colors (Windows) for details. Added a method to force discrete pixels in PDF export of image. Mainly for use on Macintosh. For example, on Macintosh: Make/O/N=(50,40) jack=x*y NewImage jack;MoveWindow 121,91,682,537 ModifyImage jack ctab= {*,*,Rainbow,0} Now copy to the clipboard as a Quartz PDF and read into Preview.app via New From Clipboard. Then execute: SetIgorOption MaxDimForImagePixels=41 and do it again to see the difference. UPDATE: As of 6.20B02 you also have to execute this: SetIgorOption imagedraw, TinyBlitOK=0 Procedure Window Improvements Checking the Auto-compile menu also compiles the procedures immediately. Also see Invisible Procedure Files. Added "Show File in Finder/Windows Explorer" button to Procedure info dialogs.. Increased the maximum number of help template characters that will be inserted in a procedure file from 120 to 400. You can open UTF-16 (two-byte Unicode) text files as procedure windows.. Gizmo Improvements Added support for EPS export. #include <All Gizmo Procedures> includes the procedures into an independent module so they'll continue working if the user's own procedures don't compile. The Gizmo menus have been revised. Drawing Improvements Draw patterns can be transparent using "magic" white background color value of (65534,65534,65534). Does not work with emf or wmf export. Example: Display SetDrawEnv fillpat= 5,fillfgc= (65535,0,0) DrawRect 0.15,0.18,0.50,0.60 SetDrawEnv fillpat= 6,fillfgc= (0,0,65535),fillbgc= (65534,65534,65534) DrawRect 0.34,0.12,0.64,0.70 Draw text can be mutli-line and use all the escape codes of TextBoxes. When DrawPICT is used in an independent module and you need to access the picture gallery, you can now do so using a new prefix name, GalleryGlobal. For example: DrawPICT 0,0,1,1,GalleryGlobal#PICT_0 Annotation Improvements New escape codes for textboxes to provide tweaks to line spacing. See the \sa and \sb escape codes for TextBox. Annotations can be rotated in one-degree increments using New Graphics . Tag arrow heads can be added on either or both ends of the tag attachment line. Control Improvements A SetVariable control can now be used without a global variable. See the _STR: and _NUM: syntax for the value keyword. ControlInfo reads back the string from SetVariable when using new _STR: mode. You can now use ctrl-return to enter a carriage return in a string SetVariable. A carriage return in a string SetVariable or a \r in a textbox now shows as a symbol representing a carriage return. SetVariable can now use fancy text using the escape codes defined for the TextBox operation if noedit=2. New mousewheel event codes for SetVariable: See events 4 and 5. Additional keywords for coloring Most user-defined control titles now accept styled text commands. The control dialogs have an Insert popup to make this easier. ControlInfo for Button and CustomGaget controls now return tick count of last mouse up in V_value. This can sometimes make it possible to use buttons without setting an execution proc. The value expression for ValDisplay can now be _NUM:<numeric expression>. This avoids the need to set a dependency on a global variable.. ListBox disable=2 is now supported. The foreground color of cells in a Listbox control now follows the color specified by selWave even if the cells are selected. Previously the foreground color was ignored for selected cells. Added keyboard event (event 12) to the Listbox action. Sets the row member of the WMListboxAction structure to the character code; use num2char to get a string for the character typed. Also sets the eventMod member appropriately. Added the clickEventModifiers keyword to the Listbox command to tell listbox controls to ignore right clicks and clicks with modifier keys. That allows the listbox action procedure to receive the mousedown and mouseup events for their own purposes, allowing a contextual menu to be put up by the action procedure even on checkbox and editable cells. Added the titleWave keyword to the Listbox command to specify column titles using a text wave instead of the listwave dimension labels. This allows more than 31 characters in a column title, which is especially useful with styled text. Added setEditCell keyword to the Listbox command to allow programmatic initiation of cell editing. Control Panel Improvements. Panel windows can now be the target of ShowInfo and HideInfo for use with any graph subwindows. You must use an explicit name via the /W flag to target a panel window. Without the flag, the top graph window will be the target. Panel windows can now be used as progress indicator windows during long calculations. See the DoUpdate /W and /E flags and the ValDisplay mode=4 setting. See Progress Windows for example code. You can now create a snapshot picture of a control panel. Use SavePICT/SNAP=1. Note that scroll bars and the content of Notebook subwindows will not be captured. Windows only: Changed the window coordinates for floating panels to be consistently screen coordinates. Previously, NewPanel/FLT=1/W=(x0,y0,x1,y1) would use screen coordinates except the y values were offset by 20. Previously, GetWindow's wsize keyword would return coordinates relative to the MDI frame. Now they are screen coordinates but, for consistency, measured in Points, not pixels. Previously, MoveWindow would offset a floating panel by 20 points. Controls outside of a tab/groupbox frame but inside the enclosure are no longer considered inside the tab/groupbox, so the control background is rendered correctly. (This affected only controls positioned in the tab or groupbox title areas.) ListBox special kind=1 now supports tables in addition to graphs. Only presentation portion is provided. Analysis Improvements Added /TIME=secs flag to Loess operation to warn or abort if the calculation time exceeds that number of seconds. WaveCRC now returns a consistent value for the header CRC value that previously changed when other waves were created or killed. Loess properly aborts if the user presses command-period (Macintosh) or Ctrl+Break (Windows). New Mulit-peak Fit 2 package. See New And Improved WaveMetrics Procedure Files for details on the new package. Added new operation LombPeriodogram. Added /MPCT flag to Smooth to compute percentile, min, and max value in the smoothing window. The revamped Smooth dialog now has Percentile, Min, and Max algorithms and a few more options for Loess smoothing. The replacement value interface is hopefully more obvious. Added /AUTO and /NODC options to the Correlate operation, and revamped the Correlate dialog accordingly. Added /DIML flag to Sort and IndexSort. The Optimize and FindRoots operations are now thread-safe, with the exception of FindRoots for polynomial roots (/P flag). IntegrateODE now has a /STOP flag that allows you to specify a wave with stopping conditions on the Y values and derivatives. Your derivative function can also request a stop by returning 1 from the function. Statistics Improvements Added /NAPR flag in StatsSRTest to allow the use of the normal approximation even when the number of points is less than 150. Added Jack-Knife analysis and a new flag /MC to StatsResample. Added new operation StatsSample. Added /AEVR flag to StatsTTest. Added calculation of P-values in all four tests in StatsCircularTwoSampleTest. Matrix Improvements Added new functions to MatrixOP: replace(), replaceNaNs(), minVal(), maxVal(), clip(), and scale(). Changed MatrixOP to return a matrix of NaN values when inverting a singular matrix. MatrixOP convolve() now supports an efficient direct kernel convolution with padding or data reflection at boundaries. MatrixOP now supports a /FREE flag to store the output in a free wave. Curve Fitting Improvements Changed some flags and added some new flags to CurveFit, FuncFit and FuncFitMD to make it easier to write compiled (function) code with options. Before, flags had to be present or not present which can't be compiled into a choice. Now some arguments have been added, and a new flag (/NWOK) has been added to make it possible to compile choices. Added /ODRT flag to CurveFit parameters (the flags at the end of the command). Sets convergence tolerance for ODR fitting. Removed upper limit on V_FitMaxIters. See Special Variables for Curve Fitting. Added error message if you try to add confidence bands or prediction bands to an ODR (Orthogonal Distance Regression) fit. See Also: Errors in Variables: Orthogonal Distance Regression. Image Plot Improvements ModifyImage plane now indexes through higher dimensions (chunks). For example if an image has 4 planes and two chunks, plane= 4 would show plane 0 of chunk 1. New rgbMult keyword for ModifyImage. Direct color values are multiplied by this. Image Processing Improvements Added /DEST=destinationWave flag to ImageInterpolate. ImageRegistration now supports the individual registration of layers in a 3D stack. You can also use the operation to transform any image with a user-defined set of parameters. This is mostly useful for transforming multiple images based on the registration of a single frame. Added /BRXY flag to ImageStats to allow for specification of multiple beams using an XY pair of waves. Added the flag /Igor to ImageSave to force TIFF file saving using Igor's code. Data Import And Export Improvements Dramatically speeded up loading of very long 1D text waves using LoadWave. You can disable interpretation of escape sequences when loading text using LoadWave. Set bit 3 of the loadFlags parameter of the /V flag."). The LoadWave operation can handle UTF-16 (two-byte Unicode) text files. It does not recognize non-ASCII characters, but does ignore the byte-order mark at the start of the file (BOM) and null bytes contained in UTF-16 text files. LoadWave/J now accepts date/time values in ISO-8601-style: <date> T <time>. It does not support ISO-8601 time zone designations. The GBLoadWave operation now supports very big files. See GBLoadWave and Very Big Files for details. Changed LoadData operation so that it creates the variable V_flag and sets it to the number of objects loaded, or to -1 if the user cancelled the open file dialog. The length of the objectNameList used with SaveData/J is now unlimited. Now support save and restore of DataFolderRef (DFREF) and wave reference waves in packed experiments. These types can not be stored in unpacked experiments or via SaveData and they will not show up in the data browser. They will be ignored by previous versions of Igor. See Data Folder References. File Command Improvements You can now display an Open File dialog that supports selecting multiple files. See Displaying a Multi-Selection Open File Dialog. PathInfo's new /SHOW flag opens the specified folder in the Finder (Macintosh) or Windows Explorer (Windows). Added a "Igor Pro User Files" option to SpecialDirPath. In the SetFileFolderInfo /RO command on Macintosh, bit 1 has no effect. Use /RO=0 or /RO=1 but not /RO=2 or /RO=3. The FSetPos and FStatus operations now support very big files (greater than 2GB). FSetPos now supports setting the current position in files up to about 4.5E15 bytes. FStatus now supports reporting the current file position (through V_filePos) and the total file size (through V_eof) for files up to about 4.5E15 bytes. The GBLoadWave operation now supports very big files. See "GBLoadWave and Very Big Files" in GBLoadWave Help.ihf for details. The Open operation, when used to display an Open File or Save File dialog, now supports file name extensions longer than three characters via the new /F flag. Added /D=2 flag to Open operation to make it easier to create utility routines that take pathName and fileName parameters. See Displaying an Open File Dialog and Using Open in a Utility Routine for an example. The IndexedFile function ignores dot-underscore files (e.g., "._wave0.ibw") created by Apple's SMB software unless the specified file type is "????" (any file type). On Macintosh, eliminated the limit on number of files that Igor can open at one time. Programming Improvements New MultiThread keyword provides automatic parallel processing of wave assignment statements. See Automatic parallel processing with MultiThread..) A killed wave in a WAVE reference now act like a NULL wave. This is to fix crashes resulting from code like this: WAVE awave foo() // a function that kills awave Display awave Programmers can now use a shortcut when creating a WAVE reference variable while using $ <str>. See the /WAVE=<name> discussion in Automatic Creation of WAVE References. You can now create free waves in functions using the new /FREE flag with either Make or Duplicate. This flag is not allowed on the command line and is not allowed with $ or folder syntax. New built-in wave reference function, NewFreeWave. You can now create and pass in a free wave to a user-defined function using {a,b,...} syntax as illustrated here: Function foo(w) WAVE w print w End Function bar() foo({1,2,3}) End See Free Waves. Added GetErrMessage function (which is pretty useful in combination with Execute). GetSelection for procedure windows works just like for notebooks except that the name is actually a title wrapped in $"". Added optional dfr parameter to GetDataFolder; when supplied, it is used in place of the current data folder.. Now allow unlimited number of datafolders to be queued via ThreadGroupPutDF. Increased the maximum dimension length in user defined Structures to 400 from 100 for all types except STRUCT. Added new /C (continue) flag for PauseForUser when you have something to do while waiting. After handling any events, PauseForUser returns immediately after setting V_Flag to the truth that the target window exists. Typical use would be for automatic continue after some delay. Made PauseForUser on Windows suppress clicks on most non-target windows. Conditional ops (<, > etc) are now defined for complex. The imaginary part is ignored on input and set to zero on output. ProcedureText can return all of the text in a specified procedure window. DisplayProcedure now groks procedure name paths like WMGP#GizmoBoxAxes#DrawAxis to display static functions (even in an indepdendent module). See The IndependentModule Pragma. WinRecreation can return file information (symbolic path, full path, file name) for a specified procedure window. SetIgorOption poundDefine=name and SetIgorOption poundUndefine=name enable the procedure window's Compile button. See Conditional Compilation. It is now possible to attach user data to a graph trace. See ModifyGraph for Traces, information on the userData keyword. Also see the GetUserData function. Bit 2 omits hidden traces from the output of TraceNameList. Added /N option to PopupContextualMenu to allow contextual menus using the standard user-defined menu mechanism. The Debugger's breakpoints follow the text (mostly). The Debugger has a new "Show Wave Scaling" menu item in the Waves in Current or Root Data Folder popup menu. The Debugger optionally shows waves as a graph trace or image plot, with a limited selection of appearance options available from a right-click contextual menu. Debugging on Error breaks into the debugger on stack exhaustion. New mouse wheel event for named window hooks. See SetWindow eventCode= 22 with new fields wheelDx and wheelDy. Values are typically +1 or -1 with wheelDy being set by the vertical mouse wheel. On Windows, horizontal mouse wheel requires Vista. New "spinUpdate" window hook eventCode=23, called for progress windows during execution of user code. Allows semi-automatic progress updates. See SetWindow and Progress Windows for details. The window hook "modified" event is now sent from notebook windows or subwindows. It is an error to try to kill the notebook window or its parent window during a window hook "modified" event. See SetWindow. On Windows, "activate" and "deactivate" events are sent to window hook functions (see SetWindow) even when a panel or graph is minimized. GetWindow now can tell you if a window is maximized or active. ChildWindowList now returns empty list if error rather than raising an error. GuideNameList function. Added cd and pwd operations. Added the YYYY-MM-DD format to Secs2Date. Changed DateTime to include fractional seconds. In wfprintf operation, if refNum is 1, Igor will print to the history area instead of to a file. This is provided for debugging purposes. Added a special-purpose feature for Bela Farago whereby text sent to history area is carbon-copied to a notebook. See History Carbon Copy. /KILL flag to SavePackagePreferences operation. In the SaveData operation, Save Graph Copy and Save Table Copy, a message is now added to the saved experiment's history containing the parent experiment name and date/time.. Added run time error when writing to a text wave fails. You can now use structures defined in independent modules in global procs using imName#structName. New and Improved XOPs The new SQL XOP provides access to relational databases from Igor procedures. It uses ODBC (Open Database Connectivity) libraries and drivers on Mac OS X and Windows to provide this access. SQL XOP (file name SQL.xop) was created by WaveMetrics in 2007. It is unrelated to SQLXOP (file name SQLXOP.xop) which was created by Bruxton Corporation in the 1990's and which runs on Windows only. Macintosh: the MLLoadWave XOP is now universal (Intel as well as PowerPC). The old PPC-only MLLoadWave_OSX XOP (in "More Extensions:File Loaders:PPC Extensions") has been removed from the distribution. To use the new XOP, remove the old alias from Igor Extensions and activate the new MLLoadWave XOP by adding its alias to Igor Extensions (preferably in the Igor Pro 6 User Files folder opened from Igor's Help menu). See "Using MLLoadWave on Mac OS X" in the MLLoadWave Help.ihf file for details on Macintosh configuration requirements for MLLoadWave.. Windows: Fixed a bug in the GBLoadWave XOP that prevented it from working with very large files (>2GB). The GBLoadWave XOP and dialog now properly escapes backslashes in UNC file paths (\\Server\Share) on Windows, and supports long file names on Macintosh. The SndLoadSaveWave XOP reads files with long names on Mac OS X, properly escapes backslashes in UNC file paths (\\Server\Share) on Windows. The JCAMPLoadWave XOP has been recompiled to support long file names. Also added new error message stating that XYXY data is not supported, and suggesting that it can be loaded as Delimited Text with comma delimiter. Relaxed line-length restriction to allow non-standard files with lines longer than 80 characters. Macintosh: Universal versions of NIGPIB XOP and NIGPIB2 XOPXOP using HDF5 library version 1.8.2. This was done to keep in sync with the Windows version which was updated in Igor Pro 6.10B06. Windows: New DSXOP supports DirectShow video acquisition under Windows XP and Windows VISTA. Miscellaneous Improvements Added the ExperimentModified operation. Added the IgorVersion function. Window titles can now be up to 255 characters instead of up to 40. Igor object picture information is now preserved when you copy a picture between graphs, tables, layouts, notebooks and the picture gallery. Added IgorExchange item to help menu. This leads to , the user-to-user support web site. The file information dialog that appears when you click the tiny page icon in the lower-left corner of help, notebook, and procedure windows has a new "Show File in Finder/Windows Explorer" button. SaveExperiment/P=<path> now presets Save File dialog folder.. Changed the Pictures dialog's list of names to one column, putting any error or commentary text below the list. Added a Copy Picture button. Fixed the Convert to PNG button not enabling. New And Improved Example Experiments Added Multi-peak fit 2 Demo.pxp as an introduction to the new Mulit-peak Fit 2 package. See below in New And Improved WaveMetrics Procedure Files 6.1 for details on the new package. Added Cursor Moved Hook Demo.pxp in the Examples→Techniques folder. Added Trace Graph.pxp in the Examples→Techniques folder. Added Volume Grids.pxp. Added snakeDemo.pxp. Added BackgroundImageDemo.pxp. Added Circular Two Sample Test.pxp. Added MultiThreadMandelbrot.pxp. Added Ternary Diagram Demo.pxp. New And Improved WaveMetrics Procedure Files #include <all gizmo procedures&gr; includes the procedures into an independent module so they'll continue working if the user's own procedures don't compile. Added new Ternary Diagram package, which you will find under Windows→New→Packages. Brand-new revised version of Split Axis package has nice control panel GUI, handles images and contours, keeps track of its axes so that they can be listed in menus sensibly, and can be removed easily. See the Graph menu's Package submenu. New version of Global Fit 2.ipf has new data set selector panel. Hopefully it will make it easier to select waves when working with lots of data sets. Modified ColorWaveEditor to take advantage of the new /N option for PopupContextualMenu. Now you change the color by clicking on a row to bring up a contextual menu. Added Select Points for Mask procedure package, an updated and improved version of Data Mask for Fit. The name was changed to reflect the fact that it has wider applicability than just making a mask wave for fitting. It is now available via the GraphâPackages menu. The ODE Panel and FitODE procedure files have been updated to offer the latest IntegrateODE options, and to modernize the GUI. Multi-peak Fit 2 is a complete rewrite of the Multi-peak Fit package: - Brand new, shiny user interface. - Easy to use in your own experiment file. - Easy to use on multiple data sets within a single experiment file. - Improved user interface for graphically editing initial guesses at peaks. - Get location, FWHM, and peak height even for peak types that don't have analytic expressions for those parameters. - Ability to mix different peak types within a single fit. - Added a help file to document the use of Multi-peak Fit 2. - Framework for users to add their own peak and baseline functions. - Support for Igor programmers to use the fitting engine and to do batch peak fitting. Routines in KillWaves.ipf have been updated to work with waves in all data folders. The side effect of bringing windows to the front in order to remove waves from them has been removed. Upgraded CopyImageSubset.ipf slightly to use all of the ModifyImage recreation settings in the created image plot. Added IgorThief.ipf.. New IgorRGBtoCMYKPanel.ipf implements a GUI for editing root:M_IgorRGBtoCMYK (which specifies custom RGB to CMYK for EPS and Igor PDF export) and for gathering colors used in the top graph. ColorSpaceConversions.ipf now contains a function that replicates Igor's RGB→CMYK conversion and a function that approximates a CMYK→RGB conversion.. Sonogram.ipf implements a "0 dB Max" feature to normalize the image to a maximum of 0 (dB). Fixed a bug in Transpose Waves in Table.ipf- it failed to handle liberally-named waves. PopupWaveSelector.ipf should now create a popup window of consistent size on Windows. It also computes the size of the group box used to frame SetVariable popupWaveSelector widgets better. On Windows, it positions the drop-down arrow on the little button in a SetVariable widget better. XOP Toolkit Improvements. Bug Fixes See Changes Since Igor 6.10 for a detailed bug fix list. Forum Support Gallery Igor Pro 8 Learn More Igor XOP Toolkit Learn More Igor NIDAQ Tools MX Learn More
https://www.wavemetrics.com/products/igorpro/newfeatures/previous/whatsnew61details
CC-MAIN-2020-24
en
refinedweb
Join the community to find out what other Atlassian users are discussing, debating and creating. Hello everybody. I try to make Script Listener, which in the time of issue creation make a Issue in another instance of jira via REST and I want to parse response to get ID of created issue and set that ID in to custom field, but I can't. Is it possible to set value in custom field via script listener when Issue Create event happens? def issue = event.getIssue() def key = issue.key MutableIssue mI = ComponentAccessor.getIssueManager().getIssueByCurrentKey(key) mI.setCustomFieldValue(ComponentAccessor.getCustomFieldManager().getCustomFieldObjectByName("Issue ID"),"here is ID from response") And why I can't use this def issue = event.getIssue() issue.setCustomFieldValue(cF, value) Hi 1) event.issue returns "Issue" interface, it doesn't have setCustomFieldValue methoid. You need "MutableIssue" interface you want to update this issue. 2) From API setCustomFieldValue void setCustomFieldValue(CustomField customField, Object value) Sets a custom field value on this Issue Object, but does not write it to the database. This is highly misleading. To actually set a custom field value, use OrderableField.updateIssue(com.atlassian.jira.issue.fields.layout.field.FieldLayoutItem, MutableIssue, java.util.Map) So you need "updateIssue" method from IssueManager def CF = customFieldManager.getCustomFieldObject(<fieldID>); MutableIssue issueToUpdate = (MutableIssue) event.issue; issueToUpdate.setCustomFieldValue(CF, <newValue>); issueManager.updateIssue(event.getUser(), issueToUpdate, EventDispatchOption.ISSUE_UPDATED,.
https://community.atlassian.com/t5/Jira-questions/How-set-custom-field-value-in-Issue-Create-event/qaq-p/1216402
CC-MAIN-2020-24
en
refinedweb
A functional and reactive JavaScript framework for predictable code. cycle.js.org xxx$.log('xxx').map(... import {HTTPContext} from '../../http-context-driver' function FrontPage ({HTTP}) { return { HTTP: HTTP.map((ctx: HTTPContext) => { const outgoing: HTTPContext = { request: ctx.request, response: ctx.response, body: 'FrontPage' } return outgoing }) } } export default FrontPage @mariuslundgard awesome! You got a github star :-) I hope I can start wrapping as a cycle.js driver in the future. And I would love to have the req/res-part available as well. I just don’t have the time to figure out if I need cycle.js or not in my projects. But I do use most of the thoughts I’ve heard about MVI, but as model, view, interactions, and state.
https://gitter.im/cyclejs/cyclejs?at=571b5d7c47b4c6480ff9940d
CC-MAIN-2020-24
en
refinedweb
After seeing the recent story on the front page about the RPi controlled Roomba, I decided to dust off my old 500 Discovery series, and my old USB Roostick+cable. I installed PySerial Then I hooked up the Pi, plugged the roostick+cable into the Roomba and into the Pi's USB Hub. lsusb shows: the Hub 3 "Standard Microsystems Corp" entries The mouse The Keyboard and finally: "Cygnal Integrated Products, Inc. CP210x UART Bridge / myAVR mySmartUSB light" Unplugging the roostick and running lsusb again shows that it's that last item in the list that is the roostick. I threw together a little python test program, basically exactly what's in the Roomba SCI interface document: Code: Select all import serial) Seems like no matter what I put in for the device it comes back saying it can't connect. Looking in /dev, I see /ttyUSB0 show up when I plug the Roostick in... But trying to use /dev/ttyUSB0 as the port gives an exception "Port is already open" error. Any ideas???
https://www.raspberrypi.org/forums/viewtopic.php?f=37&t=22462&p=211921
CC-MAIN-2020-24
en
refinedweb
Join the community to find out what other Atlassian users are discussing, debating and creating. Hi, we have the following issue with the letter font in a comment: If a user adds an attachment into a newly created comment, for example a Microsoft Outlook MSG file (message) this attachment is shown as a link. Then the user makes a bullet list with even this attachment line. When he then press ENTER (to the next bullet line) the text font will get smaller in the next line. Has anybody seen this already? Regards Tim Hi Tim, Sorry to hear about this problem. While I have seen other documented bugs around spacing in bullet lists in Jira, such as JRASERVER-33394, I have not yet found this specific bug documented that you describe here. I tried to recreate what you described in my 8.4.1 test instance of Jira, by adding a comment, and trying to insert both attachment links and external links into the first line of a bullet list. However I could not seem to replicate this problem here. I'd be interested to learn more about your environment here. Such as I'd be interested to figure out how I can reproduce this problem so that we can better document this behavior. Regards, Andy Hi @Andy_Heinzer , I am able to reproduce this issue in 8.3.4 and even in 8.4.2. Here is my step by step description of this issue: When I use the text mode there is a slight difference between the first and the second line. The second line is indented by a single space (?) character. When I copy and paste the whole text the indent dissapears: * [^Axians_R58700447910_Office365.PDF] * ^tes^ On my screenshot you will the the indent. The behavior is the same in Description. Copy and paste a URL (text) from the web browser does not change the font. Creating a external link using the editor menu seems to work well, too. HTH Regards Tim Hi Tim, Thanks for providing the detailed steps here. With these I was then also able to replicate this problem. I agree this is a bug in the way the visual editor in Jira server is working. It seems that it is incorrectly applying that caret ^ character here on that next line. In my research of this problem I came across a very similar reported bug in JRASERVER-64897. While the steps are a bit different here, I certainly think this is related to the problem you have found here. So I created a new bug that more clearly highlights the steps you took to locate this bug in JRASERVER-70097. I found that if you use a carriage return (enter) after creating the link, but before creating the bullet list / numbered list, that this formatting bug does not appear. Additionally this bug does not appear to extend itself to the text editor and seems to be bound specifically to the Visual editor. That said, thanks for raising this problem on Community. I am not sure when this bug might be fixed within Jira server, but you can watch that bug ticket for updates on this problem. I hope that one of these work-around above will be useful in the meantime. Cheers,.
https://community.atlassian.com/t5/Jira-questions/attachment-link-in-bullet-list-will-change-letter-font-in-next/qaq-p/1198955
CC-MAIN-2020-24
en
refinedweb