text
stringlengths
454
608k
url
stringlengths
17
896
dump
stringclasses
91 values
source
stringclasses
1 value
word_count
int64
101
114k
flesch_reading_ease
float64
50
104
UDP(4) NetBSD Kernel Interfaces Manual UDP(4)Powered by man-cgi (2020-09-24). Maintained for NetBSD by Kimmo Suominen. Based on man-cgi by Panagiotis Christias. NAME udp -- Internet User Datagram Protocol SYNOPSIS #include <sys/socket.h> #include <netinet/in.h> int socket(AF_INET, SOCK_DGRAM, 0); int socket(AF_INET6,. There is one valid encapsulation option: UDP_ENCAP_ESPINUDP from RFC3948 defined in <netinet/udp.h>. Options at the IP transport level may be used with UDP; see ip(4) or ip6(4). DIAGNOSTICS A socket operation may fail with one of the following errors returned: [EADDRINUSE] when an attempt is made to create a socket with a port which has already been allocated; ; SEE ALSO getsockopt(2), recv(2), send(2), socket(2), inet(4), inet6(4), intro(4), ip(4), ip6(4), rfc6056(7), sysctl(7) User Datagram Protocol, RFC, 768, August 28, 1980. Requirements for Internet Hosts -- Communication Layers, RFC, 1122, October 1989. HISTORY The udp protocol appeared in 4.2BSD. NetBSD 9.0 May 31, 2018 NetBSD 9.0
https://man.netbsd.org/NetBSD-9.0/i386/udp.4
CC-MAIN-2021-10
refinedweb
172
51.04
How You Can Change A PID process in Linux By Using A Kernel Module In this article, we will try to create a kernel module that can change the PID of an already running process in the Linux OS, and also experiment with the processes that received the modified PID. Warning: Changing PID is a non-standard process, and under certain circumstances can lead to kernel panic. Our test module will implement the character device/ dev/test when reading from which the process will be changed PID. For an example of implementing a character device, thanks to this article. The complete code of the module is given at the end of the article. Of course, the correct solution was to add a system call to the kernel itself, but this would require a recompilation of the kernel. Environment All the module testing activities were performed in a VirtualBox virtual machine with a 64-bit Linux distribution and a 4.14.4-1 kernel version. Communication with the machine was carried out using SSH. Attempt # 1 simple solution A couple of words about current: the current variable points to a task_struct structure with a process described in the kernel (PID, UID, GID, cmdline, namespaces, etc. The first idea was simply to change the current-> pid parameter from the kernel module to the desired one. static size_t device_read( struct file *filp, char *buffer, size_t length, loff_t * offset ) { printk( "PID: %d.\n",current->pid); current->pid = 1; printk( "new PID: %d.\n",current->pid); ,,, } To test the functionality of the module, I wrote a program in C ++: #include <iostream> #include <fstream> #include <unistd.h> int main() { std::cout << "My parent PID " << getppid() << std::endl; std::cout << "My PID " << getpid() << std::endl; std::fstream f("/dev/test",std::ios_base::in); if(!f) { std::cout << "f error"; return -1; } std::string str; f >> str; std::cout << "My new PID " << getpid() << std::endl; execl("/bin/bash","/bin/bash",NULL); } Load the module with the command instead, create/dev/test and try. [root@archilinux ~]# ./a.out My parent PID 293 My PID 782 My new PID 782 PID has not changed. Perhaps this is not the only place where the PID is indicated. Attempt # 2 additional PID fields If not current-> pid is the process ID, what is it? A quick scan of the code getpid () pointed to a task_struct structure that describes the Linux process and the pid.c file in the kernel source code. The desired function is __task_pid_nr_ns. In the function code there is a call to task-> pids [type] .pid, this parameter we will change. Let’s compile it and try again. Since we tested on SSH, we were able to get the output of the program before the kernel crashed: My parent PID 293 My PID 1689 My new PID 1689 The first result is already something. But PID still has not changed. Attempt # 3 non-exportable kernel symbols A more careful study of pid.c gave a function that does what we need static void __change_pid (struct task_struct * task, enum pid_type type, struct pid * new) The function takes a task for which it is necessary to change the PID, the PID type and, in fact, the new PID. The creation of a new PID is handled by the function struct pid * alloc_pid (struct pid_namespace * ns) This function accepts only the namespace in which the new PID will reside, this space can be obtained using task_active_pid_ns. But there is one problem: these kernel symbols are not exported by the kernel and can not be used in modules. In solving this problem I was helped by a wonderful article. The function code find_sym is taken from there. static asmlinkage void (*change_pidR)(struct task_struct *task, enum pid_type type, struct pid *pid); static asmlinkage struct pid* (*alloc_pidR)(struct pid_namespace *ns); static int __init test_init( void ) { printk( KERN_ALERT "TEST driver loaded!\n" ); change_pidR = find_sym("change_pid"); alloc_pidR = find_sym("alloc_pid"); ... } static ssize_t device_read( struct file *filp, char *buffer, size_t length, loff_t * offset ) { printk( "PID: %d.\n",current->pid); struct pid* newpid; newpid = alloc_pidR(task_active_pid_ns(current)); change_pidR(current,PIDTYPE_PID,newpid); printk( "new PID: %d.\n",current->pid); ... } Let’s compile it and try again. My parent PID 299 My PID 750 My new PID 751 Now PID has been changed! The kernel automatically allocated our program a free PID. But is it possible to use PID, which took another process, for example, PID 1? We add after the allocation code My parent PID 314 My PID 1172 My new PID 1 Let’s compile it and try again. My parent PID 314 My PID 1172 My new PID 1 Get the real PID 1. Bash has issued an error that prevents the switching of tasks on the% n command, but all other functions work fine. Interesting features of processes with a modified PID PID 0: cannot be logged out Let’s return to the code and change the PID to 0. newpid->numbers[0].nr = 0; Compiling and run it. My parent PID284 My PID 1517 My new PID 0 Is PID 0 not so special? Now let’s try to exit. The core falls! The kernel defined our task as IDLE TASK and, seeing the completion, just fell. Apparently, before the completion of our program should return a “normal” PID. The invisible process Let’s return to the code and expose the PID, guaranteed not to be occupied newpid->numbers[0].nr = 12345; Compiling and run it. My parent PID296 My PID 735 My new PID 12345 Let’s see what’s in the /proc 1 148 19 224 288 37 79 86 93 consoles fb kcore locks partitions swaps version 10 149 2 226 29 4 8 87 acpi cpuinfo filesystems key-users meminfo sched_debug sys vmallocinfo 102 15 20 23 290 5 80 88 asound crypto fs keys misc schedstat sysrq-trigger vmstat 11 16 208 24 291 6 81 89 buddyinfo devices interrupts kmsg modules scsi sysvipc zoneinfo 12 17 21 25 296 7 82 9 bus diskstats iomem kpagecgroup mounts self thread-self 13 176 210 26 3 737 83 90 cgroups dma ioports kpagecount mtrr slabinfo timer_list 139 18 22 27 30 76 84 91 cmdline driver irq kpageflags net softirqs tty 14 182 222 28 31 78 85 92 config.gz execdomains kallsyms loadavg pagetypeinfo stat uptime As you can see /proc does not define our process, even if we occupied a free PID. The previous PID also does not exist in /proc, and this is very strange. Perhaps we are in a different namespace and therefore are not visible to the main /proc. We’ll mount the new /proc, and see what’s there 1 14 18 210 25 291 738 81 9 bus devices fs key-users locks pagetypeinfo softirqs timer_list 10 148 182 22 26 296 741 82 90 cgroups diskstats interrupts keys meminfo partitions stat tty 102 149 19 222 27 30 76 83 92 cmdline dma iomem kmsg misc sched_debug swaps uptime 11 15 2 224 28 37 78 84 93 config.gz driver ioports kpagecgroup modules schedstat sys version 12 16 20 226 288 4 79 85 acpi consoles execdomains irq kpagecount mounts scsi sysrq-trigger vmallocinfo 13 17 208 23 29 6 8 86 asound cpuinfo fb kallsyms kpageflags mtrr self sysvipc vmstat 139 176 21 24 290 7 80 87 buddyinfo crypto filesystems kcore loadavg net slabinfo thread-self zoneinfo As before, our process does not exist, which means that we are in the usual namespace. Let’s check ps -e | grep bash 296 pts/0 00:00:00 bash Summary Only one bash, from which we started the program. There is no previous PID or current one on the list.
https://www.smartspate.com/can-change-pid-process-linux-using-kernel-module/
CC-MAIN-2019-30
refinedweb
1,287
68.4
The Problem WiX has been a wonderful tool for producing MSIs despite a handful of deficiencies. In a large project with multiple developers assemblies are added to and removed from the project on a continuing basis. Keeping WiX in sync with these changes is not well-supported. If an assembly is removed, WiX will complain that it can’t find the file and abort. New assemblies are a different story. Ideally, a new assembly would be added to a WiX project by having heat run on it, the resulting XML massaged, and inserted into the correct component group. There is no mechanism for doing this automatically at this point. My Solution In order to prevent the WiX project from producing an MSI with missing files, I wrote a custom MSBuild task to compare the contents of the application’s build directory with the WiX source code. If any extra files are found, the custom task logs each orphan as an error, and the WiX project fails to build. The following isn’t bullet-proof and lacks some necessary error checking, but I hope it sheds light on the core of my approach. Step 1: Create a Custom Build Task to Detect Orphans Creating the Custom Build Task I’ll not detail creating a custom build task here, but refer you to some articles I found most useful: - Bart de Smet’s excellent article The Custom MSBuild Task Cookbook - The MSDN reference pages - Marcin Kawalerowicz’s Writing MSBuild Custom Task The long and short of it is that a custom task is a simple class that descends from Microsoft.Build.Utilities.Task and overrides the Execute() method. Execute() returns a simple bool to indicate success or failure. Required Parameters This process needs two directories: where the application build files reside, and where the WiX source files reside. (This assumes that all respective files exist in a single directory.) namespace WiXInstallValidator { public class OrphanedFileCheck: Task { . . . [Required] public string ArtifactsDirectory { get; set; } [Required] public string WiXSourceDirectory { get; set; } The [Required] attribute ensures that the project file sets both of these parameters. Fetching the File Names In the Execute() method, loading the list of file names from the directories supplied by the ArtifactsDirectory and WiXSourceDirectory was straightforward. // // Extract list of WiX source files // IEnumerable lWixFiles = from f in System.IO.Directory.GetFiles(WiXSourceDirectory, "*.wxs") select f.ToLower(); // // DLLs that exist in the build artifacts directory // IEnumerable lBuildFiles = from f in System.IO.Directory.GetFiles(ArtifactsDirectory, "*.dll") select System.IO.Path.GetFileName(f).ToLower(); The WiX source files need the path since we’re going to actually open the files. The DLL names have the path stripped off since we’re going to compare them against the WiX source code. Extract Filenames from XML The WiX code is nothing special. I have a variable $(var.BuildRoot) that points to the directory where the DLLs are found. Thus a typical WiX source file has the form: . . .. . . XElement requires that we add the WiX namespace. I define that as a constant for code clarity. Thus the Linq code looks something like: private const string BUILD_ROOT = "$(var.BuildRoot)\\"; private const string WIX_NAMESPACE = "{}"; . . . // // Extract filenames from XML begining with $(var.BuildRoot) // IEnumerable lFilesInWiX = from f in lWixFiles from c in XElement.Load(f).Descendants(WIX_NAMESPACE + "File") where ((string)c.Attribute("Source")).StartsWith(BUILD_ROOT) select ((string)c.Attribute("Source")).Substring(BUILD_ROOT.Length).ToLower(); Compare the Lists of Files Determining if there are new files in danger of not being included in the MSI only requires the simple statement: // // Files in the build artifacts directory which aren't in WiX // IEnumerablelOrphanedFiles = lBuildFiles.Except(lFilesInWiX); Informing the User of Orphans To create a nice list of errors, one uses the Log.LogError() method thus: foreach (string s in lOrphanedFiles) Log.LogError("The file {0} appears to be missing from the WiX source code.", s); Wrapping Up the Custom Task Lastly, the custom task returns a boolean indicating success or failure. return lOrphanedFiles.Count() == 0; Step 2: Inserting the Custom Task Into the WiX Build Including the Extension The WiX project file has the extension wixproj. First we have to make MSBuild aware of the extension. . . .. . . This is straight out of the articles on writing MSBuild custom tasks that I listed above. Triggering the Extension Again, this is straight out of the articles on writing MSBuild custom tasks that I listed above. There are some comments in the default WiX project file showing where to add custom tasks. Conclusion That’s it! This is something that I don’t do often, so recorded my personal notes here in case somebody else might benefit from my working through the problem. Credits Thanks to the wonderful WiX mailing list members, especially Simon and Blair who pointed me in this general direction. Updates - 2010-01-21 - Added ToUpper() to the Linq expressions to avoid false positives due to case sensitivity.
http://jamesreubenknowles.com/rudamentary-wix-orphan-prevention-812
CC-MAIN-2017-13
refinedweb
814
56.15
Answered: sencha create jsb gives [Ext.Loader] Failed loading Answered: sencha create jsb gives [Ext.Loader] Failed loading We have couple ST 2.0 projects, and they all share certain common classes. So we concat common classes into an js called: 'architecture.js'. Here is some sample inside architecture.js: Code: Ext.define('Test.store.Base', { extend: 'Ext.data.Store', findExactRecord: function(field, attr) { return this.getAt(this.findExact(field,attr)); } }); Ext.define('Test.store.Settings', { extend: 'Test.store.Base', config: { model: 'Test.model.Setting', storeId: 'Settings', autoLoad: true, autoSync: true } }); app.js looks like this: Code: Ext.Loader.setPath({ 'Ext': 'sdk/src' }); Ext.application({ name: 'TESSTime', requires: [ 'Ext.MessageBox', 'Test.common.Settings', 'appShared.common.Settings', 'appShared.utility.DltkWriter' ], ... Code: // ... "js": [ { "path": "sdk/sencha-touch.js" }, { "path": "scripts/architecture.js", "update": "delta" }, { "path": "scripts/tessshared.js", "update": "delta" }, { "path": "app.js", "bundle": true, /* Indicates that all class dependencies are concatenated into this file when build */ "update": "delta" } ], // ... Code: Error thown from your application with message: Error: [Ext.Loader] Failed loading 'Test/store/Base.js', please verify that the file exists. I thought since Test.store.Base is defined before Test.store.Settings. The class loader should find it. Can anyone shed some lights on what is the problem? Thanks Instead of loading a separate JS file, I would have each class in it's own file. I would then set a path for the common classes who have their own namespace. And then require the classes I need. One more note. If I commented out app.js section in the app.json, it gives the same error. Any idea? - Join Date - Mar 2007 - Location - Gainesville, FL - 37,327 - Answers - 3540 - Vote Rating - 850 Instead of loading a separate JS file, I would have each class in it's own file. I would then set a path for the common classes who have their own namespace. And then require the classes I certainly works. I was trying to see if combining them into one JS works.
http://www.sencha.com/forum/showthread.php?218086-sencha-create-jsb-gives-Ext.Loader-Failed-loading&p=830510
CC-MAIN-2014-42
refinedweb
335
55.61
An open source, header-only library that provides fast, immutable, constexpr-compatible implementation of std::set, std::map, std::unordered_map and std::unordered_set to C++14 users. It can be used as an alternative to gperf. Introduction I've always been frustrated, when initializing a const std::set<int> keys = {1, 2, 3}, to see that the structure is initialized at runtime. Gast, it's marked as const! Couldn't this be a simple binary search in a sorted, constant array of ints? And what about this one: const std::unordered_set<int> keys = {4, 5, 6}? By the eyes of my Bonnie Mary, one could find a hash function without collision for these three little pigs and use it, instead of doing the whole stuff at runtime! This should even make lookup faster, right? Actually, there already exists solutions to the second problem, known as perfect minimal hashing. You may have heard of gperf. It does exactly what we want: take a list of values, find a collision-free hash function for these values and generate the appropriate C code. It slightly complicates the build but it gets the jobs done. This article uses C++14-powered constexpr to solve both issues, initializing containers at compile time, resulting in 0-cost initialization and fast lookup. The whole stuff is bundled in the frozen library. It's available under the Apache license 2.0 on github. std::set<> and std::map<> std::set<> and std::map<> are standard containers that only require their keys to be comparable. The lookup is required to be in \(\mathcal{O}(log(n))\) and the implementation is usually based on a red-black tree to keep a balanced tree. The lookup is done using a binary search. For an immutable set, there's no need for a red-black tree, a plain sorted array is enough. The constexpr constructor is in charge of sorting the initializer list, storing it into the array and then, the lookup is implemented using a standard binary search. From the user point of view, the structure declaration only requires an extra size template parameter: #include <frozen/set.h> constexpr frozen::set<int, 3> keys = {1, 2, 3}; int some_user(int key) { return keys.count(key); } Because keys is used in a non-constexpr context by some_user, it does not only live in the constexpr world. Let's have a look at the generated assembly to find out why: 0000000000000000 <_Z9some_useri>: 0: 83 ff 02 cmp edi,0x2 3: 7e 10 jle 15 <_Z9some_useri+0x15> 5: b8 03 00 00 00 mov eax,0x3 a: 83 ff 03 cmp edi,0x3 d: 74 0e je 1d <_Z9some_useri+0x1d> f: 31 c0 xor eax,eax 11: 0f b6 c0 movzx eax,al 14: c3 ret 15: 0f 94 c0 sete al 18: 0f b6 c0 movzx eax,al 1b: ff c0 inc eax 1d: 39 f8 cmp eax,edi 1f: 0f 9e c0 setle al 22: 0f b6 c0 movzx eax,al 25: c3 ret The binary search is actually unrolled, and the keys are set as immediate operands. Brest! When trying with a larger set of elements, the unrolling + inlining still works nicely and the body of the lookup ends in a very large function, without any function call. Implementation detail The binary search is implemented as a recursive function, specialized for the size of the current range. This takes advantage of the compile-time information on the set size, and ends up with a fully unrolled lookup. The text-book iterative algorithm uses a while loop which performs very badly in that case, while this version plays very well with the compiler, or at least with Clang 5. Note that fully unrolling the binary search may be a bad choice, especially if it happens to stress the instruction cache too much. Yet, it works flawlessly for small sets! template <class T, class Compare> struct LowerBound { T const &value; Compare const &compare; constexpr LowerBound(T const &value, Compare const &compare) : value(value), compare(compare) {}; if (compare(*it, value)) { auto constexpr next_count = N - (step + 1); return doit(it + 1, std::integral_constant<std::size_t, next_count>{}); } else { auto constexpr next_count = step; return doit(first, std::integral_constant<std::size_t, next_count>{}); } } }; /*...*/ std::unordered_set<> and std::unordered_map<> The main feature of frozen is a static version of std::unordered_set<> and std::unordered_map<>. Finding a collision-free hashing function for a given set of keys is a well-studied problem, known as perfect (eventually minimal) hashing problem. I did not invent anything here, just read this great blogpost that provides a simple algorithm in Python, converted into a constexpr version and voilà. For the lazy ones, the whole idea is to use a first regular hashing function and fill the buckets. For those with collisions, order by number of collisions, we iteratively try another hashing function parametrized by a seed. Once we find a seed parameter that makes all keys fall into an empty slot, we move to the next bucket and so on until only collision-free entries are left, then we put them into the empty slots. This uses an auxiliary table to hold the extra seeds and collision-free displacements. Using this algorithm, it's possible to declare a frozen unordered set like this: #include <frozen/unordered_set.h> constexpr frozen::unordered_set<int, 3> keys = {1,2,4}; int some_user(int key) { return keys.count(key); } with the guarantee that the frozen::unordered_set<int, 3>::count(int) call is collision-free. The assembly dump of the some_user function tells us more about the implementation: 0000000000000000 <_Z9some_useri>: 0: 89 f8 mov eax,edi 2: 83 e0 03 and eax,0x3 5: 48 8b 04 c5 00 00 00 mov rax,QWORD PTR [rax*8+0x0] c: 00 d: 48 85 c0 test rax,rax 10: 78 45 js 57 <_Z9some_useri+0x57> 12: 48 63 cf movsxd rcx,edi 15: 48 31 c8 xor rax,rcx 18: 48 89 c1 mov rcx,rax 1b: 48 f7 d1 not rcx 1e: 48 c1 e0 15 shl rax,0x15 22: 48 01 c8 add rax,rcx 25: 48 89 c1 mov rcx,rax 28: 48 c1 e9 18 shr rcx,0x18 2c: 48 31 c1 xor rcx,rax 2f: 48 69 c1 09 01 00 00 imul rax,rcx,0x109 36: 48 89 c1 mov rcx,rax 39: 48 c1 e9 0e shr rcx,0xe 3d: 31 c1 xor ecx,eax 3f: 6b c1 15 imul eax,ecx,0x15 42: 89 c1 mov ecx,eax 44: c1 e9 1c shr ecx,0x1c 47: 31 c1 xor ecx,eax 49: 89 c8 mov eax,ecx 4b: c1 e0 1f shl eax,0x1f 4e: 29 c8 sub eax,ecx 50: f7 d8 neg eax 52: 83 e0 03 and eax,0x3 55: eb 03 jmp 5a <_Z9some_useri+0x5a> 57: 48 f7 d0 not rax 5a: 48 8b 0c c5 00 00 00 mov rcx,QWORD PTR [rax*8+0x0] 61: 00 62: 31 c0 xor eax,eax 64: 39 3c 8d 00 00 00 00 cmp DWORD PTR [rcx*4+0x0],edi 6b: 0f 94 c0 sete al 6e: c3 ret The first and performs the first (simplistic) hashing. Then it performs a lookup in the auxiliary table and based on the result, it either computes the auxiliary hash (based on the extra seed from the auxiliary table), or directly picks the index. Either way, it performs the comparison between the argument and the candidate and returns the result. The string Case A typical candidate for use with frozen are... strings. And because std::string cannot be used in a constexpr environment and std::string_view is only available in C++17 (with a constexpr constructor!), frozen provides a frozen::string class that acts as a view on existing data. The operator""_s can be used to easily convert C-style strings to this class. Bonus: Usage in Constant Context That's anecdotal, but the following is possible with frozen: constexpr frozen::unordered_set<int, 4> UnluckyNumbers = { 4, // from china 9, // from japan 17, // from Italy 13, // Triskaidekaphobia }; constexpr int value = ...; static_assert(!UnluckyNumbers.count(value), "you're program is ill-blessed in some geographical location!"); Comparison to gperf The gperf tool proposes an ahead-of-time compiler that generates perfect, minimal hash. Consider this list of words, listed in the gperf input file format: %% %% Running gperf titan.in > titan.c produces a C file that contains a const char * in_word_set(const char *str, unsigned int len) function to perform the check. The equivalent C++ code based on frozen is the following, using frozen::string: #include <frozen/unordered_set.h> #include <frozen/string.h> using namespace frozen::string_literals; constexpr frozen::unordered_set<frozen::string> Titans = { "Coeus"_s, "Crius"_s, "Cronus"_s, "Hyperion"_s, "Iapetus"_s, "Mnemosyne"_s, "Oceanus"_s, "Phoebe"_s, "Rhea"_s, "Tethys"_s, "Theia"_s, "Themis"_s, "Asteria"_s, "Astraeus"_s, "Atlas"_s, "Aura"_s, "Clymene"_s, "Dione"_s, "Helios"_s, "Selene"_s, "Eos"_s, "Epimetheus"_s, "Eurybia"_s, "Eurynome"_s, "Lelantos"_s, "Leto"_s, "Menoetius"_s, "Metis"_s, "Ophion"_s, "Pallas"_s, "Perses"_s, "Prometheus"_s, "Styx"_s, }; The benchmarking program is the following: #include <iostream> #include <string> #include <unordered_set> #include <chrono> int main() { const std::unordered_set<std::string> Titans = { ", }; std::string line; unsigned count = 0; std::chrono::duration<double, std::milli> duration{0}; while(std::cin) { std::getline(std::cin, line); auto start = std::chrono::steady_clock::now(); if(Titans.count(line)) count += 1; auto stop = std::chrono::steady_clock::now(); duration += stop - start; } std::cout << "duration: " << duration.count() << " ms" << std::endl; std::cout << count << std::endl; return 0; } Yes, it's probably I/O bound, but as we only measure the hashing time, it still gives a hint on the hashing time when the key is not in the set. And here is the result, using /usr/share/dict/british-english-large as input (fun fact: 13 titans are present in this dictionary): So frozen is within the reach of gperf, and both are way faster than the standard solution. That's still frustrating. Fortunately, we could change the hashing function (djb2 and FNV-1a) generator used by frozen to improve this situation. The default is: template <> struct elsa<string> { constexpr std::size_t operator()(string value) const { std::size_t d = 5381; for (std::size_t i = 0; i < value.size; ++i) d = (d * 33) + value.data[i]; return d; } constexpr std::size_t operator()(string value, std::size_t seed) const { std::size_t d = seed; for (std::size_t i = 0; i < value.size; ++i) d = (d * 0x01000193) ^ value.data[i]; return d; } }; But using the much simpler: struct olaf { constexpr std::size_t operator()(frozen::string value) const { return value.size; } constexpr std::size_t operator()(frozen::string value, std::size_t seed) const { std::size_t d = seed; std::size_t bound = std::min(value.size, (std::size_t)2); for (std::size_t i = 0; i < bound; ++i) d = (d * 0x01000193) ^ value.data[i]; return d; } }; constexpr frozen::unordered_set<frozen::string, 33, olaf> Titans = {...}; We get the same timings as gperf \o/. This generator is less robust though, so not suitable as a default. Conclusion Programming with constexpr in the post C++14 world is great. It makes it possible to achieve the same job as code generator while only relying on a standard C++ compiler. And in the case of perfect hashing, it gives very interesting result! One note though: on my laptop, using frozen with GCC is currently a pain, because the compiler hangs for no apparent good reason; Let's report this! Thanks First, thanks to Steve Hanov for his great blog. Then thanks to Romain and Adrien for their feedback, and all the Quarkslab proof readers, especially w1gz!
https://blog.quarkslab.com/frozen-an-header-only-constexpr-alternative-to-gperf-for-c14-users.html
CC-MAIN-2021-39
refinedweb
1,939
58.11
If a plain BasicConfigurator.configure() is called in an application after the HierarchyMBean is instantiated, then an exception is thrown trying to create an ObjectName for the appender based on the Appender's name property, which is initialised to null, and is not allowed. Instead, the LoggerDynamicMBean class should be defensive when creating a Appender MBean's by detecting a null/empty string name and at least trying to use .toString() to construct a logical display name. I have a simple patch for this that I'm just testing, it basically resorts to defensively using the Appender.toString() in an attempt to get at least a value for the JMX namespace. If that fails, well, then you're screwed still. You'll find here a collection of mistakes and errors. Most are easy to fix. The entire log4j project is available here : If of interest for you, thanks for your (positive..) feedback. Paul, do you want to submit your patch? Created attachment 23112 [details] Patch that fixes the null appender name Note: This is a direct diff of my workspace, which also includes a change to test/build.xml to remove the ErrorHandler test that just doesn't pass on my computer for some unknown reason (before and after my change). We've been using this change in production for 2 months now with no problems. Committed changes in rev 734480. I did a few things different than Paul's patch. First, Paul's patch used a package visible static method to handle the logic to get a name from the appender. I moved the function into a common ancestor and made it protected. Also, Paul's patch removed use of the layout from the AppenderDynamicMBean name. That may be a desirable change, but it wasn't part of this bug report.
https://bz.apache.org/bugzilla/show_bug.cgi?id=46163
CC-MAIN-2017-47
refinedweb
302
65.42
Member Since 4 Years Ago 2 Why Unable To Access The Global Function In Vuelidate Message? I have a global translate function imported in my app.js. export default { methods: { __(key, replace = {}) { ... } } } -- validations: { form: { name: { required: helpers.withMessage(this.__('common.name'), required), }, } It works fine in other method but i just can't use it to translate message in validations. It shows undefined __ I am using Vuelidate package and the error as shown below Uncaught TypeError: Cannot read property '__' of undefined at Module../node_modules/babel-loader/lib/index.js??clonedRuleSet-5.use[0]!./node_modules/vue-loader/dist/index.js??ruleSet[0].use[0]!./resources/app/views/auth/SignUpProfile.vue?vue&type=script&lang=js Replied to How To Setup Microservices In Laravel? Alright, thanks guys for the valued feedback! Replied to How To Setup Microservices In Laravel? Alright, so meaning that if we can do it in monolithic way then it's better just stick to it for this cases. Where micro-services take places only if services can be independent and not belong to each other. Thus, will need to call multiple API just to get a single resource which is expensive. But then if apply on login services, mail services... still acceptable? Is it because if the services too dependent on each others then it's better not to separated them "into smaller, multiple apps". Are we still allowed to like passing an id and get data from a service (e.g. to check user profile, user is a service and is independent)? Replied to How To Setup Microservices In Laravel? Sorry, maybe I am wrong. From what i know here, let's take an example like simple blog app I separated into 3 backend microservices which are users, These 3 backend microservices are small laravel application. In Posts service will consist only posts and user_id and everything just related to post. In Users service just basically to store the user details. In When i want to get a response with data of user, comment, then i need to call these services from my controller and return to my frontend. CMIIW, I am not sure if this is right. Do you have any resources to share / sample output with description where can help to understand the implementation better if my concept was wrong. Appreciated it, thanks. Replied to How To Setup Microservices In Laravel? Great, thanks. I am not sure how big it will grows. But, definitely will more than Admin, customer, product & services, order etc. So in this case, better to stick with laravel relations, and migrate to microservices if needed in future? And running microservices could be quite expensive right? And also would like to know how would it looks like if implemented as microservices. As what i know so far, every services is a laravel application then with it own database and store related data and using ID to connect each other. Am i right? Started a new Conversation How To Setup Microservices In Laravel? For example, I have a marketplace to sell my product and services. I separated it into admin, customer, product & services, order, checkout, mail services... etc Is it mean that each services is an laravel application then communicate with each other? Means it's like duplication set of application from here, but database just store needed data and use api to get more info from other services? I am new to it and still learning, hope to get feedback,, thanks Replied to Encounter Issue When Install Dingo/api Package yes, this is my composer.json { "name": "laravel/laravel", "type": "project", "description": "The Laravel Framework.", "keywords": ["framework", "laravel"], "license": "MIT", "require": { "php": "^7.3|^8.0", "brick/money": "^0.5.2", "fideloper/proxy": "^4.4", "fruitcake/laravel-cors": "^2.0", "guzzlehttp/guzzle": "^7.3", "laravel/breeze": "^1.1", "laravel/framework": "^8.12", "laravel/passport": "^10.1", "laravel/socialite": "^5.2", "laravel/tinker": "^2.6", "league/fractal": "^0.19.2", "phpfastcache/phpfastcache": "^8.0", "raiym/instagram-php-scraper": "^0.11.1", "spatie/laravel-permission": "^4.0", "wulfheart/pretty_routes": "^0.2.0", "ylsideas/feature-flags": "^1.4" }, "require-dev": { "barryvdh/laravel-debugbar": "^3.5", "facade/ignition": "^2.5", "fakerphp/faker": "^1.9.1", "laravel/sail": "^1.0.1", "mockery/mockery": "^1.4.2", "nunomaduro/collision": "^5.0", "phpunit/phpunit": "^9.3.3" }, "autoload": { "psr-4": { "App\": "app/", "Database\Factories\": "database/factories/", "Database\Seeders\": "database/seeders/", "P1\": "src/" } }, "autoload-dev": { "psr-4": { "Tests\": "tests/" } }, "scripts": { "post-autoload-dump": [ "Illuminate\Foundation\ComposerScripts::postAutoloadDump", "@php artisan package:discover --ansi" ], "post-root-package-install": [ "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" ], "post-create-project-cmd": [ "@php artisan key:generate --ansi" ] }, "extra": { "laravel": { "dont-discover": [] } }, "config": { "optimize-autoloader": true, "preferred-install": "dist", "sort-packages": true }, "minimum-stability": "dev", "prefer-stable": true } Started a new Conversation Encounter Issue When Install Dingo/api Package I am having issue installing dingo/api package. This is the problem show Problem 1 - Root composer.json requires dingo/api ^0.10.0 -> satisfiable by dingo/api[v0.10.0]. - dingo/api v0.10.0 requires illuminate/routing 5.1.* -> found illuminate/routing[v5.1.1, ..., 5.1.x-dev] but these were not loaded, likely because it conflicts with another require. I am using laravel 8 and PHP 8 for now. Replied to How To Share Variable Within App.js And Other Js In Vue ahh yes, my mistake but i encounter another issue as shown below. Is it something wrong with my progress bar? app.js:385623 Uncaught TypeError: o is not a constructor at Object.install (app.js:385623) at Object.use (app.js:128209) at Module../resources/app/app.js (app.js:192449) at __webpack_require__ (app.js:423299) at app.js:423461 at Function.__webpack_require__.O (app.js:423336) at app.js:423463 at app.js:423465 Solved -- due to vue version issue Started a new Conversation How To Share Variable Within App.js And Other Js In Vue I have an issue on the var not defined when trying to separate the thing in another js. E.g. This is my app.js import { createApp } from "vue"; import App from "./App.vue"; import router from "./router"; import store from "./store"; import globalComponents from "./global-components"; import utils from "./utils"; import "./libs"; // Import progressbar require('./progressbar'); const app = createApp(App) .use(store) .use(router); In my progressbar.js import VueProgressBar from 'vue-progressbar'; app.use(VueProgressBar, { color: 'rgb(143, 255, 199)', failedColor: 'red', height: '4px', transition: { speed: '0.4s', opacity: '0.6s', termination: 300 }, }) Just curious can i do it in this way? Or i can only achieve by putting them in app.js? Replied to Error When Trying To Implement Laravel Translation Into Vuejs File Oops, it should be fine now. Just my mistake on key. Thank you! Replied to Error When Trying To Implement Laravel Translation Into Vuejs File Yes, i fixed it with that way. But i am having another issue after that on the translation part. When i am calling this __('I am something') will return {'i_am_something': 'I am something'} instead of I am something. I am trying to translate my key. Started a new Conversation Error When Trying To Implement Laravel Translation Into Vuejs File I am encountering an issue when trying to implement laravel translation into vuejs app.js:417882 Uncaught Error: ES Modules may not assign module.exports or exports.*, Use ESM export syntax, instead: ./resources/app/translation.js at Object.set [as exports] (app.js:417882) at Module../resources/app/translation.js (app.js:191861) at __webpack_require__ (app.js:417794) at Module../resources/app/app.js (app.js:190194) at __webpack_require__ (app.js:417794) at app.js:417971 at Function.__webpack_require__.O (app.js:417831) at app.js:417973 at app.js:417975 My app.js import { createApp } from "vue"; import App from "./App.vue"; import router from "./router"; import store from "./store"; import globalComponents from "./global-components"; import utils from "./utils"; import "./libs"; // SASS Theme import "./assets/sass/app.scss"; const app = createApp(App) .use(store) .use(router); globalComponents(app); utils(app); app.mount("#app"); createApp(App).mixin(require('./translation')) translation.js } }, } I am following the step here to implement laravel translation. Am i doing it wrongly? Or what did i missing out here? Replied to User Will Be Logged Out After Deployment Made Oh, thanks. But usually where do we placed the key besides storage? Can i create a same level dir with storage and load the key from there? Started a new Conversation User Will Be Logged Out After Deployment Made I have an issue where user always to be logged out after deployment. I am using fix APP_KEY and laravel passport package. Is it because public oauth and private oauth key file stored in storage always being cleared caused the issue? Replied to How To Merge Array Object Nested Value? oh ya, forgot to mention. Yes, i am doing it in vue js. Started a new Conversation How To Merge Array Object Nested Value? I have an array object which look like this [{ id: 1 description: 'test parent' child: [{.id: 100, description: 'test child' }] }] Another array object look like this [{ id: 1 }, { id: 100 }] How can i merge the bottom array object into this [{ id: 1, description: 'test parent' }, { id: 100, description: 'test child' } ] Started a new Conversation How To Group Country-state-city Based On Parent_id? I am trying to group country, state, and city into one list. The data stored as this format ... id, parent_id, name, type 1, null, "Singapore", "country" 2, 1, "Singapore", "state" 3, 2, "Ang Mo Kio", "city" 4, 2, "Jurong West", "city" The way i am using is looping the table where store the country-state-city. $table = Table::all(); foreach($table as $t) { if($t->type === "country") {} if($t->type === "state") {} if($t->type === "city") {} } Is there an elegant way to achieve this? Started a new Conversation How To Allow Only Single Root Node Being Selected, And Allowed Multiple Selection For Child Node On Vue-treeselect? This is the package () used for my dropdown. I have a requirement where I want to have the user to select only one of the root nodes but one or multiple of child nodes. The dropdown has three levels. <treeselect ref="treeselect" v- // js handleSelect({ id }) { const { treeselect } = this.$refs const node = treeselect.getNode(id) let newValue if (node.isLeaf) { const { parentNode } = node if (parentNode && !treeselect.isSelected(parentNode)) { newValue = [ id ] } } else { newValue = [ id ] treeselect.traverseDescendantsBFS(node, descendant => { newValue.push(descendant.id) }) } if (newValue) setTimeout(() => { this.value = newValue }) }, For the current function, it only allowed to select one child. My expected output // e.g. 1 - [ ] a - [ ] aa - [ ] ab - [x] b - [x] ba - [x] byebye - [x] byebye - [x] byebye // e.g. 2 - [ ] a - [ ] aa - [ ] ab - [ ] b - [ ] ba - [ ] byebye - [ ] byebye - [x] byebye // e.g. 3 - [ ] a - [ ] aa - [ ] ab - [ ] b - [ ] ba - [x] baa - [ ] bab - [x] bb - [x] bba - [x] bbb How should I enhance my function to achieve the following circumstances? Replied to Call Seeder From Migration Yeah, i am thinking that too. Just they are asking me to do it. I am questioning them same thing too, as long as i am preventing duplication data to be inserted then should be fine. There's will be hard if we are removing everything inserted where dependency was there. Actually the seeder here just act as new data insert like cities where i don't write again the query to insert the data where already implemented in seeder. Replied to Call Seeder From Migration Alright, thanks for the suggestion. But what if going to rollback the data insertion, is that make sense to remove the data inserted using down()? Myself don't think that make sense to do it. Replied to Call Seeder From Migration You mean here where we just run the seed command manually ourself instead made use migration command during deployment right? Replied to Call Seeder From Migration Because i need to add new country data into my table. Any better suggestion how can i do this? Started a new Conversation Call Seeder From Migration Anyone can guide me, if migration up() call a seeder, what should i actually do with the down()? Is it truncate the table? public function up() { // Call seeder Artisan::call('db:seed', [ '--class' => 'BaseDataSeeder', ]); } Replied to How To Write A Test Case For Generate PDF? Yes, it works fine for my previous test on generate PDF. I am using DOMPDF Oh, what i mean is to check the value passed into pdf e.g. I am populating my PDF with the value $model->name, $model->created_at. Do i really need a test on this and how can the test be done actually? Replied to How To Write A Test Case For Generate PDF? I am doing it in this way public function test_can_generate_pdf() { PDF::shouldReceive('loadView') ->once() ->andReturnSelf() ->getMock() ->shouldReceive('download') ->once() ->with('welcome.pdf') ->andReturn('THE_PDF_BINARY_DATA'); $this->get('/download') ->assertSuccessful() ->assertSeeText('THE_PDF_BINARY_DATA'); } Sorry i am still new to test stuff, i stucked when i am going to check with the data pass into the loadView to generate PDF. In my controller, public function generatePDF(Model $model) {} Basically i just throw $model to the view to generate PDF. How can i test on the data needed for the pdf? Not sure how i am going to test on this. Started a new Conversation How To Write A Test Case For Generate PDF? How do i test if i passed correct data to generate PDF? $data = Model::where('id', 1)->first(); $date = Carbon::parse($data->created_at)->format('d/m/Y'); $pdf = PDF::loadView('printPDF', compact('data', 'date')); return $pdf->download($data->runningNumber . '.pdf'); This is the sample of my controller. How can i create a test case for this? I want to check the $data passed to the view to generate the PDF. Replied to How To Save Null Value Into Date Column Format? It's just simple date format column. Already set ->nullable()->default(null) for table. $track = new Track(); $track->parcel_delivery_date = null; // when i pass null it will automatic set as today's date $track->save() Just something like. Replied to How To Save Null Value Into Date Column Format? no, is another date column Replied to How To Save Null Value Into Date Column Format? My table already set to nullable, but it doesn't taking any effect. It will auto set to today's date. Started a new Conversation How To Save Null Value Into Date Column Format? I am having trouble when trying to update date column with null value. I found that null value unable to override the value stored in the date column. How can i update it with null value? Replied to How To Validate Date And Time? Alright, thanks. Started a new Conversation How To Validate Date And Time? I have a validation as shown below 'date' => 'nullable|date_format:Y-m-d|after_or_equal:today', 'time' => 'nullable|date_format:H:i' When i am testing with data today data with past time. It still allowed me to pass. How can i validate if today date and time must be greater or equal time now? Replied to Is There A Better Way To Grouping An Array Parent And Child? How will it looks like if go for readability? Started a new Conversation Vue Unable To Load Image I have an issue with image display where it shows [object Module] for the image src. This is my webpack config const mix = require("laravel-mix"); const path = require("path"); const tailwindcss = require("tailwindcss"); const { styles } = require("@ckeditor/ckeditor5-dev-utils"); const CKERegex = { svg: /ckeditor5-[^/\]+[/\]theme[/\]icons[/\][^/\]+\.svg$/, css: /ckeditor5-[^/\]+[/\]theme[/\].+\.css/, }; /* |-------------------------------------------------------------------------- | Mix Asset Management |-------------------------------------------------------------------------- | | Mix provides a clean, fluent API for defining some Webpack build steps | for your Laravel applications. By default, we are compiling the CSS | file for the application as well as bundling up all the JS files. | */ Mix.listen("configReady", (webpackConfig) => { const rules = webpackConfig.module.rules; const targetSVG = /(\.(png|jpe?g|gif|webp)$|^((?!font).)*\.svg$)/; const targetFont = /(\.(woff2?|ttf|eot|otf)$|font.*\.svg$)/; const targetCSS = /\.p?css$/; for (let rule of rules) { if (rule.test.toString() === targetSVG.toString()) { rule.exclude = CKERegex.svg; } else if (rule.test.toString() === targetFont.toString()) { rule.exclude = CKERegex.svg; } else if (rule.test.toString() === targetCSS.toString()) { rule.exclude = CKERegex.css; } } }); mix.alias({ "@": path.join(__dirname, "resources/app"), "~": path.join(__dirname, "node_modules"), }); mix .js("resources/app/app.js", "public/dist/js") .vue() .sass("resources/app/assets/sass/app.scss", "public/dist/css") .options({ processCssUrls: false, postCss: [tailwindcss("./tailwind.config.js")], }) .autoload({ "cash-dom": ["cash"], "@popperjs/core": ["Popper"], }) .webpackConfig({ module: { rules: [ { test: CKERegex.svg, use: ["raw-loader"], }, { test: CKERegex.css, use: [ { loader: "style-loader", options: { injectType: "singletonStyleTag", attributes: { "data-cke": true, }, }, }, "css-loader", { loader: "postcss-loader", options: { postcssOptions: styles.getPostCssConfig({ themeImporter: { themePath: require.resolve( "@ckeditor/ckeditor5-theme-lark" ), }, minify: true, }), }, }, ], }, ], }, }) .browserSync({ proxy: "vue-laravel.test", files: ["resources/**/*.*"], }); Can i know which configure wrong that caused the issue? Started a new Conversation Is There A Better Way To Grouping An Array Parent And Child? I have an array in this format "child_1" => [ ...... "parents" => [ ....... ] ] "child_2" => [ ...... "parents" => [ ....... ] ] How can i make it parents with many childs? "parents" => [ .... "childs" => [ "child_1" => [], "child_2" => [], "child_3" => [] ] ] I am using foreach to loop again and reassign into a new array. Is there any better approach to achieve this? $arr = []; foreach ($array as $data) { $arr[$data->parent_id] = $data->parent $arr[$data->parent_id]["childs"] = $data } Replied to What Is The Good Design For Multiple Social Login Database On User? So how was thing going on, e.g. a user use multiple social account to login. There might be some info different like profile photo, are we going to display the info based on social account or ignore it. Allowed them to login and just show the registered details at first? Started a new Conversation What Is The Good Design For Multiple Social Login Database On User? I am looking for an idea on designing table for user login with SSO/ traditional way. Basically, i am using one table to do the job by identify the provider_type and provider_key. I am thinking whether to separate it out into multiple table for social provider or 2 tables (user and provider). Is it legit if every social account is linked to each other and access to same user? Or as a new user for each social account? Or it depends on business model? What do you guys think of it? Appreciated for the feedback. Thanks! Replied to How To Assign Array Value Based On Key To A Class Public Properties? The error show Typed property ...::$customer must be an instance of .....\Entities\Customer, array used Started a new Conversation How To Assign Array Value Based On Key To A Class Public Properties? I have a class with public properties. public string $id; public Customer $customer; I have an array $data = ['id' => 1, ['customer' => [........] ] protected function transform(array $data): void { foreach ($data as $key => $value) { $this->$key = $value; } } How can i assign into the Customer with the loop above? Started a new Conversation How To Assign Value Based On Key Without Needed To Assign One By One? I have a class class user() { public string $id; public string $first_name; public string $last_name; } I want to assign value into user() based on the array i get $array = [ 'id' => 1, 'first_name' => 'james'. 'last_name' = > 'tan' ] $user = new user(); $user->id = .....; Is there a way used to map automatically without needed to reassign? Started a new Conversation How To Prevent User From A Group To Access Other Group Resources? I am implement API with passport, whoever own the bearer token can access to any user resource with the API. E.g. order/1 , which belong to user A in company A but user B from other company also can access as long as got their own bearer token. How could i restrict only to a group of user from a company which allow to view the order? What is the method used to restrict resources being retrieved by others for api? Started a new Conversation How To Convert Camel Case Into Snake Case When Store Into Database As Json? I have an entity as shown below class Entity { public string uuid; public string customerName; ...... } In my controller $data = collect(new Entity ( 'b5b436f6-7a8b-4a5b-ae59-3754517d4ada' 'John' ))->toJson(); When converted into json, it will show {"uuid":"b5b436f6-7a8b-4a5b-ae59-3754517d4ada", "customerName":"John"}', i want it to be {"uuid":"b5b436f6-7a8b-4a5b-ae59-3754517d4ada", "customer_name":"John"}' Replied to I Am Trying To Inject My Route Params Into My Model But Show 404 I am using passport, not sure why not working. Is my params wrong defined wrong so not able to do injection Started a new Conversation I Am Trying To Inject My Route Params Into My Model But Show 404 This is my route DELETE | /api/v1/order/{order} I am passing my id /api/v1/order/1 to delete function in my controller In my controller, i am using use App/Models/OrderEvents as Order public function delete(Order $order) {} Am i doing in wrong way? It shows me 404 after i call my api. Replied to Can Laravel Event Sourcing (spatie) Create Multiple Snapshots Table? so meaning that i am wrong and can't use this method to achieve something like order event history? Instead of storing it in 1 snapshot table. I store it separately based on the event happened. Replied to Can Laravel Event Sourcing (spatie) Create Multiple Snapshots Table? to store snapshot for order like purchase, sale, invoice...etc in separate table Started a new Conversation Can Laravel Event Sourcing (spatie) Create Multiple Snapshots Table? Is there possible for laravel event sourcing (spatie) package to use multiple snapshots table or events table? It looks like config there only able bind to only one snapshot repo and event repo. Anyone tried before? Replied to Which Approaches Better For REST API Params? How about for product with price? Pass price as well then backend to verify if not same then throw price updated? Started a new Conversation Which Approaches Better For REST API Params? If i want store data as history. Should i pass only the id field and then retrieve record based on id, or pass all the info needed and store it in database? Which one is correctly being used?
https://laracasts.com/@crazylife
CC-MAIN-2021-25
refinedweb
3,717
60.21
Confession: I never understood a thing about pluggable adapters in the Gang of Four book. I have read that section on more than one occasion and not understood a damn word. So it seems like good grist for a blog post. Part of my confusion is that I am not 100% clear on what is meant by the term. When first introduced in the book, a pluggable adapter describes "classes with built-in interface adaption." I am unclear on what "built-in" means and what gets it (the adapter or adaptee). Later, they describe a reusable widget that needs to work with similar objects even if they have different interfaces. I am going to focus on that second idea for now. Maybe I can figure out what they mean in the first definition for a follow-up post. I am still working with my RobotDart class that moves in different directions via a single move()method: enum Direction { NORTH, SOUTH, EAST, WEST } class Robot { int x=0, y=0; String get location => "$x, $y"; void move(direction) { print(" I am moving $direction"); switch (direction) { case Direction.NORTH: y++; break; case Direction.SOUTH: y--; break; case Direction.EAST: x++; break; case Direction.WEST: x--; break; } } }A competing robot manufacturer might have a different robot movement API that looks like: class Bot { int x=0, y=0; void goForward() { y++; } void goBackward() { y--; } void goLeft() { x--; } void goRight() { x++; } }So how do I go about defining an interface that can work with either of these? I think that if I can answer that, I will have a pluggable adapter. The universal remote control that I am building requires a target interface that looks like: abstract class Ubot { void moveForward(); void moveBackward(); void moveLeft(); void moveRight(); }When I previously only needed to support the Robotclass, I could do so with a plain-old adapter like: class UbotRobot implements Ubot { Robot _robot; UbotRobot(this._robot); void moveForward() => _robot.move(Direction.NORTH); void moveBackward() => _robot.move(Direction.SOUTH); void moveLeft() => _robot.move(Direction.WEST); void moveRight() => _robot.move(Direction.EAST); }One way that I can convert that to support the Botclass as well is to add a conditional to each move-related method: class UbotRobot { var _robot; UbotRobot(this._robot); bool get isRobot => _robot is Robot; bool get isBot => _robot is Bot; void moveForward() { if (isRobot) _robot.move(Direction.NORTH); if (isBot) _robot.goForward(); } // ... }That actually does the trick. In the client code, I can now use a Robotinterchangeably with Botwhen instantiating the universal UBotinstance: Regardless of which robot is used, the movement commands work, thanks to the adapter:Regardless of which robot is used, the movement commands work, thanks to the adapter: var robot = new Bot(); // new Robot() also works var universalRobot = new UbotRobot(robot); With the loquaciousWith the loquacious print("Start moving the robot."); universalRobot ..moveForward() ..moveForward() ..moveForward() ..moveForward() ..moveForward(); print("The robot is now at: ${universalRobot.location}."); Robot, this results in: $ ./bin/play_robot.dart Start moving the robot. I am moving Direction.NORTH I am moving Direction.NORTH I am moving Direction.NORTH I am moving Direction.NORTH I am moving Direction.NORTH The robot is now at: 0, 5.While the taciturn Botproduces: $ ./bin/play_robot.dart Start moving the robot. The robot is now at: 0, 5.Both kinds of robots are controlled by the same universal remote class. It would be a pain to maintain an adapter like this. When the next robot is supported, I would have to make changes to each method. Worse, each method would eventually grow to contain one line for every supported interface. Better is to create a registry that contains enough information to invoke the appropriate commands on the adaptees. I think this must be what the Gang of Four were talking about with the three different versions of pluggable adapters. I am unsure that I understand each of the types that they discuss. I do understand... mirrors! So I import Dart mirrors and declare a registry with sufficient information to issue move commands to each type: import 'dart:mirrors'; class UbotRobot implements Ubot { var _robot; UbotRobot(this._robot); static Map<Type, Map> _registry = { Robot: { 'forward': [#move, [Direction.NORTH]], 'backward': [#move, [Direction.SOUTH]], 'left': [#move, [Direction.WEST]], 'right': [#move, [Direction.EAST]] }, Bot: { 'forward': [#goForward, []], 'backward': [#goBackward, []], 'left': [#goLeft, []], 'right': [#goRight, []] } }; // ... }With that, I can reflect on the robot when invoking the appropriate movement method (with arguments): class UbotRobot implements Ubot { // ... void moveForward() { var _ = _registry[_robot.runtimeType]['forward']; reflect(_robot).invoke(_[0], _[1]); } // ... }Happily, that works as desired. Don't believe me? Try the code on DartPad:! I think I have a idea of what pluggable adapters are now. I may explore the concept a little further tomorrow. Hopefully I can better understand those implementation discussions from the book now! Day #51
https://japhr.blogspot.com/2016/01/what-heck-is-pluggable-adapter.html
CC-MAIN-2017-51
refinedweb
800
67.35
: /// <summary> ///. Program: $features = [Microsoft.SharePoint.Administration.SPFarm]::Local $id = [Guid]("00BFEA71-DE22-43B2-A848-C05709900100") $feature = $features[$id]'='Attachments'></FieldRef> <FieldRef Name='LinkTitle'></FieldRef> <FieldRef Name='IntegrationID'></FieldRef> <! A Simple Way to Improve CAML Query Performance There are many ways to improve the performance of your CAML queries, but I've recently found that in some cases, it's as easy as switching the order of your filter operations. In this case, I was searching across a list of 1,000,000 items for a set of 41. The list consists of tasks with, among other fields, a Status and Assigned To field. Both of these fields were indexed, but the following query was still running in the 10 second range: <Where> <And> <And> <Neq> <FieldRef Name='Status' /> <Value Type='Choice'>Completed</Value> </Neq> <Neq> <FieldRef Name='Status' /> <Value Type='Choice'>Terminated</Value> </Neq> </And> <Eq> <FieldRef Name='AssignedTo' LookupId='TRUE' /> <Value Type='Int'>159</Value> </Eq> </And> </Where> One small tweak and the same query ran in 1.5s: <Where> <And> <Eq> <FieldRef Name='AssignedTo' LookupId='TRUE' /> <Value Type='Int'>159</Value> </Eq> <And> <Neq> <FieldRef Name='Status' /> <Value Type='Choice'>Completed</Value> </Neq> <Neq> <FieldRef Name='Status' /> <Value Type='Choice'>Terminated</Value> </Neq> </And> </And> </Where> All that was done was to shift the order of the query conditions. The first query reads as "All tasks that are not Completed and not Terminated and Assigned To user 159". The second query reads as "All tasks that are Assigned To user 159 that are not Completed and not Terminated". I didn't trace the generated SQL, but it's not hard to imagine that the SQL now performs an initial filter on the data set against the user ID and returns a much smaller data set for subsequent operations (filter by Status). So the lesson learned is that for large lists, you need to follow Microsoft's guidance on large lists, but also ensure that your queries are written to take advantage of the indexes and reduce the data set as early as possible (preferably against an indexed field.). SharePoint’s Image Problem SharePoint has an image problem with many folks. I've discussed it before, but I think I have a new perspective on the issue. You see, I recently interviewed a candidate that was Microsoft Certified IT Professional: SharePoint Administrator 2010 and Microsoft Certified Professional Developer: SharePoint Developer 2010. His resume looked impressive and promising, with many SharePoint projects under his belt. He failed miserably on my moderate-advanced web developer assessment, skipping on nearly every single item in the assessment -- things that I think any mid-level web/.NET developer should know. You see, the problem is not that SharePoint is inherently a weak platform or inherently un-scalable or inherently poorly performing, but that they've made the platform so approachable, so well documented, and built such a strong community of developers and developer evangelists around it, that anyone can get into it. You don't need to know how garbage collection works or understand the difference between a Func and an Action (or even know what they are!) or what IL is. You don't need to know how to write a generic class or how to refactor code to reduce complexity. You don't need to know many of the higher level programming concepts of .NET or sound object oriented programming practices to build solutions on SharePoint because most of the time, you can just google it and find an example (Of course, most examples -- even the Microsoft MSDN ones -- are not meant for production code; they are merely designed to convey the concept and usage of a particular member in the library but not necessarily how to use it in an architecturally sound manner). So therein lies the root of SharePoint's image problem: it's so easy to build basic solutions, a developer who is fundamentally weak on the .NET platform and fundamental web technologies like Javascript and CSS can be productive in many companies and even get Microsoft certified! And then these developers are let loose on projects that ultimately under-deliver in one way or another. Be that performance or usability or maintainability. SharePoint is like the mystery basket on Chopped. There is nothing inherently good or bad about those mystery ingredients but for the skill of the individual chefs who combine them through the application of experience, creativity, and technique to create a dish. With different chefs, you will get drastically different results each round and the winners are usually the folks that have a fundamental understanding of the art and science of flavor and cooking as well as a deep understanding of the ingredients. It is the same with SharePoint; it is nothing but a basket of ingredients (capabilities or features) to start from (a very generic one at that). At the end, whether your dish is successful or not is a function of whether you have good chefs that understand the ingredients and understand the art and science of melding the ingredients into one harmonious amalgamation. Likewise, it is important that when staffing for SharePoint projects, you focus not only on SharePoint, but also on the fundamentals of .NET, computer science, and good programming in general. You can also think of it like a Porsche. Give it to a typical housewife to drive around a track and you'll get very different results versus having Danica Patrick drive it. Should it reflect poorly on the Porsche that the housewife couldn't push it anywhere near the limits? Or is it a function of the driver? Danica Patrick in a Corolla could probably lap my wife in a Porsche around a track. The bottom line is that SharePoint, in my view, is just a platform and a good starting point for many enterprise applications. When some SharePoint projects fail or fall short of expectations, the blame is often assigned to the platform (ingredients) and not to the folks doing the cooking (or driving). SharePoint is indeed a tricky basket of ingredients and it still takes a skilled team of architects, developers, testers, and business analysts to put it together in a way that is palatable. Watch Out For SPListItemCollection.Count and Judicious Use of RowLimit This seemingly innocuous call can be quite dangerous when used incorrectly. The reason is that this property invocation actually executes the query. This is OK if you plan on iterating the results because the results are cached, but costly if you don't plan on iterating the results. The following code sample can be used to test this effect for yourself: static void Main(string[] args) { using(SPSite site = new SPSite("")) using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("General Tasks"); SPQuery query = new SPQuery(); query.RowLimit = 1; query.Query = @" <Where> <Contains> <FieldRef Name='Title'/> <Value Type='Text'>500KB_1x100_Type_I_R1</Value> </Contains> </Where>"; query.QueryThrottleMode = SPQueryThrottleOption.Override; SPListItemCollection items = list.GetItems(query); Stopwatch timer = new Stopwatch(); timer.Start(); Console.Out.WriteLine("{0} items match the criteria.", items.Count); var timeForCount = timer.ElapsedMilliseconds; Console.Out.WriteLine("{0} milliseconds elapsed for count.", timer.ElapsedMilliseconds); foreach (var i in items) { Console.Out.WriteLine("{0} milliseconds elapsed for start of iteration.", timer.ElapsedMilliseconds - timeForCount); break; } } } (And of course, you can check the implementation of Count in Reflector or dotPeek) You will see that the start of iteration will be very fast once you've invoked Count once. Now here is where it gets interesting: - The total time it takes to execute the query is longer for invoking Count versus just iterating (~3000ms vs ~3200ms, about 5-10% in my tests). - When I set the RowLimit to 1, I can reduce the time by roughly 40-50% (~1600ms vs ~3200ms for a resultset of 230 out of a list of 150,000 items). Try it yourself by commenting and uncommenting the RowLimit line and commenting and uncommenting the line that invokes Count. What does this mean for you? Well, if you don't need the count, then don't use it. It's slower than just iterating the results. Where you plan on iterating the results anyways, don't invoke Count. If you need the count, you are better off doing a counter yourself in the iteration. And in a use case where you don't plan on iterating the result set (for example, checking to see if there is at least one occurrence of a type of object), be sure to set the RowLimit in your query! SharePoint, Large Lists, Content Iterator, and an Alternative When retrieving large datasets from large SharePoint lists, SharePoint 2010 provides a new class called ContentIterator (CI) that is supposed to help make large dataset retrievals from large lists possible. There's a bunch of great documentation on the web regarding this class, but one interesting observation that I've made is that it seems that it limits your query to one field only. This means that in your query's where clause, you can only include one field, even when used with the order clause generated by ContentIterator.ItemEnumerationOrderByNVPField. I tested with a list containing over 22,000 items with the default thresholds: And randomly generated data like so: It turns out that if I use more than one field in the query, even with an index on each field in the query and using SPQueryThrottleOption.Override, the CI will fail the query with a threshold error. What's one to do if you need to get all of the items in a list? It seems that you should be able to just simply write a loop that executes the query and retrieves data, page-by-page, until you reach the end of the set. So I rigged up the code myself: /// <summary> /// Executes a query and returns the result in batches. /// </summary> public class BatchQueryExector { private SPQuery _query; private BatchQueryExector() {} /// <summary> /// Creates an instance of the executor against the specified query. /// </summary> /// <param name="query">The query to execute.</param> /// <returns>The instance of the executor.</returns> public static BatchQueryExector WithQuery(SPQuery query) { BatchQueryExector executor = new BatchQueryExector(); executor._query = query; return executor; } /// <summary> /// Specifies the list the query will be executed over. /// </summary> /// <param name="list">The SharePoint list that contains the data.</param> /// <returns>An instance of <c>ExecutionContext</c>.</returns> public ExecutionContext OverList(SPList list) { return new ExecutionContext(_query, list); } /// <summary> /// Inner class used to encapsulate the execution logic. /// </summary> public class ExecutionContext { private readonly SPList _list; private readonly SPQuery _query; /// <summary> /// Creates a new instance of the context. /// </summary> /// <param name="query">The query to execute.</param> /// <param name="list">The SharePoint list that contains the data.</param> public ExecutionContext(SPQuery query, SPList list) { _query = query; _list = list; } /// <summary> /// Retrieves the items in the list in batches based on the <c>RowLimit</c> and /// invokes the handler for each item. /// </summary> /// <param name="handler">A method which is invoked for each item.</param> public void GetItems(Action<SPListItem> handler) { string pagingToken = string.Empty; while (true) { _query.ListItemCollectionPosition = new SPListItemCollectionPosition(pagingToken); SPListItemCollection results = _list.GetItems(_query); foreach (SPListItem item in results) { handler(item); } if (results.ListItemCollectionPosition == null) { break; // EXIT; no more pages. } pagingToken = results.ListItemCollectionPosition.PagingInfo; } } } } This can be invoked like so: internal class Program { private static void Main(string[] args) { Program program = new Program(); program.Run(); } private void Run() { using (SPSite site = new SPSite("")) using (SPWeb web = site.OpenWeb()) { SPList list = web.Lists.TryGetList("TestPaging"); SPQuery query = new SPQuery(); query.Query = @" <Where> <And> <Eq> <FieldRef Name=""TstProgram"" /> <Value Type=""Text"">Program 1</Value> </Eq> <Eq> <FieldRef Name=""TstDocumentType"" /> <Value Type=""Text"">15 Day SUSAR</Value> </Eq> </And> </Where>"; query.RowLimit = 100; // Effective batch size. query.QueryThrottleMode = SPQueryThrottleOption.Override; query.Query += ContentIterator.ItemEnumerationOrderByNVPField; Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); int count = 0; BatchQueryExector.WithQuery(query).OverList(list).GetItems(i => { count++; }); stopwatch.Stop(); Console.Out.WriteLine("{0}ms, {1} items", stopwatch.ElapsedMilliseconds, count); } } } It turns out that this works just fine provided that at least one of the columns in your query has an index. I tested with indices on all columns, on two columns, on one column, and on no columns. With no indices, this query will fail as well (must have at least one index on one of the columns in your query in my testing, but my guess is that you will need more as the number of items increases). With one to three indices, it made no difference in performance. In fact, it got a little slower with three indices. The batch size also had an impact. Larger batch sizes were more efficient, which makes sense given that another database roundtrip is made for each batch. For 32,000 items (I added more to test), a batch of 1000 (seems to be a sweet spot in my testing) completed in 2487ms for 7902 items. A batch of 500 completed in 2550ms. A batch of 100 completed in 3116ms. It doesn't have the fancy bits of the CI, but it will work with multiple columns in your where clause. To test for yourself, you can download this handy-dandy, multi-threaded list filler. Use ContentIterator to Read Items from Large SharePoint Lists New to me: ContentIterator for reading items from large lists. Why"). The problem with this is that for some odd reason, the SQL query that gets generated when you query on the field that has wrapped onto the second row inexplicably only queries the first row. In the generated SQL, I found the following: ...AND (UserData.tp_RowOrdinal=0) AND ((UserData.[int10] = N''34'') ...)..
http://charliedigital.com/category/sharepoint/
CC-MAIN-2014-52
refinedweb
2,262
54.02
E-Series Data Radio User Manual ER450 Remote Data Radio EB450 Base Station EH450 Hot Standby Base Station 1 Contents SECTION 1 3 Part A – Preface 4 Warranty4 Important Notice 4 Safety Information 5 Compliance Information 5 Warning - RF Exposure 5 Related Products 6 Other Related Documentation and Products 6 Revision History 6 Part B – E Series Overview 7 Definition of E Series Data Radio E Series Product Range E Series – Features and Benefits Model Number Codes 7 7 7 9 Part C – Applications 10 Application Detail Systems Architecture 10 11 Part D – System Planning and Design 14 Part H – Maintenance 42 Routine Maintenance Considerations 42 Part I – TVIEW+ Management Suite - Programmer43 Introduction43 Installation43 TVIEW+ Front Panel 44 Programmer44 Part J – Appendices 57 Part K – Support Options 59 Website Information E-mail Technical Support Telephone Technical Support Service Department 59 59 59 59 Selecting Antennas 14 Understanding RF Path Requirements 14 Examples of Predictive Path Modelling 15 Data Connectivity 20 Power Supply and Environmental Considerations 21 Physical Dimensions - Remote Data Radio - ER450 22 Physical Dimensions - Mounting Cradle/Din Rail mount 23 Physical Dimensions - Base Station - EB450 24 Physical Dimensions - Hot Standby Base Station - EH45025 Part E – Getting Started 26 ER450 Quick Start Guide EB450 Quick Start Guide EH450 Quick Start Guide 26 32 35 Part F - Operational Features 40 Multistream functionality (SID codes) Collision Avoidance (digital and RFCD based) Digipeater Operation TVIEW+ Diagnostics Poor VSWR Sensing 40 40 40 40 40 Part G – Commissioning 41 Power-up41 LED Indicators 41 Data Transfer Indications 41 Antenna Alignment and RSSI Testing 41 Link Establishment and BER Testing 41 VSWR Testing 41 2 SECTION 1 Part A - Preface Part B - E Series Overview Part C - Applications Part D - System Planning and Design Part E - Getting Started Part F - Operational Features Part G - Commissioning Part H - Maintenance 3 Part A - Preface Part A – Preface Warranty Important Notice All equipment supplied by Trio Datacom Pty Ltd (As of 1 January 2009) is covered by warranty for faulty workmanship and parts for a period of three (3) years from the date of delivery to the customer. During the warranty period Trio Datacom Pty Ltd shall, at its option, repair or replace faulty parts or equipment provided the fault has not been caused by misuse, accident, deliberate damage, abnormal atmosphere, liquid immersion or lightning discharge; or where attempts have been made by unauthorised persons to repair or modify the equipment. © Copyright 2011 Trio Datacom Pty Ltd All Rights Reserved The warranty does not cover modifications to software. All equipment for repair under warranty must be returned freight paid to Trio Datacom Pty Ltd or to such other place as Trio Datacom Pty Ltd shall nominate. Following repair or replacement the equipment shall be returned to the customer freight forward. If it is not possible due to the nature of the equipment for it to be returned to Trio Datacom Pty Ltd, then such expenses as may be incurred by Trio Datacom Pty Ltd in servicing the equipment in situ shall be chargeable to the customer. When equipment for repair does not qualify for repair or replacement under warranty, repairs shall be performed at the prevailing costs for parts and labour. Under no circumstances shall Trio Datacom Pty Ltd’s liability extend beyond the above nor shall Trio Datacom Pty Ltd, its principals, servants or agents be liable for the consequential damages caused by the failure or malfunction of any equipment. This manual covers the operation of the E Series of Digital Data Radios. Specifications described are typical only and are subject to normal manufacturing and service tolerances. Trio Datacom Pty Ltd reserves the right to modify the equipment, its specification or this manual without prior notice, in the interest of improving performance, reliability or servicing. At the time of publication all data is correct for the operation of the equipment at the voltage and/or temperature referred to. Performance data indicates typical values related to the particular product. This manual is copyright by Trio Datacom Pty Ltd. All rights reserved. No part of the documentation or the information supplied may be divulged to any third party without the express written permission of Trio Datacom Pty Ltd. Same are proprietary to Trio Datacom Pty Ltd and are supplied for the purposes referred to in the accompanying documentation and must not be used for any other purpose. All such information remains the property of Trio Datacom Pty Ltd and may not be reproduced, copied, stored on or transferred to any other media or used or distributed in any way save for the express purposes for which it is supplied. Products offered may contain software which is proprietary to Trio Datacom Pty Ltd. However, the offer of supply of these products and services does not include or infer any transfer of ownership of such proprietary information and as such reproduction or reuse without the express permission in writing from Trio Datacom Pty Ltd is forbidden. Permission may be applied for by contacting Trio Datacom Pty Ltd in writing. 4 Part A - Preface Safety Information Compliance radio equipment described in this user manual emits low level radio frequency energy. The concentrated energy may pose a health hazard depending on the type of antenna used. In the case of: The addition of this symbol to a Danger or Warning safety label indicates that an electrical hazard exists, which will result in personal injury if the instructions are not followed. This is the safety alert symbol. It is used to alert you to a potential personal injury hazards. Obey all safety messages that follow this symbol to avoid possible injury or death. WARNING indicates a poentialy hazardous situation which, if not avoided, can result in death or serious injury. CAUTION indicates a potentially haradous situation which, if not avoided, can result in minor or moderate injury. CAUTION, used without the safety alert symbol, indicates a potentially hazardous situation which, if not avoided, can result in equipment damage. PLEASE NOTE Electrical equipment should be installed, operated, serviced, and maintained only by qualified personnel. No responsibility is assumed by Trio Datacom for any consequences arising out of the use of this material. Warning - RF Exposure Non-directional antenna - DO NOT allow people to come within 0.5 metres (20 inches) of the antenna when the transmitter is operating Directional antenna - DO NOT allow people to come within 6 metres (20 feet) of the antenna when the transmitter is operating. FCC Notice (Hot Standby Controller, equipment-orient to relocate the receiving antenna. Increase the separation between the equipment and receiver. Connect the equipment into an outlet on a circuit different to that which the receiver is connected. Consult the dealer or an experienced radio/television technician for assistance. IC Notice (Hot Standby Controller Only) This Class B digital apparatus complies with Canadian ICES-003. Cet appariel numerique de la class B est conforme a la norme NBM-003 du Canada. R&TTE Notice (Europe) Applies to models Ex450-xxExx-xxx In order to comply with the R&TTE (Radio & Telecommunications Terminal Equipment) directive 1999/5/EC Article 3 (Low Voltage Directive 73/23/EEC), all radio modem installations must include an external in-line lightning arrestor or equivalent device that complies with the following specifications: • DC Blocking Capability - 1.5kV impulse (Rise Time 10mS, Fall Time 700mS) (Repetition 10 Times) or 1.0kV rms 50Hz sine wave for 1 minute. Schneider Electric declares that the E Series radio modem is in compliance with the essential requirements and other relevant provisions of the Directive 1999/5/EC. Therefore Schneider Electric E Series equipment is labelled with the following CE-marking. 0889 5 Part A - Preface Important Notices for Class I, Division 2, Groups A, B, C & D Hazardous Locations Applies to models ER450-xxxxx-xHx(CSA Marked) This product is available for use in Class I, Division 2, Groups A, B, C & D Hazardous Locations. Such locations are defined in Article 500 of the US National Fire Protection Association (NFPA) publication NFPA 70, otherwise known as the National Electrical Code and in Section 18 of the Canadian Standards Association C22.1 (Canadian Electrical Code). The transceiver has been recognised for use in these hazardous locations by the Canadian Standards Association (CSA) International. CSA certification is in accordance with CSA Standard C22.2 No. 213M1987 and UL Standard 1604 subject to the following conditions of approval: 1. The radio modem must be mounted in a suitable enclosure so that a tool is required to gain access for disconnection of antenna, power and communication cables. 2. The antenna, DC power and interface cables must be routed through conduit in accordance with the National Electrical Codes. 3. Installation, operation and maintenance of the radio modem should be in accordance with the radio modem’s user manual and the National Electrical Codes. 4. Tampering or replacement with non-factory components may adversely affect the safe use of the radio modem in hazardous locations and may void the approval. 5. A power connector retainer with thumbwheel screw as supplied by Schneider Electric MUST be used. Do not disconnect equipment unless power has been switched off or the area is known to be non-hazardous. Substitution of components may impair suitability for Class I, Division 2. Refer to Articles 500 through 502 of the National Electrical Code (NFPA 70) and Section 18 of CSA C22.1 for further information on hazardous locations and approved Division 2 wiring methods. WEEE Notice (Europe) equipment for recycling, please contact the dealer from whom you originally purchased the product. Dieses Symbol auf dem Produkt oder seinem Verpacken zeigt an, daß dieses Produkt nicht mit anderer Vergeudung entledigt werden darf. Stattdessen ist es Ihre Verantwortlichkeit, sich Ihre überschüssige Ausrüstung zu entledigen, indem es rüber sie zu einem gekennzeichneten Ansammlungspunkt für die Abfallverwertung elektrische und elektronische Ausrüstung übergibt. Die unterschiedliche Ansammlung und die Wiederverwertung Ihrer überschüssigen Ausrüstung zu der Zeit der Beseitigung helfen, Naturresourcen zu konservieren und sicherzugehen, daß es in gewissem Sinne aufbereitet wird, daß menschliche Gesundheit und das Klima schützt. Zu mehr Information ungefähr, wo Sie weg von Ihrer überschüssigen Ausrüstung für die Wiederverwertung fallen können, treten Sie bitte mit dem Händler in Verbindung, von dem Sie ursprünglich das Produkt kauften. Related Products ER450 Remote Data Radio MR450 Remote Data Radio EB450 Base/Repeater Station EH450 Hot Standby Base Station Other Related Documentation and Products E Series Quick Start Guides TVIEW+ Management Suite Digital Orderwire Voice Module (EDOVM) Multiplexer Stream Router (MSR) Revision History Issue 5 Feb 2004 Additional radio and Programmer information Issue 6 Feb 2005 Additional information for Hazardous Locations. Issue 7 May 2005 Various Updates Issue 8 Jan 2006 WEEE Updates Issue 9 Mar 2006 E Series Gen II Updates Issue 10 Mar 2007 Order Matrix Updated Issue 11 Jun 2009 Minor Fixes. Issue 12 Jun 2011 Converted to Sncheider Format 6 Part B – E Series Overview Part B – E Series Overview Definition of E Series Data Radio E Series – Features and Benefits The E Series is a range of wireless modems designed for the transmission of data communications for SCADA, telemetry and any other information and control applications that utilise ASCII messaging techniques. The E Series uses advanced “digital” modulation and signal processing techniques to achieve exceptionally high data throughput efficiency using traditional licensed narrow band radio channels. Common Features and Benefits of the E Series Data Radio (Generation II) • Up to 19200bps over-air data rates using programmable DSP based advanced modulation schemes. • Designed to various International regulatory requirements including FCC, ETSI and ACA. • Superior receiver sensitivity. • Fast data turnaround time <10mS. • 128-bit AES encryption. • Flash upgrade-able firmware – insurance against obsolescence. The E Series range consists of the basic half duplex “Remote” radio modem, an extended feature full duplex Remote radio modem, and ruggedised Base Station variants, including an optional Hot Standby controller to control two base station units in a redundant configuration. • Multi-function bi-colour Tx/Rx data LEDs showing Port activity (breakout box style), as well as LEDs indicating Tx, Rx, RF Signal, Data Synchronisation and DC Power status of the radio. • Rugged N type antenna connectors on all equipment. Frequency band variants are indicated by the band prefix and model numbering. (See Model Number Codes) • High temperature transmitter foldback protection. • Two independent configurable data ports and separate system port. • Higher port speeds to support increased air-rate (up to 57600bps on Port A and 38400bps on Port B). • Compatible with most industry standard data protocols. eg: MODBUS, DNP-3, IEC 870, SEL Mirrored Bits, etc. • Independent system port for interruption free programming and diagnostics (in addition to two (2) user ports). • 9600bps in 12.5 kHz radio channels with ETSI specifications. • Compatible with legacy systems (Non Packet Digital and Bell 202 Modes) • Remote over-the-air configuration of any radio from any location. • Multistream™ simultaneous data streams allows for multiple vendor devices / protocols to be transported on the one radio network. • Flexible data stream routing and steering providing optimum radio channel efficiency – complex data radio systems can be implemented with fewer radio channels. • The ability to duplicate data streams – that is, decode the same off-air data to two separate ports. These products are available in many frequency band and regulatory formats, to suit spectrum bandplans, in various continental regions. The range is designed for both fixed point to point (PTP), and multiple address (MAS) or point to multipoint (PMP) systems. E Series Product Range ER450 Remote Radio EB450 Base / Repeater Station EH450 Hot Standby Base Station 7 Part B – E Series Overview • • • Multi-function radio capable of dropping off one stream to a port and forward on or repeat (store and forward) the same or other data. Stand-alone internal store and forward operation – buffered store and forward operation even in the ER remote units. Unique integrated C/DSMA collision avoidance technology permits simultaneous polling and spontaneous reporting operation in the same system. Features and Benefits of ER450 Remote Data Radio • Optional full duplex capable remote – separate Tx and Rx ports for connection to an external duplexer. • New compact and rugged die cast case with inbuilt heatsink. • Low power consumption with use of external shutdown control. • Rugged N type antenna connectors. Data Port “breakout box” style flow LEDs for easier troubleshooting. • Digital receiver frequency tracking for long term data reliability. • • Network wide non intrusive diagnostics which runs simultaneously with the application. Features and Benefits of EB450 Standard Base / Repeater Station • Network wide diagnostics interrogation which can be performed from anywhere in the system including any remote site. • Diagnostics will route its way to any remote or base / repeater site regardless of how many base / repeater stations are interconnected. • Full range of advanced features available within Network Management and Remote Diagnostics package – BER testing, trending, channel occupancy, client / server operation, etc. • Competitively priced high performance base. • Incorporates a rugged 5W power amplifier module. Features and Benefits of EH450 Hot Standby Base / Repeater Station • Individual and identical base stations with separate control logic changeover panel. • ALL modules are hot swapable without any user downtime. • On board memory for improving user data latency – increased user interface speeds. • Flexible antenna options – single, separate Tx & Rx, two Tx and two Rx. • Full CRC error checked data – no erroneous data due to squelch tails or headers. • Both on-line and off-line units monitored regardless of active status. • Radio utilises world standard HDLC as its transportation protocol. • Various flow control and PTT control mechanisms. • Configurable backward compatibility with existing D Series modulation scheme for use within existing networks. • Digital plug in order wire option for commissioning and occasional voice communications without the need to inhibit users application data. 8 Part B – E Series Overview Model Number Codes D, E & M Series Data Radios - Part Number Matrix = Tyxxx-aabbb-cdef T y x x z - a a b b b - c d e Options - Base Stations* 0 = No Options 1 = 450MHz Band Reject Duplexer [DUPLX450BR] 5 = 900MHz Band Pass Compact Duplexer [DUPLX900BPC] 6 = 900MHz Band Pass Duplexer (76MHz split)[DUPLX852/930] A = 450MHz 20W RF Power Output Options - E and M Series Remotes 0 = No Options H = Hazardous Environment Class 1, Div 2 and Diagnostics Available ONLY and standard on ER & MR450-aa-000 to 004 Options - Hot Standby Configurations* 0 = No Options Duplexer Antenna Antenna Number Type Config A B Dual [x4] C Single Internal Single D Dual [x2] Internal Dual [x2] F Dual [x2] External Dual [x2] Antenna Type Separate Tx & Rx Separate Tx & Rx Combined Tx/Rx Combined Tx/Rx Combined Tx/Rx Options* E = Diagnostics and Encryption - [DIAGS/E or DIAGS/EH] (E Series Only) *** X = Full Duplex Operation and Diagnostics (E-Series Remotes only) Y = Full Duplex Operation, Diagnostics and Encryption [ERFD450 & DIAGS/E] (E-Series Remotes only) *** L = Sleep Mode Module + Diagnostics (MR450 only) D = Diagnostics RF Channel Data Rate & Bandwidth (InternalE Modem) Series # D Series A01 = ACA 4800 / 9600bps 12.5kHz A01 = ACA 4800bps 12.5kHz A02 = ACA 9600# / 19k2bps 25kHz A02 = ACA 9600bps 25kHz F01 = FCC 9600# / 19K2bps 12.5kHz F01 = FCC 9600bps 12.5kHz F02 = FCC 19k2bps 25kHz E01 = ETSI 4800# / 9600 bps 12.5kHz Frequency Bands D Series (900MHz) 07 = (Tx) 847 to 857MHz (1W) (Rx) 923 to 933MHz (Full Duplex) 06 = (Tx) 923 to 933MHz (1W) (Rx) 847 to 857MHz (Full Duplex) Model Sub-Type 0 = Serial Interface Only e = Ethernet & Serial Interface (E Series Only) Generic Frequency Band 45 = 450MHz UHF Band (E & M Series only) 90 = 800-900MHz Band (D Series only) E Series (400MHz) 46 = 370 to 388MHz (Tx & Rx) 47 = 380 to 396MHz (Tx & Rx) 48 = 395 to 406MHz (Tx & Rx) 50 = 403 to 417MHz (Tx & Rx) 63 = 406 to 421MHz (Tx & Rx) 64 = 415 to 430MHz (Tx & Rx) 56 = 418 to 435MHz (Tx & Rx) 57 = 428 to 444MHz (Tx & Rx) 55 = 436 to 450MHz (Tx & Rx) 51 = 450 to 465MHz (Tx & Rx) 65 = 455 to 470MHz (Tx & Rx) 52 = 465 to 480MHz (Tx & Rx) 53 = 480 to 494MHz (Tx & Rx) 60 = 490 to 500MHz (Tx & Rx) 54 = 505 to 518MHz (Tx & Rx) M Series~~ 000 = Analog Only 12.5kHz (Local Diags included - No Additional Charge) 001 = 2400bps 12.5KHz / 4800bps 25kHz 002 = 4800bps 12.5KHz / 9600bps 25kHz 003 = FCC 9600bps 12.5KHz 004 = ETSI 4800bps 12.5KHz 241* = 2400bps 12.5KHz (S Series [24SR]* Compatible) c/w Local Diags 242* = 2400bps 25KHz (S Series [24SR]* Compatible) c/w Local Diags 482* = 4800bps 25KHz (S Series [48SR]* Compatible) c/w Local Diags M Series (400MHz) M = 400 to 470MHz (Tx & Rx) (M Series Only) H = 450 to 520MHz (Tx & Rx) (M Series Only) Note: Other frequency bands available on request NOTES: * Additional charges apply. Must be ordered separately. Please refer to price list. ** Consult factory for availability. *** Export restrictions may apply. # Provides compatibility with D and/or M Series radios [ ] Items in [ ] parenthesis refer to actual Trio part numbers ~~ M Series Compatible EB/EH450 Base Stations are Type A01 or F01 Unit Type R = Remote Station B = Base / Repeater Station (D, E & M Series Only) H = Hot Standby Base / Repeater (D, E & M Series Only) Standards: ACA - Australian Communications Authority FCC - Federal Communications Commission ETSI - European Telecommunication Standards Institute Model Type D = D Series Family E = E Series Family M = M Series Family The example shown specifies: E Series, Remote Radio, generic 450MHz band, with a specific frequency of 450MHz to 465MHz, a 9600/19200bps modem, with a bandwidth of 25kHz, diagnostics and Class 1, Div 2 Hazardous Approval (standard). Example: E R 4 5 0 - 5 1 A 0 2 - D H 0 Dwg / Ver: 184-56-0001-H 9 Part C – Applications Part C – Applications Generic Connectivity The E Series has been designed for SCADA and telemetry applications, and any other applications that use an ASCII communications protocol, and which connect physically using the RS232 interface standard (although converters can be used to adapt other interfaces such as RS422/485, RS530/V35, G703 etc). Any protocol that can be displayed using a PC based terminal program operating via a serial communications port is suitable for transmission by the E Series radio modems. An ASCII protocol is any that consists of message strings formed from ASCII characters, that being defined as a 10 or 11 bit block including start and stop bits, 7 or 8 data bits and optional parity bit(s). Port set-up dialogue that includes the expressions “N,8,1”, or E,7,2” or similar indicate an ASCII protocol. Most of the dominant telemetry industry suppliers utilise proprietary ASCII protocols, and also common ‘open standard” industry protocols such as DNP3, MODBUS, TCP/IP, and PPP. These are all ASCII based protocols. Industries and Applications The E Series products are widely used in point-to-point. Application Detail SCADA Systems This is where one or more centralised). Telemetry Systems Dedicated telemetry control systems interconnecting sequential devices either where cabling is not practical or distances are considerable. Examples include: • Ore conveyor or slurry pipeline systems • Water systems (pump and reservoir interlinking) • broadcast industry (linking studio to transmitter) etc. 10 Part C – Applications Systems Architecture Point-to-Point This simple system architecture provides a virtual connection between the two points, similar to a cable. Dependent of the hardware chosen, it is possible to provide a full duplex connection (i.e. data transfer in both directions simultaneously) if required. Point-to-Multipoint Systems In a multiple access radio system, messages can be broadcast from one (master) site to all others, either using a half duplex radio system or from any site to all others, using a simplex radio channel. Half duplex systems often utilise a full duplex master, to make the system simpler and for faster operation. In either case, it will be necessary for the application to support an addressing system, since the master needs to be able to select which remote device it with which it wishes to communicate. Normally, the radio system is allowed to operate “transparently”, allowing the application’s protocol to provide the addressing, and thus control the traffic. Where the application layer does not provide the addressing, the E Series can provide it using SID codes™. (See Part F Operational Features) 11 Part C – Applications Digipeater Systems Backbone Store and Forward Systems This configuration is used where all sites are required to communicate via a repeater site. A repeater site is used because it has a position and/or height advantage and thus provides superior or extended RF coverage. The radio modem at the repeater does not have to be physically connected to the application’s master site. Information from the application’s master is transmitted to the repeater via radio, and the repeater then relays this information to the other field sites. In this scenario, the repeater is the master from an RF point of view, and the application master is effectively a “remote” from an RF point of view, even though it is controlling the data transfer on the system. Store and forward is used as a way of extending RF coverage by repeating data messages from one site to another. This can be done globally using the inbuilt data repeating functions, or selectively using intelligent address based routing features available in some PLC/RTU protocols. In this case it is necessary for all units on the system to operate in half duplex mode (only key-up when transmitting data), so that each site is free to hear received signals from more than one source. Digipeater System Backbone Store and Forward System 12 Part D – System Planning and Design Repeat and Translate This configuration is used where there are multiple repeaters in series required to reach great distances. The use of the translate function in this scenario is effectively avoiding messages being sent back and forth between series of repeater units. The translate function essentially gives a form of message direction. The repeat/translate function works by identifying the Stream ID (SID) code at the start of each received message and determines whether to change the SID code, ignore the message or repeat the message as is, as defined by the user in the repeat/translate table. 13 Part D – System Planning and Design Part D – System Planning and Design Selecting Antennas Understanding RF Path Requirements A radio modem needs a minimum amount of received RF signal to operate reliably and provide adequate data throughput. In most cases, spectrum regulatory authorities will also define or limit the amount of signal that can be transmitted, and the transmitted power will decay with distance and other factors, as it moves away from the transmitting antenna. It follows, therefore, that for a given transmission level, there will be a finite distance at which a receiver can operate reliably with respect to the transmitter. Apart from signal loss due to distance, other factors that will decay a signal include obstructions (hills, buildings, foliage), horizon (effectively the bulge between two points on the earth), and (to a minimal extent at UHF frequencies) factors such as fog, heavy rain-bursts, dust storms, etc. In order to ascertain the available RF coverage from a transmitting station, it will be necessary to consider these factors. This can be done in a number of ways, including (a) using basic formulas to calculate the theoretically available signal - allowing only for free space loss due to distance, (b) using sophisticated software to build earth terrain models and apply other correction factors such as earth curvature and the effects of obstructions, and (c) by actual field strength testing. It is good design practice to consider the results of at least two of these models to design a radio path. 14 Part D – System Planning and Design Examples of Predictive Path Modelling goodpath.pl3 756.69 031 04 37.49 S 150 57 26.34 E 297.05 309.67 030 56 24.00 S 150 38 48.00 E 117.21 (%) Obstructed Radio Path This path has an obstruction that will seriously degrade the signal arriving at the field site. Field Site Elevation (m) Latitude Longitude Azimuth Clear line of site Radio path with good signal levels, attenuated only by free space loss. Major Repeater Site obstpath.pl3 450.00 33.33 115.99 0.00 103.75 EB450 103.75 ER450 5.00 6.99 6.71 8.27 0.71 -140.00 1.00 0.00 4.63 6.66 1.26 -135.00 45.93 -103.75 453.14 36.25 99.976 102.70 -96.76 545.42 38.24 99.985 Major Repeater Site Field Site Elevation (m) Latitude Longitude Azimuth 703.83 030 43 55.92 S 150 38 49.51 E 180.10 309.67 030 56 24.00 S 150 38 48.00 E 0.10 (%) 450.00 23.04 112.78 16.71 117.25 EB450 117.25 ER450 5.00 6.99 6.71 8.27 0.71 -140.00 1.00 0.00 4.63 6.66 1.26 -135.00 9.70 -117.25 95.74 22.75 99.470 21.70 -110.26 115.23 24.74 99.665 15 Part D – System Planning and Design Effect of Earth Curvature on Long Paths This path requires greater mast height to offset the earth curvature experienced at such a distance (73km). longpath.pl3 Repeater Site Elevation (m) Latitude Longitude Azimuth Antenna Type Antenna Height (m) Antenna Gain (dBi) Antenna Gain (dBd) TX Line Type TX Line Length (m) TX Line Loss (dB) Connector Loss (dB) Frequency (MHz) Path Length (km) Free Space Loss (dB) Diffraction Loss (dB) Net Path Loss (dB) 221.26 032 01 21.63 S 142 15 19.26 E 217.12 ANT450/6OM 40.00 8.15 6.00 Far Field Site 75.58 032 33 00.00 S 141 47 00.00 E 37.37 ANT450/9AL 5.00 11.15 9.00 LDF4-50 40.00 6.79 2.72 2.00 450.00 73.46 122.85 22.94 133.55 LDF4-50 5.00 6.79 0.34 2.00 133.55 Radio Type Model TX Power (watts) TX Power (dBW) Effective Radiated Power (watts) Effective Radiated Power (dBW) RX Sensitivity Level (uv) RX Sensitivity Level (dBW) EB450 5.00 6.99 6.72 8.27 0.71 -140.00 ER450 1.00 0.00 4.64 6.66 1.26 -135.00 RX Signal (uv) RX Signal (dBW) RX Field Strength (uv/m) Fade Margin (dB) Raleigh Service Probability (%) 1.49 -133.55 14.65 6.45 79.735 3.32 -126.56 17.64 8.44 86.656 16 Part D – System Planning and Design There are basically two types of antennas – omni-directional and directional. Omnidirectional antennas are designed to radiate signal in a 360 degrees segment around the antenna. Basic short range antennas such as folded dipoles and ground independent whips are used to radiate the signal in a “ball” shaped pattern. High gain omni antennas such as the “colinear” compress the sphere of energy into the horizontal plane, providing a relatively flat “disc” shaped pattern which goes further because all of the energy is radiated in the horizontal plane. Directional antennas are designed to concentrate the signal into “beam” of energy for transmission in a single direction (i.e. for point-to-point or remote to base applications). Beamwidths vary according to the antenna type, and so can be selected to suit design requirements. The most common UHF directional antenna is the yagi, which offers useable beam widths of 30-50 degrees. Even higher “gain” is available using parabolic “dish” type antennas such as gridpacks. Antenna Gain Tuning the Antenna Many antennas are manufactured for use over a wide frequency range. Typical fixed use antennas such as folded dipoles and yagis are generally supplied with the quoted gain available over the entire specified band range, and do not require tuning. Co-linear antennas are normally built to a specific frequency specified when ordering. With mobile “whip” type antennas, it is sometimes necessary to “tune” the antenna for the best performance on the required frequency. This is usually done by trimming an antenna element whilst measuring VSWR, or simply trimming to a manufacturer supplied chart showing length vs frequency. These antennas would normally be supplied with the tuning information provided. Antenna Placement When mounting the antenna, it is necessary to consider the following criteria: The mounting structure will need to be solid enough to withstand additional loading on the antenna mount due to extreme wind, ice or snow (and in some cases, large birds). For omni directional antennas, it is necessary to consider the effect of the mounting structure (tower mast or building) on the radiation pattern. Close in structures, particularly steel structures, can alter the radiation pattern of the antenna. Where possible, omni antennas should always be mounted on the top of the mast or pole to minimise this effect. If this is not possible, mount the antenna on a horizontal outrigger to get it at least 1-2m away from the structure. When mounting on buildings, a small mast or pole (2-4m) can significantly improve the radiation pattern by providing clearance from the building structure. By compressing the transmission energy into a disc or beam, the antenna provides more energy (a stronger signal) in that direction, and thus is said to have a performance “gain” over a basic omni antenna. Gain is usually expressed in dBd, which is referenced to a standard folded dipole. Gain can also be expressed in dBi, which is referenced to a theoretical “isotropic” radiator. Either way, if you intend to send and receive signals from a single direction, there is advantage in using a directional antenna - both due to the increased signal in the wanted direction, and the relatively decreased signal in the unwanted direction (i.e. “interference rejection” properties). For directional antennas, it is generally only necessary to consider the structure in relation to the forward radiation pattern of the antenna, unless the structure is metallic, and of a solid nature. In this case it is also prudent to position the antenna as far away from the structure as is practical. With directional antennas, it is also necessary to ensure that the antenna cannot move in such a way that the directional beamwidth will be affected. For long yagi antennas, it is often necessary to install a fibreglass strut to stablilise the antenna under windy conditions. Alignment of Directional Antennas This is generally performed by altering the alignment of the antenna whilst measuring the received signal strength. If the signal is weak, it may be necessary to pre-align the antenna using a compass, GPS, or visual or map guidance in order to “find” the wanted signal. Yagi antennas have a number of lower gain “lobes” centred around the primary lobe. When aligning for best signal strength, it is important to scan the antenna through at least 90 degrees, to ensure that the centre (strongest) lobe is identified. When aligning a directional antenna, avoid placing your hands or body in the vicinity of the radiating element or the forward beam pattern, as this will affect the performance of the antenna. 17 Part D – System Planning and Design RF Feeders and Protection Data Connectivity The antenna is connected to the radio modem by way of an RF feeder. In choosing the feeder type, one must compromise between the loss caused by the feeder, and the cost, flexibility, and bulk of lower loss feeders. To do this, it is often prudent to perform path analysis first, in order to determine how much “spare” signal can be allowed to be lost in the feeder. The feeder is also a critical part of the lightning protection system. The V24 Standard The E Series radio modems provide two asynchronous V24 compliant RS232 ports for connection to serial data devices. There are two types of RS232 interfaces – DTE and DCE. All elevated antennas may be exposed to induced or direct lightning strikes, and correct grounding of the feeder and mast are an essential part of this process. Gas discharge lightning arresters should also be fitted to all sites. DTE stands for data terminal equipment and is generally applied to any intelligent device that has a need to communicate to another device via RS232. For example: P.C. Comm ports are always DTE, as are most PLC and RTU serial ports. Note: All ETSI installations require the use of a lightning surge arrestor in order to meet EN6095. See Part A Preface for lightning arrestor specifications. DCE stands for data communication equipment and is generally applied to a device used for sending data over some medium (wires, radio, fibre etc), i.e. any MODEM. The standard interface between a DTE and DCE device (using the same connector type) is a straight through cable (i.e. each pin connects to the same numbered corresponding pin at the other end of the cable). Common Cable Types @ 450MHz Loss per meter @ 450MHz Loss per 10m RG58C/U 0.4426dB4.4dB RG213/U 0.1639dB1.6dB FSJ1-50 (¼” superflex) 0.1475dB 1.5dB LDF4-50 (1/2” heliax) 0.0525dB 0.52dB LDF5-50 (7/8” heliax) 0.0262dB 0.3dB The “V24” definition originally specified the DB25 connector standard, but this has been complicated by the emergence of the DB9 (pseudo) standard for asynch devices, and this connector standard has different pin assignments. The wiring standard is “unbalanced”, and provides for three basic data transfer wires (TXD, RXD, and SG – signal ground). Hardware Handshaking Hardware handshake lines are also employed to provide flow control, however (in the telemetry industry) many devices do not always support all (or any) flow control lines. For this reason, the E Series modems can be configured for full hardware flow control, or no flow control at all (simple 3 wire interface). Note: that when connecting devices together with differing handshake implementations, it is sometimes necessary to “loop” handshake pins in order to fool the devices handshaking requirements. In telemetry applications (particularly where port speeds can be set to the same rate as the radio systems over-air rate) then flow control, and therefore handshaking, is usually NOT required. It follows that any devices that CAN be configured for “no flow control” should be used in this mode to simplify cabling requirements. Handshaking lines can generally be looped as follows: DTE (terminal) – loop RTS to CTS, and DTR to DSR and DCE. DCE (modem) - loop DSR to DTR and RTS (note-not required for E Series modem when set for no handshaking). 18 Part D – System Planning and Design Cable Wiring Diagrams 19 Part D – System Planning and Design Cable Wiring Diagrams RS232 Connector Pin outs (DCE) Port A and B, Female DB9 20 Part D – System Planning and Design Power Supply and Environmental Considerations General Solar Applications When mounting the equipment, consideration should be given to the environmental aspects of the site. The cabinet should be positioned so that it is shaded from hot afternoon sun, or icy cold wind. Whilst the radios are designed for harsh temperature extremes, they will give a longer service life if operated in a more stable temperature environment. In an industrial environment, the radio modems should be isolated from excessive vibration, which can destroy electronic components, joints, and crystals. In solar or battery-backed installations, a battery management unit should be fitted to cut off power to the radio when battery levels fall below the minimum voltage specification of the radio. In solar applications, a solar regulation unit MUST ALSO be fitted to ensure that the radio (and battery) is protected from excessive voltage under full sun conditions. When calculating solar and battery capacity requirements, the constant current consumption will be approximately equal to the transmit current multiplied by the duty cycle of the transmitter, plus the receive current multiplied by the (remaining) duty cycle of the receiver. The cabinet should provide full protection from moisture, dust, corrosive atmospheres, and residues from ants and small vermin (which can be corrosive or conductive). The radio modem will radiate heat from the in-built heatsink, and the higher the transmitter duty cycle, the more heat will be radiated from the heatsink. Ensure there is sufficient ventilation in the form of passive or forced air circulation to ensure that the radio is able to maintain quoted temperature limits. The Tx/Rx duty cycle will be entirely dependent on the amount of data being transmitted by the radio modem, unless the device has been configured for continuous transmit, in which case the constant current consumption will be equal to the transmit current only (at 100% duty cycle). Note: Operation below the minimum specified supply voltages could result in poor radio performance. If the supply voltage falls below 7.2Vdc the radio will shut down. Normal radio startup will not occur until 10Vdc is supplied. Power Supply The power supply should provide a clean, filtered DC source. The radio modem is designed and calibrated to operate from a 13.8VDC regulated supply, but will operate from 10-16 volts (filtered) DC. The power supply must be able to supply sufficient current to provide clean filtered DC under the full current conditions of the radio modem (i.e. when transmitting full RF power). See Section L - Specifications for more details of the power supply requirements. Site Earthing CAUTION Ensure that the chassis mounting plate, power supply (-) earth, RTU 13.8Vdc. terminal device, and lightning arrester are all securely earthed to a common ground point to which an earth stake is attached. Pay particular attention to 24Vdc PLC systems using DC-DC converters to supply CAUTION). 21 Part D – System Planning and Design Physical Dimensions - Remote Data Radio - ER450 22 Part D – System Planning and Design Physical Dimensions - ER450 Mounting Cradle/Din Rail Mount (Optional) Mounting Cradle ER450 Mounting Cradle The ER450 mounting cradle comes standard with the x4 mounting posts. If you want to purchase a new unit equipt with the Din Rail mount, you can either request to have the units sent with the Din Rail mount already screwed onto the mounting cradel or have the Din Rail mount supplied seperately along with x4 screws and x4 washers (srews: 3x8 Pan head, Washers: 3mm Sping washers). In the case of attaching the Din rail mounts to older radios, please ensure that you radio’s mounting cradle has the x4 mounting posts. Din Rail Mount (Optional) 35mm Din Rail Din Rail Mount The Din Rail Mount is an optional feature. The Mount is screwed onto the Bottom of an ER450 Mounting Cradle giving the unit the ability to be simply ‘clipped’ and Locked onto 35mm Din Rail. 23 Part D – System Planning and Design Physical Dimensions - Base Station - EB450 24 Part D – System Planning and Design Physical Dimensions - Hot Standby Base Station - EH450 25 Part E – Getting Started - ER450 Part E – Getting Started ER450 Quick Start Guide Mounting and Environmental Considerations Introduction The ER450 radio comes complete with a mounting cradle and is attached to a panel or tray by means of screws or bolts, using the hole slots provided. Welcome to the ER450 Quick Start Guide. This guide provides step-by-step instructions, with simple explanations to get you up-and-running. Note: In high power or high temperature applications, it is desirable to mount the radio with the heatsink uppermost to allow ventilation for the heatsink. The radio should be mounted in a clean and dry location, protected from water, excessive dust, corrosive fumes, extremes of temperature and direct sunlight. Please allow sufficient passive or active ventilation to allow the radio modem’s heatsink to operate efficiently. ER450 Connections Layout Typical Radio Setup Omni-Directional or Direction Yagi Antenna E-Series Remote Lightning Arrestor Mains Supply RS232 Serial Device (RTU/ PLC) Connected to port A and/or port B Regulated Power Supply (110/220VAC to 13.8 VDC Nominal) Laptop/PC running TView+ Diagnostics Connected to System Port 26 Part E – Getting Started - ER450 Connecting Antennas and RF Feeders The RF antenna system should be installed in accordance with the manufacturers notes. The RF connector used on the E Series radios are N Type female connectors. Always use good quality low loss feeder cable, selected according to the length of the cable run. Ensure all external connections are waterproofed using amalgamating tape. Preset directional antennas in the required direction using a compass, GPS, or visual alignment and ensure correct polarisation (vertical or horizontal). TVIEW+ Adaptor Configuration: System Port Pin 1 Pin 2 Pin 3 Pin 4 Pin 5 Pin 6 Pin 7 Pin 8 Description System port data out (RS232) System port data in (RS232) Factory Use Only - Do not connect Shutdown Programming Use Only (Grounded) Factory Use Only - Do not connect Ground External PTT DB9 Female Pin 2 Pin 3 No Connection No Connection Pin 5 No Connection Pin 5 No Connection Special user pinouts: • Shutdown (Pin 4) - Active low for power save function In order to put the radio into Shutdown mode, tie pin 4 to a digital output on a SCADA Pack, RTU or similar device. When it is desired to turn the radio off, switching this digital output must connect the radio’s pin 4 to ground. The (earth) ground of both devices would also need to be tied together as a common reference. (pin 7 on the radio’s System port) A 2 wire cable between SCADA Pack and radio system port is all that’s required, with an RJ-45 connector on the radio end. The Shutdown pin may be left floating for the radio to remain powered. • External PTT (Pin 8) - Provides a manual PTT override facility for enabling the transmitter. For testing this can be activated by connecting PTT (Pin 8 ) to Gnd (Pin 7). Communications Ports System Port – RJ45 The System Port (available front and rear on EB/EH450) is a multi-function interface used for: • Programming / Configuration of the radio • Remote Diagnostics connections To access these functions use the TVIEW+ Cable assembly (RJ45 Cable and RJ45 to DB9 Adaptor). The TVIEW+ Cable is a standard CAT 5 RJ-45 (Male) to RJ-45 (Male) patch cable. It is intended for RS232 serial communications only and should not be connected directly into an Ethernet port of a PC. The Cable must be used in conjunction with the RJ-45 to DB9 Adaptor. Cross Over cable (Trunking System Port to Sytem Port) Some circumstances require a user to trunk the system ports of two units using an RJ45 cross over cable. Follow the diagram below to create the cross over cable. 27 Part E – Getting Started - ER450 User Interfaces – Ports A & B RS232 Connector Pin outs (DCE) Port A and B, Female DB9 Each user port (A & B) is wired as a RS232 DCE, configurable for no handshaking (3-wire) interface, or for hardware or software (X-on/X-off) flow control. In most systems flow control is not required, in which case only 3 wires need to be connected between the radio and the application device. Typical pins used: • Pin 2 (RxD) - data output from the radio modem, • Pin 3 (TxD) - data input to the radio modem, • Pin 5 (SG) - signal ground. See Part D – System Planning and Design - Data Connectivity, for further details of other cable configurations. Activating the Transmitter • In most systems, the transmitter by default is controlled automatically by the radio when it has data to transmit. In some systems, such as full duplex point-to-point links or full duplex point-to-multipoint base stations, it is desirable to run the transmitter all the time (hot keyed). The radio modem can be configured to transmit whenever an external RTS signal (Pin 7) is applied to one (or either) user ports. (To simulate an external RTS input, loop pins 6 to 7). To operate in these modes, the radio must be configured via the programming software. Two mechanisms are provided to do this: • The radio modem can be configured to transmit continuously whenever powered, or Caution: When the radio is configured to transmit continuously, ensure an RF load is present BEFORE applying power to the unit. 28 Part E – Getting Started- ER450 Power Supply Requirements TVIEW+ Management Suite The E Series radio modem is designed and calibrated to operate from a filtered 13.8Vdc regulated supply, but will operate from a 10-16Vdc (11-16Vdc for EB450 & EH450) range. See Section L - Specifications for more details on power supply requirements Radio Configuration). This TVIEW+ Management Suite allows a number of features including: Configuration (Local - serial, or Remote - over-the-air), Remote Diagnostics Facilities and Firmware Upgrades. The configuration wizard can be used to provide Quick Start generic templates for the types of systems architecture you wish to employ. Example: Local configuration session – 1 Attach the programming cable from the PC to the System Port of the radio 2 Launch TVIEW+ & Select “Programmer” 3 Select “Read” the radio 4 Change the configuration as required 5 Select “Write” the parameters back to the radio Refer to Parts I & J – TVIEW+ Management Suite for detailed operation of advanced features. The radio is designed to self protect from permanent damage if the voltage exceeds 16Vdc or if reverse polarity is applied. The radio may need to be returned for service if this occurs. The radio modem can also be damaged if there is any potential difference between the chassis-ground, RS232 signal ground, power (-) input, or antenna coaxial shield. Before connecting any wiring, ensure all components are earthed to a common ground point (please pay particular attention to 24V PLC power systems where converters are used). Connect the antenna and RS 232 plugs BEFORE applying power to the unit. Lastly, before inserting the power plug, please re-check that the polarity and voltage on the power plug is correct using a multimeter. 29 Part E – Getting Started- ER450 Optimising the Antenna for best RX signal LED Indicators & Test Outputs Once the unit is operational, it is important to optimise the antenna tuning. In the case of a directional antenna, it will be necessary to align the antenna for the best received signal. This can be done by using the (0-5Vdc) output on Pin 9 of Port B to indicate signal strength (RSSI). This voltage can be converted to dBm using the chart below. LED Legend Radio is Powered If all the LEDs are off, no power is reaching the radio modem. Successful power-up is indicated by the “PWR” LED indicating a continuous (healthy) GREEN state. Note that this LED is turned RED when the transmitter is active. Radio Errors Internal radio management software monitors many aspects of the radio hardware. Under certain circumstances radio faults may prevent normal operation. In the event that these fault conditions occur, the radio will enter an ERROR state and this will be indicated by flashing ALL LEDs RED, then flashing a pattern of GREEN LEDs. The pattern of all GREEN LEDs represents the specific type of error that has occurred. See Table below. Analog RSSI Output Characteristics - E Series Data Radio 5 4.5 RSSI (DC Volts) 4 3.5 3 2.5 Port A Port B Pwr/TX Error Diagnosis OFF Synch/ RXSig OFF OFF ON OFF OFF ON OFF OFF ON External Supply Voltage out of spec. (1) RX VCO Out of Lock. (2) TX VCO Out of Lock. (3) ON ON 2 1.5 1 0.5 0 -120 -110 -100 -90 -80 -70 -60 -50 -40 RF Level (dBm) All other patterns indicate serious hardware errors. Please record this pattern and return the result with the service return information. Note (1): If external voltage is too high (>16Vdc) radio damage may occur. If the external voltage is too low (<10Vdc) the radio may not operate within specifications. Note (2) and (3): If the radio receiver or transmitter frequencies are programmed outside the specified frequency ranges (model type dependent), then normal radio operation may not be possible. In this case, use TVIEW+ to set the receiver and/or transmitter frequencies to be within the specified range. If this error occurs and the frequencies are within the specified frequency ranges (model type dependent), the radio will need to be returned for service. 30 Part E – Getting Started- ER450 Received Signal Indicator LED Legend The “RX/SYNC” LED is used to indicate. Verifying Operational Health It is possible to verify the operation of the radio modem using the indicators provided by the unit. The state of the transmitter and receiver, and data flow can be interpreted by the indicator LEDs (see below). Note: Port A and Port B’s RxD and TxD will be Active on Data Flow Full Duplex – PTP Master or Slave A continuous GREEN indication shows that the modem is locked and synchronised to the incoming signal, and has excellent Bit Error Rate (BER). Any losses of synchronisation (BER errors) are shown as a visible RED flicker of the LED. Note: This might only be apparent on a PTMP slave when only receiving. Full Duplex – PTMP Master Tx Half Duplex – PTMP Slave Rx Data Flow “breakout” LEDs There are also two LEDs to indicate data flow into and out of the two user ports. Input data to be transmitted is shown as a RED flash, and received data to be output to the port is shown as a GREEN flash. Half Duplex – Master or Slave (Tx) If data is alternately flowing in and out quickly, then the indicator appears orange. Half Duplex – Master or Slave (Rx) 31 Part E – Getting Started - EB450 EB450 Quick Start Guide 20W Power Amplifier option Introduction The 20W power amplifier is primarily used for the purpose of overcoming Tx combiner losses. In such cases of a 20W power amplifier being required, an Rx preamp may also be required. Welcome to the Quick Start Guide for the EB450 Base / Repeater Data Radio. This guide provides step-by-step instructions, with simple explanations to get you up-andrunning. Note: 20W power amplifier options may not be available in all Countrys. please contact the factory to confirm availability. Mounting and Environmental Considerations External Duplexer Considerations The EB450 Base Station is housed in a 2RU 19” rack enclosure. The 4 mounting holes on the front panel should be used to secure the unit to the rack. The EB450 is normally supplied with separate Tx and Rx ports for connection to an external duplexing system. The radio. Depending on the frequency band of operation and the Tx/Rx frequency split, internal band reject duplexers are available. Connecting Antennas and RF Feeders See ER450 Quick Start Guide Communications Ports See ER450 Quick Start Guide Section Full Duplex Considerations Power Supply and Protection The EB450 is designed for continuous full duplex transmission. An automatic thermostatically controlled fan will operate whenever the internal temperature exceeds 40 degrees Celsius and turn off again when the temperature goes below 35 degrees Celsius. See ER450 Quick Start Guide Section TVIEW+ Management Suite - Radio Configuration See ER450 Quick Start Guide Section Optimising the Antenna for VSWR and best RX signal See ER450 Quick Start Guide Section 32 Part E – Getting Started - EB450 Typical Radio Setup Digital Inputs and Outputs The EB450 provides a facility for two channels of digital user inputs and outputs (Digital User I/O). Information on how to control and monitor this I/O using TVIEW+ Diagnostics can be found in Part J - TVIEW+ Management Suite - Remote Diagnostics & Network Controller. All user I/O is optocoupled for isolation between the EB450 and uses equipment. When using the I/O facility the I/O electrical characteristics and ratings must be observed. Failure to observe these ratings may result in equipment damage. Inputs Two User Inputs are available. They have identical interface characteristics. Each input has an internal resistance of 470 Ohms. Some form of switching contact (ie: switch, relay) is normally used to change the state of the input. Both an isolated and non-isolated input configuration is possible. TVIEW+ Diagnostics will recognise an input as being ON when the switch is closed. If the switch is open (or not connected) TVIEW+ diagnostics will recognise the inputs as being OFF. Outputs Two User Outputs (Open Collector) are available. They have identical interface characteristics. The maximum current allowed through each output is 20ma. External resistors must be used keep the current below this value. Each output has an internal resistance of 100 Ohms. Ohms law can be used to calculate the resistance required for a specific voltage (keeping the current below 20mA). Nominally 1k Ohm is used for a +13v8 supply and 330 Ohms for a +5v supply. When the OUTPUT is OFF, V = Vs. No current will flow when output is off. When the OUTPUT is ON, V = nominally 2.3 volts . Current is set by resistor. Is 33 Part E – Getting Started - EB450 LED Indicators & Test outputs Bar Graph Indicators Radio is Powered The bar graph indicators on the front panel provide variable information regarding the performance of the Base Station. To enable / disable the bar graph display depress the Display ON / OFF button. The display will turn off automatically after 5 minutes. If all the LEDs are off, no power is reaching the radio modem. Successful power-up is indicated by the “PWR” LED indicating a continuous (healthy) GREEN state. Note that this LED is turned RED when the transmitter is active. DC Supply: Indicates the supply input voltage at the exciter module. Typically 13.8Vdc. Indication: <10Vdc no LED’s on, 10-10.9Vdc LED’s RED, 11-15.6Vdc All LED’s GREEN, >=15.7Vdc last LED RED. Tx Power: Indicates forward RF power output as measured at the TX antenna port. Typically +37dBm or +43dBm for a 20W version. Hardware Error A hardware error is indicated on the status LEDs by all LEDs flashing RED at a rate of 1Hz. This indicates internal communications to the exciter inside the basestation has been lost and the base station needs to be returned to repair. Received Signal Indicator The “RX/SYNC” LED indicates. A continuous GREEN indication shows that the modem is locked and synchronised to the incoming signal, and has excellent Bit Error Rate (BER). Any losses of synchronisation (BER errors) are shown as a visible RED flicker of the LED. Indication: <20dBm no LED’s on, 20-40.6dBm (11.5W) LED’s GREEN, >=40.7dBm last LED RED. Tx Drive: Indicates exciter drive level. Typically +20dBm. Indication: <10dBm no LED’s on, 10.0-25.9dBm LED’s GREEN, >=26.0dBm last LED RED. Rx Sig: Indicates receive signal strength. Typically -85 to -65dBm. Indication: <-120dBm no LED’s on, -120 to -110.1dBm LED’s RED, >=-110dBm LED’s GREEN. RxFreq. Offset: Indicates offset of receiver AFC - useful in determining frequency drift. Typically 0kHz. Indication: Single GREEN LED to indicate current value, <-3.6kHz or >+3.6kHz LED is RED. No signal, all LED’s OFF. Note: 5 second peak hold circuitry. Note: This might only be apparent on a PTMP slave when only receiving. Test Mode Data Flow “breakout” LEDs There are also two LEDs to indicate data flow into and out of the two user ports. The Bar Graph indicators have a Test Mode, which cycles all LED’s for correct operation (before returning to their normal operation). To activate this mode, simply depress the ON / OFF button while applying power to the unit. Input data to be transmitted is shown as a RED flash, and received data to be output to the port is shown as a GREEN flash. If data is alternately flowing in and out quickly, then the indicator appears Orange. 34 Part E – Getting Started - EH450 EH450 Quick Start Guide Introduction Welcome to the Quick Start Guide for the EH450 Hot Standby Base / Repeater Station. This section provides additional step-by-step instructions to install, commission and operate the EH450 Hot Standby Base Station. This document should be read in conjunction with the EB450 Base Station Quick Start Guide. The EH450 is a fully redundant, hot standby digital data radio base / repeater station providing automatic changeover facilities. The EH450 is designed as a modular solution, comprising 2 identical EB450 base station units (standard) linked to a central, fail-safe monitoring and changeover controller (Hot Standby Controller). Either base station may be taken out for maintenance without the need for any system down time. The automatic changeover is triggered by out of tolerance (alarm) conditions based on either RF and/or user data throughput parameters. Features and Benefits • Individual and identical base stations with separate control logic changeover panel • Modules are hot swapable without user downtime • Flexible antenna options – single, separate Tx & Rx, two Tx and two Rx • Both on-line and off-line units monitored regardless of active status • Also refer to the common Features and Benefits list of the E Series Data Radio Base / Repeater Unit Base / Repeater Unit Hot Standby Controller Unit Note: RF connectors not used on ETSI version Rear View 35 Part E – Getting Started - EH450 Operational Description Mounting and Environmental Considerations The Hot Standby Controller (HSC) unit is a 1RU rack mounted module that interfaces to two physically separate base stations (each 2RU rack mounted modules) via a number of RF and data cables. The EH450 Hot Standby Base Station is housed as a 5RU 19” rack mounted set, encompassing 2 x 2RU Base Station units and 1 x 1RU Hot Standby Controller unit. The mounting holes on the front panels should be used to secure the units to the rack. Both base stations are operating simultaneously and both units are constantly receiving signals, however only data from one base station, the “online” base station is directed to the user equipment. The online base station is the only base station transmitting at any time. The Hot Standby Controller has the following functions: • Diplex the transmit and receive paths (Assuming internal duplexer fitted), TX Only. • Amplify and split the incoming signal two ways so both base stations receive at once. • Monitor status reports from both base stations to identify faults and swap over the online base station if required. • Switch the antenna via internal coaxial relay duplexer to the online base station transmitter and inhibit the offline base station from transmitting. • Switch the User A and B data ports through to the online base station. The unit. The Base Station front panel system ports must not be used while in this configuration. An optocoupler based switch in the base station controller directs data to and from ports A and B on the rear panel directly to ports A and B on the on-line base station without any involvement from the Hot Standby controller microcontrollers (apart from selecting the online base). This provides protection of the system from failure of the microcontroller. As well as ports A and B, each base has a system port. The system port of each base station is interfaced to the microcontroller on the Hot Standby controller. This allows the microcontroller in charge of selecting the base station to receive diagnostic messages from each base station to decide their health. The base station has it’s own system port on the rear panel and this is interfaced to the Hot Standby Controller Module. The HSC will route diagnostics at the rear panel system port to and from the system ports of the base stations. Warning The base station front panel system port has priority over the rear panel port, which is used for communication between the base station and the Hot Standby Controller. This is to permit service personnel to reconfigure the base station module without disconnection from the Hot Standby Controller. It should be noted however, that when the front panel port is accessed, a changeover event will occur due to lost communications with the Hot Standby Controller. 36 Part E – Getting Started - EH450 Communications Ports The A & B Data Ports and System Ports of each Base Station connect directly to the Hot Standby Controller units corresponding ports with the cables provided. Ensure all clamping screws on the Data Port cables are firmly secured and the System Port cables are clipped in correctly. See figure below for further details. The Hot Standby Controller units A & B Data Ports connect directly to you application device and the System Port connects directly to your local PC. See ER450 Quick Start Guide Section for further details. Note: Only the front or rear User System Port can be used at any one time on the Hot Standby Controller. Note: RF Connectors not used on ETSI version Power Supply and Protection The EH450 has facilities for dual power supplies to provide for a redundant system. A separate power supply should be used for each of the Base Station units. The Hot Standby Controller unit has connections for dual power supplies and it is recommended that the power supplies from each of the Base Stations also be used to power the Hot Standby Controller unit. See Figure below for further details. See ER450 Quick Start Guide Section for detailed wiring information. Note: RF Connectors not used on ETSI version 37 Part E – Getting Started - EH450 Connecting Antennas and RF Feeders There are 3 primary antenna connection options. All connectors used are standard N Type sockets. See figures below for further details. See ER450 Quick Start Guide for detailed wiring information. 38 Part E – Getting Started - EH450 Front Panel Operation Switches Alarm Status LEDs Select Switch There are 10 alarm LEDs on the front panel, five for base 1 and five for base 2. These LEDs provide a general indication of base station status. More detailed base station status information is available by using the diagnostic utility software. The 3 position switch (1 / Auto / 2) on the front panel provides the following functionality: • Position 1: base station 1 is forced into operation • Position Auto: changeover hardware will select the online base station • Position 2: base station 2 is forced into operation The select switch is also used to identify the target base station for configuration programming. Adjacent to the select switch are two LEDs: These LEDs indicate the current active base station. Select LEDs • • • Green - Auto Mode Red - Remote Force Amber - Local Force 2 Green Firmware Download 2 Amber Test Mode 2 Red Fatal Error - refer User Manual Reset Switch The indicated alarms for each base station are: Freq. => Frequency Error RxSig => Receive Signal (RF) Error Data => Receive Data Error TxPower => Transmit Power (RF) Error Supply => DC Voltage Error The status of each alarm is represented as follows: OFF => Unknown => Green No Error Red Error condition => Recovered Error condition Amber => Current (active) Any active or recovered error LEDs will turn to green after the reset alarms switch has been pushed or remotely reset. This is a momentary close switch which when depressed will reset all LED alarm indications. System Port There are two system port connection points, one on the rear panel and one on the front panel. Both have the same functionality and can be used for local diagnostics, firmware front panel downloads and hot standby controller testing. To access the system port use the diagnostic/programming cable supplied. Note: When connection is made to front panel system rear system port is disabled. 39 Part F – Operational Features Part F - Operational Features Multistream functionality (SID codes) The E Series sends data messages in packets. A feature of the E Series is that an address can be embedded in each packet. This address is called the stream identifier code (SID). By configuring a user serial port for a specific SID code, it is possible to steer messages to similarly configured ports between radio modems. In effect, it is possible to use the multiple serial ports available on the E Series, to enable multiple protocols to share the same RF channel. The SID codes also facilitate the use of other features such as TView diagnostics. Unique selective routing, repeating, and data splitting functions available in the radio modems configuration allow data steering and bandwidth management in complex systems. RF Carrier Detect RSSI based Collision Avoidance In half duplex systems, the receiver’s RF carrier detect is used to inhibit the transmitter whilst a signal is being received. Digipeater Operation A feature of the E Series radio modems is the ability to internally repeat data packets to provide stand alone repeater facilities without the need for external intelligence. This is done by programming “SID Codes” to “Repeat” a stream or range of streams. Wizard templates can be used to simplify setup of this and other features. See Part I - TView+ Management Suite - Programmer and Part J - TView Remote Diagnostics and Network Controller for details. See Part I - TVIEW+ Management Suite for details. Collision Avoidance (digital and RFCD based) The E Series has an inbuilt remote configuration and diagnostics utility. Where multiple “unsynchronised” protocols coexist on a common “multiple access” radio channel, there is always a possibility that both “hosts” may poll different “remote” devices at the same time. If both devices attempt to answer back to the single master radio at the same time, it follows that a collision could occur on the radio channel. To facilitate the operation of multiple protocol operation on the radio channel, a transparent collision management system has been implemented : See Part I - TView+ Management Suite - Programmer for details. TVIEW+ Diagnostics This facility allows transparent remote access to the key configuration and operating parameters of the radio. See the TView+ Diagnostics User Manual for more information. Poor VSWR Sensing To protect the transmitter, forward and reverse power are measured on each transmission. If a VSWR of 3:1 or greater is measured, transmitter output power is reduced to +31 dBm. (ER only) Digital Collision Avoidance System If the “multiple access master” has been configured for full duplex operation, it is possible to use the inbuilt collision avoidance signalling system. Once the master radio receives a valid incoming data stream from a remote, a flag within the “outbound” data stream is used to alert all other remote devices that the channel has become busy. Remote devices wishing to send data will buffer the message until the channel status flag indicates that the channel is clear. A pseudorandom timing value is added to the retry facility to ensure that waiting remotes do not retry at the same time. 40 Part G – Commissioning Part G - Commissioning Power-up Upon power up, the radio will self test and shortly after the green power LED will be displayed. Failure of the power LED to light indicates no power, or failure of the fuse due to incorrect polarity or overvoltage. Other failure such as fatal internal errors will initiate error modes as detailed in Part E - Getting Started: LED Indicators and Test Outputs. LED Indicators Will depend on the system architecture. If the device is a remote site receiving a base station with a constant carrier, then the RXSIG/SYNC LED should be green to indicate healthy reception of the wanted signal. If the site has been configured as a constantly transmitting base station, then the PWR/TX LED should show red. In other types of systems, TX and RX bursts would be indicated by the RX or TX LED’s as above. Data flow to and from the user ports is indicated by the TXD/RXD LEDs for each port. (See Part E – Getting Started: LED Indicators and Test Outputs.) Data Transfer Indications Bi-colour LEDs are provided to indicate RS232 data being transmitted and received on each data port. A RED flash indicates a byte (or bytes) of incoming data from the serial line which will be transmitted to air, and a green flash indicates a byte of data received “off air” being released onto the serial line. If data is being sent to the radio modem and the Data LED does not flash RED, this may indicate a wiring or configuration problem. Check that the TX and RX data lines are correctly wired (see Part E – Getting Started: LED Indicators and Test Outputs). Also check that character set and parity settings (i.e. N,8,1 etc) are set identically at the terminal and the radio modem. Note that some incorrect settings of the character set parameter can still produce transmittable data, even though the data will not be understood by the application. Antenna Alignment and RSSI Testing Once the RXSIG LED is lit, it is possible to confirm RX signal strength and align a directional antenna by monitoring the RSSI output. This DC voltage appears at Pin 9 of Port B. A ground reference can be obtained from chassis ground or Pin 5 of Port A or B. The chart below shows Pin 9 voltage as it relates to signal strength. Analog RSSI Output Characteristics - E Series Data Radio Link Establishment and BER Testing 5 4.5 4 RSSI (DC Volts) Check DC power connector for correct voltage (1016VDC) and polarity, BEFORE plugging in the power connector. 3.5 3 2.5 2 1.5 1 0.5 0 -120 -110 -100 -90 -80 -70 -60 -50 -40 RF Level (dBm) Once communications has been established, it is possible to confirm the packet error rate performance of the radio path, and thus estimate the BER figure. There are a number of tools provided to do this. The easiest is to use the “indicative packet error test” provided within the TVIEW+ Diagnostics under “statistical performance tools”. Alternatively, it is possible to use hyper terminal, or other packet test instruments or PC programs to run end to end or perform “loopback” testing. Please note that when using a “loopback plug” some understanding of the packetising process is necessary, since each “test message’ must be carried in a single packet for meaningful results to be obtained. Note also that in PTMP systems, allowance must be made for collision potential if other data is being exchanged on the system. VSWR Testing VSWR testing is achieved using specialized VSWR testing equipment, or a “Thruline” power meter that measures forward and reverse power. VSWR is the ratio between forward and reflected transmitter power, and indicates the health and tuning of the antenna and feeder system. VSWR should be better than 2 to 1, or expressed as a power ratio, <6dB or no more than 25%. To activate the radio’s transmitter for VSWR testing, use: a) An RTS loop b) A system port PTT plug with pins 7&8 shorted. 41 Part H – Maintenance Part H - Maintenance Routine Maintenance Considerations The E Series hardware itself does not require routine maintenance. However all radio products contain crystal frequency references, and the stability of these crystals changes with time. The effect of this is that the product will slowly drift off frequency, and eventually it will require re-calibration. E Series radios are designed with high quality, low drift specification references, to ensure a long maintenance free lifespan. The length of this lifespan will depend on the severity of temperature extremes in the operating environment, but is normally 3–5 years. Extended frequency drift can be detected using TVIEW+ Diagnostics “Freq error” parameter. Generally, re-calibration is achieved by replacing the radio in the field with a spare, and returning the radio to a service centre for re-calibration and specification testing at moderate cost. Routine maintenance should be performed on external equipment subject to greater environmental stresses including antennas, RF feeder cables, backup batteries and cooling fans (if required). This maintenance should include testing of site commissioning figures such as received signal strength, VSWR, P/S voltage etc. 42 Part I – TVIEW+ Management Suite - Programmer Part I – TVIEW+ Management Suite - Programmer Introduction This manual covers the installation and operation of the E Series TVIEW+ Management Suite which incorporates 3 utilities: • Programmer for configuration of the radio RF parameters, system parameters and data ports • Diagnostics* for real-time monitoring and logging of radio performance parameters • Firmware Update for loading new firmware releases into the radio data modem All utilities can be run on any IBM compatible computer running Windows 2000® and above. This section describes use of the programmer and firmware Update utilities in detail. Users should refer to the separate WinDiags User Manual for information about this utility. The programmer is used to set configuration parameters within the ER450 data radio modem and EB450 base station. The utility permits configuration of modems connected directly to the PC as well as over the air to a remote unit. Configuration parameters can be saved to a disk file for later retrieval, or used for clone programming of other modems. All configuration parameters are held in non-volatile memory (NVRAM) on the Data Radio Modem. Configuration is fully programmable via the Systems Port using the programming adaptor and cable supplied. Disassembly of the unit is not required for any reason other than for servicing. The diagnostics utility permits monitoring and logging of radio performance parameters for both E Series* as well as M Series* data radio modems and base stations. It supports homogeneous systems of radios as well as mixed systems of both E and M series radios. The firmware update utility permits field upgrade of the firmware in an ER450 data radio modem, EB450 base station and EH450 hot standby unit connected directly to the PC. A special serial adaptor cable is required to be connected to Port B to load firmware into the unit. * Requires the optional DIAGS Network Management and Remote Diagnostic Facility to be installed - per radio. Installation Unit Connection Programmer and Diagnostics Utilities The unit is connected to the PC using the supplied DB9-RJ45 adaptor cable (part no. TVIEW+ Cable) for local configuration changes or diagnostic monitoring. The cable should be connected to the RJ45 System Port of the unit and a valid PC serial port (e.g. COM 1) DB9 connector. (See Part E - Getting Started: Communications Ports) Firmware Update Utility The unit to be updated with firmware connects to the PC using the DB9-DB9 adaptor (part no. DRPROG). The cable should be connected to the DB9 Port B connector on the unit and a valid PC serial port (See Appendix C for details) DB9 connector. Software Please take a moment to read this important information before you install the software. The installation of this Software Suite is a 2 step process. Step 1 completes the typical installation of the TVIEW+ Management Suite and will install the Programming Software together with the E Series Documentation. Step 2 installs the Diagnostic Software and is optional. This step is only required if your radios have Remote Diagnostics enabled. STEP 1: Installation - TVIEW+ Management Suite Note: If a previous version of the TVIEW+ Management Suite has been installed on your PC, you must uninstall it via Control Panel “Add/Remove Programs”. • Close down all other programs currently running. • Place the CD-ROM in the drive on the PC. • Using Windows Explorer locate the files on the CDROM. • In Windows Explorer double click on the file called TVIEW+_(Version#)_install.exe • After the installer starts follow directions. 43 Part I – TVIEW+ Management Suite - Programmer STEP 2: Installation - TView Diagnostic Software (Optional) Programmer - Main Window Note: If a previous version of the “TView WinDiags” software has been installed on your PC, you must uninstall it via Control Panel “Add/Remove Programs”. • Close down all other programs currently running. When first started the programmer is in file mode as indicated by the mode field at the bottom right of the panel shown below. In this mode it is possible to open a previously saved configuration file, or configure various programming options and save the configuration to a file. • Place the CD-ROM in the drive on the PC. Note: Modulation type is not available in this mode. • Using Windows Explorer open the “Diagnostics” directory on the CR-ROM. • Double click on the file called setup.exe • After the installer starts follow directions. To commence programming a unit (radio remote or base station) a session must first be established by using the “READ” function. If you have a Hot Standby Set-up and are locally connected to the Hot Standby Controller, The programmer will read the currently ‘active’ Base. To select which base you want ‘active’ there is a switch on the front panel of the Hot Standby Controller that controls active base toggling. Other: The current E Series Manuals are supplied and installed as part of the TVIEW+ Management Suite installation in Adobe Acrobat format. Adobe Acrobat Reader is provided on the CD-ROM for installation if required. TVIEW+ Front Panel When started the TVIEW+ front panel appears. The larger buttons permit each of the five utilities to be started. The diagnostics button may be greyed out if this utility has not been installed or found in the correct file directory. Access to Advanced Set-up Parameters and an exit facility are provided by the remaining 2 buttons. The READ function reads the current configuration from the unit and displays it in the main window. The “mode” displays changes to local or remote depending on the type of session selected at the read function. Several options in the main window may be blanked out until a session has been established with a unit. Note: Changing any item on the menu will in general not take effect until data is written back to the unit using the “WRITE” function. The procedure to follow for normal programming of unit is: • Read unit • Configure parameters (or Open a previously saved configuration file) • Write unit Several modems of the same radio type can be programmed with the same configuration using the clone facility described in Clone Mode. It is important to note that when using this facility the cloned radio should be of the same type to ensure it does not operate outside its capability. 44 Part I – TVIEW+ Management Suite - Programmer Pull Down Menus and Toolbar Buttons The items on the pull-down menus can be selected either directly with a mouse or using the ALT key in combination with a HOT KEY (e.g. ALT-F to select the file menu). Several of the functions within each menu are also available on the toolbar (click once to select). File Menu The file menu allows the user to load (open) or save configuration data as well as to quit the program. The files are saved with an “.cfg” file extension Open (also available on the toolbar) This function is used to load an existing configuration file that can be used to directly program the radio or to use as a starting point to edit configuration parameters. Note that a session must be established with the unit by initially reading the configuration parameters from the unit prior to being written to a unit. If in file mode the modulation type will not be displayed. If in local/remote mode and a file that was saved from local/ remote mode is opened, then modulation type will be imported and used, but only if it is valid for the connected hardware. If not, then the unit’s read modulation type will be used. Save (also available on the toolbar) This function terminates the program. The user is requested to confirm this selection before exiting the application. Modem Menu This radio menu allows configuration data to be read from and written to the unit (remote radio or base station) using the selected PC serial port connection (see Settings menu). The action of reading the configuration establishes a session with the unit. Communications is maintained with the unit to ensure that the session remains open. If the session has been lost due to data transmission errors or disconnection of the programming cable it will need to be re-established to ensure any updated configuration is written successfully to the unit. Read (also available on the toolbar) This function establishes a session with the unit, reads configuration data from the unit and displays it in the programmer main window. When selected a dialogue window appears prompting the user to choose whether the unit to read is local (connected directly to the serial port or remote (connected over the air to the unit connected to serial port). Unit no. (Serial no.) must be entered and the stream SID code is “on” (default =0)). After configuration data is read from the unit it is available for editing and writing back to the unit or saving to a file. The progress of data transfer to or from the unit is indicated by a message window as well as a rotating indicator in the bottom right hand corner of the main window. This function is used to save the current configuration parameters to a file for future recall. If in “file mode” only basic RF, Port and System parameters are saved and re called. If in local/remote mode then modulation type is saved and re called. Print (also available on the toolbar) This function prints out the configuration data to the default printer in a standard format. There are no options for this item. This should be used if a complete record is required for site/unit configuration. Firmware/Modulation/Diags/ Hardware type are all printed. Exit (also available on the toolbar) Write (also available on the toolbar) This function writes configuration data displayed in the main window to the unit and reboots the unit. When selected a dialogue window appears prompting the user to confirm whether to proceed. A progress indicator in the bottom right hand corner of the main window is displayed while data is being read. This selection is only available if a session has been previously established and maintained with the unit. This dialogue provides a facility for reversing any remote configuration changes that cause unexpected results resulting in the device reverting to previous configuration if contact is lost. Choose “Make changes and resume contact” to safeguard changes. Some parameter changes (such as frequency change) will, by definition, automatically result in lost contact. 45 Part I – TVIEW+ Management Suite - Programmer Choose “Make changes anyway and finish” to complete intentional changes which will result in lost contact. After configuration data has been written, the session with the unit is closed and the programmer reverts to file mode. This function permits writing of the same configuration data to several units. This feature is normally used for configuring data radio modems connected locally. Note: In general, any change made on the programmer screen must be written to the unit (using the write function) to become permanently stored. However, changes to Power adjust, Mute adjust and Tx/Rx trim take The procedure is: • Read the configuration from the first unit. • Configure the parameters (or open a previously saved configuration file). immediate effect to allow test and adjustment prior to permanent storage via the write function. • Select Clone Mode (Modem menu). • Write the configuration to the first unit. Cancel Session (also available on the toolbar) • Connect the next unit. • Write the next unit which establishes a session and recognises the unit serial number and type, which then configures the unit • Repeat the last 2 steps for the remaining units. This function closes the session with unit and puts the programmer back into file mode. All configuration changes are discarded including changes to Power Adjust, Mute Adjust and Tx/Rx Trim. Wizard (also available on toolbar) Settings This function permits the user to select standard configurations after the configuration from a unit has been read or a file opened. The user is prompted via a series of dialogue windows to select the desired configuration that can then be written to the unit (remote radio or base station). This menu permits selection of the PC serial port (COM1 to COM99 if available) to be used for communications with the unit. COM1 is the default selection and if a different port is to be used it must be set before establishing a session by reading the configuration from a unit. Whilst a session is established with a unit this menu can not be accessed. Clone Mode Help This menu permits selection of help information using the Contents key. Warnings regarding use of the programmer software using the Warnings key and version detail using the About key. 46 Part I – TVIEW+ Management Suite - Programmer Port A and Port B Configuration Data from these two user ports is multiplexed for transmission over the air. Each port can be configured separately for the Character layer (Data speed, number of data bits, number of stop bits, parity), Packet layer and Handshaking (flow control). Port B must be enabled if required by setting the check box at the top of its configuration section. In both cases data is sent over the radio channel in variable length frames and delineation of these frames is dependent on the configuration selected as well as the characteristics of the data stream received at the data port. The packet layer configuration options that can be selected are: Standard (live framing) With standard live framing data received from the host by the modem is immediately placed into a frame and transferred onto the radio channel. This minimises “store and forward” delays in the data transmission. The following description is common to both ports. Character Layer There are two standard formats and a custom format that can be selected by checking the appropriate control button to the left of the description. The standard formats are: • 9600,N,8,1 (data speed = 9600 bps, no parity, 8 data bits, 1 stop bit) • 4800,N,8,1 (data speed = 4800 bps, no parity, 8 data bits, 1 stop bit) A non-standard format can be selected via the Custom button that displays a dialogue box to permit selection of data speed, parity, number of data bits and stop bits. Once selected the OK button should be used to complete the selection. The custom selection is also displayed in the main window below the Custom button. If a stream of characters is received by the modem, then several characters at a time may be placed into the same frame. The number of characters in the frame depends mainly on the respective baud rates of the user port and the primary channel baud rate of the modem, as well as the level of overheads experienced on the radio channel and the user data stream. The number of data bits associated with the user data stream will also have an effect on the average size of a frame. For instance the number of stop bits, and number of data bits per character. The system designer must choose the best compromise of all the above items to ensure the most efficient method of data transmission. Note: The first few characters are always packetised and sent by itself regardless of all the above variables. Modbus This selection configures the PAD driver with options automatically set to implement the MODBUS protocol, e.g. 5 mSec timer. Custom Other configurations of the PAD driver can be selected via the Custom button which displays a dialogue box to permit selection of several configuration options as follows: SLIP / DIAGNOSTICS Packet Layer (Packet Modes Only) There are two standard configurations and a custom configuration which can be selected by checking the appropriate control button to the left of the description. There are essentially two basic modes of operation for the packet assembler and disassembler (PAD). SLIP is a well known protocol for transferring binary data packets over a data link. Each data packet is delineated by <FEND> characters, and a substitution mechanism exists that allows these characters to be included in the data packet. Appendix B describes the SLIP protocol which is used extensively in UNIX™ based systems, and is closely associated with TCP/IP networks. The first is where the PAD operates in a standard mode with data received at the port being immediately sent over the radio channel. The second is a store and forward or delayed mode where whole data packets are received from the port before being sent over the radio channel. 47 Part I – TVIEW+ Management Suite - Programmer The fields which can be configured are: • Character Input timer: Set the input timer value in ms or enter zero to disable. Range 0 - 255. • Maximum Frame Size: Set the maximum number of characters or enter zero to disable. Range 0 4095. • Minimum Frame Size: Set the maximum number of characters or enter zero to disable. Range 1 255. Only available when AES Encryption is on. • EOM Character: Select the check box to the left of the description to enable and enter the EOM character as a decimal value. Range 0 - 255. The diagnostics controller package uses the SLIP protocol to communicate between base station and remote modems. DNP-3 / IEC870 This selection configures the PAD driver to implement the DNP-3 Protocol and IEC870 Protocol. Pull Down Menu Selection The PAD driver can be configured for a number of vendor specific protocols by selecting the desired option. • LIVE Framing: Select the check box to the left of the description to enable live framing mode. Note : When AES encryption has been turned ON, the packet layer is modified to suit the fixed format requirements of AES encryption. This may result in changes to the data latency and throughput in some modes. Handshaking (Packet Modes Only) If the standard PAD is selected (i.e. any settings apart from SLIP/Diagnostics), then flow control can be either hardware handshaking, XON/XOFF protocol or none. Custom Format Note: Handshaking is not supported when using Bell 202 modes. The XON/XOFF flow control is not supported when using the SLIP/Diagnostics protocol. This selection permits PAD driver to be configured in a variety of ways and requires a greater understanding of the system design. The Handshaking section of the screen allows the selection of either of the handshaking methods as well as allowing handshaking to be disabled. For the modem to successfully transmit its packets (or frames) of data over the radio channel, it must be told on what basis to delineate data packets received at the data port. Once the end of a data packet has been received at the port the data frame is closed and transmission over the radio channel commences. Delineation of data packets can be configured to occur via any combination of: Details of the two handshaking methods are given below. • A pre-defined minimum time delay between packets received at the port. Typically the time delay would reflect the absence of a couple of characters in the data stream at the specified user port baud rate. • Limiting the maximum number of characters which can be put in the data frame sent over the radio channel. • Receipt of a selected end of message (EOM) character at the port. An ASCII carriage return (character 13) is often used for this purpose. As each data frame to be transmitted over the radio channel has overhead data consisting of checksums and SID codes. The system designer must determine the best compromise between the ratio of overhead versus user data which depends on packet size and user data packet transmission latency. Hardware The modem acts as Data Communications Equipment (DCE) and supplies to the host controller the following interface signals: Data Set Ready Data Carrier Detect Clear To Send Receive Data Output (DSR) (DCD) (CTS) (RXD) The host controller must act as Data Terminal Equipment (DTE) and supplies to the modem the following interface signals : Data Terminal Ready (DTR) Request To Send(RTS) Transmit Data Input (TXD) • DCD DCD has several modes of operation. It is set to TRUE when data is being transferred from the modem to the host - RXD line active. The signal is asserted approximately 500ms before the start bit of the first character in the data stream and remains for approximately 1 character after the last bit in the data stream. The other modes of operation are dependent on the advanced settings. • DSR DSR is permanently set to TRUE. 48 Part I – TVIEW+ Management Suite - Programmer • CTS Disabled The CTS is a signal from the modem to the host informing the host that the modem is able to accept incoming data on the TXD line. It responds to the actions of the RTS line similar to the operation of a “standard” line modem. This selection disables the DCD output on the port. This selection is not permissible if hardware based flow control has been selected. The CTS is FALSE if the RTS line is FALSE. Once the RTS line is set to TRUE (signalling that the host wants to send some data to the modem on the TXD line), then the CTS will be set TRUE within 1ms, if the modem is capable of accepting more data. This selection causes DCD to be asserted at the onset of a an RF signal that is higher than the mute setting. This will generally occur several milliseconds before data is transmitted from the port. The CTS line will be set to FALSE if the transmit buffer in the modem exceeds 4075 bytes, or the number of queued frames exceeds 29 to ensure that no overflow condition can occur. • RTS The RTS line is used for two reasons. The first is to assert the CTS line in response to RTS. The RTS line can also be used to key up the transmitter stage of the modem. • RF Carrier Detect Data Detect (RS485 Flow Control) This selection causes DCD to be asserted when data is about to be transmitted from the port. This option is not available if handshaking is set to “None” or “Xon/Xoff”. RF Parameters This section of the main window permits adjustment of transmitter and receiver, radio channel modulation scheme, frequency trim and advanced features. DTR The DTR line is used for flow control of data being sent from the modem to the host controller. When the host is able to accept data it sets this line to TRUE, and if data is available within the modem, it will be sent to the host. If the host cannot accept any more data, then it sets the DTR to FALSE, and the modem will stop all transmissions to the host. • Xon/Xoff If the flow control mechanism is XON/XOFF then the modem uses the standard ASCII control codes of DC1 {^Q=11(Hex)=17(Dec)} for XON and DC3 {^S=13(Hex)=19(Dec)} for XOFF. The DTR input line is totally ignored. Note: There is no substitution mechanism employed in the XON/XOFF protocol, so care must be taken when transferring binary data to ensure that invalid flow control characters are not generated. Advanced This button provides access to the advanced features of the port configuration. When selected a dialogue box appears which permits selection of the source for the port DCD output signal. Transmitter The transmitter can be configured for transmit frequency and power level. Frequency The required transmit frequency in MHz can be entered in the display field. The programmer checks that the selected frequency is in the range for the particular model of radio and provides warnings if it is not. Power Adjust The currently selected transmit power is displayed below the button in dBm. The power level can be adjusted by selecting this button which displays a dialogue box. The up/down keys, or a typed in value, can be used to select the required power level in dBm steps. There are two methods for setting the power. 49 Part I – TVIEW+ Management Suite - Programmer • Using Factory Calibration To use the factory calibration of the radio the desired power is set immediately using the OK button in the dialogue box. This method permits the transmit power to be set without energising the transmitter. Note that although the transmit power has been adjusted it must be written to NVRAM using the modem “Write” function to ensure it is retained after a power on reset. • Using a Power Meter To overcome manufacturing variations in the power setting a more accurate setting of power can be achieved by the selecting the “Test With Meter” button in the dialogue box. This displays another dialogue box warning the user that the transmitter is about to be energised and that the power meter used should be able to handle at least 10 Watts from the modem. Selecting OK in this warning dialogue box will energise the transmitter which will also be indicated by the red transmit LED on the unit. The power is adjusted using the up/down keys until the required power level is obtained. Selecting OK will retain the power setting and turn the transmitter off. Note: Although the transmit power has been adjusted it must be written to NVRAM using the modem “Write” function to ensure it is retained after the modem is rebooted. Selecting “stop test” will stop and leave you in power adjust box. “Cancel” will stop test and take you back to the main window. a dialogue box. The up/down keys, or a typed in value, can be used to select the required mute level in dBm steps. Whilst a session is in progress with a unit the mute level adjustment is live. Selecting OK will retain the mute level setting. Note that although the mute level has been adjusted it must be written to NVRAM using the modem “Write” function to ensure it is retained after the modem is rebooted. Whilst the modem is capable of receiving extremely weak radio signals, and successfully extracting the data content from the waveforms the mute level should be set to assist the modem in filtering out unwanted signals. Unwanted signals can be the result of background noise or interference. The mute level should be set at a level above these unwanted signals and at a level low enough to detect the wanted signal. Detection of a received signal above the mute level is indicated by the “RxSig” LED on the unit. Modulation The radio modem utilises a DSP to control the modulation of transmit signals and demodulation of received signals. This provides greater flexibility in the ability of the radio modem to support new modulation schemes whilst maintaining compatibility with existing modulation schemes. The currently selected modulation scheme is displayed in the main window below the select button. The modulation scheme can be adjusted by selecting this button which displays a dialogue box. The desired modulation scheme can then be selected from the pulldown menu in the dialogue box and retained using the OK button. Receiver The receiver can be configured for receive frequency and mute level. Frequency The required receive frequency in MHz can be entered in the display field. The programmer checks that the selected frequency is in the range for the particular model of radio and provides warnings if not. Mute Adjust The currently selected mute level is displayed in the main window below the button in dBm. The mute level can be adjusted by selecting this button which displays The type of modulation available for selection is dependent on the model of radio. Modulation types are sorted using the following criteria : Country of Approval (FCC, ETSI, ACA), Radio Channel Bandwidth (12.5kHz or 25kHz), Radio Mode (E Series, M Series, D Series or Legacy) and over the air speed (2400bps, 4800bps, 9600bps, 19k2bps). Only modulation schemes suitable for the radio model in use are available for selection. Please consider the following notes when choosing a modulation: Country of Approval : FCC : for use in North America and other countries who use FCC approved radios. ACA : for use in Australia only. ETSI : for use in Europe and other countries who use ETSI approved radios. 50 Part I – TVIEW+ Management Suite - Programmer Legacy Modulation Schemes: Some modulation types are specifically for backwards compatibility. These include Bell 202 modes and D Series compatibility modes. These legacy modes should only be chosen when backward compatibility is required as their performance is inferior to the generic modulation schemes (bandwidth and RF sensitivity). Tx/Rx (Frequency) Trim The currently selected frequency trim, which is common to both transmitter and receiver, is displayed in the main window below the button in Hz. The frequency trim can be adjusted live by selecting this button which displays a dialogue box. The up/down keys can be used to select the required frequency offset in steps pre-determined by the radio modem. Selecting OK will retain the frequency trim setting. Note that although the frequency trim has been adjusted it must be written to NVRAM using the modem “Write” function to ensure it is retained after the modem is rebooted. PTT Delay : the amount of time between RTS enabled and the transmitter becoming active. Transmit Tail Suppression : Minimises garbage characters at end of transmission. (Available in Bell 202 Mode only.) Receiver Full Duplex This check box should only be ticked when the radio is operating in “full duplex” mode and with a “full duplex” hardware platform. For standard half-duplex remotes this option should not be ticked. For other modes please consult the factory for further information. Note: This parameter is set in the factory to the correct state and should not be altered without factory consultation. System Parameters This section of the main window configures the PTT control, collision avoidance, stream setup for routing of data, advanced features and provides unit information. PTT (Press To Transmit) Control (Packet Modes Only) This facility permits correction for drifts in the frequency reference caused by component aging. For example, a standard crystal may vary in fundamental frequency operation over 1 year by one part per million. An adjustment range of ± 10ppm, displayed in Hz, has been allowed for and if this is insufficient the unit should be returned to the dealer/factory for re-calibration. Advanced RF transmission can be configured to occur permanently, automatically on data received at Port A or Port B, or RTS being asserted on Port A or Port B. A PTT timeout facility can be configured to limit the period for which the transmitter is enabled. Each option is selected by setting the control to the left of the description on the main window. When PTT is active the “Tx” LED on the unit is illuminated and RF power is being fed to the antenna. Permanent Tx This will cause the transmitter to be permanently enabled (keyed) and displays another dialogue box warning the user that the transmitter will be energised immediately after the configuration is written to the unit. Selecting OK confirms this setting. The other PTT selections are disabled when this option is selected. Note: This option is only available for full duplex units when being programmed locally. Auto On Data This button permits setting of advanced features. When selected a dialogue box appears which permits configuration of various parameters. Non-Packet Mode Setup (Non-Packet and Bell 202 Mode Only) CTS Delay : the amount of time between RTS enabled to CTS active. PTT Hold : the amount of time the transmitter will remain enabled after RTS is disabled. Note: When replacing an MDS4710 radio operating in Bell 202 mode, the E Series radio needs to have PTT Hold set to 10mS to account for the extra delay in the radio when compared to an MDS radio. This will cause the transmitter to be enabled (keyed) automatically on data received at Port A or Port B and included in a complete frame for transmission over the radio channel. The maximum period for which the transmitter will be enabled is limited by the PTT timeout setting. From Port A RTS This will cause the transmitter to be enabled (keyed) on Port A RTS being asserted. The maximum period for which the transmitter will be enabled is limited by the PTT timeout setting. Applications which rely on establishing a link ahead of data being transferred require this method of activation. From Port B RTS This will cause the transmitter to be enabled (keyed) on Port B RTS being asserted. The maximum period for which the transmitter will be enabled is limited by the PTT timeout setting. Applications which rely on establishing a link ahead of data being transferred require this method of activation. 51 Part I – TVIEW+ Management Suite - Programmer PTT Timeout The PTT timeout facility is used to disable the transmitter if it exceeds the designated time. The timeout value can range from 1 to 255 seconds and the facility is disabled by setting a zero value. The timeout value chosen for this should be set according to system requirements which may include: • Prevention of a remote unit remaining keyed up and locking out all other remote units in a point to multipoint system. • Limiting the period a remote unit remains keyed up to prevent battery drain in a low power application. Note: If a PTT timeout occurs before completion of a data transmission data will be lost. Stream Setup (E&M Modes Only) This button brings up a dialogue box to permit editing of Stream IDentifier (SID) codes which are used by the modem as the addressing mechanism for data stream routing. A SID code can be placed at the start of each data frame as it is sent over the radio channel. The receiving modems use this code to determine how to route the data message. The modem supports simultaneous operation of both Port “A” and Port “B” over the one radio link, along with the inclusion of a diagnostics data stream. Each port is independent and supports multiple options which are described in the following sections. The following diagram illustrates the structure of the stream routing function for each data port. User Port This option is selected by clicking on the User Port button and filling in the RXSID and TXSID fields to the right. The radio comes preconfigured with default values. In User Port mode all SID code operations are performed transparently to the user data. Data placed into a user port which has been assigned a specified SID code, will only be received by a modem at the other end of the radio link that has a user port assigned with the same SID code. The SID code is added by the radio modem to the user data stream and removed by the radio modem when user data is outputted to a data port. In this way, Port “A” and Port “B” can be assigned different SID codes, thereby separating the data streams. Two SID codes values are available for each user port RXSID and TXSID. The RXSID codes apply to the data being received by the modem, and the TXSID codes apply to the data being transmitted by the modem. This allows for different transmit and receive codes if required, but generally they would be both the same. A situation where Tx and Rx SID codes may be different is in a repeater configuration. In this type of application all data messages sent to the repeater will be “repeated”. Thus by having different Tx and Rx codes, a control unit will not “hear” its own transmission, and remotes will not hear the reply from any other remote. For more information please consult the Schneider Electric Trio E Series training material available as a power point slide from our website at The diagnostics facility (when installed) also uses SID codes. The diagnostics data simply uses a different data stream to the user data, but is processed internally by the modem. If access to the diagnostics facility is required, similar to when the diagnostics utility is used with the modem, then the data port concerned and the diagnostics stream, must have the same SID codes assigned to them. Alternatively the System port can be used, which is 19.2K, Slip. Trunk Streams In the Trunk Streams mode, data that is inputted into the modem for transmission must have a SID code appended to the start of the data packet. This mode requires the use of a “SLIP” interface as configured using the packet layer. Trunk Steam mode is normally used in conjunction with TView Diagnostics software, when connection to a MSR Stream Router or when connecting radios together such as a back-to-back connections as used in multiple point to point links. In Trunk Stream mode a range of SID codes can be transmitted and received via a data port. This range is specified when this mode is selected. In a typical application, such as a back to back connection as used in a multiple point to point links, where all data (including diagnostics) from one radio needs to be “trunked” through to the other radio, the range used is 0 to 255. Trunked mode allows a configurable selection of data streams to be “trunked” to other equipment yet the data remains separated as the SID codes are appended to each packet of data outputted. 52 Part I – TVIEW+ Management Suite - Programmer Diagnostics Setup (Packet Modes Only) Polled Diagnostics The Diagnostics Processor can be configured to listen for diagnostics on a range of SID codes. The factory default is SID code 0 (From Stream 0 To Stream 0). The diagnostics responses are sent back over the same stream as the questions. Diagnostics Repeat This option can be toggled on and off by clicking the button. Some applications will require that a repeater unit in a point to multipoint system repeats diagnostics frames only. Repeat/Translate Configuration The modem is capable of operating in a repeater mode. Each user port can be configured as a separate repeater. The associated user ports are effectively disconnected from the “outside world” when in repeater mode. Data received from the radio channel is passed directly to the transmitter, and placed back onto the radio channel. This feature requires a firmware revision of R2.12.1 or later. The repeater must receive a complete frame of data before it is retransmitted. In some systems this store and forward delay may be significant, and careful selection of maximum frame sizes configured at the source unit must be considered to minimise the delay. To enable the mode select “Repeat Range” in the Type field and specify the range of SID codes for which will be repeated. Maximum of 2 repeat ranges can be used, ensure there is no overlap of SID ranges. Translate Streams This function is similar to repeat streams however it also translates the SID code from one value to another as the repeating function occurs. This mode can be used to controlled data repeating in systems where more than one repeater is required, such as store and forward system or pipe-lines. If translate is not used then a ‘Ping Pong’ effect would occur between to adjacent sites. Maximum of 16 translates can be used. Do not translate from the same SID more than once. This will be the case when the system diagnostics controller is connected to a remote unit in the system, and it polls the system population from this point. The master unit must retransmit any diagnostic frames that are not addressed to itself onto the remainder of the population. Automatic Diagnostic Reports This option allows the configuration of automatic diagnostics. This feature requires a firmware revision of R2.12.1 or later. This option automatically appends diagnostics messages when user data is transmitted. This option can be toggled on and off by clicking the “Enable” button. Minimum Report Interval : Specifies the amount of time before a diagnostics message is appended to the next user data message. Diagnostic Stream: Specifies the SID code used for the automatic diagnostics message. Controller Destination Address: Specifies the address of the Diagnostics Controller Software that is receiving the automatic messages and displaying them. This value must match that specified in the TVIEW diagnostics software configuration. Advanced The Advanced button can be used to install diagnostics into the E-Series radio if it was not purchased with the original order. Enter the 8 digit key-code supplied by Schneider Electric to enable diagnostics. If diagnostics is already installed this option will be “greyed out”. Diagnostics SID codes can also be translated. You must configure each radio in TView+ Diagnostics to operate using the SID code you want. SID Translation Example 53 Part I – TVIEW+ Management Suite - Programmer Encryption Setup (Packet Modes Only) The desired option for collision avoidance is selected by checking the control button to the left of the description on the main window. None When selected this turns off all collision avoidance mechanisms. This should only be used in point to point applications. Digital 128 bit AES Encryption can be enabled in the radio. AES Encryption is a feature available in the E Series Generation II product (firmware pack 4.x.x and above). Radios that have 128-bit AES encryption enabled can only communicate with other radios that have AES encryption enabled and use the same encryption key. AES Encryption is enabled by selecting the Enabled button and entering an “Encryption key”. The “Encryption key” must be between 8 and 16 characters long. The key can contain ASCII or hexadecimal characters. When entering hexadecimal characters, the format must be “0xDD” where DD is a sequence of hexadecimal digits. (0-9,A-F). When a radio configuration is read from a radio that already has AES encryption enabled, the encryption key will be shown as “**************” in the programmer to indicated encryption is enabled. Since there is no mechanism to see the encryption in plain text you must ensure the encryption key is recorded in a safe and secure place for future reference. This is the standard method of collision avoidance and utilises a channel busy indication bit in the signalling channel transmitted to all remotes for control. When selected a dialogue box appears and several options must be configured: • Mode – “Master” or “Remote”. When the master unit receives a valid transmission from a remote unit it sets the channel busy indication bit. This busy bit is interpreted by the other remotes to not transmit. Once the transmission from the first remote ends the master unit resets the busy bit to indicate the channel is now clear to transmit on. The master unit, which is normally a base station, takes about 5ms to detect a transmission from a remote unit and set the channel busy indication bit on the radio channel. During this period collision of remote transmissions can still occur and is unavoidable. Note: The master must be permanently keyed. • Backoff Method – “Retry after Tx Attempt” or “Delay before Tx Attempt”. The method chosen is system dependent and can only be configured if the mode is “remote”. The former is best used when data responses from remotes are largely asynchronous. The latter is best used when this is not the case. • Backoff Timing – “Maximum Slots”, “Time per Slot”. This can only be configured if the mode is “remote”. When a remote is ready to transmit data but it finds the busy bit. Note : When AES encryption is enabled in the radio, both Port A & B packet layer settings may be modified to ensure compatibility with AES encryption mode. Note : AES encryption is subject to export restrictions and may not be available in all countries. Collision Avoidance (Packet Modes Only) In a point to multipoint system the master unit (usually a base station) can transmit at any time and the remotes will all receive the broadcast signal. However, if more than one remote unit transmits at a time, then a collision will occur during the multiple transmissions, resulting in a loss of data from one or more units. Two collision avoidance mechanisms have been included in the modem. The standard (Digital) method utilises a signalling channel which is embedded in overhead data transmitted over the radio channel. The second method utilises detection of a carrier signal to postpone transmission of data. Both methods require configuration of several options for successful operation. As the channel busy indication bit is critical for reliable operation default interpretation of this bit is defined in the remote units. If the master modem stops transmission (or has not yet started) the remote will interpret that the channel is busy and will not transmit until the master comes on line. Carrier Detect This method of collision avoidance utilises a carrier transmitted to all remotes to indicate that the radio channel is busy. When selected a dialogue box appears and several options must be configured: 54 Part I – TVIEW+ Management Suite - Programmer • Mode – “Master” or “Remote”. When the master unit receives a valid transmission from a remote unit it transmits a carrier signal to indicate busy. Of course the master will also initiate a transmission if it has data to send. The transmitted carrier is interpreted by the other remotes to not transmit. Once the transmission from the first remote ends the master unit stops transmission to indicate the channel is now clear to transmit on. The master unit, which is normally a base station, takes about 5ms to detect a transmission from a remote unit and transmit a carrier signal. During this period collision of remote transmissions can still occur and is unavoidable. Note: The master can only be a full duplex unit and cannot be permanently transmitting. For half duplex and simplex systems all units should be set as “Remote” (no Master). • Backoff Timing – “Maximum Slots”, “Time per Slot”. This can only be configured if the mode is “remote”. When a remote is ready to transmit data but it detects a carrier signal. Unit Information The information displayed is intended to assist the user to identify the radio modem as well as support should their services be needed. Radio Model refers to the type of unit. The ER450 is a remote unit and the EE450 is a exciter inside a base station unit. Gen II will be noted where Gen II hardware is detected. Unit Information - Details More detailed information is also available to assist in identifying components installed in the unit (remote, base station or hot standby). The additional information provided is: • Controller Rev refers to the microcontroller firmware component version for the radio. • DSP Code Rev refers to the DSP firmware component version for the radio. • Processor Board ID refers to the processor board identification number and hardware revision information for the radio. • RF Deck ID refers to the RF deck board identification number and hardware revision information inside the radio. • Production Build Code refers to the automated production test and calibration sequence used during manufacture of the radio. • Hardware indicates whether the radio is half or full duplex. • Unit Type indicates whether the unit is recognised as a remote or base station. • Tx and RX Frequency Range indicates the frequency range for which the radio is capable of being operated in. In the case of a base station unit the following additional information is provided: • Base Firmware Pack refers to the firmware package version installed in the base station (front panel) controller which is separate to the radio installed. There are several components associated with this firmware package and a single version number is used to identify them. • Base Controller Rev refers to the microcontroller firmware component version for the base station. Messages The message window provides a log of error messages occurring during use of the programmer utility. Several error messages may occur as a result of a selection. Status Bar Radio Type refers to the frequency band supported by the radio as well as the channel bandwidth. For example 51A02 is a type 51 band with a 25kHz channel. The status bar is located at the bottom of the main window and provides information regarding communication actions occurring with the radio data modem. Diags Installed is set to yes or no depending on whether the diagnostics key has been set in the unit. Additional fields located on the status bar include: Serial Number is unique to each unit and is set within the unit at time of production as well as included on the label fixed to the unit. Firmware Pack refers to the firmware package version installed in the radio. There are several components associated with microcontroller and DSP firmware installed and a single version number is used to identify them. • Unit ID refers to the identification label used by the diagnostics utility. This is currently the same as the unit’s serial number. • Mode refers to the type of session established. It can be a File, Local indicating a local port connection to the unit or Remote indicating communications is via a radio channel. 55 Part I – TVIEW+ Management Suite - Programmer Configuring E-Series for use with M-Series Connect the E Series Master radio to the computer using the TView+ Programming and Diagnostics cable Described in the previous section. Read the E-Series unit. Using the Wizard facility is the quickest way to confgure the bulk of the radio confguration parameters. Click on the Wizard button to activate the Wizard menu. Click on Wizard Button number 8: “E Series Confgured for M Series compatibility.” The screen then returns to the normal E Series confguration screen. Frequencies, TX Power and Modulation Type can now be confgured. The following menu will be shown. (a) Enter an appropriate TX frequency. (b) Enter an appropriate RX frequency. Note : If using half duplex (ie:different) TX & RX frequencies the Remote M Series radio must have the opposite frequency settings with respect to the Master. (c) Change the TX power to 20 dBm. (d) Select the appropriate modulation - Normally “9600 12.5kHz M-Series” Note : The modulation setting must be identical in both E Series Master and M Series Remote radios for correct operation to occur. This now completes the E Series confguration programming. Select Master by clicking on the “Master” button. This will pre-confgure the radio to a known working confguration suitable for communication with the M Series. 56 Part J – Appendices Part J – Appendices Appendix A - Firmware Updates Firmware Update Overview Firmware updates are performed on a unit connected locally to the PC. It is recommended that all cabling to the unit be disconnected prior to commencing firmware update to minimise any interruption to the process or disturbances of signals on cables still connected. All other TView+ Management Suite utilities should also be exited during the firmware update process. Firmware Update for E Series Base Station Exciters - Gen II (Serial No 56000 or above) 1. 2. 3. Select the “Device Type” as “Exciter - E Series Gen II” from the options on the top right of the firmware update main window. 4. Select the file containing the firmware update package using the “Open Firmware Package” button at the bottom of the main window. After opening the file, the browse window will close and a description of the firmware package will appear in the main window. 5. Initiate the firmware updating process using the “Write” button at the bottom of the main window. 6. Depress the Base Station F/W Update switch on the Front Panel of the Base Station using a suitable probe. This switch is located below the “Display ON/OFF” button and to the left of the Systems Port. In order to depress the switch a small object such as a paperclip is required. Note: The base station will display all LEDs as AMBER indicating the firmware update is in progress. 7. Another information window will appear. Wait until the firmware update process indicates the firmware update is “Done”. 8. Remove DC power to the base station and re-apply power to ensure the base station returns to normal operating mode. The procedure to update the firmware is different for both E Series Generation I and Generation II radios. Please ensure you have the latest release of the TView+ Management Suite before you attempt a firmware upgrade. This can be obtained from the Trio website at Firmware Update for E Series Remote Radios Gen II (Serial No 56000 or above) 1. Click on the “E Series Firmware Update” Start the firmware update utility from the TView+ front panel. 2. Connect the TView+ E Series diagnostics/programming cable from the PC Serial (COM) port to the systems port on the radio as shown below. Select the appropriate COM Port if required. 3. 4. 5. Select the “Device Type” as “Radio - E Series Gen II” from the options on the top right of the firmware update main window. Select the file containing the firmware update package using the “Open Firmware Package” button at the bottom of the main window. After opening the file, the browse window will close and a description of the firmware package will appear in the main window. Click on the “E Series Firmware Update” Start the firmware update utility from the TView+ front panel. Connect the TView+ E Series diagnostics/programming cable from the PC Serial (COM) port to the systems port on the base station front panel. Select the appropriate COM Port if required. Firmware Update for E Series Remote Radios and Base Station Exciters - Gen I (Serial No 56000 or below) 1. Start the firmware update utility from the TView+ front panel. 2. Disconnect power from the unit by turning off the power supply or removing the power connector to the unit. 3. Connect an E Series Gen I Firmware Update cable from the PC serial (COM) Port to Port B on the radio as shown below. Initiate the firmware updating process using the “Write” button at the bottom of the main window. Another information window will appear. Wait until the firmware update process indicates the firmware update is “Done”. The radio is now ready to use. 4. Select the unit type from the options on the top right of the firmware update main window. Please note that “Exciter” refers to the radio contained inside the base station. Note: The firmware update of a base station exciter will result in the base station flashing all LEDs RED with the fan on. This error condition will only occur whilst the firmware update is in progress. 57 Part J – Appendices 5. 6. 7. Select the file containing the firmware update package using the “Open Firmware Package” button at the bottom of the main window. After opening the file, the browse window will close and a description of the firmware package will appear in the main window. Initiate the firmware updating process using the “Write” button at the bottom of the main window. Another logging window will appear. Reconnect power to the unit when prompted in the logging window. The status LEDs on the unit including power should all be extinguished and the transfer of firmware should commence. If this does not occur steps 6 & 7 should be repeated. Note: Remote radio status LEDs including power will all be off. 8. The logging window will display the progress of each firmware block transferred and when complete a success dialogue box appears. Type OK to close this dialogue box and type “Exit” in the main window to exit the firmware update utility. 9. Disconnect the cable from Port B and re power the unit to enable the new firmware. Hot Standby Controller Firmware Update Installation Instructions: 1. Update of the hot standby firmware uses the firmware update utility supplied with the TView+ Management Suite. 2. Start the firmware update utility from the TView+ front panel. 3. In the firmware update utility select device type as “Hot Standby Controller”. 4. Select the file containing the firmware update package using the “Open Firmware Package” button at the bottom of the main window. After opening the file the browse window will close and a description of the firmware package will appear in the main window. 5. Ensure that the hot standby controller is powered. 6. Connect the “TView+ cable” to the front or rear system port of the hot standby controller. . 7. On the hot standby controller front panel, depress and hold the “Reset Alarms” button, then momentarily depress the firmware update switch using a suitable thin probe. Now release the “Reset Alarms” button. The two LEDs either side of the “Select” switch should turn green indicating the hot standby controller is in firmware updating mode. Base Station Display Firmware Update Installation Instructions: 1. Update of the front panel firmware uses the firmware update utility supplied with the TView+ Management Suite. 2. Start the firmware update utility from the TView+ front panel. 3. In the firmware update utility select device type as “Base Station Front Panel” 4. Select the file containing the firmware update package using the “Open Firmware Package” button at the bottom of the main window. After opening the file the browse window will close and a description of the firmware package will appear in the main window. 5. Ensure that the base station is powered. 6. Connect the “TView+ cable” to the front or rear system port of the base station. 7. On the base station front panel depress and hold the “Display On/Off” button, then momentarily depress the firmware update switch using a suitable probe before releasing the “Display On/Off” button. The firmware update switch is located behind the small hole (not labelled) in the front panel below the “Display On/Off” button. Note: Display Status LEDs will be lit in this Mode.. Note : The firmware update switch is located behind the small hole (not labelled) in the front panel to left of “Reset Alarm” button.. 10. Repower the hot standby controller to enable the new firmware. 10. Re power the base station to enable the new firmware. 58 Part K – Support Options Part K – Support Options E-mail Technical Support When e-mailing questions to our support staff, make sure you tell us the exact model number (and serial number if possible) of the Trio equipment you are working with. Include as much detail as possible about the situation, and any tests that you have done which may help us to better understand the issue. If possible, please include your telephone contact information should we wish to further clarify any issues. Technical Support: Europe, Africa, Middle East Available: Monday to Friday 8:30am - 5:30pm Central Europe Standard Time Direct Worldwide: +31 (71) 579 1655 Email: euro-support@controlmicrosystems.com Technical Support: The Americas Available: Monday to Friday 8:00am - 6:30pm Eastern Standard Time Toll free within North America: 1-888-226-6876 Direct Worldwide: +1 (613) 591-1943 Email: technicalsupport@controlmicrosystems.com Technical Support: Asia Pacific Available: Monday to Friday 8:30am - 5:30pm Australian Eastern Standard Time Direct Worldwide: +61 3 8773 0100 Email: support@triodatacom.com Information subject to change without notice. © Copyright 2011 Trio Datacom Pty Ltd. All rights reserved. Issue: 06-11 59
https://manualzz.com/doc/935603/schneider-electric-eb450-user-manual
CC-MAIN-2018-39
refinedweb
22,112
51.89
When bit-field data was stored in a Scalar in ValueObjectChild during UpdateValue() it was extracting the bit-field value. Later on in lldb_private::DumpDataExtractor(…) we were again attempting to extract the bit-field: s->Printf("%" PRIu64, DE.GetMaxU64Bitfield(&offset, item_byte_size, item_bit_size, item_bit_offset)); which would then not obtain the correct value. This will remove the extra extraction in UpdateValue(). We hit this specific case when values are passed in registers, which we could only reproduce in an optimized build. Note: for the test I did not want to rely on clang choosing to pass the union by register, so I used assembly which ensures I will obtain the behavior I am looking to capture for the test. Why remove the code in ValueObject rather than avoid re-extracting at printing time? I'm not sure which one is correct. If you get your hands on a ValueObject for the field in your test, what will GetValueAsUnsigned return? it should give the correct field value. If the test in assembly is what we want, this is also architecture specific. It should be restricted to x86_64 This is fundamentally a no-go. Depending on the optimization pipeline passes this in a register is an assumption that might go away at some point in the future and this test won't test what it has to & will still pass silently. Something like this might work: *depending on the optimization pipeline, the fact that is passed in a register is an assumption that I think this is redundant. The default is a.out Given that the source code is a .s file, I think the -O1 is just redundant and can be removed. Using assembler is fine for this purpose. Is it possible to just override the rule that produces the .o file? Otherwise you are dropping the codesign and dsymutil phase. lldbutil has a helper for running to a breakpoint by name. lldb_private::DumpDataExtractor(…) is general purpose and it used by a lot of other code, it does know the value comes from a Scalar or otherwise it is just receiving a DataExtractor and obtaining the data from there. I did try using Specifying Registers for Local Variables and it did not work :-( but in good news, I don't need the -O1 it was left over when I was struggling to get the test going. Yes, this was left over when I was experimenting trying to get the test to work I do not need the -O1. Let me see if I can remove the .o step. Yes. I could not get it to work using lldbutil I was working w/ @JDevlieghere on this and he thought that made sense. IIUC I would have rewrite the assembly file to make it work. Removing use of -O1 from Makefile. You didn't answer the most important question. Will GetValueAsUnsigned return the correct value on such a ValueObject once you remove this code? apologies, misunderstood. Yes, it does: (lldb) script var = lldb.frame.FindVariable("u") (lldb) script print(var.GetChildMemberWithName('raw')) (uint32_t) raw = 1688469761 (lldb) script print(var.GetChildMemberWithName('a')) (uint32_t:8) a = 1 (lldb) script print(var.GetChildMemberWithName('b')) (uint32_t:8) b = 1 (lldb) script print(var.GetChildMemberWithName('c')) (uint32_t:6) c = 36 (lldb) script print(var.GetChildMemberWithName('d')) (uint32_t:2) d = 2 (lldb) script print(var.GetChildMemberWithName('e')) (uint32_t:6) e = 36 (lldb) script print(var.GetChildMemberWithName('f')) (uint32_t:2) f = 1 Whoops, copy-pasta: (lldb) script print(var.GetChildMemberWithName('raw').GetValueAsUnsigned()) 1688469761 (lldb) script print(var.GetChildMemberWithName('a').GetValueAsUnsigned()) 1 (lldb) script print(var.GetChildMemberWithName('b').GetValueAsUnsigned()) 1 (lldb) script print(var.GetChildMemberWithName('c').GetValueAsUnsigned()) 36 (lldb) script print(var.GetChildMemberWithName('d').GetValueAsUnsigned()) 2 (lldb) script print(var.GetChildMemberWithName('e').GetValueAsUnsigned()) 36 (lldb) script print(var.GetChildMemberWithName('f').GetValueAsUnsigned()) 1 The test LGTM now! Please be sure to address Fred's comment before committing. Do we have an end-to-end (with source code instead of assembler) test for ObjC bitfields, too? If not, it might still be a good a idea to add one even if it doesn't add coverage for this particular change. I just have a small comment about the test. If you build the test with an llvm.org version of clang (best if it contains the git hash it was build from) and you don't include headers (they don't seem to be required for the test), then the file would be much easier to update/extend for other people. Updated to use llvm.org clang, remove header files from the main.c and add the commit hash for the clang so that it is easier to replicate the main.s in the future.. In D85376#2209638, @labath wrote:. This sounds like a great approach, I have unfortunately been struggling to get a test case that works. It looks like I am hitting another bug, I am not surprised b/c using slight variations on this code I have found other three other bugs with how we deal with DW_OP_piece, DW_OP_bit_piece and I think DW_AT_const_value respectively. I have been working w/ this: #include <stdio.h> typedef union { unsigned raw; struct { unsigned a : 8; unsigned b : 8; unsigned c : 6; unsigned d : 2; unsigned e : 6; unsigned f : 2; } ; } U; static U ug= (U)(unsigned)0x0; void f(U u) { printf( "%d\n", u.raw); return; } int main() { ug.raw = 0x64A40101; f(ug); printf( "%d\n", ug.raw); } and compiling as using clang -O1 -gdwarf-4 but we obtain bad values: (lldb) target variable ug (U) ug = { raw = 3395301392 = (a = 16, b = 48, c = 32, d = 1, e = 10, f = 3) } I tried generating assembly and manually adjusting the debug info but I was not able to get very far there. FYI this was the DWARF expression it was generating: DW_AT_location (DW_OP_addr 0x100002010, DW_OP_deref_size 0x1, DW_OP_constu 0x64a40101, DW_OP_mul, DW_OP_lit0, DW_OP_plus, DW_OP_stack_value) If you can come up w/ a way to generate a test that produces correct values I am happy to use it! We found a way to hand modify the assembly and it looks good, I just need to convert it to a test. Replacing python test with Shell test I'll leave the test review to Pavel who knows that much better, but I have two last nits about the test. I think this was still generated with system clang. info_string below says this was compiled by Apple clang version 12.0.0 (clang-1200.0.31.1) and not the listed commit (which would create an info_string like clang version 12.0.0 ( 86dea1f39bd127776b999e10dff212003068d30a).) You can avoid these system-specific paths by compiling the file in /tmp with your cwd in /tmp and passing -isysroot / to the clang invocation. This way this section would look like this for everyone independently of their system username or macOS version (which will make updating this much easier): .asciz "clang version 12.0.0 ( 6acb897dfbc0ec22007cde50b3bc9c60f4674fb2)" ## string offset=0 .asciz "/tmp/weird.c" ## string offset=101 .asciz "/" ## string offset=114 .asciz "/tmp" ## string offset=116 .asciz "ug" ## string offset=121 .asciz "U" ## string offset=124 .asciz "raw" ## string offset=126 .asciz "unsigned int" ## string offset=130 .asciz "a" ## string offset=143 This gives a much more compact debug info section: typedef union { unsigned raw; struct { unsigned a : 8; unsigned b : 8; unsigned c : 6; unsigned d : 2; unsigned e : 6; unsigned f : 2; }; } U; // This appears first in the debug info and pulls the type definition in... static U __attribute__((used)) _type_anchor; // ... then our useful variable appears last in the debug info and we can // tweak the assembly without needing to edit a lot of offsets by hand. static U ug; extern void f(U); // Omit debug info for main. __attribute__((nodebug)) int main() { ug.raw = 0x64A40101; f(ug); f((U)ug.raw); } You can easily edit out the TEXT section, the line table and the accelerator tables and patch the location expression to give you a minimal binary. I don't think you need the TEXT segment at all, or at least you can make it empty. Updated test using more compact code from Fred. This looks good to me. I appreciate the efforts taken to reduce the test size. The trick for controlling the debug info order is neat, and I may end up using it some time. FWIW, the way I usually handle these things is by first replacing all constant debug info offsets with symbolic references (.long 123 -> .long .Lmytype-.debug_info). After that, it's possible to freely manipulate any debug info entry. (At that point I usually delete all DW_AT_decl_file/lines and other boring attributes, which tends to reduce the file a lot). I don't think the test file name matches what is being tested anymore. Maybe name it something like DW_AT_data_bit_offset-DW_OP_stack_value (in line with other tests in this folder)? Update test name
https://reviews.llvm.org/D85376?id=285423
CC-MAIN-2021-31
refinedweb
1,473
66.23
Hola Coders! This article is all about Flask static files and its implementation. So let’s get started! The need for Static Files in Flask You would have observed that almost all the websites consist of photos, Background colors, and many other beautification elements. This aesthetic nature of websites is achieved by using static files, which comprise of Images, CSS files, and JS scripts. We save these static files in a separate folder called static located beside our main Flask application. Now that we have some knowledge about static files let’s see implement them. Hands-on with Flask Static Files We will now display a background static file image on our webpage using Flask. 1. Coding our Main application Consider the following Flask application code from flask import Flask,render_template app = Flask(__name__) @app.route('/blog') def blog(): return render_template('blog.html') app.run(host='localhost', port=5000) Here we are rendering an HTML template using the render_template function. If you get any trouble understanding the application syntax, check out our Introduction to Flask article for better understanding. 2. Coding our Templates Here we use the special URL attribute to specify the Static File location. <img src = "{{ url_for('static',filename="<filename>") }}> The url_for attribute pulls out the path of the file located inside the static folder. You can download the below image for this demonstration and save it in the static folder. Now create a “blog.html” Template File and add the below code in it: <html> <body> <img src= "{{ url_for('static',filename='blog.jpg') }}"> <h2>This is a blog website</h2> </body> </html> Do checkout our Flask Templates article to know more about rendering Templates in Flask 3. Implementation of the Code That’s it; let us now run the server and check our web page Perfect !! Conclusion That’s it for this tutorial, guys! I hope the article helped you improve your knowledge of Static Files in Flask. Do check out our Flask Template article to learn more about Templates. See you in the next article! Till then, Happy coding!!
https://www.askpython.com/python-modules/flask/flask-static-files
CC-MAIN-2021-10
refinedweb
343
57.47
Chatlog 2011-10-12, PatHayes <sandro> GUEST: Tim (tlebo) Lebo, RPI <sandro> REMOTE: pfps, az, ww 11:09:22 <RRSAgent> RRSAgent has joined #rdf-wg 11:09:22 <RRSAgent> logging to 11:09:24 <Zakim> Zakim has joined #rdf-wg 11:09:26 <sandro> zakim, this is rdf2wg 11:09:26 <Zakim> ok, sandro; that matches SW_RDFWG(F2F)6:00AM 11:10:04 <AZ> zakim, who is on the phone? 11:10:04 <Zakim> On the phone I see AZ, +1.617.324.aaaa, ??P2 11:10:11 <yvesr> sandro, we could hear you fairly well over h323 11:10:23 <yvesr> (a bit better than on zakim) 11:10:37 <sandro> RRSAgent, pointer? 11:10:37 <RRSAgent> See 11:10:50 <sandro> we see one very still, very blocky image. 11:10:54 <sandro> Well, we'll have some Zakim-only people, so I think we have to use zakim for audio. 11:11:01 <sandro> new call, 384kbos 11:12:23 <Scott_Bauer> Scott_Bauer has joined #rdf-wg 11:12:26 <cygri> cygri has joined #rdf-wg 11:12:34 <sandro> RRSAgent, pointer? 11:12:34 <RRSAgent> See 11:12:39 <sandro> Meeting: RDF F2F2 11:13:30 <Guus> mischa has offered to scribe the first session 11:14:04 <AlexHall> AlexHall has joined #rdf-wg 11:16:08 <Zakim> +Peter_Patel-Schneider 11:17:38 <davidwood> davidwood has joined #rdf-wg 11:17:39 <pfps> pfps has joined #rdf-wg 11:17:47 <mischat> Zakim: scribe mischat 11:17:47 <mischat> RRSAgent: scribe mischat 11:17:47 <RRSAgent> I'm logging. I don't understand 'scribe mischat ', mischat. Try /msg RRSAgent help 11:18:13 <ivan> scribenick: mischat 11:18:20 <mischat> sandro: that was me calling you 11:18:42 <yvesr> we're trying to sip into zakim, so that we can hear you better 11:19:32 <danbri> scribe: Mischa Tuffield 11:20:41 <mischat_> mischat_ has joined #rdf-wg 11:21:24 <Zakim> -??P2 11:21:29 <iand> iand has joined #rdf-wg 11:21:50 <Zakim> +??P2 11:22:35 <Guus> [david, I'm on the Web client of IRC, so not receiving anything alse] 11:23:51 <davidwood> Does someone in London have a Skype ID? 11:23:59 <davidwood> If so, I can try calling you. 11:24:03 <gavinc> gavinc has joined #rdf-wg 11:24:09 <davidwood> Guus, ack 11:25:18 <sandro> We can actually hear you through the H channel - but it's unintelligible. 11:25:30 <sandro> So please turn off the audio channel. 11:26:07 <Zakim> -??P2 11:26:15 <sandro> zakim, who is on the call? 11:26:15 <Zakim> On the phone I see AZ, +1.617.324.aaaa, Peter_Patel-Schneider 11:26:24 <Zakim> +??P4 11:26:31 <sandro> zakim, aaaa is MIT_Meeting_Room 11:26:31 <Zakim> +MIT_Meeting_Room; got it 11:27:28 <davidwood> I'm sure there is a FOAF tag for that 11:27:44 <swh> what about a language tag? 11:27:45 <mischat> as well an inverse foaf property 11:28:19 <gavinc> Can you turn off the audio on your video? 11:29:34 <gavinc> Please, can you turn off the audio on your video 11:30:30 <sandro> topic: introductions 11:30:43 <AZ> is there a video stream available for remote participants? 11:30:54 <sandro> David Wood, Gavin, Tim Lebo, Alex Hall, Sandro, Scott Bauer, Lee F 11:31:01 <sandro> scribeL mischa 11:31:04 <danbri> AZ, we tried but nothing yet. Will try again to fix it in next break. 11:31:07 <sandro> scribe: mischa 11:31:37 <sandro> zakim, who is talking? 11:31:40 <mischat> Mischa, Pierre, Ian, Andy, Richard, NickH, Ivan, Steve, Danbri, Yves 11:31:43 <AndyS> scribenick: mischat 11:31:49 <Zakim> sandro, listening for 10 seconds I heard sound from the following: ??P4 (77%) 11:31:57 <ww> zakim, remind me of the telephone number please 11:31:57 <Zakim> I don't understand 'remind me of the telephone number', ww 11:32:05 <sandro> zakim, who is on the call? 11:32:05 <Zakim> On the phone I see AZ, MIT_Meeting_Room, Peter_Patel-Schneider, ??P4 11:32:09 <AndyS> We're trying to sort the positioning out now 11:32:10 <davidwood> zakim, code? 11:32:10 <Zakim> the conference code is 733294 (tel:+1.617.761.6200 sip:zakim@voip.w3.org), davidwood 11:32:12 <sandro> Zakim, what is the code? 11:32:13 <Zakim> the conference code is 733294 (tel:+1.617.761.6200 sip:zakim@voip.w3.org), sandro 11:32:35 <LeeF> LeeF has joined #rdf-wg 11:32:36 <danbri> zakim, who is speaking? 11:32:47 <sandro> zakim, ??P4 is BBC_Meeting_Room 11:32:47 <Zakim> +BBC_Meeting_Room; got it 11:32:49 <Zakim> +??P2 11:32:50 <Zakim> danbri, listening for 10 seconds I heard sound from the following: AZ (34%), ??P4 (64%) 11:32:56 <mischat> Guus: is proposing we jump to the first item of the agenda 11:32:56 <ww> Zakim, ??P2 is ww 11:32:56 <Zakim> +ww; got it 11:33:12 <danbri> it's hearing noise from AZ 11:33:27 <danbri> AZ, can we mute you? you can unmute via bot here 11:33:30 <mischat> can we mute AZ or is that just rude? 11:33:32 <danbri> zakim, mute AZ 11:33:32 <Zakim> AZ should now be muted 11:33:36 <AZ> Zakim, mute me 11:33:36 <Zakim> AZ was already muted, AZ 11:33:37 <ww> zakim, mute me 11:33:37 <Zakim> ww should now be muted 11:33:56 <AZ> strange, my phone was muted already 11:34:02 <gavinc> Time for POTS! 11:34:58 <Zakim> -BBC_Meeting_Room 11:35:00 <ww> even post is voip these days :) 11:35:04 <iand> danbri spending most of this meeting being tied to his chair by power cables 11:35:19 <Zakim> +??P4 11:35:29 <cygri> zakim, ??P4 is BBC_Meeting_Room 11:35:29 <Zakim> +BBC_Meeting_Room; got it 11:36:08 <mischat> Guus: move to the first item of the agenda, the naming issue 11:36:23 <pchampin> 11:36:32 <pfps> it would be nice if the agenda had pointers to the relevant information. 11:36:33 <danbri> zakim, BBC_Meeting_Room holds mischat, Guus, danbri, yvesr, pchampin, swh, ivan, cygri, iand, andys 11:36:33 <Zakim> +mischat, Guus, danbri, yvesr, pchampin, swh, ivan, cygri, iand, andys; got it 11:36:45 <AndyS> 11:36:54 <sandro> sandro has changed the topic to: Oct 12 -- 11:36:59 <danbri> zakim, BBC_Meeting_Room also holds NickH 11:36:59 <Zakim> +NickH; got it 11:37:01 <mischat> Guus: first item to discuss and decide on teminology 11:37:17 <mischat> Guus: based on sandro's g* teminology 11:37:26 <mischat> Guus: gbox == graph container 11:37:35 <mischat> Guus: gsnap == graph or graph set 11:37:45 <mischat> Guus: gtext == graph serialisation 11:37:49 <sandro> q+ 11:37:52 <LeeF> "graph set" is misleading because it sounds like a bunch of graphs 11:38:03 <mischat> ⦠so are these a good place to start? 11:38:15 <mischat> sandro: doesn't remember us talking about a graph set 11:39:16 <mischat> ivan: can we use the queue, as I am scribing from here 11:39:25 <davidwood> q+ to summarize MIT discussion 11:39:32 <cygri> q+ to propose to drop g-text from the discussion, it doesn't seem to be necessary 11:39:32 <mischat> sandro: didn't like the term graph-set, and i think the rest of the terms are far 11:39:52 <mischat> sandro: we should use the g* terminology informally for the time being 11:40:01 <ivan> +1 to Sandro 11:40:01 <Guus> q+ 11:40:06 <ivan> ack sandro 11:40:11 <mischat> for the public working set we should use the Guus proposed graph terminology 11:40:19 <danbri> ack davidwood 11:40:19 <Zakim> davidwood, you wanted to summarize MIT discussion 11:40:23 <mischat> davidwood: had a private conversation with LeeF 11:40:27 <sandro> sandro: Let's keep using g-* terms if they seem useful, but "graph set" is bad. 11:40:53 <sandro> david: "graph" itself is too ambiguous. 11:40:55 <mischat> davidwood: LeeF proposed it graph snapshot, the idea of using graph for gsnap could be an issue 11:40:59 <mischat> as it is too ambitious 11:41:09 <danbri> I can't find much on g-snap, except 11:41:18 <iand> terminology summary proposal was at 11:41:34 <danbri> sorry I meant - can't find much on graph set 11:41:40 <gavinc> Turtle needs to talk about graph seralizations 11:41:43 <mischat> cygri: g-snap and g-box pop up a lot, but the g-text term doesn't pop up lots 11:41:47 <davidwood> There was an earlier proposal to drop g-text. +1 to cygri. 11:41:56 <sandro> +1 cygri dropping "g-text" and just using "graph serialization" 11:41:56 <mischat> so we might not need an official term for it 11:41:58 <cygri> ack me 11:41:58 <Zakim> cygri, you wanted to propose to drop g-text from the discussion, it doesn't seem to be necessary 11:42:20 <sandro> q? 11:42:28 <davidwood> If we need a term for Turtle, we can always create a term for g-text at that time. 11:42:31 <ivan> ack guus 11:42:36 <mischat> Guus: thinks that graph-set is poor, and gnap-snapshot is a bit geeky 11:42:41 <danbri> "graph dump?" or has unpleasant associations? 11:42:43 <danbri> q? 11:42:58 <gavinc> Is anyone keen on "graph set"? 11:43:21 <cygri> +1 to ask whether anyone wants to change the term âRDF graphâ from Concepts 11:43:22 <sandro> +1 "graph set" sounds a lot like a set of graphs. 11:43:24 <pchampin> to me "graph set" also sounds like "a set of graphs" 11:43:28 <danbri> gavinc, when I heard "graph set", I thought it meant a g-box, so i guess the intuitions are wrong. And it'll probably annoy mathematicians. 11:43:31 <mischat> Guus: requirement for the naming is that they match concepts which new people coming into RDF must be easy to understand 11:43:38 <cygri> q+ to ask whether anyone wants to change the term âRDF graphâ from Concepts 11:43:40 <davidwood> "graph version"? 11:43:47 <cygri> ack me 11:43:47 <Zakim> cygri, you wanted to ask whether anyone wants to change the term âRDF graphâ from Concepts 11:43:48 <LeeF> I don't imagine that these are really terms that are going to need to be taught in beginners' tutorials, are they? 11:43:56 <mischat> Guus: graph set is a bit geeky, and might lead people to think that it is a "collection of graphs" 11:43:57 <tomayac> tomayac has joined #rdf-wg 11:43:57 <danbri> q+ to suggest Graph Image (like a picture of frozen snapshot, notion ... same as machine images, .iso etc) 11:44:10 <AZ> why not "RDF graph" as in all Sem Web specs? 11:44:20 <ivan> g+ 11:44:22 <ivan> q+ 11:44:33 <AZ> "graph" is totally ambiguous but "RDF graph" is well defined 11:44:56 <mischat> cygri: notes that the term "RDF graph" matches are use of gsnap, would we have to renamed the term in the RDF Concepts document 11:44:59 <ivan> ack danbri 11:44:59 <Zakim> danbri, you wanted to suggest Graph Image (like a picture of frozen snapshot, notion ... same as machine images, .iso etc) 11:45:02 <davidwood> Is it? Or is it equally ambiguous 11:45:12 <mischat> danbri: suggest "RDF image" as a term for g-snap 11:45:20 <danbri> ack me 11:45:20 <sandro> "Image" is okay, but not as good as "snapshop", for me. 11:45:23 <mischat> danbri: the term image, as in something which doesn't change 11:45:28 <davidwood> concur 11:45:36 <davidwood> (with Sandro) 11:45:38 <iand> i like davidwood's "graph version" 11:45:41 <pfps> +1 to ivan 11:45:44 <mischat> ivan: we should try to use the term "graph" consistently for the g-snap 11:45:49 <danbri> graph version works for me 11:46:13 <cygri> +1 to ivan 11:46:17 <mischat> Guus: this would make the smallest change to the documents 11:46:18 <danbri> i might try the 'image' metaphor in supporting materials. people mostly will just use 'graph' and be vague, whatever we decide. 11:46:19 <sandro> strawpoll between "RDF Graph", "Graph Snapshot", and "Graph Version" ? 11:46:29 <davidwood> -1 to Ivan (sorry). We really need to be unambiguous. 11:47:01 <mischat> Guus: by default we should use the RDF graph to mean the g-snap 11:47:02 <davidwood> q? 11:47:15 <ivan> q? 11:47:18 <ivan> ack ivan 11:47:39 <cygri> q+ 11:47:44 <zwu2> zwu2 has joined #rdf-wg 11:47:57 <mischat> Guus: graph serialisation and graph container, are we happy with this? 11:48:10 <mischat> Guus: is all the discussion around g-snap then right? 11:48:32 <mischat> cygri: davidwood are suggesting we change the term "graph" in the RDF concepts 11:48:34 <mischat> ? 11:48:42 <AZ> -1 to rename "RDF graph" 11:48:43 <mischat> cygri: as per your "-1" early 11:49:08 <davidwood> cygri, yes. I propose that RDF Graph as defined in RDF Concepts be changed to "graph snapshot" or another term that we agree upon. 11:49:24 <mischat> sandro: agrees that it would be hardwork to change the term in the concepts, but agrees that it would be beneficial to make it less ambiguous 11:49:36 <gavinc> Can we write the question in IRC? 11:49:42 <mischat> Guus: keeping it is as, RDF graph for g-snap? 11:49:48 <ivan> +1 11:50:02 <cygri> +1 11:50:03 <swh> +1 11:50:04 <pchampin> +1 11:50:07 <davidwood> -1 11:50:10 <gavinc> -0 11:50:10 <mischat> +1 11:50:13 <tomayac> =1 11:50:15 <sandro> 0 very conflicted 11:50:15 <yvesr> +1 11:50:17 <AndyS> Strawpoll -- g-snap ==> RDF graph 11:50:17 <iand> +1 11:50:18 <zwu2> +1 11:50:21 <AlexHall> +1 11:50:25 <AZ> +1 11:50:26 <AndyS> +1 11:50:31 <tomayac> +1 (fscking US keyboard) 11:50:33 <danbri> +1 11:50:34 <AZ> (and banish the use of "graph" alone, "graph" != "RDF graph") 11:50:36 <pfps> +1 11:50:39 <LeeF> 0 11:50:59 <tlebo> q+ 11:51:02 <pchampin> q+ 11:51:03 <cygri> ack me 11:51:07 <yvesr> i guess it just needs clarification 11:51:13 <AZ> q+ 11:51:14 <iand> q+ 11:51:25 <mischat> davidwood: is surprised that we are choosing to keep the term as it, given the issues we faced early on in the WG 11:51:39 <gavinc> WE might know that, my -0 is that I'm not sure that anyone else will be clear about that. 11:51:48 <swh> +1 11:51:48 <iand> q- 11:51:52 <swh> q+ 11:51:57 <AZ> zakim, unmute me 11:51:57 <Zakim> AZ should no longer be muted 11:52:12 <tlebo> +1 "RDF Graph" : as long as "Graph" is contrasted with the other terms (container, serialization), it clarifies what it is and is not. 11:52:13 <pfps> -1 to david's sentiments - RDF graph is not confusing in itself, the issue was that there are other notions that did not have names, and they were bleeding into the only name that we had 11:52:16 <tlebo> q? 11:52:17 <mischat> Guus: states that we learnt from the early discussions, and by tightening up the other definitions like g-text and g-box 11:52:19 <Guus> q? 11:52:22 <iand> +1 to pfps 11:52:24 <cygri> +1 to guus. we lacked a good term for g�-box. once that's fixed, it'll be easier to be clear and unambiguous 11:52:36 <Souri> Souri has joined #RDF-WG 11:52:36 <mischat> Guus: we would be making the term "RDF Graph" less ambiguous 11:53:02 <pfps> +1 to tlebo 11:53:04 <tlebo> q- 11:53:07 <ivan> ack tlebo 11:53:10 <ivan> ack pchampin 11:53:14 <AZ> +1 tlebo 11:53:17 <mischat> tlebo: by fixing terms for the other two terms, would make it term graph == g-snap 11:53:20 <danbri> do all these definitions have identity conditions for the things they're naming? 11:53:23 <AZ> q- 11:53:25 <sandro> tlebo: If we have "Graph Container" and "Graph Serialization", then "Graph" becomes clearer, and renaming it would be a problem. 11:53:47 <yvesr> q? 11:53:49 <gavinc> Where "Graph" is "RDF Graph" yes? 11:53:53 <davidwood> The one thing we get out of the continued use of the term "graph" for a g-snap is that it can be considered a proper set. 11:53:56 <ivan> ack swh 11:54:04 <tlebo> yes, where "Graph" becomes "RDF Graph" 11:54:09 <mischat> pchampin: states that the official term for the g-snap should be Graph, and having the other two terms defined would make it less ambiguous 11:54:25 <AlexHall> q+ 11:54:33 <mischat> swh: said that the term graph hasn't really hurt anyone in practice 11:54:39 <mischat> davidwood: suggests that we move on 11:54:50 <AZ> g-snaps should be "RDF Graph" not "Graph" 11:55:06 <sandro> PROPOSED: In our documents, we'll use the terms "RDF Graph" for g-snap, "Graph Container" for g-box, and "Graph Serialization" for g-text 11:55:16 <mischat> Guus: resolution In our documents we will use the term RDF Graph for notion of the g-snap 11:55:36 <sandro> +1 11:55:41 <davidwood> 0 11:55:41 <mischat> Guus: any objections to the proposal 11:55:41 <pchampin> +1 11:55:42 <Souri> +1 11:55:43 <pfps> +1 11:55:44 <iand> +1 11:55:45 <AZ> +1 11:55:46 <sandro> (with a little hesitation, but... it's okay.) 11:55:46 <yvesr> +1 11:55:48 <mischat> Guus: any +1's 11:55:48 <cygri> -0. still not sure about graph container 11:55:48 <zwu2> +1 11:55:52 <tomayac> +1 11:55:55 <ww> 0+ 11:55:56 <ivan> +1 11:56:01 <mischat> Guus: thanks for the first resolution 11:56:01 <gavinc> -0 graph container vs. dataset seems a bit confused 11:56:01 <yvesr> me :) 11:56:05 <sandro> RESOLVED: In our documents, we'll use the terms "RDF Graph" for g-snap, "Graph Container" for g-box, and "Graph Serialization" for g-text 11:56:34 <AlexHall> q- 11:56:35 <mischat> Guus: we just won on numbers of hours chatting about graphs :) 11:56:56 <mischat> Guus: topic : named graphs discussion 11:57:28 <mischat> Guus: we have 3 major contributions here Richard, Tim, and who ⦠11:57:42 <tlebo> 11:57:45 <mischat> Guus: tlebo as you are the guest, please go ahead and describe your pro posable 11:57:53 <ivan> s/who/Sandro/ 11:58:16 <mischat> tlebo: ^^ developing a method for describing different views of the same events 11:58:35 <mischat> tlebo: OWL ontology, which uses RDF to make assertions about the world 11:58:53 <mischat> tlebo: we will have to manage chunks of this knowledge using named graphs 11:58:55 <sandro> topic: Named Graphs (?) 11:59:28 <mischat> davidwood: the provenance DM has just been put into FPWD 12:00:05 <mischat> davidwood: what is the relationship between this document and the owl provenance DM? 12:00:50 <mischat> tlebo: we are using named graphs to manipulate statements from different sources 12:01:07 <Guus> q? 12:01:35 <mischat> tlebo: the end result, using the provenance OWL ontology, the contents of a named graph would be triples asserted by different agents 12:01:59 <mischat> Guus: found the statement at the beginning defining what a named graph is 12:02:20 <davidwood> Is Tim's (Jeremy's) "named graph" a g-snap? 12:02:25 <tlebo> "sandro's document"? 12:02:27 <sandro> 12:02:32 <ww> I feel compelled to mention the statement identifier approach again so we can actually talk *directly* about "triples asserted by different agents" instead of being forced to use named graphs as an indirection 12:02:35 <mischat> Guus: you state in one of these assertions is that the named-graph is global 12:02:37 <sandro> q+ 12:03:00 <davidwood> Similarly, is the "global RDF graph" a g-box? 12:03:01 <mischat> Guus: these named graphs are more like files, more like g-boxs 12:03:25 <mischat> tlebo: could adopt of new terminology after this meeting 12:03:52 <mischat> sandro: tlebo's document doesn't assume global naming, it assumes local naming 12:03:52 <danbri> q+ re "Named graphs let you specify a subset of the "global" RDF graph."; that has a kind of mystical feel to it. The global graph would be all triples imaginable? Full of contradictions etc? 12:04:12 <sandro> q- 12:04:49 <mischat> Guus: doesn't understand the statement "Named graphs let you specify a subset of the "global" RDF graph." 12:05:14 <danbri> q? 12:05:15 <mischat> sandro: in our current world, you need a sparql-endpoint URI and a ⦠(sorry sandro ?) 12:05:24 <ivan> ack danbri 12:05:24 <Zakim> danbri, you wanted to discuss "Named graphs let you specify a subset of the "global" RDF graph."; that has a kind of mystical feel to it. The global graph would be all triples 12:05:28 <Zakim> ... imaginable? Full of contradictions etc? 12:05:35 <mischat> danbri: "Named graphs let you specify a subset of the "global" RDF graph." <-- dan was thinking about the Web not about SPARQL 12:05:56 <mischat> danbri: thinks that is more sensible in a SPARQL context not the RDF one 12:06:12 <sandro> sandro: in our current world, you need a sparql-endpoint URI and the tag IRI of the graph within the endpoints dataset. So you need 2 URIs to name a graph. This is unforunate, and not in keeping with web architecture. 12:06:37 <mischat> davidwood: it sounds like a top-down approach 12:06:46 <Souri> q+ 12:06:46 <Guus> q? 12:06:53 <mischat> tlebo: we are talking about a "RDF consumer" based approach 12:08:22 <ww> +1 12:08:27 <mischat> danbri: we have presented RDF to people, we have been criticised for trying to make a giant database for the web, we need to consider named graphs as something which would enable decentralisation 12:08:27 <danbri> blah blah pluralism blah 12:08:37 <gavinc> Named graphs are about decentrializations and pluralism 12:08:40 <cygri> +1 to the "blah blah" part 12:08:43 <ivan> ack Souri 12:08:47 <danbri> basically we got a lot of pushback for seeming to naively believe all RDF could be merged into a single flat unified triple db 12:08:50 <mischat> danbri: asked please do not go down a path of massive giant graph 12:09:30 <mischat> Souri: in the triples-store world, you need to definite the sparql endpoint URL and a graph name. 12:09:35 <danbri> Named Graphs is our comeback, where we say 'nah, we are more pragmatic, ... named graphs are different datasets offering their own perspective into the Web, without need or pressure for global consistency with every other piece of rdf' 12:09:37 <Guus> q? 12:09:56 <yvesr> mischat: davidwood 12:10:12 <danbri> (ie. there isn't (sorry timbl) a giant Global graph as such (except for the happy smaller subset of RDF graphs that happen at some given point to be true); rather we have a graph-of-graphs) 12:10:35 <sandro> that's tlebo 12:10:51 <mischat> Guus: any more questions for tim? 12:11:06 <ivan> zakim, BBC_Meeting_Room also has Thomas 12:11:06 <Zakim> +Thomas; got it 12:11:16 <mischat> Guus: please sandro go through your email 12:11:28 <tlebo> tlebo has joined #rdf-wg 12:11:35 <sandro> 12:12:00 <mischat> sandro: has been thinking about how to make progress on graphs, finds the subject overwhelming 12:12:02 <AndyS> AndyS has joined #rdf-wg 12:12:19 <mischat> sandro: at a high-level the above document should capture our goals ^^ 12:12:30 <mischat> sandro: 12:12:57 <mischat> sandro: 3 difference things we need to do 1. come up with syntaxes for conveying datasets 12:13:17 <mischat> sandro: trig being the big contender, and nquads is there too 12:13:34 <mischat> ⦠the 2nd area, is about vocabularies about conveying datasets 12:13:48 <gavinc> Graph Seralizations Strawman: 12:14:18 <mischat> sandro: 1 is datatypes for documents, 2 plain or RDF strings, 3 reification vocabulary 12:14:37 <mischat> ivan: doesn't understand the difference between 2.1 and 2.2 12:14:49 <davidwood> q+ to ask how Sandro's proposal relates to the way graphs are named in some currently implemented RDF databases. 12:15:01 <AndyS> 2.1 is "<s><p><o>"^^rdf:turtle 12:15:07 <cygri> :G1 owl:sameAs ":s :p :o"^^rdf:Turtle 12:15:22 <cygri> :G1 rdf:turtleSerialization ":s :p :o" 12:15:23 <mischat> sandro: in both cases string in RDF, in 2.1 the datatype is like turtle, so that the value space is an RDF graph, in 2.2 it is a string, so we some predicate which states that the value is a graph 12:15:37 <danbri> do we have datatype URI conventions for Mime types yet? eg. foo:application/rdf+xml ? 12:15:57 <mischat> sandro: the three ways above do not require any change to syntax 12:16:22 <mischat> Guus: are these an alternative for things in 1 12:17:01 <gavinc> danbri, don't I wish 12:17:06 <mischat> sandro: we could do both, but not necessary 12:17:06 <mischat> Guus: we could have a stawpoll on this later 12:17:06 <mischat> sandro: too early for a resolution 12:17:09 <danbri> (has anyone stress-tested RDF stores with multi-gigabyte string literals?) 12:17:35 <gavinc> danbari, yes, they all broke horrigly with even megabyte size literals 12:17:36 <mischat> sandro: 3rd area, if you get sent data outputted from a decision in 1 or 2, what do you do with the data upon receipt 12:17:37 <ww> danbri: i believe so, but clearly not a strong enough convention or best practice that i can't find the vocabulary again with google without trying very hard 12:17:44 <AndyS> [ignore SPARQL "FROM" and "FROM NAMED"] +1 and sort out later 12:18:13 <mischat> sandro: i.e. what are you supposed to do when you get a file with a default graph for example 12:18:36 <cygri> q+ to ask what the association between URIs and resources in plain RDF is in Sandro's taxonomy 12:18:46 <danbri> re 2.1. the latest I found from TAG is this ...debate still between new URI scheme vs names 12:18:46 <davidwood> danbri, the internals of several RDF stores that I am aware of (Mulgara, Sesame, OWLIM) would NOT handle multi-gigabyte strings at all well. That is contrary to their design presumptions. 12:18:55 <mischat> sandro: another big question, are we naming graphs on a global scale 12:20:08 <mischat> davidwood: is curious how this relates this to RDF databases, i.e. we don't seem to acknowledge that there is no mention of common use cases in RDF stores 12:20:37 <mischat> sandro: this that all triplestore are agnostic to the semantics of the named graphs 12:21:14 <mischat> sandro: so if you blindly interact with datasets across the web, then this isn't an issue 12:21:32 <AndyS> HTTP GET / 12:21:46 <mischat> davidwood: thinks that the SPARQL service verb is going this way, where there is automated consumption of datasets on the web 12:21:58 <AndyS> HTTP GET... 12:21:59 <swh> I'm not sure that SPARQL stores are semantics-neutral 12:22:01 <gavinc> q+ 12:22:06 <mischat> davidwood: doesn't think that the semantics and the implementations are that far apart 12:22:10 <sandro> q? 12:22:13 <cygri> ack me 12:22:13 <Zakim> cygri, you wanted to ask what the association between URIs and resources in plain RDF is in Sandro's taxonomy 12:22:14 <ivan> ack davidwood 12:22:17 <swh> at the very least it effects the optimisers 12:22:17 <Zakim> davidwood, you wanted to ask how Sandro's proposal relates to the way graphs are named in some currently implemented RDF databases. 12:23:08 <mischat> cygri: trying to make sense of your options, and what the options mean and what effects. If you look at RDF 1.0 and we look at the association between URIs and resource 12:23:21 <mischat> cygri: where does this association fall in your taxonomy of options 12:23:53 <mischat> sandro: the URI is naming a person globally, this should be a 3.1 thing, from sandro's breakdown 12:24:49 <mischat> cygri: is talking about semantics, and how this fits into the semantic document. As is stands the RDF semantics is rather quiet about these 12:25:04 <mischat> cygri: topics of global naming 12:25:22 <Guus> q? 12:25:23 <mischat> sandro: points to the discussion on the mailing list between richard, pat, and peter 12:26:12 <pfps> It wasn't that Pat and I disagree about how the RDF Semantics work. Instead, we disagree on how this is to be described. I tend to divorce the formal semantics from any surround - I think that Pat tries to push more of this surround into the description of the semantics. 12:26:33 <Guus> [is part of the "Semantics" here not really "Pragmatics"?] 12:26:59 <mischat> sandro: would like to be able to tell developers how to write code which can talk to other peoples datasets 12:27:05 <mischat> gavinc: agrees with sandro and thinks that sparql avoids talking about semantics. different datasets will all be implemented differently, and hence their semantics are different 12:27:08 <AndyS> 1st choice is surely do we make things people current do "wrong" or do we have something that covers several ways of using URI-association-graph: (central design or community emergent behaviour?) A lot of NGs is local only - who cares? - not published. 12:27:15 <mischat> gavinc: is not sure we need perfect semantics 12:27:32 <mischat> gavinc: doesn't think this lack of semantics has hurt anybody 12:27:57 <Guus> q? 12:28:05 <mischat> sandro: what gavinc is talking about was captured in 3.3.2 12:28:06 <Guus> ack gavinc 12:28:13 <mischat> sandro: 12:28:24 <zwu2> q+ 12:28:29 <sandro> q? 12:28:30 <LeeF> q+ to make distinction between what an implementation does and what a user of an implementation does 12:28:45 <mischat> davidwood: there is a social construct which is disjoint from the syntax. this is a social convention :) 12:29:02 <tlebo> q? 12:29:02 <cygri> +1 to davidwood 12:29:08 <ivan> q? 12:29:18 <ivan> azk zwu 12:29:23 <ivan> ack zwu 12:29:23 <mischat> Guus: any more questions for sandro 12:29:27 <cygri> davidwood: don't want to stifle innovation by specifying it too tightly 12:29:38 <mischat> zwu2: what are the confusions which you seeing ? 12:30:27 <cygri> q+ 12:30:41 <mischat> sandro: thinks there will be a future where you are talking to many datasets, and it will become important when each implementation will have different ways of storing their graphs in their triple stores 12:30:50 <ivan> ack LeeF 12:30:50 <Zakim> LeeF, you wanted to make distinction between what an implementation does and what a user of an implementation does 12:31:00 <tlebo> As long as we have rdf2:GraphContainer, don't we have a basis for others to describe the associations among them. e.g., :GN a rdf2:GraphContainer; my:unionOf :G1, :G2 ? 12:31:19 <mischat> LeeF: /me can't understand u 12:31:49 <cygri> +1 to thinking about conformance 12:32:40 <mischat> LeeF: is thinking about conformance, is not clear, is it is the RDF dataset isn't conformant. Should the triplestore have an conformant API. 12:32:42 <sandro> I think it's the person using the API.... 12:32:56 <AndyS> tlebo - yes I think so but it can become a burden. c.f. Assembler vs high level code (reification has this problem, more so) 12:33:21 <Guus> q? 12:33:52 <mischat> LeeF: are there test cases which test the semantics when talking about conforming datasets 12:34:25 <ivan> ack cygri 12:35:11 <danbri> cygri: you want system not to have to guess what kind of graph layout we're finding in some store 12:35:18 <Guus> q+ 12:35:22 <davidwood> q+ to mention interoperability as the place semantics meet implementations 12:35:26 <mischat> cygri: wanted to comment on when sandro mentioned a developer which needs to talk to lots of RDF datasets, and what to expect. 12:35:37 <AlexHall> +1 - how RDF gets associated with a graph URI is different from what that association means 12:35:44 <gavinc> Seems like an issue for VoID 12:35:51 <tlebo> +1 to documenting dataset patterns that people have used (like those Gavin mentioned). 12:35:55 <mischat> cygri: thinks this is about patterns when using/interacting with datasets. This shouldn't touch on the semantics of RDF 12:36:01 <pchampin> q+ 12:36:04 <LeeF> +1 to cygri 12:36:06 <ivan> ack Guus 12:36:08 <danbri> +1 for documenting patterns over proscribing one notion 12:36:19 <zwu2> +1 to cygri 12:36:22 <mischat> cygri: thinks that we should be documenting patterns, is the way to go, and doesn't think that making everyone have one view of the world, won't work 12:36:29 <yvesr> +1 12:36:39 <ww> AndyS: that's why we have compilers, which have something solid to build upon. just need good tools. 12:36:46 <gavinc> I don't think it's a "can't" define semantics I'd say shouldn't ;) 12:37:00 <mischat> Guus: is asking cygri if he would prefer to document pragmatics instead of defining semantics 12:37:22 <mischat> Guus: would like to provide guides and not limit the practice 12:37:30 <AZ> +1 guus 12:37:40 <AndyS> ww - that was the reif argument ... didn't work out (not sure why) Ditto RDF lists. 12:37:57 <tlebo> example dataset organization: source vs. content based graph organization 12:37:59 <iand> guus: saying we want the widest semantics that we can agree on 12:38:01 <ivan> ack davidwood 12:38:01 <Zakim> davidwood, you wanted to mention interoperability as the place semantics meet implementations 12:38:10 <cygri> +1 to guus 12:38:25 <danbri> cygri is it fair to read your approach (re pattern description) as a variant on "All problems in computer science can be solved by another level of indirection"? 12:38:35 <danbri> (cygri leaves room) 12:39:04 <AndyS> ==> (the room leaves cygri) 12:39:26 <Guus> q? 12:39:28 <mischat> davidwood: we are getting worked about defining everything, has an issue that everyone interprets the semantics differently then we will have interoperability issues 12:39:30 <ivan> ack pchampin 12:39:59 <mischat> pchampin: has a question for cygri 12:40:34 <danbri> q+ to suggest this is a classic layer-of-indirection solution to avoid committee design 12:40:36 <mischat> pchampin: thinks that semantics is exactly what we need to define interoperability. And is not comfortable with cygri's distinction 12:40:42 <sandro> q? 12:40:54 <sandro> q+ 12:40:57 <danbri> q? 12:41:08 <sandro> q- 12:41:32 <tlebo> q+ to ask silly question about using fragment identifiers to resolve "local vs. global" graph names. 12:41:35 <sandro> "Patterns of Use" vs "Semantics". 12:41:36 <mischat> pchampin: is not comfortable your distinction between patterns of use and semantics 12:42:09 <Guus> any volunteers for taking over scribing? 12:42:39 <AndyS> scribe AndyS 12:42:40 <AndyS> scribenick: AndyS 12:42:47 <AndyS> cygri: semantics are complicated 12:43:23 <sandro> +1 break at top of hour 12:43:34 <tlebo> <> { } is "the global one", # { } is "the local one" .... (or _ ) 12:43:37 <AndyS> q? 12:43:42 <AndyS> ack danbri 12:43:42 <Zakim> danbri, you wanted to suggest this is a classic layer-of-indirection solution to avoid committee design 12:43:44 <ivan> ack danbri 12:44:30 <AndyS> danbri: practical vs semantics - maybe more have an indirection point - standards avoid impossible agreement decision 12:44:37 <sandro> danbri: cygri is trying to put in an extensibility hook, since we can't agree how to limit things now. 12:44:48 <sandro> q+ 12:44:56 <AndyS> ... makes practical in WG time. 12:44:56 <AndyS> q+ 12:45:32 <AndyS> guus: if we could agree, shoudl we formalize local or global naming at least? 12:45:47 <AndyS> cygri: yes if not too much pain 12:45:50 <Guus> q? 12:45:58 <ivan> ack tlebo 12:45:58 <Zakim> tlebo, you wanted to ask silly question about using fragment identifiers to resolve "local vs. global" graph names. 12:46:16 <AndyS> tlebo: use cases for both local and global 12:46:41 <AndyS> ... different syntaxes e.g. URI frag 12:46:42 <AlexHall> local = mint your own (UUID-style) URI 12:46:58 <gavinc> local = lie about being global 12:47:06 <mischat> ack sandro 12:47:06 <danbri> maybe a) there are some practices that are just *wrong* eg. naming a graph with a URI of a human b) some that are OK but no consensus around details, eg. URI is URI of a random Web page c) some that are clearer but have practical annoyances (eg. using uuid: or urn:) ... so describing patterns approach is consistent with saying which amongst a-b-c-etc we prefer 12:47:11 <AndyS> guus: issue is if/should we stds that? 12:48:21 <tlebo> @danbri, I'd say that <> {} would be *wrong*, while # would be perfectly valid in anyone's dataset. 12:48:54 <AndyS> sandro: tag example: local g-snap : predicate + graph literal could RDF assertions to show association. 12:49:20 <pchampin> q+ 12:49:40 <AndyS> ack me 12:49:40 <ivan> ack AndyS 12:49:53 <cygri> q+ to comment on the practical difficulty of defining semantics for this 12:50:21 <ivan> ack pchampin 12:51:07 <Guus> andy: use case for immutable graph container 12:51:21 <AndyS> pchampin: Q: options wiki page: pred+graph literal means defer (sandro: log:semantics) but it says something about the resource not the URI 12:51:32 <ivan> q+ 12:52:04 <AndyS> sandro: yes but <t1> names a web resource and representation is the graph (indirection again?) 12:52:23 <yvesr> we shouldn't get into the semantics of N3 predicates - it's just the extension mechanism that is relevant imho 12:52:23 <iand> aren't graphs in sparql named with resources rather than URIs-as-strings? 12:52:38 <ivan> q- 12:53:02 <AndyS> pchampin: one concern on difficult to define semantics : we seem to talk about the IRI itself 12:53:03 <cygri> iand, no, the spec says "pair of IRI and graph" â nothing about resources 12:53:15 <ivan> ack cygri 12:53:15 <Zakim> cygri, you wanted to comment on the practical difficulty of defining semantics for this 12:53:18 <AndyS> q? 12:54:46 <AndyS> cygri: meta: area of semantics we seem to get into vague (richard waves hands) but push back is on detail. We shoudl discuss concrete semantics proposal with detaiils. 12:55:22 <AndyS> .... and we are not there yet. One example (sandro) and we don't get further. 12:55:45 <AndyS> guus: Test case (triples) examples is a way to do that 12:55:50 <sandro> +1 cygri we have gap between requirements on the semantics and the specification of the semantics 12:55:50 <AndyS> cygri: yes 12:56:05 <AndyS> q? 12:56:18 <davidwood1> davidwood1 has joined #rdf-wg 12:56:29 <sandro> restart at 15 after...? 12:56:34 <iand> yes 12:56:58 <AndyS> guus: break now for 15 mins - then review situation. We will discuss options from Sandros's list 12:57:08 <sandro> we can hear you well, yes. 12:57:09 <ivan> zakim, who is here? 12:57:09 <Zakim> On the phone I see AZ, MIT_Meeting_Room, Peter_Patel-Schneider, ww (muted), BBC_Meeting_Room 12:57:11 <Zakim> MIT_Meeting_Room has davidwood, gavinc, zwu2, tlebo, AlexHall, sandro, Souri, Scott_Bauer, LeeF 12:57:14 <Zakim> BBC_Meeting_Room has mischat, Guus, danbri, yvesr, pchampin, swh, ivan, cygri, iand, andys, NickH, Thomas 12:57:17 <Zakim> On IRC I see davidwood1, AndyS, tlebo, Souri, zwu2, tomayac, LeeF, gavinc, iand, mischat, pfps, davidwood, AlexHall, cygri, Scott_Bauer, Zakim, RRSAgent, AZ, danbri, Guus, swh, 12:57:19 <Zakim> ... ivan, pchampin, ww, yvesr, manu, NickH, trackbot, manu1, sandro 12:57:33 <sandro> Yeah -- play with video maybe, but keep the audio as-is. 12:57:42 <sandro> nah --- ignore Zakim. 12:57:49 <sandro> update the wiki page! 12:58:12 <sandro> yep, 9:15 ET 13:06:42 <Zakim> -AZ 13:07:41 <Zakim> +AZ 13:12:57 <MacTed> MacTed has joined #rdf-wg 13:18:02 <iand> iand has joined #rdf-wg 13:18:37 <Guus> reconvene? 13:20:45 <yvesr> sandro, do you get video from us 13:20:46 <mischat> can people in MIT able to see us ? davidwood gavinc or anyone ? 13:20:47 <yvesr> ? 13:21:48 <davidwood> no 13:21:48 <gavinc> for values of see that are not very good 13:21:58 <yvesr> still not? 13:22:08 <gavinc> you still have audio 13:22:12 <davidwood> no 13:22:28 <yvesr> we see you well 13:22:37 <tlebo> tlebo has joined #rdf-wg 13:22:38 <gavinc> and video is gone 13:22:41 <yvesr> looks like xmeeting is sending very little traffic to you 13:23:19 <LeeF> LeeF has joined #rdf-wg 13:24:24 <AndyS> reconvene 13:24:50 <sandro> we see you!!!!! 13:25:02 <yvesr> yay!!! 13:25:08 <AndyS> !!!!! 13:25:22 <sandro> we heard that laugh 13:25:30 <sandro> no, we do, now. 13:26:07 <AndyS> guus: sandro, we stopped the options discussion: continue? 13:26:59 <pfps> Pat and I can't help to formalize something that we don't understand 13:27:02 <AndyS> sandro: agree with cygri of disconnect between detail/semantics and approaches discussions 13:27:37 <AndyS> davidwood: suggest start with 5 UCs (the A priority) 13:27:49 <gavinc> the 5 use cases 13:27:52 <gavinc> 1.1 (A PRIORITY) Slicing datasets according to multiple dimensions 13:27:54 <gavinc> 1.3 (A PRIORITY) Graph Changes Over Time 13:27:55 <gavinc> 1.5 (A PRIORITY) Exchanging the contents of RDF stores 13:27:57 <gavinc> 4.9 (A PRIORITY) Trust Web Opinions 13:27:58 <gavinc> 5.2 (A PRIORITY) OWL's âOntology Documentsâ 13:28:00 <AndyS> sandro: understand how to implement 13:28:55 <AndyS> guus: meta: we have to assess if we have clarity to std semantic notion. We need an established practice not new work. 13:29:08 <AndyS> sandro: test cases => formal semantics 13:29:46 <AndyS> guus: one possibility is we conclude can't get there and instead intro graph names not more 13:30:12 <AndyS> yvesr to talk about graph slicing 13:30:41 <cygri> 13:30:41 <yvesr> 13:30:41 <iand> 13:30:46 <davidwood> 13:30:49 <pchampin> 13:31:08 <AndyS> BBC want central RDF store then need to have slices (per product) 13:31:26 <AndyS> yvesr: product is e.g. /programmes, /music 13:31:51 <AndyS> ... need to slice by resources as well for fast update: 13:31:57 <cygri> q+ to ask whether that's like "redundant stored data" or "views" 13:32:01 <AndyS> ... found stores good at whole graph ops 13:32:22 <gavinc> +infinity to updating small bits using graph replacement rather then UPDATE 13:32:47 <davidwood> +1 to Gavin 13:32:51 <AndyS> ... e.g. Eastenders (a TV program(me)) chnage => change whole graph 13:33:14 <iand> this sounds similar to 1.7.1 editing datasets at the granulaity of the graph 13:33:35 <cygri> ack me 13:33:35 <Zakim> cygri, you wanted to ask whether that's like "redundant stored data" or "views" 13:33:39 <AndyS> cygri: is a view computed on the fly or duplicated data? 13:34:00 <AndyS> yvesr: duplicated 13:34:32 <AndyS> ... original UC was graphs in graphs because of overlaps of views 13:35:20 <AndyS> ... currently hierarchical: /programmes/Eastenders ==> fast operations 13:35:24 <Guus> q? 13:35:40 <davidwood> q+ to ask about non-heirarchical subgraphs 13:36:16 <AndyS> cygri: in some store there is a union dft graph. Update in NG is seen in dft graph. Do you want same but more complicated? 13:36:22 <ivan> ack davidwood 13:36:22 <Zakim> davidwood, you wanted to ask about non-heirarchical subgraphs 13:36:29 <davidwood> 13:36:33 <AndyS> yvesr: yes - we'd like that also access control 13:36:35 <davidwood> The wasComplementOf relationship is used to denote that two entities complement each other, in the sense that they each represent a partial, but mutually compatible characterization of the same thing. 13:37:44 <sandro> davidwood: Let's talk about non-hierachical subgraph relationships. 13:38:00 <pchampin> q+ to ask yves another question about hierarchical 13:38:20 <AndyS> davidwood: if we had a looser notion of subgraph then we can do this (scribe??) 13:38:48 <AndyS> yvesr: currently two graphs can overlap in triples 13:38:51 <sandro> davidwood: subgraphs should have the freedom to overlap in terms of membership of their triples. 13:38:54 <pchampin> q- 13:39:08 <AndyS> guus: What mechanisms do we need? 13:39:21 <gavinc> +q to talk about implementations of this 13:39:21 <AndyS> ... name containers? 13:39:32 <sandro> guus: it sounds like the crucial thing here is to name containers 13:40:09 <mischat> mischat has joined #rdf-wg 13:40:11 <sandro> yvesr: You can check triple-by-triple to see if two graphs overlap. 13:40:13 <AndyS> yvesr: issues: (1) specification of strucures e.g. overlap Can check currently. bNodes are "a bit more complicated" 13:40:43 <AndyS> ... (2) NG impl issue: good if split of triples : overlaps are duplication 13:40:45 <ivan> q+ 13:40:46 <mischat> this seems like a SPARQL issue from my POV 13:40:46 <sandro> yvesr: There can be lots of duplication of information 13:40:49 <ivan> ack gavinc 13:40:49 <Zakim> gavinc, you wanted to talk about implementations of this 13:40:54 <cygri> q+ to think out loud about ânested datasetsâ 13:41:50 <sandro> gavin: Speaking to one implementation. One method we used to define the relationship between super and sub graphs. SPARQL CONSTRUCT queries to create bounded descriptions, stored as separate named graph, later. 13:41:53 <AndyS> gavinc: example - supergraphs defined by CONSTRUCT of subgraphs - stored as separate graph 13:42:01 <LeeF> I'm not sure how relevant this is, but in Anzo we pretty much just define "RDF Datasets" as first class citizens - they're defined in the system and are collections of named graphs as per the SPARQL notion of a dataset 13:42:05 <LeeF> 2 datasets can share a graph 13:42:15 <LeeF> and we use the datasets as a way to handle higher-level manipulations 13:42:15 <sandro> gavin: None of these were based on semantic relationship -- the Construct queries defined the supergraphs. 13:42:38 <Guus> q? 13:42:42 <sandro> sandro: not really sub/super graph, but ... other graphs. 13:42:56 <sandro> gavin: No new triples created -- it was just re-grouping triples. 13:43:02 <AndyS> gavin: no new triples : CONSTRUCT is a method of grouping triples 13:43:14 <sandro> gavin: a fairly common pattern. 13:43:16 <AlexHall> Mulgara has a feature to create a named graph that is a view consisting of boolean set operations on -- surely other stores have this feature as well? 13:43:22 <Guus> ack invan 13:43:32 <Guus> ack ivan 13:43:35 <AlexHall> [set operations on other named graphs] 13:44:07 <sandro> q+ to answer 13:44:14 <AndyS> ivan: what can we do for you? 13:44:15 <cygri> q- 13:44:41 <sandro> q+ to say that "web semantics for datasets" would allow other folks to mix & match yvesr's data. 13:44:43 <AndyS> yvesr: not complete clear - loosely defined maybe better 13:44:57 <AndyS> ivan: is there a stronger semantics that (in a few years) woudl be better 13:45:12 <AndyS> yvesr: yes - eg. graph of things editors can change 13:45:25 <sandro> q? 13:45:30 <AndyS> ... whether this is big spec csost. 13:45:54 <AndyS> guus: Is this data mgt , rather than RDF change? 13:45:54 <davidwood> q+ re ISSUE-33 13:46:01 <sandro> issue-33? 13:46:01 <trackbot> ISSUE-33 -- Do we provide a way to refer to sub-graphs and/or individual triples? -- open 13:46:01 <trackbot> 13:46:16 <AndyS> ... (exploring) 13:46:19 <Guus> q? 13:46:20 <ivan> ack sandro 13:46:20 <Zakim> sandro, you wanted to answer and to say that "web semantics for datasets" would allow other folks to mix & match yvesr's data. 13:46:56 <AndyS> sandro: yvesr says "graph" for "graph container" 13:47:24 <cygri> trackbot: BEER on yvesr 13:47:24 <trackbot> Sorry, cygri, I don't understand 'trackbot: BEER on yvesr'. Please refer to for help 13:48:01 <AndyS> ... and my web semantic proposal woudl let mix and match deref via stable URL 13:48:21 <AndyS> ... build eco system #13:48:21 <NickH> �[A7 13:48:22 <ivan> q? 13:48:25 <ivan> q? 13:48:30 <ivan> ack davidwood 13:48:30 <Zakim> davidwood, you wanted to discuss ISSUE-33 13:48:41 <Guus> q? 13:48:45 <ivan> ISSUE-33? 13:48:45 <trackbot> ISSUE-33 -- Do we provide a way to refer to sub-graphs and/or individual triples? -- open 13:48:45 <trackbot> 13:48:54 <AndyS> davidwood: for BBC UC can we close issue-33? 13:49:54 <AndyS> ... contention is remove parent-child but let graphs exists and overlap we do not need subgraph specially 13:50:19 <Souri> q+ to suggest => :G rdf:includes :g1, :g2, :g3 . (flexible grouping in RDF, not having to go to SPARQL) 13:50:22 <sandro> q? 13:50:34 <cygri> q+ to say that one doesn't preclude the other 13:50:39 <ivan> q+ 13:50:39 <AndyS> ... looser defn of subgaph and graph membership can overlap then we benefit from no fixed hierarchy 13:50:45 <AndyS> ... and we can close issue-33 13:50:58 <sandro> q+ to say I agree we can let g-snaps overlap as they may, assuming we don't care about bnodes 13:51:06 <pfps> pfps has joined #rdf-wg 13:51:22 <AndyS> davidwood: proposal "no" to issue-33 by defn g* so subgraphs are possible. 13:51:32 <AndyS> ack souri 13:51:32 <Zakim> Souri, you wanted to suggest => :G rdf:includes :g1, :g2, :g3 . (flexible grouping in RDF, not having to go to SPARQL) 13:51:32 <ivan> ack Souri 13:51:59 <davidwood> +1 to souri 13:52:15 <sandro> souri: As Gavin said, with grouping of graphs, not parent/child, ... I want to take these graphs together, and name the collection this,... not in SPARQL, just in RDF. 13:52:42 <sandro> ... in the triplestore, G container is always the merge of the contents of G1, G2, etc. 13:52:44 <AndyS> souri, this is in RDF not SPARQL, then query graph G then snapshots G 13:52:47 <Zakim> +PatH 13:53:00 <cygri> ack me 13:53:00 <Zakim> cygri, you wanted to say that one doesn't preclude the other 13:53:01 <ivan> ack cygri 13:54:24 <AndyS> cygri, two things: good things from arb overlap graphs but may still want to have "subgraph" explicit concpt 13:54:49 <ivan> ack ivan 13:54:50 <tlebo> Is @davidwood saying that #33's subgraph notion can be accounted for by placing RDF Graphs (g-snap) into Graph Containers (g-box)? If you want to "hierarchicalize" RDF Graphs, you'd do it by placing them into hierarchical Graph Containers. 13:54:52 <AndyS> ... and UC wikidata talks about triples not graphs (was that right?) 13:55:09 <davidwood> Souri's formulation allows the creation of parent-child subgraphs as a degenerate case. 13:55:20 <davidwood> Therefore, cyri's concern is handled. 13:55:35 <yvesr> wikidata is a very good use-case for the same sort of issues: you always have two dimensions on which you want to slice your dataset: per item in the wiki, and per authorisation rights 13:55:35 <sandro> q- 13:55:39 <AndyS> ivan: subset can be useful so don't see overlap covers subgraph need as is very useful. 13:56:02 <PatHayes> PatHayes has joined #rdf-wg 13:56:05 <AndyS> guus: what have we leant? 13:56:30 <AndyS> sandro: we need bnodes sharing - subgraphs 13:56:43 <AndyS> guus: gSnap senseof graph 13:56:53 <davidwood> tlebo, if you name a graph in a g-box and fill it with triples from a g-snap, then sure. 13:57:01 <cygri> sandro, bnode scope is orthogonal to subgraphs 13:57:07 <gavinc> bnode sharing clearly DOESN'T need subgraphs as bnodes can be amusingly shared in sparql datasets today ;) 13:57:30 <pchampin> q+ to ask a very basic question 13:57:47 <AndyS> yvesr: not sure operators useful - want to mark a triple as in bags. 13:58:07 <AndyS> ... graph as container 13:58:18 <davidwood> bnode sharing would be facilitated by naming g-snaps 13:58:21 <sandro> it is, cygri? I thought bnodes were scoped to graphs..... 13:58:45 <AndyS> sandro - by syntax 13:58:53 <cygri> sandro, no. they are not scoped at all. bnode *identifiers* are scoped by document 13:59:03 <gavinc> +g to explain at least one "implementation" of bnode "sharing" between many graphs 13:59:08 <mischat> can't you achieve this with a SPARQL insert thing 13:59:11 <mischat> +1 Guus 13:59:13 <AndyS> guus: do a lookup as to where it is? 13:59:25 <tlebo> q? 13:59:27 <gavinc> +q to explain at least one "implementation" of bnode "sharing" between many graphs 13:59:33 <AndyS> iand: name sets of triples? 13:59:36 <PatHayes> unfortunately at present RDF dos not scope bnodes at all, and sparql takes advantage of this. 13:59:48 <ivan> q? 13:59:52 <gavinc> +1000 PatHayes 13:59:56 <davidwood> named set of triples == named g-snap 14:00:02 <sandro> sorry, cygri -- yes, but I thought in Named Graphs bnodes were not allowed to be shared. 14:00:31 <cygri> sandro, the carroll et al paper might say that. sparql doesn't. 14:00:40 <AndyS> iand: if use name, what triples is it? 14:00:52 <ivan> q? 14:00:55 <AndyS> q+ 14:00:55 <gavinc> the carroll et all paper didn't say that... at least not by my reading 14:01:03 <ivan> ack pchampin 14:01:03 <Zakim> pchampin, you wanted to ask a very basic question 14:01:06 <gavinc> and it seems PatHayes at well 14:01:06 <PatHayes> no, the carroll +al paper does not address this bnode issue. 14:01:16 <cygri> gavinc, you might be right. i should re-read it 14:01:45 <gavinc> and given et all included PatHayes I'm going to agree with him 14:01:50 <AndyS> pchampin: do we have an accepted way to talk about graph containers? 14:02:03 <pchampin> pchampin: or RDF graphs (aka g-snap) 14:02:06 <AndyS> guus: we have consensus for this. 14:02:18 <ivan> q? 14:02:19 <sandro> +1 everyone seems to agree we need a way to name graph containers 14:02:36 <Souri> s/ et all / et al / 14:02:45 <iand> do any use cases require naming of graphs (g-snaps) 14:02:58 <LeeF> i share iand's question 14:02:58 <ivan> ack gavinc 14:02:58 <Zakim> gavinc, you wanted to explain at least one "implementation" of bnode "sharing" between many graphs 14:03:04 <AndyS> path: must not confuse container and snap 14:03:13 <ivan> q/ 14:03:15 <ivan> q? 14:03:31 <sandro> PatHayes, you're missing the look of complete "Who Me???" on my face. I don't think THAT'S what we're disagreeing about. 14:03:56 <PatHayes> ok, sandro, sorry if ive been misreading you. 14:03:57 <davidwood> Propose to RESOLVE "we need a way to name graph containers" 14:04:13 <AndyS> gavinc: bnodes not scoped anywhere and impls use this. skolemization round tripping possible. 14:04:24 <AndyS> ... may not be a good way. 14:04:51 <AndyS> sandro: trig, nq syntax. 14:04:57 <Guus> maybe we should state the consensus that, at the minimum, graph containers should have a naming mechanism 14:05:00 <iand> +1 to davidwood suggestion 14:05:01 <AndyS> gavinc: variations 14:05:19 <ivan> q? 14:05:20 <AndyS> path: I agree 14:05:24 <Guus> ... as a resolution 14:05:33 <sandro> gavin: We clearly need *some* standardization to allow people to transmit datasets where there are blank nodes shared between graphs. 14:05:47 <AndyS> davidwood: name gboxes ... propose resolution 14:06:59 <yvesr> having names for both snapshots and containers would be horribly confusing 14:07:36 <gavinc> eh, we already do and it's not that bad 14:07:44 <gavinc> and the names are the same ;) 14:07:49 <yvesr> :) 14:07:51 <PatHayes> yvesr, we are already in practice in this confusion. 14:08:04 <Souri> q+ (aside) to confirm (hopefully) that graph names cannot be bNodes (and must necessarily be IRIs) 14:08:24 <Souri> ack (aside) 14:08:24 <Zakim> (aside), you wanted to confirm (hopefully) that graph names cannot be bNodes (and must necessarily be IRIs) 14:08:34 <AndyS> guus: unclear "named graph" 14:08:34 <AndyS> cygri: no - named graph snap 14:08:34 <AndyS> ... it's the formal def 14:08:41 <AndyS> cygri: collection of named snapshots 14:08:45 <sandro> Doesn't RDF already support naming everything we can image? :-) 14:08:53 <sandro> s/image/imagine/ 14:08:56 <PatHayes> souri, yes. bnode is not a name. But a bnode can refer to anything that can be named. 14:09:00 <sandro> queue= 14:09:03 <gavinc> Souri, the named graph paper at least was happily clear that it was IRI not Resource (eg, no blank nodes) 14:09:04 <ivan> zakim, who is here? 14:09:04 <Zakim> On the phone I see MIT_Meeting_Room, Peter_Patel-Schneider, ww (muted), BBC_Meeting_Room, AZ, PatH 14:09:06 <Zakim> MIT_Meeting_Room has davidwood, gavinc, zwu2, tlebo, AlexHall, sandro, Souri, Scott_Bauer, LeeF 14:09:09 <Zakim> BBC_Meeting_Room has mischat, Guus, danbri, yvesr, pchampin, swh, ivan, cygri, iand, andys, NickH, Thomas 14:09:11 <Souri> q- 14:09:12 <Zakim> On IRC I see PatHayes, pfps, mischat, LeeF, tlebo, iand, MacTed, davidwood, AndyS, Souri, zwu2, tomayac, gavinc, AlexHall, cygri, Scott_Bauer, Zakim, RRSAgent, AZ, danbri, Guus, 14:09:17 <Zakim> ... swh, ivan, pchampin, yvesr, manu, NickH, trackbot, manu1, sandro 14:09:19 <Souri> q? 14:09:20 <AndyS> q+ 14:09:24 <ivan> zakim, MIT_Meeting_Room also has Eric 14:09:24 <Zakim> +Eric; got it 14:10:00 <pchampin> scribe pchampin 14:10:02 <AndyS> q- 14:10:41 <danbri> does the bot need : prefix? 14:10:42 <danbri> scribenick: pchampin 14:11:05 <pchampin> pat: what I understood: we have IRIs refering to graph containers, and IRIs refering to graphs (snapshots) 14:11:27 <pchampin> ... is that IRI going to appear in any RDF triple? and refer to the graph in this way? 14:11:56 <pchampin> guus: that would make life easier 14:12:22 <cygri> q+ 14:12:40 <gavinc> PatHayes: that would make life possible 14:12:51 <pchampin> pat: to talk about a container changing over time, you need a programing language, which RDF is not 14:13:43 <pchampin> cygri: SPARQL is in last call; it already uses this notion of containers of graph; it is not a programming language 14:14:05 <pchampin> ... it is based on an abstract syntax: datasets 14:14:11 <AndyS> (SPARQL update -- graph store) 14:14:28 <pchampin> ... it does not have to become a part of RDF semantics 14:14:49 <tlebo> (where is g-box, g-snap, g-text defined?) 14:15:15 <iand> tlebo: 14:15:15 <AlexHall> 14:15:25 <pchampin> pat: I'm not suggesting that we should have this way of talking about boxes 14:16:06 <pchampin> ... if we have to incorporate notions of time dependency in the semantics, this will be a major change 14:16:18 <danbri> aside -- putting time and change pragmatics into semantics, seems like trying to teach flatlanders (per ) about the mythical 3rd dimension 14:16:28 <PatHayes> by 'programming language' I mean only that it presumes an underlying notion of state 14:16:39 <pchampin> cygri: I agree that I would not like to make this kind of change in RDF semantics 14:16:59 <sandro> q? 14:17:05 <Guus> q? 14:17:06 <cygri> ack 14:17:07 <tlebo> thanks, @iand 14:17:09 <ivan> ack cygri 14:17:16 <sandro> q+ 14:17:24 <ivan> ack sandro 14:17:54 <ericP> ericP has joined #rdf-wg 14:18:31 <pchampin> sandro: we can probably leave time out of the semantics 14:18:41 <AlexHall> keep in mind, time is only one dimension over which the contents of a named g-box can change 14:18:46 <swh> time is far from the only variable 14:18:51 <pchampin> pat: that is, if we keep *dereferencing* out of the semantics too 14:19:04 <yvesr> +1 to swh 14:19:40 <ivan> q? 14:19:44 <ww> ww has joined #rdf-wg 14:19:51 <ww> +1 to sandro 14:20:11 <pchampin> andy: there is a difference btw using dereferencing the LOD way, and recording it in the RDF semantics 14:20:38 <sandro> So, maybe there can be some consensus around talking about dereferencing, but not in the RDF Semantics. 14:20:55 <pchampin> guus: still trying to draw lessons from the BBC usecase 14:21:18 <pchampin> ... we need to put triples in different containers 14:21:31 <sandro> pat: I agree dereferencing involves time, but time is hard, so I think we should leave dereferencing outside of the RDF Semantics. 14:21:36 <pchampin> ivan: and let the content of those containers overlap 14:21:51 <ivan> q? 14:22:24 <pchampin> cygri: the usecase requires shared bnodes between graphs (and containers) 14:22:26 <sandro> cygri: This use case involves bnodes being shared between Graph Containers. 14:22:37 <ericP> does it require bnode sharing? can't the graphs just entail each other? 14:22:54 <gavinc> Requires in reality shared blank nodes BETWEEN datasets, which ummm, impossible. New reality quickly becomes the use case tends to mean you can't/shouldn't use bnodes 14:23:02 <AndyS> AndyS has joined #rdf-wg 14:23:14 <PatHayes> not require bnode sharing, but allow it. 14:23:17 <pchampin> steve: you could also say: if you are going to use this use case, then you *can't* use bnodes 14:23:24 <pchampin> yves: unfortunately, we do use bnodes 14:23:31 <sandro> .well-known/genid is the answer. :-] 14:23:43 <swh> +1 to sandro :) 14:23:50 <gavinc> +sigh to sandro 14:23:57 <ericP> couldn't gsnap: { _:s1 <p1> <o1> } capture gbox: { _:s2 <p1> <o1> } ? 14:24:01 <cygri> q+ 14:24:14 <cygri> q- 14:24:19 <yvesr> sandro, :) 14:24:22 <AndyS> sometimes you know its the same bnode -- additional information e.g. subgraph 14:24:31 <sandro> q? 14:24:40 <sandro> 14:24:45 <cygri> BBC_meeting_room is out of coffee :-( 14:24:50 <mischat> 14:24:59 <sandro> cygri, you can have some of ours. We have lots left. 14:25:25 <mischat> 14:25:37 <pchampin> guus: let's switch to another usecase 14:25:41 <PatHayes> damn all your coffees, i havnt even had a shower yet. 14:25:43 <mischat> 5.2 5.2 (A PRIORITY) OWL's âOntology Documentsâ 14:25:47 <ivan> 14:25:50 <pchampin> gavin: 5.2 OWL ontology documents 14:25:52 <cygri> PatHayes too much information 14:25:59 <PatHayes> ;- 14:26:30 <pchampin> ... the general convention: you name the graph container with the ontology URI 14:28:05 <pchampin> ... the OWL ontology for Dublin Core exists on the web and you can deference it 14:28:33 <pchampin> {hard to scribe explaination} 14:28:46 <sandro> gavin: The OWL ontology for Dublin Core exists on the web, and you can reference it. However, there are other ontologies with that name. There might be a DL ontology for dublin core. 14:28:51 <sandro> gavin: different ontologies, different URIs, but SOMETIMES I NEED TO GIVE THEM THE SAME NAME -- so I can switch which representation of the ontology I'm using. 14:28:55 <sandro> gavin: Almost every ontology editor and OWL reasoner does it. 14:29:00 <PatHayes> but why do you want to say this common uri is a name? 14:29:14 <pchampin> david: it's a nasty hack, but it's a good idea 14:29:26 <PatHayes> q+ 14:29:51 <pchampin> danbri: every now and then, I receive a mail suggesting to have the FOAF ontology conform with OWL-DL or other standard 14:29:57 <iand> q+ 14:30:01 <cygri> owl:Ontology rdfs:subClassOf rdf:Graph? 14:30:04 <iand> q- 14:30:14 <pchampin> ... it would be good if, with content negociation, different versions could be served 14:30:25 <sandro> danbri: With FOAF, I always emails saying I should use DL, and they email me an OWL file. 14:30:27 <AZ> gavin, it make me think of something I made a while ago: 14:30:30 <pchampin> ivan: every OWL ontology, DL or not-DL, seen with RDF glasses, is a graph 14:30:32 <iand> q+ to say there seems to be confusion between a namespace URI and an ontology URI 14:30:38 <sandro> ivan: Every ontology, DL or not, is an RDF graph. 14:30:41 <sandro> s/ont/OWL ont/ 14:30:44 <pchampin> ... if you change the ontology, it is a different graph 14:30:52 <pchampin> q+ to answer ivan 14:31:10 <mischat> i agree with danbri content negotiation is what is missing here, and mime-types for the various OWL variants 14:31:28 <pchampin> guus: gavin, what is the requirement here? 14:31:33 <davidwood> When you refer to an ontology by URI, you are referring to a g-box. When you reason over it, you are reasoning over a g-snap. 14:31:38 <cygri> q+ 14:31:43 <pchampin> gavin: the problem is how owl:imports interacts with named graphs 14:32:02 <pchampin> ... depending how you implement it, different weird things happen 14:32:07 <AlexHall> q+ 14:32:19 <mischat> is this an RDF issue? 14:32:33 <swh> "owl:" means it's OWL's problem :) 14:32:38 <pchampin> ... e.g. people use owl:imports inside SPARQL, what does that mean exactly? 14:33:15 <ivan> 14:33:30 <davidwood> mischat, yes it is an RDF issue for the graph TF because of this statement in the UC: "An Ontology Document has an IRI, but it is left open-ended what that IRI represents (graph in a graph store? file on a file system? web resource?) Can the document IRI and the graph IRI that stores the ontology be the same?" 14:33:42 <pchampin> peter: care has been taken in OWL2 with owl:import: this is a pragmatic issue, not a semantic issue (?) 14:33:50 <ivan> "From a physical point of view, an ontology contains a set of IRIs, shown in Figure 1 as the directlyImportsDocuments association; these IRIs identify the ontology documents of the directly imported ontologies as specified in Section 3.2. The logical directly imports relation between ontologies, shown in Figure 1 as the directlyImports association, is obtained by accessing the directly imported ontology documents and converting them into OWL 2 ontologies. The l 14:33:52 <davidwood> It is the same dual use of the name of the graph that we are wrestling with here. 14:34:43 <AndyS> AndyS has joined #rdf-wg 14:34:43 <pchampin> guus: for me, this use case is out of our scope, because owl:import has only operational semantics 14:34:45 <mischat> davidwood: i understand that it is on the UC document, it looks like something for a primer about linked data and sparql stores 14:34:46 <davidwood> q? 14:34:52 <mischat> q? 14:35:08 <sandro> q? 14:35:19 <sandro> gavin: The requirement is how owl:imports intereact with Named Graphs. If you treat owl:import as derefencing, you get different results from using it as the dataset tag. 14:36:02 <davidwood> mischat, yes, it will probably end up that way once we figure out how we name graphs. 14:36:09 <sandro> PatHayes: It seems to me, part of the idea behind "Named Graphs", was the act of attaching a URI was a special thing to do. Just because an IRI retrieves a graph doesnt mean it's the 'name' of the graph. Could be several retreive it, but only one of those is its name. 14:36:22 <pchampin> pat: in the named graph paper, several URIs can resolve to a graph, but only one is officially naming it 14:36:44 <ivan> ack iand 14:36:44 <sandro> PatHayes: It's okay to have an IRI that retreives different graphs at different times, as long as it's not the "name" of the graph 14:36:44 <Zakim> iand, you wanted to say there seems to be confusion between a namespace URI and an ontology URI 14:36:49 <pchampin> ... you can have several other URIs doing weird thing for practical reasons 14:37:07 <sandro> -1 PatHayes -- I think it's core the Web Architecture that "identify" and "name" are the same thing. 14:37:29 <iand> ack me 14:37:31 <Guus> q? 14:37:32 <PatHayes> sandro, that HAS to be wrong. 14:37:46 <pchampin> iand: coming back to the dublin core example, you can have many variants of the ontology, but they share the same ontology URI 14:37:56 <sandro> gavin: Ontology URI is the name of ontology, the base URI, where it's published, etc.... 14:37:59 <PatHayes> q- 14:38:28 <sandro> q+ to talk about "identify"-vs-"name" 14:38:32 <iand> actually I said dublin core has one namespace URI but could have multiple ontologies with different variants of OWL, each with their own URI 14:38:50 <gavinc> +1 iand 14:38:56 <mischat> pchampin: had an answer for ivan, agree's with danbri 14:38:57 <sandro> (agreed iand) 14:39:11 <PatHayes> q+ for identify/name when that gets to be a topic. 14:39:21 <mischat> pchampin: the ontology is more abstract than the graph 14:39:31 <mischat> ivan: every OWL is an RDF graph 14:39:49 <mischat> ivan: conceptually every OWL can be mapped to a graph 14:40:03 <gavinc> iand, of course the "namespace" doesn't really exist in RDF 14:40:03 <pchampin> ack me 14:40:03 <Zakim> pchampin, you wanted to answer ivan 14:40:21 <Guus> ack cygr 14:40:29 <davidwood> From AWWW: 14:40:30 <Guus> ack cygri 14:40:30 <pchampin> cygri: the OWL specs says how you can turn any ontology onto a graph 14:40:37 <davidwood> "To benefit from and increase the value of the World Wide Web, agents should provide URIs as identifiers for resources." 14:40:48 <pchampin> ... also an ontology has an identifier (URI) 14:40:48 <danbri> re ontologies and graphs -- 'turn into', 'map to', 'is just a', ... hearing lots of phrases, 'translates into a', ... 14:40:57 <davidwood> Note that equates a URI and an identifier. 14:41:14 <pchampin> ... wouldn't it be great if OWL3 said "here is how an OWL ontology is mapped into a graph, here is how it is mapped into a named graph, here is..." 14:41:29 <AndyS> Sounds like short-circuit of naming: name of concept/abstraction != name of graph that encodes (one way) the ontology 14:41:34 <pchampin> ivan: that's the job of the OWL3 WG 14:41:50 <danbri> ivan, so in FOAF we have from the ns URI both RDF/XML conneged with lots of triples, and text/html conneg defaulted, with a few triples via RDFa; --- is this one Ontology in your sense, or two? 14:41:51 <AlexHall> +1 AndyS 14:41:59 <pchampin> cygri: we can make things easier for the OWL3 WG to do that 14:42:01 <davidwood> Also,: "By design a URI identifies one resource" 14:42:08 <PatHayes> davidwood, what is your point? All that is about identification, not naming. 14:42:14 <sandro> Provenance-WG is alll about describing conversion processes and their results. 14:42:37 <Guus> q? 14:42:58 <davidwood> PatHayes, my point is that we don't name anything on the Web other than with a URI. I must agree with Sandro that Web names are Web identifiers are Web URIs. 14:43:19 <davidwood> Perhaps we are using the term "name" differently? 14:43:31 <gavinc> davidwood, yes... however that one resource might have many descriptions 14:43:41 <sandro> AlexHall: Lots of copies of some ontology can exist on the web. 14:43:51 <pchampin> alex: we are ok to have conflicting representation of the same ontology, with the same URI 14:43:54 <davidwood> Ah, your "names" are descriptions? Why not call them descriptions? 14:44:06 <PatHayes> david, in spite of what sandro says, the RDF specs and the named graph paper both disagree with y'all. 14:44:06 <davidwood> My "names" are handles. 14:44:07 <pchampin> ... conflict usually resolved by the application 14:44:14 <sandro> q? 14:44:18 <mischat> davidwood: the tag have been talking about how "URIs define one resource" recently in the context of fragment ids in RDFa 14:45:19 <pchampin> ivan: two issues: you say that the same ontology graph will be present in different systems, meaning that dereferencing the URI of the ontology will return a copy 14:45:24 <mischat> and people seem to be happy that a frag URIs can identify different things on the web ⦠based on the agent. which is slightly to danbri's point re: mime-types and conneg 14:45:29 <sandro> ivan: "the same ontology graph will be present in many different systems" -- that's true, and means the name of the ontology, when dereferenced, it gives you a "core copy" of it....? But when you said "these representations can be different/conflicting with each other", I have a problem with that. 14:45:30 <davidwood> mischat, interesting (and brave!) 14:45:49 <sandro> +1 agreed, different ontologies with the same name -- that's a bug. 14:45:51 <pchampin> ... but saying that those copies may be conflicting, it is a bug (a useful bug, but a bug) 14:46:04 <davidwood> PatHayes, can you point me to a section in the RDF docs that makes your point clear? 14:46:29 <cygri> different ontologies with same name is not a bug. it's a difference in opinion. 14:46:41 <yvesr> +1 14:46:44 <PatHayes> ivan , why is the name considered "core"? I suggest that is a mistake. The name is attached by some kind of baptism. 14:46:46 <swh> mischat, using rat URIs to distinguish relies upon client-side modification, by definition 14:46:51 <swh> s/rat/tag/ 14:46:53 <pchampin> guus: is it the work of this WG to solve this? 14:47:01 <pchampin> sandro, gavin, david: YES 14:47:06 <mischat> swh: frag? 14:47:14 <danbri> cygri, can you phrase that equally-ish 'it's a single ontology that people are saying different things about'? (might not even be a different opinion, just a different choice of assertions) 14:47:14 <ww> ww has joined #rdf-wg 14:47:16 <sandro> sandro: there's nothing OWL-specific here; it comes up in any case of RDF. 14:47:20 <iand> mischat, danbri: don't think you should conneg ontologies that define things differently - conneg variants are supposed to be basically interchangeable 14:47:25 <pchampin> guus: suggest we have a separate document about RDF authorities 14:47:30 <cygri> q? 14:47:34 <sandro> "The Role of Derefencing in RDF" -- a new RDF WG Note. 14:47:38 <swh> mischat, fragment URIs, I was replying to your point :) 14:47:38 <sandro> ? 14:47:43 <mischat> yeah i see 14:47:48 <pchampin> ivan: it means that the dereferencing model does not work 14:47:58 <AndyS1> AndyS1 has joined #rdf-wg 14:48:06 <danbri> iand, can you define 'basically interchangeable'? e.g. 'same intellectual content' ... can we conneg Flash and SVG? .MP3 and .WAV? PDF and HTML5? 14:48:22 <pchampin> gavin: you mean that the web does not work... 14:48:35 <Guus> q? 14:48:47 <sandro> ack sandro 14:48:47 <Zakim> sandro, you wanted to talk about "identify"-vs-"name" 14:48:48 <ivan> ack AlexHall 14:48:49 <Guus> ack AlexHall 14:49:53 <cygri> httpRange-14 is mentioned. it'll be all downhill from here 14:49:55 <ivan> but that means if we have a local dataset that uses for a name a 'global' (or core) URI, that would not dereference to the local copy in the dataset but it would go somewhere else. Ie, putting URI dereferencing into the dataset model may go wrong 14:50:07 <danbri> zakim, who is playing music? 14:50:08 <Zakim> I don't understand your question, danbri. 14:50:13 <pchampin> sandro: the web-arch way for a URI to identify a thing is not the same as the RDF way 14:50:36 <AndyS> resolved httpRange-14? 14:50:57 <pchampin> pat: agree with sandro, the httpRange-14 solves this, but has the WG endorsed it? 14:51:29 <iand> We need a godwins law for httprange-14 14:51:37 <cygri> coffee break? 14:53:00 <pchampin> (pat and sandro arguing about following the TAG or not in their resolution of httpRange-14) 14:53:48 <pchampin> pat: httpRange-14 does not say anything about what resource a IRI identifies, only what *kind* of resource 14:53:53 <iand> let's get coffee then httprange-14 will be resolved when we get back 14:54:36 <yvesr> iand, it will have resolved itself 14:54:42 <sandro> :-) :-) <iand> We need a godwins law for httprange-14 14:54:59 <pchampin> guus: can we get a clear statement of what we expect as a result of this WG 14:55:04 <yvesr> i quite liked the idea of a note 14:55:07 <pchampin> ... not in terms of semantics, but of pragmatics 14:56:07 <pchampin> sandro: there should be a document explaining how dereference relates to RDF 14:56:10 <pchampin> guus: agree 14:56:23 <sandro> sandro: It sounds like we should be working on a document (Note, Rec, part of Rec) aboud how dereference relates to RDF. 14:56:32 <sandro> PatHayes: amen 14:57:37 <PatHayes> david, re. your earlier question, see 14:58:08 <davidwood> Thanks, Pathayes 14:58:12 <PatHayes> OK, see yall in an hour. 14:58:17 <AZ> gentlemen, I have to leave now 14:58:34 <Zakim> -PatH 14:58:55 <AZ> bye 14:59:04 <Zakim> -AZ 15:03:37 <Zakim> -ww 15:09:02 <Zakim> -MIT_Meeting_Room 15:15:36 <AlexHall> AlexHall has joined #rdf-wg 15:52:31 <AlexHall> AlexHall has joined #rdf-wg 15:54:38 <zwu2> zwu2 has joined #rdf-wg 15:55:55 <Scott_Bauer> Scott_Bauer has joined #rdf-wg 15:56:50 <Guus> reconvene in 5? 15:57:11 <AlexHall> still missing most of the room at MIT 16:00:21 <AndyS> AndyS has joined #rdf-wg 16:01:13 <Zakim> +PatH 16:01:45 <Zakim> -PatH 16:01:50 <tlebo> tlebo has joined #rdf-wg 16:03:01 <gavinc> gavinc has joined #rdf-wg 16:03:23 <Souri> Souri has joined #RDF-WG 16:03:37 <Zakim> +MIT_Meeting_Room 16:03:53 <davidwood> davidwood has joined #rdf-wg 16:04:07 <Guus> welcome bac, MIT meeting room 16:05:17 <danbri> davidwood, can you hear us? 16:05:25 <danbri> EUROPE CALLING AMERICAS 16:05:29 <swh> swh has joined #rdf-wg 16:05:38 <sandro> MIT is back on the phone. 16:07:38 <LeeF> LeeF has joined #rdf-wg 16:07:54 <ericP> topic: meta-discussion of how to make progress in F2F 16:08:21 <tlebo> davidwood: name, identifier, dereferencing is causing problems. 16:08:23 <Guus> q+ 16:08:32 <davidwood> ack PatHayes 16:08:32 <Zakim> PatHayes, you wanted to discuss identify/name when that gets to be a topic. 16:08:35 <ericP> davidwood: after 6 months, we're still not using terms consistently enough to enable progress 16:08:48 <ericP> ... suggestions for way forward? 16:08:56 <davidwood> ack Guus 16:09:07 <ericP> scribenick: ericP 16:09:16 <cygri> q+ 16:09:21 <ericP> Guus: i feel we moved forward a bit before the break: 16:09:39 <ericP> ... .. some consensus that we need names for at least graphs, maybe more 16:09:54 <ericP> ... .. some sense of the requirements these impose on RDF 16:10:10 <ericP> ... .. use cases lead us to the deferencing dicusssion 16:10:45 <ericP> ... still not clear how rdf dataset relates to g{snap,box} 16:10:52 <Zakim> +PatH 16:10:53 <LeeF_> LeeF_ has joined #rdf-wg 16:11:09 <ericP> davidwood: we need names for at least graph containers (gboxes) 16:11:35 <ericP> s/names for at least graphs, maybe more/names for at least graph containers, maybe more/ 16:12:07 <ericP> davidwood: paraphrasing PatHayes, "a name is not an identifier" 16:12:08 <yvesr> r 16:12:15 <Guus> q+ 16:12:30 <ericP> ... "... we can have multiple names for things" 16:12:47 <sandro> pat: We're not obliged to presume that "naming" and "identifying" are the same relationships. 16:12:49 <ericP> PatHayes: the notion of name and identifier are disctinct 16:13:02 <davidwood> ack cygri 16:13:05 <ericP> ... no position on whether they *should* be the same 16:13:45 <ericP> cygri: i think we made progress on understanding peoples' positions and requirements, as well as what's easy or hard 16:14:11 <ericP> ... can we discuss what we can write over the coming weeks to make progress? 16:14:13 <sandro> cygri: let's figure out what we should write in the coming weeks 16:14:27 <ericP> ... e.g. i think we should gather use cases 16:14:28 <LeeF_> +â for test cases 16:14:50 <sandro> cygri: eg: patterns for use of named graphs, that exist in the wild, and potentially cause interop conflicts. 16:14:54 <ericP> ... we should look for different existing use patterns which will reveal problems at e.g. SPARQL endpoints 16:15:07 <sandro> q+ 16:15:09 <davidwood> q? 16:15:12 <ericP> +1 to test cases 16:15:13 <davidwood> ack Guus 16:15:15 <PatHayes> leef, what symbol was that? 16:15:23 <ericP> Guus: +1 to test cases 16:15:49 <ericP> ... want to see which we should put in RDF semantics and which are outside pragmatics 16:15:51 <sandro> PatHayes, it was a unicode snowman 16:16:01 <davidwood> 16:16:07 <sandro> (or not. hard to see.) 16:16:09 <PatHayes> :-) 16:16:14 <ericP> ... folks already have pragmatic approaches. the question is whether we can incorporate some of that into RDF 16:16:37 <davidwood> q? 16:16:40 <davidwood> ack sandro 16:16:51 <ericP> Guus: with respect to naming and referencing, i don't expect us to put stuff into Semantics, but it will be in tests 16:17:14 <LeeF_> LeeF_ has joined #rdf-wg 16:17:37 <ericP> sandro: in gavin's use case, several folks said "there's a bug here" 16:17:49 <LeeF_> PatHayes, 16:18:00 <ericP> ... we can try to solidify that 16:18:23 <ericP> davidwood: "can a document IRI and the graph IRI be the same?" 16:18:32 <ericP> gavinc: and the ontology IRI? 16:18:44 <davidwood> q? 16:18:54 <ericP> sandro: is the ontology's name for itself the same as its location? 16:19:03 <ericP> gavinc: axes: 16:19:08 <ericP> ... .. graph name 16:19:09 <sandro> graph-name vs location 16:19:19 <ericP> ... .. <x> a Ontology. 16:19:39 <ericP> ... .. where you can retrieve the [ontology?] 16:19:52 <AlexHall> :g1 { :g1 a owl:Ontology } 16:20:04 <swh> if <x> a Ontology, surely <x> should't be a graph? c.f. Person and graph 16:20:06 <ericP> ... i think the prob exists on these axes 16:20:26 <danbri> we no hear 16:20:32 <mischat> can people speak in turn please 16:20:49 <danbri> we heard a little of all of them 16:20:57 <ericP> ... { <x> a Ontology } gets repeated everywhere 16:21:32 <sandro> sandro: possible test case, if we can infer a type for locations and/or names. 16:21:34 <ericP> LeeF: is it kosher for the graph name to be X and for X to be the ontology triple 16:21:45 <ivan> q+ 16:21:49 <PatHayes> this sounds very like the question whether one iri can identify the NYTimes and also one day's version of it. 16:21:55 <davidwood> ack ivan 16:21:55 <AndyS> no 16:21:55 <gavinc> HTTP GET <g1> ; :g1 { :g1 a owl:Ontology } 16:22:09 <ericP> davidwood: we should at least provide guidance to the community 16:22:36 <PatHayes> that is exactly what I meant by using a name inside some rdf. 16:22:48 <ericP> ivan: sandro vs. cygri controversy: should the formal part of the RDF docs talk about dereferencing the graph name 16:22:55 <PatHayes> once you do that, it belongs to trhe semantics. 16:23:09 <ericP> ... if the answer is "no", we can discuss writing additional guidance documents 16:23:11 <tlebo> is Gavin's #1 "graph name" of the Graph Container? 16:23:14 <PatHayes> +1 to ivan 16:23:24 <ericP> ... that question is the fundamental question 16:23:34 <ericP> q+ to say we won't knwo until we've explored the use cases 16:23:40 <swh> +1 to ivan 16:23:51 <cygri> q+ to give an example from sindice 16:23:52 <ericP> sandro: i think we're only going to answer that question by working up from test cases 16:24:12 <ericP> ivan: so let's look at tests keeping this in mind 16:24:18 <pfps> test cases can provide information on what a solution might look like, but they don't help much to determine what the solution is 16:24:36 <swh> q+ 16:25:05 <ericP> ... if the semantics requires a particular way of dereferencing the name or graph, would that change antidot's implementation? 16:25:05 <PatHayes> test cases give useful information about intuitions. better than arguing :-) 16:25:14 <mischat> +1 to ivan, all conversations we have had today seem to involve talk about dereferencing, linked data, and quads, but this hasn't been discussed yet. 16:25:14 <gavinc> +100 PatHayes 16:25:16 <sandro> The Formal Semantics document is just one way to make a spec. First let's figure out what we want to spec. 16:25:17 <cygri> PatHayes, but less fun! 16:25:26 <LeeF_> :) 16:25:50 <PatHayes> ericP, this irc record. 16:25:56 <davidwood> ack ericP 16:25:56 <Zakim> ericP, you wanted to say we won't knwo until we've explored the use cases 16:27:12 <sandro> ericP: The SemWeb limps along, we're used to, we compose SPARQL queries that connnect different graphs, we're not surprised by individuals lying to us, etc. But Sandro is trying to enable things beyond what we are doing now. We don't want to make sure we don't rule out these use cases in the future. 16:27:20 <swh> q- 16:27:45 <AlexHall> s/don't want to make sure/want to make sure/ 16:27:55 <sandro> ... without understand how we can take this to a system where there is consistency between platforms, ... we need to figure out how we want the system to work before deciding what goes in the semantics document. 16:28:03 <swh> q+ 16:28:18 <sandro> PatHayes: I agree, but we may find it can't be done in the Semantic Document. Be ready to be told "I can't do it". 16:28:21 <ericP> PatHayes, 16:28:25 <pfps> +1 to Pat :-) 16:28:45 <sandro> davidwood: if you can't do it, where does that leave us? 16:29:12 <sandro> PatHayes: without precisely defined semantics. maybe that's okay. 16:29:30 <ericP> sandro, what do you feel about the semantics being defined in natural language and test cases? 16:29:31 <pfps> Test cases are not a definition. Natural language can be rather squishy. 16:29:37 <danbri> we'd need specific examples of the test cases 16:29:39 <sandro> sandro: How bad would it be to do it with natural language and test cases? 16:29:49 <ericP> PatHayes: that's like asking a horse trainer how they feel about life without horses 16:30:04 <sandro> PatHayes: There's a long language of clashes resolves by formal semantics. If we can do it that way we should. 16:30:07 <ericP> ... the world can get by, but [there's a cost] 16:30:12 <sandro> davidwood: Thanks Pat! 16:30:17 <davidwood> ack cygri 16:30:17 <Zakim> cygri, you wanted to give an example from sindice 16:30:31 <ericP> ... but don't be surprised if i can't write the semantics that you guys arrive at 16:30:42 <PatHayes> squishy, good one. 16:30:44 <cygri> ack me 16:30:59 <sandro> s/sandro, what do/sandro: what do/ 16:31:15 <ericP> cygri: re: dereferencing, we have a web crawling use case about an RDF search engine 16:31:23 <mischat> 16:31:27 <Souri> q+ to confirm that we are discussing three things: graph name for an ontology, name of the ontology, location from where the ontology (or graph) i available 16:31:47 <PatHayes> 'ontology 16:31:53 <ericP> ... it takes a URL X, dereferences it, put's the parse into GRAPH <X> 16:31:55 <PatHayes> sorry 16:31:57 <Souri> s/ i av/ is av/ 16:32:18 <ericP> ... it supports the truth that sandro wants 16:32:45 <ericP> ... if we want to define this formally, we have to discuss @@1 16:32:53 <ericP> ... in 2006, that was RDF/XML 16:33:03 <ericP> ... in 2007, RDF/XML and Turtle 16:33:16 <sandro> cygri: sindice's dataset uses the fetch-from location as the tag, and its graph containers. when we built this in 2006, this was parsed from RDF/XML, then conneg, then sniffing, then microformats support added, then RDFa, then microdata, ... and some day json-ld, etc. 16:33:24 <ericP> ... then we added RDFa, ntriples, microdata, ... 16:33:36 <sandro> cygri: The notion of dereferencing has changed over the years. 16:33:44 <ericP> ... the notion of dereferencing has changed over the years 16:34:12 <PatHayes> this is exactly why we had an abstract notion of rdf graph, to provide a level of abstraction above particulr syntax. 16:34:25 <pchampin> who wrote earlier that time was not the only parameter? 16:34:29 <ericP> ... how do we write a formal spec that tells us how to dereference? 16:34:51 <ericP> davidwood: can you tell me if 4.2 is subsumes 4.9 or 1.3? 16:34:56 <PatHayes> uri for the test cases? 16:35:02 <davidwood> q? 16:35:06 <ericP> sandro: [addressing cygri] 16:35:09 <PatHayes> q 16:35:21 <PatHayes> q 16:35:22 <danbri> q? 16:35:22 <ericP> ... i don't have a pat answer, but i think we can come up with something that's good enough 16:35:23 <gavinc> PatHayes, 16:35:26 <PatHayes> q+ 16:35:46 <PatHayes> thanks gavin 16:36:09 <ericP> cygri: i think that a formal semantics must be precise, so we need to reduce our scope to what we can be precise about 16:36:41 <PatHayes> typing with one hand, return and shift keys too close. 16:36:43 <ericP> ... there's something else that can be done which is sort of hand-wavey which would be useful; recording this pattern 16:37:20 <davidwood> acl swh 16:37:21 <ericP> ... but writing to rules to establish if <G> is a conforming something of an IRI could be hard 16:37:24 <davidwood> ack swh 16:37:50 <ericP> swh: agreed with ericP to a point, but have a different conclusion: 16:38:18 <ericP> ... .. none of the use cases we've discussed benifits from a formal semantics for dereferencing 16:38:42 <davidwood> ack Souri 16:38:43 <Zakim> Souri, you wanted to confirm that we are discussing three things: graph name for an ontology, name of the ontology, location from where the ontology (or graph) i available 16:38:57 <ericP> ... so unless we can find another use case, i think we can spend our time better elsewhere 16:39:06 <ericP> Souri: in the ontology case, i see three things: 16:39:10 <ericP> ... .. graph name 16:39:16 <ericP> ... .. ontology name 16:39:21 <ericP> ... .. location 16:39:32 <davidwood> 5.2 16:39:44 <davidwood> 16:39:50 <ericP> Souri: these could all be different 16:39:57 <tlebo> is "graph name" of the container or g-snap? 16:40:05 <ericP> ... can we add properties like rdf:availableFrom? 16:40:42 <tlebo> q+ 16:40:45 <ericP> ... if folks want to use one IRI for all, fine 16:40:53 <pfps> right now OWL works fine without any further semantics for ontology names 16:41:04 <tlebo> q- 16:41:08 <ericP> ... if not, we can give them some properties to describe their relationships 16:41:21 <davidwood> ack PatHayes 16:41:26 <ericP> davidwood: by "graph", gsnap or gbox? 16:42:03 <Guus> suggest to go to the wikidata usecase 16:42:14 <cygri> q+ 16:42:24 <ivan> ack cygri 16:42:27 <ericP> PatHayes: from cygri listing the syntaxes each year, the notion of defining dereferencing would be to address exactly that 16:42:37 <ericP> ... i thought that was the one part we got exactly right 16:43:03 <ericP> cygri: one of the cool things about syndice is that we can push a bunch of stuff down the pipe and we get triples 16:43:12 <ericP> ... the process is really complicated 16:43:29 <ericP> ... HTTP, mime time, sniffing, ... 16:43:46 <ivan> s/mime time/mime type/ 16:43:47 <ericP> ... we learn more about this all the time 16:44:03 <gavinc> s/mime type/media type/ ;) 16:44:17 <ericP> ... getting from the IRI to the graph is hard to specify 16:44:37 <ericP> ... i'm more interested in what you get after you dereference and parse and all that 16:44:47 <swh> there can even be multiple was to get from a URI to different graphs, e.g. conneg + RDFa 16:45:15 <swh> +1 to not specifying it 16:45:20 <yvesr> swh, and conneg'ed graphs may be different too 16:45:29 <swh> indeed 16:45:30 <cygri> ericP++ 16:45:33 <yvesr> swh, (as it does on the bbc site, for example, although i agree it's not ideal) 16:45:56 <cygri> q+ 16:46:01 <LeeF> LeeF has joined #rdf-wg 16:46:03 <cygri> q- 16:47:29 <LeeF_> LeeF_ has joined #rdf-wg 16:47:42 <cygri> ericP: from the same input URI, you could end up with quite different snaps because of different processing that was done 16:48:08 <cygri> q+ 16:49:35 <davidwood> ack cygri 16:49:38 <cygri> q- 16:49:39 <ericP> PatHayes: we violated the obvious deferencing rules when we decided that IRIs in RDF could identify graphs 16:50:05 <AndyS> AndyS has joined #rdf-wg 16:50:08 <sandro> The mentioned decision was: "Named Graphs in SPARQL associate IRIs and graphs *but* they do not necessarily "name" graphs in the strict model-theoretic sense. A SPARQL Dataset does not establish graphs as referents of IRIs (relevant to ISSUE-30)" 16:50:34 <iand> do sparql datasets consist of g-snaps or g-boxes? 16:50:42 <cygri> iand, g-snaps 16:51:07 <cygri> (with g-boxes it's a âgraph storeâ, defined in the SPARQL Update spec) 16:51:22 <cygri> 16:51:29 <iand> cygri: i don't agree that a g-box is a graph store 16:52:11 <cygri> iand: what AndyS is saying 16:52:32 <danbri> nor I 16:52:42 <iand> cygri: isn't a g-box a set of g-snaps with the same name? 16:53:06 <Souri> s/tanks/thanks/ 16:53:19 <danbri> if I have a github repo with 15 versions of some RDF doc (er, graph), ... is that a g-box? 16:53:20 <davidwood> iand: no, I don't think so 16:53:28 <cygri> iand, no. g-snaps don't have names as such 16:53:38 <davidwood> 16:53:39 <gavinc> gavinc: A graph store is made up of gboxes, a dataset is made up of g-snaps 16:53:41 <cygri> g-snap = mathematical set of triples 16:53:48 <davidwood> q? 16:54:16 <davidwood> TOPIC: 4.9 (A PRIORITY) Trust Web Opinions 16:54:27 <AndyS> +1 gavinc -- what needs clarifying is graph store -> dataset for query, not graph store or dataset themselves 16:54:34 <MacTed> MacTed has joined #rdf-wg 16:55:58 <ericP> sandro: people are publishing useful info on the web 16:56:12 <ericP> ... alice is searchnig for a good local seafood restaurant 16:56:31 <iand> cygri: can't get my head round g-snaps not having names if SPARQL datasets are made of named g-snaps 16:56:35 <davidwood> iand: Also, a g-box is mutable and not a 'set' 16:56:35 <ericP> ... there are different modes of failure sensitive to the data she may find: 16:56:47 <ericP> ... .. deception (people lying) 16:56:48 <cygri> iand: named graph = pair of uri and g-snap 16:56:57 <ericP> ... .. errors (mistakes in the data) 16:57:03 <cygri> sparql dataset = set of named graphs, plus a default graph (= g-snap) 16:57:05 <ericP> ... .. simplication 16:57:10 <ericP> ... .. time lag 16:57:21 <ericP> ... .. subjectivity 16:57:49 <iand> cygri: you are saying named graphs are graphs without names that have a name associated with them 16:57:50 <ericP> ... [of course] this occurs in science, IT (e.g. employee directory) 16:58:11 <cygri> iand i don't think i said that 16:58:13 <ericP> ... i haven't yet tied this down to test cases 16:58:20 <gavinc> iand, could you use "," and not ":" the minutes will be very annoying otherwise 16:58:45 <ericP> ... e.g. i don't want to endorse a gbox; i want to endorse a gsnap (review changes out from under your endorsement) 16:59:06 <ericP> davidwood: she already knows about the sources of reviews, but she doesn't know which she can trust 16:59:07 <iand> gavinc, yep, sorry 16:59:47 <ericP> sandro: say she's using sindice to find seafood restos 16:59:54 <PatHayes> q+ 17:00:07 <ericP> davidwood: alice goes to sindice and gets RDF for resto reviews 17:00:24 <ericP> ... upon what data/metadata is she "trusting" the review? 17:00:43 <ericP> sandro: she had to know her threat model to manage her security 17:01:02 <ericP> ... .. deception: web of trust 17:01:17 <ericP> ... .. error: crowd sourcing 17:01:23 <ericP> ... .. time lag... 17:01:35 <ericP> davidwood: i'd like to get here with 1.3 17:02:14 <ericP> ... implicit in this is that a given review published in the web must be spidered by sindice or alice, ... 17:02:32 <ericP> ... in spidering, they must capture provenance data (where, when, ...) 17:02:54 <ericP> sandro: sindice could just give alice the locations, and she fetches them 17:03:21 <ww> ww has joined #rdf-wg 17:03:21 <swh> if sindice just gives Alice a URI should just judge timeliness without trusting the publisher 17:03:26 <danbri> it's a myth that you need URIs to do things 17:03:29 <danbri> it's just a lot easier 17:03:34 <swh> s/should/she can't/ 17:03:44 <ericP> davidwood: she'll need at least one bit of metadata, the IRI, or much more 17:03:52 <PatHayes> All these issues come up on the web right now. People seem to manage, on the whole. Might be worth trying to figure out how/why and provide similar funcitonality for people to use in RDF. 17:04:06 <ericP> ... if sindice finds a resto review in RDF, what's it try to GET? 17:04:37 <ericP> cygri: deferences, parses (many parsers) 17:04:44 <ericP> ... records: 17:04:48 <ericP> ... .. domain name 17:04:51 <ericP> ... .. time 17:04:57 <ericP> ... .. HTTP headers 17:05:10 <ericP> ivan: the name of the graph is the IRI which gave you the IRI? 17:05:12 <ericP> cygri: yes 17:05:51 <ericP> davidwood: if we standardized a named graph: named gbox or named gsnap, would that help? 17:06:07 <ivan> q+ 17:06:15 <sandro> q+ to reply to "don't stdize deref" 17:06:16 <ericP> cygri: don't try to specify the dererencing step 17:06:16 <PatHayes> q- 17:06:28 <ericP> ... would be immediately outdated 17:06:32 <PatHayes> i wrote my comment. 17:07:01 <ericP> davidwood: would a standard for gboxes or gsnaps help the sindice use case? 17:07:12 <ericP> cygri: practically, no; it's already implemented 17:07:29 <ericP> ... would make it easier for us to discuss what we do in terms others would understand 17:07:32 <gavinc> PatHayes, for one thing humans don't treat IRIs as opaque. A review from "" is magicly downranked 17:07:57 <ericP> ... i listed this because i don't want the WG to standardize something harmful 17:08:00 <gavinc> ack sandro 17:08:00 <Zakim> sandro, you wanted to reply to "don't stdize deref" 17:08:45 <cygri> 17:08:50 <PatHayes> gavin, nice. to me that suggests we could use a way to say foo is downrated in RDF. Now ask what kind of thing foo is... 17:09:45 <ericP> sandro: if alice's software is speaking to sindice, using SPARQL against the dataset, it would help if here code knew that sindice is using their named graph convention 17:10:31 <cygri> q+ to ask about test cases for "to dereference, follow the standards" 17:10:35 <ericP> ... re: specifying dereferencing, i don't want to specify the mechanics; we can just lean on the specs (which is what PatHayes identified as the bit of the semantics that works) 17:10:39 <swh> That sounds like a job for a vocabulary, not sure it's the RDF-WGs problem 17:10:48 <yvesr> +1 17:10:57 <sandro> +1 steam-powered parsers!! 17:11:04 <AndyS> And in the limit (geo-IP) not everyone may see the same thing for exactly the same request. 17:11:04 <AlexHall> +1 swh 17:11:15 <davidwood> ack ivan 17:11:29 <tlebo> can't we phrase dereferencing as http:Requesting a rdf2:GraphContainer to obtain a http:Representation of a rdf2:Graph, http:ContentNegotiated to a particular rdf2:GraphSerialization ? 17:11:29 <ericP> PatHayes: if someone has a new steam-powered parser, they just have to describe in painstaking detail how it emits triples 17:11:56 <ericP> ivan: if we use this black box, do we exclude names? 17:12:19 <gavinc> Yeah, sounds like a job for the vocabulary, but I think we get right back to what is that vocab talking about, a Resource in a Graph or "The Graph". Where "Graph" is our nice new meaning of gbox+gsnap 17:12:25 <ericP> ... e.g. AndyS's suggestion for using tag IRNs for time-stamped data 17:13:16 <AndyS> q+ 17:13:20 <ericP> sandro: dereferencing is the way we learn the intent of the identifier 17:13:21 <AlexHall> gavinc, yeah we need to make sure that the vocabulary has something to talk about 17:13:34 <danbri> q+ to grouch 17:13:46 <danbri> de-referability is not a property of URI scheme 17:14:01 <danbri> 17:14:41 <yvesr> q? 17:14:49 <PatHayes> all uris dereferenced for a nominal fee. money-back guarantee. 17:14:49 <danbri> q- 17:14:53 <davidwood> ack cygri 17:14:53 <Zakim> cygri, you wanted to ask about test cases for "to dereference, follow the standards" 17:14:56 <gavinc> 0K box! 17:15:00 <danbri> q+ 17:15:02 <ivan> ack cygri 17:15:29 <ericP> cygri: so we leave dereferencing as a black box (leave to standards) 17:15:48 <ericP> ... but i don't see how to write test cases 17:16:30 <ericP> ... if it's a specification, it should be possible to write a test case 17:16:38 <ericP> sandro: i agree with your goal 17:16:53 <PatHayes> which, btw sandro, is one reason why naming/reference cannot be identical to awww:identifies. 17:16:59 <ericP> ... most dereferences are in HTTP and there's a little glue around the edges 17:17:52 <ericP> ... i haven't got a test case and agree that we need then 17:18:09 <davidwood> ack AndyS 17:18:13 <ericP> sandro: names and awww:identifies could be congruant functions 17:18:18 <davidwood> ack danbri 17:19:28 <davidwood> 1.3 (A PRIORITY) Graph Changes Over Time 17:19:29 <PatHayes> 8 track tapes... 17:19:30 <ericP> danbri: re: deferencing, you speak as if dereferencability as it it were a behavior of the schema, but it evolves 17:19:31 <yvesr> q? 17:19:32 <davidwood> 17:19:49 <PatHayes> of course 17:19:53 <swh> q+ 17:19:53 <sandro> pfps if we can't discuss history are we doomed to repeat it? :-) 17:20:02 <davidwood> ack swh 17:20:03 <danbri> resolved: de-referencability is not a simple characteristic of a URI scheme, but depends on social and technical mess surrounding us 17:20:29 <davidwood> Ugh 17:20:35 <davidwood> s/resolved// 17:20:42 <sandro> q+ 17:20:46 <ericP> swh: in our system you need to have different graphs at the same IRI at different times 17:21:05 <PatHayes> q+ 17:21:10 <tlebo> :URL rdfs:subClassOf rdf2:GraphContainer ? 17:21:19 <ericP> ... we need to say that some info was in <X> at one time but not later 17:21:36 <ericP> ... so of course you can't *just* use <X> 17:21:39 <tlebo> rdfs2:GraphContainer owl:disjointWith rdf2:Graph . 17:22:01 <sandro> q? 17:22:05 <ericP> ... we just use <X-2011-10-12T17:22:05> 17:22:19 <ericP> ... looked at MD5, but it was a pain 17:22:30 <swh> we actually use <> 17:22:57 <danbri> (q: are anyone's 'graphs' computed from other 'graphs' rather than simply fetched? am assuming so but didn't hear much mention of this...) 17:23:10 <PatHayes> do you need to be able to tell, by looking at the iri, which way it works (box or snap name) ? 17:23:33 <ericP> sandro: if you use <>, you could own that graph and say that it's attached to <> 17:23:43 <tlebo> @pathayes, no, interrogate its rdf:types ? 17:23:51 <iand> +1 swh - this is first use case where graph name cannot be same as source of triples 17:23:55 <ericP> ivan: we've never said that a graph need have only one name 17:24:03 <sandro> really I said garlic + date + fetched-url 17:24:15 <danbri> I have swh's use case too; it's quite a common pattern and worth naming/documenting/exposing 17:24:17 <sandro> q+ 17:24:28 <sandro> q+ to talk about rolling snapshots 17:24:32 <ericP> PatHayes: i think that there's one name, which if you use it as a graph name, changes meaning from time to time 17:24:45 <mischat> we didn't go for⦠to save bytes FWIW 17:25:02 <AndyS> AndyS has joined #rdf-wg 17:25:23 <swh> mischat, that's right 17:25:29 <ericP> ivan: we have the notion of a "graph container" and a graph at different IRIs 17:25:41 <ericP> gavinc: do they *have* to be different IRIs? 17:25:46 <sandro> makes sense, mischat --- but you COULD quite easily, and then it would totally conform with "Web Semantics for Datasets". 17:27:40 <cygri> q+ 17:27:51 <sandro> davidwood: Possible consensus: The identifier for a graph container is disjoijnt with the identifier with the g-snap (rdf graph). 17:27:57 <mischat> we were could have done, but we built this a while ago, before this conversation. we do this by using SPARQL to insert triples into a triplestore. and as far as we were aware we were conforming 17:28:11 <PatHayes> you could use one iri to identify a grap and a container, but dont record that use in any published rdf. 17:28:12 <ericP> davidwood: gavinc thinks that he's heard an emerging concensus that the graph container must be different from the name for a graph 17:28:32 <ericP> ... objections? 17:28:59 <davidwood> Yes, there were (thankfully) objectons 17:29:08 <swh> LOAD <> will do that 17:29:32 <ericP> swh: as applied globally, yes 17:29:45 <PatHayes> disjoint is too strong. 17:29:49 <ericP> davidwood: and here, so we don't have consensus here 17:30:04 <PatHayes> q+ 17:30:05 <pchampin> q+ 17:30:22 <ericP> sandro: [chasing why this breaks SPARQL] 17:30:26 <cygri> q+ to say that if <u> *denotes* a graph container, then it must still be possible to associate <u> with a graph graph in an RDF dataset 17:30:46 <mischat> isn't the beauty of it that you can choose to use the URL of where you dereferenced it from, or use whatever URI you wish when sticking it into your sparqlstore 17:31:15 <LeeF_> SELECT .... FROM <g1> { ... } 17:31:22 <LeeF_> g1 specifies a graph container 17:31:25 <LeeF_> it gets dereferenced 17:31:31 <LeeF_> and put into a local graph container that is also named g1 17:31:40 <LeeF_> local g1 is contextualized by the invocation of the quer 17:31:41 <ericP> timlebo: when you specify the SPARQL query, the FROM IRI sites the graph container, GRAPH <IRI> dereferences IRI and stores it locally 17:31:46 <PatHayes> agree with cygri, but want to add cautions regarding denoting-use in rdf which assumes connection to association. 17:31:51 <AndyS> FROM ==> FROM NAMED 17:31:53 <davidwood> q? 17:32:02 <iand1> iand1 has joined #rdf-wg 17:32:14 <cygri> ack me 17:32:14 <Zakim> cygri, you wanted to say that if <u> *denotes* a graph container, then it must still be possible to associate <u> with a graph graph in an RDF dataset 17:32:39 <ericP> ... so the SPARQL query against your local <IRI> is contextualized by your dereference 17:32:57 <sandro> +1 cygri 17:33:00 <gavinc> s/graph graph/RDF Graph (gsnap) 17:33:02 <gavinc> s/graph graph/RDF Graph (gsnap)/ 17:33:20 <AndyS> It is a bad part of SPARQL. Promotes lazy naming. (and DAWG removed it once ... community wanted it back) 17:33:42 <ericP> cygri: if i deference (which may change tomorrow), i serialize it into a trig file 17:33:56 <PatHayes> im losing sound here. 17:34:18 <ericP> ... that trig file serializes a gsnap which i want to associate with the gbox (<>) 17:34:34 <davidwood> PatHayes, we hear BBC. Perhaps you should redial? 17:34:44 <sandro> Can't there be an eg:hasGraph relation between the gbox and the gsnap? 17:35:10 <ericP> ... one identifier denotes a graph container @@2 17:35:15 <PatHayes> in a spec we can mention lazy naming and point out how useful it is but also say how dangerous it can be with detailed warnings. 17:35:35 <sandro> q++++ 17:35:41 <ericP> ivan: i understand the example, and it makes me uneasy that the same IRI denotes two conceptually distinct things 17:35:45 <LeeF_> where in this example is a URI being used for a gsnap? 17:35:47 <gavinc> ack +++ 17:35:48 <AndyS> PatHayes - good idea - say "don't publish - use locally" 17:35:56 <PatHayes> +1 ivan 17:36:00 <ericP> ... maybe we have to live with conflation 17:36:09 <iand1> So we are back to "(15:04:03) davidwood: Propose to RESOLVE "we need a way to name graph containers"" 17:36:09 <PatHayes> q- 17:36:09 <LeeF_> +1 to living with the conflation!! 17:36:18 <tlebo> Still thinks that adopting <> vs. my:# and your:# addresses this confusion. 17:36:23 <pchampin> q- 17:36:26 <davidwood> ack sandro 17:36:26 <Zakim> sandro, you wanted to talk about rolling snapshots 17:36:28 <gavinc> +1 to living with conflation 17:36:38 <iand1> -1 to conflation 17:36:50 <ericP> sandro: i have issues with an IRI denoting two things 17:36:51 <cygri> danbri++ 17:37:15 <ericP> danbri: it's just an unspecified relationship 17:37:21 <PatHayes> because people want to be happily sloppy, sandro. 17:37:27 <ericP> sandro: so why can't we specify that relationship? 17:38:00 <ericP> ... particular predicates can imply the <bgox of> 17:38:03 <ericP> q? 17:38:14 <yvesr> s/bgox/gbox 17:38:20 <PatHayes> this is very like the problem of giving iris to editions of documents, seems to me. 17:38:20 <iand1> can someone propose some concrete text to discuss? 17:39:04 <ericP> davidwood: we have namespace all over RDF 17:39:28 <ericP> ... we have IRIs which point to SPAQL enpoints which point to resources 17:39:39 <tlebo> @PatHayes, frbr:Work vs frbr:Expression gives you clean disjointness of editions and their more abstract documents. 17:40:17 <tlebo> q+ 17:40:24 <PatHayes> i know, tlebo. i wish all these scruffy people would agree to that disciplined. 17:40:34 <PatHayes> to/to be/ 17:40:42 <ericP> davidwood: these identifiers liter our RDF graphs 17:40:52 <sandro> q? 17:41:01 <sandro> q+ to talk about rolling snapshots 17:41:04 <PatHayes> use imperial measures to solve that one. 17:41:07 <gavinc> GET <> ; <> { <> example: ""^^xsd:anyURI } 17:41:08 <danbri> tlebo, path, frbr distinctions are too often anything but clean when you try to get people to make specific decisions that apply them in practice 17:41:10 <ericP> ... my position is that we should accept the dual nature of those IRIs as identifiers and collapse the duality when we open the box 17:41:14 <davidwood> ack tlebo 17:41:29 <LeeF_> I'm pretty happy to go ahead being sloppy in violation of the semantics -- presumably, some day there will be a tool that is really valuable that relies on me following the semantics and then i will be motivated to change my implementation :) 17:41:35 <ericP> tlebo: propose that URLs are a subclass of graph container which you dereference to a graph 17:41:38 <yvesr> danbri, +1 17:42:04 <AndyS> LeeF, suspect world+dog agrees with you 17:42:36 <PatHayes> q+ 17:42:38 <ericP> ... (when we're talking about RDF graphs) 17:42:46 <danbri> LeeF, the WG is the tool, and the semantics are where we write stuff down so we don't forget exactly what we decided... 17:42:53 <davidwood> q? 17:42:54 <swh> we're processing HTML mostly, not RDF 17:43:18 <ivan> before break: there is something that we _did_ learn today: 17:43:19 <davidwood> Topic: 10 minute break 17:43:23 <Zakim> -PatH 17:43:28 <LeeF_> danbri, i'm not sure i understand what you're saying -- you're saying the semantics in the spec by themselves should be enough for me to change my implementation? that's unlikely 17:43:30 <tlebo> +1 17:44:05 <AndyS> MIT has gone silent (here) 17:44:20 <sandro> we muted for the break, AndyS 17:45:38 <danbri> LeeF_, no, more that you shouldn't be sat there, waiting and dissapointed, when no fabulous js/Java/php library comes along proving the usefulness of the Semantics. Rather, the fact that most such libraries more or less work well with each other, is partly due to things having been written down in obsessive detail in the semantics (and in testcases, sure) 17:54:31 <Scott_Bauer> Scott_Bauer has joined #rdf-wg 18:00:49 <davidwood> Reconvene 18:01:10 <AlexHall> scribe: alexhall 18:01:23 <Zakim> +PatH 18:01:25 <ivan> scribenick: AlexHall 18:01:32 <LeeF_> If there were more people using Windows then there would be more people agreeing with me about just living with the conflation :-) 18:01:46 <AlexHall> davidwood: don't think we ever really talked about UC 1.3. Steve started to and didn't finish, did you have anything else? 18:01:55 <davidwood> Topic: 1.5 (A PRIORITY) Exchanging the contents of RDF stores 18:01:55 <AlexHall> swh: no, that was it 18:02:07 <davidwood> 18:02:22 <AlexHall> davidwood: whose use case? 18:02:28 <swh> I want it :) 18:02:47 <davidwood> iand? 18:02:59 <iand1> nooo 18:03:09 <AlexHall> swh: related to backups... how to move between stores? Things like trig do it fairly well except the default graph issue 18:03:26 <sandro> swh: TriG doesn't work for this if the default graph is the merge of all the named graphs. 18:03:27 <AlexHall> ... duplicate every triple if dft graph = union of ngs 18:03:37 <AlexHall> ... also issues around bnodes 18:04:43 <PatHayes> why should the default be the union of named graphs??? that sounds like an obviously wrong general assumption. 18:04:53 <AlexHall> ivan: trig syntax won't tell you what is the default graph 18:05:16 <sandro> PatHayes, it's not a general assumption -- it's just how some SPARQL engines are set up. 18:05:31 <AndyS> PatHayes, "can be" -- common pattern and they use NG to manage data (subsets of the data) 18:05:34 <sandro> (steve's in particular, by default.) 18:05:39 <pchampin> q+ 18:05:42 <AlexHall> guus: not a sparql store developer -- what's the issue here? 18:05:45 <PatHayes> so, why are we even talking about this? 18:06:12 <PatHayes> ok, so trig needs to be extended in some way? 18:06:14 <davidwood> ack sandro 18:06:14 <Zakim> sandro, you wanted to talk about rolling snapshots 18:06:15 <AlexHall> ???: many stores define the default graph specially 18:06:23 <PatHayes> q- 18:06:46 <sandro> sandro: The other thing TriG doesn't do for this UC is bnodes (unless skolemized) 18:07:20 <davidwood> ack pchampin 18:07:22 <ericP> swh, how about a meta comment in trig like this:? @SPARQL: CONSTRUCT { ?s ?p ?o } WHERE { GRAPH ?g { ?s ?p ?o } } . 18:08:01 <mischat> mischat has joined #rdf-wg 18:08:20 <AlexHall> pchampin: think i disagree that this is a problem with trig. dataset is an immutable structure. how the default graph was defined is irrelevant. 18:08:22 <AndyS> TriG can do bNodes - just a small decision on scope - "small consensus" was doc-wide but point decision to be made. Orthogonal (later) 18:08:42 <davidwood> INSERT DATA { GRAPH <g> {} } ... 18:08:46 <AlexHall> ... if SPARQL stores are more than just dataset definitions then they need extra stuff to support that. 18:09:18 <AlexHall> davidwood: looking at SPARQL update example here, data is going into a graph identified by a URI 18:09:52 <AlexHall> ... 6 months ago, there was disagreement on this issue: what is being identified by this URI? 18:10:12 <AlexHall> ... if we choose to align with SPARQL, then we're saying that this URI identifies a g-box 18:10:17 <cygri> -1 18:10:24 <PatHayes> i think we have already decided that we are NOT doing this. 18:10:39 <cygri> q+ to ask what david means by âidentifyâ 18:10:40 <sandro> STRAWPOLL: Does anyone object to identifying a g-box with a URI, aligning with SPARQL 1.1 " INSERT DATA { GRAPH <g> {} } " 18:11:31 <iand1> of course you can identify a g-box with a URI, but you don't have to 18:11:42 <AlexHall> pat: IRI is associated with graph, but doesn't denote it 18:11:48 <sandro> cf the resolution from 2011-04-14 --- the url CAN denote the g-snap. 18:11:52 <AlexHall> sandro: but the IRI can denote the g-box 18:11:52 <davidwood> ack cygri 18:11:52 <Zakim> cygri, you wanted to ask what david means by âidentifyâ 18:11:53 <sandro> CANT 18:12:10 <AndyS> ptr to resolution? 18:13:06 <cygri> quoting SPARQL Update: âA Graph Store is a mutable container of RDF graphs managed by a single service. Similar to an operated on by the, a Graph Store contains one (unnamed) slot holding a default graph and zero or more named slots holding named graphs. Operations may specify graphs to work with, or they may rely on a default graph for that operation.â 18:13:09 <sandro> AndyS: 18:13:16 <AndyS> sandro, thx 18:13:18 <swh> I don't think SPARQL GRAPH uris identify anything in particular 18:13:20 <sandro> s/:/,/ 18:13:25 <AlexHall> davidwood: when you give a server a URI instructing where to put some data, how can that URI not identify the g-box? 18:13:28 <pchampin> @swh me neither 18:13:57 <AlexHall> sandro: in SPARQL as deployed, they aren't used (consistently) to denote anything 18:13:59 <pfps> +1 to Sandro :-0 18:14:13 <AndyS> (That resolution was about datasets not graph stores.) 18:14:17 <AlexHall> ... used to denote different things in different datasets 18:14:55 <iand1> what does "zero or more named slots holding named graphs" mean? is that 2 names, one for the slot, one for the graph? 18:15:16 <AlexHall> ericP: we could say that SPARQL has never operated on g-boxes, only g-snaps 18:15:34 <danbri> i can't understand 'sparql operating over' here; it's more about how the system is managed 18:15:43 <danbri> and db admins don't exist in the formal Semantics 18:15:45 <AlexHall> davidwood: SPARQL might operate on g-boxes, but from the perspective of a user it's a g-snap for any given query. 18:15:46 <danbri> (yet) 18:15:47 <sandro> iand1, no, it's one name. 18:15:55 <yvesr> not when you update... 18:16:01 <tlebo> INSERT DATA { GRAPH #<g> {} } :-) 18:16:29 <zwu2> +1 to tlebo 18:16:42 <cygri> cambridge, slow down please 18:17:05 <davidwood> q? 18:18:19 <iand> sparql 1.1 query doesn't import the definition of graph from RDF Concepts. Doesn't seem to define it at all. 18:19:05 <AlexHall> ericP: meta-discussion about not allowing ourselves to be constrained by what SPARQL is doing right now. 18:19:21 <pchampin> q+ to suggest that SPARQL 1.1 *has* URI for g-boxes... somewhere 18:19:22 <sandro> eric: so far, maybe, SPARQL is against only g-snaps? 18:19:23 <yvesr> iand, interesting - it dives directly in 'graph patterns' 18:19:30 <AndyS> q+ 18:19:35 <gavinc> INSERT DATA { GRAPH <iri> { <s> <p> <o> }} ... takes the gsnap in the <iri> gbox adds <s> <p> <o> to the set to create a new gsnap that is placed into the gbox <iri> ? 18:19:37 <AlexHall> souri: if you're doing an update, it has to be a g-box. 18:20:01 <davidwood> ack pchampin 18:20:01 <Zakim> pchampin, you wanted to suggest that SPARQL 1.1 *has* URI for g-boxes... somewhere 18:20:01 <Guus> q? 18:20:07 <pchampin> 18:20:08 <gavinc> q+ to add question already in irc 18:20:43 <AlexHall> pchampin: thinking about section from SPARQL 1.1 that comes close to assigning URIs for graph containers 18:21:15 <AlexHall> ... indirect identification by building a graph URI from the service URI and the graph URI 18:21:23 <AndyS> q- 18:21:36 <sandro> Ahhhhh. I forgot/missed that. 18:22:41 <AlexHall> sandro: this torpedoes my claim that you have to use 2 URIs to denote a g-box in SPARQL. 18:23:00 <cygri> q+ 18:23:39 <tlebo> service description document ? 18:24:02 <AlexHall> andy: you don't get something back from a dataset, a dataset is a set of graphs some of which with URIs associated 18:24:12 <AlexHall> ... a graph store is a different aspect 18:24:52 <AlexHall> ... SPARQL 1.0, a dataset is a set of graph and named graphs that is what the query runs over 18:25:14 <AlexHall> ... then you have FROM/FROM NAMED which describes how to build the dataset from g-boxes/g-snaps 18:25:32 <pchampin> and dereference 18:25:40 <pchampin> s/dereference/dereferencing/ 18:25:50 <AlexHall> ... then SPARQL 1.1 adds the notion of graph store, which is a collection of slots for graphs that can change over time 18:26:06 <mischat_> mischat_ has joined #rdf-wg 18:26:16 <sandro> PROPOSED: SPARQL11-http-rdf-update URLs like /rdf-graphs/service?graph=http%3A// denote graph containers (gboxes). The embedded URI *might* also denote that same container, for some dataset arrangement patterns. 18:26:31 <AlexHall> davidwood: is it your opinion that we can map the terms from SPARQL to our g-* terms (with an additional term to describe a collection of g-boxes)? 18:27:04 <AlexHall> andy: yes, but it doesn't take into account stuff around graph literals 18:27:36 <gavinc> INSERT DATA { GRAPH <iri> { <s> <p> <o> }} ... takes the gsnap in the <iri> gbox adds <s> <p> <o> to the set to create a new gsnap that is placed into the gbox <iri>. This creates a new Dataset as well. ? 18:27:42 <davidwood> ack gavinc 18:27:42 <Zakim> gavinc, you wanted to add question already in irc 18:28:17 <AlexHall> gavinc: given the original insert data statement, is what i wrote in IRC true? 18:28:49 <yvesr> no 18:28:49 <PatHayes> i vote for it. 18:28:53 <tlebo> +1 to @gavinc's INSERT 18:28:57 <PatHayes> :-( 18:29:02 <sandro> +1 to gavin's explanation 18:29:07 <pchampin> ok if "<iri> gbox" means "the gbox labeled with <iri>" 18:29:22 <sandro> yes, pchampin 18:29:30 <PatHayes> yves, what was wrong with it? 18:29:37 <AndyS> Yes. 18:29:44 <ivan> what does 'label' mean? More exactly, what doesn't it mean? 18:29:53 <sandro> "paired" 18:29:57 <tlebo> [] sd:name <iri> . 18:29:57 <PatHayes> "identify" has huge tag-baggage. 18:30:00 <sandro> (I think that matches the spec) 18:30:10 <davidwood> q? 18:30:15 <tlebo> () 18:30:25 <AlexHall> yves: find it counter-intuitive, think it will be horribly confusing to somebody reading the spec for the first time. 18:30:29 <swh> q+ 18:30:58 <sandro> q+ to strawpoll 18:31:02 <tlebo> [] sd:name gavinc:iri; a rdf2:GraphContainer . 18:31:10 <PatHayes> im having a hard time thinking what else it can possibly mean. 18:32:00 <davidwood> ack cygri 18:32:17 <yvesr> ack swh 18:32:20 <davidwood> q+ to ask gavinc about "add to a set" 18:32:45 <AlexHall> swh: for gavinc, the thing that's wrong is that insert doesn't work over datasets, it works over graph stores. datasets are immutable. 18:32:51 <AlexHall> q+ 18:33:09 <gavinc> A Graph Store is paired with a Dataset that that is made up of the ??? of gboxes that contain the gsnaps that make up the Dataset 18:33:14 <gavinc> It may be more readable backwards 18:33:21 <iand> INSERT DATA { GRAPH <iri> { <s> <p> <o> }} means take the gsnap that is the current state of the gbox <iri>, perform an RDF-Merge with <s> <p> <o> to form a new gsnap and make that the current state of <iri> 18:33:52 <AlexHall> davidwood: sparql also has delete, but you can't delete from a set can you? 18:34:05 <pfps> you can add triples to a set, just like you can add 1 to a number, you just get a *different* set 18:34:19 <yvesr> ok, so do we need the equivalent of the gbox/gsnap terminology for dataset? 18:34:25 <yvesr> dbox/dsnap? 18:34:31 <gavinc> PatH, yes. A graph store can have a NEW gbox added 18:34:41 <PatHayes> tnx. 18:34:52 <pfps> we need to be careful to distinguish between side-effecting operations and functional operations 18:35:13 <AndyS> q+ to book a slot on the Q [point to follow] 18:35:26 <davidwood> q- 18:36:12 <davidwood> ack sandro 18:36:12 <Zakim> sandro, you wanted to strawpoll 18:36:14 <PatHayes> I once had lunch with Peter Landin. 18:36:20 <tlebo> +1 @iand's rephrasing of @gavinc's INSERT interpretation 18:36:33 <AlexHall> sandro: do we want to cement this down any more? 18:36:43 <AlexHall> zhe: depends on how you describe the <IRI,graph> pairing 18:36:45 <sandro> STRAWPOLL: SPARQL11-http-rdf-update URLs like /rdf-graphs/service?graph=http%3A// denote graph containers (gboxes). The embedded URI *might* also denote that same container, for some dataset arrangement patterns. 18:37:01 <cygri> ±1 18:37:06 <mischat> like how a g-box of triples can at time T is a g-snap. A graphstore of quads at time T is a dataset 18:37:17 <cygri> +1 actually 18:37:18 <LeeF_> +1 18:37:30 <swh> I have no idea what that means 18:37:31 <tlebo> @iand's interpretation: This is in line with PROV-WG's immutable prov:Entity prov:derivedFrom (a distinct) prov:Entity . 18:37:52 <AndyS> +1 18:37:53 <Souri> Souri has joined #RDF-WG 18:38:13 <PatHayes> +0 18:38:15 <AlexHall> sandro: some people use datasets in such a way that the embedded graph tag will denote the gbox. 18:38:31 <AlexHall> davidwood: can you please define denote for us? 18:39:05 <tlebo> "identifying" is how HTTP dereferencing works; "denotes" is how RDF works. 18:39:13 <tlebo> so says @PatHayes 18:39:16 <davidwood> denotes -> "is a way of referring to". There may be other ways. 18:39:16 <zwu2> +0 18:39:17 <PatHayes> well, its any naming. 18:39:58 <sandro> pat: it was the TAG that made that distinction, between "identify" and naming (in the general sense, which is how we use it). 18:40:19 <Souri> what are we saying +1, -1, +0, -0 to? (I was disconnected for last few minutes) 18:40:24 <tlebo> PatHayes: things apply to identifying that DO NOT apply to "denotes" - because it lets you access it. 18:40:37 <Guus> smaal reformuulation: "INSERT DATA { GRAPH <iri> { <s> <p> <o> }} means take the gsnap that is the current state of the gbox <iri>, perform an RDF-Merge with <s> <p> <o> and make that the current contents of <iri>" 18:40:50 <sandro> STRAWPOLL: SPARQL11-http-rdf-update URLs like /rdf-graphs/service?graph=http%3A// denote graph containers (gboxes). The embedded URI *might* also denote that same container, the way some people use datasets. 18:41:04 <PatHayes> pfps, you might be right. 18:41:28 <tlebo> it's not the same container! 18:42:08 <yvesr> 'might' and 'some' in a strawpoll confuses me :/ 18:42:20 <iand> INSERT DATA { GRAPH <iri> { <s> <p> <o> }} implies <iri> rdf:type :gbox 18:42:32 <cygri> iand, no 18:42:35 <PatHayes> <iri> := merge( <iri>, {s p o} ) 18:42:43 <pfps> implies in what entailment regime? 18:42:46 <ericP> q? 18:42:53 <AlexHall> sandro: i think most of the confusion here is the connection between IRI and gbox 18:42:54 <cygri> it's both a wave and a particle 18:42:55 <davidwood> iand: We aren't ready to make a statement that <iri> identifies the gbox... 18:42:55 <iand> pfps: in english 18:43:07 <iand> davidwood: i didn't say identifies 18:43:13 <davidwood> ack AlexHall 18:43:15 <yvesr> cygri, but is it dead or alive? 18:43:24 <PatHayes> en-tag 18:43:31 <cygri> yvesr, you won't know before you open the g-box 18:43:36 <sandro> Note that I'm NOT saying the IRI denotes the g-box, but the QUALIFIED one does as per 18:43:36 <davidwood> iand, no, you said rdf:type 18:43:41 <ericP> AlexHall: re: the relationship between the graph store and dataset 18:43:59 <ericP> ... the dsnap is the immutable collection of graphs states taken from the graph store 18:44:20 <ericP> q? 18:44:31 <davidwood> ack AndyS 18:44:31 <Zakim> AndyS, you wanted to book a slot on the Q [point to follow] 18:44:38 <ericP> q+ to ask if this strawpoll is intended to describe a new best practice 18:44:50 <davidwood> ack ericP 18:44:50 <Zakim> ericP, you wanted to ask if this strawpoll is intended to describe a new best practice 18:44:50 <tlebo> <> ! sameAs <.../rdf-graphs/service?graph=http%3A//> (but are both rdf2:GraphContainers). However, both have some common skos:broader... 18:45:26 <AlexHall> ericP: is the goal of this strawpoll to provide guidance for how people might manage their g-snaps and the g-boxes they stole them from? 18:45:44 <AlexHall> ... is it meant to provide guidance? describe best practice? document the only way we can do this? 18:46:03 <AlexHall> sandro: i think this is the only way to do this that makes sense. 18:46:31 <AlexHall> ericP: how can i evaluate this? is there a test case I can throw at it? 18:46:48 <AlexHall> sandro: use it in some RDF 18:46:53 <sandro> <> dc:author sandro:me 18:47:11 <sandro> <> rdf:type r:GraphContainer 18:47:31 <AlexHall> davidwood: we need to adjourn soon 18:47:59 <AlexHall> ericP: don't think we can answer this tonight. perhaps we should write some coherent test cases first. 18:48:07 <tlebo> TRUE: /rdf-graphs/service?graph=http%3A// a rdf2:GraphContainer; skos:broader ?x . <> a rdf2:GraphContainer; skos:broader ?x . 18:48:28 <AlexHall> davidwood: this example rdf is describing the gbox? 18:48:28 <PatHayes> sandro, this illustrates for me exactly the problem. you are the author of the box. 18:48:32 <AlexHall> sandro: yes 18:48:48 <Guus> q+ to ask Steve/Andy about synching RDF dataset def in SPARQL doc 18:48:59 <tlebo> these GraphContainers are frbr:Items :-) 18:49:05 <AlexHall> ???: what is being described, the box or the graph in the box? 18:49:24 <cygri> q+ 18:49:42 <AlexHall> sandro: normally dc:author is applied to web pages, and web pages are boxes too. when we say somebody is the author of the webpage, we generally mean they are the author of the latest version. 18:49:42 <davidwood> ack Guus 18:49:42 <Zakim> Guus, you wanted to ask Steve/Andy about synching RDF dataset def in SPARQL doc 18:49:53 <sandro> <> eg:refreshRate 3. 18:50:00 <mischat> mischat has joined #rdf-wg 18:50:03 <AlexHall> ... in this context, might mean that sandro:me is the author is the latest gsnap in the box 18:50:30 <cygri> q- 18:52:19 <AlexHall> guus: can we try re-formulating the definition of SPARQL dataset in terms of the RDF dataset terms? 18:52:30 <AlexHall> davidwood: agenda-bashing time 18:52:44 <PatHayes> i wont be able to be there tomorrow, so y'all might get things done a bit faster :-) 18:52:56 <AlexHall> ... revisit latest formulation of gavin's description of INSERT DATA, can possibly shake out some strawpolls 18:53:41 <AndyS> It is possible to improve - (carefully - safe against later RDF-WG decisions) 18:53:44 <AlexHall> ... as well as sandro's g-box IRI strawpoll 18:54:05 <AlexHall> ... propose to add these items to tomorrow's agenda 18:54:38 <AlexHall> guus: really want to visit the wikidata use case 18:55:18 <AlexHall> sandro: time to assign some homework 18:55:43 <ivan> ISSUE-33? 18:55:43 <trackbot> ISSUE-33 -- Do we provide a way to refer to sub-graphs and/or individual triples? -- open 18:55:43 <trackbot> 18:55:44 <AlexHall> ... look over the issue list for ones you care about or think are obsolete 18:56:04 <AlexHall> davidwood: would like to revisit issue-33 18:56:15 <tlebo> @sandro - we can apply "mangling service endpoint and GRAPH <IRI> to name the g-box" to TRiG by replacing "service endpoint" with a sufficient "location" of the TRiG file. (because sparql endpoint and TRiG file are two of a more general notion) 18:56:56 <tlebo> BIG elephant: putting semantics in to name of a named graph or not 18:57:04 <AlexHall> guus: still no answer to the issue of whether to put semantics into the relationship between the name and the graph 18:57:29 <AlexHall> sandro: my strawpoll is trying to narrow down that space 18:58:52 <AlexHall> ... clear that we can't have consensus that the IRI denotes the gbox because it will break too much deployed stuff 18:59:40 <AlexHall> davidwood: adjourned 18:59:51 <Zakim> -PatH 18:59:55 <sandro> PROPOSED: While it's desirable to have dataset tag IRIs denote their associated g-boxes, because of existing deployments we can't just rule that now. Instead, we can provide some way to flag the cases where it does, so the market can move in that direction. 19:00:00 <sandro> (for tomrrow.) 19:00:00 <Zakim> -MIT_Meeting_Room 19:00:58 <sandro> PROPOSED: While it's desirable to have dataset tag IRIs denote their associated g-boxes, because of existing deployments we can't just rule that now. In particular, in different datasets, the relation is different. Instead, we can provide some way to flag the cases where it does, so the market can move in that direction. 19:01:22 <sandro> PatHayes, can you formally define g-box for us? 19:06:09 <AndyS> AndyS has left #rdf-wg 19:08:09 <sandro> a g-box, named with zero or more IRIs, is a function (mapping) from time to g-snaps. 19:09:53 <LeeF_> a g-box is a function from the current environment to a g-snap 19:09:57 <LeeF_> that function can be named with an IRI 19:12:53 <sandro> gavin: what about localhost: 19:13:15 <sandro> david: We should say what people do on the open web, and if people want to break things on their own machine, that's their problem. 19:14:13 <sandro> david: people are free to make stupid mistakes; it's just less useful when they do... 19:31:57 <Zakim> -Peter_Patel-Schneider 20:45:32 <AlexHall> AlexHall has joined #rdf-wg 21:14:03 <iand> iand has joined #rdf-wg 21:56:04 <iand> iand has joined #rdf-wg 22:05:01 <Zakim> disconnecting the lone participant, BBC_Meeting_Room, in SW_RDFWG(F2F)6:00AM 22:05:03 <Zakim> SW_RDFWG(F2F)6:00AM has ended 22:05:07 <Zakim> Attendees were AZ, +1.617.324.aaaa, Peter_Patel-Schneider, ww, mischat, Guus, danbri, yvesr, pchampin, swh, ivan, cygri, iand, andys, NickH, davidwood, gavinc, zwu2, tlebo, 22:05:10 <Zakim> ... AlexHall, sandro, Souri, Scott_Bauer, LeeF, Thomas, PatH, Eric, MIT_Meeting_Room 22:49:25 <Zakim> Zakim has left #rdf-wg 23:38:14 <tomayac> tomayac has joined #rdf-wg 23:40:31 <mischat> mischat has joined #rdf-wg # SPECIAL MARKER FOR CHATSYNC. DO NOT EDIT THIS LINE OR BELOW. SRCLINESUSED=00001803
https://www.w3.org/2011/rdf-wg/wiki/Chatlog_2011-10-12
CC-MAIN-2017-09
refinedweb
24,126
65.35
Important: Please read the Qt Code of Conduct - Get coordinates of dicom image by clicking anywhere on image in Qt Hello, I am making GUI application in Qt where I want load my Dicom images in QWidget box. And I need to get actual XYZ coordinates of dicom images on screen by clicking anywhere on the image. And then use those for further processing. Can anyone please tell me how to create function of QT to click on an image and get the actual coordinates of dicom image (which are pixels has range from 256256 or 512512)? Thanks in advance. - SGaist Lifetime Qt Champion last edited by SGaist Hi and welcome to devnet, All Qt widgets have the mousePressEvent method. You can use that in the widget that show the image to know where you are. Note that there's already the QtDcm project that seems to provide everything needed. Maybe the MITK project could also be of interest. Thank you for your reply. With mousepressevent, can i get coordinates also? And Could you please provide me some examples for mousepressevent with QWidget? I don't know how to write code for it to get coordinates of dicom image. I think seeing example can help me to understand how to use mousepressevent. Thanks again. @pvirk said in Get coordinates of dicom image by clicking anywhere on image in Qt: With mousepressevent, can i get coordinates also? Yes, Example: @pvirk said in Get coordinates of dicom image by clicking anywhere on image in Qt: XYZ coordinates of dicom images Just to be clear. the mousepressevent gives your the x,y in pixels. There is no Z. I have tried the example from here. It gives me x,y coordinates wherever I double-click on Qt window. But if I put QWidget (specifically I want to use QVTKWidget where I will get my dicom images) in .ui file, then I don't understand what to change in above example, to get x, y coordinates only in that particular QWidget/QVTKWidget window (not outside of it). And then save it so I can use it for further processing. Could you please tell me in details? Thanks a lot again. - jsulm Qt Champions 2019 last edited by jsulm @pvirk Subclass QVTKWidget, override mousePressEvent() in your subclass and use that one instead of QVTKWidget Sorry, but I don't know how to do it. I am new to Qt. Could you please explain me in steps? What exact changes I have to do, do I need any header file for it? @pvirk said in Get coordinates of dicom image by clicking anywhere on image in Qt: I am new to Qt It's actually C++ class MyWidget : public QVTKWidget { protected: void QVTKWidget::mousePressEvent(QMouseEvent * event) ; } And now use this MyWidget class instead of QVTKWidget. I did this, but do not understand what is wrong in it. Do I need any header file? @pvirk said in Get coordinates of dicom image by clicking anywhere on image in Qt: Do I need any header file? At least you must include the definition of QVTKWidget ==> maybe #include <QVTKWidget>or #include <QVTKWidget.h>? @pvirk Sorry, it needs to be class MyWidget : public QVTKWidget { protected: void mousePressEvent(QMouseEvent * event) ; } You are just mixing unrelated stuff. @jsulm provided you with the minimal class definition to get started. If you don't know how to do subclassing, then please, start by going through basic C++ tutorials before going further. You'll save yourself a lot of trouble. Okay. I will check C++ tutorials. Thank you so much everyone. Hello, I have tried example to understand mousepressevent in QWidget. But I am facing some problem, when I use it in my code. I used one QVTKWidget to check coordinates with mousepressevent, and it worked. But when I use that same QVTKWIdget to load dicom data using vtkRenderWindow and interactor, it shows following errors. Here "matDisplay" is class I created for mousepressevent. - Error C2039 'SetRenderWindow': is not a member of 'matDisplay' - Error C2039 'GetInteractor': is not a member of 'matDisplay' I need Render Window and Interactor to render dicom images. So, how can I use mousepressevent in QVTKWidget? Please help and thanks in advance. What is matDisplay? Hi Can you show your exact code for matDisplay ? It should have those functions Hello, 'matDisplay' is class i created for mousepressevent. then I used QObject::connect(ui->qvtkWidget_3, SIGNAL(sendMousePosition(QPoint&)), this, SLOT(showMousePosition(QPoint&))); in my other .cpp file. This thing works. Here I used subclass QWidget. But if I use QVTKWidget subclass, then build succeeded but then my program crashes. But when I used this qvtkwidget_3 to get my dicom data, then shows me those errors. Anyone has any idea about it? @pvirk Hi It has to inherit from QVTKWidget as else it wont be right for the other classes as the errors shows: Error C2039 'SetRenderWindow': is not a member of 'matDisplay' Error C2039 'GetInteractor': is not a member of 'matDisplay' This is correct as a QWidget does not have them. It comes from QVTKWidget. You have to use that QVTKWidget find out why it crashes. I would guess you might forgot to call : QVTKWidget(parent) and maybe had QWidget(parent) from before. so that the QVTKWidget was not ok setup. = crash Hello, I changed it to :QVTKWidget in both my .h and .cpp files of matDisplay class. The reason for crashing was, In .ui file the qvtkwidget was not promoted to QVTKWidget.h file. I promoted to it and now there is no crashing. But now the problem is I cannot use my matDisplay.h also as promoted class in .ui file. Because of that I cannot get coordinates of that widget. How can I use both my QVTKWidget.h and matDisplay.h as promoted classes for qvtkwidget in .ui file? I double-checked both of them in promoted widget option, but still it is only promoted to qvtkwidget.h only? HI you can not promote a widget to 2 different widgets. That is not possible but would be cool if it could work :) You can have 2 widgets but im not sure why you want that. From the code, matDisplay is your version of QVTKWidget so you should place a QWidget and promote that to matDisplay. And it then contains your extra code for mousePress and all of QVTKWidget I tried this way. I used QWidget for my matDisplay class and promoted to matDisplay. But when I use that same QWidget in my code to load image, It shows those same errors. Error C2039 'SetRenderWindow': is not a member of 'matDisplay' Error C2039 'GetInteractor': is not a member of 'matDisplay' (because it is promoted to only matDisplay and not to QVTKWidget) I need only one widget where i can load dicom image (which are connected to render window and interactor in my code) and use that same widget to get coordinates of that dicom image. Sorry I tried all ways, but don't understand how to achieve these both things using only one widget. Kindly please help me. Inherit matWidget from QVTKWidget.
https://forum.qt.io/topic/110689/get-coordinates-of-dicom-image-by-clicking-anywhere-on-image-in-qt
CC-MAIN-2020-45
refinedweb
1,181
66.03
50038/how-can-i-combine-two-dataframes-in-python-pandas I'm using python pandas data frame , I have an initial data frame say X from which I extracted two data frames: A = X[X.label == k] B = X[X.label != k] And then changed the label in A and B: A.label = 1 B.label = -1 Now I want to combine A and B, such that when we sample A and B from X, they retain their indexes from X. Hi, You can use the following methods to combine the data frames: 1) append method df = A.append(B) 2) pd.concat method df = pd.concat([A,B]) Assuming that your file unique.txt just contains ...READ MORE def add(a,b): return a + b #when i call .. Refer to the below screenshots: Then set a ...READ MORE Hi, You can use dedicated hooks(decorators) called before ...READ MORE OR
https://www.edureka.co/community/50038/how-can-i-combine-two-dataframes-in-python-pandas
CC-MAIN-2019-39
refinedweb
151
79.36
lot more time.. To. There are a few differences between the full .NET Framework and the version that ships with Silverlight 1.1 Alpha. Cross Platform, Cross Browser is very important to Silverlight and so just like the rest of Silverlight the .NET components will work on Mac and Windows. They will also run in FireFox, IE and Safari. There is no difference between the framework when running on different platforms.. The first place to start is to define what is required to create a .NET Silverlight application. There are four basic ingredients in any Silverlight 1.1 program: What you need to Install('Silver: Here is the code listing:. hr = WSAAddressToString(. My friend ran into a problem recently where they wanted to use commands such as Cut, Copy, Paste in buttons, they couldn’t figure out how to bind the buttons CommandTarget property to multiple targets. For those of you not familiar with WPF Commands check out this MSDN article. When a command is applied to a control such as a button the focus scope of the button or it’s parent container determine if the command will apply to other controls in the Window or Page. By default Menu or ToolBar elements have their own FocusScope so controls with commands on them will work on controls outside that FocusScope. For example the xaml snippet below shows a DockPanel with a Menu which has a MenuItem that whose Command property is assigned the Copy command. Additionally the StackPanel below the menu has a button whose Command property is also set to Copy. <DockPanel> <Menu DockPanel. <MenuItem Command="Copy"/> <StackPanel DockPanel. <Button Command="Copy" >Copy</Button> </StackPanel> <StackPanel Name="Group" DockPanel. <TextBox Name="MyTextBox1"/> <TextBox Name="MyTextBox2"/> </DockPanel> When this code is run typing some text and then selecting that text in either TextBox in the last StackPanel will cause the MenuItem to become in enabled because it is bound to the Copy command, but the Button in the StackPanel will remain disabled. The reason for this is because the Button is in the same FocusScope as the TextBox and in WPF this will keep the Command from working with the TextBox. To solve this problem we can add a CommandTarget property to the Button and bind to the TextBox by name. This is shown in the xaml snippet below. We add CommandTarget ="{Binding ElementName=MyTextBox1}" To the Button which causes the Button to enable when we select text in the first TextBox, but we still have a problem. We want the Copy button to work for all Text elements in our application, not just the single TextBox we have set our CommandTarget property to. <MenuItem Command="Copy"/> <Button Command="Copy" CommandTarget="{Binding ElementName=MyTextBox1}">Copy</Button> To solve this problem we are going to use an attached property on a class called FocusManager. The property is called IsFocusScope and is a bool. This property allows us to set the FocusScope for a control. The xaml snippet below uses the attached property on the StackPanel to set the StackPanel to its own FocusScope. This makes it so that we don’t need to set a CommandTarget, because the StackPanel with the button and the TextBoxes are now in different FocusScopes. <StackPanel FocusManager. </DockPanel> Menu and ToolBar both use the FocusManager.IsFocusScope property to set their own FocusScope and if desired you can set that property to false on a Menu or ToolBar to get the reverse behavior. The xaml snippet below does this by setting FocusManager.IsFocusScope="False" on the Menu. <Menu FocusManager. This is the third and final post about my WPF 2D Cell Animation program; Ink-A-Mator. Once you can get the source on the .NET 3.0 Community site. This week we are going to look at how we can create a color palette, since WPF doesn’t have one. The first place to start with creating a color picker is to figure out what color is at a given x, y coordinate. If you are familiar with GDI or GDI+, then you might think there is a GetPixel method available on some object similar to a Graphics object. Unfortunately there is no such method or property. Instead we will have to create a bitmap from the UIElement we want to get the color from, create a copy of its pixels and then index into that copy to find the pixel we want. // We are using 32 bit color. int bytesPerPixel = 4; // Where we are going to store our pixel information. byte[] Pixels = new byte[(int) uiElement.Height * (int) uiElement.Width * bytesPerPixel]; // Create a render target which allows us to get a copy of any UI element as a bitmap RenderTargetBitmap rt = new RenderTargetBitmap((int)uiElement.Width, (int) uiElement.Height, 96, 96, PixelFormats.Pbgra32); // Render the image of the uiElement to a bitmap. rt.Render(uiElement); // Calculate the stride of the bitmap int stride = (int) uiElement.Width * bytesPerPixel; // Copy the pixels from our render target to the array of pixels. rt.CopyPixels(Pixels, stride, 0); // p is a Point so use p with formula (Y * Width * BPP + X * BPP) to figure out index in array. int pixelIndex = (int)((int)(p.Y) * uiElement.Width * bytesPerPixel + (int)(p.X) * bytesPerPixel); // extract the rgb components from the array. We use Pbgra32 here so our order is b g r. byte b = Pixels[pixelIndex]; byte g = Pixels[pixelIndex + 1]; byte r = Pixels[pixelIndex + 2]; // Create a color from the rgb components. Color color = Color.FromRgb(r, g, b); Each pixel in our Pixel array is made up of four components; blue, green, red and alpha all of which are one byte, which is 32 bits or 4 bytes, this is known as the bit depth. Each entry in our Pixels array is going to hold one of these components. To get the total size of the array to hold the pixels we need to multiply the width, height and bytes per pixel. Next we create our RenderTargetBitmap passing it the desired width, height, DPIX, DPIY and the desired pixel format. I have hard coded the DPI to be 96, which I thought might cause a problem when I changed the DPI, but WPF does a nice job of abstracting so that it performs and looks correct at different DPI settings. RenderTargetBitmap derives from BitmapSource which is the same type as the Source property on an Image control, so we can display a RenderTargetBitmap using an Image control. Now we call Render on our RenderTargetBitmap instance passing in the uiELement. RenderTargetBitmap allows us to get a bitmap version of a WPF Visual. Once we compute the stride we call CopyPixels on our RenderTargetBitmap instance which as the name implies copies the pixels in the bitmap to our Pixels byte array. All we have to do now is compute the index for the pixel and point x, y. Since our Pixels byte array represents a pixel component per index we need to multiply our y coordinate by the width and bit depth then add that to our x coordinate times the bit depth. This will put our index and the first component of the pixel. Since we are using BGR color ordering defined by the PixelFormat.Pbgra32, pixel components are in the order blue, green, red, alpha instead of red, green, blue, alpha. We don’t care about alpha so we are just going to ignore that component. In the source code I have two different palettes that I create. The simpler one called Palette2 uses a LinearGradientBrush to create the look of the Palette. The other palette called Palette in source code takes four colors and blends them from the four corners of the palette. To create Palette2 we need to create a Visual that will define look of our palette. To do this we are going to create a LinearGradientBrush and add some gradient stops. LinearGradientBrush brush = new LinearGradientBrush(); brush.StartPoint = new Point(0.5, 0); brush.EndPoint = new Point(0.5, 1); brush.GradientStops.Add(new GradientStop(Colors.Orange, 0)); brush.GradientStops.Add(new GradientStop(Colors.Yellow, 0.15)); brush.GradientStops.Add(new GradientStop(Colors.Green, 0.25)); brush.GradientStops.Add(new GradientStop(Colors.Blue, 0.5)); brush.GradientStops.Add(new GradientStop(Colors.Red, 0.75)); brush.GradientStops.Add(new GradientStop(Colors.Black, 0.9)); brush.GradientStops.Add(new GradientStop(Colors.White, 1)); We then create a Rectangle and set its Fill property to the brush. We then use RenderTargetBitmap to make a bitmap copy of the Rectangle the first time the user clicks on it to generate the Pixels array. We then cache the Pixels array and index into when a user clicks somewhere else in the Rectangle. The more complex Palette uses a bit of math to create the blending of the colors in the four corners. Palette.cs has the code for this palette. Unlike Palette2 which took a snapshot of a Visual and turned it into an image, Palette will create an image from scratch. The image below shows that we blend from left to right and then from top to bottom. We actually do the gradient math for the first line of the image and the last line of the image and then blend between the top and bottom lines. First we calculate the amount each color component changes as pixels go from left to right. The method CalculatePixelSlope shows how we calculate this change. The first two parameters define the color components of the pixels we want to interpolate between and distance specifics the distance between these pixels. Notice that the return type is PixelAsDoubles which is important because the change in color will most likely be small and possibly negative. PixelAsDoubles CalculatePixelSlope(Pixel p1, Pixel p2, int distance) { return new PixelAsDoubles((double)(p2.r - p1.r) / distance, (double)(p2.g - p1.g) / distance, (double)(p2.b - p1.b) / distance); } struct Pixel public byte r; public byte g; public byte b; struct PixelAsDoubles public double r; public double g; public double b; Next we use the pixel slope to fill in the pixels in our image. The CalculatePixelGradient method below takes the starting pixel color components and pixel color slope and figure out for a given distance what the color should be. private static Pixel CalculatePixelGradient(Pixel startingPixel, int distance, PixelAsDoubles slope) Pixel p = new Pixel(); // We don't want to start at zero so shift. distance++; p.r = (byte)(startingPixel.r + slope.r * distance); p.g = (byte)(startingPixel.g + slope.g * distance); p.b = (byte)(startingPixel.b + slope.b * distance); return p; Now let’s look at how we create an image from scratch and call these methods to create our four color palette. Again we need to create a byte array which will hold our pixel components. Then we create the four corner pixels and pass them to CalculatePixelSlope to figure out the gradient for the top and bottom lines of the image. We begin looping through the pixels calling CalculatePixelGradient which will give us the final pixel at the top and bottom. Once we have these pixels we calculate the pixel slope for the top to bottom gradient and call CalculatePixelGradient which returns the final pixel. Notice that our pixel order is now RGB instead of BGR, this is because we are going to use the PixelFormat.Rgb24 instead of the PixelFormat.Pbgra32 format as we did with Palette2. After the look we calculate our stride and then call the static method Bitmap.Create which creates a BitmapSource from an array of bytes which represent the pixels. BitmapSource CreateFourColorPalette() // Create a place to hold our pixel data. pixels = new Byte[(int)(FourColorPaletteSize.Width * FourColorPaletteSize.Height * bytesPerPixel)]; int i = 0; // Find Color Slopes Pixel upperLeft = new Pixel(upperLeftColor.Color.R, upperLeftColor.Color.G, upperLeftColor.Color.B); Pixel upperRight = new Pixel(upperRightColor.Color.R, upperRightColor.Color.G, upperRightColor.Color.B); Pixel lowerLeft = new Pixel(lowerLeftColor.Color.R, lowerLeftColor.Color.G, lowerLeftColor.Color.B); Pixel lowerRight = new Pixel(lowerRightColor.Color.R, lowerRightColor.Color.G, lowerRightColor.Color.B); // Get the change in color for the distance the color is traveling PixelAsDoubles LeftToRightTop = CalculatePixelSlope(upperLeft, upperRight, (int)FourColorPaletteSize.Width); PixelAsDoubles LeftToRightBottom = CalculatePixelSlope(lowerLeft, lowerRight, (int)FourColorPaletteSize.Width); // We interpolate from left to right and then top to bottom. for (int y = 0; y < FourColorPaletteSize.Height; y++) for (int x = 0; x < FourColorPaletteSize.Width; x++) Pixel p1, p2; p1 = CalculatePixelGradient(upperLeft, x, LeftToRightTop); p2 = CalculatePixelGradient(lowerLeft, x, LeftToRightBottom); PixelAsDoubles topToBottom = CalculatePixelSlope(p1, p2, (int)FourColorPaletteSize.Height); Pixel p = CalculatePixelGradient(p1, y, topToBottom); pixels[i++] = p.r; pixels[i++] = p.g; pixels[i++] = p.b; // Figure out the stride. int stride = (int)FourColorPaletteSize.Width * bytesPerPixel; return BitmapImage.Create((int)FourColorPaletteSize.Width, (int)FourColorPaletteSize.Height, 96, 96, PixelFormats.Rgb24, null, pixels, stride); The two main advantages of creating a palette this way is that we don’t have to wait for WPF to render the brush like we did with Palette2 and we have more control over the colors in the palette. When looking at the source code you will notice that Palette.cs actually creates two palettes. The master palette uses more advanced blending to create a palette that allows us to select the colors of the FourCornerPalette. Tomorrow I will start a new series about an application I created using WPF, WCF and peer to peer which allows for content distribution without servers. Last week we looked at how we could use the Ink APIs in WPF to create 2D animation authoring application. This week we are going to look at how we can use the Open Packaging Conventions APIs in WPF to save and load our animation. Once you can get the source on the .NET 3.0 Community site. The Open Packaging Conventions (OPC) APIs can be found in the System.IO.Packaging namespace. Before we get into the code let’s look at the ideas behind the OPC. The Office 2007 file formats use OPC along with the XPS file type. One of the reasons to use OPC is that we only have to learn one API to be able to read and write many formats. An OPC based file consists of three parts; the Package which holds the other parts, the PackageParts which holds the data and the PackageRelationships which describe what the PackageParts are and how they are related to other parts. We are going to use a ZipPackage which is provided as a default implementation of the Package abstract class. The ZipPackage stores the package as a zip file and the parts as xml files. This is very helpful when developing a new file format because we can just change our file extension to .zip and explore how the file is laid out. Now we’ll take a look at how we save a file using OPC. Here is the save code from Ink-A-Mator: private const string ResourceRelationshipType = @""; // Create a new ZipPackage and save the animation in it. using (Package p = ZipPackage.Open(fileName, FileMode.Create)) // Save out each of our frames. for (int i = 0; i < this.frames.Count; i++) // We need to create a part to save to. PackagePart part = p.CreatePart(PackUriHelper.CreatePartUri(new Uri(string.Format("Frame{0}{1}", i, ".frm"), UriKind.Relative)), "Ink/WPF"); PackagePart part = p.CreatePart(PackUriHelper.CreatePartUri(new Uri(string.Format("Frame{0}{1}", i, ".frm"), UriKind.Relative)), "Ink/WPF"); // Create a relationship for our part so that we can walk through relationships on open. p.CreateRelationship(part.Uri, TargetMode.Internal, ResourceRelationshipType); // Get a memory stream to save our part. using (Stream s = part.GetStream()) // save each frame into the stream this.frames[i].Save(s); // don't forget to close the stream. s.Close(); Let’s look at each line in detail. The first line declares a const string ResourceRelationshipType which is just a URI for our part type. The URI has no significance it is just what I have chosen to represent my frame parts. Next we create our ZipPackage using the static Open method. Notice that we have wrapped this line in a using statement because the Package class implements IDisposable. Then we loop through our collection of animation frames and create a PackagePart and PackageRelationship for each frame. To create the part we call the CreatePart method on our package instance. This method takes two arguments the URI of this part and the type of this part. We use the PackUriHelper.CreatePartUri static method to help us create the part. We just want to store the name of each frame in the form “Frame0.frm”. The StrokeCollection stores the .frm files in Ink Serialized Format (ISF). Next we are going to use our package to create a PackageRelationship. We use relationships like a table of contents for the OPC file, it allows us to ask for parts by relationship when we read files back. Then we’re going to use the part instance we created to write our frames content to using the GetStream method. This method returns a stream that we can use to write our content too. Remember that our frames are just StrokeCollections which have a Save method to write to a stream, so we just have to pass the part stream to the Save method. Last we call close on the part stream. The image below shows the layout of our package if we unzip our saved file. Now we will examine the parts in the package. The _rels folder contains a single file .rels which represent the part relationships we created: Package/_rels/.rels: <Relationships xmlns=""> <Relationship Type="" Target="/Frame0.frm" Id="R1856367c1f81411f" /> <Relationship Type="" Target="/Frame1.frm" Id="R77e932075fd84ad2" /> <Relationship Type="" Target="/Frame2.frm" Id="R2485e76da2c64a2d" /> … All the other 48 frames </Relationships> Here we can see that the .rels file contains a collection of relationships. The Type attribute of a Relationship is useful when we load this file as we will see shortly. The Target attribute points to another file in our Package which is a PackagePart, which holds the contents of a single frame. As seen in the image above. Lastly the [Content_Types].xml file contains the types we have defined for this Package. [Content_Types].xml: <?xml version="1.0" encoding="utf-8"?> <Types xmlns=""> <Default Extension="frm" ContentType="Ink/WPF" /> <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml" /> </Types> We have two types in our Package. Our Frame type with the extension .frm and the relationships with the extension .rels. That’s all there is to saving a file using the OPC file format. Now we will take a look at our Load method and see how easy it is to open a file using OPC. // Open our file using the Open Packaging APIs using (Package p = ZipPackage.Open(fileName, FileMode.Open)) // We pull frames by part so we need the package relationship. PackageRelationshipCollection rels = p.GetRelationshipsByType(ResourceRelationshipType); // Walk through our frames in part form. foreach (PackageRelationship rel in rels) // Get the address of this frame part. Uri uri = PackUriHelper.ResolvePartUri( new Uri("/", UriKind.Relative), rel.TargetUri); // Get the frame part with the address. PackagePart part = p.GetPart(uri); // Put the frame to memory // A frame just consists of a stroke collection so load it. this.Paper.Strokes = new StrokeCollection(s); // Close our stream. // Move to the next frame. OnNextFrame(this, new RoutedEventArgs()); } // Move back to the last frame. OnPreviousFrame(this, new RoutedEventArgs()); Most of this code should be familiar to you now because it is very similar to the Save method. Once again we use the ZipPackage.Open method, this time we are using the Open FileMode. Next we are going to call GetRelationshipsByType and pass our frame relationship type. This method is going to return us a collection of relationships. This is basically the object form of the .rels file we looked at. Since we have one relationship for each frame we are going to loop through the relationships to create each file. Using the ResolvePartUri static helper method we pass in target uri from the relationship. Once we have this URI we can call GetPart passing the URI which will return us an instance of frame PackagePart. Now we just have to call the GetStream method on the part and create a new instance of a StrokeCollection passing the stream of our ISF file. The other calls here were explained last week and deal with the Ink API. The OPC APIs have some other interesting functionality that we didn’t make use of here such as digital signatures, but you should have enough of an understanding to read and write your own files. For more information on OpenXML and working with the Office 2007 formats check out the articles on the Open XML Developer website..
http://blogs.msdn.com/ebooth/
crawl-002
refinedweb
3,452
57.57
Design Flaws in Futhark Futhark has evolved significantly since its design was first scribbled on a napkin in late 2012. The language has since been heavily modified and extended, and bears little resemblance to the original prototype. Features such as higher-order functions and sum types were added as we figured out how to handle them efficiently. Since we are pretty much making all this up as we go along, we get some features wrong initially and fix them later. Other features get removed entirely. For this post, I am going to discuss some aspects of the Futhark language design that I suspect may be flawed, but where the jury is still out, or where it’s not clear what a fix looks like. I am not going to talk about missing features (such as recursion) that would obviously be welcome, but are merely hard to implement well. I dare not hope that these are all the remaining flaws of Futhark, but they are the ones I know of. 1-indexing of tuples In Futhark, components of a tuple can be accessed using the same dot notation as with records: foo.1, foo.2. In contrast to arrays, which are 0-indexed, tuple components are numbered from 1. While Dijkstra argues convincingly and correctly for the benefits of 0-indexing, he does so in the context of ranges, which does not apply to tuple indexing. In Futhark, there is no way to perform arithmetic on a tuple index. They must always be constants, because they are really just names that look like numbers. Thus the reasoning behind the inconsistency: 0-indexing is used for arrays because it has benefits when doing index calculations, while 1-indexing is used for tuples because it is the more familiar ordering. Yet, I cannot help but wonder whether we got this one wrong. How many programmers are going to accidentally access the wrong field in a tuple, because they are used to thinking 0-indexed? We are not even particularly consistent elsewhere: Futhark numbers OpenCL devices starting from 0 (because that’s what OpenCL itself does), and our test runner also numbers test cases from 0. The cost of changing this is obvious: every single Futhark program that uses dot notation for tuples must be modified. While the lightweight anonymous records means that tuples are not as widespread as in other languages, I’m not sure the cost is worth it. 32-bit sizes Code emitted by the Futhark compiler uses 32-bit integers to track array sizes, do index calculations, and so on. This has some obvious practical problems (arrays cannot be larger than 2³²-1 elements), but can lead to substantially faster execution, as both CPUs and GPUs have substantially lower 64-bit integer performance. Some time ago, I experimentally changed the compiler to emit 64-bit index arithmetic instead, which resulted in a 50% slowdown on an NVIDIA GTX 780Ti GPU (a somewhat old model) on a representative benchmark program. At some point of course, this will stop being an acceptable constraint. In principle, addressing this should be as simple as merely changing the compiler to generate 64-bit index operations, and then presumably adding some smarts to the code generator to reduce the overhead as much as possible. We already use 64-bit pointers and 64-bit allocations, so in principle this is not difficult. We can even imagine a compiler option for switching between 32- and 64-bit index calculations. Unfortunately, 32-bit sizes have also infiltrated the source language in a user-visible way. One of Futhark’s few unusual language features is the support for size annotations, by which functions can express constraints on the sizes of arrays. For example, the following definition of dot product expresses the constraint that the two input vectors must have the same length: However, size parameters such as n also exist as expression-level variables, which means they can be used to extract the size of arrays: Currently, these parameters are always of type i32. Changing the type of sizes is likely to break most Futhark programs that use size parameters in expressions. In a similar manner, Futhark also allows value-level parameters to occur in types, which is useful for typing functions like replicate: This intermixing means that simply having a compile-time flag to switch the internal type of sizes is not viable. One might well ask: should size parameters be in scope at the expression level at all? Should we make one large break and change all sizes to i64, even in the source language? Maybe sizes should be an opaque type of an unspecified number of bits? Perhaps we should treat sizes as “overloaded”, like we do with numeric literals, and transparently cast sizes to any integer type. While convenient, it sounds like a fertile breeding ground for hard-to-test-for bugs. Something definitely has to be done, but it is not yet clear what. Higher-order modules Futhark supports an advanced ML-style module system. The difference between this and a conventional module system is that beyond simple name-spacing, ML-style module systems also support parametric modules, by which modules can be parameterised over the concrete implementation of some other module. This allows us to program against interfaces that than implementations, and provides a powerful mechanism for generic programming. -- A module type with an abstract type and two values using that type. module type monoid = { type t val op: t -> t -> t val zero: t } -- Two different implementations of the 'monoid' type. module monoid_add_i32 : monoid with t = i32 = { type t = i32 let op = (i32.+) let zero = 0i32 } module monoid_prod_f32 : monoid with t = f32 = { type t = f32 let op = (f32.*) let zero = 0f32 } -- A parametric module that can generate a "sum" module given any -- module that implements the 'monoid' module type. module type msum(P: monoid) = { let sum (ts: []P.t) : P.t = reduce P.add P.zero ts } -- We can then instantiate the 'msum' module. module msum_i32 = msum monoid_add_i32 module msum_f32 = msum monoid_prod_f32 Parametric modules can be seen as a restricted form of functions at the module level. One obvious question is then to ask whether we can have higher-order modules in the same way that we have higher-order functions. The answer is no for Standard ML, where modules are at most first-order, but other languages in the ML family, including Futhark, do support higher-order modules. However, I have come to believe that higher-order modules are a mistake. Specifically, compared to their complexity (both conceptually and implementation-wise), they seem to have very little utility. The only use of higher-order modules I have seen, outside the compiler test suite, is an example program I wrote explicitly to demonstrate them, and which I since rewrote in a simpler way. In contrast to parametric modules, which are frequently used, the higher-order modules in Futhark have never since proven useful in practice. Futhark supports higher-order modules mostly for the research challenge. We did get a paper out of it, even including a Coq formalisation of a possible implementation. However, the implementation in the compiler is not mechanically derived from the Coq version, has had several tricky bugs, and is likely to contain yet more. The next time I discover a mysterious failure in the implementation of higher-order modules, I am likely to just rip it out entirely - especially because the implementation also complicates the handling of first-order modules. The issue with higher-order modules is not just one of implementation. Even conceptually they are hard to understand, and I don’t think any of Futhark’s documentation (outside the paper linked above) really describes them. ML-style modules are already a fairly big item on the complexity budget, as they are essentially a distinct sub-language, and I don’t think higher-order modules carry their own weight. Using let for both local and top-level definitions In the distant past, Futhark used fun and val for top-level definitions of functions and values, and let for local bindings inside a function. At some point, we realised, no doubt influenced by OCaml, that we could just use let in all cases, without any syntactic confusion. This was also around the time we added true function values to the language, so we wanted to remove the old syntactic distinction between defining “values” and “constants”. Unfortunately, we didn’t realise the impact it would have on parse errors. As an example, what’s wrong with the following program? Written like this, a human can easily see that f is missing an in. However, since let g x is also syntactically valid as part of a function definition, the parser will see it like this, and not report an error until it reaches end-of-file: There is no clue in the source code that g is intended as a top-level function, since local functions have the same syntax. The user will be told that an in was expected but that end-of-file was reached, and will probably spend a lot of time looking for a problem with g. A similar issue occurs when writing editor tooling. Specifically, futhark-mode for Emacs implements automatic indentation the way most Emacs modes do it: a bunch of regular expressions and crude parser techniques to determine proper indentation based on the preceding lines. The advantage of this approach, compared to running a global re-formatter that uses a proper parser, is that its effects are local, and work well even for programs that contain syntax errors. The problem is that arbitrary look-back is necessary to determine whether some let is local (and so should be indented relative to the enclosing definition) or global, and so should be indented to column 0. Both of these issues could have been avoided if we had used a dedicated keyword, say def for top-level definitions. With our current design, we can certainly work around the issue by making the parser emit better error messages, such as indicating where the let missing an in actually starts. Maybe we can also improve futhark-mode to the point where it stops getting confused (or just switch to an external formatter with an error-tolerant parser). For now, we handle it by making the Tab key cycle through multiple indentation candidates in case of ambiguity. This is similar to how Emacs modes tend to handle languages with significant indentation, such as Python or Haskell, but it’s a bit embarrassing that it is necessary for Futhark just because we neglected to put enough parsing guideposts into the syntax.
https://futhark-lang.org/blog/2019-12-18-design-flaws-in-futhark.html
CC-MAIN-2020-16
refinedweb
1,781
58.01
Web APIs are application programming interfaces over the web which can be accessed using HTTP protocol. Server hosting providers such as Veesp provide programmatic access to get and post data to manage our servers and services that they provide. In this tutorial, you will learn how you can automate Veesp VPS tasks in Python using requests library, alright let's get started. First, let's install requests library: pip3 install requests After you create your own account, you can order some cheap VPS with some bucks, here is a list of available services: I've chose Linux SSD VPS here, feel free to choose any one you like, and I've used the sandbox option in the following list: Once paid and your VPS is properly activated, you can follow along now, open up a new Python file or interactive shell (prefered) and follow along: import requests from pprint import pprint I'm using pprint just for printing API results nicely. Define a tuple that contains your real authentication credentials on your Veesp account: You will need to pass this auth tuple to every API call you make. Let's start off by getting account details: # get the HTTP Response res = requests.get("", auth=auth) # get the account details account_details = res.json() pprint(account_details) requests.get() function sends a HTTP GET request to that URL with your authentication, here is my result (with hidden sensitive information of course): {'client': {'address1': '', 'city': '', 'companyname': '', 'country': 'US', 'email': 'email@example.com', 'firstname': 'John Doe', 'host': '0.0.0.0', 'id': '29401', 'ip': '0.0.0.0', 'lastlogin': '2019-11-06 11:18:04', 'lastname': '', 'newsletter': [''], 'phonenumber': '', 'postcode': '', 'privacypolicy': [''], 'state': ''}} Let's see our service we just bought: # get the bought services services = requests.get('', auth=auth).json() pprint(services) This will output: {'services': [{'id': '32723', 'domain': 'test', 'total': '4.000', 'status': 'Active', 'billingcycle': 'Monthly', 'next_due': '2019-12-06', 'category': 'Linux SSD VPS', 'category_url': 'vps', 'name': 'SSD Sandbox'}]} Awesome, so this is a monthly Linux SSD VPS with a total cost of 4$. You can also see the VM upgrade options and make an upgrade request automatically, always refer to their official documentation for more information. Let's list all VMs we own: # list all bought VMs all_vms = requests.get("", auth=auth).json() pprint(all_vms) 32723 is my service ID as shown above, so you should edit that with your own ID. This will output some thing like this: {'vms': {'18867': {'bandwidth': 100, 'burstmem': -512, 'cpus': '1', 'disk': 10, 'id': '18867', 'ip': ['hiddenip', ' 2a00:1838:37:3bd::ae42'], 'ipv6subnets': ['2a00:1838:37:3bd::/64'], 'label': 'test', 'memory': 512, 'pae': 0, 'password': 'hiddenpassword', 'pxe': 0, 'state': 'online', 'template': 'linux-debian-10-x86_64-min-gen2-v1', 'template_label': 'Debian Buster 10 64 bit', 'usage': {'bandwidth': {'free': 100, 'percent': '0', 'total': 100, 'used': 0}, 'disk': {'free': 10, 'percent': '0', 'total': 10, 'used': 0}, 'memory': {'free': 0, 'percent': '0', 'total': 0, 'used': 0}}}}} I've hid the real IP address and password of my VPS, but you can see I chose a linux debian distro with 10GB SSD disk, 512GB of memory and 1CPU, etc. Now let's stop the VPS: # stop a VM automatically stopped = requests.post("", auth=auth).json() print(stopped) 18867 is my VM ID, you should use your own ID of course. Note that I'm using requests.post() function here instead, this function sends HTTP POST request to that URL. The above code outputs: {'status': True} Great, that means it successfully stopped the VPS, let's see it in the Veesp dashboard: Let's start it again: # start it again started = requests.post("", auth=auth).json() print(started) Output: {'status': True} That's cool, now you can use SSH access to it as it is online as shown in the dashboard: To wrap up, you can make many cool things with this API, not just the ones that are seen in this tutorial, check their official website and their API documentation for more features. I hope this tutorial will make you aware of Web APIs and their benefit of automating various tasks, not just VPSs and dedicated servers. Also, this tutorial introduces you to Web APIs, feel free to make your own scripts to automate various things of your own needs. Happy Coding ♥View Full Code
https://www.thepythoncode.com/article/automate-veesp-server-management-in-python
CC-MAIN-2020-16
refinedweb
712
55.58
. “You is available below and on the Linux Foundation YouTube channel. 10 Quotes from the Linux Kernel Developer Panel 1. “I downloaded the 2.2 kernel only to discover that Alan Cox had marked my network driver obsolete. So I decided to make it unobsolete which involved about a 2,000-line patch and 5,000-line changelog.” - Andrew Morton on his first patch. 2. “We had the Kernel Summit over the past few days and it seemed pretty boring. We weren't arguing anymore... (Disagreement from the panelists.) Wait, we were?” - Greg KH. 3. Greg KH : “Containers are not secure natively, you have to use namespaces, yet we keep finding bugs in (namespaces). Are they ready to use?” Lutomirski: “It's a tradeoff. If they're off you have a security problem. If they're on you may also have a security problem. At least the rate of severe bugs seems to be decreasing over time so that's reassuring.” 4. “We're trying to extend our interfaces to the point that you can safely run code that you traditionally absolutely could not as root.” - Linus Torvalds, on namespaces and container security. 5. “I'm too old to fix bugs nowadays. My first response is, who can I manipulate into fixing this?” - Andrew Morton. 6. “I'd love for Linux to shrink again... We've clearly been bloating up the kernel a lot over the past 20 years.... It's a problem if we want to push the envelope into embedded devices, in particular.” - Linus Torvalds. 7. “Lots of ARM stuff is coming in, so for the next few years that will be a challenge. A lot of people will want to leverage drivers built on ACPI and use them in the ARM space.” -Shuah Khan. 8. “Projects like Raspberry Pi were actually great at seeding random people with hardware... and very few of those will necessarily decide to do kernel development, but if you seed the world a small percentage is still a lot of people.” - Linus Torvalds. 9. “I've had a patch rejected because it's overly complicated... the x86 maintainers have been amazing about this... It makes the development take a little bit longer in the short term... but it's much more effective as a long term strategy.” - Andy Lutomirski. 10. GregKH: “We're running really well. We're running everywhere. Where are we going next? We've conquered pretty much every major industry.” Linus Torvalds: “I still want that desktop.”
https://www.linux.com/blog/thanks-making-games-faster-top-10-quotes-linux-kernel-developer-panel
CC-MAIN-2016-30
refinedweb
417
68.77
Important: Please read the Qt Code of Conduct - Setting QObject properties through Qt CSS not fully working Hello, all. I have the following sample code: #include <QApplication> #include <QLabel> #include <QTimer> int main( int argc, char* argv[] ) { QApplication a( argc, argv ); QLabel label; label.setStyleSheet( "QLabel {\n" " border: 2px solid green;\n" " qproperty-pixmap: url(:/Green.png);\n" "}\n" "\n" "QLabel:disabled {\n" " border: 2px solid gray;\n" " qproperty-pixmap: url(:/Gray.png);\n" "}" ); QTimer t; QTimer::connect( & t, & QTimer::timeout, [ & label ]() { label.setEnabled( ! label.isEnabled() ); } ); label.show(); t.start( 1500 ); return a.exec(); } The stylesheet is successfully applied for both the border standard CSS property and the QLabel's custom "pixmap" property one and for both states. In my actual application setting the value of a custom property through CSS using the "qproperty-" syntax works but what fails is to give the custom property at hand a different value for another state of the QObject-based instance at hand. Tested whether there is a difference between setting the CSS directly to the QObject-based instance at hand or to the QApplication's stylesheet and found there's none. Removed the whole CSS of my application and left only that of the given QObject-based instance at hand and again the QObject's instance property was set only with the value provided for its default state but not for its disabled state for example. The QObject-based instance is again QLabel and again I want to set its "pixmap" property. Can't provide a more concrete and deep example, but just want to know whether anyone has stumbled upon such problem in his/her real-life application and if so did he/she found any solution. Can't see why setting a QObject's custom property through CSS for more than one state of the QObject-based instance could fail in one and succeed in another application. @napajejenunedk0 said in Setting QObject properties through Qt CSS not fully working: QLabel:disabled {\n" " border: 2px solid gray;\n" " qproperty-pixmap: url(:/Gray.png);\n" "}" properties are not reapplied on pseudo state changes. See QTBUG-2982, as you can see it is very old, and i wouldn't expect it to be fixed any time soon. What happens when you do this: QTimer::connect( & t, & QTimer::timeout, [ & label ]() { label.setEnabled( ! label.isEnabled() ); label.style()->polish(&label); } ); What happens when you do this: ... Nothing. What I know is that repolishing of a QWidget-based class instance is needed only in case its stylesheet depends on values of dynamic object properties, not in case of using CSS or Qt CSS-specific integrated pseudo states. Already tried repolishing the QLabel but nothing helped. properties are not reapplied on pseudo state changes. See QTBUG-2982, as you can see it is very old, and i wouldn't expect it to be fixed any time soon. Using Qt 5.5.1 MSVC 12 (VS 2013) 32-bit and looking both at the test project, where it works, and another real-world one, where it doesn't it is actually partially reproducible. As mentioned in my original post, it is strange that removing the whole stylesheet of the actual application (not the test one) and leaving only that of the QLabel at hand doesn't make any difference. I was thinking of removing all object names if they are in some way staying in the way of the correct application of the stylesheet. Another reason could be the actual project's UI complexity. @raven-worx, replaced the QLabelwith QPushButton, since I want to control its icon as well through CSS (as it is the case in the Qt bug you've cited above) and saw that trying to set different icon ( qproperty-icon) according to its :checkedpseudo state results in applying only one of the provided icons. Unpolishing and polishing the QPushButtonwhile using the pseudo state has no effect. Moving to dynamic properties or more properly said to the dynamic property equivalent of the given pseudo state - :checkedto [checked="true"]plus repolishing the button upon a change in its checked state resulted in the desired behavior. For sure this semi-automaticity is not the best programming practice. Setting the topic to solved despite the usage of a workaround. @napajejenunedk0 yes, QSS by far is not perfect and has many internal bugs. @raven-worx said in Setting QObject properties through Qt CSS not fully working: @napajejenunedk0 yes, QSS by far is not perfect and has many internal bugs. This statement is a bit scary, given that I have recently changed all the existing "in-line" code (i.e. native Qt widget calls) over to using stylesheets everywhere... :( @JonB Sorry, but thats how it is. It of course depends on how extensively you are using QSS. In general it does it's job well, but there are some annoying special cases i already encountered over the years. And since QSS mostly fails silently they are hard to debug. @raven-worx Still scary!! :) I am now using QSS everywhere, like I would use just CSS for all my HTML/CSS styling. And since QSS mostly fails silently they are hard to debug. Couldn't agree more! It seems to use qDebug()for any problems, and doesn't even return error codes. Already faced this, for the record (others might wish to copy) as a consequence when reading my application stylesheets the code I use is along the following lines: def readStylesheets(): hdlr = errfunctions.addQtMessageDialogHandler() try: QtWidgets.QApplication.instance().setStyleSheet(css) finally: errfunctions.removeQtMessageDialogHandler(hdlr) def addQtMessageDialogHandler() -> LoggingDialogHandler: # Add a LoggingDialogHandler to when qtMessageHandler() (which uses qtLogger) is called hdlr = LoggingDialogHandler() qtLogger.addHandler(hdlr) return hdlr def removeQtMessageDialogHandler(hdlr: LoggingDialogHandler): # Remove a LoggingDialogHandler previously added via addQtMessageDialogHandler() qtLogger.removeHandler(hdlr) def qtMessageHandler(type: QtCore.QtMsgType, context: QtCore.QMessageLogContext, msg: str): # Message handler for Qt qDebug() etc. # see, #, # ... # install qtMessageHandler() to handle qDebug() etc. QtCore.qInstallMessageHandler(qtMessageHandler) i.e. the gist here is I have a global qtMessageHandler()function defined --- which is what qDebug()etc. all call --- and installed via QtCore.qInstallMessageHandler(), so I can see all debug errors/warnings. And when I'm about to read a QSS stylesheet, I wrap the reading code so that it throws up an actual "error dialog" (or whatever you want) if any qDebug()is executed by the Qt reading code, as the only way to clearly see if there has been any kind of error.
https://forum.qt.io/topic/86722/setting-qobject-properties-through-qt-css-not-fully-working
CC-MAIN-2021-10
refinedweb
1,070
54.52
Hi Liam,> Am 30.08.2017 um 13:24 schrieb Liam Breck <liam@networkimprov.net>:> > Hi Nikolaus,> > On Wed, Aug 30, 2017 at 2:30 AM, H. Nikolaus Schaller <hns@goldelico.com> wrote:>> Hi Liam and Sebastian,>> >>> Am 29.08.2017 um 22:20 schrieb Liam Breck <liam@networkimprov.net>:>>> >>> Hi Nikolaus, thanks for the patch...>>> >>> On Tue, Aug 29, 2017 at 1:10 PM, H. Nikolaus Schaller <hns@goldelico.com> wrote:>>>> Tested on Pyra prototype with bq27421.>>>> >>>> Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>>>>> --->>>> drivers/power/supply/bq27xxx_battery.c | 2 +->>>> 1 file changed, 1 insertion(+), 1 deletion(-)>>>> >>>> diff --git a/drivers/power/supply/bq27xxx_battery.c b/drivers/power/supply/bq27xxx_battery.c>>>> index b6c3120ca5ad..e3c878ef7c7e 100644>>>> --- a/drivers/power/supply/bq27xxx_battery.c>>>> +++ b/drivers/power/supply/bq27xxx_battery.c>>>> @@ -688,7 +688,7 @@ static struct bq27xxx_dm_reg bq27545_dm_regs[] = {>>>> #define bq27545_dm_regs 0>>>> #endif>>>> >>>> -#if 0 /* not yet tested */>>>> +#if 1 /* tested on Pyra */>>>> static struct bq27xxx_dm_reg bq27421_dm_regs[] = {>>> >>> I think we can drop the #if and #else...#endif so it's just the>>> dm_regs table, as with bq27425.>> >> I have fixed that and did take the chance to update my OpenPandora>> kernel so that I also could test and make the bq27500 working.> > Is this gauge on the board or in the battery?It is on the board.> If in the battery,> monitored-battery should not be used.> > For a gauge on the board, if a user changes the battery to a different> type, they need to update the dtb.Well, that is a little difficult to control, but here we have onlyone standard Pandora cell. There may exist replacements with differentcapacity, but that should not be our problem...> > I assume you built with config_battery_bq27xxx_dt_updates_nvm?Yes.> >> The biggest hurdle was to find out that I have to change the>> compatible string to "ti,bq27500-1" to get non-NULL dm_regs...>> >> [ 12.765930] bq27xxx_battery_i2c_probe name=bq27500-1-0>> [ 12.771392] bq27xxx_battery_i2c_probe call setup>> [ 12.874816] bq27xxx_battery_setup>> [ 12.904266] bq27xxx_battery_setup: dm_regs=bf0520e0>> [ 12.933380] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix>> [ 13.234893] bq27xxx_battery_settings>> [ 13.238891] bq27xxx-battery 2-0055: invalid battery:energy-full-design-microwatt-hours 14800000> > The chip does not support this param, so it should be zero, as it has> to be set if charge-full-design-* is set. Can you try that?Hm. IMHO the DT should describe what the battery has and the driver should simply ignorevalues it can't handle or reject them but do the best out of it. Telling the driver to ignorea value by setting to 0 would IMHO be the wrong approach.We are also working on the generic-adc-battery driver that makes use of the same battery DTnode so that people can choose if they want to configure a kernel for fuel gauge org-a-b or even both.> >> [ 13.312469] bq27xxx_battery_set_config>> [ 13.407745] bq27xxx_battery_unseal>> [ 13.455993] bq27xxx_battery_update_dm_block>> [ 13.460418] bq27xxx-battery 2-0055: update terminate-voltage to 3200>> [ 13.694885] bq27xxx_battery_seal> > We need to see output after a reboot.This was the value after first boot with the new driver enabled.A second boot after removing and reinserting battery shows:[ 11.256713] bq27xxx_battery_setup[ 11.256744] bq27xxx_battery_setup: dm_regs=bf05b0e0[ 11.257690] (NULL device *): hwmon: 'bq27500-1-0' is not a valid name attribute, please fix[ 11.258056] bq27xxx_battery_settings[ 11.258300] bq27xxx-battery 2-0055: invalid battery:energy-full-design-microwatt-hours 14800000[ 11.258300] bq27xxx_battery_set_config[ 11.258331] bq27xxx_battery_unseal> Note that this chip has NVM so> these settings persist without power.Yes I know. Up to now the bq27500 has been programmed during production testby some special flashing tool. Now as the kernel driver has this capability,we should make (optionally) use of it.> >> Does this look ok for>> >> bat: battery {>> compatible = "simple-battery", "openpandora-battery";>> voltage-min-design-microvolt = <3200000>;>> energy-full-design-microwatt-hours = <14800000>;>> charge-full-design-microamp-hours = <4000000>;>> };>> >> ?I mainly had some initial doubts that it did not tell something like"update design-capacity" to 4000 or "design-capacity has 4000"Ah, I see: /* assume design energy & capacity are in same block */This means the bq27500 never programs capacity because we can't specify energy.So I't suggest to revise this rule and coupling of energy and capacity setting.>> >> I will send a patch for enabling both fuel gauges and the omap3-pandora-common.dtsi asap.> > You probably don't want this in upstream dts, as it only programs the> gauge if the kernel has the above config option. If the box runs a> stock distro, it won't work. A custom-built kernel with the above dts> programs the gauge unless the user sets the module param> dt_monitored_battery_updates_nvm=0. The requisite dtb should be> packaged with the custom-built kernel, and deployed with awareness of> the actual battery present.Imho, DT can and should describe all properties of the standard OpenPandorabattery (and not missing registers of the bq27500).Using this information or not should be defined by different defconfigs.Anyways I have now collected my patches into a patch set for furtherreview and cherry-picking.BR,Nikolaus
http://lkml.org/lkml/2017/8/31/88
CC-MAIN-2018-13
refinedweb
848
60.41
Linux Software › Internet › HTTP (WWW) › mod_xmlns 0.97 mod_xmlns 0.97 mod_xmlns Apache module adds XML namespace support to publishing with Apache. mod_xmlns adds XML Namespace support to Apache, and mod_xmlns Apache module adds XML namespace support to publishing with Apache. mod_xmlns adds XML Namespace support to Apache, and may form the basis of XML-driven publishing systems. It runs as an output filter, so it works automatically with any content generator. From Version 0.9 (May 1st 2004) it has moved from experimental prototype to provisionally stable (i.e. there's nothing that is known to need changing before it can be declared stable). This hasn't entirely held, as the API has had to be updated. Now the API is shared with mod_publisher, and is being documented. The basic API for Namespace implementations is: Directives implemented by mod_xmlns XMLNSUseNamespace Syntax: XMLNSUseNamespace URI [on|off] [version] Activates or deactivates processing for namespace URI, using the processor defined in the version paramater. XMLNSDefaultNamespace Syntax: XMLNSDefaultNamespace URI Sets a URI to use as default namespace (for un-namespaced elements). XMLNSCommentHandlers Syntax: XMLNSCommentHandlers on|off Turns on or off comment handlers defined in namespace implementations. Default is On. XMLNSCommentRemove Syntax: XMLNSCommentRemove on|off Determines whether to strip comments that are not processed by any namespace handler. Default is to pass comments through intact. Limitations: Requirements: Download mod_xmlns 0
http://nixbit.com/cat/internet/nttp-(www)/mod-xmlns/
CC-MAIN-2013-48
refinedweb
226
50.94
Validation Validating Domain ClassesGrails allows you to apply constraints to a domain class that can then be used to validate a domain class instance. Constraints are applied using a "constraints" closure which uses the Groovy builder syntax to configure constraints against each property name, for example: Note that as of Grails 0.4 your constraints must be static or an exception will be thrown.To validate a domain class you can call the "validate()" method on any instance: class User { String login String password String email Date age static constraints = { login(size:5..15,blank:false,unique:true) password(size:5..15,blank:false) email(email:true,blank:false) age(min:new Date(),nullable:false) } } The {{errors}} property on domain classes is an instance of the Spring org.springframework.validation.Errors interface.By default the persistent "save()" method calls validate before executing hence allowing you to write code like: def user = new User() // populate propertiesif(user.validate()) { // do something with user } else { user.errors.allErrors.each { println it } } You can also reject domain object values in a controller. You might need to do this if you don't want a new instance of an object to be created if an invalid property or id is passed in as a parameter. For instance: if(user.save()) { return user } else { user.errors.allErrors.each { println it } } For a full reference see the Validation Reference if(params.networksChosen){ def nlist = new ArrayList(); if(params.networksChosen.class == String){ nlist = params.networksChosen.split(",") } else nlist = params.networksChosen; nlist.each { item-> String cleaned = item.trim() Network nw = Network.findByNetworkId(cleaned) if(!nw){ newSnap.errors.rejectValue( 'networks', 'snapshot.networks.notFound', [cleaned] as Object[], 'Could not locate network: {0}' ) } else newSnap.addToNetworks(nw) } } Display Errors in the ViewSo your instance doesn't validate, how do you now display an appropriate error message in the view? For starters you need to redirect to the right action or view with your erroneous bean: In this case we use the render method to render the right view, alternatively you could chain the model back to a "create" action: class UserController { def save = { def u = new User() u.properties = params if(u.save()) { // do something } else { render(view:'create',model:[user:u]) } } } The chain method stored the model in flash scope so that it is available in the request even after the redirect.So now to the view, you clearly have an instance with errors, to display them we use a special tag called "hasErrors": chain(action:create,model:[user:u]) This is used in conjunction with the tag "renderErrors" which renders the errors as a list. In GSP because you can call tags as regular methods calls it also means you can do some neat tricks to highlight the errors really easily such as: <g:hasErrors </g:hasErrors> The above code will add the "errors" CSS class to the property if there are any errors for the field 'login' now simply add a CSS style: <div class="prop ${hasErrors(bean:user,field:'login', 'errors')}"> <label for="login"><input type="text" name="login" /> </div> And you have the erroneous field highlighting when there is a problem. .errors { border: 1px solid red } Changing the Error MessageOf course the default error message that Grails displays is probably not what you were after, so you will want to change this. The way you do this is by modifying the "grails-app/i18n/messages.properties" file and adding a message for the particular error code.For example if we follow the above example the error code may be "user.login.length.tooshort" so we add an entry: For a complete list of error codes and how they correspond to validation constraints see the Validation Reference user.login.length.tooshort=I'm sorry the login you entered wasn't quite long enough, please make it longer Defining constraints for Hibernate mapped classesTo a "com.books.HibernateBook" class (either an EJB3 entity of mapped with Hibernate XML) defined above you would need to create a "com/books/HibernateBookConstraints.groovy" script in the same package as the class itself, in the src/java directory tree. Within the script just define constraints in the same way as you would do in a GORM class: Note that if there is no a correct package declaration for the constraints class, Grails start-up will loop infinitely. /* com.books.HibernateBookConstraints.groovy */ package com.booksconstraints = { title(size:5..15) desc(blank:false) } 1 Comment Site Login
http://www.grails.org/Validation
crawl-002
refinedweb
742
53.71
Add a build or release task Custom build or release tasks can be contributed by extensions that can be discovered and installed by users into an organization in Azure DevOps Services. These tasks appear next to Microsoft-provided tasks in the Add Step wizard: To learn more about the new cross-platform build/release system, see Team Foundation Build & Release. Note: This article covers agent tasks in agent-based extensions. For information on server tasks/server-based extensions, checkout the Server Task GitHub Documentation. Preparation and required setup for this tutorial In order to create extensions for Azure DevOps Services, there are some prerequisite software and tools you'll need: - An organization in Azure DevOps Services, more information can be found here - A text editor. For many of the tutorials we used Visual Studio Code, which can be downloaded here - The latest version of node, which can be downloaded here - Typescript Compiler 2.2.0 or greater, which can be downloaded here - Visual Studio Code for intellisense and debugging support, or release task extension should look like the following: |--- README.md |--- images |--- extension-icon.png |--- buildAndReleaseTask // where your task scripts are placed |--- vss-extension.json // extension's manifest Develop in Unix versus Windows This walkthrough was done on Windows with PowerShell. We attempted to make it generic for all platforms, but the syntax for getting environment variables is different. If using a Mac or Linux, replace any instances of $env:<var>=<val> with export <var>=<val> Steps Below are the steps to create a build or release task extension and put it on the Marketplace: - Step 1: Create a custom task - Step 2: Unit test the task scripts - Step 3: Create the extension manifest file - Step 4: Package your extension - Step 5: Publish your extension - Optional: Install and test your extension Step 1 is all about setting up your task. Every part of Step 1 should be done within the buildAndReleaseTask folder. Create task scaffolding The first step is to create the folder structure for the task and install the required libraries and dependencies. Create a directory and package.json file First, from within your buildAndReleaseTask folder, run: npm init npm init creates the package.json file. You can accept all of the default npm init options. typings install so node_modules are built each time and don't need to be checked in. echo node_modules > .gitignore Create tsconfig.json compiler options This file makes sure that our TypeScript files get compiled to JavaScript files. tsc --init In addition, for this example we want to compile to the ES6 standard instead of ES5. To ensure this happens, open the newly generated tsconfig.json and update the target field to "es6". Note To have the command run successfully, make sure that TypeScript is installed globally with npm on your local machine. Task implementation Now that the scaffolding is complete, we can start code below and replace the {{placeholders}} with your tasks information. The most important placeholder is the taskguid, which must be unique and can be generated here. { ": { "target": "index.js" } } } task.json components Here is a description of some of the components of the task.json file: Note For a more in-depth look into the task.json file, or to learn how to bundle multiple versions in your extension, check out the build/release task reference. index.ts Create an index.ts file using the following code as a reference. This is the code that is run when the task is called. import tl = require('azure-pipelines-task-lib/task'); async function run() { try { const inputString: string = tl.getInput('samplestring', true); if (inputString == 'bad') { tl.setResult(tl.TaskResult.Failed, 'Bad input was given'); return; } console.log('Hello', inputString); } catch (err) { tl.setResult(tl.TaskResult.Failed, err.message); } } run(); Compile Type "tsc" from the buildAndReleaseTask folder to compile an index.js file from index.ts. Run the task The task can be run by simply running node index.js from PowerShell — that is exactly what an agent does. The task failed! That's exactly what would happen if the task ran and inputs were not supplied ( samplestring is a required input). To fix this, we can set the samplestring input and run since samplestring was supplied, and it correctly outputted "Hello Human"! The goal of unit testing is to quickly test the task script, not the external tools it's calling. We want to be able to test all aspects of both success and failure paths. Install test tools We use Mocha as the test driver in this walk through. npm install mocha --save-dev -gaDone) { // Add success test here }); it('it should fail if tool returns 1', function(done: MochaDone) { // Add failure test here }); }); Create success test The success test validates that when the appropriate inputs are given to the tool, it succeeds with no errors or warnings and returns the correct output. First, we create a file containing our task mock runner. This simulates running the task and mocks all calls to outside methods. To do this, create a success', 'human'); tmr.run(); Next, add the following example success test to your _suite.ts file to run the task mock runner: it('should succeed with simple inputs', function(done: MochaDone) { bad or incomplete input is given to the tool,aDone) { this.timeout(1000); let tp = path.join(__dirname, 'failure.js'); let tr: ttm.MockTestRunner = new ttm.MockTestRunner(tp); tr.run(); console.log(tr.succeeded); assert.equal(tr.succeeded, false, 'should have failed'); assert.equal(tr.warningIssues, 0, "should have no warnings"); assert.equal(tr.errorIssues.length, 1, "should have 1 error issue"); assert.equal(tr.errorIssues[0], 'Bad input was given', 'error issue output'); assert.equal(tr.stdout.indexOf('Hello bad'), -1, "Should not display Hello bad"); done(); }); Running the tests To run the tests, run the following commands: tsc mocha tests/_suite.js Both tests should pass. If you want to run the tests with more verbose output (what you would see in the build console), set the environment variable: TASK_TEST_TRACE=1: ## Step 3: Create the extension manifest file The extension manifest contains all of the information about your extension. It includes links to your files, including your task folders and images. This example is an extension manifest which contains the build or release task.## Step 3: Create the extension manifest file The extension manifest contains all of the information about your extension. It includes links to your files, including your task folders and images. This example is an extension manifest which contains the build or release task. $env:TASK_TEST_TRACE=1 Copy the .json code below and save it as your vss-extension.json file: { increments the patch version number of your extension and saves the new version to your manifest. After you have your packaged extension in a .vsix file, you're ready to publish your extension to the Marketplace.## Step identifier for your publisher, for example: mycompany-myteam - This is used as the value for the publisherattribute in your extensions' manifest file. - Specify a display name for your publisher, for example: My Team - Review the Marketplace Publisher Agreement and select Create Now your publisher is defined. In a future release, you'll be able to grant permissions to view and manage your publisher's extensions. This makesselectyour extension and select Share..., and enter your organization must install it.## Optional: Install and test your extension Installing an extension that is shared with you is simple and can be done in a few steps: - From your organization control panel ({organization}/_admin), go to the project collection administration page. - In the Extensions tab, find your extension in the "Extensions Shared With Me" group,selecton the extension link. - Install the extension! If you can't see the Extensions tab, make sure you're in the control panel (the project collection level administration page -{organization}/_admin) and not the administration page for a project. If you're on the control panel, and you don't see the Extensions tab, extensions may not be enabled for your organization.. Feedback
https://docs.microsoft.com/en-us/azure/devops/extend/develop/add-build-task?view=azure-devops
CC-MAIN-2019-35
refinedweb
1,337
56.25
I’ve added 2 new assembly source files for shellcode to execute a ping. First one does a simple ping, second one does a ping with the computername and username in the ICMP packet data. I’ve added 2 new assembly source files for shellcode to execute a ping. First one does a simple ping, second one does a ping with the computername and username in the ICMP packet data. The: I modified the source code of ReactOS‘ cmd and regedit for the following trick: Let me summarize how I did this, as this is the combined result of several techniques I blogged about before. You can download regedit.dll here and the new version of cmd.dll with the DLL command here. The DLL command I added allows you to load a DLL with LoadLibrary or directly into memory (/m option). When loaded with LoadLibrary, the library will be unloaded with FreeLibrary unless you use option /k to keep it loaded. The DLL command assumes that your DLLs execute via the DllMain entry-point when they get loaded. This is something I’ve wanted to do for some time: take a command interpreter and transform it from an EXE into a DLL. Why you ask? Well, because it’s a fun challenge 😉 But also because a DLL is loaded into a process. In a restricted environment, it can be injected into a legitimate process and thus bypass the restriction mechanisms. Metasploit’s Meterpreter is another example of a command interpreter in DLL form. cmd.exe from Microsoft is closed source, but there is an open-source variant available from the ReactOS project. Compiling cmd.exe from ReactOS is simple: download the source-code and the ReactOS build environment. Install it, start the build environment and issue command make cmd. That’s all you need to do to compile cmd.exe (I used version 0.3.11). Transforming the source code to generate a DLL in stead of an EXE is simple. You need to change 3 files. Edit file cmd.rbuild and make these changes to the module element: <module name="cmd" type="win32dll" installbase="system32" installname="cmd.dll" unicode="yes" crt="msvcrt"> Because I want to use this DLL in GUI-processes without console, I need to create a console. Edit file cmd.c and add AllocConsole(); to function cmd_main: SetFileApisToOEM(); InputCodePage= 0; OutputCodePage = 0; AllocConsole(); hConsole = CreateFile(_T("CONOUT$"), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); And because a DLL has another entry-function than an EXE, edit file main.c and replace function main with function DllMain: #include <precomp.h> INT WINAPI DllMain( IN PVOID hInstanceDll, IN ULONG dwReason, IN PVOID reserved) { switch (dwReason) { case DLL_PROCESS_ATTACH: cmd_main(0, NULL); break; case DLL_THREAD_ATTACH: break; case DLL_THREAD_DETACH: break; case DLL_PROCESS_DETACH: break; } return TRUE; } That’s it. Recompile with make cmd to generate cmd.dll There are still some improvements we can make, but that’s for a later version: error messages are not displayed, exiting the shell terminates the host process, … You can download the modified source files and compiled cmd.dll here. This is a screenshot of cmd.dll injected inside Excel with my memory module shellcode: Last.
https://blog.didierstevens.com/2010/02/
CC-MAIN-2017-43
refinedweb
532
65.22
Importing Brian2¶ After installation, Brian2 is avaiable.). This is the style used in the documentation and in the examples but not in the Brian2 code itself (see Coding conventions). If you want to use a wildcard import from Brian2, but don’t want to import all the additional symbols provided by pylab, you can use: from brian2.only import * Note that whenever you use something different from the most general from brian2 import * statement, you should be aware that Brian2 overwrites some numpy functions with their unit-aware equivalents (see Units). If you combine multiple wildcard imports, the Brian2 import should therefore be the last import. Similarly, you should not import and call overwritten numpy functions directly, e.g. by using import numpy as np followed by np.sin since this will not use the unit-aware versions. To make this easier, Brian2 *.
http://brian2.readthedocs.io/en/2.0a8/introduction/import.html
CC-MAIN-2017-39
refinedweb
143
64.51
Qt application with public QML code that user can edit Hello, I want to allow users to change visual aspect of my application editing '.qml' files. I know this is possible but have no idea how. Can someone put me on the right track please ? I found this : QML files in the file system Files are stored without compression and encryption Faster to build but slower to deploy Stored without compression so they take more storage space Easy to do UI changes on the fly on target (just edit QML and restart) < this is what i need i think so how to store files without compression and encryption? QML files in the resource file Resources are compiled to the binary file making the executable file size bigger Slower to build but faster to deploy. Takes less storage space because resources are compressed by default. Because the executable size is bigger the program takes more memory when running. You can't do changes to UI without re-compiling Thx in advance LA Hi, One possible way is to copy the file you want to allow editing from the resource to a suitable writable location (see QStandardPaths). Then you have to tell your application to load that file if it exists otherwise the one from the resource. Note that this also allows you to do a "reset" if the edits ends breaking something (and you can be sure it will at some point) I sublclassed QQuickPaintedItem; constructor: #include "qmprogressbar.h" QMProgressBar::QMProgressBar() { QString homeLocation = QStandardPaths::locate(QStandardPaths::DocumentsLocation, QString(), QStandardPaths::LocateDirectory); homeLocation.append("QMProgressBar.qml"); QQmlEngine qengine; QFile file(homeLocation); if( file.exists()){ qDebug()<< "User file found..."<< homeLocation ; QQmlComponent component(&qengine,QUrl::fromUserInput(homeLocation)); userItem = qobject_cast<QQuickItem*>(component.create()); qDebug()<< userItem->property("maxValue"); } else{ homeLocation = ":/QMProgressBar.qml"; QFile homefile(homeLocation); if(homefile.exists()){ qDebug()<< "QRC file found..."<< homeLocation; QQmlComponent component(&qengine,QUrl::fromUserInput(homeLocation)); userItem = qobject_cast<QQuickItem*>(component.create()); qDebug()<< userItem->property("maxValue"); } } userItem->deleteLater(); } if file exists in writable homeLocation it will be used else qrc file is used. This is ok. Now could you please tell me how can i display this item on the screen ? I saw this exemple but i can not understand what exactly i have to do .. Do i have to implement paint(QPainter *painter) method ? I did this : void QMProgressBar::paint(QPainter *painter){ //test painter->drawPie(boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16); // this works } There is a method drawPixmap( x,y,w,h,QPixmap &pm ) so I'm trying to convert my QMProgressBar.qml to a pixmap : void QMProgressBar::paint(QPainter *painter){ QPixmap itemPxMap; itemPxMap.load("qrc:///QMProgressBar.qml"); painter->drawPixmap(50,50,100,100,itemPxMap); // this will not work : application starts and shows white screen } Is it possible to convert a .qml file to QPixmap ? Please tell me what i'm doing wrong here. What exactly are you trying to achieve ? I thought you wanted to load a QML file and run it live in your application which seems to not be what you are doing. @SGaist hello, As i said i'm trying to create a qtQuick app, with .qml files avalabls for the user (user can edit qml files) @SGaist said in Qt application with public QML code that user can edit: One possible way is to copy the file you want to allow editing from the resource to a suitable writable location (see QStandardPaths). Then you have to tell your application to load that file if it exists otherwise the one from the resource. So I'm trying to subclass QQuickPaintedItem, class QMProgressBar : public QQuickPaintedItem{ // I want to read a .qml file ('user file' if it exists, otherwise the one from the resource) create the item corresponding that qml code, show it on the screen }; then i will register my class : qmlRegisterType<QMProgressBar>("QMProgressBar", 1, 0, "Bar"); To be able to create QMProgressBar{} in QML. So, for the moment in my class I'm able to load the right file, cast it to QQuickItem*, read properties : QQmlComponent component(&qengine, QUrl::fromUserInput(homeLocation)); userItem = qobject_cast<QQuickItem*>(component.create()); qDebug() << userItem->property("maxValue"); Last thing i have to do, is to show that item. Thx Like this exemple : except : void PieChart::paint(QPainter *painter) { QPen pen(m_color, 2); painter->setPen(pen); painter->setRenderHints(QPainter::Antialiasing, true); // painter->drawPie(boundingRect().adjusted(1, 1, -1, -1), 90 * 16, 290 * 16); //instead of 'drawPie()', i want to drow 'userItem' } @LeLev said in Qt application with public QML code that user can edit: Last thing i have to do, is to show that item. Ok, last thing to do was to set the visual parent of my qquickitem ! now is is working. userItem->setParentItem(this); @SGaist thank you very much for help! LA
https://forum.qt.io/topic/87077/qt-application-with-public-qml-code-that-user-can-edit
CC-MAIN-2018-39
refinedweb
790
54.93
Your answer is one click away! I want to display a message for two seconds. The logic that im using right now is making the code wait using pygame.time.delay(2000) after pygame.display.flip. A short example: (I use this flip-delay on my code a lot) write_gui("{0} has appeared".format(monster.name), BLUE, 24, TEXT_CORNER_X, TEXT_CORNER_Y) pygame.display.flip() pygame.time.delay(2000) This does work but it tends to "hang" the entire process, so when this happens I get some bugs because of this, mainly some frame loss because the program can keep up with the sleep-awake cycle. So what I'm thinking right now is to draw the same frame for two seconds. So what do you guys recommend I should do? Because one of my answers was to put every flip on a while loop, so there has to be a better line-conservative approach to solve this. your program "hangs" because you are not calling pygame.event.get() when you are sleeping, pygame.event.get()lets pygame handle its internal events. The simplest way to solve is to use the return value from dt = clock.tick(), in this case dtwill be the time since your last call to clock.tick(), this value will be in milliseconds. You could then use that value to increment a counter on how long to show the message. You could write a function like this if you wanted and call it with how long to wait: def waitFor(waitTime): # waitTime in milliseconds screenCopy = screen.copy() waitCount = 0 while waitCount < waitTime: dt = clock.tick(60) # 60 is your FPS here waitCount += dt pygame.event.pump() # Tells pygame to handle it's event, instead of pygame.event.get() screen.blit(screenCopy, (0,0)) pygame.display.flip() This function will wait for the specified time and keep the screen as it was before the call.
http://www.devsplanet.com/question/35269201
CC-MAIN-2017-30
refinedweb
316
76.22
Task... Identify the 2 highest elevation points in a series of polygons. Purpose... To win a bet amongst neighbors... to locate something like a tower... find observation points for visibility analysis... lots of reasons Conceptualization... - Intersect the points with the polygons, retaining all attributes... output type... point - Add an X and Y field to the result so you have the point coordinates for later use (if you don't have them) - Delete any 'fluff' fields that you don't need, but keep the ID, KEY, OBJECTID fields from each. They will have a unique name for identification. - Split the result into groupings using the key fields associated with the polygons (see code) - Sort the groupings on a numeric field, like elevation (ascending/descending) (code) - Slice the number that you need from each grouping. (code) - Send it back out to a featureclass if you need it. (code) For Picture People... A sample table resulting from the intersection of points with polygons. The points (in red) and the polygons (a grid pattern) with the two points with the highest 'Norm' value in each polygon An upclose look of the result For the Pythonistas.... Fire up Spyder or your favorite python IDE >>> a = arcpy.da.TableToNumPy("path to the featureclass or table", field_names="*") # you now have an array with me so far? now you have an array Make a script... call it something (splitter.py for example) The work code... import numpy as np import arcpy def split_sort_slice(a, split_fld=None, val_fld=None, ascend=True, num=1): """Does stuff Dan_Patterson@carleton.ca 2019-01-28 """ def _split_(a, fld): """split unsorted array""" out = [] uni, idx = np.unique(a[fld], True) for _, j in enumerate(uni): key = (a[fld] == j) out.append(a[key]) return out # err_0 = "The split_field {} isn't present in the array" if split_fld not in a.dtype.names: print(err_0.format(split_fld)) return a subs = _split_(a, split_fld) ordered = [] for i, sub in enumerate(subs): r = sub[np.argsort(sub, order=val_fld)] if not ascend: r = r[::-1] num = min(num, r.size) ordered.extend(r[:num]) out = np.asarray(ordered) return out # ---- Do this ---- in_fc = r"C:\path_to_your\Geodatabase.gdb\intersect_featureclass_name" a = arcpy.da.TableToNumPyArray(in_fc, "*") out = split_sort_slice(fn, split_fld='Grid_codes', val_fld='Norm', ascend=False, num=2) out_fc = r"C:\path_to_your\Geodatabase.gdb\output_featureclass_name" arcpy.da.NumPyArrayToFeatureClass(out, out_fc, ['Xs', 'Ys'], '2951') Lines 40 - 42 NumPyArrayToFeatureClass—Data Access module | ArcGIS Desktop Open ArcGIS Pro, refresh your database and add the result to your map. I will put this or a variant into... So that you can click away, for those that don't like to type.
https://community.esri.com/blogs/dan_patterson/2019/01/29/split-sort-slice-the-top-x-in-y
CC-MAIN-2019-26
refinedweb
438
59.4
I have a boxin my world (made in onGUI) and was wondering if it was possible to do a have a simular animation as the button press be played on the box? I have a spell that is cast when the key 1 is pressed. I have a box displaying the name and hotkey and also if the player is in range or not. I want to have an animation that shows when the spell button is being pressed. Is this possible or is it just a stupid idea? I would recommend not using OnGUI() anymore, it is deprecated. The newer Unity UI system replaced it and has a lot better functionality. In Unity UI you model a button with a GameObject with a Button script on it, which automatically handles being pressed. I have heard people saying this, but i feel like the new system is extremely bad at different sizes of screens. If i place a button in the bottom of the screen on my computer it is not even in the screen on my laptop. Well, designing the UI for various resolutions is difficult, but once you understand anchoring and the CanvasScaler component, it becomes a lot easier. And with OnGUI() you still have the same problem, but there you have to change code to move the UI, and calculate with resolution and ratios... Check out this Unity manual about how to design for various resolutions, it is not perfect, but it explains the basics well. And also i find it hard to eg. have a text be displayed over an enemy or the player. That's actually really easy, just add this script to the UI element you want to move: public class AnchorIn3D : MonoBehaviour { [SerializeField] private RectTransform ownRectTransform = null; [SerializeField] private Transform target = null; public void SetTarget (Transform value) { target = value; } [SerializeField] private Vector3 offset = Vector3.zero; public void SetOffset (Vector3 value) { offset = value; } private void Awake () { if (ownRectTransform == null) { ownRectTransform = GetComponent<RectTransform>(); } } private void Update () { if (ownRectTransform != null && target != null) { ownRectTransform.position = Camera.main.WorldSpaceToScreen(target.position + offset); } } } Answer by rerenzel · Feb 28, 2018 at 05:02 PM yes it is if(Input.GetButtonDown(yourButton) { // this is where your animation starts } if(Input.GetButtonDown(yourButton) { // this is where your animation 220 People are following this question. Animation bug when click and hold on Button edge 1 Answer UI button pressed animation not playing directly after entering 1 Answer How to animate button ? 1 Answer Activating One Part of An Animation 2 Answers Trying to manage an Animation. AnimationState.time doesn't adjust the animation 1 Answer
https://answers.unity.com/questions/1474595/playing-a-button-pressed-animation-on-a-box.html
CC-MAIN-2019-09
refinedweb
432
53.21
What on Earth Was the JetBrains Quest? We have a lot of developers at JetBrains, and many of us like games – challenging games. We came up with the idea of creating a treasure hunt in which the solution to each puzzle was the hint for the next one. We’d hide all the puzzles as easter eggs inside JetBrains sources. After a long period of brainstorming, JetBrains Quest was born. JetBrains Quest was a series of puzzles spread throughout different JetBrains pages and products. The game consisted of 3 Quests, with 4-6 puzzles to solve per quest. The first quest was relatively easy to give people a chance to figure out what to expect with the difficulty increasing as you moved along. The Quest began on March 9 with a post on our social media networks (Twitter, Facebook and Linkedin) and it ended on March 15 at 12:00 CET. At this point all of the puzzles were removed. The response from the community was amazing! People were asking for more. Based on the comments, it looks like the most difficult puzzle to solve was the Fibonacci exercise. This puzzle was hidden inside a Tip of the Day in a specific version of IntelliJ IDEA Community Edition. 12:00 CEST. This was the last puzzle of the entire Quest. If you attempt to solve it using a linear approach, it will take hours or even days to get the answer. There were two main approaches to tackling this puzzle. The easy one was to use Wolfram|Alpha to get the first and last four digits. The second way is more difficult, but it comes with a bonus: a bigger feeling of accomplishment! There are algorithms that make the computation for the Fibonacci sequence faster. We were expecting you to implement one of these options. Here’s an example: import math def last_fib_digits(fib_number, last_digits): prev, cur = 0, 1 q = 10 ** last_digits while fib_number > 0: prev, cur = cur, prev + cur fib_number -= 1 cur %= q return prev def first_fib_digits(fib_number): phi = (math.pow(5.0, 0.5) + 1) / 2 logF = fib_number * math.log10(phi) - 0.5 * math.log10(5.0) return math.pow(10.0, logF - int(logF)) print(last_fib_digits(50000000, 4)) print(first_fib_digits(50000000)) First 4 digits: 4602 Last 4 digits: 3125 For those of you who didn’t manage to finish the Quest, you can see all the puzzles and their solutions here. We would like to thank everyone who took part in our JetBrains Quest and joined in the fun. Leave a comment below and let us know which puzzle was your favorite. Thanks for joining in! May you always have an adventure in your life! – The JetBrains Quest Team 3 Responses to What on Earth Was the JetBrains Quest? Haim Lvov says:March 28, 2020 Yay! My comment to the quests was highlighted here! 😀 Flo says:April 3, 2020 Fibonacci took me the longest, because I interpreted “first and last 4 digits” to the single first digit and the last 4 (so 5 in total). those says:May 1, 2020 For those of you who didn’t manage to finish the Quest, you can see all the puzzles and their solutions
https://blog.jetbrains.com/blog/2020/03/27/what-on-earth-was-the-jetbrains-quest/
CC-MAIN-2020-45
refinedweb
534
73.37
A 0-1 sequence can be interpreted as a point in the interval [0,1]. But this makes the long-term behavior of the sequence practically invisible due to limited resolution of our screens (and eyes). To make it visible, we can also plot the points obtained by shifting the binary sequence to the left (Bernoulli shift, which also goes by many other names). The resulting orbit is often dense in the interval, which doesn’t really help us visualize any patterns. But sometimes we get an interesting complex structure. The vertical axis here is the time parameter, the number of dyadic shifts. The 0-1 sequence being visualized is the Kolakoski sequence in its binary form, with 0 and 1 instead of 1 and 2. By definition, the n-th run of equal digits in this sequence has length . In particular, 000 and 111 never occur, which contributes to the blank spots near 0 and 1. Although the sequence is not periodic, the set is quite stable in time; it does not make a visible difference whether one plots the first 10,000 shifts, or 10,000,000. The apparent symmetry about 1/2 is related to the open problem of whether the Kolakoski sequence is mirror invariant, meaning that together with any finite word (such as 0010) it also contains its complement (that would be 1101). There are infinitely many forbidden words apart from 000 and 111 (and the words containing those). For example, 01010 cannot occur because it has 3 consecutive runs of length 1, which implies having 000 elsewhere in the sequence. For the same reason, 001100 is forbidden. This goes on forever: 00100100 is forbidden because it implies having 10101, etc. The number of distinct words of length n in the Kolakoski sequence is bounded by a power of n (see F. M. Dekking, What is the long range order in the Kolakoski sequence?). Hence, the set pictured above is covered by intervals of length , which implies it (and even its closure) is zero-dimensional in any fractal sense (has Minkowski dimension 0). The set KC apparently does not have any isolated points; this is also an open problem, of recurrence (whether every word that appears in the sequence has to appear infinitely many times). Assuming this is so, the closure of the orbit is a totally disconnected compact set without isolated points, i.e., a Cantor set. It is not self-similar (not surprising, given it’s zero-dimensional), but its relation to the Bernoulli shift implies a structure resembling self-similarity: Applying the transformations and yields two disjoint smaller copies that cover the original set, but with some spare parts left. The leftover bits exist because not every word in the sequence can be preceded by both 0 and 1. Applying the transformations and yields two larger copies that cover the original set. There are no extra parts within the interval [0,1] but there is an overlap between the two copies. The number appears several times in the structure of the set: for instance, the central gap is , the second-largest gap on the left has the left endpoint , etc. The Inverse Symbolic Calculator has not found anything about this number. Its binary expansion begins with 0.001 001 011 001 001 101 001 001 101 100… which one can recognize as the smallest binary number that can be written without doing anything three times in a row. (Can’t have 000; also can’t have 001 three times in a row; and 001 010 is not allowed because it contains 01010, three runs of length 1. Hence, the number begins with 001 001 011.) This number is obviously irrational, but other than that… In conclusion, the Python code used to plot KC. import numpy as np import matplotlib.pyplot as plt n = 1000000 a = np.zeros(n, dtype=int) j = 0 same = False for i in range(1, n): if same: a[i] = a[i-1] same = False else: a[i] = 1 - a[i-1] j += 1 same = bool(a[j]) v = np.array([1/2**k for k in range(60, 0, -1)]) b = np.convolve(a, v, mode='valid') plt.plot(b, np.arange(np.size(b)), '.', ms=2) plt.show()
https://calculus7.org/tag/kolakoski-sequence/
CC-MAIN-2018-05
refinedweb
712
61.77
Google Cloud Endpoints can save you coding time. This article walks you through several best practices for using endpoints, such as how to annotate methods to avoid REST collisions. Contents Cloud Endpoints in a Nutshell Setup: A Quick Review Snippets of Endpoint Code Designing Your API Generating Your Library Designing Your Model for the Datastore Google Cloud Messaging For First-time Android Developers Final Word Appendix Cloud Endpoints in a Nutshell Cloud Endpoints is a service for building and exposing custom APIs with which your client applications can interact. It exists to make your life as a developer much easier. Google engineers have already put in an enormous amount of effort to write and optimize it for you, freeing you from the worry of writing the bulk of the server-client interactions and protocols yourself. One of the benefits of being able to easily build your own API is that you can design it any way you want. Cloud Endpoints gives you this flexibility—it allows REST- or RPC-style APIs, or a combination of both. Even better, you can change the design as often as you like and implement those changes quickly. This is perfect for agile style of development. A Bit About Basic REST. CRUD (Create, Retrieve, Update, Delete) is at the root of REST. When you use Android Studio or the Google Plugin for Eclipse to generate an Endpoint class, these types of basic methods are generated for you. You are not limited to those basic actions. Adding custom methods gives you more flexibility, allowing you to perform complex operations. For example, checkForVictory might perform several queries and write to a database. Setup: A Quick Review This section provides a quick review on how to generate your project and build Endpoints on Eclipse. For more information, refer to the developer documentation. - Make sure the following are downloaded and set up on your computer: - Eclipse - Google Plugin for your version of Eclipse - App Engine SDK - Android SDK At the time of writing, the latest versions were Eclipse 4.2, App Engine SDK 1.8.0, and Android SDK r21.01.1. - If you do not already have an Android client application, create one in Eclipse. - Create your App Engine backend by right-clicking your Android Application and selecting Google > Create App Engine Backend. - You can generate basic Endpoints classes by right-clicking your data object java class and selecting Google > Generate Cloud Endpoint Class. You can always further modify these classes. - Generate your library by right-clicking your App Engine backend application and selecting Google > Generate Cloud Endpoint Library. If you’re an IntelliJ user, another option for an Android development environment is the Android Studio on IntelliJ. Although this article does not cover that option, you can read more about it on the Android developer site. Snippets of Endpoint Code Defining Endpoints in the Backend The App Engine application Endpoints code can be grouped into two categories: model and API. The first type is your model. These classes represent the objects in the world of your application—in other words, they represent the resources that will be manipulated by your API. For example, if your application world contains lobsters with whiskers, you might have a data object such as this: public class Lobster { private int whiskerLength; public int getWhiskerLength() { return whiskerLength; } public void setWhiskerLength(int whiskerLength) { this.whiskerLength = whiskerLength; } } The second type is your API code. The API part of your code provides the methods that may be accessed in a client application. These methods manipulate the objects in your model. There are two ways to start writing API code: - You may right-click on Lobster.java and select Google > Generate Endpoint Class, whereupon Eclipse will generate a new class for you called LobsterEndpoint.java. This class will be filled with pre-generated annotations and code, ready to be called from your client. These generated methods insert, update, and delete your Lobster objects from your Datastore. You can further modify this class by adding or removing methods. - You may create your own Java class and call it whatever you want. As long as it is annotated properly, Cloud Endpoints will recognise it as being part of your API. Please note that private instance methods will not become part of your API. An example of an endpoint class might look like this: @Api(name = "lobster") public class LobsterEndpoint { @ApiMethod(name = "lobster.growWhisker", httpMethod = HttpMethod.POST) public void growWhisker(Lobster lobster) { // grows the lobster’s whisker // calculates growth, updates the Lobster in Datastore } private int calculateWhiskerGrowth(Lobster lobster) { // this method is a private utility method // it will NOT be visible in your API } } One general tip: Don’t get stuck on the generated endpoint code. It is useful, yes, and contains great starting point patterns, but don’t be afraid to modify it for your specific project. The code is as malleable as you want it to be. For example, the auto-generated DeviceInfo entities use Registration IDs as keys. You can still add new fields to a DeviceInfo entity, or use a different field for the key instead. Consuming Endpoints from the Client After you generate your Cloud Endpoint Library, the new code that appears in your client (usually under some folder with endpoint-libs in the filepath) corresponds to the functionality you provided in your backend code. The difference in the model is that new classes extend the GenericJson class, so that they can be sent as JSON. This is what your newly-generated Lobster class might look like: public final class Lobster extends GenericJson { private int whiskerLength; public int getWhiskerLength() { return whiskerLength; } public Lobster setWhiskerLength(int whiskerLength) { this.whiskerLength = whiskerLength; return this; } } The API client code is a series of methods and JSON request classes, which make it very easy for you to use in an Android client. This is what the result of your LobsterEndpoint.java class might look like: public Lobster lobster() {...} public class Lobster { public GrowWhisker growWhisker(Lobster lobster) {...} public class GrowWhisker extends LobsterRequest { private static final String REST_PATH = “growWhisker” protected GrowWhisker(Lobster lobster) {...} ... } } You can then consume this exposed endpoint with the following code: service.lobster().growWhisker(lobster).execute(); If you are at all familiar with HTTP requests, you will know that, for any given REST path, you can only provide one definition of POST, one of GET, and so on. You can certainly create multiple POSTs in the same endpoint API, but make sure that their REST paths are different, or you will run into conflicts. For more information on @ApiMethod annotations, see the relevant section in the appendix. Ideally, once the library is generated in your client application, you should leave the generated client code alone. Any changes you may want to make to your model or API should be done in the backend. Designing Your API Model - The classes in your model must have certain characteristics. If you want to use a class in your API, these are the characteristics that are required: - Be serializable - Have a zero-argument constructor - Implement getters and setters for its fields - The classes in your model may contain other instance methods as well. Keep in mind that any methods that are not getters or setters will never see the light of day on the client side. - How does an object class definition in the model get flagged for inclusion in the generated client model? Say you have a Clam.java class and some fields and getters and setters (get/setPearl, get/setColor, for example), but when you generate the Endpoint Library, no Clam.java appears in your generated code. What happened to it? How you use the Clam object in the rest of your model and in your backend API determines this behavior. - Using the entity in your API will force Cloud Endpoints to recognize that Clams, as objects, exist. @ApiMethod(name = "clam.producePearl", httpMethod = HttpMethod.POST) public void producePearl(Clam clam) { // adds a pearl to the clam } - Using Clams properly in your model forces Cloud Endpoints to recognize them and generate a client-side Clam.java for you. In order to make Cloud Endpoints recognize Clams as objects, write a setClam (Clam clam) setter method, which can be public, protected, or private. - “Setter” methods must have the following properties: - The method name must begin with “set” - The object that you want to set must be in the parameters For example: setClam(Tree tree) is clearly setting a Tree, not a Clam – despite the method name claiming otherwise. This method will actually generate a Tree.java class in the client, as well as getTree() and setTree(Tree) methods. It will not generate a setClam(Clam) method. About Supported Types - Enums. Enums in your backend are generated as String representations in the client code. In other words, if you are making use of the enum functionality in both the backend and client, you will need to define the enum in both places. - Boolean – Getters often appear in a form such as “isLobster” in Java code, and Eclipse uses that convention when you right-click the field and go to Source > Generate Getters/Setters. However, be aware that Cloud Endpoints will generate “getLobster” in the client model. API Methods - The attribute “name” for @Api annotation should start with a lowercase character. It should be formatted like a Java variable name—camel case, alphanumeric. - Static methods are not supported in your Endpoints classes. If you must have a static method, it should be made private. - If you do not specify the httpMethod attribute in @ApiMethod signature, Cloud Endpoints will make an educated guess for you, based on your method name. - Use the @ApiNamespace annotation for more control over your the package names of your library. Otherwise, your API will use the default package names. - Method parameters in the generated client library are in alphabetical order, regardless of the original order in the backend method. As a result, you should be careful when editing your methods, especially if there are several parameters of the same type. The compiler will not be able to catch parameter-ordering errors for you. - Empty Lists that are returned will arrive as nulls on the client-side. Remember to check for those. - Overloaded methods in a class are not supported. About Supported Parameter Types - Most parameter types must be serializable because JSON requires that the objects be serializable. - You may also use any JavaBean, which includes anything from your model, since your model objects should conform to the JavaBean standard as described above. - A limited set of types need not be serializable, but must be annotated with @Named. These are the types: String, int/Integer, boolean/Boolean, long/Long. About Supported Return Types - Return types must be serializable. The supported @Named method parameters (such as Strings and Booleans) are not supported as return types. One exception is that you can return a void, in which case the generated client-side method will return a Void.class. - Lists of serializable types. Actually, what Endpoints generates is a new “Collection” JSON class that is similar to every other client model class. For example, if you have an object in your model that is represented by Lobster.java, and you want to return a List<Lobster>, the library will have a LobsterCollection.java. You can retrieve the list of Lobsters in your client by calling getItems(). - Maps of serializable types. Similar to the way it deals with Lists, Endpoints generates a “JsonMap” for Maps. - Subclass types will generate the interface type. For example, if your backend method returns an ArrayList, it will be a List in your client. Of course, you should probably be using the interface to define your variables and return types anyway, but be aware of this in cases where you want to use the subclass. Generating Your Library As you begin to generate your Cloud Endpoints API library, here are a few features that the Google Plugin for Eclipse can help you with: - Starting from scratch is very easy. When you first generate your App Engine backend from your Android project, Eclipse sets up the configurations to link the the two. These configurations tell Eclipse to put the new generated library code into the correct folder in your Android project. For more details, see the Generating Endpoints sections. - If you already have an App Engine application that you want to link up to your Android frontend, you’ll need to edit your Eclipse project settings. - In your Eclipse project for your Android client, there is a hidden folder called “.settings/”. The com.google.gdt.eclipse.appengine.swarm.prefs file in the settings folder should contain a line: “connectedProject=YourAppEngineBackend”, where “YourAppEngineBackend” is the name of your backend. - In your Eclipse project for your App Engine backend, there is also a hidden folder called “.settings/”. The com.google.gdt.eclipse.appengine.swarm.prefs file in the settings folder should contain a line: “connectedProject=YourAndroidClient”, where “YourAndroidClient” is the name of your frontend client. - Resolve errors when generating the Cloud Endpoint Library by looking at Eclipse’s Error Log. As you start developing with Cloud Endpoints, you might run into problems generating the library at first. You may encounter the error, “Generating Cloud Endpoint has encountered errors and is not complete.” You can see a much more complete description of the error by selecting Window > Show View > Error Log. Double-click on each error for a nice verbose output. - Make sure your Eclipse version has a Google Plugin that is compatible with the version of App Engine SDK. If you’re still running into odd errors such as “method not found” after reading the Error Log, it may be due to incompatibility between versions. When in doubt, update to the latest versions of the Google Plugin, App Engine SDK, and Android SDK. If there are still problems, try switching to newer versions of Eclipse. - Re-generate your library periodically, or after every major change. When you change your @ApiMethod name attribute, or anything else that causes client-side changes, you should update your library. Think of it this way: You are the engineer for both server code and client code. Sometimes you, the backend engineer, will make breaking changes, and you, the frontend engineer, will have to adapt. - Set up a local development environment if you want to test locally. When you generate the endpoint library, a class is automatically created for you, named CloudEndpointUtils. If you want to do local testing, remember to set LOCAL_ANDROID_RUN = true, and call CloudEndpointUtils.updateBuilder(builder) in every place that instantiates an endpoint service. This way, you can easily switch between local versus deployed versions by toggling the LOCAL_ANDROID_RUN variable. Designing Your Model for the Datastore Remember to make your model Datastore-compliant if you wish to use the easily-accessible persistent storage that Datastore offers, which plays so nicely with Cloud Endpoints. Take a look here for the full list of Datastore Properties and Types. The following describes some of the highlights and ambiguities of Datastore in more detail: - You have several choices for interacting with the Datastore. JPA/JDO provides an excellent abstraction layer for when your saved model is simple. The low-level Datastore API gives you more control over how your objects persist. If you use the low-level Datastore API, you can, and will need to, manually control changes to your model. This has upsides and downsides. - Empty lists persist as plain old nulls. It is worth noting that even if you check for these nulls and attach an empty List to the object that gets sent to the client, it will still arrive as null on the client. - For persisting groups of objects, remember that Datastore only takes objects of type Collection or its subclasses. The items in the Collection must be of one of the other supported types, or they must be serializable into a Blob. - No arrays. As mentioned above, Datastore will take values of type Collection, so make use of those instead of arrays. - Datastore does not distinguish between the sizes of the numbers, such as int32 and int64. For example, if you persist a List of Integers, it is stored as List<Long>. Of course, you do not have to use the Datastore. One of the benefits of App Engine is that you can mix and match many Cloud services. Cloud SQL, JPA for example (which would be a great option) is available for you to use. Alternatively, you could explore Google BigQuery, if that is the type of data storage you need. And Google Cloud Storage is a good way to store a wide variety of types of data, as well. Google Cloud Messaging Google Cloud Messaging is pretty straightforward to use for basic purposes. Any known issues are documented here. For First-time Android Developers If you’re new to Android, you’ll find that Cloud Endpoints makes everything much simpler and allows you to focus your energies on the app itself, such as: - Make calls to your API asynchronously on non-UI threads. Android has one main thread (often referred to as the “UI thread”) running, so you do not want it to be bogged down and waiting for responses. - AsyncTasks are your friends. Note that AsyncTasks that are tied to an Activity can be destroyed when the Activity is destroyed, so it is up to you to make sure that all such behavior is intended. Search for articles regarding “AsyncTasks screen rotation,” for example, and you should find many ideas out there for dealing with this. - If you need to use an object that should be returned by the task, make use of the task’s onPostExecute override method. If you request a Lobster object from your API using an AsyncTask, and then immediately try to use it in your next line of code (for example, Lobster lobster = new GetLobsterAsyncTask().execute(lobsterName); lobster.dance();), you will receive an exception. So, not only will your lobster “not dance,” it will “throw a NullPointerException at you”. - If you want the UI to wait until the task returns, use a ProgressDialog in the onPreExecute and onPostExecute methods. - Keep track of Activity and Fragment lifecycles. If you’re having trouble with this at first, override a number of the important lifecycle methods and put debug Log statements in them, just to see whether and when your Activities are getting Paused, Resumed, Destroyed, and so on. Here is a full list of these methods, if you need them. - For example, when you start a second Activity with startActivityForResult, you’ll be able to see that the very first thing the lifecycle hits, when that second Activity finishes, is the onActivityResult in the first Activity – even before onCreate/Resume. - Starting a new Activity in the middle of a method does not excuse the rest of the line of logic from executing. This applies to startActivity, startActivityForResult, or anything else. Even though you cannot see it, the method will complete, as well as any other methods that it calls. The Activity containing the executing method does not go away until you destroy it or pop it off the stack. - Sometimes, you should just delete the R.java file. Or, in other words: Clean and rebuild your project. Occasionally you’ll run into some issues where “you can’t cast Lobster into Tree.” “But I’m not trying to,” you say, “because that that’s silly—Lobsters and Trees aren’t even part of the same Kingdom!” It might mean that your R.java file, which holds pointers to values defined in your res/ folder, got a little mixed up. Rebuilding should fix it. - Android layouts rules are not CSS rules. They can often be very similar, so you should feel very much at ease. However, sometimes there are minor differences. For example, margins do not collapse in Android, so check your facts before investing a lot of effort into your layout. - Dalvik is not really Java. Dalvik does use Java syntax, however, and Android supports a very large subset of the Standard Java libraries, such as java.util and java.io. You cannot import just any third-party Java library and expect it to play well with Android. - Creating a new Activity with Eclipse’s “Create a New” wizard generates/modifies five files: - AndroidManifest.xml (adds a new <activity> entry) - res/values/strings.xml (adds a title string for the activity) - res/menu/your_activity.xml (creates this file) - res/layout/your_activity.xml (creates this file) - YourActivity.java (creates this file with some starter methods, such as onCreate override) - Use the standard Logger class for logging on App Engine. You can view the output in the App Engine Dashboard of the Google Cloud Platform Console. Android uses its own logging, and its output can be seen in one of the Eclipse views called “LogCat”. - If you’re hitting occasional EOFException errors, it is likely due to keepAlive connections on Android. You can find various solutions on StackOverflow. Final Word You’ve read through a lot of the specifics you may encounter, but the best way to learn is to jump right in. Cloud Endpoints is extremely flexible and intuitive. It takes on the burden of developing client-server interactions and protocols, and allows you to focus on developing your application logic. Best of all, it’s not in the way—after you begin to develop your application, getting your client to talk to your server is so easy that you forget that it was not always so simple. Good luck! Appendix @ApiMethod usage There is a wonderful table here to guide you through annotating your Java API methods. Here are a few additional, in-depth details: The REST URI path of your endpoint prefers to use these attributes, in the following order: - Your path attribute. - In path = lobsters: “lobsters” will become your REST path. - The 2nd part of your “name” attribute. - In name = lobsters.assignName: “assignName” will become your REST path. - Your method name. - In public void assignName(Lobster lobster): “assignName” will become your REST path. Regarding your name attribute, think of the first part of this attribute as your resource class. Think of the second part as the method you want to perform. Here are a couple examples of the name attribute: - name = lobsters.assignName on your backend will be consumed with service.lobsters().assignName(param)in your client code. - name = lobsters on your backend will be consumed with service.lobsters(param)in your client code. Example 1 With those rules in mind, here is a typical example of what a method might look like in your App Engine backend. Notice that the resource, lobster, is pluralized: @ApiMethod(path = “lobsters/assign/{[a]name}[a]”, name = "lobsters.assignName", httpMethod = HttpMethod.POST) public void makeLobsterANewName(String name) {...} Then the client library will generate the following code to use on your client: public Lobsters lobsters() {...} public class Lobsters { public AssignName assignName(String name) {...} public class AssignName extends CloudmazeRequest { private static final String REST_PATH = “lobsters/assign/{name}” protected AssignName(String name) {...} } } And to consume the endpoint, you can write the following code: String name = “Bob the Lobster”; service.lobsters().assignName(name).execute(); Example 2 Here is a typical example of a simpler CRUD-type method for a Lobster resource in your App Engine backend. Notice that the resource, lobster, is pluralized, and that there is no HttpMethod attribute because the “update” method defaults to HttpMehod.PUT: @ApiMethod(path = “lobsters”, name = "lobsters.update") public void updateLobster(Lobster lobster) {...} The client library then generates the following code to use on your client: public Lobsters lobsters() {...} public class Lobsters { public Update update(String name) {...} public class Update extends CloudmazeRequest { private static final String REST_PATH = “lobsters” protected Update(String name) {...} } } To consume the endpoint, you can write the following code: Lobster bobLobster = new Lobster(); service.lobsters().update(bobLobster).execute(); HttpMethod Defaults Cloud Endpoints will make some smart decisions on which HttpMethod to use when a method name begins with certain key words. For example, setLobster defaults to httpMethod = HttpMethod.POST, unless otherwise specified.
https://cloud.google.com/solutions/mobile/google-cloud-endpoints-for-android/
CC-MAIN-2016-18
refinedweb
4,005
64.1
UnSignpost From Uncyclopedia, the content-free encyclopedia Welcome to Uncyclopedia's online news page, the UnSignpost. News is updated here regularly (every month) giving you a minute by minute acount of the goings on in the Uncyclopedia community. Uncyclopedia invaded by aliens The UnSignpost journalists would like to report to you the lateness of the latest UnSignpost, it's retard, as a Frenchman would say. French people do not have anything to do neither with this UnSignost, nor with this article (unless the French are really the reason for everything being late), and this reference was inserted here for no reason. UnSignpost receives its own namespace - As thousands of mourners crowded round the cenitaph in Whitehall this week, Uncyclopedia too remembered those men who had died in their effort to liberate UnSignpost. VFD floods - The VFD region of Uncyclopedia has undergone serious flooding in the past few days with many articles drowning in the midst of the storm that hit. UnSignpost change reported to be a hoax - UnSignpost's dramatic changes that have taken place over the last day are said to have been a cover for a coup between the Chief Editors. Image of the week! Archives and stuff - UnSignpost:UnSignpost/20131031: the latest UnSignpost; - UnSignpost:Article: Check out our old and new articles to find out why we are not the same!.5/0) - (8/3) - Declaration of Gin-Dependence (5.5/0) Featured Articles of the Week: Mold
http://uncyclopedia.wikia.com/wiki/Uncyclopedia:UnSignpost
CC-MAIN-2013-48
refinedweb
241
50.46
Part 1 (link) introduces basic bitwise operations. This is part 2 and it's mainly about (in)famous bitsets and example problems. Also, see links to very useful advanced stuff at the bottom. EDIT: here's video version of this blog (on my Youtube channel). Built-in functions In C++, __builtin_popcount(x) returns popcount of a number — the number of ones in the binary representation of $$$x$$$. Use __builtin_popcountll(x) for long longs. There are also __builtin_clz and __builtin_ctz (and their long long versions) for counting the number of leading or trailing zeros in a positive number. Read more here. Now, try to solve these two simple tasks in $$$O(1)$$$, then open the spoiler to check the solution: 1 << __builtin_ctz(x) 1 << (32 - __builtin_clz (x - 1)) but this is UB (undefined behavior) for $$$x \leq 1$$$ so you'll often need an if for $$$x == 1$$$. While popcount is often needed, I rarely use the other two functions. During a contest, I would solve the two tasks above in $$$O(\log x)$$$ with simple while-loops, because it's easier and more intuitive for me. Just be aware that these can be done in $$$O(1)$$$, and use clz or ctz if you need to speed up your solution. Motivation behind bitsets Consider this problem: There are $$$N \leq 5000$$$ workers. Each worker is available during some days of this month (which has 30 days). For each worker, you are given a set of numbers, each from interval $$$[1, 30]$$$, representing his/her availability. You need to assign an important project to two workers but they will be able to work on the project only when they are both available. Find two workers that are best for the job — maximize the number of days when both these workers are available. You can compute the intersection of two workers (two sets) in $$$O(30)$$$ by using e.g. two pointers for two sorted sequences. Doing that for every pair of workers is $$$O(N^2 \cdot 30)$$$, slightly too slow. We can think about the availability of a worker as a binary string of length $$$30$$$, which can be stored in a single int. With this representation, we can count the intersection size in $$$O(1)$$$ by using __builtin_popcount(x[i] & x[j]). The complexity becomes $$$O(N^2)$$$, fast enough. What if we are given the availability for the whole year or in general for $$$D$$$ days? We can handle $$$D \leq 64$$$ in a single unsigned long long, what about bigger $$$D$$$? We can split $$$D$$$ days into convenient parts of size $$$64$$$ and store the availability of a single worker in an array of $$$\frac{D}{64}$$$ unsigned long longs. Then, the intersection can be computed in $$$O(\frac{D}{64})$$$ and the whole complexity is $$$O(N^2 \cdot \frac{D}{64})$$$. const int K = MAX_D / 64 + 1; unsigned long long x[MAX_N][K]; int intersection(int i, int j) { int total = 0; for(int z = 0; z < K; z++) { total += __builtin_popcountll(x[i][z] & x[j][z]); } return total; } So, we can simulate a long binary number with multiple unsigned long longs. The implementation isn't that bad but doing binary shifts would be quite ugly. Turns out all of this can be done with bitsets easily. Bitsets bitset<365> is a binary number with $$$365$$$ bits available, and it supports most of binary operations. The code above changes into simple: bitset<MAX_D> x[MAX_N]; int intersection(int i, int j) { return (x[i] & x[j]).count(); } Some functions differ, e.g. x.count() instead of __builtin_popcount(x) but it's only more convenient. You can read and print binary numbers, construct a bitset from int or string bitset<100> a(17); bitset<100> b("1010");. You can even access particular bits with b[i]. Read more in C++ reference. Note that the size of the bitset must be a constant number. You can't read $$$n$$$ and then declare bitset<n> john;. If $$$n$$$ is up to $$$100$$$, just create bitset<100>. The complexity of bitwise operations is $$$O(\frac{size}{32})$$$ or $$$O(\frac{size}{64})$$$, it depends on the architecture of your computer. Problems P1. Different numbers — You are given a sequence of $$$N \leq 10^7$$$ numbers, each from interval $$$[0, 10^9]$$$. How many different values appear in the sequence? Don't use set or unordered_set because they quite slow. Create bitset<1000000001> visited, mark every given number visited[x] = 1, and print visited.count(). The time complexity is $$$O(N + \frac{MAX\_X}{32})$$$, space is $$$O(\frac{MAX\_X}{32})$$$. This will use 128 MB memory (one billion bits). Creating a boolean array instead would take 1GB because one element of this array takes the whole byte. Remember that bitset is more memory-optimized than a boolean array! An alternative solution is to use vector<bool> b(1000000001) because it's memory-optimized too, so takes 128 MB. It doesn't have a count() method but it isn't necessary if you do if(!b[x]) { count++; b[x] = 1; }. P2. Knapsack — You are given $$$N \leq 1000$$$ items, each with some weight $$$w_i$$$. Is there a subset of items with total weight exactly $$$W \leq 10^6$$$? Standard knapsack with boolean array would be $$$O(N \cdot W)$$$, too slow. bool can[MAX_W]; int main() { int n, W; cin >> n >> W; can[0] = true; for(int id = 0; id < n; id++) { int x; cin >> x; for(int i = W; i >= x; i--) { if(can[i-x]) can[i] = true; } } puts(can[W] ? "YES" : "NO"); } Instead of using a boolean array, let's use bitsets and binary shifting to get $$$O(\frac{N \cdot W}{32})$$$. You don't need to know bitsets to see how this would work for $$$W \leq 32$$$ and a bitmask unsigned long long can;, and here we just do it for a longer bitmask. bitset<MAX_W> can; int main() { int n, W; cin >> n >> W; can[0] = true; for(int id = 0; id < n; id++) { int x; cin >> x; can = can | (can << x); // or just: can |= (can << x); } puts(can[W] ? "YES" : "NO"); P3. Triangles in a graph — Given a graph with $$$n \leq 2000$$$ vertices and $$$m \leq n \cdot (n - 1) / 2$$$ edges, count triples of vertices $$$a, b, c$$$ such that there are edges $$$a-b$$$, $$$a-c$$$ and $$$b-c$$$. Represent adjacency of a vertex in bitmask. P4. Chef and Queries — (easy) P5. Odd Topic — (medium), thanks to Not-Afraid for the suggestion P6. Funny Gnomes — (hard) Bonuses 1) m & (m-1) turns off the lowest bit that was set to $$$1$$$ in a positive number $$$m$$$. For example, we get $$$24$$$ for $$$m = 26$$$, as $$$11010$$$ changes into $$$11000$$$. Explanation on quora 2) A quite similar trick allows us to iterate efficiently over all submasks of a mask, article on cp-algorithms / e-maxx. This article also explains why masks-submasks iteration is $$$O(3^n)$$$. 3) DP on broken profile (grid dp) — 4) SOS dp (sum over subset) — & 5) _Find_next function and complexity notation for bitsets — I will add links to some problems in online judges, feel free to suggest some in the comments. I think that bonuses 3 and 4 lack some explanation with drawings, maybe I will make some soon.
https://codeforces.com/blog/entry/73558
CC-MAIN-2020-50
refinedweb
1,226
72.46
Hi I open A new unity 2018.1.6f1 File with the Newst Playmaker & Vuforia for Playmaker from the Ecosystem. accept the playmaker & vuforia thier is no other data in the file when I hit play Button this error is written on the console: Assets/PlayMaker Vuforia/Actions/VuforiaGetExtendedTracking.cs(28,3): error CS0246: The type or namespace name `IEditDataSetBehaviour' could not be found. Are you missing an assembly reference? I am working with vuforia 7.2 & playmaker 1.9 Need your advice asap Inbal Hello Inbal, I cannot comment on Playmaker, but can you please confirm that you have enable Vuforia Support in Player Settings -> XR Settings? Thanks, Vuforia Engine Support
https://developer.vuforia.com/forum/creating-ar-trackables/vuforia-playmaker-unity-201818f
CC-MAIN-2021-21
refinedweb
112
51.55
Modern processors are equipped with sophisticated branch prediction algorithms (the Pentium family, for example, can predict a vast array of patterns of jumps taken/not taken) but if they, for some reason, mispredict the next jump, the performance can take quite a hit. Branching to an unexpected location means flushing the pipelines, prefetching new instructions, etc, leading to a stall that lasts for many tens of cycles. In order to avoid such dreadful stalls, one can use a branchless equivalent, that is, a code transformed to remove the if-then-elses and therefore jump prediction uncertainties. Let us start by a simple function, the integer abs( ) function. abs, for absolute value, returns… well, the absolute value of its argument. A straightforward implementation of abs( ) in the C programming language could be inline unsigned int abs(int x) { return (x<0) ? -x : x; } Which is simple enough but contains a hidden if-then-else. As the argument, x, isn’t all that likely to follow a pattern that the branch prediction unit can detect, the simple function becomes potentially costly as the jump will be mispredicted quite often. How can we remove the if-then-else, then? Let us first introduce the sex( ) helper function—I still use the mnemonic sex to amuse and chock friends and coworkers, but it comes from a Motorola 6809 instruction, sign extend. The sex function will return an integer where the sign bit of its argument have been copied in all the bits. For example, sex(321)=0, but sex(-3)=0xff...ff. This function is ideal to generate a mask based on the sign of the argument. Of course, sex must be branchless to be of any use to us. At the assembly language level the instruction exists on most processors (it is one of the cbw (convert byte to word), cwd (convert word to double word), etc, instructions on x86/AMD64), but what can we do at the C language level to force the compiler to use the specialized instruction, or at least an efficient replacement? One can use the right shift operator: inline unsigned int sex(int x) { return x >> (CHAR_BIT*sizeof(int)-1); } where the (compile-time) safe expression (CHAR_BIT*sizeof(int)-1) evaluates to 15, 31, or 63 depending on the size of integers on the target computer (CHAR_BIT comes from limits.h, and is worth 8, most of the times). However, this one-liner relies on the underlying processor’s shift instruction which, in some case, can be dreadfully slow (a few cycles for each bit shifted in micro-controllers) or very fast (one cycle simultaneously executed with other instructions in bigger processors). One can also use an union, which will compile to memory manipulation instructions, completely removing shifts from the function: inline int sex(int x) { union { // let us suppose long is twice as wide as int long w; // should be hi,lo on a big endian machine struct { int lo, hi; } } z = { .w=x }; return z.hi; } This will basically force the compiler to use the cbw family of instructions. Let us rewrite abs using sex: inline unsigned int abs(int x) { return (x ^ sex(x)) - sex(x); } Now, how does that work? If x is negative, sex(x) will be 0xff...ff, what is, filled with ones. If x is not negative (zero or positive), sex(x) will be zero. So, if the number of negative, it computes its two’s complement, otherwise leaves it unchanged. For example, if x is negative, say -3 (no point in using large, weird, numbers here), sex(-3) is 0xff...ff and -3 ^ 0xff...ff is the same as ~(-3), the bitwise negation of -3. Then, we subtract -1 (which is the same as adding 1), computing ~(-3)+1 which is the correct two’s complement. If on the other hand x is positive (or null), sex(x) evaluates to zero, and lo! (x ^ 0)-0 = x, which leaves the value of x unchanged! Of course, when compiling the above abs function the compiler generates very little code, especially when one uses the union version of sex. For example, on Intel x86, it could compile down to abs: cdq eax xor eax,edx sub eax,edx assuming the value is already in (and returned by) eax. The cdq instruction sign-extends eax into the edx register: it promotes a 32 bits value to a 64 bits value held in edx:eax. Now, we can use sex for other if-then-else type function. Take min and max for example. The pair is usually implemented as inline int min(int a, int b) { return (a<b) ? a : b; } inline int max(int a, int b) { return (a>b) ? a : b; } Using sex, the pair becomes inline int min(int a, int b) { return b + ((a-b) & sex(a-b)); } inline int max(int a, int b) { return a + ((b-a) & ~sex(b-a)); } which are now thoroughly branchless. Hurray! Can you think of other common, simple functions, what would benefit from branch removal? You have “(x ^ 0)=0 = x” at one point; it should be “(x ^ 0)-0 = x” Lots and lots of these here: Nice posting! Thanks. You should look at teh booke Hacker’s Delight, by Henry S. Warren Jr. (Addison-Wesley, 2003). Its companion website is. It has non-branching methods for integral comparisons, including methods optimized for PowerPC machine language. It features odd and stunning ways to reverse the bits in a byte or word. And, it has non-branching ways to do integral division by small integers using only bit shifts and addition. hi, I think the expression (x ^ 0)=0 = x, should be corrected to (x ^ 0)-0 = x (x^0)=0 have been corrected. Thanks you two for spotting the typo. Is there a reason you’re not just setting the sign bit to 0? I know about the book, I have it on my shelve! For sex, for example, he proproses (x>0)-(x<0) which cannot be efficiently implemented if your processor lacks predicated movs. But while the book is a treasure trove, I find it somewhat not as well explained as it could be, nor as visual as it should be. I intend to present some of the stuff in a much more visual fashion. I’m not sure in reference to what step you ask why we can’t just turn the sign bit to 0, but the general reason is that the number representation is two’s-complement. In two’s complement, the sign bit is set if the number is negative, but setting the bit to zero doesn’t give you abs(x), but abs(x-1). Two’s-complement arithmetic is based on modular arithmetic. On n bits, -1 is not 0x800…0, buf 0xff…ff. so, any number + 0xff…fff (modulo 2^n) is the same as the number minus 1 (modulo 2^n). See, for example:'s_complement Thanks for the article, i enjoyed it. You should make sure abs returns an unsigned otherwise abs(INT_MIN) will fail. And, as you probably know, the code is not portable as C (stupidly, IMO) allows for three different implementations of signed integers and leaves signed integer overflow undefined …which then gets abused by gcc language lawyers. see: To avoid any misunderstandings, i used the words ‘not portable’ in a very wide sense, as i believe all currently used processors and C compilers use 2’s-complement so in practice it is a non-issue. It’s just one of my pet peeves about C. You’re right on both counts (I corrected it, including the other one). While you are correct at pointing this, compilers however revert to expected behavior when undefined behaviors occurs. I’ve never seen a compiler not wrapping around, nor, for exemple, not honoring signed/unsigned shift-rights. This kind of pitfall will, I think, play an important role when I’ll be writing about (non-)portability. That is what i always thought, too. Unfortunately, this is not true for e.g. gcc. See: I think my previous comment was eaten up. Gcc unfortunately considers it ok for undefined behavior to result in unexpected behavior: Hacker’s Delight ('s+Delight&pg=PP1&ots=UTozQTQwJG&sig=RrYNUKr81zvOkti-yYxxV9K99xM&hl=en&sa=X&oi=book_result&resnum=1&ct=result) has a lot of this stuff, among other (more esoteric) things. Read the link i posted above, you will see that this is not the case for gcc. Well, you’re right (and so is the other blog’s author). Gcc/g++ will “optimize” the function to false (or 0), but gcc/g++ is inconsistent. For example, it is readily verified that a piece of code like x=0x7ffffff0; cout << hex << x << endl; x+=0xff; cout << x << endl; produces 7fffffff0 800000ef which is a wrap around behavior. Icc (Intel’s C Compiler) makes the function return true, however, as it uses (correctly?) wrapping. Icc’s behavior is, maybe, more consistant. But that raises the question about how this difference affects larger program such as, say, codecs. One must wonder if the compiler would automatically do a better job using CMOV (on Intel)… cmov is a possibily too, but I think it’s about the same as the cwd-based solution. Using cmov, you’d get something like […] “sex” funkcija ir izvilkta no šī bloga. […] […] Further detailed reading about this technique here: Branchless Equivalents of Simple Functions. […]
https://hbfs.wordpress.com/2008/08/05/branchless-equivalents-of-simple-functions/
CC-MAIN-2015-40
refinedweb
1,579
62.07
Spec Sheet : Visual C# Spec Sheet is a Visual C# program that displays your computer’s hardware and software configuration data. It shows details of your Processor, RAM, Cache Memory, Secondary Memory, Removable drives, GPU, Bluetooth, Wifi, Ethernet, Printer, OS and several other things. What makes it even better is the fact that it is lightweight as well as portable. You don’t need to install it at all. Just copy the 25 KB executable to the computer whose specs you want to check. You can download Spec Sheet here, or keep reading below to know more about this awesome utility. This program requires .NET Framework 4.5 Spec Sheet As we mentioned above, Spec Sheet lists the hardware and OS specs of your Windows Computer. Microsoft Windows provides the System Information utility (msinfo32.exe), which displays the specs of your computer. However, it isn’t lightweight. Also, it displays too much data – most of which is unnecessary for a typical Windows user. Therefore, we decided to develop a program for displaying only the basic hardware and OS data, which is useful for every Windows user. That’s how the idea of the Spec Sheet originated. How does the Spec Sheet work? The Spec Sheet window uses a TabControl control with 7 tab pages namely, Processor, Memory, Graphics, Audio, Network, Printer and OS (as you can see in the screenshots section below). The titles of these tab pages are self-explanatory. However, we’ve listed them below for the sake of explanation : - Processor – This tab page shows the details of your processor(s), viz. Processor Name, Architecture, Clock Speed, No. of Cores etc. - Memory – This tab page shows the details of your RAM, Cache Memory and Hard Disk/SSD. You have to choose one of the three options – PhysicalMemory (RAM), CacheMemory (Cache) and LogicalDisk (Hard Disk/SSD) from the combo box on this page. - Graphics – This tab page shows the details of the Graphics card present in your computer (in case of single GPU). If there are multiple Graphics cards, the card which is currently active on your computer is displayed. - Audio – This tab page shows the details of the Audio device(s) installed in your computer. - Network – This tab page shows the details of the various networking devices present in your computer, like the Bluetooth device, the Wifi card, Ethernet etc. - Printer – This tab page shows the details of the printer(s) and fax device(s) installed on your computer. - OS – This is the last tab page and it displays various details of the Operating System currently installed on your computer. Please Note that some fields may display the text – <<<No Information Available>>>. This is because the values for these fields were not provided by the Operating System in your case. You should not worry about that. It’s normal and not the fault of the Spec Sheet program or your computer. Spec Sheet – Design The Spec Sheet uses some classes from the System.Management namespace. These classes are MangementObject, ManagementObjectSearcher and PropertyData. The ManagementObjectSearcher class is used for searching for data using “keys” viz. Win32_Processor. The ManagementObject class is used for viewing the contents of the data received from ManagementObjectSeacher. The PropertyData class is used for displaying the data in the ListView Control. The details of how this is accomplished can be understood by viewing the source code of the Spec Sheet, which can be downloaded from the Downloads section below. Screenshots of Spec Sheet Spec Sheet – Processor Spec Sheet – RAM Spec Sheet – Hard Disk/SSD Spec Sheet Downloads Click here to download the source code of this program (92 KB). Click here to download only the executable of this program (25 KB). This program requires .NET Framework 4.5 If you like this program, SHARE IT with your friends and colleagues and help others find this COOL program. Also, if you have any suggestions for improving this program, do let us know. Nice program. I’m not a programmer but still I love your projects. These programs are quite useful to me. This one and the document reader were really awesome. Hi, Manoj. It’s good to know that we’re helping non-programmers as well. In fact, recently we have been trying to design our posts so that they are useful for everyone. This is a really cool program. I think it’s even better than msinfo. Any suggestions to make it better? It’s good enough for me. 🙂 Wonderful program! The hardware specs shown by this program helps me compare different PCs easily. That’s great 🙂 That’s exactly what this program was intended for – Comparing specs…
https://www.wincodebits.in/2016/02/spec-sheet-visual-c.html
CC-MAIN-2018-34
refinedweb
772
66.44
Watch some penguins on the livecam! Become a Premium Member and unlock a new, free course in leading technologies each month. /** 1. define enums and structs in their own header files e.g. **/ enum Command { MOVE_LEFT, MOVE_RIGHT, etc. }; /** 2. include it in both unmanaged and managed projects **/ /// unmanaged_cmd.h namespace native_proj { #include "Command.h" } /// managed_cmd.h (managed C++ bridge) namespace bridge { public #include "Command.h" } // at this point there should be two Command types native_proj::Command and bridge::Command /** 3. use it in C# **/ namespace UI { class derived_form : Form { void some_method() { sendCommand(bridge.Command.MOVE_LEFT, input_args, output_results); } } } Add your voice to the tech community where 5M+ people just like you are talking about what matters. If you are experiencing a similar issue, please ask a related question Join the community of 500,000 technology professionals and ask your questions.
https://www.experts-exchange.com/questions/23806631/Sharing-types-between-unmanaged-and-managed-languages.html
CC-MAIN-2017-26
refinedweb
139
59.7
Type: Posts; User: cegparamesh Here is the code: #include <iostream> using namespace std; class base { public: virtual void printbase() Thank You friends. How would i use the static cast? When i do like this, error message comes up. Base *b = static_cast<Derived*>(&reference_variable)->DerivedMember(arguments); Thank... Friends, Can a base class reference be used to access derived class-specific members? Note that the members are not part of the base class, only part of the derived class. Thank You, ... Paul, you are such a nice person!!! What a wonderful help you provided to a newbie. Keep it up. and Thanks. I am using Visual C++ 7, and got the problem solved. Paramesh. Paul, I rebuilded and found no change. I am testing the right dll. The ordinal number it showed is 0x0001. and i left a space between the function name and ordinal. I dont know how stupid i... Paul, I have added the DEF file to the project workspace. I changed the EXPORTS fact to all possible values. No use. The name is still _fact@4. It seems that the DEF file is not recognized... Paul, Thank you. I downloaded the depends.exe and found that the name of the function is not fact. it is: _fact@4 Now, the program runs fine. But still, i have one question: Why didnt the... Paul, You are a great helper! I thought you would just ignore my request. Anyway. Here is my total thingy: DLL: fact.cpp: extern "C" int __declspec(dllexport) __stdcall I already have the def file created! But it still gives me the runtime exception. When i tried to run the same program in Dev C++, it gave me no error.(irrelevant to the forum!) Can you give... Thank You for your reply paul. In that case, how would i call the dll? When i do like this: typedef int (WINAPI*function)(int); function fact; Thank you very much Paul. Sorry for my mistake. :D Paul. Thank you for your replies. But your suggestion gave me two errors: fact.cpp(3) : warning C4518: 'int ' : storage-class or type specifier(s) unexpected here; ignored fact.cpp(3) :... I tried that also. But of no use. Any other ideas? PS: (Paul. It would be <cstring> instead of <string. :) Never mind) Hello friends, When i try this simple program in Visual C++: #include<iostream> using namespace std; int main() { string s; Hello friends, I created a simple dll. The code in the dll is : extern "C" __declspec(dllexport) int fact(int n) { int i, fac; for(i = 2, fac = 1; i <= n; i++) I am back. :D go to general discussion this thread is becoming boring. Great! Do this right away. About the lol smiley. Its too dark to see its laughing. may be change that color to yellow or any light color? happy bday. :D I am going to think of a strategy to win this one. :lol: Microsoft has combined the strength of its three most powerful operating systems to create the next generation operating System: :D ... I'm Back. :grin:
http://forums.codeguru.com/search.php?s=761a92a04b83464ce620ec4ef1f9d56c&searchid=9125345
CC-MAIN-2016-30
refinedweb
512
87.31
Details Description Verify and correct existing error handling on 0-10 CLIENT codepath: - whats the structure and how does it compare with whats there on the 0-9 codepath ? - do errors thrown to the client from the broker have the correct result on an open connection/session/producer/consumer ? - is logging correctly implemented ? Activity - All - Work Log - History - Activity - Transitions First of all, thanks for doing this. I have been meaning to do this for a while now. I have the following questions about the patch. In @@ -139,36 +139,24 @@ public class BasicMessageConsumer_0_10 ... you have added the following code. + if (isMessageListenerSet() && capacity == 0) + + _logger.debug("messageOk, trying to notify"); + super.notifyMessage(jmsMessage); 1. What is the reason for adding this? 2. How is this related to exception handling? (or is this part of some other JIRA that got accidentally added to this patch ?) 3. Have you run the tests against the 0-10 cpp broker profiles? In general If any code is modified in the 0-10 client side, I'd like to kindly request that the 0-10 cpp broker test profiles are run before the patch is committed. Ah my bad, there was a local modification in my code when the patch was applied, and due to that I misunderstood that particular code segment. I failed to realize that you had merely rearranged the code there. Btw question (3) still stands Updated with fixes for close race condition.
https://issues.apache.org/jira/browse/QPID-2657
CC-MAIN-2017-09
refinedweb
241
67.15
Subclass of QTextEdit makes the program to crash - davidesalvetti last edited by davidesalvetti Hi, I'm having problem with a subclass of QTextEdit. First of all I had to subclass QTextEdit because I need the 'editingFinish' signal that is not supported by QTextEdit. But now I don't understand why this new class is causing the crash. I'll try to make you understand better with the code. qcustomtextedit.h class QCustomTextEdit : public QTextEdit { Q_OBJECT public: QCustomTextEdit( QWidget *parent = 0):QTextEdit(parent) { } signals: void editingFinished(QString); protected: void focusOutEvent(QFocusEvent *e) { QTextEdit::focusOutEvent(e); emit editingFinished(this->toPlainText()); } }; archivio.h #include "qcustomtextedit.h" namespace Ui { class Archivio; } class Archivio : public QMainWindow { Q_OBJECT public: explicit Archivio(QWidget *parent = 0); ~Archivio(); public slots: void on_PushButton_clicked(); void textedit_editingFinished(QString); private: Ui::Archivio *ui; QCustomTextEdit *textedit; }; archivio.cpp Archivio::Archivio(QWidget *parent) : QMainWindow(parent), ui(new Ui::Archivio) { ui->setupUi(this); setAttribute(Qt::WA_DeleteOnClose); ArchivioAperto = true; textedit = new QCustomTextEdit; textedit->setStyleSheet("*{background-color:white; color:black;}"); QVBoxLayout *layout = new QVBoxLayout(ui->frame_3); layout->addWidget(textedit); layout->setSpacing(0); layout->setMargin(0); layout->setContentsMargins(0,0,0,0); ui->frame_3->setLayout(layout); connect(textedit, SIGNAL(editingFinished(QString)), this, SLOT(textedit_editingFinished(QString))); } void Archivio::on_PushButton_clicked() { qDebug() << "HERE4"; QFile note("C:/Progetti/QT_Project"+ "/Note.txt"); if(note.open(QIODevice::ReadOnly)) { qDebug() << "HERE5"; QByteArray baNote = note.readAll(); qDebug() << "HERE8"; textedit->setText(QString(baNote));//the program crashes here note.close(); qDebug() << "HERE6"; } else { } } void Archivio::textedit_editingFinished(QString message) { qDebug() << message; QFile o_filenote("C:/Progetti/QT_Project"+ "/Note.txt"); o_filenote.remove(); QFile n_filenote("C:/Progetti/QT_Project" + "/Note.txt"); if(n_filenote.open(QIODevice::WriteOnly)) { n_filenote.write(message.toLatin1()); n_filenote.close(); } } I cannot understand how the textedit object can be 0x0 after I have created the Archivio class. Have I made some mistake while creating the subclass? The interesting thing is that when I launch the debugger everything works fine, I have problems only if I don't launch the program from it. Thanks in advance! - SGaist Lifetime Qt Champion last edited by Hi, From the looks of it, you didn't show all your code. Do you have somewhere another assignment to that variable ? On an unrelated note, there's no need for the call to clearsince you are calling setTextwhich replaces the content of the text edit. - davidesalvetti last edited by davidesalvetti @SGaist I have updated the code with all the instance of 'textedit', I'm sorry to make you lose time but I can't show all the code. Anyway these are ALL the instances of 'textedit' so it should be enough, am I wrong? @SGaist said in Subclass of QTextEdit makes the program to crash: On an unrelated note, there's no need for the call to clearsince you are calling setTextwhich replaces the content of the text edit. Yes, you are right, I tried it just because maybe the problem was not the textedit object but the textedit->setText()function. I just tried it without the clearbut it crashes the same way. Maybe is something in the subclass? I can't even try to understand better the problem launching the Debugger engine because with it everything works. Can it be a problem of optimizations? @davidesalvetti Hi, I don't think the code you show which can cause a crash. I have few remarks from your code: Don't set a parent to a QWidget or a QLayout when you put them in another layouts. textedit = new QCustomTextEdit; QVBoxLayout *layout = new QVBoxLayout; ... layout->addWidget(textedit); //layout becomes the parent of textedit ui->frame_3->setLayout(layout); //frame_3 becomes the parent of layout - You need to call QWidget::focusOutEvent() in focusOutEvent(), otherwise your textedit will never lose focus void focusOutEvent(QFocusEvent *e) { QWidget::focusOutEvent(e); emit editingFinished(this->toPlainText()); } @Gojir4 Thank you for your answer! I modify my code with your advice, but the problem is still there... What should it be if not the 'textedit'? I mean, if I comment the line of 'textedit->setText()' everything works fine. The last qDebugmessage is "HERE8". Have you got any other idea? I don't know why with the debugger engine evrything works, this is a strange thing, don't you think? - jsulm Lifetime Qt Champion last edited by @davidesalvetti said in Subclass of QTextEdit makes the program to crash: textedit->setText() Set a break point at this line and start debugging. If it stops at that line check the values of the variables, then execute the line and check what exactly is the crash (SIGSEGV, ...?). You can post the stacktrace after crash here. @Gojir4 said in Subclass of QTextEdit makes the program to crash: QWidget::focusOutEvent(e); I was wrong here, you have to call QTextEdit::focusOutEvent(e);, sorry @davidesalvetti Actually I have tested your QCustomTextEdit class and I don't have any crash with it, so, as @SGaist suggested, I think it's coming from somewhere else in your code too. @jsulm It would be the right solution if the crash would still remain also after starting the debugging. When I use the debugging everything works fine, no crash. That's why I think it's some kind of optimization that is causing the problem. I think it's some kind of optimization that is causing the problem. Don't blame the compiler, we all do and it's never its fault ui->frame_3->setLayout(layout);is useless. remove it - before QVBoxLayout *layout = new QVBoxLayout(ui->frame_3);add Q_ASSERT(!ui->frame_3->layout());to make sure you don't have a layout already - after qDebug() << "HERE8";add if(!textedit) qDebug("textedit is NULL!"); - in the constructor add connect(textedit,&QObject::destroyed,[](){qDebug("textedit was destroyed!");});to check if it gets deleted @VRonin Thanks for your answer. I updated my code with your changes, this is the debug output: HERE4 HERE5 and then the crash...I don't understand :/ It crashes every time I call the textedit object. After "HERE5" there is the code line if(!textedit) qDebug() << "textedit is NULL!"; qDebug() << "HERE8" << textedit; But these message are not shown in the application output. - J.Hilk Moderators last edited by J.Hilk create your Pointer with a nullptr set private: Ui::Archivio *ui; QCustomTextEdit *textedit = nullptr; then it's created pointed to 0 and only changes when you newit, in case your function is called before the customTextEdit could be created. As an experiment you could also just try with a normal QTextEditrather than a QCustomTextEdit @J.Hilk Thanks for your answer. I tried but no changes, it's still crashing. Anyway I don't know if this could be usefull but I've seen that sometimes it works right just for the first time I click the button, then I close the 'Archivio' and then I reopen it and clicking again on the button makes the crash. - J.Hilk Moderators last edited by @davidesalvetti from the code example I can see that you have a ui-file for your class, why don't you Promote your CustomWidget in the Desginer and let Qt's internal manage the creation and destruction of the object? @VRonin I just tried it. Creating the QTextEdit object from the constructor doesn't make change to the behaviour of the program. Is it possible that the problem is in how I create and put into the layout the Object? If I create the QTexteEdit from the layout it works perfectly. @J.Hilk That made the trick! I din't know about promoting custom widget, but it worked! So there must be something wrong in the way I've put the object into the layout and into the frame. If somebody knows what is the problem is welcome so that I can avoid it the next times. Anyway the topic is solved, thank you all.
https://forum.qt.io/topic/92225/subclass-of-qtextedit-makes-the-program-to-crash
CC-MAIN-2022-27
refinedweb
1,286
55.64
OOPS concepts Tutorial Summary: By the end of this tutorial "OOPS concepts Tutorial", you will understand the meaning of OOPS concepts. Three basic concepts of OOPS - Abstraction - Encapsulation - Polymorphism 1. Abstraction Abstraction means using the equipment (or code) without knowing the details of working. For example, you are using your mobile phone without knowing how a mobile operates internally. Just a click on a button connects to your friend. This is abstraction. That is, the details of mobile mechanism are abstracted. Similarly we use the code of somebody to get the functionality without knowing how the code is written or working. For example, you are using printf() function to write to the DOS prompt without the awareness of what the code of printf(). One of the ways of achieving abstraction is inheritance. Through inheritance a subclass can use the super class methods as if they belong to it without caring their implementation details. 2. Encapsulation Object-oriented concepts borrowed many terms from other technologies like encapsulation (from pharmaceuticals), inheritance (from biology), cloning (from genetics) and polymorphism (from biology) etc. Placing a powdered drug in a gelatin capsule and sealing it is known as encapsulation. With encapsulation, a Pharmacist hides the properties of a drug like its taste and color from the patient. Similar meaning is in OOPs also. Encapsulation hides the implementation details of coding; other way it is abstraction. With abstraction, implementation of information is hidden. In a programming language, variables represent the properties and methods are used to change the properties. For example, the speed variable represent the property of a motor car and the method accelerator() is used to change the speed. Objects are used to call the methods. There may be multiple motor cars and every car has its own speed. Here, motor car represents an object. Every object encapsulates its own data. This encapsulation concept takes OOP languages a lead over traditional procedure-oriented languages. Binding data with objects (generally through method calls) is known as encapsulation. In encapsulation, to have control over the manipulation of data (not to feed wrong data, for example, the speed cannot be negative) by other classes, a programmer declares variables as private and methods as public. Other classes can access the private variables through public methods. With encapsulation, every object maintains its own data and this data is entirely private to that object. Other objects cannot access or modify the data. 3. Polymorphism Polymorphism is a Greek term and means many forms of the same ("poly" means many and "morphism" means forms). It is an OOP paradigm where one method can be made to give different outputs (functionalities) when called at different times. Polymorphism is two ways – static polymorphism where methods are binded at compile time and dynamic polymorphism where methods are binded dynamically at runtime. The same person is called as an officer (in office), husband (in house) and player (in cricket team). The person can be treated as base class. Extra subclasses can be added by hierarchical inheritance like son etc. Hello sir, I am unable to understand polymorphism. Can you describe the word polymorphism? In real life, a woman is polymorphic. For a son, she is mother, for a husband she is wife, for a father she is daughter etc. The same woman does different jobs with different people. This we called as polymorphism. Same way, the same method can do different jobs like calculating triangle area, rectangle area etc, Sir I am a fresher Student with moderate level of knowledge in java and willing to join your prestigious java classes. please help me. I’ll thought my self if i ever get a chance to attend your class. Are you at Hyderabad? Sir, encapsulation in other way is abstraction. With abstraction, implementation of information is hidden. I didn’t get this point clearly sir, Could you please explain a little bit more ? Thanks Thank you so much….. You save my life.! this is what i’m looking for… thank u so much. reaaly good to learn java here thank you nageswarao sir. public class Person { String name; int age; void talk() { System.out.println(“hello I am “+name); System.out.println(“hello my age “+age); } } class Demo125 { public static void main(String[] args) { Person p=new Person(); p.name=”mohan”; p.age=25; p.talk(); System.out.println(“hashcode(reference) of object= “+p.hashCode()); } } error:class Person is public ,should be declared in a file named Person.java public class Person ^ plz rectify the problem why can’t i use public or protected there .thank you Just do one simple thing… Create a separate file for both Person.java and Demo.java declare both class as public.. or just change the access specifier of Person as default and Demo125 as Public and save the entire file with name Demo125.java.. Your program will definitely run… it very good site to learn java
http://way2java.com/oops-concepts/oops-concepts-introduction/
CC-MAIN-2017-13
refinedweb
817
58.79
Created on 2008-09-04 00:23 by djmdjm, last changed 2009-04-02 03:57 by jnoller. This issue is now closed. test_multiprocessing crashes on platforms that lack a working sem_open(), despite it being turned off at compilation time by setting HAVE_SEM_OPEN=0 in the Extension macros in setup.py I think the multiprocessing module should disable the functionality gracefully when it is missing from _multiprocessing. Failure message: test test_multiprocessing crashed -- <type 'exceptions.AttributeError'>: 'module' object has no attribute 'SemLock' Traceback (most recent call last): File ".//Lib/test/regrtest.py", line 556, in runtest_inner indirect_test() File "/usr/ports/lang/python/2.6/w-Python-2.6b3/Python-2.6b3/Lib/test/test_multiprocessing.py", line 1758, in test_main ProcessesMixin.pool = multiprocessing.Pool(4) File "/usr/ports/lang/python/2.6/w-Python-2.6b3/Python-2.6b3/Lib/multiprocessing/__init__.py", line 226, in Pool return Pool(processes, initializer, initargs) File "/usr/ports/lang/python/2.6/w-Python-2.6b3/Python-2.6b3/Lib/multiprocessing/pool.py", line 84, in __init__ self._setup_queues() File "/usr/ports/lang/python/2.6/w-Python-2.6b3/Python-2.6b3/Lib/multiprocessing/pool.py", line 130, in _setup_queues from .queues import SimpleQueue File "/usr/ports/lang/python/2.6/w-Python-2.6b3/Python-2.6b3/Lib/multiprocessing/queues.py", line 22, in <module> from multiprocessing.synchronize import Lock, BoundedSemaphore, Semaphore, Condition File "/usr/ports/lang/python/2.6/w-Python-2.6b3/Python-2.6b3/Lib/multiprocessing/synchronize.py", line 29, in <module> SEM_VALUE_MAX = _multiprocessing.SemLock.SEM_VALUE_MAX AttributeError: 'module' object has no attribute 'SemLock' 1 test failed: test_multiprocessing Which platforms is this appearing on? On Thu, 4 Sep 2008, Jesse Noller wrote: > > Jesse Noller <jnoller@gmail.com> added the comment: > > Which platforms is this appearing on? OpenBSD, with this section added to setup.py: @@ -1269,6 +1268,14 @@ class PyBuildExt(build_ext): ) libraries = [] + elif platform.startswith('openbsd'): + macros = dict( # OpenBSD + HAVE_SEM_OPEN=0, # Not implemented + HAVE_SEM_TIMEDWAIT=0, + HAVE_FD_TRANSFER=1, + ) + libraries = [] + else: # Linux and other unices macros = dict( HAVE_SEM_OPEN=1, 2.6rc1 shows the same failure traceback on FreeBSD 6.3, which is covered by a section of setup.py the same as Damien added for OpenBSD. So the bug is actually in the multiprocessing module rather than the unittest. If HAVE_SEM_OPEN is not defined then SemLock is never built into _multiprocessing.so, but multiprocessing/syncronize.py unconditionally depends on its presence. I guess _multiprocessing could always define a dummy SemLock or synchronize.py could check before it depends on it. (it would be great to see this fixed for 2.6) -d Bumping up _ I'll need help with a patch Looking at mp.synchronize, the whole module really does depend on a working _multiprocessing.SemLock instance. If these platforms don't have a native semaphore implementation, what is their basic inter-process synchronisation primitive? Once that is identified, then it should be possible to code either a C or Python semaphore implementation based on that primitive. For 2.6/3.0 it would probably be best to just disable the module entirely on platforms that lack shareable semaphores (OpenBSD & FreeBSD at least) Jesse, how much (if any) of the rest of the package will work without the synchronize module? If it isn't a lot, then it may be a matter of just making this a cleaner ImportError and an expected test suite skip on OpenBSD and FreeBSD. (Unfortunately, our OpenBSD and FreeBSD buildbots are so unreliable that they don't get much attention when they go red - it looks to me like the OpenBSD buildbot isn't even managing to build _multiprocessing at the moment, because HAVE_SEM_OPEN is incorrectly set to 1). I've done some more digging into this for the FreeBSD case. FreeBSD 6.3 and 7.0 both have sem_open, and the man pages suggest it should be fully functional. (see) There is a caveat on the length of the name, which I think could trigger if the counter variable passed into SEM_CREATE() is >9999. But as that variable seems like it can only ever be 0 (not sure this is intended!) this shouldn't happen as it stands. If I change HAVE_SEM_OPEN to 1 in setup.py, the _multiprocessing module builds, but test_multiprocessing provokes a core dump in both cases. The backtrace (on 6.3 i386) looks like: #0 0x2820ef17 in ksem_open () from /lib/libc.so.6 #1 0x2820592c in sem_open () from /lib/libc.so.6 #2 0x284494a0 in semlock_new (type=0x2844b380, args=0x836443c, kwds=0x0) at /home/andymac/build/python-svn/trunk-r66550/Modules/_multiprocessing/semaphore.c:439 #3 0x0809e710 in type_call (type=0x2844b380, args=0x836443c, kwds=0x0) at Objects/typeobject.c:731 #4 0x0806042a in PyObject_Call (func=0x2844b380, arg=0x836443c, kw=0x0) at Objects/abstract.c:2487 #5 0x080cc367 in PyEval_EvalFrameEx (f=0x84dd00c, throwflag=0) at Python/ceval.c:3890 #6 0x080cf9ac in PyEval_EvalCodeEx (co=0x8478800, globals=0x4e, locals=0xa00, args=0x819b02c, argcount=4, kws=0x0, kwcount=0, defs=0x0, defcount=0, closure=0x0) at Python/ceval.c:2942 #7 0x08123f84 in function_call (func=0x8486ca4, arg=0x82e107c, kw=0x0) at Objects/funcobject.c:524 #8 0x0806042a in PyObject_Call (func=0x8486ca4, arg=0x82e107c, kw=0x0) at Objects/abstract.c:2487 #9 0x08069c15 in instancemethod_call (func=0x4e, arg=0x82e107c, kw=0x0) at Objects/classobject.c:2579 #10 0x0806042a in PyObject_Call (func=0x84857ac, arg=0x82e107c, kw=0x0) at Objects/abstract.c:2487 #11 0x080cc367 in PyEval_EvalFrameEx (f=0x826140c, throwflag=0) at Python/ceval.c:3890 ---Type <return> to continue, or q <return> to quit--- On 7.0 amd64, the top of the backtrace scrolls off screen so I can't get the start of the trace (X not installed...). To try and remove threads from the equation, due to FreeBSD 6.3 having an issue with fork() in a threaded build (see issue3864 for more info), I configured without threads (ie ./configure --without-threads) and the _multiprocessing module fails to build: gcc -fPIC -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall-Wstrict-prototypes -DHAVE_SEM_OPEN=1 -DHAVE_FD_TRANSFER=1 -DHAVE_SEM_TIMEDWAIT=0 -IModules/_multiprocessing -I. -I/home/andymac/build/python-svn/trunk-r66550/./Include -I. -IInclude -I./Include -I/usr/local/include -I/home/andymac/build/python-svn/trunk-r66550/Include -I/home/andymac/build/python-svn/trunk-r66550 -c /home/andymac/build/python-svn/trunk-r66550/Modules/_multiprocessing/semaphore.c -o build/temp.freebsd-6.3-RELEASE-i386-2.6/home/andymac/build/python-svn/trunk-r66550/Modules/_mult iprocessing/semaphore.o /home/andymac/build/python-svn/trunk-r66550/Modules/_multiprocessing/semaphore.c: In function `semlock_acquire': /home/andymac/build/python-svn/trunk-r66550/Modules/_multiprocessing/semaphore.c:314: error: `_save' undeclared (first use in this function) /home/andymac/build/python-svn/trunk-r66550/Modules/_multiprocessing/semaphore.c:314: error: (Each undeclared identifier is reported only once /home/andymac/build/python-svn/trunk-r66550/Modules/_multiprocessing/semaphore.c:314: error: for each function it appears in.) It appears that some support is there for a single threaded build, but is incomplete (there's a similar problem in socket_connections.c, but the module build bails before then). If its not to be supported on single threaded builds (which would be a big shame in my opinion!) then the code should make this explicit, otherwise the single threaded build case needs to be fixed. I'm still trying to understand the core dump in the multithreaded build - unfortunately I'm not terribly familiar with gdb or with debugging from cores (and the actual failure appears to be triggering in the C library for which I currently don't appear to have symbols...) Any suggests on how/where to dig further on this? Oops - meant to add that the actual reported cause of the core dump is "Bad system call". Also, the OpenBSD man pages make clear that shared semaphores aren't supported and sem_open() doesn't exist: I've been thinking about this - Right now, having a working mp.synchronize module, and thread support is key to package currently. For 2.6 - it's really too late to try to mock up a working mp.synchronize module, or significantly change the package. My recommendation (I'm going to work on a patch to do this) is to not support fbsd/openbsd in this release cycle, which is unfortunate. Any other thoughts? Well, even if 2.6 slipped (which it is looking probably won't happen), how much time would you need to deal with this? Sounds like you just won't be able to get to it even with an extra week. So that means multiprocessing is just not supported on FreeBSD and OpenBSD at this moment. Sucks, but hopefully it can get fixed in the future. And if people complain, bug them to get a reliable buildbot going. Agreed - Jesse, can you work up a patch that generates a clean import error when _multiprocessing.SemLock can't be defined (due to HAVE_SEM_OPEN=0 or a single-threaded build), adds test_multiprocessing to the expected skips for FreeBSD and OpenBSD, and updates the multiprocessing docs to note the restriction to systems with a working sem_open() implementation? Improving the *BSD and single-threaded build compatibility of the multiprocessing package will just have to be high on the to-do list for 2.6.1. This may also be worth mentioning in the release notes - Barry's call on that one.. >>> looks good to me On Mon, Sep 29, 2008 at 11:20 AM, Jesse Noller <report@bugs.python.org> wrote: > > Jesse Noller <jnoller@gmail.com> added the comment: > >. Is "thereforce" an actual word? Otherwise it looks fine to me. > Is "thereforce" an actual word? Otherwise it looks fine to me. > Yeah, I caught that. Rather than disable the entire package, which would be frustrating to many - I've changed it to only disable mp.synchronize for now, patch is pending my final build and test/doc check locally Here's a patch, works on my machine. Please review it and make sure it satisfies what we've spoken about. Could use confirmation from Damien and Andrew that they now see the expected skips with the patch applied, but otherwise looks good to me. I can confirm that the patch works on OpenBSD -current. Only one nit: Does this line in Lib/test/test_multiprocessing.py need to be there? +#import multiprocessing.SemaphoreImportError On Sep 29, 2008, at 6:36 PM, Damien Miller <report@bugs.python.org> wrote: > > Damien Miller <djmdjm@users.sourceforge.net> added the comment: > > I can confirm that the patch works on OpenBSD -current. Only one nit: > > Does this line in Lib/test/test_multiprocessing.py need to be there? > > +#import multiprocessing.SemaphoreImportError > Oops - my bad. I'll remove it and check it tonight checked in r66688, lowering from rb to crit to address post 2.6 final The checked in change has the planned effect on FreeBSD 6.3 i386. I can't check on my 7.0 amd64 box as I can't quickly put a current source tree on it. POSIX semaphores should be fixed in 8-CURRENT, pending MFC. There are rtld + malloc issues in FreeBSD. Python multiprocessing's use of POSIX threads is not strictly POSIX compliant, as it tries to do a lot more than just call exec() or async-signal-safe POSIX APIs after fork()-ing. There is a degree of reluctance in the camp to fix for these reasons... In the meantime, you may wish to try building Python 2.6 on FreeBSD using GNU Pth, here is a patch: thanks! BMS Sorry, I hit the wrong bug Closing; we've removed hard-coded platform variables for a better autoconf approach. We currently skip the test suite on platforms which don't support or have what we need.
https://bugs.python.org/issue3770
CC-MAIN-2018-05
refinedweb
1,952
59.3
30 August 2011 08:01 [Source: ICIS news] By Clive Ong ?xml:namespace> SM buyers expect spot prices to slip next month on increased supply of the material, and with demand for downstream plastic resins usually waning towards the second half of September, as the seasonal peak in the Chinese manufacturing season for exports draws to a close. Limited availability of spot cargoes throughout August helped prop up SM prices at an average of around $1,510/tonne (€1,042/tonne) in August, against a backdrop of widely fluctuating crude prices, according to ICIS. Crude prices traded at a wide range of $76-87/bbl in August. Spot inventories along the eastern Chinese shore tanks were at 50,000-60,000 tonnes in August, compared to 70,000-85,0000 tonnes in July, market sources said. “[SM] supply in the region would most likely improve in September as some SM plants will come back on stream”, said a Korean trader. Shanghai Secco Petrochemical’s 500,000 tonne/year SM unit in eastern Elsewhere in Meanwhile, Zhenhai Lyondell Chemical’s 620,000 tonne/year SM plant restarted on 29 August after suffering an outage on 26 August because of technical problems, market sources said. Taiwan Styrene Monomer Corp’s 180,000 tonne/year No 1 line in Lin Yuan is expected to restart production in mid-September. Mechanical problems shut the plant in late July, market sources said. Meanwhile, Formosa Chemical and Fibre Corp’s 250,000 tonne/year No 1 unit and its 350,000 tonne/year No 2 unit in Mailiao have remained shut since mid-May, following a fire incident that hit the petrochemical complex of the Petrochemical Corporation of Meanwhile, Ellba Eastern Chemical’s 550,000 tonne/year SM plant at SM is a liquid chemical used to make plastic resins like polystyrene (PS) and acrylonitrile-butadiene-styrene (ABS), as well as synthetic rubbers. (
http://www.icis.com/Articles/2011/08/30/9488579/tight-asia-sm-supply-to-ease-as-plant-turnarounds-end-in-sept.html
CC-MAIN-2014-10
refinedweb
317
51.31
So, I decided to give it a go. This is the cpython code: info = GetSecurityInfo(GetCurrentProcess(),6,0) SetSecurityInfo(process, 6, win32.win32security.DACL_SECURITY_INFORMATION | win32.win32security.UNPROTECTED_DACL_SECURITY_INFORMATION, None, None, info.GetSecurityDescriptorDacl(), info.GetSecurityDescriptorGroup()) When I run in IronPython, the following happens: GetSecurityInfo returns an integer. This means I cannot do info.GetSecurityDescriptorDacl() etc If I leave out the last two (optional) parameters to SetSecurityInfo, I get a return code of 998. Looking this up in winerror.h gives ERROR_NOACCESS. This is not a rights problem afaik, since I am running ipy with Admin rights. Ok, so at this point, I thought "screw it, I'll do it in C#". So, my C# code is simple for testing: using System; namespace UnmanagedCode { public class processSecurity { public int getValue(int value) { return value + 1; } } } I compile it in VS2010 Express as a .NET Framework 4.0. I end up with a DLL file. I then copy that DLL into a clean directory, and launch ipy.exe in that directory. IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.4952 Type "help", "copyright", "credits" or "license" for more information. >>> import clr >>> clr.AddReferenceToFile("UnmanagedCode.dll") Traceback (most recent call last): File "<stdin>", line 1, in <module> IOError: System.IO.IOException: Could not add reference to assembly UnmanagedCode.dll So, I imported sys, and checked the path... the current directory is in the path. At this point, I cannot figure out wtf is wrong. I have looked and read and googled etc but the examples all seem to be outdated and 'just work'... but not when I attempt them! Some pointers as to how to get this working would be nice ! -Bye -Richard On Wed, Sep 22, 2010 at 2:20 PM, Lukas Cenovsky <cenovsky at bakalari.cz> wrote: > On 22.9.2010 20:03, Jeff Hardy wrote: > >. > > You can use clrtype instead of ctypes to call native functions - see > (Sample) ClrType.zip. > > -- > -- Lukáš > > _______________________________________________ > Users mailing list > Users at lists.ironpython.com > > >
https://mail.python.org/pipermail/ironpython-users/2010-September/013735.html
CC-MAIN-2017-17
refinedweb
332
53.07
XML Glossary .NET Framework 4.6 and 4.5 This glossary defines terms that pertain to XML standards. A - attribute - An XML structural construct. A name-value pair, separated by an equals sign, included inside a tagged element that modifies certain features of the element. All attribute values, including things like size and width, are in fact text strings and not numbers. For XML, all values must be enclosed in quotation marks. You can declare attributes for an XML element type using an attribute list declaration. C -. See also Extensible Stylesheet Language. - CDF - See Channel Definition Format (CDF). - Channel Definition Format (CDF) - An XML-based data format used in Microsoft® Internet Explorer 4.0 and later to describe Active Channel™ content and desktop components. CDF permits a Web publisher to offer frequently updated collections of information, or channels, enabling automatic delivery to compatible Web clients. The user only needs to choose the channel once, and scheduled deliveries of the channel information will be delivered to the client without further intervention. - character data - All the textual content of an element or attribute that is not markup. XML differentiates this plain text from binary data. In the XML OM, character data is stored in text nodes, which are implemented as DOM text objects. - complex data type - An element that can contain other elements or attributes. Also known as complex type. Appears as <complexType> in XML documents. - CSS - See Cascading Style Sheets (CSS). D - data island - An XML document (<XML> or <SCRIPT language="XML">). that exists within an HTML page. It allows you to script against the XML document without having to load it through script or through the <OBJECT> tag. Almost anything that can be in a well-formed XML document can be inside a data island. HTML is used as the primary document or display format, and XML is used to embed data within the document. - Data Source Object - Provides a way to bind HTML controls directly to an XML data island. It assists developers in connecting to structured XML data and supplying it to an HTML page by using the data-binding facility of dynamic HTML.. - data types - The parts and subparts of an XML schema that are used as the basis of all the larger components in schema. - definition - A description used to create simple and complex data types. - document element - The element in an XML document that contains all other elements. It is the top-level element of an XML document and must be the first element in the document. There is exactly one document element, no part of which appears in the content of any other element. The document element represents the document as a whole; every other element represents a component of the document. The terms root element and document element are interchangeable. - document entity - The starting point for an XML parser. Unlike other entities, the document entity has no name and cannot be referenced. It is the entity in which the XML declaration and document type declaration can occur. - Document Object Model (DOM) -. - document type declaration ->. - Document Type Definition (DTD) - Can accompany a document, essentially defining the rules of the document, such as which elements are present and the structural relationship between the elements. It defines what tags can go in your document, what tags can contain other tags, the number and sequence of the tags, the attributes your tags can have, and optionally, the values those attributes can have. DTDs help to validate the data when the receiving application does not have a built-in description of the incoming data. The DTD is declared within the document type declaration production of the XML file. With XML, however, DTDs are optional. See also schema. - DOM - See Document Object Model. - DTD - See Document Type Definition. E - EDI - See Electronic Data Interchange. - Electronic Data Interchange (EDI) - An existing format used to exchange data and support transactions. EDI transactions can be conducted only between sites that have been specifically set up with compatible systems. Proprietary EDI formats are more difficult to write than XML, and unlike XML, cannot be transmitted over HTTP. - element - An XML structural construct. An XML element consists of a start tag, an end tag, and the information between the tags, which is often referred to as the contents. Each element has a type, identified by name, sometimes called its "generic identifier" (GI), and may have a set of attribute specifications. Each attribute specification has a name and a value. An instance of an element is declared using <element> tags. Elements used in an XML file are described by a DTD or schema, either of which can provide a description of the structure of the data. - entity - An XML structural construct. A file, database record, or another item that contains data. The primary purpose of an entity is to hold content — not structure, rules, or grammar. Each entity is identified by a unique name and contains its own content, from a single character inside the document to a large file that exists outside the document. The function of an XML entity is similar to that of a macro definition. The entity can be referred to by an entity reference to insert the entity's contents into the tree at that point. Entity declarations occur in the DTD. - entity reference - An XML structural construct. Acts as a placeholder for the content author, and the XML parser places the actual content at each reference site. To include an entity reference, you first insert an ampersand (&) and then enter the entity name followed by a semicolon (;), as follows: &YourEntityName;. Then, when the line is processed, the entity will be replaced with the entity's content. It is used in much the same way as a macro. - Extensible Markup Language (XML) - A subset of SGML that is optimized for delivery over the Web, XML provides a uniform method for describing and exchanging structured data that is independent of applications or vendors. The key is that with XML, the information is in the document, while the rendering instructions are elsewhere. In other words, content and presentation are separate. XML is the Web's language for data interchange and HTML is the Web's language for rendering. At the time of this writing, XML 1.0 is a Worldwide Web Consortium Recommendation, which means that it is in the final stage of the approval process. - Extensible Stylesheet Language (XSL) - A language used to transform XML-based data into HTML or other presentation formats, for display in a Web browser. The transformation of XML into formats, such as HTML, is done in a declarative way, making it often easier and more accessible than through scripting. In addition, XSL uses XML as its syntax, freeing XML authors from having to learn another markup language. In contrast to CSS, which "decorates" the XML tree with formatting properties, XSL transforms the XML tree into a new tree (the HTML), allowing extensive reordering, generated text, and calculations — all without modification to the XML source. The source can be maintained from the perspective of "pure content" and can simultaneously be delivered to different channels or target audiences by just switching style sheets. XSL consists of two parts, a vocabulary for transformation and the XSL Formatting Objects. F - facet - A restriction on a data type. A single defining aspect of value space. There are two types of facets: fundamental and constraining. I - infoset - See XML information set. - invalid document - Documents that do not follow the XML tag rules. If a document has a DTD or schema, and it doesn't follow the rules defined in its DTD or schema, that document is invalid as well. M - mixed content - Element types with mixed content are allowed to hold either character data alone or character data interspersed with child elements. In this case, the types of the child elements can be constrained, but not their order or their number of occurrences. N - namespace - A mechanism that allows developers to uniquely qualify the element names and relationships and to make these names recognizable. By doing so, they can avoid name collisions on elements that have the same name but are defined in different vocabularies. They allow tags from multiple namespaces to be mixed, which is essential if data is coming from multiple sources. Namespaces ensure that element names do not conflict, and clarify who defined which term.. - NCName - An XML name that does not contain a colon (:). An NCName begins with either a letter or an underscore (_) character, followed by any combination of letters, digits, accents, diacritical marks, periods (.), hyphens (-), and underscores (_) permitted in the XML specification. The following list shows some example NCNames: x _aaabbb.ccc catalog part-number _-._-... - notation - Tells the parser what type of object is being referenced. Usually refers to a data format of non-XML data, such as BMP. A notation identifies by name the format of unparsed entities, the format of elements that bear a notation attribute, or the application to which a processing instruction is addressed. - notation declaration - Tells the parser how to deal with a specific binary file type, as well as provides a name and an external identifier for a notation.. P - parsed entity - An entity that has content that is parsed and replaced with actual literal values. The result is called the replacement text. Parsed entities can only contain character data or XML markup. - processing instruction - An XML construct that conveys information to the application processing the XML. A processing instruction is a mechanism for embedding information in a file that is intended for proprietary applications. The application processing the XML can take specific action based on processing instructions. No entities are expanded within a processing instruction. The following is a processing instruction that indicates that the XML file is a Microsoft Word XML document: <?mso-application progid="Word.Document"?> Q - QName - A representation of an XML qualified name. A QName consists of a namespace, represented by a namespace prefix, and a local name. For a QName to be valid, a namespace declaration must be in scope for the context in which the QName is used. For example, if a namespace declaration, such as xmlns:aw=””, is in scope, then an element can be declared, <aw:Root/>. For this element, aw:Root is the QName. R - reference node - The reference node for a search context is the node that is the immediate parent of all nodes in the search context. Every search context has an associated reference node. - replacement text - The content of parsed entities, after replacement of character references and parameter-entity references. S - SAX - See Simple API for XML. - schema - A formal specification of element names that indicates which elements are allowed in an XML document, and in what combinations. It also defines the structure of the document: which elements are child elements of others, the sequence in which the child elements can appear, and the number of child elements. It defines whether an element is empty or can include text. The schema can also define default values for attributes. A schema is functionally equivalent to a DTD, but is written in XML. A schema also provides for extended functionality such as data typing, inheritance, and presentation rules. Consequently, the new schema languages are far more powerful than DTDs. - schema structures - The compounds that can be constructed from data types and are used to describe the element, attribute, and validation structure of a document type. - SGML - See Standard Generalized Markup Language. - Simple API for XML (SAX) - An XML API that allows developers to take advantage of event-driven XML parsing. Unlike the DOM specification, SAX doesn't require the entire XML file to be loaded into memory. SAX notifies you when certain events happen as it parses your document. When you respond to an event, any data you don't specifically store is discarded. If your document is very large, using SAX will save significant amounts of memory when compared to using DOM. This is especially true if you only need a few elements in a large document. - simple data type - An element that contain only text. Also known as simple type. Appears as <simpleType> in XML documents. Attributes are considered simple types because they contain only text. - Simple Object Access Protocol (SOAP) - An open, extensible way for applications to communicate using XML-based messages over the Web, regardless of what operating system, object model, or language they use. SOAP provides a way to use the existing Internet infrastructure to enable applications to communicate directly with each other without being unintentionally blocked by firewalls. - SOAP - See Simple Object Access Protocol. - Standard Generalized Markup Language (SGML) - The international standard for defining descriptions of structure and content of electronic documents. Despite its name, SGML is not a language in itself, but a way of defining languages that are developed along its general principles. SGML defines the way that a markup language is built by specifying the syntax and definitions for the elements and attributes that compose it. XML is a subset of SGML designed to deliver SGML-type information over the Web, while HTML is an application of SGML. T - template -. - tokenized attribute type - In a tokenized type, the parser will normalize all white space to a single space character and will eliminate leading and trailing white space altogether. It will also validate the contents based on the declared type. Seven attribute types are characterized as tokenized types because each value represents either a single token (ID, IDREF, ENTITY, NMTOKEN) or a list of tokens (IDREFS, ENTITIES, and NMTOKENS). U - Uniform Resource Identifier (URI) - A superclass that includes both URNs and URLs. Presently, URI means URL in nearly all cases when discussing XML, although it is expected that URNs will become more numerous in the future. The URI supplies a universally unique number or name that can identify an element or attribute in a universally unique way.. - Uniform Resource Locator (URL) - The set of URI schemes that have explicit instructions on how to access the resource on the Internet. URLs are uniform in that they have the same basic syntax no matter what specific type of resource (Web page, newsgroup) is being addressed or what mechanism is described to fetch it. - Uniform Resource Name (URN) - Identifies a persistent Internet resource. A URN can provide a mechanism for locating and retrieving a schema file that defines a particular namespace. While an ordinary URL could provide similar functionality, a URN is more robust and easier to manage for this purpose because a URN can refer to more than one URL. Unlike URLs, URNs are not location-dependent. - unparsed entity - Any block of non-XML data, sometimes referred to as a binary entity because its content is often a binary file (such as an image) that is not directly interpreted by the XML parser. An unparsed entity could contain plain text, so the term binary is a bit misleading.. - URI - See Uniform Resource Identifier. - URL - See Uniform Resource Locator. - URN - See Uniform Resource Name. V - valid XML - XML that conforms to the rules defined in the XML specification, as well as the rules defined in the DTD or schema.. - vocabulary - See XML vocabulary. W - W3C - See Worldwide Web Consortium. - well-formed XML - XML that follows the XML tag rules listed in the W3C Recommendation for XML 1.0, but doesn't have a DTD or schema. A well-formed XML document contains one or more elements; it has a single document element, with any other elements properly nested under it; and each of the parsed entities referenced directly or indirectly within the document is well formed.. - Worldwide Web Consortium (W3C) - A standards body located at MIT that sets standards for XML, HTML, XSL, and many other Web technologies. X - XDR - See XML-Data Reduced. - XML - See Extensible Markup Language. - XML-Data Reduced (XDR) - An early language used to create a schema, which identifies the structure and constraints of a particular XML document. XML-Data Reduced refers to the subset of the XML-Data schema specification that was made available in MSXML 3.0 and later. It carries out the same basic tasks as DTD, but with more power and flexibility. Unlike DTD, which requires its own language and syntax, XML-Data Reduced uses XML syntax for its language. Unlike XSD, which has only recently been recommended as a standard, XML-Data Reduced was implemented and made available by Microsoft well ahead of the existence of XSD as a recommended standard by the W3C XML Schema Working Group. - XML declaration - The first line of an XML file can optionally contain the "xml" processing instruction, which is known as the XML declaration. The XML declaration can contain pseudo-attributes to indicate the XML language version, the character set, and whether the document can be used as a standalone entity. An example is the XML declaration that begins every valid XML file: - XML document - A document engine - Software that supports XML functionality on the client; Internet Explorer 4.0 and later include XML engines. Its components include the XML parser, the XSL processor, and schema support. - XML information set - A description of the information available in a well-formed XML document. - XML Object Model - An API that defines a standard way in which developers can interact with the elements of the XML structured tree. The XML object model exposes properties, methods, and the actual content (data) contained in an object. It controls how users communicate with trees, and exposes all tree elements as objects, which can be accessed without any return trips to the server. The XML OM uses the W3C standard Document Object Model. - XML parser - A software module used to read XML documents and provide access to their content and structure. The XML parser generates a hierarchically structured tree, then hands off data to viewers and other applications for processing, and finally returns the results to the browser. A validating XML parser also checks the XML syntax and reports errors. - XPath - The result of an effort to provide a common syntax and semantics for functionality shared between XSL Transformations (XSLT) and XPointer. The primary purpose of XPath is to address parts of an XML document. It also provides basic facilities for manipulation of strings, numbers, and Booleans. XPath uses a compact, non-XML syntax to facilitate use of XPath within URIs and XML attribute values. XPath gets its name from its use of a path notation as used in URLs for navigating through the hierarchical structure of an XML document. - XML Pointer Language (XPointer) - A W3C initiative that specifies constructs for addressing the internal structures of XML documents. In particular, it provides for specific reference to elements, character strings, and other parts of XML documents, whether or not they bear an explicit ID attribute.: - XML Query Language (XQL) - A set of extensions to XSL Patterns proposed to the W3C.. - XML Schema Definition (XSD) - A language proposed by the W3C XML Schema Working Group for use in defining schemas. Schemas are useful for enforcing structure and/or constraining the types of data that can be used validly within other XML documents. XML Schema Definition refers to the fully specified and currently recommended standard for use in authoring XML schemas. Because the XSD specification was only recently finalized, support for it was only made available with the release of MSXML 4.0. It carries out the same basic tasks as DTD, but with more power and flexibility. Unlike DTD, which requires its own language and syntax, XML Schema Definition uses XML syntax for its language. XSD closely resembles and extends the capabilities of XDR. Unlike XDR, which was implemented and made available by Microsoft in MSXML 2.0 and later releases, the W3C now recommends the use of XSD as a standard for defining XML schemas. See also schema. - XML vocabulary - A set of actual elements and the structure for a specific document type used in particular data formats. Vocabularies, along with the structural relationships between the elements, are defined in a DTD that serves as the rulebook for that vocabulary. One of the first and probably most well-know vocabularies is the Channel Definition Format used to define Web pages that are designed to be sent automatically, or "pushed" to client users. - XPointer - See XML Pointer Language. - XQL - See XML Query Language. - XSD - See XML Schema Definition. - XSL - See Extensible Stylesheet Language. - XSL formatting objects - A set of formatting semantics expressed as an XML vocabulary.. - XSL Patterns - A declarative, non-procedural selection language implemented in MSXML versions 3.0 and earlier. For MSXML 4.0 and later, XSL Patterns is not supported. For more information about XSL Patterns, download the MSXML 2.5 SDK from MSDN® at msdn.microsoft.com/downloads/. - XSL Transformations (XSLT) - Makes use of the expression language defined by XPath for selecting elements. Build Date: Show:
https://msdn.microsoft.com/en-us/library/ms256452(v=vs.110).aspx
CC-MAIN-2015-22
refinedweb
3,477
56.05
Created on 2013-02-08 18:27 by bfroehle, last changed 2014-02-04 08:49 by python-dev. This issue is now closed. I tried to implement a custom extension type using PyType_FromSpec and Py_LIMITED_API but couldn't implement tp_dealloc: static void mytype_dealloc(mytypeobject *self) { // free some fields in mytypeobject Py_TYPE(self)->tp_free((PyObject *) self); // XXX } The line marked XXX will not compile in Py_LIMITED_API because there is no access to the fields of PyTypeObject. There doesn't seem to be any function in the API which just calls tp_free. I suggest the addition of an API function (to be included in Py_LIMITED_API): void PyType_GenericDealloc(PyObject *self) { Py_TYPE(self)->tp_free(self); } I should mention that essentially what I'm advocating is renaming and exposing `object_dealloc` in Objects/typeobject.c. The proper name is not obvious to me... should it be PyObject_GenericDealloc since it acts on objects? Or PyType_GenericDealloc since it will be stuck into one of the PyTypeObject slots? I propose a more general solution: add a function PyType_GetSlot. + return *(void**)(((char*)type) + slotoffsets[slot]); New Python versions may add new slots. What do you think of returning NULL if the slot number is higher than the maximum slot? It looks like "#define Py_tp_free 74" is the highest slot number since Python 3.2. For example, Python 3.4 has a new "tp_finalize" slot, but I don't see it in typeslots.h. If the set of slots gets extended, extensions would have to opt-in to use the newer slots, i.e. the availability of slot numbers should be conditional at compile-time. Returning 0 for slots not supported in a version seems fine to me as well (after reconsideration), as this is also what you would get if you just recompiled the old type with the new Python headers (i.e. all fields added at the end are 0-initialized). As for slots added to 3.4: it would certainly possible to add them to the stable ABI, if we indeed trust that they are stable (i.e. won't go away until 4.0). That would have to be decided on a slot-by-slot case, preferably in individual roundup issues. I thought I replied to this... weird. Do I understand correctly that it's basically impossible to write a proper custom deallocator in the limited API right now, because you can't get access to your base class's tp_free? (If so, why didn't anybody notice?) Also, isn't it reasonable to pass in non-heap type objects? I realize supporting this would complicate the implementation a great deal. It's certainly possible to write a "proper" dealloc - just call PyObject_Del directly. This is correct if the type isn't subclassable, and works if it actually isn't subclassed, or if the subclass object can also be released through PyObject_Del. That this has *nobody* noticed yet isn't the case - the OP certainly noticed a year ago. Else, the limited API isn't in wide use yet, probably partly because it is too limited still for certain extension modules (but it is by design that it is limited at all, so that code might require active porting to use it, and may not be portable at all in certain cases). If the typical use case is PyTYPE(self)->tp_free, then the type ought to be a heap type, so limiting the implementation to heap types should be sufficient. It would be feasible to extend it to non-heaptypes, although I do wonder what use case this would allow for. I was thinking of a subclass of an existing class, both implemented in C. collections.Counter does that, but it uses _PyType_LookupId() which is in the limited API. Would it be possible to achieve equivalent functionality by using _PyType_LookupId()? If so, maybe instead of the proposed new function PyType_GetSlot, we should make _PyType_Lookup and _PyType_LookupId part of the public API. (And, I freely admit I don't understand all this that well and that could be a very dumb question.) I'm not sure we are looking at the same code base, I look at and ISTM that collections.Counter is *not* implemented in C. Also, according to I see that _PyType_LookupId is *not* in the limited API (and it really shouldn't). In any case, _PyType_LookupId cannot replace PyType_GetSlot, since it returns a PyObject* from the namespace of the type. Many of the slots don't actually have a Python name (including tp_free, which is the OP's original use case), plus the value returned ought to be a function pointer, not a PyObject*. New changeset 655d7a55c165 by Martin v. Löwis in branch 'default': Issue #17162: Add PyType_GetSlot. Thanks for the reviews; this is now committed. New changeset eaae4008327d by Victor Stinner in branch 'default': Issue #17162: Fix compilation, replace non-breaking space with an ASCII space
http://bugs.python.org/issue17162
CC-MAIN-2015-27
refinedweb
813
63.7
The following will be covered. 1. How to post and what your post should include. 2. General Questions Answered 3. Good Tutorial Sites Section 1 First and most important the use of code tags. you use [ c o d e ] (without spaces) and [ / c o d e ] to turn on and off code tags. the following is example of code posted with and without code tags : WITH: WITHOUT:WITHOUT:Code:#include <iostream> using namespace std; int main() { cin.get(); return 0; } #include <iostream> using namespace std; int main() { cin.get(); return 0; } See the difference, the code with tags is easier to read and follow. Now you must decide which catergory your question fits in. To decide this shouldn't be to hard. A good guideline is if your post contains no code or no question about a select peice of code, then it possibly belongs in general catergory. If you have a GUI question post in the operating system specific to your question. If your using char array, and havent heard of strings. Theres a good chance you should be posting in C instead of C++, unless you are using other c++ functions. Here are a few header that if you have included you probably need a c++ post : <vector>, <string>, <map>, <list>, <set>, <deque> If your post contains INT WINAPI WinMain() then you should be posting in the windows programming section. Any question dealing with sound and animation would probably be asked best in game programming. Anything dealing with the internet, sockets, HTTP, FTP, SMTP, and so on would best be asked in the network programming. If you want to ask people for another kind of help project and recruitment board is for you. If youd like to start or compete in a contest the contest board is for you. The next important thing is to ask a smart question, believe it or not there is a website on how to ask a smart question. You should only be asking a question if google.com or the board search has not returned anything useful. Dont forget that alot of smart people here have already answered alot of the beginner question in the FAQ. (No one ever follows that last advice, because if they did we wouldnt have any post and none of us would want that ).). Your topic should be about your problem, not help im a noob, or this is a stupid question. A good topic would be, How do i use rand();? Then follow up with what your problem is, what you have tried, and post any code that you have written in an attempt to fix your own problem. The less winded and more precise you are the better help you will recieve. If you are going to ask a homework question make sure you have posted the code you have written so far and point out your problem. No one here will write your code for you, but everyone is glad to help with a problem. This brings us to posting reply's, we are all here to help so if you think you have something valid to offer you should post, if you are wrong someone will correct you and you will have learned something from the experience as well. Section 2 Common Questions Ask by Beginners How do I get my program to wait for a keypress? Clear the screen? Generate random numbers? How do I get a number from the user (C) Stop my Windows Console from disappearing everytime I run my program? Where can I download a missing header file? Test an int to determine if it is even or odd Convert a string (char array) to an int Convert an int to a string (char array) (C) Get a line of text from the user/keyboard (C) Convert an int to a string (C++) Convert a string to a int (C++) Obtain a string from the user (C++) Format output using printf() (C) Format output using cout (C++) Comparing strings (C) Run a program from within a program Display a picture file in DOS Multiple source files for one program (C++ example) gotoxy() in a Windows Console Flush the input buffer How can I get input without having the user hit [Enter]? Why does my program enter an infinite loop if the user inputs invalid data? (C++) Sleeping How can I convert a char/string to upper or lower case? Accessing command line parameters/arguments Validate user input Color my text Work with dates and times Use directional keys in a console application Work with files (C) Work with files (C++) Time my application/function Accessing a directory and all the files within it Converting a string to binary Separate a string into tokens? (C++) Throwing exceptions (C++) Separate a string into tokens? (C) Using templates to solve problems Reading data from a socket AND OF COURSE THE REST OF THE CBOARD FAQ Section 3 adrianxw.dk Winsock Tutorial CplusPlus.com Tutorial SOurce Code Search Engine STL C++ Library MSDN Good Free C++ Compiler Preludes Wonderful Site C++ Tutorial Win32 Programming Tutorial SourceForge c++ articles about.com parashift comp.lang.c++.moderated Game Developer OpenGL Documentation The forger win32 tutorial Beej's Guide to Network Programming
https://cboard.cprogramming.com/cplusplus-programming/68108-cboard-newbies.html
CC-MAIN-2017-13
refinedweb
877
69.41
Learn how easy it is to sync an existing GitHub or Google Code repo to a SourceForge project! See Demo You can subscribe to this list here. Showing 6 results of 6 This testprogramm generates correct code if the constant for testing is smaller as 127. If not then a Integer compare is generated instead a char. Version: SDCC : mcs51/gbz80/z80/avr/ds390/pic14/i186/tlcs900h 2.3.0 (Oct 2 2001) (UNIX) ----------------- #include <8051.h> volatile unsigned char t1,t2; main() { t2=P1; t1=(t2==127)?1:2; P2=t1; } ----------------------- generates 211 ; test.c 11 003B AA 31 212 mov r2,_t2 003D 7B 00 213 mov r3,#0x00 214 ; Peephole 132 changed ljmp to sjmp 215 ; Peephole 198 optimized misc jump sequence 003F BA 7F 07 216 cjne r2,#0x7F,00103$ 0042 BB 00 04 217 cjne r3,#0x00,00103$ 218 ;00106$: 219 ; Peephole 200 removed redundant sjmp 0045 220 00107$: 0045 7A 01 221 mov r2,#0x01 222 ; Peephole 132 changed ljmp to sjmp 0047 80 02 223 sjmp 00104$ 0049 224 00103$: 0049 7A 02 225 mov r2,#0x02 004B 226 00104$: 004B 8A 30 227 mov _t1,r2 228 ; test.c 14 004D 85 30 A0 229 mov _P2,_t1 -- MFG Gernot@... > > > > Hi, > Is it possible to link object code files (*.obj) generated by Keil C51 > compiler using SDCC for a 8051? Short answer: no. Long answer: the object-file-formats are totally different. Bernhard > Hello, The sdcc-2.3.0-i586-mingwmsvc.zip does not include sim51 binaries ?! :-( Why? Thank you, Alexei Lioubimov Hi, Is it possible to link object code files (*.obj) generated by Keil C51 compiler using SDCC for a 8051? Thanks Ibon Goikoetxea ibonpas@... _________________________________________________________________ Get your FREE download of MSN Explorer at
http://sourceforge.net/p/sdcc/mailman/sdcc-user/?viewmonth=200110&viewday=2
CC-MAIN-2015-22
refinedweb
293
75.4
I know, I know, I am an incredible nit picker, but it gives me the willies to see the hard-coded string “\n” used for newline. It works and there is no real “correctness” argument to be made here, but I just don’t like it. Here are my reasons: 1. Not self documenting, the “new-guy” (or gal) may not know that “\n” means new line 2. It is unduly concrete rather than symbolic, making it hard for other software to reason of over the code. 3. Does not work across platforms. Instead of Console.WriteLine(“\n” + name); My suggested alternative is: Console.WriteLine(); Console.WriteLine(name); Or, if you must have it in one line, Console.WriteLine(Environment.NewLine + name); Now, aren’t those much better? I’ve been known to do the following when calling StringBuilder.AppendFormat(), which doesn’t have a method that writes a new line. I suppose that it could work for stream output as well, although I’ve never used it that way. StringBuilder builder = new StringBuilder(1024); string nl = Environment.NewLine; builder.AppendFormat("{0}{1}{0}", nl, name); The last time that I can recall doing this was when building POST data for an HttpWebRequest. It’s not all that useful for outputting one line, but for several, it’s a real keystroke-saver. Now that we have code snippets, I think I may create one with a shortcut of "nl" or "n" that expands to Environment.NewLine. I wonder if using "n" as the shortcut would cause any problems. By the way, it seems that an AppendLine() method has been added in Whidbey, but no AppendLineFormat(). It seems that AppendLine() simply calls Append(Environment.NewLine), so it’s nothing all that special (except for saving a line of code). On the surface you would think that I could call String.Format() and pass it to AppendLine(), but that method creates ANOTHER StringBuilder, calls AppendFormat() on it, and returns the string. That hardly seems as efficient. Heh. That’s funny. I do exactly that, even though I’ll use other framework constants like the path separator. I’m not sure where I picked up the habit, but I haven’t ever even thought of using anything other than n. I even know that there’s a constant for newlines. Doh. Would you actually hire a new guy (or gal) who doesn’t know such basic escape sequence as n? That would explain a lot about Microsoft’s SW The other arguments are fine but this one really cracked me up 😉 absolutely! What do you mean "not self documenting?" You can look up the valid escape sequences in the documentation and there it is! And, why wouldn’t it be portable to any platform that implements .NET? The character escapes are part of the spec. This is a lack of Refactoring Tool support. With advanced enough tools you can find all String literals, check for contains "n", and replace with Environment.NewLine. Tools for Java are advanced enough to allow this, they just don’t expose it currently No one will complain if you clean up their code and fix this. So if its your project or have commit rights, make the changes, and check them in. Now, hopefully this doesn’t remind me of this one ;-): Jeez, I’ve been reading your blog from pretty much the start, but I’ve seem to have missed the first 492 pet peeves…;) I thought that n was /defined/ as being the platform’s newline character sequence? It’s therefore cross-platform as it stands. It’s only work in win? Console.WriteLine("x0ax0d" + name); 2 things spring to mind, though mainly from a devils advocate point of view. 1. If the code maintainer does not know what "n" means, what are they doing with my code! 3. I don’t know about most people but I have only ever written code for Windows, "rn" == CRLF. I’m sorry, I think you’re out of your tree with this one. 1. That’s possible, but I think it’s silly. By the same token, we must avoid CDATA sections in xml, never use c#’s @"" syntax, and refuse to put javascript in asp.net pages, beyond that entered by the platform. At a certain point, you have to just say "this is assumed knowledge". n is one of the things that I think it’s perfectly reasonable to assume. 2. This implies a complete inversion of Postel’s law – tools accepting only a subset of the language. n is part of the language, and tools that claim to speak the language should do so. 3. Eh? Which platforms doesn’t it work for? In C you just say n and the library makes sure it gets turned into the platform’s newline character, unless you turn off the translation by opening the file in binary mode. There’s no particular reason why that sort of machinery wouldn’t kick in for multi-platform stuff. I can state from experience that n does produce a newline under mono on linux. <br>rn ? if you do not know what is n (t, r) you shouldn’t do programming. All your suggestions are weak ! <br>You are solving wrong problem. <br>I do not realy care about .NET on UNIX, I care more about performance on my platform I’ve paid money already. <br> <br>a) <br>Console.WriteLine(); <br>Console.WriteLine(name); <br>This will asquere lock on console or stdout file twice ! A lot of useless code will be executed twice to output a few lines <br> <br>b) <br>Console.WriteLine(Environment.NewLine + name); <br>This will create new useless object as result of "+" operator and only then will output it ! <br> <br>Both is wrong. There is no way to output series of strings/data without creation of new object with all data or without useless locking of console output. <br> <br>There is no buffering performed for console output ! <br> <br>Two calls for <br>"Console.Write(x); <br>Console.WriteLine(y);" <br>will take as much as twice more time that single call there z = x+y <br>"Console.WriteLine(z);" <br>Perform simple testing and compare results (redirection preffered). <br>Mine are : <br>With file rediction 00:00:00.6409216 vs. 00:00:01.0715408 <br>Without redirection, console slowed down everything 00:00:11.0759264 vs. 00:00:12.1374528 <br> <br>This is clear that single call to Console.WriteLine is faster, but creation of "x+y"object has additional costs !! <br> <br>Summary: System.Console must have a way to output series of data in single call. <br>Plz do not propose to use "{0}{1}" format. It’s also slow. compare: string text = "The FirstnSecondnThirdnFourth Line"; to string text = "The First" + Environment.NewLine + "Second" + Environment.NewLine + "Third" + Environment.NewLine + "Fourth Line"; The developers of C wisely included a shorthand for newlines and other control characters. The sad part was, MS ignored the widely accepted use of "n" for new line, and used two characters, instead of one. So now, 24-plus years later, we are still talking about things like Environment.NewLine. Anyone familiar with C will understand "n" just fine.. Yup that’s more readable. But anyone who has been working wih C, C++ knows n means a new line. LOL I’m in the choir. Honestly… .NET is great, but I don’t see MS ever really putting a focus on being cross-platform. But does your peeve extend to embedded newlines? String.Format(" Name: {0}n Addr: {1}nPhone: {2}", name, addr, phone); David, <br> <br>Pet peeve #492 was ‘Typos in Blog Titles’. I missed the first 491 too. Mi idiot comment of the day: If it’s shorter, it’s gotta be faster. "n" rules. My idiot comment of the day: If it’s shorter, it’s gotta be faster. "n" rules. Funny thing that a microsoft employee cares about different platforms. I think n was one of the first things I learned in CS 101: An Introduction to Programming. Seriously. I think n was one of the first things I learned in CS 101: An Introduction to Programming. Seriously. I think n was one of the first things I learned in CS 101: An Introduction to Programming. Seriously. My question is if ‘n’ is not good enough, then what about the other escape characters? I love being able to use string.Format to use a compact form for concatenating and formatting strings. I don’t like to concatenate strings by closing and opening quotations, which makes the code harder to read in many cases. Correct me if I’m wrong, but I think Brad’s point is that n is often used on Windows when in actuality, the developer probably intended rn (or in demical ASCII code: 13 10). In VB, this is known as vbCrLf. Environment.NewLine (on Windows) for example is NOT equivalent to n. It’s actually rn. Whereas I assume that on Linux (via Mono) Environment.NewLine is equivalent to n (correct me if I’m wrong). I saw an interesting comment . " But the method Brad shows us has no performance issue. Console.WriteLine(Environment.NewLine + name); will run as same as the Console.WriteLine("n" + name). But calling Console.WriteLine twice could have insignificant cost since the function call causes the stack frame allocation, backup the current stack frame and so on. What do you think Brad? Well, it sure has been a while sense nearly everyone disagrees with me on an issue… I guess that is why this is a pet peeve and not a design guideline. 😉 Can I assume the “silent masses” are with me? Anyway, take it or leave it. On the perf angle, I would be shocked if anyone had a real world scenario for one method being better than the other at least for Console output. String formatting may be a different issue as there is less overhead there, but as Rico would say: “Measure”. Well there is a difference between n and Environment.NewLine. Try opening a file in Notepad that used only n and not rn… it sucks. Why is NewLine part of Environment? Why isn’t it part of TextWriter? That way I could open a fresh stream with the intended encoding and then just use it. Thus, the right code would like this: Console.WriteLine(Console.Out.NewLine + name); Thus, if standard-output has been redirected to a unix/mac device, you’ll get the correct NewLine encoding (or at least, you’d have a chance of getting it). We talked about putting NewLine somewhere in IO, but there is no good place… sometimes you need this when jut building up a string with StringBuilder for example, so it seemed odd to put in in the IO namespace What about "Console.WriteLine("{0}{1}", Environment.NewLine, name);"? I used to agree with you to never use "n" with streams, but had an issue using StreamWriter.WriteLine() method. I was creating CSV files by looping through a DataTable. Occasionally, I am guessing, the WriteLine() method was not perfoming as I would expect. IOW no NewLine character was getting put out; two lines of CSV data were being listed as one line. I could find no reason for this, and it seems to happen at purely random intervals. I changed all my _Writer.WriteLine() methods over to _Writer.Write( "n" ) and haven’t experienced a problem since. If you have a solution for my problem I will be more than happy to switch my code back, since it isn’t as pretty. Yes, you approach is more readable. I much prefer Environment.NewLine. FxCop rule that checks for hard coded new line characters (‘n’ or ‘r’). FxCop rule that checks for hard coded new line characters (‘n’ or ‘r’). PingBack from PingBack from PingBack from PingBack from PingBack from
https://blogs.msdn.microsoft.com/brada/2004/08/08/pet-peeve-493-console-writeline-n/
CC-MAIN-2016-30
refinedweb
2,000
75.2
It looks like you're new here. If you want to get involved, click one of these buttons! Hi All: I have been using the KLayout Python module a lot and see the following: On RedHat EL 6 I can compile the "master" branch (0.26?) and get the module to work on a Python 3.6.7 install just by setting the $PYTHONPATH variable to include the .../pymod directory from the install directory. On Windows 10 with Windows Subsystem for Linux I can install the .deb file for Ubuntu 16.04, and then I can run python3 on WSL with klayout (and Pycharm Professional Edition on the Windows side). Working well. On MS Windows (outside of WSL), I can install the PyPI module (or the one from:) with "PowerShell" but then when I start the Python and import klayout I get: import klayout import klayout.db as kl Traceback (most recent call last): File "", line 1, in File "C:\Users\nxa11113\AppData\Local\Python36\lib\site-packages\klayout\db__init__.py", line 1, in import klayout.dbcore ImportError: DLL load failed: The specified module could not be found. > I have Python 3.6.7 (from python.org, the 64-bit install) installed in: C:\Users\nxa11113\AppData\Local\Python36 Does this module work for anyone, and if so, does Python need to be installed anywhere else? Also I have lots of other stuff installed and I can't exclude side effects. Thanks for any suggestions. Best regards, Erwin Hi Erwin, Thanks for the feedback :-) Regarding Windows: did you install the 3rd party package? The Python module does not come with all the necessary 3rd party libraries such as pthread, zlib etc. Honestly, I don't know how to package them with setuptools (you). You can install them manually and let PATH point to them. The procedure is a bit clumsy currently, but I think it'll go away once the masters of setuptools will enlighten me (or I screw up and package all the 3rd party libs into an installer). You can find the details here:. Best regards, Matthias Hi Matthias, thanks, I'll have a look at how setuptools work. Actually, my solution (WSL with Pycharm on Windows) has been working really well (because I can use the Python either on the Windows Subsystem for Linux side, or also the Python in our Linux farm if I want to tie in other tools) but it does require the commercial edition of PyCharm (not an issue for me). There is another solution which I haven't tried (again sidestepping the packaging challenge on Windows) which is to run the Ubuntu PyCharm on WSL with the server which everybody seems to be using, see Let me have a look at your link, and happy holidays from Texas. Best regards, Erwin Just to close this, I followed Matthias's instructions and now I have the Python module working with Python 3.6.7 on Windows (the canonical install from python.org). This is good, mainly because it makes it easy to share the module with others. Also, for some reason, PyCharm doesn't work well under WSL so if one wants to use WSL Python (with KLayout or some other way) it is better to run PyCharm under Windows and use an SSH connection to WSL. The same is true for running PyCharm on a server behind a VPN. So this is where the pro version of PyCharm is very useful. Hi Erwin, good to hear .. thanks for sharing this. We're working on providing a pre-build Windows module. Best regards, Matthias
https://www.klayout.de/forum/discussion/1171/pypi-klayout-module-windows
CC-MAIN-2019-13
refinedweb
601
72.97
#include <stdio.h> #include <string.h> #include <stdlib.h> #include "ourhdr.h" typedef struct // Country Data struct declaration { char code[4]; // Country Code char name[50]; // Country Name float life_expectancy; // Life Expentancy of the Country's citizen int pop; // Country's Population } DATATYPE; typedef struct // Index Data struct declaration { char code[4]; long int offset; // offset of the data } INDEX; INDEX StructArray[300]; // for a lot of them DATATYPE ActualStruct; // for a single struct void sort(INDEX SortArray[], int n) { int j; for(j=0; j < n;j++) { int k; char *temp = SortArray[j].code; for (k= j-1; k >= 0; k--) { if(strcmp(SortArray[k].code, temp) >= 0) break; strcpy(SortArray[k+1].code, SortArray[k].code); } strcpy( SortArray[k+1].code, temp); // strcpy } } int main() { int i = 0; int size = 0; FILE *FI, *FO, *FO2; char Line[1000]; // NO input line (delimited by \n) is longer than 1000 char * Tok; // token from line if((FI = fopen("AC1.txt", "r")) == NULL) // open a stream from "countries" err_sys("Open Fail\n"); if((FO = fopen("DATABASE.txt", "wb")) == NULL) // open a stream from "countries" err_sys("Open DATABASE Fail\n"); if((FO2 = fopen("DIRECTORY.txt", "w+")) == NULL) // open a stream from "countries" err_sys("Open DIRECTORY Fail\n"); while ( fgets( (char *) Line,1000,FI) != NULL) // fill buffer up to newline or eof or error { Tok = strtok( Line ,",\n"); // skip ID number Tok = strtok( NULL ,",\n"); // this should get the country code ActualStruct.code[0] = Tok[0]; ActualStruct.code[1] = Tok[1]; ActualStruct.code[2] = Tok[2]; ActualStruct.code[3] = 0; // To create "string" Tok = strtok( NULL ,",\n"); // this should get the country name strncpy(&ActualStruct.name[0],Tok,50); // copy string at most 50 chars Tok = strtok( NULL ,",\n"); // skip Tok = strtok( NULL ,",\n"); // skip Tok = strtok( NULL ,",\n"); // skip Tok = strtok( NULL ,",\n"); // skip Tok = strtok( NULL ,",\n"); // this should get the population ActualStruct.pop = atoi(Tok); // convert string to integer Tok = strtok( NULL ,",\n"); // this one should get life expectancy ActualStruct.life_expectancy = atof(Tok); // convert string to a floating point number strcpy(StructArray[i].code, ActualStruct.code); // get the current code StructArray[i].offset = ftell(FO); // get the current offset in the DATABASE file if (fwrite(&ActualStruct, sizeof(DATATYPE),1,FO) != 1) // write the struct to the DATABASE file err_sys("fwrite error"); printf("%5s%50s%15u%18f%10u\n",&ActualStruct.code[0],&ActualStruct.name[0],ActualStruct.pop,ActualStruct.life_expectancy,StructArray[i].offset); i++; size = i; } printf("Before Sort:\n"); for (i=0; i<size; i++) { printf("%s \t %u\n",StructArray[i].code, StructArray[i].offset); } sort(StructArray,sizeof(StructArray)/sizeof(*StructArray)); // call sort function printf("After Sort:\n"); for (i=0; i<size; i++) { printf("%s \t %u\n",StructArray[i].code, StructArray[i].offset); } if (fclose(FI)) // close file descriptor FI err_sys("Close error\n"); if (fclose(FO)) // close file descriptor FO err_sys("Close error\n"); if (fclose(FO2)) // close file descriptor FO2 err_sys("Close error\n"); printf("------THE END------ \n"); // and this if not error :) } Are you are experiencing a similar issue? Get a personalized answer when you ask a related question. Have a better answer? Share it in a comment. From novice to tech pro — start learning today. Open in new window You are only copying the code. The rest of the data is staying in its original place. (You need to copy everything, maybe you need a function?) The revolutionary project management tool is here! Plan visually with a single glance and make sure your projects get done. I'm kind of slow in understanding stuffs. thank you:) Here's a fact that you may not realize. If you have two struct objects, x and y, then if you say: x = y; then the entire contents of y are copied into x. The only other c-syntax item that you may need help on is strcmp: In particular, read carefully the section on Return Value. SortArray[k] > SortArray[j] then SortArray[k+1] = SortArray[k] SortArray[k] = SortArray[j] am i right? yes and i know i should copy the whole DATATYPE struct into INDEX struct(but only show the country code and its offset) but i dunno how should i write it out? i'm really weak at this:( Well, as long as you understand that the '>' operator does not apply to your INDEX type, and that you meant something close to that, then, yes, you are right. So, assuming that we're all on the same page as to the understanding of the algorithm, I urge you to write down the following table on paper for the values that you expect on line 32 in your OP. Here's the header of this table: Open in new windowNext-LOC is the next line of code that you want to execute (i.e., either 33 or 34). This table will have multiple entries for j since j is in the outer loop. Then, go through the debugger and verify that your expectation is correct. Don't be surprised if you are surprised by what you find. BTW - you don't have to do this for every possibilty of j,k pairs. It should only take a few entries for you to discover your problem. You may also be surprised about some the first entry, which I find a bit odd (and I'd take off a point or two), but which still works algorithmically. >> then SortArray[k+1] = SortArray[k] // ok >> SortArray[k] = SortArray[j] // did you really mean j here? Good Luck! DZA(k=1) > BEN(j=2) then k+1=k so now DZA(k=2) and then compare again k-- AGO(k=0)>BEN(j=2) IS NOT BIGGER, so fail get out of the loop and k+1 which is now (k=1) = BEN(j=2) and the list is AGO(k=0),BEN(k=1),DZA(k=2) i edit the sort function, i think is easier to understand Open in new window but i still can't understand the func that tommy provide? I was assuming you understood the code you had. Now I'm not completely sure. Did you write and understand it or did you get it from someone else? hmm so you meant that I've to call the whole datatypeCopy() func in that line // Open in new window hmm sorry i'm really trying out my best to understand what you all trying to say but i'm really slow in understanding things! Open in new window void indexCopy(INDEX& dest, const INDEX& src) <-- syntax error before '&' token and before that i defined INDEX dest, src; <-- is it correct to define like that because i got an error of not declaring dest and src? Do not declare dest and src anywhere else. Open in new window like this ryte? hmm but i'm getting an error as2.c:42: error: syntax error before '&' token void indexCopy(INDEX& dest, const INDEX& src) First: Take out the INDEX dest, src; line. Then (for both structs) try defining them like this Open in new windowThat's the only thing that looks fishy. Otherwise, I don't see why you should get that error. Open in new window anyway i've successfully sorted out! great thanks! It's a little technical, but it would be good to understand. You use the . if you have the actual struct. You use the -> if you have a pointer. So INDEX x; x.code; INDEX* x; x->code; When you use * then the variable is just an address that points to where the data really is. Look up pointers if you want. They are very useful but easy to cause weird errors with.
https://www.experts-exchange.com/questions/26834401/sorting-an-array-of-structs.html
CC-MAIN-2018-13
refinedweb
1,280
64.71
Today I got email about some information in Effective Modern C++. The email included the statement, "An expression never has reference type." This is easily shown to be incorrect, but people assert it to me often enough that I'm writing this blog entry so that I can refer people to it in the future. Section 5/5 of the Standard is quite clear (I've put the relevant text in bold): If an expression initially has the type “reference to T” (8.3.2, 8.5.3), the type is adjusted to T prior to any further analysis. The expression designates the object or function denoted by the reference, and the expression is an lvalue or an xvalue, depending on the expression.There'd clearly be no need for this part of the Standard if expressions couldn't have reference type. If that's not enough to settle the matter, consider the type of an expression that consists of a function call. For example: int& f(); // f returns int& auto x = f(); // a call to fWhat is the type of the expression "f()", i.e., the type of the expression consisting of a call to f? It's hard to imagine anybody arguing that it's not int&, i.e., a reference type. But what does the Standard say? Per 5.2.2/3 (where I've again put the relevant text in bold and where I'm grateful to Marcel Wid for correcting the error I had in an earlier version of this post that referred to 5.2.2/10):.It's very clear that expressions can have reference type. Section 5/5 takes those expressions and strips the reference-ness off of them before doing anything else, but that's not the same as the reference-ness never being present in the first place. Scott 45 comments: Hi, I have another example of expression with reference type: int a = 1, b = 2, c = 3; (b += c) = a; Also lambda is expression with reference type. I think by the same argument one could say that function parameters may be array types: > After determining the type of each parameter, any parameter of type “array of T” or “function returning T” is adjusted to be “pointer to T” or “pointer to function returning T,” respectively. [dcl.fct]/5 The wording could easily be changed to "if the type would otherwise be a reference type/array type," and then the wording would no longer support your claim. Finally, the wording in the second quote does not refer to the type of an expression, just the the 'result type' of a function, which is not necessarily identical to the type of a function call expression calling the function. @Anonymous I believe even by Scott's argument that expression does not have a reference type; it's simply an lvalue of type int, because the built-in += operator is specified to return "return an lvalue referring to the left operand." --- I think it's good to understand what is meant when somebody says, informally, 'the expression has a reference type', but I'm not sure there's a real, practical need to take the terms 'before' and 'after' too literally when the spec uses them this way. @Seth: I'd be interested to know what type you think the expression "f()" has, according to the Standard. Determining the type of the expression `f()` includes applying [expr]/5. That is, one cannot be said to have determined the type until all applicable rules have been applied. So I would say that the expression `f()` formally has type `int` (and the expression is an lvalue). I might well informally describe `f()` as having int reference type. @Seth: But what type do you start with, i.e., to what type to you apply "the applicable rules"? To start with, no type at all. Then my understanding would be updated/corrected to 'int&' by the application of [expr.call]/3. Then it would be updated/corrected to 'int' by the application of [expr]/5. @Seth: So the type of the call expression is int&, per 5.5.2/3. The adjusted type (per the wording in 5/5) is int. Interestingly, 5/5 seems to be the motivation for the decltype rule in 7.1.6.2/4 bullet 3 that add a reference-qualifier to the type of lvalue expressions. That is, 5/5 takes the reference-qualifier away from expressions with reference type, and, for lvalues, 7.1.6.2/4 bullet 3 adds it back. (I am aware that 7.1.6.2/4 bullet 3 yields reference types for some lvalue expressions that were not originally of reference type, e.g., index operations into an array, but my sense is that its main job is to restore reference qualifiers that 5/5 removed.) So if you were asked to describe the type of the parameter in `void foo(int x[5])` would you say its type is an array of 5 ints? And then only when asked about the "adjusted type" of the parameter say that the type is an int pointer, per [dcl.fct]/5's wording that 'After determining the type of each parameter, any parameter of type “array of T” [...] is adjusted to be “pointer to T”'? I don't believe that these figurative uses of 'before' and 'after' should be taken literally and the 'intermediate' states referred to by the standard should not be treated as part of the program's actual meaning. There is no literal timeline in which the program means one thing and then means another as additional rules from the spec are applied. The program has one meaning, and that meaning is the final result of applying the whole standard. But again, this is only when speaking formally. If distinguishing between an expression's 'non-adjusted type' and its 'adjusted type' is helpful in explaining some point then I think it's perfectly reasonable to speak informally in such terms. Nor does such an informal description need any cover from the standard; if the standard in fact used the wording 'if an expression's type would otherwise be "reference to T" the expression's type is actually T,' it could still be reasonable to talk about expressions with reference types. @Seth: Personally, I'd say that the parameter in your example is declared to be an array of 5 ints, but it's treated as if it had been declared to be a pointer. FWIW,." One reader wrote "An expression never has reference type, ... [so this] doesn't make much sense." I think that the idea that a variable of type int& doesn't have a reference type is absurd and is not helpful, especially in understanding how type deduction works. Of course, a single comment from a single reader means nothing, but I've had this kind of discussion a number of times with a variety of people. Hence this blog post. Until 5/5 gets applied, an expression can have reference type, and that pre-5/5 type corresponds much more closely to intuition than the post-5/5 "adjusted" type. > I think that the idea that a variable of type int& doesn't have a reference type is absurd and is not helpful Well a variable and an expression that is just a variable's names are distinct and do not necessarily have the same type. But I understand exactly what you mean, and I agree that speaking informally of an expression having a reference type is perfectly reasonable and may be helpful for explication. In particular I can see why one might prefer such terminology over a more formal usage of the standard's value category terms; it's both more succinct and more accessible, as many programmers aren't familiar with the value categories. On the other hand, if people keep bringing up this point I have to wonder; are they just engaging in pedantry, or are they actually failing to understand what you mean due to this informal usage? If the former then I think it can safely be dismissed with a "yeah, but you know what I mean," without harming your mission of making people better C++ programmers. @Seth: Your perspective seems to be entirely pragmatic, which I appreciate. The Standard, on the other hand, engages in semantic gymnastics leading to the odd formality that given a call to a function that returns a reference, the (post-adjustment) type of the call expression is a non-reference, but if you check to see if the result of the call is a reference (via std::is_reference<decltype(the function call)>::value), the result is true: it's a reference. As I said, 5/5 takes the reference away, and decltype adds it back. It'd be an interesting exercise to see how hard it would be to eliminate this now-you-see-it-now-you-don't behavior from the Standard. (One thing that'd have to be done would be to change the specifications for some of the operations in the C subset, e.g., to have pointer dereferences and array index operations return T& instead of simply lvalues of type T.) [5.1.1p8]: An identifier is an id-expression provided it has been suitably declared [...] The type of the expression is the type of the identifier. [8.3.2p1]: [...] then the type of the identifier of D is “derived-declarator-type-list reference to T.” I think the paragraphs above settle the matter once and for all, don't they? Regarding the type of "f()", [5.2.2p3]: [...] the type of the function call expression is the return type of the statically chosen function [...] This return type shall be an object type, a reference type or cv void. So, the type of "f()" is "int&". The moment it is used, its type is adjusted to "int", because we want to work with the object or function being referenced, not with the reference itself (that's how I think about it). @bogdan: Thanks for the backup :-) I agree, the sections you site for identifiers as expressions seem to make the case pretty unequivocally. Does the following count as an expression that returns a reference? Does the following also count as a function that only accepts an array (not an array that has decayed into a pointer) and returns an array (without having it decay into a pointer)? #include <iostream> int ( & add_two( int( & a )[ 3 ] ) )[ 3 ] { for ( auto & e : a ) { e += 2; } return a; } std::ostream & operator << ( std::ostream & o, int const ( & a )[ 3 ] ) { for ( auto const & e : a ) { o << e << '\n'; } return o; } int main() { int vec3[ 3 ]{ 1, 2, 3 }; std::cout << "vec3:\n" << vec3 << '\n'; int ( & result )[ 3 ] = add_two( vec3 ); std::cout << "result:\n" << result << '\n'; std::cout << "vec3:\n" << vec3 << '\n'; std::cout << "add_two( vec3 ):\n" << add_two( vec3 ) << '\n'; std::cout << "vec3:\n" << vec3 << '\n'; //----------------------------------- // TWO CASES THAT DO NOT WORK: //----------------------------------- //----------------------------------- // CASE 1) Arrays of a different size: //----------------------------------- //int vec4[ 4 ]{ 1, 2, 3, 4 }; //add_two( vec4 ); // compile-time error: error C2664 : 'int (&add_two(int (&)[3]))[3]' : cannot convert argument 1 from 'int [4]' to 'int (&)[3]' //----------------------------------- // CASE 2) Pointers to arrays of the same size: //----------------------------------- //int * vec3_ptr = new int[ 3 ]{ 1, 2, 3 }; //std::cout << "vec3_ptr:\n"; //for ( size_t i = 0; i < 3; ++i ) { // std::cout << vec3_ptr[ i ] << '\n'; //} //std::cout << '\n'; //add_two( vec3_ptr ); // compile-time error: error C2664: 'int (&add_two(int (&)[3]))[3]' : cannot convert argument 1 from 'int *' to 'int (&)[3]' //add_two( *vec3_ptr ); // compile-time error: error C2664: 'int (&add_two(int (&)[3]))[3]' : cannot convert argument 1 from 'int' to 'int (&)[3]' //delete[] vec3_ptr; } /* Output: vec3: 1 2 3 result: 3 4 5 vec3: 3 4 5 add_two( vec3 ): 5 6 7 vec3: 5 6 7 */ From above, the question: Does the following count as an expression that returns a reference? should have read: Does the following count as an expression that has a reference type? ... and I should have followed that up with: Or are you guys writing about something different? ;-) The very first quote says that, for the purpose of any analysis whatsoever ("prior to any further analysis"), expressions don't have reference type, because those that start out that way are immediately adjusted. So while technically you're right, expressions can have reference types, such knowledge does not serve any purpose in understanding the language. The slightly simplified "expressions never have reference type" is not technically true, but more useful than the exact truth for understanding the language. Your second quote, on the other hand, says nothing to support your point. The "result type" in that quote is not the type of the function call expression, it's the declared result type of the function. Note that the removal of the reference type from types of expressions leads to an identical treatment of variables of type T and variables of type T& as well as any lvalue expression of type T, not only in the context of deduction. So this might make the spec easier, despite the additional rule in [expr]p5. For example, some expressions require that one of the operands has an integral type. If expressions observably could have reference type, this had to be adjusted so that both integral types and references to integral types are matched. I therefore agree with @Seth that a distinction between the type of a variable and the type of an expression referring to that variable makes sense (to me). Also in the light of variables of rvalue-reference type: All expressions that are names, i.e. all id-expressions, are lvalues - with the exception of enumerators. (Class member access expressions can be rvalues, but they're not id-expressions.) There is of course an asymmetry between variables and return types: For the former, we treat references and non-references equally as lvalues, whereas for return types, the value category is determined by the reference qualifier or lack thereof. By talking about expressions of reference type, it might be possible to lose sight of this asymmetry. This asymmetry is also the reason for the different rules of decltype(expression) vs decltype((expression)) - but there's no excuse to call the whole thing decltype if it's only sometimes about the declared type of a variable. As far as I know, you cannot observe the initial type of an expression prior to applying [expr]p5, so talking about the initial type to me only makes sense if it has explanatory value (and not because there indeed is, in some sense, an expression of reference type). P.S. I'm resubmitting this comment since I'm unsure if my earlier submission worked. Since I wrote that mail to Scott, let my clarify some points: It is true that an expression can have (initially) a reference type. In your example the function call expression f() has type int& (by 5.2.2/3 not 5.2.2/10 which is about the value category of the expression). But as soon as you recognize that the type is a reference, you adjust the type to int. That's why I tell people that an expression never has reference type. Because it is the adjusted type which matters (in overload resolution, template argument deduction, auto, decltype, ...). But if you take the standard literally then it is true that an expression can have (initially) reference type, although you cannot observe this initial type. @dyp: > By talking about expressions of reference type, it might be possible to lose sight of this asymmetry. In my opinion, it's the other way around, and here's why: As you mentioned, the function call expression 'f()' works very differently depending on whether 'f' is declared as 'int f()' or 'int& f()'. If we refused to talk about expressions of reference type, then the expression 'f()' would have type 'int' in both cases, which I'd say would make it more likely to lose sight of the asymmetry you talked about. Also, such an interpretation is incorrect from the standard's point of view, as the type of a function call expression is the same as the function's declared result type (standard reference in my previous answer). So, I think talking about expressions of reference type makes a lot of sense, as it helps us understand why the expression is treated differently later on, even though the reference has been removed 'for further analysis'. @dyp and @Marcel Wid: Consider this function definition, where 'B' is a class type. void f(B b, B& br) { b.mf(); br.mf(); } The 'initial', before adjustment, type of the expression 'b' is 'B', while for 'br', it's 'B&' (standard reference in my previous answer). Those 'initial' types are essential for interpreting the two full expressions, and they're very observable to me - they can change the way the full expressions are evaluated. Saying that 'it is the adjusted type which matters' may actually be confusing. Sure, we can construct other ways to think about this, but I think the way using the 'initial' reference type has its merits, and, given that the standard explicitly defines expressions of reference type, I think there are reasons to prefer it. @Marcel Wid: Thanks for pointing out that I should have cited 5.2.2/3 instead of 5.2.2/10 for the call expression. I've updated the post to reflect this. @dyp: As I hope I made clear in an earlier comment, my interest in the matter is for explanatory purposes, so perhaps we can agree that there is value in that realm for the idea that expressions can have reference type. Here's what I wrote in the earlier comment:." In essence, what I'm doing here is describing the effect of 5/5. It prevents readers from wondering why template type deduction doesn't deduce a reference type when a reference variable is passed, and it also prevents them from wondering why passing a reference variable to a reference parameter doesn't yield a reference to a reference. As for the standard itself, if you want to truly understand it, you have to recognize that expressions can start with a reference type (e.g., per 5.5.2/3), can have it stripped off (per 5/5), and can have it added back again (e.g., per 7.1.6.2/4 bullet 3).. (I was a bit sloppy in the usage of the term "reference qualifier" in my previous comment. What I meant were the ptr-operators that are added to object types, not the ref-qualifiers added to member function types.) @bogdan Well, the asymmetry is present in the value category of the expression. In the example, there is no difference in the decomposition or semantics of the expressions b.mf() and br.mf(). The initial types do not seem relevant to me in those examples. Yes, they do refer to objects of different scopes; yes, the types of the function parameter matter for the function call expression f(obj0, obj1). But for the class-member-access expressions b.mf and br.mf, those differences do not matter. In both cases, the object-expression is an lvalue. Overload resolution will select the same member function (declaration) for both function-call expressions. (Polymorphism doesn't change that.) The semantics of an expression are determined by two independent pieces of information. We can express these pieces for example as: - The kind (id-expression, function call, ..) of the expression and its initial type. - The value category and the type after removing references. We can also express these pieces of information in other ways, much like the basis vectors of a vector space. One has to admit that there are expressions of reference type in the Standard. But I think the origin of the "there are no expressions of reference type" is a simplification; a model of the specification. As far as I can see, you can form a very precise model of the specification with the simplification of "there are no expressions of reference type": Whenever an expression is analyzed, its type loses its referenceness. This referenceness is so brittle that you cannot even look at it with decltype to observe it; it seems unobservable to me. If you talk about expressions having reference type in the context of anything but the mere existence of those expressions, then I think that is a model of the actual spec. Such a model can be useful, for example if it is simpler than the actual rules. Typically, we restrict the applicability of such a model to achieve simplification: Newtonian mechanics is a good model as long as the objects have the right size and mass and are not too fast. @Scott Meyers You are a far more experienced teacher than I am. I wonder though if it is useful to talk about exceptions of the referenceness of expressions, a la "in this context it does care, in that context it does not care whether or not the expression has reference type". What I'm wondering is if it is possible and useful to teach another model of expressions to programmers that are not very experienced with Standardese. It seems to me the model you're referring to is akin to "expressions can have reference type, and there are contexts where this referenceness is ignored". The model that's behind "there are no expressions of reference type" to me necessarily includes describing expressions via the reference-less type and its value category. Once there is value category, we don't need the referenceness of an expression any more. In fact, the two are not "linearly dependent", to use the language of the vector basis example from my previous comment. If we do not include value category, we need not only to know the referenceness, but also the kind of the expression (variable, function call, cast?) to determine the semantics. The reason why I'm wondering is that to me, a model that only involves the two value categories and the reference-less type seems simpler than a model that needs to add exceptional rules and distinguish between variables and return values. (But then again, I'm not a very experienced teacher.) Neither model is entirely correct, as far as I can see. The former ("there are expressions of reference type, and there are contexts where it doesn't care") needs to introduce rules e.g. in type deduction where there are no such rules in the Standard. The latter ("there are no expressions of reference type") does not acknowledge that there are actually expressions with reference type in the Standard. Deciding which model is better can of course not be done solely on this point. A model is good if it has a clear application area where it is sufficiently precise; and then it needs to be as simple as possible. @dyp: A fundamental problem is that variables can be of reference type. There's no way to hide that from people. If x is of type int&, x is a reference. That has implications you can't get away from, e.g., it has to be initialized. But if you pass x to a template function, what type will be deduced for x? Its type is int&, so what is the obvious conclusion? But the obvious conclusion is wrong. So how do we explain that? One way is to split hairs and say that x, as a variable, is an int&, but x, as an expression, is an int. But that also requires explaining when something is a variable and when it's an expression, and it's frankly a can of worms. It's like trying to explain how a variable of type int&& is an lvalue, which is something I have extensive experience with, and trust me when I tell you that it's initially very confusing for virtually everybody (including me). I haven't tried teaching things that way, so I can't compare it to what I do, which is to tell people that for type deduction purposes, an argument's reference-ness is ignored. What I can say is that it's easy to motivate that, because if I have a template that seems to declare a by-value parameter (i.e., that declares a parameter of type T), it'd be counterintuitive if passing a reference argument turned that into a T& parameter. Of course, matters get even more confusing when universal references enter the picture, because then lvalue arguments are deduced to have a reference type. Which means that, strictly speaking, a variable of type int& is an expression of type int that's deduced to have a type of int&. But my way's no better: the variable has type int&, but its reference-ness is ignored for type deduction purposes, but then a & is slapped back on. There's just no way to make that sequence of events look anything but arbitrary, IMO. (@Scott Meyers: Apologies for the partial hijacking of the discussion, I'll shut up in a minute, I promise...) @dyp: I have to disagree with your analysis of the 'void f(B b, B& br)' example. I think there is a fundamental difference in semantics between 'b.mf()' and 'br.mf()': if 'mf' is virtual, then, of the two expressions, 'b.mf()' is the only one for which we can tell for sure, at compile time, what function will actually be called (or, to put it differently, expression 'b' is the only one for which the static type and dynamic type of the object referred to will always be the same). It seems to me that the fact that 'br.mf()' can result in a different function being called than the one that would be chosen statically is an essential property of 'br' being a reference type (in this case); it's essential for both the compiler and the human reading the code, and it's very observable. This property of 'br' is not a consequence of either the value-category or the type-after-removing-references properties in this case. So, in your subsequent description (nice one, by the way), I think you need one more basis vector to truly form a basis in your model; that could be the declared-type, but then that's not linearly independent of type-after-removing-reference. I see that as a problem with the model. I only intervened in the discussion because I thought the statement 'expressions don't have reference type' was too strong and a bit dangerous, since it runs contrary to explicit statements in the standard. I also think the statement 'the initial reference type of an expression is not observable' is too strong, and one of the reasons is the example above. In terms of what is the best model for teaching this C++ vector-space-of-properties, I think both alternatives have advantages and disadvantages of their own, and, if I had to teach it... I'd probably choose a third way :-) but it would probably include expressions of reference type. How do you teach the following? int&& f(); void g(int&& x) { int&& y = f(); int&& z = x; //ERROR! } Both expressions, x and f(), have (initial) type int&&. In my model, where an expression has 2 invariants, namely its (adjusted) type and its value category, I can easily explain the bahavior: The expression f() hat type int and is an xvalue (or more general an rvalue), while the expression x also has type int but is an lvalue. Again, I claim that it's the adjusted type AND the value category of an expression that matter. Of course, there is no single best model to teach these topics, but I want to motivate, why the model "expressions never have reference type" is IMO a good starting point. ." As I said earlier, it may be better for pedagogical reasons to speak of expressions having reference types, but I think it's absolutely incorrect to say that understanding expressions as having non-reference types (and having value categories) is "insufficient for purposes of understanding the Standard." That is, although the standard refers to expressions as having intermediate reference types, that language could easily be replaced, and whenever any part of the standard refers to an expression's type, template deduction rules, decltype, etc., it is always talking about the expression's final type. Nor is understanding that it is the final type which is formally significant an 'informal shorthand'. To the contrary, it is an 'informal shorthand' to skip the value category conversions and act as though these expressions have reference types in these contexts. --- The reference type was added to C++ as the programmer's handle for controlling expression value categories from C, in support of C++'s goal of giving programmers power similar to the built-in constructs. It's clear that what C++ tries to do is keep reference types and value categories consistent to this end. Since accessing a 'referred-to object' requires having a glvalue, reference types get converted to glvalues for expressions. And since types don't have value categories, getting a type from an expression (e.g., decltype) means transforming the expression's value category into a reference qualifier on the resulting type. In particular I wouldn't say that [expr]/5 is what motivates the decltype rules for producing reference types. Instead both rules, along with several others, all share the same motivation; to make reference qualifiers on types synonymous with value categories on expressions. As such, eliminating the back and forth between the two would, I think, mean completely eliminating value categories from the standard and replacing all that language with language to deal with expressions of reference types. --- Here's another argument: it is too much of a stretch to argue that "the expression's type" should be understood to refer to an expression's 'inital' type rather than it's final type. "An expression's type" is it's final, adjusted type, and is therefore never a reference type. This is why I say that the according to the standard, the type of `f()` is formally `int`, with an lvalue value category. @Seth: [...]although the standard refers to expressions as having intermediate reference types, that language could easily be replaced, and whenever any part of the standard refers to an expression's type, template deduction rules, decltype, etc., it is always talking about the expression's final type. Understanding the Standard requires dealing with it as it's written, not as it could be written, and 5.2.2/3 is an example of where the Standard refers to an expression's type as potentially being a reference, i.e., where, when the Standard talks about an expression's type, it's not talking about its final/adjusted type. There is no way to reconcile the idea that expressions never have reference type with this part of the Standard, and that's why I say that the shorthand "expressions never have reference type" is insufficient for understanding the Standard. @Marcel Wid: I'd explain the behavior of your function g as follows: 1. As function return types, rrefs are rvalues. 2. The initalization of y is fine, because rrefs can be initialized with rvalues. 3. All parameters are lvalues, regardless of type, so x is an lvalue. 3. The initialization of z is illegal, because you can't initialize an rref with an lvalue. Scott To clarify my earlier statement: there is no part of the standard in which an expression's type is taken to mean anything other than its 'final' type, excepting by necessity only the part that specifies the algorithm for determining that final type. For example, the specifications for template type deduction and decltype specifiers will refer to the types of expressions but never mean their initial types. 5.2.2/3 ([expr.call]/3) describes a step in the algorithm for determining an expression's type. "and that's why I say that the shorthand "expressions never have reference type" is insufficient for understanding the Standard." If you're only talking about specification for determining an expression's type, okay. But understanding, say, the template type deduction does not require ever knowing about an expression's 'initial' type. An 'initial' type is never needed for understanding any other part of the standard. @Scott Meyers I do acknowledge that there variables of reference type necessitate to deal with reference type. In an earlier comment, I've alluded to the asymmetry of variables of reference type versus function calls whose initial type is a reference. You say that it would be splitting hairs to differentiate between some x as a variable and the same x as an expression. I think a programmer already needs to understand that, since initializing a reference is fundamentally different from using it after the initialization; for example: int y = 42; int x = y; // not an assignment, binding to a reference x = y; // an assignment y = x; // an expression with the same behaviour as the above This is not just about the sign = in two contexts. In the initialization of a reference, we deal with the reference itself and need semantics that are different from the semantics of initializing the type referred to. When later dealing with the variable of reference type, it is as if we were dealing with the object referred to. I know only two occasions when we deal with variables themselves, instead of expressions referring to those variables: Initialization and decltype. The latter does two things, one of which is to yield the declared type of a variable. Both occasions need special treatment anyway. Therefore, I fail to see the can of worms you're mentioning. Would you mind giving an example? For me, a lot of rules just fell into place after realizing that effectively, expressions don't have reference type (that is, in every context where we analyze expressions or where the type of an expressions is required for the semantics of some super-expression, they don't have reference type). One example is the lvalueness of an expression that refers to a variable of rvalue-reference type. As you probably know, those kind of expressions originally were specified as rvalues, before it was realized that this leads to problems. As I see those problems, they're all related to the handle one gives to the rvalue by binding it to a name: with a name, I can refer to the same object multiple times, and the name can refer to some subobject of the actual (complete) object. Though I don't have a concise rule of what an lvalue is, being a name is a property that is sufficient to being an lvalue because of the identity that a name gives to an object. (Enumerators are names but rvalues, but they could be seen as a form of literals, that is, expressions referring to a value directly. Also, they're not variables.) And this is also how the Standard specifies that (id-)expressions referring to variables of rvalue reference type are lvalue-expressions: There simply is no dedicated rule, the rule for id-expressions indiscriminately applies to all variables. For forwarding references, the spec has been deliberately broken as far as I understand it: an inconsistency has been introduced to solve the forwarding problem. Since the inconsistency is in the Standard, it might not be reconcilable with the remaining rules even in a simplified model. P.S. Resubmitting a comment again. There seems to be an issue? Sometimes, I'm not getting a confirmation. @dyp: I'm sorry you're having trouble posting. As far as I know, that's a Blogger issue, and there's nothing I can do to resolve the problem. If you (or anybody else) is aware of something I can do to improve the situation (short of moving my blog to a different platform), please let me know. The distinction between variables and expressions that you draw is actually the distinction between declarations and expressions. I agree that that's something developers already have to understand, but even that has unfortunate consequences. C programmers moving to C++ tend to have great difficulty in understanding that in a declaration, "&" means reference, but in an expression, "&" means address-of. Except, of course, in the type specification part of a cast expression, where it can mean reference again. Another can of worms. Given a variable x, you seem to want to say it's a variable in declarations, but an expression everywhere else, except when passed by itself to decltype, when it's a variable again. That explanation works, I guess, but note that formally (per 7.1.6.2/4 as well as the grammar summary at the beginning of 7.1.6.2), decltype takes only expressions. Which means that in "decltype(x)", x is an expression that's treated as a variable. I thus disagree with your assertion that "in every context where we analyze expressions or where the type of an expressions is required for the semantics of some super-expression, they don't have reference type." In some (but not all) expressions used as arguments to decltype, they have reference type. It's this kind of special-case behavior that I consider a can of worms. As an aside regarding your view of names and lvalues, note that "this" is effectively a variable name that's not an lvalue. (In principle, the expression "&this" makes perfect sense and has obvious semantics, but it's not permitted, because "this" is defined to be an rvalue.) @bogdan (I have not seen exceptions to this rule, so I'll state it as an absolute) The Standard does not discriminate in the (immediate) context of any other expressions between expressions of lvalue-reference type and variables that are lvalues. This of course is also the case for calls of member functions as in `b.mf()` vs `br.mf()`. Both cases follow the same rule in the specification. (So again, the spec does not use the initial type of an expression to define any semantics but the value category of said expression. That's what I mean with the initial type of the expression is not observable.) Which function is actually called depends on another property that you'd have to add in both simplified models: the dynamic type of the object expression (the LHS of `.`) The fact that for `br.mf()` the function being called is not known from the immediate context is not unique to expressions of reference type. And similarly, the function that `br.mf` refers to could have been declared as `final` in some base class, so we could restore knowledge of which function is being called at compiler time. In a simplified model that has no expressions of reference type, one could say that a dynamic dispatch is always performed, and a compiler is free to perform static analysis to avoid the dynamic dispatch under the as-if rule. If you insist that the property of the static type of an expression can differ from the dynamic type of the expression is important, then I'd like to see in which parts of the Standard this property is actually used. I would guess that we can omit this property from the model "expressions don't have reference type" and lose only a small part of its area of applicability (if any at all), while keeping it simple at its valid area of applicability. As Scott Meyers mentioned earlier: dereferencing a pointer does not yield an expression of reference type currently in the Standard. So when you claim that there's a fundamental difference between `b.mf` and `br.mf`, you'd have to introduce a rule that either covers `br.mf` and some `p->mf`, or a separate rule for both, or make `*p` yield an expression of reference type. I think that is more complicated than just to say that the abstract machine always performs a dynamic dispatch (for virtual functions). @dyp: . @dyp: A few more bits and pieces: > Which function is actually called depends on another property that you'd have to add in both simplified models: the dynamic type of the object expression Yes, of course that property is needed, but I said something else too: in that example, the fact that 'b' is not a reference conveys essential information about the dynamic type of the object, namely that it will always be the same as the static type, and that in itself is also a property of the expression. > The fact that for `br.mf()` the function being called is not known from the immediate context is not unique to expressions of reference type. I never said it were. I specifically said that in that case, of the two expressions, the reference one has that property and the other one doesn't. Yes, there are other expressions with this property, and all those expressions involve pointers or references in one way or another. Just like I can't ignore a pointer dereference, I can't ignore a reference. They all have an essential common trait; I guess I would call it 'the pointer-like trait'. > And similarly, the function that `br.mf` refers to could have been declared as `final` in some base class, so we could restore knowledge of which function is being called at compiler time. That would amount to 'adjusting the experiment so that it conforms to the model', and that's not how good models are validated. > In a simplified model that has no expressions of reference type, one could say that a dynamic dispatch is always performed, and a compiler is free to perform static analysis to avoid the dynamic dispatch under the as-if rule. Yes, one could say that. And the programmer reading the code will have to do that static analysis as well. And what will be the first thing the programmer or the compiler will look at when statically analysing that example? Whether the object expression actually is of a reference type or not. Removing this from the model when you're clearly going to resort to it when needed just seems counterproductive to me. @dyp: (This post was supposed to appear before the other one, but it looks like it was overwritten instead.) . @Scott Meyers The posting issue might be related to the "preview" feature. When I try to preview my comment and then use the "Publish" button in the preview window, it seems to fail. First of all, since I'm tired of using a sentence two refer to either model, I'll introduce some bad names: "there are NO Reference-Type EXpressions" -> Nortex "EXpressions Can hAve Reference Type" -> Excart This might not be very relevant, but I purposely made a distinction between initialization and usage, not between declarations and expressions: Mem-initializers in the mem-initializer-list of a constructor are not declarations, but have the same reference-binding semantics that appear in the definitions of variables of reference type. "C programmers moving to C++ tend to have great difficulty in understanding that in a declaration, "&" means reference, but in an expression, "&" means address-of." Interesting! Though I can understand why this is not obvious. I'd probably try to differentiate between the postfix type-operator "&" and the prefix expression-operator "&". But I guess I'm digressing. The reason why I mentioned decltype specifically as a kind of exception to the "the referenceness of an expression is ignored" is because I think the decltype language feature is fundamentally broken: it yields two related, but not identical pieces of information about its operand - depending on what form the operand has. If the operand is a variable or function, it tells us the declared type of that entity. Otherwise, it tells us the type of the operand expression plus its value category. This leads to weird inconsistencies you'll probably know: int x; decltype(x) // int decltype((x)) // int& int&& y = move(x); decltype((y)) // int& as @Seth already said, decltype does not simply restore the referenceness of an expression. [to be continued... sorry for the long comment] @Scott Meyers [...continued] Therefore, I think decltype is in itself a can of worms. If you know a simple explanation of the weird behaviour of decltype in the Excart model, please let me know. Assuming we don't know any such simple explanation, I don't think it's a good example of a difficult-to-explain special case in the Nortex model. I can only agree that decltype does take only expressions. But I don't quite know what you want to say with "x is an expression that's treated as a variable". If we go the language-lawyer way and follow the strict wording of the spec, if the expression is an id-expression or class-member-access, the expressions is only used to tell us what entity it is referring to. The type of that entity is used as the resulting type; the type of the expression is not itself used in that case. I would also guess that decltype takes an expression because that's the easiest way to specify it grammatically; for example, A::x to "name" some variable in a base class or namespace necessarily is an expression, not a an identifier. I don't like playing language-lawyer here, since I think the whole discussion is only useful if we discuss the Nortex and Excart models. The Standard itself, as it is written, cannot be precisely described by Nortex, since - as you have pointed out - it is incorrect as a claim. In the Nortex model, one could easily explain decltype in a way very similar to the Standard: if the expression names a variable or function directly, the resulting type is the declared type of that variable or function. Otherwise, the resulting type is the type of the expression, plus an & if it is an lvalue, or an && if it is an xvalue. On the side-topic of "this": That is an interesting remark I'll have to think more about. Currently, I'd say that it's more like a literal, simply because it fundamentally is more like a value, not an object. I might describe it as a value whose meaning is "the address of the current class instance (subject)". Also, I'm stuck at the "obvious semantics" that an expression "&this" should have. I don't really understand what you're alluding to. @dyp: Since the original point of my post was to establish that expressions can have reference type, and you seem to agree that that's true for the Standard as it's written (which is the only Standard we have), I'll put you down as agreeing with me, take my winnings, and go home :-) Regarding "this", the only reason it seems more like a literal than an object is because it's defined to be an rvalue. If, instead, it were defined to be an lvalue of type T* const (for a class T) or, for const objects, const T * const, you be able to treat it like any other const lvalue, and the type yielded by "&this" would be T * const * (or, for const objects, const T * const *). When teaching C++ we should describe things "as is", i. e. as they are in standard. Or, we should give a warning like "currently we are not strict". So, if I wrote a C++ book, I would give a warning that I'm not strict at the beginning, then give some informal text about references and types, but then proceed to actual terminology, i. e. every expression has value category and (final) type, which is always non-reference. We should have some convention about what "type of expression" is. Can it be reference or no. Everywhere the standard refers to "type of expression" it assumes that it cannot be reference (including 4.1/1 [lvalue-to-rvalue conversion] and 7.1.6.2/4 [decltype definition]), with the exception for 5/5 and some places where we construct type of expression, for example mentioned 5.2.2/3. So, (final) "type of expression" never can be reference (but intermediate type can be reference). Let's assume we declare "int a". What is type of expression "a" now? Of course, it is "int", even if we will consider pre-5/5 type. We can say that it is "int &", but this would be our local convention only, which will contradict the standard. Okey, so "a" is int. It is lvalue of type "int". Now we declare "int &b = a". What is type of expression "b"? This expression is indistinguishable from "a". I. e. they both are lvalues, they both can be assigned to. If we have the following two functions: void f (const int &); void f (int &); then "f (a)" and "f (b)" will both call the second variant. Only way to distinguish "a" and "b" is decltype: decltype (a) and decltype (b) are different things (but in this case decltype gives us type of variable and not type of expression). So, this is pedagogically right way to think that "a" and "b" have the same type. Okey, so expression "b" has no reference type, and so (by analogue) any other expression has no reference type. >pre-5/5 type corresponds much more closely to intuition than the post-5/5 "adjusted" type. In this example, "a" and "b" are nearly the same and so should have the same type. But pre-5/5 types are different. So, post-5/5 is closer to intuition (at least to intuition of experienced programmer). Now about that br.mf example. b and br declared differently, so they are initialized differently. b initialized as a copy of actual argument and br initialized as a reference to actual argument. But after this initialization expressions b and br have the same type: they both are lvalues of type B. @bogdan { Now about that argument about virtual functions in br.mf example. As well as I know, the standard doesn't describe where virtual function table (vft) look up can be omitted. So, in b.mf () vft look up typically omitted, but this is implementation detail, this is just optimization. So, b and bf still are lvalues of type B. Well, I can agree that this b.mf example shows that referenceness sometimes matter. But "expression cannot have reference type" is too good convention. } @Unknown: > We should have some convention about what "type of expression" is. [...] Agreed. How about this convention: The type of an expression is what the standard says it is. This is what I use; it has the advantage that it doesn't need any disclaimers. > [...] Now we declare "int &b = a". What is type of expression "b"? [...] Please read my first post in this thread, where I indicate the sections in the standard that clearly and unambiguously specify that the type of the expression "b" is "int&". Not the "intermediate" type; this is the type. Saying that expression "b" has type "int" is simply incorrect. I think it's important to restate this, as you're making this wrong assertion several times in your post. The significance of reference types in expressions and the usefulness of building new conventions, different from the ones in the standard, about the types of expressions are subjects that have been discussed at length in this thread. Valuable arguments have been brought up on both sides, and I don't think it's worth repeating the same ideas. The same goes for "br.mf()", whether direct calls are just optimizations or not, and so on. I've made my point on that in a previous post. (I'm that "Unknown") @bogdan > The type of an expression is what the standard says it is. Unfortunately, the standard doesn't say what is "the type of expression". The standard has pre-5/5 type and post-5/5. And, according to the standard, both are "type of expression". So, we should have some agreement. > I indicate the sections in the standard that clearly and unambiguously specify that the type of the expression "b" is "int&" Okey, but 4.1/1 [lvalue-to-rvalue conversion] and 7.1.6.2/4 [decltype] use term "type of expression" and assume it is never reference. So, it is not clear from the standard that type of expression "b" is "int &". (And yes, this is inconsistency in the standard. Ideally, the standard should be fixed to say what "type of expression" is.) @Askar Safin: > Unfortunately, the standard doesn't say what is "the type of expression". The standard has pre-5/5 type and post-5/5. And, according to the standard, both are "type of expression". [...] I disagree. I believe the standard does say what the type of an expression is: it's what it says it is in the section that defines that expression. Everything else are transformations applied to the expression as part of the "analysis" that [5p5] refers to. If you want to think of expressions as having multiple types, it's your choice, if you think that makes things easier to understand, but I don't think that's what the standard says. Yes, there are inconsistencies in the standard's wording on this subject, but I tend to see them as unimportant, because all of them (that I know of) can be solved by the classic "yes, but you know what I mean". What's important here is to understand the semantics of references (part name, part pointer, as I like to say), and once that's clear, everything else falls into place, the wording being less important. There are other places where the standard is ambiguous or inconsistent and clarification is more difficult or impossible, and I'd prefer to see the committee focus on those. @bogdan > can be solved by the classic "yes, but you know what I mean" I understand the standard so: type of expression is non-reference type (because we use this in 4.1/1) and all other parts of the standard which contradict this, can be solved using "you know what I mean" :) @Askar Safin: I'm afraid you're looking for inconsistencies in the wrong place. There's no inconsistency between [4.1p1] and [7.1.6.2p4], on the one hand, and expressions having reference type on the other hand. The expressions that those paragraphs are referring to are undergoing "analysis"; they have already been transformed so that reference types have been replaced by the referred types. There is no contradiction here. When I agreed that there are inconsistencies, I was referring to cases like: -on the one hand, [5.2.9] and [5.2.10], which define the results of some casts to reference types as having non-reference type; -on the other hand, [5.4p1], which says "The result of the expression (T) cast-expression is of type T [...]", which means that, if T is U&, the result of the cast has reference type, and then goes on to say that this cast is actually defined in terms of the other casts.
http://scottmeyers.blogspot.com/2015/02/expressions-can-have-reference-type.html
CC-MAIN-2017-34
refinedweb
9,254
60.04
i want to get a general consensus on the format before we decide on the topic(s). feel free to submit new ideas on a format. Printable View i want to get a general consensus on the format before we decide on the topic(s). feel free to submit new ideas on a format. i think if you stick to an easy project... but give more points for innovation and adding in lots of neat features it willl be more acessible for the newbies around here... also having a 3 week windows you would be sure to have quite a bit of entries Well, the problem with big contests is that you need participants or it feels like a waste of time, and big contests take more time to make submissions, which make them less convenient for competitiors. Unfortunately, it's kinda hard to think of interesting small programs. I like the idea of small easy contests untill we get the hang of making this work, and maybe sometime soon have a more interesting / challenging contest. I think you won't be enthusiastic in taking part in a small contest, and after you've taken part in a big one, you are always nail biting for the result to be out. So, big ones are fun, and hence I prefer the big ones! Personally I think shorter is better..... some of us don't have tooo many hours to waste away on here ... :D agree with hammer I'm an advocate of the short and sweet program, even if I have a lot of time on my hands. Concise, to the point, mindbogglingly complex to even the well-trained eye...okay, maybe not quite to that extreme, but you get the idea. :rolleyes: As for a suggestion, how about coming up with the most creative way possible to do something which would otherwise be routine and boring. quzah's counting recursive program comes to mind. Or something along those lines, I can't quite remember.Or something along those lines, I can't quite remember.Code: #include <stdio.h> void print ( int i ) { if ( i > 0 ) print ( i - printf ( "%d", i ) ); } int main ( void ) { print ( 9 ); return 0; } -Prelude from the poll it is clear that there should be two contests: one easy and one difficult. so let's make a list of topics for each contest. I think there should be more useful 'small' apps, like the phonebook. If i remember correctly, the phone book was done....i could be wrong though. for the other idea, how about a VERY small RPG game, a very small one for the easy section. well no matter what u guys pick, i wouldn't be able to go on because i don't have my compiler:mad: i just formated my comp how about this: i put up two polls, one with easy topics and one with hard topics. easy topics would be beginner stuff, like writing an accounting program, or figuring out perfect numbers in the fastest time possible. hard topics would be stuff like a turing machine or a lisp interpreter. (more details to follow on poll). every topic mentioned will be included in the poll. (unless it exceeds 15, where i'll narrow it down to 15.) then two contest threads with the decided topic will be stickeyed to the top of the general board. and the judge choosing, contest enrollment, etc... will be done like normal. there is one point where i'm not sure on. should all contestants be permitted into the easy one? someone like prelude could easily win over someone like newbie_c0d3R_109. do you think that would be fair? I am so in favour of an RPG contest. It's not too terribly time consuming to write one, allows for a lot of creativity, and it's a topic that we could easily reuse (the programs would, hopefully, just keep getting better). Anyone can write an RPG, it could range from a choose-your-own-adventure type deal to a Moraff's world clone, and it is quite possible for someone with not-so-great programming eperience to win the contest through pure ingenuity. Here are some other ideas, which probably lean on the difficult side, although perhaps could be made easy I think. Story Generator Map Generator (Maze Generator?) (ASCII) graphics engine Fractal maker Obfuscated / shortest possible code to do X Edit: About easy and hard problems, I think that a good solution is to allow anyone to enter an easy contest, but rank the veteran and novice submissions seperately. Basically, vets should work with the same prompt, but be expected to have some feature of their program which really overshadows the prompt, not just have a really well-written submission; like say you made a word processor prompt (please don't, BTW. Very boring), and a vet enters, and decides to add grammer checking (an extreme example I know...). Actually, I don't see any reason why a vet shouldn't enter an easy contest with a novice submission either. It's just that programs that really just use the prompt as an excuse to make a bigger, more interesting program, should be adknowledged on their own (and hopefully thus encouraged, without scaring away submissions from people without so much free time :)).
https://cboard.cprogramming.com/brief-history-cprogramming-com/20357-third-round-contests-submit-ideas-printable-thread.html
CC-MAIN-2017-26
refinedweb
889
71.04
#include <movie.h> #include <movie.h> List of all members. Add code to the movie class to read/write text movie files. Add code for saving a movie file with adjusted colors. Default constructor. Constructor with an output file name. If a movie is created using this constructor, an output file is opened and pieces are written as they are added. Constructor for a movie with size frames. [inline] Destructor. It deletes the arrays. Function to get the limits from a movie. The gl_box class needs to get the limits from the current movie to help with setting the eye and focus coordinates. Function to read a movie from an animp movie file. If the file begins with "Animp001", it is read as an animp movie file. Otherwise it assumed to be a pdb file. Function to read 1 frame from the current movie file. Function to read arbitrary data from the current movie file. There are several read functions for various basic and array data types. Each of these calls this function to perform the read and passes an identifying string into this read to be part of possible error messages. Function to read a pdb (Protein Data Bank) file. The Protein Data Bank format is a commonly-used format for storing atomic structure of molecules. Animp can display a molecule from a pdb file using spheres for atoms and cylinders for bonds. It uses the CPK (Corey, Pauling, Kultun) color schemes for elements and uses atomic radii based on the non-ionic versions of atoms. Function to read an int from an animp movie file. Function to read an array of spheres with short coordinates. Function to read an array of spheres. Function to read an array of cylinders with short coordinates. Function to read an array of cylinders. Function to back up the FILE pointer to "un-read" an int. Several functions need to read an int and possibly decide not to use the value. Putback allows them to effectively put back the value so that another function can read that int next. Function to write an animp movie file. Function to write a frame to a animp movie file. Function to write 1 frame to an animp movie file. Function to write an int to an animp movie file. Function to write a string to an animp movie file. Function to write a arbitrary data to an animp movie file. This function is called by the other write functions to do the actual work. It attempts to write and prints an error message if the write fails. Function to print a movie to stdout. Function to add a static frame to a movie. Function to add a frame to a movie. Function to add a color to the movie's color array. Function to add a named color to the movie's color array. To color atoms conveniently add_color is used to add a color with a name like "He" for Helium. This adds the color to the colors array and adds entries to the color_table and rev_color_table maps. Then it is easy to get the color index from the name and vice-versa. Array of colors. Frame drawn in each image. Frame number for the current frame. The dynamic frames. FILE pointer used for reading/writing. Number of frames in frames array. Position in a movie file for the frame count. When a movie is written frame-by-frame, the frame count is not known until the end. At the end it is necessary to write the frame count in the movie file. The count_offset variable holds the address for writing the frame count. Whether colors have been written yet. Whether there are any valid limits yet. Minimum x, y and z coordinates. Maximum x, y and z coordinates.
http://animp.sourceforge.net/classmovie.html
CC-MAIN-2017-43
refinedweb
634
77.74
Python - yield keyword The yield enables a function to comeback where it left off when it is called again. This is the critical difference from a regular function. A regular function cannot comes back where it left off. The yield keyword helps a function to remember its state. Let's look at the following sample code which has 3 yields and it is iterated over 3 times, and each time it comes back to the next execution line in the function not starting from the beginning of the function body: def foo_with_yield(): yield 1 yield 2 yield 3 # iterative calls for yield_value in foo_with_yield(): print yield_value, Output 1 2 3 Simply put, the yield enables a function to suspend and resume while it turns in a value at the time of the suspension of the execution. In the previous same, what actually returns is a generator object. We can see it from a modified code: def foo_with_yield(): yield 1 yield 2 yield 3 x=foo_with_yield() print x print next(x) print x print next(x) print x print next(x) Output: <generator object foo_with_yield at 0x7f6e4f0f1e60> 1 <generator object foo_with_yield at 0x7f6e4f0f1e60> 2 <generator object foo_with_yield at 0x7f6e4f0f1e60> 3 The next() function takes a generator object and returns its next value. Repeatedly calling next() with the same generator object resumes exactly where it left off and continues until it hits the next yield statement. All variables and local state are saved on yield and restored on next(). Generators are closely tied with the iteration protocol. Iterable objects define a __next__() method which either returns the next item in the iterator or raises the special StopIteration exception to end the iteration. An object's iterator is fetched with the iter built-in function. The for loops use this iteration protocol to step through a sequence or value generator if the protocol is suspended. Otherwise, iteration falls back on repeatedly indexing sequences. To support this protocol, functions with yield statement are compiled specially as generators. They return a generator object when they are called. The returned object supports the iteration interface with an automatically created __next__() method to resume execution. Generator functions may have a return simply terminates the generation of values by raising a StopIteration exceptions after any normal function exit. The net effect is that generator functions, coded as def statements containing yield statement, are automatically made to support the iteration protocol and thus may be used any iteration context to produce results over time and on demand. In short, a generator looks like a function but behaves like an iterator. For more information on generator, please visit Python generators.
http://www.bogotobogo.com/python/python_function_with_yield_keyword_is_a_generator_iterator_next.php
CC-MAIN-2017-34
refinedweb
440
50.57
Getting the average to display mike statham Greenhorn Joined: Feb 24, 2012 Posts: 16 posted Feb 29, 2012 21:50:32 0 I need Someone to help me or show me what I need to do for the average to print out correctly import java.io.FileNotFoundException; import java.io.FileReader; import java.util.Scanner; public class StudentGrades { //Declare variables and make the total test a constant equal to 3, since there are 3 tests private static double TOTAL_TESTS = 3; private static double average; private static char grade; private static int numA; private static int numB; private static int numC; private static int numD; private static int numF; //Use an array to store the 3 test scores private static int[] testScore = new int[3]; private static String name; public StudentGrades() { //initialize the average, grade, letter grade and name to zero,empty and null average = 0; grade = ' '; name="null"; numA = 0; numB = 0; numC = 0; numD = 0; numF = 0; } public static void getAverage(Scanner inFile) { //create local variable to store temporary average in int tempAverage = 0; for (int num = 0; num <=2; num++) { testScore[num] = inFile.nextInt(); //Add all the scores together per student tempAverage = testScore[num] + tempAverage; //Divide the average by the total amount of tests(3) average = (double)tempAverage / (TOTAL_TESTS); } } public char calculateGrade(Scanner inFile) { //Assign a grade to the appropriate numerical value //A=90-100 B=80-89 C=70-79 D=60-69 F=Below 60 if (average <= 100 && average >= 90) { numA += 1; grade = 'A'; } else if (average < 90 && average >= 80) { numB += 1; grade = 'B'; } else if (average < 80 && average >= 70) { numC += 1; grade = 'C'; } else if (average < 70 && average >= 60) { numD += 1; grade = 'D'; } else { numF += 1; grade = 'F'; } //Return the appropriate grade return grade; } public static void main(String[] args) throws FileNotFoundException { //Open the file that you are reading the information from try (Scanner inFile = new Scanner(new FileReader("TestDate.txt"))) { StudentGrades averages = new StudentGrades(); //Read the input file until there is no text while (inFile.hasNext()) { // get the name of the student name = inFile.next(); // get the name of the student StudentGrades.getAverage(inFile); //Calculate the average grade = averages.calculateGrade(inFile); for (int num = 0; num <= 2; num++) { //calculate sum of all array elements } //Output each students name, test scores, average numerical grade and letter grade System.out.printf("%s\t has an average grade of %.2f You will receive a %s in this class.\n", name, average, grade); } System.out.printf("\nOverall Class Average is %.2f\n",grade/TOTAL_TESTS); System.out.println("\nThe following lists the number of students earning each letter grade:"); //print out the count of each number of letter grades System.out.println("\nNumber of A's = "+numA); System.out.println("Number of B's = "+numB); System.out.println("Number of C's = "+numC); System.out.println("Number of D's = "+numD); System.out.println("Number of F's = "+numF); //generates three random numbers between 0 and 50, calculates the average. int one,two,three; one=(int)(Math.random()*(51)); two=(int)(Math.random()*(51)); three=(int)(Math.random()*(51)); int average=(one+two+three)/3; System.out.printf("\n\nThe following program generates 3 random numbers, then averages them.\n"); System.out.printf("\nThe average of\t"+one+" "+two+" "+three+" is "+average); } } } output is: Connie has an average grade of 85.33 You will receive a B in this class. James has an average grade of 92.00 You will receive a A in this class. Susan has an average grade of 52.33 You will receive a F in this class. Jake has an average grade of 66.33 You will receive a D in this class. Karen has an average grade of 77.33 You will receive a C in this class. Bill has an average grade of 99.00 You will receive a A in this class. Fred has an average grade of 85.33 You will receive a B in this class. Cheryl has an average grade of 75.00 You will receive a C in this class. Pam has an average grade of 65.00 You will receive a D in this class. Steve has an average grade of 45.00 You will receive a F in this class. John has an average grade of 86.33 You will receive a B in this class. David has an average grade of 81.67 You will receive a B in this class. Corina has an average grade of 91.67 You will receive a A in this class. Delia has an average grade of 74.00 You will receive a C in this class. Evan has an average grade of 99.00 You will receive a A in this class. Overall Class Average is 21.67 ****HERE'S THE PROBLEM***** The following lists the number of students earning each letter grade: Number of A's = 4 Number of B's = 4 Number of C's = 3 Number of D's = 2 Number of F's = 2 The following program generates 3 random numbers, then averages them. The average of 22 43 49 is 38 Zeeshan Sheikh Ranch Hand Joined: Nov 20, 2011 Posts: 144 I like... posted Feb 29, 2012 23:04:55 0 System.out.printf("\nOverall Class Average is %.2f\n",grade/TOTAL_TESTS); I think reason you are not getting right results because you are dividing character type by double. That's the only logical error. MySQL Blog Sumiran Pradhan Greenhorn Joined: Mar 10, 2010 Posts: 12 posted Feb 29, 2012 23:49:29 0 Basically, you need to create another variable that is going to sum all your subjects or averages and then calculate. The formula that you use is incorrect. I agree. Here's the link: subject: Getting the average to display Similar Threads I think I'm stuck!! Help setting up an array and other issues Changing array I think and the print statement Actually I'm lost this problem baffles me All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter JForum | Paul Wheaton
http://www.coderanch.com/t/568999/java/java/average-display
CC-MAIN-2014-15
refinedweb
1,009
66.13
<< Will Long5,449 Points why does this say that it is not returning the hash when it explicitly say "return hash" def create_shopping_list hash = ["name" => "name", "item" => "array.new"] return hash end list = create_shopping_list def create_shopping_list hash = ["name" => "name", "item" => "array.new"] return hash end list = create_shopping_list 1 Answer Gilbert Kennen10,661 Points Hashes use curly braces, not square brackets. You are creating an array with a hash in the middle of it. [{"name" => "name", "item" => "array.new"}] You probably want to do: def create_shopping_list hash = {"name" => "name", "item" => "array.new"} hash end While I recognize this is a trivial method, standard Ruby practice is to only use return when you are breaking out of the middle of a method, otherwise it always returns the result of the last expression of the method. Will Long5,449 Points Will Long5,449 Points ohh
https://teamtreehouse.com/community/why-does-this-say-that-it-is-not-returning-the-hash-when-it-explicitly-say-return-hash
CC-MAIN-2022-33
refinedweb
142
71.34
Capture The Flag << BlackHoleCritter | GridworldTrailIndex | AntFarm >> Watch a movie of a CaptureTheFlag game Overview There are two Flags, one red one blue. Flag is a subclass of Actor, and overrides the act() method. It looks for all the occupied locations of the grid, and if there are less than 2 flags, it means it is the winner, and proceeds to remove all Actors that are not the same color as itself. Each team will start with the same number of AttackCritters each starting with a strength of 5. When they are initialized, they store the Color of its target. They move randomly like a Critter, but if they have a neighbor of the same color, their strength goes up. If they have a neighbor of the other color, their strength does down. If a neighbor is a Flag of their enemy's color, they remove it from the grid. If their strength is less than 1, they remove themselves from the grid (or for a less violent game, you can have them switch teams!). CaptureTheFlag.java import java.awt.Color; import info.gridworld.actor.*; import info.gridworld.grid.*; public class CaptureTheFlag { public static void main(String[] args) { ActorWorld battleField = new ActorWorld(); battleField.setGrid(new BoundedGrid(10, 19)); battleField.add(new Location(4,18), new Flag(Color.RED)); battleField.add(new Location(4,0), new Flag(Color.BLUE)); battleField.add(new Location(5,0), new Rock()); battleField.add(new Location(5,18), new Rock()); battleField.add(new Location(4,1), new Rock()); battleField.add(new Location(4,17), new Rock()); battleField.add(new Location(5,1), new Rock()); battleField.add(new Location(5,17), new Rock()); for (int i=0;i<5;i++){ battleField.add(new Location(2+i, 8),new AttackCritter(Color.BLUE, Color.RED)); battleField.add(new Location(2+i, 10),new AttackCritter(Color.RED, Color.BLUE)); } battleField.show(); } } Hints - Make accessor methods (getter and setter methods) to strengthso you can test and manipulate the AttackCritters - Be mindful of the post conditions for Critters! If you are changing the state of an Actor, it can only be in processActorsor in makeMove.
https://mathorama.com/apcs/pmwiki.php?n=Main.CaptureTheFlag
CC-MAIN-2021-04
refinedweb
352
51.55
This is your resource to discuss support topics with your peers, and learn from each other. 12-18-2008 11:48 AM Please pardon the "noob" nature of this question! I'm trying to get a "hello world" app to work for the first time. One of my Java files in the project has the line: import java.util.Calendar; This is really simple stuff. For example - when compiling this using javac from DOS - it works great. But when using the BlackBerry IDE I get the following compilation errors: D:\Java\BlackBerry\Algorithms.java:84: cannot find symbol symbol : variable DAY_OF_YEAR location: class java.util.Calendar sysdate.add(Calendar.DAY_OF_YEAR, delta); ^ D:\Java\BlackBerry\Algorithms.java:210: cannot find symbol symbol : method contains(java.lang.String) location: class java.lang.String if (lp_cipher_input.contains(kHeaderStr) && lp_cipher_input.contains(kFooterStr)){ ^ D:\Java\BlackBerry\Algorithms.java:210: cannot find symbol symbol : method contains(java.lang.String) location: class java.lang.String if (lp_cipher_input.contains(kHeaderStr) && lp_cipher_input.contains(kFooterStr)){ 3 errors I tried right-clicking on the project, selecting "Properties..." and adding entries under the "Imported JAR Files" area. Even though I "pointed it" to JAR files under my JDK directory, it still wouldn't work. Any help you could give me would be greatly appreciated! Thank you! Joe Solved! Go to Solution. 12-18-2008 11:55 AM Look like you are trying to compile "desktop" J2SE code with the J2ME compiler and libraries. Open up the javadocs for java.util.calendar and you will see that DAY_OF_YEAR is not implemented. 12-18-2008 11:56 AM - edited 12-18-2008 12:07 PM Just installed OS on my new computer and there is no JDE installed, so I cannot check. But I think there is no such constant declared in java.util.Calendar class that included into RIM API. java.util.Calendar from Java SE and java.util.Calendar from RIM API -- are a bit different. Check this link: 12-18-2008 12:00 PM Wow! Thank you for such a prompt response. Joe 12-18-2008 12:20 PM For a novice Blackberry developer the following links will be useful: and welcome to the club 12-18-2008 02:38 PM 12-18-2008 03:15 PM 12-18-2008 03:33 PM You're welcome Also check the following links: Developers @ Blackberry site
http://supportforums.blackberry.com/t5/Java-Development/First-Time-JDE-Use/m-p/110745
CC-MAIN-2015-35
refinedweb
393
61.22
Manually set the value of the @extended macro. SetExtended ( code [, return value] ) When entering a function @extended is set to 0. Unless SetExtended() is called, then @extended will remain 0 when the function ends. This means that in order for @extended to be set after a function returns, it must be explicitly set in the function. This also means you may need to backup the status of @extended in a variable if you are testing it in a While-WEnd loop. The return value parameter is optional. It is provided as a way to use the Return SetExtended(...) syntax to define the value to be returned at the same time as setting @extended. If a specific value is not set then the return value will be undefined and should not be used subsequently by the code. @extended is limited between the values of -2147483648 to 2147483647. SetError #include <MsgBoxConstants.au3> SetExtended(10) MsgBox($MB_SYSTEMMODAL, "", "Value of @extended is: " & @extended)
https://www.autoitscript.com/autoit3/docs/functions/SetExtended.htm
CC-MAIN-2018-30
refinedweb
159
58.38
iHalo: used to render halos (aka "light globes"). More... #include <ivideo/halo.h> Detailed Description iHalo: used to render halos (aka "light globes"). This interface can be used as well for any scalable semi-transparent 2D sprites. The "halo" is really just an alpha map; the sprite is a single-colored rectangle with more or less transparent portions (depends on alpha map). Definition at line 41 of file halo.h. Member Function Documentation Draw the halo given a center point and an intensity. If either w and/or h is negative, the native width and/or height is used instead. If the halo should be clipped against some polygon, that polygon should be given, otherwise if a 0 pointer is passed, the halo is clipped just against screen bounds. Query halo color. Query halo height. Query halo width. Change halo color. The documentation for this struct was generated from the following file: Generated for Crystal Space 1.4.1 by doxygen 1.7.1
http://www.crystalspace3d.org/docs/online/api-1.4.1/structiHalo.html
CC-MAIN-2014-15
refinedweb
164
68.87
| Join Last post 01-16-2008 6:27 PM by sliderhouserules. 0 replies. Sort Posts: Oldest to newest Newest to oldest I am curious to know to what degree the MVC team is keeping the principles that the P&P team has been touting (a la WCSF, etc.) as they're developing the MVC framework. I see a lot of talk about DI, etc. but don't really see the robust enterprise-level-framework feature set even in any discussions or "preview" information (like Phil will post -- IE namespaces for routes is coming). In particular I am talking about modular architecture that allows composite applications (or frameworks) to be easily built. A particular need is the ability to separate the application vertically into modules, and have those modules be pluggable/swappable through configuration. Another concern of mine is robust security. I've always felt that the out-of-the-box security features offered in ASP.NET are rather Mickey Mouse. Who wants to take a large web site with hundreds of pages and try to manage security in web.config? Who can seriously take a large customizable application and hard-code roles into stuff without shaking your head at it? Enterprise development, in my experience, needs to focus on giving the operations people the maximum amount of control over the application that they manage, and not require code changes for rather simple things that should be covered by design (for instance, simply renaming a role cause someone wants it to be "Administrator" instead of "admin" that some developer named it). Along the lines of some of the stuff I've seen on the forums here and in some blog posts, and in line with what little I understand about the Enterprise Library security features, I'd like to see a very simple security model based on Rules. Rules can be hard-coded into the application via attributes, then the ops people can group Rules into Roles, and then map Users to Roles -- and they can change it all they want without any code changes! Basically what Adam has here in his Create method, but attribute based: I don't want to rant. I just want to say that this framework is so elegant it has me very excited. But I'm not going to be using it to build a blog engine. I'm going to be building enterprise-level applications based on a framework that allows us to plug different versions of the same module (CustomerService, for example) into different implementations for different customers. Scott Guthrie said in his ALT.NET talk that if you're doing enterprise development, you'll probably want to use MVC. Please hold true to that, and don't base the design on making it easy to build blog engines. Advertise | Ads by BanManPro | Running IIS7 Trademarks | Privacy Statement © 2009 Microsoft Corporation.
http://forums.asp.net/t/1206611.aspx
crawl-002
refinedweb
478
51.58
Ks0068 keyestudio 37 in 1 Sensor Kit for Arduino Starters Contents - 1 kesestudio 37 in 1 Sensor Kit for Arduino Starters - 2 Summary - 3 Project Details - 3.1 Project 1: White LED Light - 3.2 Project 2: Red LED Light - 3.3 Project 3: 3W LED Module - 3.4 Project 4: RGB LED - 3.5 Project 5: Analog Temperature - 3.6 Project 6: Photocell Sensor - 3.7 Project 7: Analog Sound - 3.8 Project 8: Analog Rotation Sensor - 3.9 Project 9: Passive Buzzer - 3.10 Project 10: Digital Buzzer - 3.11 Project 11: Digital Push Button - 3.12 Project 12: Digital Tilt Sensor - 3.13 Project 13: Photo Interrupter - 3.14 Project 14: Capacitive Touch - 3.15 Project 15: Knock Module - 3.16 Project 16: Hall Magnetic Sensor - 3.17 Project 17: Line Tracking Sensor - 3.18 Project 18: Infrared Obstacle Avoidance - 3.19 Project 19: PIR Motion Sensor - 3.20 Project 20: Flame Sensor - 3.21 Project 21: Vibration Sensor - 3.22 Project 22: Analog Gas Sensor - 3.23 Project 23: Analog Alcohol Sensor - 3.24 Project 24: Digital IR Transmitter - 3.25 Project 25: Digital IR Receiver - 3.26 Project 26: Rotary Encoder - 3.27 Project 27: LM35 Linear Temperature - 3.28 Project 28: 18B20 Temperature Sensor - 3.29 Project 29: ADXL345 Three Axis Acceleration - 3.30 Project 30: DHT11 Temperature and Humidity Sensor - 3.31 Project 31: Bluetooth Module - 3.32 Project 32: TEMT6000 Ambient Light - 3.33 Project 33: SR01 Ultrasonic Sensor - 3.34 Project 34: Joystick Module - 3.35 Project 35: DS3231 Clock Module - 3.36 Project 36: 5V Relay Module - 3.37 Project 37: Vapor Sensor - 4 Resources - 5 Buy from kesestudio 37 in 1 Sensor Kit for Arduino Starters - Sensor kit for Arduino - Based on open-source hardware - 37 kinds of sensors packed in one box - To make interesting projects Summary This. Now, let us embrace this fascinating world of ARDUINO and learn together! Project Details Project 1: White LED Light Introduction This is a white LED module. The main function is to control a plugin LED on and off. When connecting to ARDUINO, after programming, it will emit white red. Features - Control interface: Digital - Working voltage: DC 3.3-5V - Pin pitch: 2.54mm - LED color: white - Easy to use - Useful for light projects Connect It Up Connect the LED module to control board using three jumper wires. Then connect the control board to your PC with a USB cable. _3<< Project 2: Red LED Light Introduction This is a red LED module. The main function is to control a plugin LED on and off. When connecting to ARDUINO, after programming, it will emit red white. Features - Control interface: Digital - Working voltage: DC 3.3-5V - Pin pitch: 2.54mm - LED color: red - Easy to use - Useful for light projects Technical Details - Dimensions: 34mm*20mm*11.5mm - Weight: 2.7g Connect It Up Connect the red LED module to control board using three jumper wires. Then connect the control board to your PC with a USB cable. _6<< Project 3: 3W LED Module Introduction This LED module is of high brightness because the lamp beads it carries is 3W. We can apply this module to Arduino projects. For example, intelligent robots can use this module for illumination purpose. Please note that the LED light can't be exposed directly to human eyes for safety concerns. Specification - Color temperature: 6000~7000K - Luminous flux: 180~210lm - Current: 700~750mA - IO Type: Digital - Supply Voltage: 3.3V to 5V - Power: 3W - Light angle: 140 degree - Working temperature: -50~80℃ - Storage temperature: -50~100℃ - High power LED module, controlled by IO port microcontroller - Great for Robot and search & rescue platform application Sample Code // } Result Done wiring and powered up,upload well the code, both D13 led and the led on the module blink for one second then off, circularly. Project 4: RGB LED Introduction This is a full-color LED module, which contains 3 basic colors-red, green and blue. They can be seen as separate LED lights. After programming, you can turn them on and off by sequence or can also use PWM analog output to mix three colors to generate different colors. Specification - Color: red, green and blue - Brightness: High - Voltage: 5V - Input: digital level Sample); } void loop() {for(val=255; val>0; val--) {analogWrite(11, val); analogWrite(10, 255-val); analogWrite(9, 128-val); delay(1); } for(val=0; val<255; val++) {analogWrite(11, val); analogWrite(10, 255-val); analogWrite(9, 128-val); delay(1); } } Result Done uploading the code, you should see the RGB LED flashing with different colors. Project 5: Analog Temperature into degrees Celsius temperature via simple programming, finally to display it. It's both convenient and effective, thus it is widely applied in gardening, home alarm system and other devices. Specification - Interface Type: analog - Working Voltage: 5V - Temperature Range: -55℃~315℃ Sample Code Copy and paste the below code to Arduino software. void setup() {Serial.begin(9600); } // the loop routine runs over and over again forever: void loop() {int sensorValue = analogRead(A0); Serial.println(sensorValue); delay(1); } The above code is only for analog value. You can see that the analog value is changing according to the temperature change in the environment. But it’s not very obvious. Let’s solve this by using the following equation. Then upload the code below to the Arduino board. The value read from the serial port is similar to normal temperature. e.g. The temperature right now is 30°C. #include <math.h> void setup() { Serial.begin(9600); } void loop() { double val=analogRead(0); double fenya=(val/1023)*5; double r=(5-fenya)/fenya*4700; Serial.println( 1/( log(r/10000) /3950 + 1/(25+273.15))-273.15); delay(1000); } Result Done wiring and powered up, upload well the code, then open the serial monitor, you will see the current temperature value. Shown below. Project 6: Photocell Sensor Introduction Photocell is commonly seen in our daily life and is mainly used in intelligent switch, also in common electronic design. To make it more easier and effective, we supply corresponding modules. Photocell. Specification - Interface Type: analog - Working Voltage: 5V Sample Code int sensorPin =A0 ; int value = 0; void setup() { Serial.begin(9600); } void loop() { value = analogRead(sensorPin); Serial.println(value, DEC); delay(50); } Result Done wiring and powered up, upload well the code, then open the serial monitor, if cover the photocell on the sensor with your hand, you will see the analog value decrease. Shown as below. Project 7: Analog Sound Introduction The keyestudio microphone sensor is typically used in detecting the loudness in ambient environment. The Arduino can collect its output signal by analog input interface. The S pin is analog output, that is voltage signal real-time output of microphone. The sensor comes with a potentiometer, so that you can turn it to adjust the signal gain. It also has a fixed hole so that you can mount the sensor on any other devices. You can use it to make some interactive works, such as a voice operated switch. Specification - Operating voltage: 3.3V-5V(DC) - Operating current: <10mA - Interface:3PIN - Output signal: Analog Sample Code int sensorPin =A0 ; // define analog port A0 int value = 0; //set value to 0 void setup() { Serial.begin(9600); //set the baud rate to 9600 } void loop() { value = analogRead(sensorPin); //set the value as the value read from A0 Serial.println(value, DEC); //print the value and line wrap delay(200); //delay 0.2S } Test Result Connect it up and upload the code successfully, then open the serial monitor on the right upper corner of Arduino IDE. The analog value will pop up on the monitor window. The greater the sound, the greater the analog value is. Project 8: Sample Code void setup() { Serial.begin(9600); //Set serial baud rate to 9600 bps } void loop() { int val; val=analogRead(0);//Read rotation sensor value from analog 0 Serial.println(val,DEC);//Print the value to serial port delay(100); } Result Done wiring and powered up, upload well the above code, then open the serial monitor and set the baud rate as 9600, finally you will see the analog value. If rotate the knob on the rotation sensor, the value will be changed within 0-1023. Shown below. Project 9: Passive Buzzer Introduction We can use Arduino to make many interactive works of which the most commonly used is acoustic-optic display. The circuit in this experiment can produce sound. Normally, the experiment is done with a buzzer or a speaker while buzzer is. Specification - Working voltage: 3.3-5v - Interface type: digital Sample Code int buzzer=3;//set digital IO pin of the buzzer void setup() { pinMode(buzzer,OUTPUT);// set digital IO pin pattern, OUTPUT to be output } void loop() { unsigned char i,j;//define variable while(1) { for(i=0;i<80;i++)// output a frequency sound { digitalWrite(buzzer,HIGH);// sound delay(1);//delay1ms digitalWrite(buzzer,LOW);//not sound delay(1);//ms delay } for(i=0;i<100;i++)// output a frequency sound { digitalWrite(buzzer,HIGH);// sound digitalWrite(buzzer,LOW);//not sound delay(2);//2ms delay } } } Test Result After downloading the program, buzzer experiment is complete. You should hear the buzzer ringing. Project 10: Digital Buzzer Introduction Sample Code int buzzPin = 3; //Connect Buzzer on Digital Pin3 void setup() { pinMode(buzzPin, OUTPUT); } void loop() { digitalWrite(buzzPin, HIGH); delay(1); digitalWrite(buzzPin, LOW); delay(1); } Test Result After uploading the code, you can hear the buzzer beep continually. Project 11: Digital Push Button Introduction This is a basic button application module. Momentary Pushbutton Switch usually stays open. When it is pressed down, circuit connected; when it is released, it will bounce back to the status of disconnection. The module has three pins for easy connection. You can simply plug it into an IO shield to have your first try of Arduino. Details - Interface: Digital - Supply Voltage: 3.3V to 5V - Easy to plug and operate - Large button keypad and high-quality button cap - Standard assembling structure - Easily recognizable pins - Icons illustrate sensor function clearly - Achieve interactive works Sample Code /* # When you push the digital button, the Led 13 on the board will turn on. Otherwise,the led turns off. */ int ledPin = 13; // choose the pin for the LED int inputPin = 3; // Connect sensor to input pin 3 void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inputPin, INPUT); // declare pushbutton as input } void loop(){ int val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH digitalWrite(ledPin, LOW); // turn LED OFF } else { digitalWrite(ledPin, HIGH); // turn LED ON } } Result When you push the digital button, the Led 13 on UNO board will be on. When release the button,the led is off. Shown as below. Project 12: Digital Tilt Sensor Introduction Tilt. Specification - Supply Voltage: 3.3V to 5V - Interface: Digital } } Result Upload the code to the board. Then tilt the sensor, you will see the led on the sensor is turned on. Shown as below. Project 13: Photo Interrupter 14: Capacitive Touch Introduction Are you tired of clicking mechanic button? Well, try our capacitive touch sensor. You can find touch sensors mostly used on electronic device. So upgrade your Arduino project with our new version touch sensor and make it cool!! This little sensor can "feel" people and metal touch and feedback a high/low voltage level. Even isolated by some cloth and paper, it can still feel the touch. Its sensitivity decreases as isolation layer gets thicker. Specification - Supply Voltage: 3.3V to 5V - Interface: Digital } } Result Done wiring and powered up, upload well the code, then touch the sensor with your finger, both D2 led on the sensor and D13 indicator on UNO board are on. Otherwise, those two indicators are turned off. Project 15: Knock Module This is a knock sensor module. When you knock it, it can send a momentary signal. You can combine it with Arduino to make some interesting experiment, e.g. electronic drum. - Working voltage: 5V Sample Code int Led=13;//define LED interface int Shock=3;//define knock sensor interface int val;//define digital variable val void setup() { pinMode(Led,OUTPUT);//define LED to be output interface pinMode(Shock,INPUT);//define knock sensor to be output interface } void loop() { val=digitalRead(Shock);//read the value of interface3 and evaluate it to val if(val==HIGH)//when the knock sensor detect a signal, LED will be flashing { digitalWrite(Led,LOW); } else { digitalWrite(Led,HIGH); } } Result Upload the code to the board. When the sensor detects a knock signal, both the led on the sensor and led 13 on the UNO board are turned on. Extension You can extend to connect an external LED; when knock the sensor, the external LED will turn on. For example: Project 16: Sample Code int ledPin = 13; // choose the pin for the LED int inputPin = 3; // Connect sensor to input pin 3 int val = 0; // variable for reading the pin status void setup() { pinMode(ledPin, OUTPUT); // declare LED as output pinMode(inputPin, INPUT); // declare push button as input } void loop(){ val = digitalRead(inputPin); // read input value if (val == HIGH) { // check if the input is HIGH digitalWrite(ledPin, LOW); // turn LED OFF } else { digitalWrite(ledPin, HIGH); // turn LED ON } } Result Wire it up and upload well the code to board, you will see that D13 indicator on UNO board is off, and led on the module is also off. But if put a magnetic ball close to the hall module, you will see the D13 indicator on UNO board is turned on, and led on the module is also turned on. Project 17: Line Tracking Sensor-PIN (1 - signal ; 2 - power ; 3 - power supply negative) - Output Level: TTL level Sample Code ///Arduino Sample Code void setup() { Serial.begin(9600); } void loop() { Serial.println(digitalRead(3)); // print the data from the sensor delay(500); } Result Done uploading the code to board, open the serial monitor and set the baud rate as 9600, then you can see the data from the sensor. Shown below. Project 18: Infrared Obstacle Avoidance to+50℃ - Detection distance: 2-40cm - IO Interface: 4 PIN (-/+/S/EN) - Output signal: TTL voltage - Accommodation mode: Multi-circle resistance regulation - Effective Angle: 35° Sample Code const int sensorPin = 3; //); } } Result Done uploading the code to board, you can see the led on both UNO board and obstacle detector sensor is turned on. If we put a foam block in front of the sensor, this time when sensor detects the obstacle, sled on the sensor will be turned on. Project 19: PIR Motion Sensor Introduction: ℃ - Output Voltage: High 3V, low 0V - Output Delay Time (High Level): About 2.3 to 3 Seconds - Detection angle: 100 ° - Detection distance: 7 meters - Output Indicator LED (When output HIGH, it will be ON) - Pin limit current: 100mA Connection Diagram: Connect the S pin of module to Digital 3 of UNO board, connect the negative pin to GND port, positive pin to 5V port. Sample Code: byte sensorPin = 3; byte indicator = 13; void setup() { pinMode(sensorPin,INPUT); pinMode(indicator,OUTPUT); Serial.begin(9600); } void loop() { byte state = digitalRead(sensorPin); digitalWrite(indicator,state); if(state == 1)Serial.println("Somebody is in this area!"); else if(state == 0)Serial.println("No one!"); delay(500); } Result Done wiring and powered up, upload well the code, if the sensor detects someone moving nearby, D13 indicator on UNO board will light up, and "Somebody is in this area!" is displayed on the serial monitor. If no movement, D13 indicator on UNO board not lights, and "No one!" is displayed on the serial monitor. Project 20: Flame Sensor Introduction This flame sensor can be used to detect fire or other lights with wavelength stands at 760nm ~ 1100nm. to 85℃ - Interface: Digital Connection Diagram Connect the D0 pin to digital 2, GND pin to GND port, VCC pin to 5V port. (State == HIGH) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } Result Done wiring and powered up, upload well the code to the board. Then if you put a lighter close to the sensor, when the sensor detects the flame, another led on the sensor is turned on. Project 21: Vibration Sensor Introduction++; } Project 22: Analog Gas Sensor Introduction This analog gas sensor - MQ2 is used in gas leakage detecting equipment in consumer electronics and industrial markets. This sensor is suitable for detecting LPG, I-butane, propane, methane, alcohol, Hydrogen and smoke. It has high sensitivity and quick response. In addition, the sensitivity can be adjusted by the potentiometer. Specification - Power supply: 5V - Interface type: Analog - Wide detecting scope - Quick response and High sensitivity - Simple drive circuit - Stable and long lifespan gas, the value will make a change. Project 23: Analog Alcohol Sensor Introduction This analog gas sensor - MQ3 is suitable for detecting alcohol. It can be used in a breath analyzer. It has good selectivity because it has higher sensitivity to alcohol and lower sensitivity to Benzine. The sensitivity can be adjusted by rotating the potentiometer. Specification - Power Supply: 5V - Interface Type: Analog - Quick response and High sensitivity - Simple drive circuit - Stable and long service life alcohol gas, the value will make a change. Project 24: Digital IR Transmitter Introduction IR Transmitter Module is designed for IR communication which is widely used for operating the television device from a short line-of-sight distance. The remote control is usually contracted to remote. Since infrared (IR) remote controls use light, they require line of sight to operate the destination device. The signal can, however, be reflected by mirrors, just like any other light sources. If part, which has an IR transmitter mimicking the original IR control. Infrared receivers also tend to have a more or less limited operating angle, which mainly depends on the optical characteristics of the phototransistor. However, it’s easy to increase the operating angle using a matte transparent object in front of the receiver. Specification - Power Supply: 3-5V - Infrared Center Frequency: 850nm-940nm - Infrared Emission Angle: about 20degree - Infrared Emission Distance: about 1.3m (5V 38Khz) - Mounting Hole: inner diameter is 3.2mm, spacing is 15mm Sample Code 1: int led = 3; void setup() { pinMode(led, OUTPUT); } void loop() { digitalWrite(led, HIGH); delay(1000); digitalWrite(led, LOW); delay(1000); } In the darkness of the environment, you are going to see blinking blue light on phone's screen when using camera to shoot the infrared LED. Upload well the above code to the board, the led on the sensor will blink red light. In the following, let’s move on to an interactive example between IR receiver and IR transmitter module. Infrared Remote/Communication: Hardware List - UNO R3 x2 - Digital IR Receiver x1 - IR Transmitter Module x1 Get Arduino library Arduino-IRremote and install it. Note: here if you have no two main boards, you can replace it with the breadboard for connection, may be more easier and convenient. Connection Diagram For IR Transmitter: Notice: Arduino-IRremote only supports D3 as transmitter. For IR Receiver: connect it to D11 port. Upload code 2 to the UNO connected with IR Transmitter: #include <IRremote.h> IRsend irsend; void setup() {} void loop() { irsend.sendRC5(0x0, 8); //send 0x0 code (8 bits) delay(200); irsend.sendRC5(0x1, 8); delay(200); } Upload code 3 to the UNO connected with IR Receiver: #include <IRremote.h> const int RECV_PIN = 11; const int LED_PIN = 13; IRrecv irrecv(RECV_PIN); decode_results results; void setup() {Serial.begin(9600); irrecv.enableIRIn(); // Start the receiver } void loop() {if (irrecv.decode(&results)) { if ( results.bits > 0 ) { int state; if ( 0x1 == results.value ) { state = HIGH; } else { state = LOW; } digitalWrite( LED_PIN, state ); } irrecv.resume(); // prepare to receive the next value }} Test Result When IR Receiver module receives the infrared signal from IR Transmitter, D1 led on the IR Receiver module will blink.Shown as below figure. Project 25: Digital IR Receiver Introduction IR is widely used in remote control. With this IR receiver, Arduino project is able to receive command from any IR remoter controllers if you have right decoder. Well, it will be also easy to make your own IR controller using IR transmitter. Specification - Power Supply: 5V - Interface: Digital - Modulation Frequency: 38Kh Note: before compiling the code, do remember to place the library into libraries directory of Arduino IDE. Otherwise, compiling will fail. } } IR Remote Library includes some sample codes for sending and receiving: IR Remote Library Result Done wiring and uploading the code, then control the IR receiver module by an infrared remote control, D1 led will flash. Shown as below. Project 26: Rotary Encoder Introduction The rotary encoder can count the pulse outputting times during the process of rotation in positive and reverse direction by rotating. This rotating counting is unlimited, not like potential counting. It can be restored to initial state to count from 0. Specification - Power Supply: 5V - Interface: Digital); } } Result Wiring well and uploading the above code, you can rotate the encoder module to randomly control two LED modules on and off. When you rotate the encoder module, one LED module is turned on first but another one is off. If you continue to rotate the encoder module, one LED module becomes off while another one is turned on, repeatedly. Project 27: LM35 Linear Temperature Introduction LM35 Linear Temperature Sensor is LM35 linear temperature sensor and sensor-specific Arduino shield can be easily combined. Specification - Based on the semiconductor LM35 temperature sensor - Can be used to detect ambient air temperature - Sensitivity: 10mV per degree Celcius - Functional Range: 0 degree Celsius to 100 degree Celsius); } Result Wire it up as the above diagram and upload well the code to the board, then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature value shown below. The value may be slight difference due to different place and weather. Project 28: 18B20 Temperature Sensor Introduction: DS18B20 is a digital temperature sensor. It can be used to quantify environmental temperature testing. The temperature range is -55 ~ +125 ℃, inherent temperature resolution 0.5 ℃. It also support multi-point mesh networking. The DS18B20 can be deployed to achieve multi-point temperature measurement. It has a 9-12 bit serial output. Specification: - Supply Voltage: 3.3V to 5V - Temperature range: -55 °C ~ +125 °C - Interface: Digital Sample Code: OneWire Library Download: ); //to slow down the output so it is easier to; } Done uploading the code to the board, open the serial monitor, and you can see the measured temperature data. Project 29: ADXL345 Three Axis Acceleration Introduction: degrees. Specification - 2.0-3.6VDC Supply Voltage - Ultra Low Power: 40uA in measurement mode, 0.1uA in standby@ 2.5V - Tap/Double Tap Detection - Free-Fall Detection - SPI and I2C Interface Sample Code The circuit connection is follows: - VCC: 5V - GND: ground - SCL: UNO A5 - SDA: UNO A4 #include <Wire.h> //); } Result Wiring as the above diagram and power on, then upload the code and open the serial monitor, it will display the triaxial acceleration of sensor and its status, as the graph shown below. Project 30: DHT11 Temperature and Humidity Sensor_56<< Specification - Supply Voltage: +5 V - Temperature Range: 0-50 °C error of ± 2 °C - Humidity: 20-90% RH ± 5% RH error - Interface: Digital Sample Code Download the DHT11Lib. Then open the serial monitor and set the baud rate as 9600, finally you will see the current temperature and humidity value. Project 31: Bluetooth Module Introduction. Specification -: 5 V DC 50mA - Operating temperature: -20 to 55℃ Sample Code int val; int ledpin=13; void setup() { Serial.begin(9600); pinMode(ledpin,OUTPUT); } void loop() { val=Serial.read(); if(val=='a') { digitalWrite(ledpin,HIGH); delay(250); digitalWrite(ledpin,LOW); delay(250); Serial.println("keyestudio"); } } Project 32: TEMT6000 Ambient Light Introduction: At some point you are going to sense ambient brightness with better precision than your trusty photoresistor without adding complexity to your project. When that day comes, go get yourself a TEMT6000 ambient light sensor. The TEMT6000 is supposed to be adapted to the sensitivity of the human eye, but found it preformed using it in your project. as you like, the output value will just be lower. Sample Code You can not get more simpler } Result Wiring well and uploading the code above, open the serial monitor of Arduino software. Then cover the sensor with your hand or a paper, the light becomes weak, finally you will see the value showed on monitor decrease. Project 33: SR01 Ultrasonic Sensor Introduction The Keyestudio SR01 Keyestudio SR01 Ultrasonic Sensor with an Arduino Sample Code - VCC to arduino 5v - GND to arduino GND - Echo to Arduino pin 7 - Trig to Arduino pin 8 #define echoPin 7 // Echo Pin #define trigPin 8 //); } Result After upload the code to the board, open the serial monitor of Arduino IDE, you can see the distance value measured by ultrasonic sensor. Project 34: Joystick Module Introduction. Specification - Supply Voltage: 3.3V to 5V - Interface: Analog x2, Digital x1 Sample Code); } Result Wiring well and uploading the code, open the serial monitor and set the baud rate to 9600, push the joystick, you will see the value shown below. Project 35: DS3231 Clock Module Introduction DS3231 is equipped with integrated TCXO and crystal, which make℃ - Working temperature: -40 ~ C to +85 ~ C - 16 pins Small Outline Package (300mil) Connection Diagram This module adopts the IIC test method, so we only need to connect SDA to Arduino A4; SCL to A5; positive pin to VCC; negative pin to GND. Sample Code Before compiling the code, you’d better put DS3231 library under file into Arduino catalogue. #include <Wire.h> #include "DS3231.h" DS3231 RTC; //Create the DS3231 object char weekDay[][4] = {"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; //year, month, date, hour, min, sec and week-day(starts from 0 and goes to 6) //writing any non-existent time-data may interfere with normal operation of the RTC. //Take care of week-day also. DateTime dt(2011, 11, 10, 15, 18, 0, 5);//open the serial port and you can check time here or make a change to the time as needed. void setup () { Serial.begin(57600);//set baud rate to 57600 Wire.begin(); RTC.begin(); RTC.adjust(dt); //Adjust date-time as defined 'dt' above } void loop () { DateTime now = RTC.now(); //get the current date-time Serial.print(now.year(), DEC); Serial.print('/'); Serial.print(now.month(), DEC); Serial.print('/'); Serial.print(now.date(), DEC); Serial.print(' '); Serial.print(now.hour(), DEC); Serial.print(':'); Serial.print(now.minute(), DEC); Serial.print(':'); Serial.print(now.second(), DEC); Serial.println(); Serial.print(weekDay[now.dayOfWeek()]); Serial.println(); delay(1000); } Before compiling the code, you’d better put DS3231 library under file into Arduino catalogue. When the above steps are done, you can upload the code to arduino and open the serial monitor and get the following results: Project 36: 5V Relay Module Introducton This single relay module can be used in interactive projects. It is active HIGH level. This module uses SONGLE 5v high-quality relay. It can also be used to control lighting, electrical and other equipment. The modular design makes it easy to expand with the Arduino board (not included). The relay output is by a light-emitting diode. It can be controlled through digital IO port, such as solenoid valves, lamps, motors and other high current or high voltage devices. Specification - Type: Digital - Rated) - Maximum switching power: AC1200VA DC240W (NO) AC625VA DC120W (NC) - Contact action time: 10ms Connection Diagram Firstly you need to prepare the following parts by yourself before testing. - Arduino Board*1 - Single relay module*1 - LED module *1 - USB Cable*1 - Jumper Wire*8 Sample Code Copy and paste the code below to Arduino software. int Relay = 8; void setup() { pinMode(13, OUTPUT); //Set Pin13 as output digitalWrite(13, HIGH); //Set Pin13 High pinMode(Relay, OUTPUT); //Set Pin3 as output } void loop() { digitalWrite(Relay, HIGH); //Turn off relay delay(2000); digitalWrite(Relay, LOW); //Turn on relay delay(2000); } Test 37: Vapor Sensor Introduction: Steam sensor is an analog sensor and can be made as a simple rainwater detector and liquid level switch. When humidity on the face of this sensor rises, output voltage will increase. Caution: connection parts is non-waterproof, so please don’t put them into water.) Test_73<< Resources - Video: - Libraries:
https://wiki.keyestudio.com/index.php/Ks0068_keyestudio_37_in_1_Sensor_Kit_for_Arduino_Starters
CC-MAIN-2021-43
refinedweb
4,718
55.54
Is there a tool that can scan a small text file and look for any character not in the simple ASCII character set? A simple Java or Groovy script would also tool that can scan a small text file and look for any character not in the simple ASCII character set? A simple Java or Groovy script would also do. Well, it's still here after an hour, so I may as well answer it. Here's a simple filter that prints only non-ASCII characters from its input, and gives exit code 0 if there weren't any and 1 if there were. Reads from standard input only. #include <stdio.h> #include <ctype.h> int main(void) { int c, flag = 0; while ((c = getchar()) != EOF) if (!isascii(c)) { putchar(c); flag = 1; } return flag; } Just run $JDK_HOME/bin/native2ascii on the text file and search for "\u" in the output file. I'm assuming you want to find it so you can escape it anyway and this will save you a step. ;) I have no idea if this is legit, casting each char to an int and using a catch to identify things that fail. I'm also too lazy to write this in java so have some Groovy def chars = ['Ã', 'a', 'Â', 'ç', 'x', 'o', 'Ð']; chars.each{ try{ def asciiInt = (int) it } catch(Exception e){ print it + " "} } ==> à  ç Ð In Java (assuming the string is specified as the first command-line argument: public class Main { public static void main(String[] args) { String stringToSearch = args[0]; int len = stringToSearch.length(); for (int i = 0; i < len; i++) { char ch = stringToSearch.charAt(i); if (ch >= 128) // non-ascii { System.out.print(ch + " "); } } System.out.println(); } } To make this your own, replace stringToSearch with whatever you need. A simple groovy example: def str = [ "this doesn't have any unicode", "this one does ±ÁΘ·€ÔÅ" ] str.each { if( it ==~ /[\x00-\x7F]*/ ) { println "all ascii: $it" } else { println "NOT ASCII: $it" } } It's as simple as this bit here: it ==~ /[\x00-\x7F]*/ Edit: I forgot to include a version for files. Oops: def text = new File(args[0]).text if( text ==~ /[\x00-\x7F]*/ ) { println "${args[0]} is only ASCII" System.exit(0) } else { println "${args[0]} contains non-ASCII characters" System.exit(-1) } That version can be used as a command line script, and includes an exit status so it can be chained. /[\x00-\xFF]*/, just as every single string also matches /a*/, even "xxx". Zero or more means you’re content with 0. And /[\x80-\xFF]/is not ASCII! You need to match /^[\x00-\x7F]+$/to be all ASCII. A normal regex engine with the very most basic Unicode support would simply use \p{ASCII}vs \P{ASCII}. – tchrist Aug 31 '11 at 18:49 grepwith a negated character class. – Tom Zych Aug 31 '11 at 0:59 grep '[^\x00-\xFF]'or its moral equivalent using existing tools not writing a new program is nothing but insane overkill. – tchrist Aug 31 '11 at 2:17
https://superuser.com/questions/330435/how-can-i-find-non-ascii-characters-in-text-files
CC-MAIN-2020-50
refinedweb
508
81.63
Can't seem to run multiple python files in one project I have two .py files in my project. The first file, main.py ran 100% fine. I added a second file, hell.py, which only has print('hello') in it. When I switch the file viewer to hell.py, clicked run, and the console only displays the output of main.py, but does not display 'hello'. Why can't I get 'hello' to show up? Answered by Geocube101 (663) [earned 5 cycles] Stan085 (23) you can also use you can also use exec(open("hell.py").read()) (this would be useful if you have a variable named hell, because import would override it, and this also saves some memory space) The replit editor only runs the main file. In order to run the second file, you will have to import it import [file_name]. When importing another python file, do not include the .py extension. Note: The file runs immediately after import meaning that as soon as the file imports, it runs. If you need the file to only run at a specified line, that is where you put the import command. @Geocube101 Do you know if there a reason for this limitation? I don't think I ran into this problem when I last used a standalone IDE. @sodalover I do not know the reason. @Geocube101 @sodalover repl.it needs to have a builtin "run point" (I'm not sure what the proper word is) to run your repl, so it always finds main.py and runs it. This is also why you cannot rename main.py
https://replit.com/talk/ask/Cant-seem-to-run-multiple-python-files-in-one-project/8563
CC-MAIN-2021-39
refinedweb
268
85.69
Python Programming, news on the Voidspace Python Projects and all things techie. Release: ConfigObj 4.6.0 and Validate 1.0.0 Finally a fresh release ConfigObj and Validate. Note ConfigObj and Validate development is now done in Google Code project and subversion repository. Please post any bug reports or feature requests on the project issue tracker. The best introduction to working with ConfigObj, including the powerful configuration validation system, is the article: ConfigObj is a simple to use but powerful Python library for the reading and writing of configuration (ini) files. Through Validate it integrates a config file validation and type conversion system. Features of ConfigObj include:. The full changelog for ConfigObj 4.6.0 is: - method - Removed the deprecated istrue, encode and decode methods - Running test_configobj.py now also runs the doctests in the configobj module - Through the use of validate 1.0.0 ConfigObj can now validate multi-line values. As the public API for Validate is stable, and there are no outstanding issues or feature requests, I've bumped the version number to 1.0.0. The full change log is: - BUGFIX: can now handle multiline strings - Addition of 'force_list' validation option You should be able to install ConfigObj (which includes Validate in the source distribution on PyPI) using pip or easy_install. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-16 22:35:49 | | Categories: Python, Projects Tags: configobj, validate, release Innapropriate Python Python is not always appropriate in every circumstance. As if proof was needed two recent news stories confirm it: - Man bites Python (sounds like self-defense though) - Real life snakes on a plane (Pythons naturally) Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-16 19:31:12 | | Categories: Fun, Python Tags: snakes, news Sod This! Another Podcast Sod This is a new podcast by well known .NET MVPs, Devexpress evangelists and all round (figuratively of course) raconteurs: Gary Short and Oliver Sturm. Episode 3 is now up, and it's an interview with me on dynamic languages in general and IronPython in particular. (Before becoming a .NET programmer Gary was a smalltalk developer.) The interview took place during the BASTA conference in Germany; in a bar, so the audio starts of a bit rough but improves as the interview progresses. I even reveal my mystery past and what I did before programming in Python. Oh, and just for the record - I was the first Microsoft dynamic languages MVP. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-15 22:36:22 | | Categories: IronPython, General Programming, Life Tags: podcast Setting Registry Entries on Install On Windows Vista setting registry entries on install is hard. It is likely that Microsoft don't care - the official guidance is to set entries on first run and not on install, but there are perfectly valid reasons to want to do this. The problem is that for a non-admin user installation requires an administrator to authenticate, and the install then runs as the admin user not as the original user. So if you set any registry keys using HKEY_LOCAL_USER then they will be set for the wrong user and not visible to your application when the real user runs it. The answer is to set keys in HKEY_LOCAL_MACHINE, which is not an ideal answer but at least it works. The problem comes if you need write access to those registry keys; the non-admin user doesn't have write access to HKEY_LOCAL_MACHINE. When you create the key you can set the permissions though,but you need to know the magic incantations. In IronPython (easy to translate to C# if necessary) the requisite magic to allow write access to all authenticated users is: from System.Security.AccessControl import RegistryAccessRule, RegistryRights, AccessControlType from System.Security.Principal import SecurityIdentifier, WellKnownSidType REG_KEY_PATH = "SOFTWARE\\SomeKey\\SomeSubKey" key = Registry.LocalMachine.CreateSubKey(REG_KEY_PATH) ra = RegistryAccessRule(SecurityIdentifier(WellKnownSidType.AuthenticatedUserSid, None), RegistryRights.FullControl, AccessControlType.Allow) rs = key.GetAccessControl() rs.AddAccessRule(ra) key.SetAccessControl(rs) key.Close() Of course the next issue is what happens when you make your application run as 32bit on a 64bit OS (to workaround in part the horrific performance of the 64bit .NET JIT). Hint, the registry keys will have been created in the WOW6432Node. If you want to use the standard locations and share between 64 and 32 bit applications then you need to look into reflection (which copies keys between the 32 and 64 bit registry trees) with RegEnableReflectionKey (although it's not entirely clear whether you need to enable or disable reflection to share keys, but thankfully I haven't yet needed to experiment with this). Update If this wasn't all enough fun for you, under some circumstances you can end up with registry virtualization. This is where your registry keys end up in an entirely separate registry hive called VirtualStore under the root node. You can find a reference on virtualization (which can also cause file locations to be virtualizaed - making them visible to some applications and invisible to others) on this page. In our case deleting the VirtualStore restored sanity. Most of the details in this entry only apply to 64 bit Windows Vista. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-15 16:58:37 | | Categories: General Programming, IronPython Tags: windows, vista, registry, installers More Fun at PyCon 2009 PyCon 2009 was awesome fun, as many others have charted. The highlights of the conference were, as always, meeting and mixing with such a rich combination of clever and fun people - all of whom I have Python in common with. It was a mix of new friends and old friends, far too many to mention all of them. The Hyatt hotel in which PyCon was held in had the rooms on all four external walls, interconnected with a grand structure that someone nicknamed the fragatorium: The tenth floor made an ideal launching point for the balsa aeroplanes being given out by the Wingware guys. The fleet: Mr. Tartley getting ready to launch: We did manage to get one to the other side, and even caught a photo of plane in flight. Unfortunately I'm rubbish at remembering to take photos, about the only genuine conference photo I took was of the VM panel discussion. During the sprints there was much ridiculousness around the Django Pony, that somehow ended up with the domain ponysex.us being hosted on my server! As an added bonus I was elected to membership of the Python Software Foundation (PSF) during the conference. This means two things in practise; a new opportunity to bikeshed on the PSF mailing list and new opportunities to volunteer for extra work! D'oh. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-11 17:31:22 | | Categories: Fun, Python Tags: pycon, planes, psf, djangopony Distributed Test System at Resolver Systems There is quite a discussion going on the Testing in Python mailing list. A lot of it was kicked off by Jesse Noller discussing the new distributed testing framework he wants to build. Just for the record, here is a rough outline of how we do distributed testing over a network at Resolver Systems. It is a 'home-grown' system and so is fairly specific to our needs, but it works very well. The master machine does a full when the build is started). The master introspects the build run (collects all the tests) and pushes a list of all tests by class name into the database. When the zip file arrives on a slave machine a daemon unzips and deletes the original zipfile. Each slave then pulls the next five test classes out of the database and runs them in a subprocess. Each test method pushes the result (pass, failure, time taken for test, machine it was run on, build guid and traceback on failure) to the database. If the subprocess fails to report anything after a preset time (45 mins I think currently) then it kills the test process and reports the failure to the database. Performance tests typically run each test five times and push the times taken to a separate table so that we can monitor performance of our application separately. The advantage of the client pulling tests is that if a slave machine dies we have a maximum of five test classes for that build that fail to run. It also automatically balances tests between machines without having to worry about whether a particular set of tests will take much longer than another set.. Easily being able to see the total number of tests in a run makes it easy to see when tests are accidentally getting missed out. A completed run emails the developers the results. The web page for each build allows us to pull machines out whilst the tests are running. If a machine is stopped then it stops pulling tests from the database (but runs to completion those it already has). Machines can be added or re-added from the command line. We have a build farm (about six machines currently) typically running two continuous integration loops - SVN head and the branch for the last release. These run tests continuously - not just when new checkins are made. This works very well for us, although we are continually tweaking the system. It is all built on unittest. The system that Jesse Noller will have as its foundation a text based protocol (XML or YAML) for describing test results. These can be stored in a database or as flat files for analysis and reporting tools to build on top of. For a test protocol representing results of test runs I would want the following fields: - Build UUID - Machine identifier - Test identifier: typically in the form package.module.Class.test_method (but a unique string anyway) - Time of test start - Time taken for test (useful for identifying slow running tests, slow downs or anomalies) - Result: PASS / FAIL / ERROR / SKIP - Traceback Anything else? What about collecting standard out even if a test passes? Coverage information? We sometimes have to kill wedged test processes and need to push an error result back. This can be hard to associate with an individual test, in which case we leave the test identifier blank. Extra information (charts?) can be generated from this data. If there is a need to store additional information associated with an individual test then an additional 'information' field could be used to provide it. A lot of the other discussion on the mailing list has been around changes and potential changes to the unittest module - changes that started in the PyCon sprint. I'll be doing a series of blog posts on these in the coming days. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-11 16:55:48 | | Categories: Work, General Programming Tags: testing, distributed Essential Programming Skills: Reading and Writing As a programmer there are two basic skills vital to your productivity: how fast you can type and how fast you can read. On typing, Steve Yegge said it best of course in Programming's Dirtiest Little Secret. I often mock Mr. Tartley for being a hunter pecker, but he can really type quite fast with his two fat fingers. I taught myself to touch type with Mavis Beacon back when I was selling bricks and found it enormously freeing. Being able to type without having to look at the keyboard makes a massive difference. There are a host of tools that will help you learn or practise touch typing. I've just discovered (via Miguel de Icaza) a fun web based one, that you can fire up at any time. You race against other players typing short passages from books, with visual cues when you make mistakes. It even lets you setup private games to race against a set of friends. My only criticism is that there isn't enough punctuation to really practise typing for programmers (programmer specific version anyone?): The combination of competition, short doses and interesting passages make it fun, addictive and actually useful. My average WPM is 52 at the moment, but I reckon if I practise a few times a day I'll pick up speed. The correlating skill essential for programmers needing to browse countless pages of documentation and information from blogs that may or may not be useful is speed reading. The following tool is great for practising, but I'm also finding it useful for quickly reading long passages of text. It shows you the text a line at a time, moving the focused part quickly (at a speed you can configure and control from the keyboard) from left to right. This mirrors (unsurprisingly) the way I skim read blogs etc. The problem is that I often involuntarily skip passages whilst skim reading - this tool is good for practise but also helps me to read quickly without missing bits. Like this post? Digg it or Del.icio.us it. Posted by Fuzzyman on 2009-04-11 16:26:32 | | Categories: General Programming, Life, Fun Tags: typing, reading, tools 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_2009_04_11.shtml?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+voidspace+%28The+Voidspace+Techie+Blog%29
CC-MAIN-2015-32
refinedweb
2,228
62.48
Wiki jsTimezoneDetect / Home How do I use jsTimezoneDetect? This script does one thing and one thing alone. It gives you the zone info key of a timezone that describes the timezone you are in. It is synchronous, fast and about 1.65 KB gzipped (4.9 KB uncompressed). Download the latest minified version. Include it on a webpage. Then: var timezone = jstz.determine(); timezone.name(); "Europe/Berlin" If you are interested in the code details, read About the Code. Click here for a link to a list of timezones that the script can detect. The latest version of jsTimezoneDetect is running on. Contact me: pellepim , if you have any questions. What do I do with the result? jsTimezoneDetect gives you a timezone key, compliant with the zoneinfo database. Often called the "Olson database", or simply the tz database. It is a public domain collaborative compilation of information about the world's timezones. It is widely used as basis for timezone information in operating systems and software. Nearly all platforms and programming languages have libraries that support it. Who would benefit from this script? Programmers who want to store and work with server side representations of a user's timezone for the use of showing dates and time. jsTimezoneDetect is built to give you a "good enough" timezone so that you will be able to present dates and times to an end user in the expected manner. Simply put: you can use this script to get an Olson timezone key for your user's timezone, that's it. The Olson database is available on most platforms and for most programming languages. Who does not benefit from this script? Programmers who need a very exact timezone. jsTimezoneDetect is only good at finding a timezone that is good enough to display dates and times. It will not help you if you want to know what days are official holidays in a certain region. The Olson Timezone Database Currently this script only maps timezones to the Olson database (also known as the tz database or the zoneinfo database). To do anything sensible with the key you get from this script you will need to do a lookup in the Olson database. For example, if you are using Python, you can use the module pytz to accomplish the following: from datetime import datetime from pytz import timezone import pytz def convert(): """ Converts 2010-12-25 06:00:00 UTC+0000 to Central European Time """ utc = pytz.utc cet = timezone('Europe/Amsterdam') # Europe/Amsterdam is the tz key jsTimezoneDetect will hand you format = '%Y-%m-%d %H:%M:%S %Z%z' utc_datetime = utc.localize(datetime(2010, 12, 25, 6, 0, 0)) #2010-12-25 06:00:00 UTC+0000 cet_datetime = utc_datetime.astimezone(cet) return cet_datetime.strftime(format) #returns 2010-12-25 07:00:00 CET+0100 A little about the Olson keys Not all Olson tz keys are given by this script. Many are superfluous, e.g you don't need them to do normal datetime normalizations and calculations. If there are many timezones with UTC+6 but none of them use daylight savings, this script simply returns ONE of the timezone keys representing this type of timezones. Updated
https://bitbucket.org/pellepim/jstimezonedetect/wiki/Home
CC-MAIN-2018-43
refinedweb
533
66.84
-------------------------------- Jifty 1.50430 - April 30th, 2015 -------------------------------- * Stop including cssquery back-compat JS * Make the CAS into a durable store * Rewrite pubsub framework, using websockets and AnyMQ * Remove clientside sessions * Refactor how halos work; this changes the default wrapper * Instead of just using Hash::Merge, use a "!" suffix on hash keys to explicitly override the associated site_config value, instead of merging. ------------------------------ Jifty 1.10518 - May 17th, 2011 ------------------------------ CORE ==== * Only load view handlers and actions once This speeds up startup, particularly under multi-threaded plack servers, by allowing the view handlers and actions to be loaded once before forking. This is safe because essentially no state is saved (and almost certainly none is modified) on the Jifty::Handler and Jifty::API objects between first and second initialization. * Replace XML::XPath with the more modern HTML::TreeBuilder::XPath * Allow a shortcut around the dispatcher for fragments Re-dispatching through the application's dispatcher can be a significant performance hit on pageregion-heavy pages. Allow dispatchers to declare a fragment_handler method which will be used in place of the full dispatcher. Care must be taken to ensure that this does not allow walking around ACLs. Anything which runs on every request (sessions, Jifty->api limiting) will have already run once on the original /__jifty/webservices/json request; however, since that page is in no way ACL protected by the dispatcher, a fragment_handler method which does not adequately express the ACL checks of the rest of the dispatcher is a security vulnerability. Whitelisting, rather than blacklisting, is most likely the correct course of action. * Shorten onclick handlers by removing repeated boilerplate This reduces page size significantly on pages which use them frequently. SECURITY ======== * Move directory traversal check to the more centralized ->render_template * Canonicalize all request paths; this catches fragment requests as well Previously, the path as passed in the fragment request data structure was used verbatim in the dispatcher and other locations. This possibly allowed requests to walk around ACLs by requesting '/some/safe/place/../../../dangerous' as a fragment. As a non-fragment, this would have been canonicalized to '/dangerous', but fragment paths were not being so canonicalized. BUGFIXES ======== * Close lightboxes automatically and only if there are no validation errors * Have Jifty::Test::WWW::Mechanize pull in improvements from Jifty::Client::field_error_text * Handle 5.14's regex stringification better * Do not repeatedly warn about cssQuery deprecation. INSTALL ======= * We placked up a while ago, no need for HTTP::Server::Simple deps * Depend on the Jifty::DBI 0.68 which has security fixes * Test::Spelling improvements * Remove Test::WWW::Declare ----------------------------------- Jifty 1.10228 - February 28th, 2011 ----------------------------------- BUGFIXES ======== * brief_description now always works by returning ->name, or failing that, ->id. * jifty adopt: Don't bother forking before invoking $EDITOR DOCUMENTATION ============= * Document the models method of Jifty::Schema TESTS ===== * Avoid loading author test modules unless -d inc/.author * Author tests for no tabs ----------------------------------- Jifty 1.10214 - February 14th, 2011 ----------------------------------- CORE ==== * Monkeypatch Mouse to silence misleading warnings * Add a timestamp type * Add a default timezone configuration * Add support for cc and bcc in Jifty::Notification * Let JIFTY_LOG_LEVEL override LogLevel from the config * Notify the record when we're about to begin running through an Update VIEW ==== * render_title_inpage expects to be passed the title * Correct an image URL in CSS to point to /static/ * __page is only relevant for SPA, which isn't the default configuration * Revert "* Upgrade a region error from a debug to a warning." * Add the id and class attributes to Forms, aliasing id and name * Make sure the submenu <ul> has the submenu class * Add a deep_active option to render active menu items all the way down * Add an option to kill the JS expand spans * Test the count of children, not just the truth * Switch to an HTML5 doctype from XHTML BUGFIXES ======== * Don't automatically upgrade the schema when running jifty schema --print * Add some newlines to our warnings to kill the line numbers * Fix jifty schema --setup when AutoUpgrade is off * Compiled condition cache should depend on cwd, as well * Revert "Remove the unused drop-column logic from jifty schema --setup, since ->columns returns only active cols" DOCS ==== * Point users to perldoc Jifty::Config in the new app config file [rt.cpan.org #24787] * Grammar fix and strengthen the "don't use this for new deployments" * Since plackup -s FCGI doesn't work, don't recommend it TESTS ===== * Fix a test that wants the old-style html tag ----------------------------------- Jifty 1.01209 - December 9th, 2010 ----------------------------------- ____ _ _ ____ _ __ _ | _ \| | / \ / ___| |/ / | | | |_) | | / _ \| | | ' / | | | __/| |___ / ___ \ |___| . \ |_| |_| |_____/_/ \_\____|_|\_\ (_) The biggest change since the last release is Jifty's move to Plack. Please be sure to read the INCOMPATIBILITIES section below. INCOMPATABILITIES ================= Jifty is ported to PSGI using Plack. This changed much of the request and response handling code, but hopefully in ways that don't hurt existing apps too much. * The following methods are removed: - Jifty->handler->apache - Jifty->handler->cgi Most methods for ->apache and ->cgi are provided by the Compat plugin, which is automatically loaded for older jifty apps. Use corresponding header methods of Jifty->web->request and Jifty->web->response. * Printing to STDOUT deprecated. Use outs, outs_raw, or Jifty->web->response->body() instead. * Munging and using the %ENV hash is deprecated. Use Jifty->web->request->env instead. * Jifty::Server::* no longer exist, but you probably weren't using them directly anyway POSSIBLE INCOMPATIBILITIES ========================== * template_exists and render_template now live in Jifty::Web instead of Jifty::Dispatcher * Jifty::JSON updated to use modern JSON.pm (2.xx): This removes the "singlequote" option. Instead, HTML escape the entire blob of JSON if you plan to put it in an HTML attribute. Jifty::JSON will croak if you attempt to use the "singlequote" option. CORE ==== * Uploads are promoted to Jifty::Web::FileUpload objects for easier handling in actions. They should be backwards compatible with CGI.pm's lightweight Fh objects. * Pass the intended action (create, update) to canonicalizers * Pass the current state of other parameters/attributes to validators, canonicaliers, and autocompleters * Update actions set the record's ID in the result (imitating Create actions) * Jifty::Web::Menu improvements, including YUI menu support and easier subclassing * CRUD: New sort headers * CRUD: Allow subclasses to customize which search fields are rendered * Revert a bunch of incorrect HTML escaping of <script> content * Be helpful and Warn if a keybinding won't work because of a missing element ID * CAS: Add a memcached backed store * Refactor Jifty::Web::Session to extract the Jifty::DBI-based store * Add an OrderedList form field widget * Add an Uploads (plural!) form field widget * Add a tool (utils/un-serial.pl) to standardize Jifty->serial values in output files, for easier diff'ing * Add an AboutMe action for dumping the CurrentUser -- useful for REST apps * Add a way to explicitly create a new session * Inspect callers to default to http URLs for notifications instead of the scheme of the current user * View: Make it possible to override the page class per page * Add an after_include_css trigger PLUGINS ======= * Config: nav menu munging can be disabled * Halo: HideHalos config setting enables turning off Halos even in DevelMode * SQLQueries: Add an option to EXPLAIN all queries * RequestInspector: Support display only on a certain cookie value * RequestInspector: Add a persistent storage option * RequestInspector: Add an aggregate rendering view * CompressedCSSandJS: Support early generation of CSS/JS at server start rather than first request * CompressedCSSandJS: Move CAS serving methods into Jifty::CAS (and PSGI-ize them) * CompressedCSSandJS: Rewritten as Plack middleware rather than a Jifty dispatcher * REST: Add __not/<column>/<value> syntax for /=/search URLs * REST: Support serialization of refers_to model columns * REST: Cache bust before returning a 302 Found to avoid returning an invalid Location: header * REST: Expand valid_values when describing an action's params * Authentication::Password: Fix a bug where a user can't read their own email address * Authentication::Password: Make the login and signup links tangent I18N ==== * User language preference in the database is now respected JAVASCRIPT ========== * Update json.js * Move functions in bps_utils.js to the Jifty.Utils namespace * Replace JSAN libs with jQuery calls * Remove unused formatDate.js * Replace autocomplete implementation with a modified version of jQuery's Autocomplete plugin. Note that this is different than and predates the jQuery UI autocomplete module. * Update jQuery to 1.4.1 * Add jQuery UI 1.7.2 with the sortable module * Add a region update helper Jifty.updateRegion * Remove thickbox's unused and problematic CSS BUGFIXES ======== * Only cache the current_user object if the session is loaded * Don't modify the form value in-place when checking placeholder text to workaround a bug in IE7 and 8 * Various for Jifty::Web::Menu * Various Javascript syntax fixes for IE * Various and sundry encoding fixes * Lots more tiny fixes here and there DOCS ==== * Update app_behaviour.js doc for the jQuery implementation * Fix example lighttpd config and doc its quirks * Various small improvements * Spellchecked all the POD :) TESTS ===== * Many new and updated tests * Tests should now be (and hopefully stay!) warnings free * LogLevel now defaults to FATAL (instead of WARN) so expected errors don't confuse users. This is overridable by setting JIFTY_TEST_LOGLEVEL in your environment. ----------------------------------- Jifty 0.91117 - November 17th, 2009 ----------------------------------- POSSIBLE INCOMPATABILITIES ========================== * Don't call App->start if we're running with no handle (i.e., `jifty schema`) * Render PKs as read-only in update actions. If you do not specify which parameters to render for update actions, this will begin rendering id as a read-only field. * Replace AdminUI's CRUD with Jifty::View::Declare::CRUD. You may need to run something like: perl -MFile::ShareDir=dist_dir -e 'print dist_dir("Jifty")' \ | xargs sudo rm -ir ...to make sure the old CRUD is gone so the new CRUD can take its place. CORE FEATURES ============= * Page region preloading (see Jifty::Manual::Preload) * Optimize magic curent_user intuition a bit * Add expired_update/create helper method to session collection. * Bump JDBI dep to 0.58 for SetupWizard's available_databases queries * Warn about next_page 'url' * Add DBI as an explicit dependency * Allow underscore in time_zone for set_current_user_time_zone * by-pass additional column attributes of models to corresponding form fields of model actions. * add a "raw_html" option to Jifty::Web::Menu items CRUD ==== * Warn about missing object_type * Don't pass the update action to display_columns * Pass on extra arguments to render_param from CRUD * Popout CRUD update forms * CRUD: Prefer the column's label to its name when available * Make CRUD search a lightbox instead of the horrific splat it is now * Use paging for CRUD listings DOC === * Cookbook: how to use postgresql database instead of sqlite * Cookbook: file upload code snippet * Cookbook: how to catch action results and POST data * Clarify the signature of render_param * Fix pod of Jifty::LetMe; productse "path", not "token" * Jifty::Web::Link doesn't exist. Jifty::Web::Form::Link does. * Minor tutorial improvements I18N ==== * zhtw: note translator * zhtw: Add Jifty::Manual::JavaScript_zhtw * zhtw: Add Jifty::Manual::Actions_zhtw PLUGINS ======= * SinglePage: link test * SinglePage: add hr between test links * SinglePage: fix spa for link with parameters * Authentication::Password: missing email field in login_widget when we don't use login_by: username * SetupWizard: Change "Save" to "Next" * SetupWizard: Skeleton of the SetupWizard tests * SetupWizard: Basic tests to make sure stepping through the wizard works * SetupWizard: Make sure we update the site_config correctly for each step of the process * CompressedCSSandJS: add skipped_js; some js does *not* work if compressed * I18N: specify jquery asynchronous by option async. REFACTOR ======== * Stub out Field->preload_javascript * Factor javascript_attrs into a second method for building up an inspectable data structure * Break up $update into $update_json * Improve clarity of _values_for_field * Refactor Select's render_widget so it can be extended * Refactor handle_comp so that we can reuse its setup TEST ==== * Add @post_chdir to Jifty::Test::Dist for tests that need to do stuff between chdir and Jifty load * Provide strict mode to require no warnings (from test server for now) during tests. * Workaround the problem plan() only ignores unknown arguments if it sees known ones. * strip jifty-specific test import options in import_extra * appropriate test config tweaks for coverage run. * utility for running tests with coverage. * find uncovered mason files. * Handle use Jifty::Test 'no_plan' more gracefully than exploding * Refactor most of action_field_value into action_field_input * Only run Jifty::Test's teardown code if it setup * Use Test::Script::Run's get_perl_cmd instead of reinventing it * Use get_perl_cmd for restart.t too VIEW ==== * Improve debug information by including the servicing view handler in message * Add a css file for CRUD * Integrate facebox into jifty * Hide elements with the jshide class * fix a lot of missing escapes in ::Field::Collection and some other obvious problems, probably it never been used * List of checkboxes for multiple-choice selection * If we are in https, then stay in https * mason_scomp helper function in Jifty::View::Declare * Support for an "all" link in /_elements/paging ------------------------------ Jifty 0.90701 - July 1st, 2009 ------------------------------ BUGFIX ====== * Fix a bug in jifty.js when extracting ordering information for actions submitted via AJAX I18N ==== * Updated zh_tw translation ------------------------------- Jifty 0.90630 - June 30th, 2009 ------------------------------- POSSIBLE INCOMPATIBILITIES ========================== * Modules which 'use Jifty::Dispatcher -base' and 'use Jifty::View::Declare -base' will have strict and warnings automatically turned on in them. CORE FEATURES ============= * Factor out available_values into a method * Support plain strings in available_values * In mandatory fields, tell the user which fields failed validation REFACTOR ======== * Add a Jifty->admin_mode method; this should be used in place of Jifty->config->framework('AdminMode') BUGFIX ====== * Don't rely on cwd for creating and reading PID files * Automatically create the pid dir if it's not existent * Even admin users couldn't access the online docs * jifty_root returned a wrong path (actually a wrong volume) if we're not in the same volume as we installed Jifty * Extract ordering information for actions submitted via AJAX * Fix SPA history event on page load and page reload CRUD ==== * Don't show new item widget unless current user can create * Make display_columns fall back to the record's readable columns I18N ==== * Updated zh_tw translation PLUGINS ======= * REST: Run more of the dispatcher tests * REST: Support .html format * REST: 403 if the record is unreadable * REST: Display actions valid_values * SQLQueries: Display query time in each query's summary * SetupWizard: Plugin to make it easy for end-users to set up your app * Config: Plugin to add configuration editor DOC === * Updated zhtw tutorial * Provide a Template::Declare page region example TEST ==== * Per-test Test::Builder object, for compat with new nested TAP support in Test::More VIEW ==== * Add extra css selectors, allowing arbitrary growl updates ------------------------------ Jifty 0.90519 - May 19th, 2009 ------------------------------ POSSIBLE INCOMPATIBILITIES ========================== * Jifty::Mason::Halo has been demoted into into Jifty::View::Mason::Halo; if your wrapper scripts invoked methods in Jifty::Mason::Halo, they may need to be changed. CORE FEATURES ============= * Add a Jifty->web->qualified_parent_region for munging your sibling regions * Basic background process support via Jifty->background * Add and use the display_length attribute on columns * Make Jifty::DateTime->from_epoch(100) dwim * Server script immediately forks, so it can be restarted * Flush and close the client connection before running after {} blocks CRUD ==== * When we delete an item in CRUD, don't refresh the parent, because that closes open editing forms. Just replace the current region with empty * Make no_items_found a region * When you use CRUD to create a new element, clear any existing "No items found" notice * Hooks for overriding the display of a particular form field * Factor out page_title for CRUD I18N ==== * Apply maketext perl plugin to pl,pm files, to grep more kinds of i18n string formats. * Fix localization js typo BUGFIX ====== * Call to _page_class needs parens to not get parsed as a package * Avoid use of "packge HTML::Mason::Exception", which causes PAUSE to hate us * Fixes for plugin share paths when running Jifty out of @INC * Comment the warning when ApplicationClass::Config is not a sub-class of Jifty::Config * Move pubsub activation to being on document ready, just in case * Fix a function call name * Give an actual error message when there's no current user * Set the InactiveDestroy on the dbh when backgrounding * In forking servers, disconnect the database before stalling on accept * Fix another shared database handle between tests and test servers * There is no utf8 in this file, thus no need for "use utf8" * Always specify _which_ file had errors opening when you die DOC === * Begin making POD coverage a little happier with TD templates * RequestInspector API doc * Pod coverage for script classes * POD coverage for SQLQueries * Fix POD warnings find by lintian tool from debian packaging * Better POD coverage * New entry in Manual::Cookbook: Render model refers_to field as a select widget with meaningful display name * Fix cookbook "brief_description" section * Update Manual index * Updated japanese tutorial * Updated zhtw tutorial * add Deploying_zhtw, AccessControl_zhtw INSTALL ======= * Update to Module::Install 0.85 * Depend on JDBI 0.57 because of display_length and rename_table/rename_column * Bump WWW::Mechanize dep for working ->back method PLUGINS ======= * allow plugins to return more than one static_root. * Add a RequestInspector plugin, which any per-request debugging aids use * Reimplement SQLQueries as a RequestInspector consumer; LeakTracker, Gladiator, and NYTProf now also use RequestInspector * Include sum of query time in the SQLQueries summary * Try harder to avoid loading a prereq_plugin multiple times * Refactor SQLQueries to use a real view * SQLQueries further display: bind parameters and stack traces * Don't display bind parameters if there are none * Add a Config plugin, for adjusting Jifty configuration from the application; can restart the standalone server to take changes, additionally. * Remove custom page {} sub from Password's View class. The page {} in Password's View class simply delegated to the application's View class' page {} -- no other part of the TD page code uses this codepath. This _may_ break backwards compatibility in some applications, however. PUBSUB ====== * Every 10 seconds, have PubSub send a whitespace character as a keep-alive. Without this, Pubsub children under a Forking server stick around forever after the client has left the page. This does not address the problem of FastCGI clients, which have a similar problem. REFACTOR ======== * Split Jifty::CAS::Blob out, and document * Migrate to new rename_table/rename_column in JDBI * Factor out the actual record creation in JARC into a create_record method * Refactor away duplication in Jifty->web->link * Change all calls from Template::Declare->(new|end)_buffer_frame to new API TEST ==== * Improve clarity and correctness of moniker_for * Add a test for restarting the server * Fix a non-deterministic test which failed when load was too high * Silence TODO warnings * Avoid undef warning * Squelch debug message unless running verbosely VIEW ==== * Pass $self to page's meta so method dispatch still works * Apps can now include app-late.css for restyling YUI and jQuery and whatnot * Give timepicker buttons a label of "Pick time" ------------------------------- Jifty 0.90409 - April 9th, 2009 ------------------------------- POSSIBLE INCOMPATIBILITIES ========================== * Mason's dhandler is no longer in charge of generating 404's; instead, the dispatcher catches when no views can handle a request. The 'mason_internal_error' page has also been renamed to the more straightforward '/errors/500'. * Actions found under Jifty::Plugin::SomePlugin::Action are now denied. As these actions are always mirrored under the application's YourApp::Action class, this provides a single point of extensibility and access control. As long as plugins and applications always refer to the application's mirrored action class -- which they should be doing already for extensibility -- this change does not affect backwards compatibility. * AppClass::Action is now a mixin, and does not inherit from Jifty::Action. This removes a diamond inheritance pattern from autogenerated jifty actions, and those made by `./bin/jifty action`. This is additionally needed in order to allow `jifty action`-generated UpdateWidget actions to inherit from a consistent and correct set of parents. This _will_ break existing actions which only inherit from YourApp::Action but not Jifty::Action as well. * The div with id 'jifty-wait-message' has changed CSS, and now includes an animated 'spinner.' Applications which customized the CSS of this element may need to adjust their CSS. * Jifty no longer uses the 'prototype' javascript library by default, instead relying on 'jQuery'. Applications running config file version 3 and below will have the 'Prototypism' plugin added automatically, which enables compatibility with the 'prototype' javascript library. This plugin can be safely removed if your application makes no use of 'prototype'. * URI unescaping is now consistent between FastCGI and standalone SECURITY ======== * Fix a security hole in the REST plugin which let you call any method on the model. We were checking the load by column with valid_column instead of the display field. This would not be done with any elevated privileges, but still might have allowed unexpected access. * Requests to /=/subs how return immediately if PubSub is turned off, instead of consuming a thread on the server CORE FEATURES ============= * Jifty::Datetime has been retooled to be more generic * Allow subclassing of Jifty::Config into YourApp::Config * Store the request method on the request object. This is so a POST request with an action, which is redirected to a new URL in a before {} block, doesn't show the user an obscure 'Action denied' message. Since the original request with the action was a POST request, it is _not_ a cross-site scripting vulnerability. * YAML configuration file merging is now slightly smarter for specific listrefs: MailerArgs and View.Handlers arguments now replace earlier settings, rather than appending to them. * Overload stringification of ClassLoaders, so warning messages with @INC are a bit more educational * The configuration setting FallbackViewHandler has been removed, as it is no different from the last Handler in the View section. For backwards compatibility, Jifty::Handler still adds it to the set if it exists in your config file, though. * In the DateTime filter, use the application's DateTime class if they have one * Handle Jifty->web->new_action('CreateFoo', moniker => 'create_foo') (makes "class" optional) * Move Mason-specific methods out of Jifty::Handler * Add an "explain" method to Jifty::API, to trace action deny/allow * Deny and hide autogenerated application action abstract base classes. * Make Net::Server subclasses use Log4perl infrastructure * Move log messages, whenever possible, to $self->log rather than Jifty->log * The code that walks the calls stack to find the correct current_user has been refactored. * Split out Jifty::View::Mason::Request (renamed from HTML::Mason::Request::Jifty) into its own file. ACTIONS ======= * Obviate the need for the really short sub record_class {...} in most cases of YourApp::Action::UpdateFoo (and SearchFoo, DeleteFoo, and CreateFoo) * Added an Execute virtual action for help building general "do something to a record" actions. * Updated the Create, Execute, and Update actions to make them easier to extend via Jifty::Param::Schema * Extract the validation of valid_values into a method which is overridable * Whenever we can (on any action and on record ->creates), pass in the other field values so a validator can base its validation on those as well. * Add an option for force ajax validation failures on empty form fields * Allow earlier fields to set validation failures on later fields * "ajax validates" on a column should actually activate it, with an action validator * Add a Time and DateTime renderer * Add a Bulk update action * Add report_detailed_messages option in Jifty::Action::Record * Allow literal region names in qualified_region * Allow action parameter renderers with :: in their name * Make Jifty::Action::Record::Search skip container columns. * In Jifty::Action::Record::Search actions, "contains" conditions should not kick in if its length is 0. * Don't push Jifty::Action onto @ISA if the class is already a Jifty::Action COMMAND LINE ============= * `jifty console` has been removed in favor of `jifty repl`, which is provided by Jifty::Plugin::REPL. * `jifty deps` has been removed in favor of Shipwright. * Added `jifty version` command * Add a --no-bootstrap option for `jifty schema` command * Quiet down warnings about missing application root when creating a new application with `jifty app` * If someone creates an app with a Foo::Bar name, make it Foo-Name for them. * Add control of running user, group, and host in standalone server PUBSUB ====== * Multiple regions can be subscribed to the same PubSub channel * Coalesce region updates in PubSub. * PubSub updates can now have effects on removal and addition. * Support for Jifty->subs->update_on( class => 'SomeEvent' ) as a shortcut. * Add an Jifty::Event::Log, and a Jifty::Logger::EventAppender, so you can cause arbitrary log messages to send events, based on your log4perl config. * Don't connect to PubSub during cleanup, and disconnect PubSub after initialization I18N ==== * Locale::Maketext::Lexicon is not smart about seeing the same path more than once. This is a problem if the app uses multiple plugins, which all point to the Jifty share directory for their po files. * Updated fr, ru, zh_tw, ja translations * Added `jifty po` script to manage po and pot files BUGFIXES ======== * Delay view setup for as long as possible; this prevents command-line scripts from creating Mason cache directories. * Better warning-proofing for 5.10, which gets picky about lc called with undef, like render_as sometimes is. * Let Jifty::JSON export objToJson and jsonToObj if the user requests it * Log an error on invalid display_from or value_from in Jifty::Action valid_values * In void context, Jifty->web->link renders the link or button automatically. * Fix memory leaks due to weak reference in Jifty::Web::Menu, Jifty::Web::Form::Field, and Jifty::Web::Menu. * Check that a valid_values collection has a ->count before calling ->first on it * The "get" function of Jifty::Dispatcher contained a bug that made it return '' whenever the actual value was '0'. Additionally, show(0) did not work, and set(foo => 0) and default(foo => 0) would print '' instead of 0 in debug log. * Do not attempt to create sqlite databases with colons in the filename, as win32 does not allow them. * When setting the continuation request's path in a redirect, we need to unescape it to be consistent with Apache, lighttpd, and HTTP::Server::Simple * Split the _current_ continuation from the continuation we're returning or calling into. This means you can return from a continuation you're not in, and it does the right thing if actions fail to validate, and the call doesn't go through. * Force Net::Server to not duplicate filehandles when it forks * When we set up database connections, first purge the memcache connections, if any; reusing memcache filehandles leads to broken connections. After we fork in the server, we re-set up the database connections. * Fix potential connection problems after forking in the server * Intuit https better in Jifty->web->path * LWP::UserAgent explodes unless ENV{http_proxy} looks like a URI, and '' doesn't cut it. * Stop Jifty actions from loading by primary key if you pass in blank primary keys. * Don't try to drop the DB if we know it doesn't exist * Fix multiple loops which looped on $_, and called functions which implicitly modified $_ * Include all css_files when not using compressed css * Clean up "action denied" warnings a bit, such that they give useful backtraces, and only give additional cross-site scripting warnings if the request method is GET. * Work around a bug in 5.10 where nested loops trigger "Attempt to free unreferenced scalar" * Don't reset keybindings when we display the keybinding div, or we never have any to display. CRUD ==== * Updated POD * Add support for predefined searches, and sort headers * If create from new_item_controls fails, don't show an empty row in the CRUD UI that goes away later. * 'id' column is not editable (though if you really demand it you can have it) DOCUMENTATION ============= * Tutorial has been updated to use Template::Declare instead of Mason * Jifty::Manual::Javascript describes programming techniques for javascript in Jifty. * Jifty::Manual::jQueryMigrationGuide describes the steps in migrating from Prototype to jQuery. * Update copyright year to 2009 * Updated documentation for `jifty` command * Added zh_tw translation of the tutorial PERFORMANCE =========== * Don't call ->plugins _twice_, since Module::Pluggable doesn't cache at all, and stat is expensive * Subrequests should never need to run actions; this should speed up regions * Having a local $Request saves thousands of method calls to Class::Accessor per request * In Jifty::Web::Menu, cache ordering of children, and url value, more aggressively; also remove unnecessary _parent accessor * Cheat, in Jifty::CurrentUser, and walk around Class::Accessor methods in a hotspot * Install a faster Jifty::Web->out in the handler once we have output headers. * Remove uses of a Class::Accessor where we don't need one * In certain hotspots, walk around Class::Accessor calls and access the object hash directly. * When outputting links and buttons, only iterate over javascript attributes that have been set, rather than _all_ attributes. PLUGINS ======= * In plugins, add support for "after app => run {...}" instead of just "after plugin Jifty::Plugin::Something => run {...}" in dispatcher. This allows plugins to provide dispatcher rules which the application can override. * The following plugins, previously distributed as part of Jifty core, have been moved into their own distributions: - Attributes - Authentication-CAS - Authentication-Facebook - Authentication-Ldap - AutoReference - Chart - Comment - Feedback - Gladiator - GoogleMap - LeakTracker - Monitoring - OpenID - Quota - Recorder - SiteNews - TabView - Userpic - UUID - Yullio * The following plugins, previously distributed under plugins/ as part of core, but not installed by default, have been moved into their own distributions: - AuthzLDAP - CodePress - DumpDispatcher - EmailErrors - ExtJS - ProfileBehaviour - WikiToolbar - WyzzEditor * Added ViewDeclarePage plugin, for more advanced Template::Declare pages. * Several deprecated plugins have been removed: - AuthCAS (replaced by Authentication::CAS) - AuthLDAP (replaced by Authentication::LDAP) - EditInPlace - Debug (replaced by AccessLog) - Nothing * Authentication::Password: Extend Login action so people can use username to login, though email takes precedence of username * OnlineDocs: Cleanup and dispatcher-ize * OnlineDocs: Link to local application pod directly * OnlineDocs: Allow linking to specific page within documentation using /__jifty/online_docs/?n=Jifty::Manual * REST: Include the "by" column attribute in the REST interface for Net::Jifty * REST: Some doc for extending your REST interface's object dump * REST: Propagate output format across REST redirection * REST: Give help under /= as well * REST: Better errors from the REST API for hidden/denied actions * SinglePage: Added history support for links; we use the "Really Simple History" javascript library to make the magic work. () * SinglePage: Add a temporary variable for disabling spa in runtime. * SQLQueries: Also clear slow/halo queries on "clear queries" * SQLQueries: Avoid undef warnings from undef bindings * User: Since it is internally used as a flag to store if one has valid email address, the column "email_confirmed" should never be rendered. TESTING ======= * Move a skip_all from compile time to runtime. some cpantesters failed a test file with no actual tests :( * Move t/lib/Jifty/SubTest.pm to lib/Jifty/Test/Dist.pm Additionally, make it descend from Jifty::Test, so you don't need to use both * Add test app from Peter Mottram to uncover this valid_values bug * TODOify some tests that need some virtual-column discussion * Depend on the $$ for ports, not on random numbers. This reduces the likelihood of port conflict. * Add a test helper module for matching notification email sent during a test. * Fixes for updated LWP, WWW::Mechanize; ->get and ->post are not ->get_ok and ->post_ok * Add a TestServerWarnings plugin during tests, which allows us to have a warnings_like test, which checks warnings on the server side. * Bail early with exit value, if database drop or create fails * Do not load po files by default anymore. You can provide l10n => 1 for tests requiring po loading. VIEW ==== * Better integration between views, using a common String::BufferStack. This allows cross-calling between Template::Declare and HTML::Mason templates. * Kill our custom popup notifications in favor of jGrowl. Additionally, use Behavior to change full-page action messages into sticky jGrowl messages. * Added a 'multiple' flag for select form field * Make the default "Loading..." display as an animated gif spinner * Support for "loading" fragments for lazy regions. * Add, and respect, the calendar-starts-monday element class for calendar javascript. * Add a render_hidden to Jifty::View::Declare::Helpers ------------------------------- Jifty 0.80408 - April 8th, 2008 ------------------------------- I18N ==== * Make account confirmation error message translatable - alech * r4925 removed loc.js from jifty::web, which should have been added to the i18n plguin. - clkao * random l10n. - clkao * typo in zh_tw.po. - clkao * updated zh_cn po - sunnavy BACKWARD-COMPATIBILITY-PROBLEM ============================== * THE FOLLOWING CHANGE BREAKS BACK COMPATABILITY: * 'set' in T::D templates and the dispatcher no longer alters the values in the request itself. It alters values that are not stored if the request is saved as a continuation. This saves us from contiuation bloat due to objects getting stored in the continuation. This does not lose us much, because any arguments set via 'set' will get a chance to be set again when the continuation is called. Due to the implementation, however, 'set' cannot be used any more to alter or add actions, state variables, or the like. Some might view this new restriction as a feature, though, given how much of a kludge it felt like before. - alexmv * Complain loudly about back-compat when an action is denied. Changelog the Jifty::API changes. - sartak * Update YUI from 2.2.1 to 2.4.1 *** Please check your apps for incompatibilities as there have been *** many changes between these YUI versions. - trs BUGFIX ====== * add a check for the op to the dispatcher condition cache because on and the other ops generate different regexps - falcone * Check validity of PID in the lock file - alexmv * Delay things which call Jifty::Util::require; Jifty::Util is often in *mid- require* when Jifty::Everything is loaded, thus causing calls to Jifty::Util::require to silently fail. - alexmv * Don't single-quote our JSON output, since JSON technically only has double quotes. - alexmv * Fix for autogenerated modules. Since sticking a method into them can cause things to "inherit" being autogenerated(!), we instead keep a global hash of them. - alexmv * Fix schema code, which checked the wrong class for plugins overriding the app. - alexmv * Fix typo causing the CSSQuery plugin to fail - trs * Force time zone update on current_user change - alexmv * Jifty::Util->_require can muck up $1, $2 so save those before using it. - sterling * Added an additional guard on actions to keep from short-circuiting record actions built from plugins that are overridden. - sterling * Jifty::Util::app_root - File::Spec::Win32's catdir() just got much more strict in PathTools 3.27, such that catdir('C:', 'perl') now returns 'C:perl' instead of 'C:\perl'. - audreyt * Jifty::Web::Session::ClientSide - Unbreak this module by conforming to the latest ::Session API (with _cookie_name) as well as Base-64 encoding the cookie itself. - audreyt * Misc current_user cleanups to deal with issues unmasked by RT on Jifty - jesse * Now with more running under "use strict" - alexmv * Old requests from continuations may not have template_arguments set - alexmv * Jifty::Web::Session->continuations returns a hash, not a hashref. - alexmv * Revert r4829 -- it registers all actions in the *form*, which is wrong. - alexmv * Redirects during continuation return should catch dispatcher ABORTs - alexmv * Refactoring around the fact that Scalar::Defer::defer'd variables will never return undef until they're forced. - jesse * Revert r5120 for now; it breaks on page region updates, when regions don't know if they were in a form. A more correct fix (which will put this logic back) will be forthcoming. - alexmv * Static handler and CAS handler spit out same headers now - alexmv * Work around bug in Devel::InnerPackage - alexmv * Wrong column type. - alexmv * Warnings avoidance for undef valid_values in actions - alexmv * catpath wants a file, or File::Spec::Unix carps about undef values - alexmv * lockfile error-proofing - alexmv * A fix for a time zone bug exposed by Doxory: copy the time_zone from JDBI::Filter, but allow for overriding it - sartak * Actually, no, don't bless the result of Jifty::Result->as_hash - sartak * Backing out the previous commit as this has been moved up into Jifty::DBI. - sterling * Better error reporting if `jifty app` can't create directories (due to e.g. perms) - nelhage * Bulletproof Jifty::Util->make_path - sartak * Bypass ACLs to check - trs * Check the database connection before handling requests. - sterling * Copying a reference unweakens it, so a small fix for that in JWFF- >_action. But that isn't our leak, I think - sartak * DateTime->new is pretty strict, so use DateTime->now - sartak * Don't call _handler_setup unless the normalising accessor is used as mutator. - clkao * Don't try to make undef urls absolute - trs * Enforce uniqueness on (object_id, object_class, type) - trs * Fix a typo in r5217. - clkao * ID is sometimes passed into Jifty::Action::Record::Update, we want to ignore it if it doesn't change, to avoid spurious permission errors. This codepath could use some more thought - sartak * Improve Jifty::DateTime->new_from_string so that it can handle time zones properly, and add Jifty::DateTime->get_tz_offset. - sartak * In Action::Record::Delete and ::Update, don't require that error messages be returned from set_field and delete. This is to facilitate before_$crud JDBI::Record triggers - sartak * Make Jifty::DateTime->current_user_has_timezone work (ie without requiring a blessed reference) - sartak * Minor typo fix - jasonmay * Precedence - trs * Removing <!-- and --> from scripts because when evalScript() is called during Ajax loads, IE7 complains about syntax errors. - sterling * Rename $pkg to $file in Jifty::Util->_require, and don't append .pm if it's already there - sartak * Revert 4649 js memoization which caused .error div problems - sartak * Revert 4650 (cssquery change) because ".error is no longer hidden for the region being replaced with ajax" in some browsers - sartak * Revert 4746 because it's actually not evil at all - sartak * Tiny fixes in the new Jifty::Script::Script (hanenkamp++) - sartak * Two small fixes for Jifty::Result changes: missed two fields and for backcompat we need to bless the resulting hash into Jifty::Result - sartak * Use the cssQuery-jquery back-compat script, and have the CSSQuery plugin remove it. This way the jifty.js cssQuery call actually works. Which fixes the admin CRUD. Woo hoo - sartak * change only for readability. thank jesse san. - bokutin * fix Jifty->web->session->continuations. change accessor from $_->key to $_- >data_key - bokutin * fixed a wrong regex - sunnavy * for mysql varchar must be explicit (255 should be enough) - yves * move fakeapache lexwrap into after_listener_setup so other fakeapache instances won't be affected by jifty::server. - clkao * oops, revert accidental changes in the deferred sub. - clkao * revert load_or_create canonicalization and move discussion on jifty- devel - dpavlin * run canonicalization before load in load_or_create - dpavlin * schema upgrade error when creating new tables - ssinyagin * seems varchar(255) won't work, have to set max_length - sunnavy * tiny fix, sometimes options are undef - sunnavy * utf8 on $path cause garbage characters in Mason. This problem line in HTML::Mason::Compiler::raw_block() is $comment = "#line $line $file\n" if $self->use_source_line_numbers; If utf8 on $path was pass UTF8_ON = "#line UTF8_OFF UTF8_ON" ( $file is $path ) - bokutin CORE ==== * Added a JIFTY_APP_ROOT environment variable for forcing an app root even if we're in another directory - jesse * Code to actually fully remove a session - alexmv * J::Web::Session::ClientSide - Switch to Storable because we really want to serialize all kinds of things. - audreyt * Jifty::Web::Session::ApacheSession, a session backend that bridges to Apache::Session. - audreyt * Lockfile support - alexmv * Protected and private columns and models - alexmv * defer default value until we really care about it - jesse * Add 'jifty repl' which uses the awesome Devel::REPL - sartak * Add support for application overridden models which gives us: (1) References from plugins to app models with less pain. (2) An easier implementation path in cases where mixins are just extra work. (3) Allows application flexibility to modify plugin models. (4) Consistency with the way apps may override actions an notifications. - sterling * Add the continuation debugging tool from hiveminder - nelhage * Adding a CLI thingy to generate stubs for command-line scripts. - sterling * Allowing actions also shows them. Fix the defaults so that "weird" actions (such as Jifty::Action) are hidden. - sartak * Accept user_object->timezone for intuiting the user's time zone. - sartak * Force result->success to be 0 or 1, for the benefit of REST users - sartak * If the user runs "jifty server" before the first "jifty schema -- setup", create the database for them - sartak * Jifty::DateTime::is_date method, which tells whether the given J:DT is only a date - sartak * Let Jifty::Param::Schema actions define documentation for paramters. - sartak * Make Jifty::DateTime dates Jifty::Util->stringify to just yyyy-mm-dd, no 00:00:00 - sartak * Make sure actions still fail when you set columns you can't update (or read) to undef - sartak * Make the json and yaml webservices use Result->from_hash - sartak * Move the REST object walking into Jifty::Result so that it may be reused - sartak * add an utility summarizing js file sizes and minified sizes. - clkao CRUD ==== * Don't explicitly register the delete action in CRUD - alexmv * new_item doesn't use an id -- don't try to get() it - alexmv * Small cleanups to CRUD views to help make RT work - jesse * unfubarring the admin CRUD step 1: give each item a form, instead of one form containing everything (which saddened Firefox) - sartak DOC === * Clean out un-necessary files from examples/ - alexmv * Deployment manual updates from Stanislav Sinyagin - jesse * Jifty::Dispatcher: Extremely trivial POD typo cleanup - audreyt * Jifty::Dispatcher: Trivial minimal POD fix for correct vim highlighting (avoiding "package" at the beginning of the line.) - audreyt * Make POD coverage happy - alexmv * POD nit in Jifty::Web::Session (no whitespace on line before POD command) - alexmv * Perltidy - alexmv * Port the chat demo to Template::Declare - jesse * Add myself to AUTHORS - bokutin * Fix POD coverage failures for the Comment plugin. - sterling * Fix part about re-use of actions outside Jifty app by creating request and response just like Jifty::Test->web does. - dpavlin * Halo pod coverage - sartak * Steal documentation from the model class in Jifty::Action::Record - sartak * added mod_perl and file permissions info - ssinyagin * appended myself - ssinyagin * fix pod. - bokutin INSTALL ======= * Update JSON::Syck dependency to 0.29 because previous versions contains a bug that would deserialize "foo:bar" to "foo: bar" when SingleQuote is set to true. - audreyt * Add ApacheSession to MANIFEST. - audreyt * Bump JDBI dep - alexmv * Bump Scalar::Defer dependency, for great lack-of-memory-leak justice - alexmv * Don't pull in another dep for something trivial - alexmv * Email::MIME and Email::Simple went through a period of not talking to each other, throwing crokery around, and generally making life miserable for each other. Force versions of things which are at least on speaking terms again. - alexmv * Regen MANIFEST since it's been a while... - audreyt * Updated Module::Install - alexmv * Upgrade Class::Inspector dependency so Win32 won't break with File::Spec 3.16. - audreyt * Add Devel::Gladiator to Makefile.PL, other little fixes in here - sartak * Depend on Regexp::Common itself - sartak * Dependency on URI::Escape (which we're already using, probably pulled in by Mason) - sartak * More Makefile.PL tweaks - sartak * Typo fix in Makefile.PL - sartak * Update MANIFEST and META.yml - sartak * Use "recommends" instead of "requires" for optional dependencies. Comments requires Regexp::Common::Email::Address - sartak * debian packaging - yves MISC ==== * Refacotring/cleanup - jesse * Munging @INC isn't necessary in new scripts, Jifty does that for you now - sartak * We haven't needed File::Basename in bin/jifty for a long time - sartak PERFORMANCE =========== * Add an ->enumerable method to record classes, so we don't try to create huge valid_values lists for record classes which are known-huge. - alexmv * Attempt to weaken another reference to the current action that may be leaking - jesse * Cache triggers for session and metadata - alexmv * Compressed CSS and JS caching backout - jesse * We somehow had dropped caching headers when we compressed css and js. - jesse * Don't load up the column object on create widgets unless we need it. - jesse * Beginning some serious refactoring of Jifty::Action::Record- >arguments - jesse * starting to split out current values of things - jesse * store the base 'arguments' hash and merge in default values on the fly. This should result in a healthy performance boost. But is also the first place to look if things start acting funny any time soon. - jesse * If we have a user object already, use it to fetch the email address when generating a LetMe - jesse * Fix menus to properly weaken "parent" relationships (and normalize _parent and parent) - jesse * Terrifyingly, the added /s causes escape_html (2% of hiveminder's runtime) to benchmark 200% faster. - jesse * There's no need to compile Dispatcher rules to regexes every time they're evaluated. Cache them. - jesse * nope - I'm wrong. bad benchmarking made me believe that the thing I am reverting was faster - jesse * Another JS speedup: cache the results of selectAll. it's called only 8 times for /todo, but caching saves ~80ms. - sartak * Another copied weakref in Jifty::Web::Form::Field, though this code was just changed so I don't think it explains our white whale - sartak * Cache the log handle so the file isn't opened every hit - sartak * Compare old/new values for updating _before_ checking if we can update it (no point in saying permission denied for a column we don't want to actually change). However, only do the comparison if we can read the field so that we don't get bogus undefs. Everybody's happy now. Bonus: make references X by Y work when comparing old/new values - trs * Fix a real memory leak in Jifty::Web::Menu due to copying a weak reference. Woo! - sartak * Fix a validation bug where we'd get a lot of "extend=function (object) { return Object.extend.apply(this, [this, object]); }" arguments. This is because prototype.js overcomplicates form element serialization. - sartak * In deferred sub called from arguments, we need to use weakself. - clkao * use Jifty::YAML, not YAML - jesse * Shave off another 100ms by special casing the beastly 40% function - sartak * Speed up selection by class by using indexOf with space padding instead of regex - sartak * cssquery.js: thisElement is being called 11000 times for hiveminder's /todo. It includes an IE workaround. Use the workaround only if we're actually using IE. This cuts its runtime on /todo from ~220ms to ~100ms - sartak PLUGIN ====== * 'unexpected dispatch on REST' fixed - Patch from bokutin - jesse * A first pass attempt at a Devel::Gladiator plugin for Jifty. Doesn't seem to work very well - jesse * Autocompleter: Allow keyboard navigation in IE7 by hooking keyDown instead of keyPress. This fix arguably belongs to upstream (scriptaculous), but for now it resides in jifty.js. - audreyt * Check and upgrade plugin versions - alexmv * In authenticate::password plugin, do the password check on creation and prevent empty password. - clkao * It turns out that the keyDown navigation fix in Autocompleter applies to MSIE, not only MSIE7. Reported by: Stephen Lee - audreyt * Less spastic logging for the monitoring plugin - alexmv * Made Password Auth plugin able to work with attributes other than 'email address' for autoloading - jesse * Monitoring plugin - alexmv * Add a Jifty->web->current_user->is_oauthed - sartak * Force values in REST handler, so we get real values - alexmv * bugfix for 'new' classloader - yves * chg name column filter by ldapfilter - yves * made not changing your password no longer a criminal offense - jesse * fixed a bug someone introduced that mistakenly set password to varchar(255) - jesse * don't prepend http:// on https:// openid urls. - clkao * on verification failure, call continuation if there's one, rather than always redirect to /openid/login. - clkao * previous() method for doing diffs to the last value - alexmv * A few more OAuth tests I had left uncommitted, tired of 's'ing them :) - sartak * Add /=/search/ModelName/c1/v1/c2/v2/c3/v3/... for REST - sartak * Add Jifty::Plugin::Recorder::Command::Playback with some serious caveats - sartak * Add __limit/N to /=/search/ for when you really only want N results -- such as when displaying them in a dashboard widget O:) - sartak * Add a Queries plugin for examining the db queries made by your app - sartak * Add a Quota plugin which provides a framework for managing quotas in Jifty - trs * Add blog-style comments to just about any model. - sterling * Add pid to request log name so having multiple fcgi procs won't have a cow - sartak * Add query logging to halos - sartak * Add some "downgrade the info link if there's no information" logic - sartak * Add some support for dumping the Perl code of templates. For now, only for TD. And DDS is currently giving us a lot of extraneous bits (oh well) - sartak * Allow AuthenticateOpenID and VerifyOpenID for some pages - sartak * Allow playback of multiple files in one command, get rid of -f switch - sartak * Allow plugins to add new jifty commands. This requires an unreleased version of App::CLI, but otherwise works. Features usually come with a cost, and this one's cost is .02s on app startup. Worth it, IMO :) - sartak * Attributes: When we delete a record, delete any attributes it may have - sartak * Awright! Plugins can now fiddle with (TD) halos as they wish. As an example, query logging is activated only if you use the SQLQueries plugin. Which also fixes a bug where any queries caught by the Halo plugin would be lost to SQLQueries. - sartak * Checkpoint in the new Attributes plugin, a port of RT::Attribute - sartak * Content-addressable storage (in memory) facility for jifty. Port CCJS plugin to use CAS. - clkao * Don't 404 on a search with no results - sartak * Fix the current_user_can call - sartak * Fix the isa check in REST's _resolve. We instead want to fail if the class we check isn't a $base. - sartak * Fixing HTML dumping so that the HTML is more correct and easier to read when debugging. - sterling * Clean up the return values of the attribute mixin methods - sartak * Freeze and thaw the CGI object, because it can be a glob that upsets YAML - sartak * Wrap the YAML generation in eval {} too, because it is upsettable :) - sartak * Generalize __limit to __per_page and __page - sartak * Get rid of the warn select_query on adminui search - sartak * Display "1 entry" instead of "1 entries" - sartak * Give each OAuth page an OAuth title and subtitle - sartak * Give response code 405 (invalid method) on GET /oauth/{request,access}_token - sartak * Give the interesting classes jifty_serialize_format instead of hardcoding in recurse_object_to_data (obra++) - sartak * Halo refactor to allow arbitrary plugins to add their data to be displayed - sartak * Halos now display arguments - sartak * Have OAuth use our shiny new boolean type so that it works on multiple databases - sartak * I am Jifty::Plugin::GoogleMap::Widget user. Since rev.5170, no render google widget. I am not sure if this change is right. - bokutin * Instead of sticking 1 into is_oauthed, stick in the access token - sartak * Fix a bug in updating a consumer's timestamp - sartak * Keep track of whether we are OAuthed in the stash (this may move in the future, since current_user_can will probably want it) More tests, especially "don't let consumers oauth tokens while oauthed" - sartak * LeakTracker: complain if Devel::Events::Generator::ObjectTracker isn't loaded in time (nothingmuch++) - sartak * LeakTracker: log how much memory we're using at each request if Proc::ProcessTable is installed - sartak * Have the REST dispatcher use "documentation" meta-attribute in models and columns - sartak * Log successful OAuths - sartak * Make TD halos show up only if DevelMode is on, consistent with Mason halos - sartak * Make the OAuth models root-only - sartak * Make the default log path log/requests, and make the path if needed - sartak * More Recorder doc - sartak * More tests for, and cleanups of, OAuth - sartak * Move LeakTracker's reports into /__jifty/admin/ as well - sartak * Move the query reports into /__jifty/admin/ - sartak * Now each halo has a proper header. You can now toggle between rendered output and HTML source. It's ugly as sin, but it works. Other misc cleanups. - sartak * User has some choice how long to grant access (instead of only 1 hour) - sartak * User may now choose to deny the consumer write access (the current_user_can check isn't working just yet) - sartak * Add CurrentUser->oauth_token - sartak * OAuth is now its own dist, Jifty-Plugin-OAuth - sartak * OAuth should set temporary_current_user, not current_user - sartak * OAuth: Better allow/deny notifications - sartak * OAuth: Better debugging output, small fixes - sartak * OAuth: Support for Authorization header - sartak * OAuth: hyperlink fixes, make deny come before allow so it's the default (when the user mashes enter) - sartak * OAuth: test that delete fails when the access token forbids write access We need to hook into JDBI::Record's before_$crud triggers because current_user_can may just say "yes the owner can delete" and we want to prevent that - sartak * OAuth: use 0 and 1 for booleans instead of '' and 't' to satisfy all(sqlite, postgres, perl). argh. Render allow/deny as a selectbox in REST - sartak * Old REST code was creating screwy hashes, use the new jifty_serialize_format instead - sartak * Punt the design issue by making SQLQueries and LeakTracker use your app's layout :) - sartak * Queries: begin renaming to SQLQueries because Queries is vague - sartak * REST's _resolve needs to take into account that we use :: as a seperator, but we give . as the separator - sartak * REST: Add /=/version, which only includes Jifty and REST versions. Bump REST to 1.00. - sartak * REST: Add __order_by, __order_by_asc, and __order_by_desc to /=/search - sartak * REST: Canonicalize search arguments - sartak * REST: Include a REST URL in Jifty::Record links. The HTTP_ACCEPT logic should be made smarter - sartak * REST: More documentation for /=/search - sartak * REST: Qualifying the entire model/action name will fail because it will have no leading :: - sartak * REST: We don't need the temporary hack any more for .js, since jifty_serialize_format already explicitly stringifies things - sartak * REST: bug in some old code: if (ref $x eq 'ARRAY') { %$x } - sartak * Recorder plugin: record and playback accurate HTTP requests. So far the record part is done. - sartak * Recorder: Defer loghandle creation until first hit, so not all commands are creating request logs - sartak * Recorder: Don't install the trigger if creating the loghandle failed - sartak * Recorder: Log all HTTP output from playback. This required a small API change to get unique filenames - sartak * Recorder: Rename handle attribute to loghandle due to a possible conflict - sartak * Recorder: Update Playback doc - sartak * Recorder: autoflush logfile just in case the server goes splat - sartak * Recorder: log how much memory we're using at each request if memory_usage is set. - sartak * Recorder: log when we started and ended each request in absolute time - sartak * Recorder: record the current user ID so we can still playback (to some degree) without the sessions table - sartak * Remove a bunch of code duplication between Jifty::{Mason,Plugin}::Halo - sartak * Rewrite the Gladiator plugin so that it now works, and do the log/view thing (which really wants to be generalized.. later) - sartak * Run delete_all_attributes _after_ deleting the original record, in case that fails - sartak * SPA is not compatible with letme's across clicks/submit for obvious reasons. So disable it when we got temporary_current_user. - clkao * SQLQueries: Finish renaming from Queries - sartak * SQLQueries: Hide the stack trace behind a more/less JS thinger - sartak * SQLQueries: Log queries as soon as they're made, instead of after the request - sartak * SQLQueries: keep track of the ten slowest queries and display them. The query page could use a bit of visual design. :) - sartak * Small OAuth doc improvements - sartak * Small fixes for newer OAuth spec - sartak * Some SQLQueries fixes - sartak * Some refactoring of Jifty::Mason::Halo. Now it too can support plugins munging the halo data. And its query logging is now off unless the SQLQueries plugin is used - sartak * Split between "Draw halos" and "Page info". Make halos look less offensive as well. - sartak * Style changes, flip between "draw halos" and "hide halos" - sartak * Template::Declare halos! (you'll need a bleeding edge TD though) - sartak * Test corrections, and depend on Net::OAuth 0.05 - sartak * The jQuery plugin is now obsolete since jQuery is no included in Jifty's core JavaScript files. - sterling * Updating the REST plugin to use PUTDATA added in CGI.pm 3.30. - sterling * Upgrade plugins before application so that application upgrades can depend on plugin upgrades - trs * Use Jifty::Util->absolute_path on the recorder log path - sartak * Use add_order_by for REST's __order_by, except the first time when we do want to wipe out the default ordering - sartak * Use record->jifty_serialize_format instead of the old result- >_record_to_data - sartak * User-specific documentation at /oauth - sartak * add missing continuation in CAS login plugin - yves * allow authentication by mail or cas login and domain - yves * first cut of the iefixes plugin. no css yet. This includes javascript libraries from, which is MIT-licensed. - clkao * mixin ldap authentication by email - yves * r4991 broke SPA redirect, since webservice_redirect is supposed to set things into request. Do that explicitly now. - clkao SECURITY ======== * BEHAVIOR CHANGE: REST will now list visible actions, not just runnable actions. This is because you generally want to disable actions during GET, but that breaks GET /=/action/ So if you have actions you really mean to hide, then you'll need to update your application. - sartak * Distinguish between *runnable* actions and *visible* actions in Jifty::API. This distinction will be used in the REST interface shortly. You should hide an action if the user will never be able to run it. You should deny actions if conditions aren't right for this request (such as during a GET). For example: Only administrators should be able to see a PublishNews action. Jifty->api->hide('PublishNews') unless Jifty->web->current_user- >is_admin Only users can run CreateGame (though nonusers can still inspect the action). Jifty->api->deny('CreateGame') unless Jifty->web->current_user- >user_object - sartak * Never send a cookie with cached content. Misbehaving proxies cause terrific problems. - sartak * Security fix: Deny all actions (except Autocomplete and Redirect) on GET. You must whitelist actions known to be safe, such as with: before '*' => run { Jifty->api->allow('CustomSearch') }; - sartak TESTING ======= * 01-version_checks.t: Avoid warnings. - audreyt * Fix tests for new region styling - alexmv * Add todo tests for validate_password to be run on set_password, which isn't currently the case. - clkao * Jifty::Test::WWW::Declare doesn't call import_extra, so move 'requires' and plan into ->setup - alexmv * We have to use Jifty::Util in Jifty::Test, alas. :/ - alexmv * Remove bogus svn:keywords from a test file - alexmv * Only clobber ::plan if we actually output a plan already - alexmv * Output a plan before loading modules - alexmv * Prune the test subdirectories - alexmv * Purely pedantic/cosmetics fix to all Makefile.PL under t/TestApp-*/ so their "name" instruction contains properly formatted distribution name such as "TestApp-JiftyJS", instead of the incorrect module name such as "TestApp::JiftyJS". - audreyt * Run tests against an apache httpd - alexmv * Test fixes for there being one more arg to JS Region.new - alexmv * Update test for the new world order where empty labels are not output - alexmv * small fixes to make the tests run from the main harness - jesse * t/TestApp/t/06-validator.t fails with an older HTTP::Server::Simple - falcone * AJAX canonicalization tests submitted by Peter Mottram - sartak * Add a "Play" action with various argument schema, and a test to test javascript behaviour based on the schema. The first test is to test if ajax canonicalized setting works. - gugod * Add a simple tangent/return test file, this is to protect the behaviour that, clicking on a "return" link should return to previous tangent point, or default location if none. - gugod * Add a simple test to test Action object initialization. - gugod * Add a test to test the link that updates multiple regions at once, and also showing an alert(). - gugod * Add canonicalization tests. - gugod * Add t/Mapper/lib/Mapper/Dispatcher.pm which whitelists the GetGrail and CrossBridge actions - sartak * Adda another URL that shows the same form as /c/page1/ to test if the form_return really return to the tangent point. - gugod * Better diagnostics from OAuth - notify user when we have Net- OAuth < 0.05 - sartak * Don't run Comment plugin test if a prerequisite is missing. - sterling * Ensure that giving OAuth consumers write access works - sartak * Finish two sets of selenium tests for testing continuation. The goal is to see if form_return actually returned to where it begins. The entry point can be either '/c/page1', or '/c/page_another_one'. - gugod * Fix dependency test failures from the comment plugin. - sterling * Fix some test failures caused by halo output in TD generated images. Anyone have any better ideas? - sartak * Fix test that was requiring search to return 404 for no matches - sartak * Fix the comment view test page. - sterling * For testing continuation, add a "AddTwoNumber" wizard like the one in Jifty::Manual::Continuations, only it's written with TD rather then mason template. To manually test it, goto /c/page1 first. Type some number and hit enter. You sholud then visit /c/page2. Type some other number and hit enter. You should return to /c/page1 with the result of AddTwoNumber action shown in the message box. - gugod * Forgot to commit TestApp::Plugin::Attributes::Model::Song - sartak * Get rid of the JQuery plugin tests hanging around from a now gone JQuery plugin - trs * Have t/01-dependencies.t report the entire dir+filename, not just the filename - sartak * Import a Test.More (the jsan module) -based js test to test behavour.js. Including a .t wrapper that launches a selenium server pointing to the harness test. - gugod * Improve tests, the basic protected resource request works, yay. PLAINTEXT fixes. - sartak * Jifty::TestServer: explicitly ignore ClassLoader objects in @INC while stringifying - ishigaki * Make Crypt::OpenSSL::RSA optional for OAuth, and fix the tests to not require it - sartak * Missing $server in a test? I doubt this is intentional, so fixing - sartak * Test fixes so that http methods other than GET and POST work - sartak * TestApp::OAuth::User->current_user_can - sartak * Prepare a TestApp just for testing jifty.js javascript functions. The goal is to test javascript code, not just perl code, so using selenium is a must. Pretty much like this test suit should be the counter-part of mech- based tests under TestApp/. Provide a simple test file to test Jifty.update() function, both with and without argument. - gugod * Replace "is $html, ..." with $self->wait_for_text_present_ok Isolate current tests in a bare block, so we can put more tests in this file easily. - gugod * When we fail to connect to the selenium rc, skip the rest of the tests - sartak * force TestApp-JiftyJS to use en on server side, otherwise the browser launched by selenium might be trying to use other languages we have translation for, causing the expected error output being localized. - clkao * ignore TestApp-Plugin-Attributes' var and log - sartak * jQuery: Fix our one test failure (caused by a broken test) - sartak VIEW ==== * onclick => { submit => { action => $a, arguments => { a => "b" }}} now propagates the action arguments to the non-JS click as well. - alexmv * 'mandatory' columns are not mandatory if they have a default and didn't appear in the form. - alexmv * Allow onclick, etc, handlers on arbitrary elements - alexmv * Possibly making region inclusion display-neutral - jesse * Check that forms that are opened are closed - alexmv * Perltidy to fix indentation in Jifty::Web - alexmv * Don't output an empty label element - alexmv * Failing test for error pages - alexmv * Finish pulling out html comments, and the now-unnecessary newlines as well - alexmv * Fix error pages. This is a perltidy; the only semantic change is to replace Jifty->web->return with form_return - alexmv * Fix setting of class attribute for calendars (className is only for element.className) - trs * Fixes for region updates in the wake of r5216 - alexmv * Lazy page regions (only work with JS) - alexmv * Lazy pageregions can't be done using behavior, as the JS which defined the region might not have been run yet if it itself came from a region load (for fragments responses, behavior is applied immediately, scripts are run after some settle time). Thus, put the region-updating code into the page directly. - alexmv * Make view handler classes configurable. - jesse * One-character fix to get lazy regions actually working - alexmv * The correct logic (putting the registration on the button) was already in the $action->button method; move it into Clickable. - alexmv * Regions need to know if they started with the form open - alexmv * Skip ajax canonicalization on checkboxes - alexmv * Template arguments override normal args, when talking to templates - alexmv * Template arguments don't propagate down into pageregion calls - alexmv * Warn about template_argument change side-effects - alexmv * We should skip registering it on the button if it has made any appearance in the form - alexmv * When doing new region creation, make sure we get the new value of the element that we're applying Behavior, etc, to. - alexmv * YUI classes weren't getting properly attached because $class changed to $args{class} (why didn't strict/warnings catch this?) - trs * Attach the proper yuimenu(bar)?itemlabel class to links - trs * You no longer have to manually register an action if the only place it's used in a form is in a submit. exception: if you use a moniker rather than an action object, we don't have a way to convert that into the action, so that still requires a manual registration - jesse * _current_collection shouldn't ever be able to get an object passed as search_collection - alexmv * app_behaviour.js was not enable in IE6. jQuery less than 1.2.2 has problem in .ready() (We have 1.2.1). - bokutin * cleaning up some old templates - jesse - Merge /bps/jifty/jifty/branches/cssquery-refactor to /bps/jifty/jifty/trunk - clkao - When form_field() are called with render_as in cached mode, Make sure it requires the widget class. - clkao - Refactor and put all the Form::Field blessing logic into one place. - clkao * A prototype.js fix for IE6 throwing object errors on Hiveminder task creation - sartak * Add a canonicalize_value to Jifty::Web::Form::Field. Override it in Date to output just the YMD part. - sartak * Add a class to read mode spans to allow them to be selected separately. - sterling * Convert clickable tooltip to button title and make sure buttonToLink() passes on the title attribute. - sterling * Don't auto register field's action unless we are in an open form. This fixes the case where actions aren't properly registered to the correct form: my $foo = $action->form_field('foo')->element_id; form { render_action($action); form_submit; } - clkao * Fix a bug that if you use $action->form_field('foo'); $action- >form_field('foo', render_as => 'hidden') you get a ::hidden object which is useless, as opposed to normal Hidden object which returns from the following without cache: $action->form_field('foo', render_as => 'hidden') - clkao * Fix menu activation for menu items which are defined with link instead of url/label - trs * Fix title handling in Web::Form::Field::Select - sartak * Fixed missing HTML escaping on option value attributes in select form fields. - sterling * Inserted the missing jifty-result-popup DIV on the Mason page wrapper. - sterling * Jifty::Web: removed long-gone loc.js (deleted at #4324) from javascript_libs - ishigaki * Make dropdown/context menus a reasonable fixed width - trs * Make the YUI menu.css usable - trs * Move our own Form.Element.* methods to Jifty.Form.Element.* and mark the old ones as deprecated. This is a forward-compatible change in preparation for the jquery branch merge. After the merge, the old methods will no longer exists, and the Jifty.Form.Element.* ones will be provided by the Prototypism plugin. Patch by hlb. - clkao * Normalize placeholder text because sometimes one has \r\n and the other has \n. Ugh. - sartak * Only call ->url on link if it supports it - trs * Some style changes and minor fixes (that damn quote in onclick.. !) - sartak * Support group headings for YUI menubar rendering - trs * Support menu grouping for YUI - trs * Totally redo menu grouping. The way it works now is you build up menus and submenus as normal and then for submenus that you want inline, you set render_children_inline => 1 for the parent. - trs * Turns out turning off ajax canonicalization for a single form field was just ignored. We need more JS tests. :( - sartak * Updated the chart image behaviour JavaScript since it broke with the Prototype 1.6 update. - sterling * Updating so that simple bars work again (broke with Prototype 1.6) and also ported to use jQuery. - sterling * jifty.js: Work around placeholders not being properly cleared and causing (small) data loss - sartak * re-merge r5120 given now regions know if they are in a opened form. - clkao * refactor handlers Jifty::Web::Form::Element to use our mk_normalising_accessor. - clkao Jifty 0.71129 I18N ==== * Delay i18n handle init until we have session. SkeletonApp dispatcher rule to set language in session. - clkao * I18N plugin: log when user is somehow able to pass in disallowed lang. inline the initial dictionary json. - clkao * I18N: load json dict from absolute path. - clkao * I18N::Action::SetLang: scalar::defer is trigger some oddness, rewrite available languages as normal runtime code, and cached. - clkao * I18n: fix json dictionary fallback. - clkao * Jifty::I18N - POD fixup. - audreyt * Jifty::I18N: Implement the L10N.AllowedLang key to limit the set of languages available to the user. Use case: ja.po is incomplete and we wish to hide it from users. Requested by: clkao - audreyt * Jifty::I18N: provide available_languages method. - clkao * Jifty::I18N::promote_encoding - r4286 by yours truly broke auto- decoding for POST requests. This is a better fix to avoid the "Unquoted / not allowed in Content-Type" warning (which arugably is a Email::MIME::ContentType glitch), by scanning the Content- Type header for the substring "charset" before parsing it. This way, when "charset" is not found in that header, we still fallback to Encode::Guess, regardless of whether the request was of type "multipart/form-data". - audreyt * Jifty::I18N::promote_encoding: Multi-part form data have no notion of charsets, so we return the string verbatim here, to avoid the "Unquoted / not allowed in Content-Type" warnings when the Base64- encoded MIME boundary string contains "/". Prompted by this Content- Type header found in real world: multipart/form-data; boundary=---- WebKitFormBoundaryRqXyEnBQ/5VSsexe which triggered this error: -- 2007/10/22 04:19:30 WARN> Carp.pm:46 Carp::carp Unquoted / not allowed in Content-Type! at /usr/local/lib/perl5/site_perl/5.9.5/Jifty/I18N.pm line 226 -- 2007/10/22 04:19:30 WARN> Carp.pm:46 Carp::carp Illegal Content- Type parameter /5VSsexe at /usr/local/lib/perl5/site_perl/5.9.5/Jifty/I18N.pm line 226 - audreyt * Jifty::Plugin::I18N: provides SetLang action. provides loc.js and other facilities to l10n your javascript along with po. - clkao * Provide get_current language method in Jifty::I18N. - clkao * Support serving json version of po and localization in javascript space. - clkao * Update zh-tw po to include translations for authentication::password plugin. - clkao * allow switching current language for Localization. - clkao * bin/jifty po now takes two more options: --dir for additional directories to look at so javascript files can be scanned. --js for generating json dictionaries for messages appeared in javascript files declared with Jifty::Web. - clkao * loc.js cleanups. - clkao * updated ja.po - ishigaki * zh_tw l10n for Authenication::Password plugin. - clkao BUGFIX ====== * A temporary fix for rico.js, which is defining the obsoleted (in Prototype) Object.prototype.extend which and then breaks all calls to jQuery.fn.extend. That means all methods with jQuery.fn.extend were simply not there. For instance, jQuery("div.secret").show() - gugod * Added missing jifty-result-popup div to the page detritus section of Jifty::View::Declare::Page. - sterling * Allow users to name their apps in lowercase (as pragmas ?!). Reported by SteveH++ - jesse * Bring the default back, but at 0.0.0 to prevent uninitialized complaints. - sterling * Class::Accessor::Fast cleanups - jesse * Clean up Jifty::Web initialization a bit. - jesse * Clean up the masonXXXXXXXXXX temp directory after each test run. - sterling * Do not do clever & broken input_name for buttons when preserve_state is false. - clkao * Don't do weird things with loading model subclasses - jesse * Don't send cookies for static files. We suspect that doing so was screwing up non-compliant proxies that were caching the cookie and causing.. "amusing" security problems - sartak * Fix compatibility with Test::WWW::Mechanize - jesse * Fix mismerge.. - sartak * Fixes to several of my fixes for Jifty::Request::load_from_data_structure - jesse * Fixing a bug that prevents any but the first plugin being checked for schema updates. - sterling * Fixing a typo in the plugin DB version metadata key affecting upgrades. - sterling * Horrible Hash::Merge workaround, part 2 - alexmv * Improving schema setup for plugins that are turned on after the application is initially deployed. - sterling * Jifty::Request::Mapper - Avoid uninitialized warnings when $args{destination} ends up undefined. - audreyt * Make sure Jifty::Filter::DateTime doesn't disturb Floating datetimes Otherwise, dates would get set to the current_user's timezone, throwing a wrench in the works - sartak * Menu class is undef by default; fall back to the empty string - alexmv * Minor edit: fixing reference to Jifty::Request::Action to Jifty::Action - sterling * Pg wants to connect to template1, but CREATE DATABASE foo TEMPLATE template0 - alexmv * Plugin upgrade incorrectly assumes a DB version of 0.0.1 when none is found. - sterling * Rather than helpfully failing to load model classes that have compiletime errors, actually die with the error that caused the class not to load. - jesse * Remove debug info. - clkao * Remove debugging statement - alexmv * Removing the display style from the jifty-result-popup, which is breaking it. - sterling * Revert clkao's fixes for now because they break apps :/ - sartak * Revert r4117 as the element readiness state is not compatible with what it was. - clkao * Revert r4435 because it breaks Safari 3.0.4 - sartak * Reverting the addition of these files which were added by a push error. - sterling * Some databases have schema creation single-threadedness. If they block, wait and retry for up to a minute - jesse * Some parts of that last commit to use only one Module::Pluggable weren't as hot as they appeared to be; - jesse * The JIFTY_SITE_CONFIG environment variable was silently ignored. - audreyt * Undoing 4302. There is such a class. Thanks to chmrr. - sterling * Undoing previous accidental patch to Jifty::Continuation because I have not finished proofing it. - sterling * Use ->clone on DateTime objects to avoid possible DST issues, etc - sartak * Use blessed() instead of ref() to keep an if statement from tripping on ->isa(). - sterling * We depend on the bugfix that File::Spec->rel2abs("/foo","/foo") eq "." - alexmv * When it's a ::Create action, $event_info won't have a record_id there, cause a fatal error when it's published latter. - gugod * When loading a web request from a data structure, don't totally throw away the path it was requested at. - jesse * Work around a "feature" in Hash::Merge < 0.10 - alexmv * carp, don't warn, for a "title" Mason/TD warning - sartak * collection generator may be called when we're loading models and not all models have been loaded to the moment, so we have to try to require the model before testing if it esists. - ruz * don't gen a collection class if there is no model - ruz * don't warn if database doesn't exist when dropping database - sunnavy * friendly_date should be relative to the user, not floating - sartak * make a looser check for Content-Type since firefox 3 will append charset stuff to it sometimes - sunnavy * merged prototpe-1.6 to trunk again, wish it's all right this time :) - sunnavy * no need to print STDERR, we can warn in $SIG{__WARN__} - sunnavy * oops, should look for js files under js. - clkao * our version of prototype can't deal with synchronous request. - clkao * revert changes to ClassLoader. Collection classes are failing to be generated in some TD views - falcone * rollback r4242 which cached the gzipped js/css even through develmode reload. - clkao * tabview shouldn't force absolute paths to relative ones - jesse * warnings should be to STDERR - sunnavy * we want to compute UUIDs every time. really. it's not useful to always have the same uuid - jesse * webservices_rediret: don't redirect if there's any failed action. - clkao CORE ==== * Add Jifty::DateTime::from_epoch which does our usual timezone magic, use set_current_user_timezone more, too - sartak * Add Jifty::Util->is_app_root to determine whether a path looks enough like the app root - sartak * Add a 'now' method to Jifty::DateTime which sets the timezone to the current user's timezone. DateTime::now passes time_zone => UTC to Jifty::DateTime::now, which caused it to skip over the currentuser/timezone magic. - sartak * Add a ForwardCompatible config in Database section. The usecase is that when you switch your checkout to something with older version of app schema, you can declare it is compatiable with the future version that is currently in db. - clkao * Add a Jifty::DateTime set_current_user_timezone method - sartak * Add an 'as_user' method and have 'as_superuser' use it - sartak * Add the ability for apps to have very fine-grained testing (such as overriding config for a subdir of t/, or even a particular test file). Still needs tests and I suppose some more doc :) - sartak * Added a new 'AutoUpgrade' option for Jifty and Application schemas, so you don't need to manually upgrade every time jifty or your app version bumps - jesse * Added the ability to craft a Jifty button with a "submit" link which submits hardcoded arguments. - jesse * Change how plugin is initialized so _pre_init is actually noted. - clkao * Don't require recipients in Jifty::Notificaiton be objects. - clkao * Finalize triggers if possible (supported in forthcoming Class::Trigger release). Override JDBI's default of having refers_to null return undef, instead of object with no id. RightsFrom 'foo_id' should work like RightsFrom 'foo' - alexmv * Fix the problem of tests having both config and a correctly-relative $0 Jifty::SubTest now makes available the old Cwd (which as 03-nosubtest demonstrates doesn't break apps that don't use Jifty::SubTest) Also a bit of doc in Jifty::Config The Feature is Done. :) - sartak * Fixes to not cache compressed css+js while in devel mode. Refactoring js compression code into the plugin where it belongs. - jesse * Get rid of another place where we had a custom accessor that meant 'arguments' - for great consistency - jesse * In Jifty::DateTime->new, set the timezone to floating if it looks like just a date - sartak * Initial implementation of Jifty::Test::WWW::Declare, with basic tests in TestApp - sartak * Just a perltidy - alexmv * Make action_arguments effective from js update() - clkao * Making the as_*_action() methods accept a paramhash for additional new_action() parameters. - sterling * New as_string method for Jifty::Web::Form::Link. - clkao * Override T:W:D's get with ours which prepends the server's URL Start documentation - sartak * Recursively transform content structures. Set a flag when we change the method, in case apps care - alexmv * Remove the unused drop-column logic from jifty schema --setup, since ->columns returns only active cols - sartak * Ripping out new_record_action() from Jifty::Web. Re-implementing it as as_create_action(), as_update_action(), as_delete_action, and as_search_action() in Jifty::Record and Jifty::Collection. - sterling * Test config loading is now complete code-wise :) And it has tests now too! Just need to doc it in manual or Jifty::Config - sartak * Untabify - alexmv * Updated the JSON and YAML transports for web service requests to allow complex data structures in actions - jesse * Updating the Jifty web menu component to respect classes added by users - jesse * added "rel" attribute to Jifty::Web::Form::Link/Element, to allow <a rel="nofollow"...> or <a rel="next"...> - ishikaga * allow onsubmit in form to include custom javascript. - clkao * if refers_to is not mandatory field then add 'no_value' option to select box - ruz * merged prototype-1.6 to trunk - sunnavy * use object calls instead of instance calls. use better handling of roots so server relative paths work as expected unless you're bind to a location - ruz * working toward onclick => { submit => { action => $action, arguments => { foo => 'value', bar => 'other value'} }} Jifty's js still needs help - jesse CRUD ==== * A bit of refactoring to expose some more overridable templates in CRUD view - jesse * Adding another CRUD setup example to the synopsis. - sterling * Assume the page is "1" if no value for page is given to the pager in CRUD. - sterling * Don't override object_type if the CRUD view package already defines object_type. - sterling * Simplifying the CRUD code for generating the record_class and making it more flexible. Adding a stub for CRUD testing. - sterling * added a bit more semantic markup to the crud view - jesse DOC === * A lot of POD for OAuth, and some tiny fixes elsewhere - sartak * Add a Jifty::Manual which lists each of the manuals with a short description. Secret confession: I was tired of perldoc Jifty::Manual::<tab> failing :) - sartak * Add Jason May to AUTHORS - sartak * Added a synopsis and license section to docs. - sterling * Adding SYNOPSIS, LICENSE, and code comments. - sterling * Adding a description to Jifty::Everything docs. - sterling * Adding documentation for Action and Static attributes to resolve POD coverage test failures. - sterling * Another example app: ShrinkURL, which is basically (surprise!) tinyurl - sartak * Clean up the Pod, added a Synopsis, added a Why? section, added code comments, and some code tidying. - sterling * Cleaning up documentation to fix pod coverage test failures. - sterling * Doc - sartak * Fix Jifty::Server::Prefork's document so it mentions Net::Server::PreFork, instead of Net::Server::Prefork. (Yes this is very confusing.) - audreyt * Fix package names, add copyright notices - sartak * Fixing POD coverage errors in the AutoReference plugin. - sterling * Fixing pod coverage problems with the jQuery plugin. - sterling * Improving POD and minor tidying. - sterling * Include the http method (GET, POST, etc) in the debug message - sartak * Jifty::Notification - Minor doc fix - The html_body method was misspelled as html-body. - audreyt * More comments - sartak * POD clean-up, some code commenting, and minor tidying. - sterling * POD for LeakTracker's subs - sartak * POD re-wrapping. perltidy. Use Jifty::DBI's new ->_new_record_args and _new_collection_args. Bump the JDBI dep accordingly - alexmv * SendFeedback.pm: Take away the phrase "hiveminder" from the documentation. - audreyt * a tiny change and typo fix - sunnavy * doc fixes - sunnavy * pod fixes - jesse * tiny typo fix - sunnavy * typo fix - sunnavy * updated my email address in AUTHORS to agentzh@agentzh.org - agentz INSTALL ======= * mention Net::LDAP because of the new Plugin so we don't fail 01-dependencies - falcone * Add changelogger dependencies - sartak * Added requirement for URI 1.31, which adds uri_escape_utf8(). - sterling * Adding File::Temp 0.15 requirement for cleanup(). - sterling * Bump JDBI dep to 0.45 (Filter::DateTime changes) - sartak * Force a clone which doesn't have as many bugs - alexmv * Jifty::DBI now uses Class::Trigger instead of Jifty::DBi::Class::Trigger (since rev3968) - ishigaki * Make Test::WWW::Declare an optional dep for now - sartak * Modules other than Net::OAuth::Request in Net-OAuth distro don't have version - ishigaki * Move memleak deps into its own Makefile.PL section - sartak * Removing Test::Log4perl. It isn't used anywhere anymore. - sterling * Require Net::OAuth 0.04 because 0.03 needs my patch. Don't run tests if Net::OAuth is uninstalled - sartak * added Test::Log4perl dep again; it is surely used at t/TestApp/t/02-dispatch-show-rule-in-wrong- ruleset.t - ishigaki * clean dependency test since changelogger has been moved out - sunnavy * older Email::LocalDelivery is buggy. - clkao * require CSS::Squish 0.07, no need to call _resolve_file any more - sunnavy * we need DateTime::Locale - sunnavy MISC ==== * A command line completion script is added into contrib/ - c9s * Add 'performance' tag to sort-changelog - sartak * Add another changelog sorting program, this one I think works a bit better :) - sartak * Remove bin/*-changelog, as they've been moved into their own dist, App- Changelogger - sartak * Remove some debugging statements - sartak * Sort change groups by header, typo fix - sartak * Stripping off the execute flag in SVN. - sterling * add a bug tag - falcone * add an exclude command for logs you don't need to ship - falcone * fix so we don't try to print to a bogus filehandle - falcone * make format_entry return text rather than printing. use the returned message to generate the changelog rather than printing to STDOUT - falcone * remove doubled loop over log messages. explicitly loop over uncategorized first, then offer the user to review all the changes again. reformatting - falcone * talk about how to do iterative editing - falcone * update fr.po and debian control - yves * upgraded request logging from DEBUG to INFO - jesse * usage documentation - falcone * use existing t-discard tag. don't autoskip things, just group them together and you can delete them - falcone PERFORMANCE =========== * The cache was actually a huge performance problem - jesse * Use much less UNIVERSAL::require (to shave a second or two off start times) - jesse * When replacing a region, use the technique described in to improve performance. - clkao * Cache gzipped output from the compressedcssandjs plugin - jesse * Fix a bug that after you access a static css file, it breaks the compressed css by not actually squishing main.css, hence requests static css files under __jifty/css. - clkao * In Jifty::Model::Session: Turn session_id, data_key, key_type into case_sensitive, so we don't do useless tolower on loading sessions. index session_id by default. - clkao * Switch to a single call to Module::Pluggable to help improve startup performance. - jesse * More trying to force caching of static content. - jesse PLUGIN ====== * Add a trigger to Jifty.pm to be run after all initialization (so plugins can use the database handle, or anything else) - sartak * Add an additional trigger in Clickable for SinglePage to filter out state variables for region-__page. - clkao * Add better support for dates in the REST plugin, rewrite a somewhat hairy method - sartak * Add cdn option to CompressedCSSandJS plugin. - clkao * Add new LeakDetector plugin. It kinda sorta works :) - sartak * Added a new plugin that provides an autocomplete widget specially for record references. Helpful in cases when a select is just be too big to contemplate. - sterling * Adding missing JavaScript file and cleaning up a method left-over from testing. - sterling * Don't set action defaults in REST. Actions can take care of themselves. - sartak * Expanded the previous fix to cover sticky values and the initial value in the input tag. - sterling * Fix it so that AutoReference fields show the _brief_description rather than the id in read mode. - sterling * Fixed AutoReference so that it is possible to set the field to empty if not mandatory. - sterling * Fixed a problem where AutoReference breaks in Search actions. - sterling * Fixed the feedback plugin so it works even if the current user doesn't have permission to read their own email. - chapman * Fixing the data fetcher on the AutoReference box so that it sends the text being typed rather than the current value in the hidden field. - sterling * Get rid of spurious warning in Auth::Password plugin - sartak * Handle region redirect with continuation return (for spa). - clkao * Implement callback URLs and test them - sartak * Include the list of object types leaked in the request report - sartak * Make find_plugins() sensitive to wantarray. - sterling * Many improvements, including some pages - sartak * Modified the JS to ignore the [id:1] text at the end of the references. - sterling * More cleanup, hide zero-leak requests by default - sartak * More fixes to get protected resource requests going. We might need a WWW::Mechanize::OAuth subclass, so that each get/post will be properly wrapped as an OAuth request - sartak * Move files from LeakDetector to LeakTracker (because that's the term Cat uses) - sartak * Name the first Jifty->new during test 'pre_init', and tell plugins not to register triggers just yet to avoid duplicated triggers. - clkao * Now we send responses to token requests (and test them) What's left: Authorizing request tokens is coded, but it's slightly flawed somehow Getting access tokens is coded, but not tested No code yet for the actual accessing of resources - sartak * Patch by Alex to make sp_submit_form to be happier with J:V vars. - clkao * Provide an after_include_javascript for plugins to do javascript initialisation. - clkao * Rename 'ready' to 'post_init'. 'ready' and 'server_ready' are somewhat misleading because the plugins fire during other jifty commands - sartak * Refactor timestamp and nonce out of tokens and into consumers. Thanks to hannesty for discussing how it should work - sartak * Some cleanups in LeakDetector - sartak * Some more fleshing out of the OAuth plugin - sartak * Somehow this file got duplicated. I might've done it. shrug - sartak * Start adding an OAuth plugin - sartak * Start writing tests Change timestamp to (ugh) time_stamp, because timestamp is a reserved word in a few SQL apps - sartak * The REST dispatcher should warn $@ if an error occurs - sartak * Turns out we can't (so easily) have the URLs be configurable. Not too much of a problem though Other fixes - sartak * Unbreak OpenID plugin with new Jifty::API implementation. Give fully-qualified action class name here because Jifty::API does not resolve action class names to those ones provided by plugins (those under Jifty::Plugin::*::Action namespace) This is maybe a bug, but need further discussion. - gugod * Users can now authorize/deny request tokens - sartak * Various improvements of try_oauth so it gets further (but not all the way) in the correct codepath - sartak * Various refactors and cleanups Request tokens are now properly set to "used" Life of a request token lengthened on authorize Fixed duplicate timestamp/nonce check (and test) - sartak * Whoops, committed in a subdirectory - sartak * Whoops, the consumer and user were using the same mech. But fixing that didn't break anything :) - sartak * actormetadata: provide a current_user_is_owner method. - clkao * add Jasig CAS plugin with mixin model user - yves * default not to preserve state when spa is replacing __page - clkao * first release for an experimental mixin ldap release - yves * r4534 belongs to trunk. In ClassLoader, if an action matches Create* that isn't about creating a model, don't just return but continue to see if there's any matching actions from plugins. This solves CreateOpenIDUser in particular. - jesse * revert its previous revision for it's fixed earler in classloader. - gugod * simplify ccjs plugin with static handler method call. - clkao * spa: don't translate javascript: links. - clkao * tabview: fix the logic for defered tabs. - clkao TESTING ======= * Add (grr, passing) tests for setting columns in the test app - sartak * Add TestMode: 1 to the default test config - sartak * Add some more tests for Jifty::DateTime in the TestApp - sartak * Begin adding tests for protected resource requests - sartak * Clearing out old new_record_action() tests. - sterling * Correctly skip OAuth tests in the absence of Net::OAuth - sartak * Dispatcher and config fixes, start adding a new test file - sartak * Expand the tests, now they actually test something real! So right now the OAuth plugin is rejecting a few kinds of bad requests (e.g. unknown consumer) while accepting a good request. Now to make more requests of each type :) - sartak * First cut of Selenium testing support in Jifty. - clkao * Fix test count - alexmv * Fixing long-broken support for the "JIFTY_FASTTEST" env variable - jesse * Mailboxes need to have unique names for parallel testing - alexmv * More tests, start implementing callbacks, but failing :) - sartak * Most AccessToken tests done :) first implementation was right on - sartak * Refactor the tests - sartak * Skip OAuth tests if Crypt::OpenSSL::RSA is unavailable RSA should be optional, will fix later - sartak * The first few test scripts are now complete, and uncovered many bugs. Yay. - sartak * When testing, don't just use a single global test database. Instead, use one per testfile. This allows some measure of parallelization - jesse * Wrote most of the authorization tests - sartak * added TestApp-Plugin-OnClick, initially for the update of prototype.js - sunnavy * clean dependency test since changelogger has been moved out - sunnavy * first cut of tests for singlepage app plugin. - clkao * my computer is slow. be more patient about selenium rc startup. - clkao * not dep test for bin/sort-changelog - sunnavy * only run pod coverage tests if you're a developer - jesse * refactor Jifty::Test a bit - sunnavy * support SELENIUM_RC_TEST_AGAINST and SELENIUM_RC_BROWSER environment variable, and allow args to be passed into selenium rc invoker. - clkao VIEW ==== * <embed> isn't a tag which gets a close on it - alexmv * Add a hook to change a menu item's label - sartak * Add support for "title" attribute on elements, which shows tooltips - sartak * Added an app_page_footer page call to jifty view declare page - jesse * Additional selector to make sure that autocomplete hides .hidden_value on .inline forms. - sterling * In TD View handler, don't just return without printing headers if the response content is empty, as when you access /__jifty/empty. - clkao * Making Jifty::Web::Menu more extensible. - sterling * Upgrade a region error from a debug to a warning. - jesse Jifty 0.70824 INSTALL ======= * WWW::Mechanize versions before 1.30 had broken gzip behaviour which broke tests - jesse * properly skip client side td test if new B is not found. - clkao * GD is not mandatory requirement. Skip chart test if not found. - clkao * require Class::Trigger 0.12 for abortable triggers used by css/js compression plugin. - clkao * debian packaging - yves * Makefile.PL - Jifty now depends on TD 0.26 - agentz * r1254@agentz-office: agentz | 2007-08-10 17:08:14 +0800 Makefile.PL - do NOT skip any tests under t/ unintentionally ;) - agentz * Updated the module recommendations for the Chart plugin. - sterling * Adding Image::Info dependency used during testing of Jifty::Plugin::Chart - sterling * add missing Test::Log4perl dep and update the Jifty::DBI requirement - falcone * Changing the Jifty console requirement back to default => 0. - sterling * debian dependancies * T::D 0.21 needed to pass tests - yves * add IPC::Run3 to dependency. - clkao * Update dep to include version of Module::Pluggable that is patched so that compile errors are caught - trs * Add dependency on Class::Trigger - alexmv * here sunnavy comes, ;-) - sunnavy * typo in recommends - falcone * Add myself to AUTHORS - andk * Better diagnostic messages in the dependency checking script. Thanks to Andreas Koenig - jesse * don't index plugins' test directories - jesse TESTING ======= * Add failing tests for load_by_kv with chr(0) - sartak * clean up load_by_kv - jesse * The warnings come from the server code after the fork. Test::Log4Perl isn't going to catch them. - jesse - Fix our test mech to not choke on non-default cookie names - Clean up page headers - Remove unecessary var - trs * Fix the template subclassing tests. - clkao * Helper method for mounting crud view. - clkao * Add a little pod coverage - sartak * Make sure there's always a stash during testing since we don't always go through the web - sartak * Pass defaults to render_region in test. - clkao * the actual templates for the 16- test.t/TestApp - clkao * failing tests for region and show inconsistency. - clkao * make a chdir conform to the rest of the test suite and use Jifty::SubTest chdir noticed by Andreas Koenig during his cleanups - falcone * add tests for UTF-8 related things - ruz * a failing test about utf8 when using T::D - yves * we need bytes in escape_uri then 'use bytes' * resulting string is always valid ascii string, so we shouldn't forcibly set utf flag - ruz * fast test support: truncate tables rather than recreating database when JIFTY_FAST_TEST is specified. - clkao VIEW ==== * update tabview plugin to use new relative path syntax for td show(). - clkao * don't use pager to determine items as list_items might be called directly and no pager has been set on the collection. - clkao * Jifty::Plugin::SkeletonApp::Dispatcher - Do not override the 'Home' menu item if the app had set it already. - audreyt * Jifty::View::Declare::CRUD - I18N. - audreyt * Fixed a problem where some disabled elements weren't re-enabled after a submission when the disabled elements were outside of the fragment being refreshed. - efunneko * Added a new helper, new_record_action(), that wraps new_action() with additional help creating Create, Update, Delete, and Search actions for models. - sterling * Fixes to use_mason_wrapper(): * Added a test to make sure use_mason_wrapper() works. * Added $jifty_internal_request to note whether a Mason request is internal or not. * Altered the autohandler to use $jifty_internal_request when blocking access to /_elements/ * Fixed error handling in the autohandler to redirect to /__jifty/error/requested_private_component rather than /errors/requested_private_component - sterling * Give the browser (particularly Safari) some more "settle time" - trs * - efunneko * Fix to a JavaScript bug performing the rerendering of IMG graphs. - sterling * Without the conditional we'll hide errors as soon as we display them - trs * Add explicit hide/show for the error, warning, and canonicalization note divs. This solves some long time ugliness on IE. However, it is not perfect as I am still getting some rendering issues on IE. Does not seem to break anything on FF. - sterling * Fix a fragment update regression caused by the trimclient merge. - clkao * Make enter key submit in the address search popup. * Fix the close link in ambigious address popup. - clkao * Add some classes - trs - CRUD view: Minor refactoring for easy wording change - Provide the D in CRUD - trs * CRUD: Don't bother showing edit link if current user can't - clkao - Plugin CSS and JS (which should be put in share/plugin/Jifty/Plugin/Foo/web/static/{css,js}) is now compressed by CCJS - CCJS can compress more than just main.css by calling Jifty->web->add_css("file.css") - trs * in REST record_to_data, skip container columns. - clkao * r60264@102: jesse | 2007-07-08 21:52:09 -0700 * Template::Declare behaviour change for "show 'foo'" to now show foo at the current template depth. - jesse * r24794@zot: tom | 2007-06-21 02:46:02 -0400 Restore and update the OOM patch to the YUI calendar - trs * Convert to using the form of declaring titles that works when using the mason wrapper with TD - trs * CRUD plugin cleanup and refactoring - jesse * CRUD View: Also export display_columns so it's not required to override it - trs * New Template::Declare page syntax for additional code block run before wrapper, and have the returned value passed to wrapper: template foo => page { title => 'this is title', other => 'foo' } content { h1 { 'blah } }; - clkao * Fix jifty->web->out from without td used with mason wrapper. - clkao * try not to interfere when a user clicks on a link with a modifier key pressed - jesse * YourApp::View->use_mason_wrapper now lets your write page {} in TD but uses your mason wrapper. - clkao * Do not call update() when ctrl-clicked - clkao * Fix javascript emission when CompressedCSSandJS plugin is not loaded noticed by dpavlin++. - clkao * Refactor the CRUD view to make it easier to customize the output - jesse * when rendering the keybindings div, reset Jifty.KeyBindings. Ideally we might want to keep the state with the div so it resets itself when replaced. - clkao * For post fragment update script evaluation, use YUI OnAvailable rather than hardcoded setTimeout. - clkao * switch url from an attribute to a child node for ajax redirects. (The old behaviour didn't work in safari) - jesse * add_javascript method to simplify adding JS libs and updated doc - trs * Fix update() called from non-form. - clkao * Implement "submit => undef" in onclick hook where it should submit all actions. - clkao * Let the code calling the wrapper specify a page class to use to support multiple page types - trs * Make redirect inside region work. - clkao * Make Jifty->web->out work during the dispatch rule stage. - clkao * Optionally use app's View::Page class for wrapper. - clkao * refactor the TD wrapper into a class. - clkao * Abstract render_footer. * Header is always considered done when sending out nontoplevel wrapper in spa. - clkao * r57907@pinglin: jesse | 2007-06-03 16:59:42 -0400 * The SPA templates no longer include css and js twice - jesse * Template::DEeclare now gets a hashref of all the arguments set() in the dispatcher. - jesse * Fix search collection for CRUD. - clkao * Better factored CRUD library, ready for local overriding - jesse * Calendar: Our default canonicalizer is yyyy-mm-dd, while the calendar generates single-character months and dates sometimes. Standardize on the two-digit form. - alexmv * CRUD view and a working example (sitenews) - jesse * Always use an application's 'wrapper' in preference to the Jifty default - jesse * clean url for submenu - yves * add a render_as_classical_menu to have the same menu with T::D view than older mason _elements/nav. - yves * Stop a certain class of validator error that causes an infinite loop in IE - jesse * CRUD builder search works - jesse * Jifty::View::Declare::CRUD lifted from BabelBee - jesse * add the ability to have some code before a javascript click : onclick => [ { beforeclick => "<somecode>;" }, { args => ... - yves * More refactoring in support of adding new view handlers. - jesse U-PUBSUB ======== * Jifty.Subs needs outs_raw. - clkao DOC === * Minor pod additions. removing unneeded wrappers - jesse * Adding documentation for Action and Static attributes to resolve POD coverage test failures. - sterling * Adding tangent and return to the glossary. - sterling * Updating Pod and source comments for Jifty::Config. Performed some Perl tidying and added a new section describing why Jifty uses three levels of configuration files (may need additional editting). - sterling * Cleaning up the Pod and adding a few code comments to Jifty::Collection. - sterling * Added myself to AUTHORS - efunneko * Updating Pod and adding code comments to Jifty::Client. - sterling * Major Pod improvement to the class loader, many more helpful code comments, and some tidying for the class loader. Phew. - sterling * Cleaning up the Pod for Jifty::Bootstrap - * Fixing error that occurred during previous push. - sterling * Improving some of the Pod, code comments, and minor perl tidying. - * Improving some of the Pod, code comments, and minor perl tidying. - sterling * add myself to AUTHORS :) - sartak * added some pod to help make pod tests pass - jesse * Added a recipe for using "result_of" to fetch information about actions for use in appends. - sterling * Added NAME sections and short descriptions for the CPAN module summary. - sterling * Adding documentation to Jifty::Plugin::Debug to fix POD coverage failures. - sterling * Added an additional see also to Jifty::Manual::AccessControl to the User and Authentication::Password plugins. - sterling * The true return value of the module needs to not be part of the POD * Fix a POD nitpick - alexmv * word-wrapping some POD - nelhage * Fleshing out and cleaning up the documentation for Jifty::Plugin::Authentication::Password. - sterling * Fleshing out and cleaning up the documentation for Jifty::Plugin::User. - sterling * Added a many-to-many relationship recipe to the cookbook. - sterling * added see also section to Jifty::Upgrade - bartb * Now with more POD! (and passing POD tests) - trs * Extracting talks from the jifty dist - jesse * r58374@pinglin: jesse | 2007-06-14 20:17:33 -0400 * Full doc for the existing CRUD templates - jesse * Cleaning up and improving some of the view documentation. - sterling * Yada Sample application: Example::Todo is too hard to type. Yada! - clkao * The cookbook was wrong about the auth recipe - jesse * More comment about the JAFF handling special case from update(). - clkao * Clarifying comments about the plugins lists - trs * document why the validate hack exists. - clkao * exceedingly minor POD fixes. - diakopter * fix some pod bugs in Jifty/API.pm - sunnavy * update zh_cn.po - sunnavy * documentation fix that seems to have been forgotten when length was renamed max_length - andk * add 'Login on demand' section to Cookbook - ruz * Added section on dynamically created binary content in the cookbook - alech * add docs to pass the pod-coverage tests - falcone * small update to ru.po - ruz * add docs to escape_uri * fix it in the way need it to work, it's escape_uri_utf8. there is no way to escape binary and text scalars in one sub, we need the latter. - ruz * ru.po - ruz * linked POD++ - ruz PLUGINS ======= * Plugins may now have regular models. These are deployed after the schema is setup after adding the plugin to installation. Plugins can bootstrap and upgrade their schema with their own version numbers just like applications (though with slightly different details). - sterling * Adding a plugin for using the jQuery Javascript library with Jifty. - sterling * Fixing the chart plugin tests to match up with changes that have happened to the API since they were written. - sterling * Chart plugin configuration updates: * Deprecating the renderer option. * Adding the DefaultRenderer option to replace renderer. * Adding the PreloadRenderers option to allow additional renderers to be preloaded. * Updated the documentation. * Made sure that the configuration is always passed to the renderer constructor, even if they are loaded late. - sterling * Chart Plugin: Removing extra comma from JavaScript list. - sterling * Chart Plugin: Whoops. Forgot to check in the actual XML SWF library. This is version 4.6. - trs - Chart Plugin: Treat the width and height appropriately - Chart Plugin: Add the XML::Simple dep - trs * Bunch of updates to the chart plugin - Refactored dispatcher - Added XML SWF renderer - Renderers are now passed the configuration hash when init'd - trs * Chart Plugin: Use PlotKit.Base.map explicitly - trs * Chart Plugin: Render onAvailable instead of on window load so that we work in regions - trs * Chart Plugin: Make sure we do not attempt to render 0 pixel values no matter what. - sterling * Chart Plugin: Adding the SimpleBars renderer as a decent, dead-simple HTML- based renderer for HorizontalBars and a prototype for using tables for client- side chart configuration. - sterling * Chart Plugin: Removed some redundant code from the PlotKit renderer and added support for options to the GD::Graph and Chart renderers. - sterling * Chart Plugin: Improved the way the DIV tag is generated for PlotKit. - sterling * Chart Plugin: Added better error handling on renderer require. - sterling * Chart Plugin: Standardizing the chart types across the three current renderers. - sterling * Chart Plugin: Updated the behaviour script used by IMG chart renderers to make it more URI aware. - sterling * Chart Plugin: Fix failing dependency test because Chart uses GD to fix testing. - sterling * Chart Plugin: Added a renderer parameter to the chart() method and add per- renderer initialization. - sterling * Chart Plugin: Making the IMG-based chart renderers capable of handling CSS styling with some added behaviour. - sterling * Chart Plugin: Don't mess with the data structure if it's already what plotkit expects - trs * Chart Plugin: *Very* custom packed PlotKit (from svn) that no longer depends on MochiKit exporting functions into the global namespace. Still need to solve the issue of why MochiKit blows up when included in our honkin' JS file... - trs * Chart Plugin: Uncomment neccessary require. Make sure to handle undefined stuff - trs * Basic PlotKit renderer for Chart plugin - trs * Made the chart plugin test smarter and added one for the GD::Graph renderer. - sterling * Fixed an eensy POD bug. - sterling * Fixed POD coverage issue. - sterling * Updated POD and removed an unnecessary extra subroutine call. - sterling * Added a renderer for GD::Graph - sterling * Moved the chart/* dispatch to chart/chart/* to make room for alternate charting mechanisms. - sterling * Fixed the way arguments are passed to the render() method in Jifty::Plugin::Chart::Web. - sterling * Added a hack to chart.t (forcing an early load of GD) to avoid the segfault that was causing it to fail. Removed the TODO block from the test. - sterling * Regarding Jifty::Plugin::Chart: Added better comments. Fixed some error handling. Switched to using scalar_png(). Switched to using - >require rather than an eval to load Chart classes. Eliminated the need for IO::String. Moved some processing out of View and into Dispatcher. - sterling * Adding a test suite for Jifty::Plugin::Chart, but it is having weird troubles loading Chart::* because that seems to disconnect the server output or something. - sterling * Added the Chart::Base recommendation for the Chart plugin. - sterling * Added documentation to the experimental Chart plugin. - sterling * Adding a plugin for rendering charts of data. - sterling * Updated tabview plugin to work when it's not already inside a region - jesse * Fix IE issues with search div. - clkao * i18n for feedback plugin. - clkao * Incredibly naive "image column" userpic plugin. - jesse * ActorMetadata plugin: Asset renamed to ActorMetadata - jesse * First cut of GoogleMap plugin. - clkao * Facebook plugin: Provide a way to link existing users with a Facebook account - trs * Facebook plugin: More pod, forceable login - trs * Basic Facebook auth plugin - trs * OpenID Plugin: Add a "next" parameter so one can specify the next page to go after openid login. - gugod * debug plugin for logging dispatched rules and current user. - clkao * Password Auth: Plugin view class should respect app page. - clkao * Got the tabview plugin working with non-CRUD code. * got the tabview plugin preloading the first tab, even if it's marked as a region rather than a static tab - jesse * Single Page App: Unbreak nojs form submitting when SPA is enabled. - clkao * CompressedCSSandJS: support optional javascript minifier. - clkao * Move the javascript concatenating logic from Jifty::Web to the plugin. - clkao * CodePress plugin: bump version to 0.02, remove requirement to modify submit form button (and in process break next_page after it, because it turns normal form submit into Ajax form submit which doesn't handle redirects very well -- because it usually redirects to page which isn't valid XML) - dpavlin * Added a 'feedback' plugin - jesse * In SinglePage mode, allow Action::Redirect to happen within webservice and have the client js accepts it. - clkao * CodePress plugin; add language accessor to select syntax highlight language (instead of default generic), example of usage, replace onload with DOM.Events - dpavlin * CodePress plugin for web-based source code editor with syntax highlighting - dpavlin * Make SinglePage plugin configurable. - clkao * First draft of SinglePage plugin. - clkao * Make CompressCSSandJS optional. * always refresh css & js if in devel mode. - clkao * OpenId Plugin: Fix has_alternative_auth. - clkao * Authentication::Password plugin: The (unused) resend_confirmation template was missing. - clkao * User model mixin for OpenID plugin. * Make Authenticate::Password aware that there can be alternative authentication systems. * Make OpenID plugin work even when Authenticate::Password is enabled. - clkao * OpenID Plugin: The minimum required OpenID View for your app to mixin. - gugod * TabView plugin. - clkao * Site news plugin - jesse * A Jifty console to provide quick diagnostic shell for debugging or maintaining purpose. Yes, it's learnt from RoR, and it's good to have it when developing applications, or when you just start learning Jifty. - gugod * This is the OpenID plugin code. Setting up your app to use OpenID isn't as easy as we thought it to be. Will need a receipe to teach people how to cook it. - gugod * Login plugin: return id of the user from action - ruz * REST dispatcher: always use warnings and strict. - jesse * REST plugin: render referencing fields in a saner fashion. - clkao * plugin to add a wiki toolbar to textarea - yves * plugin to use Wyzz online wyziwig editor to render textaera for test and comments - yves CORE ==== * Remove cargo-culting changing of $0 from Jifty::SubTest. It doesn't affect test output but does break things - jesse * respect initial PATH in env under fastcgi. - clkao * Add friendly_date method to Jifty::DateTime which special-cases yesterday/today/tomorrow - sartak * Jifty::View::Declare - Work around Perl 5.9.5 bug by avoid punning the constant name BaseClass with the subclass name ::BaseClass. - audreyt * todo-ify failing tests in t/13-sessions.t - sartak * In action argument creation from model, do not assume refers_to always want a select based on id which we might not be referring to. Allow user to override render_as for refers_to columns. - clkao * Correct a crud component path. - clkao * Fix view CRUD template's method of getting the record - trs * First cut of a UUID column plugin, with a basic test in the user model - jesse * Add a load_by_kv to Jifty::Web::Session - sartak * Resolve import conflicts now that T::D and J::V::D::Helpers have a thingy with the same name - jesse * Moniker bulletproofing. Suggested by Mikko Lapasti - jesse * Push milestone 1 of trimclient to trunk. - clkao * Now make sure it's actually UTF-8 - trs * Make sure we get UTF-8 - trs * Fixing API qualification to make it possible to access actions associated with plugins via ->new_class. - sterling * Don't mess with the HTML by default. This should likely become configurable in the future. - trs * Cleaned up the class loader a bit to make all the auto-generated methods use the same name, remove an unnecessary elsif, and add a few more comments. - sterling * Need parens - trs * Fixed CRUD view to no longer require you to specify a base_path for the plugin's view. It was redundant and we could intuit it. - jesse * Refactor CRUD view to be more subclassable - Extract out per_page - trs * type can be empty for container columns. - clkao * support external javascripts. - clkao * Added support for application-specific plugins (i.e., App::Plugin::XXX) and plugins named using the fully-qualified Jifty::Plugin::XXX name. - sterling * check if current_user->can('user_object') when tring to figure out timezone - dpavlin * Altered the ClassLoader to create Collections for models deeper under the model namespace,like "App::Model::Foo::Bar". These is consistent with the handling for actions and other components already in place. - sterling * Move pulling action defaults from action in request into the action's new, instead of a "private" argument. * Remove an extra place where we default the moniker to _generate_moniker * A bunch of POD (re)wrapping. - alexmv * Recent YAML::Syck's get confused by trying to be too smart with $test_config, which is a filehandle which *also* stringifies to the path. Force stringification to get consistent (working) results. - alexmv * No matter what _resurect_current_user is intended for, it ought to be spelled _resurrect_current_user instead. :-) - audreyt * Mapper edge case failure (when no 'name' was given) - alexmv * add {_resurect_current_user} field into user module - ruz * protect ourself from circular references between User and CurrentUser we do it in user_object, so solution is generic should work in any case, but only if people use the method to set user_object and user model uses _current_user key to store reference to the CurrentUser - ruz * Use Jifty::Util->share_root for finding plugin share roots so that if Jifty isn't installed it still DTRT * Only calculate static roots once and report on plugins adding roots (like the mason handler does) - trs * Allow app changeable cookie names - trs * Web::Form::Link - When escape_label was set, the tooltip property was (very sillily!) first escaped, then discarded away, displaying the unescaped text instead. It now escapes properly. * Also make tooltips with value '0' display properly. - audreyt * Allow scheme to be specified for Jifty->web->url. This functionality was taken out during the move from "heuristics" to URI.pm, but for a non- apparent reason. - trs * HTTPS and HTTP adjectives for dispatcher rules - trs * Jifty->web->form->next_page got dropped when you submit only a specific action with Jifty->web->form->submit. This commit autoadds next_page if you submit only a subset of actions. - jesse * _redirect expects a local path, not a fully formed URL. (This only actually broke internal redirects) - jesse * Always give the dispatcher unescaped path like fastcgi does, from standalone, webservice, and region entrance. - clkao * work around annoying Module::Pluggable bug - sky * Make multiple use base lines into one for readability. - clkao * Admin UI: Don't trip over classes we can't require - jesse * Quiet a dispatcher warning - jesse * misc webservices_redirect cleanup. - clkao * Refactor handle_request to extract out methods * Only warn about denied actions on validate if they're also actions we want to run - jesse * Back out a Croak back to a die. (We're using it for exception handling, not to-user reporting) - jesse * Merge from fragcont branch to include minimum support of continuation in webservices requests to make SinglePageApp plugin work. - clkao * Only squelch "can't locate" errors relating to the class we're trying to require. If it's something else, it's likely a module use'd by the module we're requiring. - trs * correct en.po charset. - clkao * Only call LML->import once ever. - clkao * Kill 5% of startup time by not validating during DateTime::Locale. - clkao * Disable in-region redirect unless SPA is enabled. - clkao * Move methods unrelated to mason to Jifty::View. - clkao * Added support for "redirects" on fragment calls (which really just do an internal replace) - jesse * Really fix the region rewriting logic. - clkao * new Jifty->find_plugin method. - clkao * add a config file version, so we can change old defaults. - jesse * Correct app_class usage. - clkao * CurrentUser->username now uses brief_description on user_object. - clkao * In ClassLoader, be quiet when we are just trying to see if a module exists. - clkao * When we convert a model into an action, don't deref and then reref the array of possible valid values. We lose any attempt at possible magic that we might have. - jesse * A move to hand on the rendering of JDBI::Collection columns to app developers.. - gugod * add data to the result indicating which requested actions were denied and mark them failed. Options for a better denied message coming soon - falcone * Extract the model list from Script::Schema to Schema - jesse * Incremental extraction of schema management from Jifty::Script::Schema - jesse * Cause more compiliation failures to actually stop the app from running - jesse * Cause more compiliation failures to actually stop the app from running - jesse * Cope better with malformed fragment requests - alexmv * Push app_root/lib onto @INC when we create a new Jifty object - alexmv * Moved the commands for add/drop column to Jifty::Record (they should move to JDBI eventually) * Added a drop_table to Jifty::Record - jesse * Added the before_access trigger and a simple test for it. Also updated TestApp and the current_user test to make them compatible with the new before_access test. - sterling * '*' matches only a single level in the dispatcher. '**' matches all level.s We want to run the "Home" rule at all dispatcher levels. - jesse * Make compile errors in autorequired modules fatal - jesse * FCGI.pm ties our streams and its implementation doesn't have support for setting IO layers with binmode, but we can do the same using Encode::encode. We just turn on raw mode on STDOUT and convert to octets ourself using Encode.pm and charset definition from the content type field. - ruz * Extensive UTF8 improvement: to sanity through insanity * control mode of output handles, if content type has charset defined then we set :encoding(<charset>) output layer (or :utf8), otherwise binary * regions are special as we print out them into STDOUT, but sometimes need them as a string. We localize STDOUT and get data, however because of the above canonicalization we get octets or binary, so we check again the current content type. If the type contains charset definition then we decode octets back into perl string(in terms of perl unicode support), otherwise we leave things as is. jifty is sane when apps' developers are sane * never use 'bytes' pragma * avoid using 'encoding' pragma * use perl strings in jifty ** when you get a text data from external sources then Encode::decode it * set output encoding with $r->content_type('type/subtype; charset=XXX') ** by default it's UTF-8 ** you can use cp1251 (or other) and things should work, user will get data in cp1251 and browser should display it right ** don't Encode::encode things before output everybody have own critirea of sanity * if you think that something is wrong then add tests to jifty - ruz * we shouldn't silence utf8 warnings - ruz * utf8::downgrade converts to octets only if string had been upgraded, what is not always true for 'perl strings' - ruz * escape_utf8 * don't use bytes just escape things doesn't matter if it's flagged string or not, perl must do the right thing. * don't localize ref, use it directly, afaik smaller memory footprint - ruz * utf8::downgrade doesn't like strings as FAIL_OK, only integers, 1 is not that cool as 'FAILURE IS OK', but works - ruz * initial environment that makes fastcgi work got deleted - jesse * This module is for rendering a collection of input fields at once as a single widget. The major goal is to let developer say like: column bars => refers_to "My::Model::BarCollection", render as "Collection" availables are defer { retrieve_some_bars() }; in their model class, and it'll just display a nice form to input the value for a list of available bars. - gugod * fixed Jifty::View::Declare::Helpers since we now install tag subs directly to the target package instead of using @EXPORT. We now makes use of T::D::Tags's @TagSubs struct - agentz Jifty 0.70422 [Password Authentication plugin] * Better "password reset" behaviour * added regression test for bug fix in Jifty::Plugin::Authentication::Password::Action::Signup * change manual for access control with user and authentication::password plugins * Revert the bogus warning silencing in 0.70416 as it kills Doxory example. (reported by semifor++) [Core] * More debugging info for broken letmes * Added duck typing to the Jifty::Handle constructor to prevent difficult to trace error messages when the driver name is mispelt or fails to load. * Jifty::Upgrade - Defensive programming against tables that did not have "create table" in its schema for SQLite column renaming. * Jifty::Module::Pluggable - Silence the @ISA warnings. * Doc updates for Jifty::ClassLoader -- David Good <dgood@willingminds.com> * Created a method that can be over-ridden for custom test database setup * debian stuff, fr.po update Jifty 0.70416 * New ExtJS plugin (For yahoo-ui ext) * zh-tw L10N for authen/passwd/user plugins. * WWW::Mechanize 1.22 removed the form method. thanks to hdp for noticing/poking * render_region should have default empty path. * Jifty::Plugin::REST::Dispatcher - Gugod pointed out that we don't need to stringify() the object-to-data output, because (esp for nested structures) it's far more convenient to have the $accept-specific formatter (e.g. YAML or JSON) to render it. * Added render_as_yui_menubar in Menu.pm * Upgraded YUI to 2.2.1 * NOTICE: if you are using yui tabview, please use tabview.css instead of tabs.css * Added yui/element-beta.js and yui/menu.js in Web.pm * Allow '->superuser' to be both an object and class method. * added audreyt's Doxory demo app from doc/talks/yapcasia2007-doxory.pdf * Add doc and prefork dependency so the doc and dep tests pass * Preforking server support for Jifty::Server * Refactoring to support more template engines * fix "open" class in menu - active menu item doesn't imply current open item * Jifty::Plugin - Authentication::Password now auto-loads LetMe and User. * added a "SkipAccessControl" framework directive * Doc: Add section on using models/actions outside of a Jifty app * fix handling of multi-line data when encoded in JSON -- they should never wrap over multiple lines in generated output * helpers improvements for T::D * Make CurrentUser->new work as a method on an instance, so that as_superuser works. * Added a 'None' session type for when your application doesn't need sessions * Can't just check to see if the config exists to decide whether to initialze the Jifty object * Make render_region resolve relative template in current context. * We load the config on demand now, so it always exists. Test for classloader existence, instead of config existence, to tell whether or not we need to Jifty->new. * Refactor the I18N plugin stuff to not fail tests. * Make sure test coverage copes with new jifty->config * Better plugin I18N * Plugin paths don't need to convert because File::ShareDir::module_dir always returns an absolute path. I have added also modification checking to the Jifty::I18N::refresh for plugin po files. -- Alexey Grebenschikov * Log::Log4perl::Appender::String (used in tests) was only added in 1.02; require at least that * Switch Jifty->config to automatic instantiation * Added a basic test stub for Jifty::Test::WWW::Mechanize. -sterling * don't require a bunch of unused modules that don't trickle to the templates * don't set the Home tab twice * use Pod::Simple::HTML where we need it * Administration and Online docs tabs are set in Jifty/Plugin/*/Dispatcher.pm * When running coverage, don't use Class::Accessor::Named as it uses Hook::LexWrap * don't load up PodSimple and other friends unless you've actually enabled AdminMode and brought OnlineDocs into the picture * Modified submit_html_ok to make it behave like the documentation says it should. * Don't create a new config object every time we look at the db version * Added the ability to have a return button that looks like a submit button on a form. * When you rest a lost password, email address is implicitly confirmed * extracted dump_rules into DumpDispatcher plugin -dpavlin * more quieting down of "couldn't drop that database that shouldn't have existed in the first place" warnings * keep old LDAP and CAS plugins usable, THIS COULD BREAK APP MODELS NAME LDAPUser and CASUser models are now User -yves * Autogenerate Package::Action when we need it * Jifty: We now depend on Scalar::Defer 0.10 to not break the *_ localization. * Jifty::DBI::Param::Schema - Mention how to use "defer". * Remove legacy naming from the Auth::Password plugin # nelhage++ * The plugin classloader is wrong. it's going away forever * LetMes need to deal with user objects as superuser to get their tokens * next major round of work on the login plugin. signup now works slightly better debug logging from the jifty dispatcher * Slightly better mail sending defaults * When we use App::Class, actually require the module, to save the user some typing * Changes to the dispatching to templates: * only add '/index.html' to the path given if there is no template that can handle the given path. * template_exists now checks for Template::Declare templates too * tests that check that T::D templates are preferred over Mason templates. * Set some svn:ignore properties so that generated files don't litter the tree * Include the jifty skeleton app by default. * make the 'hey! it's admin mode' bit not overwrite the menu * TD fragments and unicode needed some massage. * Next pass at a login/signup password auth plugin. Now supports login and logout and signup * Jifty::CurrentUser now has a default "_init" behaviour. * The password auth plugin now works * Updated the 'feeds' section in J:M::Cookbook to not lie about the way XML::Feed actually works. Arguably it /should/ work the way we described ("your implementation is showing"), but fixing the docs was easier than submitting a patch to someone else's module. * Now we can inherit actions from plugins * fixed incorrect documentation of _ and added a SYNOPSIS * "final" Mergedown of the Template-Declare branch of Jifty. - New Template::Declare based templating system (optional) - Significant work on plugins - Significant refactoring - Many jifty features extracted to 'mandatory' plugin applets. (These should be made optional or removable over time) * Doc patch for how to do multiple "onclick" actions - jpollack@gmail.com * Log::Log4perl::Appender::String (used in tests) was only added in 1.02; require at least that * add doc to manage a superuser group * add doc to emulate updated_on * Add note to cookbook showing how to change other fields using ajax canonicalization * Basic handler for running Jifty under mod_perl2. Tested under Unbuntu Feisty, with a default Apache2/MP2 install. Requires a config change, explained in the perldoc. -rodi * examples/{Chat,Clock,Ping}/: Use Jifty::Server::Fork instead of stub ::Server subclasses. * Jifty::Server::Fork - New module to conveniently express a forking builtin server. *" * Fix adding columns during an upgrade. * added a Deploying page to the manual based on the process I have found successful * updated the upgrading manual and added a few extra glossary items * DBD::pg passes postgres' warnings up, so try to convert their various logging levels back to Log4Perl levels. Completely heuristic, probably wants more guarding so it doesn't reach out and bite someone. * This quiets some of the most annoting warns revealed when I removed the log-level downing in Script/Schema.pm * Added support for schema_version() in records * Updated the schema upgrade process to handle renames more nicely * Added a simple test for upgrading * YAML.pm is currently required even if YAML::Syck is present. The Makefile now requires YAML even if you have a C compiler and are installing YAML::Syck. * added a CUSTOMIZATION section to the Jifty::Action docs * upping require for IPC::PubSub to 0.23 due to use of disconnect * Disconnect PubSub before dropping the database * Solve copious global destruction warnings * send correct HTTP/1.1 headers for caching when running Jifty with DevelMode: 0 * Support POSTing to /=/model/Foo to create items without specifying a PK * lib/Jifty/Manual/TutorialRest.pod - quick overview of REST plugin * don't double warn. Now that we stopped schema creation from suppressing warnings this *shouldn't* be necesary * stop hiding messages/warns from the database during tests * default to only showing WARN and higher when running tests (rather than our more normal INFO) * Added the ability to force arguments and path when rengering a region. This lets developers force override something passed in via ajax or a "sticky" value from a previous request. * Jifty::Script - Assume "jifty fastcgi" when we are running under cgi. * I18N and zh-* L10N for menu and halo. * fix JScript conditional compilation bug. Jifty.Utils.isMSIE works now. * strict, warnings, and redefinition warning avoidance for J::Module::Pluggable. * Alternate implementation of Module::Pluggable::Object's _require method to avoid a useless string eval. * Actually carp from within our log warning handler, to not swallow critical debugging into * Jifty::Logger - Properly respect previous $SIG{__WARN__} handler if Log4Perl isn't yet initialized; that means we won't silently discard compile-time errors from our model classes, though they are still demoted as warnings. * Refactored Jifty::Script::Schema to use extracted column, table and db manipulation routines * Extract the "load model related classes" logic in the class loader to its own function * A new method provides a tantalizing glimpse of jifty's forthcoming "load models from the database" support * Added table and column schema generation methods to Jifty::Record, based on an extraction of Jifty::Script::Schema * Added "create db" and "drop db" methods to Jifty::Handle * Added the 'bootstrap' option to vanilla Jifty::CurrentUser. Now there's one fewer cases where you need a custom CurrentUser class * Jifty::Util - Add a generate_uuid method and use it to generate ApplicationUUID. * Jifty::Script::App - Make the generated Makefile.PL more canonical. * Jifty::Util - only requires ExtUtils::MM at request. * Jifty::Util - fixed the broken Win32 logic: - use ExtUtils::MM before calling MM->maybe_command - ignore the case of letters when comparing file names * Change all tests for the literal Driver string "SQLite" to a regex match to /SQLite/, in anticipation of fancy drivers such as SVK::SQLite. * enable UTF-8 flag awarness in JSON libraries to fix problem in validation of values during creating a record via the admin interface when column has valid values with unicode chars. * include iepngfix 1.0 * add MIME type text/x-component for .htc file * howto document for iepngfix * Our fallback I18N handle needs to specify that it should autocreate keys if they're not found * Jifty::I18N: Provide a default fallback lexicon class for "en" so Locale::Maketext won't clobber our $@ stack. * Jifty::I18N - Avoid naked eval{} that clobbers $@. * Jifty::Web - Add private accessor for _state_variables to avoid typo-prone ->{'state_variables'}. * REST: Implementation for PUT and DELETE on model items * Canonicalize/validate after typing and blurring, too * Modernization of model declarations for compatibility with new Object::Declare based Jifty::DBI * updating to 'max_length' name for the parameter formerly known as 'length' * Jifty: Deprecate ->length in web form and param fields; write ->max_length instead. * Allow create, load_or_create and load_by_cols to be used as class methods. * REST: Show an action HTML form when rendering /=/action/App.Action.Foo as HTML * Fix running actions (checking for allowed-ness was done wrong) * Cut down on a lot of the crap that we outputed and fix up structure * Make it possible to request XML from the URL like the other data formats * Show action params in any data format instead of just an HTML form * Only allow method calls if the "field" is actually a column * Force stringification so that we don't segfault trying to output blessed references and what not * added the update method which reconstructs the locale handle (used by Jifty::Handler::handle_request) [Jifty::I18N] * &_(loc) now uses the global locale handle instead of the one set up during Jifty::I18N->new(). [Jifty::I18N] * Audrey's refresh method now always calls C<update> either directly or indirectly (via C<new>) [Jifty::I18N] * C<handle_request> now always calls Jifty::I18N->update directly or indirectly (via C<< Jifty::I18N->refresh >>) [Jifty::Handler] * Misc minor startup-time performance improvements * Only run onsubmit() if we have an onsubmit property * Support for controlling browser-based autocomplete on form fields * Fix how fake buttons submit forms -trs * Gotta double-quote keybinding labels if they have embedded newlines. * Warnings when a developer puts a "show" into a "before" or "after" dispatcher rule. Jifty 0.70117 Dependencies: * Bumped the minimum required version of Jifty::DBI to 0.30 Jifty 0.70116 New authors * Add yves in authors, for localisation, debian packaging -yves * Added PJF to AUTHORS file. -pjf * Added evdb as a new author -evdb * agentz * pmurias PubSub (audreyt, clkao, jesse) * Audrey, Jesse and CL hacked out a PubSub message bus and a preliminary Comet implementation. * Doc for how subscription stuff works. a bit of refactoring toward a second transport * Added sample apps and design docs from the PubSub/Comet hackathon * upgrade schema to work on mysql -jesse Database * Initial support for prefetched collections. -jesse * Added support for SQL::ReservedWords to the schema tool, to stop me from building applications for Postgres on SQLite and hurting myself later -jesse * Add a CheckSchema option to the config file to govern the SQL Schema keyword checking -jesse * Classify databases failing an SQL::ReservedWords check for nicer output -gaal * Better debugging information when running actions -jesse Documentation * Updated tutorial to remove mention of the deprecated download area. -pjf * Provided extra tips on how to install Jifty using Perl's standard CPAN module on both Unix-like and Win32 systems. -pjf * Documented PageRegions usage -wolfgang * Show an example of a canonicalizer (lifted from the jifty presentations). -falcone * Document the ability to frob other pieces of the action from a canonicalizer -falcone * Jifty::Manual::UsingCSSandJS - Fix the misspelled "app.css" to the correct "app.js"; minor reformatting. -audreyt * Jifty::Manual::Models - It mentions <> as the SQL inequality operator, but all internal code uses != instead; change the doc to match reality. -audreyt * Jifty::Manual::Cookbook - Trivial typo. -audreyt * Jifty::Manual::AccessControl, Jifty::Manual::RequestHandling - Change C< objEmeth > to the more readable C<< obj->meth >> POD syntax. -audreyt * expanded AccessControl.pod to reflect changes in Login plugin -wolfgang * added a pod describing Jifty's request handling process -wolfgang * added a german translation for Tutorial.pod -wolfgang * Minor fixes to pod -evdb * added explanations about Login Plugin to AccessControl.pod -wolfgang * updated Models.pod to reflect recent changes -wolfgang * added a section on 'limit' to 'Models.pod' -wolfgang * Supply documentation for all of the methods which had been missing it -jesse * Jifty::Param::Schema merge algorithm rescued from the obscurity of commit logs. -jesse * Corrected Jifty::Record::current_user_can: The right is 'update', not 'edit' -jesse * Jifty::Record::current_user_can: "admin" should have been "delete" -jesse * Added the time and date filters to the cookbook. -nelhage * Improved docs for Jifty::RightsFrom -jesse * Improved docs for Jifty::Record (Access control related functionality) -jesse * Added a documentation fileon CSS and JS -wolfgang * Jifty::Param::Schema - Trivial doc fix to s/Wifty/MyApp/. -audreyt * Jifty::Action - add documentation for the automatic moniker generation algorithm. -audreyt * Minor documentation updates -gaal * Jifty::Script::FastCGI doc - it's share/web/ not web/ nowadays. -audreyt * Two simple POD typos, one spotted by Gaal Yahas. -audreyt * Minor spelling corrections. -jpeacock * Fixed a cookbook typo, and add some sentences describing an issue when defer{} failed to dwim. -gugod * A cookbook recipe to do ajax canonicalization. -gugod * Jifty::Action POD: Copy-n-paste the synopsis from Jifty::Param::Schema and correctly L<> there. -audreyt * Tell people where the docs for Jifty::Action::button really live -jesse * [Manual/Actions.pod] added more explanation for the "return values" of Actions made the $id args optional in the sample code. added internal links to L</monikers>. a few additions to the explanation a few cleanups in the sample code -agentz * Manual/Cookbook.pod: typo fixes, code cleanup -agentz * document Jifty::Web::Form::Field::preamble -agentz * Jifty::Manual::(Upgrading|RequestHandling|AccessControl|UsingCSSandJS|Actions|Continuations) typo and wording fixes -agentz * Jifty::Manual::PageRegions examples and cleanup -agentz * Jifty::Manual::Models - mentioned the build_select_query method, paging, and Jifty::Manual::Upgrading. -agentz * Added a note about the fact that mason needs to be flush left to the tutorial -jesse * add full MyWeblog example -jesse * limit handling corrected in Jifty::Manual::Models -wolfgang * Cookbook typo fixed. thanks to tokuhirom -jesse * Jifty::Manual::Cookbook - applied the "edit" link patch from Peter Wise. -agentz * plugin and declarative test design docs -nelhage * ldap autocomplete example -yves * Tutorial_de retitled to not conflict with the english one. -jesse Plugins * First release for plugins AuthLDAPOnly and AuthLDAPLogin, all comments are welcome -yves * Login plugin : Add missing Notification::ConfirmLostPassword, dispatcher for passwordreminder, let to reset lost password -yves * Added an action to let the user change his/her password in the login plugin -yves * AuthLDAP plugins: minor doc and debian rules fix -yves * You can now run actions and get back arbitrary data formats from the REST dispatcher -nelhage * REST dispatcher cleanups. -jesse * First cut at XML webservices in the REST plugin -jesse * The first bit of major refactoring of the REST plugin. -jesse * we loves our ACLs, we do. The REST plugin was violating too much encapsuplation -jesse * Added Module::Install files for plugins EditInPlace and Login; some of them were in the MANIFEST but not the repository, so we were getting false warnings of missing files when running 'make distclean'. -jpeacock * Add license to Login plugin's Makefile.PL. NOTE: remember to increment the plugin's $VERSION strings before releasing to CPAN (else updates won't get installed). -jpeacock * test and debian updates for the LDAP plugin -yves * Usable AuthzLDAP Plugin, see man Jifty::Plugin::AuthzLDAP while thinking on new more generic Jifty::Plugin::Authz::XYZ , Jifty::Plugin::Authentication:XYZ -yves * Login: Don't delete arguments that you don't know about /a priori/. Don't display fields that shouldn't be displayed (using the Unrendered attribute). -jpeacock * Duplicate code removed from the plugin classloader -jesse * Better handling of autocreated modules from plugins. Print debug statements when autogenerating packages. -jpeacock * reworking of Login plugin -jpeacock * Some CAS authentification plugins -yves Internals * Jifty.pm: Load I18N after plugins, but before the main classloader, so the main classes has access to _(). - audreyt * Removed support for Devel::Gladiator. It was very, very beta and caused server processes to end up as zombies -jesse * qw'' is just weird. Change all instances to qw(). -schwern * Jifty::Action::Record 'use'd DateManip but never uses it. -schwern * It also used UNIVERSAL::require but did all of its requires via Jifty::Util. -schwern * Yet another fix to the URI-from-env feature, fixes a failing test (reported by alexmv++). -gaal * Guessing request schemes from the environment is fragile, so make the fallback on BaseURL more reliable. -gaal * when inferring a scheme for the application, look at REQUEST_URI instead of assuming http://. Fixes tangent() on non-http:// apps. -gaal * Use Jifty->app_class whenever possible -alexmv * Code cleanups in Jifty/Subs.pm -alexmv * Fix for when Jifty->web->url is called with query parameters -alexmv * Added a Module::Pluggable subclass to get our own (somewhat improved) require behaviour -jesse * We were not properly removing blank values on record create -jesse * Better handling of current_user when used as a class method -jesse * use ApplicationClass, not Application Name in the login plugin -clkao * Add _is_readable in Jifty::Record, which means the record should bypass current_user_can in check_read_rights. -clkao * Add results_are_readable argument to collection to mark records with _is_readable. -clkao * Minor refactoring to enable non-cookie based session storage -jesse * Use Jifty->app_class to construct app-space class names. -clkao * Jifty::JSON - Turn on $ImplicitUnicode so unicode strings can be reliably serialized into .js and back. (This is crucial for e.g. JavaScript confirm hooks.) -audreyt * avoid warnings in LetMe -jesse * DateTime: DateManip can get confused if someone else calls Date_Init earlier in the process. Tell it "no, really, GMT please" -falcone * DateTime: we're always setting the timezone to the user's timezone, even if new is explicitly called with a timezone. This breaks DateTime->from_epoch which wants data back in UTC -falcone * provide json webservices -audreyt && pmurias * Jifty::ClassLoader - Defining MyApp::Action::Record::* now works. -audreyt * Jifty.pm: Before we call Data::UUID->new, be sure to load it. -audreyt * Jifty::Param::Schema allows "hints are 'type stuff'" but our Model syntax uses 'are' to build an arrayref, so "hints are 'type stuff'" in a model would result in displaying ARRAY(0x123456). -falcone * implement if-modified-since for static view handler. -clkao * Module::Pluggable does't include empty intermediate classes now -alexmv Web UI * Links and Form titles needed to be better escaped -jesse * Add delete option in admin view (for Jamalle - private joke) -yves * Jifty::Param - It's no longer a Jifty::Web::Form::Field subclass. -audreyt * Add the ability to send "notes" to users from your canonicalizer. This is separate from the warning and error spans used by the validator -falcone * validator.xml - allow us to update action data just by changing it. Without this you had to set ajax_canonicalizes on a field in order to change it and have it propagated back. --falcone * Some refactoring of form field rendering, and adding a focus => argument to form fields to focus them on page load. -nelhage * Switch our implementation of autofocus to use behavior, rather than a custom onload event -jesse * Fix calendar div & IE select box problem -ishigaki * Do a slightly more generic dereferencing on the user object's friendly name in the sidebar -jesse * Fixing autocomplete so we render the autocomplete div *before * the javascript, so the JS can hook it. -nelhage * Remove useless check in buttonToLink to get a javascript performance boost. -hlb * Make render_messages sort on result moniker as well. -audreyt * Jifty::Response: Ensure consistent ordering from monikers. -audreyt * Hacked the yui calendar component to allow selection of out-of-month dates -jesse * Even more I18N+L10N, this time for admin crud pages and calendar.html -audreyt * adjusted the output format of render_preamble by removing a redundant space. -agentz * The "length" attribute Web::Form::Field now also means HTML "maxlength" in addition to "size". -audreyt * calendar.js - Fire off canonicalization/validation methods upon clicking a date. -audreyt * Update YUI to 0.12 and port local changes -trs * Administration manage model : add sortable capabilities in header table bug fix in delete item begining of modularity other cosmetic changes silk icons, wai tags thanks to Jamalle -yves * Jifty::Web::Form::Field and ::Select - Label display was rendered using the latin1-biased escaping in HTML::Entities; switch to the proper UTF-8 escaping in Jifty->web->escape. -audreyt * This helps passing xhtml validation. <input> cannot be direclty under <form>, there should be a block-level element in-between. -gugod * made wait-message look consistent in both firefox and IE -agentz * admin/model/dhandler: localization hooks added, page title added -agentz * add yui/tabview and its assets -hlb * Indicate mandatory fields visually -trs * Only emit mandatory field warnings with Ajax when the field starts with data. -trs * Close <li>s we open in the admin interface -alexmv * remove extra </div>s -gugod * upgrade yui library & add yui/container.js -hlb * Fix broken Jifty.Utils.isMSIE -trs * Fix buttonToLink to deal with normal, non-ajaxy buttons that we want to turn into links -trs * Use Jifty::JSON::objToJson to properly escape JS values (in particular single quotes in button labels were causing problems) -trs * Add a key_binding_label attribute so that key binding labels can be set independently of the normal label -trs Jifty Actions * Jifty::Action: Generate stable auto-monikers for actions based on the caller stack. -audreyt * Negative searching for Search actions -jesse * Added an option to search the contents of any text field to jifty search actions -nelhage * Jifty::Action::Record: Allow the same for user-generated param vs CRUD actions. -audreyt * Jifty::Action - Autoincrement the per-request stash counter for the case of looped action creation. -audreyt * Fixed 'mandatory' validation misbehavior -- 'mandatory' now handled correctly -wolftang * Jifty::Param::Schema: Allow partial override of superclass's PARAMS by simply declaring a sub "param" and fill them with the fields you'd override. -audreyt * Jifty::Web / Jifty::Action: Stickiness now works on autogenerated monikers. -audreyt * Modified Jifty::Action::Record::Update so that empty strings for integer and boolean columns will be interpreted as NULLs. This may break apps that assume that an empty value string will be a no-op. -jesse * Jifty::Action::Record::Search - Consider "float" and "double" fields as numeric for comparison. Also consider "char" as textual. -audreyt * Allow a canonicalization note to be set, even if you don't change the value of the action parameter - falcone * L10N for Action::Record::Search -audreyt * Jifty::Manual::Actions include example with available are defer { ... } syntax which doesn't work because ref on variables deferred with Scalar::Defer return 0 instead of ARRAY -dpavlin * Add an "(any)" label to Action::Record::Search when render as radio. -audreyt * Jifty::Action::Record - Support for "is autocompleted" annotation. -audreyt * Jifty::Action::Record::Search - "numeric" and "decimal" fields are also numeric. -audreyt * Jifty::Action::Record - "is autocompleted" choices should not consider null/empty fields. -audreyt * Action::Record::Search - When there is just one choice, don't bother displaying '(any)' for Radio. -audreyt * Jifty::Action::Record::Search - First cut at a _dwim field for numeric fields that supports > >= < <= == = != ! <> operators. -audreyt * Jifty::Action::Record - Autocompletion now lists only the parts that matches the user-input as prefix. -audreyt * Jifty::Action::Record::Search - Add _before/_since for dates, as well as the equivalent _ge and _le for numbers. -audreyt * Jifty::Action::Record::Search - Add hints to _dwim. -audreyt * Adding a note about canonicalizers being idempotent -nelhage * add max_length alias to fix Object::Declare and Jifty::Param::Schema not handling length properly -alexmv bin/jifty * Change Jifty::Util's probe of bin/jifty from -x to -r for poor people on filesystems that does not have a executable bit. (The maybe_command is still needed for the .bat case.) -audrety * Fix the bin/jifty detection logick: The .bat extension exists for MSWin32, cygwin and os2, so use MM->maybe_command for those three platforms. -audreyt * Also, the -e check is redundant after -x, and in Win32 we can use bin/jifty.bat alone without bin/jifty, so make the check respect that case. Reported by: Stephen@s-team -audreyt * bin/jifty covered sigterm in a way that could cause zombie processes under fastcgi -jesse * Be explicit about the paths we're creating -alexmv * Jifty::Script::Server - Remedy for the edge error case where var/ is missing, which used to cause mysterious error messages. -audreyt Building apps * Small error string change to suggest looking for missing use lines in models where refer_to is used -bartb * Ongoing work to pass through Class::ReturnValue errors all the way from Jifty::DBI to the view layer -jesse * create scaffolding actions with the new Jifty::Param::Schema syntax --falcone * Jifty::Manual::Upgrading - Remove the now-obsoleted claim that one has to "use" model classes before renaming it. -audreyt * Jifty::Upgrade - rename() now works with SQLite too, woot! -audreyt Dependencies and installation * Makefile.PL typo. Spotted by David Adler -jesse * Files for debian packaging, now rather for actual cpan release than for svn. -yves * Update MANIFEST.SKIP and run 'make manifest' to ensure that new files get added properly. -jpeacock * Added a dependency on libextutils-command-perl to debian control file -bartb * Older DBI versions didn't provide the API we're using. (0.22 is known bad) -jesse * Remove PerlIO::gzip as a Jifty dependency. -audreyt * Older XML::Writer versions failed tests. Dependency bumped - Thanks to Jonathan Stowe -jesse * Reverting to dumping using YAML.pm *again*, because YAML::Syck generates XML that makes YAML segfault :/ -nelhage * Fixed missing dependency on Module::CoreList -- Thanks to Henry Baragar -jesse * Makefile.PL - Add dependency on Test::Base and Module::Refresh. Reported by: Andreas Koenig -audreyt * Makefile.PL - Bump JSON::Syck dependency to 0.15 to handle single quote + unicode strings. -audreyt * SQLite is required to test properly -jesse * debian packaging updates -yves * Skip html files when looking for dependencies. This may cause us to miss some modules used only from within mason, but it will stop falsely detecting lines that start with the word "use" in docs. -jesse * add Test::MockModule and Test::MockObject for J::W::F::F testing -agentz * made Test::MockModule and Test::MockObject optional by putting them into development dependency list -agentz * Makefile.PL: remove Test::HTTP::Server::Simple dependency when $^O eq 'MSWin32' -ishigaki * debian packages : add libtest-mockobject-perl libtest-mockmodule-perl in recommands packages (for new snapshot on jiftysvn repository) -yves * cleaned up debian readme -bartb * Clean up MANIFEST (mostly sqlite files) -alexmv * hlb++ reported that we really want HTTP::Server::Simple 0.26+, not 0.20+, as 0.20 and 0.21's critical URI-path-processing bug makes us non utf8 friendly. -audreyt * Added Data::UUID to the Makefile.PL and made sure we use'd it in Jifty.pm -kevinr Internationalization * The ubiquitous "There was an error completing the request. Please try again later.") error message should be localised. -audreyt * We now default the location of the jifty siteconfig file -jesse * * "You need to fill in this field" needs to be localized. -audreyt * Stopped the internationalization system from exploding if a plugin doesn't have a module_dir -alexmv * The internationalization system now extracts messages from TemplateRoot, not share. -clkao * Plugin internationalization and french po files -yves * Jifty::I18N: New ->refresh method so .po files are reloaded properly when DevelMode is on. -audreyt * Even more l10n on Jifty::Action::Record. -audreyt * jifty po shouldn't check/update files under .svn directories -ishigaki * zh_cn and zh_tw translations -audreyt * "jifty po": Ignore _svn/ directories (Win32), as well as foo~ files. -audreyt * L10N for the new Search action fields. -audreyt * update fr.po -yves * update zh_cn and zh_tw and use traditional characters in zh_tw -agentz * update german J::Manual::Tutorial_de to match english version's changes -wolfgang * Jifty::Script::Po: shouldn't update other catalogs if we specify target language with -l -ishigaki Testing * Jifty::Test: canonpath-ed for Win32 -ishigaki * make sure to skip 04memcached.t if you don't have Cache::Memcached -ishigaki * skip all the live tests (that call 'start_ok') on Win32 -ishigaki * shut up warnings when tests have no plan (t/Continuations/03-gc.t) -ishigaki * Added Jifty::Test->web to allow using Jifty->web in tests without a bunch of scaffolding. * Converted search tests to using Jifty::Test->web -schwern * Basic compile and startup tests for the Chat sample -schwern * add tests for Jifty::Web::Form::Field's render methods -agentz * adjusted t/06-forms.t to skip related tests when these two modules are not installed. -agentz * fix t/TestApp-Plugin-REST/t/02-basic-use.t because ClassLoader creates 4 new actions -falcone * add tests for Jifty::Param::Schema -agentz * TODO tests attempting to test if we get ajax validation errors for mandatory values after the sticky_value has been deleted -trs Email notifications * When sending email notifications, encode the message body -clkao * MIME-encode notification subjects. -clkao * Content-transfer-encoding needs to be 8bit. -clkao * Don't set notification transfer_encoding to 8bit if it's actually multipart. -clkao Dispatcher * avoid undef warnings in the Dispatcher -jesse * Jifty::Dispatcher - Alternation in extended shell globbing syntax now admits zero characters as well: on 'foo{,.zip}' # matches 'foo' and 'foo.zip' -audreyt * Jifty::Dispatcher - NUMBER SIGN (#) now captures one or more digit characters in the extended shellglob condition syntax. Suggested by: Sebastian Riedel -audreyt Jifty 0.60912 Testing * force to use Jifty::TestServer on Win32, though both JTS and THSS doesn't work properly at the moment. * Give a description for get_html_ok so that you know what URLs fail/succeed in test output * Small stylistic cleanup to t/01-dependencies * Honour coverage options. * make sure to remove remnant test db before we test (Jifty on Win32 fails to unlink them right now) * Add Jifty::Test->test_in_isolation * Document Jifty::Test->is_done. * Added Jifty::Test->is_passing and is_done * Basic SYNOPSIS for Jifty::Test as well as mentioning the Test::More passthrough. * Add Jifty::Test->teardown_mailbox to mirror setup_mailbox * use safer File::Spec->rel2abs for SubTest * TestServer: use File::Spec->rel2abs; it's safer than Cwd::abs_path which croaks * Jifty::Test->test_file() accepting and returning a list causes problems because people will try to do: my $file = Jifty::Test->test_file($file) and it ain't gonna DWIM. * Mention Shell::Command and Jifty::Test->temp_file in the style guide. * Add Jifty::Test->test_file() to declare files created only for testing and which should be cleaned up. * Fixing tests when using JDBI::Record::Memcached and setting things in the database from test scripts * Added explicit tests for Jifty::Action::Redirect * Script for running client and server side combined code coverage. * Give a description for get_html_ok so that you know what URLs fail/succeed in test output * Ignore "fluff" errors in HTML validation since they cause non-W3C attributes like "autocomplete" to be warned about * Add html_ok method for checking the mech's current content so tests can use it while we retain control over Test::HTML::Lint Models * jifty model --name now uses the new schema {} sub. * Made the display of a friendly string for picking a record from a list a lot more flexible. * canonicalization wasn't being properly run on models before validation * Added Jifty::Filter::DateTime, a JDBI filter that promotes DateTime objects to Jifty::DateTime objects on read, setting the time zone appropriately. * Added a concept of "virtual" arguments to actions. These won't be passed on to Record classes, even if they're sumbitted. We use this for Password confirmation arguments, so that we don't pass password_confirm on to the database, which is kinda useless (and breaks the db ;) * Added a as_superuser method to Jifty::Record to make it easier for * code to briefly dodge around ACLs when needed. Admin UI * __jifty/admin: use ->models reflection to build the nav bar. * Integer C<gt> or C<lt> searching. * Added substring search and date comparison to J::A::R::Search * Basic search in admin mode using Jifty::Action::Record::Search. Still buggy, especially UI-wise, but functional. * Initial version of Jifty::Action::Record::Search. It only supports * exact positive searches on fields at the moment. * There's no point in rendering confirm fields for passwords when we're viewing records in admin mode. * Don't create _gt and _lt search fields for magic _id refers_to fields. * Make the admin UI look slightly less crappy. * Make admin mode DTRT with columns that end in _id and refer to another model. REST * REST Dispatcher: model list reflection * Basic placeholder for REST plugin tests * REST Dispatcher skeleton that actually works * Jifty::Plugin::REST::Dispatcher - /=/action/ now works across HTML+HTTP. * J::P::REST::Dispatcher - all GET model URLs work, with 404s. * Jifty::Plugin::REST::Dispatcher - model fetch actually works! Actions * No longer generating arguments on C<Jifty::Action::Record> for fields that C<refer_to> C<Jifty::DBI::Collection>s, since we can't do anything useful with them right now anyways. * Get the _confirm items on passwords to respect sort ordering * Debugging improvements to stop stupid developer mistakes like passing the wrong sort of object to a Jifty::Action::Record. * Now we do proper escaping of values in select-one lists. * Canonicalise {onclick}{submit} using the accessor wrapper. * Only call moniker when {onclick}{submit} isa Jifty::Action. Documentation * Wolfgang Kinkeldei: added a pod on models * Patch from Todd Chapman to fix tutorial * The beginnings of a Jifty code style guide. * Jifty::Manual::Continuations: reflect tangent() in the manual. * Developer documentation for the Jifty::Web::Form::Field::* hierarchy. * Add "How do I Add Atom/RSS Feeds" to Cookbook. * Add a recipe about running fastcgi server, which, in fact, only points to 'jifty help fastcgi'. * lib/Jifty/Manual/FAQ.pod - a start on an FAQ * Standardizing on referring to share/web everywhere in the tutorial. * Todd Chapman noticed a typo in the docs about autocompleters * Tutorial patch from rindolf++ * documented logger_component argument * Add a small bit of doc about creating your own classes that are normally created by J::ClassLoader * A start at some docs on upgrading, needs reviewing and some more examples Perfomance and optimization * Don't try to lowercase session information on postgres * Don't bother with session when serving static files. * Don't need ExtUtils::MakeMaker in Jifty::Util. This is about 7% of total compile time loading jifty. * Kill Jifty::Web::Menu circular references. * Transform actions in {onclick}{submit} to their monikers, to avoid circular references. Javascript and HTML * Fix AJAX canonicalization of date fields * Some browsers don't like trailing commas in JS arrays and hashes. * You can now pass confirm => 'question?' to javascript hooks (i.e. onclick) and get a confirm dialog in the browser. This doesn't work without javascript yet. * Use a local copy of the icons in our calendar widget, rather than the version that yahoo points to on akamai * fix the unexpected behavior in context menu for IE users. * Fix bug that didn't allow calendar months to be changed * Show calendar widget on focus and hide it on blur * If we don't have XMLHttpRequest, fall back on page loads * More thorough normalization of the submit parameter to Javascript handlers * Accesskey support added to buttons and links. It just uses the same keys as our javascript key bindings. * A little more Element/Clickable refactoring, and implementing a C<disable> option to onclick handlers that toggles whether or not to disable form fields for an action. * We now write out state variables at the start of forms, instead of at the end. * Moved "Dismiss" buttons on messages and errors into Behaviour, so they only show up in javascripty contexts where they'd be useful * Added the ability to support target attributes in menu items and clickables * IE doesn't support element.setAttribute("class", "foo"), so use element.className instead * Explicitly specify a radix of 10 (decimal) for the parseInt calls used in Yahoo's calendar widget when parsing the date to initially display * Don't attempt to disable hidden inputs, since this sometimes causes IE to die * Use our own "enter" handler to select the button to click, since Safari sometimes gets it wrong with complex fields * The setAttribute call doesn't work for "class" in IE * Fixing the calendar widget to create a new calendar every time, so that the calendar reflects any changes the user makes in the text field. * Support turning off autocomplete on a per-form basis. We still need per-field, but that's for later. Distribution * debian packaging files for jifty * Removed duplicated share/web (it was copied to lib/auto/Jifty) * CGI.pm 3.17 (and possibly earier) had a bug where regex metacharacters in the PATH_INFO would cause it to puke. We now depend on CGI 3.19 which fixed that bug. * Update Module::Install to 0.64. The important thing here is it gets us a fixed Module::AutoInstall which works when you run Makefile.PL from the command line without CPANPLUS installed. * Don't index the t directory * add "use Jifty::YAML" before all uses. * Moved some modules to feature sections in Makefile.PL, updated 01-dependencies.t to recognise recommends sections as well as requires * Win32 requires File::ShareDir 0.04 * Removed Text::Autoformat dependency and usage. Dispatcher * Dispatcher: Support tangent($url) as sugar for Jifty->web->tangent(url=>$url). * Dispatcher: Allow "**" in glob pattern to mean anychar including slash. * Dispatcher did not have a ->{cgi}, so ->method certainly could not work. Use the env variable for now. * Jifty::Dispatcher: abort(404) now works as the doc promised. Internals * Jifty->web->return in void context is now an immediate return. * Jifty::ClassLoader - Make Jifty::Handle a CL'ed module as well, so MyApp::Handle can implement scary magick of its own. * Don't blow up when trying to check if action mixins are autogenerated * Let's be better about not redirect-looping when calling continuations to paths that contain multibyte characters. This solution is a hack, but it's better than looping. * Fix placeholders on browser forward/back * Replace hard tabs with spaces for consistency * Jifty::Web::state_variables no longer prefixes keys with J:V- before returning them, and Clickables now serialize the *outgoing* state vars, instead of the previous request's. * When rendering a page region, mark actions as inactive, don't remove them, so that their arguments are available inside fragments. * If we receive an action's arguments, but it's not in J:ACTIONS, or we don't run it for some other reason, don't consider it to have failed for the purposes of stickiness. * moniker_for and action_form now behave more cleanly with forms which have no non-continuation fields other than their submit buttons. * No longer lose if you do a Jifty::Action::Redirect to the same page you're already on. Also, add the ability to force Web to redirect, even if it's to the current page. * Jifty.pm: Change all __PACKAGE__ to Jifty. * Jifty::ClassLoader: provide ->models accessor to list the model classes. * added Jifty::Request::clear_state_variables * Form::Clickable: Don't mix self accessors and args. * Refactor the constructors for Jifty::Web::Form::*, which takes initial hash and values to be overridden with accessors. Internationalization * LetMes' escaping should be utf8 aware * Email addresses probably shouldn't ever be utf8, but using the utf8 escaper is more Right(tm) * Properly UTF-safeing Jifty::LetMe Sean E. Millichamp and clkao both pointed out that Locale::Maketext could choke on overloaded objects like DateTimes. This change makes sure that doesn't happen any more. * Locale::Maketext doesn't always do the right thing with user-generated strings. So let's do that for it. * Properly encode arguments when generating LetMe URLs. Email * add UTF-8 charset to message body on notifications * added infrastructure to do mime mails * make Jifty notifications be UTF-8 Plugins * Jifty::Web::Session::ClientSide - Client-side sessions. * Added a ProfileBehaviour plugin to aid profiling Javascript Behaviours (see app_behaviour.js in the Jifty source for some more information) * Some Behaviour profiling UI fixes. * Removing profiling code from behaviour.js * Get the signup form in the login plugin to respect locally defined schema for the user class * Added information about the environment to the EmailErrors plugin * Making the Login plugin play nice with admin mode. * Plugin static roots should take precendence over jifty's Win32 * Win32 complains when you try to unlink open DB 0.60722 * Dispatcher fixes to deal with the better canonicalization we started doing in 0.60707 * changed all instances of '/usr/bin/perl' to '/usr/bin/env perl' * added a path option to Jifty::Web->url * added url tests * Jifty::Manual::Actions -- update the worldview to reflect the parameters/arguments concept split. * Introduce aliases. See Jifty::Param::Schema for the table. * Declarative Jifty Parameters. * See Jifty::Param and Jifty::Param::Schema for the new syntax. * Also added dependencies for Jifty::Script::Deps and declarative parameters. * Also updated test applications to use declarative parameters. * Adding the CSS browser selector trick from to Jifty * After autocomplete, trigger a validation. * Upping JSON::Syck version dependency. 0.14 fixes escaping in single-quoted strings. * Add a tooltip to the dismiss link and hide the dotted border * Trailing commas are not good for JS in Safari * Let's not blow up if we have placeholders on an input without a form * Don't fade autocomplete in and out, just show and hide it * Not submitting placeholder values when we submit forms or AJAX * Add the class before we set the text, so that it appears grayed-out, rather than appearing and *then* graying out * Support multi-line placeholders * textareas can have placeholders, too; Style them appropriately as well * Adding support for placeholders, grayed-out text in form fields that is written in with JS and vanishes on focus * Auto-accept cpan's wisdom about prompts (Jifty::Deps) * 0th sketch at "jifty deps" * packaging plan updates * J::Web::redirect can take a Clickable as arg, so make goto do that, instead of passing a URL with parameters, which doesn't work right * Proper port support on urls. Thanks to jpeacock. * Resolve inconsistent filenames vs packages (Plugins) * Switched Jifty::Web::url to use uri.pm rather than "heuristics" * Let's not blow up if an action has a result that's an unblessed reference. * Don't upgrade the database versions with schema --print. I'm not sure if there's a good way to persuade JDBI to give us the SQL to print, so we're just spitting out a warning for now, but that's better than the old behavior. * Stop notification from flipping out if you use a scalar as the To: * basic smoke test for jifty's notifications * Only set active child on create if we have a request * More serious failure message, and don't imply that it's necessarily the server's fault. * update .po files * Jifty::Dispatcher - there's no call_next, remove it from POD, fnord. * Refactoring message rendering slightly * Fix Jifty-Win32 by having canonicalize_path always returning /-separated paths, never \-separated paths. * Let classes be set on menu items * Adding a warning about our slow Rico.Corner.round * Documenting how to write sane Behaviours that don't leak memory (leak less memory, probably) in IE and aren't dog-slow. * Fix JS memory leak in IE * Make jifty tests respect the current given @INC, so it doesn't use lib when you are supposed to use blib during make test. * Make the subtest system less painful. * Use Jifty::Script to invoke test server, so it doesn't depend on bin/jifty. * Fix a Safari display bug * Fix calendar positioning bug and make sure it works when the date field is within a relative or absolutely positioned element * Test file for Jifty::Client * First pass at a Jifty client module. * English orthography fixes. * Trailing commas in Perl are good. In Javascript, they aren't, and sometimes cause IE to barf (like this one). * Hide focus border * Lowering the autocomplete delay * first-pass editorial run over Continuations.pod. * Sketchy sketchy handwavy descriptions of page region backend. Ramblings totally not expected to be interpretable. * Wrap the popup notification div in dropshadow wrapper hooks * Mention webservices in Actions doc * Double fallback goes the way of the dodo * Continuation manual * Set up the output API for mapping of request parameters (input API already existed) * Change method of getting results out of response on continuation RETURN * Fewer calls to ->arguments, though they might be cached already. * Not all CurrentUser classes may have a "nobody" * Jifty::Web::Form:Clickable - provide a bit more info on how to use the "returns" field. * jifty-dispatcher.graffle that shows the dispatch chain. * Nicer "server down" message * Re-enable form inputs after failure * toggleable page region clickables weren't doing the right thing when used in non-ajax mode * Fix the validation and autocomplete race condition * Skip nobody and superuser when we do notifications 060707 * Minor build fixes 060706 * SECURITY UPDATE: Previous versions of Jifty did not protect users against a class of remote data access vulnerability. If an attacker knew the structure of your local filesystem and you were using the "standalone" webserver in production, the attacker could gain read only access to local files. We found this vulnerability on 6 July 2006 during an internal Security scan. We've added new tests to ensure that these and other similar vulnerabilities don't recur. We recommend that ALL users of Jifty UPGRADE to 0.60706 IMMEDIATELY. 060616 * The last CPAN release was broken. No real changes. 060615 (15 June 2006) The following incompatible changes were made to Jifty. For a complete changelog, please see the "Changes" file. * Removed the ActionBasePath and CurrentUserClass configuration variables. This breaks backwards compatibility. * If you've overridden /_elements/javascript in your app, you'll want to take a look at the new stock version to see what has changed. * The JS method document.getElementsBySelector() no longer exists. Use cssQuery() instead. * Jifty::Record now returns empty objects for related objects that can't be loaded, rather than undef * The keybinding JS code is now a more proper library (Jifty.KeyBindings) and less intrusive. If you've overridden the default /_elements/wrapper in your app, you'll want to make sure you get rid of the keybinding javascript (see the stock wrapper). Just include <& /_elements/keybindings &> wherever you want the keybindings for a page to appear. * This shouldn't be the cause of breakage, but the included rico.js is no longer a stock Rico build. See the comments at the top of the file if you're interested. * 'last_rule' now aborts only the current stage -- thus, last_rule from a 'before' block will *NOT* prevent the RUN stage from happening! This is a *BACKWARDS-INCOMPATIBILE CHANGE*, but fixes the dispatcher to agree with its docs. * 'abort' is the correct call to skip straight to the cleanup block. * This allows the edit in place plugin to 'claim' its path and protect it from access control in the app's 'before' blocks 0.60507 (7 May 2006) * Pod fixes from Eric Wilhelm lib/Jifty/Object.pm - removed incorrect '=for' directive lib/Jifty/Web/Form/Field.pm - removed incorrect '=for' directive lib/Jifty/Web/Form.pm - removed incorrect '=for' directive * Better failure messages on when schema upgrades with SQLite fail from Alex Vandiver * Be a little more explicit about SQLite's limitation, and a possible (painful) workaround * Update the inc tree to 0.62 for various fixes, in particular improved share_dir compatibility. --Audrey Tang * We were inconsistently using Jifty::Util::make_path as a subroutine. It's a class method. This could break the stub generators and tutorial. Thanks to Sean E. Millichamp 0.60505 - Cinco de Jifty! (5 May 2006) * Native support for times and timezones. * Bug fixes (Many contributors) * Documentation updates (Many contributors) * Win32 Support (Audrey Tang) * New Session layer based on Jifty instead of Apache::Session. Designed for AJAX and Continations (alexmv) * Jifty internal metadata store (The begining of an internal configuration management system (alexmv) * Form fields no longer automatically insert the field name by itself as a class. Instead, the class has changed to "argument-<fieldname>" to avoid conflicts with generic class names (such as date). * Move allow and deny'ing of actions into Jifty::API; this breaks backwards compatibility. * Don't allow applications to be named "Jifty" by default. They are forced to be named "JiftyApp" now, for namespace reasons. * Remove Jifty->web->actions method; you should be using Jifty::Form's actions method. * Beginning of localization support. * Notifications can now take a user object or an email address * "sort order for arguments" patch, as suggested by miyagawa. This makes use of sort_order column property of Jifty::DBI * YAML -> Jifty::YAML * Switch from Time::ParseDate to Date::Manip, since the former isn't win32 compatible * Shuffle the Mason and static handlers into Jifty::View namespace * Jifty no longer attempts to AJAX submit file upload fields * We no longer write DefaultStaticRoot and DefaultTemplateRoot into config files * Added a "LogLevel" option to the Jifty config file, so you can more easily enable debug logging. 0.60321 * 'return if already_run' in after rules so they run only once * Overhauled the static server to try really hard to force caching by clients. It also gzips its content, if possible. * More stylish forms * Allow Jifty->web->return( to => "..default path..", ...) * Actually accept region names to refresh * Halo improvements * chromatic supplied a patch to switch from UNIVERSAL::isa to ->isa. * Trivial webservices hack * It's now possible to override Jifty::Record's baseclass in your app 0.60221 * Use Jifty::Util->require to log require errors * Auto-generate Bootstrap class * Give us a way to get the CurrentUser from a Mech object during testing * When calling a continuation, try to make sure that the urls are really different, not just differently canonicalized, lest we get an infinite loop * Default to not showing debug logs * Fragments in JS land now know about their parents, and pass their superstructure in the fragment request. This lets $region->parent have full information. * 'refresh => region' mode for replacement * Better docs on region replacement * add_* calls on Jifty::Request now return the object added, not the request 0.60213 * Jifty::Dispatcher written * Jifty::Handler is now an object, not a utility. It has the power to "run" a request. * Call chain is now Handler to Dispatcher, which calls Jifty::Web and Mason, instead of the other way around. * Better Documentation coverage. * Paint on some really bitchin 'go faster' stripes on the server. * Refactored the dispatcher to use exceptions rather than LABELS: so that Devel::DProf doesn't fall over * Added a new "DevelMode" flag, to toggle the peformance-killing development aids. * Only drop tables if the tests all succeeded * Fragments now go through the dispatcher * `jifty schema` overhaul * Mandatory form fields now have a css marker. * Do away with setup_actions mason method * Stop using mason notes * Jifty::Script::Schema support for basic mysql love * lighttpd support. * Move autocomplete.xml and validator.xml to __jifty/. * Upgrade to Scriptaculous 1.5.1. * Delete is its own action now, instead of being part of Update. 0.51228 * Jifty::Action->argument_names should sort keys lexographically, not random hash-ordering. * Remove last vestiges of ::Delete from ::Update * Refactored Jifty::Config to allow the application class to be specified when calling Config->guess * Refactored Jifty::Script::App into bite-sized morsels * Made Jifty::Script::App generate a config file * Made Jifty::Script::App and Jifty::Config::Guess happy with multi-level package names 0.51225 - Initial release
https://metacpan.org/changes/distribution/Jifty
CC-MAIN-2018-51
refinedweb
28,828
52.19
#include <sys/tiuser.h> int t_optmgmt (fd, req, ret) int fd; struct t_optmgmt *req; struct t_optmgmt *ret; The req and ret arguments point to a t_optmgmt structure containing the following struct netbuf opt; long flags;The optfield identifies protocol options, and the flagsfield is used to specify the action to take with those options. The options are represented by a netbuf (see netbuf(FP); also for len, buf, and maxlen) structure in a manner similar to the address in t_bind.: flagsfield of ret either has T_SUCCESS or T_FAILURE set to indicate to the user whether the options are supported. These flags are only meaningful for the T_CHECK request. optfield of ret. In req, the lenfield of optmust be zero, and the buffield may be NULL. If issued as part of the connectionless-mode service, t_optmgmt may block due to flow control constraints. The function does not complete until the transport provider has processed all previously sent data units. AT&T SVID Issue 3 ; X/Open CAE Specification, Networking Services, Issue 4, 1994. ; and Intel386 Binary Compatibility Specification, Edition 2 (iBCSe2) .
http://osr507doc.xinuos.com/en/man/html.NET/t_optmgmt.NET.html
CC-MAIN-2019-30
refinedweb
180
53.92
. What’s the source code executed behind the scene to produce this realistic rendering? It’s very interesting to go inside this powerful game engine and discover how it’s designed and implemented. C++ developers could learn many best practices from its code base. Let’s explore its source code using CppDepend and CQLinq to detect some design and implementation choices of its development team. 1- Namespaces Unreal Engine uses widely namespaces for three major reasons: - Many namespaces contains only enums as shown by this following CQLinq query, which gives us the ones containing only enums. In a large project, you would not be guaranteed that two distinct enums don’t both called with the same name. This issue was resolved in C++11, using enum class which implicitly scope the enum values within the enum’s name. - Anonymous namespace: Namespace with no name avoids making global static variable. The “anonymous” namespace you have created will only be accessible within the file you created it in. Here it is the list of all anonymous namespaces used: - Modularizing the code base: Let’s search for all the other namespaces, i.e. neither the anonymous ones nor the ones containing only enums: The namespaces are a good solution to modularize the application; Unreal Engine defines more than 250 namespaces to enforces its modularity, which makes the code more readable and maintainable. 2- Paradigm used: C++ is not just an object-oriented language. As Bjarne Stroustrup points out, “C++ is a multi-paradigmed language.” It supports many different styles of programs, or paradigms, and object-oriented programming is only one of these. Some of the others are procedural programming and generic programming. 2-1 Procedural Paradigm 2-1-1 Global functions Let’s search for all global functions defined in the Unreal Engine source code: We can classify these functions in three categories: 1 – Utility functions: For example 6344 of them concern Z_Construct_UXXX functions, which are used to create instances needed by the engine. 2 – Operators: Many operators are defined as it is shown, by the result of this CQLinq query: Almost all kinds of operators are implemented in the Unreal Engine source code. 3 – Functions related to the engine logic: Many global functions containing some engine treatments are implemented. Maybe these kinds of functions could be grouped by category, as static methods into classes, or grouped in namespaces. 2-1-2 Static global functions: It’s a best practice to declare a global function as static unless you have a specific need to call it from another source file. Many global functions are declared as static, and as specified before, other global functions are defined inside the anonymous namespaces 2-1-3 Global functions candidate to be static. Global not exported functions, not defined in an anonymous namespace and not used by any method outside the file where they were defined. These are good candidates to be refactored to be static. As we can observe some global functions are candidates to be refactored to be static. 2-2 Object Oriented paradigm 2-2-1 Inheritance In object-oriented programming (OOP), inheritance is a way to establish Is-a relationship between objects. It is often confused as a way to reuse the existing code which is not a good practice because inheritance for implementation reuse leads to Tight Coupling. Re-usability of code is achieved through composition (Composition over inheritance). Let’s search for all classes having at least one base class: And to have a better idea of the classes concerned by this query, we can use the Metric View. In the Metric View, the code base is represented through a Treemap. Treemapping is a method for displaying tree-structured data by using nested rectangles. The tree structure used in a CppDepend treemap is the usual code hierarchy: - Projects contains namespaces. - Namespaces contains types. - Types contain methods and fields. The treemap view provides a useful way to represent the result of a CQLinq request; the blue rectangles represent this result, so we can visually see the types concerned by the request. As we can observe, the inheritance is widely used in the Unreal Engine source code. Multiple Inheritance: Let’s search for classes inheriting from more than one concrete class. The multiple inheritance is not widely used, only few classes inherit from more than one class. 2-2-2 Virtual methods Let’s search for all virtual methods defined in the Unreal Engine source code: Many methods are virtual, and some of them are pure virtual: As the procedural paradigm, the OOP paradigm is also widely used in the Unreal Engine source code. What about the generic programming paradigm? 2-3 Generic Programming C++ provides unique abilities to express the ideas of Generic Programming through templates. Templates provide a form of parametric polymorphism that allows the expression of generic algorithms and data structures. The instantiation mechanism of C++ templates insures that when a generic algorithm or data structure is used, a fully-optimized and specialized version will be created and tailored for that particular use, allowing generic algorithms to be as efficient as their non-generic counterparts. 2-3-1 Generic types: Let’s search for all genric types defined in the engine source code: Only some few types are defined as generic. Let’s search for generic methods: More than 40000 methods are generic; they represent more than 25% of the methods implemented. To resume the Unreal Engine source code, mix between the three paradigms. 3- PODs to define the data model In object-oriented programming, plain old data (POD) is a data structure that is represented only as passive collections of field values (instance variables), without using object-oriented features. In computer science, this is known as passive data structure Let’s search for the POD types in the Unreal Engine source code More than 2000 types are defined as POD types, many of them are used to define the engine data model. 4- Gang Of Four design patterns Design Patterns are a software engineering concept describing recurring solutions to common problems in software design. Gang of four patterns are the most popular ones. Let’s discover some of them used in the Unreal Engine source code. 4-1 Singleton The singleton is the most popular and the most used one. Here are some singleton classes defined in the source code: TThreadSingleton is a special version of singleton. It means that there is created only one instance for each thread. Calling its method Get() is thread-safe. 4-2 Factory Using factory is interesting to isolate the logic instantiation and enforces the cohesion; here is the list of factories defined in the source code: And here’s the list of the abstract ones: 4-3 Observer The observer pattern is a software design pattern in which an object maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. They are some observers implemented in its source code, FAIMessageObserver is one of them. Here’s a dependency graph to show the call of the OnMessage method of this observer: 4-4 Command The command pattern is a behavioral design pattern in which an object is used to represent and encapsulate all the information needed to call a method at a later time. Four terms always associated with the command pattern are command, receiver, invoker and client. A command object has a receiver object and invokes a method of the receiver in a way that is specific to that receiver’s class. Here’s for example all commands inheriting from the IAutomationLatentCommand : 5- Coupling and Cohesion 5-1 Coupling Low coupling is desirable because a change in one area of an application will require fewer changes throughout the entire application. In the long run, this could alleviate a lot of time, effort, and cost associated with modifying and adding new features to an application. Low coupling could be acheived by using abstract classes or using generic types and methods. Let’s search for all abstract classes defined in the Unreal Engine source code : Only some few types are declared as abstract. The low coupling is more enforced by using generic types and generic methods. Here’s for example the methods using at least one generic method: As we can observe many methods use the generic ones, the low coupling is enforced by the function template params. Indeed the real type of these parameteres could change without changing the source code of the method called. Cohesion. Here are. The underlying idea behind these formulas can be stated as follow: a class is utterly cohesive if all its methods use all its methods use all its instance fields, which means that sum(MF)=M*F and then LCOM = 0 and LCOMHS = 0. LCOMHS value higher than 1 should be considered alarming. Only some types are considered as not cohesive. 6- Immutability, Purity and side effect 6-1 Immutable types Basically, an object is immutable if its state doesn’t change once the object has been created. Consequently, a class is immutable if its instances! Another benefit about immutable classes is that they can never violate LSP (Liskov Subtitution Principle) , here’s a definition of LSP quoted from its wiki page: Liskov’s notion of a behavioral subtype defines a notion of substitutability for mutable objects; that is, if S is a subtype of T, then objects of type T in a program may be replaced with objects of type S without altering any of the desirable properties of that program (e.g., correctness). Here’s the list of immutable types defined in the source code: 6-2 purity and side effect. Writing your functions/methods without side effects – so they’re pure functions, i.e. not mutate the object – makes it easier to reason about the correctness of your program. Here’s the list of all methods without side-effects More than 125 000 methods are pure. 7- Implementation quality 7-1 Too big methods Methods with many number of lines of code are not easy to maintain and understand. Let’s search for methods with more than 60 lines. Unreal Engine source code contains more than 150 000 methods, so less than 1% could be considered as too big. 7-2 Methods with many parameters Few methods has more than 8 parameters, most of them are generic, to avoid defining variadic functions, like the case of TCStringt::Snprintf methods. 7-3 Methods with many local variables Less than 1% has many local variables. 7-4 Methods too complex are no standard values. Let’s search for methods that could be considered as complex in the Unreal Engine code base. Only 1,5% are candidate to be refactored to minimize their complexity. 7-4 Halstead complexity Halstead complexity measures are software metrics introduced by Maurice Howard Halstead in 1977. Halstead made the observation that metrics of the software should reflect the implementation or expression of algorithms in different languages, but be independent of their execution on a specific platform. These metrics are therefore computed statically from the code. Many metrics was introduced by Halstead, Let’s take as example the TimeToImplement one, which represents the time required to program a method in seconds. 1748 methods require more than one hour to be implemented. 8- RTTI RTTI refers to the ability of the system to report on the dynamic type of an object and to provide information about that type at runtime (as opposed to at compile time). However, RTTI become controversial within the C++ community. Many C++ developers chose to not use this mechanism. What about Unreal Engine developers team? No method uses the dynamic_cast keyword, The Unreal Engine team chose to not use the RTTI mechanism. 9- Exceptions Exception handling is also another controversial C++ feature. Many known open source C++ projects do not use it. Let’s search whether in the Unreal Engine source code an exception was thrown. Exceptions are thrown in some methods; let’s take as example the RaiseException one: As specified in their comments, the exception could be generated for the header tool, but in normal runtime code they don’t support exception handling. 10- Some statistics 10-1 most popular types It’s interesting to know the most used types in a project; indeed these types must be well designed, implemented and tested. And any change occurs to them could impact the whole project. We can find them using the TypesUsingMe metric:: 10-2 Most popular methods 10-3 Methods calling many other methods It’s interesting to know the methods using many other ones, It could reveal a design problem in these methods. And in some cases a refactoring is needed to make them more readable and maintainable.
https://cppdepend.com/blog/?p=13
CC-MAIN-2019-47
refinedweb
2,135
51.07
How to inherit base class properties ?ShanSun88 Mar 26, 2012 1:34 AM Hi All, I have one doubt.Can anyone clear this doubt? Steps: 1)I have created One movieClip & named as MyComp 2)I export this movieclip to actionscript.Class name for this movieclip is MyComp. 3)After that,Dynamically I have created 5 instance for this class & added to stage. 4)Now i need to change width of MyComp. it should reflect on previous 5 instance too. I tried like, I have created MyComp.as file in same location. There I tried to inherite DisplayObject properties Width. Example : In authoring time,I have one movieclip in my library which contains one rectangle shape..Im adding 5 instance of that movieclip in stage. After that i get into one movieclip,and im increasing width of that movieclip by increasing Shape width. it ll get reflect in all instance.. i need this thing in actionscript.... is it possible? Thanks... 1. Re: How to inherit base class properties ?_spoboyle Mar 26, 2012 3:55 AM (in response to ShanSun88) you can't do what you are trying to do the way you are trying to do it. I have included some code here (pure AS3, no timeline or library) which you might be able to adapt to your needs Basically I have created a static property (_rectWidth which controls the rectangles width) on the MovieClip class that contains the rectangle and a render() function that redraws the rectangle tot he correct width. Note you will have to call render() after setting a new width to see the rectangle drawn at the new width. Then in the main class I create 5 rectangles with random colours and positions. The main class also listens for the "arrow up" and "arrow down" keys to change the rectangle's size. Note: I change the size of the rectangle and then run through all of the Main classes children (which are all RectMC's) and call render(); package { import flash.display.Sprite; import flash.events.Event; import flash.events.KeyboardEvent; public class Main extends Sprite { public function Main():void { if (stage) init(); else addEventListener(Event.ADDED_TO_STAGE, init); } private function init(e:Event = null):void { removeEventListener(Event.ADDED_TO_STAGE, init); // entry point for (var i:int = 0; i < 5; i++) { var col:uint = Math.floor(Math.random() * 0xffffff); var rectX:int = Math.floor(Math.random() * stage.stageWidth); var rectY:int = Math.floor(Math.random() * stage.stageHeight); var rectMC:RectMC = new RectMC(col); rectMC.x = rectX; rectMC.y = rectY; addChild(rectMC); } stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyDown); } private function onKeyDown(e:KeyboardEvent):void { switch (e.keyCode) { case 38: RectMC.rectWidth += 20; break; case 40: RectMC.rectWidth -= 20; break; } for (var i:int = 0; i < numChildren; i++) { var rectMC:RectMC = getChildAt(i) as RectMC; rectMC.render(); } } } } package { import flash.display.MovieClip; import flash.events.Event; /** * ... * @author steven O'Boyle */ public class RectMC extends MovieClip { protected static var _rectWidth:int = 100; protected static var _rectHeight:int = 50; protected var _rectColour:uint; public function RectMC(col:uint) { _rectColour = col; render(); } public function render():void { graphics.clear(); graphics.beginFill(_rectColour); graphics.drawRect(0, 0, _rectWidth, _rectHeight); graphics.endFill(); } public static function set rectWidth(value:int):void { _rectWidth = value; } public static function get rectWidth():int { return _rectWidth; } } } 2. Re: How to inherit base class properties ?ShanSun88 Mar 26, 2012 4:14 AM (in response to _spoboyle) Thanks for ur valuable reply...
https://forums.adobe.com/message/4291553
CC-MAIN-2015-27
refinedweb
567
60.61
Bluition I’ve Made Some Special Modifications Myself My current mode of transportation is a quasi-beat up, hot red Kymco ZX50 scooter. Let’s face it – if it doesn’t look like much on the outside, you’d better make some special modifications yourself. In comes Bluition. The Run Down Bluition is a bluetooth ignition device that allows me to control my scooter from my Android phone. Here’s the run down: - My Droid 4 runs a program called Tasker. Tasker is an AMAZING program that can run applications or other actions given specific events or states. I’ve put instructions for it to call a specific Python script given a specific gesture is detected. - Python for Android provides a very simple scripting system. It was amazing how few lines of code were needed to open up a Bluetooth connection and send commands to the bluetooth module on the scooter. - An RN-42 Bluetooth module from SparkFun receives the commands from the Android phone. The commands include instructions to set GPIO pins high or low. - The RN-42 outputs are then connected to MOSFET drivers, which in turn drive mechanical relays. Again, SparkFun parts. - The mechanical relays are connected into the scooter ignition, starter as well as a solenoid that pops opens the seat lid. -. - And foot bone is connected to the knee bone… The setup was pretty simple and done dirt cheap – see the bill of materials below. My favorite part was that I didn’t have to use a microcontroller. As much as I love microcontrollers (my day job is firmware programming), it was nice for a change to be able to just focus on electronics and wiring. This setup could be used for just about anything that just needs an on/off relay with the actual programming to a smart phone. I’m sure if Han had one, he’d totally be scripting his droid to automatically control a mog feeder on the Falcon. In the interest of time, I’m not going to fully comment how I made it. If there’s enough interest (leave a note in the comments), I’ll draw up an Instructables tutorial on how to connect it and possibly even make pre-assembled kits. Hopefully I’ll give you enough info below that if you have some experience you should be able to put it together without much trouble. Bill of Materials Let’s start with a BOM. Links provided where available. Some components were just lying around. My SparkFun order for the parts I didn’t have was only $50, but the total is probably around $75-$100. - $12 – x4 Relay SPDT Sealed – 20A - $16 – x4 MOSFET Power Control Kit - $16 – x1 Bluetooth SMD Module – RN-42 - $15 – x1 Solenoid – 36v - $5 - x1 Car Adapter USB Power Supply – 5VDC 650mA - $2 - x1 Voltage Regulator – 3.3V - $3 - x1 Bowden Cable and Sleeve (from local bicycle shop) - x1 – Sealed Rocker Switch - x1 – 13 Position Screw Terminal Strip - x4 1N4148 diodes (used as flyback diodes on relays) - x4 120 ohm resistors - A few 0.1uF capacitors - 18 AWG Wire - 18 gauge Tap Splices and Butt Splices - 2200 uF Capacitor - 18V Zener Diode - Semi-rigid plastic sheet – .060″ ABS or Delran from your local hobby shop should work fine. - A lot of zipper ties and foam tape :-) Tools - Socket wrench and set - Socket drivers - Pliers (regular and needle nose) - Wire cutters & strippers - Crimp tool - Soldering iron - A butane soldering iron was particularly handy when soldering on the scooter itself (but there are other ways) - Phillips and Flathead Screwdrivers - Allen wrench set - Power drill and bits, preferably with a step drill Time All told, I spent about three full weekends on this. Now that it’s all figured out, if I had a PCB already built and the wiring diagram it would probably only take a rainy Saturday to do. Build Pictures Here are a few pictures that I took throughout the build process. I have more, but these are a decent overview. Build Notes A few notes about individual items. The Scooter The goal was to keep the original scooter electrical setup intact so I’m not screwed if (when?) the electronics get a bad spike, water shooting into the console, etc. and blow up. I mostly succeeded – at least I know I could use the scooter without the Bluition module if necessary. Over half of the scooter exterior had to be removed in order to get access to all the wiring needed. Things that came off: The front, the handlebar covers (still hanging there by control cables and wires, but all screws & bolts were out), the seat, storage compartment, carrier rack, and seat latch. Wiring The wiring was pretty straightforward, except for the ignition. I’m no grease monkey, so this is my simple interpretation of the mechanic’s manual and various forum postings: +12V gets connected, obviously. But there was another connection that was grounded when the ignition switch was in the off position, then left floating when in the on position. My (frail) understanding is that it grounds the Capacitor Discharge Igniter, which removes sparkability from the spark plugs and forces the engine to die. If I didn’t connect this, I could start the scooter but the engine kept running when the ignition signal was removed. You’ll notice there’s an extra relay in the pictures that looks like it was added haphazardly as an afterthought – bingo. The starter was simple – there’s a starter switch on the handlebars. Simply used tap splices, and connected both sides to a relay in parallel with the starter switch. The solenoid relay just sucked power from the +12V rail. Easy peasy. I ran a Bluition power switch (sealed rocker) up to the handlebars so that, when not in use, the Bluition module wouldn’t suck the battery dry. Seat Latch Solenoid This was pretty tricky. It boiled down to lubricating the Bowden cable well with silicone grease, and getting the Bowden cable entry and exists as parallel as possible with the path of the solenoid and latch. On the solenoid side, I removed the spring and plastic washer and put a ball of solder on the cable to hold it in place. The extra-hot butane soldering iron was helpful with this. On the latch end, after trying many approaches I ended up just zipper tying the cable to the existing key-triggered cable. I also zipper tied the solenoid to the chassis outside of the storage compartment area, and zipper tied the Bowden cable itself to places where it held the cable in locations that allowed parallel entry into the sleeve. Bluition Installation Running wire all over and getting all the signals wasn’t too bad. Labeling the wires as I ran them helped a ton. It was really nice using the tap splices over soldering. The module itself was installed in the “glove box” console area. I mounted each component onto a plastic sheet using foam tape, and then mounted the plastic sheet onto the inside of the console. I had every intention of using Sugru to encapsulate the module, and I may still do so. But until I know it’s going to work reliably I’ll hold off. RN-42 Bluetooth Module I was blown away at how cheap this sucker was – and it worked like a charm too! Dead bug soldering was a bit of a pain, but not too bad. I’ll post a schematic at a later date to show which wires went where, but just look at the data sheet – any of the PIO pins 7 or below can be used. I couldn’t get PIO pins 8-11 to work – the datasheet says some modules don’t have these, and I can only assume this is one of them. They can provide a few milliamps each, but they work just fine driving the MOSFET gates with a 120 ohm resistor in series. Python Environment and Code First, let’s talk about the environment. BTW, it was WAY easier to get things working here than it was on my laptop in Ubuntu. Here are the Android apps that I’ve used to make things happen: - Tasker- This program automates your smartphone in so many ways. I set it up so that if I shook the phone in one of three axes, a Python script that performed a specific action occurred: - Front to Back Shake: Start the scooter - Up and Down Shake: Stop the scooter - Left to Right Shake: Open the seat lid - SL4A: Scripting Layer 4 Android is a program that provides a common layer for many different scripting languages so they can be ported to Android. Python for Android is an interpreter used by SL4A. - Python for Android – Python interpreter used by SL4A to let us run the scripts. Now for the fun part – code! I was amazed at how simple it was in the Python for Android environment. I think you will be too. Before starting, make sure you’ve paired your Android phone with the RN-42 module through the “Settings -> Wireless and networks -> Bluetooth” menu. Then, you can run scripts like the following that open up a Bluetooth connection, then enters command mode, then sends a GPIO command. Easy peasy. The following script is called StartScooter.py. import android import time droid = android.Android() # Over-the-air commands that modify the GPIO pin states on the RN-42 module. IGN_ON = 'S&,1808\r' IGN_OFF = 'S&,1810\r' SEAT_ON = 'S&,4040\r' SEAT_OFF = 'S&,4000\r' STRT_ON = 'S&,9080\r' STRT_OFF = 'S&,9000\r' INIT_DDR = 'S@,D8D8\r' print "Enabling Bluetooth..." droid.toggleBluetoothState(True) print "Connecting to scooter RN-42 module..." # Change the X's in the following line to match your MAC address. droid.bluetoothConnect('00001101-0000-1000-8000-00805F9B34FB', 'XX:XX:XX:XX:XX:XX') print "Entering command mode..." droid.bluetoothWrite('$$$') res = droid.bluetoothReadLine() print res print "Initializing PIO direction..." droid.bluetoothWrite(INIT_DDR) res = droid.bluetoothReadLine() print res print "Sending ignition on command..." droid.bluetoothWrite(IGN_ON) res = droid.bluetoothReadLine() print res print "Sending starter on command..." droid.bluetoothWrite(STRT_ON) res = droid.bluetoothReadLine() print res time.sleep(1.7) print "Sending starter off command..." droid.bluetoothWrite(STRT_OFF) res = droid.bluetoothReadLine() print res droid.bluetoothStop() Just write up a script with the basics of the above script in it, run it in SL4A, and it will toggle GPIO pins on the RN-42 module. See the RN-42 user’s manual for more info on the GPIO commands, and the Python for Android documentation for more info on the Android API. In Conclusion In the altered words of Jack Handy:”If you ever get the chance to choose between regular heaven and Bluetooth heaven, choose Bluetooth heaven. It may be a joke, but if not, mmmm boy!” .? Congratulations for your project! For a beginner like me it is complicated to put all together (Tasker-SL4A-Python) I have tried to follow the steps, but I’m unable to make it work with Tasker. Can you attach the files or configuration you are using? Thanks in advance. Jesus..
http://bradsprojects.wordpress.com/2012/06/14/bluition/
CC-MAIN-2014-10
refinedweb
1,858
71.65
Getting More Out of Vue Async Components We mainly use Vue async components to split them into their own bundle to reduce our initial bundle size, I explore how to get out more of those components. Async Component OptionsAsync Component Options If you are using Nuxt, you are bound to love the asyncData feature as it allows you to fetch arbitrary data and inject them into the page component's data. But it only works for page components, when it comes to component-level async data we have no real answer, at least for the time being. Consider a component that has a dynamic layout that changes depending on the user configuration, like a tenant app with a dynamic layout. A simple implementation looks like this: <template> <div> <div : Section 1 </div> <div : Section 2 </div> <div : Section 3 </div> </div> </template> <script> export default { props: { layout: { type: Array, default: () => [6, 3, 3] } } }; </script> Naturally you would fetch the layout information in this component's parent and pass them via the layout prop. This is fine but it would be much better if we could make this component self contained and decouple this logic from its parent. And if its going to be used a lot it will be problematic to keep fetching the config over and over. I guess we can just fetch the information from an API, and instead of using a layout prop we could instead use local state: <template> <div> <div : Profile Section </div> <div : Sidebar </div> <div : Ads </div> </div> </template> <script> export default { name: 'Layout', data: () => ({ layout: [6, 3, 3] }), async mounted() { this.layout = await api.getUserLayout(); } }; </script> Cool, but we immediately notice a problem, our component will not render the correct configuration initially. This problem can be avoided in the first example, but can still happen. Vue.js offers us the ability to build lazy components, we mainly use this feature to split our code into multiple chunks which is useful for large components like a vue-router's route component. An async component is usually composed like this: Vue.component('async-component', () => import('./async-component')); But we could do a lot more with this idea, after all the function should return a promise that resolves to a component options object. So we are free to do any arbitrary operations in-between, we could fetch data from a remote source for example. Vue.component('Layout', async () => { const layout = await api.getUserLayout(); return { data: () => ({ layout }), template: ` <div> <div : Profile Section </div> <div : Sidebar </div> <div : Ads </div> </div> ` }; }); Great, our component is now fully independent and it doesn't use life cycle methods. You can apply this technique to any component that fetches it's definition dynamically from a remote endpoint, the possibilities are endless at this point! By looking at our component. I can see your disgust at the inline template, surely a larger component will be extremely annoying to inline like that, it would be cooler if we could use our Vue template along with this one. Remember that we can put any arbitrary logic inside the async component resolver, so for instance we could load a component ourselves and inject the data in it. A quick dirty hack would look like this: const Layout = async () => { // Our SFC const component = await import('./components/Layout'); const layout = await api.getUserLayout(); // Good ol' JS monkey patching. const originalData = component.data; component.data = () => { return { ...originalData(), layout }; }; return component; }; This patches our component definition with the remote data fetched, it also splits our component into its own chunk and so we are golden on both fronts. Now it we wouldn't be done unless this is reusable, right? What we need is to inject data into an arbitrary component with a promise result. We could do this with a higher order component (HOC): const withData = (component, callback) => async () => { const asyncData = await callback(); // Handle both splitted components and directly imported ones. component = component.then ? await component : component; const originalData = component.data || (() => ({})); component.data = () => { return { ...originalData(), ...asyncData }; }; return component; }; Now we could use this with any component: Vue.component( 'Layout', withData(() => import('./components/Layout.vue'), api.getUserLayout) ); This is not a perfect solution as your component would only evaluate the resolver function once, meaning it won't update upon each visit to this component. But we explored the idea of injecting component options at runtime, this is useful if you are doing it once in a full-render like a loading a header or a footer. Here is this example in action: Async FeaturesAsync Features Sometimes you face this scenario: your awesome component does a default thing, then based on a prop or some runtime condition it takes the code into a heavy execution path. Let's illustrate this with an example that I ran into, I have this AppContent component that adds some styling and preprocessing to arbitrary text. For example it converts :emoji: to emoji graphics like Slack or discord. That's not a lot, but we also have another scenario where we might run into the three ticks ` to display some code snippet which will require some highlighting. So we also need to load our highlighter of choice (Prism or Highlight.js) then load our theme of choice and apply it on the code snippet. Now you will realize that this component even if lazily loaded will pack a bunch of kilobytes to support features that might not exist in all content written, and if we need to add more features it will grow very quickly. wouldn't it be nice to just load the absolute minimum and progressively load features when needed? You could tackle this in multiple ways, assuming our content nodes are flat (no children) it will allow us to rule out recursive components, which is for the better because we want to keep it simple. A great solution would be to map the nodes into components and these components will be lazily loaded with import(). <template> <div class="AppContent"> <Component v- {{ node.body }} </Component> </div> </template> <script> export default { components: { SnippetNode: () => import('./SnippetNode.vue'), EmojiNode: () => import('./EmojiNode.vue') }, props: { nodes: { type: Array, required: true } }, computed: { mappedNodes () { return this.nodes.map(node => { if (node.startsWith(':') && node.endsWith(':')) { // Emoji Node return { component: 'EmojiNode', props: { id: node.replace(/:/g, '') } }; } if (node.startsWith('```') && node.endsWith('```')) { // Snippet node return { component: 'SnippetNode', props: { language: node.match(/```(w+)/)[1] }, body: node.replace(/```(w+)?/g, '') }; } // just a paragraph return { component: 'p', body: node }; }); } } }; </script> Here it is in action: This looks fine at first glance, but you will notice that it loads both components anyways even if you remove some nodes from the nodes.json file. Splitting them up into their own bundles isn't the goal here, we want to load them when needed, we want to save some valuable kilobytes as it will allow our readers to read the article faster. Currently we probably made it worse by adding the async overhead. Let us define our goal here: We need to dynamically register components if they are needed, otherwise we don't register them at all. A useful feature of the Dynamic component is that the is prop can accept a component options, so instead of registering the lazy components we can lazily load them when computing the nodes list. A slightly improved example looks like this: // Create a lazy loader. const loadComponent = function (component) { return () => import(`./${component}.vue`); } export default { props: { nodes: { type: Array, required: true } }, computed: { mappedNodes () { return this.nodes.map(node => { if (node.startsWith(':') && node.endsWith(':')) { // Emoji Node return { component: loadComponent('EmojiNode'), props: { id: node.replace(/:/g, '') } }; } if (node.startsWith('```') && node.endsWith('```')) { // Snippet node return { component: loadComponent('SnippetNode'), props: { language: node.match(/```(w+)/)[1] }, body: node.replace(/```(w+)?/g, '') }; } // just a paragraph return { component: 'p', body: node }; }); } } }; This does the trick! it only loads the component down the wire only when needed. By doubling down on laziness we managed to solve the problem, but can we get away with something much simpler? Since we are only transforming text, we could render spans with HTML binding with v-html. And we can lazy load any JavaScript code using import() just like async components, it isn't exclusive to Vue components. <template> <div class="AppContent"> <p v-</p> </div> </template> <script> function transform(node) { function loadTransformer(transformer) { return import(`../transformers/${transformer}.js`).then(({ transform }) => { return transform; }); } if (node.startsWith(":") && node.endsWith(":")) { return loadTransformer("emoji").then(t => t(node)); } if (node.startsWith("```") && node.endsWith("```")) { return loadTransformer("code").then(t => t(node)); } return node; } export default { props: { nodes: { type: Array, required: true } }, data: () => ({ mappedNodes: [] }), async mounted() { for (const node of this.nodes) { this.mappedNodes.push(await transform(node)); } } }; </script> That surprisingly looks a lot cleaner, instead of using async components, we use regular functions which will reduce our logic considerably. This is fine for small stuff, once the logic starts to grow you may opt-in for components as they will give you the flexibility needed but its good to know that we don't have to stuff everything into a component. ConclusionConclusion We explored a couple of interesting ideas we can do with async components, I'm sure you can think of a couple of crazy ideas as well.
https://logaretm.com/blog/2019-08-01-getting-more-out-of-vue-async-components/
CC-MAIN-2020-34
refinedweb
1,532
53.41
#include <EntryPoint.h> List of all members. Definition at line 10 of file EntryPoint.h. [inline, explicit] constructor, need to specify the WorldStatePool (presumably it's in a shared memory region...) Definition at line 28 of file EntryPoint.h. [inline, virtual] an EmptyData implies a WorldStateRead should be passed on to the pool, requesting a write requires a WorldStateWrite to be passed Implements Resource. Definition at line 31 of file EntryPoint.h. Definition at line 36 of file EntryPoint.h. [inline] this can be useful when planning to write, get the threadlock to do some initial setup before grabbing an entry from the pool Definition at line 56 of file EntryPoint.h. this instance will be used if an empty Data is passed to useResource (only safe to do because we get lock first, so two threads won't be using the same data at the same time) Definition at line 18 of file EntryPoint.h. Referenced by releaseResource(), and useResource(). [protected] pool which manages which WorldStates are being updated while old copies can still be read Definition at line 59 of file EntryPoint.h. only one behavior runs at a time Definition at line 60 of file EntryPoint.h. Referenced by getLock(), releaseResource(), and useResource().
http://www.tekkotsu.org/dox/hal/classEntryPoint.html
crawl-001
refinedweb
206
56.25
Tax Have a Tax Question? Ask a Tax Expert Hi Lane, I ever asked you some questions about gift tax last month. Now this is my new account (because I am closing my old account) and I would like to follow up on some questions: - You mentioned on 709 form: "Nonresidents not citizens of the United States are subject to gift and GST taxes for gifts of tangible property situated in the United States". Just to check, the stocks in my brokerage account should be intangible property, right? So if I gift my stocks to my parents this year (because I am non-resident alien this year), it is not subject to gift tax nor applicable to lifetime exclusion, thus I do not really need to file any report, right? - If I transfer my stocks or cash from my US bank account to my Singapore bank account, then is the stocks or cash still considered as US-situated property or not? Just wonder, if later on, I want to gift the cash from my Singapore bank account to other people, do I still need to file gift tax return or not (I am always non-resident alien when doing so). Hi!That's right - gifts of any intangible property by a nonresident alien (stocks, other securities), whether or not situated in the U.S. and regardless of its value, would not be taxable. And on the transfer question, no the property being in Singapore would not be US situs property and we're still talking about intangibles here as well.No need to file the 709 at allGood to hear from youLane The Internal Revenue Service and the courts have generally taken the position that cash gifts (for example, in the form of actual bills and coins), constitute tangible personal property. As a result, cash gifts made by a nonresident alien in the U.S. are subject to gift tax. On the other hand, in Private Letter Ruling(NNN) NNN-NNNN the Service ruled, in part, that a transfer of cash by a check drawn on a foreign bank and payable by a U.S. bank is not subject to gift tax. Prior rulings by the Service on the issue of whether a cash transfer, in a form other than the physical exchange of bills and coins, have not been entirely consistent. In addition, a private letter ruling binds only the IRS and the requesting taxpayer. Absent clear guidance, the safest approach is to presume that cash is tangible personal property for purposes of the gift tax rules. But when I transfer cash to other people, I do it from my Singapore bank account when I live physically in Singapore and I am outside US for the year. Is it still considered as "by a nonresident alien in the U.S." ? You can also set me up as your preferred expert on your home page. Regardless, thanks again, Lane Hi Lane, Just to follow up this question further, because on wikipedia, it says that, For gift tax purposes, the test is different in determining who is. So my questions are: - To prepare for the worst case, assuming that, I did the gifting this year (but the amount was below unified lifetime credit), then a couple of years later, IRS catches my case and judges that I was actually a resident (not a NRA) when I did the gifting. If this happens, I will be forced to file gift tax return and pay gift tax by then. In this case, because I can still claim to count this gift towards my unified lifetime credit and by doing so, I should not owe any gift tax to IRS anyways, right? Just wonder, is there still any late filing penalty for this not-owing-any-tax case? If so, how to calculate it? - For the hypothetical case above, when I claim to use the unified lifetime credit, I am actually claiming based on the credit amount in the year I did gifting rather than in the year I am filing the return (which could be a couple of years later than the year I did gifting), right? - To prevent the worst case from happening, do you think it is OK to still file form 709 to notify IRS about this gifting regardless, even though I think I am still a NRA this year? So that I fulfill (actually over-fulfill) my responsibility. But if I do so, does it mean that IRS will just consider me as a resident alien and count this amount into my unified lifetime credit and there is no way for me to argue that "this should not be counted because I was a NRA when gifting" in the future anymore?. Thanks a lot for your reply! Just to clarify one point (sorry I did not mention it clearly before), for one gift, I am actually transfer stocks from my US brokerage account to my parents and the stocks are issued by a US public company, so it is US-situs property (but still intangible since it is stock). Hope in this case, your opinion is still valid. And I was asking about which year to determine the unified lifetime credit, because this credit changes every year. I know this year is $5,250,000, but I heard next year it may drop to $1,000,000. So just would like to see the gifting this year is associated with which year's unified lifetime credit (this year or the later year when I am forced to fill gift tax return). As a follow-up, just to be sure I'm being clear, Bo ... The amount that your total accumulated gifts (total to) each year will be applied to the lifetime exclusion for THAT year, for TAX DUE purposes And the need to file has only to do with being required to file (as we have been discussing) which will in turn add that year's gifts to the accumulated total. Thanks a lot for the explanation! I feel much clearer now:) Just found this on 6651 (): In the case of a failure to file a return of tax imposed by chapter 1 within 60 days of the date prescribed for filing of such return (determined with regard to any extensions of time for filing), unless it is shown that such failure is due to reasonable cause and not due to willful neglect, the addition to tax under paragraph (1) shall not be less than the lesser of $135 or 100 percent of the amount required to be shown as tax on such return. Does it mean that, even when I have 0 tax liability, I still need to pay $135 as the minimum for late filing ? Here we go Bo.This is found in the IRS internal manual (see the underlined sentence below): If the return is at least 60 days late, including extensions, a minimum FTF penalty applies: For returns filed (without regard to extensions) after 12/31/2008, the minimum penalty is the lesser of $135 or 100 percent of the tax required to be shown on the return that was not paid on or before the due date. For returns filed . You can find this here (2nd heading down): Feedback Appreciated (If I don't get a positive rating then I am not paid ... Thanks!) I see. Thanks for the update. While FTF penalty does not apply to gift tax in this section, can we just confirm that there is 0 penalty for late filing if there is 0 gift tax liability? Or there is other tax code that deals with FTF penalty for gift tax. See IRM 20.1.2.2.7.4, Minimum Penalty, for additional information
http://www.justanswer.com/tax/82qu9-hi-lane-ever-asked-questions-gift-tax-last.html
CC-MAIN-2016-26
refinedweb
1,294
63.32
NAME ng_device -- device netgraph node type SYNOPSIS #include <netgraph/ng_device.h> DESCRIPTION A device node is both a netgraph node and a system device interface. When a device node is created, a new device entry appears which is accessible via the regular file operators such as open(2), close(2), read(2), write(2), etc. The first node is created as /dev/ngd0, all subsequent nodes /dev/ngd1, /dev/ngd2, etc. HOOKS A device node has a single hook with an arbitrary name. All data coming in over the hook will be presented to the device for read(2). All data coming in from the device entry by write(2) will be forwarded to the hook. CONTROL MESSAGES The device node supports one non-generic control message: NGM_DEVICE_GET_DEVNAME Returns device name corresponding to a node. SHUTDOWN This node shuts down upon receipt of a NGM_SHUTDOWN control message, or upon hook disconnection. The associated device entry is removed and becomes available for use by future device nodes. SEE ALSO netgraph(4), ngctl(8) HISTORY The device node type was first implemented in FreeBSD 5.0. AUTHORS Mark Santcroos <marks@ripe.net> Gleb Smirnoff <glebius@FreeBSD.org>
http://manpages.ubuntu.com/manpages/precise/man4/ng_device.4freebsd.html
CC-MAIN-2015-22
refinedweb
195
57.77
The chain rule of derivatives is, in my opinion, the most important formula in differential calculus. In this post I want to explain how the chain rule works for single-variable and multivariate functions, with some interesting examples along the way. Preliminaries: composition of functions and differentiability We denote a function f that maps from the domain X to the codomain Y as . With this f and given , we can define as the composition of g and f. It's defined for as: In calculus we are usually concerned with the real number domain of some dimensionality. In the single-variable case, we can think of and as two regular real-valued functions: and . As an example, say and . Then: We can compose the functions the other way around as well: Obviously, we shouldn't expect composition to be commutative. It is, however, associative. and are equivalent, and both end up being for . To better handle compositions in one's head it sometimes helps to denote the independent variable of the outer function (g in our case) by a different letter (such as ). For simple cases it doesn't matter, but I'll be using this technique occasionally throughout the article. The important thing to remember here is that the name of the independent variable is completely arbitrary, and we should always be able to replace it by another name throughout the formula without any semantic change. The other preliminary I want to mention is differentiability. The function f is differentiable at some point if the following limit exists: This limit is then the derivative of f at the point , or . Another way to express this is . Note that can be any arbitrary point on the real line. I sometimes say something like "f is differentiable at ". Here too, is just a real value that happens to be the value of the function g at . The single-variable chain rule The chain rule for single-variable functions states: if g is differentiable at and f is differentiable at , then is differentiable at and its derivative is: The proof of the chain rule is a bit tricky - I left it for the appendix. However, we can get a better feel for it using some intuition and a couple of examples. First, the intuituion. By definition: Multiplying both sides by h we get [1]: Therefore we can say that when changes by some very small amount, changes by times that small amount. Similarly is the amount of change in the value of f for some very small change from . However, since in our case we compose , we can say that , evaluating . Suppose we shift by a small amount h. This causes to shift by . So the input of f shifted by - this is still a small amount! Therefore, the total change in the value of f should be [2]. Now, a couple of simple examples. Let's take the function . The idea is to think of this function as a composition of simpler functions. In this case, one option is: and then , so the original f is now the composition . The derivative of this composition is , or since . Note that w is differentiable at any point, so this derivative always exists. Another example will use a longer chain of composition. Let's differentiate . This is a composition of three functions: Function composition is associative, so f can be expressed as either or . Since we already know what the derivative of is, let's use the former: \end{align*}\]]() The chain rule as a computational procedure As the last example demonstrates, the chain rule can be applied multiple times in a single derivation. This makes the chain rule a powerful tool for computing derivatives of very complex functions, which can be broken up into compositions of simpler functions. I like to draw a parallel between this process and programming; a function in a programming language can be seen as a computational procedure - we have a set of input parameters and we produce outputs. On the way, several transformations happen that can be expressed mathematically. These transformations are composed, so their derivatives can be computed naturally with the chain rule. This may be somewhat abstract, so let's use another example. We'll compute the derivative of the Sigmoid function - a very important function in machine learning: To make the equivalence between functions and computational procedures clearer, let's think how we'd compute S in Python: def sigmoid(x): return 1 / (1 + math.exp(-x)) This doesn't look much different, but that's just because Python is a high level language with arbitrarily nested expressions. Its VM (or the CPU in general) would execute this computation step by step. Let's break it up to be clearer, assuming we can only apply a single operation at every step: def sigmoid(x): f = -x g = math.exp(f) w = 1 + g v = 1 / w return v I hope you're starting to see the resemblance to our chain rule examples at this point. Sacrificing some rigor in the notation for the sake of expressiveness, we can write: This is the chain rule applied to . Solving this is easy because every single derivative in the chain above is trivial: Now you may be thinking: - Every function computable by a program can be broken down to trivial steps like our sigmoid above. - Using the chain rule, we can easily find the derivative of such a sequence of steps... therefore: - We can easily find the derivative of any function computable by a program!! An you'll be right. This is precisely the basis for the technique known as automatic differentiation, which is widely used in scienctific computing. The most notable use of automatic differentiation in recent times is the backpropagation algorithm - an essential backbone of modern machine learning. I personally find automatic differentiation fascinating, and will write a more dedicated article about it in the future. Multivariate chain rule - general formulation So far this article has been looking at functions with a single input and output: . In the most general case of multi-variate calculus, we're dealing with functions that map from n dimensions to m dimensions: . Because every one of the m outputs of f can be considered a separate function dependent on n variables, it's very natural to deal with such math using vectors and matrices. First let's define some notation. [3] [4]. Intuitively, the multivariate chain rule mirrors the single-variable one (and as we'll soon see, the latter is just a special case of the former) with derivatives replaced by derivative matrices. From linear algebra, we represent linear transformations by matrices, and the composition of two linear transformations is the product of their matrices. Therefore, since derivative matrices - like derivatives in one dimension - are a linear approximation to the function, the chain rule makes sense. This is a really nice connection between linear algebra and calculus, though a full proof of the multivariate rule is very technical and outside the scope of this article. Multivariate chain rule - examples Since the chain rule deals with compositions of functions, it's natural to present examples from the world of parametric curves and surfaces. For example, suppose we define as a scalar function giving the temperature at some point in 3D. Now imagine that we're moving through this 3D space on a curve defined by a function which takes time t and gives the coordinates at that time. We want to compute how the temperature changes as a function of time t - how do we do that? Recall that the temprerature is not a direct function of time, but rather is a function of location, while location is a function of time. Therefore, we'll want to compose . Here's a concrete example: And: If we reformulate x, y and z as functions of t: Composing , we get: Since this is a simple function, we can find its derivative directly: Now let's repeat this exercise using the multivariate chain rule. To compute we need and . Let's start with . maps , so its Jacobian is a 3-by-1 matrix, or column vector: To compute let's first find . Since maps , its Jacobian is a 1-by-3 matrix, or row vector: To apply the chain rule, we need : Finally, multiplying by , we get: Another interesting way to interpret this result for the case where and is to recall that the directional derivative of f in the direction of some vector is: In our case is the Jacobian of f (because of its dimensionality). So if we take to be the vector , and evaluate the gradient at we get [5]: This gives us some additional intuition for the temperature change question. The change in temperature as a function of time is the directional derivative of f in the direction of the change in location ( ). For additional examples of applying the chain rule, see my post about softmax. Tricks with the multivariate chain rule - derivative of products Earlier in the article we've seen how the chain rule helps find derivatives of complicated functions by decomposing them into simpler functions. The multivariate chain rule allows even more of that, as the following example demonstrates. Suppose . Then, the well-known product rule of derivatives states that: Proving this from first principles (the definition of the derivative as a limit) isn't hard, but I want to show how it stems very easily from the multivariate chain rule. Let's begin by re-formulating as a composition of two functions. The first takes a vector in and maps it to by computing the product of its two components: The second is a vector-valued function that maps a number to : We can compose , producing a function that takes a scalar an returns a scalar: . We get: Since we're composing two multivariate functions, we can apply the multivariate chain rule here: Since and , this is exactly the product rule. Connecting the single-variable and multivariate chain rules Given function , its Jacobian matrix has a single entry: Therefore, given two functions mapping , the derivative of their composition using the multivariate chain rule is: Which is precisely the single-variable chain rule. This results from matrix multiplication between two 1x1 matrices, which ends up being just the product of their single entries. Appendix: proving the single-variable chain rule It turns out that many online resources (including Khan Academy) provide a flawed proof for the chain rule. It's flawed due to a careless division by a quantity that may be zero. This flaw can be corrected by making the proof somewhat more complicated; I won't take that road here - for details see Spivak's Calculus. Instead, I'll present a simpler proof inspired by the one I found at Casey Douglas's site. We want to prove that: Note that previously we defined derivatives at some concrete point . Here for the sake of brevity I'll just use as an arbitrary point, assuming the derivative exists. Let's start with the definition of : We can reorder it as follows: Let's give the part in the brackets the name . Similarly, if the function f is differentiable at the point , we have: We reorder: And call the part in the brackets . The choice of the variable used to go to zero: k instead of h is arbitrary and is useful to simplify the discussion that follows. Let's reorder the definition of a bit: We can apply f to both sides: By reordering the definition of we get: Now taking the right-hand side of (1), we can look at it as since and we can define . We still have k going to zero when h goes to zero. Assigning these a and k into (2) we get: So, starting from (1) again, we have: Subtracting from both sides and dividing by h (which is legal, since h is not zero, it's just very small) we get: Apply a limit to both sides: Now recall that both and go to 0 when h goes to 0. Taking this into account, we get: Q.E.D.
https://eli.thegreenplace.net/2016/the-chain-rule-of-calculus
CC-MAIN-2017-51
refinedweb
2,032
51.38
Raspberry Pi + TMP36 Temperature Sensor Getting started Hooking up analog sensors to the Raspberry Pi is easy with the MCP3008. Follow along to learn how to hook your Raspi up to a temperature sensor, and start streaming right away! We'll be using the Plotly Python API on the Raspberry Pi to do all the heavy lifting. This tutorial does however, assume that you have an internet connection on your Pi, as well as either SSH access or a keyboard and monitor hooked up. Materials - Raspberry Pi (Model B) - Raspberry Pi wifi dongle - TMP36 temperature sensor - MCP3008 D/A chip - Hookup wires - Half-size breadboard - Pi Cobbler or Adafruit Pi shield Hooking it up Software First, install the required modules and dependencies (you can copy and paste this in your terminal): sudo apt-get install python-dev wget -O - | sudo python sudo easy_install -U distribute sudo apt-get install python-pip sudo pip install rpi.gpio sudo pip install plotly Create a new folder for your project. Create a config.json file in said folder and input your plotly API key, and your plotly streaming tokens. Example config.json: { "plotly_streaming_tokens": ["your_stream_token", "another_stream_token"], "plotly_api_key": "api_key", "plotly_username": "username" } The script Grab the Python scripts here! tmp36.py is where all the fun happens. readadc.py is just a helper script that tmp36.py will use to poll for analog data from the MCP3008. Copy both of these files into the folder you have created above. Open up tmp36.py, and let's go through it. First we're just importing all of the necessary libraries. readadc makes it easy to pull analog data from your Rasberry Pi's GPIO pins. import plotly.plotly as py # plotly library import json # used to parse config.json import time # timer functions import readadc # helper functions to read ADC from the Raspberry Pi import datetime # log and plot current time Now, we're going to pull in our config file, and use them to initialize our Plotly object. with open('./config.json') as config_file: plotly_user_config = json.load(config_file) py.sign_in(plotly_user_config["plotly_username"], plotly_user_config["plotly_api_key"]) Now, we create a shell for our graph, and prepare it for streaming. This is where you first include your streaming_token, to tell Plotly's servers to expect a stream from that particular stream_token! url = py.plot([ { 'x': [], 'y': [], 'type': 'scatter', 'stream': { 'token': plotly_user_config['plotly_streaming_tokens'][0], 'maxpoints': 200 } }], filename='Raspberry Pi Streaming Example Values') print "View your streaming graph here: ", url The TMP36 is hooked up to PIN0 on the MCP3008. We then initialize our readadc module (preparing to read analog values). We then initialize a plotly stream, indicating which token we will be using for that trace. sensor_pin = 0 readadc.initialize() stream = py.Stream(plotly_user_config['plotly_streaming_tokens'][0]) stream.open() Here we're just creating the main loop that polls for data on sensor_pin, converting that to a temperature reading, and writing that data to our plotly stream with stream.write(data) #the main sensor reading and plotting loop while True: sensor_data = readadc.readadc(sensor_pin, readadc.PINS.SPICLK, readadc.PINS.SPIMOSI, readadc.PINS.SPIMISO, readadc.PINS.SPICS) millivolts = sensor_data * (3300.0 / 1024.0) # 10 mv per degree temp_C = ((millivolts - 100.0) / 10.0) - 40.0 # convert celsius to fahrenheit temp_F = (temp_C * 9.0 / 5.0) + 32 # remove decimal point from millivolts millivolts = "%d" % millivolts # show only one decimal place for temprature and voltage readings temp_C = "%.1f" % temp_C temp_F = "%.1f" % temp_F # write the data to plotly stream.write({'x': datetime.datetime.now(), 'y': temp_C}) # delay between stream posts time.sleep(0.25) Wrapping it up You're all ready to go! You've got your Pi hooked up as per the above diagram, you've created a config.json file with your credentials, and in the same folder have you have copied over tmp36.py and readadc.py. From that directory, run: sudo python tmp36.py You can watch the console to see the URL returned from Plotly's server. Now go check out your live stream!
https://plot.ly/raspberry-pi/tmp36-temperature-tutorial/
CC-MAIN-2018-05
refinedweb
664
57.57
img_dtransform_create() Prepare to transform an image Synopsis: #include <img/img.h> int img_dtransform_create( const img_t *src, const img_t *dst, img_dtransform_t *xform ); Arguments: - src - The image you want to convert from - dst - The image you want to convert to - xform - The address to an opaque img_dtransform_t where the function stores the transform it creates. Library: libimg Use the -l img option to qcc to link against this library. Description: This function pepares a data transformation from one format to another, from the format in the src image to the format in the dst image. Once this function is called, you call img_dtransform_apply() to apply the transformation, then img_dtransform_free() to free the xform opaque structure. - Data transforms are capable of handling palette-based formats, abstracting the details of conversions and/or expansion. It's generally easiest to use this construct when converting data from one arbitrary format to another. - Conversion to a palette-based format is not supported. Returns: - IMG_ERR_OK - Success. The xform is valid and must be freed when the transform is finished. For any other return code (error), the xform isn't valid, and it must not be freed. - IMG_ERR_PARM - Required bits in the flags member of src aren't set (at a minimum IMG_H and IMG_W need to be set). - IMG_ERR_MEM - Insufficient memory for transform - IMG_ERR_NOSUPPORT - No support for the requested transform. Classification: Image library
https://developer.blackberry.com/playbook/native/reference/com.qnx.doc.neutrino.lib_ref/topic/i/img_dtransform_create.html
CC-MAIN-2021-21
refinedweb
226
55.64
Displaying XML in a Swing JTree Overview It seems obvious enough: You have an XML document or fragment. XML is hierarchical. A Swing JTree displays hierarchical data. How do you make a JTree display your XML fragment? If you understand that Swing's architecture uses MVC, you probably know you need a "model" that your JTree instance can be instructed to use. However, the only real concrete model class in the standard Swing API is the DefaultTableModel class. This class provides objects to the tree that implement the TreeNode interface. If you have started down this path, subclassing and customizing the standard behavior of the DefaultTableModel and working with your own DefaultTreeNode objects just to display XML will quickly give you a headache. About this Article I will be staying completely within the standard API, so no third-party XML libraries will be needed. If you need to get more familliar with the XML classes in the standard API, you might want to read one of my earlier articles "Working with XML and Java" or consult your favorite search engine. I also tend to use Java 5 syntax (generics and enhanced-for). The reader is assumed to be somewhat familiar with Swing. The TreeModel Interface This interface defines the following methods. I have borrowed the descriptions directly from the Java API documentation. - void addTreeModelListener(TreeModelListener l): Adds a listener for the TreeModelEvent posted after the tree changes. - void removeTreeModelListener(TreeModelListener l): Removes a listener previously added with addTreeModelListener. - Object getRoot() Returns the root of the tree. - int getChildCount(Object parent): Returns the number of children of parent. - Object getChild(Object parent, int index): Returns the child of parent at index index in the parent's child array. - boolean isLeaf(Object node): Returns true if node is a leaf. - int getIndexOfChild(Object parent, Object child): Returns the index of child in parent. - void valueForPathChanged(TreePath path, Object newValue): Messaged when the user has altered the value for the item identified by path to newValue. I have listed the methods roughly in order of usage. When a JTree is given a TreeModel implementation to use, it registers itself as a TreeModelListener. (A good model implementation will alert all of its listeners if the structure of the tree changes, or if a node value changes. This lets the tree know it needs to redraw itself.) The root node is consulted first, and then the children for each node are obtained to build up the display. The icon in the tree that appears to each entry is determined from the result of whether that entry is a leaf or not. (Generally, if a node returns '0' for getChildCount, it should return 'true' for isLeaf... but, this is not set in stone.) Finally, if the values in the model are mutable (they can be edited) and the tree is editable, the tree will communicate with the edited value with the model by way of the valueForPathChanged method. (This example won't use an editable tree, so you won't implement this last method.) An important point to note is that, being an interface, the TreeModel class doesn't concern itself with exactly where the data comes from or how it is stored. Because you will be dealing with an XML document, however, your implementation will include an instance field for an org.w3c.dom.Document class, and a corresponding getter/setter method pair. The TreeModel interface methods will simply work off of the Document object directly: protected Document document; public Document getDocument() { return document; } public void setDocument(Document doc) { this.document = doc; TreeModelEvent evt = new TreeModelEvent(this, new TreePath(getRoot())); for (TreeModelListener listener : listeners) { listener.treeStructureChanged(evt); } } Any time you alter the data model—such as when you replace the source XML document completely in the setDocument method—you need to alert all the listeners of this fact. This is what the extra code in setDocument takes care of. (The definition of the "listeners" variable will be introduced shortly. Bear with me.) Before you start writing the TreeModel method implementations, you should carefully note that the model returns back objects of type java.lang.Object to the tree (for the root node and all children underneath it). The tree, by way of its default TreeCellRenderer, neither knows nor cares exactly what class these objects truly are. To know what label to draw in the tree for any given node, the toString method is called. (A special-purpose, highly customized tree might use a different tree cell renderer, which might be written to use something other than 'toString' to generate the node labels ... but that is beyond the scope of this article.) With this being the case, the standard org.w3c.dom.Node class doesn't provide a terribly useful return value for the toString method... at least not that useful to the casual end-user. To address this, you will wrap the Element objects in a custom class that provides a more intelligent response to the toString method: It will return the name of the Element using the getNodeName method. Look at this wrapper class first: public class XMLTreeNode { Element element; public XMLTreeNode(Element element) { this.element = element; } public Element getElement() { return element; } public String toString() { return element.getNodeName(); } } Page 1 of 3
https://www.developer.com/java/other/article.php/3731356
CC-MAIN-2017-47
refinedweb
878
55.64
Hi every one… In the last few posts we have shown how to display the SQL results in Operator , fetch the failed objects errors message in Package and various other techniques. Today we want to cover another small scripts which can enable you fetch details of the Interface that have error out because of PK , FK ,Not Null constraints etc and goes to the Error table. This scripts creates a File and dumps all the information by reading from SNP_CHECK_TAB table and finally file can be added to OdiSendMail and send to the Administrator or Developers so that they can know which interface got error records, so they can do the needful and also in daily load we fail to see all these smaller details especially we have hundreds of interfaces. import string import java.sql as sql import java.lang as lang import re sourceConnection = odiRef.getJDBCConnection("SRC") output_write=open('c:/snp_check_tab.txt','w') sqlstring = sourceConnection.createStatement() #--------------------------------------------------------------------------- output_write.write("The Errored Interface of today's (<%=odiRef.getSysDate( )%>) run are .... n") output_write.write("----------------------------------------------------------- nn") #--------------------------------------------------------------------------- sqlstmt="SELECT 'Errored Interface t- '||SUBSTR(ORIGIN,INSTR(ORIGIN,')')+1, LENGTH(ORIGIN))||'nError Message tt- '||ERR_MESS||'nNo of Errored Records t- '|| ERR_COUNT AS OUTPUT FROM ODI_TEMP.SNP_CHECK_TAB WHERE TRUNC(CHECK_DATE)=TRUNC(SYSDATE)" result=sqlstring.executeQuery(sqlstmt) rs=[] while (result.next()): rs.append(str(result.getString("output")+'t')) res='nn'.join(map(string.strip,rs)) print >> output_write, res sourceConnection.close() output_write.close() [Note – In the above scripts please change the File path and the Schema(Work Schema ) name according to your respective Environment ] Provide the Technology and Schema of your work Schema or required schema which can access the SNP_CHECK_TAB and provide the code in Command on Target and for every run you will get the sample output as shown below. Attach the File to OdiSendMail and get the daily Error Interface , Message and Records detail . Download the Codes See you soon… April 5, 2016 at 8:40 PM While scanning my files on to ODI, I am not able to see what I printed. How do I fix this? April 19, 2016 at 6:17 PM Hi Sophia… I couldn’t understand what do you mean… Can you explain with more details? June 26, 2011 at 3:18 AM Hi, I have an issue in log file name. I’m loading data into Hyperion Financial Management. In the IKM of the SQL to HFM data, we have an option of log file enabled. I made it true and gave the log file name as ‘HFM_dataload.log’. After executing the interface when I navigate in to that log folder and view the log file, that file is blank. Also a new file ‘HFM_dataloadHFM6064992926974374087.log’ is cerated and the log details are displayed in it. Since I have to automate the process of picking up the everyday log file and mail it to the users, * I need the log details to be displayed in the specified log name i.e. ‘HFM_dataload.log’ * Also I was not able to perform any action(copy that newly generated log file into another or send that file in mail), since I’m not able to predict the numbers generated along with the specified log file name. Kindly help me to overcome this issue. Thanks in advance. June 27, 2011 at 9:00 AM Please look into the KM how ODI is creating the number in HFM_dataloadHFM6064992926974374087.log and through that same logic u can pickup the Log file or u can add the command to rename to what ever file u wish to create and use that in your email. Please let us know if you need any other help. Thanks Kshitiz Devendra March 23, 2011 at 7:16 AM hi , i did the same thing as you said in the above one , but the error is showing that table or view does not exist March 23, 2011 at 7:24 AM Here SELECT ‘Errored Interface t- ‘||SUBSTR(ORIGIN,INSTR(ORIGIN,’)’)+1, LENGTH(ORIGIN))||’nError Message tt- ‘||ERR_MESS||’nNo of Errored Records t- ‘|| ERR_COUNT AS OUTPUT FROM ODI_TEMP.SNP_CHECK_TAB WHERE TRUNC(CHECK_DATE)=TRUNC(SYSDATE)” replace the schema name ODI_TEMP with your work schema name where the SNP_CHECK_TAB exist and please re run again . Thanks
http://odiexperts.com/error-records-log/
CC-MAIN-2017-04
refinedweb
702
61.16
Hello and thank you in advance for any guidance on this question. I am fairly new to Python and in the progress of converting some scripts from Powershell. My requirement is to read a CSV file with urls and then execute an external program to verify they are active. The script works great but executes sequentially. I am seeking help to use Python to execute an external program in parallel (for each entry in the csv file) and the capture the return codes which can be used to analysis the url status. Here is my current code which works but only sequentially. import csv import subprocess cmd = ("c:\\scripts\\cmd\\http-ping.exe") test_file = 'C:\SERVER_INVENTORY\SYSTEM_INVENTORY.csv' csv_file = csv.DictReader(open(test_file, 'rb'), delimiter=',', quotechar='"') for line in csv_file: host = line['url'] print cmd, host pname = subprocess.Popen([cmd,host],stdout=subprocess.PIPE, stderr=subprocess.STDOUT) stdout, stderr = pname.communicate() if pname.poll() == 100: print "Ok" print(pname.returncode) else: print "Error" print(pname.returncode) Here are the results. It executes the first url and then then the second in order. C:\scripts>python forum.py c:\scripts\cmd\http-ping.exe "" Ok 100 c:\scripts\cmd\http-ping.exe "" Error 0
http://forums.devshed.com/python-programming-11/execute-process-parallel-951262.html
CC-MAIN-2014-10
refinedweb
203
62.24
pwned alternatives and similar packages Based on the "Security" category. Alternatively, view pwned alternatives based on common mentions on social networks and blogs. ssl_verify_fun6.9 1.0 pwned VS ssl_verify_funCollection of ssl verification functions for Erlang safetybox3.1 0.0 pwned VS safetyboxSecurity oriented helper functions for Elixir ca3.0 1.2 pwned VS ca🛡️ CA: Certificate Authority EmailGuard2.8 0.7 pwned VS EmailGuardElixir library for detecting disposable (burner) or non-business email addresses. ssl_verify_hostname2.1 0.0 pwned VS ssl_verify_hostnameErlang library for certificate hostname validation based on rfc6125. clamxir1.5 0.0 pwned VS clamxirCalmAV wrapper for elixir code_signing0.8 2.1 pwned VS code_signingElixir library for signing and verifying BEAM files with Ed25519 signatures Password0.5 0.0 pwned VS PasswordFlexible password policies for Elixir. Do you think we are missing an alternative of pwned or a related project? README Pwned Check if your password has been pwned It uses have i been pwned? to verify if a password has appeared in a data breach. In order to protect the value of the source password being searched the value is not sended through the network. Instead it uses a k-Anonymity model that allows a password to be searched for by partial hash. This allows the first 5 characters of a SHA-1 password hash to be passed to the API. Then search the results of the response for the presence of their source hash and if not found, the password does not exist in the data set. Table of Contents Install The package can be installed by adding pwned to your list of dependencies in mix.exs: def deps do [ {:pwned, "~> 1.1"} ] end Usage case Pwned.check_password("somepassword") do {:ok, false} -> IO.puts("Good news — no pwnage found! This password wasn't found in any of the Pwned Passwords loaded into Have I been pwned.") {:ok, count} -> IO.puts("Ohh, sorry! This password has appeared #{count} time on data breaches.") :error -> IO.puts("Something went wrong.") end Contributing See the [contributing file](CONTRIBUTING.md). License [Apache License, Version 2.0](LICENSE.md) © Thiago Santos *Note that all licence references and agreements mentioned in the pwned README section above are relevant to that project's source code only.
https://elixir.libhunt.com/pwned-alternatives
CC-MAIN-2021-43
refinedweb
372
59.7
I thought I’d strike again with a small hands-on tutorial on using Janos, a tool we created to simplify the migration to EKS 1.16 as required by Amazon. This will be the final step towards ending EKS 1.15 support by May 3, 2021. Nothing too fancy. Just straight to the point :) Kubernetes sometimes deprecates apiVersions. Most notably, many deprecations occurred in the 1.16 release. Therefore, you will need to update your Kubernetes manifests to the correct API references before that deadline! At SumUp, we automated this process as we have a large number of clusters. We catch up with Pablo Loschi, our Argentinian Senior DevOps Engineer based in Berlin. Here at SumUp, we’re always looking for great talents to be part of the company and help us develop the best solutions for small businesses all over the world. Pablo Loschi is one of those talents. And if you’re a Backend Developer looking to become a DevOps Engineer, he has some interesting insights for you. “I grew up in Argentina, and I’ve been living in Berlin for just over a year now. As a child, I remember reading all the Windows 95 help section before… This guide is an update to a previous story of mine. Why another guide? Because it addresses the same issue in a simpler way. Generally speaking, simplifying is the art of distilling information. It’s all about organizing ideas and concepts to extract only the meaningful parts. This guide will get you to a working example of setting up an API gateway from scratch which will use JWT with ACL to authorize a user to reach an endpoint. For other parts, you can refer to the excellent Kong documentation. “Simplicity is the ultimate sophistication.” Leonardo da Vinci (1452–1519) At Applift we are building API services and need to allow or restrict certain calls based on roles, we choose to use this using jwt tokens support server-to-server or client-to-server communication, using JWTs as our API tokens. Here is a short example on on how to do this in a sample application. Our test application, called cafe, lets you order either tea via the tea service or coffee via the coffee service. You indicate your drink preference with the URI of your HTTP request: URIs ending with /tea get you tea and URIs ending with /coffee get you coffee. … Konga is a fully featured open source, multi-user GUI, that makes the hard task of managing multiple Kong installations a breeze. It can be integrated with some of the most popular databases out of the box and provides the visual tools you need to better understand and maintain your architecture. Konga - More than just another GUI to Kong Admin APIpantsel.github.io You can see a LIVE DEMO (username: demo password: demodemodemo) This guide assumes that you have deployed Kong using something similar to our previous post: From the previous point to have to files that are going to be used for this: one yaml file with the information for Kong to… At Applift we are handling a high volume of traffic with hundreds of millions of events daily (clicks, impressions, actions, in-app events, etc.). This means we need to be able to scale our servers fast to handle traffic spikes and also to control who has access to our servers and with which permissions. We have chosen to build our infrastructure on top of K8s to allow elasticity and scalability. We use Kong as our API gateway to control and throttle access to the cluster. So what is Kong? Kong is an orchestration microservice API gateway. Kong provides a flexible abstraction… … Based on this previous story , we started managing several certificates for different applications and it was becoming harder to maintain (also we were hitting the rate limits for Let’s-ecnrypt), so with Lucas Collino we found a way to use wildcard certificates (as recommended). This allows creating a single *.mycompany.com certificate which fits all the applications we support. The certificate is stored in a secret in the kube-system namespace, we replicated that secret across all namespaces, so developers can access it in their own namespaces. This guide assummes that you have followed the previous one, and you have Helm and… manager v0.6.2 This guide assumes that you have K8s cluster working with external dns and nginx-ingress-controller installed, the following steps are: Helm is…
https://pgold30.medium.com/?source=about_page-------------------------------------
CC-MAIN-2021-39
refinedweb
748
62.07
bugfix: list operations no longer require specific arrangement in memory (that assumption became invalid by ALLOCATEing local names): : list-length ( list -- u ) 174: 0 swap begin ( u1 list1 ) 175: dup while 176: @ swap 1+ swap 177: repeat 178: drop ; 179: 180: : /list ( list1 u -- list2 ) 181: \ list2 is list1 with the first u elements removed 182: 0 ?do 183: @ 184: loop ; 185: 186: : common-list ( list1 list2 -- list3 ) 187: \ list3 is the largest common tail of both lists. 188: over list-length over list-length - dup 0< if 189: negate >r swap r> 190: then ( long short u ) 191: rot swap /list begin ( list3 list4 ) 192: 2dup u<> while 193: @ swap @ 194: repeat 195: drop ; 196: 197: : sub-list? ( list1 list2 -- f ) 198: \ true iff list1 is a sublist of list2 199: over list-length over list-length swap - 0 max /list = ; 200: 201: \ : ocommon-list ( list1 list2 -- list3 ) \ gforth-internal 202: \ \ list1 and list2 are lists, where the heads are at higher addresses than 203: \ \ the tail. list3 is the largest sublist of both lists. 204: \ begin 205: \ 2dup u<> 206: \ while 207: \ 2dup u> 208: \ if 209: \ swap 210: \ then 211: \ @ 212: \ repeat 213: \ drop ; 214: 215: \ : osub-list? ( list1 list2 -- f ) \ gforth-internal 216: \ \ true iff list1 is a sublist of list2 217: \ begin 218: \ 2dup u< 219: \ while 220: \ @ 221: \ repeat 222: \ = ; 223: 224: \ defer common-list 225: \ defer sub-list? 226: 227: \ ' ocommon-list is common-list 228: \ ' osub-list? is sub-list?: 254: : compile-pushlocal-f ( a-addr -- ) ( run-time: f -- ) 255: locals-size @ alignlp-f float+ dup locals-size ! 256: swap ! 257: postpone f>l ; 258: 259: : compile-pushlocal-d ( a-addr -- ) ( run-time: w1 w2 -- ) 260: locals-size @ alignlp-w cell+ cell+ dup locals-size ! 261: swap ! 262: postpone swap postpone >l postpone >l ; 263: 264: : compile-pushlocal-c ( a-addr -- ) ( run-time: w -- ) 265: -1 chars compile-lp+! 266: locals-size @ swap ! 267: postpone lp@ postpone c! ; 268: 269: 7 cells 32 + constant locals-name-size \ 32-char name + fields + wiggle room 270: 271: : create-local1 ( "name" -- a-addr ) 272: create 273: immediate restrict 274: here 0 , ( place for the offset ) ; 275: 276: variable dict-execute-dp \ the special dp for DICT-EXECUTE 277: 278: 0 value dict-execute-ude \ USABLE-DICTIONARY-END during DICT-EXECUTE 279: 280: : dict-execute1 ( ... addr1 addr2 xt -- ... ) 281: \ execute xt with HERE set to addr1 and USABLE-DICTIONARY-END set to addr2 282: dict-execute-dp @ dp 2>r 283: dict-execute-ude ['] usable-dictionary-end defer@ 2>r 284: swap to dict-execute-ude 285: ['] dict-execute-ude is usable-dictionary-end 286: swap to dict-execute-dp 287: dict-execute-dp dpp ! 288: catch 289: 2r> is usable-dictionary-end to dict-execute-ude 290: 2r> dpp ! dict-execute-dp ! 291: throw ; 292: 293: defer dict-execute ( ... addr1 addr2 xt -- ... ) 294: 295: :noname ( ... addr1 addr2 xt -- ... ) 296: \ first have a dummy routine, for SOME-CLOCAL etc. below 297: nip nip execute ; 298: is dict-execute 299:ash 374: \G Comment till the end of the line if @code{BLK} contains 0 (i.e., 375: \G while not loading a block), parse and discard the remainder of the 376: \G parse area. Otherwise, parse and discard all subsequent characters 377: \G in the parse area corresponding to the current line. 378: immediate 379: 380: ' ( alias ( ( compilation 'ccc<close-paren>' -- ; run-time -- ) \ core,file paren 381: \G Comment, usually till the next @code{)}: parse and discard all 382: \G subsequent characters in the parse area until ")" is 383: \G encountered. During interactive input, an end-of-line also acts as 384: \G a comment terminator. For file input, it does not; if the 385: \G end-of-file is encountered whilst parsing for the ")" delimiter, 386: \G Gforth will generate a warning.: 400: \ the following gymnastics are for declaring locals without type specifier. 401: \ we exploit a feature of our dictionary: every wordlist 402: \ has it's own methods for finding words etc. 403: \ So we create a vocabulary new-locals, that creates a 'w:' local named x 404: \ when it is asked if it contains x. 405: 406: : new-locals-find ( caddr u w -- nfa ) 407: \ this is the find method of the new-locals vocabulary 408: \ make a new local with name caddr u; w is ignored 409: \ the returned nfa denotes a word that produces what W: produces 410: \ !! do the whole thing without nextname ; 460: 461: forth definitions 462: 463: \ A few thoughts on automatic scopes for locals and how they can be 464: \ implemented: 465: 466: \ We have to combine locals with the control structures. My basic idea 467: \ was to start the life of a local at the declaration point. The life 468: \ would end at any control flow join (THEN, BEGIN etc.) where the local 469: \ is lot live on both input flows (note that the local can still live in 470: \ other, later parts of the control flow). This would make a local live 471: \ as long as you expected and sometimes longer (e.g. a local declared in 472: \ a BEGIN..UNTIL loop would still live after the UNTIL). 473: 474: \ The following example illustrates the problems of this approach: 475: 476: \ { z } 477: \ if 478: \ { x } 479: \ begin 480: \ { y } 481: \ [ 1 cs-roll ] then 482: \ ... 483: \ until 484: 485: \ x lives only until the BEGIN, but the compiler does not know this 486: \ until it compiles the UNTIL (it can deduce it at the THEN, because at 487: \ that point x lives in no thread, but that does not help much). This is 488: \ solved by optimistically assuming at the BEGIN that x lives, but 489: \ warning at the UNTIL that it does not. The user is then responsible 490: \ for checking that x is only used where it lives. 491: 492: \ The produced code might look like this (leaving out alignment code): 493: 494: \ >l ( z ) 495: \ ?branch <then> 496: \ >l ( x ) 497: \ <begin>: 498: \ >l ( y ) 499: \ lp+!# 8 ( RIP: x,y ) 500: \ <then>: 501: \ ... 502: \ lp+!# -4 ( adjust lp to <begin> state ) 503: \ ?branch <begin> 504: \ lp+!# 4 ( undo adjust ) 505: 506: \ The BEGIN problem also has another incarnation: 507: 508: \ AHEAD 509: \ BEGIN 510: \ x 511: \ [ 1 CS-ROLL ] THEN 512: \ { x } 513: \ ... 514: \ UNTIL 515: 516: \ should be legal: The BEGIN is not a control flow join in this case, 517: \ since it cannot be entered from the top; therefore the definition of x 518: \ dominates the use. But the compiler processes the use first, and since 519: \ it does not look ahead to notice the definition, it will complain 520: \ about it. Here's another variation of this problem: 521: 522: \ IF 523: \ { x } 524: \ ELSE 525: \ ... 526: \ AHEAD 527: \ BEGIN 528: \ x 529: \ [ 2 CS-ROLL ] THEN 530: \ ... 531: \ UNTIL 532: 533: \ In this case x is defined before the use, and the definition dominates 534: \ the use, but the compiler does not know this until it processes the 535: \ UNTIL. So what should the compiler assume does live at the BEGIN, if 536: \ the BEGIN is not a control flow join? The safest assumption would be 537: \ the intersection of all locals lists on the control flow 538: \ stack. However, our compiler assumes that the same variables are live 539: \ as on the top of the control flow stack. This covers the following case: 540: 541: \ { x } 542: \ AHEAD 543: \ BEGIN 544: \ x 545: \ [ 1 CS-ROLL ] THEN 546: \ ... 547: \ UNTIL 548: 549: \ If this assumption is too optimistic, the compiler will warn the user. 550: ;: ' (then-like) IS then-like 661: ' (begin-like) IS begin-like 662: ' (again-like) IS again-like 663: ' (until-like) IS until-like 664: ' (exit-like) IS exit-like 665: 666: \ The words in the locals dictionary space are not deleted until the end 667: \ of the current word. This is a bit too conservative, but very simple. 668: 669: \ There are a few cases to consider: (see above) 670: 671: \ after AGAIN, AHEAD, EXIT (the current control flow is dead): 672: \ We have to special-case the above cases against that. In this case the 673: \ things above are not control flow joins. Everything should be taken 674: \ over from the live flow. No lp+!# is generated. 675: 676: \ About warning against uses of dead locals. There are several options: 677: 678: \ 1) Do not complain (After all, this is Forth;-) 679: 680: \ 2) Additional restrictions can be imposed so that the situation cannot 681: \ arise; the programmer would have to introduce explicit scoping 682: \ declarations in cases like the above one. I.e., complain if there are 683: \ locals that are live before the BEGIN but not before the corresponding 684: \ AGAIN (replace DO etc. for BEGIN and UNTIL etc. for AGAIN). 685: 686: \ 3) The real thing: i.e. complain, iff a local lives at a BEGIN, is 687: \ used on a path starting at the BEGIN, and does not live at the 688: \ corresponding AGAIN. This is somewhat hard to implement. a) How does 689: \ the compiler know when it is working on a path starting at a BEGIN 690: \ (consider "{ x } if begin [ 1 cs-roll ] else x endif again")? b) How 691: \ is the usage info stored? 692: 693: \ For now I'll resort to alternative 2. When it produces warnings they 694: \ will often be spurious, but warnings should be rare. And better 695: \ spurious warnings now and then than days of bug-searching. 696: 697: \ Explicit scoping of locals is implemented by cs-pushing the current 698: \ locals-list and -size (and an unused cell, to make the size equal to 699: \ the other entries) at the start of the scope, and restoring them at 700: \ the end of the scope to the intersection, like THEN does. 701: 702: 703: \ And here's finally the ANS standard stuff 704:17: \G @var{Definer} is a unique identifier for the way the @var{xt} 718: \G was defined. Words defined with different @code{does>}-codes 719: \G have different definers. The definer can be used for 720: \G comparison and in @code{definer!}.
https://www.complang.tuwien.ac.at/cvsweb/cgi-bin/cvsweb/gforth/glocals.fs?f=h;only_with_tag=MAIN;ln=1;content-type=text%2Fx-cvsweb-markup;rev=1.66
CC-MAIN-2022-21
refinedweb
1,700
68.5
The following is a example of defining a function in Python. def fib(n): """This prints n terms of a sequence where each term is the sum of previous two, starting with terms 1 and 1.""" result=[];a=1;b=1 for i in range(n): result.append(b) a,b=b,a+b; result.insert(0,1) del result[-1] return result print fib(6) The string immediately following the function definition is the function's documentation. Note the use of 「.insert」 to insert 1 at the beginning of a list, and 「del result[-1]」 to remove the last element in a list. The unusual syntax of 「a.insert()」 is what's known as Object Oriented syntax style. Try writing a factorial function. Here's a line-by-line equivalent Perl version: =pod fib(n) prints n terms of a sequence where each term is the sum of previous two, starting with terms 1 and 1. =cut use strict; sub fib($) { my $n= $_[0]; my @result; my ($a, $b); @result=();$a=1;$b=1; for my $i (1..$n){ push @result, $b; ($a,$b)=($b,$a+$b); } unshift @result, 1; pop @result; return @result; } use Data::Dumper; print Dumper [fib(5)]; The 「=pod」 and 「=cut」 is Perl's way of demarking inline documentation called POD. Note: the empty line around it is necessary, at least in Perl version up to 5.6 (in wide use around ≈2002). perldoc perlpod The 「use strict;」 is to make Perl's loose syntax stricter thru compiler enforcement. Its use is encouraged by Perl gurus, but not all standard packages use it. If you declare 「use strict;」, then you need to declare your variables. Example: 「my $n;」. perldoc strict The $ in fib($) is there to declare that fib has a parameter of one scalar. Its use is however optional and uncommon. It is used for clarity but has also met with controversy by Perl gurus as being unperl. perldoc perlsub The 「$_[0]」 is the first element of the array 「@_」. The 「@_」 array is a predefined array. It's values are the arguments passed to subroutine. The last line 「[fib(5)]」, is basically to make it a memory address of a copy of the list returned by fib(5). This is needed because the function 「Dumper」 takes a reference.
http://xahlee.info/perl-python/function_def2.html
CC-MAIN-2013-20
refinedweb
387
75.5
I admit I’ve always been a big fan of the In A Nutshell book series from O’Reilly. The latest edition of XML In A Nutshell meets my expectations by providing a concise, informative XML reference for any developer’s desk. One word of caution is necessary: The book is not geared toward the XML novice—it is a reference to be used by those familiar with the technology. There is a plethora (books, Internet resources, etc.) available for learning XML and related technologies. Accessible content The book’s size (9 by 6 inches) and approximately 600 pages offer a relatively compact package. One of my pet peeves is a computer book so large you need a forklift to carry it. The size makes it easy to thumb through, and the pages are tabbed (black boxes), so information is easy to locate. Additionally, the table of contents and index are indispensable avenues to easily locate the required technical details. Organization The book includes four sections: - XML Concepts—This section covers the fundamental technologies that form the core of XML. This includes XML, DTDs, namespaces, and Unicode. Brief introductions and examples are provided. - Narrative-Centric Documents—The second section covers the technologies used for narrative or presentation. These include XSLT, CSS, Xpath, and RDDL. The book is not a comprehensive guide to either, but each initiative is explained with corresponding examples. - Data-Centric XML—The biggest area of XML adoption is working with data. This section focuses on the technologies available for working with XML data. The Simple API for XML (SAX), Document Object Model (DOM), and XML Schemas dominate this section. - Reference—The book closes with an extensive reference section. A quick reference is provided for the technologies covered in the book, including XML 1.0, DTDs, schemas, XSLT, and SAX. Although these specifications are in a state of flux, the reference is great to have at your fingertips. The bulk of the book is devoted to the reference section (300-plus pages), but this is the appeal of the Nutshell series of books. A developer in the heat of a project can easily locate the necessary technical details to keep moving forward. XML is changing, so why bother? It is true that XML and related technologies are in a constant state of change, so the information in the book can quickly become dated. On the other hand, the core aspect of the technologies remains constant, so the book will always be useful. Additionally, the products supporting XML cannot keep up with every new development. Consequently, the book’s information is more reliable than first imagined. A valuable asset I have already stated my bias, but I love XML In A Nutshell. The second edition covers the newer technologies like XSL-FO, XHTML, and Xlink. The wealth of information available in one location is a valuable addition to any developer’s toolbox. As an example, I was recently working on a project involving XML Schemas. I am still developing my schema knowledge; so my mind gets stuck in the DTD mode of think at times. I was banging my head with a schema syntax problem when I looked at my bookshelf where XML In A Nutshell offered a lifeline. I grabbed the book, easily located the Schema reference section (black page tabs), and quickly found the information (variable types) necessary to remove the obstacle. Many developers are quick to point out that an Internet search could easily find the answer, but I disagree the answer would be found as quickly. I find Internet searches often consume more time than anticipated, and they often lead to tangential browsing, a real waste of time. A worthy investment Experienced developers working with XML should add this book to their bookshelf as a valuable investment that will repay in time saved and knowledge gained. On the flip side, all XML newbies should steer clear until gaining a better understanding of the technologies involved.
http://www.techrepublic.com/article/everything-xml-at-your-fingertips/1044757/
CC-MAIN-2017-26
refinedweb
660
55.13
A pointer is a special kind of variable. Pointers are designed for storing memory address i.e. the address of another variable. Declaring a pointer is the same as declaring a normal variable except you stick an asterisk '*' in front of the variables identifier. There are two new operators you will need to know to work with pointers. The "address of" operator '&' and the "dereferencing" operator '*'. Both are prefix unary operators. When you place an ampersand in front of a variable you will get it's address, this can be stored in a pointer vairable. When you place an asterisk in front of a pointer you will get the value at the memory address pointed to. Here is an example to understand what I have stated above. #include <stdio.h> int main() { int my_variable = 6, other_variable = 10; int *my_pointer; printf("the address of my_variable is : %p\n", &my_variable); printf("the address of other_variable is : %p\n", &other_variable); my_pointer = &my_variable; printf("\nafter \"my_pointer = &my_variable\":\n"); printf("\tthe value of my_pointer is %p\n", my_pointer); printf("\tthe value at that address is %d\n", *my_pointer); my_pointer = &other_variable; printf("\nafter \"my_pointer = &other_variable\":\n"); printf("\tthe value of my_pointer is %p\n", my_pointer); printf("\tthe value at that address is %d\n", *my_pointer); return 0; } This will produce following result. the address of my_variable is : 0xbfffdac4 the address of other_variable is : 0xbfffdac0 after "my_pointer = &my_variable": the value of my_pointer is 0xbfffdac4 the value at that address is 6 after "my_pointer = &other_variable": the value of my_pointer is 0xbfffdac0 the value at that address is 10. For example: char *y; char x[100]; y is of type pointer to character (although it doesn't yet point anywhere). We can make y point to an element of x by either of y = &x[0]; y = x; Since x is the address of x[0] this is legal and consistent. Now `*y' gives x[0]. More importantly notice the following: *(y+1) gives x[1] *(y+i) gives x[i] and the sequence y = &x[0]; y++; leaves y pointing at x[1]. C is one of the few languages that allows pointer arithmetic. In other words, you actually move the pointer reference by an arithmetic operation. For example: int x = 5, *ip = &x; ip++; On a typical 32-bit machine, *ip would be pointing to 5 after initialization. But ip++; increments the pointer 32-bits or 4-bytes. So whatever was in the next 4-bytes, *ip would be pointing at it. Pointer arithmetic is very useful when dealing with arrays, because arrays and pointers share a special relationship in C. Arrays occupy consecutive memory slots in the computer's memory. This is where pointer arithmetic comes in handy - if you create a pointer to the first element, incrementing it one step will make it point to the next element. #include <stdio.h> int main() { int *ptr; int arrayInts[10] = {1,2,3,4,5,6,7,8,9,10}; ptr = arrayInts; /* ptr = &arrayInts[0]; is also fine */ printf("The pointer is pointing to the first "); printf("array element, which is %d.\n", *ptr); printf("Let's increment it.....\n"); ptr++; printf("Now it should point to the next element,"); printf(" which is %d.\n", *ptr); printf("But suppose we point to the 3rd and 4th: %d %d.\n", *(ptr+1),*(ptr+2)); ptr+=2; printf("Now skip the next 4 to point to the 8th: %d.\n", *(ptr+=4)); ptr--; printf("Did I miss out my lucky number %d?!\n", *(ptr++)); printf("Back to the 8th it is then..... %d.\n", *ptr); return 0; } This will produce following result: The pointer is pointing to the first array element, which is 1. Let's increment it..... Now it should point to the next element, which is 2. But suppose we point to the 3rd and 4th: 3 4. Now skip the next 4 to point to the 8th: 8. Did I miss out my lucky number 7?! Back to the 8th it is then..... 8. See more examples on Pointers and Array const int * const ip; /* The pointer *ip is const and it points at is also cont */ int * const ip; /* The pointer *ip is const */ const int * ip; /* What *ip is pointing at is const */ int * ip; /* Nothing is const */ As you can see, you must be careful when specifying the const qualifier when using pointers. You know how to access the value pointed to using the dereference operator, but you can also modify the content of variables. To achieve this, put the dereferenced pointer on the left of the assignment operator, as shown in this example, which uses an array: #include <stdio.h> int main() { char *ptr; char arrayChars[8] = {'F','r','i','e','n','d','s','\0'}; ptr = arrayChars; printf("The array reads %s.\n", arrayChars); printf("Let's change it..... "); *ptr = 'f'; /* ptr points to the first element */ printf(" now it reads %s.\n", arrayChars); printf("The 3rd character of the array is %c.\n", *(ptr+=2)); printf("Let's change it again..... "); *(ptr - 1) = ' '; printf("Now it reads %s.\n", arrayChars); return 0; } The array reads Friends. Let's change it..... now it reads friends. The 3rd character of the array is i. Let's change it again..... Now it reads f iends. When. Try the following code to understand Generic Pointers. #include <stdio.h> int main() { int i; char c; void *the_data; i = 6; c = 'a'; the_data = &i; printf("the_data points to the integer value %d\n", *(int*) the_data); the_data = &c; printf("the_data now points to the character %c\n", *(char*) the_data); return 0; } NOTE-1 : Here in first print statement, the_data is prefixed by *(int*). This is called type casting in C language.Type is used to caste a variable from one data type to another datatype to make it compatible to the lvalue. NOTE-2 : lvalue is something which is used to left side of a statement and in which we can assign some value. A constant can't be an lvalue because we can not assign any value in contact. For example x = y, here x is lvalue and y is rvalue. However, above example will produce following result: the_data points to the integer value 6 the_data now points to the character a
http://www.tutorialspoint.com/cgi-bin/printversion.cgi?tutorial=ansi_c&file=c_pointing_data.htm
CC-MAIN-2014-15
refinedweb
1,045
64.2
Ultimate guide for Data Exploration in Python using NumPy, Matplotlib and Pandas Introduction Exploring data sets and developing deep understanding about the data is one of the most important skills every data scientist should possess. People estimate that the time spent on these activities can go as high as 80% of the project time in some cases. Python has been gaining a lot of ground as preferred tool for data scientists lately, and for the right reasons. Ease of learning, powerful libraries with integration of C/C++, production readiness and integration with web stack are some of the main reasons for this move lately. In this guide, I will use NumPy, Matplotlib, Seaborn, and Pandas to perform data exploration.. In case you missed it, I would suggest you to refer to the baby steps series of Python to understand the basics of python programming. - Learning Python for data analysis – with instructions on installation and creating the environment - Libraries and data structures - Exploratory analysis in Python (using Pandas) - Data Munging in Python (using Pandas) Contents – Data Exploration Here are the operations I’ll cover in this article (Refer to this article for similar operations in SAS): How to remove duplicate values of a variable? How to group variables to calculate count, average, sum? How to recognize and treat missing values and outliers? How to merge / join data set or dataframes effectively in Pandas? Part 1: How to load data file(s) using Pandas? Input data sets can be in various formats (.XLS, .TXT, .CSV, JSON ). In Python, it is easy to load data from any source, due to its simple syntax and availability of predefined libraries, such as Pandas. Here I will make use of Pandas itself. Pandas features a number of functions for reading tabular data as a Pandas DataFrame object. Below are the common functions that can be used to read data (including read_csv in Pandas): Code import pandas as pd #Import Library Pandas df = pd.read_csv("E:/train.csv") #I am working in Windows environment #Reading the dataset in a dataframe using Pandas print df.head(3) #Print first three observations Output Code df=pd.read_excel("E:/EMP.xlsx", "Data") # Load Data sheet of excel file EMP Output print df Code: df=pd.read_csv("E:/Test.txt",sep='\t') # Load Data from text file having tab '\t' delimeter print df Part 2: How to convert a variable to a different data type? Converting a variable data type to others is an important and common procedure we perform after loading data. Let’s look at some of the commands to perform these conversions: Convert numeric variables to string variables and vice versa srting_outcome = str(numeric_input) #Converts numeric_input to string_outcome integer_outcome = int(string_input) #Converts string_input to integer_outcome float_outcome = float(string_input) #Converts string_input to integer_outcome The later operations are especially useful when you input value from user using raw_input(). By default, the values are read at string. Convert character date to Date: There are multiple ways to do this. The simplest would be to use the datetime library and strptime function. Here is the code: from datetime import datetime char_date = 'Apr 1 2015 1:20 PM' #creating example character date date_obj = datetime.strptime(char_date, '%b %d %Y %I:%M%p') print date_obj Part 3: How to transpose a Data set or dataframe using Pandas? Here, I want to transpose Table A into Table B on the variable Product. This task can be accomplished by using Pandas dataframe.pivot: Code #Transposing Pandas dataframe by a variable df=pd.read_excel("E:/transpose.xlsx", "Sheet1") # Load Data sheet of excel file EMP print df result= df.pivot(index= 'ID', columns='Product', values='Sales') result Output Part 4: How to sort a Pandas DataFrame? Sorting of data can be done using dataframe.sort(). It can be based on multiple variables and ascending or descending both orders. Code #Sorting Pandas Dataframe df=pd.read_excel("E:/transpose.xlsx", "Sheet1") #Add by variable name(s) to sort print df.sort(['Product','Sales'], ascending=[True, False]) Above, we have a table with variables ID, Product and Sales. Now, we want to sort it by Product and Sales (in descending order) as shown in table 2. Part 5: How to create plots (Histogram, Scatter, Box Plot)? Data visualization always helps to understand the data easily. Python has libraries like matplotlib and seaborn to create multiple graphs effectively. Let’s look at the some of the visualizations to understand below behavior of variable(s) . - The distribution of age - Relation between age and sales; and - If sales are normally distributed or not? Histogram: Code #Plot Histogram import matplotlib.pyplot as plt import pandas as pd df=pd.read_excel("E:/First.xlsx", "Sheet1") .hist(df['Age'],bins = 5) #Labels and Tit plt.title('Age distribution') plt.xlabel('Age') plt.ylabel('#Employee') plt.show() Output Scatter plot: Code .scatter(df['Age'],df['Sales']) #Labels and Tit plt.title('Sales and Age distribution') plt.xlabel('Age') plt.ylabel('Sales') plt.show() Output Box-plot: Code import seaborn as sns sns.boxplot(df['Age']) sns.despine() Output Part 6: How to generate frequency tables with Pandas? Frequency Tables can be used to understand the distribution of a categorical variable or n categorical variables using frequency tables. Code import pandas as pd df=pd.read_excel("E:/First.xlsx", "Sheet1") print df test= df.groupby(['Gender','BMI']) test.size() Output Part 7: How to do sample Data set in Python? To select sample of a data set, we will use library numpy and random. Sampling of data set always helps to understand data quickly. Let’s say, from EMP table, I want to select random sample of 5 employees. Code #Create Sample dataframe import numpy as np import pandas as pd from random import sample # create random index rindex = np.array(sample(xrange(len(df)), 5)) # get 5 random rows from the dataframe df dfr = df.ix[rindex] print dfr Output Part 8: How to remove duplicate values of a variable in a Pandas Dataframe? Often, we encounter duplicate observations. To tackle this in Python, we can use dataframe.drop_duplicates(). Code #Remove Duplicate Values based on values of variables "Gender" and "BMI" rem_dup=df.drop_duplicates(['Gender', 'BMI']) print rem_dup Output Part 9: How to group variables in Pandas to calculate count, average, sum? To understand the count, average and sum of variable, I would suggest you use dataframe.describe() with Pandas groupby(). Let’s look at the code: Code test= df.groupby(['Gender']) test.describe() Output Part 10: How to recognize and Treat missing values and outliers in Pandas? To identify missing values , we can use dataframe.isnull(). You can also refer article “Data Munging in Python (using Pandas)“, here we have done a case study to recognize and treat missing and outlier values. Code # Identify missing values of dataframe df.isnull() Output To treat missing values, there are various imputation methods available. You can refer these articles for methods to detect Outlier and Missing values. Imputation methods for both missing and outlier values are almost similar. Here we will discuss general case imputation methods to replace missing values. Let’s do it using an example: #Example to impute missing values in Age by the mean import numpy as np meanAge = np.mean(df.Age) #Using numpy mean function to calculate the mean value df.Age = df.Age.fillna(meanAge) #replacing missing values in the DataFrame Part 11: How to merge / join data sets and Pandas dataframes? Joining / merging is one of the common operation required to integrate datasets from different sources. They can be handled effectively in Pandas using merge function: Code: df_new = pd.merge(df1, df2, how = 'inner', left_index = True, right_index = True) # merges df1 and df2 on index # By changing how = 'outer', you can do outer join. # Similarly how = 'left' will do a left join # You can also specify the columns to join instead of indexes, which are used by default. End Notes: In this comprehensive guide, we looked at the Python codes for various steps in data exploration and munging. We also looked at the python libraries like Pandas, Numpy, Matplotlib and Seaborn to perform these steps. In next article, I will reveal the codes to perform these steps in R. Also See: If you have any doubts pertaining to Python, feel free to discuss with us. Did you find the article useful? Do let us know your thoughts about this guide in the comments section below. Leave a Reply Your email address will not be published. Required fields are marked *
https://www.analyticsvidhya.com/blog/2015/04/comprehensive-guide-data-exploration-sas-using-python-numpy-scipy-matplotlib-pandas/
CC-MAIN-2022-21
refinedweb
1,416
57.16
).Google Merchant Center Namespace Declaration The following namespace declaration is required in order to use attributes defined only in the Google Merchant Center namespace.xmlns:g="" In addition to declaring the Google Merchant Center namespace, you must also include a prefix within every attribute tag. We add this prefix to attributes to distinguish attributes defined in our namespace from elements defined in Atom 1.0. The prefix selected for this namespace declaration is "g":<g:image_link></g:image_link> Attributes in the Google Merchant Center namespace must include this prefix or the attributes, and any values they contain, will be ignored. Attributes You can use as many relevant attributes as are specific to your in your feed. Section 2: Important Checklist Before you submit your feed, we highly recommend running through the following list to help ensure your file is properly formatted: - Your filename must end with the .xml extension. - The feed filename you register in your Google Merchant Center account must match the name you assign to your file. - Remember to include namespace declarations. These values should match exactly as shown. - Google Merchant Center namespace: xmlns:g="". - Custom attributes namespace: xmlns:[prefix]="", where [prefix] is replaced by the prefix you've included in your file. - - Verify the prefix included in the Google Merchant Center and Custom Google Merchant Center attribute tags matches the prefix defined in the namespace declaration. - Remove attributes that do not contain any values. Section 3: Final note The.
https://support.google.com/merchants/answer/160593?hl=en
CC-MAIN-2018-43
refinedweb
242
54.63
nerdtronn. nerdtronn When you exit the script and swipe over to the console you’ll see the full output. nerdtronn Found the below thread with the solution. Just need to add @ui.in_background above the scene method definition! nerdtronn Having trouble editing the post on mobile, but note there is the below line before getting loc1. Missed that when posting. location.start_updates() nerdtronn) nerdtronn? nerdtronn Thanks for the replies! Will dig into these and see what I can get working. nerdtronn I’d like to periodically issue an HTTP request to a URL which will return a result via JSON. This is in a scene based script. So I’d like to do it async so the scene updating doesn’t stop while the request is waiting. I’m new to async in python. I found asyncio and I see pythonista includes that. Many examples also use aiohttp which does not appear to be included in pythonista. Can anyone point me to a simple example of using asyncio only to do this which will work in a scene based script? nerdtronn Thanks for the replies! After reading them a few times and experimenting I think I'm understanding it now. To create and position a rect using paths, I'm creating it with ui.Path.rect() and just giving 0,0 for the position with the desired size. Then I'm setting the position property to locate the center where I want it. Seems to be working, thanks for the help! nerdtronn I’m trying to draw a box in the center of the screen using the below. The box is drawn centered about the origin (lower left corner of the screen). It doesn’t seem to respect the x and y values I’m giving it. I’m sure I’m missing something obvious :). Can anyone point me in the right direction? import scene as sc import ui class MyScene (sc.Scene): def setup(s): s.background_color = 'blue' s.bdr = sc.ShapeNode() s.bdr.fill_color = (0,0,0,0) s.bdr.stroke_color = 'yellow' cx = s.size.width cy = s.size.height s.bdr.path = ui.Path.rect(cx / 2, cy / 2, 100, 100) s.bdr.line_width = 3 s.add_child(s.bdr) sc.run(MyScene())
https://forum.omz-software.com/user/nerdtronn
CC-MAIN-2021-49
refinedweb
375
78.85
May 25, 2009 07:30 AM|LINK You will have to use a update button for that May 25, 2009 07:40 AM|LINK By the given button of that gridview? How? May 25, 2009 07:59 AM|LINK As same in that article I have given earlier May 25, 2009 08:06 AM|LINK Sorry for that I really did not have the definite ideas for automatically calling one event from the code-behind after having carefully checked your postings. I only need the way to automatically fire/trigger one event in the code-behind from the gridview. May 25, 2009 08:40 AM|LINK What do you mean automatically? If there's a button user clicks on it the event will be called May 25, 2009 08:48 AM|LINK But the buttons, like 'Edit'/'Update', come together with the Gridview, and are not defined by us. How to add event for that? How do we know which object ID it is? Could you pls answer me why the above event could not be fired? If that was fired, why is there no help by giving the parameters? May 25, 2009 09:20 AM|LINK For that there's a GridView editing event have a look here this will surely clear all your doubts I donot have ready code other wise I would have given it May 25, 2009 09:32 AM|LINK Many thanks Mak. The article does talk about the Rowupdating/RowDeleting events of the gridview. But simply, why won't the following event be fired and then give any help by providing the parameters, for the Gridview? (ds_my_det is just the name of the gridview) Very very sorry for being unable to close this issue for long time. using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.IO; using System.Text; using System.Data.SqlClient; using System.Configuration; using System.Data.OracleClient; namespace Newst { public partial class my_det : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void ds_my_det_RowUpdating(object sender, EventArgs e) { LinkButton lnk = (LinkButton)sender; GridViewRow curr_row = (GridViewRow)lnk.Parent.Parent; ds_my_det.InsertParameters.Clear(); ds_my_det.InsertParameters.Add("title", curr_row.Cells[0].Text); ds_my_det.InsertParameters.Add("start_dt", curr_row.Cells[1].Text); ds_my_det.Insert(); } } } I only expect to see that the event is being called and the parameters there will be further used for the gridview. May 25, 2009 10:45 AM|LINK I'll suggest do what suggested in that article or download and use its code You may be missing something that's why your code is not called Also you need to rebind the GridView after edit and updates So that it reflects the changes May 26, 2009 08:07 AM|LINK Many many thanks, Mak and good day. You can take your time and tell me once you've got any good news for the outstanding issue here. 60 replies Last post May 27, 2009 09:25 AM by mudassarkhan
http://forums.asp.net/t/1425152.aspx/5/10?Re+Cannot+convert+type+System+Web+UI+Control+to+
CC-MAIN-2013-20
refinedweb
506
64.71
08 June 2005 04:48 [Source: ICIS news] ?xml:namespace> The official said it was waiting for approval from its joint venture partners, Sumitomo Chemical and Nippon Shokubai, before proceeding with construction work. He added that the new plant would use Sumitomo’s C4 technology. The investment cost for the project is estimated at Won50bn ($49.7m/Euro40.4m). It is scheduled to start up in April 2008. CNI's sister publication Asian Chemical News (ACN) reported in November 2004 that the company was considering building an MMA plant in Daesan. The official said the location had been changed to Yeochun because the company wanted the new plant to be closer to its existing plants. The new plant would be the company’s third MMA facility. LG currently operates two MMA plants with a capacity of 50,000 tonne/year each at Yeochun. LG’s 50,000 tonne/year optical-grade poly-MMA (PMMA) project at Yeochun is on schedule to come onstream on 1 July this year, added the official. Optical-grade MMA is used in the production of liquid crystal display (LCD) panels. LG MMA is 50% owned by LG Corp, 25% by Sumitomo Chemical and 25% owned by Nippon Shokub.
http://www.icis.com/Articles/2005/06/09/683937/s+koreas+lg+mma+seeking+approval+for+new+yeochun+mma.html
CC-MAIN-2013-20
refinedweb
203
64.1
A wrapper for boto3 paginators to iterate per resource Project description BBP - Better Boto Paginator The boto3 module has pagination functionality. So if you're trying to enumerate a long list of resources, the paginator will provides an easier way to fetch chunk after chunk of the resource list, compared to raw list_ calls. The problem with how the module exposes these pages is that you end up with a list of lists. For example, to get a list of all objects within an S3 bucket, you can do: import boto3 client = boto3.client('s3') paginator = client.get_paginator('list_objects_v2') objects = [p['Contents'] for p in paginator.paginate(Bucket='my-bucket')] This returns a list of lists of object information. Do you remember off the top of your head how to flatten a list of lists into one list? I sure don't. Yes I could have a for loop and append to a list each iteration, but that feels like more effort than should be required. Even if you're not loading the whole resource list into a list in memory, and are instead processing within a for loop, you end up with a messy nested for loop. for page in paginator.paginate(Bucket='my-bucket'): if ['Contents'] in page: for element in page['Contents']: process(element) I find this a bit awkward. What I really want is: for element in function(Bucket='my-bucket'): process(element) Where function is smart enough to either return the next item on the page it already has in memory, or fetch the next page with a new API call and return the first item of that. This library provides that function. Installation pip install bbp Usage Here's an example of how to use it for the Lambda ListFunctions paginator. from wrapper import paginator from pprint import pprint for lam in paginator('lambda', 'list_functions', 'Functions'): pprint(lam) # process just one element at a time lambdais what you would pass to boto3.client() list_functionsis what you would pass to client.get_paginator() Functionsis the key within the response to list_objects_v2which contains the list of resources for each page. This varies for each type of pagination call. You have to look up the documentation. Eventually I'll try to get this tool to lookup/remember that. Here's another example, using the S3 ListObjectsV2 paginator. In this example we need to pass in the bucket name as an extra argument. Just specify this as a name=value pair at the end of the argument list. for obj in paginator('s3', 'list_objects_v2', 'Contents', Bucket='mybucket'): pprint(obj) # process a single resource s3is what you would pass to boto3.client() list_objects_v2is what you would pass to client.get_paginator() Bucket='mybucket'and any other name=valuearguments are what get passed to the paginator. Packaging This is my first ever package on PyPI. I used this guide to learn how to do this. Project details Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
https://pypi.org/project/bbp/
CC-MAIN-2021-04
refinedweb
506
56.66
One of the most useful things you can do in JavaScript is check to make sure that a form is filled in properly. Checking form contents before submission saves server processor cycles as well as the user’s time waiting for the network round trip to see if the proper data has been entered into the form. This section provides an overview of some common techniques for form validation. The first issue to consider with form validation is when to catch form fill-in errors. There are three possible choices: Before they happen (prevent them from happening) As they happen After they happen Generally, forms tend to be validated after input has occurred, just before submission. Typically, a set of validation functions in the form’s onsubmit event handler is responsible for the validation. If a field contains invalid data, a message is displayed and submission is canceled by returning false from the handler. If the fields are valid, the handler returns true and submission continues normally. Consider the brief example here that performs a simple check to make sure that a field is not empty: <<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">> <<html>> <<head>> <<title>>Overly Simplistic Form Validation<</title>> <<meta http-> <<script type="text/javascript">> <<!-- function validate() { if (document.myform.username.value == "") { alert("Username is required"); return false; } return true; } //-->> <</script>> <</head>> <<body>> <<form name="myform" id="myform" method="get" action="" onsubmit="return validate();">> Username: <<input type="text" name="username" id="username" size="30" />> <<input type="submit" value="submit" />> <</form>> <</body>> <</html>> The previous example suffers from numerous deficiencies. First off, it really doesn’t check the field well. A single space is acceptable using this validation. Second, it is not terribly abstract in that the validation function works with only the username field in that document; it can’t be applied to a generic field. Last, the validation doesn’t bring the field that is in error into focus. A better example correcting all these deficiencies is presented here: <<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">> <<html>> <<head>> <<title>>Better Form Validation<</title>> <<meta http-> <<script type="text/javascript">> <<!-- // Define whitespace characters var> Username: <<input type="text" name="username" id="username" size="30" maxlength="60" />> <<br />> Password: <<input type="password" name="userpass" id="userpass" size="8" maxlength="8" />> <<br />> <<input type="submit" value="Submit" />> <</form>> <</body>> <</html>> The previous example illustrated how writing generic input validation routines can be useful. Instead of having to recode the same or similar field checking functions for each form on your site, you can write a library of validation functions that can be easily inserted into your pages. In order to be reusable, such functions should not be hardcoded with form and field names. The validation functions should not pull the data to be validated out of the form by name; rather, the data should be passed into the function for checking. This allows you to drop your functions into any page and apply them to a form using only a bit of event handler “glue” that passes them the appropriate fields. Form checking functions should go beyond checking that fields are non-empty. Common checks include making sure a field is a number, is a number in some range, is a number of some form (such as a U.S. ZIP code or Social Security number), is only a range of certain characters like just alpha characters, and whether input is something that at least looks like an e-mail address or a credit card number. Many of the checks, particularly the e-mail address and credit card number checks, are not really robust. Just because an e-mail address looks valid doesn’t mean it is. We’ll present e-mail and numeric checks here as a demonstration of common validation routines in action. Many forms are used to collect e-mail addresses, and it is nice to ferret out any problems with addresses before submission. Unfortunately, it is difficult to guarantee that addresses are even in a valid form. In general, about the best you can say quickly about an e-mail address is that it is of the form userid@domain, where userid is a string and domain is a string containing a dot. The “real” rules for what constitutes a valid e-mail address are actually quite complicated, and take into consideration outdated mail addressing formats, IP addresses, and other corner cases. Because of the wide variation in e-mail address formats, many validation routines generally look simply for something of the form string@string. If you want to be extremely precise, it is even possible not to have a dot (.) on the right side of an e-mail! The function here checks the field passed in to see if it looks like a valid e-mail address. function isEmail(field) { var positionOfAt; var s = field.value; if (isEmpty(s)) { alert("Email may not be empty"); field.focus(); return false; } positionOfAt = s.indexOf('@',1); if ( (positionOfAt == -1) || (positionOfAt == (s.length-1)) ) { alert("E-mail not in valid form!"); field.focus(); return false; } return true; } We can write this more elegantly using a regular expression: function isEmail(field) { var s = field.value; if (isEmpty(s)) { alert("Email may not be empty"); field.focus(); return false; } if (/[^@]+@[^@]+/.test(s)) return true; alert("E-mail not in valid form!"); field.focus(); return false; } The regular expression above should be read as “one or more non-@ characters followed by an @ followed by one or more non-@ characters.” Clearly, we can be more restrictive than this in our check if we like. For example, using /[^@]+@(\w+\.)+\w+/ does a better job. It matches strings with characters (e.g., “john”) followed by an @, followed by one or more sequences of word characters followed by dots (e.g., “mail.yahoo.”) followed by word characters (e.g., “com”). Checking numbers isn’t terribly difficult either. You can look for digits and you can even detect if a passed number is within some allowed range. The routines here show a way of doing just that: function isDigit(c) { return ((c >>= "0") && (c << "9")) // Regular expression version: // return /^\d$/.test(c); } Since the isDigit() routine is so simple, the regular expression version isn’t much better. But consider this more complicated example: function isInteger(s) { var i=0, c; if (isEmpty(s)) return false; if (s.charAt(i) == "-") i++; for (i = 0; i << s.length; i++) { // Check if all characters are numbers c = s.charAt(i); if (!isDigit(c)) return false; } return true; } The regular expression version is far more elegant: function isInteger(s) { return /^-?\d+$/.test(s); } The regexp used should be read, “at the very beginning of the string is an optional negative sign followed by one or more digits up to the end of the string.” Since regular expressions are only useful for pattern matching, they are of limited value in some situations: function isIntegerInRange (s,min,max) { if (isEmpty(s)) return false; if (!isInteger(s)) return false; var num = parseInt (s); return ((num >>= min) && (num << max)); } The last question is how these routines can be easily added in to work with any form. There are many ways to do this. In the next example we use an array holding the names of the fields and the type of validation required.You would then loop through the array and apply the appropriate validation routine, as shown here: <<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">> <<html>> <<head>> <<title>>Generic Form Check Demo<</title>> <<meta http-> <<script type="text/javascript">> <<!-- var validations = new Array(); // Define which validations to perform. Each array item // holds the form field to validate, and the validation // to be applied. This is the only part you need to // customize in order to use the script in a new page! validations[0]=["document.myform.username", "notblank"]; validations[1]=["document.myform.useremail", "validemail"]; validations[2]=["document.myform.favoritenumber", "isnumber"]; // Customize above array when used with a new page. function isEmpty(s) { if (s == null || s.length == 0) return true; // The test returns true if there is at least one non- // whitespace, meaning the string is not empty. If the // test returns true, the string is empty. return !/\S/.test(s); } function looksLikeEmail(field) { var s = field.value; if (isEmpty(s)) { alert("Email may not be empty"); field.focus(); return false; } if (/[^@]+@\w+/.test(s)) return true; alert("E-mail not in valid form."); field.focus(); return false; } function isInteger(field) { var s = field.value; if (isEmpty(s)) { alert("Field cannot be empty"); field.focus(); return false; } if (!(/^-?\d+$/.test(s))) { alert("Field must contain only digits"); field.focus(); return false; } return true; } function validate() { var i; var checkToMake; var field; for (i = 0; i << validations.length; i++) { field = eval(validations[i][0]); checkToMake = validations[i][1]; switch (checkToMake) { case 'notblank': if (isEmpty(field.value)) { alert("Field may not be empty"); field.focus(); return false; } break; case 'validemail': if (!looksLikeEmail(field)) return false; break; case 'isnumber': if (!isInteger(field)) return false; } } return true; } //-->> <</script>> <</head>> <<body>> <<form name="myform" id="myform" method="get" action="" onsubmit="return validate();">> Username: <<input type="text" name="username" id="username" size="30" maxlength="60" />> <<br />> Email: <<input type="text" name="useremail" id="useremail" size="30" maxlength="90" />> <<br />> Favorite number: <<input type="text" name="favoritenumber" id="favoritenumber" size="10" maxlength="10" />> <<br />> <<input type="submit" value="submit" />> <</form>> <</body>> <</html>> The nice thing about this approach is that it’s easy to add these validation routines to just about any page. Just place the script in the page, customize the validations[] array to hold the form fields you wish to validate and the string to indicate the validation to perform, and finally add the call to validate() as the onsubmit handler for your form. Separating the mechanism of validation (the checking functions) from the policy (which fields to check for what) leads to reusability and decreased maintenance costs in the long run. An even more elegant possibility is to use hidden form fields and (believe it or not) routines that are even more generic than those we just saw. For example, you might define pairs of fields like this: <<input type="hidden" name="fieldname_check" value="validationroutine">> <<input type="hidden" name="fieldname_errormsg" value="msg to the user if validation fails">> You would define hidden form fields for each entry to validate, so to check that a field called username is not blank, you might use <<input type="hidden" name="username_check" value="notblank">> <<input type="hidden" name="username_errormsg" value="A username must be provided">> To check for an e-mail address, you might use <<input type="hidden" name="email_check" value="validEmail">> <<input type="hidden" name="email_errormsg" value="A valid email address must be provided">> You would then write a loop to look through forms being submitted for hidden fields and to look for ones in the form of fieldname_check. When you find one, you could use string routines to parse out the field name and the check to run on it. If the check fails, you can easily find the associated error message to show by accessing the field fieldname_errormsg. Regardless of the method you choose, it should be clear that the approach is useful as it allows you to separate out reused JavaScript validation functions into .js files and reference from just about any form pages. However, before setting out on the task to roll your own validation routines, consider the number of people who already have needed to do the same thing. Code is out on the Web already, so it makes sense to start with a library when making your validation code. For example, take a look at for some sample scripts. Netscape has provided a form validation collection of code ever since JavaScript 1.0 and also provides regular expression-oriented checks as well. There is no reason you need to wait for the form to be submitted in order to validate its fields. You can validate a field immediately after the user has modified it by using an onchange event handler. For example: <<script type="text/javascript">> <<!-- function validateZip(zip) { if (/\d{5}(-\d{4})?/.test(zip)) return true; alert("Zip code must be of form NNNNN or NNNNN-NNNN"); return false; } // -->> <</script>> ... <<form action="#" method="get">> <<input type="text" name="zipcode" id="zipcode" onchange="return validateZip(this.value);" />> ...other fields... <</form>> The validateZip() function is invoked when the ZIP code field loses focus after the user changed it. If the ZIP code isn’t valid, the handler returns false, causing the default action (blurring of the field) to be canceled. The user must enter a valid ZIP code before they will be able to give focus to another field on the page. Preventing the user from giving focus to another field until the most recently modified field is correct is questionable from a usability standpoint. Often, users might want to enter partial information and then come back to complete the field later. Or they might begin entering data into a field by mistake, and then realize they don’t want any data to go in that field after all. Having the focus of input “trapped” in one form field can be frustrating for the user. For this reason, it is best avoided. Instead, alert the user to the error, but return true from the onchange handler anyway allowing them to move along in the form. We’ve seen how to catch errors at submission time and right after they occur, but what about preventing them in the first place? JavaScript makes it possible to limit the type of data that is entered into a field as it is typed. This technique catches and prevents errors as they happen. The following script could be used in browsers that support a modern event model (as discussed in Chapter 11). It forces the field to accept only numeric characters by checking each character as it is entered in an onkeypress handler: <<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">> <<html>> <<head>> <<title>>Numbers-Only Field Mask Demo<</title>> <<meta http-> <<script type="text/JavaScript">> <<!-- function isNumberInput(field, event) { var key, keyChar; if (window.event) key = window.event.keyCode; else if (event) key = event.which; else return true; // Check for special characters like backspace if (key == null || key == 0 || key == 8 || key == 13 || key == 27) return true; // Check to see if it's a number keyChar = String.fromCharCode(key); if (/\d/.test(keyChar)) { window.> Robot Serial Number: <<input type="text" name="serialnumber" id="serialnumber" size="10" maxlength="10" onkeypress="return isNumberInput(this, event);" title="Serial number contains only digits" />> <</form>> <</body>> <</html>> In this script, we detect the key as it is pressed and look to see if we will allow it or not. We could easily vary this script to accept only letters or even convert letters from lower- to uppercase as they are typed. The benefit of masking a field is obviously that it avoids having to do heavy validation later on by trying to stop errors before they happen. Of course, you need to let users know that this is happening, by both clearly labeling fields and using advisory text (and even giving an error message, as we did by setting the window status message). You might consider using an alert dialog or putting an error message into the form, but that might be too obtrusive. Form validation is really a great use of JavaScript, but sometimes it is misused or poorly applied. This section outlines some general principles you can apply to your validation strategy. Be helpful. Client-side validation should be used to assist the user in entering data correctly. As such, it should interact with the user in ways that are helpful. For example, if the user enters invalid data, include the format data was expected to be in your error message. Similarly, use script to correct common mistakes when you can. For example, it’s simple to use JavaScript to automatically reformat phone numbers of the form NNN-NNN-NNNN to (NNN) NNN-NNNN. Don’t be annoying. We’ve used alert()s to inform users of invalid inputs for the sake of illustration. However, alert()s have to be dismissed before the user can correct their data, and users might forget which fields were in error. Instead, consider showing the error message somewhere in the page itself. Use HTML features instead of JavaScript whenever possible. Rather than using JavaScript to validate the length of a field, use maxlength. Instead of checking a date, provide a pull-down of the possible dates so as to avoid bad entries. The same could be done for typing in state codes or other established items. Show all the errors at once. Many people prefer to see all the errors at once, so you could collect each individual error string into an error message and display them all together. Catch errors early. Waiting until submission is not the best time to catch errors. Some developers will opt instead to catch errors when fields are left using the onblur or onchange handler. Unfortunately, onblur doesn’t always work as planned because you may get into an endless event loop. If you do use blur and focus triggers, make sure to manage events, including killing their bubble (as discussed in Chapter 11). If in doubt, be more permissive rather than more restrictive. There’s nothing more frustrating than trying to enter information you know is valid only to have it rejected because the page’s developer isn’t aware of all the possible inputs. Remember: JavaScript form validation is to be used to help the user find mistakes, not to enforce policy. A final observation that escapes many developers is that you always need to validate form fields at the server. Client-side validation is not a substitute for server-side validation; it’s a performance and usability improvement because it reduces the number of times the server must reject input. Always remember that users can always turn off JavaScript in their browser or save a page to disk and edit it manually before submission. This is a serious security concern and JavaScript developers would be mistaken to think their validation routines will keep the determined from injecting bad data into their Web application.
http://www.yaldex.com/javascript_tutorial_2/LiB0111.html
CC-MAIN-2016-50
refinedweb
3,057
54.63
Creating Custom Content Blocks: Wordpress Gutenberg vs. Sanity.io Knut Melvær Dec 7 '18 ・4 min read Wordpress 5.0 comes with a brand new rich text editor called Gutenberg. It is highly anticipated and has created both buzz and controversy. The promise of Gutenberg is customizability, especially when it comes to adding custom content blocks. If you want to get started with Gutenberg, you can read this excellent introduction in Smashing Magazine. It is built in React and allow developers to extend the editors basic functionality. Custom testimonial block type in Wordpress Gutenberg. Published on smashingmagazine.com We couldn't resist though. Since having custom content blocks is in the DNA of Sanity, we wanted to show how easy it is to recreate the testimonials slider that the 12 min read, and 10 part article introduces you to. Like an eleventh of the time easier. 🐇 Of course, the comparison only goes so far. Wordpress is a classic CMS with a template engine, whereas you can use Sanity as a headless CMS with the frontend framework you would prefer, be it Vue, React or something else. If you haven't tried Sanity yet, it only takes two minutes to get started. To create a project and get an instant real-time hosted content API, and the connected open sourced editor locally, run this line in your terminal: npm install -g @sanity/cli && sanity init If you choose the blog template in the CLI tool, you're pretty much set to go! The testimonial slider content model In the tutorial on Smashing Magazine, you learn to make a "testimonial slider" – typically used on marketing pages as a way to visualize social proof for your product. To re-create the Wordpress testimonial slider for Sanity you only need to define its content model. We'll take care of the input fields, and the real-time syncing to the datastore. The content model is pretty straightforward: First, we make the type for a testimonialSlider. It's an object, with an array (which also holds the order of the testimonials) of testimonial objects with the fields author, image, content, and link to the source. I made the content field be clean text, but we could also have used blockContent if we wanted to have rich text (and a slider within a slider, in case you are into recursive content patterns). If we add options: { hotspot: true } to the image field, your editor can even set custom hotspots and crops for the image, which may be useful for image art direction. const testimonialSlider = { name: 'testimonialSlider', title: 'Testimonial slider', type: 'object', fields: [ { name: 'slider', title: 'Slider', type: 'array', of: [ { name: 'testimonial', title: 'Testimonial', type: 'object', fields: [ { name: 'author', title: 'Author', type: 'string' }, { name: 'image', title: 'Image', type: 'image' }, { name: 'content', title: 'Content', type: 'text' }, { name: 'link', title: 'Link', type: 'url' } ] } ] } ] } const blockContent = { name: 'blockContent', type: 'array', of: [ { type: 'block' }, { type: 'testimonialSlider' } ] } export default { testimonialSlider, blockContent } That's pretty much it. The user interface will be clean and can be used right away. To get that nice prepared JSON-structure for your frontend, you can use this GROQ query, assuming that your rich text is named content and used in the document type *[_type == "post"]{ ..., content[]{ ..., _type == "testimonialSlider" => { slider[]{ ..., image{ ..., asset-> } } } } } Custom preview component You can also add a custom preview component with some React code: import React from 'react' import client from 'part:@sanity/base/client' import urlBuilder from '@sanity/image-url' const urlFor = source => urlBuilder(client).image(source) const sliderPreview = ({ value = {} }) => { return ( <marquee> {value && value.slider.map(slide => ( <div key={slide._key} style={{ display: 'inline-block', marginRight: '1em' }} > <figure> <img src={urlFor(slide.image) .width(50) .url()} style={{ marginRight: '0.5em' }} /> <span className="legend"> “<em>{slide.content}</em>”<br /> {slide.author} – {slide.link} </span> </figure> </div> ))} </marquee> ) } export default sliderPreview Include it in your schema by adding this to your testimonialSlider content type schema: import React from 'react' import sliderPreview from './sliderPreview.js' const testimonialSlider = { name: 'testimonialSlider', title: 'Testimonial slider', type: 'object', preview: { select: { slider: 'slider' }, component: sliderPreview }, fields: [ /* the fields */ ] } Here I've used the good old HTML element <marquee> to get a scrolling effect; you probably shouldn't do the same: Beyond appearances: The advantage of deeply typed rich text content This testimonial slider example tightly ties to a specific presentation on a webpage, which makes sense in WordPress because it's built to render and manage a website. WordPress saves the input in Gutenberg as HTML, which is what you eventually also get out of the APIs. HTML in content APIs is generally not what you want if you want to use it in your favorite frontend framework, or in something that should render in something other than a web browser. Sanity saves the content in the editor as Portable Text, which makes it portable across any markup, but also makes rich text queryable. It should be easy to create custom editorial experiences, with the custom types and inputs that makes sense in your project or organization, and it should be easy to take that content and fit it to whatever form of presentation. (open source and free forever ❤️) Stickers Contest!!🐶😍🤓 Something that we must have in our laptops are stickers. Who has de best collection?
https://dev.to/sanity-io/creating-custom-content-blocks-wordpress-gutenberg-vs-sanityio-4k5m
CC-MAIN-2019-09
refinedweb
874
51.38
On Sun, Aug 31, 2003 at 09:34:46AM -0700, Justin Erenkrantz wrote: > >Nope :) DNS servers don't even understand IPv4 addresses in that > >sense, you can't query a DNS server saying "give me the reverse > >of this IPv4 addresss", your resolver has to turn 209.237.227.195 > >into 195.227.237.209.in-addr.arpa for anything to happen. In the > >case of IPv6 there are two reverse zones it should be asking for, > >so for 2001:770:18:2:260:CFFF:FE20:F45C it should be asking for; > > Okay, now I know why IPv6 will never take off. This is total lameness. What do mean never take off ? It's taken off, it's here, in production! I could go on at length about this comment .. more seriously though, it might be time daedalus was acessible over IPv6 (imo). Just using 6to4 until a native feed could arrive. > Okay, I took your patch and added some autoconf-fu to try to detect this > case. The patch for sockaddr.c is great, works fine. The autoconf-fu needs some tweaks to work/compile :) ; Index: configure.in =================================================================== RCS file: /home/cvspublic/apr/configure.in,v retrieving revision 1.534 diff -u -r1.534 configure.in --- configure.in 31 Aug 2003 16:28:54 -0000 1.534 +++ configure.in 31 Aug 2003 17:44:13 -0000 @@ -894,6 +894,7 @@ APR_FLAG_HEADERS( alloca.h \ + assert.h \ ByteOrder.h \ conio.h \ crypt.h \ Index: build/apr_network.m4 =================================================================== RCS file: /home/cvspublic/apr/build/apr_network.m4,v retrieving revision 1.20 diff -u -r1.20 apr_network.m4 --- build/apr_network.m4 31 Aug 2003 16:28:55 -0000 1.20 +++ build/apr_network.m4 31 Aug 2003 17:44:16 -0000 @@ -164,6 +164,9 @@ #ifdef HAVE_NETINET_IN_H #include <netinet/in.h> #endif +#ifdef HAVE_ASSERT_H +#include <assert.h> +#endif void main(void) { struct sockaddr_in6 sa = {0}; @@ -180,7 +183,7 @@ addr32 = (unsigned int *)&sa.sin6_addr; addr32[2] = htonl(0x0000FFFF); addr32[3] = ipv4.s_addr; - assert(IN6_IS_ADDR_V4MAPPED(&sin6.sin6_addr)); + assert(IN6_IS_ADDR_V4MAPPED(&sa.sin6_addr)); #ifdef SIN6_LEN sa.sin_len = sizeof(sa); -- Colm MacCárthaigh Public Key: colm+pgp@stdlib.net colm@stdlib.net
http://mail-archives.apache.org/mod_mbox/apr-dev/200308.mbox/%3C20030831174651.GA22785@castlerea.stdlib.net.%3E
CC-MAIN-2015-14
refinedweb
353
71.21
I'm the lead on Santa Tracker. Yes, I know it's June right now—pretty much as far from the holidays as you can get. 💼 I want to talk about Web Components. A quick refresher: these are Custom Elements which might use Shadow DOM, allowing elements of your own name that have their own CSS, styling and DOM contained within them: <div> <my-custom-element></my-custom-element> <p>Mixed with regular HTML!</p> </div> Polymer Away 👋 One of the reasons we're updating Santa's core UI to remove the Polymer Web Component library is because Polymer is sticky. Polymer only really works when all the other elements it interacts with are also Polymer: anything it touches also needs to work the same way. This isn't extensible and doesn't give us room to move in the future. Sites like WebComponents.org, released at the height of Google's evangelism for Polymer, proclaim #UseThePlatform, but I suspect the majority of elements there are sticky in this same way. Smooth Elements 😎 One of the main reasons we're rewriting the core UI of Santa Tracker using lit-element is because unlike Polymer, Lit is not sticky. It's just a helper library that can be used interchangeably with any other element on your page. 🤝 So in doing our rewrite of Santa Tracker, we've found that many elements just don't need to inherit from anything aside the built-in HTMLElement class, because they're only simple building blocks. We call these 'vanilla' elements. 🍨 Lit aside, there's a huge variety of small or large Web Component libraries out there that act as helpers. My good IRL friend Trey writes SkateJS, and just searching the #webcomponents tag on dev.to reveals a bunch of candidates too. 🔎 Of course, you probably shouldn't ship several different libraries: that's just sensible, to save bytes and not overly complicate your code. But if you use Lit one day, but rewrite using Skate on another (with a smattering of vanilla too), you can safely have those libraries co-exist during a migration so your site is never unusable. 🤗 An Example 🔥 For completeness, let's show off what an element looks like in Lit: class SimpleGreeting extends LitElement { static get properties() { return { name: { type: String } }; } constructor() { super(); this.name = 'World'; } render() { return html`<p>Hello, ${this.name}!</p>`; } } customElements.define('simple-greeting', SimpleGreeting); Easy, right? SkateJS has a similar, easy, getting started sample. 🛹 Vanilla Example 🍦 And what a simple element might look like without any libraries, using just the platform: class SantaChoiceElement extends HTMLElement { constructor() { super(); const template = Object.assign(document.createElement('template'), { innerHTML: ` <style>/* CSS here */</style> <div class="wrap"> <!-- more HTML --> </div> `, }); // polyfill for CSS in Shadow DOM if (self.ShadyCSS) { self.ShadyCSS.prepareTemplate(template, 'santa-choice'); } this.attachShadow({mode: 'open'}); this.shadowRoot.appendChild(document.importNode(template.content, true)); } } customElements.define('santa-choice', SantaChoiceElement); And this code is only as complex as it looks (with the polyfill for Shady CSS) for the ~10% of users who don't support Shadow DOM. Lit is including this "for free". 🆓 As an aside; <santa-choice> is an element I'm really proud of that drives the chooser thing at the bottom of Elf Maker 🧝. I'd like to write how it works some day soon. Thanks! I hope this has enlightened you a bit about WCs (Web Components). For me, the absolute insightful moment was when I realised that the benefit of using Lit, or other libraries, was that it was not all-in: they play nicely with any other part of the ecosystem and you can use as little or as much of it as you like. 👍 16 👋 Top comments (17) I love the idea of using built-in components that can be used anywhere but when trying to dive deeper into web components I found there to be a bit of friction in using it to create an app. There seemed to be a number of different ways to approach using web components: I want to like web components, but there are some things holding me back. I stopped pursuing them for now because it seemed like using a framework such as Vue was easier to be productive with and a better choice for me. I'm open to any opposing viewpoints. Any suggestions for someone like me? WCs are just another platform primitive. I don't think they're intended to be part of something called "Create Lit App". I appreciate that this might be what you want. For all of the criticism of say, the thousands of dependencies needed by Create React App, I appreciate that it's an easy way to start. If anything, WCs lend themselves to the idea of modern ES6 bundling. I'm not necessarily endorsing the Pika package manager, but it has an interesting writeup on its vision. This is effectively the "no-build" system- you just import './element-name.js, and use <element-name>inside your code. That <element-name>you've created can now be used inside any modern "create foo" or "starter kit". It's just important to remember that WCs aren't really targeting that high level on their own. I hope that helps. Good point on the dependencies, I was definitely shocked when I npm installed lit-element and saw one folder in node_modules. There is definitely a lot of developer convenience in those types of up-and-running tools, but there is a cost passed on to the user. I have heard of Pika before and I like their vision. It brings me back to the old days before all of the "necessary" tooling. I think it makes sense from a viewpoint of web components being reusable things and not part of a larger library or ecosystem. I think for me it is deciding really how I want to use them since they are basic building blocks. I could write LitElement components and create a basic router (or pull in an existing library) but there may not be a roadmap to follow and some hurdles to jump over. Or I could use a library I like such as Vue and pull in web components, I'm sure there is some documentation out there but there also may be some things to figure out. Those components are then freed from any one library and can be used in my next Vue app, React app, or [next big library] app, which seems like a good deal. I think this is sort of the vision, although I don't want to speak for those frameworks (I suspect they're generally on the no-WC-bandwagon). But again, it doesn't matter, because now you've just created a better HTML element that slots in nicely—it's no difference from a complex built-in. I invite you to try Atomico, it's simpler than the exposed libraries,eg: Atomico 3kB is based on virtual-dom, HoCs and hooks. It has a small router and deferred charges(dinamic import), eg: I hope I have covered the essentials. start simple npm init @atomico We love Web Components, not custom apis. ;-) github.com/w3c/webcomponents No thanks, WC api is unfriendly and complex, current class-based implementations generate too much repetitive code and tie tightly to this. instead, with my proposal you can better separate the logic from the view and avoid things like this. microsoft code. The right is part of the code that shows how inelegant it can be to solve a state problem using classes. Indifferent to eg, if I believe that sometimes you need solutions like Atomico if your WC is simple PWA Starter Kit does have multiple templates so you can choose versions with less stuff included by default. Thanks for posting this. At my company we've recently migrated away from the all-in nature of Polymer and moved to LitElement where needed. It's amazing and even easier then Polymer because it's even closer to standard Web Components. I think blog posts like this are really great because it shows people how easy Web Components can be and hopefully gets people thinking about using them more and maybe making their life easier with a small helper library like Skatejs, Lit, or hyperHTML 👏 I'm a fan of the web components, I would like to know your appreciation of a simpler approach to creation, based on JSX, HoC, virtual-dom and Hooks, 3kB. Atomico is a personal project made with love You mention that Polymer is "sticky" and likes to only work with other Polymer elements. Since Polymer 3 is built on LitElement, shouldn't it have the same base level of interoperability as LitElement? Or do you see Polymer 3 elements that somehow have functionality regressions over the base LitElement? Polymer 3 is a mostly mechanical migration of 2 to use ES modules. Polymer 2/3 both use the class-based method of inheriting from a base element, but they use Polymer-isms (such as the notify stuff) There's no real relation to Lit, aside some of the same authors. Great examples! ( s/HtmlElement/HTMLElement/g) whoops. Thanks 😄 I’m not sure why anyone would want to write vanilla code. The available standard API just isn’t enough (and probably never will be). Whether you choose to or not, the option is there because it's part of the platform. It doesn't hurt you, either in bytes or complexity, to do so. But the standard API is more complicated to use, is it not? Just rendering a static template requires you to call a bunch of APIs. I don’t even know if I’m supposed to try to memorize those patterns or just copy-paste the boilerplate code whenever I’m creating a new component. It’s much more complicated than say writing a template literal inside a renderfunction as with Lit. That’s why I said, I’m not sure why anyone would use (just) the standard API.
https://dev.to/samthor/modern-web-components-37hf
CC-MAIN-2022-40
refinedweb
1,676
61.67