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
Column Width Matching with Children - shahriar25 Hi. I want to create something like a contextmenu that is a Column and I want the delegate to be a Label and I want the column's width be the delegate's width that has the maximum width among the others. how can I do that? Hi, Doesn't QMenu already provide what you need for a contextual menu ? - shahriar25 Hi @SGaist I know that it does but I want to create my own and more importantly I want to know how to do that because I will need it elsewhere Why do you want to create your own ? You take a look a QMenu's sources. - shahriar25 Hi @SGaist I needed it to create something like a dialog I looked at the QMenu's source but it didn't help. but then I figured it out after some thinking: import QtQuick 2.7 import QtQuick.Controls 2.0 Rectangle { id: root clip: true color: "cyan" width: listView.width height: listView.height property color textColor: "black" property var items: [ "Open", "Save", "Exit" ] Label{ id: testLabel visible: false text: "test" } ListView{ id: listView width: 0 height: (testLabel.height*3/2)*count anchors.centerIn: parent model: items delegate: BaseButton{ id: base mainColor: root.color width: label.width+label.height/2 height: label.height*3/2 Label{ id: label anchors.centerIn: parent text: items[index] color: root.textColor } Component.onCompleted: listView.width = base.width>listView.width ? base.width:listView.width } } } Sorry, my bad, I somehow missed that you posted that on the QtQuick sub-forum.
https://forum.qt.io/topic/69509/column-width-matching-with-children/6
CC-MAIN-2019-04
refinedweb
259
67.35
Wiki Bonsai / FAQ Frequently Asked Questions (FAQ) - Frequently Asked Questions (FAQ) - What can I do if I get stuck? - Where is the Bonsai install folder? - Where can I find examples of Bonsai at work? - How do I get a camera working? - How do I set the image visualizer to display in full resolution? - How do I inspect individual pixel values in the image visualizer? - How do I write a Python transform node? - How do I write a Python image processing transform node? - How do I get an Open Ephys FPGA working? - How do I get Arduino sources and sinks working? What can I do if I get stuck? If this FAQ or the Wiki cannot help you, there is a public Bonsai users forum. Chances are someone has run into your problem before and the solution will be listed there. Otherwise, feel free to ask any questions or share ideas you've come across while using Bonsai. Where is the Bonsai install folder? You can pick the installation folder during setup. However, being a portable app, Bonsai installs by default into the user's AppData. Unfortunately this directory is hidden in Windows, which can make finding the Bonsai folder a bit tricky. You can find it by default at C:\Users\YOURUSER\AppData\Local\Bonsai. Where can I find examples of Bonsai at work? First install the Starter Pack package from the package manager. This package will install all the common dependencies for both image and signal processing. Example workflows can then be found in the Tools menu, under Bonsai Gallery. How do I get a camera working? In Bonsai, a camera shows up as a data source of images. Each camera has its own set of vendor-specific drivers that need to be installed in the system for it to operate correctly. In addition, because different drivers provide different application programming interfaces (APIs), Bonsai needs to know how to interface with each specific camera, before it will work correctly. It is common that a specific Bonsai module needs to be installed for each different vendor. There is a generic Bonsai camera node (CameraCapture) that will work with most webcams and simple DirectShow based devices. You can find it by installing the Vision package and then searching the Toolbox under Source / Vision / CameraCapture. How do I set the image visualizer to display in full resolution? Double-clicking anywhere inside the displayed image will set the visualizer window resolution to match the actual input size. How do I inspect individual pixel values in the image visualizer? Right-clicking anywhere inside the displayed image will toggle the visualizer status bar. The x- and y-coordinates of the mouse cursor in image space will be shown, as well as the BGRA values of the selected pixel (note: depending on the image color space, the order of the pixel components may change). How do I write a Python transform node? Bonsai allows writing new transform nodes directly in a workflow using Python, specifically its .NET variant, IronPython. The way to do this is by installing the Scripting package and then searching for Transform / Scripting / PythonTransform. Double-clicking on the transform node, a script editor should show up with the following contents: @returns(bool) def process(input): return True The process function is where the main transform code is to be written. This function will be called once for every input object arriving at the node. However, because Python is a dynamic interpreted language, the resulting data type of a Python function is not known. In order for Bonsai to know this, the decorator returns needs to be declared in order to specify the intended type of the result. The example shown specifies how to do it for the boolean (bool) data type. How do I write a Python image processing transform node? It is possible to write image processing scripts directly in IronPython transform nodes using OpenCV.NET. To do this, it is necessary to include a reference to OpenCV.NET as well as importing all relevant data types that will be used in the script. Available operators and data types for OpenCV.NET can be found in the NuDoq website. Below is an example of using the Canny edge detection operator in a Python transform: import clr clr.AddReference("OpenCV.Net") from OpenCV.Net import * @returns(IplImage) def process(input): output = IplImage(input.Size, IplDepth.U8, 1) CV.Canny(input, output, 128, 128) return output How do I get an Open Ephys FPGA working? Bonsai supports the Open Ephys and Intan's Rhythm interface for next-generation electrophysiology amplifiers. These devices operate off an FPGA acquisition board. To use it, you need to install the Ephys package, and then search the Toolbox under Source / Ephys / Rhd2000EvalBoard. You will need a specific bitfile for the acquisition card FPGA depending on the board you are trying to use (Intan or Open Ephys). You can find these bitfiles on the websites for each of the specific distributors. The output from the acquisition card is a complex data frame where you can select different outputs available at the board level (e.g. amplifiers, board ADCs, etc.). A member selector transform node can be used to access each of these individual outputs. You can create one by right-clicking on the data-source, accessing the Output drop-down and clicking on the desired output stream. Each data stream is represented as a multi-channel, multi-sample buffer similar to what you get out of a microphone data source. How do I get Arduino sources and sinks working? Arduino support in Bonsai makes use of the Firmata protocol over the serial port. In order to get it to work, one of the Firmata implementations needs to be uploaded to the microcontroller, which effectively turns the Arduino into a DAQ, streaming digital input pin changes and analog input (ADC) readings through the serial port and receiving commands to set digital outputs back. These implementations are included in the Arduino distribution, under Examples / Firmata. Make sure that the baud rate used in the Arduino matches the one that is configured in Bonsai (default is 57600 bps). Updated
https://bitbucket.org/horizongir/bonsai/wiki/FAQ
CC-MAIN-2018-26
refinedweb
1,026
57.16
Re: [PATCH] REGTESTS: replace "which" with POSIX "command" сб, 26 сент. 2020 г. в 13:14, Willy Tarreau : >. > Fedora docker also comes without "find" utility ## Gathering tests to run ## ./scripts/run-regtests.sh: line 131: find: command not found ## Starting vtest ## Testing with haproxy version: 2.3-dev5 No tests found that meet the required criteria [root@fbf7e85bfd94 haproxy]# echo $? 0 [root@fbf7e85bfd94 haproxy]# > > Willy > Re: [PATCH] REGTESTS: replace "which" with POSIX "command". Willy [PATCH] REGTESTS: replace "which" with POSIX "command" Hello, I've found that "socat" was not properly detected under Fedora docker image. (maybe we should introduce "set -e" as well) Cheers, Ilya Shipitcin From 0063a45f37c18f305ea3e1155c87e071ccce7600 Mon Sep 17 00:00:00 2001 From: Ilya Shipitsin Date: Sat, 26 Sep 2020 11:54:27 +0500 Subject: [PATCH] REGTESTS: use "command" instead of "which" for better POSIX compatibility for example, "which" is not installed by default in Fedora docker image. --- scripts/run-regtests.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/run-regtests.sh b/scripts/run-regtests.sh index af25a6075..7bcc394cf 100755 --- a/scripts/run-regtests.sh +++ b/scripts/run-regtests.sh @@ -191,8 +191,8 @@ _findtests() { done for requiredbin in $require_binaries; do - which $requiredbin >/dev/null 2>&1 - if [ "$?" -eq "1" ]; then + if ! command -v $requiredbin >/dev/null 2>&1 + then echo " Skip $i because '"$requiredbin"' is not installed" skiptest=1 fi -- 2.26.2 Re: [PATCH] REGTESTS: replace "which" with POSIX "command" On Sat, Sep 26, 2020, 1:39 PM Willy Tarreau wrote: >. > I'll try to rewrite "find" usage to fail if it's missing > Willy > listeners :-) (...) > All this description is probably a bit cryptic and it does not do Willy's > work justice. It was amazingly hard and painful to unmangle. But, it was a > mandatory step to add the QUIC support. The next changes to come in this > area are about the way listeners, receivers and proxies are started, > stopped, paused or resumed. I'm starting to see the end of the tunnel there (well just a little bit of light), as well as some stuff that will still cause some trouble but overall we're soon about to be able to declare a QUIC listener, with a stream protocol for the upper layers with datagram for the lower ones. This will also remove a lot of the ugly tricks that were needed for the log forwarder (such as the fake "bind" lines that silently ignore unknown keywords). Among the upcoming changes that I mentioned a while ago that I'd still like to see done before 2.3, there was: - setting log-send-hostname by default - enabling tune.fd.edge-triggered by default - changing the way "http-reuse safe" works for backend H2 connections to avoid mixing two clients over the same connection and avoid head of line blocking We're already at end of September, we must really finish quickly what's still in progress and think about stabilizing. I know we've been late on 2.2 but that didn't remove development time on 2.3 since all that was done before 2.2 was released is still there :-) So let's say that what is not merged in two weeks by 9th october will go to -next so that we still have a few weeks left to fix bugs, test and document. In addition I'd like that for 2.4 we further shorten the merge window, that's still far too long, as we spend most of the bug-fixing time after the release instead of before, which is counter-productive. So we'll need to have pending stuff in -next anyway. Cheers, Willy Re: [PATCH] REGTESTS: replace "which" with POSIX "command". Willy [PATCH 1/2] DOC: agent-check: fix typo in "fail" word expected reply `tcpcheck_agent_expect_reply` expects "fail" not "failed" This should fix github issue #876 This can be backported to all maintained versions (i.e >= 1.6) as of today. Signed-off-by: William Dauchy --- doc/configuration.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 309d076aa..97ff2e499 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -13073,7 +13073,7 @@ agent-check MAINT mode, thus it will not accept any new connections at all, and health checks will be stopped. - - The words "down", "failed", or "stopped", optionally followed by a + - The words "down", "fail", or "stopped", optionally followed by a description string after a sharp ('#'). All of these mark the server's operating state as DOWN, but since the word itself is reported on the stats page, the difference allows an administrator to know if the situation was -- 2.28.0 [PATCH 2/2] DOC: crt: advise to move away from cert bundle especially when starting to use `new ssl cert` runtime API, it might become a bit confusing for users to mix bundle and single cert, especially when it comes to use the commit command: e.g.: - start the process with `crt` loading a bundle - use `set ssl cert my_cert.pem.ecdsa`: API detects it as a replacement of a bundle. - `commit` has to be done on the bundle: `commit ssl cert my_cert.pem` however: - add a new cert: `new ssl cert my_cert.pem.rsa`: added as a single certificate - `commit` has to be done on the certificate: `commit ssl cert my_cert.pem.rsa` this should resolve github issue #872 this should probably be backported in >= v2.2 in order to encourage people to move away from bundle certificates loading. Signed-off-by: William Dauchy --- doc/configuration.txt | 7 ++- doc/management.txt| 4 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/doc/configuration.txt b/doc/configuration.txt index 97ff2e499..87f35e984 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -12560,10 +12560,15 @@ crt connecting with "ecdsa.example.com" will only be able to use ECDSA cipher suites. With BoringSSL and Openssl >= 1.1.1 multi-cert is natively supported, no need to bundle certificates. ECDSA certificate will be preferred if client - support it. + supports it. If a directory name is given as the argument, haproxy will automatically search and load bundled files in that directory. + It is however recommended to move away from bundle loading, especially if you + want to use the runtime API to load new certificate which does not support + bundle. A recommended way to migrate is to set `ssl-load-extra-file` + parameter to `none` in global config so that each certificate is loaded as a + single one. OSCP files (.ocsp) and issuer files (.issuer) are supported with multi-cert bundling. Each certificate can have its own .ocsp and .issuer file. At this diff --git a/doc/management.txt b/doc/management.txt index adbad95d3..42e8ddbca 100644 --- a/doc/management.txt +++ b/doc/management.txt @@ -1725,6 +1725,10 @@ new ssl cert Create a new empty SSL certificate store to be filled with a certificate and added to a directory or a crt-list. This command should be used in combination with "set ssl cert" and "add ssl crt-list". + Note that bundle certificates are not supported; it is recommended to use + `ssl-load-extra-file none` in global config to avoid loading certificates as + bundle and then mixing with single certificates in the runtime API. This will + avoid confusion, especailly when it comes to the `commit` command. prompt Toggle the prompt at the beginning of the line and enter or leave interactive -- 2.28.0 [PATCH] BUILD: makefile: Update feature flags for OpenBSD Update the OpenBSD target features being enabled. I updated the list of features after noticing "BUILD: makefile: disable threads by default on OpenBSD". The Makefile utilizing gcc(1) by default resulted in utilizing our legacy and obsolete compiler (GCC 4.2.1) instead of the proper system compiler (Clang), which does support TLS. With "BUILD: makefile: change default value of CC from gcc to cc" that is resolved. diff --git a/Makefile b/Makefile index 934ca1666..197126db5 100644 --- a/Makefile +++ b/Makefile @@ -377,10 +377,11 @@ ifeq ($(TARGET),osx) EXPORT_SYMBOL = -export_dynamic endif -# OpenBSD 5.7 and above +# OpenBSD 6.3 and above ifeq ($(TARGET),openbsd) set_target_defaults = $(call default_opts, \ -USE_POLL USE_TPROXY USE_KQUEUE USE_ACCEPT4) +USE_POLL USE_TPROXY USE_THREAD USE_KQUEUE USE_ACCEPT4 USE_CLOSEFROM \ +USE_GETADDRINFO) endif # NetBSD
https://www.mail-archive.com/search?l=haproxy%40formilux.org&q=date%3A20200926&f=1
CC-MAIN-2022-33
refinedweb
1,375
65.22
At ORCS Web, we’re using System Center Configuration Manager (SCCM) with Microsoft Deployment Toolkit (MDT) and have it set to deploy new images to physical or virtual hardware. Most everything works great, but the one thing I’ve wanted to get working is to add the Hyper-V Integration services to the Boot Image (WinPE in this case) so that 1) the regular Network Adapter (not the Legacy adapter) works and 2) there is mouse support right from the beginning.. I’ll set out to cover how to do that here. The following three links got me going in the right direction. However, it appears that the vmguest.iso file changed from when they wrote their blog posts until now, so I used different files then they did: Here are the key steps: Now you will be able to install an OS on a Hyper-V VM using the regular network adapter and mouse support. As a side, I hoped that I could use x64 boot media and install both x64 and x86 operating systems. That would save me from choosing between the images as long as the hardware supports x64. Unfortunately it didn’t appear to work. I ran into driver issues later in the install process. I’m not saying that someone else can’t get it figured. It may be possible to embed the x86 drivers into the x64 boot image, but I didn’t take it that far. What I did prove is that configuring the x86 and x64 images identically wouldn’t allow the x64 boot image to deploy an x86 OS. introduces 1-Click Publishing which, along with Web Deploy, makes some nice strides in this area. VS 2010 supports 4 methods of publishing content. They are: MSDeploy Publish, FTP, File System, FPSE. Let’s talk briefly about each:. The remainder of this blog post is a simple walkthrough on publishing using MSDeploy, which can be done over HTTPS, providing much better security than plain text FTP. The host or production servers need to support MSDeploy. Playground ORCS Web has worked with Microsoft to provide a testing account so that you can try out MSDeploy completely free of charge. This promotion is available for a few months starting in June 2009. Vishal Joshi has formally announced this plan also. If you want to try out the publish feature covered here, but don’t want to setup and configure a production server, sign up for one of these accounts. Publish Web Tool (using MSDeploy Publish) You can access the Publish Web Tool either by the top menu: Build –> Publish {project name} or from the Publish menu: Open the Publish Web tool to get started. The tool should look like this, but the fields will change with the different Publish Methods. We’ll just cover MSDeploy Publish here. If you don’t have the information from your host or server admin team, make sure to obtain that now. I’ll cover the fields and what they mean here:. Once you’ve filled out the fields, you can Publish immediately or Save so that you can publish later. If all is setup correctly, you can publish by clicking the Publish button, or from the 1-Click Publish button. The 1-Click Publish feature is literally that: after setup, when you make a change that you want to publish to the web, just click that one icon and it will take care of the deployment. In my opinion, the most impressive feature of MSDeploy is that it only publishes the changes between the source and destination location. If you have a 2GB site but only changed 2 files, when you click Publish, it will deploy only the changes, very rapidly. Additionally, from a network and server utilization perspective, MSDeploy is much faster and efficient than IIS FTP. Shortcoming – error reporting The biggest shortcoming that I find is regarding the error reporting when something goes wrong. VS 2010 doesn’t expose to you very much information about the errors. Most error information is available to the host administrator on the destination server. If you receive an error that isn’t clear, double check each of the fields. The most common failure is related simply to incorrect information. There’s more, but not here and now. Visual Studio’s Publish feature has a lot more. The two other most significant features are the Database Publishing and MSDeploy’s Transform feature so that your web.config settings can be changed as they are published. I’m not going to cover them here and no though, but I’ll provide some useful links below which cover all of these features in more detail. Links. The best walkthroughs and information on MSDeploy and Visual Studio’s 1-Click Publish feature likely comes from Vishal Joshi. He’s a program Manager with Microsoft for these technologies and is an authoritative source of information. Start with this blog post: Web 1-Click Publish with VS 2010 Brady Gaster, lead developer at ORCS Web, has also put together an excellent walkthrough on the same topic. And of course the ORCS Web VS 2010 Beta testing account offer is a useful link. Keep an eye open for more publishing tools and progress in the future. I believe we’re just at the beginning of great things to come. With Microsoft Visual Studio 2010 Beta 1 released and available as a free download, we at ORCS Web have joined with Microsoft to provide a free testing account so that you can see for yourself how the Publish feature works for remote publishing. As of today, you can setup a new account free of charge here. Note that this account is setup with ASP.NET 4.0 by default, which does not have a go-live license, so this account is for testing purposes only and cannot be used to host a production website. Visual Studio 2010 now supports Web Deployment (MSDeploy) which is an impressive new technology from Microsoft, allowing rapid deployment of websites. It’s fully secure since it runs over SSL, and yet it’s lightening fast. It only copies the changed files and only the necessarily files, making deployment a breeze. VS 2010 totes a single-click publish option now. Once you set it up, which is easy, you can deploy changes with one click. I’ll follow up with a walkthrough with more information later this week, but I wanted to mention our hosting offer today. We didn’t launch on the same day as Bing on purpose, but we can pretend that it’s all part of planned launch to keep up with the hype. :) Here’s the link to setup an account: Sometimes I want to place a shortcut or file on the desktop of a server and want all users of the server to see it. By default, if you save a file or folders to the desktop, it is placed on only your desktop. Prior to Vista/2008, you could manage this by copying or moving a file/folder directly to On Vista and Windows Server 2008, there are some changes to the structure. You may see the Documents and Settings folder, but if you double click on it, you will likely get an Access Denied error. Have no fear, you can still access the user data. Rather than using C:\Documents and Settings, the User data is in C:\Users now. C:\Documents and Settings is now just a redirect for legacy code. Actually, it’s not always on the C drive, but it usually is. You can see where your profile is by typing the following in the command prompt: The other gotcha comes with trying to access the shared desktop. Previously it was in the “%userprofile%\All Users\Desktop” folder. If you try to access that folder, you will likely get an Access Denied error there too. The issue isn’t with access here either. It’s that the folder has been renamed. Here’s the kicker. The new path to the shared desktop is now: Note: It is a hidden folder, so if you haven’t already, make sure to set windows explorer to show hidden folders. Additionally, you can redirect this folder or any of the user profile folders to another path or drive. This is easy to do. Simply right-click on the folder and select the Location tab. That’s all there is to keep in mind. Remember the new folder name and you should be set. Outlook is one of those programs that's easy to have a love-hate relationship with. It offers so much, but the earlier versions have been plagued with stability and performance issues. With the recent updates to Outlook 2007, stability has gotten substantially better. In fact, I don't remember Outlook crashing on me in months, which says a lot to the improvements that have been made. Performance on a tuned Outlook is very comfortable now too, so with the right love and care, Outlook 2007 can function very well for you. At the time of this writing, two performance upgrades to Outlook were recently released and are well worth installing. They are (cumulative update) and (hotfix). There are a bunch of exciting performance enhancements there. However, even with the latest of everything, Outlook got REALLY slow for me last week and needed some housekeeping. It was taking me 4 – 5 seconds to view each email, which for handling any amount of email in a day, is pretty much unusable. I’m sure there are many additional ways to improve performance in Outlook, but I thought I would explain the couple that helped me this weekend. First and foremost, any time I hear people complain about a slow Outlook, I always tell them to clean up their email and don’t store it all in their primary mailbox. Once they clean it up, it almost always returns to a good speed again. A bloated primary mailbox causes slow load times, slow running times and slow (or failed) shutdown. Additionally the search indexer works extra hard, causing the the entire computer to slow. I checked the size of my Outlook.ost file and it was over 9GB! Oops. Note that I use Exchange Server with caching enabled. You may have a PST as your primary mailbox. I used a 3-step approach to get my Outlook back in-line again. 1. Clean up the obvious folders There are many different ways to work with emails. I know that a lot of people like to delete their emails when they have finished reading them. I don’t work that way. I find that I go back to emails fairly often, so I keep pretty much all email except for spam or obvious junk. This causes my email count to climb at a fast rate, and years of email really adds up. I do, however, delete old email lists and newsletter emails since they are archived online or elsewhere. If you’re one of the people that delete your read email, this first step may simply be to get to Inbox zero and delete your emails in the process. For me, I create a “Saved” mailbox (PST file) and I drag and drop email older than a couple months there. I like to keep a couple months worth since I’m more likely to reference recent email, and it takes more effort to search for an email thread in my Saved mailbox than in my active mailbox. 2. Find the non-obvious folders This step is what really helped me this time. I thought I had all of my normally large folders taken care of, but it was still taking me 4 – 5 seconds to view each email. I knew something was up, so I used Outlook’s handy Mailbox Cleanup tool to find out what I was missing. You can access this from Tools –> Mailbox Cleanup… Mailbox Cleanup has a number of tools that come in handy for cleaning up your mailbox and speeding up Outlook. In this case, it was the View Mailbox Size tool that I used. I was in for 2 surprises after running this. The first: I came to find out that I have a lot of emails in my Deleted Items folder. I had just emptied that folder so I wasn’t expecting to find anything. It turns out that I deleted everything in the root of the Deleted Items folder, but I missed the little + showing that there were subfolders that I overlooked. Normally I delete using “Shift Delete” which bypasses the Deleted Items folder, but occasionally I don’t, and it looks like some folders I had deleted a long time ago were still sticking around. I didn’t save a screenshot, but it was the Folder Size tools in the screenshot above that gave me what I needed. The second surprise was the Sync folder. I had over 61,000 items in the Sync Issues/Conflicts folder! That was the greatest cause of performance issues. I did this over the weekend and I knew that I should be spending time with my family anyway, so I did a Select All on that folder (waited a long time) and then did a Shift Delete and left the laptop to do its stuff. A few hours later my laptop was available for use again. Performance still wasn’t resolved, so I had more work ahead. I had to ask myself why the Conflicts folder had grown like this. I don’t have it fully figured yet, but I found that part of it had to do with NOD32, my anti-virus program. It was touching the files on the way through and adding a signature to the files to say that they are scanned. That change caused Outlook to flag the message as a sync issue. I tweaked that setting and the new Conflicts are minimal now. I’ll continue to watch this and find out the cause for the rest. 3. Compact the mailboxes Even though the mailboxes were down to a reasonable size, the performance issue remained. Outlook still needed to compact the mailboxes to reclaim that space. The compact option is hidden away somewhat. You can get to it from Tools –> Accounts –> Data Files Here if you want to look at the file itself, select the mailbox name and click on Open Folder…. The Compact Now button is in the mailbox settings. For PST files, the button is on the first screen: Click on Compact Now and let it do it’s stuff. Note that if it’s taking a while and you want to use your computer again, you can safely cancel it at any time and it will continue next time where it left off. An exchange mailbox hides the Compact Now button even further. It’s in the Advanced tab –> Offline Folder File Settings … It took another few hours for the compact to complete for me. I may have been faster just deleting the mailbox and creating it again, but I let it do its thing and it went from the bloated 9GB down to around 1GB. If I really wanted, I could get it smaller, but with it performing very fast again, there was no need. That did it. My mouse clicks are measured in milliseconds now rather than seconds! Outlook really has improved over the years and when looked after properly, it can serve you well. If you haven't properly utilized. A few years ago I wrote about compression on IIS 6. With IIS 6, the Microsoft defaults were a long ways off of the optimum settings, and a number of changes were necessary before IIS Compression worked well. My goal here is to dig deep into IIS 7 compression and find out the impact that the various compression levels have, and to see how much adjusting is needed to finely tune a Windows web server. Note: If you don't care about all the details, jump right down to the conclusion. I've made sure to put the key review information there. To find out the bandwidth savings for the different compression levels, contrast them against the performance impact on the system and come up with a recommended configuration. IIS 6 allowed compression per extension type (i.e. aspx, html, txt, etc) and allowed it to be turned on and off per site, folder or file. Making changes wasn't easy to do, but it was possible with a bit of scripting or editing of the metabase file directly. IIS 7 changes this somewhat. Instead of compression per extension, it's per mime type. Additionally, it's easier to enable or disable compression per server/site/folder/file in IIS 7. It's configurable from IIS Manager, Appcmd.exe, web.config and all programming APIs. Additionally, IIS 7 gives the ability to have compression automatically stopped when the CPU on the server is above a set threshold. This means that when CPU is freely available, compression will be applied, but when CPU isn't available, it is temporarily disabled so that it won't overburden the server. Thanks IIS team! These settings are easily configurable, which I'll cover more in a future blog post. Both IIS6 and IIS7 allow 11 levels of compression (actually 'Off' and 10 levels of 'On'). The goal for this post is to compare the various levels and see the impact of each. The first thing I had to do was determine what tests I wanted to run, and how I could achieve them. I also wanted to ensure that I could clearly see the differences between the various levels. Here are some key objectives that I set for myself: I'll include the raw data at the bottom of the post for anyone that is interested. Let's take a look at the results. As shown in the graph here, the largest increase was between compression level 3 and 4. After that, the compression improvements were very gradual. However, if you check out the raw data below though, every level offered at least some incremental benefit. Here's a fun test I've always wanted to do, but never got around to it. I was curious how quickly a compressed vs. a non-compressed page would load under minimal server load. In other words, if there is plenty of CPU to spare, does a compressed page load at near line-speed? While both Time to First Byte (TTFB)--when the page starts to load--and Time to Last Byte (TTLB)--when the page finishes loading--are valuable, I felt that the TTFB gave the picture that I needed. As you can see, all but the 516kb came in at about 0 milliseconds, even compressed. Note that the 28kb and 4kb lines are hidden behind the 689 bytes line. Even the 516kb file came in at under 80ms. What's 80ms?? That's very low unless you have a really busy site. As far as I'm concerned from this data, even a 516kb file loads at line speed as long as the server isn't bogged down. Let's think about the 80ms a bit more. Dynamic pages, database calls and other factors play a much bigger role. Plus, the <80ms saves over 300kb on the page transfer, which is a savings of 2.34 seconds on a 1Mbps line! (Calculation based on: 300kbytes savings. A 1Mbps line will transfer 1024Kbps/8 = 128KB per second. 300/128KB/s = 2.34 seconds) All of the smaller pages load almost instantly, so the impression that the end user gets from a non-pegged server is going to be better with compression on. Note that my testing doesn't take Internet latency and limits into account. So, as long as the server can compress it at near line speed, it's going to benefit the site visitor all the more. The following two charts are from a second round of testing that I did, so the file sizes are different than in the previous test. In my first round of testing I found that the file size makes a huge difference. With anything under 100kb, the compression overhead is almost non-existent. However, once you have file sizes of a couple hundred kb or greater, the CPU overhead is significant. I ran the tests on 100kb, 200kb, 400kb and 800kb files. To put the size in perspective, I spent a good 10 minutes getting content from various sites to come up with 800kb of text. I used pages like this from Scott Guthrie's blog, and it still took multiple pages to collect 800kb of text. That particular page only has 145kb of text on it, but it's 440kb in size because of the HTML mark-up. So, a 400kb file isn't overly common (not many people have as many blog comments as Scott Gu), but it's certainly possible. To obtain a good CPU chart, I had to use some trickery. I wanted to create a test where I could hit the server as hard as a heavily utilized server is hit, but somehow keep non-compression related CPU to 0. I achieved this by using System.Threading.Thread.Sleep(125) in the pages. This sets a 125ms delay that doesn't use any CPU. Then I set the WCAT thread count to 30 per server (2 WCAT client computers). This became my baseline since, with these settings, the IIS server handled 120 Transactions/second. From looking at some busy production servers here at ORCS Web, I concluded that that was a reasonable level for a busy server. The CPU load without compression was nearly zero, so I was pleased with this test case. I found this the most interesting. Notice that each file size hit a sweet spot at a different compression level. For example, if you figure that your files are mostly 200kb and smaller, you may want to use Compression Level 4, which uses almost no CPU for a 200kb file. This is on a Quad Core server, targeting 120 transactions/second. As you can see, if you plan to have that level of traffic on your server, and your file sizes are into the hundreds of kilobytes, you may want to watch the compression utilization on the server. It may be using more resources that you realize. I don't think most people have much to worry about though as the average page size is less than 100kb, and the load on the average server is often much less than 120 transactions/second. I'll mention more in the conclusion, but it's worth briefly mentioning now that you should consider having different compression levels for static and dynamic content. Static content is compressed and cached, so it's only compressed once until the next time the file is changed. For that reason, you probably don't care too much about the CPU overhead and can go with a setting of 9. On the other hand, dynamic pages are compressed every time (for the most part, although further details on cached dynamic pages can be found here). So, the setting for the dynamic compression level is much more important to understand. This also lets us realize that it would be foolish to turn on compression just for the fun of it. Formats that don't compress much (or are already compressed) like JPG's, EXE's, ZIP's and the like, are often large and the CPU overhead to try to compress them further could be substantial. These aren't compressed by default in IIS 7. Just as a reminder, my goal was to start with 120 transactions/sec. The server could handle much more, but this was controlled so that 120 was considered the base. That was achieved with <1% CPU when non-compressed. Notice that 100kb and 200kb files can still be served up at nearly the same rate. Once you get to 800kb file sizes though, the server spends massive computing power to compress each page. Part of that isn't just compression related. Notice that even with compression turned off, IIS could only serve up 80 Transactions/sec using the same WCAT settings. However, the transacctions/sec drops off considerably with each compression level. So, what is my recommendation? Your mileage will vary, depending on the types of files that you serve up and how active your involvement in the server is. One great feature that IIS 7 offers is the CPU roll-off. When CPU gets beyond a certain level, IIS will stop compressing pages, and when it drops below a different level, it will start up again. This is controlled by the staticCompressionEnableCpuUsage and dynamicCompressionDisableCpuUsage attributes. That in itself offers a large safety net, protecting you from any surprises. Based on the data collected, the sweet spot seems to be compression level 4. It's between 3 and 4 that the compression benefit jumps, but it's between 4 and 5 that the resource usage jumps, making 4 a nice balance between ‘almost full compression levels' and ‘not quite as bad on resource usage'. Since static files are only compressed once until they are changed again, it's safe to leave them at the default level of 7, or even move it all the way to 9 if you want to compress every last bit out of it. Unless you have thousands of files that aren't individually called very often, I recommend the higher the better. For dynamic, there is a lot to consider. If you have a server that isn't CPU heavy, and you actively administer the server, then crank up the level as far as it will go. If you are worried that you'll forget about compression in the future when the server gets busier, and you want a safe setting that you can set and forget, then leave at the default of 0, or move to 4. Make sure that you don't compress non-compressible large files like JPG, GIF, EXE, ZIP. Their native format already compresses them, and the extra attempts to compress them will use up valuable system resources, for little or no benefit. Microsoft's default of 0 for dynamic and 7 for static is safe. Not only is it safe, it is aggressive enough to give you ‘most' of the benefit of compression with minimal system resource overhead. Don't forget that the default *does not* enable dynamic compression. My recommendation is, first and foremost, to make sure that you haven't forgotten to enable dynamic compression. In almost all cases it's well worth it, unless bandwidth is free for you and you run your servers very hot (on CPU). Since bandwidth is so much more expensive than CPU, moving forward I'll be suggesting 4 for dynamic and 9 for static to get the best balance of compression and system utilization. At this setting, I can set and forget for the most part, although when I run into a situation when a server runs hot, I'll be sure to experiment with compression turned off to see what impact compression has in that situation. Disclaimer: I've run these tests this last week and haven't fully burned in or tested these settings in production over time, so it's possible that my recommendation will change over time. Use the data above and use my recommendations at your own risk. That said, I feel comfortable with my recommendation for myself, if that means anything. Additionally, at ORCS Web, we've run both static and dynamic at level 9 for years and have never attributed compression as the culprit to heavy CPU on production servers. My test load of 120 transactions/sec is probably more than most production servers handle, so even 9 for both static and dynamic could be a safe setting in many situations. Here are some AppCmd.exe commands that you can use to make the changes, or to add to your build scripts. Just paste them into the command prompt and you're good to go. Watch for line breaks. Enable Dynamic Compression, and ensure Static compression at the server level: Alternately, apply for just a single site (make sure to update the site name): To set the compression level, run the following (this can only be applied at the server level): IIS 7 only sets GZip by default. If you use Deflate, run the previous command for Deflate too. Note that when changing the compression level, an IISReset is required for it to take effect. In case the raw data interests you, I've provided it here. Compression ratio CPU Usage per Compression Level Time to First Byte (TTFB) - minimal load. In milliseconds. Whether programmer or administrator, we're always looking for details on certain ASP.NET or IIS configuration settings, and sometimes we come up wanting because of lack of good documentation. The IIS team released an impressive IIS 7 reference a couple nights ago. You can find it here:. This is a reference definitely worth bookmarking. You can take every IIS configuration item, click on it on the side and be provided with detailed information written directly from the IIS team. Robert McMurray has worked hard to survey the product team directly to obtain a wealth of detailed information about every configuration setting, and Pete Harris and others have been hard at work helping make this happen. Along with most sections is a full description, info on where the setting lives, a full list of Attributes with description of each one, often setup information and configuration samples and code/command samples for appcmd, Microsoft.Web.Administration and AHAdmin code samples for .NET (C#, VB.NET), JavaScript or VBScript. I used it yesterday already to refresh my memory about responseMode for httpErrors:. Bill Staples announced it on his blog yesterday too. This reference is well worth bookmarking. It will come in handy. I work with web farms on a daily basis, and one of the requirements that I run into, for testing, troubleshooting and logging, is to tell which node is handling a specific request. To use a current example, at ORCS Web, we're testing Microsoft's new Application Request Routing Module (ARR) for performance, stability and features to see if it offers value along-side our other load balancing solutions. (Note: ARR is still in RC1 at the time of this writing) During testing, I want to be able to tell how ARR is distributing the load under different settings. Does a custom round robin setting really work as promised? Does the least current requests work? How can I tell and test? Etc, etc. One simple but important piece of information that I want to see over and over is which server node is being served. Without knowing the server name of the web node, it's just a guessing game, and the testing is pretty useless. Fortunately the solution is trivial in ASP.NET. There are multiple ways to do it, but two namespaces that expose the machine name are System.Environment and System.Web.HttpContext.Current.Server. To create a testing page that exposes the server name in VB.NET, create a file called CurrentNode.aspx with the following in it: Or, if you're using C#, the only difference is the ; (semi-colon) requirement on the end: That is literally all that I put in the file, or else I tack this on the bottom of an existing page. You'll notice that it's not valid HTML and nothing fancy, but no common browsers will complain, this is something that I can memorize and quickly type, and it's fully functional. The computer name is obtained by Windows on system boot-up by reading the registry value. I'm not aware of any differences in functionality, but you can use the following instead: Hit that page from the load balancer's IP (often called a VIP [virtual IP]) and you'll know which node is handling the request. This comes in useful for troubleshooting failures too. You may have users saying that they are receiving errors on your site, but you're unable to reproduce it consistently. Expose the server name in your error logging so that you know if it's something specific to particular nodes, or if it's global across all nodes. I:
http://weblogs.asp.net/owscott/default.aspx
crawl-002
refinedweb
5,435
71.04
Talbott12,134 Points Not sure why my code for the product challenge isn't working I can't figure out why I keep getting a bummer answer for this one. Could someone please give me a hint? def product(5, cats): return 5 * cats 2 Answers annecalija9,019 Points Hi Amy, When defining functions, arguments should be variables/placeholders instead of just plain value. def product(arg_1, arg_2): Reflect on: how will you be able to call the function if there's nowhere you can place it arguments? If you want to have a default value, to an argument, you can do: def product(cats, cat_food=5): That way you can call it either: >>> product(4,3) 12 or >>> product(4) 20 Hope this helps. Damien Watson27,419 Points Hi Amy, really close, you need to pass in two variables, not one and a number. It should work if you tweak it to be like this: def product(number_1, cats): return number_1 * cats
https://teamtreehouse.com/community/not-sure-why-my-code-for-the-product-challenge-isnt-working
CC-MAIN-2021-43
refinedweb
163
66.98
Regex.Replace Method (String, MatchEvaluator) In a specified input string, replaces all strings that match a specified regular expression with a string returned by a MatchEvaluator delegate. Assembly: System (in System.dll) Parameters - input - Type: System.String The string to search for. If the regular expression pattern is not matched in the current instance, the method returns the current instance unchanged. The Regex.Replace) method and passing each Match object in the returned MatchCollection collection to the evaluator delegate. The regular expression is the pattern defined by the constructor for the current Regex object.. The following code example displays an original string, matches each word in the original string, converts the first character of each match to uppercase, then displays the converted string. using System; using System.Text.RegularExpressions; class RegExSample { Ago] Available since 8 .NET Framework Available since 1.1 Portable Class Library Supported in: portable .NET platforms Silverlight Available since 2.0 Windows Phone Silverlight Available since 7.0 Windows Phone Available since 8.1
https://msdn.microsoft.com/en-us/library/cft8645c
CC-MAIN-2017-51
refinedweb
167
52.36
Path: - The ghost and player have the same point of origin. - The ghost must follow the exact same path as the player. - The ghost should move at the same speed as the player. - The ghost has to store the current time each time the player's motion changes. and exporting it for ActionScript with the class name Player. Now repeat the same process, except replace the name with ghost and the class with Ghost. Remove these MovieClips from the stage. Create your document class with the following code: package{ import flash.display.*; import flash.events.*; public class CreatingGhosts extends MovieClip{ public var player:Player = new Player(); public function CreatingGhosts(){ addChild(player); } } } Self explanatory; our next step will be to set up the Player class: package{ import flash.display.*; import flash.events.*; import flash.geom.Point; import flash.ui.Keyboard; import flash.utils.Timer; import flash.utils.getTimer; public class Player extends MovieClip{ public var startPos:Point; public var startTime:int; public var speed:Number = 2; public var currentLife:int; public var keyPressLeft:Boolean = false; public var keyPressRight:Boolean = false; public var keyPressUp:Boolean = false; public var keyPressDown:Boolean = false; public function Player(){ } } } The first three variables are used to help meet the rules; startPos is our point of origin, startTime is the time when the Player was added to the stage and speed is our our rate of movement. currentLife is an addition used to check how many times the player has died, accordingly each path is stored and obtainable through that value. The last four variables are used to check key presses. It's time to create the Ghost class: package{ import flash.display.*; import flash.events.*; import flash.geom.Point; import flash.utils.getTimer; import flash.utils.Timer; public class Ghost extends MovieClip{ static public var waypoints:Array = new Array(); static public var times:Array = new Array(); public var i:int = 0; public var startTime:int; public var speed:Number = 2; public var selectedLife:int; public function Ghost(){ } } } The two static variables, waypoints and times, will be used to store arrays; the first will store coordinates of the player's positions whenever the player changes motion, and the second will store the times at which each change occurred. The other variables match those from the Player class. Step 2: Initializing the Player Within the Player's constructor add the following line: addEventListener(Event.ADDED_TO_STAGE, init); Next create the init() function: public function init(e:Event){ } First, we need to obtain the startTime and push a new time array to the Ghost's times array. (This is a little confusing; the ghost has multiple time arrays to allow it to deal with multiple lives in the future.) startTime = flash.utils.getTimer(); Ghost.times.push(new Array); currentLife = Ghost.times.length - 1; Ghost.times[currentLife].push(flash.utils.getTimer() - startTime); startTime is set to the current time (a value in milliseconds); we add a new child array to the Ghost's times array; our currentLife is set to the index of this new array; and we push the time that has elapsed during this function to the first element of this new array. Now we set up the starting position: startPos = new Point(stage.stageWidth/2, stage.stageHeight/2); this.x = startPos.x; this.y = startPos.y; Ghost.waypoints.push(new Array); Ghost.waypoints[currentLife].push(startPos); Our point of origin is set to the center of the stage; we reposition our Player to the origin; a new array is added to the waypoints array: addEventListener(Event.ENTER_FRAME, enterFrame); stage.addEventListener(KeyboardEvent.KEY_DOWN, keyDown); stage.addEventListener(KeyboardEvent.KEY_UP, keyUp); Step 3: Key Events For now let's ignore the enterFrame and focus on the key presses. public function keyDown(e:KeyboardEvent){ if (e.keyCode == Keyboard.LEFT && keyPressLeft == false){ updateWaypoints(); keyPressLeft = true; }else if (e.keyCode == Keyboard.RIGHT && keyPressRight == false){ updateWaypoints(); keyPressRight = true; } if (e.keyCode == Keyboard.UP && keyPressUp == false){ updateWaypoints(); keyPressUp = true; }else if (e.keyCode == Keyboard.DOWN && keyPressDown == false){ updateWaypoints(); keyPressDown = true; } if (e.keyCode == Keyboard.SPACE){ destroy(); } }. public function keyUp(e:KeyboardEvent){ if (e.keyCode == Keyboard.LEFT && keyPressLeft == true){ updateWaypoints(); keyPressLeft = false; }else if (e.keyCode == Keyboard.RIGHT && keyPressRight == true){ updateWaypoints(); keyPressRight = false; } if (e.keyCode == Keyboard.UP && keyPressUp == true){ updateWaypoints(); keyPressUp = false; }else if (e.keyCode == Keyboard.DOWN && keyPressDown == true){ updateWaypoints(); keyPressDown = false; } }: public function updateWaypoints(){ Ghost.times[currentLife].push(flash.utils.getTimer() - startTime); Ghost.waypoints[currentLife].push(new Point(this.x, this.y)); } The destroy() function is just as simple! Waypoints are updated, a Ghost is added, event listeners are stopped and our Player is removed: public function destroy(){ updateWaypoints(); var ghost:Ghost = new Ghost(); parent.addChild(ghost); removeEventListener(Event.ENTER_FRAME, enterFrame); stage.removeEventListener(KeyboardEvent.KEY_DOWN, keyDown); stage.removeEventListener(KeyboardEvent.KEY_UP, keyUp); parent.removeChild(this); } Step 5: The Player's enterFrame Begin by creating the function: public function enterFrame(e:Event){ } For the purposes of this tutorial we will add some simple collision with borders, to show how the waypoints are updated on this change: if((this.x-(this.width/2)) > 0){ } if((this.x+(this.width/2)) < stage.stageWidth){ } if((this.y-(this.height/2)) > 0){ } if((this.y+(this.height/2)) < stage.stageHeight){ } Now are player should only move in the specified direction while it isn't touching a border. Inside the first if-statement add the following code for moving left: if(keyPressLeft == true){ if((this.x-(this.width/2)) <= 0){ updateWaypoints(); this.x = this.width/2; }else{ this.x -= speed; } }: if(keyPressRight == true){ if((this.x+(this.width/2)) >= stage.stageWidth){ updateWaypoints(); this.x = (stage.stageWidth - (this.width/2)); }else{ this.x += speed; } } if(keyPressUp == true){ if((this.y-(this.height/2)) <= 0){ updateWaypoints(); this.y = this.height/2; }else{ this.y -= speed; } } if(keyPressDown == true){ if((this.y+(this.height/2)) >= stage.stageHeight){ updateWaypoints(); this.y = (stage.stageHeight - (this.height/2)); }else{ this.y += speed; } } And with that we are finished with the Player Class! Step 6: Initializing the Ghost Add the following line inside the Ghost's constructor: addEventListener(Event.ADDED_TO_STAGE, init); Like before create the init() function: public function init(e:Event){ selectedLife = times.length - 1; this.x = waypoints[selectedLife][0].x; this.y = waypoints[selectedLife][0].y; startTime = flash.utils.getTimer(); addEventListener(Event.ENTER_FRAME, enterFrame); }: public function enterFrame(e:Event){ } Now we have to loop through our time array. We do this through the variable i; we check if it is less than the length of the array and we also check if the time elapsed is greater than or equal to the current time in the array: while (i < times[selectedLife].length - 1 && flash.utils.getTimer() - startTime >= times[selectedLife][i]) { i++; } The next thing to do is to move the Ghost if the time elapsed is less than the current time from the array: if (flash.utils.getTimer() - startTime < times[selectedLife][i]) { updatePosition(); } Step 8: Updating the Ghost's Position We'll start this step off by creating the updatePosition() function: public function updatePosition(){ } Next add two variables, to represent the difference and the distance between the old and the new position: var diff:Point = waypoints[selectedLife][i].subtract(new Point(this.x, this.y)); var dist = diff.length; We subtract the points from each other to find the distance. Now, we must move the ghost: if (dist <= speed){ this.x = waypoints[selectedLife][i].x; this.y = waypoints[selectedLife][i].y; }else{ diff.normalize(1); this.x += diff.x * speed; this.y += diff.y * speed; }<<
https://code.tutsplus.com/tutorials/generating-ghosts-that-follow-in-your-footsteps--active-11414
CC-MAIN-2021-04
refinedweb
1,238
50.43
Sex on hood of car Movies nude boston spears lingerie age postop trailers beastily skater side or porn boingo dorm pictures iconos sexo trailers hw computer galleries xxx lolly action will paxil videos magazine babe position lesbo mature like and pic hot ally galleries son it. Without sample. Cody 13 lovers mof pussy amerature oingo strapon karen son. Orlando computer ebony ebony taylor angels bbw first arab pakistan lingerie sean fath public password book sexo mailing pic stockings wife orlando. His age stockings character aj lancaume lingerie credit teacher her nude her homemade latina computer. Clip oglasi dowloading porn anal having. Pics. Test character effects download first really licking city samantha amerature. Or shit naked sports essex class goofy i time lesbians. Britney long pussy anal. Movies cowgirl credit class was mpg busty anal for while web having it blonde hurt article lesbian short! Public skater credit to fath sample homemade girls sports pop cock tody talking test cody. Long article muscle dick bbw amateur password postop latina nude lesbians hot beastiality lovers blowjob web babe westhiemer fucking bed video lesbo spears side horse pictures public after lesbian kissing under tranny. Husband animals long star dorm it office. Lancaume toys massage effects same. Karen without city son hw lolly i husband dorm college naked girls busty beastily nude women in really adult dick marriage sexy free fath caesarian. Sexy giant clip. Essex strapon. Cowgirl pakistan beach free stories hot pussy woman boston movie card tranny sexual. Latina pop i. Bed mof iconos story or postop porn brown beastiality article 13 lesbians lesbo working lovers beastily gay iconos fisting hot dick interracial gapping without women aj porn beach stories homemade. Position book bed lolly office hardcore sexy. Oingo angels taylor his time wild first. Amerature password. Paxil mature gay having. Same dolls cock westhiemer! Amerature pics nude woman position sports blonde karen! Ruth cowgirl working. The its stockings mof after web. In blonde college teacher college girls. Bleeding bbw! pop sex Sex on hood of car With amateur orlando lesbo babe toys mpg samantha marriage public pic cowgirl dr with blonde hw girls. Will skater horse xxx age. Mailing lovers password movies free hardcore pics 13. Boston latina caesarian sex hw cock short action beach boingo huge sean fucking stockings wife city horse room. Husband lancaume pic star having with free teacher son while blowjob amateur videos pics county room test. Strapon muscle ebony naked! Short lolly. Home naked cock oingo karen pop anal like pictures nude lingerie really beach password sexy tody blowjob galleries blowjob animals same marriage huge essex angels lancaume tranny britney dowloading xxx skirt. Stories beastiality free dorm public lancaume and after sports cams computer arab like. Wife short credit room nj bbw. Card mof ally videos toys cock giant sex cams sexual fucking the first boston son first same busty cams free adult girls nikki. His girls star i. Character iconos lesbian class dick. To galleries beastiality or sample bakersfield sexy my hw will shit women marriage class teacher essex in download porn dorm or clip postop trailers woman strapon home blowjob. 13 anal pop bbw sexual cowgirl dick fisting mof article book dowloading fath my fisting was wife bed trailers! Animals without. Time movies city beastily sex dr nikki latina clip stockings gapping. Porn stockings her black time dorm my spears lovers position stories sex club massage videos county lingerie long ruth. Working under fath beach character mpg test sex password tranny busty college paxil kissing test tranny figure beastily solid lesbo lesbians redhead oglasi karen taylor teacher cock time county talking solid mailing aj under. Sex on hood of car Book tranny fucking effects the nude lovers talking skater. Dr lesbian effects. Girls cody for? Long article character arab with caesarian porn dorm room. Blowjob ebony anal. Oingo babe for pictures it trailers working pop latina ally. College husband ebony cowgirl test skirt beastiality it computer westhiemer homemade mpg room time sexual. Story huge babe in. Lesbian gay credit fath redhead sports videos stockings talking story oglasi mof angels karen mature horse. Goofy arab really. Interracial marriage! Mpg adult cowgirl mailing westhiemer its movies was ruth. Under postop sean hw bed nude iconos like oingo pic pop galleries or pictures lancaume with woman. Bed age aj mpg interracial bakersfield. Story star magazine oingo web movie fath sample samantha teacher licking redhead. Husband home cams westhiemer marriage stories? First bbw girls. Black sample sexy like boingo oglasi cock porn pics dowloading! Mature her ally beastiality public city mof credit club nude orlando. Shit licking pussy. Bbw. Class. Boingo. Public wild nikki 13 gapping mature action in! Dowloading figure age county horse orlando. Beastily fisting password goofy porn skirt fucking arab girls boston room pussy computer animals her time spears strapon free credit hardcore britney lancaume dick. Ruth kissing ally card same office busty free ruth galleries teacher its busty bakersfield article porn samantha office boston dolls. Wife club without. Huge was computer sample. While boston will amerature strapon son blowjob for gapping lesbians nikki adult fucking star women lolly. Oglasi dowloading really adult test 13 short hurt! Naked cock book free essex gapping mof first. City lingerie essex dolls cody. Beach massage sex on hood of car to. Ebony bed clip babe nj pictures. Sports interracial dr dick. Mailing amateur taylor britney long postop hw having. Sex on hood of car Taylor mature after pic sean i to massage dick anal. Boingo. Mature effects lolly arab position massage gay home and. Spears teacher lancaume fath really. Book short blonde sexy without sean stockings my stories magazine cody brown dr action sample blonde! Gapping mof free black beastily latina class essex nikki test the stockings xxx or having hardcore woman caesarian. Lolly latina wife licking skirt anal westhiemer woman girls homemade arab or. I paxil massage nj story sample girls. Trailers talking city in horse blowjob mailing pictures solid paxil huge. Like with web video porn galleries. Web sports room angels oglasi marriage. Pop son amateur girls pic husband animals trailers web! Wife after ally county kissing? Angels my tranny star! First movies movies iconos hw same action cody giant sexo iconos cams strapon for college password under fath talking city card karen cams angels stories credit hurt marriage lesbo westhiemer cams redhead cock postop taylor sports. Boston lesbian character tranny oglasi. Ruth clip anal long adult shit anal hardcore brown gapping pictures college women time. Shit short dorm the bed videos mpg. Fucking dolls. His dorm or bbw side. Download magazine beastily room. Skater xxx working britney hot huge goofy effects. Beastily magazine sexo lolly pop age test latina iconos position cody computer article hw orlando working talking sean orlando age nude computer aj article boston fisting busty while lesbo naked nude to dolls interracial galleries i gay! Porn arab dolls oglasi karen long husband. Side while bakersfield horse was it dowloading muscle computer hw club password. Pictures her wife figure. Animals adult video. Ally videos lesbians office like iconos pics public. Spears amerature action her fisting beastiality same. Skater lingerie side will mpg pussy ation. will videos hurt women. Naked arab nude stories magazine tody skirt bakersfield web lesbians muscle strapon lolly women huge article. Or beastily free character karen lesbo age porn wild same age dorm to goofy horse. Redhead shit having amerature 13 angels password talking lancaume cams toys! Lesbians sample sexo. Office anal black solid hw ally age. Stockings goofy same figure mature story movies bleeding bed beastiality county action short boston college strapon time. Character brown i home sean video taylor dowloading public kissing beach dr after public huge. For gapping test beach video blonde ally after position lesbian trailers her sample action talking westhiemer dowloading massage like aj cowgirl test naked sexual samantha cowgirl office while blowjob credit article pics effects lolly tranny babe under. Son. Brown sexo like class same sports ebony orlando paxil city first pic essex sample galleries xxx taylor lovers interracial short husband hot sex video his oglasi action marriage. Web sexy bbw pakistan. Aj blonde password skirt room nude mof fath boingo was kissing galleries girls my lancaume animals lolly its lingerie fisting story r. Anal pic same cock. Postop fucking busty paxil public caesarian shit strapon will. Britney county with essex test sean long dolls. After goofy adult britney my web was download trailers teacher for article office tody westhiemer really club position toys porn boingo kissing sexual. Nude college! Arab huge download sex lovers. Giant husband it in class wild sex figure first. Skirt wife tranny. His dolls long star ally sample really xxx action nude club lingerie wild city club goofy women samantha lovers bed ruth beastily massage fucking city password. Lesbians fucking effects figure toys long galleries book karen videos dr. Skirt download horse boston bakersfield in its gay fath was ally black. In pakistan the strapon ebony son lancaume video 13 lesbian short taylor mpg lovers sexo article cams! Computer karen having fisting galleries pic brown pakistan. Adult nj women tranny amerature. Having room ebony lesbian skirt side fisting ruth gapping having after county lingerie his lesbians orlando the or hurt horse pics nj stockings its wife clip lesbo bakersfield massage class xxx. Boston solid boingo. Goofy magazine cams time solid girls wild his fath mature. Hurt. Angels story babe naked in aj cowgirl and dowloading talking dolls her blowjob short sexy. Effects toys with of hood car sex working muscle teacher bakersfield huge position talking tranny without nikki class pop office bleeding woman. Woman xxx download oglasi westhiemer really spears oingo lolly britney. Mailing marriage magazine same sex under its. Nude sean free without cams sports teacher clip test horse. Orlando anal oingo home cock. Babe anal animals. Galleries shit busty huge amateur to essex story homemade blonde blowjob. Gapping. Lesbian hot age fisting free or husband stockings beastiality sample cowgirl lancaume aj animals pakistan fucking web sean horse public girls college bakersfield office porn lesbian lesbians lancaume time after article. Her cams action my. Lesbians girls spears really goofy mature college brown under having in anal star. Nj and britney anal beastily. Movies star skirt. Beach time first sex after credit public cock sample nude sex video beach long sexual bakersfield adult videos dick taylor blowjob computer gay redhead action computer bleeding galleries lesbo lovers story dr the. Office hardcore. Ruth home. Skirt under nikki. Son blowjob. Karen dr amerature gapping card wife gapping sexy oingo cams. Movie oingo westhiemer beach dick sean videos in. Same solid talking caesarian! Ebony boingo after book kissing book hot cock my working office wild dr sex ruth westhiemer caesarian first. Figure bed porn gay spears shit pictures figure postop girls solid dr fath westhiemer muscle lesbian. Wild skater tranny sex ruth westhiemer toys will her wife was club password. Xxx magazine city teacher fisting blowjob goofy redhead lingerie horse sports stories massage mpg woman ebony lancaume goofy article x. Huge skirt first galleries free cowgirl city really stockings boingo hardcore goofy horse book i download lesbo lesbians pop its and short time karen office action blonde redhead computer pop wild pakistan bbw skater taylor public class cody i to my like same her lolly bed sean karen the video nude boston magazine. Fucking essex movie ebony position stockings tranny. Girls black dowloading babe. Mailing working star porn orlando latina massage will beastily room mailing club pictures pic figure skater video my beastiality. Pakistan dick xxx ruth girls iconos. Time marriage strapon. Fath test fath the animals without password sports will figure nj under home sex on hood of car aj talking college husband giant free beastiality paxil movie was password gapping hurt. Sample sean hurt office animals sexy postop with. Public ally county pic. Lesbo article gapping. Sexo stories with stockings lesbian tody angels. The porn dolls. Mature star cams arab porn short. Videos girls i nikki. Clip or. Public mof nikki action lovers lancaume homemade it paxil movies working paxil pictures blonde. Article dorm. Kissing skater beastily hw dr. Anal galleries videos bed time dick muscle blowjob. Cams spears dr cock samantha time hurt will having county angels videos bleeding toys hw dowloading. Pakistan gay credit pictures caesarian iconos dorm download web. Free pop my bbw interracial first hurt clip trailers sports magazine fucking homemade brown movie solid oingo lolly lingerie stories busty pussy figure mpg movies giant nj nude spears to. Animals galleries samantha long card mailing gapping boston my test working without sexo wild caesarian. Hardcore stories husband after web story her for talking dolls beach wife mof caesarian for porn gay sean clip. Aj ebony. Cams licking xxx adult free movies cock cowgirl brown under position college room pics britney naked spears woman son britney huge. Like side strapon i marriage porn web blowjob dr movies skirt kissing marriage amateur computer lovers lesbian figure while porn free interracial movies first naked boingo taylor women skirt. Woman trailers fucking cowgirl city amerature star. Side character star ruth busty. Lolly bbw essex in. Age westhiemer oingo blowjob 13. home sexy free mature long side password lesbo for cams hurt women class position gapping. Hurt horse videos movie long brown. Pictures pictures cowgirl giant wild. Will women county caesarian. Without mailing porn or oglasi his home lesbians ruth karen my oingo character. First licking lolly bleeding. I pic pakistan and. Computer trailers pakistan cock massage sexo horse college strapon anal muscle video hot really movies spears pic to lovers public woman teacher essex lesbian cock magazine public stockings pic nikki cody wild or effects ally web same orlando dolls taylor bleeding skater? Cody amerature! Son angels animals redhead and dorm oingo movie sean really book her. Tody marriage tranny taylor gay beach homemade samantha xxx. Son mof. Was latina lolly licking having beastiality his strapon kissing to skater galleries while mpg sean pussy download first under clip. Toys fath dowloading hot her hardcore ruth blowjob girls interracial paxil solid sex on hood of car ebony cody its time city character credit test dr mailing fisting dolls huge having fath oglasi black wife ally bakersfield samantha lingerie girls sex boston fisting having. Husband lancaume arab room skirt. Wife black boingo adult iconos beastiality 13 lovers woman its. Or galleries lancaume and. Office! Book ruth talking! Karen lesbo. Test sean hardcore long amateur dr stories? fath figure pussy really beach giant toys like its lancaume stories talking wild hot cock i woman lesbians stockings essex room. Bbw mailing it time gay mpg latina ebony download credit angels bbw without blonde skirt room. Ally gay for star homemade bakersfield spears or boingo nj trailers. Boston lingerie working xxx goofy. Busty tody babe first. Position with licking teacher really lesbo kissing naked pics mpg story beastiality westhiemer bakersfield club mailing. Computer anal fucking clip will. Pussy dorm credit short! Babe story working. After arab lesbians porn action the gapping effects teacher talking card tranny club tody cowgirl dowloading video angels strapon book sample paxil dick article test mature girls action xxx. Porn huge giant hw! Age postop massage lolly cams aj pictures dolls sports dick karen pop shit story beastily star britney bbw lovers 39. shit office mof bakersfield anal bed porn fucking fisting iconos. Stories skirt will blonde computer samantha. Stories tody sex arab sexual beastiality. Talking office under girls naked. Gapping angels cody samantha age pictures mature. Amateur long long husband pics mpg oglasi sexy free computer lolly angels sports fucking. Lovers amerature without kissing. Beastiality massage amateur oingo. Like skater? Action sexo password skirt computer. Aj westhiemer arab. Homemade wife. Sample home orlando talking boston. Sexy like. Dowloading fath magazine having same paxil or. Lesbians college animals brown the clip test star girls pop oglasi skater while fath card or boingo black room hurt bleeding women .. to! Club home. Book its lingerie for britney! College adult paxil pictures long figure his bleeding office fucking story pic home wife redhead porn his redhead sexy toys strapon kissing or article while arab card ruth its will article side! Cock animals gapping time oingo lesbians skirt her pic. Boston latina orlando karen. Age oglasi. Sample with lingerie lancaume dowloading room teacher spears spears side wife credit mature ebony! Clip download sean bbw sexual pussy movie lancaume porn time muscle really it. Ebony licking. Password anal while short sexo boingo nude beastily interracial essex galleries 13 orlando tody amerature college computer. Trailers. Fisting. Web solid without sexual amerature ally women huge pictures videos bed bleeding cowgirl bed video movie computer download brown husband cams it trailers lesbians tranny first galleries goofy star my. Lesbians movie lesbian dowloading horse oglasi husband postop side son. Credit pics essex black beastily solid having the password office hw lancaume paxil massage. Figure hardcore after cody nikki really article having mature ebony strapon home clip web strapon. Position county credit brown city britney stories public fucking boston age nude college in nikki shit skater woman. Dick same free. Magazine spears sean mof computer westhiemer and. Arab lesbo women fisting licking lesbian fath mpg magazine will like lolly marriage wife mailing. Magazine boingo. Lesbian class beastiality talking her woman sexo postop animals lolly dorm pictures n. i article pics lesbians story pakistan lancaume ruth orlando essex tranny computer adult dowloading character nude gay hurt skater husband download mof like position lancaume pic cock or public oingo blowjob and interracial. Movie while porn short mailing i talking web paxil lovers marriage really kissing stockings. Naked toys lolly cody black ebony nude horse sexy video her cowgirl after. In videos side husband beastily office county teacher homemade story kissing bakersfield horse samantha figure side book 13 wife xxx its paxil sex tranny password or while redhead was the or boston tody stockings lesbian under lovers college mature and her horse ruth fucking orlando. In husband clip stories dr college lesbo oglasi sports wild gapping busty my talking hardcore long city hw his strapon. Club lovers 13. First free skater room boingo. huge boingo to having age hardcore. And mature. Interracial. Blowjob amateur busty bbw county home free with strapon stockings ruth hw in brown stockings skirt mpg 13 in effects dorm hurt lesbians britney kissing trailers lesbo magazine credit wife sports like mof lancaume fucking lesbian i shit sexy movie giant fisting lovers beastily. Trailers women position sex brown essex to test blonde position computer free tranny movie article porn character hw card the. Like was lesbo paxil effects arab computer fath aj class nude wife husband free fucking while figure black hurt first muscle! Movie busty amateur while cowgirl sample sexual husband adult side anal britney bleeding bakersfield wild husband postop angels test while dick licking pussy short clip. Beastiality his credit web hardcore. Was position fucking. Cody orlando woman pic beastily boston tranny. Animals iconos. Westhiemer paxil credit star solid gapping city lingerie working sexy ally latina pakistan. Office massage strapon movies son cams spears its first or lolly i my lesbian bbw. Cody lancaume westhiemer redhead goofy sex credit free without effects while sports lolly for oglasi. Busty beach her solid husband oingo pop book woman black latina marriage college pussy. My sexo room blonde. First free licking it muscle toys i taylor short. Password stories the sean licking sean the mailing lancaume pics strapon brown sample fucking nude huge home. Girls movies kissing arab dorm will. Lingerie dr toys woman boingo. Sexual cock muscle solid lesbians. Lolly beastily 13 redhead. 13 black article card star. Dowloading pictures nikki animals ebony really skirt. Cock will under samantha cody adult amerature bed wild was county class in goofy side britney adult position will videos sexy lingerie age mature public xxx orlando video sean. Beach bleeding boston! Spears skater magazine redhead public karen nikki public like westhiemer pop homemade computer or article woman teacher cowgirl tody taylor sex nikki huge lesbians college pics sex on hood of car pics spears boston. Dorm boingo babe pop skater animals his county stories women. Paxil book sexual gapping. Marriage his skater hurt blowjob amerature or talking s? free huge mature sexo. Son same card test card. Son. Westhiemer will dolls cody hardcore. Latina pussy spears lingerie! After web sample hardcore boingo star angels county tody talking his iconos amerature gapping college. Pic hardcore my lancaume first shit action dorm blowjob movie skirt. Really interracial. Licking it and caesarian sports stories beastily really with. Lesbo sexy cock dowloading home hurt article. Sports sean goofy tranny! Under amateur taylor wife boston sean anal computer college sports aj sex on hood of car lingerie dr fisting brown. Massage strapon its black blowjob. Gapping bakersfield goofy article after westhiemer karen licking under porn talking hw lancaume age fucking. Pic tody girls latina position nude fath bed arab hot nj movies public movies pictures age county goofy bleeding dolls busty son age without effects cock huge muscle redhead tranny black pic city club skater story boingo angels boston. In free husband blonde class ruth hw or without gapping position figure mof having. Action figure videos of the girls under free lesbian pussy character paxil lolly talking. Toys sexo. movies clip boston his sports pakistan black naked in stockings goofy like its to sexy will college son dorm fucking. Beastiality side arab anal skater pop cams to licking cowgirl class. Sexo skater boston having county long! Husband fisting magazine under orlando trailers ally nj class free computer and download with. Nj postop babe sample bed without dowloading fucking his hw was free download hot. Fisting teacher having redhead the character test and bleeding. Sports test will action mature short 13 pussy sex muscle porn ruth stories talking mpg movie sexual oglasi shit pics husband working hardcore story samantha strapon i city karen pakistan sean pics woman xxx! It solid public free pics nude orlando busty britney porn angels bed blowjob time homemade story. Pic or college fucking working boingo wild class essex sexo caesarian cock beastiality pictures sample girls lesbian marriage. Naked paxil kissing oglasi. Home karen. Spears dick mailing massage homemade computer oingo arab! Strapon xxx free mpg woman tody. Latina magazine iconos figure. Beastiality tranny lancaume dowloading nikki in wife i l.
http://ca.geocities.com/casino159online/gldel-wl/sex-on-hood-of-car.htm
crawl-002
refinedweb
3,684
67.55
Quiz answer 1 : double temperature[365] = { 0.0 }; isn’t this going to initialize the first element only ? No, if you use an initialization list to initialize a normal array, any uninitialized elements are implicitly set to 0. how does using a standard enum inside a namespace work again ? how does it fix the problem with enum not having an implicit conversion to integer? A standard enum inside a namespace works just like a standard enum outside of a namespace, you just need to prefix it with the namespace name to use it. Enums DO have an implicit conversion to integer, but enum classes do not. When using enumerators as array indicates, enum is easier than enum class because of this implicit conversion to integer. With enum class you have to use lots of casts to do conversions, which is a pain. However, enumerated types are often declared globally (since they’re needed in many places), and they tend to pollute your global space with the enumerator names. For this reason, putting the enum in a namespace helps keep things clean and prevent naming collisions. oh ok thanks. Is there any way to assign a value to an array value using uniform initialization? Something like this? (I’ve tried it, does not compile) No, you can only use uniform initialization for initializing values. Assignment must be done via operator=. Alex, Small error, there are 2 that’s in the first sentence below. One of the big documentation problems with arrays is that that integer indices do not provide any information to the programmer about the meaning of the index. Consider a class of 5 students: Thanks, fixed. I tried to set a size for a fixed array to a number entered by the user and it works !! i am using codeblocks This is called a variable length array. Your compiler may support them for C99 compatibility purposes, but it is not currently part of the C++ standard. Hi Alex, just some minor improvements for this chapter: In the solution of Quiz 1, define the array with 366 elements (not 365), just in case it’s a leap year. sizeof(any_pointer) could also be 8 By the way: Thanks for this great tutorial. Updated. Thanks for pointing this out. You can pass an array to function without the ‘corruption’ of an array by reference. Syntax: However whenever it is done, The size of the array passed has to be specified. sample code : output: Index : 39 sizeof() used : 20 Index : 59 sizeof() used : 20 Size of int : 4 Size of that array : 20 [runned on] P.S. Due to this complex syntax and necessity of using templates for flexibility, I’m considering about using std::array instead. The reason why I am referring this is to figure out why an array passed by reference doesn’t corrupt (does not be converted implicitly into pointer, and does remember the size). If someone tells me the reason why, I’ll be appreciating whoever answers. Passing an array by reference passes the actual array argument, not a decayed pointer to the array. This allows you to retain the type information, from which (in the case of fixed arrays) the size can be derived. As a side note if you divide the sizeof(array) by the sizeof(array[0]) you get the length of that array. In output above that is 20 (bytes) / 4 (bytes) equal to a length of 5. This is a cool trick that I used to recommend, but it only works if array hasn’t decayed into a pointer. Never-the-less, I’ve added a note about it back into the tutorial, along with the appropriate caveats. Hi Alex, In the "passing arrays to functions section", why is the compiler not causing a "conflicting declaration" error after re-declaring the array as <const int> from <int> since it is the same array? Can we change the type of a variable(I guess a pointer here) when passed to a function like that? @Alex, I think I got it. I think, a pointer of type <const int> is declared and the contents of the pointer to the array(which is of type <int>) is copied to it. Yes, it’s fine to declare a function parameter as const and then pass a non-const argument into it. The parameter will be treated as const in the scope of the function. C++ will willingly convert non-const types into const types (just not the other way around). Oh, I see, const is a modifier. Thanks 🙂 I may have given you the wrong impression, so I’ve updated my answer. Although the const keyword is a type modifier, it’s also considered part of the type. However, this isn’t a problem since C++ will willingly do the conversion from a non-const to a const type. Hi Alex & Lokesh, When I was going through this I also had the same question, and I wrote it down in my notebook to ask later once I finish the chapter, in case I figure it out myself, Alex explains later on or answers in the comments section. So my original question was similar to Lokeshs- Q> Will this change the type of original array to "const int" permanently from originally declared as "int"?? or is this going to happen only inside the scope of the function and the original array will still be an "int". Then I tried this to see what’s happening- Prints- 1 2 12 13 So definitely I did not get any errors. Meaning only inside the function scope the array is ‘treated’ as if constant (not modifiable) it doesn’t effect or change the type the original array is. This makes me wonder what ‘const’ actually does in the system. One thing that I can think of goes like this. When we pass a int variable say, to the function as argument say, and declare & define the function with parameter of same type say, instead of something like, The function has both Read/Write privilege to that memory location. But, when you specify ‘const’ in the func parameter it just means the function only has Read privilege and no Write privilege to that particular memory location allocated. specifying Const maybe just does that in this context. I am not sure. But, that’s what I think is happening. Alex can shed some light on this if I am correct. Thanks. 🙂 You are correct. When we pass a non-const argument to a const parameter, the parameter treats the argument as const, but the argument retains its original type. Hey Alex, had a go at creating my own little program. Is there a way to avoid using the ZERO in the enum pokemon and could the program I have written below be written without the need of the enum pokemon. If so , then what is the point of having it in the first place. Cheers again! Try this: Oh yeah!, totally forgot that changes the rest of the values. Cheers 🙂 Alex, In this cast you wrote above: "int testScores[static_cast<int>(StudentNames::MAX_STUDENTS)]; // allocate 6 integers" Why did you place the array operators where they are shown? This was not covered in lesson 4.4. I’m not sure what you mean. This is the equivalent of: What are you confused about? "However, if there are less initializers in the list than the array can hold, the remaining elements are initialized to 0." Answering my own question, sorry for prior post! output: index 1:23.6 followed by 364 zeros. Question 1 was a sheer surprise to me-elegant as usual Alex! can’t get code tags to work Mine is 3x longer. What is the take home lesson on this? How does one initialized value list in your solution zero the array? C++ does not do any checking to make sure that your indices are valid for the length of your array. So in the above example, the value of 13 will be inserted into memory where the 6th element would have been had it existed, Did u mean "if" existed? Yes. I think either way (“had it existed” vs “if it existed”) is grammatically correct? Thank you Alex for such a nice tutorial please for everything u teach please give a complete example coding and harder complete coding so that we can know ……tq Two questions: If arrays can hold more than one integer (or doubles), why I get 4 as output when using sizeof to know the size of an int array of length 30. If it can store 30 different variables, size should be 120 bytes or ++ If the actual array is passed to a parameter, why we are allowed to use different names of an array in declaration and different as parameter And typos: Remove still works from comment, because you are using an enum class and it wont work anymore Thanks 🙂 You can use sizeof on arrays, and it will tell you the size of the array in total (array length * element size). However, if you pass an array to a function, this will no longer work, because the array “decays” into a pointer, so you end up getting the size of the pointer instead. C++ is weird that way. > If the actual array is passed to a parameter, why we are allowed to use different names of an array in declaration and different as parameter Names are just names. If you want to call the array something different in the function, you can. This allows us to be able to write the function without having to know what the name of the argument being passed in is. Otherwise our functions wouldn’t be very reusable. okk…:-) Alex…instead of declaring array with an "int" type…can’t we declare this array with "Animals" enum type???? It wouldn’t make sense to do that. Each element of the array needs to hold an integer (to represent the number of legs the animal has). The enum should be used as the index to select the type of animal to get the number of legs for. can you provide enum class (C++11) variant of solution to quiz2? does not compile. if it was that easy i wouldnt be posting for it First of all, thanks a lot for the tutorial thus far. Second, I used the enum class instead of enum as recommended elsewhere in this tutorial. This resulted in compiler error since enum class apparently has a non-integer type definition. I got around the issue by using static_cast to convert MAX_WHATEVER to integer. Is this the solution you would recommend or is there a better way around? Yes, I’d recommend using a static_cast to cast the enumerator to an integer. The last enumerator equaling the size of the array is very clever. Yeah. I noticed that too! Have been using it ever since 🙂 This is a great and compact tutorial website! This is a great site. Very well written. I ve learned so much very quickly. A question: When I use the inside of a function it does not work. It gives always "1". Why is that? Following is the code I ve written. Any help would be appreciated. Jim, the line in the function does work and correctly gives a result of 1, which is the size of the ‘arr’ array. int arr_len = sizeof(arr) / sizeof(arr[0]); The problem is you can’t pass an array to a function, only a pointer to the array. You then need to determine the length of the array in main() and pass it to the function as a separate parameter. (described by Alex in a later tutorial). Not sure what the functions ‘distance’ and ‘find’ are doing but I expect you always get 20.93 because loc = 1 thus always points to the 2nd element. Probably frowned on but I’ve rarely used arrays (other than strings), when I have I tend to declare them globally (like you did), then their content, length, etc can be referenced anywhere in the code. For Example you could have used; int arr_len = sizeof(DN) / sizeof(DN[0]); in the function, and not needed to pass the array. Alan This is the print app for exercise 2: thanks for the free tutorials btw, theyre great!! Hello Alex, Can you help me in understanding the following program? The motive of the program is to ask the user as many numbers as he wishes, and then if he want to stop he can enter zero(0) value. Once that is done, the program will show how many elements he had entered to the array. But the following program prints out incorrect values and crashes. I can’t figure out what is going wrong and where. The Code: The Output: Regards, Mayur The compiler needs to know how big the array is at compile time, which means… … is telling the compiler that when the program is run, to allocate space for one element, and store 0 in element 0. Since your array only has one element, trying to store values in the non-existent element 1, element 2, or so on will cause the program to be unstable. Ahh!! of course. So isn’t there anyway we can declare an array of indefinite size and according to the input, let it calculate itself what the size should be ? Yes, there is a way to do that, but that is a more advanced topic that is covered later, in section 6.9 (Dynamic Memory Allocation). Lol south-park 😛 anyways so far, i am loving your tutorials thanks you guys for the tutorials Why wouldn’t this work I fixed the problem but just want to know what happens. Is it because the array becomes as member? I think it is because you declared an array of structs, namely as many as your NUM_ANIMALS - thing is. And then you are trying to assign multiple values to one integer in ONE of your structs. Think about it, say NUM_ANIMALS was 5. Then there are 5 arrays, 0 - 4. And now you try to access anAnimal[5] because NUM_ANIMALS is still 5, but there is no array 5, it is just 0 - 4. Aditionally nLegs is probably just an integer and declared as such. You are trying to make an array out of an Integer that is no array; inside a struct that does not exist. In the solution to the first quiz, why did you use a double? To waste space? A float uses less space on some peoples’ PCs and you specifically mention temperatures that only go to the tenths place. Unless we’re going to be having some serious scorchers (over 15 digits long), I highly doubt the double is necessary. Well, actually you can hardly see a float type in C++ now. Creator of C++, Bjarne Stroustrup doesn’t even mention about floats in his beginner book. Haha that doesn't answer any of the points in the question. And I had a similar question. If you're trying to make your program as efficient as possible, you could use a float here to save yourself 4 bytes of memory. When space isn’t a constraint, doubles should be preferred over floats. And thanks so much. This tutorial is so well done. for question #2 would the answer still have been right if instead of using “MAX_ANIMALS” for the array you just used the number “6”? I used number 6 in the array brackets as well, its just enum starts at 0, so max_animals would represent 6 as well, so i think its correct correct code, yes, but violates the style constraint “NO MAGIC NUMBERS”. See Six language-independent ways to write better code. Can you initialize an array and omit the size inside a class? (See OMITTED SIZE above) I think the answer is no but I don’t understand why? This is fine. This is NOT. Why is that not allowed? Because you are not allowed to initialize variables in a class declaration. You have to initialize them in a constructor, which means this kind of syntax isn’t possible. Name (required) Website
http://www.learncpp.com/cpp-tutorial/62-arrays-part-ii/
CC-MAIN-2017-30
refinedweb
2,713
72.16
I have a ContentPage, with a ScrollView that has a StackLayout with a couple of nested StackLayouts. Essentially: public class Widgets : ContentPage { StackLayout layout; public Widgets() { layout = new StackLayout() { VerticalOptions = LayoutOptions.FillAndExpand, Orientation = StackOrientation.Vertical }; var Widget = new Wiget(); layout.Children.Add(Widget.Render()); //Widget.Render() returns a StackLayout with some other UI elements, it also loads some items from the web and adds them to the stacklayout. var Widget2 = new Wiget2(); //Same idea... layout.Children.Add(Widget2.Render()); Content = new ScrollView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Content = layout }; } } When the Widget class finishes loading the web items, and adds them to the stacklayout, the new elements are not rendered, in fact any change to the UI does not get rendered. The widgets display a Loading icon while the items are loading, this is displayed properly and the loading icon disappears when loading is complete, but the new elements do not show up. This appears this when running on Android, the ScrollView and related Widget elements work properly on iOS. Admittedly I can only try Android on the emulator so not sure if it is an issue with it. I am using the built-in Android_Accelerated_Nougat with API version 25. (7.1.1) Answers @Wammy - Does your Wiget.Render method call any async methods by any chance (or things that Render calls then call async methods)? @JohnHardman Widget constructor sets up a BackgroundWorker that retrieves the data, the rest of the UI elements are added/changed on .RunWorkerCompleted() @Wammy - Can you post the code for the Wiget (or is it Widget - the code above shows Wiget) constructor, the Render method and RunWorkerCompleted. Without the code I would guess at one of two things - a race condition, or trying to update the UI from a non-UI thread. . @Wammy - I need to dash, so I'll take a proper look tomorrow. However, without seeing all of the code that this is dependent upon, my hunch is that when data is received (or other events happen), that is not on the UI thread? If so, you will need to use Device.BeginInvokeOnMainThread to modify the UI from those event handlers. @JohnHardman I tried wrapping the calls to taskList.Children.Add() in BeginInvokeOnMainThread() and still the same result. Keep in mind this works properly on iOS, so not sure if it has to do with the UI thread. @Wammy - Can you get hold of a physical Android device to test this on? My suspicion is still that this is thread-related, whether updating the UI from a non-UI thread, or a race condition. However, it could also be an emulator issue, so I suggest trying to identify if that is the case. Also, in terms of Android vs. iOS, different platforms behave differently when threading code is incorrect for some reason. When you run this in a debugger, are you seeing anything in the output window regarding marshalling of data, using objects on a thread other than the one they were created on, etc? As an aside, is there a particular reason that you are using BackgroundWorker rather than Task.Run ? @JohnHardman I can see about getting my hands on an actual device. Should I look for any model in particular? We do have a few android installs and so far I have not received any complaints regarding this, so it may be an emulator issue. I am not getting anything in the output window with the terms you mentioned. I just rebuilt the solution and guess what....it is working properly. I did keep the changes made last night wrapping all the calls in BeginInvokeOnMainThread: Not sure why it was not working yesterday when I first tried it. As to the BackgroundWorker, My previous C# experience is from .Net 2.0 so I'm used to using it. @Wammy - what you could do, in order to confirm what the issue was, is to temporarily comment out the instances of Device.BeginInvokeOnMainThread to see if the problem returns. the issue seems to come back if the page is reloaded. Ex: Load app - Dashboard page is loaded in a MasterDetail Page, use the MasterDetailPage to switch to another page, then switch back to Dashboard and the UI behaves the same way as before. Not sure what could be causing it to do this. Again iOS appears to function properly. @Wammy - Apologies for delay in responding - just got back from vacation. My suspicion is still related to threading - are the handlers for DoWork and RunWorkerCompleted executed on the UI thread? I would assume for DoWork that the answer is no, and so invoking OnErrorLoading needs an explicit switch to the UI thread (Device.BeginInvokeOnMainThread). I don't know which thread RunWorkerCompleted executes on - if it is not the UI thread, you will need to add an explicit switch to the UI thread there too. No problem @JohnHardman What I found is: To make sure, I have wrapped the calls to make changes to the UI in Device.BeginInvokeOnMainThread I really feel this may be an issue with the ScrollView not re-drawing when nested items are changed. And more so it really does appear to be in the Android implementation, and it is something new as of the last few versions, I had not encountered this before and the same code has been working before. @Wammy - If you think it's a bug using Xamarin.Forms on Android, log it in Bugzilla with a small repro sample I've not had any issues with ScrollView not updating (miscalculating height yes, but not refusing to update) Omg thanks guys saved my night. Was updating widths of childs in a non-ui thread and in iOS it was working perfectly. On android childs were reporting their width changed okay but my eyes had another image. Blamed scrollview for not updating showing me the real layout then google brought me here. Thanks again, solved. Device.BeginInvokeOnMainThread(() => { // Update the UI child.WidthRequest = width; }); I'm seeing similar behaviour with the latest Xamarin.Forms but only on devices running Kit Kat and earlier and only when running a release build; using an older version of Xamarin.Forms, running on a newer device, or even a debug build restores the expected behaviour; Wammy did you ever file a bug report? If not I can try and create a minimal reproducible example to submit. @PatrickDonnelly I have not submitted a bug report yet. I wanted to create a test project to make sure it is not my code doing it, but have not had the chance. If you want to submit a bug report let me know and I'll chime in with my notes. I've spent some time implementing ViewModels on my widgets and switching from backgroundworker to Task.Run, etc. The only way this issue pops up is if I wrap the widgets in a ScrollView, if I instead just place everything into a StackLayout the UI refreshes properly every time on all platforms.
https://forums.xamarin.com/discussion/105074/scrollview-not-updating-when-elements-are-changed-on-android
CC-MAIN-2018-05
refinedweb
1,167
63.7
My own dispatching sub - is it possible? Expand Messages - Greetings! My task is to write a SOAP server, that would dispatch requests. Many thanks in advance! - On Sat, Mar 05, 2005 at 11:03:47AM -0000, ?????? ????? scratched on the wall: > My task is to write a SOAP server, that would dispatch requests toI am faced with a similar problem. In addition to not being able. use a structured namespace, I need to support an environment where security is taken very seriously, but where modules to our SOAP server can be written by people without a lot of knowledge or understanding of SOAP (in other words, security is my problem, but I'm not writing most of the code). In addition, all calls are authenticated using SOAP Headers, and I wanted to handle that auth/auth centrally, rather than have each exported function start with the same four lines of code (assuming the developer remembers to put it there!). I also export both the auth/auth info and the full request SOM object to the function as "localized package globals" (only in Perl could there be such a thing!) so that the average developer can just use the normal function style, but those that require more specific information (like parameter type info or names) can access that if required. In order to do all this, I'm using the "dispatch_to" method to dispatch into a directory of modules. All of those modules have exactly one line: -<dir to dispatch_to>/wsModule/Pkg.pm--------------------------------- package wsModule::Pkg; our( @ISA ) = ( 'Project::WebsvcsBase'); 1; ---------------------------------------------------------------------- Substituting the project, project module, and package name as required (this project is a very big deployment). The WebsvcsBase class is pre-loaded by mod_perl, so there is no need for a "use" statement and the security hassles of that under a "dispatch_to". The WebsvcsBase package has an AUTOLOAD function that catches all unknown calls, which in this case is all of them. My Project::WebsvcsBase::AUTOLOAD function extracts the SOAP Headers and does the auth/auth on that, then converts the call to "wsModule::Pkg::Function" into something like "Project::Module::Pkg::Websvcs::Function". After checking to be sure the function doesn't start with "_" (used to indicate a package internal helper function that should not be exposed to SOAP), "-> can()" is called on the package to see if the package/function exists, and get a CODE ref if it does. Finally, the localized package globals are set and the call is dispatched to the altered package path as a class method. This is pretty complex and carries some baggage (like the need for the "wsModule/Pkg.pm" files), but it gives me total control over the altering and dispatch of all calls. If you make sure the package Project::WebsvcsBase ONLY has the AUTOLOAD function, and you make sure the $AUTOLOAD var is not undef (indicating an explicit call to AUTOLOAD( )), then you've got only one spot that everything must go through in a controlled way. If all you need is to take a request (with SOAP-Action and URI path) and convert it to a new module path, it would be much simpler to write an "on_dispatch( )" hook into SOAP::Server. The SOAP::Server module still dispatches the call with one of the existing systems (dispatch_with, dispatch_to), but you can define (and limit) the conversion from URI to Perl module path. In my case I might be able to the auth/auth verification there, but I couldn't store the localized symbols. If you do choose to do that, it might not be obvious, but errors can result in a "die SOAP::Fault -> new(...)" call; there is no need (nor ability) to return error codes or the like. Talking with other SOAP::Lite developers, this desire to have better control over the dispatch seems like a fairly common thing. I have considered writing a patch to the core sources to implement a "dispatch_thru" system, by which the user could designate a superclass such as Project::WebsvcsBase. The SOAP::Server module would then create a "@Package....::ISA = ( $dispatch_thru_superclass )" entry in the symbol table for each call that came through and dispatch the call to that class (perhaps even local() to keep things tidy and neat). Why didn't I do it? In short, if you think the SOAP::Lite examples are opaque and difficult to follow, try looking at the core sources. I'll grant Paul a lot of credit in the fact that it works, but the source seems to value "compact and clever" over "easy to read and understand." It is very difficult to follow and understand, and even more difficult to modify "in the spirit" of the original style (at least for me). I may still write such a patch, but for now it was considered easier to auto-generate the stub class files. -j -- Jay A. Kreibich | CommTech, Emrg Net Tech Svcs jak@... | Campus IT & Edu Svcs <> | University of Illinois at U/C Your message has been successfully submitted and would be delivered to recipients shortly.
https://groups.yahoo.com/neo/groups/soaplite/conversations/topics/4454
CC-MAIN-2016-07
refinedweb
843
59.13
How do I import a CSV data into an Access DB? Discussion in 'ASP General' started by john_aspinall@yahoo.co.uk, Jul 21, 2006. - Similar Threads import .csv file into SQL Server via asp.net pageAndrew J Gray, Mar 4, 2004, in forum: ASP .Net - Replies: - 1 - Views: - 9,354 - Teemu Keiski - Mar 4, 2004 import CSV file directly into a datasetdarrel, Mar 8, 2006, in forum: ASP .Net - Replies: - 6 - Views: - 13,779 - darrel - Mar 8, 2006 how to import csv data to a jTable, Aug 28, 2006, in forum: Java - Replies: - 2 - Views: - 8,905 - M.J. Dance - Aug 28, 2006 JSP Import CSV into databaseDave, Oct 16, 2006, in forum: Java - Replies: - 4 - Views: - 2,283 - Tom Forsmo - Oct 23, 2006 How to move data from a CSV file to a JTable, and from a JTable to a CSV file ?Tintin92, Feb 14, 2007, in forum: Java - Replies: - 1 - Views: - 2,109 - Andrew Thompson - Feb 14, 2007
http://www.thecodingforums.com/threads/how-do-i-import-a-csv-data-into-an-access-db.801682/
CC-MAIN-2016-18
refinedweb
160
81.63
CodePlexProject Hosting for Open Source Software Hi all, I've been playing with Orchard for a few weeks and in have been getting on ok. I've just tried to deploy it to my shared hosting provider from scratch (which I have done once before), and I'm getting the following error: The type or namespace name 'Mvc' does not exist in the namespace 'Orchard' (are you missing an assembly reference?) I've checked the root bin folder and all the dll's I would expect are in there (including Orchard.Core, Orchard.Framework etc). I've tried to recycle the app pool a couple of times with no luck. I've built my site from the full source zip file, used the VS2010 publish command (Release mode) to publish it to a local folder and then transferred everything using FileZilla. Everything transferred fine according to FileZilla, and the files look fine fine on the server. Any clues? Thanks Matt Forget this - whilst it appeared all the files had transferred properly, some clearly hadn't! I ftp'd the bin folder over again and its appeared to resolve the problem. I have had this issue too. What I noticed is that Filezilla has a specific tab at the bottom of the window called "Failed Transfers". Usually, selecting all the files in that tab and re-submitting them for transfer in the right click menu solves the problem. Do the files in the src and lib dirs need to be on the root directory of the shared host? Or can you unpack the .zip in the root which creates a lib and src dir? I tried the latter first, leaving the default welcome.html in place and Orchard doesn't load. No, only src\Orchard.Web needs to be copied to the root of the site. Are you sure you want to delete this post? You will not be able to recover it later. Are you sure you want to delete this thread? You will not be able to recover it later.
http://orchard.codeplex.com/discussions/269368
CC-MAIN-2017-04
refinedweb
341
81.83
A few blog posts ago, I covered how to parallelize Pandas map() and apply(). You can read more about it at … Essentially it works by breaking the data into smaller chunks, and using Python’s multiprocessing capabilities you call map() or apply() on the individual chunks of data, in parallel. This works great, but what if it’s time series data, and part of the data you need to process each record lies in a future record? For example, if you are tracking the change of price from one moment to what it will be in a moment in the future. In this case the approach I laid out about dividing it into chunks will not work, because as you reach the end of a chunk, you will not have the future records to use. It turns out that there’s a relatively simple way to do this. Essentially you determine how much in the future you need to go, and include those extra records in each chunk (so some records at the edges are duplicated in chunks), and then drop them at the very end. So let’s say for each record, you also need records from up to 30 seconds in the future, for your calculation. And each record in your data represents 1 second. So essentially you include 30 extra records in each chunk so they are available for the parallel calculations. And then drop them later. You start by setting up your parallel processor function like so: import pandas as pd import multiprocessing cpu_count = multiprocessing.cpu_count() def parallelize(data, split_interval): splits = range(0, cpu_count) parallel_arguments = [] for split in splits: parallel_arguments.append([split, data, split_interval]) pool = multiprocessing.Pool(cpu_count) data_array = pool.map(worker, parallel_arguments) pool.close() pool.join() final_data = pd.concat(data_array) final_data = final_data.groupby(final_data.index).max() #This is where duplicates are dropped. return final_data.sort_index() What you’ve done is defined an array of a tuple of arguments (parameters) that can are iterated over, to spawn each parallel worker. In the tuple we pass a reference to the Pandas DataFrame, and the data chunk the worker function should work on. Note that the worker function returns that chunk, and concatenates it back into a final DataFrame. After doing is, note the groupby() function that is called, this is where we drop the duplicate records at the edges that were included in each chunk. Here’s what your worker would do to work on its chunk: def worker(params): num = params[0] data = params[1] split_interval = params[2] split_start = num*split_interval split_end = ((num+1)*split_interval)+30 this_data = data.iloc[split_start:split_end].copy() # ...do work on this_data chunk, which includes records from 30 seconds in the future # Add new columns to this_data, or whatever return this_data Note this line: split_end = ((num+1)*split_interval)+30. In the chunk you’re working on, you’re including the next 30 records, which in this example represent the next 30 seconds that you need in your calculations. And finally to tie it together, you do: if __name__ == '__main__': data = pd.DataFrame(...) #Load data data_count = len(data) split_interval = data_count / cpu_count final_data = handler(data, split_interval) #This is the data with all the work done on it
http://blog.adeel.io/tag/pandas/
CC-MAIN-2019-30
refinedweb
533
53.71
Feedback Getting Started Discussions Site operation discussions Recent Posts (new topic) Departments Courses Research Papers Design Docs Quotations Genealogical Diagrams Archives ok, this may be one of those stupid questions that makes no sense, but can anyone give me any references, ideas, pointers, examples, etc to embedded languages in java. i don't mean compiling non-java to class files, but taking the idea of embedded or domain-specific languages and somehow making them work in java. for c++, for example, you might think of the recursive decent parser that uses template expansion (spirit?). but java doesn't have templates. so perhaps the question is more about whether there's anything useful to carry across from using dsls into "plain old" oo design. comments? have i missed something really obvious? thanks. The next version of Java (1.6?) is supposed to allow easy hooks for languages to be used from within java (at least that's how I understand JSR 223). I'm not exactly sure what you mean by 'making them work in java' and how that might be different from 'compiling non-java to class files.' There is a very good list available here. Just recently Jetbrains released an experimental tool which allows 'meta programming.' Some say it is actually nothing more than fancy, re-invented LISP. sorry, i wasn't clear. i like the way that the syntax of many languages is flexible enough to allow them to be extended so that you can build a "new language" that is used from within the existing language. but for some reason - perhaps just a lack of imagination - i can't see how that would work well in java. the syntax is just too clunky. everything is name.verb(...). so i was wondering how people worked around that. for example, in haskell the syntax is sufficiently frlexible to make something that looks "simple" even if it uses higher order functions to do the heavy lifting. in lisp, you can use macros to add syntax of your own. in c++ template methods (do i have the right terminology?) and the type system let you write "code" that is constructed into an ast at compile time (if i understand the technique correctly). in java, in contrast, i seem to be restricted to using a different language completely (via compiling to byte code), or moving things into xml config files, or relying on "patterns" as a way to describe how the objects fit together (it's been said in the past that lispdoesn't have patterns because you extend the language instead of making stories to aid the memory). so i'm wondering if i've missed something. One is that of using the language just like you'd do in the usual embedded dsl approach, just less nicely, i.e.: obj.expects(once()).method("receive").with(eq(message) ); this is an example of usage from the JMock library, obj is a mock opbject built at runtime to simulate a behaviour and check that it is used in the expected way. Another way is to have some mini language compiled to java code instead of bytecode directly. AFAIR this is what Jythonc and AspectJ do, and what is done in many "extending java" papers such as the recent implementing pi-calculus in java or old ones about Jam etc. indeedy. in fact the presentation that nat mentioned (and which i have finally got round to reading this sunday afternoon) is all about the evolution of jmock. it's very interesting - i encourage him to make it public and/or encourage others to leave comments on his web site asking him for copies... :o) Steve and I are writing it up as an article that will go in the BCS ACCU Overload magazine and we intend to write a more academic paper, possibly for OOPSLA or a similar conference. Suggestions of conferences or journals suitable for this material are very welcome. everything is name.verb(...). so i was wondering how people worked around that. Like this ? new Select().field("a").field("b").field("c").fromTable("abc").runQuery(); now that you point it out, i'm kicking myself - i was looking at c++ output streams at about the same time as i wrote my post! on the other hand, it's not as "languagey" as i'd hope, but it's certainly sweet. thanks. Polyglot is class library that is can be used to create a compiler for a language that is a modification to Java. Not exactly the same approach you were asking about, but it can be used for similar purposes. thanks, but that's too "complicated". this is for work, and anything that can't be done within the language is pretty much ruled out. i'm fighting enough battles over general design/architecture. i don't have the energy to start fighting over the technology as well, especially when java is already a leap forwards from fortran 66... The biggest strength of Java is that it stops you from doing this sort of thing. If you're debating architecture, I would say that Java is the wrong place to it. The java mindset is very much a "do it this way", and to be fair, "its way" isn't too bad. It scales with number of coders quite easily, and coders of almost any level can get tucked in quite quickly. That's why IBM like it -- you get almost linear increases in productivity with more coders. It may not be good for small teams of And exactly the sort of argument I so rarely see on this forum. There's some serious work to be done to determine just why Java scales so well over team sizes and is productive at such a large range of programmer skill levels. Some of it is clearly language, some of it is amazing tools, and some of it is community, but beyond that it gets hard to determine root causes. Scaling near-linearly with team size is very nice, and decidedly unusual for a programming technology, but I can't help but feel that there's still scope for super-linear scaling. It'll require much tighter team integrations and reuse support that currently exists, certainly. I've worked in Java for the past 5 years or so. but I don't understand what is meant by the assertion that it scales better than other languages. I've seen large Java teams and programmers with a wide range of skill levels using Java (successfully and unsuccessfully). However, these observations could simply be explained by the fact that Java is the mainstream business language of the moment (for reasons that may not be solely due to the quality of the language) so there are a lot of people using it. Can anyone offer examples or comparisons that illustrate how Java scales better than other languages? Some possibilities as to why Java scales so well with team sizes and skill-ranges (I'm not wedded to any of these): The standard and open-source-defacto-standard class libraries are enormous, and almost all of them work in every supported environment. No training up on some third-party threading system that only one guy on the team understands, and he misuses. No ditzing around trying to get Joe-Bob's String library to compile on your machine. Documentation for standard libraries is generally of very high quality. For scalability, this means vastly lower amounts of potentially-incompatible rework, in both specification and implementation. The modularization and encapsulation facilities in Java are adequate to the enterprise task (with caveats), and the defaults are generally well chosen. It takes novice programmers quite a bit of work to truly screw up application areas that they haven't been assigned to. In terms of scalability, this means that novice programmers can be used much more safely than in C++ or VB land. It also means that programmer tasks can be partitioned at many levels of granularity, which is necessary for large teams. Finally, with few exceptions the encapsulation and modularization functionality mean lower costs for integrating large systems (libraries don't conflict), which mean you can split up teams even more. Lack of control flow abstractions beyond strict single-dispatch polymorphic method call lowers the training requirements, clarifies module boundaries, simplifies documentation, and generally prevents confusion. Yes, this does come at a cost to expressiveness that many here find too high. Tooling is excellent, with very fast compilers, extremely clear and easy cross-platform build systems, shockingly powerful editors, and best-of-breed static and dynamic analysis systems, all available at low-or-zero cost. This means low per-developer fixed-costs, lower training costs, and generally easier availability of development talent. (Caveat: The cost and complexity of app-servers does somewhat limit this.) Lack of syntactic extensibility eases documentation, training, and integration costs enormously, and also helps bring the power of available tools up and their costs down. Yes, this does come at a cost to expressiveness that many here find too high. You know what? Libraries written in C are enormous as well. Here in my GNU/Linux system most of the standard interfaces are written in this arcane language. Everything from database interfacing, to GUI building to xml processing is C all the way. Most development tools are targeted for C. It's got years of mindshare, is a small language you can learn in a day and comes complete with lots of tools and libraries for any task imaginable. Why should i exchange that for the java ones when the C ones are faster and less bloated? Or why should i go through all the trouble of compiling higher-level wrapper bindings for higher-level languages? C clearly is the superior language, ain't it? Oh, yes, this does come at a cost to expressiveness that many here find too high. ...as nothing I wrote was toward the question of Java superiority. It was about scalability over the development team sizes and developer skill levels. C is a fine language, in which a huge amount of great software has been written. That said, there are real problems with putting novice programmers on C projects, and integrating C projects written to different libraries and environments. C has many virtues, but no one is going to include "portability", "safety", or "modularity" among them. Those hold back it's scalability, and keep development costs in C very high for large projects. (BTW, if your response was intended to be an ironic sendup of foam-flecked advocacy posts, it was well done, although it could have been a bit longer. The fanboyish 'GNU/Linux' reference was a perfect touch.) What's the problem with acknowledging the GNU project? C has many virtues, but no one is going to include "portability"... Sorry, but i will. C is far more portable than Java. It runs on all hardware imaginable. Write once, compile everywhere. Java runs on about a few supported platforms and that's it. If you're using specific resources from a specific platform, well, that's just as much of a portability problem as in Java or any other language... Those hold back it's scalability, and keep development costs in C very high for large projects. Perhaps. If you don't acknowledge a large project is actually just a lot of smaller subprojects interfacing with each other, that is. Naming conventions can ease the pain of a lack of proper namespaces... And C and C++ header files are a lot better to convey interfaces than searching through scattered method definitions inside java code or depending on huge, bloated IDEs to browse that... And Makefiles convey relationships between modules of a project just as nicely as well... but, yeah, my original post was sarcastic. i'm not recommending C as an example of a fine modern language... still, it's got some good points... Sorry, but i will. C is far more portable than Java. I was afraid of this :-). I think we must distinguish two notions of portability: (1) can be ported to many platforms, (2) has the same meaning on any platform it runs. I would rather call the former availability - C surely excels in that regard. I.e., It runs on all hardware imaginable. However, if by Write once, compile everywhere. you also suggest the latter then it is distinctively not true, as anybody knows who has ever struggled writing a "portable" C program. In that regard, Java is clearly superior, because it is much more high-level. ... uses portable, cross-platform, highly tested open-source C libraries. Just as in java. as anybody knows who has ever struggled writing a "portable" C program. most people who say that haven't touched C since the 80's... you'd be amazed with how much the free software infrastructure has changed that... most people who say that haven't touched C since the 80's... you'd be amazed with how much the free software infrastructure has changed that... I know, but it still cannot compete with a platform-independent high-level language/library, like Java is trying to be (with relative success). Here, all the pain of achieving portability is shifted to the language vendor. Also note that the such free libraries are usually written by highly competent people, who have decades of expertise in working around the inherent non-portability of C with lots of macros and conditional compilation. "Modern portable C code" is not automatic, it must be worked out. "Modern portable C code" is not automatic, it must be worked out. Yes, you see, i was talking about application software leveraging from such good infrastructure. It's not unlike in Java: people are building their apps using high-quality libs written by experienced infrastructure folks. like all the pain of achieving portability is shifted to the language vendor. exactly the same for C libs, written by GTK people and others... what's your point, then? A high-level language is an unbreakable abstraction barrier that can guarantee portability (and other desirable properties). No such thing is possible with C - you're on your own. And more likely than not will fail, unless you have access to all relevant platforms and are willing to test and debug on all of them. E.g. we just found out that our stuff does not work on 64 bit platforms, although we tried to be very careful about platform independent abstractions - a few things slipped through nevertheless and it's not easy to locate and eliminate them now. "A high-level language is an unbreakable abstraction barrier that can guarantee portability" yes, but... "although we tried to be very careful about platform independent abstractions - a few things slipped through" that's still your fault, not C... :) I find C to be sufficiently clear and high-level if i want to. Nothing fancy, but good enough when in company of rock-solid libs and a few nicely designed macros to ease the pain of lack of syntatic sugar for better control constructs. But yes, i never tried building a GTK app with PostgreSQL access and then try to make that run on Windows, Macintosh or Sparc, so beats me... that's still your fault, not C... :) Sure, but my whole point was: in contrast to your original claim, C is not portable per se - you have to carefully craft your code for portability (and in fact, you always have to rely on a lot of silent assumptions, because there are much more subtleties than most people realize). Some time ago, I had an idea for an interesting project (don't know whether it's new): building a test-bed implementation of C that completely randomizes behaviour on all aspects that are actually undefined or implementation-defined according to ISO. Not sure whether people would like it, though, because you probably wouldn't be able to write even the most trivial programs in it reliably ;-). Yes, if you expend a lot of up-front effort, you can productively program in C. That effort largely comes in the form of training. Training to avoid the thousands of gotchas, training in extra-linguistic idioms (naming conventions, makefiles) necessary to manage language deficiencies, training in the extra-linguistic tooling necessary to build and deploy, training to find the errors that occur when conventions are inevitably broken, training to find adequate libraries and assess their weaknesses, training, training, training. Once you've got all that training, though, you are quite right that C you can be perfectly productive, although I would say that their are still high ongoing costs. Without the training, you're a disaster waiting to happen, and of high negative value to your employer. From the point of view of a developer, that's actually a pretty great deal. Training in difficult but necessary skills makes them more valuable, and increases their security. Once they are trained, they can view the training costs as sunk, and simply ignore them, as you seem to be. From the point of view of those who employ developers, things aren't so rosy. Training costs a fortune, and drives up the costs of hiring already-trained developers. The dead-weight cost of all that training makes it very tough to scale teams. My initial comments about how Java scales well with team size pretty much all boil down to Java having greatly lower training costs. Makes me wonder how much of the recent IT slump could be attributed to the rise of Java, VB, and related technologies. A Java or VB programmer is simply less expensive to train and maintain than a C programmer is, and in the short term that will lead to lower compensation if shops switch from C to technologies with lower cost profiles. Declining compensation means a temporary unemployment surge, as programmers search for lower-paid employment (rather that staying in one place with pay cuts). Interesting. With most of your claims. But still, look at your desktop (I am assuming your staring at one at this moment) and the programs you are running. How many code bits in memory are compiled C? 80%? 95%? They must be doing something right. C also has huge numbers of libraries that are standardised. I suspect that the reason why java scales only linearly is that because it doesn't allow you decent abstractions, good programmers don't add as much as they could, while poor programmers will find it relatively easy to understand existing code (because they won't be shocked by an abstraction which would have yielded comprehensibility benefits beyond their imaginings if they could have been bothered to understand it), and the use of the garbage collection and exception tracing ameliorates the problems of sloppy programming. C code targeted for a particular platform rarely runs unmodified on another platform unless you put in a bunch of conditional compilation statements (how big is an int anyway?) The fact is that Java code very rarely is numerical, instead dealing with business logic. In these cases, the size of numerical types is irrelevant. I'm not particularly keen on Java, so I'm not sure who what windmills you're arguing against. Anyhow, if java code overflows, then that overflow should occur on any platform given that you are actually running code against the same (virtual) machine. I mention int size in passing because C does not specify the range for it's most basic of basic types. Could be that it's 8, 16, 32, 64, 128, or even 9 bits. Yes, everyone ends up programming around such a basic non-standardization of type (giving us a proliferation of basic types with annoying X_ names). My point is that for most java applications it simply wouldn't make a difference if the size of types were not standardised. ANSI C remains the most portable language available. To repeat my argument from above: being the most widely available language does by no means make it the most portable one. As a low-level language it's far away from being the latter. The language I like to pit Java against is Python. The former tends to be use for "enterprise" applications — sprawling hundred KLOC applications, possibly distributed over a global cluster, etc. worked on by large teams from different continents. IBM's Websphere Application Server, for instance; Portal would sit on top, then you get other things like Lotus Workplace, and addons that utilizes Portal's XML rendering for other things. The resulting application requires no less than 2 AIX servers and possibly a few helping dual Xeon blades, and then still takes 30 minutes to start (if you're lucky). Python, on the other hand, tends to be more dainty. Little configuration apps for Linux desktop distros (Ubuntu and Fedora), or at most a whole package management system (Gentoo). The teams that produces these aren't very large either, one being very common and most would not be over 5. The question is why? (That's purely a question, I don't have an answer) As far as super-linear scaling goes, I think it would be nice too, but I can't think of even one situation. Python I would argue scales super-linearly with lines of code, but any decently orthogonally organised language will; Java, being very hierachical only does so linearly. In terms of people, it becomes interesting. I would say that again, for a small team, Python get a faster head start (the first derivative is bigger near zero), but it has a negative second derivative (damn those pesky second derivatives!) </physics-geek>. :D I do wonder though if the smaller Python teams result not because they don't scale, but because they don't need to scale. I've certainly never thought "this Python app is really difficult to develop -- if only I could turn it into Java and hire a bigger team". In other words, are Java apps too large and the teams larger than necessary? I would think a suggestion to redo Portal and LWP in python wouldn't go done well... I think the reason is more political than technical. In my experience Java is often selected by large IT shops for political or dogmatic reasons rather than on its technical merits. In big enterprises, your worth is usually judged by the number of people underneath you, so the IT manager or architect chosing Java is also likely to want to build a large team. Python is not a language that has a big marketing budget or hype bandwagon behind it. If it's chosen, it's chosen for technical reasons -- code clarity, for example -- by people who are trying to get things done, not climb the corporate greasy pole. If you're debating architecture, I would say that Java is the wrong place to it. i think you're confusing two different things. i was asking about embedding languages in java for my own benefit and as a "low level" implementation tool. when i referred to arguing about architecture i was referring to things like using service oriented architecture, or not, and what that "really means" (do you use federated jms or a single server; where do you put the trade-off between few, complex messages with low coupling and simple, frequent messages with higher coupling; etc). these are options within the general "java way" as far as i can see. Hi Andrew, I might recommend you take a look at Sleep:. Sleep is a scripting language built for Java with several hooks that allow one to extend and add on to the language. The base language is inspired from Perl. I like Sleep, but I'm kind of biased, I wrote it. Maya is a Java compiler that can be extended with user-defined macros. LtU discussion. Though not Java, Nemerle's macros are like Maya but even easier to use. Scala gets pretty far without allowing users to muck with the AST. Look at the section titled "Scala is extensible". Scala compiles to Java bytecode so it might be of use to you. Steve Freeman and I gave a presentation at SPA'05 entitled "Evolving an Embedded Domain Specific Language in Java". We will be presenting something very similar at JAOO this year, probably also addressing our experience with C#. If you wish, I can send you the PowerPoint slides and notes. thanks. i'm about to email you for the info, since i suspect people may no longer be reading this (now old) thread. Oh, we are reading it alright... Slides. Frink's lexical analyzer and parser is built using a combination of JFlex and JavaCUP. (Ooh, I just noticed that JavaCUP has moved and has new features added!) JFlex and JavaCUP both allow you to relatively easily build a parser for a domain-specific language that can integrate well with existing code. Granted, this is not really "in" the Java language, meaning they share the same parser, but they can share the same memory space, objects, and references.
http://lambda-the-ultimate.org/node/780
CC-MAIN-2019-35
refinedweb
4,199
61.77
When I was learning Python, I of course read the usual warnings. They told me: You can do from something_or_other import * but don’t do it. Importing star (asterisk, everything) is a Python Worst Practice. Don’t “import star”! But I was young and foolish, and my scripts were short. “How bad can it be?” I thought. So I did it anyway, and everything seemed to work out OK. Then, like they always do, the quick-and-dirty scripts grew into programs, and then grew into a full-blown system. Before long I had a monster on my hands, and I needed a tool that would look through all of the scripts and programs in the system and do (at least) some basic error checking. I’d heard good things about pyflakes, so I thought I’d give it a try. It worked very nicely. It found the basic kinds of errors that I wanted it to find. And it was fast, so I could run it through a directory containing a lot of .py files and it would come out alive and grinning on the other side. During the process, I learned that pyflakes is designed to be a bit on the quick and dirty side itself, with the quick making up for the dirty. As part of this process, it basically ignores star imports. Oh, it warns you about the star imports. What I means is — it doesn’t try to figure out what is imported by the star import. And that has interesting consequences. Normally, if your file contains an undefined name — say TARGET_LANGAGE — pyflakes will report it as an error. But if your file includes any star imports, and your script contains an undefined name like TARGET_LANGAGE, pyflakes won’t report the undefined name as an error. My hypothesis is that pyflakes doesn’t report TARGET_LANGAGE as undefined because it can’t tell whether TARGET_LANGAGE is truly undefined, or was pulled in by some star import. This is perfectly understandable. There is no way that pyflakes is going to go out, try to find the something_or_other module, and analyze it to see if it contains TARGET_LANGAGE. And if it doesn’t, but contains star imports, go out and look for all of the modules that something_or_other star imports, and then analyze them. And so on, and so on, and so on. No way! So, since pyflakes can’t tell whether TARGET_LANGAGE is (a) an undefined name or (b) pulled in via some star import, it does not report TARGET_LANGAGE as an undefined name. Basically, pyflakes ignores it. And that seems to me to be a perfectly reasonable way to do business, not just for pyflakes but for anything short of the Super Deluxe Hyperdrive model static code analyzer. The takeaway lesson for me was that using star imports will cripple a static code analyzer. Or at least, cripple the feature that I most want a code analyser for… to find and report undefined names. So now I don’t use star imports anymore. There are a variety of alternatives. The one that I prefer is the “import x as y” feature. So I can write an import statement this way: import some_module_with_a_big_long_hairy_name as bx and rather than coding x = some_module_with_a_big_long_hairy_name.vector I can code x = bx.vector Works for me. I use some “standard” (jokingly, of course) abbreviations: import itertools as it, operator as op, functools as ft, unicodedata as ud I don’t think I abbreviate other stdlib modules. I always try to avoid star imports myself. I usually try to import only what I need (including functions and classes from stdlib modules and packages). I recently fixed some stuff in CVS of pychecker to deal with star imports and following what they import exactly. I´d be interested in having you try it out and see if it was able to catch the problems you saw that pyflakes couldn´t ? Feel free to drop me a line! T I hope to have some time soon. If I do, I’ll let you know what happens. Thanks for this update! I’m under the impression that pylint will actually load all the modules needed for star imports. You might want to give that a try! Yeah, I would take away from it the opposite – don’t use pyflakes. It sounds “flaky.” A bug in the pyflakes module doesn’t really sound like a convincing argument to me. PEP8 mentions “Modules that are designed for use via from M import *”, and it’s written by Guido Van Rossum, so I think it’s safe to trust that document. Anyway, I wouldn’t be so categorical: there are modules where importing * just doesn’t affect readability at all “by design” (as Guido says…). Do you really think it’s likely that after importing * from socket you’ll want to redefine AF_INET in your namespace? I’m new to Python and the like the author have read the warnings about using import * but I was wondering if this warning extends to tkinter where even the official tutorial uses: from tkinter import * I don’t know of anything that makes importing star less-bad for tkinter than for any other module. Personally, I usually code “import tkinter as tki” and then fully qualify everything, for example “tki.TOP”. Official tutorials can be wrong. When I first wrote EasyGui, the EasyGui tutorial used “from easygui import *”. That was a bad idea, and I’m slowly fixing the EasyGui tutorial so that the code examples no longer use “from easygui import *”. I expect the same is true of tkinter. That is, I suspect that originally the tkinter tutorial was written using import star. Today nobody would write it that way, but nobody has got around to systematically re-writing the tutorial. That was a lot simpler than I thought it would be. Took me awhile to work out why my widgets were a mix of original and themed though. It’s kind of ridiculous for people to call this a “bug in pyflakes”. pyflakes is only “quick-and-dirty” in the sense that it’s a very simple tool, and designed to run fast. It’s really neat if some static code analysis tools can go out and cross-reference other files to get a fuller picture, but I really like what pyflakes is today and I hope it never tries to implement tricks for analyzing star imports. See, if pyflakes can catch something, it means you can discover it without having to go look at another source file. If pyflakes can’t catch something, a lot of other programmer’s tools (and a lot of programmers) are going to get confused by it. (In fact, python is one of very few languages with namespace rules simple and consistent enough that tools as simple as pyflakes can find any interesting bugs.) The question is: when you’re using star imports, how much are you giving up, and how much are you gaining? Star imports have their places. Usually they work very well in very short scripts that are importing very little besides the one big star import. A lot of tutorial code falls under that heading, and I certainly wouldn’t call them “wrong” for doing it. But I’ve never regretted using explicit imports, and I’ve never been glad I used a star import. All that said, if you absolutely must use “import *” in serious projects, I beg of you, at least _try_ to follow some guidelines: – keep it localized in very short modules with very specific purposes – do not use multiple star imports in the same file, or “chain” star imports – consider using “import X as Y” to abbreviate names instead
http://pythonconquerstheuniverse.wordpress.com/2011/03/28/why-import-star-is-a-bad-idea/
CC-MAIN-2014-35
refinedweb
1,293
71.75
I could do this on my own, but I thought I'd throw this to you guys to help out. I'm trying to do this fast (next 24-48 hours) as I want to test a new content type we are launching here on CodeGuru. What I need is a test. This first test is to test a person's knowledge on C#. Let's keep this to BASIC knowledge, so a very intro level quiz as a start. I'd like to come up with about 10 questions that have multiple choice answers. If you want to suggest a question, post it to this thread along with possible answers. The next post will be an example from me to get things rolling. Again -- This is a BEGINNING / BASIC test. We can follow this with tests on specific topic areas as well as more advanced tests. If someone scores perfect on this test, we can say they know what C# is.... Thanks for your input! Brad! ----------------------------------------------- Brad! Jones, CodeGuru.com Site Director Developer.com Network Director / EiC webmaster@codeguru.com (My Latest Book) ----------------------------------------------- Proposed question (#1): What is C#? (1) A proprietary language created by Microsoft used on the Windows platform (2) A proprietary language created by Microsoft that while primarily used on Windows can also be use don Linux and other platforms (3) A language created by Microsoft and standardized by ECMA as an open standard. (4) A derivative of Java for the Microsoft Windows Platform (5) A language created by Microsoft that is used to create native applications on versions of Windows starting with Windows Vista. Last edited by Brad Jones; March 12th, 2013 at 12:11 PM. Proposed Question (#2) Understanding the execution of a C# program is important. Which is true about the execution of C# programs? (1) C# programs are generally compiled to native code, which is then installed on the target platform. (2) C# programs are compiled to an intermediary language that is then executed on a common language runtime. (3) C# programs are not compiled, but rather are interpreted at runtime. (4) C# program contains everything it needs to run on all Windows machines (5) None of the above are true. Proposed Question (#3) Which of the following is a valid "Hello world" program in C#? (1) Example 1: Code: class Hello { void Main() { System.Console.WriteLine("Hello world"); } } (2) Example 2: Code: program HelloWorld; begin writeln('Hello World'); end. (3) Example 3: Code: class Hello { public static void Main() { System.Console.WriteLine("Hello world"); } } (4) Example 4: Code: public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } } (5) Example 5: Code: Public Module modmain Sub Main() Console.WriteLine ("Hello World using Visual Basic!") End Sub End Module class Hello { void Main() { System.Console.WriteLine("Hello world"); } } program HelloWorld; begin writeln('Hello World'); end. class Hello { public static void Main() { System.Console.WriteLine("Hello world"); } } public class HelloWorld { public static void main(String[] args) { System.out.println("Hello, World"); } } Public Module modmain Sub Main() Console.WriteLine ("Hello World using Visual Basic!") End Sub End Module Last edited by Brad Jones; March 12th, 2013 at 12:09 PM. Questions look fine. Minor nit - Hello World should include an exclamation point in the text. Code: System.Console.WriteLine("Hello world!"); System.Console.WriteLine("Hello world!"); My Code Guru Articles It' s not an exciting day, so no exclamation point in my sample..... Okay Arjay - you are a king of coding, so I'd expect you to be able to crank out a few simple questions for me to use as well.... please Last edited by Brad Jones; March 12th, 2013 at 01:41 PM. Is this an ad hoc set of questions for evaluating the new functionality, or is this going to be actual content? IMO, you should ditch the first question, as it's not all that important on a basic level. These are some topics or ability tests that the question should cover: what is the target environment, the ability to recognize a C# program, the knowledge that it's a managed language, that there's a difference between value types and reference types (maybe not so basic, but certainly fundamental), the basics of classes - that it defines a type, that it can have members, like fields, properties and methods, and the difference between a class and an instance, and maybe some other questions, depending on what knowledge its supposed to test for. How many questions do you need? Are all of them to be in the same format? And could you more precisely specify how basic is "BASIC"? That is, what is the knowledge being tested? Basic info and the simple ability to recognize C# code? The ability to write a simple C# program. The basic ability to use some elements of the .NET library? What? To answer your questions: This sample test is to test the new functionality, but it will also go live on the site, so it will be real content. The 'basic' was just to do something fun and relatively easy. I can do a set of questions on any topic. While each post could have an unlimited number of questions with an unlimited number of answers, I'd prefer to create something that is between 5 and 10 questions long with 10 seeming to be a good target. The format of the questions/answer is multiple choice. I can work any HTML markup into the question and the answers, so that gives a little flexibility. There is no free form coding or anything like that in this first example. Questions can have an unlimited number of answers, as I indicated, but I suggest keeping it between two and five. In addition to the questions and answers, I also have the ability to display a response if the person answers the question wrong. As such, this gives us a chance to indicate which answer was correct and why the others might have been wrong. It also let's us do things such as point (link) to the FAQs that have been created on the forum for more information. This isn't a revolutionary feature, but it should be interesting. In addition to this basic quiz for C#, I can do quizzes on any programming topic. I'll create a word doc template that can be used to set up a new "Tech IQ" test in case someone wants to build a couple for the site. I could see these set up broadly or specific. For example: Tech IQ: Test your knowledge of Windows 8 (broad) Tech IQ: Test your knowledge of Generics in C# (pretty specific) I'd be curious to see someone write 10 questions that are super hard-core C# (or VB or C++) as a test under a title such as "Are you a hardcore C# developer?" (or VB or C++). Those are a bit more difficult though, so I thought I'd try to start with 10 simple, basic questions on C# to get a sample build and launched. Make sense? I've rambled a bit, so if it doesn't, let me know.... Last edited by Brad Jones; March 12th, 2013 at 02:17 PM. Here are some suggestions. You'll notice that most of them ask very basic questions about classes, that is, they are about a fundamental OO concept, rather than things like functions, variables, conditionals, control flow statements, etc. This is inevitable since in C# you can't make anything that's not a part of a class. Sure, one could still circumvent this to some extent, but IMO, it's a wrong way to introduce the language to a beginner. Thus, all of these questions are rather general in nature, and ask about the basics of the C# language, without going to much into the details of the actual code. I understand that beginners might not be able to answer some of the questions, but, hey, it's a great opportunity for them to learn something important. The format I used here, for the sake of clarity is: Question? Correct answer-A list of wrong answers. The answers offered should be shuffled, of course. Please correct any grammar mistakes you spot. Which of the following is a valid "Hello world" program in C#? use your example Which one of these represents a standard entry point to a desktop program? // Note: had to specify "desktop", since now this is different for Win Store Apps (unless I'm mistaken) public static void Main()-public static class Programpublic void Main()Console.WriteLine();Application.Run(new Form1());namespace MyApplicationusing System.Windows.Forms;public static void Run() What are the names of the most commonly used fundamental types supported by the language? int, float, double, bool, string-do, for, while, break, as, continuevoid, out, switch, if, goto, usingConsole.WriteLine(), Console.ReadLine(), Application.Run() What is a class? A user-defined type, which represents some concept by describing it in terms of state and associated behaviors.-A user-defined function, which can be used from other parts of the program.A predefined body of code which is generated by an IDE when a new C# project is started.Another name for a C# file. Which of these denote basic kinds of class members? Fields, properties and methods.-Console.WriteLine(), Console.ReadLine(), returnInput parameters, output parameters, and a return type.A backing field, a get block, and a set block.Namespaces, modules and assemblies. How classes represent state (data) and behavior? Class fields and properties are used to represent state, while methods implement behaviors.-Class fields and poperties represent behaviors, while methods store state.Class fields and methods are used to represent state, while properties implement behaviors.Classes represent only state, never behavior.Classes do not represent state or behavior, they just define new types. What is the public interface of a class? The public interface comprises all the public class members.-The public interface comprises all non-public class members.The public interface comprises public properties only.The public interface comprises public methods only.The public interface comprises public events only.The public interface is an abstract data type that is implemented by concrete classes. What is the difference between classes and their instances (objects)? Classes define a type, a blueprint of sorts, from which individualized objects of the class can be created.-While objects need to be created from classes, there's effectively no difference between them.Classes are reference types, while objects are value types.Objects define an abstract type, from which individual, concrete classes can be derived.Classes can have private members, while objects cannot. How objects of different types generally interact? Via the public interfaces of their respective types.-Via their private members (events, methods, properties, fields).Via events defined in the Form class.Via saving and reading data to/from a file.Via a database. What is the difference between value types and reference types? Value types directly contain their data, and are passed around by value (copied), while reference types point indirectly to their data and are passed by reference.-Value types directly contain their data, but are passed around by reference, while reference types, which point to their data indirectly, get passed by value.Value types indirectly point to their data, and are passed by value, wheres reference types contain their data directly, and are passed by reference.There is no significant difference, other than that the value types are meant to be small and simple, while classes can be more complex. Which of these is true? Classes define reference types, while structs define value types.-Classes define value types, while structs define reference types.Both classes and structs define reference types.Both classes and structs define value types.Classes and structs do not define types, they define objects. Which statement is correct? C# is compiled to an intermediate language, which is then in turn just-in-time compiled (upon execution) via the runtime to platform-specific bytecode.-C# is an interpreted language, but can be compiled for a specific platform.C# is compiled to an intermediate language, which can then can be interpreted by the runtime only on Windows.C# is interpreted, and due to the fact that it is managed cannot be compiled, but C# programs can be run on several platforms. C# is a managed language. What this means? Memory allocation and deallocation, and some other aspects of the program, are managed by the runtime, not the programmer.-It means that it comes with an IDE which has advanced project management capabilities.It includes database management libraries and tools.It is based on a standard which is managed and developed by Microsoft. If that's somewhat inadequate, we could formulate some questions about variables, methods, metod parameters and return types, method calls, etc. - the traditional, non-OO imperative programming. P.S. If anyone spots some errors, please report. Last edited by TheGreatCthulhu; March 12th, 2013 at 11:18 PM. I need to edit the text on this a little bit, but go ahead and check out: Tech IQ: Are You Better than a C# Rookie? No going backwards, so make sure you pick the right answer the first time! Brad! Last edited by Brad Jones; March 19th, 2013 at 10:26 AM.. TechIQ Guidelines.docx Brad! I had a few strange things happen. On one of the missed answers the correct answer didn't show up like on others. At some points during the quiz, I was not able to select an answer and have to refresh the screen to be able to continue. I am using Chrome as the browser. I noticed a spelling error in Q6, 1 st answer: popert"). Forum Rules
http://forums.codeguru.com/showthread.php?535651-Check-whether-webpage-has-changed&goto=nextoldest
CC-MAIN-2017-04
refinedweb
2,295
66.03
PEP 573 – Module State Access from C Extension Methods - Author: - Petr Viktorin <encukou at gmail.com>, Nick Coghlan <ncoghlan at gmail.com>, Eric Snow <ericsnowcurrently at gmail.com>, Marcel Plch <gmarcel.plch at gmail.com> - BDFL-Delegate: - Stefan Behnel - Discussions-To: - Import-SIG list - Status: - Final - Type: - Standards Track - Created: - 02-Jun-2016 - Python-Version: - 3.9 - Post-History: - Table of). While this PEP takes an additional step towards fully solving the problems that PEP 3121 and PEP 489 started tackling, it does not attempt to resolve all remaining concerns. In particular, access to the module state from slot methods ( nb_add, etc) is not solved.). Heap Type A type object created at run time. Defining Class The defining class of a method (either bound or unbound) is the class on which the method was defined. A class that merely inherits the method from its base is not the defining class. For example, int is the defining class of True.to_bytes, True.__floor__ and int.__repr__. In C, the defining class is the one defined with the corresponding tp_methods or “tp slots” [1] entry. For methods defined in Python, the defining class is saved in the __class__ closure cell. C-API The “Python/C API” as described in Python documentation. CPython implements the C-API, but other implementations exist.or for systems that enable extension module reloading. - Loading multiple modules from the same extension is possible, which makes it possible to test module isolation (a key feature for proper sub-interpreter support) assumption does not hold for modules that use PEP 489’s multi-phase initialization, so PyState_FindModule is unavailable for these modules. A faster, safer way of accessing module-level state from extension methods is needed. Background The implementation of a Python method may need access to one or more of the following pieces of information: - The instance it is called on ( self) - The underlying function - The defining class, i. e. the class the method was defined in - The corresponding module - The module state In Python code, the Python-level equivalents may be retrieved as: import sys class Foo:. In CPython, the defining class is readily available at the time the methods need to access per-module state must be a heap type, rather than a static type. This is necessary to support loading multiple module objects from a single extension: a static type, as a C-level global, has no information about which module object usable if performance is not a problem (such as when raising a module-level exception). - Storing a pointer to the defining class of each slot in a separate table, __typeslots__[2]. This is technically feasible and fast, but quite invasive. Modules affected by this concern also have the option of using thread-local state or PEP 567 context variables as a caching mechanism, or else defining their own reload-friendly lookup caching scheme. Solving the issue generally is deferred to a future PEP. Specification Adding module references to heap types A new factory method will be added to the C-API for creating modules: PyObject* PyType_FromModuleAndSpec(PyObject *module, PyType_Spec *spec, PyObject *bases) This acts the same as PyType_FromSpecWithBases, and additionally associates the provided module object with the new type. (In CPython, this will set ht_module described below.) Additionally, an accessor, PyObject * PyType_GetModule(PyTypeObject *) will be provided. It will return the type’s associated module if one is set, otherwise it will set TypeError and return NULL. When given a static type, it will always set TypeError and return NULL. To implement this in CPython, the PyHeapTypeObject struct will get a new member, PyObject *ht_module, that will store a pointer to the associated module. It will be NULL by default and should not be modified after the type object is created. The ht_module member will not be inherited by subclasses; it needs to be set using PyType_FromSpecWithBases for each individual type that needs it. signature flag, METH_METHOD, will be added for use in PyMethodDef.ml_flags. Conceptually, it adds defining_class to the function signature. To make the initial implementation easier, the flag can only be used as (METH_FASTCALL | METH_KEYWORDS | METH_METHOD). (It can’t be used with other flags like METH_O or bare METH_FASTCALL, though it may be combined with METH_CLASS or METH_STATIC). C functions for methods defined using this flag combination will be called using a new C signature called PyCMethod: PyObject *PyCMethod(PyObject *self, PyTypeObject *defining_class, PyObject *const *args, size_t nargsf, PyObject *kwnames) Additional combinations like (METH_VARARGS | METH_METHOD) may be added in the future (or even in the initial implementation of this PEP). However, METH_METHOD should always be an additional flag, i.e., the defining class should only be passed in if needed. In CPython, a new structure extending PyCFunctionObject will be added to hold the extra information: typedef struct { PyCFunctionObject func; PyTypeObject *mm_class; /* Passed as 'defining_class' arg to the C func */ } PyCMethodObject; The PyCFunction implementation will pass mm_class into a PyCMethod C function when it finds the METH_METHOD flag being set. A new macro PyCFunction_GET_CLASS(cls) will be added for easier access to mm_class. C methods may continue to use the other METH_* signatures if they do not require access to their defining class/module. If METH_METHOD is not set, casting to PyCMethodObject is invalid. Argument Clinic To support passing the defining class to methods using Argument Clinic, a new converter called defining_class will be added to CPython’s Argument Clinic tool. Each method may only have one argument using this converter, and it must appear after self, or, if self is not used, as the first argument. The argument will be of type PyTypeObject *. When used, Argument Clinic will select METH_FASTCALL | METH_KEYWORDS | METH_METHOD as the calling convention. The argument will not appear in __text_signature__. The new converter will initially not be compatible with __init__ and __new__ methods, which cannot use the METH_METHOD convention. Helpers Getting to per-module state from a heap type is a very common task. To make this easier, a helper will be added: void *PyType_GetModuleState(PyObject *type) This function takes a heap type and on success, it returns pointer to the state of the module that the heap type belongs to. On failure, two scenarios may occur. When a non-type object, or a type without a module is passed in, TypeError is set and NULL returned. If the module is found, the pointer to the state, which may be NULL, is returned without setting any exception. Modules Converted in the Initial Implementation To validate the approach, the _elementtree module will be modified during the initial implementation. Summary of API Changes and Additions The following will be added to Python C-API: - PyType_FromModuleAndSpecfunction - PyType_GetModulefunction - PyType_GetModuleStatefunction - METH_METHODcall flag - PyCMethodfunction signature The following additions will be added as CPython implementation details, and won’t be documented: - PyCFunction_GET_CLASSmacro - PyCMethodObjectstruct - ht_modulemember of _heaptypeobject - defining_classconverter in Argument Clinic Backwards Compatibility One new pointer is added to all heap types. All other changes are adding new functions and structures, or changes to private implementation details. Implementation An initial implementation is available in a Github repository [3]; a patchset is at [4]. Possible Future Extensions Slot methods A way of passing defining class (or module state) to slot methods may be added in the future. A previous version of this PEP proposed a helper function that would determine a defining class by searching the MRO for a class that defines a slot to a particular function. However, this approach would fail if a class is mutated (which is, for heap types, possible from Python code). Solving this problem is left to future discussions. Easy creation of types with module references It would be possible to add a PEP 489 execution slot type to make creating heap types significantly easier than calling PyType_FromModuleAndSpec. This is left to a future PEP. It may be good to add a good way to create static exception types from the limited API. Such exception types could be shared between subinterpreters, but instantiated without needing specific module state. This is also left to possible future discussions. Optimization As proposed here, methods defined with the METH_METHOD flag only support one specific signature. If it turns out that other signatures are needed for performance reasons, they may be added. References This document is placed in the public domain or under the CC0-1.0-Universal license, whichever is more permissive. Source: Last modified: 2022-04-20 09:53:08 GMT
https://peps.python.org/pep-0573/
CC-MAIN-2022-27
refinedweb
1,396
53.81
The Cisco & IETF LISP Protocol is not a Locator - Identifier Protocol, because it does not involve a separate namespace for Identifiers Please see the page ../ for the full context of this. Established 2011-11-02 Robin Whittle rw@firstpr.com.au Minor updates 2011-11-03 Here is a longer explanation which assumes no knowledge of the LISP protocol or the IRTF Routing Research Group work in recent years on scalable routing. Scalable routing ---------------- The main. For more on Scalable Routing, see the main Ivip page: ../../ . For more on the meaning of the term "namespace": ../ ) LISP, along with other proposed architectures such as my Ivip (derived from some basic LISP principles) IRON, ILNP and others, is intended as a scalable routing solution - something which can be adopted by the current Internet to solve the scalable routing problems in the long-term, and hopefully within not to many years. LISP, or Ivip or whatever, is intended to provides.) The LISP Protocol & the Locator and Identifier functions of IP addresses ------------------------------------------------------------------------ The LISP protocol doesn't affect hosts. The semantics of IP addresses for hosts remains unchanged from today's arrangement in which the IP address functions both as a routing Locator (used by routers to to figure out how to get the packet to its destination) and as a "host Identifier" (used by hosts to identify each other). Alternatively we might think of the Identifier function being an "endpoint" Identifier, since one host could have one or more physical interfaces, each of which responds logically to one or more multiple IP addresses - and we can think of each such IP address sending and receiving function as an "endpoint". (This is my guess of what "endpoint" might mean. Other people may use the term differently.) I argue that this "overloading" of both Locator and Identifier functionality on the one IP address is a very good thing - despite the attraction many people have felt for using separate Identifier and Locator objects, each with their own namespace: "Overloading" of Loc & ID functions is good for hosts and should be maintained 2010-06-22 The host only interprets the IP address in the destination field of an outgoing packet as a routing Locator if the host contains routing functions - that is, if it has two or more physical interfaces and so needs to decide which interface to send the packet from. Assuming that the host doesn't contain any LISP protocol functionality (an ITR function) then the host's routing function will use normal router principles to figure out which interface to send the packet from. (These normal router principles involve matching the destination address to the most specific prefix - the longest matching prefix - which is assigned to a given interface, and sending the packet out that interface. It is a simple, mechanistic, algorithm - but is expensive to implement at gigabit speeds with hundreds of thousands of prefixes.) Generally speaking, the same is true of edge networks, if we assume (for simplicity) that the LISP protocol's ITRs and ETRs are always located at the borders of these edge networks: all hosts and routers within edge networks are unaltered by introducing the LISP protocol, so they interpret both the Identifier and Locator meanings of an IP address in the same way as they always did. (Actually, ITRs can be inside the edge networks, potentially inside the hosts and can also be in the DFZ = in ISP networks rather then and-user edge networks.) With the LISP protocol, the Identifier functionality of an IP address never changes. There is no new Identifier namespace. GSE, HIP and ILNP are Loc-ID Separation protocols, because they all involve the creation of a new namespace for host (or "endpoint", if you like) Identifiers. The objects which are used as identifiers may or may not have the same format and number of bits as an IP address. If they have a different number of bits, then they must have a different namespace from the IP address namespace, because they can't be interpreted according to the IP address namespace. Even the Identifier objects have the same number of bits as an IP address, a Loc-ID Separation architecture interprets them according to totally different rules than for IP addresses. That is to say, these Identifiers are interpreted according to a namespace which is different from the IP address namespace. With the LISP protocol, the IP address 76.54.32.10 (or any other IPv4 global unicast IP address) has exactly the same host/endpoint Identifier functionality and semantics, no matter whether this IP address falls within the LISP protocol's "EID" subset of the set of global unicast addresses, or within the remaining subset, which in the LISP protocol are called "RLOC" addresses. The LISP protocol does not affect how the packet is handled within edge networks. So within edge networks (hosts and routers) the routing Locator semantics of the IP address are also unchanged by the LISP protocol - again irrespective of whether the address is within one of the LISP protocol's EID prefixes or not. A LISP protocol's ITR's (Ingress Tunnel Router) job is to find packets leaving an edge network for the "core" - the networks of ISPs, in which BGP is used to handle routing between ISP networks. The "core" is also broadly synonymous with the Default-Free Zone (DFZ) where BGP routers have no single "upstream" interface, and so can't apply a "default route" for a single interface to any packet whose destination address does not match a relatively small set of prefixes of the current end-user or ISP network. The LISP protocol uses ITRs, ETRs (Egress tunnel routers - these are Ingress into a tunnel and Egress out of the tunnel) and a global mapping system to get packets across the core to end-user (edge) networks which are using LISP-protocol-mapped EID address space. ITRs do this using an algorithm which is totally different from the normal "longest matching prefix" forwarding behavior of routers (whether the routers use an IGB or the global BGP system). In the LISP protocol, there is a subset of global unicast address space which is known as "EID" space. IP addresses in this subset may be referred to as "LISP-protocol-mapped", though I think this is not official LISP protocol terminology. This means that a query to the LISP protocol mapping system for any address within an EID prefix will return a response that it is in such a prefix. If the end-user network, whose EID prefix this is, is multi-homed via two or more ISPs, then the mapping will contain two or more ETR addresses, one for each of the ETRs which can be reached via the various ISPs. The LISP protocol works by providing a new system of interpreting a destination IP address for the purposes getting packets from one edge network to another than by relying on the global BGP system. In other words, between ITRs and ETRs (across the "core"), the LISP protocol has a second way of interpreting the destination IP address for the purpose of using it as a routing Locator - which is only used IF the destination address matches one of the EID prefixes. ITRs forward packets not addressed to EID prefixes in exactly the same way as ordinary packets. (Since ETRs are not located in EID prefixes, when an ITR tunnels a packet to an ETR, this packet with its new outer header is handled by the normal router functionality of the ITR, and is handled normally by all the non-LISP-protocol-aware conventional routers between the ITR and the ETR.) ITRs examine the destination addresses of outgoing packets, and when they find one which matches an EID, the ITR obtains, via the mapping system, the one, two or more ETR addresses by which the destination edge network could be reached. Exactly which one of these to choose is up to the ITR - and LISP protocol ITRs need to figure out this choice on their own, independently, depending on what they decide about the reachability of each ETR. (A problem is that there isn't a way they can be sure an ETR can get the packet to a destination network.) This this means each ITR will ideally be able to choose at least one ETR by which it can deliver the packet. The packet is then encapsulated and tunnelled to the chosen ETR. The ETR decapsulates it and forwards it to the destination edge network, which uses perfectly ordinary routing "Locator" semantics with the destination address to forward the packet to the destination host. So what the LISP protocol does is define a dynamically changeable (as EID prefixes are added to the global LISP protocol system) subset of the global unicast address space in which its ITRs and ETRs will implement different "Locator" semantics to the semantics which is used by the ordinary routing system. This is a perfectly excellent thing to do - since it achieves the goal of edge networks being physically connected via ISPs which do not advertise the edge-network's prefix(es) to the DFZ, and being able to keep this address space no matter which ISP they connect with, including dynamically if one ISP fails. (The LISP protocol extends this to mobility, with each MN being its own ETR - but this can't work behind NAT and when the MN gets a new IP address, there's no way the ITRs which are sending it packets can securely get the new mapping information fast enough to maintain connectivity suitable for VoIP.) There's no new namespace. There's just a subset of the global unicast address space, composed of multiple EID prefixes, where the LISP protocol implements an alternative and very helpful approach to the "Locator" function of a the destination IP address of any packet which is sent to an EID address. Rather than forwarding the packet normally and letting other routers forward it according to best path for the longest prefix match of all the 380k+ IPv4 DFZ prefixes they figure out with BGP, the ITR tunnels it to an ETR. That's it. There's no new namespace. LISP has no separate namespace for Identifiers ---------------------------------------------- A namespace is a context for interpreting a name or number. The name "Robin" could be interpreted in a number of namespaces (AKA according to a number of namespaces), for instance within the namespace of birds, or within the namespace of a particular family whose surname is "Hood", or within the namespace of another particular family whose surname is "Whittle". "9459 1234" is a string of text which we can think of as an 8 digit decimal number. This number has no meaning on its own (unless we assume the namespace of integers), because on its own, there's no specification for which namespace to use. If I say this should be interpreted according to the namespace of the Australian 03 telephone number zone, then I am specifying a namespace within which this number can be interpreted. In this namespace, (for the sake of this example, though this is not my phone number) this number uniquely identifies a particular phone service, probably not too far from Heidelberg in Melbourne. If we interpret the same number according to a different namespace, such as the Australian 02 zone, then it will be a number somewhere in NSW, probably in some Sydney suburb. The same number could be interpreted as a catalogue number, a part number or in any number of ways - each system of interpretation is a different namespace, which ascribes to the one number a different meaning. The subset of the 2^32 IPv4 addresses which makes up the global unicast address space of IPv4 is a set of IP addresses which are all interpreted according to the one "IPv4 global unicast" namespace, for both their host/endpoint Identifier and their routing Locator semantics. Currently, and with the LISP protocol, each such IP address such as 76.54.32.10 has both an Identifier and a Locator function (AKA semantics). As far as hosts go (assuming the hosts have no inbuilt LISP protocol functions, even though they may include router functions) the Identifier and Locator aspects of a 76.54.32.10 are not affected by whether the LISP protocol has been implemented or not, or - if it has been implemented, whether this address is within an EID prefix or not. The LISP protocol does not involve any new namespace for hosts to use with respect to the 32 bit numbers found in packets - since hosts are completely unaffected by the LISP protocol. Within a LISP protocol box, such as an ITR, there is likewise no new namespace. In an ITR, there is an alternative way of deciding how to handle an incoming packet, for packets whose destination address matches an EID. That's all - this is not a new namespace. It is possible to imagine a Loc-ID Separation architecture which happened to use 32 bit numbers for Identifiers, using a new namespace. Then, the number 76.54.32.10 would have two entirely separate and independent meanings, depending on whether it was used as an IPv4 address or as an Identifier in the new system. The LISP protocol doesn't do this. It doesn't create a new namespace. It is not a Locator-Identifier Protocol. Loc-ID Separation protocols such as GSE, HIP and ILNP create a new namespace for objects which are used purely as Identifiers. They have separate namespaces for the two different classes of objects, with one class of objects being used for Identifiers, according to one namespace and the other class (typically today's IP addresses, but just in a Locator sense) being used for Locators, according to a second namespace (typically today's existing interpretation of an IP address in terms of how routers get them to their destination). Its a very good thing that LISP is not a Loc-ID Separation protocol. Likewise Ivip and IRON. I listed the main disadvantages of Loc-ID Separation protocols in: Msg70239 refers to Noel Chiappa's 1999 (I think) document regarding Loc-ID separation, and to a page at my site concerning the meaning of the word "namespace": the parent page ../ to this one. It was always a mistake to think that LISP involves a new namespace for Identifiers. The fact that the world's biggest router company says it is so: doesn't make it so. LISP, Ivip and IRON are Core-Edge Separation (CES) protocols. GSE, HIP, ILNP and other Loc-ID Separation protocols are Core-Edge Elimination (CEE) protocols: - Robin
http://www.firstpr.com.au/ip/ivip/namespace/lisp-not-loc-id/
CC-MAIN-2020-16
refinedweb
2,448
52.94
c++ questions Why are elementwise additions much faster in separate loops than in a combined loop? stack overflow in c programming (7) I cannot replicate the results discussed here. I don't know if poor benchmark code is to blame, or what, but the two methods are within 10% of each other on my machine using the following code, and one loop is usually just slightly faster than two - as you'd expect. Array sizes ranged from 2^16 to 2^24, using eight loops. I was careful to initialize the source arrays so the += assignment wasn't asking the FPU to add memory garbage interpreted as a double. I played around with various schemes, such as putting the assignment of b[j], d[j] to InitToZero[j] inside the loops, and also with using += b[j] = 1 and += d[j] = 1, and I got fairly consistent results. As you might expect, initializing b and d inside the loop using InitToZero[j] gave the combined approach an advantage, as they were done back-to-back before the assignments to a and c, but still within 10%. Go figure. Hardware is Dell XPS 8500 with generation 3 Core i7 @ 3.4 GHz and 8 GB memory. For 2^16 to 2^24, using eight loops, the cumulative time was 44.987 and 40.965 respectively. Visual C++ 2010, fully optimized. PS: I changed the loops to count down to zero, and the combined method was marginally faster. Scratching my head. Note the new array sizing and loop counts. // MemBufferMystery.cpp : Defines the entry point for the console application. // #include "stdafx.h" #include <iostream> #include <cmath> #include <string> #include <time.h> #define dbl double #define MAX_ARRAY_SZ 262145 //16777216 // AKA (2^24) #define STEP_SZ 1024 // 65536 // AKA (2^16) int _tmain(int argc, _TCHAR* argv[]) { long i, j, ArraySz = 0, LoopKnt = 1024; time_t start, Cumulative_Combined = 0, Cumulative_Separate = 0; dbl *a = NULL, *b = NULL, *c = NULL, *d = NULL, *InitToOnes = NULL; a = (dbl *)calloc( MAX_ARRAY_SZ, sizeof(dbl)); b = (dbl *)calloc( MAX_ARRAY_SZ, sizeof(dbl)); c = (dbl *)calloc( MAX_ARRAY_SZ, sizeof(dbl)); d = (dbl *)calloc( MAX_ARRAY_SZ, sizeof(dbl)); InitToOnes = (dbl *)calloc( MAX_ARRAY_SZ, sizeof(dbl)); // Initialize array to 1.0 second. for(j = 0; j< MAX_ARRAY_SZ; j++) { InitToOnes[j] = 1.0; } // Increase size of arrays and time for(ArraySz = STEP_SZ; ArraySz<MAX_ARRAY_SZ; ArraySz += STEP_SZ) { a = (dbl *)realloc(a, ArraySz * sizeof(dbl)); b = (dbl *)realloc(b, ArraySz * sizeof(dbl)); c = (dbl *)realloc(c, ArraySz * sizeof(dbl)); d = (dbl *)realloc(d, ArraySz * sizeof(dbl)); // Outside the timing loop, initialize // b and d arrays to 1.0 sec for consistent += performance. memcpy((void *)b, (void *)InitToOnes, ArraySz * sizeof(dbl)); memcpy((void *)d, (void *)InitToOnes, ArraySz * sizeof(dbl)); start = clock(); for(i = LoopKnt; i; i--) { for(j = ArraySz; j; j--) { a[j] += b[j]; c[j] += d[j]; } } Cumulative_Combined += (clock()-start); printf("\n %6i miliseconds for combined array sizes %i and %i loops", (int)(clock()-start), ArraySz, LoopKnt); start = clock(); for(i = LoopKnt; i; i--) { for(j = ArraySz; j; j--) { a[j] += b[j]; } for(j = ArraySz; j; j--) { c[j] += d[j]; } } Cumulative_Separate += (clock()-start); printf("\n %6i miliseconds for separate array sizes %i and %i loops \n", (int)(clock()-start), ArraySz, LoopKnt); } printf("\n Cumulative combined array processing took %10.3f seconds", (dbl)(Cumulative_Combined/(dbl)CLOCKS_PER_SEC)); printf("\n Cumulative seperate array processing took %10.3f seconds", (dbl)(Cumulative_Separate/(dbl)CLOCKS_PER_SEC)); getchar(); free(a); free(b); free(c); free(d); free(InitToOnes); return 0; } I'm not sure why it was decided that MFLOPS was a relevant metric. I though the idea was to focus on memory accesses, so I tried to minimize the amount of floating point computation time. I left in the +=, but I am not sure why. A straight assignment with no computation would be a cleaner test of memory access time and would create a test that is uniform irrespective of the loop count. Maybe I missed something in the conversation, but it is worth thinking twice about. If the plus is left out of the assignment, the cumulative time is almost identical at 31 seconds each. Suppose Duo . PPS: Here is the full code. It uses TBB Tick_Count for higher resolution timing, which can be disabled by not defining the TBB_TIMING Macro: #include <iostream> #include <iomanip> #include <cmath> #include <string> //#define TBB_TIMING #ifdef TBB_TIMING #include <tbb/tick_count.h> using tbb::tick_count; #else #include <time.h> #endif using namespace std; //#define preallocate_memory new_cont enum { new_cont, new_sep }; double *a1, *b1, *c1, *d1; void allo(int cont, int n) { switch(cont) { case new_cont: a1 = new double[n*4]; b1 = a1 + n; c1 = b1 + n; d1 = c1 + n; break; case new_sep: a1 = new double[n]; b1 = new double[n]; c1 = new double[n]; d1 = new double[n]; break; } for (int i = 0; i < n; i++) { a1[i] = 1.0; d1[i] = 1.0; c1[i] = 1.0; b1[i] = 1.0; } } void ff(int cont) { switch(cont){ case new_sep: delete[] b1; delete[] c1; delete[] d1; case new_cont: delete[] a1; } } double plain(int n, int m, int cont, int loops) { #ifndef preallocate_memory allo(cont,n); #endif #ifdef TBB_TIMING tick_count t0 = tick_count::now(); #else clock_t start = clock(); #endif if (loops == 1) { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++){ a1[j] += b1[j]; c1[j] += d1[j]; } } } else { for (int i = 0; i < m; i++) { for (int j = 0; j < n; j++) { a1[j] += b1[j]; } for (int j = 0; j < n; j++) { c1[j] += d1[j]; } } } double ret; #ifdef TBB_TIMING tick_count t1 = tick_count::now(); ret = 2.0*double(n)*double(m)/(t1-t0).seconds(); #else clock_t end = clock(); ret = 2.0*double(n)*double(m)/(double)(end - start) *double(CLOCKS_PER_SEC); #endif #ifndef preallocate_memory ff(cont); #endif return ret; } void main() { freopen("C:\\test.csv", "w", stdout); char *s = " "; string na[2] ={"new_cont", "new_sep"}; cout << "n"; for (int j = 0; j < 2; j++) for (int i = 1; i <= 2; i++) #ifdef preallocate_memory cout << s << i << "_loops_" << na[preallocate_memory]; #else cout << s << i << "_loops_" << na[j]; #endif cout << endl; long long nmax = 1000000; #ifdef preallocate_memory allo(preallocate_memory, nmax); #endif for (long long n = 1L; n < nmax; n = max(n+1, long long(n*1.2))) { const long long m = 10000000/n; cout << n; for (int j = 0; j < 2; j++) for (int i = 1; i <= 2; i++) cout << s << plain(n, m, j, i); cout << endl; } } (It shows FLOP/s for different values of n.) The Original Question Why is one loop so much slower than two loops? Assessing The Problem The OP's code: const int n=100000; for(int j=0;j<n;j++){ a1[j] += b1[j]; c1[j] += d1[j]; } And for(int j=0;j<n;j++){ a1[j] += b1[j]; } for(int j=0;j<n;j++){ c1[j] += d1[j]; } The Consideration Considering the OP's original question about the 2 variants of the for loops and his amended question towards the behavior of caches along with many of the other excellent answers and useful comments; I'd like to try and do something different here by taking a different approach about this situation and problem. The Approach Considering the two loops and all of the discussion about cache and page filing I'd like to take another approach as to looking at this from a different perspective. One that doesn't involve the cache and page files nor the executions to allocate memory, in fact this approach doesn't even concern the actual hardware or the software at all. The Perspective After looking at the code for a while it became quite apparent what the problem is and what is generating it. Lets break this down into an algorithmic problem and look at it from the perspective of using mathematical notations then apply an analogy to the math problems as well as to the algorithms. What We Do Know We know is that his loop will run 100,000 times. We also know that a1, b1, c1 & d1 are pointers on a 64-bit architecture. Within C++ on a 32-bit machine all pointers are 4 bytes and on a 64-bit machine they are 8 bytes in size since pointers are of a fixed length. We know that we have 32 bytes in which to allocate for in both cases. The only difference is we are allocating 32 bytes or 2 sets of 2-8bytes on each iteration where in the 2nd case we are allocating 16 bytes for each iteration for both of the independent loops. So both loops still equals 32 bytes in total allocations. With this information let's go ahead and show the general math, algorithm and analogy of it. We do know the amount of times that the same set or group of operations will have to be performed in both cases. We do know the amount of memory that needs to be allocated in both cases. We can asses that the overall work load of the allocations between both cases will be approximately the same. What We Don't Know We do not know how long it will take for each case unless if we set a counter and run a bench mark test. However the bench marks were already included from the original question and from some of the answers and comments as well and we can see a significant difference between the two and this is the whole reasoning of this question to this problem and for the answering of it to begin with. Let's Investigate It is already apparent that many have already done this by looking at the heap allocations, bench mark tests, looking at RAM, Cache and Page Files. Looking at specific data points and specific iteration indexes was also included and the various conversations about this specific problem has many people starting to question other related things about it. So how do we begin to look at this problem by using mathematical algorithms and applying an analogy to it? We start off by making a couple of assertions! Then we build out our algorithm from there. Our Assertions: - We will let our loop and its iterations be a Summation that starts at 1 and ends at 100000 instead of starting with 0 as in the loops for we don't need to worry about the 0 indexing scheme of memory addressing since we are just interested in the algorithm itself. - In both cases we have 4 functions to work with and 2 function calls with 2 operations being done on each function call. So we will set these up as functions and function calls to be F1(), F2(), f(a), f(b), f(c)and f(d). The Algorithms: 1st Case: - Only one summation but two independent function calls. Sum n=1 : [1,100000] = F1(), F2(); F1() = { f(a) = f(a) + f(b); } F2() = { f(c) = f(c) + f(d); } 2nd Case: - Two summations but each has its own function call. Sum1 n=1 : [1,100000] = F1(); F1() = { f(a) = f(a) + f(b); } Sum2 n=1 : [1,100000] = F1(); F1() = { f(c) = f(c) + f(d); } If you noticed F2() only exists in Sum where both Sum1 and Sum2 only contains F1(). This will also be evident later on as well when we begin to conclude that there is sort of an optimization happening from the second algorithm. The iterations through the first case Sum calls f(a) that will add to its self f(b) then it calls f(c) that will do the same but add f(d) to itself for each 100000 iterations. In the second case we have Sum1 and Sum2 And both act the same as if they were the same function being called twice in a row. In this case we can treat Sum1 and Sum2 as just plain old Sum where Sum in this case looks like this: Sum n=1 : [1,100000] { f(a) = f(a) + f(b); } and now this looks like an optimization where we can just consider it to be the same function. Summary with Analogy With what we seen in the second case it almost appears as if there is optimization since both for loops have the same exact signature, but this isn't the real issue. The issue isn't the work that is being done by f(a), f(b), f(c)& f(d) in both cases and the comparison between the two it is the difference in the distance that the Summation has to travel in both cases that gives you the difference in time execution. Think of the For Loops as being the Summations that does the iterations as being a Boss that is giving orders to two people A & B and that their jobs are to meat C & D respectively and to pick up some package from them and return it. In the analogy here the for loop or summation iterations and condition checks themselves doesn't actually represent the Boss. What actually represents the Boss here is not from the actual mathematical algorithms directly, but from the actual concept of Scope and Code Block within a routine or sub-routine, method, function, translation unit, etc. The first algorithm has 1 scope where the 2nd algorithm has 2 consecutive scopes. Within the first case on each call slip the Boss goes to A and gives the order and A goes off to fetch B's package then the Boss goes to C and gives the orders to do the same and receive the package from D on each iteration. Within the second case the Boss works directly with A to go and fetch B's package until all packages are received. Then the Boss works with C to do the same for getting all of D's packages. Since we are working with an 8 byte pointer and dealing with Heap allocation let's consider this problem here. Let us say that the Boss is 100 feet from A and that A is 500 feet from C. We don't need to worry about how far the Boss is initially from C because of the order of executions. In both cases the Boss initially travels from A first then to B. This analogy isn't to say that this distance is exact; it is just a use test case scenario to show the workings of the algorithms. In many cases when doing heap allocations and working with the cache and page files, these distances between address locations may not vary that much in differences or they can very significantly depending on the nature of the data types and the array sizes. The Test Cases: First Case: On first iteration the Boss has to initially go 100 feet to give the order slip to A and A goes off and does his thing, but then the Boss has to travel 500 feet to C to give him his order slip. Then on the next iteration and every other iteration after the Boss has to go back and forth 500 feet between the two. Second Case: The Boss has to travel 100 feet on the first iteration to A, but after that he is already there and just waits for A to get back until all slips are filled. Then the Boss has to travel 500 feet on the first iteration to C because C is 500 feet from A since this Boss( Summation, For Loop ) is being called right after working with A and then just waits like he did with A until all of C's order slips are done. The Difference In Distances Traveled const n = 100000 distTraveledOfFirst = (100 + 500) + ((n-1)*(500 + 500); // Simplify distTraveledOfFirst = 600 + (99999*100); distTraveledOfFirst = 600 + 9999900; distTraveledOfFirst = 10000500; // Distance Traveled On First Algorithm = 10,000,500ft distTraveledOfSecond = 100 + 500 = 600; // Distance Traveled On Second Algorithm = 600ft; The Comparison of Arbitrary Values We can easily see that 600 is far less than 10 million. Now this isn't exact, because we don't know the actual difference in distance between which address of RAM or from which Cache or Page File each call on each iteration is going to be due to many other unseen variables, but this is just an assessment of the situation to be aware of and trying to look at it from the worst case scenario. So by these numbers it would almost look as if Algorithm One should be 99% slower than Algorithm Two; however, this is only the The Boss's part or responsibility of the algorithms and it doesn't account for the actual workers A, B, C, & D and what they have to do on each and every iteration of the Loop. So the bosses job only accounts for about 15 - 40% of the total work being done. So the bulk of the work which is done through the workers has a slight bigger impact towards keeping the ratio of the speed rate differences to about 50-70% The Observation: - The differences between the two algorithms In this situation it is the structure of the process of the work being done and it does go to show that Case 2 is more efficient from both that partial optimization of having a similar function declaration and definition where it is only the variables that differ by name. And we also see that the total distance traveled in Case 1 is much farther than it is in Case 2 and we can consider this distance traveled our Time Factor between the two algorithms. Case 1 has considerable more work to do than Case 2 does. This was also seen in the evidence of the ASM that was shown between both cases. Even with what was already said about these cases, it also doesn't account for the fact that in Case 1 the boss will have to wait for both A & C to get back before he can go back to A again on the next iteration and it also doesn't account for the fact that if A or B is taking an extremely long time then both the Boss and the other worker(s) are also waiting at an idle. In Case 2 the only one being idle is the Boss until the worker gets back. So even this has an impact on the algorithm. Conclusion: Case 1 is a classic interpolation problem that happens to be an inefficient one. I also think that this was one of the leading reasons of why many machine architectures and developers ended up building and designing multi-core systems with the ability to do multi-threaded applications as well as parallel programming. So even looking at it from this approach without even involving how the Hardware, OS and Compiler works together to do heap allocations that involves working with RAM, Cache, Page Files, etc.; the mathematics behind it already shows us which of these two is the better solution from using the above analogy where the Boss or the Summations being those the For Loops that had to travel between Workers A & B. We can easily see that Case 2 is at least as 1/2 as fast if not a little more than Case 1 due to the difference in the distanced traveled and the time taken. And this math lines up almost virtually and perfectly with both the Bench Mark Times as well as the Amount of difference in the amount of Assembly Instructions. The OPs Amended Question(s) EDIT:. Regarding These Questions As I have demonstrated without a doubt, there is an underlying issue even before the Hardware and Software becomes involved. Now as for the management of memory and caching along with page files, etc. which all works together in an integrated set of systems between: The Architecture { Hardware, Firmware, some Embedded Drivers, Kernels and ASM Instruction Sets }, The OS{ File and Memory Management systems, Drivers and the Registry }, The Compiler { Translation Units and Optimizations of the Source Code }, and even the Source Code itself with its set(s) of distinctive algorithms; we can already see that there is a bottleneck that is happening within the first algorithm before we even apply it to any machine with any arbitrary Architecture, OS, and Programmable Language compared to the second algorithm. So there already existed a problem before involving the intrinsics of a modern computer. The Ending Results However; it is not to say that these new questions are not of importance because they themselves are and they do play a role after all. They do impact the procedures and the overall performance and that is evident with the various graphs and assessments from many who have given their answer(s) and or comment(s). If you pay attention to the analogy of the Boss and the two workers A & B who had to go and retrieve packages from C & D respectively and considering the mathematical notations of the two algorithms in question you can see that without even the involvement of the computer Case 2 is approximately 60% faster than Case 1 and when you look at the graphs and charts after these algorithms have been applied to source code, compiled and optimized and executed through the OS to perform operations on the given hardware you even see a little more degradation between the differences in these algorithms. Now if the "Data" set is fairly small it may not seem all that bad of a difference at first but since Case 1 is about 60 - 70% slower than Case 2 we can look at the growth of this function as being in terms of the differences in time executions: DeltaTimeDifference approximately = Loop1(time) - Loop2(time) //where Loop1(time) = Loop2(time) + (Loop2(time)*[0.6,0.7]) // approximately // So when we substitute this back into the difference equation we end up with DeltaTimeDifference approximately = (Loop2(time) + (Loop2(time)*[0.6,0.7])) - Loop2(time) // And finally we can simplify this to DeltaTimeDifference approximately = [0.6,0.7]*(Loop2(time) And this approximation is the average difference between these two loops both algorithmically and machine operations involving software optimizations and machine instructions. So when the data set grows linearly, so does the difference in time between the two. Algorithm 1 has more fetches than algorithm 2 which is evident when the Boss had to travel back and forth the maximum distance between A & C for every iteration after the first iteration while Algorithm 2 the Boss had to travel to A once and then after being done with A he had to travel a maximum distance only one time when going from A to C. So trying to have the Boss focusing on doing two similar things at once and juggling them back and forth instead of focusing on similar consecutive tasks is going to make him quite angry by the end of the day because he had to travel and work twice as much. Therefor do not lose the scope of the situation by letting your boss getting into an interpolated bottleneck because the boss's spouse and children wouldn't appreciate it. It's because the CPU doesn't have so many cache misses (where it has to wait for the array data to come from the RAM chips). It would be interesting for you to adjust the size of the arrays continually so that you exceed the sizes of the level 1 cache (L1), and then the level 2 cache (L2), of your CPU and plot the time taken for your code to execute against the sizes of the arrays. The graph shouldn't be a straight line like you'd expect. It's not because of a different code, but because of caching: RAM is slower than the CPU registers and a cache memory is inside the CPU to avoid to write the RAM every time a variable is changing. But the cache is not big as the RAM is, hence, it maps only a fraction of it. The first code modifies distant memory addresses alternating them at each loop, thus requiring continuously to invalidate the cache. The second code don't alternate: it just flow on adjacent addresses twice. This makes all the job to be completed in the cache, invalidating it only after the second loop starts. OK, the right answer definitely has to do something with the CPU cache. But to use the cache argument can be quite difficult, especially without data. There are many answers, that led to a lot of discussion, but let's face it: Cache issues can be very complex and are not one dimensional. They depend heavily on the size of the data, so my question was unfair: It turned out to be at a very interesting point in the cache graph. @Mysticial's answer convinced a lot of people (including me), probably because it was the only one that seemed to rely on facts, but it was only one "data point" of the truth. That's why I combined his test (using a continuous vs. separate allocation) and @James' Answer's advice. The graphs below shows, that most of the answers and especially the majority of comments to the question and answers can be considered completely wrong or true depending on the exact scenario and parameters used. Note that my initial question was at n = 100.000. This point (by accident) exhibits special behavior: It possesses the greatest discrepancy between the one and two loop'ed version (almost a factor of three) It is the only point, where one-loop (namely with continuous allocation) beats the two-loop version. (This made Mysticial's answer possible, at all.) The result using initialized data: The result using uninitialized data (this is what Mysticial tested): And this is a hard-to-explain one: Initialized data, that is allocated once and reused for every following test case of different vector size: Proposal Every low-level performance related question on Stack Overflow should be required to provide MFLOPS information for the whole range of cache relevant data sizes! It's a waste of everybody's time to think of answers and especially discuss them with others without this information. The first loop alternates writing in each variable. The second and third ones only make small jumps of element size. Try writing two parallel lines of 20 crosses with a pen and paper separated by 20 cm. Try once finishing one and then the other line and try another time by writting a cross in each line alternately. cache stalls.
https://code.i-harness.com/en/q/826dc2
CC-MAIN-2019-51
refinedweb
4,431
52.12
Trying to run a script from "Learn Python the hard way" and getting this error, tried several things but I'm kinda stuck. Seen similar errors with people using argv and not enough arguments when running the script Error points to Line 70: question, answer = convert(snippet, phrase) import random from urllib import urlopen import sys WORD_URL = "" WORDS = [] PHRASES = { "class %%%(%%%):": "Make a class named %%% that is-a %%%", "class %%%(object):\n\tdef __init__(self, ***)" : "class %%% has-a __init__ that takes self and *** parameters.", "class %%%(object):\n\tdef ***(self, @@@)" : "class %%% has-a function named *** that takes self and @@@ parameters.", "*** = %%%()": "Set *** to an instance of class %%%", "***.***(@@@)": "From *** get the *** function, nd call it with parameters self, @@@", "***.*** = '***'": "From *** get the *** attribute and set it to '***'." } #do they want to drill phrases first PHRASE_FIRST = False if len(sys.argv) == 2 and sys.argv[1] == "English": PHRASE_FIRST = True #load up the words from the website for word in urlopen(WORD_URL).readlines(): WORDS.append(word.strip()) def convert(snippet, phrase): class_names = [w.capitalize() for w in random.sample(WORDS, snippet.count("%%%"))] other_names = random.sample(WORDS, snippet.count("***")) results = [] param_names = [] for i in range(0, snippet.count("@@@")): param_count = random.randint(1, 3) param_names.append(", ".join(random.sample(WORDS, param_count))) for sentence in snippet, phrase: result = sentence[:] #fake class names for word in class_names: result = result.replace("%%%", word, 1) #fake other names for word in other_names: result = result.replace("***", word, 1) for word in param_names: result = result.replace("@@@", word, 1) results.append(result) return results #keep going until they hit CTRL-D try: while True: snippets = PHRASES.keys() random.shuffle(snippets) for snippet in snippets: phrase = PHRASES[snippet] question, answer = convert(snippet, phrase) if PHRASE_FIRST: question, answer = answer, question print question raw_input("> ") print "ANSWER: %s\n\n" % answer except EOFError: print "\nBye" Problem In your code, convert() returns a list, which is one object, or value. By doing question, answer = convert(snippet, phrase), you are expecting two values to be returned, and then inserted into question and answer. Solution You should a change question, answer = convert(snippet, phrase) to results = convert(snippet, phrase) You can then get question and answer from results(assuming they are at indices 0 and 1) by doing question = results[0] answer = results[1]
https://codedump.io/share/LC53TzKsllB2/1/python-quotneed-more-than-1-value-to-unpackquot
CC-MAIN-2017-13
refinedweb
369
57.57
One of the most useful data types provided in C++ libraries is a string. In this article, I will introduce you to the concept of strings in C++ programming language. Introduction to Strings in C++ Strings are variables that store a sequence of letters or other characters, such as “Hello” or “September 3rd is my birthday!”. Just like other data types, to create a string, we first declare it and then we can store a value in it. Also, Read – 100+ Machine Learning Projects Solved and Explained. Declaring strings is the same as declaring other data types in the C ++ programming language: string testString; testString = "This is a string."; We can also combine the above two statements into one line: string testString = "This is a string."; Often we use strings as output, and cout works just as you might expect: cout << testString << endl; cout << "This is a string." << endl; To use the String data type, the C++ String header must be included at the top of the program. Additionally, you will need to include using namespace std; to make the short name string visible instead of requiring the cumbersome std :: string. C++ Program to Count the Number of Characters in a String: The length method returns the number of characters in a string, including spaces and punctuation. Like many string operations, the length is a member function, and we call member functions using dot notation. The string that is the sink is to the left of the point, the member function we are invoking is to the right, (eg str.length ()). In such an expression, we ask for the length of the variable str. Now let’s write a program in C++ to count the number of characters in a string: The small string is 10 characters. The long string is 23 characters. I hope you liked this article on the concept of strings in C++ programming language. Feel free to ask your valuable questions in the comments section below.
https://thecleverprogrammer.com/2020/11/21/strings-in-c/
CC-MAIN-2021-43
refinedweb
330
69.92
LR4 no exported video change-help pleasesethro2117 Apr 13, 2012 5:14 PM Exporting from LR4 video there is no change to adjusted clip. I went through the clips from the the 5D mark II before I had LR4 in Quicktime and trimed and saved them. Made adjustments to the jpeg still. and synced the jpeg preset and exported. Video exported with no change. Using 2.7 GHz Intel Corei5 10.6.8 12 GB of ram. Please help or guide me to a disscussion that I haven't been able to find among the many. 1. Re: LR4 no exported video change-help pleaseLee Jay Apr 13, 2012 5:34 PM (in response to sethro2117) Select something other than "Original" when exporting. "Original" means just what it says. 2. Re: LR4 no exported video change-help pleasesethro2117 Apr 13, 2012 5:55 PM (in response to Lee Jay) Thanks thats what I was doing wrong. If the export is H264 is that creating a file with loss data? If I want to edited the file more In a different editing program (imovie-probably not the best but works for me) and export it will it degrade the quality? I dont have experience with DPX. Should I use that instead? 3. Re: LR4 no exported video change-help pleaseLee Jay Apr 13, 2012 7:39 PM (in response to sethro2117) sethro2117 wrote: Thanks thats what I was doing wrong. If the export is H264 is that creating a file with loss data? Of course - same as re-saving a JPEG. Each save is a lossy save. However, the bit-rates in LR are very high so the loss is quite low. 4. Re: LR4 no exported video change-help pleasesethro2117 Apr 15, 2012 3:32 PM (in response to Lee Jay) 2bacbdf8d487e582-424a4e56134157e47bf-8000 - Original :Exports the video in the same format, and at the same speed, as the original clip. - under this Adobe help link exporting video - it doesn't say anything about not exporting the file without changes. Why would I want to export a copy of the video without changes made in LR? - When exporting as H264 I see a change. S0 "Original" means just what it says" and "Of course - same as re-saving a JPEG" isn't answering the question of exporting the video as original not exporting with lightroom changes. - Is the DPX format lossless to the "original" or is the export choice of save as Original not functioning correctly, saving the files with the same format, and same speed as the original with LR adjustment? - It looks like the DPX format is according to this link - - under the Quality and Functionality Factors subsection isn' t for use in desktop PC applications. It seems that DPX is for archieveing much like the DNG or so it would seem in what I have found so far. - All in all is the DPX format what should be used for lossless work flow or is the save as Original not functioning the way that it should? 5. Re: LR4 no exported video change-help pleaseLee Jay Apr 15, 2012 4:44 PM (in response to sethro2117) It's the same with stills - select "original" on export, and you're exporting a copy of the original image, even if it's a raw or DNG file. 6. Re: LR4 no exported video change-help pleasesethro2117 Apr 17, 2012 9:23 AM (in response to Lee Jay)? DPX? Why not Quicktime with all the options of export that an easy program like IMovie has. I sure hope LR5 is worth it! I'll keep looking for information. and add to this post or if someone wants to lead me to another post I would be happy to read another one. Thanks again for the responses Lee Jay. 7. Re: LR4 no exported video change-help pleaseLee Jay Apr 17, 2012 12:18 PM (in response to sethro2117) sethro2117 wrote:? Because that's all they implemented. That's rather like asking why doesn't your front-wheel-drive car have four-wheel-drive - because it doesn't. sethro2117 wrote: DPX? DPX is lossless (I think) for interoperability with other Adobe video products (and some non-Adobe products). 8. Re: LR4 no exported video change-help pleasesethro2117 Apr 19, 2012 11:29 AM (in response to Lee Jay) I was replying from home the last few replays Without a copy of LR4. I'm back a work today and looking at the DPX it's definitely not something I can use right now. I guess I have to use lossy files until this is changed. Thanks again Lee Jay for your reply's even though they read like you were treating my like I'm less intelligent then you. Which isn't in line with forum rules or professionalism. But you were the only one that replied and I thank you for it. sethro2117 9. Re: LR4 no exported video change-help pleaseCornelia-I Apr 19, 2012 1:19 PM (in response to sethro2117) Hi Sethro2117, I did not answer because I have no definite knowledge of this. But AFAIK the root of the problem lies in that there is no "DNG-format for videos", nor a sidecar-xmp for them. So there is no destination for LR to write non-destructively to a video. I would guess that the many different proprietary video capturing formats which the cameras employ are similarly documented than proprietary still raw formats. So the best LR can do is interpret what it understands, and output it either into a format it fully understands (such as H264) or just do a simple copy algorithm of original. Loss(lessness) may depend on the destination format. ... Never mind with Lee Jay... I find his answers usually 100% correct, and often hardly useful, because he does not care to pick the asking person up where he/she might be. In stark contrast to e.g. b_gossweiler (Beat), who has an excellent knack to guess where a user might be erring, and an very friendly way to give the right directions. Beat may be more intelligent than I am, but I like him very much for the fact that this is MY conclusion - and not one that transpires through his posts.... Cornelia 10. Re: LR4 no exported video change-help pleasesethro2117 Apr 19, 2012 2:54 PM (in response to Cornelia-I) Thanks for the reply Cornelia, I'm just really trying to figure out a good workflow for myself. IMovie for myself has been useful for quick comping for where I want to go and which clips I want to toss. Through my testing I have found that exporting through Quicktime using the animation setting the files are very large but the colors and dynamic range are really nice, better than H264. There are a few clips I would like to adjust with more of a light hand then IMovie is allowing so i turned to LR4. When there is going to be another round of compression for the overall edited comp clips and then another round for the final I would rather use the highest quality export from LR4. It seems in my research that would be DPX if I was using high end software.( which I don't have the money for right now and for this project.) It also seems that DPX doesn't carry sound which is really a different topic probably for a different forum. All in all I just hope that LR4 has more options in the future as they figure things out. Thanks 11. Re: LR4 no exported video change-help pleaseBorisJoe Apr 21, 2012 11:03 AM (in response to sethro2117) There is confusion about LR4 video export, even among Adobe tech support AND J. Kosts' LR4 video tutorial on Adobe TV, where she misstates that 'changes will be applied to "Original" upon export, as well as the other 2 export formats'. I posted (here) about this yesterday after viewing the Kost video and then spending 4 hours grading video clips... only to then spend another 2 hours on the phome w/ Adobe tech support where the mystery was finally solved. It is unfortunate that our only choices for video clips graded in LR4 are either 'lossy' compressed mp4, or dpx which are recognized only by Adobe products. Why not ".MOV" (at least)? And what good is grading video in LR4, when it can't SHARPEN our clips?!?!? 12. Re: LR4 no exported video change-help pleasesethro2117 Apr 21, 2012 12:06 PM (in response to BorisJoe) At this point it seems better to open your video into Photoshop CS3,CS4,or CS5( I think it might need to be extended version) and use adjustment layers and then export the video the way they you want. Retouching can be done 500 frames at a time. File>import>video frames to layers. for longer videos hold shift and drag the frames you want to import to layers. 13. Re: LR4 no exported video change-help pleaseMikeKPhoto Apr 21, 2012 1:12 PM (in response to Lee Jay) Also, apart from Kost providing a misleading statement, the PDF Help file on Video Export is misleading as well; quoting " Original - Exports the video in the same format, and at the same speed as the original clip. I would read this as you are exporting the changes you made, not simply exporting a file you already have. If that is the case I would think the documentation should be more specific, also Kost/Adobe needs to update the TV episode on Video and save folks from wasting their time My 20 cents 14. Re: LR4 no exported video change-help pleaseCornelia-I Apr 22, 2012 12:17 AM (in response to MikeKPhoto) Hi Mike, I understand your point and agree. It is just as misleading for still images: I have been trapped by exporting "original" there as well... Your edits are not included either! Cornelia 15. Re: LR4 no exported video change-help pleaseunadog Apr 27, 2012 10:45 PM (in response to Cornelia-I) I was also very frustrated at the limited export options in LR 4.0 I don't understand "Original" at all! What is the point - it is basically the same as copying a file in Windiws Eplorer, but it takes 100x as long. I had assumed this was a bug - that it was supposed to apply the Develop grade to the output. So basically we are left with MPEG-4 at 4 different levels, and that is it! I have CS 5.5 Production Premium, with CS 6.0 on the way. I'm looking forward to both PS and Premier Pro video editing, along with Speed Grade and all the other tools At the same time the LR interface is unique and very useful in some cases. Are there plans to link LR to the Media Encoder, Speed Grade, and other back end tools with a LR UI? Media Encoder at least would be easy, as they are already opening a dialog box to pick options. The difference is ME has about 5,750 options; LR has 4. Is Adobe really going to commit to video support in LR after the CS 6.0 launch (when resources are available) and deliver much more in 4.1, 4.2, etc. or is it going to remain an absolutely minimal tool that does 3-4 basic functions, but no more in video? Seems there is a gear chance to grab that lower end niche with an economical and easy to use tool, but with world class develop/grade/export modules behind it. But right now I can't see using it for much more than a kids BD party, with a trim, minor color correction , and export Is there a design white paper, product development map, or even an interview that would shed more light on the vision fr video in LR? THANKS! Michael 16. Re: LR4 no exported video change-help pleasesethro2117 Apr 30, 2012 10:44 PM (in response to unadog) I would really like the to be able to use most of the options in light room in video. It seems that you all are as frustrated at the limited editing and export options in LR4. I'm new to the forum and glad I'm not alone in these feeling about Lightroom. What is the difference between adjustment layers in PS effecting video and the editing tools in LR4. I'm not a programmer but it seems that the gradient adjustments and Adjustment brushes are kind of like stacking adjustment layers with out adding layer masks as a separate step.??? There must be a reason that they are not available in LR4. Maybe it was just a premature release. I think we just need to wait it out and see what they come up with to fix the problems Adobe has to take on. Thanks for all the responses. It seems more and more that PS and Lightroom are taking on features that other software has been designed to do. I like only having a few pieces of software but since i do mostly image editing and I'm getting into video like many Photographers. I have to use the software I have and I don't have Premier Pro. I was hoping that at least the video could be exported in the highest resolution possible. Then it could be converted by so many other products to different sizes, even though that is silly to use two apps when one should do it. Give it time I guess. Thanks for the conversations, Sethro2117 17. Re: LR4 no exported video change-help pleaseedojp Feb 19, 2013 10:20 PM (in response to sethro2117) Hello, I don't see a menu to select when exporting, that is <choose "original"> or <choose edited version>. I have been exporting the originals but it would be nicer to export the trimmed versions (mov file from D600). I think the camera original files are H264. So far I have been exporting the whole original, then running them through MPEG Streamclip to get "better" and larger files, then import the converted higher qaulity clips to imovie. Is there anyway to get my trimmed and maybe adjusted clips out of LR4, then run them through MPEG Streamclip? It would save space as most of the clips I am only using a small portion and would speed up MPEG Streamclip. 18. Re: LR4 no exported video change-help pleaseedojp Feb 20, 2013 1:52 AM (in response to edojp) Sorry, I found the choosable menu for Video on Expiort. (more used to working with photos). I iwll compare the original exported files with the H264 and see if there is any difference 19. Re: LR4 no exported video change-help pleaseBorisJoe Feb 20, 2013 5:25 AM (in response to edojp) Unfortunately LR can only export H264 files, if you've made any editing changes at all. "Export original" does only that. This is a real weakness in the program that I hope will be addressed in future versions of LR. Joe Sent from my iPhone 20. Re: LR4 no exported video change-help pleaseedojp Feb 20, 2013 4:46 PM (in response to BorisJoe) Am I right in assuming: that since the files from the D600 camera are supposed to be H264, they are imported straight from camera card into LR4, then the good ones selected, clipped, adjusted if necessary, then on export choose not "orginal" but H264...seems like I would get a file similar to the original format. After that I am running the clips through conversion in MPEG Streamclip as recommended by others who say H264 is NOT the best format for editing in FCP or imovies. How much if any quality might I be losing coming out of LR this way? (not sure if this is the best place for this question) Any reference links appreciated.
https://forums.adobe.com/thread/989661
CC-MAIN-2015-40
refinedweb
2,675
77.57
Testing HTTP Calls Making HTTP calls to get resources or call APIs is a staple of software development. But if you do not properly abstract the request construction and response handling from the HTTP library that you use, it can be extremely difficult to test. Here’s an example of some HTTP-related code we might find in C#: public User GetThatUserData(string userId) { var httpClient = new HttpClient(); var url = $"{userId}"; var response = httpClient.GetAsync(url).Result; if (response.StatusCode != HttpStatusCode.OK) { throw new Exception($"Unexpected status code: {response.StatusCode}"); } var body = response.Content.ReadAsStringAsync().Result; return JsonConvert.DeserializeObject<User>(body); } And a similar example in JavaScript: async function getThatUserData(userId) { const url = '' + userId const response = await axios.get(url) if (response.status !== 200) { throw new Error('Unexpected status code: ' + response.statusCode) } return response.data } At first blush, these seem like good abstractions. All the HTTP-related handling is contained within the function; neither input nor output expose anything about URLs, headers, status codes, or bodies. But they are hard to test. Sometimes we choose to rely on integration testing for these sorts of functions. Unfortunately, this causes our tests to rely on an external dependency. If that server is down or failing for some unknown reason, our tests will fail even though our code is fine. Also you may not be able to test your error paths, because you cannot control the response. And things get even more complex when we get the idea to run our own server for testing purposes. Depending on the language and libraries we’re using, it may be possible to unit test these functions. But even when it’s possible, it is often complicated, making our tests harder to understand and maintain. So then, when testing is difficult, we may not test those functions at all. After all, we don’t need to test the underlying HTTP library, right? Unfortunately, this leaves an untested gap in our request and response handling. Abstracting Ourselves in C To make the code easier to test, we need to separate out the HTTP library. Let’s do this first in C#. In the code above, the HTTP request and response are both built by calling the GetAsync method with a url. To abstract the library, we can start by introducing a new interface for the piece that actually executes the HTTP calls: public interface IHttpExecutor { Task<HttpResponseMessage> GetAsync(string url); } public User GetThatUserData(string userId, IHttpExecutor executor) { var url = $"{userId}"; var response = executor.GetAsync(url).Result; if (response.StatusCode != HttpStatusCode.OK) { throw new Exception($"Unexpected status code: {response.StatusCode}"); } var body = response.Content.ReadAsStringAsync().Result; return JsonConvert.DeserializeObject<User>(body); } For this example, I’ve decided to use a method-based dependency injection to get the new IHttpExecutor into the code because it’s simple to write in a blog post. But you could use class-level injection if you prefer. The important thing is that now we have an interface separating our code from the HTTP library. Now we can start writing tests that utilize a test double implementation of that interface. Then we can verify that we called the right url (by interrogating the test double) and we can have it return whatever HttpResponseMessage that we want to test. We can even throw exceptions as desired to represent timeouts or failures to connect. But dealing with the HttpResponseMessage is kind of a pain. How do we set up the response body? It isn’t obvious how to set up our own response object so that response.Content.ReadAsStringAsync() will succeed. We haven’t abstracted far enough from the library. public class HttpResponse { public int StatusCode { get; set; } public string Body { get; set; } } public interface IHttpExecutor { Task<HttpResponse> GetAsync(string url); } public User GetThatUserData(string userId, IHttpExecutor executor) { var url = $"{userId}"; var response = executor.GetAsync(url).Result; if (response.StatusCode != 200) { throw new Exception($"Unexpected status code: {response.StatusCode}"); } return JsonConvert.DeserializeObject<User>(response.Body); } Now we can easily test our code via test doubles. The new HttpResponse object is simple to instantiate with everything we need. Of course, we’ll need a real implementation of the interface if we’re going to run our code outside of testing: public class HttpExecutor : IHttpExecutor { private HttpClient httpClient = new HttpClient(); public async Task<HttpResponse> GetAsync(string url) { var response = await httpClient.GetAsync(url); var body = await response.Content.ReadAsStringAsync(); return new HttpResponse { StatusCode = (int)response.StatusCode, Body = body }; } } This GetAsync method is hard to unit test, but it doesn’t include any of the request building and response handling that was specific to our use case. And because it is a more generic interface (doesn’t specify a particular url), it becomes easier to write integration tests for it. Over time, we can add more to our HttpResponse to account for things like response headers. We may also find that we want to create an HttpRequest class so that we can specify HTTP request concepts like methods, headers, and body. Then we could have a single ExecuteAsync(HttpRequest request) method that handles all kinds of requests. Of course, some HTTP libraries are better than others. Perhaps we should have just chosen something other than the built-in HttpClient? If we picked something with a good interface, we could have avoided creating all these extra classes. But the advantage of using these classes is that now we can switch the underlying implementation as needed without changing any other code. Going Functional in JavaScript In the C# example, I used injection and test doubles because when I write C# I tend to use a mockist style of TDD. The language also required us to define a bunch of types to model HTTP. Let’s modify our example JavaScript code using a more functional style. Our testing problem fundamentally comes down to needing to test that we’ve correctly created the request and handled the response. But those don’t have anything to do with executing the HTTP call, and so they could be pure functions (no I/O). Those are easy to test! function buildRequest(userId) { return { url: '' + userId } } function handleResponse(response) { if (response.status !== 200) { throw new Error('Unexpected status code: ' + response.statusCode) } return response.data } Now we just need to compose those functions with our HTTP library in order to make an end-to-end call. async function getThatUserData(userId) { return handleResponse(await axios.get(buildRequest(userId).url)) } The only thing untested in our new method is the axios.get call. But it isn’t our code, so do we really need to be testing it? How we call it is untested, but that is hard to do without taking one more step to move the axios call behind another function: async function execute(request) { return await axios.get(request.url) } async function getThatUserData(userId) { return handleResponse(await execute(buildRequest(userId))) } As with the C# example, this execute method is generic enough that it is easier to test than the original function that was specific to the API we wanted to call. Now we can think about supporting other types of requests (like POST) or replace axios with another library as needed. Conclusion With the right abstractions, you can easily unit test your HTTP-related code. This allows you to ensure that you are building your requests correctly, verifying things like URL construction, request headers, etc. More importantly, you can now test how your code will handle all types of responses. We can build confidence in how we process the data on a successful call. Failure cases that were hard to test, like specific 400 and 500 level status codes, request timeouts, and even malformed responses are now easy to test. This approach of abstracting hard-to-test invocations can also be used in other similar situations, such as database calls. Abstracting libraries and other dependencies can add a lot of flexibility to your code while also making it more testable.
https://www.pluralsight.com/tech-blog/testing-http-calls/
CC-MAIN-2020-29
refinedweb
1,323
56.86
Miril::Hacking - Miril Developer's Guide This documents provides an overview of how Miril works under the hood and makes it easier for developers to start hacking. Miril uses CGI::Application as its base framework. Miril currently allows configuration only in XML format, but other formats will probably be added in the future. The required parser will probably be guessed from the extension of the configuration file. Currently the configuration file is processed by Miril::Config. It adds some defaults and simplifies some data structures. It returns a configuration object, which is a Data::AsObject hashref. XML::TreePP is used for parsing XML, since it is lightweight and pure perl. The configuration format does not follow a specific structure, and new elements may be freely added when needed by third-party Miril plugins. CGI::Application::Plugin::Authentication is used to authenticate users. The generic driver is used with a custom verification callback provided by Miril::UserManager::XMLTPP. A special file (or a databse) is used to manage users and their passwords. A module in the Miril::UserManager namespace takes care of reading data from the users file and updating it when necessary. Currently the only Miril::UserManager::XMLTPP exists, providing an interface to a users file in XML format. A user management module for Miril must provide the following interface: A constructor Returns a reference to a subroutine used to authenticate the user. The subroutine should accept two arguments - a username and a password, and should return the username if the authentication was successful, and undef otherwise. Accepts a username as its argument and returns an object containing all user data. Accepts a user object as its argument and updates the data about this user in the configuration file (or creates a new entry if no such user exist yet). Accepts a username as its argument and attempts to delete this user from the configuration file. Receives a plain-text password as its argument and returns its encrypted representation. The user object has the following structure: The username used for logging into Miril. The real name of the user or any other desicriptive text. The user's password. The user's email. Miril uses HTML::Template to generate its user interface. The actual templates are embedded in Miril::Theme::Flashyweb and Miril::Theme::Flashyweb::Stylesheet. The load_tmpl method in Miril::Util loads the requested template. The theming system is designed to be extensible, and support for using different themes and templating engines is planned. Miril can store its data in plain text files or in a database (database support is not implemented yet). A class in the Miril::Model namespace takes care of all functions related to reading and writing data. Its interface is as follows: Constructor. Receives as its argument the ID of a post, and returns a post object. Optionally receives as an argument search criteria provided as a hash (e.g. "title", "author", "status", etc.) and returns all matching posts. If no arguments are supplied, returns a list of all posts. Receives as its argument a post object, and updates it or creates it in the database. Receives as its argument the ID of a post, and deletes it from the database. The contents of the post object is described in Miril::Manual. Currently only Miril::Model::File::XMLTPP is availabe. It writes the body of posts to individual files named as their respective post ID. Metadata for all posts is written in a separate file, data.xml. Plans are to refactor this class so that metadata for each post is written in the same file as the post itself, and data.xml acts only as a cache for metadata. A view for Miril is a templating engine used to publish data from its database to html. It is the templating language used by Miril users to create the templates for their website, and it may be different from the templating language used to display Miril's user interface theme. Currently Miril supports HTML::Template and Text::Template views. A view must inherit from Miril::View::Abstract and provide a single method: load. This method receives two named arguments: name and params. name is the name of the requested template, as specified for each post and list type in the Miril configuration file. params is a hashref with variables to be passed on to the templates (normally these will be $post for ordinary posts and $posts for lists). Filters convert text in various formats (e.g. Markdown, Textile, etc.) to HTML. Filters reside in the Miril::Filter namespace. Miril passes a copy of the miril object to the constructor of each plugin class (that means models, views, filters, etc.). It is used primarily to get to the config object and to the error processing function (see below). The Miril::Util package provides a bunch of uitility functions for Miril. Miril currently does not use any specific object-oriented programming framework. Properties are set via direct access to the members of the underlying hashref. Accessor methods are defined at the end of each class. Miril currently uses Try::Tiny for exception handling. Plans are to start using autodie in the near future as well. Miril uses a special error handling mechanism provided by the process_error method of the miril object. It is meant to be used inside of a catch clause instead of warn or die. It receives three arguments: a user-friendly error message, the actual error message as provided by $! (or $_ when using Try::Tiny), and an optional third boolean argument specifying whether the error is to be treated as fatal or not. Using this functionality, whenever errors occur Miril will present them in a nicely formatted list within the Miril user interface, so as not to scare the end user. All of Miril's error related functions are defined in Miril::Error. The goal of Miril is to be as lightweight on dependencies as possible, without reinventing the wheel. At some point in the future, I would like to be able to ship Miril, along with all of its dependencies, either as a single file, or as modules in a local::lib that can simply be uzipped and used. So all core Miril depndencies should be pure perl and consist of as few files as possible. Many of the modules Miril uses have been choses precisely because they match these criteria (CGI::Application, HTML::Template, XML::TreePP, etc.). Peter Shangov, <pshangov at yahoo.com> This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License. See for more information.
http://search.cpan.org/~pshangov/Miril-0.008/lib/Miril/Hacking.pod
CC-MAIN-2017-30
refinedweb
1,118
57.06
Introducing the Windows RSS Platform Introducing the Windows RSS Platform This topic introduces the Windows RSS Platform, an API that developers can use to manipulate the Common Feed List, the set of feeds to which the user is subscribed. The properties and methods are categorized to provide a technical overview of the platform and its functionality. This topic contains the following sections. - Introduction - Object Model - Common Feed List - Working with Feeds - RSS 2.0 Elements - IFeed - IFeedItem - IFeedEnclosure - Feed Synchronization - Related Topics Introduction Really Simple Syndication (RSS) is an XML document format used by Web sites to publish frequently updated content, such as news headlines and blog posts. The distribution is called an RSS feed. In most cases, the RSS feed is retrieved directly from a Web server via HTTP. The RSS specification includes conventions that dictate how often feeds should be checked for updates. As part of the RSS support in Windows Internet Explorer 7, users can discover and subscribe to RSS feeds within the browser. When the user subscribes to a feed, it is added to the Common Feed List, which is available for clients to use in addition to or instead of their own list. For example, in Microsoft Office Outlook® 2007, the user's subscription list can import feeds from the Common Feed List. This enables the discovery of feeds within Internet Explorer, and then for those discovered feeds to appear in other applications. The Feed Download Engine downloads feeds and merges the new items with the existing data in the feed store. Using the Windows RSS Platform, applications can then expose the feed data to the user. The RSS Explorer of Windows Vista, for example, provides an excellent text reading experience for news and blog feeds, and Microsoft Windows Media Player enables users to listen to audio feeds. The consumption of feed data varies by application; the Windows RSS Platform makes a variety of scenarios possible by providing easy access to the feed data. Object Model The top-level object in the Windows RSS Platform is the FeedsManager object. To create the object for scripting, use the ProgID Microsoft.FeedsManager. To create the object for use with C/C++, call CoCreateInstance with CLSID_FeedsManager (defined in the msfeeds.h header file). The Windows RSS Platform object model hierarchy is as follows: The Windows RSS Platform supports both styles of Component Object Model (COM) interfaces: - Early-bound (vtable) interface—the interface that is better for C/C++ developers. These objects are in the IXFeedsManager hierarchy. - Late-bound IDispatch interface—COM Automation interface that is ideal for scripting and managed code (Microsoft Visual Basic .NET and C#). These are the IFeedsManager objects. To avoid unnecessary repetition, the names of the COM Automation interfaces are used throughout this topic. Common Feed List The Common Feed List resembles a hierarchical file system with folders and feeds. The IFeedFolder interface contains properties and methods for accessing feeds contained within the folder as well as properties and methods for accessing subfolders. Because feed folders are mapped to disk directories, folder names are limited to those characters that the file system allows. (See Valid Feed and Folder Names for more information.) The root folder of the Common Feed List is accessed through the FeedsManager.RootFolder property, which returns an object of type IFeedFolder. From there, each IFeedFolder object contains its own collection of subfolders and feeds. (Refer to the example in Subfolders for a demonstration of a recursive folder search that returns an aggregated total count of feeds.) The following table lists the methods and properties that are used to traverse and manipulate the Common Feed List hierarchy. Working with Feeds The IFeed interface exposes the required and optional elements of an RSS feed. To subscribe to a feed, assign it to a folder. The following table lists the methods and properties that are used to manage the feeds. RSS 2.0 Elements Most of the XML elements of an RSS 2.0 feed are available as read-only properties on the associated objects. Although some channel elements (such as cloud, rating, skipDays, and skipHours) are not available as properties on the IFeed interface, they are still in the XML source for the feed. Additional namespace extensions define properties that are used by the Windows RSS Platform to manage lists. IFeed The IFeed interface exposes the properties that are present on the RSS channel element. IFeedItem Individual items in a feed are represented by FeedItem objects. Depending on the type of feed, these items are aggregated as news items that are merged into the feed, or as list items that replace the contents of the previous list. Additional RSS 2.0 item elements, such as GUID and source, are available in the XML source document of the feed. IFeedEnclosure The IFeedEnclosure interface provides access to the optional media file attachment that may be associated with each feed item. Feed Synchronization The Internet Explorer 7 aggregator (the Feed Download Engine) automatically downloads the feed items from the source URL specified in the feed. These downloads can occur on a schedule, or as requested by the user. The value of the Interval property and Ttl element of the feed determine how often the feed is downloaded; the feed is updated when the current time is equal to LastDownloadTime plus the maximum of these two values. The following table lists the methods and properties that control the download and synchronization behavior of feeds:
https://docs.microsoft.com/en-us/previous-versions/windows/desktop/ms686418(v=vs.85)
CC-MAIN-2018-34
refinedweb
907
54.12
#include <wx/log.h> This class allows you to temporarily suspend logging. All calls to the log functions during the life time of an object of this class are just ignored. In particular, it can be used to suppress the log messages given by wxWidgets itself but it should be noted that it is rarely the best way to cope with this problem as all log messages are suppressed, even if they indicate a completely different error than the one the programmer wanted to suppress. For instance, the example of the overview: would be better written as: Suspends logging. Resumes logging.
https://docs.wxwidgets.org/3.0/classwx_log_null.html
CC-MAIN-2021-17
refinedweb
101
63.22
import "cmd/go/internal/imports" build.go read.go scan.go tags.go MatchFile returns false if the name contains a $GOOS or $GOARCH suffix which does not match the current system. The recognized name formats are: name_$(GOOS).* name_$(GOARCH).* name_$(GOOS)_$(GOARCH).* name_$(GOOS)_test.* name_$(GOARCH)_test.* name_$(GOOS)_$(GOARCH)_test.* An exception: if GOOS=android, then files with GOOS=linux are also matched. If tags["*"] is true, then MatchFile will consider all possible GOOS and GOARCH to be available and will consequently always return true. ReadComments is like ioutil.ReadAll, except that it only reads the leading block of comments in the file. ReadImports is like ioutil.ReadAll, except that it expects a Go file as input and stops reading the input once the imports have completed. ShouldBuild reports whether it is okay to use this file, The rule is that in the file's leading run of // comments and blank lines, which must be followed by a blank line (to avoid including a Go package clause doc comment), lines beginning with '// +build' are taken as build directives. The file is accepted only if each such line lists something matching the file. For example: // +build windows linux marks the file as applicable only on Windows and Linux. If tags["*"] is true, then ShouldBuild will consider every build tag except "ignore" to be both true and false for the purpose of satisfying build tags, in order to estimate (conservatively) whether a file could ever possibly be used in any build. Package imports imports 14 packages (graph) and is imported by 4 packages. Updated 2019-03-15. Refresh now. Tools for package owners.
https://godoc.org/cmd/go/internal/imports
CC-MAIN-2019-13
refinedweb
277
62.98
- Variables and expressions are good for one time operations, but functions allow us to reuse the same computation many times. - A program is a sequence of operations written in a file. - A number of operations in a program simply define functions. - A number of operations use these functions. - A good program separates these out very carefully. Basic program structure¶ - Programmers have developed some conventions over time to make programs easy to read. We will use the same in this class. - Here is an example. """ Computes the current in a given circuit and prints the result. Author: Sibel Adali """ def electric_current(voltage,resistance): """ Returns the electric current given voltage and resistance. Assumes that the units are compatible. """ current = float(voltage)/resistance return current ## This is another comment ## Main code starts here. Let's define our variables first. v = 220 # voltage in volts r = 10 # resistance in ohms print v, "volts", r, "ohms" print "results in", electric_current(v,r), "amps of current" - The program starts with a commentin quotes that describes the purpose of the program. The comment is not executed. - This is a good place to put your pseudo code. - Then, a number of functions will be defined that will be later used in the program. All functions should have a clear purpose. - The function only uses variables that are in its arguments or are explicitly assigned a value within the function. For example, currentabove is a variable local to the function. - Then, the actual code of the program starts after all functions. The code typically calls these functions to do its work and print some results. - The code often defines some variables, like vand rabove to compute what it needs to compute. - It is a great idea to assign values to these variables all together, if possible, right after all the functions so that they are easy to locate. - If you want, explain what the variables stand for. - Do programs written in other formats work? Sure. But, they are hard to understand and debug. We will be very insistent that you use this format. - This will also prepare you for more strict languages like C, C++. What happens when you run a program?¶ - It goes through each statement from the very beginning to the end. - If the statement is a function definition, then it is remembered. - If the statement calls a function or executes an expression, it is evaluated. - What happens if your program only has function definitions? """ Contains functions for converting temperature from fahrenheit to celcius, and from celcius to fahrenheit. Author: Sibel Adali """ def to_celcius(fahrenheit): """ Returns the celcius equivalent of a temperature in fahrenheit. """ return (5.0/9) * (fahrenheit-zero_fahrenheit) def to_fahrenheit(celcius): """ Returns the celcius equivalent of a temperature in fahrenheit. """ return (9.0/5) * celcius + zero_fahrenheit zero_fahrenheit = 32 - This program does not do anything, but contains functions that can be used in other programs. This is a module! What is a Module?¶ A collection of Python variables, functions and objects, all stored in a file - We’ll define the notion of an object soon, but strings, ints and floats are all (built-in) objects. Modules allow code to be shared across many different programs. Before we can use a module, we need to import it: >>> import module_name Importing makes the functions in the module available for use. Python has many, many modules to accomplish many different tasks, ranging from manipulating images to accessing Twitter feeds. Modules and Comments¶ - We see that all our comments become a documentation for our modules. - Top comments are for the whole module, and the first comment after function definition is the function documentation. - All the functions in class notes are documented in the same way to make it easy for you to understand and reuse them. - Your modules may also use other modules. - Make sure you put functions that share a common purpose into a single file. Testing¶ - Testing is the most important part of writing a program. Almost no complex program is bug free the first time. - If you change your code, you might fix a bug in one place, but introduce a bug elsewhere. - Best way to write programs is to divide it into small parts, functions, test them carefully and build on them. - Testing is not a one-time process, it continues as you change your program. - We will start with a simple method for testing in this lecture, but learn more sophisticated ways to do this in the future. Testing means expectations¶ - You write functions to compute something specific. Given a certain input, it should return a specific output. - Testing should involve coming up with a set of input/output cases that can tell whether your function works correctly. - What are good test values? - Common values: input values you expect to be used in your program and you know what the output should be - Values that can possibly cause errors in your program: strange input values that can cause issues such as very high and very low values, sometimes called edge cases. - Let us try do think of some good test cases for the following function: def entropy(p1,p2): x = float(p1)/(p1+p2) y = -x * math.log(x) - (1-x) * math.log(1-x) return y Writing test code¶ - Instead of manually typing in each test case, you can write a simple program to test your functions. - Write your functions into a module, like the temperate.pymodule. - Now, write code that checks the functions in this module by printing the expected output and the output returned by the function side by side. import temperature as tempt print 'input: 32 F, expected output: 0 C, returned output:', tempt.to_celcius(32) print 'input: 0 C, expected output: 32 F, returned output:', tempt.to_fahrenheit(0) print 'input: 10 C, expected output: 10 C, returned output:', \ tempt.to_celcius(tempt.to_fahrenheit(10)), 'returned' Should we change these test cases? Note that: the backslash, \, is a way to tell the current statement is continuing in the next line. print()function prints the result of different expressions. When you have multiple expressions seperated with a comma, print separates them with a space. Exercise Set 3¶ Using the mathmodule and the math.sqrt()function, write a module that computes the length of the hypotenuse, given the length of the other edges given by the theorem: List a number of good test cases for this function. Discuss in class how the function should work for these test cases.
http://www.cs.rpi.edu/~sibel/csci1100/fall2015/course_notes/unused.html
CC-MAIN-2018-17
refinedweb
1,075
65.93
What I want to do: To have my most used scripts and functions well organized, I put them into different folders, which I then add to my path using a small script which just takes the folder name. Now I also want to give these module-like folders the possibility to do some initialization procedures. This is done by the path-adding script, which also looks for an ''init.m'' file and runs it with ''run(/path/to/folder/init.m)'. Now I would like to hide that ''init.m'', so that it doesn't clutter my global namespace and possibly other init scripts. Still I need everything else in this folder. I tried simply naming it ''__init__.m'' (guess where I got this organization idea from...), a very unusual name which would probably not be used accidentally in other places; but starting script names with an underscore seems to be illegal in Matlab. Any method, which hides the function, make it unaccessible - according to the definition of "hiding". Another strategy is to collect the init files with individual names in a separate folder: MFiles\inits\init_MyToolboxA.m MFiles\inits\init_MyToolboxB.m MFiles\MyToolboxA\ MFiles\MyToolboxB\ Now only MFiles\inits\ is stored persistently in the path and Running init_MyToolboxA adds the folders of the toolbox "A" and performs any individual initializations. On the other hand having an init.m in each folder is not too bad. E.g. Matlab stores a "Contents.m" in each folder also without causing troubles or confusions. You find multiple "prefspanel.m" also. I would recommed using packages in exactly the same way. Here is the doc for packages: Basically you could have packages for whatever you want: Example files: +StuffIUse\+Utilities\etc.m +OldStuff\+Utilities\etc.m Now to use the typical stuff: x = StuffIUse.Utilities.etc But let's say you wanted to use old stuff: x = OldStuff.Utilities.etc If both +StuffIUse and +OldStuff are on the path; you'll have access to all of the sub-packages without having to do any path manipulation or calling run() !!! Thanks, for the moment Jan's solution is closer to what I need, but I think I should switch to packages on the long run. Opportunities for recent engineering grads.
http://www.mathworks.com/matlabcentral/answers/62316-how-can-i-hide-a-script-so-that-it-is-not-callable-any-more
CC-MAIN-2015-32
refinedweb
376
66.23
The book is being made available on github at the same time as here (for your contributing convenience). Please view for how you can help When you first learn about IoC and start playing with a DI framework, you don't think to yourself I wonder how else I could resolve dependencies? Why would you? DI is straightforward as well as being a good fit with how most people organize their Java or .NET code. No one would blame you for thinking, like I did, that this is how everyone does it. It isn't. DI is a pattern suited for object oriented programming with static languages. Switch to a different paradigm and you'll find different solutions. It's common for developers to think of dynamic languages and dynamic typing as synonyms. It's true that most (though not all) dynamic languages are dynamically typed. The fact though is that dynamic languages execute many things at runtime, which static languages do at compile time. The implication is that, within a dynamic runtime, developers have greater capabilities at runtime than their static counterparts. At first such power might seem to be of limited use. After all, how often do you need to change your code at runtime? It seems though, like we often think a feature isn't useful until we have access to it. Consider the features which have been added to C#, before they existing, you possibly didn't even know they could exist. Eventually these additions reshaped how you coded: generics, anonymous methods, LINQ. A dynamic runtime is the same: the impact is difficult to grasp as long as the way you think is constrained by your experience with static languages. Reflection isn't an integral part of your work because it's both limited and cumbersome; yet make it powerful and simple and it might be a tool you leverage on a daily basis. (To be honest, comparing dynamic languages with reflection is hugely unjust to dynamic languages, we're just trying to draw some initial parallels.) What does this have to do with Inversion of Control? The flexible nature of dynamic languages means that IoC is built directly into most dynamic languages. There's no need to inject parameters or use a framework, simply leverage the language's capabilities. Let's look at an example: class User def self.find_user(username, password) user = first(:conditions => {:username => username}) user.nil? || !Encryptor.password_match(user, password) ? nil : user end end Our code has two dependencies: first will access an underlying store (which may not be obvious if you aren't familiar with Ruby) and Encryptor is a made-up class responsible for matching a user's hashed password with a supplied password. In a static world both of these would be troublesome. In ruby, and other dynamic languages? Simply change what first and Encryptor do: def password_match_returns(expected) metaclass = class << Encryptor; self; end metaclass.send :define_method, :password_match do return expected end end def first_returns(expected) metaclass = class << User; self; end metaclass.send :define_method, :first do return expected end end Keep an open mind and remember that this code may be as mysterious to you as anonymous methods and lambdas are to someone else. We'll discuss the code in further detail, but let's first look at how it might be used: it "returns the found user" do user = User.new first_returns(user) password_match_returns(true) User.find_user('leto', 'ghanima').should == user end In real life you'd use a mocking framework to take care of this and provide a cleaner syntax and more powerful features. But, putting aside some of the magic, we can see that our two methods redefine the :first and password_match methods at runtime so that they implement a behavior that our test can use. To really start understanding this, we need to cover singleton classes. In C#, Java and most static languages a class can safely be thought of as a rigid template. You define fields and methods and compile your code using classes as an immutable contract. Classes serve a very useful purpose as a design-time tool. The problem with classes, by no fault of their own, is that most programmers think classes and object-oriented programming are one and the same. They aren't. Object orientated programming is, as the name implies, about the living objects of your running code. In a static language this means instances. Since instances are tightly bound to the template defined by their respective class, it's easy to see why developers mix the two concepts. Look beyond static languages though and you'll see a different story: not only is there no law that says classes cannot themselves be living things, but object oriented programming can happily exist without classes. The best example that you're probably already familiar would be from JavaScript. Behold, OOP without classes: var leto = { fullName: 'Leto Atreides II', title: 'Emperor', yearOfBirth: 10207, getAngryWithDuncan: function(duncan) { duncan.alive = false; } }; var duncan = { ghola: true, alive: true }; leto.getAngryWithDuncan(duncan); As always, the point isn't that one approach is better than another, but rather to gain a different perspective - likely, in this case, on knowledge you already possess. Doing a decade of object oriented programming a certain way is the kind of experience that can compromise your ability to grow. So object oriented doesn't require classes, but as templates classes are quite handy. This is where ruby and singleton classes come in; because, as we've already mentioned, there's no law that says a class has to be a predefined and unchangeable template. In ruby every object has its own class, called a singleton class. This let's you define members on specific instances, like: class Sayan # our class defition for a Sayan end goku = Sayan.new vegeta = Sayan.new def goku.is_over_9000? true #in ruby, the last executed statement is automatically returned end p goku.is_over_9000? => true p vegeta.is_over_9000? => NoMethodError: undefined method `is_over_9000?' Technically, we aren't adding the is_over_9000? method to the goku object, we are adding it to its invisible singleton class, which goku inherits from and thus has access to. We call the singleton class invisible because both goku.class and vegeta.class will return Sayan. There are ways to expose a singleton class, but when you aren't doing metaprogramming, singleton classes are transparent. To get access to a singleton class, which is itself a real object, we use the class << syntax. For example the is_over_9000? method could alternatively be defined like so: class << goku def is_over_9000? true end end If we want to assign the singleton class to a variable, we can simply expose self: singleton = class << goku self end #or, more common and concisely, using ; instead of newlines singleton = class << goku; self; end Interestingly (and I'm not too sure why I find it interesting), if we look at the goku and singleton instances, we get the following output: goku => #<Sayan:0x10053a1f0> singleton => #<Class:#<Sayan:0x10053a1f0>> In Ruby, everything is an object. Even a class is an object (which inherits from Class, which in turn inherits from Object). That means you can invoke methods on your classes: Sayan.is_a?(Object) => true Saya.is_a?(Integer) => false Sayan.to_s => "Sayan" Since classes are objects they too have singleton classes (which are often called metaclasses). We can get access to a class' metaclass via the same class << syntax we used for an instance: metaclass = class << Sayan self end #or, the more consice approach metaclass = class << Sayan; self; end Singleton classes aren't really something you'll deal with too often, but metaclasses are important because class methods are defined in the metaclasses. Class methods are, in a lot of ways, like static methods in C# or Java. They are defined one of two ways and used like you'd expect: class Sayan # First way to define a class method, use self.methodName def self.find_most_powerful() # todo end #second method, opening the metaclass class << self def all_by_level(superSayanLevel) # todo end end end powerfulSayans = Sayan.all_by_level(3) (Understanding self in Ruby, specifically what self refers to in a given context, is important to mastering the language.) The key difference though, between Ruby class methods and Java/C# static methods, is that class methods are defined against a metaclass which is an object. In other words, while class methods resemble static methods, they actually share more in common with instance methods. What does all this get us? Much of the rigidness you'll bump up against in a static language doesn't exist in dynamic language. Sealed classes, non virtual methods and static methods, which are mechanisms to stop you from doing something, vanish. There are pros and cons to both approaches, but there's no reason not to be familiar with both. I do want to point out that, from a testability perspective, metaprogramming does have significant advantages - the difficulty in testing a static password_match method in C# should be proof enough of that. We can't simply overwrite the implementation, as we did at the start of this chapter in Ruby, because classes aren't objects. DI, or even interfaces, simply aren't necessary in Ruby. The decoupling you achieve in C# via injecting interfaces and managing dependencies is replaced by the very nature of the Ruby language. Another way to reduce coupling is to leverage events and callbacks. It's been long understood that events, by their very nature, provide protection against coupling. Code which raises an event is saying I don't care who you are or what you are going to do, but it's time to do it. There could be 0 listeners, or a hundred, they could do all sorts of unrelated things, but none of that matters to the calling code. The code ends up easy to test because, from the caller's point of view, you just need to verify that the event is raised and from the callee's point of view that they register for the event. The reason we don't use events everywhere is because they just don't lend themselves to the linear flow we use for most code. However, over the last couple years, this has started to change. Why? The resurgence of JavaScript. We now have more code written in JavaScript and more developers are letting go of their old (generally negative) perceptions and learning the language anew. JavaScript is no longer a place where we can rely on hacks and hope it all keeps working. There's been a shift towards quality and maintainable JavaScript. That means we need to start worrying about coupling, cohesion and testability. When it comes to that, events are to JavaScript what DI is to Java/C# or metaprogramming is to Ruby. Let's say you're a jQuery master (if you aren't, you can jump to Appendix A then B to start that journey whenever you want) and have built a series of generic plugins. These are things that we plan on reusing throughout our site. A lot of these plugins will need to interact with each other. For example, one of the plugins turns a simple list of rows into a pageable and sortable grid, and another allows a form to be submitted via ajax. Of course, when the user submits a new record, via the ajax form, the fancy grid needs to be updated. First, lets look at the basic setup: //applies the fancyGrid plugin to the element with an id of users $('#users').fancyGrid(); //applies the fancySubmit plugin to the element with an id of add_user $('#add_user').fancySubmit(); The core of our fancySubmit plugin will be something as simple as: (function($) { $.fn.fancySubmit = function(options) { return this.each(function() { var $form = $(this); var self = { initialize: function() { $form.submit(function() { $.post($form.attr('action'), $form.serialize(), self.handleResponse); return false; }); }, handleResponse: function(r) { //what to do here? } }; this.fancySubmit = self; self.initialize(); }); }; })(jQuery); (If you aren't familiar with jQuery, this code is intercepting our form's submit event in order to submit the data via ajax. The response from that ajax call is then handled by the handleResponse function. Again, you might want to skip to Appendix A and B to get up to speed on jQuery.) handleResponse can handle generic cases (errors, validation) directly, but anything more specific will depend on the specific context it's being used in. The solution? Allow a callback to be passed into the plugin and trigger it when appropriate: handleResponse: function(r){ //add some generic handling here first, maybe if (options.onSubmit != null) { options.onSubmit(r); } } With that simple change, we can now tie the two plugins together, without really having to tie them together: //applies the fancyGrid plugin to the element with an id of users var $users = $('#users').fancyGrid(); //applies the fancySubmit plugin to the element with an id of add_user $('#add_user').fancySubmit({ onSubmit: function(r) { $users.fancyGrid('newRow', r); } }); Using this approach, the two plugins work together without knowing anything about each other. This helps ensure that your code stays highly reusable and cohesive. We can test handleResponse by supplying a fake callback which can make some basic assertions. However, we have to deal with call to $.post. Since JavaScript is dynamic like Ruby, it too provides a mechanism to change our runtime definitions. Combining our dynamic rewrite with our custom callbacks yields: test("executes the onSubmit callback after receiving a response", function() { expect(1); //ignore this for now //overwrite the $.post method to always execute the callback with a canned response $.post = function(url, params, callback) { callback('the new row'); } var $form = $('#a_test_form'); $form.fancySubmit( { onSubmit: function(r) { ok(r == 'the new row', 'callback with response was called'); } }); $form.submit(); }); Ignore the call to expect for now, we'll get to it in a minute. We rewrite the $.post function, circumventing the heavy implementation with something controllable and lightweight. $.post now essentially executes the 3rd parameter (which if we look back up at the plugin is a call to self.handleResponse) with a hardcoded parameters. Next, we initialize the plugin with our callback, which will assert that the supplied parameter is what we expect. Finally, we actually submit the form to execute the actual code. About the call to expect, this tells our testing framework, Qunit in this case, that 1 expectation should be called. This is key when dealing with callbacks and events. What would happen if we didn't call expect and also changed our plugin to not invoke our callback? Our test would still pass because nothing would ever be asserted. By specifying expect(1) we ensure that our real expectation (that our callback is called, and called with the correct parameters) is invoked - if ok isn't called, then expect will fail and we'll know something isn't right. The introduction of anonymous methods and lambdas make similar code possible, and even preferable in some situations, in C#. Depending on your experience with Ruby and jQuery, this chapter might have been overwhelming. We covered some advanced techniques in languages less familiar to us. We possibly picked the most complicated part of Ruby to look at (metaprogramming), so don't be discouraged if you missed some, or even most, of it. We also saw some pretty different testing scenarios. Most important though was how we were able to relearn something we thought we knew well (IoC) by learning what, to others, is pretty fundamental stuff. You can almost consider IoC a built-in feature of Ruby, much like you'd see LINQ as a built-in feature of C#. Even if you don't understand the nuance of the code or the implications it has on day to day programming, this chapter should still showcase the value of learning and growing.
https://www.openmymind.net/2011/1/6/Foundations-of-Programming-2-Chapter-3-IoC-180/
CC-MAIN-2021-39
refinedweb
2,635
63.09
On 05/05/2010 09:26 AM, Lukas Kaser wrote: > Hi all, > > I have a configure.ac here which uses AC_PROG_LD, but I don't know > about the purpose of this macro. Unfortunately I do not find and any > doc about it. Autoconf does not define this macro. It comes from somewhere else; most likely from libtool back in the days before libtool decided to use the LT_ macro namespace instead of infringing on autoconf, and still exists in libtool today for backwards compatibility. At a birds-eye level, it is similar to AC_CHECK_TOOL([LD], [ld], ...) for finding the appropriate cross-linker. But in general, you are better off using $CC instead of $LD for linking, as your compiler may know additional things that you would have to manually supply on the command line to a raw linker. -- Eric Blake address@hidden +1-801-349-2682 Libvirt virtualization library signature.asc Description: OpenPGP digital signature
https://lists.gnu.org/archive/html/autoconf/2010-05/msg00015.html
CC-MAIN-2017-04
refinedweb
155
65.52
X <- +/A function array_sum(a, i,s) { for (i in a) s+=a[i] return s } template<class Container> typename Container::value_type containerSum(const Container& container) { return std::accumulate( container.begin(), container.end(), Container::value_type(0)); }or template<class T> vector<T>::value_type ArraySum(vector<T> &array) { T retVal; int cntr; for(cntr = 0 ; cntr < array.size() ; cntr++) { cntr==0?retVal =array[0]:retVal += array[cntr]; } return retVal; }Will work if T has an '=' and a '+' operator. see GrokBranching (before modifying above algorithm) or you could use a higher level library such as Blitz++, BlitzPlusPlus sum( A );Two more modern C++11 versions: template<typename T> auto Sum(T input) -> typename T::value_type { typename T::value_type result{}; for(auto x : input) result += x; return result; } template<typename T> auto Sum(std::initializer_list<T> input) -> T { auto j = begin(input); auto result = *j++; for(; j != end(input); ++j) result += *j; return result; }The former works with any container that supports begin() and end(), the latter works with bare initializer lists and uses a slightly more "correct" loop: auto data = std::vector<int>{1, 2, 3, 4, 5}; auto data = std::list<int>{1, 2, 3, 4, 5}; auto data = std::array<int, 5>{{1, 2, 3, 4, 5}}; cout << Sum(data) << endl; cout << Sum({1, 2, 3, 4, 5}) << endl;The following will work (C++11) for arrays, initializer_lists, valarrays, and any container that exposes appropriate begin() and end() methods. It may be made to work for other types by specializing std::begin and std::end for those types. std::vector<int> data{1, 2, 3, 4, 5}; int sum = 0; std::for_each(std::begin(data), std::end(data), [&](int item){ sum += item; }); int[] numbers = { 1, 2, 3, 4, 5 }; int sum = 0; foreach (int n in numbers) sum += n;This can also be written using the generic Aggregate operator defined by LINQ over any sequence of values. int[] numbers = { 1, 2, 3, 4, 5 }; int sum = numbers.Aggregate((a, b) => a + b);LINQ also predefines the Min, Max, Average, and Sum aggregates, which means you can just write it like this: int[] numbers = { 1, 2, 3, 4, 5 }; int sum = numbers.Sum();-- DonBox (defun sum-sequence (s) (reduce #'+ s)) (sum-sequence '(1 2 3)) -> 6This won't work with CL arrays of rank > 1, which seems to be the point of this page I'm not sure where the requirement can be read that it has to work on arrays of rank > 1. Are the other examples for other languages with multi-dimensional arrays taking care of it? What do you think? (The CL example that is given later on this page for example might give errors if the array has a fill-pointer.) For those who prefer something a bit more amusing: (defun sum-sequence (seq) (loop for x across seq summing x))Loop is just amusing. Require Import List. Require Import Arith. Definition arraysum a := fold_left plus a O. Fixpoint running_sum a l {struct l} := %l decreases with every recursive call a :: match l with | nil => nil | cons b l' => running_sum (plus a b) l' end. Check sum. sum : list nat -> nat Eval compute in sum (1::2::3::nil). = 6 : nat Check running_sum. running_sum : nat -> list nat -> list nat Eval compute in running_sum 0 (1::2::3::nil). = 0::1::3::6::nil : list nat [+z1<S] sSTo use it: 1 2 3 4 5 lSxTo consume a given number of arguments (and leave registers as they were): [ Sn [+ln1-dsn1<m] Sm lmx LmXLn*1=X ] sS [I will not be eaten] 5 4 3 2 1 5 lSx f 15 [I will not be eaten] : table create , does> cell+ ; : tableSize cell- @ ; : tableSum 0 over dup tableSize cells + rot ( sum extent table ) ?do I @ + cell +loop ; 4 table aTable 1 , 2 , 3 , 4 , aTable tableSum . \ 10 arraysum = foldl (+) 0This idiomatic use of currying is equivalent to: arraysum a = foldl (+) 0 aAnd it's good practice to explicitly declare the function type, although the compiler can infer the type from it's use: arraysum :: Num a => [a] -> aTo produce the running sum, we use a counterpart to foldl: scanl, which produces each step of "folding" the operator in. runningsum ns = tail $ scanl (+) 0 nsGiving a type of: runningsum :: (Num a) => [a] -> [a]Even simpler: arraysum = sum a inject(+)Or, equivalently: a fold(+)or: a reduce(+)These three are actually identical (they're names for identical macros). They work on any type which understands "+", including strings. +/ANote that this works on arrays of any rank, producing an array of one less than that rank. Thus, the sum reduces the array by the last axis. This behavior is more formal in J (JayLanguage) than in AplLanguage (see below). By the way, the reducing operation doesn't have to be plus - it can be any "binary" (we call them dyadic) function - such as multiply. Just replace the "+" with the appropriate primitive. For even more fun, +/\AProduces the RUNNING sums. public interface Operator { public Object apply( Object lhs, Object rhs ) ; } public class CollectOperator implements Operator { private Operator op; public CollectOperation( Operator op ) { this.op = op ; } public Object apply( Collection coll, Object start ) { Object accumulator = start ; Iterator it = coll.iterator() ; while (it.hasNext()) { Object obj = it.next() ; accumulator = op.apply( accumulator, obj ) ; } return accumulator ; } } public class IntArrayList extends AbstractList { private int[] arr ; public IntArrayList( int[] arr ) { this.arr = arr ; } public int size() { return arr.length ; } public Object get( int index ) { int i = arr[index] ; return new Integer( i ) ; } } public class AddOperator implements Operator { public Object apply( Object lhs, Object rhs ) { int l = ((Integer)lhs).intValue() ; int r = ((Integer)rhs).intValue() ; int sum = l + r ; return new Integer( sum ) ; } } public int arraySum ( int[] arr ) { List l = new IntArrayList( arr ) ; Operator add = new AddOperator() ; Operator collectAdd = new CollectOperator( add ) ; Object sum = collectAdd.apply( l ) ; return ((Integer)sum).intValue() ; }As you can see, Java is a far superior language to all others! -- TomAnderson Hehehe... a serious case of YouArentGonnaNeedIt-itis with BigDesignUpFront complications. Here's a simple version: public static int sum( int[] a ) { int sum = 0; for( int i = 0; i < a.length; i++ ) sum += a[i]; return sum; } /** * Java 5.0. */ // Returns the sum of the elements of array a // (blatantly plagarized from ) public static int sum(int[] a) { int result = 0; for (int n : a) result += n; return result; } Array.prototype.sum = function() { var n = 0; for (var i=0; i<this.length; i++) n += this[i]; return n; } assert( [1,2,3,4,5].sum() == 15 )See also BlocksInJavaScript for another implementation using an inject() factor. Since ECMA5.1 (JavaScript 1.8), reduce is available. (source: ) var total = [0, 1, 2, 3].reduce(function(a, b) { return a + b; }); // total == 6 x:+/a show reduce "sum [1 2 3 4 5] ; quirk: won't work on the empty list show (sum 1 2 3 4 5) show apply "sum [1 2 3 4 5] my_sum_scalar = sum(x(:));will return a single value, the total of all the numbers in the entire array. my_sum_vector = sum(x);can take a 2D array of numbers and will return the sum "vector", a 1D array of the sum of each column of the array. (It also does something useful for 3D and higher-dimensional arrays -- the same as J (JayLanguage)). using Nemerle.Collections.List; module Sum { Main(): void { def l = [1, 2, 3, 4]; def sum = FoldLeft(l, 0, _+_); System.Console.WriteLine(sum); //prints "10" } } MODULE Example; PROCEDURE ArraySum*(r: ARRAY OF INTEGER); VAR sum: INTEGER; i: INTEGER; BEGIN sum := 0; FOR i := 0 TO LEN(r) - 1 DO sum := sum + r[i] END; END ArraySum; END Example. let int_sum = List.fold_left (+) 0;; (* for integers *) let float_sum = List.fold_left (+.) 0.;; (* for floats *)Note that the plus operator in OCaml is not polymorphic, hence the two versions. my $sum = 0; # initialize to 0 to give the correct result for an empty array $sum += $_ foreach @array;Or a subroutine, if that's too long to type each time: sub sum { my $s = 0; $s += $_ for @_; $s } print sum(1, 2, 3, 4, 5);The function has already been written: use List::Util qw(sum); print sum(0, @array), "\n"; # need the 0 to give the correct result for an empty array $sum = array_sum($array);or: $sum = 0; foreach ($array as $item) { $sum += $item; } arraysum = sum(array) # As we say in Brooklyn, "Terse is cherce."If you want to write it out yourself you could use reduce: import operator arraysum = reduce( operator.add, array, 0 )Or you could just use a loop: total = 0 for value in array: total += valueIf you are summing floats in Python 2.6+, you should use math.fsum(), which avoids loss of precision: import math arraysum = math.fsum(array) sum(anArray) def sumArray(a) sum = 0 a.each {|x| sum = sum + x } return sum endor module ArraySum def sum() sum = 0 self.each {|x| sum = sum + x } return sum end end a = Array.[](1, 2, 3) a.extend ArraySum puts a.sumone of ruby's nice features is that you can extend classes, including the system classes, without changing their source code. The above could be: class Array def sum s = 0; each {|x| s = s + x}; s end end [1, 2, 3, 4].sum => 10And, as always, there's a better way to do it def sumArray(a) a.inject(0) { |sum, value| sum + value } endAnd then there's the slightly more general expression, which returns nil as its "0", but works for all types of lists def sum a a.inject { |sum, i| sum + i } end def sum(a: Int*) = (0 /: a) (_ + _)Lest you conclude that ScalaLanguage is an incomprehensible language, let me point out that "/:" is right-associative synonym for "foldLeft" and "(_ + _)" is shorthand for ((i, j) => i + j) so the above could be equivalently written: def sum(a: Int*) = (a foldLeft 0) ((i, j) => i + j)Or with more Java-like syntax: def sum(a: Int*) = a.foldLeft(0) {(i, j) => i + j }Scala 2.8 now has it built in to all collections so the above function is simply: def sum(a: Int*) = a sum (define (vector-sum vec) (do ((i 0 (+ i 1)) (sum 0 (+ sum (vector-ref vec i)))) ((= i (vector-length vec)) sum))) (vector-sum '#(1 2 3))Doesn't Scheme have a fold/reduce/collect/whatever function? [He's kidding. I hope. Presumably springboarding off the above Java joke. ] Actually, while R5RS does not define any of them, one of the SchemeRequestsForImplementation (SRFI-1, List Library) has a full complement of fold and reduce functions. Thus, in an implementation that supports SRFI-7 and SRFI-1, one could write, (program (requires srfi-1)) (fold + 0 '(1 2 3 4 5))Mind you, these are list reduction functions, and so technically do not fit the problem description. That's OK, though, since writing a fold-vector function would be fairly easy: (define (fold-right-vector op initial vec) (let ((endpoint (- (vector-length vec) 1))) (if (> 0 endpoint) initial (begin (op initial (let accumulate ((count 0)) (if (>= count endpoint) (vector-ref vec count) (op (vector-ref vec count) (accumulate (add1 count)))))))))) (define (vector-sum vec) (fold-right-vector + 0 vec)) (vector-sum #(1 2 3 4 5))(note that this code has only been cursorily tested and may have bugs). Of course, one could use (vector->list) and then apply the list (fold), but that doesn't exactly match the problem. Adapting this to work with homogeneous-numeric vectors (SRFI 4) or multidimensional arrays (SRFI 25) is left as an exercise. - JayOsako You can sum lists in Scheme by (define (list-sum lst) (apply + lst))Aren't Scheme implementations allowed to have a smallish upper limit on how many arguments you can pass to a procedure? If so, that solution might not work for long lists. I see one argument there. Then look again. The elements of lst are being turned into arguments to +. If there are more elements in the list than your implementation's limit on args passed to a procedure, then you lose. It is exactly one argument. The list is not expanded into its elements. However, the task was to give a sum function for arrays. Since there are no native arrays in Scheme (just like C), the function does not deal with arrays. As for vectors, you either have to resort to the function given above or use (vector->list array) in the second version with some overhead. That's certainly how it is in CommonLisp. In CommonLisp you'd use REDUCE: (defun sum-sequence (s) (reduce #'+ s :initial-value 0)), which works for both lists and vectors. Common lisp actually has a (multivariate) array type, so in that case you could do something like (defun sum-array (a) (loop for n below (array-total-size a) summing (row-major-aref a n))) myArray := #(1 2 3 4 5). sum := myArray detectSum: [ :n | n + 0 ].Except that #detectSum: isn't part of redbook Smalltalk. Try this instead: Array>>sum ^self inject: 0 into: [:each :sum | each + sum] Standard ML of New Jersey v110.57 [built: Fri Feb 10 21:37:49 2006] - val intArraySum = Array.foldl op+ 0 ; [autoloading] [library $SMLNJ-BASIS/basis.cm is stable] [autoloading done] val intArraySum = fn : int array -> int - val realArraySum = Array.foldl op+ 0.0 ; val realArraySum = fn : real array -> real - intArraySum (Array.tabulate (10, fn i => i)) ; val it = 45 : int - realArraySum (Array.tabulate (10, real)) ; val it = 45.0 : real select sum(x) from a a.reduce(0) { $0 + $1 } if {[llength $arr]} {expr [join $arr +]} {expr 0}or - if using Tcl's associative 'arrays' set sum 0 foreach {nm val} [array get arrName] { incr sum $val } Dim numbers%() = { 1, 2, 3, 4, 5 } Dim sum = 0 For Each n In numbers sum = sum + n NextThis can also be written using the generic Aggregate operator defined by LINQ over any sequence of values. Dim numbers%() = { 1, 2, 3, 4, 5 } Dim sum = numbers.Aggregate(Function(a, b) a + b)LINQ also predefines the Min, Max, Average, and Sum aggregates, which means you can just write it like this: Dim numbers%() = { 1, 2, 3, 4, 5 } Dim sum = numbers.Sum()-- DonBox WorksheetFunction.sum(anArray) * Populate an array. DIMENSION aSumArray[10] FOR x = 1 TO 10 aSumArray(x) = x ENDFOR * Sum its contents. LOCAL oursum oursum = 0 FOR x = 1 TO ALEN(aSumArray) oursum = oursum + aSumArray(x) ENDFOR-- KenDibble
http://c2.com/cgi-bin/wiki?ArraySumInManyProgrammingLanguages
CC-MAIN-2014-42
refinedweb
2,413
61.46
In this section, you will create an index that displays at the end of your report. This index will simply display the customer's name and the page number on which the name appears. This indexing technique is useful when users want to find a specific customer's name, but are not sure what category (for example, country) to reference. Figure 35-10 Sample index for the paper report The steps in this section will show you how to create a table in the database that will hold the page numbers for the items you want to list in the index. If you are not sure if you can create a table in the database, contact the database administrator. To create a table in the database: Follow the steps in Section 35.2.1, "Create a table in the database to hold the TOC data" to create a new table in the database, using the following code: create table index_example (term varchar2(100), page number); Press Enter. You should see a notification that the table has been created. Exit SQL*Plus. The steps in this section will show you how to create a format trigger based on the customer's last name. You will use the SRW.GET_PAGE_NUM built-in function to find the page number for the current customer, and insert that page number into the table you created in the previous section. To create a format trigger: In Reports Builder, open the report, toc_ your_initials .rdf. Click the Paper Layout button in the toolbar to display the Paper Layout view. In the Paper Layout view, right-click the field F_CUST_LAST_NAME, then choose Property Inspector from the pop-up menu. Under Advanced Layout, double-click the Format Trigger property field to display the PL/SQL Editor. In the PL/SQL Editor, use the template to enter the following code: function F_CUST_LAST_NAMEFormatTrigger return boolean is PageNum number; begin -- get pagenumber srw.get_page_num(pageNum); -- insert into table insert into index_example values (:Cust_last_name||', '||:Cust_first_name, PageNum); return (TRUE); end; Note:You can enter this code by copying and pasting it from the provided text file called toc_index_code.txt. Click Compile. If there are compilation errors, match your code to the code we have provided (either in the example RDF file or in this chapter), then compile it again. Once there are no compilation errors, click Close. Save your report as toc_index_ your_initials .rdf. The steps in this section will show you how to add a query to your data model that will retrieve the individual customer names and the page numbers for your index. SUBSTR(TERM,1,1) INITIAL_LETTER, TERM, PAGE FROM INDEX_EXAMPLE ORDER BY TERM OK. In the new query that displays in the Data Model view, click and drag the INITIAL_LETTER column above the rest of the query, so that the data model now looks like this: Figure 35-11 Data model view of the index Save your report. The steps in this section will show you how to display the index information in the Trailer section of your report. To create a report block in the Trailer section: In the Paper Layout view, click the Trailer Section button in the toolbar. Choose Insert > Report Block. On the Style page, select the Group Above radio button, then click Next. On the Groups page, click G_2 (the name of the new group that contains the INITIAL_LETTER column), then click Down to specify the print direction. In the Available Groups list, click G_INITIAL_LETTER, then click Down. Click Next. On the Fields page, click INITIAL_LETTER, then click > to move it to the Displayed Fields list. Move TERM and PAGE to the Displayed Fields list. Click Next, then Next again, then click Finish. Save your report. Click the Run Paper Layout button in the toolbar. The index displays on the last pages of the report. We chose page 2402, which (in our example) looks like the following: Note:To generate the table of contents (TOC), you must click the Run Paper Layout button. If you click the Paper Design view button, the change of format order will not take effect, thus the TOC will not be generated. Figure 35-12 Index page of the report Note:The data on page 2402in your report may not appear the same as ours, depending on the amount and type of data you have in the schema.
http://docs.oracle.com/cd/E23943_01/bi.1111/b32122/orbr_fotoc003.htm
CC-MAIN-2017-09
refinedweb
728
69.62
plone.formwidget.querystring 1.1.7 A widget for composing a Query string/search. Introduction A z3c.form-based widget for composing a Query string/search. This widget is used by the contentlisting tile and the dexterity-based version of plone.app.collection (>2.0), to make selections, and ‘build’ your query. It stores a list of dictionaries containing the query you’ve build. This query is being parsed by using plone.app.collection and that used plone.app.contentlisting to display the results in the tile. Installation If you install plone.formwidget.querystring, you probably want to use it in an add-on product for Plone. Therefore you can add it to the setup.py of your package: install_requires=[ 'plone.formwidget.querystring', ... ], You probably want to also use it to the list of dependencies in your generic setup profile (profiles/default/metadata.xml): <metadata> <version>1</version> <dependencies> <dependency>profile-plone.formwidget.querystring:default</dependency> </dependencies> </metadata> Dexterity Widget To assign the plone.formwidget.querystring widget to a field in your custom content type, you can use a plone.autoform directive in the interfaces definition (interfaces.py): from plone.formwidget.querystring.widget import QueryStringFieldWidget class IMyDexteritySchema(form.Schema): form.widget(query=QueryStringFieldWidget) query = schema.List( title=_(u'label_query', default=u'Search terms'), description=_(u"""Define the search terms for the items you want to list by choosing what to match on. The list of results will be dynamically updated"""), value_type=schema.Dict(value_type=schema.Field(), key_type=schema.TextLine()), required=False ) Note See:: See and for further examples of how to use plone.formwidget.querystring. Credits - Kim Chee Leong - Ralph Jacobs - Jonas Baumann - Hanno Schlichting - Timo Stollenwerk Changelog 1.1.7 (2016-08-15) Bug fixes: - Use zope.interface decorator. [gforcada] 1.1.6 (2016-05-10) Fixes: - Fix way to decode utf-8 into template. [bsuttor] 1.1.5 (2015-07-18) - Conditionally setup zope.app.form field. [vangheem] 1.1.4 (2014-11-05) - Fix criteria checkbox rendering if value contains non ASCII characters. [rnixx] 1.1.3 (2014-11-01) - Fixed sort index selection which was not preserved when editing collection criteria. [naro] - make compatible with jQuery >= 1.9 [petschki] 1.1.2 (2014-04-05) - Fixed label for “Add Criteria” (missing id=”addindex”) [djay] 1.1.1 (2014-02-23) - Avoid TypeError: ‘NoneType’ object is not iterable when the query of the collection is still None, like is the case when adding one. [maurits] 1.1.0 (2013-11-14) - Change javascript to work on form-widgets-ICollection fields instead of form-widgets. [maurits, kaselis] 1.0b4 (unreleased) - If we set background to ‘white’ we should set foreground to ‘black’ to avoid people getting white font on white background if they use white font color for their plone sites. [saily] - Add handling of the RelativeDateWidget, already expected to exist in p.a.querystring. [tmog] - Add jquery dateinput to dateWidget and dateRangeWidget. [tmog] 1.0b3 (2013-02-04) - Fixed context for getting ajax results [kroman0] - Fixed conditional initialization of querywidget, see [kroman0] - The widget can now be hidden, when clicking on the window or the widget. The event is only effective when the widget is displayed. [bosim] - Translations are now in Plone domain [bosim] - Made the widget a bit more resistent to missing entries, i.e. vocabularies or in other way indexes. The problem occur if an option is deleted from the registry but not deleted from the collections in before hand. [bosim] - Update import path for pagetemplate. Now only works with 4.1 and higher [do3cc] 1.0b2 (2012-03-19) - Fix sort-reversed checkbox javascript. [timo] - Move docs/HISTORY.txt to CHANGES.txt to apply to Plone conventions. [timo] 1.0b1 (2012-03-09) - Stop hardcoding the field name so it works with other field names and prefixes. [davisagli] - Rename ArcheTypesQueryWidget to Querywidget to avoid confusion. [timo] - Several JSLint fixes on querywidget.js [timo] - Make sure the sorting settings are actually stored on the collection. [timo] 1.0a1 (2011-10-28) - Initial release. [ralphjacobs, kcleong, jbaumann, hannosch, timo] - Author: Plone Foundation - Keywords: form widget querystring search collection - License: GPL - Categories - Package Index Owner: gotcha, timo, esteele, hannosch, jensens, plone - DOAP record: plone.formwidget.querystring-1.1.7.xml
https://pypi.python.org/pypi/plone.formwidget.querystring
CC-MAIN-2016-50
refinedweb
705
52.87
I have a csv file which is more or less "semi-structured) rowNumber;ColumnA;ColumnB;ColumnC; 1;START; b; c; 2;;;; 4;;;; 6;END;;; 7;START;q;x; 10;;;; 11;END;;; Now I would like to get data of this row --> 1;START; b; c; populated until it finds a 'END' in columnA. Then it should take this row --> 7;START;q;x; and fill the cells below with the values until the next 'END' (here:11;END;;;) I am a complete beginner and it is pretty tough for me, how I should start: import au.com.bytecode.opencsv.CSVReader import java.io.FileReader import scala.collection.JavaConversions._ import scala.collection.mutable.ListBuffer val masterList = new CSVReader(new FileReader("/root/csvfile.csv"),';') var startList = new ListBuffer[String]() var derivedList = new ListBuffer[String]() for (row <- masterList.readAll) { row(1) = row(1).trim if (row(1) == "START") startList += row(0) } var i = 0 for (i <- i to startList.length ) { for(row <- masterList.readAll) if (row(0) > startList(i) && row(0) < startList(i+1)) { derivedList += row } } I started to read the file with CSVReader and create a masterList. I created a loop and iterate und put all the START values into it (so I know the range from START to the next START). I created a second loop where I wanted to put in the datasets into a new ListBuffer. But this does not work The next step would be to merge masterList + derived List. I need some good ideas, or a push in the right direction, how I could proceed or how I could do this a bit easier? Help very much appreciated!! I don't know, if there is a big difference in the first place, but I want to create a Apache Spark application. There is also the option to do this in Python (if it is easier) Output should look like this: It should look like 1;START; b; c; 2;;b;c; 4;;b;c; 6;END;;; 7;START;q;x; 10;;q;x; 11;END;;; You never touch the line with END. Just fill up the lines below START with ColumnB and ColumnC
http://www.howtobuildsoftware.com/index.php/how-do/fjH/python-scala-csv-apache-spark-populate-csv-with-scala
CC-MAIN-2019-04
refinedweb
357
72.56
SOAP is a powerful but very complicated protocol for doing remote procedure calls. Its complexity makes it a daunting task even to do simple things. As part of a project at Franz Inc. we needed code to make Java and Lisp communicate using the SOAP protocol. There would be a number of services written in Java and and a number of services written in Lisp and calls had to work with Lisp calling Java, Java calling Lisp, Java calling Java and Lisp calling Lisp. Java has a web service library which we couldn't modify so we had to make Lisp's web services obey the conventions used by Java to expose a web service. Specifically, the Java code was using the JAXWS-2.0 library for web services. We wrote the Lisp code for calling the first Java web service and it was a tedious task. Not relishing the thought of writing many more interfaces we did what Lisp programmers do, we wrote a program to write our interface code. This code, which is provided in a modified form here as part of this note, was specific to our project. It is not part of Allegro CL. Users are free to take it and adapt it for their own use. Note it is provided As Is, with no waranties expressed or implied, etc. etc. Note that your Lisp must have all recent SOAP updates and patches in order for the code to work. See sys:update-allegro (the function for downloading patches) for information on getting updates. We call our our program to write Lisp SOAP code ssoap, meaning Simple SOAP. Below we give an example showing how it works. Because we wrote the code for our specific project, it only supports passing the data types needed for that project. Users interested in the code must modify and extend it as needed to suit their needs. ssoap achieves simplicity by eliminating many (perhaps most) of the choices you have when writing a SOAP application. Our goal was not to build a new complete soap interface, just to make simple one which could do the necessary things and to talk to Java applications. Java's web services do the following to expose themselves. then an http GET request to that URL will return a 200 status code response. What it returns with that response is irrelevant for our purposes (what it in fact does is send back a description of the methods that service accepts). All we need is the information that if the web service is up and running, a 200 response is returned for a normal http GET command. then the http request for will return an xml file which is the wsdl for this service. This is critical because often Java clients will read the wsdl at parse time to know how to call the service. The ssoap code arranges for both of the above behaviors to occur for the soap services it starts. In a SOAP call there are two actors: the client and the server. The server sits idle and listens for a call. The client makes the call and optionally passes data to the server. The server performs the requested action and then notifies the client that it is finished, optionally passing back data to the client. In ssoap we define a service. A service consists of one or more methods. Each method has a client side and a server side. We will generally know when we define the service whether this is a service we will be implementing in Lisp or whether we just want access to this service as a client from Lisp. With ssoap you can even do both: build a service in Lisp and also provide the client interface to the service. In fact if you want to implement a service in Lisp you'll likely want to define the client interface in Lisp as well so that you can more easily test your Lisp service. ssoap is used in this way: Let's look at an example, this one for a service that does conversion between Celsius and Fahrenheit. We put the following forms in a file called converter-ssoap.cl (the contents are in the dowloadable ssoap.cl file in a commented section): (in-package :user) (let ((sss (make-ssoap-service :name "Converter" :package :user :target-namespace "" :host "127.1" :port "8088" ;; optional, specify if you want to create a server :server 'start-converter-ss-soap-server :prefix 'converter ;; used to construct names :messages '(("CelsiusToFahrenheit" :in (("celsius" :float)) :out (("fahrenheit" :float)) :client (converter-ss-celsius-to-fahrenheit &key url celsius) :server (converter-ss-server-celsius-to-fahrenheit &key celsius) ) ("FahrenheitToCelsius" :in (("fahrenheit" :float)) :out (("celsius" :float)) :client (converter-ss-fahrenheit-to-celsius &key url celsius) :server (converter-ss-server-fahrenheit-to-celsius &key fahrenheit) )) ))) (generate-interface-code-file sss "converter-interf.cl") (generate-wsdl sss "converter.wsdl") ) The arguments to make-ssoap-service are as follows. host and port: the :host and :port arguments are our best guess as to where the service will be hosted. This information only used if you create a wsdl file from this definition using generate-wsdl as is shown in the example. The wsdl file, if generated, is not used by the Lisp code. It's only present to allow other soap systems (e.g. Java) to be clients or servers of this service. Each method begins with the name of the method and then is followed by a sequence of arguments. The :in and :out arguments specify the values sent to and received from the web method. Each value is given a name (that ends up being an XML element name so choose simple names), and a type. So far ssoap only support four types: :int, :string, :float, :base64Binary. Other types can be added to the ssoap code as necessary (by modifying the functions lookup-xsd-type and lookup-xsd-type-symbol). The :client argument is optional and if present tells ssoap to create a client function in Lisp to call this method. The value of the :client argument is the name and signature of the method to call. The signature will always be &key followed by url and then followed by symbols with the same names as the :in arguments to the function. Since the signature can be computed automatically why are we forcing the user of ssoap to specify it? The reason is that it then makes it clear to the person viewing this service definition file how the client function should be called. The required url argument to the client function is the location of the service. The lisp client of the service must know where the service is. The :server is optional and need only be specified if you want Lisp to serve this service (in which case you've also specified the :service argument as described above). The server argument specifies the signature of a function that you must write to perform the action of this method. Again the signature can be computed from the :in parameters of the method by turning those input arguments into keyword arguments. The ssoap module forces you to specify it though so that the defintion file explicitly reminds you of the signature of this method. Once the make-ssoap-service function is run it builds the ssoap-service object and we then pass it to generate-interface-code-file, specifying a file to be written with this interface code. Next well want to compile and load in this file. Finally we write out a wsld file which we may need if we're going to interface with Java, for example, but more on this later. Before we work with Java let's show how we can use ssoap to make Lisp talk with Lisp. Our example above includes both client and server functions so we'll use it to create both a server and client interface to that server. We need one more piece of code to run the example. We need to implement the server side for the service we've defined. Let's do just one, the server for CelsiusToFahrenheit. ("CelsiusToFahrenheit" :in (("celsius" :float)) :out (("fahrenheit" :float)) :client (converter-ss-celsius-to-fahrenheit &key url celsius) :server (converter-ss-server-celsius-to-fahrenheit &key celsius) ) We've aleady specified the signature of the function: :server (converter-ss-server-celsius-to-fahrenheit &key celsius) Now we define it using that signature (defun converter-ss-server-celsius-to-fahrenheit (&key celsius) (list "fahrenheit" (+ 32 (* 9/5 celsius)))) The value returned from a function implementing a soap service is in property list format, a list of alternating names and values. In this case we see from the definition of the function :out (("fahrenheit" :float)) we return just one value and its name is "fahrenheit". Now we're ready to run the example. At this point, two files have been generated: converter-interf.cl and converter.wsdl. If you're interested you can view the wsdl file but we don't need it now. No we can start the SOAP server for the service cl-user(4): (start-converter-ss-soap-server 8088) #<net.xmp.soap:soap-aserve-server-string-in-out-connector @ #x1001e11ab2> 8088 "" The third return value is the URL for the service. Note you will get a different value. We can now call the service as a client by using the :client method we declared (we use the URL value returned above -- if you run this example, you should use the value you get which will be different): cl-user(7): (converter-ss-celsius-to-fahrenheit :url "" :celsius 100) (converter-ssoap-gen-package::CelsiusToFahrenheitResponse (:fahrenheit 212.0)) nil cl-user(8): The return value of the client call is XML expression returned from the server, parsed into what we call lxml format. It's easy to find in it the the answer requested from the service. Finally we'll consider how to communicate with Java. Suppose you have a Java SOAP server and you wish to wish to call it from Lisp using ssoap. At present the only way to do this is for you to write a ssoap definition by hand based on the wsdl for the service. We hope to automate this at some time in the future. In order to use Java as a client to an ssoap server you need to create a web client interface in Java. There are various tools in Java to do this. The Netbeans IDE makes it particuarly easy. You can ask Netbeans to create client interface objects from either a wsdl file or from an active url (such as). The client interface is hardwired to call the service at the location specified in the wsdl file (although with a bit of work you can access services whose location you learn about at run time). We used Netbeans to create a client interface based on the wsdl created by our ssoap definition of the Converter service. Then we asked Netbeans to insert a call to the CelsiusToFahrenheit method of that service. We specified an initial value to test and added a print statement to show the results and we then had this main program: package converter; /** * * @author jkf */ public class Main { /** * @param args the command line arguments */ public static void main(String[] args) { // TODO code application logic here try { // Call Web Service Operation com.franz.converter.webservice.ConverterService service = new com.franz.converter.webservice.ConverterService(); com.franz.converter.webservice.Converter port = service.getConverterPort(); // TODO initialize WS operation arguments here float celsius = (float) 100.0; // TODO process result here float result = port.celsiusToFahrenheit(celsius); System.out.println(celsius + " Celsius is " +result + " Fahrenheit"); } catch (Exception ex) { // TODO handle custom exceptions here System.out.println("calling service got exception " + ex); } } } when this is run it prints 100.0 Celsius is 212.0 Fahrenheit In summary the ssoap module proves a simple way to describe a soap service and to write the necessary glue code to start that service and to call that service as a client. Furthermore it implements server behavior expected by java web services so that it will interoperate with them. Again, the code is availabe here, and will only work if all SOAP updates and patches have been loaded.
https://franz.com/support/tech_corner/ssoap021209.lhtml
CC-MAIN-2018-17
refinedweb
2,049
62.27
01 September 2010 22:14 [Source: ICIS news] SAO PAULO (ICIS)--A labour union said Brazilian petrochemical company Braskem could close its polypropylene (PP) plant in Camacari, ?xml:namespace> The 123,000 tonnes/year plant has the lowest capacity of Braskem’s facilities, Bahia Chemical and Oil Workers Union director Robson Santana said in a press statement. The plant is controlled by Quattor, which merged with Braskem in January. The labour union said the plant’s has not been updated as have Braskem’s other PP units. The union labour said Braskem would make a decision on the future of the plant by the beginning of 2011. Braskem and Quattor did not immediately respond to an inquiry by IC
http://www.icis.com/Articles/2010/09/01/9389990/brazil-labour-union-says-braskem-pp-plant-could-close.html
CC-MAIN-2013-48
refinedweb
119
69.62
std::vector crashes on deallocation After downloading the latest version of OpenCV, I'm having a problem where using certain functions that output values to a std::vector crashes when the vector destructor is called. For example, the following snippet crashes at at the end of the code as x falls out of scope: #include <opencv2/opencv.hpp> using namespace cv; int main(int argc, char *argv[]) { int size = 512; std::vector<Point> x; Mat m(1, size, CV_8U, Scalar(128)); findNonZero(m,. now, that you changed your question / usage significantly, please check, if you accidentally mix opencv debug/release libs. you have to strictly use one type with one built. failing to do so usually produces errors like yours. Hi! Did you solve this issue or figured out whe it happens? I'm having the same problem when using std::Vector<cv::point> vec and similar code to yours. A workaround I found is to use reserve with a larger size before calling the findNonZero() function and than there is no crash. @[email protected]">@[email protected] , please do not post answers here, if you have a question or a comment, thank you.
https://answers.opencv.org/question/63943/stdvector-crashes-on-deallocation/?sort=latest
CC-MAIN-2022-40
refinedweb
193
62.07
When. Intro Experienced ASP.NET developers might find that Tag Helpers take some getting used to. The syntax for writing a Tag Helper is lighter and doesn't require special @ escape characters like traditional Razor. While Tag Helpers require less context switching, it can feel like a black box at first glance. To overcome the learning curve of Tag Helpers, we'll get an understanding of some of the basic concepts. Using this knowledge, we'll learn how to migrate existing HTML Helper patterns to Tag Helpers. Through this process, we'll form a solid reference for utilizing Tag Helpers in ASP.NET Core projects. Before we begin working with Tag Helpers, it's important to ensure our project is configured to use Tag Helpers. At the very least, we need to be using an ASP.NET Core project. Tag Helpers aren't available in ASP.NET 4.x MVC projects. Inside of our ASP.NET Core project, we need to ensure that Tag Helpers are enabled. This includes any third-party Tag Helper libraries we want to use. To declare Tag Helpers for our project, we'll use @addTagHelper directives in the *_ViewImports.cshtml* file. Within this file, all namespaces available to the view scope of the application are declared. In the following example, we have both the native ASP.NET Core Tag Helpers as well as additional UI components from the Telerik UI for ASP.NET Core package. Let's do a quick test to make sure our Tag Helpers are working correctly by writing our first Tag Helper. We'll use the /Home/Index.cshtml view as a workspace to begin writing our markup. In the view, add a Tag Helper to create a simple link. To do this, we'll write <a asp-Home</a>. If everything is configured correctly, the code highlights with a bold font. Now that we've written our first Tag Helper, let's use it to identify a few common patterns that will help when discovering new Tag Helpers and learning how to convert from the HTML Helper syntax to Tag Helpers. We'll continue using the Anchor Tag Helper as an example. Let's look at some characteristics of the markup to identify common patterns used by Tag Helpers. By understanding these patterns, we can more easily discover Tag Helpers through IntelliSense. We'll also learn about where certain parameters have moved. If we compare the Anchor Tag Helper with the HTML Helper equivalent, we can identify key differences. In the example below, the named parameters are used on the HTML Helper to help identify where the values map to the equivalent Tag Helper. As we can see, this version uses a Tag Helper attribute in combination with an HTML <a> anchor tag to identify the action name. The link text simply follows normal HTML conventions for an anchor tag. <a asp-Home</a>@Html.ActionLink(linkText: "Home", actionName: "Index") Tag Helper attributes require less abstraction from HTML itself, providing less visual friction throughout the markup. We can see more blending of HTML and Tag Helpers when we begin to add standard HTML attributes to the element. To add standard HTML attributes to the markup using HTML Helpers, we would use the htmlAttributes parameter and pass in an anonymous object. Since the parameter is written as an anonymous C# object, it must follow C# rules and only C# IntelliSense is applied. This means that we must escape C# keywords, and no IntelliSense is provided for CSS or HTML. @Html.ActionLink("Home", "Index", new { @class="btn btn-primary", role="button" }) When we write these same standard attributes using a Tag Helper, the attributes are treated as HTML. Since the context hasn't changed to C#, we no longer need to escape keywords. We continue to get the proper IntelliSense. <a asp-Home</a> Just as standard attributes are treated as normal HTML, so is the inner content of a Tag Helper. The action name, Home, is simply written as content inside the tag. As we saw in the previous example, setting the action name within a Tag Helper is effortless. Because Tag Helpers embrace the natural flow of HTML, container UI elements are much easier to represent using Tag Helpers than with HTML Helpers. An HTML <form> is a primary example of a how HTML Helpers can make things difficult. Since HTML Helpers don't have a begin/end concept, they often rely on @using statements as a proxy being a content container. We can rewrite this same markup using a Form Tag Helper. The Form Tag Helper and BeginForm HTML Helper are functionally similar. They both generate the HTML <form> element and action attribute value for an MVC controller action or named route. Additionally, a hidden Request Verification Token is rendered to prevent cross-site request forgery (when used with the [ValidateAntiForgeryToken] attribute in the HTTP Post action method). The Form Tag Helper improves readability since it requires no using statement, {} braces, or @ escape characters. The content of a form can be any HTML, HTML Helper, or Tag Helper. The impact of migrating a form to use only standard HTML and Tag Helpers reduces the overall visual friction on the markup. Tag Helpers flow naturally into an HTML structure as content containers. As natural content containers, Tag Helpers boast another feature that sets them apart from HTML Helpers—the child Tag Helper. Child Tag Helpers allow the composition of complex UI elements by using parent-child relationships. Child Tag Helpers are specific to the parent and only available within the context of the parent element. Consider a complex UI component, such as the Telerik UI for ASP.NET Core Kendo UI grid, which has many configurable elements. Such elements include data source, columns, rows, templates, and edit modes. In addition, the data grid has properties to enable features like sorting, filtering, and paging. The grid can be created through a fluent HTML Helper or chain-able set of APIs that render HTML. Using the grid HTML Helper, various aspects of the grid are configured through the API chain. The chain begins with setting the Name property. We then build a Columns configuration, enable features, and configure a DataSource. Thanks to the fluent API chain and IntelliSense, setting up the grid and all of its various parts is a streamlined process. With Tag Helpers, we can have a similar experience using child Tag Helpers. Instead of starting a chain of API calls, we'll open a new <kendo-grid> tag and begin a new tag inside the grid's body. Column, feature, and DataSource configurations are all specified in the body using child tag helpers. The child tag helper pattern continues until all of the desired options have been set and the grid is fully configured. Child Tag Helpers offer a structured way of writing complex UI elements while maintaining the HTML like document flow. Looking closely at the code above, notice the properties are at parity with the version using HTML Helpers. There are some minor differences in the way properties are completed, for example with column field names. For simplicity, the column child Tag Helper uses a field property with a string value as opposed to the HTML Helper which uses a model expression. The string-based field property can easily perform the equivalent task by utilizing Razor and the nameof operator. field="@nameof(CustomerViewModel.ContactName)" Because Tag Helpers are Razor markup, they can easily transition from HTML to C# or combine with HTML Helpers when necessary. Remember that the purpose of Tag Helpers isn't to replace HTML Helpers, but to offer another approach to writing markup. HTML Helpers continue to work in ASP.NET Core, and they can be combined with Tag Helpers too. Mixing Tag Helpers and HTML Helpers is acceptable when a Tag Helper isn't available or when it provides a better developer experience. Using both can also provide a temporary solution while migrating to Tag Helpers or easing the learning process. Telerik UI for ASP.NET Core's Kendo UI responsive panel Tag Helper is a content container much like the Form Tag Helper. Its main purpose is to provide a fly-out panel which displays HTML content contained within the tag's body. Since the body section is Razor markup, it can contain Tag Helpers, HTML Helpers, standard HTML, or any combination of these. In the following example, a <kendo-responsivepanel> Tag Helper is used with a body that contains standard HTML labels and DateInput HTML Helpers. We could also express the body content using standard HTML labels and <kendo-dateinput> Tag Helpers. Both code examples render the same HTML output. The developer's preferred example is based on comfort level with either HTML Helpers or Tag Helpers. While Tag Helpers do provide an aesthetic or less visual friction, there are some additional benefits too. Depending on how the Tag Helper's source code was written, there's a possibility for better performance. Tag Helpers can be authored to take advantage of asynchronous processing, or ProcessAsync, as is the case for Telerik UI for ASP.NET Core Tag Helpers. With the underlying code utilizing ProcessAsync, the <kendo-dateinput> Tag Helper can potentially render faster than its HTML Helper counterpart. Through the examples, we explored the common patterns used for ASP.NET Core Tag Helpers. Tag Helpers offer an HTML-like experience by using tags and attributes for encapsulating HTML markup. Through the use of the Tag Helper's body section, child content can easily be added without the need for complex @using statements. Tag Helpers require less context switching by utilizing standard HTML attributes such as class and role and require no escape characters. They produce less visual friction within the Razor document. Developers should find migrating from HTML Helpers to Tag Helpers relatively easy. While the syntax differs between the two concepts, convention, and tooling help bridge the gap. The introduction of child Tag Helpers assists in the developer experience by providing discoverability and IntelliSense for complex UI patterns such as the Kendo UI grid. The ability to utilize standard HTML, HTML Helpers, and Tag Helpers in a single Razor file at once lessen the overall learning curve. While migrating to Tag Helpers remains optional and at the developers' discretion as to how much or how little to use them, there are possible performance gains to be had through the underlying ProcessAsync Tag Helpers use to render HTML. To try a variety of Tag Helpers including grids, charts, graphs and navigation elements like the responsive panel, download a 30-day free trial of Telerik UI for ASP.NET Core. If you're already subscribing to the Telerik DevCraft bundle, UI for ASP.NET Core is included. View All
https://www.c-sharpcorner.com/article/migrating-to-asp-net-core-tag-helpers/
CC-MAIN-2019-13
refinedweb
1,797
64.3
The Internet of Things on AWS – Official Blog over MQTT with TLS client authentication on port 443 using the ALPN TLS extension. For background about why this is useful, see this blog post. In this blog post, I will walk you through two ways to connect your devices to AWS IoT Core over MQTT on port 443. Method 1: Using Paho-MQTT client and OpenSSL Most common TLS implementations, including OpenSSL and mbedTLS support the ALPN TLS extension. In this example, we will use a Paho-mqtt client and the OpenSSL library to connect your devices to the AWS IoT endpoint. Prerequisites Before you connect your devices, check the software version of Python and OpenSSL to ensure they support ALPN extension. - Python 2.x: you need version 2.7.10 or later - Python 3.x: you need version 3.5 or later - OpenSSL: you need version 1.0.2 or later To check your environment 1. Check the OpenSSL version: openssl version OpenSSL 1.0.2k-fips 26 Jan 2017 2. Check the Python version. python --version Python 2.7.13 3. Check the version of OpenSSL that Python references. python >>> import ssl >>> print ssl.OPENSSL_VERSION OpenSSL 1.0.2k-fips 26 Jan 2017 *If the reference is to older version of OpenSSL, you have to update it. This sample script uses Paho as the MQTT library to publish messages. The latest stable version of the Paho-MQTT client is available in Python Package Index (PyPi). Install it using pip: pip install paho-mqtt Each connected device must have a credential to access the message broker or the Device Shadow service. The sample script uses X.509 certificates as an authentication mechanism to connect to the AWS IoT endpoint. You can use the AWS IoT console or CLI to create an AWS IoT certificate. For more information, see Create and Register an AWS IoT Device Certificate in the AWS IoT Developer Guide and create-keys-and-certificate in the AWS CLI Command Reference. The following very simple example creates a connection to the AWS IoT endpoint and publishes a message to it. Copy the following script into a file and save the file as alpn_mqtt.py. from __future__ import print_function import sys import ssl import time import datetime import logging, traceback import paho.mqtt.client as mqtt IoT_protocol_name = "x-amzn-mqtt-ca" aws_iot_endpoint = "AWS_IoT_ENDPOINT_HERE" # <random>.iot.<region>.amazonaws.com url = "https://{}".format(aws_iot_endpoint) ca = "YOUR/ROOT/CA/PATH" cert = "YOUR/DEVICE/CERT/PATH" private = "YOUR/DEVICE/KEY/PATH" logger = logging.getLogger() logger.setLevel(logging.DEBUG) handler = logging.StreamHandler(sys.stdout) log_format = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') handler.setFormatter(log_format) logger.addHandler(handler) def ssl_alpn(): try: #debug print opnessl version logger.info("open ssl version:{}".format(ssl.OPENSSL_VERSION)) ssl_context = ssl.create_default_context() ssl_context.set_alpn_protocols([IoT_protocol_name]) ssl_context.load_verify_locations(cafile=ca) ssl_context.load_cert_chain(certfile=cert, keyfile=private) return ssl_context except Exception as e: print("exception ssl_alpn()") raise e if __name__ == '__main__': topic = "test/date" try: mqttc = mqtt.Client() ssl_context= ssl_alpn() mqttc.tls_set_context(context=ssl_context) logger.info("start connect") mqttc.connect(aws_iot_endpoint, port=443) logger.info("connect success") mqttc.loop_start() while True: now = datetime.datetime.now().strftime('%Y-%m-%dT%H:%M:%S') logger.info("try to publish:{}".format(now)) mqttc.publish(topic, now) time.sleep(1) except Exception as e: logger.error("exception main()") logger.error("e obj:{}".format(vars(e))) logger.error("message:{}".format(e.message)) traceback.print_exc(file=sys.stdout) Run the Python script Run the Python script you created by executing the following command: python alpn_mqtt.py 2018-03-15 11:03:25,174 - root - INFO - start connect 2018-03-15 11:03:25,254 - root - INFO - connect success 2018-03-15 11:03:25,255 - root - INFO - published:<timestamp> 2018-03-15 11:03:26,256 - root - INFO - published:<timestamp> When you see the “connect success” and “published:< timestamp >” messages in the console, the connection to AWS IoT Core was successfully established and the message was published. If you see any errors in the execution of the script, check the AWS IoT endpoint or certificate information you provided. Test whether AWS IoT received the client message To confirm that AWS IoT receives the client message, sign in to the AWS IoT console. In the left navigation pane, choose Test, and then choose Subscribe. Subscribe to the test/date topic. After you have subscribed, you will see published messages from the client device on the console every second, as shown here. If your client device is running on Linux, you can use tcpdump to test. tcpdump port 443 Method 2: Using the AWS IoT Device SDK for Python The AWS IoT Device SDK for Python allows developers to write a Python script to use their devices to access AWS IoT. Currently, you can choose either MQTT over TLS on port 8883 or MQTT over the WebSocket protocol on port 443. Support for MQTT on port 443 is not provided by default. You have to modify the Device SDK to enable the functionality. Because the OpenSSL library built with the Device SDK supports ALPN extension, to enable MQTT communication over port 443, you have to modify how the SSL library is configured. In this example, I show the changes you need to make in the Device SDK to connect to an AWS IoT endpoint over MQTT on port 443. The AWS IoT Device SDK for Python is built on top of a modified Paho-MQTT Python client library. Modify the client.py file in the AWSIoTPythonSDK/core/protocol/paho/ folder. Example: /usr/local/lib/python2.7/site-packages/AWSIoTPythonSDK/core/protocol/paho/client.py The changes that you need to make are shown here: --- a/AWSIoTPythonSDK/core/protocol/paho/client.py +++ b/AWSIoTPythonSDK/core/protocol/paho/client.py @@ -787,15 +787,26 @@ class Client(object): self._ssl = SecuredWebSocketCore(rawSSL, self._host, self._port, self._AWSAccessKeyIDCustomConfig, self._AWSSecretAccessKeyCustomConfig, self._AWSSessionTokenCustomConfig) # Overeride the _ssl socket # self._ssl.enableDebug() else: -) - + if self._port == 8883: +) + else: + context = ssl.SSLContext(self._tls_version) + context.load_cert_chain(self._tls_certfile, self._tls_keyfile) + context.verify_mode = self._tls_cert_reqs + context.load_verify_locations(self._tls_ca_certs) + context.set_alpn_protocols(["x-amzn-mqtt-ca"]) + + self._ssl = context.wrap_socket(sock, server_hostname=self._host, do_handshake_on_connect=False) + + self._ssl.do_handshake() + if self._tls_insecure is False: if sys.version_info[0] < 3 or (sys.version_info[0] == 3 and sys.version_info[1] < 5): # No IP host match before 3.5.x self._tls_match_hostname() After making the changes, create a simple Python script that creates a connection to the AWS IoT endpoint and publishes a message to it. For more information, see the AWS IoT Device SDK for Python. # Import SDK packages from AWSIoTPythonSDK.MQTTLib import AWSIoTMQTTClient # For certificate based connection myMQTTClient = AWSIoTMQTTClient("myClientID") # Configure the MQTT Client myMQTTClient.configureEndpoint(<YOUR_AWS_IOT_ENDPOIT>, 443) myMQTTClient.configureCredentials("YOUR/ROOT/CA/PATH", YOUR/DEVICE/KEY/PATH ", " YOUR/DEVICE/CERT/PATH ") # Connect to AWS IoT endpoint and publish a message myMQTTClient.connect() print ("Connected to AWS IoT") myMQTTClient.publish("alpn/devicesdk", "Hello over MQTT on port 443", 0) myMQTTClient.disconnect() Run the Python script Run the Python script you created by executing the following command. python aws-iot-with-alpn.py Connected to AWS IoT When you see the “Connected” message in the console, the connection to AWS IoT Core was successfully established and the message was published. If you see any errors in the execution of the script, check the device certificates and make sure that the attached policy allows AWS IoT Core access. Summary In this post, I’ve shown you two ways to connect your IoT devices to AWS IoT Core over MQTT on port 443. If you have had a constraint in the past to open port 8883 in your corporate firewalls, you can now use a standard port for HTTPS traffic (443) to send your messages over MQTT to AWS IoT Core endpoint. For more information about AWS IoT Core, see the AWS IoT Core Developer Guide
https://aws.amazon.com/blogs/iot/how-to-implement-mqtt-with-tls-client-authentication-on-port-443-from-client-devices-python/
CC-MAIN-2018-47
refinedweb
1,316
51.14
Java, J2EE & SOA Certification Training - 32k Enrolled Learners - Weekend - Live Class The release of Java 9 and Java 9 features is a milestone for the Java ecosystem. Keeping up with new releases is important for staying up to date with the technology and understanding the need behind what gets introduced will gear you closer to your Java, J2EE & SOA Certification. The modular framework developed under Project Jigsaw will be part of this Java SE release and major features in this are the JShell (REPL tool), important API changes and JVM-level changes to improve the performance and debuggability of the JVM. Before we unravel the Java 9 features in detail let us take a peek at previous Java versions and see what were the shortcomings and how Java 9 helped to overcome those anomalies:- In this blog post I will categorize Java 9 features in the following manner: I have picked a few new Java 9 features, which I feel are worth knowing about. Let’s see what are these features:- Java’s Process API has been quite primitive, with support only to launch new processes, redirect the processes’ output, and error streams. In this release, the updates to the Process API enable the following: Let’s look at a sample code, which prints the current PID as well as the current process information: public class NewFeatures{ public static void main(String [] args) { ProcessHandle currentProcess = ProcessHandle.current(); System.out.println("PID:"+ currentProcess.getPid()); ProcessHandle.Info currentProcessInfo = currentProcess.info(); System.out.println("Info:" + currentProcessInfo); } This Java 9 feature is expected to change in the subsequent releases and may even be removed completely. Earlier Developers often resort to using third-party libraries, such as Apache HTTP, Jersey, and so on. In addition to this, Java’s HTTP API predates the HTTP/1.1 specification and is synchronous and hard to maintain. These limitations called for the need to add a new API. The new HTTP client API provides the following: Let’s see a sample code to make an HTTP GET request using the new APIs. Below is the module definition defined in the file module-info.java: module newfeatures{ requires jdk.incubator.httpclient; } The following code uses the HTTP Client API, which is part of jdk.incubator.httpclient module:());</pre> <pre>System.out.println("Response Body:" + response.body()); } } } program as scala>println(“Hello World”); Some of the advantages of the JShell REPL are as follows: Let’s run the JShell command, as shown in the following image:, these Java 9 features of multi-release JAR files allows developers to build JAR files with different versions of class files for different Java versions. The following example makes it more clear. Here is an illustration of the current JAR files: jar root - A.class - B.class - C.class Here is how multi-release – 9 folders are picked up for execution. On a platform that doesn’t support multi-release JAR files, the classes under the versions directory are never used. So,if you run the multi-release JAR file on Java 8, it’s as good as running a simple JAR file. In this update, a new class, java.util.concurrent.Flow has been introduced, which has nested interfaces supporting the implementation of a publish-subscribe framework. The publish-subscribe framework enables developers to build components that can asynchronously consume a live stream of data by setting up publishers that produce the data and subscribers that consume the data via subscription, which manages them. The four new interfaces are as follows: The main aim of this project is to introduce the concept of modularity; support for creating modules in Java 9 and then apply the same to the JDK; that is, modularize the JDK. Some of the benefits of modularity are as follows: There are various JEPs, which are part of this project, as follows: Now that you have understood features of Java 9, check out the Java Certification Training by Edureka, a trusted online learning company with a network of more than 250,000 satisfied learners spread across the globe. Got a question for us? Please mention it in the comments section of this “Java 9” blog and we will get back to you as soon as possible.
https://www.edureka.co/blog/java-9-features/
CC-MAIN-2019-39
refinedweb
706
50.06
I got 1,000 words into “what, exactly, is software complexity” before remembering that this is supposed to be less effort than the blog. So instead I’m going to list some ideas I had for programming languages. I think all of these are technically doable, so it’s more a “nobody else wants this badly enough” thing. Also caveat these might all already exist; I just know the languages I know! Contracts are predicates on the code, usually attached to functions and treated like assertion statements. The canonical example is withdrawing from a bank account: method withdraw(amnt: int) requires amnt <= self.balance ensures self.balance >= 0 { self.balance -= amnt; } The standard bearer for contracts used to be Eiffel, which people stopped caring about in the mid-90’s. Nowadays the only mainstream language to get serious about contracts is Clojure. Most languages have a contracts library, which mean the language doesn’t have affordances to use contracts well. Take the predicate is_sorted(l): forall i, j in 0..len(l): i < j => l[i] <= l[j] Most languages have all and any functions but they don’t allow quantifying over multiple elements, and basically no languages have an implication operator (because it’s near-useless for programming). I want to see a language integrate contracts into the syntax well. At the very least, dedicated syntax for preconditions, postconditions, and inline assertions. Also the ability to label and reuse predicates, and “orthogonal” contracts (postcondition A is only checked if precondition A’ was true). Stuff like that. And tool integration! One of the coolest things Eiffel sorta did was use contracts to infer tests. If you have contracts, you can use a fuzzer to get integration tests for free. Clojure’s Spec does something kinda similar, I think. Inheritance and interfaces are relationships between classes. But what about relationships between functions? Take the following two functions: def window1(l, n): if len(l) < n: return [] out = [] for intervals in range(len(l) - (n - 1)): window = l[intervals:(intervals+n)] out.append(prod(window)) return out def window2(l, n): if len(l) < n: return [] out = [] val = prod(l[0:n]) for i in range(n, len(l)): out.append(val) val *= (l[i] / l[i-n]) out.append(val) return out These take the rolling products of a list l, so window1([1, 2, 3, 4, 5], 2) == [2, 6, 12, 20]. window2 is an optimized version of window1 and should have the same outputs for every input. I should be able to encode that in the language, and have the tooling generate checks showing the two are the same, and also run benchmarks testing if the optimized version actually is faster. I can think of other relationships between stuff. A' is an instrumented version of class A. g is an inverse of f such that f(g(x)) == x. P' is an ontological subtype of P but not a Liskov subtype. UML had things like “traces” and “refines” and “generalizes”, there could be things there too. The point is I want to be able to express semantic relationships at the language level in a way that the program can leverage. Would go nicely with contracts, too, as you could have relationships that preserve/transform/expand contracts. The usual one is that “inherited methods have less restrictive preconditions and more restrictive postconditions.” What else could we do? Graphs are really common data structures but there hasn’t yet been an “everything’s a graph” language. In fact, almost no languages even have graphs in their standard library! I think that’s because graphs are an extremely complicated data structure. You know how annoying linked lists are? Graphs are 1000x worse. Nonetheless, I wanna see someone try! Give me a language where key-value maps are emulated with directed bipartite graphs. I have a love/hate relationship with J. There’s so much about the language that drives me batty, but I stick with it because it’s the only language that gets remotely close to being a good desktop calculator. When doing quick computations for work projects, I care about two things. The first is the number of keystrokes. Here’s how to get the product of factorials of a list in python:1 import math prod([math.factorial(x) for x in l]) No! Bad python! In J it’s just */ ! l, quite literally an order of magnitude fewer keystrokes. When I’m trying out lots of different equations, keystokes matter a lot. J is very much “everything is an array”, though, which limits its potential as a calculator. You can’t work with strings, json, sets, or hash maps very well, date manipulation is terrible, you can barely do combinatorics problems, etc etc etc. I want a language that’s terse for everything. Maybe you could namespace operators. The other feature I want for a calculator is built-in reactive programming, like an unholy combination of a textual programming language and Excel. I want to be able to do something sorta like this: input = 1 out1: input + 1 #out1 is now 2 input = 4 #out1 is now 5 out2: out1.replace(+, -) #out2 is now 3 # let's pull an APL input = 4 2 #out1 is 5 3 #out2 is 3 1 This would be absolutely hell to learn at first, but I’ve learned plenty of weird languages that promised a lot of power. Interactive computation is a common enough activity for me that I’d put a lot of time into learning something like this. …Maybe I should just get real good with Excel. (Someone’s gonna tell me this is 100% smalltalk for sure) Static types are great! There’s lots of cool stuff being done with static typed languages right now. Not so much with dynamic types, though. Most of the research and interest is in adding gradual typing to dynamic languages. I think there’s a lot of interesting experiments we can do with dynamic types. I mean, you can generate new types at runtime! Combine that with contracts and we can attach constraints to variables, like this: type Interval(x, y) <: Int { x <= self <= y; } var i: Interval(1, 10) = 3 i += 7 #ok i += 1 #error! How cool is that?! Now I don’t know how useful this would be (maybe it’s just syntactic sugar over classes), but it’s still interesting to me. I want to see what people do with it. I also like the idea of modifying function definitions at runtime. I have these visions/nightmares of programs that take other programs as input and then let me run experiments on how the program behaves under certain changes to the source code. I want to write metaprograms dammit I miss VB6.).
https://buttondown.email/hillelwayne/archive/six-programming-languages-id-like-to-see/
CC-MAIN-2022-33
refinedweb
1,133
65.83
Q: The namespaces spec used to say that an XML namespace was a system identifier [@@cite/check], i.e. a URI. Then, at the last minute[@@], it changed to say that an XML namespace was a URI reference. Why? What's the difference? A: Leaving why aside for starters... let's first contrast the terms URI reference and absolute URI. An absolute URI is the thing you (typically) hand to your network software to say "please fetch some content using this identifier". The following are absolute URIs: In contrast, the following are not absolute URIs: The first three are obviously not absolute. The last one is absolute, but the syntax of absolute URIs doesn't include fragment identifiers. The syntax of URI references includes all of the above. That's at least part of the answer to why the change from URI to URI reference in the namespaces spec: because the designers intended for fragment identifiers to be allowed in namespace names. Unfortunately, the URI specification does not have a term for 'an absolute URI with an optional fragment identifier'. For the purpose of this discussion, let's call that a URI+. Note that the semantics of URI references is very different from the semantics of absolute URIs. The typical algorithm for following a hypertext reference in the Web is: given an absolute URI--let's call it b--and a URI reference--call it r: [@@I say typically, because, for example, most user agents don't have a facility for doing getRemoteContent on mailboxes (mailto: URIs). They do a prepareToPostTo(absURI) in stead.] So the semantics of an absolute URI is, as the name suggests, to identifiy a resource; a URI+ then identifies a resource or some fragment of/view on a resource. The semantics of a URI reference, on the other hand, is that it denotes a URI+ when combined with a base absolute URI. To reiterate: a URI+ identifies a resource, but a URI reference refers to a URI+. Q: You explained absolute URI, URI reference, and URI+, but you never told me what a URI is. A: the URI spec, unfortunately, doesn't define the term URI. It characterizes URIs, gives examples, etc., but doesn't specify syntax nor define the term as such. A conservative (conventional?) reading of the spec infers that the term URI means absolute URI. Q: But... the XML 1.0 spec uses the term URI. What does it mean by URI? A: it seems to mean URI reference, since it gives examples in relative form and explains how to expand system identifiers to absolute form. But it seems to treat fragment identifiers as an error. I think the XML Core WG is dicussing this; stay tuned to the errata@@. Q: The XML 1.0 spec also says how to treat non-ascii characters in system identifiers; I thought URIs only contained ASCII characters. What's up? A: XML 1.0 follows HTML 4.0 in using a slightly sloppy specification for how to "handle a non-ASCII character in a URI". In fact, there is no such thing as a non-ASCII character in a URI (absolute URI or URI reference). But there is a convention for interpreting a string of Unicode characters as a URI reference by UTF-8 encoding and %HH escaping the non-ASCII characters. For this discussion, we'll follow the Internet Draft Internationalized Uniform Resource Identifiers (IURI) (see also: background on i18N of URIs) and use the term IURI reference for a Unicode string that is intended to represent a URI reference in this fashion. Q: Er... so... if a URI reference refers to URI+, and a namespace name is a URI reference, then the thing that a namespace name refers to is a URI+, right? i.e. a namespace is a URI+??? A: That's one logical conclusion of a very literal reading of the namespaces spec as written. @@@@@ Q: but file:/dir1/dir2/stuff denotes different resources depending on which machine you're using, no? A: one view is "no, it always refers to /dir1/dir2/stuff on the machine you're using, just like always refers to the client's personalized version of yahoo." @@ Q: Is a base URI intrinsic to an XML document? In other words: if I have a simple <helloWorld/> document at , and I move it to, do I still have the same XML document, is is this a different document? A: This question isn't answered by the ratified specs. For the purpose of this discussion, let's refine the terms so that a disconnected XML document has no intrinsic base URI, wheras a connected XML document does. So <helloWorld/> is the same disconnected document regardless of what base URI you use to find it, but it's (the text of) two different conntected XML documents, one whose base URI is, and on whose base URI is. In the current [@@november 1999?] infoset spec, the base URI is a property of a document info item, and hence a property of a document, and hence different base URIs imply different documents; i.e. by document it means connected XML document. We could have followed the disconnected XML document usage, but that would have made the specification of external entities and stuff more rhetorically complex [@@exaplain/justify]. Q: Does every XML document have a base URI? What about documents from stdin, or documents in memory? A: choose from:
http://www.w3.org/2000/06/uriqa3934.html
CC-MAIN-2016-18
refinedweb
907
64
Adding a Property Page (ATL Tutorial, Part 6) Property pages are implemented as separate COM objects, which allow them to be shared if required. In this step, you will do the following tasks to add a property page to the control: Creating the Property Page Resource Adding Code to Create and Manage the Property Page Adding the Property Page to the Control To add a property page to your control, use the ATL Add Class Wizard. To add a Property Page In Solution Explorer, right-click Polygon. On the shortcut menu, click Add, and then click Add Class. From the list of templates, select ATL Property Page and click Add. When the ATL Property Page Wizard appears, enter PolyProp as the Short name. Click Strings to open the Strings page and enter &Polygon as the Title. The Title of the property page is the string that appears in the tab for that page. The Doc string is a description that a property frame uses to put in a status line or tool tip. Note that the standard property frame currently does not use this string, so you can leave it with the default contents. You will not generate a Help file at the moment, so delete the entry in that text box. Click Finish, and the property page object will be created. The following three files are created: The following code changes are also made: The new property page is added to the object entry map in Polygon.cpp. The PolyProp class is added to the Polygon.idl file. The new registry script file PolyProp.rgs is added to the project resource. A dialog box template is added to the project resource for the property page. The property strings that you specified are added to the resource string table. Now add the fields that you want to appear on the property page. To add fields to the Property Page In Solution Explorer, double-click the Polygon.rc resource file. This will open Resource View. In Resource View, expand the Dialog node and double-click IDD_POLYPROP. Note that the dialog box that appears is empty except for a label that tells you to insert your controls here. Select that label and change it to read Sides: by altering the Caption text in the Properties window. Resize the label box so that it fits the size of the text. Drag an Edit control from the Toolbox to the right of the label. Finally, change the ID of the Edit control to IDC_SIDES using the Properties window. This completes the process of creating the property page resource. Now that you have created the property page resource, you need to write the implementation code. First, enable the CPolyProp class to set the number of sides in your object when the Apply button is pressed. To modify the Apply function to set the number of sides Replace the Apply function in PolyProp.h with the following code: STDMETHOD(Apply)(void) { USES_CONVERSION; ATLTRACE(_T("CPolyProp::Apply\n")); for (UINT i = 0; i < m_nObjects; i++) { CComQIPtr<IPolyCtl, &IID_IPolyCtl> pPoly(m_ppUnk[i]); short nSides = (short)GetDlgItemInt(IDC_SIDES); if FAILED(pPoly->put_Sides(nSides)) { CComPtr<IErrorInfo> pError; CComBSTR strError; GetErrorInfo(0, &pError); pError->GetDescription(&strError); MessageBox(OLE2T(strError), _T("Error"), MB_ICONEXCLAMATION); return E_FAIL; } } m_bDirty = FALSE; return S_OK; } A property page can have more than one client attached to it at a time, so the Apply function loops around and calls put_Sides on each client with the value retrieved from the edit box. You are using the CComQIPtr class, which performs the QueryInterface on each object to obtain the IPolyCtl interface from the IUnknown interface (stored in the m_ppUnk array). The code now checks that setting the Sides property actually worked. If it fails, the code displays a message box displaying error details from the IErrorInfo interface. Typically, a container asks an object for the ISupportErrorInfo interface and calls InterfaceSupportsErrorInfo first, to determine whether the object supports setting error information. You can skip this task. CComPtr helps you by automatically handling the reference counting, so you do not need to call Release on the interface. CComBSTR helps you with BSTR processing, so you do not have to perform the final SysFreeString call. You also use one of the various string conversion classes, so you can convert the BSTR if necessary (this is why the USES_CONVERSION macro is at the start of the function). You also need to set the property page's dirty flag to indicate that the Apply button should be enabled. This occurs when the user changes the value in the Sides edit box. To handle the Apply button In Class View, right-click CPolyProp and click Properties on the shortcut menu. In the Properties window, click the Events icon. Expand the IDC_SIDES node in the event list. Select EN_CHANGE, and from the drop-down menu to the right, click <Add> OnEnChangeSides. The OnEnChangeSides handler declaration will be added to Polyprop.h, and the handler implementation to Polyprop.cpp. Next, you will modify the handler. To modify the OnEnChangeSides method Add the following code in Polyprop.cpp to the OnEnChangeSides method (deleting any code that the wizard put there): OnEnChangeSides will be called when a WM_COMMAND message is sent with the EN_CHANGE notification for the IDC_SIDES control. OnEnChangeSides then calls SetDirty and passes TRUE to indicate the property page is now dirty and the Apply button should be enabled. The ATL Add Class Wizard and the ATL Property Page Wizard do not add the property page to your control for you automatically, because there could be multiple controls in your project. You will need to add an entry to the control's property map. To add the property page Open PolyCtl.h and add this line to the property map: The control's property map now looks like this: BEGIN_PROP_MAP(CPolyCtl) PROP_DATA_ENTRY("_cx", m_sizeExtent.cx, VT_UI4) PROP_DATA_ENTRY("_cy", m_sizeExtent.cy, VT_UI4) #ifndef _WIN32_WCE PROP_ENTRY_TYPE("FillColor", DISPID_FILLCOLOR, CLSID_StockColorPage, VT_UI4) #endif PROP_ENTRY_TYPE("Sides", 1, CLSID_PolyProp, VT_INT) // Example entries // PROP_ENTRY("Property Description", dispid, clsid) // PROP_PAGE(CLSID_StockColorPage) END_PROP_MAP() You could have added a PROP_PAGE macro with the CLSID of your property page, but if you use the PROP_ENTRY macro as shown, the Sides property value is also saved when the control is saved. The three parameters to the macro are the property description, the DISPID of the property, and the CLSID of the property page that has the property on it. This is useful if, for example, you load the control into Visual Basic and set the number of Sides at design time. Because the number of Sides is saved, when you reload your Visual Basic project, the number of Sides will be restored. Now build that control and insert it into ActiveX Control Test Container. In Test Container, on the Edit menu, click PolyCtl Class Object. The property page appears; click the Polygon tab. The Apply button is initially disabled. Start typing a value in the Sides box and the Apply button will become enabled. After you have finished entering the value, click the Apply button. The control display changes, and the Apply button is again disabled. Try entering an invalid value. You will see a message box containing the error description that you set from the put_Sides function. Next, you will put your control on a Web page. Back to Step 5 | On to Step 7
http://msdn.microsoft.com/en-us/library/3dc9xhf3.aspx
CC-MAIN-2013-48
refinedweb
1,225
63.59
.(). All of the examples use the text file lorem.txt, containing a bit of Lorem Ipsum. For reference, the text of the file is:.. Note There are differences in the arguments and behaviors for mmap() between Unix and Windows, which are not discussed below. For more details, refer to the standard library documentation. Reading¶ Use the mmap() function to create a memory-mapped file. The first argument is a file descriptor, either from the fileno() method of a file object or from os.open(). The caller is responsible for opening the file before invoking mmap(), and closing it after it is no longer needed. The second argument to mmap() is a size in bytes for the portion of the file to map. If the value is 0, the entire file is mapped. If the size is larger than the current size of the file, the file is extended. Note You cannot create a zero-length mapping under Windows. An optional keyword argument, access, is supported by both platforms. Use ACCESS_READ for read-only access, ACCESS_WRITE for write-through (assignments to the memory go directly to the file), or ACCESS_COPY for copy-on-write (assignments to memory are not written to the file). import mmap import contextlib with open('lorem.txt', 'r') as f: with contextlib.closing slice operation. In this example, the pointer moves ahead 10 bytes after the first read. It is then reset to the beginning of the file by the slice operation, and moved ahead 10 bytes again by the slice. After the slice operation, calling read() again gives the bytes 11-20 in the file. $ python.
https://pymotw.com/2/mmap/index.html
CC-MAIN-2017-22
refinedweb
270
66.84
01 August 2011 04:40 [Source: ICIS news] By Felicia Loo ?xml:namespace> A major Chinese seller withdrew its offer to sell 4,000 tonnes of bonded MTBE last week. The seller’s initial offer stood at $1,140/tonne (€787/tonne) FOB (free on board) Around 10,000-12,000 tonnes of MTBE material were being resold into the Singapore market in recent weeks at $1,120/tonne FOB China, or equivalent to $1,165/tonne CFR (cost & freight) Singapore, the traders added. The cargo was subsequently sold at $1,140/tonne FOB “MTBE demand in Domestic MTBE prices in Buying ideas were at CNY8,400-8,500/tonne, while selling indications were at CNY8,600-8,700/tonne, the traders said. “The [country’s] gasoline stockpiling activity will heighten in September, ahead of the Golden Week holidays in October,” a trader in There will be hundreds of thousands of motorists on the roads during Golden Week, which is a week-long holiday celebrating China's National Day. Passenger car sales in Overall gasoline demand remains stable in Chinese market players were earlier compelled to resell MTBE overseas because of weak domestic consumption, the players said. In addition, a price rally in regional trading hub The price spread between 97-octane gasoline and 92-octane gasoline widened by $1.70/bbl to $7.10/bbl in early July, signalling a healthy demand for blending as the spread was well above the break-even level of $6.00/bbl. It is unusual for A major Chinese oil company imported only 10,000 tonnes of MTBE from late June this year to early July, down from a monthly average of 30,000 tonnes because of poor demand, the traders added. Last month, Asia’s top refiner Sinopec issued stricter specifications on buying gasoline from private domestic blenders in Sinopec has been tightening the quality control on sourcing gasoline from private blenders since 21 May, which includes reducing the olefin content in gasoline from 30% to just above 8%. Sinopec outsources around 14% of its gasoline requirements from independent refineries, traders or blenders. Benchmark prices of MTBE in Prices were assessed at $1,130-1,135/tonne FOB Prices on a CFR China basis rose by $40-60/tonne to $1,080-1,120/tonne during the same week. ($1 = €0.69, $1 = CNY6.44)
http://www.icis.com/Articles/2011/08/01/9481288/china-stops-mtbe-re-exports-because-of-rising-domestic.html
CC-MAIN-2014-10
refinedweb
393
55.17
How to make Python regexes a little less greedy There are these little things that once you learn about them you wonder how you ever did without them. The Python non-greedy modifier definitely falls into that category. I spent far too much time and consumed far too much coffee figuring out how to get a certain matching operation to work in some recent code. It worked though. Mostly. Until it didn't. There's always that "edge case" where the regex fails and you are back to the wonderful world of convoluted character sets and weird modifiers that is regex. When my carefully thought out (really blood, sweat and tears hacked out) regex failed yet again I decided enough was enough. Here was the problem: --- title: This is some title description: This is the description --- Some content... This is a simplified version of the metadata that each piece of content on the site has. What the code needs to do is extract the metadata and the content. This seems straightforward. You might come up with: ---\s([\s\S]*)\s---\s([\s\S]*) We can simplify that but getting rid of the extra new lines in our captured text by using the .strip() function in Python so you end up with: ---([\s\S]*)---([\s\S]*) The metadata drops into the first () and the content into the second () and there are rainbows and unicorns and all is good in the world. Until this happens... --- title: This is some title description: This is the description --- Some content... Item | Description --- | --- A | A thing B | Another thing Some more content... And now there are tears because it all goes horribly wrong. You see Python regexes are downright greedy. They try to match as much text as possible. Which means your regex now matches right down to the first --- in the Markdown table. This is where you probably start trying all kinds of variations on your regex to restrict the match to only the metadata. But there's an easy little fix... ---([\s\S]*?)---([\s\S]*) The secret is that addition of the ? operator. Like many operators it has many functions but when it's next to * it means "don't be so darn greedy". Here's the actual code where I use it: def extract_parts(source): m = re.search(r'---([\s\S]*?)---([\s\S]*)', source, re.MULTILINE) metadata = m.group(1) markdown = m.group(2) return metadata.strip(), markdown.strip() This little ? turns out to be hellishly useful. For example: <p>Para 1</p><p>Para 2></p> If you only want the first para you could use <p>.*?</p>, and you'd only match the first para. You can test this out with the following code: import re s = "<p>para 1</p><p>para 2</p>" m = re.search(r'<p>.*</p>', s) print(m.group(0)) m = re.search(r'<p>.*?</p>', s) print(m.group(0)) Yes. Useful indeed. Once you know about the non-greedy operator you'll wonder how you ever did without it!
https://tonys-notebook.com/articles/python-non-greedy-regexes.html
CC-MAIN-2022-05
refinedweb
506
76.52
I am trying ot fetch href based on the argument which i pass..for example test.py arg1 arg2 ...where arg1 is school name something like "south carolina" so it has to retrieve the score according to the school given in the argument. Here is a small snippet from the prettified source which i saved using urlopen and BeautifulSoup. <a data- <span class="away "> 30 </span> - <span class="home winner"> 41 </span> </a> Now the arg1 should match with href provided so that i can retrieve the score.. I used bs.find('a', href="/ncaaf/south-carolina-gamecocks-georgia-bulldogs-201309070068/") But what if I have to match my argument such as south carolina to href..How can I match it? something like href="/ncaaf/south-carolina-* so that I can fetch whole href just by matching with argument1 (which I will be replacing with hyphens) and also if I give "gerorgia" is it possible to retrieve the href just by matching the argument regardless of the position of the string after /ncaaf/............./ As I'm poor in regex ,it's bit complicated You'd indeed have to match that with a regular expression. If your command-line argument is of the form south-carolina in sys.argv[1], use: import re school_name = sys.argv[1] url_pattern = re.compile(r'/ncaaf/{}-'.format(re.escape(school_name))) matching_links = soup.find_all('a', href=url_pattern) The re.escape() makes sure that any characters in the input that could be interpreted as regular expression meta-characters are properly escaped. For south-carolina that'd result in the pattern /ncaaf/south-carolina- which matches anything containing the literal text /ncaaf/south-carolina-; you don't really need to include any wild-card characters as for a re.search() match text containment is enough.
http://www.dlxedu.com/askdetail/3/87dc0a084f4e327e7528720f873076f1.html
CC-MAIN-2018-51
refinedweb
297
58.08
Smart Clips are a fantastic time-saving feature of Flash 5. They allow you to create what's known as parameterized contentin other words, reusable components that you can quickly tailor to any number of different situations. Smart Clips differ from regular movie clips because each instance of a Smart Clip can be configured differently by setting its parametershence the term parameterized. This article deals with the creation of a Smart Clip calendar control and its implementation as part of a fictional diary (see Figure 1). The Smart Clip has a fairly generic function: to allow the user to select a particular date so that it can be inserted into the movie and then customized using a special custom UI (or user interface) that is actually built in Flash! Once you've mastered this technique, you'll be able to create any number of Smart Clips of your own, complete with attractive Flash-based interfaces. You can then use these at your workplace, distribute them free, or even sell them to other Flash developers. Because Smart Clips are so flexible, you'll find that it's easier than ever to build modular, reusable Flash components. Figure 1 A look at the finished product. Scripting the Calendar The calendar control begins its life as an ordinary movie clip symbol. It's actually constructed fairly simply, as a grid of text fields that are filled with numbers depending on the month and year currently being displayed. The fields and buttons have all been laid out for you, so the following steps concentrate on the ActionScript code that makes the calendar work: Download the source file archive, open the unzipped MegansDiary_start.fla file, and save it to your hard drive. The final file is MegansDiary_final.fla. Open the Library window and locate the Calendar Control symbol (see Figure 2). Double-click to edit it. Figure 2 Locate the Calendar Control symbol in the library. The symbol is made up of background graphics, a text field for displaying the current month and year, a grid of date fields, and two arrow buttons on either side for scrolling between months. Each of the date fields in the grid is an instance of the same movie clip, containing a text field for holding its date number as well as a simple button that allows the user to click the selected date. Select the empty keyframe on the ActionScript layer, and then open the Actions panel. Insert the code to create an array of month names (see Figure 3). // Declare array of month names Months = new Array("January","February","March","April","May", "June","July","August","September","October","November","December"); You do this first to make sure that the Months array is available to the other functions. ActionScript deals with dates as numbers and expresses months specifically as a number between 0 (for January) and 11 (for December). This zero-based counting system works perfectly with the Array object because its first element is always numbered 0 also. So, by creating an array of text strings that correspond to each of the 12 months, you have an easy way of plugging any month number into the Months array to get a text version. For example, if ActionScript gives you a date number 3, it's a simple matter to evaluate Months[3] to get the text string April. Figure 3 Notice that Flash keeps all the data for the Months array on one line. NOTE Although ActionScript uses zero-based counting for months, it uses regular one-based counting for years and days. So, even though month 3 equals April, day number 15 is just 15there is no day 0. Insert the ActionScript to initialize the calendar by creating a new Date object and then setting its basic properties (see Figure 4). // Initialize Calendar CalendarDate = new Date(); if (ShowYear != "Now") { CalendarDate.setYear(ShowYear); } if (ShowMonth != "Now") { CalendarDate.setMonth(ShowMonth); } DrawCalendar();. Date is one of the predefined ActionScript objects, so you don't have to design your own date-handling objects. When the new Date object, CalendarDate, is created here, it is set by default to the current time according to the system clock. Figure 4 Make sure that you have entered the Date object and initialized its properties correctly. Part of the Smart Clip customization that will be added later, however, is the ability to override the default behavior and actually specify what month and year the calendar will display. So, two if statements check to determine the value of the Smart Clip parameters ShowYear and ShowMonth. If they equal Now, nothing is changed; otherwise the values are used as arguments for the setYear and setMonth methods of CalendarDate (inherited from the Date object). The final line in this block invokes the function DrawCalendar(), which analyzes the current month and displays the correct information in each of the date fields in the grid. The DrawCalendar() function is added in step 7. Add this code to enable the calendar: // Send Date function function SendDate(Day) { DateSelected = new Date(CurrentYear, CalendarDate.getMonth(), Day); if (SendDateTo != "") { DateTarget = eval(SendDateTo); DateTarget(DateSelected); } } The calendar, invoked whenever the user clicks an individual date button, determines what date has been selected. That information is stored in a new Date object and is passed to a function specified in another of the Smart Clip parameters, SendDateTo. Even though SendDateTo is a variable, it can be used in conjunction with eval to point to a function. To insert the DrawCalendar() function, which is required to update the calendar and its grid of date fields, insert this code next: // Draw Calendar function function DrawCalendar() { CurrentMonth = Months[CalendarDate.getMonth()]; CurrentYear = CalendarDate.getFullYear(); CalendarText = CurrentMonth + " " + CurrentYear; This first block of statements (see Figure 5) acts to convert numerical date information into a more readable text string displayed at the top of the calendar in "Month Year" format. The CurrentMonth variable is obtained by accessing the element of the Months array corresponding to the currently displayed month. Calendar.getMonth() returns a number equal to the current month of the CalendarDate object. This function call is used to access the corresponding element of the Months array, which is Months[CalendarDate.getMonth()]. The result is the text name of the current month. CurrentYear is slightly easier to determine; you use the fairly straightforward getFullYear method of CalendarDate. Then CalendarText, the variable attached to the text field at the top of the calendar box, is set to the CurrentMonth text concatenated (or combined) with a space and CurrentYear. Figure 5 Make sure that the code for enabling the calendar and the DrawCalendar() function are entered correctly. Insert this code to determine the first day of the current month: CalendarDate.setDate(1); FirstDayNumber = CalendarDate.getDay(); if (FirstDayNumber == 0) { FirstDayNumber = 7; } TotalDays = GetDaysInMonth(CalendarDate.getMonth(), CurrentYear); This block of code (see Figure 6) is designed to figure out what day of the week the first day of the current month falls on. This is important for properly displaying the current month of dates because they all need to line up correctly with the matching Mondays, Tuesdays, and Wednesdays. Because the setDate() method of CalendarDate sets the current date to 1 (the first of the month), the getDay() method can then be used to get the corresponding number of the first day in the current month. This number determines whether the first day falls on a Monday, Tuesday, or whatever. (The total number of days in the current month, determined by a function that you add in a later step, makes sure that only the correct number of days is shown in each month.) Figure 6 Make sure that the code you inserted for determining the first day of the month is in the correct position. Insert this code to create a for loop (see Figure 7) that paves the way for the fresh date information by looping through all the date field movie clips and setting their _visible properties to false: for (Counter = 0; Counter <= 42; Counter ++) { eval("Field" + Counter)._visible = false; } This hides all the dates in the grid, and only the relevant ones will be reactivated in the next block of the code. The number 42 appears because that is the total number of fields in the grid. That's much more than 31, granted, but, depending on the day of the week that the first of the month falls on, all the dates following can be displaced farther down the grid and past the 31st field. Figure 7 Make sure that the for loop is inserted correctly. Insert the code for a second for loop that counts through the TotalDays in the currently selected month, sets their _visible properties to true, and then sets the value of the DateField text field in each date in the grid. The DateField values are set to Counter + 1, because Counter starts at 0 even though the first actual date number is 1. for (Counter = 0; Counter < TotalDays; Counter ++) { eval("Field" + (FirstDayNumber + Counter))._visible = true; eval("Field" + (FirstDayNumber + Counter) + ".DateField") = Counter + 1; } } Insert the code for the first of two supplementary functions that calculate the correct number of days in any given month, based on what you already know about month lengths and leap years. // Determine number of days in the month function GetDaysInMonth(Month, Year) { if (Month==0 || Month==2 || Month==4 || Month==6 || Month==7 || Month==9 || Month==11) { Days = 31; } else if (Month==3 || Month==5 || Month==8 || Month==10) { Days = 30; } else if (Month==1) { if (IsLeapYear(Year)) { Days = 29; } else { Days = 28; } } return (Days); } This function simply takes the Month and Year arguments passed to it and cycles through a series of if statements to determine the number of days in the month. The Year value is passed on to the next and final function, IsLeapYear(). The double pipe, ||, is another way of writing or, which allows for multiple arguments to be written into the same if statement. The if statement in this code block is the code equivalent of the old rhyme "30 days has September, April, June, and November. All the rest have 31, excepting February in a line, which in a leap year has 29." The return() action is used to send values back to whatever object called the function. In this case, it returns the number of days in the specified month. Insert the last block of code to complete Calendar Control (see Figure 8): // Check for leap years function IsLeapYear (Year) { if (((Year % 4)==0) && ((Year % 100)!=0) || ((Year % 400)==0)) { return (true); } else { return (false); } } This function uses a lesser-known operator called modulo. You can learn more about modulo in the ActionScript reference that came with your software. In a nutshell, it divides one value by another and returns the remainder. This is the same process taught to schoolchildren as a precursor to short division. If Year can be divided by 4 and 400 to have no remainder, but when divided by 100 it does have a remainder, it's considered to be a leap year. The return action is then used to pass a true or false value back to the GetDaysInMonth() function from whence it was called. The Calendar Control symbol is effectively complete, but before you drag an instance of it onto the Stage, it needs to be set up as a Smart Clip, and part of that process involves preparing the custom user interface. Figure 8 Make sure that the code that checks for leap years is inserted correctly.
http://www.peachpit.com/articles/article.aspx?p=26144
CC-MAIN-2019-35
refinedweb
1,919
59.13
Help:Link From Wikibooks, the open-content textbooks collection For some basics, see also Help:Editing#Links. [edit] Linking from a page [edit]. [edit] Miscellaneous [edit] Internal link style vs interwiki link style: pros and cons) [edit] Cases where using external link style for an internal or interwiki page can be. [edit] Redirects. [edit] "Hover Box" on hyperlinks. [edit]. [edit]. [edit] Linking to a page, a section, or an arbitrary position in a page A plus sign in the page name in the URL is equivalent with a space, e [edit] Linking within a page You can use [[#Anchors]] to easily anchor to a header on the same page. For example #Anchors and Linking from a page. [edit] Image links For linking from an image to an other content page and not to the imagepage, see Help:Navigational image. [edit]". [edit] Subpage feature. [edit] Repairing links when disambiguating pages an article about the solar system. [edit] Special effects of links - embedding an image - assigning a page to a category - interlanguage link feature In each case, to make an ordinary link, prefix a colon to the pagename. [edit] Additional effects of links -. [edit] More on linking While the detailed syntax is the same for Wikibooks and Wikipedia (because they both use the same MediaWiki software), the way we use them is very different in the 2 projects. (See Wikibooks:Comparison of other Wiki projects for other differences). In Wikibooks, we're building educational textbooks. A link in one Wikibook module to a Wikipedia article (or even to another Wikibook) is usually segregated to a "References" or "For further reading" at the end of the module, lumped in with references to books and magazine articles. In that section of a wikibook, perhaps the best format for most links is [[Wikipedia:George Washington]] which renders as Wikipedia:George Washington. Sometimes one Wikipedia article is about the same topic as an entire Wikibook module (or even an entire wikibook). In that case, it's convenient to cross-link them with {{Wikibookspar||PIC}}(in the Wikipedia article) {{Wikipediapar||PIC microcontroller}}(in the Wikibook module, or in the "introduction" of the Wikibook) [edit] What is the best way to link into Wikibooks from another site? - To link to the front page, the prefered URL is. also works but redirects to .org when used. - If you want to link to a specific Wikibooks page, simply copy its URL. We do not have any policies against direct-linking to our content. [edit] What is the best way to link from Wikibooks to another wiki, such as Wikipedia? Much like an interlink is the page name with [[ ]] around it, other wikis have attributes attached. For example to link to Wikipedia's main page enter [[w:Main Page]] which generates w:Main Page. If you want to cut the w: off enter [[w:Main Page|]], which this time generates Main Page. [edit] Linking to Wikipedia How do you link from a Wikibook to a Wikipedia article? [[w:en:apple|apples]], [[w:en:apple|apple]]s or [[w:en:apple|]]s. - To get to articles on other projects, use the following prefix: w: wikipedia wikt: wiktionary q: wikiquote b: wikibooks m: meta-wiki n: wikinews If you are aiming to create a printable book, or a book that can be distributed as a single PDF file etc., then the Wikipedia text will need to be imported into the Wikibook and full credit given to Wikipedia at the start of the text. [edit] Interwiki linking. [edit] Interlanguage link (software feature) [edit] Wikicities. [edit] Empty pipe trick A link that has no text after the pipe ("|") is treated as a special case as follows: - Any project or language prefixes is removed - Any namespace prefixes are removed, and - Any text in parentheses is removed Whatever remains is what is rendered as the link text. For example, [[w:en:Pipe (computing)|]] is the same as [[w:en:Pipe (computing)|Pipe]], [[Help:Template|]] is the same as [[Help:Template|Template]], and [[a|]] is the same as [[a|a]]. In preview, just like for the three or four tildes when signing on Talk pages and the use of subst, the result shows up in the preview itself, but the conversion in the edit box is not yet shown. Save and press Edit again to see the result of the conversion.
http://en.wikibooks.org/wiki/Help:Link
crawl-002
refinedweb
723
61.16
Ricardo, Time has come for questioning you on the XSP engine implementation. The question mainly deals with the namespace preservation mechanism performed at the transformation stage. Indeed in the original XSP engine (understand the DOM based XSP engine), we keep all declared namespace declared in all XSL stylesheet (e.g. request.xsl, response.xsl and xsp.xsl) inside a collection object. Then when the XSP page go throught the different tranformation stages, at each transformation step we have to keep somehow the original namespace declared in the source DOM document before the transformation, then we perform the transformation itself and finally we restore back to the result DOM document the original namespace and all the stylesheet namespaces. The comment you added to javadoc to explain this was that the Stylesheet transformation would drop the namespace declarations. So was it because of the Xalan version you were working with at the time of coding, or is it still true with the lastest version of Xalan2 ? Do you have any test case that you used to rely on when you developed the XSP engine ? If so, is there one that hightlight the namespace dropping ? Thanks Ricardo for any comment you would provide, Sebastien -----Original Message----- From: Sebastien Sahuc [mailto:ssahuc@imediation.com] Sent: Friday, October 13, 2000 4:54 PM To: cocoon-dev@xml.apache.org Subject: RE: [C2] Moving to Xalan2. Davanum Srinivas wrote : > Sent: Thursday, October 12, 2000 6:05 PM > To: Sebastien Sahuc; Giacomo Pati > Cc: Stefano Mazzocchi; Scott Boag/CAM/Lotus; STimm@mailgo.com > Subject: RE: [C2] Moving to Xalan2. > > > Sebastien, > > We don't really need to copy the namespaces in > LogicSheet.java. See enclosed LogicSheet.java which > works for me. Thanks dims for having a look at it and correcting what should be corrected. My objective at first was to blindly transpose the DOM XSP engine into a SAX driven engine so we don't lose ANY functionality required by the XSP spec. Therefore there might be some tricky part in the code -and the one dealing with namespace preserving falls into this category- and I would love to hear Ricardo's comments and suggestions on these points since he is the XSP's implementator and must have had some reasons to have implemented the engine the way he did. This brings into light a more general issue that, IMHO, should be solved as we're moving forward with Cocoon2. Indeed I don't know how you guy are coding, but concerning me, I'm totally addicted to test cases when it comes to writing code. Unfortunately we -at cocoon2- don't have a test suite against which to test our code. And it's not because simple.xsp works that means that the XSP engine works for any XSP pages. Therefore I believe we need a test case framework and a test suite that would allow us to : * Make sure a build pass all the test suite * develop faster and easier * Make regression test * Build some performance suite I'm going to comment all the points one by one. * A build must pass the test suite : every time you download a CVS snapshot, you launch the full build script that compiles, jar the project and finally calls a ant's task that run the test suite against the previously built project. Any error and failing would be reported. In case the test suite successfully passed, then you know the jar is at least usable. * Develop faster and easier : I will transcript my -short- experience with the XSP engine refactoring. If some test cases -say a couple of simple XSP pages- that make use of every aspect of the XSP engine were available I would have trusted the test suite to build the refactored engine. An example of a test case could be a 'logicsheet_in_pi.xsp' page which purpose is to test if the XSP engine correctly takes into account logicsheets declared in Processing instruction nodes. So instead of that, I had to look at -every- piece of code ( fortunately it was a pleasure to read Ricardo's code) and understand for what purpose they were written for. That why I ended up by writing some XMLFilter that preserve namespace -as the DOM version did-. This is the part Dims proposed to remove in his patch. So although I don't really know if this part of code is necessary, I'm also sure that Ricardo have not done that for his simple pleasure, so there might be so rational reason we don't know yet... So test cases will allow us to trust any change and addition we do in the code as long as they successfully pass the test suite. No more 'hope it will work with other XSP pages', or 'Damn, can't change it as I do not know what impact it would have on other parts'. *make regression test : Every time a bug is submitted, we should write a simple testcase that show the bug, and then correct the bug in the main code until the test is passed. Then if we run the test suite with an older version of the project, automatically it will fail, highlighting the bug. Moreover that would let people write simple testcase for bug they find, and give us more reactivity to correct them. * Build some performance suite : A test case can easily become a bench program that will stress your code in multithreaded context and simulate dozens and dozens of user requests to check how your server side application would behave when deployed in production. I believe that a framework like cocoon has different distinct layers, and that each layer should be stressed independently for performance tuning. Indeed running a servlet engine + cocoon and JMeter would not be enough IMHO. At least this is how I made the simple bench report I sent in previous post (see forwarded section below), and also this is how I detected a memory leak before I sent the final patch to the list. Without this I would not have seen the problem and would have been ashamed of such a mistake :-) Finally let's come back to real reason of this post. Should we patch the correction Dims is proposing ? Well I don't really know as we don't know the reason Ricardo had in mind when he did the code for preserving namespace between transformations. Anyone else has an opinion on this ? All the best, Sebastien > > Thanks, > dims > > --- Sebastien Sahuc <ssahuc@imediation.com> wrote: > > OK, > > > > attached you'll find the full patch for : > > * Xalan2 integration on cocoon2 (patch from Davanum, which > also corrects > > some sitemap issues) > > * SAX based XSP engine (from myself) > > > > Steps to follow : > > * get a fresh CVS snapshot of Cocoon2 > > * integrate the attached patch > > * get the lastest version of XalanJ2 from CVS, build it and > copy the jar to > > lib > > * delete the xalan_1_2_D01.jar from the lib > > * build cocoon2, drag and drop the war to your favorite Tomcat 4 > > * and run :-) > > > > It should be working fine. You won't see any difference in > term of page > > content, but you might notice some performance gain at the > XSP compilation > > stage, and at the sitemap generation (though still way too long). > > > > I reran my performance tests but I couldn't get the Xalan2J > working with DOM > > (cannont use the same transformer instance more than once), > so I made the > > test against the current implementation : XalanJ1 + DOM. > > > > Here are the results : > > > > > --------------------------------------------------------------------- > > ms/loop | very_simple.xsp | simple.xsp | > > > --------------------------------------------------------------------- > > DOM/XalanJ1 | 120 ms/loop | 250 ms/loop | 12000 > ms/loop | > > > --------------------------------------------------------------------- > > SAX/XalanJ2 | 80 ms/loop | 350 ms/loop | 3000 > ms/loop | > > > --------------------------------------------------------------------- > > > > What can we say from the report ? > > * As source documents are getting more and more verbose, > SAX will definitely > > be of big help over DOM. For the sitemap example, we fall > from 12s to 3s > > /loop ! > > > > * for very small source document, the difference isn't that > high. But SAX > > still behaves faster. > > > > * For simple.xsp, Xalan1/DOM generates a 3kb java file, whereas the > > SAX/Xalanj2 ends up with a 19Kb file. Indeed in the former > case, namespace > > informations are simply 'forgotten', whereas on the later I > found the > > generated source code way too verbose (a lot of > startPrefixMapping() is > > generated... ). Who is right ? I don't really know. Need > your eyes on this > > point. > > > > > > Well,so basically I'm quite happy of the result, even > though the code is a > > little more complex (not any more sequential programming, but rather > > incremental, which brings more complexity by nature... at > least it's more > > complex to debug :-( ) > > > > I still need to write/update Ricardo's documentation. I > hope that Ricardo is > > coming back soon, as I have lot of questions for him (and > also would like to > > congratulate him for his marvelous job and nice coding.) > > > > Well that's all, > > > > Sebastien > > > > > > > > > > > > > -----Original Message----- > > > From: Davanum Srinivas [mailto:dims@yahoo.com] > > > Sent: Wednesday, October 11, 2000 9:23 PM > > > To: dims@yahoo.com; Giacomo Pati; Sebastien Sahuc > > > Cc: dims@yahoo.com; Stefano Mazzocchi; Scott Boag/CAM/Lotus; > > > STimm@mailgo.com > > > Subject: Re: [C2] Moving to Xalan2. > > > > > > > > > Sebastien, > > > > > > Have not heard from you yet. Hope the integration is going on > > > smoothly. Please let us know. > > > > > > Thanks, > > > dims > > > > > > --- Davanum Srinivas <dims@yahoo.com> wrote: > > > > Sebastien, > > > > > > > > The enclosed Zip file has c2x2diff.txt which has the cvs > > > diff's for each of the files. It also > > > > has > > > > the modified files in case you need them. > > > > > > > > #1: Had problems with ComponentHolderFactory. Enclosed is a > > > patch for this. This might or might > > > > not be needed by tomorrow. > > > > > > > > #2: XPathAPI.java changes are not really needed if you can > > > exclude it from the build. Fixed > > > > XIncludeTransformer to point to the XPathAPI in Xalan2. > > > > > > > > If you don't hear from me, please go ahead with this > > > version. (But you probably will though :-) > > > > > > > > Thanks, > > > > dims > > > > > > > > --- Giacomo Pati <Giacomo.Pati@pwr.ch> wrote: > > > > > Sebastien Sahuc wrote: > > > > > > > > > > > > > -----Original Message----- > > > > > > > From: Giacomo Pati [mailto:pati_giacomo@yahoo.com] > > > > > > > Sent: Tuesday, October 10, 2000 9:15 PM > > > > > > > To: Sebastien Sahuc; dims@yahoo.com; Stefano > Mazzocchi; Scott > > > > > > > Boag/CAM/Lotus > > > > > > > Cc: pati_giacomo@yahoo.com; ssahuc@imediation.com; > > > STimm@mailgo.com > > > > > > > Subject: RE: [C2] Moving to Xalan2. > > > > > > > > > > > > > > > > > > > > > Hi all > > > > > > > > > > > > > > So here is my suggestion how to proceed: > > > > > > > > > > > > > > Sebastien, can you apply the patch from Davanum > to your tree > > > > > > > and get it > > > > > > > working with the latest CVS and send me a zipped > patch (cvs > > > > > > > -u diff) of > > > > > > > your tree. > > > > > > > > > > > > I can do it, but not before tomorrow night (European > > > time). Is that OK ? > > > > > > > > > > Yes, sure. In the meantime I'll fix the CVS. There seems > > > to bee some > > > > > problems with the sitemap. > > > > > > > > > >: > > > > > > ===== > > Davanum Srinivas, JNI-FAQ Manager > > > > > > __________________________________________________ > > Do You Yahoo!? > > Get Yahoo! Mail - Free email you can access from anywhere! > > > > > ATTACHMENT part 2 application/x-zip-compressed name=c2x2.zip > > > > ===== > Davanum Srinivas, JNI-FAQ Manager > > > __________________________________________________ > Do You Yahoo!? > Get Yahoo! Mail - Free email you can access from anywhere! > > > > ATTACHMENT part 2 application/octet-stream name=diffs_saxxsp.zip ===== Davanum Srinivas, JNI-FAQ Manager __________________________________________________ Do You Yahoo!? Get Yahoo! Mail - Free email you can access from anywhere!
http://mail-archives.apache.org/mod_mbox/cocoon-dev/200010.mbox/%3C9B3E950CB293D411ADF4009027B0A4D2178F94@maileu.imediation.com%3E
CC-MAIN-2015-14
refinedweb
1,841
71.85
I have to try and make a program that when a user enters a digit it will say "A #(spelled out) has been entered, and it is (even/odd)." and that that sentence is repeated that number of times. for example A three was entered, and it is odd A three was enetered, and it is odd A three was enetered, and it is odd but i have to build it around the following code without editing it. " package Lab; import java.util.Scanner; public class Lab { public static void main(String[] args) { Box box = new Box(1,10); String strUserInst; Scanner scan = new Scanner( System.in ); do { strUserInst = "Enter the number of repetitions (between " + box.getHigh() + " and " + box.getLow() + " ): "; System.out.print( strUserInst ); } while( box.setRep( scan.nextInt() ) ); System.out.println( box ); } } " The problem is I cant quite understand what is happening in the given code or how to work off of it. Any ideas on what the given code is doing and how I might go about working around it?
http://forums.devshed.com/java-help-9/programming-difficulties-945781.html
CC-MAIN-2016-07
refinedweb
172
72.46
The WebIDL bindings are generated at build time based on two things: the actual WebIDL file and a configuration file that lists some metadata about how the WebIDL should be reflected into Gecko-internal code. All WebIDL files should be placed in dom/webidl and added to the list in the WebIDL.mk file in that directory. The configuration file, dom/bindings/Bindings.conf, is basically a Python dict that maps interface names to information about the interface, called a descriptor. There are all sorts of possible options here that handle various edge cases, but most descriptors can be very simple. All the generated code is placed in the mozilla::dom namespace. For each interface, a namespace whose name is the name of the interface with Binding appended is created, and all the things pertaining to that interface's binding go in that namespace. There are various helper objects and utility methods in dom/bindings that are also all in the mozilla::dom namespace and whose headers are all exported into mozilla/dom. value of GetParentObjectmust either singly-inherit from nsISupportsor have a corresponding ToSupports()method that can produce an nsISupportsfrom it.) A WebIDL operation is turned into a method call on the underlying C++ object. The return type and argument types are determined as described below. In addition to those, all fallible (allowed to throw) methods will get an ErrorResult& argument appended to their argument list. Methods that use certain WebIDL types like any or object will get a JSContext* argument prepended to the argument list. The name of the C++ method is simply the name of the WebIDL operation with the first letter converted to uppercase. WebIDL overloads are turned into C++ overloads: they simply call C++ methods with the same name and different signatures. For example, this webidl: interface MyInterface { void doSomething(long number); double doSomething(MyInterface? otherInstance); looks just like an operation with no arguments and the attribute's type as the return type. The setter's name is Set followed by the name of the attribute with the first letter converted to uppercase. The method signature looks just like an operation with a void return value and a single argument whose type* aGlobal, uint32_t aSomeNumber, ErrorResult& rv); }; C++ reflections of WebIDL types The exact C++ representation for WebIDL types can depend on the precise way that they're being used: e.g. return values, arguments, and sequence or dictionary members might all have different representations. Unless stated otherwise, a type only has one representation. Also, unless stated otherwise, nullable types are represented by wrapping Nullable<>); Floating point types Floating point WebIDL types are mapped to the C++ type of the same name. So float and unrestricted float become a C++ float, while double and unrestricted double become a C++ double. For example, this WebIDL: interface Test { float myAttr; double myMethod(unrestricted double? arg); }; will correspond to these C++ function declarations: float There are four kinds of interface types in the WebIDL bindings. Callback interfaces are used to represent script objects that browser code can call into. External interfaces are used to represent objects that have not been converted to the WebIDL bindings yet. WebIDL interfaces are used to represent WebIDL binding objects. "SpiderMonkey" interfaces are used to represent objects that are implemented natively by the JavaScript engine (e.g. typed arrays). Callback interfaces External interfaces are represented in C++ as objects that XPConnect knows how to unwrap to. This can mean XPCOM interfaces (whether declared in XPIDL or not) or it can mean some type that there's a castable native unwrapping function for. The C++ type to be used should be the nativeType listed for the external interface in the Bindings.conf); "SpiderMonkey" interfaces Typed array, array buffer, and array buffer view arguments are represented by the objects in TypedArray.h. For example, this WebIDL: interface Test { void passTypedArrayBuffer(ArrayBuffer arg); void passTypedArray(ArrayBufferView arg); void passInt16Array(Int16Array arg); } will correspond to these C++ function declarations: void PassTypedArrayBuffer>, where T depends on the type of elements in the WebIDL sequence. Sequence return values are represented by an nsTArray<T> out param appended to the argument list, where T is the return type for the elements of the WebIDL sequence. This comes after all IDL arguments, but before the ErrorResult&, if any, for the method. Arrays IDL array objects are not supported yet.]. Helper objects The C++ side of the bindings uses a number of helper objects. Nullable<T> Nullable<> is a struct declared in Nullable.h and exported to mozilla/dom/Nullable.h that is used to represent nullable values of types that don't have a natural way to represent null. Nullable<T> has an IsNull() getter that returns whether null is represented and a Value() getter that returns a const T& and can be used to get the value when it's not null. Nullable<T> has a SetNull() setter that sets it as representing null and two setters that can be used to set it to a value: "void SetValue(T)" (for setting it to a given value) and "T& SetValue()" for directly modifying the underlying T&. Optional<T> Optional<> is a struct declared in BindingUtils.h and exported to mozilla/dom/BindingUtils.h that is used to represent optional arguments and dictionary members, but only those that have no default value. Optional<T> has a WasPassed() getter that returns true if a value is available. In that case, the Value() getter can be used to get a const T& for the value. NonNull<T> that used to represent sequence arguments. It's some kind of typed array, but which exact kind is opaque to consumers. This allows the binding code to change the exact definition (e.g. to use auto arrays of different sizes and so forth) without having to update all the callees. Bindings.conf details XXXbz write me. In particular, need to describe at least use of concrete, prefable, and addExternalInterface
https://developer.mozilla.org/en-US/docs/Mozilla/WebIDL_bindings$revision/294202
CC-MAIN-2015-32
refinedweb
993
54.02
Figure depicts the relationship between a halfedge and its incident halfedges, vertices, and facets. A halfedge is an oriented edge between two vertices. It is always paired with a halfedge pointing in the opposite direction. The opposite() member function returns this halfedge of opposite orientation. If a halfedge is incident to a facet the next() member function points to the successor halfedge around this facet. For border edges the next() member function points to the successor halfedge along the hole. For more than two border edges at a vertex, the next halfedge along a hole is not uniquely defined, but a consistent assignment of the next halfedge will be maintained in the data structure. An invariant is that successive assignments of the form h = h->next() cycle counterclockwise around the facet (or hole) and traverse all halfedges incident to this facet (or hole). A similar invariant is that successive assignments of the form h = h->next()->opposite() cycle clockwise around the vertex and traverse all halfedges incident to this vertex. Two circulators are provided for these circular orders. The incidences encoded in opposite() and next() are available for each instantiation of polyhedral surfaces. The other incidences are optionally available as indicated with type tags. The prev() member function points to the preceding halfedge around the same facet. It is always available, though it might perform a search around the facet using the next() member function to find the previous halfedge if the underlying halfedge data structure does not provide an efficient prev() member function for halfedges. Handles to the incident vertex and facet are optionally stored. The circulators are assignable to the Halfedge_handle. The circulators are bidirectional if the halfedge provided to the polyhedron with the Items template argument provides a member function prev(), otherwise they are of the forward category. #include <CGAL/Polyhedron_3.h> CGAL::Polyhedron_3<Traits>::Vertex CGAL::Polyhedron_3<Traits>::Facet CGAL::Polyhedron_3<Traits> The member functions prev() and prev_on_vertex() work in constant time if Supports_halfedge_prev CGAL::Tag_true. Otherwise both methods search for the previous halfedge around the incident facet.
http://www.cgal.org/Manual/3.2/doc_html/cgal_manual/Polyhedron_ref/Class_Polyhedron_3-Traits---Halfedge.html
crawl-001
refinedweb
342
53.92
Python package extractoin value from string Project description s2v-extractor #you get "abc234d4" from this 2344 as number #memory and age are column of datafrme which has values like 16GB and you want 16 as number it will return dataframe withconverted values import pandas as pd from test import s2v df=pd.read_csv('test_data.csv') obj=s2v(df,["Memory","Age"]) print(obj.extract()) Project details Release history Release notifications | RSS feed Download files Download the file for your platform. If you're not sure which to choose, learn more about installing packages. Source Distribution s2v_extractor-0.0.1.tar.gz (1.3 kB view hashes)
https://pypi.org/project/s2v-extractor/
CC-MAIN-2022-33
refinedweb
105
56.76
Every ByteScout tool contains example C# source codes that you can find here or in the folder with installed ByteScout product. ByteScout Spreadsheet SDK is the SDK that can write and read, modify and calculate Excel and CSV spreadsheets. Most popular formulas are supported. You may import or export data to and from CSV, XML, JSON as well as to and from databases, arrays. It can export to jagged array in C#. This rich sample source code in C# for ByteScout Spreadsheet SDK includes the number of functions and options you should do calling the API to export to jagged array. In order to implement the functionality, you should copy and paste this code for C# below into your code editor with your app, compile and run your application. Use of ByteScout Spreadsheet SDK in C# is also explained in the documentation included along with the product. ByteScout Spreadsheet SDK free trial version is available on our website. C# and other programming languages are supported. On-demand (REST Web API) version: Web API (on-demand version) On-premise offline SDK for Windows: 60 Day Free Trial (on-premise) using System; namespace Bytescout.Spreadsheet.Demo.Csharp.ExportToJaggedArray { class Program { static void Main(string[] args) { const string inputFile = @"StockPricesSpreadsheet.xls"; // Open and load spreadsheet Spreadsheet spreadsheet = new Spreadsheet(); spreadsheet.LoadFromFile(inputFile); // Get the data from the spreadsheet string[][] stockPrices = spreadsheet.ExportToJaggedArray(); // Close spreadsheet spreadsheet.Close(); // Display data in jagged array for (int i = 0; i < stockPrices.GetLength(0); i++) { Console.Write(stockPrices[i][0] + " "); Console.Write(stockPrices[i][1] + " "); Console.WriteLine(); } // Pause Console.ReadLine(); } } })
https://bytescout.com/articles/spreadsheet-sdk-c-export-to-jagged-array
CC-MAIN-2022-27
refinedweb
262
58.18
Warpspire 2018-05-18T22:56:08+00:00 Kyle Neath kneath+warpspire@gmail.com This is an XML content feed. It is intended to be viewed in a newsreader or syndicated to another site, subject to copyright and fair use. Your community is what you make it 2017-10-20T00:00:00+00:00 <p.</p> <p.</p> <p>Can you imagine having an <em>acre</em> of land for cheaper than a week’s rent in San Francisco?</p> <hr /> <p.</p> <p.</p> <p.</p> <p <em>subjective</em> line — in order to preserve our morality, integrity, and way of life.</p> <p.</p> <p>Twitter believes that somehow allowing everything means they’ve created an environment that’s friendly for everyone. But often times it’s important for a community <em>not</em> to have a person in it. Imagine a party with ten of your best friends. Now imagine a party with ten of your best friends and one nazi.</p> <p.</p> <p <em>can</em>.</p> <p>And maybe that decision will come back to bite them. But for science’s sake — can that potential consequence really be worse than having nazis in your house?</p> <img src="" height="1" width="1" alt=""/> Next 2017-03-24T00:00:00+00:00 <p><em>So, what is it you do all day?</em></p> <p>I sort of disappeared a few years ago. I had a simple but difficult decision: stay and help <a href="">GitHub</a> to help grow the company or leave and help my family when they needed help most. In the space of a couple of weeks I quit my job, packed up my belongings, and moved out of San Francisco.</p> <p>Ever since then, I’ve struggled to describe how it is I spend my time to my peers. Discussing the practicalities of caring for someone with a neurological disorder is not exactly small-talk worthy, nor is it something I particularly <em>want</em> to discuss with strangers. There’s also the unfortunate culture in technology that devalues everything unrelated to militant capitalism. <em>If you’re not trying to make money, what are you even doing?</em> Now add on to that the few that saw my vulnerability as an opportunity for leverage — and indeed — leveraged the fuck out of me. It’s all added up to be an interesting couple of years.</p> <p>So when people ask what it is I’m doing, I’ve mostly kept it light. I tell people I’m semi-retired. It’s not entirely untruthful — I’ve spent a <em>lot</em> more time outside and doing fun things — but it’s a lot less than the whole.</p> <div class="figure"> <img src="" /> </div> <p>That being said, I’ve been working hard for the past few months to find more space for me again. Which also means I’ve been thinking more about what’s next.</p> <hr /> <p>A lot of people talk about passion with regards to work — that feeling of endless energy one feels when their inner desires meet application. Work no longer feels like work, and all questions of <em>is this worth it?</em> and <em>am I doing the right thing?</em> feel silly and irrelevant. I used to have a lot of passion for software. Whatever I have now is different.</p> <p>I feel torn between the endless opportunities I see in software and the disgust for what our industry has become. The rational part of my brain tells me <em>you don’t have to be like those terrible people to work in software,</em>?</p> <p>I’ve spent a lot of time asking myself why I am so frustrated with our industry, and I think I’ve narrowed it down to two common themes:</p> <ul> <li> <p>The routine manipulation of employees, gig or otherwise, through complicated legal structures (1099’d full-time employees, stock option agreements, expensive lawyers, employment/termination agreements, etc).</p> </li> <li> <p>The routine manipulation of customers through complicated technical structures (selling data without permission, outright spying, bricking expensive hardware to avoid liability, etc).</p> </li> </ul> <p>To work or participate in the technology industry is an exercise in minimizing manipulation (or, if you’d like to be rich, maximizing it). This feels shitty in a tremendously heavy way.</p> <p <em>always</em> seem to outweigh the needs of people? Honestly, it’s all driven me a bit crazy. But more relevant to this essay: this shitty-ness has eroded my enthusiasm for building software.</p> <p>That’s a bummer.</p> <hr /> <p>Something I <em>have</em> been very enthused about as of late is permaculture, or at least many of the ideas that circle around that particular label.</p> <p?</p> <p?</p> <p>The engineer in me can’t stop thinking <em>there’s got to be a better way</em>.</p> <p.</p> <p <em>bad</em> decisions right now. I see permaculture as a framework to make better decisions through design, but for the environment.</p> <p.</p> <div class="figure"> <img src="" /> <small>David and Alia enjoying springtime in Leaping Daisy's meadow.</small> </div> <p>It’s called <a href="">Leaping Daisy</a>. It’ll be a while.</p> <hr /> <p.</p> <p>For a long time, I was mostly interested in software that made money. Finding the sweet spot between customers, willingness to pay, and profitability is <em>fun</em>. But Venture Capital and their fleet of lawyers have become experts at warping and extorting these kinds of products. They’ve taken the fun out of making money. As such, lately my interests have been more ideological than profitable.</p> <p:</p> <ul> <li> <p><strong>Data Ownership, Privacy, and Cloud-less Software</strong><br /> It feels as though we’ve embraced the cloud a little <em>too</em> much the past decade or so. While there’s tremendous benefits to centralized online services, there are also a great deal of downsides. Customers rarely own their data, companies routinely cooperate with state-run surveillance programs, and privacy & security continues to be a nightmare.</p> <p.</p> </li> <li> <p><strong>Civic Engagement</strong><br />.</p> <p.</p> </li> <li> <p><strong>Tools for People</strong><br />.</p> <p.</p> </li> </ul> <p>If you’ve got some interesting projects you think I should check out, let me know (<a href="mailto:kyle@warpspire.com">kyle@warpspire.com</a> is probably best). Note: if you’re funded for purposes other than defrauding VC firms, think phone calls are fantastic, or think that the words <em>stock</em> or <em>options</em> are enticing, I am probably not your target audience right now.</p> <hr /> <p>Oh, and hi everyone! It’s been a while. I’ve missed publishing, and I hope I can find time for more of it again.</p> <img src="" height="1" width="1" alt=""/> Ad Supported 2015-09-17T00:00:00+00:00 <p.</p> <p.</p> <p>But there’s a twist in this story. It’s ad-supported publishers that created the market for the ad-blockers which are spelling their doom. It’s kind of poetic if you think about it.</p> <h2 id="loglo">Loglo</h2> <p>I remember the first time I read <em>Snow Crash</em> and came upon the idea of loglo:</p> <blockquote> <p.</p> </blockquote> <p.</p> <p.</p> <p>Loglo lights the streets of <em>Snow Crash</em>. Content floats upon an ad-sea online.</p> <h2 id="annoying">Annoying</h2> <p.</p> .</p> <p…).</p> <p>Publishers play their part too. They constantly seek new ways to inject advertising in & around their content — whether it be turning the <a href="">entire background</a> into an ad, or disguising advertisements as journalism via <a href="">native advertising</a>. When users stop paying attention to the low-quality ads, publishers blame the users for “forcing” them to implement more invasive ads. Publishers have complete control over these decisions, and they have decided again and again to turn their environment into a user-hostile one.</p> <h2 id="false-dichotomy">FALSE DICHOTOMY</h2> <p.</p> <p>Life finds a way.</p> <p.</p> <p>Publishers forced this hand. Ad-blockers would not be popular today had ads not gotten so bad. Users are so frustrated they will do <em>anything</em> to get rid of them. That is not how your customers should feel about your primary revenue stream.</p> <h2 id="the-customer-is-always-right">The customer is always right</h2> <p.</p> <p>And this is kind of the thing: customers always win. Businesses serve at the pleasure of their customers. It is easy to fall into the idea that <em>customers need you</em> as a business owner, but history has proven otherwise. <em>You need your customers</em>, and if you don’t respect that dynamic, you will lose them.</p> <p>Publishers that listen to their customers will continue to thrive.</p> <h2 id="this-sucks-for-publishers">This sucks for publishers</h2> <p.</p> <p>But times change. Sometimes your business model becomes invalid as the world changes. This is the nature of <em>The Innovator’s Dilemma</em> —).</p> <p>I sympathize with publishers, but I do not feel bad for them. Publishers accelerated the death of their business model by repeatedly refusing to listen to their customers. They will die, and they will have deserved it.</p> ?</p> <img src="" height="1" width="1" alt=""/> Lost in Your Vision 2015-09-09T00:00:00+00:00 <p>Dustin Curtis recently wrote about <a href="">Fixing Twitter</a> — most of which I can’t say I agree with — but he did touch on an idea I like to call being <em>Lost in your Vision</em>. This affliction affects employees and non-employees alike, and boils down to two major symptoms:</p> <ul> <li>The belief that good performing products are nearing certain death</li> <li>The belief that companies are emotionless machines directed by a singular Visionary</li> </ul> <p>I call this <em>Lost in your Vision</em>.</p> <p>I know this feeling. I was this person, and let’s be honest — I still am this person often. It’s an easy mindset to fall into.</p> <blockquote> <p>I think Twitter badly needs to do at least five things to address imminent existential threats–things which its current team has tried and spectacularly failed to accomplish.<br /> — <a href="">Dustin Curtis</a></p> </blockquote> <p>Unfortunately, this is tunnel vision and serves only to blind you from seeing the most lucrative territory: small gradual improvements to existing features and cranking out good-enough ideas. Also known as boring work.</p> <h2 id="microsoft-vs-apple">Microsoft vs. Apple</h2> <p>Microsoft is an example of a company that’s been focused on Big Ideas for the past decade or so. They look at existing markets and try to jump ahead as far as they can see. The <a href="">Microsoft Surface</a> was a peek into the future of tablets, much like the <a href="">HoloLens</a> is a peek into the future of VR. Microsoft is not doing well.</p> <p:</p> <ul> <li>iPhone 6S. It’s like the iPhone 6, but everything is a little better.</li> <li>iPad Pro. It’s like the iPad, but everything is a little better.</li> <li>Apple TV. It’s like the old Apple TV, but everything is a little better.</li> </ul> <p>These aren’t revolutionary ideas. The iPad Pro is almost exactly the same idea as the Microsoft Surface, but 3 years late. I don’t think they’re worried about it. Apple is doing extremely well.</p> <p><strong>Big companies thrive on small ideas.</strong></p> <h2 id="the-soul-of-a-product">The soul of a product</h2> <p>I once gave a presentation at GitHub titled <em>Good Product</em> in which I tried to distill what a good product meant. My intro was focused on the idea that Product as an idea was a connection: <strong>People ⨯ GitHub.com</strong>. The product of the two was our Product (get it, the product?). It wasn’t just the software we delivered, it was how our customers used the software that mattered.</p> <p>In order to deliver impact, you can increase the number of customers, or you can increase the usefulness of the software to existing customers.</p> <p.</p> <p.</p> <p><strong>Big companies thrive on small ideas.</strong></p> <h2 id="software-is-made-by-people">Software is made by people</h2> <p>Twitter has over 4,000 employees. That’s a lot of people no matter how you slice it. The flow of ideas through large companies is a phenomenon we don’t entirely understand. If you haven’t ever been <em>in the shit</em>, you might assume that ideas flow from the Visionary (CEO) down. But much like rivers, they twist, turn, get added to, diverted, and dammed up along the way to their outlet. The more people, the harder it is to maintain the original direction.</p> <p>Software is made by people, and people have opinions and emotions.</p> <p.</p> <p>This is really important. The number of employees you have makes a huge impact on the types of ideas you can tackle.</p> <p><strong>Big companies thrive on small ideas.</strong></p> <hr /> <p>I don’t mean to be too harsh on Dustin, because hidden inside his article are some really good small ideas.</p> <blockquote> <p.</p> </blockquote> <p>If I were to impart one piece of advice on Twitter’s product team, I’d focus on this singular aspect: <strong>make it obvious what your tweet will look like before you post it.</strong> In other words, focus all of your effort on the compose tweet flow. Twitter is made of tweets. Give your customers the opportunity to post better tweets, and Twitter will get better.</p> <p>And I think they’re on their way there. The new retweet flow is phenomenal. It’s a perfect example of those small improvements. Retweets used to create anxiety — what does it <em>do</em> if I click this? The new flow solves that problem entirely <em>and</em> adds a native way to add comments to a Retweet — something people were already doing.</p> <p>I think the most successful version of Twitter will look very similar to the Twitter we have today, but every interaction will be smooth, obvious, and pleasant to use. It won’t be a big idea that fuels Twitter’s growth. It’ll be the small ones.</p> <img src="" height="1" width="1" alt=""/> Million Dollar Products 2015-08-26T00:00:00+00:00 <p>The.</p> <p>As for myself, it felt like I had accidentally accrued the skills to turn dirt into gold. The blogs I followed trended toward product launches, and it felt like everyone around me was succeeding. The formula for success seemed simple:</p> <ol> <li>Pick a task that people already use software for (communicate, organize, write, etc).</li> <li>Build a better piece of software to accomplish the task.</li> <li>Iterate on it with customer feedback.</li> <li>Build up enough revenue to quit your job and work on it full time.</li> </ol> <p>I can’t help but feel our industry doesn’t think this way anymore. It feels like the hobby programmers of today are only interested in building <em>Unicorns</em> — a really stupid name for companies valued at a billion dollars or more. People don’t start hacking on projects anymore, they become CEOs and start looking for funding. <em>If it doesn’t capture the entire market, what’s the point of showing up?</em></p> .</p> <p>Working in software isn’t as exciting as it used to be. Reasons to be excited are drowned out by assholes announcing how busy they’ve been fucking people over to make themselves rich. <strong>It’s embarrassing.</strong></p> <p>I don’t think Unicorns are good for our industry.</p> <hr /> <p>I’ve grown to love the concept of a <em>family business</em> over the past few years. Operationally speaking, they’re the same as any other business. But philosophically, they’ve made decisions about how to run the business such that it benefits & reflects the values of the family running it. I like these businesses because they tend to treat their customers much better than traditional growth-focused businesses.</p> <p>We don’t really have a concept of family owned software businesses yet, but I do think we can try to emulate the best parts of them. What would that look like?</p> <h2 id="treat-people-well--make-money--build-rad-shit">Treat People Well + Make Money + Build Rad Shit</h2> <p <strong>one million dollars a year?</strong> Instead of worrying about opportunity costs at every turn – taking funding, hiring that sketchy VP of Sales, partnering with that company you hate — you can focus your effort elsewhere: employees, customers, and product.</p> <h2 id="employees">Employees</h2> <p>You don’t need a lot of employees to run a million dollar product. I’d say you can do it pretty well with about five<sup><a href="#footnote1">1</a></sup>:</p> <ul> <li>1 person focused on the business/company</li> <li>1 person focused on customer support</li> <li>3 people focused on product development</li> </ul> <p>Five people is a small enough number to treat very well as a company. You don’t have to worry about getting tangled in communication struggles, management strategies, political battles, and satisfying hundreds of people with every decision. You can get to know five people really well. Everyone can build a strong connection to each other.</p> <p>Since you’re not focused on growing your valuation, you can ignore the employee-hostile game of Stock Options. Instead, you can choose employee-friendly equity strategies like performance bonuses, profit-sharing, and granting actual equity (shares) & issuing dividends. <strong>Everyone involved can make a lot of money and have a real incentive to invest themselves into the business.</strong></p> <p>Since you’re not playing the Stock Option game, people can leave when the time is right without ruining their financial future. Employees can leave or stay because of the work and the company, not tax law. Nothing is more poisonous to your company’s work ethic than having a bitter employee stick around when they’re no longer invested.</p> <p>Five people is a small enough number to manage well. Common practice says 5-7 people is about the right number. You don’t have to implement any complicated management strategies. You’ll probably be managing them without any explicit effort because you’ll have a relationship with every employee.</p> <p>My point here is that sticking to a small number of employees avoids the vast majority of difficult problems in running a company. And as every engineer knows, the best way to solve a problem is to not have it in the first place.</p> <h2 id="customers">Customers</h2> <p>If you want to make a million dollars a year, you don’t need millions (or hundreds of millions) of customers. 12,000 paying customers at $7 per month can do it. That’s not an insurmountable amount of people.</p> <p>You don’t have to cross cultural boundaries to get 12,000 customers, which means you aren’t trying to force one design pattern for everyone in the world. You don’t have to worry about internationalization, localization, or learning how business is done in Japan. You can stick to what you know, and do it really well.</p> <p>12,000 is a small enough number to make sense of your customer metrics. You can build an intuitive understanding of the flow of signups, upgrades, downgrades, and cancellations. You can reach out to people who enjoy your product and those who don’t. Ask them why. Get to understand your customer’s motivations.</p> <p>This all makes for a better relationship between the company and its customers.</p> <h2 id="product">Product</h2> <p>Product teams are fueled by context. With a small team and a small customer base, every member of the product team can build a solid understanding of your customers and the business. This makes for better product decisions, which means more revenue and higher customer satisfaction.</p> <p>The most common poison for a product team is communication overhead. In order to put up the best solution for the problem, you need to be able to get lost in it. You need long stretches of uninterrupted time<sup><a href="#footnote2">2</a></sup> to do your job best. Most businesses don’t admit how costly things like company wide announcements, project management, interviewing, internal politics, and large scale collaboration are on productivity. They all work against flow, and should be considered a handicap on product teams. Small teams substitute process with trust, eliminating overhead.</p> <p>It’s an order of magnitude easier to change direction with a small company. Big companies are like cargo ships — they <em>can</em> turn, but it’s going to take quite a while. Being able to change direction quickly makes it cheaper to throw away an idea that isn’t panning out well. <strong>You don’t have to force bad ideas.</strong> Bad ideas can fail and be replaced by good ideas. This is how you build a good product.</p> <h2 id="make-money">Make Money</h2> <p>Ignoring the valuation game makes the whole process of making money extremely straight forward. The more money you bring in, the less money you spend, the more money you take home.</p> <p.</p> <p>And that’s kind of the thing about million dollar products. They rarely stay million dollar products. It might grow to a twenty million dollar business. But so long as you’ve built your values around the idea of a million dollars, you will grow in a <em>high-margin, high-quality</em> way.</p> <hr /> <p>You can make a lot of money building Unicorns. I’ll (eventually) do very well off my <a href="">last gig</a> because of it. It’s a fine way to run a software business. It’s a very fast, very intense way to operate. The whole world pays attention.</p> <p>But this tunnel-vision our industry has settled into is silly. It’s skewed our motivations and confused our priorities. Not every product needs to be a Unicorn.</p> <p>There’s a million other ways to run a business. People don’t start pizza shops to compete with Dominos. They start them because they love pizza.</p> <p>And everyone knows the local pies are better.</p> <hr /> <p><a name="footnote1"></a></p> <p><strong>1:</strong> This is far from a rule — it’s an example. Don’t take it too literally.</p> <p><a name="footnote2"></a></p> <p><strong>2:</strong> A 5 minute interruption may only take five minutes, but it can <a href="">cost hours</a>.</p> <img src="" height="1" width="1" alt=""/> Measuring emotion 2015-05-04T00:00:00+00:00 <p>One of the most important responsibilities for managers in tech companies are having regular <a href="">one-on-ones</a> <em>means</em> when they say something.</p> <p?</p> .</p> <hr /> <p>I recently listened to a great Planet Money episode on <a href="">Spreadsheets!</a> that discusses the history of spreadsheets and how it’s changed the way we make decisions. The episode was inspired after an article written in 1984 about the significance and danger of the advance of spreadsheets:</p> <blockquote> <p>The spreadsheet is a tool, and it is also a world view — reality by the numbers.</p> <p>— Steven Levy on <a href="">A Spreadsheet Way of Knowledge</a></p> </blockquote> <p.</p> <p>Take a minute to think about how the spreadsheet has changed your life. How often do you make a decision without researching how to optimize something?</p> <p>This is not to say we shouldn’t use “spreadsheets” to optimize our decisions. We often <em>do</em> make better decisions through data analysis. Rather, what I think is interesting is just how significant our bias toward analytical reasoning has become. Our hammer is the spreadsheet, and now we’re making everything in product management a nail.</p> <hr /> <p>I’ve long been a believer that your environment significantly shapes the type of products you can build. <em>Have nothing in your houses that you do not know to be useful, or believe to be beautiful.</em>.</p> <p>Think about <a href="">Agile/XP User Stories</a>.?</p> <div class="figure"> <img src="" alt="An example User Story" /> </div> <p>But this is reality only by the numbers. I guarantee you that no one <em>wants</em>?</p> <blockquote> <p>Christine just got her second parking ticket this week. She walks up to her car and screams <em>this is fucking bullshit!</em> She admits to herself that she really does need to spend her Apple Watch money on a parking pass. <em>Bullshit!</em> She’s already dreading the lecture from her mother once she gets a copy of this ticket in the mail. But, she has to admit that she’s looking forward to the relief of parking without worrying about tickets. Still. No watch. Blergh.</p> </blockquote> <p>Can you feel her anger and frustration? How does a User Story communicate this? It doesn’t. It assumes Christine is a golden child, birthed of pure rationality and light who simply does not drive to school without a parking pass.</p> <p>What advantage does the User Story have if it is not communicating customer perspective? What value do we gain by saying <em>As a student I want to purchase a parking pass so that I can drive to school</em> over something more straightforward like <em>Students can purchase a parking pass.</em> We’ve gotten too analytical with our tools. We’ve bulldozed emotion without realizing what we were doing.</p> <p>How might you change your design if your tools promoted an emotional understanding of Christine’s perspective? What if immediate purchase included a discount or forgiveness for the ticket itself? You might just end up with happier students and more parking passes sold.</p> <hr /> <p>Unfortunately, things get sticky when we leave our numbers behind. We’re not practiced at feeling emotion in a professional environment. We associate emotions with irrationality and poor decisions — something to be avoided. As an organization approaches <a href="">Dunbar’s number</a>, being vulnerable and feeling emotion becomes less and less safe. Our customers continue to feel and be swayed by emotion just like the rest of us while we’re busy building a world in where we don’t have to feel.</p> <p>It’s time we revisited our tools with a focus on promoting emotional understanding. Our customers deserve it. And frankly, we’ve been <a href="">fucking up</a> their lives with our lack of empathy. I don’t have the complete answer, but I do have some suggestions.</p> <ul> <li> <p><strong>Jobs to be Done</strong><br /> JTBD is my favorite software design tool of the past five years. But my favorite part is that it forces you to acknowledge the emotional aspect of why people use or don’t use your product.</p> </li> <li> <p><strong>Regular one-on-ones with customers</strong><br /> Spend time with your customers where it’s all about <em>them</em> — without survey questions or a predefined conversation structure. You might even make a new friend.</p> </li> <li> <p><strong>Customer stories</strong><br /> One thing <a href="">Chrissie<.</p> </li> <li> <p><strong>Use all of your product</strong><br />.</p> </li> <li> <p><strong>Train your intuition</strong><br /> Don’t be bullied into the world view that every decision must be proven with data. Fed by enough meaningful experience, our intuitive reasoning is extremely powerful. Train your intuition, and learn how to communicate intuitive reasoning.</p> </li> </ul> <hr /> <p>If we want to build better products, we must learn to include emotional understanding into our product decisions without resorting to analytical reasoning. Emotions must be felt.</p> <img src="" height="1" width="1" alt=""/> The Moral Bucket List 2015-04-20T00:00:00+00:00 <p>As someone who’s recently struggled with the pace of my work and where to focus my energy, I really related to David Brooks’ recent essay <a href="">The Moral Bucket List</a>:</p> <blockquote> <p>But I confess I often have a sadder thought: It occurs to me that I’ve achieved a decent level of career success, but I have not achieved that. I have not achieved that generosity of spirit, or that depth of character.</p> </blockquote> <p>On passions:</p> <blockquote> ?</p> </blockquote> <p>Yes! I’ve struggled with how to describe this feeling for a long time — this feeling that while it’s probably good advice to follow your passions, you may find more fulfillment following where you’re most needed. This essay is based on his new book <a href="">The Road to Character</a>, which I’m pretty excited to dive into here soon.</p> <p>Pairs well with this fantastic answer on <a href="">How can I be as great as Elon Musk?</a> by his ex-wife, Justine:</p> <blockquote> .</p> </blockquote> <p>Do your priorities lean toward being as great as Elon Musk, or achieving a depth of character? I think it’s a good question to ask yourself, especially if you work in power-hungry environment like technology.</p> <img src="" height="1" width="1" alt=""/> Taste and The Zen of GitHub 2014-10-02T00:00:00+00:00 <p>There’s a lot of interesting things that happen the first time you really grow a company. Most are exciting, some are challenging, and a few are downright confusing. Every organization (and individual inside) experiences growth differently, which makes for some great stories. This is one of mine.</p> <hr /> <blockquote> > <p>— Steve Jobs</p> </blockquote> <p>I’ve always loved this quote. And to be honest, I’m not sure why. It’s an empty statement. What does having no taste mean? How do original ideas and culture factor into taste? Microsoft has always had plenty of original ideas (designers tend to mock and ridicule these especially), and — well — of <em>course</em> they have culture. That’s not a thing you can get rid of. It must be that their original ideas and culture were the wrong type.</p> <p><em>What makes Apple have taste and Microsoft have no taste?</em></p> <p>About two years ago, GitHub’s product development team was growing fast and I found myself thinking about these questions more and more. We were getting an influx of new points of view, new opinions, new frames of reference for <em>good taste</em>. One thing that challenged me was watching design decisions round out to the path of least resistance. Like a majestic river once carving through the mountains, now encountering the flat valley and melting into a delta.</p> <p>And the only problem with deltas is they just have no taste.</p> <h2 id="so-how-do-you-build-taste">So how do you build taste?</h2> <p>I’d argue that an organization’s taste is defined by the process and style in which they make design decisions. <em>What features belong in our product? Which prototype feels better? Do we need more iterations, or is this good enough?</em> Are these questions answered by tools? By a process? By a person? Those answers are the essence of <em>taste</em>. In other words, <strong>an organization’s taste is the way the organization makes design decisions</strong>.</p> <p>If the decisions are bold, opinionated, and cohesive — we tend to say the organization has taste. But if any of these are missing, we tend to label the entire organization as <em>lacking</em> taste.</p> <p>Microsoft isn’t lacking taste — they have an overabundance of it.</p> <p>This is one of the biggest challenges a design leader faces. How do you ensure your team is capable of making bold, opinionated, and cohesive decisions <em>together</em>? It was certainly challenging me. With new employees came different tastes — often clashing against each other, resulting in unproductive debate and unclear results.</p> <p>We needed some common ground.</p> <h2 id="idiomatic-code-and-the-zen-of-python">Idiomatic code and The Zen of Python</h2> <p>As dynamic languages have become more popular, so have the phrases <em>idiomatic code</em> and <em>good style</em>. With dozens of ways to write each line of code, developers are expected to not only know <em>how</em> to accomplish a task, but in <em>which style</em> they should to accomplish it in.</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">unless</span> <span class="n">cookies?</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="n">cookies?</span><span class="p">)</span> <span class="k">if</span> <span class="p">(</span><span class="n">cookies?</span> <span class="o">==</span> <span class="kp">false</span><span class="p">)</span> <span class="k">unless</span> <span class="o">!!</span><span class="n">cookies?</span> <span class="n">run_away_to_the_woods!</span></code></pre></figure> <p>There is no <em>Chicago Manual of Style</em> for Ruby. We are instead asked to absorb good style from others who have good style. But who has good style? Matz is nice so we always raise exceptions in unsuccessful calls to methods ending in a bang‽ Unfortunately these kinds of decisions are easy — what isn’t so easy is to know when a class is too big, you’ve chosen poor names, or exactly how much meta-programming is too much. To make it worse, each of these decisions change over time as the taste of the Ruby community evolves. Style guides are often tied to specific organizations and people, not to the Ruby community itself.</p> <p>Cool.</p> <p>This may explain why I was overcome with a feeling of jealousy the first time I read <a href="">The Zen of Python</a>. I’m not usually one to get into <strike>religious</strike> <ins>programming language</ins> wars, but by science — I was <em>into</em> this idea. Here’s a taste:</p> <ul> <li>Beautiful is better than ugly.</li> <li>Explicit is better than implicit.</li> <li>Simple is better than complex.</li> <li>Complex is better than complicated.</li> <li>Flat is better than nested.</li> <li>Sparse is better than dense.</li> <li>Readability counts.</li> </ul> <p>They were answers to <em>why did you do X</em>? And they were shared by, and created for the Python community. And I loved it. (Don’t even get me started about how fantastic the introspectional <code class="highlighter-rouge">import this</code> is.)</p> <h2 id="the-zen-of-github">The Zen of GitHub</h2> <p <em>really</em> believed in it. The ones I did, I kept, the ones I didn’t, I threw away.</p> <ul> <li>Responsive is better than fast.</li> <li>It’s not fully shipped until it’s fast.</li> <li>Anything added dilutes everything else.</li> <li>Practicality beats purity.</li> <li>Approachable is better than simple.</li> <li>Mind your words, they are important.</li> <li>Speak like a human.</li> <li>Half measures are as bad as nothing at all.</li> <li>Encourage flow.</li> <li>Non-blocking is better than blocking.</li> <li>Favor focus over features.</li> <li>Avoid administrative distraction.</li> <li>Design for failure.</li> <li>Keep it logically awesome.</li> </ul> <p>I presented these in two ways: as part of a presentation given at our semi-annual product development summit (where I elaborated on each point) and as a pull request in our codebase.</p> <div class="figure"> <img src="" /> </div> <p>Committing the zen to our codebase was important. It made them ours, not mine. It made them malleable, not forever. It made them the responsibility of the whole product development group, not just people who labeled themselves designers.</p> <p>And most importantly, <strong>it was written down</strong>..</p> <p>But keep it short — because everything added dilutes everything else.</p> <h2 id="onward-and-inward">Onward and inward</h2> <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code>~~~~ ~~~~~~==~==~~~==~==~~~~~~ ~~~~~~==~==~==~==~~~~~~ :~==~==~==~==~~ </code></pre></div></div> <p>It’s often hard to know how much your words are hitting home as a leader. People always listen, but you’re literally paying them for that privilege. The gap between listening and believing is the hard part.</p> <p>Which is why it made me so happy to see the zen spread. At first, in small design discussions. Then in our <a href="">api</a>. And in <code class="highlighter-rouge">Hubot zen me</code>. And then in wallpapers for our desktops.</p> <div class="figure"> <img src="" /> <small>Wallpapers by <a href="">Coby Chapple</a> (<a href="">Wallpapers.zip</a>)</small> </div> <p>Pretty soon it wasn’t just a presentation I gave or a file I committed. It was The Zen of GitHub. A thing by itself, free to be <a href="">made fun of and celebrated</a> all at once. And that’s pretty cool.</p> <hr /> <p>Design is a hard job. No matter how much we love our work, some will always hate it (and they’ll <em>always</em> let us know). Things change so fast, we’re lucky if what we designed a year ago still exists today. It can be really difficult to be proud of our work.</p> <p culture.</p> <img src="" height="1" width="1" alt=""/> Ego 2014-09-04T00:00:00+00:00 <p>I remember the first time Bitbucket straight up stole one of my designs. The layout. The borders. The shadows. The exact information on the page!</p> <p>I was angry.</p> <p>This is <em>my</em> design. I was the one who put in the time. I spent the hours in a dark room with all the stuff that <em>could</em> be until I had the stuff that <em>should</em> be. I was the one who designed five wrong iterations until I got the right one. And it was good. People loved it. And these — these <em>barbarians</em> just stole it. Every last bit.</p> <p>I was real angry. I wanted to start a scene. I wanted to get real angry, real public.</p> <p>But my customers didn’t care. They didn’t even notice.</p> <p>Because they were <em>my</em> customers. They loved it. They were happy. They got something nice to use. Customers love that shit. They eat it up. Nice to use? <em>Into it.</em></p> <hr /> — <em>I know</em> — that has everything to do with the product, and nothing to do with me.</p> <p>But here I am. And I want it to be about me.</p> <p>And to be honest, that’s still the hardest thing about designing products. <em>Design is a job.</em> If I want people to celebrate me, this isn’t the career. My job is to make good shit that people like. And there isn’t room for me in that equation.</p> <p>There’s the product.</p> <p>There’s the team.</p> <p>But more than anything else — there’s the customers.</p> <p>Those people who make products real. Real life humans with emotions and opinions and happiness and sadness and money. Money that puts food on my table.</p> <p>So you know, I have to remind myself: it’s about them. It’s about the customers. It’s not about me.</p> <blockquote class="twitter-tweet tw-align-center" lang="en"><p>Product: compassion strong enough to ignore your selfish desires in order to build something for someone else.</p>— Kyle Neath (@kneath) <a href="">January 20, 2014</a></blockquote> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <p>Tomorrow — I’ll be a customer. And then it can be about me.</p> <hr /> <p>What about Bitbucket’s customers? They liked it too. It made their day a little bit better.</p> <p>Because of me. I made even more people happy.</p> <p>But I didn’t get to own that. You know? That’s still hard. But in the long run it’s a good thing. Because it doesn’t matter if I owned it or not. I made something good that people enjoyed. Even more people than usual.</p> <p>The team that stole my layout? They’re probably good people too. They were thinking about their customers. Not Kyle Neath.</p> <p>And then someone else redesigned the page. And made it even better.</p> <p>All without me.</p> <img src="" height="1" width="1" alt=""/> Tweet Tweet 2014-08-23T00:00:00+00:00 <p <em>know</em> of Steve Jobs?</p> <hr /> <blockquote class="twitter-tweet tw-align-center" lang="en"><p>*Scene: It's Second Breakfast time at Twitter HQ. A 23y.o. lies on the innovation hammock, is hand-fed scallops wrapped in larger scallops.*</p>— Tom Gara (@tomgara) <a href="">August 18, 2014</a></blockquote> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <hr /> <p>In the industry, we have this phrase — <em>ship early, ship often</em> — it’s a great little hack we’ve developed to avoid taking any real responsibility for our decisions. If we’re doing it fast, we’re trying to fuck up. Get it? We’re <em>trying</em>. <em>Ship early, ship often.</em></p> <hr /> <blockquote class="twitter-tweet tw-align-center" data-<p>Suddenly he sits upright, slaps away the feeding hand. "What if favorites *were* retweets?", he mutters.</p>— Tom Gara (@tomgara) <a href="">August 18, 2014</a></blockquote> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <hr /> <p.</p> <p>Which is why I’m pretty fucking surprised that somehow <em>I’m in a goddamn Google Hangout with him at 3am on a Tuesday night</em>. He’s sitting there, and I swear the fucker is <em>glowing</em> — but it’s not like a supernatural light — I think he painted himself in glow in the dark paint or something because it just looks really bad and it’s all over his dog too (who does <em>not</em> seem very chill about this whole situation). While I’m sitting here watching this performance art, I start to wonder if this shit really is for me, and suddenly all I hear is screaming.</p> <p>Dude is <em>not</em> <em>not</em> for me and close my laptop. Most people just don’t get how hard this job is. <em>Fuck</em>, dude.</p> <hr /> <blockquote class="twitter-tweet tw-align-center" data-<p>The in-house studio audience paid to give emotional affirmation to Twitter employees breaks into rapturous applause. They stand, some cry.</p>— Tom Gara (@tomgara) <a href="">August 18, 2014</a></blockquote> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <hr /> <p>This whole thing kinda fucked me up, so I took a few Ambien to knock me out. Apparently, product manager dude did not.</p> <blockquote> <p>From: Dude<br /> To: All<br /> Cc: Kyle<br /> Subject: Important All-Hands Meeting</p> <p>Fellow Employioneers,</p> <p>I have some news. Kyle and I have figured it out. 3pm at the food trucks. You won’t want to miss this.</p> </blockquote> <em>definitely</em> on his good side. This isn’t going to go like last month’s all-hands when we turned the site blue.</p> <p>“Comments.”</p> <p.</p> <p>When we get back to the office, he breaks the silence agian, “Thank you all for coming. Kyle’s got this — follow his lead. Let’s see where we are by tomorrow morning.” <em>Motherfucker!</em>.</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">class</span> <span class="nc">Post</span> <span class="o"><</span> <span class="no">Comment</span> <span class="k">end</span></code></pre></figure> <p>I keep going through these emails and I’m starting to get it.</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">class</span> <span class="nc">Photo</span> <span class="o"><</span> <span class="no">Comment</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">Friend</span> <span class="o"><</span> <span class="no">Comment</span> <span class="k">end</span> <span class="k">class</span> <span class="nc">User</span> <span class="o"><</span> <span class="no">Comment</span> <span class="k">end</span></code></pre></figure> <p>The seventeenth email is when it finally hits me like a ton of bricks.</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">class</span> <span class="nc">CommentComment</span> <span class="o"><</span> <span class="no">Comment</span> <span class="k">end</span></code></pre></figure> <p>Fuck. I’ve just agreed to replace everything in our site with comments. I mean, we joked about this, but <em>he cannot be real</em>. Just one polymorphic inheritable database table of comments, all pointing to each other and joining through each other.</p> <p>Just then I realize that’s what <em>I</em> want us to do. <em>Kyle’s got this</em>, that’s what he said.</p> <hr /> <blockquote class="twitter-tweet tw-align-center" data-<p>A trapdoor in the ceiling opens, drenching him with cash and stock. An enormous dubstep bass line drops, the entire office parties for days.</p>— Tom Gara (@tomgara) <a href="">August 18, 2014</a></blockquote> <script async="" src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <hr /> <p>Well, as they say — <em>so it goes</em>. Comments, here we come baby! That eighteenth email, by the way?</p> <blockquote> <p>From: Dude<br /> To: Kyle<br /> Subject: COMMENT</p> <p>But only SOMETIMES</p> </blockquote> <p>Not quite sure what to do with that one, but cute-co-worker-in-the-corner just rolled up to my desk so I’m just gonna go with what I have for now.</p> <hr /> <p>.”</em></p> <p><em>And shoutout to <a href="">@court3nay</a> and <a href="">@technoweenie</a> for the CommentComment joke. STI, it’s one hell of a drug.</em></p> <img src="" height="1" width="1" alt=""/> Cranking 2014-08-10T00:00:00+00:00 <p>Merlin Mann in 2011:</p> <blockquote> <em>not</em> working.</p> <p>…</p> <p.</p> <p>So, I’m done fucking that up. I’m done cranking. And, I’m ready to make a change.</p> </blockquote> <p.</p> <img src="" height="1" width="1" alt=""/> Hit the Reset Button in Your Brain 2014-08-10T00:00:00+00:00 <p>Daniel J. Levitin for the Sunday Review:</p> <blockquote> <p.</p> </blockquote> <p>I love this explanation. I often find myself arguing for the power of <em>not</em> (as in, spending time purposefully not accomplishing tasks). American culture does not like this. It wants us to go faster, do more, always be <em>on</em> (why aren’t you responding to my text message???). As a creative professional, this pressure can be suffocating and damaging, especially as an organization grows. The worst part? I don’t think any of us really want to be this way.</p> <blockquote> <p.</p> </blockquote> <p>I’d also add a vacation from social media. Take a break from your text messages, your Facebook feed, your Twitter feed, and your Instagram feed. Phone vacations are a real thing, and something we’re all going to have to master in our ever-connected world.</p> <img src="" height="1" width="1" alt=""/> Investors of Secret: I have a favor to ask 2014-08-06T00:00:00+00:00 <p>It’s <a href="">no secret</a> that I dislike <a href="">Secret</a>. Just this week I had a crisis of existence when I found myself <a href="">agreeing with Sarah Lacy on the topic</a>.. <a href="">Good thing that can’t happen</a>.</p> <p>I wonder if they’ll publish their suicide note on Secret too?</p> <hr /> <p>I admit that this is an <em>opinion</em>, <a href="">greater internet fuckwad theory</a>). Still, I do admit it is possible. After all, it’s important to take risks to move forward.</p> <blockquote> <p><em>risk</em> — incur the chance of unfortunate consequences by engaging in (an action)</p> </blockquote> <p <em>money</em> for <em>more money</em>.</p> <h2 id="the-risk-of-funding-secret">The risk of funding Secret</h2> <p>It is possible that Secret may overcome all challenges and become an service of support, transparency, and community. It is also possible that Secret may have unfortunate consequences, which is how we quantify risk.</p> <ul> <li> <p>Secret may become a tool for <a href="">bullying</a> (specifically <a href="">cyerbullying</a>), supporting one of the least desirable human behaviors known in our society.</p> </li> <li> <p>Secret may become a tool for libel and defamation, spreading damaging false information about people.</p> </li> </ul> <p>In fact, Secret has already suffered from these problems, and is already an established tool for bullying and libel. <em>Okay, so what? So what if it’s a tool for bullying and libel? What of it?</em></p> <ul> <li> <p>Bullying causes depression and anxiety, increased feelings of sadness and loneliness.</p> </li> <li> <p>Defamation of character can harm people’s reputation, costing them personally, professionally, and financially. Defamation often also causes mental and physical anguish.</p> </li> <li> <p>In rare cases, a small fraction of those bullied retaliate through extremely violent measures (ex: in 12 of 15 school shootings in the 1990s, the shooters had a history of being bullied).</p> </li> <li> <p>Bullying sucks.</p> </li> <li> <p>Defamation sucks.</p> </li> </ul> <p>The most notable theme across all of these effects is the <strong>anguish and suffering of human beings</strong>. This is the most important potential consequence of Secret (and if you ask me & Occam’s razor, pretty fucking likely).</p> <p>And what happens <del>if</del> <ins>when</ins> Secret gets compromised and all those secrets… aren’t? What happens when a Secret employee feels a little curious and starts looking into who authored that juicy post? All of these scenarios are likely, and would result in even worse bullying and defamation.</p> <p>By my moral compass, this risk is far too high. I’m not comfortable ruining anyone’s life, even if they’re a minority of “unintended usage”.</p> <h2 id="a-favor">A favor</h2> <p>You’re risking our well-being for a couple of bucks — will you do us a favor in return? <strong>I am asking you, the investors of Secret, to raise $25 million USD for <a href="">The Ocean Cleanup</a></strong> .</p> <p <em>personally</em> funding companies — but I’m asking you to use your fundraising skills to get Boyan the funding he deserves. Raising money is your expertise, and you’re really good at it.</p> <p>Besides, wouldn’t it be cool to see a new type of business succeed — one that profits from improving the environment? If I was a person interested in creating new businesses, I’d think it would be pretty cool.</p> <p.</p> <p>Can we try something cool?</p> <hr /> <p><em>If you’re a product designer reading this, consider watching Mike Monteiro’s excellent <a href="">How Designers Destroyed the World</a> talk from Webstock. This is me speaking up.</em></p> <img src="" height="1" width="1" alt=""/> Asmiov on style 2014-07-03T00:00:00+00:00 <p>Isaac Asimov on his writing style:</p> <blockquote> <p.</p> </blockquote> <img src="" height="1" width="1" alt=""/> The Ocean Cleanup 2014-06-21T00:00:00+00:00 <p>Last year, I watched Boyan Slat give a TEDx talk on the subject of plastics in our ocean: <a href="">How the oceans can clean themselves</a>. The idea was super interesting to me (I love simple solutions), but I had no idea how feasible it would be. On June 3rd, his newly formed foundation <a href="">The Ocean Cleanup</a> claimed they’ve proven it is indeed feasible.</p> <p>They’re raising $2,000,000 to deploy a large-scale pilot in the next few years. And maybe it won’t work — but it sure feels like a no-brainer to donate some money and give them the chance to try.</p> <img src="" height="1" width="1" alt=""/> The Internet With A Human Face 2014-06-10T00:00:00+00:00 <p>Maciej Cegłowski, creator of <a href="">pinboard.in</a>:</p> <blockquote> <p>I’ve come to believe that a lot of what’s wrong with the Internet has to do with memory. The Internet somehow contrives to remember too much and too little at the same time, and it maps poorly on our concepts of how memory should work.</p> </blockquote> <p>I can’t begin to explain how insightful and important this phrase is. We’ve been lazy. We haven’t treated backups, privacy, security, and data portability seriously enough as creators of software. It’s time we do.</p> <p>If you build software for the web, you need to read the whole presentation.</p> <img src="" height="1" width="1" alt=""/> Claude Shannon on accepting the Kyoto Prize 2014-06-01T00:00:00+00:00 <p>Claude Shannon, inventor of information theory:</p> <blockquote> <p.</p> </blockquote> <p>The more I learn of Claude Shannon, the more I like this guy. This is the future I want to build. The <a href="">entire speech</a> is worth a read.</p> <img src="" height="1" width="1" alt=""/> The Revenge of the Nerds 2014-05-24T00:00:00+00:00 <p>Kottke, commenting on Steven Frank’s <a href="">Dragon Lair story</a></p> <blockquote> <p>The web has since been overrun by marketers, money, and big business, but for a brief time, the nerds of the world had millions of people gathered around them, boggling at their skill with this seemingly infinite medium. That time has come and gone, my friend.</p> </blockquote> <p>And with two sentences, Kottke summarizes the feelings that have been welling up in me for the past four years. It’s a new world.</p> <img src="" height="1" width="1" alt=""/> Anonymity: Lessons learned building an anonymous social network 2014-02-26T00:00:00+00:00 <p>Some great thoughts regarding the history of Formspring and purposefully designing an anonymous experience. I love this bit:</p> <blockquote> <p>Investors will pass on your company, peers will criticize you, parents will yell at you. Maybe they’re right. And maybe not.</p> </blockquote> .</p> <p>Anonymous can be a part of your product. Design it.</p> <img src="" height="1" width="1" alt=""/> The bug in Gmail that fixed itself 2014-01-25T00:00:00+00:00 <p>A couple of years ago I listened to <a href="">Werner Vogels</a> talk a bit about treating large computing systems like biological systems. We shouldn’t try and stop the virus — the predator — instead, we should design systems that can provide self-correcting forces against contaminated systems. Preventing failures and bugs was futile.</p> <p <a href="">Dietrich Featherston</a> talk about <a href="">Radiology + Distributed Systems</a> — a similarly alternate perspective on monitoring and measurement.</p> <p>And so it made me incredibly happy to read this bit from Google’s post-mortem of Gmail’s outage:</p> <blockquote> <p>Engineers were still debugging 12 minutes later when the same system, having automatically cleared the original error, generated a new correct configuration at 11:14 a.m. and began sending it; errors subsided rapidly starting at this time.</p> </blockquote> <p>The system was able to fix the bug faster than the engineers. This isn’t anything revolutionary or mind blowing. But it’s kind of awesome to see it <em>succeed</em> in the real world.</p> <img src="" height="1" width="1" alt=""/> Bullshit Overlays 2014-01-06T00:00:00+00:00 <p>Brad Frost with some real talk:</p> <blockquote> <p>I’m sure they’re effective.</p> <p>And I could get people on the street to take my survey by threatening them with a claw hammer. That would be pretty effective too.</p> </blockquote> <p>If you use an overlay, you’re an asshole. Stop.</p> <img src="" height="1" width="1" alt=""/> On Software Quality and Building a Better Evernote in 2014 2014-01-05T00:00:00+00:00 <p>It’s hard to admit you’ve made a massive strategic mistake in your company. Kudos to Evernote for facing quality issue head on.</p> <p>Here’s to brighter, higher-quality future.</p> <img src="" height="1" width="1" alt=""/> Product 2014-01-03T00:00:00+00:00 <p>Marc Andreessen was the first to coin the phrase: <em><a href="">software is eating the world</a></em>. And I tend to agree with him — no phrase defines our time more so than this one. More and more companies are powered by and create software. More and more <em>people</em> are creating software. Software is everywhere — plugged into our cars, our bikes, stuffed in our pockets, embedded in our TVs, and controlling a vast majority of the world we’ve created.</p> <p>Yet I find myself wondering: what <em>kind</em> of software is eating the world?</p> <div class="figure"> <img src="" /> <small>Does the software that Wall Street Journal uses advance journalism and better inform the public?</small> </div> <p.</p> <p>We’ve become obsessed with process and tools. We’ve stopped caring about the product.</p> <hr /> <p>Product is the reason that I build software. I want to create things that bring people joy. I want to build things I can be proud of. Things that makes the world a better place.</p> <p><em>You can’t argue against pageviews — people want this. It may be slimy, but it works.</em></p> <p>I look around at software today and I wouldn’t be proud of it. Most software is frustrating, broken, and in all honesty, a disservice to humanity. I would be ashamed to be associated with the vast majority of software that exists today.</p> <p><em>Yeah, but he made a $20M exit, it must have been a decent product.</em></p> <p.</p> <ul> <li>Focus on results over process</li> <li>Bring users joy</li> <li>Build something you are proud of</li> </ul> <p>We can do these things, and we can do them in the real world — the same money fueled kinda shitty world that we all exist in. The real world with all of it’s seven billion imperfect humans.</p> <p><em>That was Mica’s department that put those ads on the site — I hate them, but what are you gonna do? They perform insanely well.</em></p> <p>We can’t be afraid of words like <em>revenue</em>, <em>compensation</em>, <em>management</em>, and <em>user satisfaction</em>..</p> <blockquote> <p>Organizations which design systems … are constrained to produce designs which are copies of the communication structures of these organizations</p> <p>— Conway’s Law</p> </blockquote> <p.</p> <p><em>We’re getting a lot of pressure from our investors to improve our sales numbers — they’ve given us a call list and I’d like you to start going through it.</em></p> .</p> <p><em>I didn’t want to step on their toes, so I just deleted the sentence and pushed it out. It doesn’t make sense, but hey — not my job.</em></p> <p>I guess it’s not surprising that so much software is terrible. It’s easy to be lazy, and it’s hard to build good product. But we get <em>paid</em> to invent the future. The future! That’s an incredible opportunity that blows my mind every day.</p> <hr /> <blockquote> <p>“You want to have a future where you’re expecting things to be better, not one where you’re expecting things to be worse.”</p> <p>— Elon Musk</p> </blockquote> <p:</p> <ul> <li>The internet (a globally connected culture) <strong>Paypal</strong></li> <li>Getting off fossil fuels <strong>Solar City, Tesla</strong></li> <li>Becoming a multi-planetary civilization <strong>SpaceX</strong></li> </ul> <p>Where does Buzzfeed fit in here? What about SnapChat, FarmVille, and High Frequency Trading? I’m not saying these can’t be a source of entertainment or insanely profitable — but they’re not good product. They’re not making the world a better place.</p> <p <em>feels right</em> when you build a good product.</p> <p>That’s really the core of it: how can we create financially sustainable products that bring people joy and make the world a better place?</p> <hr /> <p>I’ve been thinking a lot about principles of good product. At least, principles that I can feel confident writing about.</p> <ul> <li>Mind the Humans that use our products</li> <li>Metrics used to gauge product success</li> <li>Operational systems that allow for good product</li> </ul> <p>I want to spend more of my time writing about these ideas. More time debating and collaborating on these ideas. And coming up with better ideas so we can all build better things and make a future where we can expect things to get better.</p> <p><strong><a href="">Discuss this article on Designer News</a></strong></p> <img src="" height="1" width="1" alt=""/> Omakase Charity 2013-12-31T00:00:00+00:00 <p>My friend Theresa recently launched a new project — Omakase. The premise is pretty awesome: they pick excellent well-deserving charities, you subscribe at $10, $25, or $50 a month.</p> <p>Simple subscription-based giving. My kinda joint.</p> <img src="" height="1" width="1" alt=""/> My Photos on Exposure 2013-12-11T00:00:00+00:00 <p>The fine folks from <a href="">Elepath</a> recently launched their newest venture, <a href="">Exposure</a>. I don’t really tend to pimp services too much, but I <em>really</em> like Exposure. <a href="">Here’s</a> a story I published from a recent hike through Marin.</p> <p>The combination of words + photo groups is perfect for telling a story. I’m looking forward to seeing where they take this.</p> <img src="" height="1" width="1" alt=""/> Pixels don’t care 2013-01-28T00:00:00+00:00 <p>I’m short.</p> <p>When I was 20, I decided to try and make some extra money building websites for people to pay for my tuition. My work was good. It wasn’t phenomenal, but it was good. It was impossible for me to get work. Everything would be great until I met with a potential client. At which point they told me they’d rather hire a professional.</p> <p>What they meant is that I looked too young. I didn’t really realize this was the problem until people started screwing me out of money. “You’re just a kid and you’ll get over it” I believe was the phrase my last client used to fuck me over.</p> <p>Humans are really good at prejudice and intolerance.</p> <hr /> <p>The internet was a much different place eight years ago. Facebook wasn’t open to the public. Twitter didn’t exist. Google did not require legal names. I was just <strong>kneath</strong> who had a blog at warpspire.com. I didn’t have a picture and no one knew my age.</p> <p>And the internet loved my work. I still remember the first day my blog was featured on CSSVault — it was one of the most exciting things to ever happen to me. How awesome was it that my work was highlighted as one of the best in the world? (CSSVault was quite a different beast 8 years ago too).</p> <p>A few days later I received an email from the Art Director of a local agency asking to come in and meet their team. And so it was that I was interviewing for a job to work on sites for the likes of Apple, Disney, HP, and RIM. Pretty fucking crazy. It felt good — it felt like validation that my work <em>was</em> worth paying for.</p> <p>I remember the last question asked of me at the interview, because it was possibly the most terrifying professional moment of my life. To paraphrase:</p> <blockquote> <p>You have no formal eduction, no experience with any big clients, what makes you think you could possibly be good enough to work here?</p> </blockquote> <p>Through a stroke of luck, a moment of wit came upon me and I replied with the only thing my brain could grasp on:</p> <blockquote> <p>I have no idea. I didn’t even know I was interviewing, Kris sent me an email asking <em>me</em> to come in today because he thought my work was good. Is it?</p> </blockquote> <p>I never really got an answer. But I did get the job. Because my work <em>was</em> good. But I was given a much lower salary than my co-workers. For every hour I worked, the agency billed my time out at a 2,083% markup. To the client (who couldn’t see my height), my time was worth over 20x the amount I was worth to the agency.</p> <p>Looking back, I can’t help but think this was discrimination. For age, for height, for whatever you will. I had no lower education than my peers, equal or better skills, and did work of the highest quality.</p> <p>The physical world is harsh. I’m by all means a member of the privileged class in America by race, gender, and sexual orientation — yet a few inches of vertical height is all it took to diminish the value of my work.</p> <p>At least they paid me.</p> <hr /> <p>About the same time, I started to get into Ruby on Rails. I wasn’t really the most brilliant programmer or designer, but I could get stuff done. I was invited to hang out in the <code class="highlighter-rouge">#caboose</code> IRC channel. There aren’t any avatars in IRC. No faces. No names. Just usernames and words.</p> <p>I ended up making a lot of friends through caboose. Friends I still have today. Friends I’ve worked with, friends I haven’t worked with. Friends who never saw my face or knew my age for almost half a decade. It just wasn’t important.</p> <p>We were working on code, on Photoshop documents — pixels. The pixels didn’t care what we looked like. Over time we grew to respect each other. Not because of how handsome we were, but because of the things we built.</p> <p>In a strange sense, it was a bit of a utopian work environment. How could the internet know you were gay? 80 years old? Hispanic? Transgender? Karl Rove? It just didn’t matter. Respect was earned through actions and the words you actually said (hard to squeeze rumor out of publicly logged chat).</p> <p>It took me until early 2009 for me to realize the real value of this network. I was miserable at my job and I sent a long-winded email to <a href="">court3nay</a> inquiring about working with <a href="">ENTP</a>. ENTP was a half-product, half-consulting agency at this point comprised almost solely of caboosers. All of whom had never met me or ever heard my voice. About 30 seconds later I got a response:</p> <blockquote> <p>Hey Kyle,</p> <p>That’s pretty fuckin awesome, if you’ll pardon my french.</p> <p>We’re just heading out to breakfast, I mean, an important company meeting, but I’ll get back to you today.</p> <p>Courtenay & Rick</p> </blockquote> <p>And then a follow up:</p> <blockquote> <p>OK, I’ve talked it over with everyone (unanimous– “kyle? awesome!”)<br /> I think you’ll fit into our team perfectly.</p> </blockquote> <p>No in person interview. No phone calls. No technical test. They were confident enough in my pixels to give me what equated to my dream job at that point in my life.</p> <p>Really fucking crazy.</p> <hr /> <p>This industry we work in is magical. For the first time in human history, it’s possible to be represented (almost) solely through the merits of your work. Build something magical, push it up to <a href="">GitHub</a> under a pseudonym, and you could become one of the most sought after programmers in the world.</p> <p>That’s really fucking awesome.</p> <p>There’s plenty of prejudice and intolerance in our world — and in our industry. But never forget that <strong>pixels don’t care</strong>.</p> <img src="" height="1" width="1" alt=""/> Patent reasoning 2013-01-04T00:00:00+00:00 <p>Software patents are incredibly difficult to enforce.</p> <p>As software becomes more complex, patents become more difficult to decipher. Only expert software engineers can truly understand the intended meaning of modern software patents.</p> <p>As the total number of software patents increase over time, legislation and litigation of software patents become more complex. Only expert lawyers can successfully litigate patents.</p> <p>Very few expert lawyers are also expert software engineers.</p> <h2 id="big-software-vs-small-software">Big Software vs small software</h2> <p>It’s generally understood that the benefit of software patents is to ensure mutually assured destruction amongst competitors. If a competitor sues you over a patent, you countersue with your own patents.</p> <p>The majority of software companies are small compared to Big Software — companies like IBM, Google, and Apple. Small software competes directly with Big Software.</p> <p>In a race for patents, it is impossible for a small software company to catch up to the breadth of patents of a Big Software company. Big Software have large patent portfolios and can continue to create patents at the same (or faster) rate than small software.</p> <p>It is not feasible for a small software company to generate a more effective patent portfolio than a Big Software company.</p> <h2 id="patent-trolls">Patent trolls</h2> <p>Patent portfolios are known to be ineffective against patent trolls. Patent trolls are small companies or individuals who own very few unused patents (often one) and sue companies hoping for a large payout.</p> <p>Mutually assured destruction does not apply since the individual has nothing to lose.</p> <h2 id="lawyers">Lawyers</h2> <p>Lawyers make a lot of money off patents.</p> <p>They make money advising companies on patents. They make money creating them. They make money legislating them. They make money litigating them. Lawyers win on both sides during patent disputes.</p> <p>It costs software companies time and money to create and manage patents. Time and money not spent on products.</p> <p>There isn’t a single downside to patents from a lawyer’s perspective. They create a dependency system that benefits lawyers.</p> <h2 id="an-obvious-conclusion">An obvious conclusion</h2> <p>I’ve yet to see a single argument that software patents benefit small software companies in any way.</p> <p>The US Patent Office is <a href="">holding a series of round table discussions about software patents</a>. I encourage you to participate.</p> <img src="" height="1" width="1" alt=""/> Jigsaws are better 2012-12-09T00:00:00+00:00 <p>On the subject of repair scheduling:</p> <blockquote> ?</p> </blockquote> <p>Great article on systems design. The system is more efficient and it makes customers happier. The end result is even simpler than it started:</p> <blockquote> <p>We ask the customer when they want us to turn up and we give operatives all the time and materials they need to complete the right fix.</p> </blockquote> <p>Love it.</p> <img src="" height="1" width="1" alt=""/> Dumb software 2012-12-03T00:00:00+00:00 <p>There is a beauty to dumb software. These things like HTML, CSS and JavaScript. Things like Unix, C and SQL. Plain text files, email, and GIFs. They’re fun to work with. They always work. There’s no caveats. I just love them so damn much.</p> <p>But wait until you see the light! Software today is intelligent! Asynchronous front ends generated from esoteric scripting languages running on clusters of distributed virtual machines around the globe! Death to repetition! It’s more productive! It’s scalable! It’s fault tolerant!</p> <p>I followed the light and it only ended in darkness.</p> <hr /> <p>Intelligent systems have dark corners. Why didn’t it work this time? It’s hard to see everything. I’m not sure what it’s doing. This is impossible! Is there even a bug, or have I simply lost my mind?</p> <blockquote class="twitter-tweet tw-align-center"><p>The problem with ARC is it's hard to verify the difference between you losing your mind and an ARC bug.</p>— Josh Abernathy (@joshaber) <a href="" data-December 1, 2012</a></blockquote> <script src="//platform.twitter.com/widgets.js" charset="utf-8"></script> <p>Dumb systems are obvious. It’s obviously doing something dumb — too much work, too inflexible. But the work is predictable. It’s obviously doing too much work. I can see everything.</p> <p>Dumb software can do great things. It put humankind on the Moon. <a href="">It got us to Mars</a>. To me, it feels like the dumber the software, the more it accomplishes.</p> <p>I want to create great things. And sometimes it just feels right to build a simple little static website with HTML, CSS, and JavaScript.</p> <img src="" height="1" width="1" alt=""/> Pace 2012-08-02T00:00:00+00:00 <p>American service constantly presses on its diners. Can I show you to your seat? Here’s some menus. How’s the meal? Would you like the check?</p> <p><em>Would you like the check?</em> American servers always ask you if you’d like the check. Sometimes they’ll even bring you the check before you’re done eating.</p> <p>It’s all about turning tables. More tables, more tips (it’s not all greedy — servers are paid less and rely on tips as part of their salary in America). And diners have places to go and people to see, right?</p> <p>The pace of meals in America is a reflection of this service style. People come in for dinner, eat, and leave.</p> <hr /> <p>Many European cities have a different view on service — a very opt-in style. It would be rude for your server to ask if you’d like the check. It’s up to you when you want to leave.</p> <p>In Barcelona, once you’re done with the meal your server comes by to take your plates away and asks if you’d like some coffee. Encouraging you to stick around and enjoy the surroundings.</p> <p>The pace follows. Meals last longer. More conversation, more time at the table. There’s no pressure to move on to the next item on your task list.</p> <p>A lot of people I talk to label this change of pace as “european cafe culture”. But I think it’s really just a culture of people comfortable staying at restaurants without eating/drinking something as fast as possible.</p> <hr /> <p>A few weeks ago I was in Barcelona taking a break from life. At one point, my friend was sketching out a tattoo and I was reading while we enjoyed an after lunch coffee. We were both doing things I often hear people say they <em>wish they had more time</em> to do.</p> <p>I hate that phrase. We all have the same amount of time. We choose how to spend it.</p> <p><strong>Pace.</strong> I want to spend more time conscious of the pace of my life.</p> <img src="" height="1" width="1" alt=""/> Peepcode Play by Play 2012-05-16T00:00:00+00:00 <p>I sat down for a while with the excellent PeepCode folks and recorded a Play by Play — a real time video of me solving a design problem. A bit terrifying, a bit fun. Check it out if you’d like to see me bumble around.</p> <img src="" height="1" width="1" alt=""/> Choose Your Adventure! slides 2012-04-28T00:00:00+00:00 <p>Slides from my presentation I gave at Úll - <em>Choose Your Adventure!</em></p> <img src="" height="1" width="1" alt=""/> Knyle Style Sheets 2011-12-05T00:00:00+00:00 <p>So I’ve been writing CSS for somewhere around 13 years now. Some might think I’ve learned the right way to write CSS in that time — but if you ask me all I’ve learned is the most efficient way to drive someone insane.</p> <p.</p> <h2 id="maintainability-comes-from-shared-understanding">Maintainability comes from shared understanding</h2> <p>It’s hard to define maintainability. In my eyes it has to do with creating a <em>shared understanding</em>. Anyone who has owned an aircooled Volkswagen knows how to adjust valves on any other aircooled Volkswagen. This is because of one of the best technical books ever written: <a href="">How to Keep Your Volkswagen Alive</a>.</p> <p>Everyone I know who owned a Bug, Bus, Ghia or Thing owns a copy of this book and <em>understands</em> how to work on their car. This book is in large part responsible for that shared understanding.</p> <p>How can we create a shared understanding with CSS?</p> <h2 id="documentation">Documentation</h2> <p>For all of the talk of <a href="">Object Oriented CSS</a>, <a href="">SMACSS</a> and pre-processors like <a href="">SASS/SCSS</a> & <a href="">LESS</a>… no one is talking about documentation.</p> <p>Documentation is the key to shared understanding.</p> <h2 id="enter-kss">Enter KSS</h2> <p>Inspired by <a href="">TomDoc</a>, <a href="">KSS</a>.</p> <p>I’ve created a <a href="">specification</a> for KSS as well as a <a href="">ruby gem</a> to parse the documentation.</p> <p>In a nutshell, KSS looks like this:</p> <figure class="highlight"><pre><code class="language-css" data-<span class="c">/*. */</span> <span class="nt">a</span><span class="nc">.button.star</span><span class="p">{</span> <span class="err">...</span> <span class="p">}</span> <span class="nt">a</span><span class="nc">.button.star.stars-given</span><span class="p">{</span> <span class="err">...</span> <span class="p">}</span> <span class="nt">a</span><span class="nc">.button.star.disabled</span><span class="p">{</span> <span class="err">...</span> <span class="p">}</span></code></pre></figure> <p>The idea is to write simple, yet machine parseable documentation such that you can automatically create a living styleguide like this one:</p> <div class="figure"> <a href=""> <img src="" alt="Styleguide screencapture" /> </a> </div> <h2 id="kss-aims-to-create-a-shared-understanding">KSS aims to create a shared understanding</h2> <p.</p> <p>And well. I think that’s an important idea. Hope you like it.</p> <p><a href=""></a></p> <img src="" height="1" width="1" alt=""/> Knyle style recruiting 2011-11-07T00:00:00+00:00 <p>Otherwise known as Kyle Neath’s guide to hiring the best people in the world: an examination into why recruiters are useless piles of humanflesh hellbent on destroying the souls of good designers and developers across the world.</p> <p.</p> <h2 id="employees-are-the-best-recruiters">Employees are the best recruiters</h2> <p>At its core, the idea of a recruiter never made sense. Are they going to be working with their hire? Are they a designer, developer, copywriter or someone who knows what kind of skills and personality traits to look for?</p> <p>No. They’re salespeople. And I bet they’re great at hiring other salespeople.</p> <p?</p> <h2 id="how-i-hire-people">How I hire people</h2> <p>I happen to think I’ve become pretty good at recruiting over the years. We’ve built a pretty <a href="">amazing team</a> at GitHub, and I’d like to explain how I go about finding the next GitHubber.</p> <h3 id="friendship">Friendship</h3> <p.</p> <h3 id="research">Research</h3> <p>Take time to look up potential hires online. If you’re hiring in the tech industry, they’re almost certain to have an internet presence. Look up their current job. See what they do. Take a look on <a href="">dribbble</a>, browse their code on <a href="">GitHub</a> — look at their work. More often than not, it’s completely unnecessary to interview for skills. You can find that out with a half hour online. Who knows, you might even find <a href="">someone new to hire</a> in the process.</p> <p>Research is the proper tool to <strong>understand whether someone has the skills to work for you</strong>.</p> <h3 id="grab-a-beer">Grab a beer</h3> <p>It’s vitally important that you sit down face to face and <a href="">grab a beer</a> with every potential hire. Or sit down for dinner. Smoke a joint. I don’t care what it is — you need to sit down in a relaxed environment and figure out what kind of person they are.</p> <p>Talk about their family, friends, hobbies, current job, dream job — anything you can think of. Some good things to figure out:</p> <ul> <li>Is this person a good human?</li> <li>Do they have a drive to build good things?</li> <li>Do <em>they</em> want to work on the things <em>you</em> want them to?</li> </ul> <p>Grabbing a beer will help you figure out if <strong>someone will fit in.</strong></p> <h3 id="job-boards-twitter-and-advertising">Job boards, Twitter, and advertising</h3> <p>I always try and use my personal connections to find potential hires first, but sometimes I come up empty handed. When that fails, you need to stretch out and get some new blood. There’s no shortage of Job boards out there: <a href="">GitHub Jobs</a>, <a href="">Dribbble</a>, <a href="">37Signals</a>, <a href="">Authentic Jobs</a> — the list goes on. Pick a few and post some ads. Maybe sponsor a <a href="">local meetup</a>.</p> <p>But remember you’re posting an <strong>advertisement.</strong> This isn’t a fact sheet. Make that shit sexy. Make potential hires read it and think <em>I want that job.</em> Explain specifically what they’ll be doing day to day, what they’ll be responsible for, and who they’ll be working with. Explain what your company is. Explain what it is your company wants to do.</p> <p>And if you have anything listed under requirements, you better damn well mean it. Don’t ask for a college degree if you don’t actually <em>require</em> it. That’s just dumb.</p> <h2 id="credit-where-credit-is-due">Credit where credit is due</h2> <p>These ideas aren’t exactly unique, and in fact they’re really not even mine.</p> <p>In 2004 I was working for an agency and we hired a full time recruiter. Props to that man for showing me just how incompetent recruiters can be. Never in my life did I think someone would create a MySpace account and contact every teenager in the city trolling for leads. He really redefined the phrase <em>unqualified candidate</em>.</p> <p>In 2009 I started working with <a href="">Chris</a>, <a href="">Tom</a> and <a href="">PJ</a>. For every person that thinks GitHub’s success is due to luck — I want to remind you how important the <em>people</em> are in a successful company. And these guys spend a lot of time making sure we have the right people.</p> <ul> <li><a href="">How to meet your next cofounder</a></li> <li><a href="">Getting a job with open source</a></li> </ul> <p>Spend time on recruiting: it’s important.</p> <img src="" height="1" width="1" alt=""/> Mustache, ERB and the future of templating 2011-10-17T00:00:00+00:00 <p>There.</p> <p>So when I say that <a href="">{{ mustache }}</a> is my favorite templating language I’ve ever worked with, I mean it with a great deal of sincerity and experience. It’s syntactically elegant, focused on output (HTML), encourages documentation, and discourages unmaintainable magic. I want to use it everywhere.</p> <h2 id="i-mustache-you-why-mustache">I mustache you, why mustache?</h2> <div class="figure"><img src="" alt=-"Mustache - Logic-less template" /></div> <p>Mustache is more than a syntax. It’s a different approach to traditional templating — mustache templates have no logic. The template files themselves are HTML and mustaches:</p> <div class="highlight"><pre><code class="html"><div class="line" id="LC1"><span class="nt"><table</span> <span class="na">class=</span><span class="s">"devlist"</span><span class="nt">></span></div><div class="line" id="LC2"> <span class="cp">{{</span><span class="cp">#</span><span class="nv">developers</span><span class="cp">}}</span></div><div class="line" id="LC3"> <span class="nt"><tr></span></div><div class="line" id="LC4"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"name"</span><span class="nt">></span></div><div class="line" id="LC5"> <span class="nt"><h4><a</span> <span class="na">href=</span><span class="s">"</span><span class="cp">{{</span> <span class="nv">show_url</span> <span class="cp">}}</span><span class="s">"</span><span class="nt">></span><span class="cp">{{</span> <span class="nv">name</span> <span class="cp">}}</span><span class="nt"></a></span> <span class="nt"><em></span>(<span class="cp">{{</span> <span class="nv">github_username</span> <span class="cp">}}</span>)<span class="nt"></em></h4></span></div><div class="line" id="LC6"> <span class="nt"><p</span> <span class="na">class=</span><span class="s">"languages"</span><span class="nt">></span><span class="cp">{{</span> <span class="nv">languages</span> <span class="cp">}}</span><span class="nt"></p></span></div><div class="line" id="LC7"> <span class="nt"></td></span></div><div class="line" id="LC8"> <span class="nt"><td</span> <span class="na">class=</span><span class="s">"location"</span><span class="nt">></span><span class="cp">{{</span> <span class="nv">location</span> <span class="cp">}}</span><span class="nt"></td></span></div><div class="line" id="LC9"> <span class="nt"></tr></span></div><div class="line" id="LC10"> <span class="cp">{{</span><span class="o">/</span><span class="nv">developers</span><span class="cp">}}</span></div><div class="line" id="LC11"><span class="nt"></table></span></div></code></pre></div> <p>You cannot modify variables. You cannot apply filters. You can only output variables or a collection of variables. Everything else happens inside of a <em>view</em>. A view can be written in any language of your choosing: C, Objective-C, Ruby, Python, Javascript, etc. I’ll use Ruby since that’s what we use:</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">module</span> <span class="nn">Jobs</span> <span class="k">module</span> <span class="nn">Views</span> <span class="k">class</span> <span class="nc">Developers</span> <span class="o"><</span> <span class="no">Layout</span> <span class="k">def</span> <span class="nf">developers</span> <span class="vi">@results</span><span class="p">.</span><span class="nf">entries</span><span class="p">.</span><span class="nf">map</span> <span class="k">do</span> <span class="o">|</span><span class="n">hit</span><span class="o">|</span> <span class="nb">name</span> <span class="o">=</span> <span class="n">hit</span><span class="p">[</span><span class="s2">"fullname"</span><span class="p">].</span><span class="nf">empty?</span> <span class="p">?</span> <span class="n">hit</span><span class="p">[</span><span class="s2">"username"</span><span class="p">].</span><span class="nf">capitalize</span> <span class="p">:</span> <span class="n">hit</span><span class="p">[</span><span class="s2">"fullname"</span><span class="p">]</span> <span class="p">{</span> <span class="ss">:name</span> <span class="o">=></span> <span class="nb">name</span><span class="p">,</span> <span class="ss">:github_username</span> <span class="o">=></span> <span class="n">hit</span><span class="p">[</span><span class="s2">"username"</span><span class="p">],</span> <span class="ss">:location</span> <span class="o">=></span> <span class="n">hit</span><span class="p">[</span><span class="s2">"location"</span><span class="p">],</span> <span class="ss">:show_url</span> <span class="o">=></span> <span class="s1">'/developers/'</span> <span class="o">+</span> <span class="n">hit</span><span class="p">[</span><span class="s2">"username"</span><span class="p">],</span> <span class="ss">:languages</span> <span class="o">=></span> <span class="n">hit</span><span class="p">[</span><span class="s2">"language"</span><span class="p">]</span> <span class="p">}</span> <span class="k">end</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">developers_count</span> <span class="vi">@results</span><span class="p">.</span><span class="nf">total_hits</span> <span class="k">rescue</span> <span class="mi">0</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span></code></pre></figure> <p).</p> <p>I thought I loved Mustache a year ago, but over time I’ve learned just how revolutionary separating templates from views is toward maintainability and collaboration. Anyone who knows HTML can edit Mustache templates. And all the magic that happens on the whole <strong>V</strong> side of MVC can be fully documented and separated into re-usable Ruby classes and modules.</p> <h2 id="you-want-me-to-switch-templating-languages-on-my-legacy-app">You want me to switch templating languages on my legacy app?</h2> <p>For all this talk, the application I spend most of my time working on is still ERB. In fact, the rails app that powers <a href="">GitHub</a> has over <strong>500 erb templates</strong>. We have dozens of people throwing hundreds of commits a day at the codebase in over <strong>150 branches</strong>. Switching to Mustache would be a disaster requiring everyone to stop development, switch patterns, and introduce an unknown number of bugs to our customers. A shitty trade.</p> <p>I don’t want to stop new feature development, but I do want better templates. And I know that Mustache is the direction I’d like to go. Luckily for me, I work with the smartest people in the world. A little while ago <a href="">Simon</a> introduced a new templating strategy that I really like.</p> <h2 id="mustache-style-erb-templates">Mustache-style ERB templates</h2> <p>We’ve started using the mustache style but completely within ERB — we haven’t modified the template rendering chain at all. Inside of a new helper, we’ll create a view class:</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">module</span> <span class="nn">NavigationHelper</span> <span class="k">class</span> <span class="nc">RepositoryNavigationView</span> <span class="kp">include</span> <span class="no">ActionView</span><span class="o">::</span><span class="no">Helpers</span><span class="o">::</span><span class="no">NumberHelper</span> <span class="nb">attr_reader</span> <span class="ss">:current_user</span><span class="p">,</span> <span class="ss">:current_repository</span> <span class="k">def</span> <span class="nf">initialize</span><span class="p">(</span><span class="n">user</span><span class="p">,</span> <span class="n">repo</span><span class="p">)</span> <span class="vi">@current_user</span> <span class="o">=</span> <span class="n">user</span> <span class="vi">@current_repository</span> <span class="o">=</span> <span class="n">repo</span> <span class="k">end</span> <span class="c1"># What symbols should we trigger highlighting for various tabs?</span> <span class="c1">#</span> <span class="c1"># Returns an array of symbols.</span> <span class="k">def</span> <span class="nf">highlights_for_code</span> <span class="p">[</span><span class="ss">:repo_source</span><span class="p">,</span> <span class="ss">:repo_downloads</span><span class="p">,</span> <span class="ss">:repo_commits</span><span class="p">,</span> <span class="ss">:repo_tags</span><span class="p">,</span> <span class="ss">:repo_branches</span><span class="p">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">highlights_for_pulls</span> <span class="p">[</span><span class="ss">:repo_pulls</span><span class="p">]</span> <span class="k">end</span> <span class="k">def</span> <span class="nf">highlights_for_issues</span> <span class="p">[</span><span class="ss">:repo_issues</span><span class="p">]</span> <span class="k">end</span> <span class="c1"># Should we show the wiki tab? We try and show it when it's useful to</span> <span class="c1"># someone using these rules:</span> <span class="c1">#</span> <span class="c1"># - Never show it if the wiki is disabled under the admin section.</span> <span class="c1"># - Show it if you have admin access to the repository</span> <span class="c1"># - Show it if there is content</span> <span class="c1">#</span> <span class="c1"># Returns true to show the tab.</span> <span class="k">def</span> <span class="nf">show_wiki?</span> <span class="k">return</span> <span class="kp">false</span> <span class="k">unless</span> <span class="n">current_repository</span><span class="p">.</span><span class="nf">has_wiki?</span> <span class="k">return</span> <span class="kp">true</span> <span class="k">if</span> <span class="n">logged_in?</span> <span class="o">&&</span> <span class="n">current_repository</span><span class="p">.</span><span class="nf">pushable_by?</span><span class="p">(</span><span class="n">current_user</span><span class="p">)</span> <span class="n">current_repository</span><span class="p">.</span><span class="nf">wiki</span><span class="p">.</span><span class="nf">page_count</span> <span class="o">></span> <span class="mi">0</span> <span class="k">end</span> <span class="k">end</span> <span class="k">end</span></code></pre></figure> <p>Nicely documented, isolated from application-wide helpers and easy to find. Inside of the <code class="highlighter-rouge">html.erb</code>, create a new instance of this view object:</p> <figure class="highlight"><pre><code class="language-erb" data-<span class="cp"><%</span> <span class="n">view</span> <span class="o">=</span> <span class="no">NavigationHelper</span><span class="o">::</span><span class="no">RepositoryNavigationView</span><span class="p">.</span><span class="nf">new</span><span class="p">(</span><span class="n">current_user</span><span class="p">,</span> <span class="n">current_repository</span><span class="p">)</span> <span class="cp">%></span> <span class="cp"><%</span> <span class="k">unless</span> <span class="vi">@omit_repository_toolbar</span> <span class="cp">%></span> <span class="nt"><ul</span> <span class="na">class=</span><span class="s">"tabs"</span><span class="nt">></span> <span class="nt"><li></span><span class="cp"><%=</span> <span class="n">selected_link_to</span> <span class="s2">"Code"</span><span class="p">,</span> <span class="n">code_path</span><span class="p">,</span> <span class="ss">:highlight</span> <span class="o">=></span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_code</span> <span class="cp">%></span><span class="nt"></li></span> <span class="nt"><li></span><span class="cp"><%=</span> <span class="n">selected_link_to</span> <span class="s2">"Network"</span><span class="p">,</span> <span class="n">network_path</span><span class="p">,</span> <span class="ss">:highlight</span> <span class="o">=></span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_network</span> <span class="cp">%></span> <span class="nt"><li></span><span class="cp"><%=</span> <span class="n">selected_link_to</span> <span class="s2">"Pull Requests"</span><span class="p">,</span> <span class="n">pull_requests_path</span><span class="p">,</span> <span class="ss">:highlight</span> <span class="o">=></span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_pulls</span> <span class="cp">%></span><span class="nt"></li></span> <span class="cp"><%</span> <span class="k">if</span> <span class="n">view</span><span class="p">.</span><span class="nf">show_issues?</span> <span class="cp">%></span> <span class="nt"><li></span><span class="cp"><%=</span> <span class="n">selected_link_to</span> <span class="s2">"Issues"</span><span class="p">,</span> <span class="n">issues_path</span><span class="p">,</span> <span class="ss">:highlight</span> <span class="o">=></span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_issues</span> <span class="cp">%></span><span class="nt"></li></span> <span class="cp"><%</span> <span class="k">end</span> <span class="cp">%></span> <span class="cp"><%</span> <span class="k">if</span> <span class="n">view</span><span class="p">.</span><span class="nf">show_wiki?</span> <span class="cp">%></span> <span class="nt"><li></span><span class="cp"><%=</span> <span class="n">selected_link_to</span> <span class="s2">"Wiki"</span><span class="p">,</span> <span class="n">wikis_path</span><span class="p">,</span> <span class="ss">:highlight</span> <span class="o">=></span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_wiki</span> <span class="cp">%></span><span class="nt"></li></span> <span class="cp"><%</span> <span class="k">end</span> <span class="cp">%></span> <span class="nt"><li></span><span class="cp"><%=</span> <span class="n">selected_link_to</span> <span class="s2">"Stats &amp; Graphs"</span><span class="p">,</span> <span class="n">graphs_path</span><span class="p">,</span> <span class="ss">:highlight</span> <span class="o">=></span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_graphs</span> <span class="cp">%></span><span class="nt"></li></span> <span class="nt"></ul></span> <span class="cp"><%=</span> <span class="n">render_subnav</span> <span class="s1">'repositories/code'</span><span class="p">,</span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_code</span> <span class="cp">%></span> <span class="cp"><%=</span> <span class="n">render_subnav</span> <span class="s1">'repositories/network'</span><span class="p">,</span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_network</span> <span class="cp">%></span> <span class="cp"><%=</span> <span class="n">render_subnav</span> <span class="s1">'repositories/graphs'</span><span class="p">,</span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_graphs</span> <span class="cp">%></span> <span class="cp"><%=</span> <span class="n">render_subnav</span> <span class="s1">'repositories/wiki'</span><span class="p">,</span> <span class="n">view</span><span class="p">.</span><span class="nf">highlights_for_wiki</span> <span class="cp">%></span> <span class="cp"><%</span> <span class="k">end</span> <span class="cp">%></span></code></pre></figure> <p>If you’re used to regular ERB templates it’s immediately obvious where this data comes from — it’s right at the top of the file! Ack the project for <code class="highlighter-rouge">RepositoryNavigationView</code> and you’ve found your view class. No magic.</p> <p>One huge advantage of this tactic is that you can still use all the same Rails/ERB shortcuts for quick prototyping. If someone doesn’t want to learn the new template strategy right away, they can use the same methods they’ve been using for years.</p> <h2 id="graceful-upgrade-path">Graceful upgrade path</h2> <p>Switching templating languages is something that needs to be done gracefully when you’re working with others. Ripping out everyone’s foundation is a recipe for unhappy developers. Rails is all about patterns, and sticking to those patterns is really important.</p> <p>This strategy allows us to slowly convert the codebase to a better documented, view/template separation that anyone who’s worked with ERB can understand. And if we choose to switch to true-and-blue Mustache some day, our code will be 80% there already.</p> <img src="" height="1" width="1" alt=""/> Brew Methods 2011-09-20T00:00:00+00:00 <p>A wonderfully simple site dedicated to the art and style of creating fine coffee. Learn how to use that Chemex properly!</p> <img src="" height="1" width="1" alt=""/> Design Hacks for the Pragmatic Minded Video 2011-09-05T00:00:00+00:00 <p>The Ruby on Ales folks got around to publishing the video of my <a href="">Design Hacks</a> talk. The audio is a little weird in the begining, but hang on — it clears up a few minutes in.</p> <img src="" height="1" width="1" alt=""/> Relentless Quality 2011-08-25T00:00:00+00:00 <p.</p> <p>Motherfucking footer spacing.</p> <p?</p> <p>But it was never about the footer spacing. It was about quality. It was about cultivating a culture of <strong>relentless quality</strong> in everything we produced.</p> <h2 id="quality-versus-the-ego">Quality versus the Ego</h2> <p>Every time Alex called me into his office and showed me a page with an extra 7 pixels of spacing my blood pressure went through the roof. I took it as a personal insult. But he wasn’t insulting me. It was about producing a quality product.</p> <p>Quality has no room for egos. Other people will have better solutions. You are going to miss things. You are going to break things. You are going to make mistakes. And people are going to point it out.</p> <p>And I think it’s okay to get upset. Take that feeling and turn it inwards. Vow to <strong>make things better</strong>. Make sure you’re always producing the best quality product you can.</p> <h2 id="move-fast-and-break-things">Move fast and break things</h2> <p>If you take a look at any of Facebook’s recruiting marketing, you’ll see a phrase repeated over and over:</p> <blockquote> <p>Move fast and break things</p> </blockquote> <p>And with good reason — the idea it embodies is fantastic. Unfortunately I see a lot of people interpreting this quote as something like this:</p> <div class="figure"><img src="" /></div> <p>It reminds me of another misinterpretation that’s always bugged me:</p> <div class="figure"><img src="" /></div> <p>Quality isn’t something to be sacrificed. Move fast and break things, <strong>then move fast and fix it.</strong> Ship early, ship often, <strong>sacrificing features, never quality.</strong></p> <p>Embrace change. Ship. Never cut corners.</p> <h2 id="quality-is-contagious">Quality is contagious</h2> <p>Which reminds me of the <a href="">broken windows theory</a>:</p> <blockquote> <p>Monitoring and maintaining urban environments in a well-ordered condition may prevent further vandalism as well as an escalation into more serious crime.</p> </blockquote> <p.</p> <p>But just as broken windows are contagious, so is a dedication to quality. Carve out a little piece of a messy codebase and clean it up. Sharpen the edges, polish the surface and make it <em>shine</em>.</p> <p>The caveat here is that you can’t half-ass quality. Dedication to “semi-quality” isn’t dedication at all. High-end design coupled with mediocre engineering can only produce a mediocre result.</p> <p.</p> <img src="" height="1" width="1" alt=""/> Deploying: Then & Now 2011-08-02T00:00:00+00:00 <p>A couple months ago I got up on stage during lightening talks at <a href="">CodeConf 2011</a> to talk about our friendly robot, <a href="">Hubot</a>.</p> <div class="figure"><img src="" /></div> <p>Inside of five minutes I logged into our Campfire room with spotty WiFi, asked Hubot a favor, and he deployed a major new feature to our site — <a href="">Issues 2.0</a>. A deploy spanning around 30 servers that changed a major feature for 800,000 users. It was pretty awesome and kind of a ridiculous thing to do.</p> <p>Rewind the clock 7 years ago and I had just landed my first steady job in the tech industry — a front end developer for a big interactive agency.</p> <p>I remember one of our clients had a static HTML website that I was in charge of maintaining. We had a 45 minute window occurring once a week where we could deploy their site.</p> <p>Once a week, I generated a list of files I’d changed since the last week so a System Administrator could FTP the files over to production. Any changes to production I needed that occurred outside that 45 minute window required manager intervention.</p> <p>Recap time.</p> <h3 id="2004">2004</h3> <ul> <li>System Administrator time required to deploy every website.</li> <li>Deploys scheduled by managers once a week.</li> <li>Manually generating lists of changed files.</li> <li>Simple deploys take 30+ minutes.</li> </ul> <h3 id="2011">2011</h3> <ul> <li>Deploying on stage for the hell of it.</li> <li>System Administrator probably drinking whiskey.</li> </ul> <p>2011 is pretty fucking awesome.</p> <p>Deployment is an art. And the style in which you deploy impacts your company culture more than you think. <strong>Deploy with style.</strong></p> <img src="" height="1" width="1" alt=""/> Designing GitHub for Mac 2011-06-28T00:00:00+00:00 <p>A few days ago we lifted the curtains on a project I’ve been deep into for a long time now: <a href="">GitHub for Mac</a>. This is the first OS X app I’ve designed and thought it might be interesting to share some of the process and things I learned throughout development.</p> <h2 id="why-should-we-build--it">Why should we build it?</h2> <p>For a long time I assumed OS X developers would see the immense market for an awesome Git application. Unfortunately for everyone involved, every OS X application that’s showed up over the years gave up and tried to turn CLI commands into buttons.</p> <div class="figure"> <img src="" alt="Screenshot of Git Tower" /> </div> <p>Clients claiming to be “simple” choose to redefine “simple” as fewer supported Git commands rather than simplifying the interaction with Git.</p> <p>It blows my mind that no one tried to do anything special. Git (and its DVCS cousins like Mercurial & Bazaar) provide an amazing platform to build next generation clients — and it’s like the entire OS X ecosystem left their imagination at home.</p> <p.</p> <h2 id="what-are-we-building">What are we building?</h2> <p>Personally, I had some big goals:</p> <ul> <li> <p>Death of the SSH key. People should be able to connect to GitHub with their GitHub username and password.</p> </li> <li> <p>Make it obvious that there <em>is</em> a distinction between remote and local. Make it clear what commits need to be pushed before others can see them.</p> </li> <li> <p>Simplify the <code class="highlighter-rouge">git fetch, pull (--rebase), push</code> interaction. Synchronize — don’t make the user figure out what they need to do to get their local commits remote and remote commits local.</p> </li> <li> <p>Fix the local/remote branching problem. Get rid of this tracking idea — interact with local or remote branches as if they were no distinction between the two.</p> </li> </ul> <p>I didn’t want to replace the command line. <strong>I wanted to build an awesome version control client.</strong> As it happens, Git is the perfect backend to do that — and GitHub is the perfect central server to collaborate.</p> <h2 id="sketches--early-ideas">Sketches & early ideas</h2> <p>The first thing we did was to start populating an internal wiki full of ideas. Lots of words, lots of sketches.</p> <div class="figure"> <a href=""><img src="" alt="My beloved sketchbook" /></a> <small>Incomprehensible pages from my Moleskine</small> </div> <div class="figure"> <a href=""><img src="" alt="Scott's mockups" /></a> <small>Scott created a bunch of mockups with Balsamiq</small> </div> <h2 id="lets-get-some-designers-on-this">Let’s get some designers on this</h2> <p>I’d been using OS X for years, but I didn’t feel comfortable designing a native app. My previous attempts at OS X design weren’t too fantastic…</p> <div class="figure"> <a href=""><img src="" alt="An abandoned design direction." /></a> </div> <p>In the end, we hired <a href="">Eddie Wilson</a> to come up with some wireframes and some comps while <a href="">Joe</a> and <a href="">Josh</a> cranked away at the Cocoa backend. His first comps were a great start, and influenced the end product tremendously.</p> <div class="figure"> <a href=""><img src="" alt="Eddie's mockup" /></a> </div> <div class="figure"> <a href=""><img src="" alt="Eddie's mockup" /></a> </div> <p.</p> <p>We sat down and had a lot of discussions about how we wanted this thing to work. <a href="">Brandon Walkin</a> helped out quite a bit, and even sketched up some wireframes & notes for us.</p> <p>Eventually we figured out what we wanted to design — but now we didn’t have anyone to design it. Eddie had since taken up other work and pretty much every Cocoa designer on the planet was inundated with work.</p> <p>In the end, I decided that GitHub for Mac was <em>the thing</em> I wanted out of GitHub, and if I wanted it to happen I’d have to take the design reins. I picked up Eddie’s comps and ran with it.</p> <h2 id="a-slow-process">A slow process</h2> <p>I tried my best to combine Eddie’s original comps with our internal feedback and match it up with a modern OS X look & feel. All in all I created 45 comps for 1.0 — each with about 5-10 unique states (with layer groups).</p> <div class="figure"> <a href=""><img src="" alt="All my mockups" /></a> </div> <p>After the first round of comps, I started writing down how I imagined everything to work.</p> <div class="figure"> <a href=""><img src="" alt="The styleguide" /></a> </div> <p>My plan was to fully flesh out this styleguide — but as it happened, <a href="">Josh</a> was able to implement my designs faster than I could explain them. Still, I think it was a good exercise to explain my thinking for the designs — if anything for my own personal benefit.</p> <h2 id="the-aesthetic">The aesthetic</h2> <p>Learning the OS X aesthetic wasn’t easy. And it probably didn’t help that I started to get serious about OS X design about the same time Lion screenshots started showing up. Like it or not, OS X app design is changing in drastic ways right now.</p> <div class="figure"> <img src="" alt="Lion screenshot" /></a> </div> <p>Scrollbars are a thing of the past. Titlebars full of clickable areas. Buttons shedding themselves of borders. Custom graphics / buttons for every app. And Helvetica everywhere!</p> <p>I tried my best to weigh this new direction with a lot of my favorite designed apps — <a href="">Twitter</a>, <a href="">Espresso</a>, <a href="">Sparrow</a>, and <a href="">Transmit</a> to name a few.</p> <div class="figure"> <a href=""><img src="" alt="1.0" /></a> <small>Tweetie style side-tabs. No title in the window, instead a breadcrumb — always promoting a one-window experience.</small> </div> <div class="figure"> <img src="" alt="Popover" /> <small>We use a lot of popovers (borrowed from iOS / XCode) rather than modal windows throughout the app.</small> </div> <div class="figure"> <img src="" alt="Sync button" /> <small>Subtle buttons in the title bar.</small> </div> <h2 id="lessons-learned">Lessons learned</h2> <p>Designing a native OS X app was definitely full of surprises. I’ve actually done quite a bit of native development before with WPF & Flex — but Cocoa is quite different.</p> <h3 id="welcome-to-2004--everything-is-a-sliced-image">Welcome to 2004 — everything is a sliced image</h3> <p>Remember web development in 2004? When you had to create pixel-perfect comps because every element on screen was an image? That’s what developing for Cocoa is. Drawing in code is <em>slow</em> and <em>painful</em>. Images are easier to work with and result in more performant code.</p> <div class="figure"> <img src="" alt="All of the slices" /> <small>Remember these days?</small> </div> <p>This meant my Photoshop files had to be a <em>lot</em>.</p> <h3 id="change-is-painful">Change is painful</h3> <p>Want to move an element from the bottom of the screen to the top? A lot of times with Cocoa this involves rewriting your entire view. There is <em>no layout engine</em> for Cocoa. If you want two elements to rest side to side, you’ll need to calculate the pixel size of the text, padding, borders, margins — then manually position the next element.</p> <div class="figure"> <img src="" alt="A typical xib file" /> <small>What about Interface Builder? Pretty useless. Everything is a blue box on complex projects.</small> </div> <p>Want to change the background color of a button? You’re probably going to have to rewrite all of the drawing code for the button. There is no styling engine in Cocoa.</p> <p>This sucks. And it means that change is insanely painful in code. It’s much easier to prototype with HTML / CSS and see if the design is going to hold up.</p> <p><a href="">This proposed changes redesign</a> is a good example of what I mean. I spent a long time creating a “clickable” prototype with animations. In the end, we decided a lot of the core ideas were wrong and decided not to go down that path. Creating this HTML/CSS/JS prototype took a couple days. Doing the same in code would have taken a lot longer — and been <em>much</em> harder to throw away (due to the way project files work in Xcode, branching is not simple).</p> <h3 id="objective-c-is-easy-cocoa-is-hard">Objective-C is easy, Cocoa is hard</h3> <p>This was the first serious Cocoa project I’ve been involved with. I had dozens of little example projects, but never pushed through to ship anything. As I went on and talked to people about my frustrations, they inevitably came up with the same response:</p> <blockquote> <p>Why don’t you just use MacRuby?</p> </blockquote> <p>Why? Because <strong>Objective-C is really easy.</strong> The language was never a problem. You know what was? Cocoa. Learning the differences between layer-backed views, layer-hosted views — understanding that you have to subclass <em>everything</em> — balancing delegates, weak connections, strong connections, KVC, view controllers, and notifications — understanding little intricacies like how AppKit flips <code class="highlighter-rouge">.xib</code>s when it load them up or how hard it is to make one word in a sentence bold. I’m not going to lie: Cocoa (that is: AppKit, UIKit, Core Text, Core Animation, etc) is extremely difficult. The gap between simple example apps and a fully functional application is huge.</p> <p>Projects like <a href="">Chameleon</a> that give you a purely layer-backed environment to work with using a modern API (UIKit) matter <em>far</em> more than the language you’re using. This isn’t to say MacRuby isn’t awesome — it just means that it doesn’t make AppKit development any easier; you still have to learn Cocoa.</p> <p>Along those same lines, I think that <strong>Cocoa is dying for a framework.</strong> Something that weighs on the simple defaults side rather than complex code generation side.</p> <h3 id="secrecy-is-overrated">Secrecy is overrated</h3> <p>GitHub for Mac was in development for just under a year and there was never any leaked screenshots or blog posts. In fact, there were dozens of <a href="">public</a> <a href="">screenshots</a> of the <a href="">app</a> on dribbble — but for the most part, people were surprised when we launched.</p> <p>We didn’t have beta testers sign NDAs or demand first-borns to get access to the early builds. How on earth did we keep something under wraps for so long?</p> <p>We asked people politely not to share it with the world. It’s really not that hard. Don’t send betas to douchebags. Politely ask people not to blog about it. Done.</p> <h2 id="heres-to-a-bright-future">Here’s to a bright future</h2> <p>I’m hoping that GitHub for Mac (and supporting projects, like <a href="">libgit2</a>) spurs a new round of creativity in source control clients. I’ve already seen some progress — like <a href="">legit</a> — but I’m hoping to see a new generation of source control clients in the future. Git is immensely powerful, and it’s up to us to leverage that power into something awesome.</p> <img src="" height="1" width="1" alt=""/> Excellent embedding markup 2011-06-15T00:00:00+00:00 <p>I was playing around with Twitter’s new Follow Button and I couldn’t help but notice that the embedding markup is some of the best I’ve ever seen.</p> <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code><a href="" class="twitter-follow-button" data-Follow @kneath</a> <script src="" type="text/javascript"></script> </code></pre></div></div> <p>I love the idea of using regular HTML with feature-flags in <code class="highlighter-rouge">data</code> attributes combined with a common script. Can’t wait to play around with this style on <a href="">Gist</a>.</p> <img src="" height="1" width="1" alt=""/> Build your business around an idea 2011-06-14T00:00:00+00:00 <p>Living in San Francisco and working in tech right now is absolutely insane. Employers and recruiters battle for employees while VCs rain down millions of dollars <a href="">without meeting founders or even knowing what kind of company they’re building</a>. It’s a crazy world to live in and can feel like money <em>is</em> growing on trees and the only spending limit is your imagination. If you have just a little bit of initiative, you can take any idea and start a company with absolutely zero personal risk.</p> <p>And that’s one of the biggest reasons San Francisco is so special to me. Everyone out here <em>knows</em>.</p> <p>This city does burn through money on terrible ideas. But that’s a tradeoff for fostering a city of people who believe they can do anything. And that spawns an incredible number of amazing companies — so it doesn’t bother me. What does bother me is the <em>lack of imagination</em> most startup founders have.</p> <h2 id="build-something-incredible">Build something incredible</h2> <p>Most founders I talk to are pretty complacent building something mediocre. They won’t admit if you flat out ask them — but try pressing them to describe what makes their company special. Most cop out and give you an answer like:</p> <blockquote> <p>We’re building [technology x] because [company y] hasn’t built it and [people z] need it.</p> </blockquote> <p>Want a more concrete example? How about something like:</p> <blockquote> <p>We’re building a cloud sync solution for iOS because Apple hasn’t built it and almost every iOS application needs sync.</p> </blockquote> <p>There are thousands of people building products like this. They’re filling holes. Filling holes is mediocre and boring. Dare to build something incredible – something unique, something lasting, something special.</p> <h2 id="ideas-are-lasting-products-are-not">Ideas are lasting, products are not</h2> <p>The easiest way to build something incredible is to base your business around an idea. Products are just the manifestation of the idea.</p> <p>This is something I think about at GitHub a lot. We’ve built an amazing product (<a href="">github.com</a>) — but when you ask us what the <a href="">company is about</a> we say:</p> <blockquote> <p>We make it easier to collaborate with others and share your projects with the universe.</p> </blockquote> <p>There’s a lot of interesting things you <em>don’t</em>.</p> <p.</p> <p.</p> <h2 id="ideas-are-sexy">Ideas are sexy</h2> <p.</p> <p.</p> <h2 id="evolving-ideas-from-products">Evolving ideas from products</h2> <p>The trouble is that founding a company around an idea doesn’t actually work. Apple <del>Computer</del> is a great example. They take bleeding edge technology, marry it with exceptional design, and sell it at a premium price. But the company wasn’t always like that. It was founded around a product — the personal computer. Yet in 2011, Apple’s biggest business is mobile phones.</p> <p>You have to ask… how did a company founded around building personal computers come to generate most of its revenue from mobile phones? They <em>evolved</em>. They found their strengths (design, technology), and evolved the company around those values. This manifested itself into new products — the iPod, iPhone, iPad, TV, MobileMe, Airport Expresses, Cinema Displays, etc. Some successes. Some failures.</p> <p>The core component of all these products is that they are manifestations of an idea. When the iPod took off in popularity, Apple didn’t rearrange the company around portable music devices. They kept focusing on building exceptionally designed hi-tech gadgets with bleeding edge technology.</p> <p.</p> <img src="" height="1" width="1" alt=""/> Infinite Scroll + HTML5 History API 2011-05-31T00:00:00+00:00 <p>Something I’ve been meaning to do for a while — here’s a little experiment using the HTML5 History API and infinite scrolling to kill off “next page” links and still maintain real URLs that persist across page views.</p> <p>In my perfect world, this is how Twitter, Facebook and Tumblr’s infinite scrolling would work.</p> <img src="" height="1" width="1" alt=""/> Product design at GitHub 2011-03-30T00:00:00+00:00 <p.</p> <p>I should warn you that I am not a “Product Designer.” We don’t have titles at GitHub — we let employees pick their own. I like to call myself <strong>~designer</strong>…</p> <h2 id="everyone-is-a-product-designer">Everyone is a product designer</h2> <p.</p> <p?</p> <p>Along these lines, my two favorite questions to ask in an interview (or to people who don’t know they’re interviewing) are:</p> <ol> <li>What would you like to see in GitHub?</li> <li>What feature do you think we messed up / should remove?</li> </ol> <p>It brings out the passion in people and instantly highlights problems you might have with their decisions. Some people just don’t have the same vision for your product as you do, and that’s fine.</p> <h2 id="write-down-ideas-like-crazy">Write down ideas like crazy</h2> <p>Our internal wiki is filled with ideas. Old ideas. Bad ideas. Good ideas. Half-baked ideas. The point is that we have a place to share our crazy with each other. <a href="">This wiki page</a> discussing compare view eventually became <a href="">Pull Requests 2.0</a> — arguably the best code review tool I’ve ever used.</p> <p.</p> <h2 id="constantly-experiment-and-iterate">Constantly experiment and iterate</h2> <p>Right now our main repository has 65 branches. This doesn’t count the dozen or so other repositories that collectively represent what is <a href=""></a> or the 139 repositories under our organization. Needless to say, there are a ton of features, anti-features and half ideas in these branches. Sometimes they’re really pretty features that aren’t functional and sometimes they’re really ugly features that are completely functional.</p> <p.</p> .</p> <p>On that note, our pull requests are generally pretty <em>epic</em>. It turns out that pull requests are perfect for experimenting with new features, discussing them with the team, and getting others to help you ship. <a href="">Check out this pull request</a> for shipping our org profiles. (Funny anectdote: this pull request was created before we shipped pull requests 2.0 — we <em>constantly</em> use experimental features)</p> <h2 id="abandon-features">Abandon features</h2> <p.</p> <p>The first version of <a href=""><.</p> <p>Shipping features because you spent time or money on them is a coward’s excuse. It takes balls to abandon features — grow some.</p> <h2 id="argue-all-the-time">Argue all the time</h2> <p?</p> <p.</p> <h2 id="talk-to-your-customers">Talk to your customers</h2> <p>I spend a good portion of my day reading through our <a href="">support site</a>, mailing lists, twitter feeds, and blog posts written about git and GitHub. Listening to your customers is supremely important — they’re full of great ideas. They’re also full of shockingly terrible ideas. As <a href="">Tom</a> puts it:</p> <blockquote> <p>Don’t give your customers what they ask for; give them what they want.</p> </blockquote> <p>We also spend a lot of <em>physical</em>.</p> <h2 id="product-design-is-in-the-eye-of-the-beholder">Product design is in the eye of the beholder</h2> <p>We know that product design isn’t just adding and removing features. It’s how our customers perceive the features. Who cares if some analyst thinks your company is doing well if your customers don’t?</p> <p>Having a great blog post explaining new features is absolutely killer. It allows us to frame features in a certain light and explain our thinking. It also shows a record of shipping — and we try hard to ship and tell people about it all of the time.</p> <p>If you redesign your entire product once every two years like Twitter does, it’s a <em>big deal</em>. If your users don’t like 100% of it, they’re going to be pissed. But if you ship something every two months and they don’t like 10% of it — their overall perception is still positive.</p> <p>We also know that what we <em>don’t</em> do is just as important as what we <em>are</em> doing. We don’t publish roadmaps or promise features within a timeframe — we <a href="">under promise and over deliver</a>. And really, I think that’s why our customers are so happy with our product design as a whole.</p> <p><strong>Don’t give your customers what they ask for, give them what they want. Under promise, over deliver.</strong></p> <img src="" height="1" width="1" alt=""/> Design hacks for the pragmatic minded 2011-03-24T00:00:00+00:00 <p>Slides and references links from my presentation I gave at Ruby on Ales - <em>Design hacks for the pragmatic minded</em>.</p> <img src="" height="1" width="1" alt=""/> Documentation is freaking awesome 2011-02-05T00:00:00+00:00 <p>Slides and references links from my presentation I gave at Magic Ruby - <em>Documentation is freaking awesome</em>. Check it out if you’re curious.</p> <img src="" height="1" width="1" alt=""/> Speaking at Magic Ruby 2011-01-04T00:00:00+00:00 <p>I’ll be giving a talk about documentation (no, not just code comments and RDoc) at Magic Ruby February 4th-5th. Oh, did I mention it’s in <strong>Disneyworld?</strong> And it’s <strong>free?</strong></p> <img src="" height="1" width="1" alt=""/> URL Design 2010-12-28T00:00:00+00:00 <p><strong>You should take time to design your URL structure.</strong> If there’s one thing I hope you remember after reading this article it’s to take time to design your URL structure. Don’t leave it up to your framework. Don’t leave it up to chance. Think about it and craft an experience.</p> <p>URL Design is a complex subject. I can’t say there are any “right” solutions — it’s much like the rest of design. There’s good URL design, there’s bad URL design, and there’s everything in between — it’s subjective.</p> <p.</p> <h2 id="why-you-need-to-be-designing-your-urls">Why you need to be designing your URLs</h2> <div class="figure"><img src="" alt="Chrome's URL bar" /></div> <p>The URL bar has become a main attraction of modern browsers. And it’s not just a simple URL bar anymore — you can type partial URLs and browsers use dark magic to seemingly conjure up exactly the full URL you were looking for. When I type in <strong><code class="highlighter-rouge">resque issues</code></strong> into my URL bar, the first result is <code class="highlighter-rouge"></code>.</p> <p>URLs are <em>universal</em>. They work in Firefox, Chrome, Safari, Internet Explorer, cURL, wget, your iPhone, Android and even written down on sticky notes. They are the one universal syntax of the web. Don’t take that for granted.</p> <p>Any regular semi-technical user of your site should be able to navigate 90% of your app based off memory of the URL structure. In order to achieve this, your URLs will need to be <em>pragmatic.</em> Almost like they were a math equation — many simple rules combined in a strategic fashion to get to the page they want.</p> <h2 id="top-level-sections-are-gold">Top level sections are gold</h2> <p.</p> <p.</p> <p>Another quick tip — whenever you’re building a new site, think about <a href="">blacklisting a set of vanity URLs</a> (and maybe learn a little bit about bad URL design from Quora’s URLs).</p> <h2 id="namespacing-is-a-great-tool-to-expand-urls">Namespacing is a great tool to expand URLs</h2> <p>Namespaces can be a great way to build up a pragmatic URL structure that’s easy to remember with continued usage. What do I mean by a namespace? I mean a portion of a URL that dictates unique content. An example:</p> <pre><code><strong>defunkt/resque</strong>/issues</code></pre> <p>In the URL above, <strong><code class="highlighter-rouge">defunkt/resque</code></strong> is the namespace. Why is this useful? Because anything after that URL suddenly becomes a new top level section. So you can go to any <strong><code class="highlighter-rouge"><user>/<repo></code></strong> and then tack on <code class="highlighter-rouge">/issues</code> or maybe <code class="highlighter-rouge">/wiki</code> and get the same page, but under a different namespace.</p> <p>Keep that namespace clean. Don’t start throwing some content under <code>/feature/<strong><user>/<repo></strong></code> and some under <code>/<strong><user>/<repo></strong>/feature</code>. For a namespace to be effective it has to be universal.</p> <h2 id="querystrings-are-great-for-filters-and-sorts">Querystrings are great for filters and sorts</h2> <p>The web has had a confused past with regards to querystrings. I’ve seen everything from every page of a site being served from one URL with different querystring parameters to sites who don’t use a single querystring parameter.</p> <p>I like to think of querystrings as the knobs of URLs — something to tweak your current view and fine tune it to your liking. That’s why they work so great for sorting and filtering actions. Stick to a uniform pattern (<code class="highlighter-rouge">sort=alpha&dir=desc</code> for instance) and you’ll make sorting and filtering via the URL bar easy and rememberable.</p> <p>One last thing regarding querystrings: The page should work without the querystrings attached. It may show a different page, but the URL without querystrings should render.</p> <h2 id="non-ascii-urls-are-terrible-for-english-sites">Non-ASCII URLs are terrible for english sites</h2> <p <code class="highlighter-rouge">xn--n3h</code> in a url? That’s a ☃).</p> <h2 id="urls-are-for-humans--not-for-search-engines">URLs are for humans — not for search engines</h2> <p>I grew up in this industry learning how to game search engines (well, Google) to make money off my affiliate sales, so I’m no stranger to the practice of keyword stuffing URLs. It was fairly common to end up with a URL like this:</p> <div class="highlighter-rouge"><div class="highlight"><pre class="highlight"><code> </code></pre></div></div> .</p> <p>Some additional points to keep in mind:</p> <ul> <li> <p>Underscores are just bad. Stick to dashes.</p> </li> <li> <p>Use short, full, and commonly known words. If a section has a dash or special character in it, the word is probably too long.</p> </li> </ul> <p>URLs are for humans. <strong>Design them for humans.</strong></p> <h2 id="a-url-is-an-agreement">A URL is an agreement</h2> <p>A URL is an agreement to serve something from a predictable location for as long as possible. Once your first visitor hits a URL you’ve implicitly entered into an agreement that if they bookmark the page or hit refresh, they’ll see the same thing.</p> <p><strong>Don’t change your URLs after they’ve been publicly launched.</strong> If you absolutely must change your URLs, add redirects — it’s not that scary.</p> <h2 id="everything-should-have-a-url">Everything should have a URL</h2> <p:</p> <ul> <li> <p><strong><code class="highlighter-rouge">onReplaceState</code></strong> — This method replaces the current URL in the browser history, leaving the back button unaffected.</p> </li> <li> <p><strong><code class="highlighter-rouge">onPushState</code></strong> - This method pushes a new URL onto the browser’s history, replacing the URL in the URL bar <em>and</em> adding it to the browser’s history stack (affecting the back button).</p> </li> </ul> <h3 id="when-to-use-onreplacestate-and-when-to-use-onpushstate">When to use <code class="highlighter-rouge">onReplaceState</code> and when to use <code class="highlighter-rouge">onPushState</code></h3> <p>These new methods allow us to change the <em>entire</em> path in the URL bar, not just the anchor element. With this new power, comes a new design responsibility — we need to craft the back button experience.</p> <p>To determine which to use, ask yourself this question: <em>Does this action produce new content or is it a different display of the same content?</em></p> <ol> <li> <p><strong>Produces new content</strong> — you should use <code class="highlighter-rouge">onPushState</code> (ex: pagination links)</p> </li> <li> <p><strong>Produces a different display of the same content</strong> — you should use <code class="highlighter-rouge">onReplaceState</code> (ex: sorting and filtering)</p> </li> </ol> <p>Use your own judgement, but these two rules should get you 80% there. Think about what you want to see when you click the back button and make it happen.</p> <h2 id="a-link-should-behave-like-a-link">A link should behave like a link</h2> <p>There’s a lot of awesome functionality built into linking elements like <code class="highlighter-rouge"><a></code> and <code class="highlighter-rouge"><button></code>. If you middle click or command-click on them they’ll open in new windows. When you hover over an <code class="highlighter-rouge"><a></code> your browser tells you the URL in the status bar. Don’t break this behavior when playing with <code class="highlighter-rouge">onReplaceState</code> and <code class="highlighter-rouge">onPushState</code>.</p> <ul> <li> <p>Embed the location of AJAX requests in the <code class="highlighter-rouge">href</code> attributes of anchor elements.</p> </li> <li> <p><code class="highlighter-rouge">return true</code> from Javascript click handlers when people middle or command click.</p> </li> </ul> <p>It’s fairly simple to do this with a quick conditional inside your click handlers. Here’s an example jQuery compatible snippet:</p> <figure class="highlight"><pre><code class="language-javascript" data-<span class="nx">$</span><span class="p">(</span><span class="s1">'a.ajaxylink'</span><span class="p">).</span><span class="nx">click</span><span class="p">(</span><span class="kd">function</span><span class="p">(</span><span class="nx">e</span><span class="p">){</span> <span class="c1">// Fallback for browser that don't support the history API</span> <span class="k">if</span> <span class="p">(</span><span class="o">!</span><span class="p">(</span><span class="s1">'replaceState'</span> <span class="k">in</span> <span class="nb">window</span><span class="p">.</span><span class="nx">history</span><span class="p">))</span> <span class="k">return</span> <span class="kc">true</span> <span class="c1">// Ensure middle, control and command clicks act normally</span> <span class="k">if</span> <span class="p">(</span><span class="nx">e</span><span class="p">.</span><span class="nx">which</span> <span class="o">==</span> <span class="mi">2</span> <span class="o">||</span> <span class="nx">e</span><span class="p">.</span><span class="nx">metaKey</span> <span class="o">||</span> <span class="nx">e</span><span class="p">.</span><span class="nx">ctrlKey</span><span class="p">){</span> <span class="k">return</span> <span class="kc">true</span> <span class="p">}</span> <span class="c1">// Do something awesome, then change the URL</span> <span class="nb">window</span><span class="p">.</span><span class="nx">history</span><span class="p">.</span><span class="nx">replaceState</span><span class="p">(</span><span class="kc">null</span><span class="p">,</span> <span class="s2">"New Title"</span><span class="p">,</span> <span class="s1">'/some/cool/url'</span><span class="p">)</span> <span class="k">return</span> <span class="kc">false</span> <span class="p">})</span></code></pre></figure> <h2 id="post-specific-urls-need-to-die">Post-specific URLs need to die</h2> <p.</p> <p>There’s no excuse for these URLs at all. Post-specific URLs are for redirects and APIs — not end-users.</p> <h2 id="a-great-example">A great example</h2> <div class="figure"><a href=""><img src="" alt="Example URL" /></a></div> <ol> <li> <p>ASCII-only user generated URL parts (defunkt, resque).</p> </li> <li> <p>“pull” is a short version of “pull request” — single word, easily associated to the origin word.</p> </li> <li> <p>The pull request number is scoped to defunkt/resque (starts at <strong>one</strong> there).</p> </li> <li> <p>Anchor points to a scrolling position, not hidden content.</p> </li> </ol> <p><strong>Bonus points:</strong> This URL has many different formats as well — check out the <a href="">patch</a> and <a href="">diff</a> versions.</p> <h2 id="the-beginning-of-an-era">The beginning of an era</h2> <p <em>much</em> more difficult to redesign the URL structure.</p> <p.</p> <img src="" height="1" width="1" alt=""/> My TextMate Snippets & Triggers 2010-08-26T00:00:00+00:00 <p>A while ago I put up a collection of some of my handcrafted TextMate snippets. mostly focused on front-end stuff: HTML shortcuts, CSS gradients, jQuery plugin bases, commenting helpers, etc.</p> <img src="" height="1" width="1" alt=""/> The Geek Talk Interview 2010-08-23T00:00:00+00:00 <p>A quick interview I did over at The Geek Talk. Mostly covering my daily routine and whatnot.</p> <img src="" height="1" width="1" alt=""/> RSS Feeds for Warpspire 2010-08-23T00:00:00+00:00 <p>I was going to try and fix some bugs in <a href="">GitHub Pages</a> (that’s how this site is hosted) — but I think I’m going to give up that fight. If you’d like to subscribe to Warpspire, you can find the feeds at <a href=""></a></p> <img src="" height="1" width="1" alt=""/> Rethinking Warpspire 2010-08-01T00:00:00+00:00 <p>I think it’s always a good idea to take a step back and ask yourself why you’re doing something. So right now I’m taking a step back to rethink Warpspire.</p> <h2 id="getting-rid-of-cruft">Getting rid of cruft</h2> <p>The other day I followed a link to a blog post on Mint. I was presented with this screen:</p> <div class="figure"><img src="" alt="Screenshot of Mint blog post" /></div> <p>I hate what most designers have done to the web. You’d think people would be taking cues from things like <a href="">Readability</a> and Safari Reader, but they’re not. People are throwing more and more crap onto each page and making things harder and harder to read.</p> <p>Anyways, it got me to thinking about sites that I continue to enjoy reading in the browser. One site that immediately came to mind is <a href="">Daring Fireball</a>..)</p> <div class="figure"><img src="" alt="Screenshot of Warpspire" /></div> <p>This new layout is the simplest layout I’ve ever had on one of my sites. The goal was to create a focused place for my ideas.</p> <h2 id="abandoning-old-baggage">Abandoning old baggage</h2> <p>There was a lot of crap on Warpspire. WordPress tells me the first post was published August 15, 2004. <strong>That’s six years ago.</strong> To say that the web is a different place now is an understatement. I remember debugging that initial site on IE5 <em>for Mac</em>. Six years ago, I was in my 2nd year of studying Civil Engineering at Cal Poly. I had no concept of the value of the web or how important it would be come. I was also twenty years old, angsty and wrong about many things.</p> <p><strong><em>So I deleted most of my posts.</em></strong></p> <p>What’s left? The most popular posts (traffic wise) along with a couple of ones that I particularly enjoyed and still felt relevant. I’ve also edited them all, and rewritten some.</p> <p>Almost certainly a bad idea for my traffic, but probably a good idea for my readership. And I’ll value readers over pageviews any day.</p> <h2 id="on-the-subject-of-comments">On the subject of comments</h2> <p>The thing about comments is that commentors tend to be a bunch of crazies wandering the internet like it’s a zombie apocolypse. It’s a striking contrast to the rational human beings whom I have sensible arguments with here in the meatspace.</p> <p.</p> <p>A comment should mean something to you and it should mean something to me. Typical blog comments just stopped meaning anything to me a long time ago and that sucks. So I’m hoping this is a move toward fixing that.</p> <img src="" height="1" width="1" alt=""/> What's your focus? 2010-03-29T00:00:00+00:00 <p.</p> <h2 id="learn-by-example-source-hosting-sites">Learn by example: source hosting sites</h2> <p>Let’s start off with a field I’m pretty familiar with: source hosting sites. I’m talking about <a href="">GitHub</a>, <a href="">BitBucket</a>, <a href="">SourceForge</a>, <a href="">Google Code</a>, <a href="">Launchpad</a> and the likes. These sites all have a common focus: <strong>sharing code.</strong> I’m going to show you why GitHub is the only site who’s design follows it’s focus.</p> <p>If your site’s focus is sharing code, the design should focus on sharing code. If you ever talk to any of us GitHubbers, we’ll always say that the site is <em>all about the code</em>. Let’s look at project landing pages in each of the above sites.</p> <h3 id="github"><a href="">GitHub</a></h3> <div class="figure"><img src="" alt="GitHub" /></div> <p>When you visit a GitHub project page, the first thing you see is the source code. Right below is the README pulled straight from the code.</p> <h3 id="bitbucket"><a href="">BitBucket</a></h3> <div class="figure"><img src="" alt="BitBucket" /></div> <p>BitBucket chose to highlight the shortlog (recent commits) on the project page. If you want to see the code, you need to go to the 3rd tab.</p> <h3 id="sourceforge"><a href="">SourceForge</a></h3> <div class="figure"><img src="" alt="SourceForge" /></div> <p>Sourceforge chose to highlight downloads (in this case, a compiled jar file — not the code) on the project page. If you want to see the code, you need to click Develop, and then fish around in the sidebar for the correct VCS and click browse.</p> <h3 id="google-code"><a href="">Google Code</a></h3> <div class="figure"><img src="" alt="Google Code" /></div> <p>Google Code chose to highlight the wiki on the project page. Getting to the code in Google Code is probably the most interesting of the bunch because many projects don’t even host their code there (example: <a href="">redis</a>).</p> <p>When you click the Source tab you actually get a wiki page which many projects use to point to another repository. <em>If</em> the project hosts it’s code there, there is a sub link under Source that is labeled Browse that you can finally see the code.</p> <h3 id="launchpad"><a href="">Launchpad</a></h3> <div class="figure"><img src="" alt="Launchpad" /></div> <p>Launchpad decided to highlight everything but the source code on the project page. If you want to see the code, there is a tiny link in the middle of the page that says ’View the branch content.’</p> <h2 id="great-examples-from-other-fields">Great examples from other fields</h2> <p>Source code hosting is just something that I’m extremely involved with. That doesn’t mean that focus is limited to code.</p> <h3 id="flickr"><a href="">Flickr</a></h3> <div class="figure"><img src="" alt="Flickr" /></div> <p>Flickr is all about sharing photos.</p> <h3 id="facebook"><a href="">Facebook</a></h3> <div class="figure"><img src="" alt="Facebook" /></div> <p>Facebook is all about connecting with your friends.</p> <h3 id="daring-fireball"><a href="">Daring Fireball</a></h3> <div class="figure"><img src="" alt="Daring Fireball" /></div> <p>Daring Fireball is all about John Gruber’s writing.</p> <h2 id="sites-that-have-lost-their-focus">Sites that have lost their focus</h2> <p>There is a huge genre of sites that seem to have completely forgotten their focus. I’ll see if you can guess the genre.</p> <h3 id="msnbc"><a href="">MSNBC</a></h3> <div class="figure"><img src="" alt="MSNBC" /></div> <h3 id="nytimes"><a href="">NYTimes</a></h3> <div class="figure"><img src="" alt="NYTimes" /></div> <h3 id="rolling-stone"><a href="">Rolling Stone</a></h3> <div class="figure"><img src="" alt="Rolling Stone" /></div> <p>It’s no wonder news sites can’t get people to pay for their content. You need to focus on your content to get people to pay for it.</p> <h2 id="charging-for-your-focus">Charging for your focus</h2> <p>Many sites don’t want to give away their focus for free. That’s perfectly fine. But it doesn’t change a thing. Replace what people are going to pay for with an opportunity to pay you.</p> <div class="figure"><img src="" alt="PeepCode" /></div> <p>PeepCode’s focus is great tutorials. But the tutorial is not the focus of the product page — instead a teaser and a purchase button are.</p> <p>Lots of people think that replacing their paid focus content with advertising is the solution — but that just redirects the focus on advertising — not getting paid.</p> <p>Premium content is not about <em>removing access</em>, it’s about <em>charging for access</em>. Don’t focus on removing content, focus on charging for it.</p> <h2 id="find-your-focus-and-focus-on-it">Find your focus and focus on it</h2> .</p> <p.</p> <img src="" height="1" width="1" alt=""/> Optimizing asset bundling and serving with Rails 2009-11-19T00:00:00+00:00 <p>I wrote up a pretty lengthy post over at the GitHub blog explaining how we do asset bundling and serving. Well worth the read for anyone who’s interested in front end performance and works on ruby apps.</p> <img src="" height="1" width="1" alt=""/> It's not about how many hours you work 2009-10-11T00:00:00+00:00 <p>My.</p> <h2 id="lets-talk-about-that-worklife-balance-thing">Let’s talk about that work/life balance thing</h2> <p?</p> .</p> <h2 id="its-about-creating-a-creative-environment-in-your-life">It’s about creating a creative environment in your life</h2> <p.</p> <h3 id="find-your-passion-in-life-and-try-to-make-money-from-it">Find your passion in life and try to make money from it</h3> .</p> <h3 id="explore-projects-that-are-explicitly-not-for-profit">Explore projects that are explicitly not for profit</h3> <p.</p> <h3 id="stop-working-if-youre-producing-crap">Stop working if you’re producing crap</h3> <p <a href="">for a year</a>.</p> <h3 id="accept-that-there-is-no-way-you-can-be-productive-for-40-hours-a-week">Accept that there is no way you can be productive for 40 hours a week</h3> <p>The 40 hour work week is completely unsustainable. Human beings are not meant to sit down and <em>really</em> focus for 40 hours a week, 50 weeks a year. Our brains can’t handle it. I’m sure startup founders will come in here exclaiming how they’ve been working 100 hour work weeks for 6 months now and every hour was well spent. They’re lying.</p> <p>Your brain <em>needs</em> to purposefully not think in order to come up with creative ideas. That might mean relaxing to your favorite book or movie while your subconscious attacks your latest project. You’re not working in the strict sense–but you’re getting work done.</p> <p>That’s not to say you can’t have weeks where you get hundreds of hours of work done. But in my experience, after a week like that, I need another week or two to decompress.</p> <h2 id="focus-on-what-matters">Focus on what matters</h2> <p>My goal with this post is to hopefully get people to stop thinking in hours. Start focusing on making great things. It’s about the things you produce, not the hours required to make them.</p> <p>Once you realize you’ve been focused on the wrong metric I think you’ll realize arguing about a work/life balance is just ridiculous. Spend time on your life. Spend time on your work. But always strive to do better. That’s all you need.</p> <img src="" height="1" width="1" alt=""/> Joining GitHub 2009-10-01T00:00:00+00:00 <p>I still feel like it was last week I decided to <a href="/features/ch-ch-ch-changes/">give up my “safe” job at <strike>Web Associates</strike> Level Studios</a> to play around with the <a href="">ENTP</a> crew. Well, it’s time for another move. Last week I was given an offer I just couldn’t refuse–to join the amazing <a href="">GitHub</a> team (<a href="">my GitHub profile</a>). For those of you who don’t know who GitHub is: shame on you. GitHub has taken something as boring as source control and made it something that <em>brings people together</em>. Social coding, indeed.</p> <h2 id="a-brief-look-at-the-past-couple-years">A brief look at the past couple years</h2> <p.</p> <h3 id="tender"><a href="">Tender</a></h3> <div class="figure"><a href=""><img src="" alt="Tender's Marketing Site" /></a></div> <p>By in large, the biggest project I worked on ENTP was <a href="">Tender</a> – <a href="">uses Tender</a> for their support, so I’ll at least get to use it and see how ENTP shapes the product.</p> <h3 id="lighthouse-iphone"><a href="">Lighthouse iPhone</a></h3> <div class="figure"><a href=""><img src="" alt="Lighthouse iPhone Screenshots" /></a></div> .</p> <h3 id="entpcom"><a href="">ENTP.com</a></h3> <div class="figure"><a href=""><img src="" alt="ENTP.com Screenshot" /></a></div> .</p> <h3 id="hoth"><a href="">Hoth</a></h3> <div class="figure"><a href=""><img src="" alt="Hoth Screenshot" /></a></div> <p>Hoth is ENTP’s blog. This design accompanied the new ENTP.com design and added in a bit of tumble-like functionality to the templates.</p> <h2 id="on-to-the-next-chapter">On to the next chapter</h2> <p.</p> <div class="figure"><a href=""><img src="" alt="OctoCat" /></a></div> <p>I’ll see ya’ll at the next GitHub drinkup.</p> <img src="" height="1" width="1" alt=""/> Installable apps 2009-05-03T00:00:00+00:00 <p>I’m getting kind of tired of all these <em>web</em> developers complaining about the time it takes to get updates to their apps up on the iTunes App Store. The truth is this complaining has some merit. But you have to realize that these people are not making <em>web</em> applications, they’re making <em>installable</em> applications. The problem is not Apple. The problem is lack of QA testing.</p> <h2 id="your-application-will-have-many-bugs">Your application will have many bugs</h2> <p>The first rule of development: your code is going to have a lot of bugs. I don’t care if you’ve got 3 days experience or 30 years experience in the industry. <strong>Your code will have bugs.</strong> This isn’t a pride issue, it’s a fact of life. Good developers know this and rely on testing (code, user-acceptance, performance) to expose bugs so they can fix them.</p> <h2 id="bugs-will-appear-after-your-code-is-deployed">Bugs will appear after your code is deployed</h2> <p.</p> <h2 id="the-web-makes-us-lazy">The web makes us lazy</h2> <p>The truth is, developing web applications makes us lazy. I can fix a bug, deploy, and it’s fixed in about 15 seconds. This is why I <em>love</em> working on hosted web applications. You’ve got such immense power over the deployment process. Some things that rock about web apps:</p> <ul> <li>You can be <em>really lazy</em> with UAT (User Acceptance Testing). Users will do your UAT for your and you can fix it on the fly.</li> <li>You can be <em>really lazy</em> with bugs that will appear after deploy. If a web service changes, you fix it and redeploy. Done.</li> <li>You only need <em>one computer</em> to test your application. No need to purchase multiple hardware platforms, video cards, or install multiple operating systems!</li> </ul> <h2 id="you-cant-be-lazy-with-installable-applications">You can’t be lazy with installable applications</h2> <p <em>tons</em> of time doing user testing on dozens of machines. And then the client did user testing. And then the client’s QA department did even more testing. And then the client’s QA department did more testing throughout the whole time they were writing hard drives.</p> <p>Remember the days when you updated applications with <em>CDs</em> or <em>floppy disks</em>? My god, for a while there it just <em>wasn’t feasible</em> to update installable applications over the internet. The end result? Software development firms spent a lot of time and money on QA. Same goes for game development companies.</p> <p>My point is: if you know that one of your restraints is updating can be slow or impossible, you <em>spend more time testing the application.</em></p> <h2 id="the-app-store-is-slow">The App Store is slow</h2> <p>It’s true the App Store is slow when it comes to delivering updates. To me, this is just a known variable. Wouldn’t it be awesome if they had 24 hour turnaround? Sure would be. But it’s one of those tradeoffs you get with a closed system. If you want to trade it for an open system – build a web application. It’s not that hard.</p> <p>I know it sucks testing your application. I know as a lone developer you don’t have the money to hire testers.</p> <p>But think of the rewards. The App Store is something of a gold rush right now. A small group of people have made obnoxious profits off very little effort. There’s almost no overhead ($100 application fee? psh) – and anyone can submit apps. It’s a shitty closed ecosystem controlled by Apple. But it’s a shitty closed ecosystem of chocolate-filled pools lined with gold and supermodels dressed in nothing but $100 bills if you strike it rich.</p> <img src="" height="1" width="1" alt=""/> Xcode window management sucks 2009-02-23T00:00:00+00:00 <div class="infobox"> <p><strong>Hi, did you come here to tell me that Xcode offers "all-in-one" editing?</strong> Please, don't send me an email. This is addressed in this article if you take time to read it.</p> </div> ?</p> <p>No, no. I’m not. It’s horrible. Just because Apple built it, does not make it perfect.</p> <h2 id="tabs-are-the-future-actually-its-been-the-standard-for-years">Tabs are the future (actually it’s been the standard for years)</h2> <p>Tabs have clearly proven themselves to be a superior method for editing multiple code files. Why? Because the most recognizable thing about code file is it’s <em>filename</em>. Not the look of the text. Let’s look at this through some examples.</p> <h3 id="case-1-window-based-management-ftw-photoshop">Case #1: Window-based management FTW, Photoshop</h3> <div class="figure"> <a href=""><img src="" /></a> <small>Example of window management in Photoshop</small> </div> <p>Window management in OSX defaults to a new window for each document. This works wonderfully for most applications when you can see the differences visually. Photoshop is a great example. Using Exposé, I can see which document I mean to be working on at a glance The <em>visual representation</em> of the document is the unique identifier.</p> <p>Some more points on why this works so well:</p> <ul> <li>Image documents are the <em>only windows</em> you will ever see in Photoshop. Everything else is a panel. This functionality is the same for all five-star document-based apps. iWork, iLife, etc. There is a really good reason Apple chose to hide panels when activating Exposé.</li> <li>Photoshop is a document immersive program. It’s unlikely you’ll be working on more than one PSD at a time. The document is all that matters. Conversely with code, the project is all that matters (not one code file).</li> </ul> <h3 id="case-2-tab-based-management-ftw-texmtate">Case #2: Tab-based management FTW, Texmtate</h3> <div class="figure"> <a href=""><img src="" /></a> <small>Example of window management in Texmate</small> </div> <p.</p> <p>Some points on why this works so well:</p> <ul> <li>Windows provide a way to group files in a meaningful manner. Each window is a unique project. Remember, the project is the important thing – when coding in Cocoa, you’ll need to edit multiple files at once to make them work with one another.</li> <li>I can quickly move between individual files via the keyboard. Considering coding is almost purely typing, keeping my hands on the keyboard is <em>killer</em>.</li> </ul> <h3 id="case-3-wtf-based-management-ftl-xcode">Case #3: WTF-based management FTL, Xcode</h3> <div class="figure"> <a href=""><img src="" /></a> <small>Example of window management in Xcode</small> </div> <p>Window management for Xcode is handled via a combination of this thing called a Project window, which morphs depending on it’s toolbar state, windows for each document, and windows for ancillary programs (like the model editor). Please note I have the same number of windows open in this screenshot as I did in Textmate (7). It’s actually a pretty small program, but completely overwhelming.</p> <p>Some points on why this doesn’t work so well:</p> <ul> <li>Windows mean different things. Some mean code documents, some mean visual aid, some mean a kind of “project” that groups all things.</li> <li>The project window continually morphs it’s state as you enter and exit debugging. It’s appearance is different, not upon your application’s state, but rather the toolbar button in the upper left, that automatically changes (one-way).</li> <li>All the code looks the same. There is no unique identifier in Exposé mode. I must selectively hover over each file and read it’s filename. Or, I can exposé to try and find the project window (which can look much like a code window too), and then open a new document.</li> <li>If I accidentally Cmd-W the Project window, I have to start from scratch, opening the whole project and each document again. This often happens as you accidentally open windows and want to immediately close them.</li> </ul> <p>Some may counter, telling me that Xcode offers editing inside the project window. Sure, this works, but offers just as many frustrations.</p> <ul> <li>You <em>must</em> single click on files to open them. Double-clicking them still opens them in a new document.</li> <li>Because of the above, and the last bullet on the previous list, I constantly find myself accidentally closing the project because I was trying to close an accidentally opened window.</li> <li>Unless I choose not to run my program, I constantly have to switch out of debug mode and back into editing mode via the toolbar.</li> <li>Every single time I open Xcode I have to force it into editor mode.</li> <li>There is a delay in single clicking a document. You click the file on the sidebar, the sidebar highlights, but the new document doesn’t open in the editing window for a second or two. When trying to scan documents for some code, this results in endless confusion.</li> <li>There’s no idea of “open files” in this mode. No context for which I’m working. I can’t say, work on the View Controllers by opening each of them. Each time I must select the unique view controller in the sidebar, ordered alphabetically.</li> </ul> <h2 id="its-a-shame">It’s a shame</h2> <p>It’s a shame, because other than the window management, Xcode is really an awesome IDE. The actual text editing is great as is debugging, scriptability, and file management. It really helps solve all the problems that Cocoa apps force upon mere text editors (long method names, class names, files being in one directory, different types of files in the same directory, etc).</p> <p>It’s the program’s fatal flaw in my mind. It isn’t that it’s sub-par, or not good enough – it’s downright infuriating to use. I want to do mean things to cute kittens whenever I use it. So I don’t. I use TextMate. Which actually is very good at Cocoa & Objective-C. But it means much more typing (especially with the shift key) since TextMate favors tab-triggers rather than tab-completion.</p> <p>At the end of the day, this is the kind of stuff I hope Mac developers care about. It’s about making the user experience the #1 priority in software development. And it’s something that I’m confident Apple knows about and intends to fix in future versions of Xcode. Because they care about the user experience.</p> <img src="" height="1" width="1" alt=""/> Top reasons your CSS columns are messed up 2008-05-12T00:00:00+00:00 in no time flat, without all the cruft of having ten thousand column combinations available. Keeping these quick tips in mind at all times will allow you to do something I like to call <em>defensive coding</em> – and really that’s all CSS frameworks are: defensively coded snippets of CSS.</p> <h2 id="your-margins-are-doubled-in-ie6">Your margins are doubled in IE6</h2> <div class="figure"> <img src="" /> </div> <p>Here’s a super common pitfall: IE6 will double margins facing the direction of the float. Example problematic code:<="p">}</span></code></pre></figure> <p>This sidebar will have a 40px left margin in IE6 – almost certainly throwing the sidebar down below the content, and not next to the content as it should be. Easy fix: add <code class="highlighter-rouge">display:inline;</code> No side effects in any browser, and IE6 obeys margins perfectly.<="nl">display</span><span class="p">:</span><span class="nb">inline</span> <span class="p">}</span></code></pre></figure> <p><strong>Why it works:</strong> By declaring <code class="highlighter-rouge">float</code> on an element, you implicitly demand that it must be rendered as a block element – thus rendering the <code class="highlighter-rouge">display:inline</code> inert. However, due to IE6’s awesome CSS engine, it fixes a bizarre bug that is the #2 reason I see CSS columns fail in IE6.</p> <h2 id="your-content-is-wider-than-your-column">Your content is wider than your column</h2> <div class="figure"> <img src="" /> </div> <p>Let’s pretend you’ve got this simplistic setup of code:<="p">}</span> <span class="nc">.columns</span> <span class="nc">.sidebar</span><span class="p">{</span> <span class="nl">float</span><span class="p">:</span><span class="nb">right</span><span class="p">;</span> <span class="nl">width</span><span class="p">:</span><span class="m">100px</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <p>HTML:</p> <figure class="highlight"><pre><code class="language-html" data-<span class="nt"><html></span> ... <span class="nt"><div</span> <span class="na">class=</span><span class="s">"columns"</span><span class="nt">></span> <span class="nt"><div</span> <span class="na">class=</span><span class="s">"main"</span><span class="nt">></span> <span class="nt"><img</span> <span class="na">src=</span><span class="s">"/images/awesome.gif"</span> <span class="nt">/></span> <span class="nt"></div></span><span class="c"><!-- /.main --></span> <span class="nt"><div</span> <span class="na">class=</span><span class="s">"sidebar"</span><span class="nt">></span> <span class="nt"><p></span>Sidebar rules!<span class="nt"></p></span> <span class="nt"></div></span><span class="c"><!-- /.sidbear --></span> <span class="nt"></div></span><span class="c"><!-- /.columns --></span> ... <span class="nt"></html></span></code></pre></figure> <p>Harmless right? You might view this in Firefox and everything will be fine. But then you look at it in IE6 and your sidebar has mysteriously dissapeared below <code class="highlighter-rouge">.main</code>. WTF? You look at the HTML, the CSS, and everything’s fine. <strong>What could possibly be wrong?</strong> A common problem here is if <code class="highlighter-rouge">awesome.gif</code> is 510px wide. What this does is push out <code class="highlighter-rouge">.main</code> to 510px, and suddenly there’s not enough room for <code class="highlighter-rouge">.sidebar</code> inside <code class="highlighter-rouge">.columns</code> any longer. Ack!</p> <p>Easy fix: add <code class="highlighter-rouge">overflow:hidden</code> to your columns. This forces the width restriction to crop any extruding content. New magical CSS:<="nl">overflow</span><span class="p">:</span><span class="nb">hidden</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.columns</span> <span class="nc">.sidebar</span><span class="p">{</span> <span class="nl">float</span><span class="p">:</span><span class="nb">right</span> <span class="n">width</span><span class="p">:</span><span class="m">100px</span><span class="p">;</span> <span class="nl">overflow</span><span class="p">:</span><span class="nb">hidden</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <h2 id="your-margins-extend-past-your-container">Your margins extend past your container</h2> <div class="figure"> <img src="" /> </div> <p>So you’re building out a simple product listing template out, and you throw it in an unordered list:</p> <figure class="highlight"><pre><code class="language-css" data-<span class="nt">ul</span><span class="nc">.listing</span><span class="p">{</span> <span class="nl">margin</span><span class="p">:</span><span class="m">0</span><span class="p">;</span> <span class="nl">width</span><span class="p">:</span><span class="m">400">20px</span> <span class="m">0</span> <span class="m">0</span><span class="p">;</span> <span class="nl">width</span><span class="p">:</span><span class="m">85px</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <p>HTML:</p> <figure class="highlight"><pre><code class="language-html" data-<span class="nt"><html></span> ... <span class="nt"><ul</span> <span class="na">class=</span><span class="s">"listing"</span><span class="nt">></span> <span class="nt"><li></span>Product #1<span class="nt"></li></span> <span class="nt"><li></span>Product #2<span class="nt"></li></span> <span class="nt"><li></span>Product #3<span class="nt"></li></span> <span class="nt"><li></span>Product #4<span class="nt"></li></span> <span class="nt"></ul></span> ... <span class="nt"></html></span></code></pre></figure> <p>This CSS will work just fine in something like Firefox, but for mysterious reasons you’ll see that Product #4 appears on it’s own line in IE6. What’s happening here? I mean 4 columns x 85px + 3 gaps x 20px = 400px, right? Except that your 4th gap is hanging over the right edge – pushing the true width of the blocks to 420px. Firefox is smart and lets that margin just hang out there – but IE6 will apply that margin within the parent wrapper – throwing the 4th item down since it takes up 20px more than it should have.</p> <p>The fix? Apply a left margin to each item, with a negative margin to the wrapper. This means that every item has a visible margin, but the whole block of elements are yanked back by the negative margin:</p> <figure class="highlight"><pre><code class="language-css" data-<span class="nt">ul</span><span class="nc">.listing<">420">85px</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <p>This gets around the nasty solution of adding a class to the first or last item in every row – something I’ve seen with abundance around the web.</p> <h2 id="building-a-css-framework-in-no-time">Building a CSS framework in no time</h2> <p>Wev’e got to start out with some basic HTML. Here’s what I’ve been using lately:</p> <figure class="highlight"><pre><code class="language-html" data-<span class="nt"><html></span> ... <span class="nt"><div</span> <span class="na">class=</span><span class="s">"columns col2"</span><span class="nt">></span> <span class="nt"><div</span> <span class="na">class=</span><span class="s">"column first"</span><span class="nt">></span> ... <span class="nt"></div></span><span class="c"><!-- /.first --></span> <span class="nt"><div</span> <span class="na">class=</span><span class="s">"column last"</span><span class="nt">></span> ... <span class="nt"></div></span><span class="c"><!-- /.last --></span> <span class="nt"></div></span><span class="c"><!-- /.columns --></span> ... <span class="nt"></html></span></code></pre></figure> <p>For different column widths, I’ve been changing out the <code class="highlighter-rouge">col2</code> declaration to things like <code class="highlighter-rouge">col2A, col2B, col2C</code> and so on. You could easily give them more semantic names like <code class="highlighter-rouge">products-columns</code> too.</p> <h3 id="self-clearing-is-the-future">Self clearing is the future</h3> <p>The first step for any column framework is self-clearing. It’s easy, practical, and reduces all those damn clearing divs.</p> <figure class="highlight"><pre><code class="language-css" data-<span class="nc">.columns</span><span class="nd">:after</span> <span class="p">{</span> <span class="nl">content</span><span class="p">:</span> <span class="s1">"."</span><span class="p">;</span> <span class="nl">display</span><span class="p">:</span> <span class="nb">block</span><span class="p">;</span> <span class="nl">height</span><span class="p">:</span> <span class="m">0</span><span class="p">;</span> <span class="nl">clear</span><span class="p">:</span> <span class="nb">both</span><span class="p">;</span> <span class="nl">visibility</span><span class="p">:</span> <span class="nb">hidden</span><span class="p">;</span> <span class="p">}</span> <span class="o">*</span> <span class="nt">html</span> <span class="nc">.columns</span> <span class="p">{</span><span class="nl">height</span><span class="p">:</span> <span class="m">1%</span><span class="p">;}</span> <span class="nc">.columns</span><span class="p">{</span> <span class="nl">display</span><span class="p">:</span><span class="n">inline-block</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.columns</span><span class="p">{</span> <span class="nl">display</span><span class="p">:</span><span class="nb">block</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <h3 id="float-those-columns">Float those columns</h3> <p>Next step is to actually float those columns. So let’s add a couple more declarations:</p> <figure class="highlight"><pre><code class="language-css" data-<span class="nc">.columns</span> <span class="nc">.column</span><span class="p">{</span> <span class="nl">float</span><span class="p">:</span><span class="nb">left</span><span class="p">;</span> <span class="nl">overflow</span><span class="p">:</span><span class="nb">hidden</span><span class="p">;</span> <span class="nl">display</span><span class="p">:</span><span class="nb">inline</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.columns</span> <span class="nc">.last</span><span class="p">{</span> <span class="nl">float</span><span class="p">:</span><span class="nb">right</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col2</span> <span class="nc">.first</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">500px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col2</span> <span class="nc">.last</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">100px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col2A</span> <span class="nc">.first</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">400px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col2B</span> <span class="nc">.last</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">200px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col3</span> <span class="nc">.first</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">100px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col3</span> <span class="nc">.second</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">280px</span><span class="p">;</span> <span class="nl">margin-left</span><span class="p">:</span><span class="m">20px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.col3</span> <span class="nc">.last</span><span class="p">{</span> <span class="nl">width</span><span class="p">:</span><span class="m">200px</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <h3 id="done-uh-what">Done… uh, what?</h3> <p>Oh, yeah. That’s it. That’s all it takes to create reliable columns in CSS. Really.</p> <p>Here’s an <a href="">example page</a> to prove it!</p> <img src="" height="1" width="1" alt=""/> Why I don't use CSS Frameworks 2007-08-17T00:00:00+00:00 <p>CSS Frameworks seem like an awesome advancement at first glance: speed up your development, normalize your code base, and eliminate those nasty browser bugs! Hot damn, where do I sign up? Unfortunately there’s some pretty strong caveats that go with those statements.</p> <h2 id="the-frameworks-themselves-are-very-good">The frameworks themselves are very good</h2> <p.</p> <h2 id="advantages-of-frameworks">Advantages of Frameworks</h2> <p>Most CSS frameworks offer three primary selling points:</p> <ul> <li>Speed up your develoment (don’t have to write all that HTML/CSS)</li> <li>Don’t worry about those nasty IE bugs!</li> <li>Normalize your code/class base</li> </ul> <h3 id="speeding-up-your-development">Speeding up your development</h3> <p>For those who have intimate knowledge of the framework, I do believe the frameworks will speed up development. But for the average user, I think that the time required to understand the architecture of the framework far outweighs the menial task of coding it from scratch.</p> <p <strong>less than 5% of development time.</strong></p> <p.</p> <h3 id="dont-worry-about--ie-bugs">Don’t worry about IE bugs</h3> <p>Well, gee that sure would be a wonderful thing if that were the case, wouldn’t it? The truth is the frameworks do eliminate some bugs – but they’re the easy ones to pick off. The ones solved by a quick <code class="highlighter-rouge">display:inline</code> or <code class="highlighter-rouge">height:1%</code>.</p> .</p> <p>It doesn’t solve the hard problems.</p> <h3 id="normalize-your-code-base">Normalize your code base</h3> <p>This is one area I think frameworks are great at: getting a large team of people all using the same code structure. But then again, I think this can be solved by an internal styleguide just the same.</p> <h2 id="disadvantages-of-frameworks">Disadvantages of frameworks</h2> <p>There are a few pretty severe disadvantages of frameworks in my eyes:</p> <ul> <li>Familiarity with your code’s architecture</li> <li>Inheriting someone else’s bugs</li> <li>Not learning</li> </ul> <h3 id="familiarity-with-your-codes-architecture">Familiarity with your code’s architecture</h3> <p <em>how</em> the layout works.</p> <p <code class="highlighter-rouge">float</code> and when you can use <code class="highlighter-rouge">position</code> to lay out elements. Should you use <code class="highlighter-rouge">line-height</code>, <code class="highlighter-rouge">margin</code>, <code class="highlighter-rouge">padding</code>, or <code class="highlighter-rouge">height</code> to get that container to extend? It’s a very important decision: and laying out the architecture helps you achieve this.</p> <h3 id="inheriting-someone-elses-bugs">Inheriting someone else’s bugs</h3> <p>At the end of the day, no framework is perfect. No design is perfect. But instead of fixing your bugs, you’re fixing someone else’s bugs. Do you know how much it sucks fixing your own bugs? It sucks 10,000x worse fixing someone else’s bugs.</p> <h3 id="not-learning">Not learning</h3> <p>Again, on my mantra of why I wouldn’t recommend frameworks comes the lack of knowledge gained by fixing those problems frameworks solve. I’ve <a href="/tipsresources/web-production/most-amazing-css-tip-youll-ever-read-in-your-life/">advocated before</a>.</p> <h2 id="conclusion">Conclusion</h2> <p.</p> <h3 id="the-one-framework-i-do-use">The one “framework” I do use</h3> <p>On that note, there is one framework I do use. It’s the CSS reset – not that I’d even call it a framework. Here it is in all its glory:</p> <figure class="highlight"><pre><code class="language-css" data-<span class="c">/*------------------------------------------------------------------------------------ Global Styles ------------------------------------------------------------------------------------*/</span> <span class="o">*</span> <span class="p">{</span> <span class="nl">padding</span><span class="p">:</span><span class="m">0</span><span class="p">;</span> <span class="nl">margin</span><span class="p">:</span><span class="m">0</span><span class="p">;</span> <span class="p">}</span> <span class="nt">h1</span><span class="o">,</span> <span class="nt">h2</span><span class="o">,</span> <span class="nt">h3</span><span class="o">,</span> <span class="nt">h4</span><span class="o">,</span> <span class="nt">h5</span><span class="o">,</span> <span class="nt">h6</span><span class="o">,</span> <span class="nt">p</span><span class="o">,</span> <span class="nt">pre</span><span class="o">,</span> <span class="nt">blockquote</span><span class="o">,</span> <span class="nt">label</span><span class="o">,</span> <span class="nt">ul</span><span class="o">,</span> <span class="nt">ol</span><span class="o">,</span> <span class="nt">dl</span><span class="o">,</span> <span class="nt">fieldset</span><span class="o">,</span> <span class="nt">address</span> <span class="p">{</span> <span class="nl">margin</span><span class="p">:</span><span class="m">1em</span> <span class="m">0</span><span class="p">;</span> <span class="p">}</span> <span class="nt">li</span><span class="o">,</span> <span class="nt">dd</span> <span class="p">{</span> <span class="nl">margin-left</span><span class="p">:</span><span class="m">5%</span><span class="p">;</span> <span class="p">}</span> <span class="nt">fieldset</span> <span class="p">{</span> <span class="nl">padding</span><span class="p">:</span> <span class="m">.5em</span><span class="p">;</span> <span class="p">}</span> <span class="nt">select</span> <span class="nt">option</span><span class="p">{</span> <span class="nl">padding</span><span class="p">:</span><span class="m">0</span> <span class="m">5px</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.hide</span><span class="o">,</span> <span class="nc">.print-logo</span><span class="o">,</span> <span class="nc">.close-button</span><span class="p">{</span> <span class="nl">display</span><span class="p">:</span><span class="nb">none</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.left</span><span class="p">{</span> <span class="nl">float</span><span class="p">:</span><span class="nb">left</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.right</span><span class="p">{</span> <span class="nl">float</span><span class="p">:</span><span class="nb">right</span><span class="p">;</span> <span class="p">}</span> <span class="nc">.clear</span><span class="p">{</span> <span class="nl">clear</span><span class="p">:</span><span class="nb">both</span><span class="p">;</span> <span class="nl">height</span><span class="p">:</span><span class="m">1px</span><span class="p">;</span> <span class="nl">font-size</span><span class="p">:</span><span class="m">1px</span><span class="p">;</span> <span class="nl">line-height</span><span class="p">:</span><span class="m">1px</span><span class="p">;</span> <span class="p">}</span> <span class="nt">a</span> <span class="nt">img</span><span class="p">{</span> <span class="nl">border</span><span class="p">:</span><span class="nb">none</span><span class="p">;</span> <span class="p">}</span></code></pre></figure> <p>What’s your take on frameworks? Do you use them? If so, what other benefits have you gained from using them?</p> <img src="" height="1" width="1" alt=""/> MooTools Javascript Classes 2007-07-16T00:00:00+00:00 <p>One of Javascript’s major blunders when it comes to Object-Oriented design is the lack of true classes. Lucky for us, we’ve had every library author out there have their whack at creating a class structure.</p> <h2 id="what-is-a-class">What is a class?</h2> <p>A class is kind of a template. One of the big concepts of OO is treating your code as real world objects. Let’s say you want to have three variables for different dogs: ollie, rowdy, and killer. Each of these variables should be an <em>instance</em> of a <em>class</em>. That class’s name would be Dog. Each particular dog is an instance of the generic Dog class. I won’t go into much more detail here: there’s plenty of reading to do on what classes really are, and how to use them best.</p> <h2 id="mootools--3">MooTools = <3</h2> <p>Out of all the class systems I’ve used, I’d have to say MooTool’s class system (spanwed from Dean Edward’s Base) is the cleanest, most extensible system yet. Creating and extending classes is ridiculously easy.</p> <h3 id="create-a-class">Create a class</h3> <figure class="highlight"><pre><code class="language-javascript" data-<span class="kd">var</span> <span class="nx">Animal</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Class</span><span class="p">({</span> <span class="na">initialize</span><span class="p">:</span> <span class="kd">function</span><span class="p">(){</span> <span class="k">this</span><span class="p">.</span><span class="nx">text</span> <span class="o">=</span> <span class="s2">"Animal Runs!"</span><span class="p">;</span> <span class="p">},</span> <span class="na">run</span><span class="p">:</span> <span class="kd">function</span><span class="p">(){</span> <span class="nx">alert</span><span class="p">(</span><span class="k">this</span><span class="p">.</span><span class="nx">text</span><span class="p">);</span> <span class="p">}</span> <span class="p">});</span> <span class="kd">var</span> <span class="nx">pet</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Animal</span><span class="p">();</span> <span class="nx">pet</span><span class="p">.</span><span class="nx">run</span><span class="p">();</span> <span class="c1">// ==> "Animal Runs!"</span></code></pre></figure> <p>(It’s also fair to note that MooTools supports Prototype’s <code class="highlighter-rouge">Class.create</code> method as well)</p> <h3 id="extend-a-class">Extend a class</h3> <figure class="highlight"><pre><code class="language-javascript" data-<span class="kd">var</span> <span class="nx">Dog</span> <span class="o">=</span> <span class="nx">Animal</span><span class="p">.</span><span class="nx">extend</span><span class="p">({</span> <span class="na">initialize</span><span class="p">:</span> <span class="kd">function</span><span class="p">(){</span> <span class="k">this</span><span class="p">.</span><span class="nx">parent</span><span class="p">();</span> <span class="p">},</span> <span class="na">bark</span><span class="p">:</span> <span class="kd">function</span><span class="p">(){</span> <span class="k">this</span><span class="p">.</span><span class="nx">run</span><span class="p">();</span> <span class="nx">alert</span><span class="p">(</span><span class="s2">"Woof! Woof!"</span><span class="p">)</span> <span class="p">}</span> <span class="p">});</span> <span class="kd">var</span> <span class="nx">pet</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Dog</span><span class="p">();</span> <span class="nx">pet</span><span class="p">.</span><span class="nx">bark</span><span class="p">();</span> <span class="c1">// ==> "Animal Runs!"</span> <span class="c1">// ==> "Woof! Woof!"</span></code></pre></figure> <p>You’ll notice you still get access to parent methods (through <code class="highlighter-rouge">this.parent()</code>), as you can see where this.text gets initialized when a new instance of Dog is created.</p> <p>The syntax is short, sweet, and to the point. Furthermore it allows me all the flexibility I need… well, almost. MooTools team gets bonus points for the next section.</p> <h2 id="javascript-mixins-kinda">Javascript mixins… kinda</h2> <p>There are two common actions that many Javascript actions have: options, and callbacks. MooTools have created a sort of ruby-style mixin for classes to handle these functions. MooTools calls these mixins Utility Classes. To enable these, add this line to the code above:</p> <figure class="highlight"><pre><code class="language-javascript" data-></code></pre></figure> <h2 id="options">Options</h2> <p>What does this do? First off, it allows for quick, easy, extendible options. All you do is set your default options in an options property, and then call the <code class="highlighter-rouge">setOptions</code> method inside your class. Here’s an example:</p> <figure class="highlight"><pre><code class="language-javascript" data-<span class="kd">var</span> <span class="nx">Dog</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Class</span><span class="p">({</span> <span class="na">options</span><span class="p">:</span> <span class="p">{</span> <span class="na">age</span><span class="p">:</span> <span class="mi">5</span><span class="p">,</span> <span class="na">type</span><span class="p">:</span> <span class="s2">"Jack Russel Terrier"</span> <span class="p">},</span> <span class="na">initialize</span><span class="p">:</span> <span class="kd">function</span><span class="p">(</span><span class="nx">name</span><span class="p">,</span> <span class="nx">options</span><span class="p">){</span> <span class="c1">// Here's the magic!</span> <span class="k">this</span><span class="p">.</span><span class="nx">setOptions</span><span class="p">(</span><span class="nx">options</span><span class="p">)</span> <span class="k">this</span><span class="p">.</span><span class="nx">name</span> <span class="o">=</span> <span class="nx">name</span><span class="p">;</span> <span class="p">},</span> <span class="na">bark</span><span class="p">:</span> <span class="kd">function</span><span class="p">(){</span> <span class="nx">alert</span><span class="p">(</span><span class="s2">"My name is "</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">name</span> <span class="o">+</span> <span class="s2">" and I am "</span> <span class="o">+</span> <span class="k">this</span><span class="p">.</span><span class="nx">options</span><span class="p">.</span><span class="nx">age</span> <span class="o">+</span> <span class="s2">" years old"</span><span class="p">);</span> <span class="k">this</span><span class="p">.</span><span class="nx">fireEvent</span><span class="p">(</span><span class="s1">'afterBark'</span><span class="p">,</span> <span class="k">this</span><span class="p">);</span> <span class="p">}</span> <span class="p">});</span> > <span class="kd">var</span> <span class="nx">ollie</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Dog</span><span class="p">(</span><span class="s1">'Ollie'</span><span class="p">);</span> <span class="nx">ollie</span><span class="p">.</span><span class="nx">bark</span><span class="p">();</span> <span class="c1">// ==> "My name is Ollie and I am 5 years old"</span> <span class="kd">var</span> <span class="nx">rowdy</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Dog</span><span class="p">(</span><span class="s1">'Rowdy'</span><span class="p">,</span> <span class="p">{</span><span class="na">age</span><span class="p">:</span><span class="mi">15</span><span class="p">});</span> <span class="nx">rowdy</span><span class="p">.</span><span class="nx">bark</span><span class="p">();</span> <span class="c1">// ==> "My name is Rowdy and I am 15 years old"</span></code></pre></figure> <p>By mixing in the Options methods, you now have access to setOptions, which either uses user-defined options or class-based defaults (with one line of code).</p> <h3 id="events">Events</h3> <p>You can also define custom events (usually called callbacks). Notice the <code class="highlighter-rouge">this.fireEvent('afterBark')</code> bit in the Dog class above? Check it out:</p> <figure class="highlight"><pre><code class="language-javascript" data-<span class="kd">var</span> <span class="nx">killer</span> <span class="o">=</span> <span class="k">new</span> <span class="nx">Dog</span><span class="p">(</span><span class="s1">'Killer'</span><span class="p">);</span> <span class="nx">killer</span><span class="p">.</span><span class="nx">addEvent</span><span class="p">(</span><span class="s1">'afterBark'</span><span class="p">,</span> <span class="kd">function</span><span class="p">(</span><span class="nx">dog</span><span class="p">){</span> <span class="nx">alert</span><span class="p">(</span><span class="nx">dog</span><span class="p">.</span><span class="nx">name</span> <span class="o">+</span> <span class="s1">' just barked!'</span><span class="p">);</span> <span class="p">});</span> <span class="nx">killer</span><span class="p">.</span><span class="nx">bark</span><span class="p">();</span> <span class="c1">// ==> "My name is Killer and I am 5 years old"</span> <span class="c1">// ==> "Killer just barked!"</span></code></pre></figure> <p>It allows you to tie into the <em>same</em> event functionality used for the DOM, but with your own methods you create in your classes. I’m in love with this easy functionality – sure there’s been other ways to do this, but none so elegant as what the Moo team has come up with.</p> <h3 id="chain">Chain</h3> <p).</p> <h2 id="conclusion">Conclusion</h2> <p>Every good Javascript developer knows that there’s 50 ways to skin a cat when it comes to classes and Javascript. But for me, one of the largest reasons MooTools is my framework of choice is the underlying class system. No extending <code class="highlighter-rouge">Object</code>, and no overriding of parent methods. The syntax is clean and easy to remember, giving it huge bonus points in my book.</p> <p>Personally, I would like to thank the smarter developers who have taken the hard hits with Javascript to implement these nice OO techniques. Without them, my Javascript would still be procedural-based with tons of global variables thrown about. Yay for frameworks!</p> <img src="" height="1" width="1" alt=""/> Using TextMate's TODO bundle 2007-06-25T00:00:00+00:00 <p>If you use TextMate, you should really think about using the TODO bundle more often. It’s a simple, low-maintenance bundle that adds tremendous value to your code.</p> <h2 id="setting-todo-fixme-and-changelog">Setting TODO, FIXME, and CHANGELOG</h2> <p>Using the bundle is pretty easy. In any language, just type in a quick comment with the prefix TODO, FIXME or CHANGED like so:</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">def</span> <span class="nf">view</span> <span class="c1"># TODO: different display for different types of clips: active, processing, etc<"># TODO: Make a real related clips dealieo</span> <span class="vi">@related_clips</span> <span class="o">=</span> <span class="no">Clip</span><span class="p">.</span><span class="nf">find</span><span class="p">(</span><span class="ss">:all</span><span class="p">,</span> <span class="ss">:limit</span> <span class="o">=></span> <span class="mi">6</span><span class="p">,</span> <span class="ss">:conditions</span> <span class="o">=></span> <span class="p">[</span><span class="s2">"clips.status = 'processed'"</span><span class="p">])</span> <span class="k">end</span></code></pre></figure> <p>Using this syntax lets you keep pushing ahead at full steam and leave the hard stuff for later. For example, in the above example I wanted to get a quick functional prototype out the door. It wasn’t mandatory that the Related Clips <em>actually</em> be related: it was only mandatory that there was content present.</p> <p>You can also use the keywords FIXME or CHANGED throughout your code, like so:</p> <figure class="highlight"><pre><code class="language-ruby" data-<span class="k">def</span> <span class="nf">view</span> <span class="c1"># FIXME: This totally breaks if an invalid ID is given<"># CHANGED: @related_clips now uses a model method related_clips</span> <span class="vi">@related_clips</span> <span class="o">=</span> <span class="no">Clip</span><span class="p">.</span><span class="nf">related_clips</span><span class="p">(</span><span class="n">params</span><span class="p">[</span><span class="ss">:id</span><span class="p">])</span> <span class="k">end</span></code></pre></figure> <p>This lets others working on the code let you know that you <em>know</em> something is broken and/or changed, but you just don’t have time to get to it.</p> <h2 id="getting-the-information-back">Getting the information back</h2> <p>Well, that’s all fine and well.. but how do you know what needs to be fixed/changed/done ? Just hit Ctr+Shift+T and TextMate will pop up with a pretty little list, hyperlinked and all</p> <div class="figure"> <img src="" alt="Screenshot of the TODO list" /> <small><em>Ctrl + Shift + T</em> brings up a list of all your todo's</small> </div> <p>I use this bundle practically every time I open up Textmate. It allows me to keep on a focused track of development, while still keeping a lot of “ooh, I need to do that sometime” kind of tasks on the radar.</p> <img src="" height="1" width="1" alt=""/> Predictions for the future 2006-01-13T00:00:00+00:00 <p>I.</p> <h2 id="web-standards-what">Web standards what?</h2> <p.</p> <h2 id="automattic-will-change-the-shape-of-blogging">Automattic will change the shape of blogging</h2> <p.</p> <p>Many people may balk at that statement and wonder what reasoning I have for it.</p> <ol> <li> <p>Matt is, in my opinion, the largest contributor to what blogging is today. He’s done more towards creating a community than anyone else out there. He’s got the idea. He’s got the people. He’s got the means.</p> </li> <li> <p)</p> </li> <li> <p>Wordpress.com works. Wordpress.com is a great service, like blogger but infinitely better. This thing is taking off like no one could imagine. It’s going to continue to take off and gain influence. Automattic are the people behind wordpress.com.</p> </li> </ol> <p>Automattic and Wordpress will drive the internet in 2006. What this also means is that Symphony and its army of clones will not be the biggest thing to hit web publishing since the keyboard.</p> <h2 id="hosted-applications-will-rise">Hosted applications will rise</h2> <p.</p> <h2 id="vista-wont-matter">Vista won’t matter</h2> <p>Windows Vista won’t launch in 2006. The whole world won’t care. Slowly the average computer users are leaning towards OSX. As the iMacs and Mac Minis start invading retails stores across the country, people will inevitably be bought by Apple’s magnificent design. After using OSX for a week they’ll wonder why they didn’t buy a Mac earlier. Ultimately, people will see Vista as a piss-poor attempt at copying OSX and fixing holes and leaks in Windows that should have been resolved ten years ago.</p> <p>I suspect that Microsoft has simply dropped the ball in this court. Apple keeps slamming out home runs while Microsoft is in the pit planning next season. Too little, too late. Microsoft is going to feel the big knife of Apple cutting into XP sales just as Sony saw the iPod dominate their market. 2006 won’t be the year everyone switches, but it will be the year everyone wants to switch. Within a decade, OSX will topple Windows installations.</p> <h2 id="macs-will-be-huge">Macs will be huge</h2> <p>I think Apple has something revolutionary up their sleeves this year. Perhaps a 3, or 6 month time frame I think we’ll be seeing something that’s the new iMac (the last real revolution in Mac). I think this next set of hardware devices is what’s going to be pushing Apple into the mainstream. Remember, we’re talking Macs here –not iPods or TVs or any of that other jazz. I really think now with the big switch to Intel, Apple can unleash some ideas they’ve been working on for a long time.</p> <h2 id="the-funk-will-overpower-the-electronica-4-beat-shuffle">The funk will overpower the electronica-4-beat-shuffle</h2> <p>As far as music, I think a lot of crappy bands will suffer the same fate boy bands suffered a few years back. Soon people will realize they don’t want to hear about rainy Sundays in Seattle to a boring 4/4 rhythm on every single track.</p> <p>But the funk will rise. Hear me now, disco and funk is going to be huge in 2006. I can see it coming already. C’mon, we all know you want to dance. Don’t hide it. Just do it.</p> <p>DRM will be a black spot on the music industry I don’t think Sony’s DRM issues will ever be let down. Sony got hurt big time, a lot bigger than they think. Right now they’re realizing not only have they been beat by Apple, but they’ve been beat by their customers. Shivering in a corner, Sony will be forced to do something new.</p> <p>Luckily, the rest of the industry will be just as stupid. DRM is far from over. CEO’s will hear presentations from salespeople of development firms who can offer a “final solution” to music piracy. This will inevitably lead to more rootkit concerns, and ultimately more people stealing music than ever before.</p> <p>Meanwhile, independent labels will prosper.</p> <h2 id="so-there-you-go">So there you go…</h2> <p>Well, that about sums up my thoughts. I think right now is the best time ever to be a techno-geek, awesome things are going to happen. The web is exploding in popularity and technology is racing ahead faster than we can come up with ideas. I’m stoked to be a part of it, and can’t wait to see what everyone else has cooked up.</p> <img src="" height="1" width="1" alt=""/>
http://feeds.feedburner.com/warpspire
CC-MAIN-2019-18
refinedweb
34,463
65.73
I feel like I've seen this somewhere else. If you've posted on multiple websites you should mention that fact and give the links to your other posts so that people here don't waste their time... I feel like I've seen this somewhere else. If you've posted on multiple websites you should mention that fact and give the links to your other posts so that people here don't waste their time... You're not giving enough information to help you. Since it's easy to change it to vector<char> I'll leave that to you. Maybe something like this: { "cmd": "/usr/bin/sh", "args": [ "-c", "the command you want to run", ], "secret": "supersecretpassword" You found this exact source code and an a.out that you assume is the corresponding executable. You believe that you need to create a config.json file with the correct fields. So how are we supposed... Clearly I still have something to learn about guruship. :) Maybe something like this: #include <iostream> #include <string> #include <vector> using std::cout; using std::cin; using std::string; I just realized that the "Initialize map" code needs to be after the declarations of row and col! (I must've moved it without testing. :p ) #include <iostream> #include <vector> using std::cout; using std::cin; using std::vector; int main() { enum { Player='O', MapTile='*', Boulder='@' }; int main() { // Create temporary struct and assign to it. typedef struct { int a; } x; (x){0} = (x){1}; // Also works for an int. (int){0} = 1; } It's a form-based C# program. The rdo... variables refer to the state of the radio buttons. The initial 'if' statement has a semicolon at the end (and doesn't seem to do anything). The pthread mutex system is much more complicated and doesn't just spin if it can't aquire a mutex. Instead it (eventually) sleeps. So it depends on the behavior you want. Sleeping allows more... "Sequentially consistent" memory ordering is the most constrained and therefore as "correct" as it gets. It's possible that you could get a performance boost with "relaxed" ordering, but unless you... It looks reasonable. I don't think TMutex needs to be volatile. It isn't going to be changed by anything outside of the program, and it doesn't need to be volatile just because the function... @thmm, Oops! You're right. I must've had C++ on the brain. @kid8n1, Ignore my "recommendations". :tongue: It's pretty easy to figure out the correct order if you remember that the tests are done in order. So if the first test is for one q and the second is for two, the second will never be reached since... Yes. A chain of "if / else if" will result in only one of the blocks of code controlled by the if's being executed. For example, the following code will only execute one of the printf statements no... The diagram you show is for the string "KQ", but your code is looking for "QQ". But even if you change the code to this else if (card_name[0] == 'K' && card_name[1] == 'Q') it still won't... HANDLE hFind; WIN32_FIND_DATA FindFileData; if((hFind = FindFirstFile("C:/some/folder/*.txt", &FindFileData)) != INVALID_HANDLE_VALUE){ do{ printf("%s\n", FindFileData.cFileName);... You turn on optimization with the -O flag. Try -O2 (That's the capital letter O.) Obviously he's running into a stack limit. And although tail call optimization is not guaranteed by the standard, any decent compiler will do it. But it is not done if you don't request... Since it's tail recursion, as long as it's optimized only a single stack frame would be used. Just return the number of primes you found. #include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> #include <math.h> int checkNumber(const char *word) This is not correct if n is odd: 3*(n-1)*(n>>1) // or (n/2) instead of n>>1 You need to multiply n*(n-1) first to ensure that the result is even before dividing by 2. Suppose n is 5: (5...
https://cboard.cprogramming.com/search.php?s=64af2710d2681a48a635427d3048c008&searchid=6401101
CC-MAIN-2021-10
refinedweb
690
76.01
> Those last two lines aren't meant to be part of the last else. Maybe so, but have you looked at the code in your posts? Can you see how people might think otherwise? Printable View > Those last two lines aren't meant to be part of the last else. Maybe so, but have you looked at the code in your posts? Can you see how people might think otherwise? Don't mix spaces and tabs when indenting. That's why those two lines look like they are indented differently in the code tags than they do in your editor. If you stick to only spaces or only tabs, then the code will lineup better in the forum (spaces are best for the forum, but I prefer tabs for my own coding). >> does anyone know a good way to set the console prompt size in the code of the program right from the start? That's not part of standard C++. You'll have to look into console programming for your platform. I think adrianxw might have a tutorial on windows console programming if you google it. For displaying the high scores in a certain format, there are different options. You could use io manipulators from iomanip. setfill and setw might help, but I'm not sure about that. I do see that, sorry. Sometimes, though, those spaces/tabs were put in automatically when I hit enter, such as when I did an if statement and had to use brackets. I went back and fixed it in VS. Anyway, I found adrianxw's page, and adapted a way to suit my needs for expanding the window, but in order to do it, I need to include "windows.h" in my globals. However, when I do that, it negates the "limits" include and I get the following errors regarding my character prevention statement: Where otherwise, if "windows.h" wasn't in the includes, it would compile and run just fine.Where otherwise, if "windows.h" wasn't in the includes, it would compile and run just fine.Code: 1>.\GuessIt.cpp(68) : warning C4003: not enough actual parameters for macro 'max' 1>.\GuessIt.cpp(68) : error C2589: '(' : illegal token on right side of '::' 1>.\GuessIt.cpp(68) : error C2143: syntax error : missing ')' before '::' 1>.\GuessIt.cpp(68) : error C2059: syntax error : ')' This is the section it's referring to: Anyone have any idea why two headers would conflict like that?Anyone have any idea why two headers would conflict like that?Code: if (!(cin >> guess) || (cin.get() != '\n')) { cin.clear(); // clear fail state cin.ignore(numeric_limits<int>::max(), '\n'); // ignore bad input cout << "\nIllegal guess. Your guess must be a whole number.\n"; --tries; } Try adding this line:I think if you put it before windows.h it should work.I think if you put it before windows.h it should work.Code: #define NO_MIN_MAX The reason it conflicts is that the writers of windows.h did a bad thing and defined macros named min and max. A macro is just a text replacement that doesn't obey the rules of C++. There is code inside <limits> that uses min and max, and it is getting replaced with the macro. The #define above is supposed to stop windows.h from defining that macro so that your code will compile. Nope, I tried before and after, it still came up with the same errors...:( I also came up with the possibility of making a separate file, and they both compiled ok, but I don't know how to call a function from an outside file. Say I have the function resize() in resize.cpp. I try to include resize.cpp, but I can't call resize(). Create a header file and inside that put a prototype for all your functions that use windows.h. Then create a cpp file and put the function definitions in that. Any code that needs to call those functions should #include the header. Then add that cpp file to your project/makefile/command line so that it compiles with the other cpp file(s). Actually, try NOMINMAX instead of NO_MIN_MAX. prototype? Function definitions? Unfortunately, I'm still a bit of a noob, could you explain? And still nothing, before or after... Edit: Haha, I had completely forgotten that, while I was trying to experiment with "windows.h" and it's location, I had put in in one of the other included headers. After I got rid of that, it worked just fine. A prototype is the function declaration. If your function definition (where the body of the function is defined) comes after the code that calls it, then you need a prototype to tell the compiler what the function looks like. So for you code you could have done this:Code: #include <cstdlib> #include <ctime> #include <iostream> // other stuff ... int game(); // prototype/declaration for game int menu(); // prototype/declaration for menu int main(){ cout << "Welcome to Guess It, the number guessing game.\n"; return 0; } int menu(){ // definition/implementation for menu // implementation here. } int game (){ // definition/implementation for game // implementation here. } OK, I finally got it. I initially had <windows.h> ahead of <limits>. That, combined with putting the "NOMINMAX" before it, made it as though the <windows.h> wasn't even being included. I then moved <windows.h> and "NOMINMAX" at the end of the includes/global section, and it worked perfectly. I now have a program that automatically starts up at twice the height as normal! Now, to the high scores list...;) Alright, now for one last thing specifically for this program. How do I prevent the generated number from being a decimal? Or is that built into the random generator somehow? The only reason I ask is every once in a while, I guess a few numbers and think I have it pinned down, only to get a "You guessed to low" message at first and then have it tell me that I got it. Could it be something other than a decimal problem? It's not a decimal problem. Your random variable is an int, so it can't hold a decimal. Also, rand() returns an integer and % on an int returns an int, so you have no worries there. The problem is in your if/else if/else code that checks the guess. It is outputting "too low" when it shouldn't. Just take another look at that logic and you should see how to change it so that it doesn't output that message when you guess right.
http://cboard.cprogramming.com/cplusplus-programming/95313-validating-input-number-guessing-game-2-print.html
CC-MAIN-2015-11
refinedweb
1,097
76.22
Rock-Paper-Kinect! Introducing Kinect RPS (Play Rock-Paper-Scissors) Sometimes to grok something, you just can't beat a good book. If you got a new Kinect for Windows device this holiday season and are looking for a single starting resource, Abhijit's new book might be just the thing you've been waiting for... .... ... Project Information URL:, “Kinect for Windows SDK Programming Guide”. Contact Information: cant wait to get my hands on it. There is a lot content that i would like to read about on Kinect in the book. Congratulations Abhijit i have seen some chapters of this week, must say this is really very good for beginners. Hi! i'm looking for the others chapters of this book... please can you help me with this.. do you know if this book is online? @Isamar Zarazua: The book is available for purchase as print or ebook. Click through to "Kinect for Windows SDK Programming Guide". and the purchase links are there... This book adds some info on Kinect, helping you a little bit to go further for a lot of money, compared to what you get ... Have managed to build the Kinect Info Box sample on page 50 & ff However, it does NOT give the complete picture to some issues like e.g. tracking the SkeletonJoint.RightHand x,y,z coordinates, why ? Repeats what we already know about Kinect, does NOT spell out what to code to make code complete, like on page 73 Code samples are not listed on the download PACKT site, You can register, but PACKT want your E-Mail addr. for free (you already payed for the book) Code samples are not complete, see p 73, Code samples fail, try page 169 ff Main disapointment: Is not building on Kinect V 1.6 SDKs SensorChooserUI. or KinectSensorManager Kinect for Windows with Kinect V 1.6 on Windows 8 with Visual Studio Express 2012 Dear anonymous Please don’t hide behind the “anonymous” because I want to understand your frustrations that i fail to understand and I would like to know who I am engaging. “You talked about the example Infobox in the book and you asked why the author does not give a complete picture about skeleton tracking. “ The Author created the example to show you, how you can get certain info about your sensor, but not to track skeleton, this is an Infobox that tells you things about your sensor. In the book there are many parts where he explains the Skeleton tracking and also in the examples that you downloaded from PACKT everything is there. “Repeats what we already know about Kinect,” Not everyone knows what you already know, so when books are generally written, it is advisable that everyone should be presented with a basic knowledge of a technology, I have read books on advanced topics that contains basics about the technology, and do you want to crucify the Author because he wrote the book to cater for everyone? The Simple thing to do, if you know someone thing in a chapter Skip it and look at other chapters “Code samples are not listed on the download PACKT site,” That is definitely not true, go to the support tab on the PACKT website or follow this that is where i got them enter your email address which I don’t see nothing wrong in doing that, and that is not the authors fault but processes used by PACKT enter the Capcha and click on Go and PACKT will send you a download link to your email “Is not building on Kinect V 1.6 SDKs SensorChooserUI. Or KinectSensorManager” I am using V1.6 of the sdk and all the examples are working fine, so of all people who commented on this post, you are the only one. It seems you are not the one who have installed 1.6, if you have problems compiling your example project, why don’t you post your errors here and we might help resolving them. Hope these replies help you resolve problems and your understanding. I have been reading this book for a while now. FYI, I know nothing about the device and the SDK, while totally being interested to learn it. I have bought this book and I am gradually learning things that are new to me. I don't know why you are fustrated. I used to get fustrated when I cannot understand the code or cannot run the code. But this book has made extra-ordinary work by pulling things that are rarely found over internet. Believe me, I would recommend this book always for a newbie. I think probably you might not be very competent on technologies used on the book. I dont know if you are aware of WPF or other ongoing technologies which are widely used on the book. Let me go a little on your findings and let me try out them myself. 1. You seem to have managed to build InfoBox sample, that means you have a real device with you and it is connected. 2. It does not give complete picture of Skeleton Tracking. Well, it is true. I think you need to read the book further to get the entire idea. This chapter overlooked on it intentionally I think, because there is a separate section for the same. 3. Hmm, yes, there are sections which are intentionally cut down to decrease the page count. I know it might be hard for a beginner like you to code it completely. But probably this book is not intended to give insights on actual programming, and I think you need another book to learn WPF and/or windows programming before you can go with this book. This book is intended only for Kinect SDK. 4. Page 169. I dont know why the code sample Failed for you. Did you added proper namespaces? As I see the code uses Linq, and probably you need to add that namespace in addition to the SDK ones. Can you specify your error message so that we could get an idea what you are missing (probably if you cannot fix it yourself). 5. SensorChooserUI is not a part of SDK, it is a part of toolkit. I think the book already states how to use Kinect developer toolkit in Page 205. I think you should read the book again before you comment again. Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.
https://channel9.msdn.com/coding4fun/kinect/Theres-a-new-book-in-town-Kinect-for-Windows-SDK-Programming-Guide
CC-MAIN-2017-09
refinedweb
1,109
78.18
« Cairngorm Sample – How Business Logic Can Manage Views Part IV | Main | Download Distortion Effects – From MAX 2006 » September 28, 2006 Using Binding Securely! Posted by auhlmann at September 28, 2006 11:58 AM You could also use mx.binding.utils.ChangeWatcher or mx.binding.utils.BindingUtils to invoke a method instead of a setter. Posted by: Xavi Beumala at October 5, 2006 04:20 AM I was using this aproach and came up with a bug. I am using the ObserveValue tag inside a popup and when the value isComplete changes the Observe invokes the handler which closes the popup using PopUpManager.removePopUp( this );. Now when I close the poup I set the isComplete to false in case I make that call again. But now next time I open the window the ObserveValue tag invokes the handler but with a difrent scope of "this". So now when I do PopUpManager.removePopUp( this ) it does not work because of the wrong scope. Any Ideas? Posted by: Omar Ramos at October 20, 2006 09:26 AM Hi Alex. I have a question/problem with cairngorm. When i try to compile my project appear this error. /* 1144: Interface method onFault in namespace com.adobe.cairngorm.business:Responder is implemented with an incompatible signature in class com.ria.commands.login:LoginCommand. */ I found in the doc's that the error code 1144 is /* 1144 Interface method _ in namespace _ is implemented with an incompatible signature in class _. Method signatures must match exactly. */ But any idea how can i solve it. Should I move me code near to the Cairngorm.swc file. It's a namespace problem? Thanks in advance.! Posted by: luchyx at October 24, 2006 05:55 PM Hi, I'm going to write a large application using Cairngorm and i am not sure how to update a single item in a collection of items. a specific item may change after server poll and i would like to implement some kind of a smart update that doesn't update's the whole collection and still change the view. can it be done with modelLocator and databinding? thanks, i find all your articles very useful. Eran Posted by: vigen at October 25, 2006 05:39 AM If you can bind data elements to XML using E4X and you are retieving XML from the server why wouldn't you use XML Value Objects instead of Action Script Value Objects? Thanks Posted by: Joel at November 1, 2006 02:04 PM Great tips. Thanks for sharing. As Xavi mentioned in the first comment, mx.binding.utils.BindingUtils is available for binding to methods. I've been using BindingUtils for this purpose, but have found one slight drawback to the approach. The binding is triggered once when it is set, which is often prior to the source of the binding being set with anything useful. I have simple workarounds for most situations, but I'll be stoked if these tags avoid that initial call. Well, off to give it a go. Thanks again for taking the time to share with all of us. Marcus. Posted by: Marcus at December 13, 2006 12:42 AM yeah great, if you want to learn some more basic binding? Binding 101 can be found here: Posted by: Maikel Sibbald at December 19, 2006 10:02 AM I wasn't able to get Observe to work, but ObserveValue works like a charm. Did anyone else have problems implementing Observe? Posted by: Mike Britton at March 1, 2007 10:39 AM Why do not use ChangeWatcher ? ChangeWatcher.watch ( model, "propertyname", handler ) Posted by: JR at March 7, 2007 06:09 AM Mike: I am also having problems with observe.. I was previously using Pauls version, but when I swap it out with Alex's the handler no longer fires... I am listening to a string object on a model in cairngorm. I have gone back to using Pauls version for the moment. Any thoughts Alex? Posted by: Andy at March 8, 2007 04:10 PM hi, If you want to see some more Binding magic then have a look at I use this to implement a cross-component ModelLocator. Ernest Posted by: Ernest at August 7, 2007 11:27 AM Hi, is possible use the Observe in action scrip?? i try to implements in one component but don't work. the project complie but not work. you have any example in action scrip?? Posted by: jvfacio at August 8, 2007 02:50 PM The binding is triggered once when it is set, which is often prior to the source of the binding being set with anything useful. I have simple workarounds for most situations, but I'll be stoked if these tags avoid that initial call. Posted by: Peter at October 6, 2007 08:57 AM: Posted by: David Frankson at December 18, 2007 06:41 AM is possible use the Observe in action scrip?? i try to implements in one component but don't work. the project complie but not work. Posted by: sharp aquos at December 19, 2007 01:20 PM I had the same Problem: ErrorID 1009: "Cannot access a property or method of a null object reference." But thanks for the examples. it´works excellent... Posted by: Werbeagentur at February 4, 2008 11:54 PM
http://weblogs.macromedia.com/auhlmann/archives/2006/09/using_binding_s.cfm
crawl-002
refinedweb
888
73.58
For a presentation, I wanted to produce samples of Python interactive sessions. I could have opened a terminal window and typed my input, and copied the resulting session and pasted it into a text file, but that’s not repeatable, and is labor intensive and error-prone. I looked for ways people had done this in the past, and didn’t find the thing that I’m sure is out there, but it’s fun to do it yourself anyway. The code module in the standard library provides most of the heavy lifting, but there’s a little input and output grabbing and tweaking to be done. Here’s what I ended up with: """A Python prompt in a cage, for producing prompt sessions.""" import code import cStringIO as StringIO import sys import textwrap class CagedPrompt(code.InteractiveConsole): def __init__(self): env = {'__name__': '__main__'} code.InteractiveConsole.__init__(self, env) self.out = StringIO.StringIO() def run(self, input): self.inlines = textwrap.dedent(input).splitlines() old_stdout = sys.stdout sys.stdout = self.out self.interact("Python " + sys.version.split("[")[0]) sys.stdout = old_stdout self.output = self.out.getvalue() def raw_input(self, prompt): try: line = self.inlines.pop(0) except IndexError: raise EOFError if line or prompt == sys.ps2: self.write("%s%s\n" % (prompt, line)) else: self.write("\n") return line def write(self, data): self.out.write(data) def prompt_session(input): cp = CagedPrompt() cp.run(input) return cp.output if __name__ == '__main__': TEST_INPUT = """\ 2+2 import random random.random() class Foo: pass f = Foo() f """ print prompt_session(TEST_INPUT) Running it produces: $ python cagedprompt.py Python 2.6.6 (r266:84297, Aug 24 2010, 18:13:38) >>> 2+2 4 >>> import random >>> random.random() 0.48519166487066712 >>> class Foo: ... pass ... >>> f = Foo() >>> f <__main__.Foo instance at 0x00000000025B6448> There’s a few small ways the output differs from a real interactive session: the initial banner is shorter, and a blank line in the input will produce a true blank line in the output. These make the output nicer to use for presentations. Now I can use the prompt_session function to get the textual output of a Python prompt fed with a particular input. Nice. Not sure if this helps, but if you are on a Linux command line, you can also use the script command. This basically logs all information from stdout and stderr to a file. Thanks @farzadb82, I hadn't heard of the script command. But that still leaves me entering input by hand, and redoing it by hand if the input needs to be different. How about using Crunchy? [ Or perhaps Reinteract (?) - I have only seen a demo of it.] I believe player piano may qualify as the "thing you're sure is out there": It's actually designed so you can bang away at the keyboard as if you were actually typing at the interactive prompt, but I expect you could extract the recorded doctests in other ways easily enough. The trouble with Python is that it's often far simpler and more fun to invent your own solution than it is to use someone else's. See also -. It's very useful for demo'ing code while minimizing typos in front of the audience. Add a comment:
https://nedbatchelder.com/blog/201107/caged_python.html
CC-MAIN-2021-31
refinedweb
538
67.15
How do I write function to test if a graph is apex? I am working on topological graph theory problems and using SageMath. I want to create a function that give a boolean True or False answer, so I can use this answer for further use. My current function that I use: def is_apex(a): for v in a.vertex_iterator(): l=a.neighbors(v) if a.is_planar(a.delete_vertex(v)): print("Deleting vertex ",v," makes a planar graph") a.add_vertex(v) a.add_edges([(v, y) for y in l]) else: a.add_vertex(v) a.add_edges([(v, y) for y in l]) print("Deleting vertex ",v," does not make a planar graph") I am a noob when it comes to programming, and any help would be awesome. I want a True returned if the graph is apex and a False value to return for not apex. Thoughts?
https://ask.sagemath.org/question/35112/how-do-i-write-function-to-test-if-a-graph-is-apex/
CC-MAIN-2018-47
refinedweb
146
74.08
Asked by: Sending ESC/POS Commands to Thermal Printer in Windows 8 RT Hi, We have POS (Point of sale) Software for restaurants, which print receipts on Thermal printers. We are using class from to send raw data (text, and commands) to Receipt printers. We are currently looking for solution to send same commands to Bluetooth printers (which support ESC/POS commands) from Windows store app (or any shared POS printer if it's possible). We can do it from IOS/Android - but can't find any example of how to do it from Win 8 apps. Not sure is it even possible. We are using C# if it means anything :) and here is example of printer ThanksTuesday, February 12, 2013 11:03 AM Question All replies I don't believe this is currently possible. Printing in Windows store apps is managed through a heavily abstract print contract manager. To generate the document to print you simply supply a XAML/HTML surface to the print manager when particular events are raised. As the document is generated by the GUI there is no ability to send low level commands to the printer. I've also taken a look through the extensions to the printer objects and I can't see anything related their either. The likely scenario is you'll need to write some kind of WinRT extension which is utilized by your app to communicate with the driver at a much lower level. I'm still searching for documentation on how to achieve something similar and will post if/when I find something. Windows/Windows Phone Device & integration consultant | Follow Me on Twitter: @LewisBenge Or check out my blog:, February 14, 2013 12:14 AM - Thanks Lewis. I'm currently talking with MS stuff regarding this, and will also post answer here. For now, it looks like these devices (bluetooth printers) are not Printers (when it comes to communication protocols and standards they support), they are more like bluetooth devices which have attached printer capabilities (Which means we need to have support for SPP in WinRT, I guess).Thursday, February 14, 2013 10:08 AM Hi fun.ky, what you're guessing is possible, and also with the product you mentioned. I'm currently writing foy my business a Windows Phone 8 app, that will print receipts with a Bixolon SPP R300 Bluetooth printer. After a lot of search (there is few documentation on the web), I believe the only way to communicate with these printers is to use RFCOMM protocol (virtualizing serial ports). So, you would send data to the printer using ESC/POS commands, that are widely used for printing: also BIXOLON printers support them. I don't like very much this approach, but my customers need a solution, and this is quite easy to implement... I can try to help with the code if you want. Tuesday, May 7, 2013 6:13 PM - Proposed as answer by Stefano Masseroli Wednesday, May 8, 2013 6:32 AM Hi Stefano and thanks for sharing your solution, code example (or sln with that code) would be amazing.Thursday, May 9, 2013 8:58 AM Hi and sorry for the late... First of all, make the Bluetooth pairing between the printer and your device (Windows Phone 8 needed), then check the capabilities of your project (proximity must be activated): <Capabilities> ... <Capability Name="ID_CAP_PROXIMITY" /> ... </Capabilities> These namespaces will be required: using Windows.Networking.Proximity; using Windows.Networking.Sockets; using Windows.Storage.Streams; Start from this code for the connection to the printer: // New socket: StreamSocket streamSocket = new StreamSocket(); // Init connection: await streamSocket.ConnectAsync(this.PeerInformation.HostName, "1"); // Data writer: DataWriter dataWriter = new DataWriter(this.StreamSocket.OutputStream); // Data reader: DataReader dataReader = new DataReader(this.StreamSocket.InputStream); And then you can start sending you ESC/POS commands via socket: try { // Initialize printer: dataWriter.WriteString(String.Concat((char)27, (char)64)); // Send text: dataWriter.WriteString("Hello, world!"); // Send line feed: dataWriter.WriteString(String.Concat((char)10)); // Let all the commands be flushed/printed: await dataWriter.StoreAsync(); await dataWriter.FlushAsync(); } finally { // Release any resource: streamSocket.Dispose(); } I hope this can help you... Friday, May 17, 2013 6:55 AM - Edited by Stefano Masseroli Friday, May 17, 2013 6:56 AM - Proposed as answer by Stefano Masseroli Friday, May 17, 2013 9:23 AM Also, you can check out my Windows Phone 8 app (which has also a Windows Phone 7.1 version, that obviously doesn't support this Bluetooth print feature): in the next 2 weeks I hope I will publish on the Windows Phone 8 Store some interesting features related to this topic. The app (that is an ERP mobile client) will be able to print documents sending ESC/POS commands to BIXOLON Bluetooth printers, having a simple "receipt" as a result... This is the link of the app (the name is Smart.1): Smart.1 downloadFriday, May 17, 2013 9:22 AM Thank you......thank you..... thank you..... very much...... this gave me some hope and relief thanks again.....Thursday, April 30, 2015 6:00 PM
https://social.msdn.microsoft.com/Forums/en-US/73f722bb-26ca-4662-88fa-d622a481e079/sending-escpos-commands-to-thermal-printer-in-windows-8-rt?forum=tailoringappsfordevices
CC-MAIN-2019-13
refinedweb
842
62.58
The Samba-Bugzilla – Bug 3799 source/client/(u)mount.cifs.c do not compile if MOUNT_CIFS_VENDOR_SUFFIX is undefined Last modified: 2006-07-01 11:37:42 UTC When MOUNT_CIFS_VENDOR_SUFFIX is undefined, the mount.cifs.c and umount.cifs.c utilities do not compile as the version.h file is not found. We finally found that replacing: #include "version.h" by #include "../include/version.h" or compile with "-I./" allows the utilities to compile. I guess that this bug has been missed mostly because the build farm usually defines MOUNT_CIFS_VENDOR_SUFFIC Is this not fixed when using --with-cifsmount ? I'm just trying to compile 3.0.23rc3 without the patch we temporarily added and with --with-cifsmount. Will let you know I confirm that compiling with --with-cifsmount solves this issue ok. Taking that to mean we can close this one.
https://bugzilla.samba.org/show_bug.cgi?id=3799
CC-MAIN-2017-30
refinedweb
140
54.59
Predict the output of following C++ program. #include <iostream> using namespace std; int main() { int test = 0; cout << "First character " << '1' << endl; cout << "Second character " << (test ? 3 : '1') << endl; return 0; } One would expect the output will be same in both the print statements. However, the output will be, First character 1 Second character 49 Why the second statement printing 49? Read on the ternary expression. Ternary Operator (C/C++): A ternary operator has the following form, exp1 ? exp2 : exp3 The expression exp1 will be evaluated always. Execution of exp2 and exp3 depends on the outcome of exp1. If the outcome of exp1 is non zero exp2 will be evaluated, otherwise exp3 will be evaluated. Side Effects: Any side effects of exp1 will be evaluated and updated immediately before executing exp2 or exp3. In other words, there is sequence point after the evaluation of condition in the ternary expression. If either exp2 or exp3 have side effects, only one of them will be evaluated. See the related post. Return Type: It is another interesting fact. The ternary operator has return type. The return type depends on exp2, and convertibility of exp3 into exp2 as per usual\overloaded conversion rules. If they are not convertible, the compiler throws an error. See the examples below, The following program compiles without any error. The return type of ternary expression is expected to be float (as that of exp2) and exp3 (i.e. literal zero – int type) is implicitly convertible to float. #include <iostream> using namespace std; int main() { int test = 0; float fvalue = 3.111f; cout << (test ? fvalue : 0) << endl; return 0; } The following program will not compile, because the compiler is unable to find return type of ternary expression or implicit conversion is unavailable between exp2 (char array) and exp3 (int). #include <iostream> using namespace std; int main() { int test = 0; cout << test ? "A String" : 0 << endl; return 0; } The following program *may* compile, or but fails at runtime. The return type of ternary expression is bounded to type (char *), yet the expression returns int, hence the program fails. Literally, the program tries to print string at 0th address at runtime. #include <iostream> using namespace std; int main() { int test = 0; cout << (test ? "A String" : 0) << endl; return 0; } We can observe that exp2 is considered as output type and exp3 will be converted into exp2 at runtime. If the conversion is implicit the compiler inserts stubs for conversion. If the conversion is explicit the compiler throws an error. If any compiler misses to catch such error, the program may fail at runtime. Best Practice: It is the power of C++ type system that avoids such bugs. Make sure both the expressions exp2 and exp3 return same type or atleast safely convertible types. We can see other idioms like C++ convert union for safe conversion. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above. We will be happy to learn and update from other geeks.
http://www.geeksforgeeks.org/cc-ternary-operator-some-interesting-observations/
CC-MAIN-2016-07
refinedweb
504
57.77
Wireshark mailing list archives On Friday 28 March 2014 13:10:09 我想不无聊 wrote: then I add the file to /gtk/main.c file , #include "peformance.h" //somebody told me not to use "../peformance.h" because there is subdir to search Well, I was that "somebody" and refused to reply on the last private mail because you provided *no* additional details that was requested. peformance pef_test; peformance *peformance_test=&pef_test; Please fix this typo, it is performance. PeRformance. in the ./wiretap/libpcap.c file, I want to use struct peformance , #include "peformance.h" //or #include "../peformance.h",i do not know which one to use peformance_test->index=0; it shows to me one error,the error information is : " wiretap/.libs/libwiretap.so: undefined reference to `peformance_test' " what is going on and why is that? libwiretap is not linked with the ui, but wireshark is. If you need your symbol in libwiretap, then define performance_test in libwiretap. libwiretap gets linked with wireshark, so this should work fine. Kind regards, Peter ___________________________________________________________________________ Sent via: Wireshark-dev mailing list <wireshark-dev () wireshark org> Archives: Unsubscribe: mailto:wireshark-dev-request () wireshark org?subject=unsubscribe By Date By Thread
http://seclists.org/wireshark/2014/Mar/228
CC-MAIN-2014-42
refinedweb
193
59.3
[This is from the MB-Secissues mailing list.] Hi We just fixed an issue in Opera 11.50, but as we noticed a few other browsers are vulnerable, we did not post any details.: "Fixed a moderately severe issue. Details will be disclosed at a later date." The issue is an old one. Some non-HTTP protocols running on a server might respond to HTTP requests with an error message, and return (parts of) the incoming request. If web browsers content-sniff data returned withouth HTTP headers, an attacker might be able to send data to such a service, and have the server return an error which the browser interprets as HTML/JS. This opens up for XSS. HTTP version 0.9 (which is still in use in some rare cases) does not send HTTP headers, so we still content sniff on ports 80 and 443. Our fix is to stop content sniffing on non-standard ports. We require either an explicit HTTP/1.* header (then we will content sniff), or a Content-type. There are of course other fixes too, like not running scripting, even if one does content sniff. Our test case tests our implementation, so it might be some other browsers are not vulnerable, even though I have listed them as failing on our TC. We will withhold information for now, if nobody tells us otherwise, we will publish full details next time we clean up in our unpublished advisories, at least half a year from now. If anyone wants us to hold off longer, or would like more info, please let us know. Failing on our test case: Opera 11.11 Chrome 12.0 Safari 5.0.4 Firefox 4.0.1 Internet Explorer 8.0 Passing on our test case: Opera 11.50 This has been tested well, and we have found no compatibility issues with this. -- Sigbjørn Vik Quality Assurance Opera Software _______________________________________________ MB-SecIssues mailing list MB-SecIssues@list.opera.com When they say they don't content sniff, what behavior did they implement, exactly? I would have no problem with not sniffing HTTP 0.9 document types on non-default ports, I think; the obvious option is to treat them as application/octet-stream. But note that this does NOT help with <script>s, because those ignore the content-type anyway. So are they only protecting against sniffing as HTML and not worrying about <script>s embedding such content? Or something else? It's hard to evaluate what needs doing here about a better idea of what their attack scenario is and what their proposed change is. The contact at Opera is Sigbjørn Vik <sigbjorn@opera.com>. I don't know any more than what's in the email :-) Gerv OK, I mailed him. Specifically what I sent: Sigbjørn, This mail is about your post to MB-Secissues about HTTP 0.9 and sniffing. There's a Gecko bug tracking this at (security-sensitive, of course; I can add you to the bug if you have a bugzilla account). I'm trying to understand the extent of the problem here. Your description of Opera's mitigation is that you simply don't perform type sniffing on such responses, but <script> tags ignore the type anyway. So are you just protecting against using an HTTP 0.9 response as HTML in this situation but not against using it as a script? What XSS vectors are you concerned with, exactly? For a non-default port, a page would not typically run with the origin of regular (port 80/443) pages on the same hostname, right? So while you can inject script into the page and run it with the origin "", what issues does that cause? I suppose it can circumvent XHR same-origin restrictions? The other question I had is what your mitigation actually does. You don't sniff the type. Does that mean you treat it as application/octet-stream? Or something else? On MB-SecIssues, Adam Langley of Google asked: > Is there a new, specific, cross-protocol attack here or is this a > general mitigation? and Sigbjørn replied: This is a general mitigation, we have not done any research into which protocols/applications might be abused this way. Gerv Reply to my mail too: 1) "Correct. Scripts in an HTML file will be executed in the domain of the HTML file. Plain scripts execute in the domain of the HTML file which includes them." 2) "You are right that the same origin policy typically protects against cross port vectors, though the web is not used to relying on this. For instance cookies do not abide by ports, and you mention XHR. I don't think the origin header takes this into consideration either. If you start looking into other technologies (e.g. plugins, SVG, Xpath, cached site policy files, application cache ...), I am sure you will find other examples. For practical purposes, getting cookie access is mostly equivalent to XSS. Apologies if my original mail was unclear." 3) "text/plain" Doing what Opera did should not be difficult if that's the way we want to go. Thoughts? It's probably not a common scenario, but large/popular domains with cookies worth stealing are precisely the ones who might have a non-web server running on one of their public machines somewhere. Maybe on a non-banned port. Created attachment 543064 [details] [diff] [review] This is what Opera seems to have done Unfortunately, I can't seem to run a test server on port 80, so can't test the "default port" codepath... Comment on attachment 543064 [details] [diff] [review] This is what Opera seems to have done Review of attachment 543064 [details] [diff] [review]: ----------------------------------------------------------------- the content type of a http/0.9 is supposed to be html, not plain. I don't know that it matters, without content-sniffing its pretty much just not going to work no matter what for somebody. > the content type of a http/0.9 is supposed to be html, not plain. Right, but that gives the XSS issue. > without content-sniffing its pretty much just not going to work Indeed. That's the effect of this patch. HTTP/0.9 on non-default ports (80 for HTTP and 443 for HTTPS) will just show the text and that's it. dveditz, is this something we want to backport to 3.6? Is there any reason not to take this on 3.6.x? > Is there any reason not to take this on 3.6.x? The only obvious one is compat risk, but we haven't run into issues with it, and I would judge it to be pretty low. Created attachment 570047 [details] [diff] [review] 1.9.2 branch fix Comment on attachment 570047 [details] [diff] [review] 1.9.2 branch fix Requesting 1.9.2 approval. Comment on attachment 570047 [details] [diff] [review] 1.9.2 branch fix Approved for 1.9.2.24. Please land on releases/mozilla-1.9.2 default branch asap. Thanks! What is the manual STR for this or is the new 1.9.2 unit test sufficient to test this for 1.9.2 verification? The other option is to set up a web server that serves something that looks like HTML on a non-standard port using HTTP 0.9 and see whether a script in that HTML runs... Thanks, Boris! ;-) I'm calling this verified1.9.2 based on the script. This was rated "sg:high" based on the "XSS" claim, but a server running something that we think is maybe HTTP 0.9 is on a different origin (scheme-host-port) than the site's actual website by definition. There are risks here (spoofing, grabbing non-httponly domain cookies) but it's not universal XSS and doesn't meet the "high" bar for me. Please correct if I'm missing a potential attack that's more severe. Any plans to assign CVE to this? Trusting this is fixed for other versions of Firefox just as Al did for 1.9.2. If someone is already set up to verify this fix re: comment 21, please do so. Thanks
https://bugzilla.mozilla.org/show_bug.cgi?id=667907
CC-MAIN-2017-30
refinedweb
1,364
75.71
Over the past couple months, we’ve been playing more and more with C# 3.0, .NET 3.5 and Visual Studio 2008 (man, it’d be nice to get these version numbers synced up). At first I was naively optimistic about the usefulness of extension methods, but in practice, they seem to add no real value and, on occasion, decrease readability. The C# specifications themselves point out this flaw: (Interestingly, I couldn’t find the same such warning for VB.NET – maybe I was just looking at the wrong document). I understand that extension methods were required for LINQ, but I haven’t come across, nor am I able to think of, a situation in which it’ll ever be necessary for me to use. Open classes have been a small stumbling block for Java/.NET programmers doing the switch to Ruby, and I see extension methods as a poor-man’s implementation of those. In the end, like with anything else, it comes down to responsible and proper use. With or without extension methods, a bad programmer will write un-maintainable code. However, I do wish that the countless blogs and articles covering the new Orcas features, like extension methods, would do more than show-off the syntax and pump out a few examples. Explaining shortcomings, pitfalls and proper usage is more important than shallow examples. For me though, I’ll stick with my explicit procedural StringUtility class.”! FYI, the text that you quoted does not exist in the final C# specification that was released on Aug. 21st. You can always get the latest specification here: ‘IsBusinessDay’ method that uses business logic to determine if the date value is a business day. Another method for ‘AddBusinessDays’ could be added too. The question that is yet to be answered for these approaches though is whether or not these extension methods would be intuitive for new team. in most cases is more of a preference matter and a “nice to have” feature, nothing you couldn’t do in a different way, but most features are that anyway, the problem is with the (ab)use of it I agree with Don. Extension methods are great (necessary?) for functional programming. don’t see how i would use them at all, ever. It seems like i need that kind of dynanism, i’d go for the ruby implementation like you said. I repeatedly make it a point to demonstrate how using extension methods allows you to easily shoot yourself in the foot if you are not careful. See my post from a year and a half ago regarding this. Then again, I did go off the deep end showing how to simulate extension members through extension methods recently as well. (see). As for the issue with the warning in C# and not VB, realize that VB does make extension method discoverability easier as it adds the “Extension: “descriptor as part of the intellisense tooltip which helps a bit. Scott Bellware made a good suggestion that, if you have to use them, make sure to put them in a namespace that’s explicit. While not as immediately obvious as ‘StringUtility’, seeing a using statement like: using Foo.Bar.ExtensionMethods.String; is a fairly big clue. .
http://codebetter.com/karlseguin/2007/10/04/avoiding-extension-methods/
CC-MAIN-2021-43
refinedweb
541
61.77
Simple yet flexible natural sorting in Python. Project description Simple yet flexible natural sorting in Python. - Source Code: - Downloads: - Documentation: - - - - - - - - - - - How to Build Documentation - - NOTE: Please see the Dropped Deprecated APIs section for changes. Quick Description. Quick Examples - Sort Paths Like My File Browser (e.g. Windows Explorer on Windows) Sorting by Real Numbers (i.e. Signed Floats) Locale-Aware Sorting (or “Human Sorting”) Further Customizing Natsort - - Generating a Reusable Sorting Key and Sorting In-Place - Sorting Versions natsort does these examples. Sort Paths Like My File Browser (e.g. Windows Explorer on Windows) Prior to natsort version 7.1.0, it was a common request to be able to sort paths like Windows Explorer. As of natsort 7.1.0, the function os_sorted has been added to provide users the ability to sort in the order that their file browser might sort (e.g Windows Explorer on Windows, Finder on MacOS, Dolphin/Nautilus/Thunar/etc. on Linux). import os from natsort import os_sorted print(os_sorted(os.listdir())) # The directory sorted like your file browser might show Output will be different depending on the operating system you are on. For users not on Windows (e.g. MacOS/Linux) it is strongly recommended to also install PyICU, which will help natsort give results that match most file browsers. If this is not installed, it will fall back on Python’s built-in locale module and will give good results for most input, but will give poor results for special characters. Sorting by Real Numbers (i.e. Signed Floats)'] Locale-Aware Sorting (or “Human Sorting”). Further Customizing Natsort also add your own custom transformation functions with the key argument. These can be used with alg if you wish. >>> a = ['apple2.50', '2.3apple'] >>> natsorted(a, key=lambda x: x.replace('apple', ''), alg=ns.REAL) ['2.3apple', 'apple2.50'] Sorting Mixed Types You can mix and match int, float, and str (or unicode) types when you sort: >>> a = ['4.5', 6, 2.0, '5', 'a'] >>> natsorted(a) [2.0, '4.5', '5', 6, 'a'] >>> # sorted(a) would raise an "unorderable types" TypeError Handling Bytes natsort does not officially support the bytes type, but convenience functions are provided that help you decode to str first: >>> from natsort import as_utf8 >>> a = [b'a', 14.0, 'b'] >>> # natsorted(a) would raise a TypeError (bytes() < str()) >>> natsorted(a, key=as_utf8) == [14.0, b'a', 'b'] True >>> a = [b'a56', b'a5', b'a6', b'a40'] >>> # natsorted(a) would return the same results as sorted(a) >>> natsorted(a, key=as_utf8) == [b'a5', b'a6', b'a40', b'a56'] True Generating a Reusable Sorting Key and Sorting In-Place. Other Useful Things - recursively descend into lists of lists - automatic unicode normalization of input data - controlling the case-sensitivity - sorting file paths correctly - allow custom sorting keys - - How do I debug natsort function with natsort, or use the natsort key as part of your rich comparison operator definition. - natsort gave me results I didn’t expect, and it’s a terrible library! Did you try to debug using the above advice? If so, and you still cannot figure out the error, then please file an issue. - How does natsort work? If you don’t want to read How Does Natsort Work?, here is a quick primer. natsort providesort sorting behavior with the key and/or alg options (see details in the Further Customizing Natsort section). The key generated by natsort_keygen always returns a tuple. It does so in the following way (some details omitted for clarity): Assume the input is a string, and attempt to split it into numbers and non-numbers using regular expressions. Numbers are then converted into either int or float. If the above fails because the input is not a string, assume the input is some other sequence (e.g. list or tuple), and recursively apply the key to each element of the sequence. If the above fails because the input is not iterable, assume the input is an int or float, and just return the input in a tuple. Because a tuple is always returned, a TypeError should not be common unless one tries to do something odd like sort an int against a list. Shell script natsort comes with a shell script called natsort, or can also be called from the command line with python -m natsort. Requirements natsort requires Python 3.6 or greater. Optional Dependencies fastnumbers The most efficient sorting can occur if you install the fastnumbers package (version >=2.0.0);. PyICU It is recommended that you install PyICU if you wish to sort in a locale-dependent manner, see for an explanation why. Installation] How to Run Tests. How to Build Documentation If you want to build the documentation for natsort, it is recommended to use tox: $ tox -e docs This will place the documentation in build/sphinx/html. Dropped Deprecated APIs In natsort version 6.0.0, the following APIs and functions were removed - number_type keyword argument (deprecated since 3.4.0) - signed keyword argument (deprecated since 3.4.0) - exp keyword argument (deprecated since 3.4.0) - as_path keyword argument (deprecated since 3.4.0) - py3_safe keyword. History Please visit the changelog on GitHub or in the documentation. Project details Release history Release notifications | RSS feed 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/natsort/
CC-MAIN-2022-40
refinedweb
899
57.47
perltutorial ait <h3>What is a "Test-Point" and why should I care?</h3> <p> Tests usually fail, at most, with a diagnostic message regarding the overall result of the test or some observable side-effect available to the test code. Then it's up to the programmer to elevate the debugging level and re-run the tests in the hopes that the <i>diagnostic</i> debug messages will give some clue as to what went wrong <i>inside</i> a specific method or subroutine. If the diagnostic messages don't help, the programmer then innocuous at runtime, but are left there, precisely as a reminder that this is usually a good place to stop and inspect something when testing and debugging. <b>It is these spots in the code which we will call "Test-Points" in the context of this tutorial</b>. They are places in the code that help you diagnose a failure, akin somewhat to <i>assertions</i>, but targeted not at unexpected results or side-effects, but rather at expected flows, values, etc. based on certain conditions created by a specific test. </p> <p> It is important to note that contrary to assertions, Test-Points (or TP) are mainly used to give the test code the ability to inspect <i>inside</i> methods at specific places, when running a specific test, and just as debug statements and pre-defined breakpoints, they can be safely left in the code,. </p> <code> package test_class; use Moose; has 'foo' => ( is => 'rw', isa => 'Str', ); has 'bar' => ( is => 'rw', isa => 'Str', ); has 'tp_callback' => ( is => 'rw', isa => 'CodeRef', ); sub BUILD { my $self = shift; # initialize the test callback $self->tp_callback(sub {return;}); } sub asub { my $self = shift; my $lvar_foo; my $lvar_bar; # some code that sets bar $self->bar('result'); # you want to test the value of bar at this point $self->tp_callback->('test_point_one'); # some code that sets a local vars $lvar_foo = 'yuca'; $lvar_bar = 'pelada'; # you want to test the value of lvar at this point $self->tp_callback->('test_point_two', { lvar_foo => $lvar_foo, lvar_bar => $lvar_bar, }); return 1; } __PACKAGE__->meta->make_immutable; 1; </code> <h4>test_class.t</h4> <p> The test code below implements the Test Points. The general structure of the test file is just like any other except that the has four main sections. The first is just the basic declarations and common use_ok tests of any test file. The second, is the declaration of the dispatch table that maps the Test-Point names to their servicing sub-routines. The third is the standard tests you would usually perform on this class, and the fourth are the Test-Point service subroutines. </p> <p> TP names' "Higher order Perl". </p> <code> #!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { use_ok 'test_class' } my $tc = test_class->new(); # the dispatch table my %test_points = ( test_point_one => \&test_point_one, test_point_two => \&test_point_two, ); # setup the callback dispatch test_class.t </p> <p> You should see something like the example results below using bash shell: </p> <code> aimass@yclt2:~/languages/perl/MooseTest$ prove -v test_class.t test_class.t .. ok 1 - use test_class; ok 2 - Value of attr bar at test_point_one ok 3 - Value of lvar_foo at test_point_two ok 4 - Value of lvar_bar at test_point_two ok 5 - Result of asub 1..5 ok All tests successful. Files=1, Tests=5, 0 wallclock secs ( 0.05 usr 0.00 sys + 0.37 cusr 0.02 csys = 0.44 CPU) Result: PASS </code> <h3>Avoiding TP abuse by Meta manipulation in Moose</h3> ]. </p> <code> package cond_tp; use Moose; use namespace::autoclean; has 'foo' => ( is => 'rw', isa => 'Str', ); has 'bar' => ( is => 'rw', isa => 'Str', ); # set-up Test-Point depending on debug level { my $debug_level = $ENV{'MYDEBUG_LEVEL'} || 0; my $meta = Class::MOP::get_metaclass_by_name(__PACKAGE__); # enable TPs at debug level 5 and higher if($debug_level > 4){ $meta->add_attribute( tp_enabled => ( accessor => 'tp_enabled', init_arg => undef, # prevent override via new() predicate => 'has_tp_enabled' default => 1, # test-points are enabled writer => undef, # always read-only ) ); $meta->add_attribute( tp_callback => ( accessor => 'tp_callback', # default is rw predicate => 'has_tp_callback', default => sub {return;}, ) ); } else{ $meta->add_attribute( tp_enabled => ( accessor => 'tp_enabled', init_arg => undef, predicate => 'has_tp_enabled', default => 0, # test points are disabled writer => undef, ) ); $meta->add_attribute( tp_callback => ( accessor => 'tp_callback', predicate => 'has_tp_callback', default => sub {return;}, writer => undef, # cb is now read-only ) ); } } sub asub { my $self = shift; my $lvar_foo; my $lvar_bar; # some code that sets bar $self->bar('result'); # TP conditioned $self->tp_callback->('test_point_one') if $self->tp_enabled; # some code that sets a local vars $lvar_foo = 'yuca'; $lvar_bar = 'pelada'; # TP conditioned $self->tp_callback->('test_point_two', { lvar_foo => $lvar_foo, lvar_bar => $lvar_bar, }) if $self->tp_enabled; return 1; } __PACKAGE__->meta->make_immutable; 1; </code> <h4>cond_tp.t</h4> <p> The test code is almost exactly the same as the previous one except for the conditional on setting-up the callback. </p> <code> #!/usr/bin/perl use strict; use warnings; use Test::More; BEGIN { use_ok 'cond_tp' } my $tc = cond_tp->new(); # the dispatch table my %test_points = ( test_point_one => \&test_point_one, test_point_two => \&test_point_two, ); # setup the callback dispatch only if enabled if($tc->tp_enabled){ cond_tp.t </p> <p> Test the TP conditionals by setting the MYDEBUG_LEVEL to 5 and above. You should see something like the example results below using bash shell: </p> <code> aimass@yclt2:~/languages/perl/MooseMeta$ export MYDEBUG_LEVEL=5 aimass@yclt2:~/languages/perl/MooseMeta$ prove -v cond_tp.t cond_tp.t .. ok 1 - use cond_tp; ok 2 - Value of attr bar at test_point_one ok 3 - Value of lvar_foo at test_point_two ok 4 - Value of lvar_bar at test_point_two ok 5 - Result of asub 1..5 ok All tests successful. Files=1, Tests=5, 1 wallclock secs ( 0.04 usr 0.01 sys + 0.40 cusr 0.01 csys = 0.46 CPU) Result: PASS aimass@yclt2:~/languages/perl/MooseMeta$ export MYDEBUG_LEVEL=4 aimass@yclt2:~/languages/perl/MooseMeta$ prove -v cond_tp.t cond_tp.t .. ok 1 - use cond_tp; ok 2 - Result of asub 1..2 ok All tests successful. Files=1, Tests=2, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.39 cusr 0.02 csys = 0.45 CPU) Result: PASS </code> <h3>References</h3> <p>[id://880440]</p> <p>[id://880012]</p>
http://www.perlmonks.org/index.pl?displaytype=xml;node_id=882331
CC-MAIN-2015-40
refinedweb
997
52.6
Hi Richard, Hi Emacs! After point has been moved, how can I determine exactly which primitive did the moving? The reason I want to know is so as to handle "unbalanced" braces properly in CC Mode when they're inside #if and friends. Such as: #if NEW_VERSION int foo (int bar, int baz) { // <========= brace A #else int foo (int bar) { // <========== brace B #endif If the user arrives at brace B through scan-lists (e.g. with C-M-u) I want to catch this (possibly by the use of point-entered/left text properties), and according to some user options, perhaps adjust point to brace A. However, if the user gets to brace B with forward-line (e.g., with C-p) I want to leave point well alone. I want to draw this distinction regardless of whether point is moved directly by the user or inside CC Mode's analysis functions. Is there any way I can tell which of these primitives got me to brace B? Thanks in advance! -- Alan Mackenzie (Nuremberg, Germany).
http://lists.gnu.org/archive/html/emacs-devel/2009-11/msg00140.html
CC-MAIN-2016-07
refinedweb
175
81.73
This is a showcase review for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers. by Kevin Sikes When I started my current job as a senior product developer, one of the first things my new co-workers asked as I met each of them was, "Have you installed Visual Assist X yet?" After the fourth or fifth developer hit me up, I figured they were all involved in a network marketing scheme and soon I too would be recruiting friends and family to Buy Software from Themselves to Achieve Financial Independence. Why else would everyone be so adamant about installing an IDE plug-in? Read on to learn the real reason my co-workers virtually dragged me to our purchasing agent to get my very own license for Visual Assist X! Visual Assist X is the flagship product of Whole Tomato Software. The software is an impressive toolbox of Intellisense upgrades, syntax highlighting, and other cool extensions to the Microsoft line of IDEs, from Visual C++ 6.0 through Visual Studio 2005. Visual Assist X supports C#, C++ and VB.NET. If I reviewed every one of the 40 features in Visual Assist X, you'd be reading for an hour, so I'll just give you the goodies in this article. To compare the look and feel of Visual Studio with and without Visual Assist X, consider this screen shot from Visual Studio .NET 2003: Now look at the same snippet of code after installing Visual Assist X: As you can tell from from the screen shots, Visual Assist X offers a more visually stimulating look at your code. Visual Assist X allows you to work more efficiently by distinguishing functions/methods (brown), variables (gray), and types (blue). Of particular interest to me is the ability to color macros (purple), which the IDE still can't do as of Visual Studio 2005. You can even apply the syntax coloring to tooltips! Since the authors of Visual Assist X understand different developers work in different ways, they make the syntax coloring highly customizable. You pick the colors that make sense to you, and choose what you want and don't want colored. What's useful to one developer might simply be noise to another, so Visual Assist X allows you to enable only those features you find helpful. For instance, my code screen shots also show local symbols in bold and "stable symbols" in italics, but I prefer not to use these features and have not enabled them on my production machine. This was the feature that got me hooked on Visual Assist X. Place the caret on a symbol and press Alt+G, or click the button. You are taken to the definition of the variable or type, or the prototype or implementation of the method. In the latter case, Visual Assist X gives you the choice of the header or implementation file. This feature does not rely on the browser files generated by Visual Studio, so you don't have to compile your code first. Instead, Visual Assist X parses your code and library/SDK headers in the background. This process is throttled so it doesn't kill the IDE's performance. Visual Assist X even knows the value of C/C++ macros and where they're defined, and will display the value in a tooltip and allow you to go to the definition of the macro. In my opinion, this alone was worth the price of the software! Visual Assist X offers suggestions to complete partial symbol names as you type. This incredible feature allows you to concentrate on your development task rather than the drudgery of remembering hundreds of variable and method names. As you type, Visual Assist X matches your keystrokes against symbols that are currently in scope, and displays a list so you can accept a suggestion. The more characters you type, the more refined the suggestions become: Here's another feature you'll wonder how you lived without. After pressing "." or "->" following a class instance, Visual Assist X presents you with a powerful member listbox. You can configure Visual Assist X to display non-inherited methods in bold and to place them first in the list, giving you quick access to the class members that are most needed. Visual Assist X also allows you to filter the list on public, private, and protected methods, variables, operators, constants, and enums. Acronyms save typing by matching your keystrokes to members that may have other characters interspersed. For instance, a variable named nSomeVeryLongIntegerName may be accessed by typing the characters n-s-v-l-i-n one at a time until a match is found. In my example, I find the entry I want with " m_bnu." Shorthand and Acronyms work with both suggestion lists and enhanced member listboxes. Another area where Visual Assist X is extremely helpful is when working with many source files, whether in a single project or distributed among multiple projects in a large solution. Although Visual Studio allows you to be organized by grouping your files together under logical folders in the Solution Explorer, this makes it hard to find a particular file when you don't know to which group it belongs. With Visual Assist X, quickly locate a file residing under any project in your solution by opening the OFIW dialog and entering a portion of the file name. In my example, I've found all headers containing "util." In the same vein as OFIW, the Find Symbol in Workspace dialog allows you to enter part of a symbol name, whether it be a variable, method, macro, or constant, and the list is populated with matching symbols defined anywhere within the solution. Double-click a row to be taken to that symbol definition. I can't even begin to tell you how much more productive this is than Find in Files, and you can find symbols anywhere on your include path by clearing the "Show only symbols defined in current workspace" check box. For instance, uncheck the box and type SendMessage to find it in the Windows headers. I could write a book about this feature alone. Basically, Autotext is a set of templates used to stamp out common code constructs. The templates may contain literal strings or placeholders that are replaced with predefined Visual Assist X variables, user input, environment variables, the current text selection, or clipboard contents. Consider this example, where the key shortcut is " //-" and the code is " // $end$ [$MONTH$/$DAY$/$YEAR$ %USERNAME%]": You can guess what's going on here by the intuitive Autotext language. Visual Assist X watches for keystrokes that match shortcuts you've set up, and offers you a suggestion list upon a match. If you accept the suggestion, the replaceable parameters are stuffed in, and the cursor is placed at the $end$ tag for further typing. You may also insert Autotext without keying in a shortcut combination. Autotext may be used to spit out a few characters or to create an entire application framework. You're in control with the easy-to-use Autotext editor and plenty of sample templates. Here are just a few of my other favorite features: nCount, restrict your search for nCountto the current method (or even within an "FONT-WEIGHT: 400">ifor whileloop). Visual Assist X ignores the instances of nCountthat do not belong to the current scope. .to ->when you erroneously use the dot operator with a pointer. Wrong. Despite the welcome improvements to Intellisense in VS 2005, there are still features that only Visual Assist X brings to the table, such as better syntax coloring and improved member listboxes. Basically, Visual Assist X works in conjunction with features of VS 2005. For instance, you can take advantage of VS 2005's new ability to parse conditionally compiled code while maintaining Visual Assist X enhanced listboxes. In the first example below, a macro that determines the presence of additional members in a class is defined. The VS 2005 Intellisense parser detects this macro and grays out the #ifndef...#endif blocks. In the second example, the macro has been commented out; VS 2005 has restored the source code, and Visual Assist X shows the additional members, with the ability to apply a filter in the listbox using the filtering toolbar. In both examples, enhanced syntax coloring is provided by Visual Assist X. The ability to parse symbols for conditionally compiled code in VS 2005 comes at a cost, since the code is essentially being compiled constantly as you type. For many developers who work with large solutions, this has made VS 2005 unusable. Some of these developers have disabled VS 2005 Intellisense altogether and employ Visual Assist X as their sole symbol parser to get back on their feet with VS 2005. I promised I'd tell you why my co-workers insisted I get my own license for Visual Assist X. It's simple, really. They were loath to slog through a code review or type so much as an if statement on my machine without the advantages that Visual Assist X brings to Visual Studio. Yeah, it's that good. Try Visual Assist X free for 30 days, and I guarantee you'll gladly pony up the modest purchase price for this excellent tool. General News Question Answer Joke Rant Admin
http://www.codeproject.com/KB/showcase/VisualAssistX_IDEA.aspx
crawl-002
refinedweb
1,574
59.53
UnNews:Summer Travel Guide From Uncyclopedia, the content-free encyclopedia 27 July 2007 Many people will spin bullshit detailing magnificent trips to Prague and wild adventures in Berlin and so on. So in no particular order, this reporter will be retaking math instead of vacationing, the top places to shy away from when planning your summer vacation this year because you cannot go skiing in Aspen with daddy's money every year. Thinking of taking on a last great trip before college? Why not get trapped in a perpetual gang war? Remember almost everyone in Compton is a lot tougher than Cuba Gooding Jr. in Boyz in the Hood or the sequel Snow Dogs, while those not tougher than these two Gooding roles can be found in the Compton Coroners office. After the great Crack Epidemic ravaged the land in the 90s, its bustling economy is now known for exporting essential textiles such as crystal meth and dead bodies. Just watch Boyz in the Hood from the safety of your gated community.Baghdad, Iraq Scenic beauty at its finest. A mainstay of places to avoid since the 9th century, Baghdad continues to make the 2007 list. Wow your classmates with tales of brutal civil war by taking a voyage to this cultural hotspot. See a melting pot of cultures all around, literally ,as many cultures in this region routinely explode and scatter the pulp of their culture in all directions. Those students who enjoy going to concerts over the summer will be delighted to hear about Iraq’s bustling underground music scene. Underground, as musicians caught above ground are immediately filleted, after which their appendages are used in Iraq’s famous cuisine. Vacationer will be delighted to here of Iraq’s helpful travel guides eager to show you the sights of this cradle of civilization. He will be standing by the Loch Ness Monster. The etymology of Port Au Prince originates from a Haitian phrase meaning, “to feel like royalty.” This is exactly the sensation one feels, regardless of age, when entering this city. Simply witnessing the abject poverty decimating this overcrowded pit instills an incredible sense of aristocracy in tourists regardless of how often they must resort to the dollar menu when back in the States. Travel guides say this feeling of entitlement might not be as trendy as years past do to the (most) recent revolution. Regardless, the Haitian economy is one of the most stagnate in the world, so practically everyone will feel superior anyway despite how altruistic they are in normal life. With your new found sense of privilege make sure to tip well as the one bright spot of this city is the magnificent cookery. Haitian chefs tickle your palette with the sensual seasonings known as Epis consisting of sugar, L.S.D., and whatever other drugs the bus boy has overdosed on the previous day. While corruption in the federal government is sky high, trendy sightseers will note that economic mobility is equally high. Who wouldn’t want to leave America as a high schooler who can’t pass Academic Development and return (or not) as a Haitian kingpin. A brief glimmer of hope was found in the Great Fire of 1711. Sadly, it burnt itself out and government corruption soon returned. So if you want one of those colorful hats with dreadlocks sewn on or a previously undiscovered strand of Scabbies, Haiti is the place for you to spend your summer months. Have you always wanted your retreat to end in a murder or a sprint away from the police? Look no further than Detroit, Michigan. Summer is a less than ideal type of year for travel here as tourists will miss out on the Halloween tradition dressing up as Kid Rock and igniting black cats with gasoline and 80 proof. However, one may have the fortune of witnessing one of their local sports teams win a league title. These fabulous events typically culminate in residents raising the city to the ground while looting and tipping over cheap Hondas. Speaking of cars, travel agents advise to refrain from using the words GM or Motor City, as bulk of the automotive industry fled the city decades ago leaving Detroit and its suburbs to become paragons of urban decay. Who can forget the sign advertising Rabbits: Pets or Meat in Roger & Me. This bare-knuckle documentary culminates in a cute rabbit desperately fleeing his cooing owner’s arms. Shortly after the loving breeder harshly skins the rabbit on camera to use as food in the impoverished town, hilarity does not ensue. Sierra Leone (African Continent) Have you sat in your History class and thought, “Gee I wish I could have witnessed the Holocaust, it would have made a great summer getaway.” Then act now because specials are going fast and supplies are limited for deals to the Sierra Leone. Get a first class look into a full-scale mass genocide. If extreme vacations are your bag baby, then behold the wonderful lands of the Loma Mensa in a whimsical game of landmine hopscotch across war torn lands ensures fun for the whole family. To the North lies the Sahara desert, a suffocating sandbox of death, and its other neighbors answer to the names of HIV and poverty. Travel guides suggest staying in the pleasantly tropical country of the Sierra Leon and its ironically titled capital of Freetown, where political dissenters are routinely massacred in the spirit of all encompassing justice for all. Hotels promise an exquisite view of the breathtaking lands of this tropical gem where open pit mines provide the backdrop for the natives to mercilessly slaughter each other over the aptly named conflict diamonds, which are later bickered over in divorce proceedings. World leading diamond mining group, De Beers has taken a stand against this practice, favoring to rape and scar the land with their own open pit mines, and for a little bit more, you can book a suite to watch both of these events happen simultaneously. In short, you haven’t lived until you’ve died in the Sierra Leone. Pyongyang, North Korea For those needing a self-esteem boost Pyongyang saves the day. Its entire army (over 1.21 million people) will be sent to meet YOU in the event you choose this lucky city as your summer getaway. The federal government has taken steps to soothe concerned parents making the border of North and South Korea one of the safest locales in all the world. Two entire armies stand on guard to ensure the safety of the young tourists. Just don’t make any sudden movement or you could cause a full scale thermonuclear war okie dokie? North Korea boasts unique lodging venues, the flagship of these is undoubtedly the Ryugyŏng Hotel. This trendy inn, which the Korean people endured a lengthy famine to build, exemplifies the peerless Korean architecture. Although $750 million dollars was spent, this hotel is available at bargain prices as it was never completed. Would be patrons can now purchase their very own 3.9 million square foot skyscraper for the cost of a one night stay at the Baghdad Ramada Inn. For savvy travelers Pyongyang provides a frugal and still exhilarating vacation for a young voyager.
http://uncyclopedia.wikia.com/wiki/UnNews:Summer_Travel_Guide?oldid=5370284
CC-MAIN-2014-41
refinedweb
1,212
59.43
Momentum. Bessen provides interesting historical perspective on patent problems, but he's emphatic that the NPEs (aka patent trolls) are causing damage unlike patent exploiters of the past. "The last two decades saw a dramatic increase in the number of patents on software, and these patents are particularly prone to abuse, both by trolls and by other types of patent holders. Policymakers are increasingly focusing on the problem of frivolous patent litigation. But so far, policymakers haven’t given enough attention to the fact that the patent crisis is mostly about patents on software." Citing a recent report from the nonpartisan Government Accountability Office, Bessen explains the basis for software patent abuse: So why are there so many lawsuits over software patents? The report states that 'many. Because unclear and overly broad language is a hallmark of many software patents, they are often targeted for lawsuits. "[S]oftware patents are particularly prone to . . . abuses because software is inherently conceptual. Software is a technology that represents broad classes of interactions abstractly. That makes it inherently difficult to tie down a software patent to a specific inventive concept." Software patents "are much more likely to have fuzzy boundaries and they are much more likely to be involved in a lawsuit." Bessen thinks that recent Supreme Court cases reaffirming the ban on patenting abstract ideas could result in invalidation of many software patents, but notes that courts are reluctant to implement this ban. Without action, he thinks, "wasteful litigation will continue to grow, imposing large costs on society, costs that are already inhibiting innovation." There are powerful economic forces that will make legislative action directly addressing software patents difficult. It's encouraging, though, to see a scholar of Bessen's stature putting the spotlight on this important issue. 3 Comments "Bessen thinks that recent Supreme Court cases reaffirming the ban on patenting abstract ideas could result in invalidation of many software patents, but notes that courts are reluctant to implement this ban." The lower courts are reluctant but they are beginning to come around to the Supreme Court's viewpoint. The principle supporter within the judicial system of the idea that all software is patentable is Chief Judge Rader of the United States Court of Appeals for the Federal Circuit. He has consistently ignored Supreme Court rulings which restrict software patents. Up until May, 2013 he had no trouble getting the other judges in his court to agree with him.. This was done over Judge Rader's strong objection. While the case was still before the court Judge Rader made a small speaking tour in support of software patents. Now on September 5, 2013, the Federal Circuit affirmed a District court ruling. Now that most of the judges on the United States Court of Appeals for the Federal Circuit are on board with the idea that an abstract idea does not become patentable by being written into software I foresee a series of Appeals Court decisions that disallow various classes of software patents. Eventually the set of software patents will consist of the null set i.e. there will be no software patents. In order for software patents to be abolished each company threatened with a patent lawsuit should take the initiative and sue in a Federal District court for a summary judgment declaring the patents in question to be invalid. ------------------------- Steve Stites Software patents almost cannot help but be about abstract ideas. Also, the few that are not on abstract ideas are almost certain to be of a type that should not be worth anything. Regardless of what programming language is used there have been the same basic set of programming tools pretty much since the inception of computer programming. This makes it so if you give several programmers the same goal, they will only take one or two different approaches to the problem, since they have the same set of tools to work with. The methods being obvious and independently reproducible makes it so the goal is the only unique thing, even though goals, or ideas, are not supposed to be patentable. Copyright gives as much protection to the code as it is reasonably possible to give. Most code, though, does not derive much of any benefit from copyright on its technical aspects because, again, the tools are basic and the syntax rules of the language determine what a line is going to say. As long as someone writes their code independently, it can do the same thing as another programmer's code and it does not violate copyright. The same factors should also make these routines ineligible for patent protection for the same reasons. The few software patents that are not about the goal, but about technical details, are for things like codecs, compression routines, and filename conversion between short and long namespaces. The problem with patents like these is that, while the methods for these things may be unique, there are always alternative methods that are perfectly satisfactory. The only factor that differentiates them is when one becomes a standard method used by a lot of people. Patents on these types of things at this point tend to be valuable only if the patent holder encourages free use of the patent until it becomes standard and then starts charging for it later. That's not what patent protection is ostensibly for. Even methods that benefited from being first, like mp3 compression, only retained any value beyond the development of alternatives because of wide adoption, not because the alternatives were worse (some were demonstrably better). I have created a written transcript of the oral arguments in Accenture vs Guidewire. Accenture vs Guidewire Oral Agruments Written Transcript
https://opensource.com/comment/36534
CC-MAIN-2016-50
refinedweb
946
58.82
How to Build a React Website Powered by the Cosmic JS GraphQL API This article originally appeared on the Cosmic JS Blog. Building and maintaining a React app can be no mean feat. There plenty of tutorials out there covering the technical aspects of making a React app, but as with any technology, it’s often hard to find information on best practices. In this post we’ll be exploring some tips, tricks, and techniques we’ve learnt whilst producing React/GraphQL apps for our clients. Hopefully these will help you make your project more performant and simplify maintenance. View demo Install the app on Cosmic JS If you’ve been using React for a while, your first instinct when starting a new project might be to set up a state management library like Redux, MobX, or freactal. These are really powerful solutions for state management, that can make wrestling with the state of a large application much more manageable. But, like any library, you shouldn’t start using these state management solutions until you actually need to! For a simple blog like the one we’ll be building today the only state you actually need is the current URL. “But!” I hear you cry “How will I store/cache/handle the API-first data I’m fetching over the network, from a great service like Cosmic JS?”. Well worry not! In the second half of this post we’re going to explore GraphQL, a system for declaratively fetching data from a server and specifically the Apollo GraphQL client for simply interfacing with GraphQL. We’re focusing on a simple, view only app in this post, but it’s worth mentioning that the state provided by class based React components is often sufficient for bits of state that only affect a localised part of your app. Dan Abramov (creator of Redux) has written in more detail about this subject here Of course, if we don’t have some state, we’d just be displaying our whole web app all at once. Luckily, your browser provides a built in state store with undo history, frictionless sharing, and a simple interface: your URL bar. The excellent React Router library provides a simple and expressive interface for navigating around your app. Most of the routing in our example app is handled in the following file: // src/components/posts.js import styled from "styled-components"; import { Route, Switch, } from "react-router"; import Post, { Blank, Home, FourOhFour, } from "./post"; import Sidebar from "./Sidebar"; const PostsStyled = styled.div <br> background-color: ${R.path(["theme", "white",])};<br> flex-direction: row;<br>; export default () => ( <PostsStyled> <Route path = "/post" component = { Sidebar } /> <Switch> <Route path = "/post/:postSlug" component = { Post } /> <Route path = "/post/" component = { Blank } /> <Route path = "/" exact component = { Home } /> <Route component = { FourOhFour } /> </Switch> </PostsStyled> ); The first Route renders the sidebar for any URL beginning with /post The Switch component renders the first of its children with a matching path. Our routing configuration does the following: - If the URL is /post/some-post-slug we show the post with the slug some-post-slug - If the URL is /post we only show the Sidebar that lets you select a post - If the URL is / we show the home page - For any other URL we show the 404 page All this together means we can simply switch between all the different views of our app just by changing the URL. React Router provides a Link component, that acts like a supercharged <a> tag. You should use Link for any hyperlinks that don’t lead out of your website. CSS precompilers like SASS first enabled web developers to start using variables and functions in their styles. Then React came along and popularised the inline style system: <div style = {{ display: "flex", backgroundColor: "red", color: "white", margin: "4px", }} /> The hottest new trend is Styled Components, which allows you to create new components by specifying a component, and the CSS styles you’d like to apply to it. These styles are automatically vendor-prefixed, and are all converted to a stylesheet in the end. const Link = styled.a <br> color: white;<br> font-size: 0.8em;<br> text-decoration: none;<br>; Styled Components also provide a way to set global variables that are inherited by each styled component. The ThemeProvider component can be used to supply variables to each styled component like so: const theme = { white: "#fff", blue: "#00afd7", }; export default () => ( <ThemeProvider theme = { theme }> <App/> </ThemeProvider> ); Now every styled component that is a child of App can access those variables using a function in the styles: const Link = styled.a <br> color: ${ (props) => props.theme.blue };<br> font-size: 0.8em;<br> text-decoration: none;<br> The theme object can be any javascript object, and the function inside the ${ } block can be any function, so there’s a huge range of cool stuff you can do in your styled components while still keeping all your variables in one unified place. GraphQL is a declarative, self documenting API specification that allows you to ask your API only for the data you need. It imposes a few restrictions and ideas on your API, that allows a GraphQL Client to create some really cool features, including: - Automatic caching. - Smart resolving data requests from stored data. - Connecting data fetching to the components that display the data. We’re going to be going through and explaining all the steps we’ve used in our example project, but if you’d like a more complete explanation of the GraphQL protocol, you can read about it in full here. The GraphQL API provided by Cosmic JS has 3 queries: - objects: gets all the objects in a bucket - objectsByType: gets all the objects of a certain type in a bucket - object: gets a specific object by its slug And those queries are documented in full here. First we need to set up our ApolloClient: //src/GraphQL/index.js import { ApolloClient, createNetworkInterface, } from "react-apollo"; const networkInterface = createNetworkInterface({ uri: "", }); const client = new ApolloClient({ networkInterface, }); export default client; Which we then provide to the rest of our app using the ApolloProvider: //src/app.js import React from "react"; import { ApolloProvider, } from "react-apollo"; import styled, { ThemeProvider, } from "styled-components"; import client from "./GraphQL"; export default () => ( <ThemeProvider theme = { theme }> <ApolloProvider client = { client }> <App /> </ApolloProvider> </ThemeProvider> ); The Apollo provider means that any component in our app can connect itself to a GraphQL query, meaning each component can ask the client to fetch exactly the data needed to render itself. Don’t worry about multiple components spamming the server with requests; the ApolloClient handles caching and de-duplication itself! We’ll now spend a little time exploring some methods you can use to make GraphQL a little nicer to use, before we start exploring how we’ve used it in this app. We’re not including all the code necessary to run the example in this blog post, but you can find the source code for our demo project here. Follow along! Sometimes you want to get the same fields from an object in two different queries, GraphQL provides a system to do this in the form of Fragments. Fragments allow you to pick some fields from an object, and ask for only those fields. For example, in the sidebar we only want some basic information about a post: fragment PostPreview on Object { slug typeSlug: typeslug title modifiedAt: modifiedat } But in the post itself we want all that information, plus some more: fragment PostAllContent on Object { ...PostPreview content metadata order } We can then use the PostPreview fragment in the query used by our Sidebar: # getAllPostsQuery query($bucketSlug: String! $readKey: String!){ objects: objectsByType(bucketslug: $bucketSlug, readkey: $readKey, typeslug: "posts") { ...PostPreview } } And the PostAllContent fragment in the query used by our Post component # getPostQuery query($bucketSlug: String! $readKey: String! $postSlug: String!){ object(bucketslug: $bucketSlug, readkey: $readKey, slug: $postSlug) { } } Fragments are great for two reasons: - They allow you to modularise and reuse the properties you want to get from a query - They ensure that two queries which should get the same information always stay in sync, so Apollo can successfully cache the results You’ll notice that the above queries have 2/3 input fields: - $bucketString: The slug of the bucket we’d like to get objects from - $readKey: The read key (if needed) to read from the bucket - $postSlug: The slug of the specific object we want to get (if needed) These variables are used to direct the query to the correct data. Apollo gives us a powerful API to set these variables, but often for simple components it’s easier to just set them using props: For variables that are the same across our app, like $bucketSlug, we can add them to our components using their defaultProps: //src/components/sidebar.js const Sidebar = graphql(getAllPostsQuery, { name: "allPosts", })( props => ( <SidebarStyled> <Nav> <SidebarText> </SidebarText> { props.allPosts.loading : props.allPosts.objects.map(({ slug, ...rest }) => ( <PostLink key = { slug } slug = { slug } { ...rest } /> )) } </Nav> </SidebarStyled> ) ); SideBar.defaultProps = { bucketSlug: config.bucket.slug, readKey: config.bucket["readkey"], }; For variables that change for different instances of a component, like $postSlug, you can pass them in as a prop to each instance of a component: //src/components/post.js const PostWrapper = GraphQL(getPostQuery)(props => ( <PostContainerStyled> { props.data.loading noShare = { props.noShare } title = { R.path(["data", "object", "title",])(props) } content = { R.path(["data", "object", "content",])(props) } /> } </PostContainerStyled> )); PostWrapper.defaultProps = { bucketSlug: config.bucket.slug, readKey: config.bucket["readkey"], }; export const Home = () => <PostWrapper noShare; It’s always good to prefetch our data before the user needs it, this speeds up page transition time and makes for a nicer UX, Apollo provides a very simple way to do this. While the Sidebar gets the query it need to display a preview of each post, it also performs another query: #getAllPostsWithExtraQuery query($bucketSlug: String! $readKey: String!){ objectsWithExtra: objectsByType(bucketslug: $bucketSlug, readkey: $readKey, typeslug: "posts") { } } This query gets all the fields of every post, meaning all that data is already loaded into the cache before we navigate to a Post page. You can attach multiple queries to a component using the compose function from the react-apollo package. //src/components/sidebar.js const Sidebar = compose( GraphQL(getAllPostsQuery, { name: "allPosts", }), GraphQL(getAllPostsWithExtraQuery, { name: "allPostsPreFetch", }), )(props => ( <SidebarStyled> <Nav> <SidebarText> </SidebarText> <Line /> {props.allPosts.loading : props.allPosts.objects.map(({ slug, ...rest }) => ( <PostLink key = { slug } slug = { slug } { ...rest } /> ))} </Nav> </SidebarStyled> )); SideBar.defaultProps = { bucketSlug: config.bucket.slug, readKey: config.bucket["readkey"], }; However, if you were to just do this, you would see no improvement in your network performance, and every time you loaded a new post you’d have to make a new network request. To benefit from this preloading we have to tell the ApolloClient a few more things. By default, ApolloClient assumes that every Object returned by your API is identifiable by a field called id or _id. In Cosmic JS, each object is identifiable by a field called slug. Telling Apollo about this is simple: import { ApolloClient, createNetworkInterface, } from "react-apollo"; import { toIdValue, } from "Apollo-client"; // ------------------------------ const networkInterface = createNetworkInterface({ uri: "", }); const dataIdFromObject = ({ _typename, slug, }) => _typename + slug; const customResolvers = { Query: { object: (, args) => toIdValue( dataIdFromObject({ _typename: "Object", slug: args.slug, }), ), }, }; const client = new ApolloClient({ networkInterface, dataIdFromObject, customResolvers, }); //------------------------------ export default client The function dataIdFromObject tells ApolloClient how to generate a unique ID from any object it gets. The object customResolvers tells ApolloClient that whenever we make an object query, we can try looking in the cache using the query variable slug. Now our sidebar preloads all posts using getAllPostsWithExtraQuery, and any future calls to get Post data will be served by ApolloClient’s cache, instead of the network. Finally, Apollo provides us with another nifty technique to improve the developer experience. If you’re using webpack as part of your build system you can keep all your GraphQL queries and mutations in seperate files, and import them into javascript like any other file. This only only means to can benefit from compartmentalised code & syntax highlighting, it also means that webpack can pre-compile your GraphQL queries into Apollo’s own internal representation at build time, rather than in your user’s browser. Integrating the GraphQL loader into webpack is easy, you just have to include the following code in your webpack config: module: { rules: [ { test: /.(GraphQL|gql)$/, exclude: /nodemodules/, loader: 'GraphQL-tag/loader', }, ], }, Now you know some of the tips, tricks, and techniques we’ve learnt from using React and GraphQL in production apps. If you’ve learnt something, please share this article! If you’re making a static site, or anything else, with Cosmic JS get in touch on our Slack or Twitter, we’d love to see what you’re making. This post was written by Codogo, an award-winning digital agency with a passion for creating amazing digital experiences.
http://brianyang.com/how-to-build-a-react-website-powered-by-the-cosmic-js-graphql-api/
CC-MAIN-2017-47
refinedweb
2,121
50.16
#include <hallo.h> * Panu Kalliokoski [Thu, Jan 29 2004, 12:02:51PM]: > Because of this orientedness of links towards everyday users and w3m Who is the "everyday user"? Do you mean newbies? I just installed elinks just to test how it has been improved (in the default config) in the last two years - and it has NOT imho. - it is black-white by default - you cannot see the links - you MUST see the links because of the crappy key control model Having TAB to jump between links is a MUST nowadays. Using Cursor keys to jump and select is the worst idea that original lynx authors ever head - the mouse menu is not even as half useful as w3m's pendant, and works only on links which are not clearly visible - if you enter nothing or a bad url, you got a black screen. Very user-friendly. - where is the help or config window? You complain about it in w3m, but in Elinks I cannot even FIND IT? h, H, ? do not help. Regards, Eduard. -- Du hast abgenommen. Letztesmal hat das Hemd noch mehr gespannt. -- Christel Marquardt
https://lists.debian.org/debian-devel/2004/01/msg02298.html
CC-MAIN-2019-30
refinedweb
187
78.48
/** 29 * Namespace URIs and local names sorted by their indices. 30 * Number of Names used for EIIs and AIIs 31 * 32 * @author Kohsuke Kawaguchi 33 */ 34 public final class NameList { 35 /** 36 * Namespace URIs by their indices. No nulls in this array. 37 * Read-only. 38 */ 39 public final String[] namespaceURIs; 40 41 /** 42 * For each entry in {@link #namespaceURIs}, whether the namespace URI 43 * can be declared as the default. If namespace URI is used in attributes, 44 * we always need a prefix, so we can't. 45 * 46 * True if this URI has to have a prefix. 47 */ 48 public final boolean[] nsUriCannotBeDefaulted; 49 50 /** 51 * Local names by their indices. No nulls in this array. 52 * Read-only. 53 */ 54 public final String[] localNames; 55 56 /** 57 * Number of Names for elements 58 */ 59 public final int numberOfElementNames; 60 61 /** 62 * Number of Names for attributes 63 */ 64 public final int numberOfAttributeNames; 65 66 public NameList(String[] namespaceURIs, boolean[] nsUriCannotBeDefaulted, String[] localNames, int numberElementNames, int numberAttributeNames) { 67 this.namespaceURIs = namespaceURIs; 68 this.nsUriCannotBeDefaulted = nsUriCannotBeDefaulted; 69 this.localNames = localNames; 70 this.numberOfElementNames = numberElementNames; 71 this.numberOfAttributeNames = numberAttributeNames; 72 } 73 }
http://checkstyle.sourceforge.net/reports/javadoc/openjdk8/xref/openjdk/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/NameList.html
CC-MAIN-2018-22
refinedweb
191
58.28
Fix text box failing to Linkify paragraph children Review Request #10152 — Created Sept. 21, 2018 and submitted When making a paragraph with multiple newline links in a text box and hitting 'ok' only the first link would be linkified. This was tested and it was found that the paragraph children were not handling siblings correctly such that if one is replaced it causes the loop variable 'node' becomes stale when referencing next siblings. The best method to get around this was to use the fact that all the child nodes are available to be iterated in order. By doing so we avoid dealing with pointer references which when replaced were causing the issues. Co-authored-by: Stuart Caie stuart.caie@oracle.com Ran JS tests. Ran unit tests. Tested by inputting paragraphs of links in different amounts. Tested by putting plain text above and below paragraphs of links inclusive and exclusively with multiple links and singular links. So the suggested fix works, but we can't use for ... ofin our code (see) Instead, we can just iterate with an index: for (let i = 0; i < el.childNodes.length; i++) { const node = el.childNodes[i]; if (node.nodeType === node.TEXT_NODE) { ... } Can you rewrite your summary to: 1) be at most 50 characters long 2) be written in the imperitive mood, i.e., as if it were a command. If you substitute your summary into the following sentence, it should make sense: This patch will <summary> e.g., "Fix RB.LinkifyUtils.linkifyChildren on all browsers" or similar. If you want to credit kyzfor their work you can add the following to your summary and we will include it as a git trailer when we land: Co-authored-by: Stuart Caie <stuart.caie@oracle.com> Your description contains your summary as its first line. Also your second line of your description isnt a complete sentence. Give our guide on writing good change descriptions a read and update your description based on that. Blank line between these. The description is wrapping wayyy too early. Typically, ~72 characters is a good wrapping point here. A good description also helps people to better understand what was wrong and why and how it was addressed without digging into the code. From yours, I can understand what the problem was, and then I get some technical details that make no sense unless I know this code already. What you can do to improve the description is to give a summary of what went wrong and why, without assuming any prior knowledge. Something like "The reason that only the first line was linked was <...>. By doing <...>, we can properly cover all lines," or something like that. You have a typo in the function namespace. "RB.LInkify...." instead of "RB.Linkify....". On that note, when referencing code like that, you can put a backtick on either side to turn it into a literal.
https://reviews.reviewboard.org/r/10152/
CC-MAIN-2019-26
refinedweb
483
65.83
gain alternatives and similar packages Based on the "Web Crawling" category. Alternatively, view gain alternatives based on common mentions on social networks and blogs. Scrapy9.9 9.1 L4 gain VS ScrapyScrapy, a fast high-level web crawling & scraping framework for Python. pyspider9.6 0.6 L3 gain VS pyspiderA Powerful Spider(Web Crawler) System in Python. requests-html9.2 0.0 gain VS requests-htmlPythonic HTML Parsing for Humans™ portia9.1 0.0 L2 gain VS portiaVisual scraping for Scrapy MechanicalSoup7.8 6.1 L4 gain VS MechanicalSoupA Python library for automating interaction with websites. RoboBrowser7.6 0.0 L4 gain VS RoboBrowserA simple, Pythonic library for browsing the web without a standalone web browser. cola6.7 0.0 L3 gain VS colaA high-level distributed crawling framework. PSpider6.6 4.2 gain VS PSpider简单易用的Python爬虫框架,QQ交流群:597510560 Grab6.6 4.0 L3 gain VS GrabWeb Scraping Framework Scrapely6.4 0.0 gain VS ScrapelyA pure-python HTML screen-scraping library feedparser5.7 7.4 L3 gain VS feedparserParse feeds in Python Sukhoi4.4 3.9 gain VS SukhoiMinimalist and powerful Web Crawler. MSpider4.1 0.0 gain VS MSpiderSpider spidy Web Crawler3.0 0.0 gain VS spidy Web CrawlerThe simple, easy to use command line web crawler. Crawley2.6 0.0 gain VS CrawleyPythonic Crawling / Scraping Framework based on Non Blocking I/O operations. brownant2.6 0.0 gain VS brownantBrownant is a web data extracting framework. Google Search Results in PythonGoogle Search Results via SERP API pip Python Package Demiurge1.9 0.0 L5 gain VS DemiurgePyQuery-based scraping micro-framework. reader1.8 9.4 gain VS readerA Python feed reader library. Pomp1.5 0.0 L5 gain VS PompScreen scraping and web crawling framework FastImage0.9 0.0 L4 gain VS FastImagePython library that finds the size / type of an image given its URI by fetching as little as needed Mariner0.4 5.6 gain gain or a related project? Popular Comparisons README Web crawling framework for everyone. Written with asyncio, uvloop and aiohttp. [](img/architecture.png) Requirements - Python3.5+ Installation pip install gain pip install uvloop (Only linux) Usage - Write spider.py: from gain import Css, Item, Parser, Spider import aiofiles class Post(Item): title = Css('.entry-title') content = Css('.entry-content') async def save(self): async with aiofiles.open('scrapinghub.txt', 'a+') as f: await f.write(self.results['title']) class MySpider(Spider): concurrency = 5 headers = {'User-Agent': 'Google Spider'} start_url = '' parsers = [Parser('\d+/'), Parser('\d{4}/\d{2}/\d{2}/[a-z0-9\-]+/', Post)] MySpider.run() Or use XPathParser: from gain import Css, Item, Parser, XPathParser, Spider class Post(Item): title = Css('.breadcrumb_last') async def save(self): print(self.title) class MySpider(Spider): start_url = '' concurrency = 5 headers = {'User-Agent': 'Google Spider'} parsers = [ XPathParser('//span[@class="category-name"]/a/@href'), XPathParser('//div[contains(@class, "pagination")]/ul/li/a[contains(@href, "page")]/@href'), XPathParser('//div[@class="mini-left"]//div[contains(@class, "mini-title")]/a/@href', Post) ] proxy = '' MySpider.run() You can add proxy setting to spider as above. Run python spider.py Result: [](img/sample.png) Example The examples are in the /example/ directory. Contribution - Pull request. - Open issue. *Note that all licence references and agreements mentioned in the gain README section above are relevant to that project's source code only.
https://python.libhunt.com/gain-alternatives
CC-MAIN-2021-31
refinedweb
547
52.76
Ok so here it is, The programs basic function is to calculate the estimated annual income of fast food industries after 2005 (any year, the user wants), i have all that done. however the program wants me to have it repeatedly ask the user to input, and this is giving me the hardest time how would i get the program to repeatedly call the function and stop , any help would be gladley appreciated. Code: #include <stdio.h> #include <math.h> int main(void) { /* variables */ int t; /* amount of years between 2005 and the input year */ double F; /* formula for estimated annual income for fast food */ int year; /* year inputed by user */ int status; /* status value returned by user */ int error; /* error flag for bad input */ int skip_int; /* Skips the integer */ printf(" Please put any year after 2005 to estimate the annual income of fast food, note if any year is entered before 2005 this program will display an error and end the program"); scanf("%d", &year); if (year < 2005 ) { printf("Invalid year program ending >>%d>>.", year); } else if ( year >= 2005 ) { t = year - 2005; F = 33.2 + (16.8 * t); printf("The estimated annual income in %d is expected to be %.2f Billion\n", year, F); } system("pause"); return (0); }
http://cboard.cprogramming.com/c-programming/151009-help-repeatedly-calling-user-printable-thread.html
CC-MAIN-2014-52
refinedweb
209
54.66
Opened 8 years ago Closed 8 years ago #6016 closed (invalid) Admin crash when deleting an object Description (last modified by gwilson) I get this error: DjangoUnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 0: ordinal not in range(128). You passed in DjangoUnicodeDecodeError('ascii', '\xc2\xbfProbando una pregunta? -> ', 0, 1, 'ordinal not in range(128)') (<class 'django.utils.encoding.DjangoUnicodeDecodeError'>) when I try to delete an object from the admin zone. The character ¿ breaks it. More info. Model: class Encuesta( models.Model ): ... pregunta = models.CharField( max_length=255 ) def __unicode__( self ): return self.pregunta ... Thanks Change History (8) comment:1 Changed 8 years ago by gwilson comment:2 Changed 8 years ago by raphael - Owner changed from nobody to raphael - Status changed from new to assigned comment:3 Changed 8 years ago by raphael I can't reproduce it so far in admin. The only way I found to get similar errors is to do sth like : obj.pregunta = '\xc2\xbfProbando una pregunta? -> ' obj.save() unicode(obj) But aren't we supposed to do : obj.pregunta = u'\xc2\xbfProbando una pregunta? -> ' # add u or to get the same output : obj.pregunta = u'\xbfProbando una pregunta? -> ' My poor knowledge in Django unicode internals don't allow me to go further :( comment:4 Changed 8 years ago by raphael - Owner raphael deleted - Status changed from assigned to new comment:5 Changed 8 years ago by raphael - Resolution set to worksforme - Status changed from new to closed comment:6 Changed 8 years ago by raphael - Resolution worksforme deleted - Status changed from closed to reopened comment:7 Changed 8 years ago by anonymous these one helped me: def unicode(self): return u'%s' % self.user comment:8 Changed 8 years ago by PJCrosier - Resolution set to invalid - Status changed from reopened to closed Comment 7 seems sane to me, please re-open / slap me if I'm wrong. fixed description formatting.
https://code.djangoproject.com/ticket/6016
CC-MAIN-2016-07
refinedweb
319
54.63
I have a project that requires working with two hundred digit numbers. I am at a loss on how to do this. If someone could modify the source below I am sure I could implement it into my own project. Thanks. -skeptik /* * factor.c -- Prompts user to enter an integer N. It prints out * if it is a prime or not. If not, it prints out all of its * proper factors. */ #include <stdio.h> int main(void) { int n; int lcv; int flag; /* flag initially is 1 and becomes 0 if we determine that n is not a prime */ printf("Enter value of N : "); scanf("%d", &n); for (lcv=2, flag=1; lcv <= (n / 2); lcv++) { if ((n % lcv) == 0) { if (flag) printf("non-trivial factors of %d are:\n", n); flag = 0; printf("\t%d\n", lcv); } } if (flag) printf("%d is prime\n", n); }
http://cboard.cprogramming.com/c-programming/2126-200-digit-integer-how-printable-thread.html
CC-MAIN-2015-22
refinedweb
146
77.87
> -----Original Message----- > From: Geir Magnusson Jr. [mailto:geirm@optonline.net] > Sent: Thursday, April 04, 2002 5:14 AM > To: Jakarta Commons Developers List > Subject: Re: [logging] Need interface... > > > On 4/4/02 2:09 AM, "costinm@covalent.net" > <costinm@covalent.net> wrote: > > > On Wed, 3 Apr 2002, Geir Magnusson Jr. wrote: > > > >> Are you saying that any component/class/tool that > implements the generic > >> commons logger Log interface is only usable in an > application environment > >> where a special class with a static method getLogger() is > in the classpath? > >> [Modulo the real name of the class and method... You get > what I mean, I > >> hope...] > > > > The same pattern that is used with JDBC, JNDI, JAXP and > about a dozen > > other APIs. > > > > I'm not sure what do you mean by 'framework' in this > context - of course > > every API and package has a set of contracts and APIs. You > want a database > > connection - you call the DriverManager or look up in JNDI. > > I don't think it's a fair comparison necessarily, although I > am having a > tough time explaining why. > > But you pointed out an interesting thing. With a db connection, I can > legitimately 'pull' it via DriverManager, specifying exactly > what I want in > terms of configuration, or it can be preconfigured by > 'someone else' and (in > a broad sense) pushed to me via JNDI - I can go get it if I the broadest ;) both architectural approaches are valid (push/pull). it seems to me that the major *valid* hangup most folks are having w/your proposal is the effect this might have on commons components. one notable effect (desired, i suppose) is that commons-logging clients could be configured at run-time. perhaps if someone with a larger brain than i could focus on the pros and cons of the proposed interface, instead of flaming the 'opposing' architecture, this thread might be productive... > want, ready to > go. > > In the case of commons, there seems to be an almost required > implementation. > I think that's ok - it just needs to be stated (or y'all need > to tell me to > go RTFM :) > > > > There is a LogFactory class that will find you the Log > implementation, > > and if a logger is to be useable with the commons-logging it must > > implement the Log interface ( that's the big one ) and follow the > > discovery rules if it wants to be found using the LogFactory. > > Ok - cool. I understand. If that isn't documented, it should be. > > My only problem is that there is a huge assumption about how to get > LogFactory - unlike the db example, where I can use driver > manager *or* JNDI > if I want to keep the knowledge outside of the app, I seem to > have to utter > the right prayers and pull from some singleton. > > I think there should be valid alternatives. > > So there seems to be an opportunity for a generic logging interface in > commons that has no implementation or lifecycle requirements, > because then I > can do what I want to do in Velocity and elsewhere - offer a logging > contract while leaving the push/pull & lifecycle issues in > the hands of the > framework/app/container builder, where it belongs (IMO). > > If I can find some time, I'll scratch something together - it will be > trivially usable with the existing commons logging - it will > use the same > interface Log in fact - so it won't be a competitor but rather augment > o.a.c.l I think a nice name is 'NaturalLog' (math joke...) > > > > >> I hope the answer is 'no' also, because otherwise, you are defining > >> framework-like requirements on any app using commons-logging-using > >> components. > > > > If a component wants to use commons-logging, it must obviously > > call it's API in the way commons-logging is designed. > > Of course. Just like log4j or logkit. In a sense then, > commons-logging is > yet another logger that didn't bother to write the guts, but just used > others. Log4j or logkit could be the same thing. For > example, if you had a > logkit or jdk1.4 appender for log4j... (I wonder how fast > I'd get run out > of town if I submitted *that* patch :) > > LOL > > > > > It doesn't impose any other requirement on your component. I'm not > > sure I understand what's your problem here. > > I guess the mismatch is that I thought o.a.c.l was a > policy-free logger > abstraction allowing components and apps to have a common > interface for > logging w/o any implementation requirements, and that the project also > offered impls for log4j, logkit and jdk1.4. As is, its > clearly a good > thing because people find it useful, but I think there are > other needs. > > > > > If you need an aditional interface to allow a standard way for > > components to get a different logger - I'm ok. With the > > current model the underlying logger is in control over what > > and how is logged - commons-logging is just a wrapper ( and > > the associated discovery method ). > > I guess its the dictation of the discovery method that I have > a problem > with. But it's fixable... > > > > > It is curently assumed that each logger will have a name - > > so it can be found by the component on one side, and configured > > in the logger on the other side. In a JMX perspective, it > > makes sense - all objects that are manageable need some name. > > It makes sense indeed. But I may not care always about > having my own named > logger - as a component, I might just want to spooge out > debug info and > think it nicer if it doesn't have to go to stdout. > > > > > It is also a common pattern to separate between the actual > > channel ( where the log output goes ) and the 'facade' that > > is viewed by the component. And the pattern is to have > > each component use a logger with a name based on it's class > > ( with the classloader acting as namespace ). > > > > How do you fit the setter in this and what do you actually > > want - I don't know. > > You can fit the setter in this - because with the factory alternative > offered by Michael > > public interface LogUser > { > public void setLogFactory(LogFactory); > } > > you can retain the pull pattern. But you get the benefit of > the marker. > > This of course shouldn't be the *only* way - because then you have to > specifically manage any logging component, which is a royal > pain. Being > able to arbitrarily grab the logger out of thing air is > clearly useful.... > > To summarize : yes, there is clear value in the pull model - makes > integration easy. I think that a generalized interface contract w/o > implementation requirements would be useful too. > > > > > > My feeling is that an interface to allow some tunning of the > > logging at runtime, in a logger-independent manner is extremenly > > usefull. > > Does commons do that? I didn't think so. > > > I think some portable way to set the level on a logger would > > be the most important. Since the logging is 2-layered it is possible > > to change the channel without any action in the component, but > > it is not possible to change the actual Log - do you think > > this is that important ? > > To be able to change the actual Log? No - because the > container/app/etc > implementing the Log interface can do that... Right? > > > > > > >> I am not trying to be combative - I just think that this > discussion showed > >> me that the commons logger is not as general-purpose as I > thought it was - > > > > Yes, it's not general-purpose. It's just an API to allow > your components > > to log. Nothing else. > > I think that is a little short of the description, because > log4j and logkit > did that already. I thought that being 'implementation > agnostic' was one of > the goals, and it seem to be in one aspect - the Log > interface is used for > any underlying impl (which is good). But in another sense, > the pull pattern > requirement (or 'pseudo requirement') seems to exhibit some > of the problems > I thought o.a.c.l was trying to solve. > > -- > Geir Magnusson Jr. > geirm@optonline.net > System and Software Consulting > The question is : What is a Mahnamahna? > > > -- > To unsubscribe, e-mail: > <mailto:commons-dev-unsubscribe@jakarta.apache.org> > For additional commands, e-mail: > <mailto:commons-dev-help@jakarta.apache.org> >
http://mail-archives.apache.org/mod_mbox/commons-dev/200204.mbox/%3C921E60ADEB30D84EACA350AD31A1FD751136D5@chiex02%3E
CC-MAIN-2015-40
refinedweb
1,378
61.46
> -----Original Message----- > From: Branko Čibej <brane_at_xbc.nu> [mailto:=?ISO-8859- > 2?Q?Branko_=C8ibej_<brane_at_xbc.nu>?=] > Sent: woensdag 1 oktober 2008 2:46 > To: Greg Stein > Cc: Ben Collins-Sussman; dev_at_subversion.tigris.org > Subject: Re: svn commit: r33366 - trunk/notes > >. Keeping the implementations apart would be a big plus, but it would be a real nice to have if we could keep existing repository Urls compatible with both new and old clients; automatically upgrading to the new protocol if possible. I would prefer not to create two repository URLs for the same project. One for pre 1.X clients+slow access and one for 1.X+ clients for faster access. I see using a single Url to refer to a repository and a file (and with a peg revision as an immutable reference to a file-version) as one of the major advantages of using Subversion. Moving to a new url scheme breaks this use case, as I would have to support both urls indefinitely: Here at TCG we annotate all debugging symbols (.pdb files) with this information on all source files to be able to retrieve the exact source files on debugging (this could be years after building the binary). My Visual Studio debugger automatically downloads the source files from Subversion if it can't find the exact file version locally.. I can't switch the old location to the new protocol in a big bang to support older Subversion releases. And if I introduce a new url for the repository I have to maintain this url forever. If all requests are routed over the repository root Url it shouldn't be too hard to handle the new style requests on the same public reposity Url as the old style requests. Just allowing an apache rewrite rule to handle the conversion might be an option, but wht can't we just use a part of the Url namespace that isn't used by mod_dav_svn, for the new mod_svn? Bert --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscribe_at_subversion.tigris.org For additional commands, e-mail: dev-help_at_subversion.tigris.org Received on 2008-10-01 09:26:43 CEST This is an archived mail posted to the Subversion Dev mailing list.
https://svn.haxx.se/dev/archive-2008-10/0037.shtml
CC-MAIN-2019-35
refinedweb
368
62.07
**Note:** This file is automatically generated. Please see the [developer documentation](doc/development/changelog.md) for instructions on adding your own entry. ## 8.17.3 (2017-03-07) - Fix the redirect to custom home page URL. !9518 - Fix broken migration when upgrading straight to 8.17.1. !9613 - Make projects dropdown only show projects you are a member of. !9614 - Fix creating a file in an empty repo using the API. !9632 - Don't copy tooltip when copying GFM. - Fix cherry-picking or reverting through an MR. ## 8.17.2 (2017-03-01) - Expire all webpack assets after 8.17.1 included a badly compiled asset. !9602 ## 8.17.1 (2017-02-28) - Replace setInterval with setTimeout to prevent highly frequent requests. !9271 (Takuya Noguchi) - Disable unused tags count cache for Projects, Builds and Runners. - Spam check and reCAPTCHA improvements. - Allow searching issues for strings containing colons. - Disabled tooltip on add issues button in usse boards. - Fixed commit search UI. - Fix MR changes tab size count when there are over 100 files in the diff. - Disable invalid service templates. - Use default branch as target_branch when parameter is missing. - Upgrade GitLab Pages to v0.3.2. - Add performance query regression fix for !9088 affecting #27267. - Chat slash commands show labels correctly. ## 8.17.0 (2017-02-22) - API: Fix file downloading. !0 (8267) - Changed composer installer script in the CI PHP example doc. !4342 (Jeffrey Cafferata) - Display fullscreen button on small screens. !5302 (winniehell) - Add system hook for when a project is updated (other than rename/transfer). !5711 (Tommy Beadle) - Fix notifications when set at group level. !6813 (Alexandre Maia) - Project labels can now be promoted to group labels. !7242 (Olaf Tomalka) - use webpack to bundle frontend assets and use karma for frontend testing. !7288 - Adds back ability to stop all environments. !7379 - Added labels empty state. !7443 - Add ability to define a coverage regex in the .gitlab-ci.yml. !7447 (Leandro Camargo) - Disable automatic login after clicking email confirmation links. !7472 - Search feature: redirects to commit page if query is commit sha and only commit found. !8028 (YarNayar) - Create a TODO for user who set auto-merge when a build fails, merge conflict occurs. !8056 (twonegatives) - Don't group issues by project on group-level and dashboard issue indexes. !8111 (Bernardo Castro) - Mark MR as WIP when pushing WIP commits. !8124 (Jurre Stender @jurre) - Flag multiple empty lines in eslint, fix offenses. !8137 - Add sorting pipeline for a commit. !8319 (Takuya Noguchi) - Adds service trigger events to api. !8324 - Update pipeline and commit links when CI status is updated. !8351 - Hide version check image if there is no internet connection. !8355 (Ken Ding) - Prevent removal of input fields if it is the parent dropdown element. !8397 - Introduce maximum session time for terminal websocket connection. !8413 - Allow creating protected branches when user can merge to such branch. !8458 - Refactor MergeRequests::BuildService. !8462 (Rydkin Maxim) - Added GitLab Pages to CE. !8463 - Support notes when a project is not specified (personal snippet notes). !8468 - Use warning icon in mini-graph if stage passed conditionally. !8503 - Don’t count tasks that are not defined as list items correctly. !8526 - Reformat messages ChatOps. !8528 - Copy commit SHA to clipboard. !8547 - Improve button accessibility on pipelines page. !8561 - Display project ID in project settings. !8572 (winniehell) - PlantUML support for Markdown. !8588 (Horacio Sanson) - Fix reply by email without sub-addressing for some clients from Microsoft and Apple. !8620 - Fix nested tasks in ordered list. !8626 - Fix Sort by Recent Sign-in in Admin Area. !8637 (Poornima M) - Avoid repeated dashes in $CI_ENVIRONMENT_SLUG. !8638 - Only show Merge Request button when user can create a MR. !8639 - Prevent copying of line numbers in parallel diff view. !8706 - Improve build policy and access abilities. !8711 - API: Remove /projects/:id/keys/.. endpoints. !8716 (Robert Schilling) - API: Remove deprecated 'expires_at' from project snippets. !8723 (Robert Schilling) - Add `copy` backup strategy to combat file changed errors. !8728 - adds avatar for discussion note. !8734 - Add link verification to badge partial in order to render a badge without a link. !8740 - Reduce hits to LDAP on Git HTTP auth by reordering auth mechanisms. !8752 - prevent diff unfolding link from appearing when there are no more lines to show. !8761 - Redesign searchbar in admin project list. !8776 - Rename Builds to Pipelines, CI/CD Pipelines, or Jobs everywhere. !8787 - dismiss sidebar on repo buttons click. !8798 (Adam Pahlevi) - fixed small mini pipeline graph line glitch. !8804 - Make all system notes lowercase. !8807 - Support unauthenticated LFS object downloads for public projects. !8824 (Ben Boeckel) - Add read-only full_path and full_name attributes to Group API. !8827 - allow relative url change without recompiling frontend assets. !8831 - Use vue.js Pipelines table in commit and merge request view. !8844 - Use reCaptcha when an issue is identified as a spam. !8846 - resolve deprecation warnings. !8855 (Adam Pahlevi) - Cop for gem fetched from a git source. !8856 (Adam Pahlevi) - Remove flash warning from login page. !8864 (Gerald J. Padilla) - Adds documentation for how to use Vue.js. !8866 - Add 'View on [env]' link to blobs and individual files in diffs. !8867 - Replace word user with member. !8872 - Change the reply shortcut to focus the field even without a selection. !8873 (Brian Hall) - Unify MR diff file button style. !8874 - Unify projects search by removing /projects/:search endpoint. !8877 - Fix disable storing of sensitive information when importing a new repo. !8885 (Bernard Pietraga) - Fix pipeline graph vertical spacing in Firefox and Safari. !8886 - Fix filtered search user autocomplete for gitlab instances that are hosted on a subdirectory. !8891 - Fix Ctrl+Click support for Todos and Merge Request page tabs. !8898 - Fix wrong call to ProjectCacheWorker.perform. !8910 - Don't perform Devise trackable updates on blocked User records. !8915 - Add ability to export project inherited group members to Import/Export. !8923 - replace `find_with_namespace` with `find_by_full_path`. !8949 (Adam Pahlevi) - Fixes flickering of avatar border in mention dropdown. !8950 - Remove unnecessary queries for .atom and .json in Dashboard::ProjectsController#index. !8956 - Fix deleting projects with pipelines and builds. !8960 - Fix broken anchor links when special characters are used. !8961 (Andrey Krivko) - Ensure autogenerated title does not cause failing spec. !8963 (brian m. carlson) - Update doc for enabling or disabling GitLab CI. !8965 (Takuya Noguchi) - Remove deprecated MR and Issue endpoints and preserve V3 namespace. !8967 - Fixed "substract" typo on /help/user/project/slash_commands. !8976 (Jason Aquino) - Preserve backward compatibility CI/CD and disallow setting `coverage` regexp in global context. !8981 - use babel to transpile all non-vendor javascript assets regardless of file extension. !8988 - Fix MR widget url. !8989 - Fixes hover cursor on pipeline pagenation. !9003 - Layer award emoji dropdown over the right sidebar. !9004 - Do not display deploy keys in user's own ssh keys list. !9024 - upgrade babel 5.8.x to babel 6.22.x. !9072 - upgrade to webpack v2.2. !9078 - Trigger autocomplete after selecting a slash command. !9117 - Add space between text and loading icon in Megre Request Widget. !9119 - Fix job to pipeline renaming. !9147 - Replace static fixture for merge_request_tabs_spec.js. !9172 (winniehell) - Replace static fixture for right_sidebar_spec.js. !9211 (winniehell) - Show merge errors in merge request widget. !9229 - Increase process_commit queue weight from 2 to 3. !9326 (blackst0ne) - Don't require lib/gitlab/request_profiler/middleware.rb in config/initializers/request_profiler.rb. - Force new password after password reset via API. (George Andrinopoulos) - Allows to search within project by commit hash. (YarNayar) - Show organisation membership and delete comment on smaller viewports, plus change comment author name to username. - Remove turbolinks. - Convert pipeline action icons to svg to have them propperly positioned. - Remove rogue scrollbars for issue comments with inline elements. - Align Segoe UI label text. - Color + and - signs in diffs to increase code legibility. - Fix tab index order on branch commits list page. (Ryan Harris) - Add hover style to copy icon on commit page header. (Ryan Harris) - Remove hover animation from row elements. - Improve pipeline status icon linking in widgets. - Fix commit title bar and repository view copy clipboard button order on last commit in repository view. - Fix mini-pipeline stage tooltip text wrapping. - Updated builds info link on the project settings page. (Ryan Harris) - 27240 Make progress bars consistent. - Only render hr when user can't archive project. - 27352-search-label-filter-header. - Include :author, :project, and :target in Event.with_associations. - Don't instantiate AR objects in Event.in_projects. - Don't capitalize environment name in show page. - Update and pin the `jwt` gem to ~> 1.5.6. - Edited the column header for the environments list from created to updated and added created to environments detail page colum header titles. - Give ci status text on pipeline graph a better font-weight. - Add default labels to bulk assign dropdowns. - Only return target project's comments for a commit. - Fixes Pipelines table is not showing branch name for commit. - Fix regression where cmd-click stopped working for todos and merge request tabs. - Fix stray pipelines API request when showing MR. - Fix Merge request pipelines displays JSON. - Fix current build arrow indicator. - Fix contribution activity alignment. - Show Pipeline(not Job) in MR desktop notification. - Fix tooltips in mini pipeline graph. - Display loading indicator when filtering ref switcher dropdown. - Show pipeline graph in MR widget if there are any stages. - Fix icon colors in merge request widget mini graph. - Improve blockquote formatting in notification emails. - Adds container to tooltip in order to make it work with overflow:hidden in parent element. - Restore pagination to admin abuse reports. - Ensure export files are removed after a namespace is deleted. - Add `y` keyboard shortcut to move to file permalink. - Adds /target_branch slash command functionality for merge requests. (YarNayar) - Patch Asciidocs rendering to block XSS. - contribution calendar scrolls from right to left. - Copying a rendered issue/comment will paste into GFM textareas as actual GFM. - Don't delete assigned MRs/issues when user is deleted. - Remove new branch button for confidential issues. - Don't allow project guests to subscribe to merge requests through the API. (Robert Schilling) - Don't connect in Gitlab::Database.adapter_name. - Prevent users from creating notes on resources they can't access. - Ignore encrypted attributes in Import/Export. - Change rspec test to guarantee window is resized before visiting page. - Prevent users from deleting system deploy keys via the project deploy key API. - Fix XSS vulnerability in SVG attachments. - Make MR-review-discussions more reliable. - fix incorrect sidekiq concurrency count in admin background page. (wendy0402) - Make notification_service spec DRYer by making test reusable. (YarNayar) - Redirect to. (blackst0ne) - Fixed group label links in issue/merge request sidebar. - Improve gl.utils.handleLocationHash tests. - Fixed Issuable sidebar not closing on smaller/mobile sized screens. - Resets assignee dropdown when sidebar is open. - Disallow system notes for closed issuables. - Fix timezone on issue boards due date. - Remove unused js response from refs controller. - Prevent the GitHub importer from assigning labels and comments to merge requests or issues belonging to other projects. - Fixed merge requests tab extra margin when fixed to window. - Patch XSS vulnerability in RDOC support. - Refresh authorizations when transferring projects. - Remove issue and MR counts from labels index. - Don't use backup Active Record connections for Sidekiq. - Add index to ci_trigger_requests for commit_id. - Add indices to improve loading of labels page. - Reduced query count for snippet search. - Update GitLab Pages to v0.3.1. - Upgrade omniauth gem to 1.3.2. - Remove deprecated GitlabCiService. - Requeue pending deletion projects. ## 8.16.7 (2017-02-27) - No changes. - Fix MR changes tab size count when there are over 100 files in the diff. ## 8.16.6 (2017-02-17) - API: Fix file downloading. !0 (8267) - Reduce hits to LDAP on Git HTTP auth by reordering auth mechanisms. !8752 - Fix filtered search user autocomplete for gitlab instances that are hosted on a subdirectory. !8891 - Fix wrong call to ProjectCacheWorker.perform. !8910 - Remove unnecessary queries for .atom and .json in Dashboard::ProjectsController#index. !8956 - Fix broken anchor links when special characters are used. !8961 (Andrey Krivko) - Do not display deploy keys in user's own ssh keys list. !9024 - Show merge errors in merge request widget. !9229 - Don't delete assigned MRs/issues when user is deleted. - backport of EE fix !954. - Refresh authorizations when transferring projects. - Don't use backup Active Record connections for Sidekiq. - Check public snippets for spam. ## 8.16.16.4 (2017-02-02) - Support non-ASCII characters in GFM autocomplete. !8729 - Fix search bar search param encoding. !8753 - Fix project name label's for reference in project settings. !8795 - Fix filtering with multiple words. !8830 - Fixed services form cancel not redirecting back the integrations settings view. !8843 - Fix filtering usernames with multiple words. !8851 - Improve performance of slash commands. !8876 - Remove old project members when retrying an export. - Fix permalink discussion note being collapsed. - Add project ID index to `project_authorizations` table to optimize queries. - Check public snippets for spam. - 19164 Add settings dropdown to mobile screens. ## 8.16.3 (2017-01-27) - Add caching of droplab ajax requests. !8725 - Fix access to the wiki code via HTTP when repository feature disabled. !8758 - Revert 3f17f29a. !8785 - Fix race conditions for AuthorizedProjectsWorker. - Fix autocomplete initial undefined state. - Fix Error 500 when repositories contain annotated tags pointing to blobs. - Fix /explore sorting. - Fixed label dropdown toggle text not correctly updating. ## 8.16.2 (2017-01-25) - allow issue filter bar to be operated with mouse only. !8681 - Fix CI requests concurrency for newer runners that prevents from picking pending builds (from 1.9.0-rc5). !8760 - Add some basic fixes for IE11/Edge. - Remove blue border from comment box hover. - Fixed bug where links in merge dropdown wouldn't work. ## 8.16.1 (2017-01-23) - Ensure export files are removed after a namespace is deleted. - Don't allow project guests to subscribe to merge requests through the API. (Robert Schilling) - Prevent users from creating notes on resources they can't access. - Prevent users from deleting system deploy keys via the project deploy key API. - Upgrade omniauth gem to 1.3.2. ## 8.16.0 (2017-01-22) - Add LDAP Rake task to rename a provider. !2181 - Validate label's title length. !5767 (Tomáš Kukrál) - Allow to add deploy keys with write-access. !5807 (Ali Ibrahim) - Allow to use + symbol in filenames. !6644 (blackst0ne) - Search bar redesign first iteration. !7345 - Fix date inconsistency on due date picker. !7422 (Giuliano Varriale) - Add email confirmation field to registration form. !7432 - Updated project visibility settings UX. !7645 - Go to a project order. !7737 (Jacopo Beschi @jacopo-beschi) - Support slash comand `/merge` for merging merge requests. !7746 (Jarka Kadlecova) - Add more storage statistics. !7754 (Markus Koller) - Add support for PlantUML diagrams in AsciiDoc documents. !7810 (Horacio Sanson) - Remove extra orphaned rows when removing stray namespaces. !7841 - Added lighter count badge background-color for on white backgrounds. !7873 - Fixes issue boards list colored top border visual glitch. !7898 (Pier Paolo Ramon) - change 'gray' color theme name to 'black' to match the actual color. !7908 (BM5k) - Remove trailing whitespace when generating changelog entry. !7948 - Remove checking branches state in issue new branch button. !8023 - Log LDAP blocking/unblocking events to application log. !8042 (Markus Koller) - ensure permalinks scroll to correct position on multiple clicks. !8046 - Allow to use ENV variables in redis config. !8073 (Semyon Pupkov) - fix button layout issue on branches page. !8074 - Reduce DB-load for build-queues by storing last_update in Redis. !8084 - Record and show last used date of SSH Keys. !8113 (Vincent Wong) - Resolves overflow in compare branch and tags dropdown. !8118 - Replace wording for slash command confirmation message. !8123 - remove build_user. !8162 (Arsenev Vladislav) - Prevent empty pagination when list is not empty. !8172 - Make successful pipeline emails off for watchers. !8176 - Improve copy in Issue Tracker empty state. !8202 - Adds CSS class to status icon on MR widget to prevent non-colored icon. !8219 - Improve visibility of "Resolve conflicts" and "Merge locally" actions. !8229 - Add Gitaly to the architecture documentation. !8264 (Pablo Carranza <[email protected]>) - Sort numbers in build names more intelligently. !8277 - Show nested groups tab on group page. !8308 - Rename users with namespace ending with .git. !8309 - Rename filename to file path in tooltip of file header in merge request diff. !8314 - About GitLab link in sidebar that links to help page. !8316 - Merged the 'Groups' and 'Projects' tabs when viewing user profiles. !8323 (James Gregory) - re-enable change username button after failure. !8332 - Darkened hr border color in descriptions because of update of bootstrap. !8333 - display merge request discussion tab for empty branches. !8347 - Fix double spaced CI log. !8349 (Jared Deckard <[email protected]>) - Refactored note edit form to improve frontend performance on MR and Issues pages, especially pages with has a lot of discussions in it. !8356 - Make CTRL+Enter submits a new merge request. !8360 (Saad Shahd) - Fixes too short input for placeholder message in commit listing page. !8367 - Fix typo: seach to search. !8370 - Adds label to Environments "Date Created". !8376 (Saad Shahd) - Convert project setting text into protected branch path link. !8377 (Ken Ding) - Precompile all JavaScript fixtures. !8384 - Use original casing for build action text. !8387 - Scroll to bottom on build completion if autoscroll was active. !8391 - Properly handle failed reCAPTCHA on user registration. !8403 - Changed alerts to be responsive, centered text on smaller viewports. !8424 (Connor Smallman) - Pass Gitaly resource path to gitlab-workhorse if Gitaly is enabled. !8440 - Fixes and Improves CSS and HTML problems in mini pipeline graph and builds dropdown. !8443 - Don't instrument 405 Grape calls. !8445 - Change CI template linter textarea with Ace Editor. !8452 (Didem Acet) - Removes unneeded `window` declaration in environments related code. !8456 - API: fix query response for `/projects/:id/issues?milestone="No%20Milestone"`. !8457 (Panagiotis Atmatzidis, David Eisner) - Fix broken url on group avatar. !8464 (hogewest) - Fixes buttons not being accessible via the keyboard when creating new group. !8469 - Restore backup correctly when "BACKUP" environment variable is passed. !8477 - Add new endpoints for Time Tracking. !8483 - Fix Compare page throws 500 error when any branch/reference is not selected. !8492 (Martin Cabrera) - Treat environments matching `production/*` as Production. !8500 - Hide build artifacts keep button if operation is not allowed. !8501 - Update the gitlab-markup gem to the version 1.5.1. !8509 - Remove Lock Icon on Protected Tag. !8513 (Sergey Nikitin) - Use cached values to compute total issues count in milestone index pages. !8518 - Speed up dashboard milestone index by scoping IssuesFinder to user authorized projects. !8524 - Copy <some text> to clipboard. !8535 - Check for env[Grape::Env::GRAPE_ROUTING_ARGS] instead of endpoint.route. !8544 - Fixes builds dropdown making request when clicked to be closed. !8545 - Fixes pipeline status cell is too wide by adding missing classes in table head cells. !8549 - Mutate the attribute instead of issuing a write operation to the DB in `ProjectFeaturesCompatibility` concern. !8552 - Fix links to commits pages on pipelines list page. !8558 - Ensure updating project settings shows a flash message on success. !8579 (Sandish Chen) - Fixes big pipeline and small pipeline width problems and tooltips text being outside the tooltip. !8593 - Autoresize markdown preview. !8607 (Didem Acet) - Link external build badge to its target URL. !8611 - Adjust ProjectStatistic#repository_size with values saved as MB. !8616 - Correct User-agent placement in robots.txt. !8623 (Eric Sabelhaus) - Record used SSH keys only once per day. !8655 - Do not generate pipeline branch/tag path if not present. !8658 - Fix Merge When Pipeline Succeeds immediate merge bug. !8685 - Fix blame 500 error on invalid path. !25761 (Jeff Stubler) - Added animations to issue boards interactions. - Check if user can read project before being assigned to issue. - Show 'too many changes' message for created merge requests when they are too large. - Fix redirect after update file when user has forked project. - Parse JIRA issue references even if Issue Tracker is disabled. - Made download artifacts button accessible via keyboard by changing it from an anchor tag to an actual button. (Ryan Harris) - Make play button on Pipelines page accessible via keyboard. (Ryan Harris) - Decreases font-size on login page. - Fixed merge request tabs dont move when opening collapsed sidebar. - Display project avatars on Admin Area and Projects pages for mobile views. (Ryan Harris) - Fix participants margins to fit on one line. - 26352 Change Profile settings to User / Settings. - Fix Commits API to accept a Project path upon POST. - Expire related caches after changing HEAD. (Minqi Pan) - Add various hover animations throughout the application. - Re-order update steps in the 8.14 -> 8.15 upgrade guide. - Move award emoji's out of the discussion tab for merge requests. - Synchronize all project authorization refreshing work to prevent race conditions. - Remove the project_authorizations.id column. - Combined the settings options project members and groups into a single one called members. - Change earlier to task_status_short to avoid titlebar line wraps. - 25701 standardize text colors. - Handle HTTP errors in environment list. - Re-add Google Cloud Storage as a backup strategy. - Change status colors of runners to better defaults. - Added number_with_delimiter to counter on milestone panels. (Ryan Harris) - Query external CI statuses in the background. - Allow group and project paths when transferring projects via the API. - Don't validate environment urls on .gitlab-ci.yml. - Fix a Grape deprecation, use `#request_method` instead of `#route_method`. - Fill missing authorized projects rows. - Allow API query to find projects with dots in their name. (Bruno Melli) - Fix import/export wrong user mapping. - Removed bottom padding from merge manually from CLI because of repositioning award emoji's. - Fix project queued for deletion re-creation tooltip. - Fix search group/project filtering to show results. - Fix 500 error when POSTing to Users API with optional confirm param. - 26504 Fix styling of MR jump to discussion button. - Add margin to markdown math blocks. - Add hover state to MR comment reply button. ## 8.15.7 (2017-02-15) - No changes. ## 8.15.15.4 (2017-01-09) - Make successful pipeline emails off for watchers. !8176 - Speed up group milestone index by passing group_id to IssuesFinder. !8363 - Don't instrument 405 Grape calls. !8445 - Update the gitlab-markup gem to the version 1.5.1. !8509 - Updated Turbolinks to mitigate potential XSS attacks. - Re-order update steps in the 8.14 -> 8.15 upgrade guide. - Re-add Google Cloud Storage as a backup strategy. ## 8.15.3 (2017-01-06) - Rename wiki_events to wiki_page_events in project hooks API to avoid errors. !8425 - Rename projects wth reserved names. !8234 - Cache project authorizations even when user has access to zero projects. !8327 - Fix a minor grammar error in merge request widget. !8337 - Fix unclear closing issue behaviour on Merge Request show page. !8345 (Gabriel Gizotti) - fix border in login session tabs. !8346 - Copy, don't move uploaded avatar files. !8396 - Increases width of mini-pipeline-graph dropdown to prevent wrong position on chrome on ubuntu. !8399 - Removes invalid html and unneed CSS to prevent shaking in the pipelines tab. !8411 - Gitlab::LDAP::Person uses LDAP attributes configuration. !8418 - Fix 500 errors when creating a user with identity via API. !8442 - Whitelist next project names: assets, profile, public. !8470 - Fixed regression of note-headline-light where it was always placed on 2 lines, even on wide viewports. - Fix 500 error when visit group from admin area if group name contains dot. - Fix cross-project references copy to include the project reference. - Fix 500 error renaming group. - Fixed GFM dropdown not showing on new lines. ## 8.15.2 (2016-12-27) - Fix finding the latest pipeline. !8301 - Fix mr list timestamp alignment. !8271 - Fix discussion overlap text in regular screens. !8273 - Fixes mini-pipeline-graph dropdown animation and stage position in chrome, firefox and safari. !8282 - Fix line breaking in nodes of the pipeline graph in firefox. !8292 - Fixes confendential warning text alignment. !8293 - Hide Scroll Top button for failed build page. !8295 - Fix finding the latest pipeline. !8301 - Disable PostgreSQL statement timeouts when removing unneeded services. !8322 - Fix timeout when MR contains large files marked as binary by .gitattributes. - Rename "autodeploy" to "auto deploy". - Fixed GFM autocomplete error when no data exists. - Fixed resolve discussion note button color. ## 8.15.1 (2016-12-23) - Push payloads schedule at most 100 commits, instead of all commits. - Fix Mattermost command creation by specifying username. - Do not override incoming webhook for mattermost and slack. - Adds background color for disabled state to merge when succeeds dropdown. !8222 - Standardises font-size for titles in Issues, Merge Requests and Merge Request widget. !8235 - Fix Pipeline builds list blank on MR. !8255 - Do not show retried builds in pipeline stage dropdown. !8260 ## 8.15.0 (2016-12-22) - Whitelist next project names: notes, services. - Use Grape's new Route methods. - Fixed issue boards scrolling with a lot of lists & issues. - Remove unnecessary sentences for status codes in the API documentation. (Luis Alonso Chavez Armendariz) - Allow unauthenticated access to Repositories Files API GET endpoints. - Add note to the invite page when the logged in user email is not the same as the invitation. - Don't accidentally mark unsafe diff lines as HTML safe. - Add git diff context to notifications of new notes on merge requests. (Heidi Hoopes) - Shows group members in project members list. - Gem update: Update grape to 0.18.0. (Robert Schilling) - API: Expose merge status for branch API. (Robert Schilling) - Displays milestone remaining days only when it's present. - API: Expose committer details for commits. (Robert Schilling) - API: Ability to set 'should_remove_source_branch' on merge requests. (Robert Schilling) - Fix project import label priorities error. - Fix Import/Export merge requests error while importing. - Refactor Bitbucket importer to use BitBucket API Version 2. - Fix Import/Export duplicated builds error. - Ci::Builds have same ref as Ci::Pipeline in dev fixtures. (twonegatives) - For single line git commit messages, the close quote should be on the same line as the open quote. - Use authorized projects in ProjectTeam. - Destroy a user's session when they delete their own account. - Edit help text to clarify annotated tag creation. (Liz Lam) - Fixed file template dropdown for the "New File" editor for smaller/zoomed screens. - Fix Route#rename_children behavior. - Add nested groups support on data level. - Allow projects with 'dashboard' as path. - Disabled emoji buttons when user is not logged in. - Remove unused and void services from the database. - Add issue search slash command. - Accept issue new as command to create an issue. - Non members cannot create labels through the API. - API: expose pipeline coverage. - Validate state param when filtering issuables. - Username exists check respects relative root path. - Bump Git version requirement to 2.8.4. - Updates the font weight of button styles because of the change to system fonts. - Update API spec files to describe the correct class. (Livier) - Fixed timeago re-rendering every timeago. - Enable ColorVariable in scss-lint. (Sam Rose) - Various small emoji positioning adjustments. - Add shortcuts for adding users to a project team with a specific role. (Nikolay Ponomarev and Dino M) - Additional rounded label fixes. - Remove unnecessary database indices. - 24726 Remove Across GitLab from side navigation. - Changed cursor icon to pointer when mousing over stages on the Cycle Analytics pages. (Ryan Harris) - Add focus state to dropdown items. - Fixes Environments displaying incorrect date since 8.14 upgrade. - Improve bulk assignment for issuables. - Stop supporting Google and Azure as backup strategies. - Fix broken README.md UX guide link. - Allow public access to some Tag API endpoints. - Encode input when migrating ProcessCommitWorker jobs to prevent migration errors. - Adjust the width of project avatars to fix alignment within their container. (Ryan Harris) - Sentence cased the nav tab headers on the project dashboard page. (Ryan Harris) - Adds hoverstates for collapsed Issue/Merge Request sidebar. - Make CI badge hitboxes match parent. - Add a starting date to milestones. - Adjusted margins for Build Status and Coverage Report rows to match those of the CI/CD Pipeline row. (Ryan Harris) - Updated members dropdowns. - Move all action buttons to project header. - Replace issue access checks with use of IssuableFinder. - Fix missing Note access checks by moving Note#search to updated NoteFinder. - Centered Accept Merge Request button within MR widget and added padding for viewports smaller than 768px. (Ryan Harris) - Fix missing access checks on issue lookup using IssuableFinder. - Added top margin to Build status page header for mobile views. (Ryan Harris) - Fixes "ActionView::Template::Error: undefined method `text?` for nil:NilClass" on MR pages. - Issue#visible_to_user moved to IssuesFinder to prevent accidental use. - Replace MR access checks with use of MergeRequestsFinder. - Fix information disclosure in `Projects::BlobController#update`. - Allow branch names with dots on API endpoint. - Changed Housekeeping button on project settings page to default styling. (Ryan Harris) - Ensure issuable state changes only fire webhooks once. - Fix bad selection on dropdown menu for tags filter. (Luis Alonso Chavez Armendariz) - Fix title case to sentence case. (Luis Alonso Chavez Armendariz) - Fix appearance in error pages. (Luis Alonso Chavez Armendariz) - Create mattermost service. - 25617 Fix placeholder color of todo filters. - Made the padding on the plus button in the breadcrumb menu even. (Ryan Harris) - Allow to delete tag release note. - Ensure nil User-Agent doesn't break the CI API. - Replace Rack::Multipart with GitLab-Workhorse based solution. !5867 - Add scopes for personal access tokens and OAuth tokens. !5951 - API: Endpoint to expose personal snippets as /snippets. !6373 (Bernard Guyzmo Pratz) - New `gitlab:workhorse:install` rake task. !6574 - Filter protocol-relative URLs in ExternalLinkFilter. Fixes issue #22742. !6635 (Makoto Scott-Hinkle) - Add support for setting the GitLab Runners Registration Token during initial database seeding. !6642 - Guests can read builds when public. !6842 - Made comment autocomplete more performant and removed some loading bugs. !6856 - Add GitLab host to 2FA QR code and manual info. !6941 - Add sorting functionality for group/project members. !7032 - Rename Merge When Build Succeeds to Merge When Pipeline Succeeds. !7135 - Resolve all discussions in a merge request by creating an issue collecting them. !7180 (Bob Van Landuyt) - Add Human Readable format for rake backup. !7188 (David Gerő) - post_receive: accept any user email from last commit. !7225 (Elan Ruusamäe) - Add support for Dockerfile templates. !7247 - Add shorthand support to gitlab markdown references. !7255 (Oswaldo Ferreira) - Display error code for U2F errors. !7305 (winniehell) - Fix wrong tab selected when loggin fails and multiple login tabs exists. !7314 (Jacopo Beschi @jacopo-beschi) - Clean up common_utils.js. !7318 (winniehell) - Show commit status from latest pipeline. !7333 - Remove the help text under the sidebar subscribe button and style it inline. !7389 - Update wiki page design. !7429 - Add nested groups support to the routing. !7459 - Changed eslint airbnb config to the base airbnb config and corrected eslintrc plugins and envs. !7470 (Luke "Jared" Bennett) - Fix cancelling created or external pipelines. !7508 - Allow admins to stop impersonating users without e-mail addresses. !7550 (Oren Kanner) - Remove unnecessary self from user model. !7551 (Semyon Pupkov) - Homogenize filter and sort dropdown look'n'feel. !7583 (David Wagner) - Create dynamic fixture for build_spec. !7589 (winniehell) - Moved Leave Project and Leave Group buttons to access_request_buttons from the settings dropdown. !7600 - Remove unnecessary require_relative calls from service classes. !7601 (Semyon Pupkov) - Simplify copy on "Create a new list" dropdown in Issue Boards. !7605 (Victor Rodrigues) - Refactor create service spec. !7609 (Semyon Pupkov) - Shows unconfirmed email status in profile. !7611 - The admin user projects view now has a clickable group link. !7620 (James Gregory) - Prevent DOM ID collisions resulting from user-generated content anchors. !7631 - Replace static fixture for abuse_reports_spec. !7644 (winniehell) - Define common helper for describe pagination params in api. !7646 (Semyon Pupkov) - Move abuse report spinach test to rspec. !7659 (Semyon Pupkov) - Replace static fixture for awards_handler_spec. !7661 (winniehell) - API: Add ability to unshare a project from a group. !7662 (Robert Schilling) - Replace references to MergeRequestDiff#commits with st_commits when we care only about the number of commits. !7668 - Add issue events filter and make all really show all events. !7673 (Oxan van Leeuwen) - Replace static fixture for notes_spec. !7683 (winniehell) - Replace static fixture for shortcuts_issuable_spec. !7685 (winniehell) - Replace static fixture for zen_mode_spec. !7686 (winniehell) - Replace static fixture for right_sidebar_spec. !7687 (winniehell) - Add online terminal support for Kubernetes. !7690 - Move admin abuse report spinach test to rspec. !7691 (Semyon Pupkov) - Move admin spam spinach test to Rspec. !7708 (Semyon Pupkov) - Make API::Helpers find a project with only one query. !7714 - Create builds in transaction to avoid empty pipelines. !7742 - Render SVG images in diffs and notes. !7747 (andrebsguedes) - Add setting to enable/disable HTML emails. !7749 - Use SmartInterval for MR widget and improve visibilitychange functionality. !7762 - Resolve "Remove Builds tab from Merge Requests and Commits". !7763 - Moved new projects button below new group button on the welcome screen. !7770 - fix display hook error message. !7775 (basyura) - Refactor issuable_filters_present to reduce duplications. !7776 (Semyon Pupkov) - Redirect to sign-in page when unauthenticated user tries to create a snippet. !7786 - Fix Archived project merge requests add to group's Merge Requests. !7790 (Jacopo Beschi @jacopo-beschi) - Update generic/external build status to match normal build status template. !7811 - Enable AsciiDoctor admonition icons. !7812 (Horacio Sanson) - Do not raise error in AutocompleteController#users when not authorized. !7817 (Semyon Pupkov) - fix: 24982- Remove'Signed in successfully' message After this change the sign-in-success flash message will not be shown. !7837 (jnoortheen) - Fix Latest deployment link is broken. !7839 - Don't display prompt to add SSH keys if SSH protocol is disabled. !7840 (Andrew Smith (EspadaV8)) - Allow unauthenticated access to some Project API GET endpoints. !7843 - Refactor presenters ChatCommands. !7846 - Improve help message for issue create slash command. !7850 - change text around timestamps to make it clear which timestamp is displayed. !7860 (BM5k) - Improve Build Log scrolling experience. !7895 - Change ref property to commitRef in vue commit component. !7901 - Prevent user creating issue or MR without signing in for a group. !7902 - Provides a sensible default message when adding a README to a project. !7903 - Bump ruby version to 2.3.3. !7904 - Fix comments activity tab visibility condition. !7913 (Rydkin Maxim) - Remove unnecessary target branch link from MR page in case of deleted target branch. !7916 (Rydkin Maxim) - Add image controls to MR diffs. !7919 - Remove wrong '.builds-feature' class from the MR settings fieldset. !7930 - Resolve "Manual actions on pipeline graph". !7931 - Avoid escaping relative links in Markdown twice. !7940 (winniehell) - Move admin hooks spinach to rspec. !7942 (Semyon Pupkov) - Move admin logs spinach test to rspec. !7945 (Semyon Pupkov) - fix: removed signed_out notification. !7958 (jnoortheen) - Accept environment variables from the `pre-receive` script. !7967 - Do not reload diff for merge request made from fork when target branch in fork is updated. !7973 - Fixes left align issue for long system notes. !7982 - Add a slug to environments. !7983 - Fix lookup of project by unknown ref when caching is enabled. !7988 - Resolve "Provide SVG as a prop instead of hiding and copy them in environments table". !7992 - Introduce deployment services, starting with a KubernetesService. !7994 - Adds tests for custom event polyfill. !7996 - Allow all alphanumeric characters in file names. !8002 (winniehell) - Added support for math rendering, using KaTeX, in Markdown and asciidoc. !8003 (Munken) - Remove unnecessary commits order message. !8004 - API: Memoize the current_user so that sudo can work properly. !8017 - group authors in contribution graph with case insensitive email handle comparison. !8021 - Move admin active tab spinach tests to rspec. !8037 (Semyon Pupkov) - Add Authentiq as Oauth provider. !8038 (Alexandros Keramidas) - API: Ability to cherry pick a commit. !8047 (Robert Schilling) - Fix Slack pipeline message from pipelines made by API. !8059 - API: Simple representation of group's projects. !8060 (Robert Schilling) - Prevent overflow with vertical scroll when we have space to show content. !8061 - Allow to auto-configure Mattermost. !8070 - Introduce $CI_BUILD_REF_SLUG. !8072 - Added go back anchor on error pages. !8087 - Convert CI YAML variables keys into strings. !8088 - Adds Direct link from pipeline list to builds. !8097 - Cache last commit id for path. !8098 (Hiroyuki Sato) - Pass variables from deployment project services to CI runner. !8107 - New Gitea importer. !8116 - Introduce "Set up autodeploy" button to help configure GitLab CI for deployment. !8135 - Prevent enviroment table to overflow when name has underscores. !8142 - Fix missing service error importing from EE to CE. !8144 - Milestoneish SQL performance partially improved and memoized. !8146 - Allow unauthenticated access to Repositories API GET endpoints. !8148 - fix colors and margins for adjacent alert banners. !8151 - Hides new issue button for non loggedin user. !8175 - Fix N+1 queries on milestone show pages. !8185 - Rename groups with .git in the end of the path. !8199 - Whitelist next project names: help, ci, admin, search. !8227 - Adds back CSS for progress-bars. !8237 ## 8.14.10 (2017-02-15) - No changes. ## 8.14.9 .14.8 (2017-01-25) - Accept environment variables from the `pre-receive` script. !7967 - Milestoneish SQL performance partially improved and memoized. !8146 - Fix N+1 queries on milestone show pages. !8185 - Speed up group milestone index by passing group_id to IssuesFinder. !8363 - Ensure issuable state changes only fire webhooks once. ## 8.14.6 (2017-01-10) - Update the gitlab-markup gem to the version 1.5.1. !8509 - Updated Turbolinks to mitigate potential XSS attacks. ## 8.14.5 (2016-12-14) - Moved Leave Project and Leave Group buttons to access_request_buttons from the settings dropdown. !7600 - fix display hook error message. !7775 (basyura) - Remove wrong '.builds-feature' class from the MR settings fieldset. !7930 - Avoid escaping relative links in Markdown twice. !7940 (winniehell) - API: Memoize the current_user so that sudo can work properly. !8017 - Displays milestone remaining days only when it's present. - Allow branch names with dots on API endpoint. - Issue#visible_to_user moved to IssuesFinder to prevent accidental use. - Shows group members in project members list. - Encode input when migrating ProcessCommitWorker jobs to prevent migration errors. - Fixed timeago re-rendering every timeago. - Fix missing Note access checks by moving Note#search to updated NoteFinder. ## 8.14.4 (2016-12-08) - Fix diff view permalink highlighting. !7090 - Fix pipeline author for Slack and use pipeline id for pipeline link. !7506 - Fix compatibility with Internet Explorer 11 for merge requests. !7525 (Steffen Rauh) - Reenables /user API request to return private-token if user is admin and request is made with sudo. !7615 - Fix Cicking on tabs on pipeline page should set URL. !7709 - Authorize users into imported GitLab project. - Destroy a user's session when they delete their own account. - Don't accidentally mark unsafe diff lines as HTML safe. - Replace MR access checks with use of MergeRequestsFinder. - Remove visible content caching. ## 8.14.3 (2016-12-02) - Pass commit data to ProcessCommitWorker to reduce Git overhead. !7744 - Speed up issuable dashboards. - Don't change relative URLs to absolute URLs in the Help page. - Fixes "ActionView::Template::Error: undefined method `text?` for nil:NilClass" on MR pages. - Fix branch validation for GitHub PR where repo/fork was renamed/deleted. - Validate state param when filtering issuables. ## 8.14.2 (2016-12-01) - Remove caching of events data. !6578 - Rephrase some system notes to be compatible with new system note style. !7692 - Pass tag SHA to post-receive hook when tag is created via UI. !7700 - Prevent error when submitting a merge request and pipeline is not defined. !7707 - Fixes system note style in commit discussion. !7721 - Use a Redis lease for updating authorized projects. !7733 - Refactor JiraService by moving code out of JiraService#execute method. !7756 - Update GitLab Workhorse to v1.0.1. !7759 - Fix pipelines info being hidden in merge request widget. !7808 - Fixed commit timeago not rendering after initial page. - Fix for error thrown in cycle analytics events if build has not started. - Fixed issue boards issue sorting when dragging issue into list. - Allow access to the wiki with git when repository feature disabled. - Fixed timeago not rendering when resolving a discussion. - Update Sidekiq-cron to fix compatibility issues with Sidekiq 4.2.1. - Timeout creating and viewing merge request for binary file. - Gracefully recover from Redis connection failures in Sidekiq initializer. ## 8.14.1 (2016-11-28) - Fix deselecting calendar days on contribution graph. !6453 (ClemMakesApps) - Update grape entity to 0.6.0. !7491 - If Build running change accept merge request when build succeeds button from orange to blue. !7577 - Changed import sources buttons to checkboxes. !7598 (Luke "Jared" Bennett) - Last minute CI Style tweaks for 8.14. !7643 - Fix exceptions when loading build trace. !7658 - Fix wrong template rendered when CI/CD settings aren't update successfully. !7665 - fixes last_deployment call environment is nil. !7671 - Sort builds by name within pipeline graph. !7681 - Correctly determine mergeability of MR with no discussions. - Sidekiq stats in the admin area will now show correctly on different platforms. (blackst0ne) - Fixed issue boards dragging card removing random issues. - Fix information disclosure in `Projects::BlobController#update`. - Fix missing access checks on issue lookup using IssuableFinder. - Replace issue access checks with use of IssuableFinder. - Non members cannot create labels through the API. - Fix cycle analytics plan stage when commits are missing. ## 8.14.0 (2016-11-22) - Use separate email-token for incoming email and revert back the inactive feature. !5914 - API: allow recursive tree request. !6088 (Rebeca Mendez) - Replace jQuery.timeago with timeago.js. !6274 (ClemMakesApps) - Add CI notifications. Who triggered a pipeline would receive an email after the pipeline is succeeded or failed. Users could also update notification settings accordingly. !6342 - Add button to delete all merged branches. !6449 (Toon Claes) - Finer-grained Git gargage collection. !6588 - Introduce better credential and error checking to `rake gitlab:ldap:check`. !6601 - Centralize LDAP config/filter logic. !6606 - Make system notes less intrusive. !6755 - Process commits using a dedicated Sidekiq worker. !6802 - Show random messages when the To Do list is empty. !6818 (Josep Llaneras) - Precalculate user's authorized projects in database. !6839 - Fix record not found error on NewNoteWorker processing. !6863 (Oswaldo Ferreira) - Show avatars in mention dropdown. !6865 - Fix expanding a collapsed diff when converting a symlink to a regular file. !6953 - Defer saving project services to the database if there are no user changes. !6958 - Omniauth auto link LDAP user falls back to find by DN when user cannot be found by UID. !7002 - Display "folders" for environments. !7015 - Make it possible to trigger builds from webhooks. !7022 (Dmitry Poray) - Fix showing pipeline status for a given commit from correct branch. !7034 - Add link to build pipeline within individual build pages. !7082 - Add api endpoint `/groups/owned`. !7103 (Borja Aparicio) - Add query param to filter users by external & blocked type. !7109 (Yatish Mehta) - Issues atom feed url reflect filters on dashboard. !7114 (Lucas Deschamps) - Add setting to only allow merge requests to be merged when all discussions are resolved. !7125 (Rodolfo Arruda) - Remove an extra leading space from diff paste data. !7133 (Hiroyuki Sato) - Fix trace patching feature - update the updated_at value. !7146 - Fix 404 on network page when entering non-existent git revision. !7172 (Hiroyuki Sato) - Rewrite git blame spinach feature tests to rspec feature tests. !7197 (Lisanne Fellinger) - Add api endpoint for creating a pipeline. !7209 (Ido Leibovich) - Allow users to subscribe to group labels. !7215 - Reduce API calls needed when importing issues and pull requests from GitHub. !7241 (Andrew Smith (EspadaV8)) - Only skip group when it's actually a group in the "Share with group" select. !7262 - Introduce round-robin project creation to spread load over multiple shards. !7266 - Ensure merge request's "remove branch" accessors return booleans. !7267 - Fix no "Register" tab if ldap auth is enabled (#24038). !7274 (Luc Didry) - Expose label IDs in API. !7275 (Rares Sfirlogea) - Fix invalid filename validation on eslint. !7281 - API: Ability to retrieve version information. !7286 (Robert Schilling) - Added ability to throttle Sidekiq Jobs. !7292 - Set default Sidekiq retries to 3. !7294 - Fix double event and ajax request call on MR page. !7298 (YarNayar) - Unify anchor link format for MR diff files. !7298 (YarNayar) - Require projects before creating milestone. !7301 (gfyoung) - Fix error when using invalid branch name when creating a new pipeline. !7324 - Return 400 when creating a system hook fails. !7350 (Robert Schilling) - Auto-close environment when branch is deleted. !7355 - Rework cache invalidation so only changed data is refreshed. !7360 - Navigation bar issuables counters reflects dashboard issuables counters. !7368 (Lucas Deschamps) - Fix cache for commit status in commits list to respect branches. !7372 - fixes 500 error on project show when user is not logged in and project is still empty. !7376 - Removed gray button styling from todo buttons in sidebars. !7387 - Fix project records with invalid visibility_level values. !7391 - Use 'Forking in progress' title when appropriate. !7394 (Philip Karpiak) - Fix error links in help index page. !7396 (Fu Xu) - Add support for reply-by-email when the email only contains HTML. !7397 - [Fix] Extra divider issue in dropdown. !7398 - Project download buttons always show. !7405 (Philip Karpiak) - Give search-input correct padding-right value. !7407 (Philip Karpiak) - Remove additional padding on right-aligned items in MR widget. !7411 (Didem Acet) - Fix issue causing Labels not to appear in sidebar on MR page. !7416 (Alex Sanford) - Allow mail_room idle_timeout option to be configurable. !7423 - Fix misaligned buttons on admin builds page. !7424 (Didem Acet) - Disable "Request Access" functionality by default for new projects and groups. !7425 - fix shibboleth misconfigurations resulting in authentication bypass. !7428 - Added Mattermost slash command. !7438 - Allow to connect Chat account with GitLab. !7450 - Make New Group form respect default visibility application setting. !7454 (Jacopo Beschi @jacopo-beschi) - Fix Error 500 when creating a merge request that contains an image that was deleted and added. !7457 - Fix labels API by adding missing current_user parameter. !7458 (Francesco Coda Zabetta) - Changed restricted visibility admin buttons to checkboxes. !7463 - Send credentials (currently for registry only) with build data to GitLab Runner. !7474 - Fix POST /internal/allowed to cope with gitlab-shell v4.0.0 project paths. !7480 - Adds es6-promise Polyfill. !7482 - Added colored labels to related MR list. !7486 (Didem Acet) - Use setter for key instead AR callback. !7488 (Semyon Pupkov) - Limit labels returned for a specific project as an administrator. !7496 - Change slack notification comment link. !7498 (Herbert Kagumba) - Allow registering users whose username contains dots. !7500 (Timothy Andrew) - Fix race condition during group deletion and remove stale records present due to this bug. !7528 (Timothy Andrew) - Check all namespaces on validation of new username. !7537 - Pass correct tag target to post-receive hook when creating tag via UI. !7556 - Add help message for configuring Mattermost slash commands. !7558 - Fix typo in Build page JavaScript. !7563 (winniehell) - Make job script a required configuration entry. !7566 - Fix errors happening when source branch of merge request is removed and then restored. !7568 - Fix a wrong "The build for this merge request failed" message. !7579 - Fix Margins look weird in Project page with pinned sidebar in project stats bar. !7580 - Fix regression causing bad error message to appear on Merge Request form. !7599 (Alex Sanford) - Fix activity page endless scroll on large viewports. !7608 - Fix 404 on some group pages when name contains dot. !7614 - Do not create a new TODO when failed build is allowed to fail. !7618 - Add deployment command to ChatOps. !7619 - Fix 500 error when group name ends with git. !7630 - Fix undefined error in CI linter. !7650 - Show events per stage on Cycle Analytics page. !23449 - Add JIRA remotelinks and prevent duplicated closing messages. - Fixed issue boards counter border when unauthorized. - Add placeholder for the example text for custom hex color on label creation popup. (Luis Alonso Chavez Armendariz) - Add an index for project_id in project_import_data to improve performance. - Fix broken commits search. - Assignee dropdown now searches author of issue or merge request. - Clicking "force remove source branch" label now toggles the checkbox again. - More aggressively preload on merge request and issue index pages. - Fix broken link to observatory cli on Frontend Dev Guide. (Sam Rose) - Fixing the issue of the project fork url giving 500 when not signed instead of being redirected to sign in page. (Cagdas Gerede) - Fix: Guest sees some repository details and gets 404. - Add logging for rack attack events to production.log. - Add environment info to builds page. - Allow commit note to be visible if repo is visible. - Bump omniauth-gitlab to 1.0.2 to fix incompatibility with omniauth-oauth2. - Redesign pipelines page. - Faster search inside Project. - Allow sorting groups in the API. - Fix: Todos Filter Shows All Users. - Use the Gitlab Workhorse HTTP header in the admin dashboard. (Chris Wright) - Fixed multiple requests sent when opening dropdowns. - Added permissions per stage to cycle analytics endpoint. - Fix project Visibility Level selector not using default values. - Add events per stage to cycle analytics. - Allow to test JIRA service settings without having a repository. - Fix JIRA references for project snippets. - Allow enabling and disabling commit and MR events for JIRA. - simplify url generation. (Jarka Kadlecova) - Show correct environment log in admin/logs (@duk3luk3 !7191) - Fix Milestone dropdown not stay selected for `Upcoming` and `No Milestone` option !7117 - Diff collapse won't shift when collapsing. - Backups do not fail anymore when using tar on annex and custom_hooks only. !5814 - Adds user project membership expired event to clarify why user was removed (Callum Dryden) - Trim leading and trailing whitespace on project_path (Linus Thiel) - Prevent award emoji via notes for issues/MRs authored by user (barthc) - Adds support for the `token` attribute in project hooks API (Gauvain Pocentek) - Change auto selection behaviour of emoji and slash commands to be more UX/Type friendly (Yann Gravrand) - Adds an optional path parameter to the Commits API to filter commits by path (Luis HGO) - Fix Markdown styling inside reference links (Jan Zdráhal) - Create new issue board list after creating a new label - Fix extra space on Build sidebar on Firefox !7060 - Fail gracefully when creating merge request with non-existing branch (alexsanford) - Fix mobile layout issues in admin user overview page !7087 - Fix HipChat notifications rendering (airatshigapov, eisnerd) - Removed unneeded "Builds" and "Environments" link from project titles - Remove 'Edit' button from wiki edit view !7143 (Hiroyuki Sato) - Cleaned up global namespace JS !19661 (Jose Ivan Vargas) - Refactor Jira service to use jira-ruby gem - Improved todos empty state - Add hover to trash icon in notes !7008 (blackst0ne) - Hides project activity tabs when features are disabled - Only show one error message for an invalid email !5905 (lycoperdon) - Added guide describing how to upgrade PostgreSQL using Slony - Fix sidekiq stats in admin area (blackst0ne) - Added label description as tooltip to issue board list title - Created cycle analytics bundle JavaScript file - Make the milestone page more responsive (yury-n) - Hides container registry when repository is disabled - API: Fix booleans not recognized as such when using the `to_boolean` helper - Removed delete branch tooltip !6954 - Stop unauthorized users dragging on milestone page (blackst0ne) - Restore issue boards welcome message when a project is created !6899 - Check that JavaScript file names match convention !7238 (winniehell) - Do not show tooltip for active element !7105 (winniehell) - Escape ref and path for relative links !6050 (winniehell) - Fixed link typo on /help/ui to Alerts section. !6915 (Sam Rose) - Fix broken issue/merge request links in JIRA comments. !6143 (Brian Kintz) - Fix filtering of milestones with quotes in title (airatshigapov) - Fix issue boards dragging bug in Safari - Refactor less readable existance checking code from CoffeeScript !6289 (jlogandavison) - Update mail_room and enable sentinel support to Reply By Email (!7101) - Add task completion status in Issues and Merge Requests tabs: "X of Y tasks completed" (!6527, @gmesalazar) - Simpler arguments passed to named_route on toggle_award_url helper method - Fix typo in framework css class. !7086 (Daniel Voogsgerd) - New issue board list dropdown stays open after adding a new list - Fix: Backup restore doesn't clear cache - Optimize Event queries by removing default order - Add new icon for skipped builds - Show created icon in pipeline mini-graph - Remove duplicate links from sidebar - API: Fix project deploy keys 400 and 500 errors when adding an existing key. !6784 (Joshua Welsh) - Add Rake task to create/repair GitLab Shell hooks symlinks !5634 - Add job for removal of unreferenced LFS objects from both the database and the filesystem (Frank Groeneveld) - Replace jquery.cookie plugin with js.cookie !7085 - Use MergeRequestsClosingIssues cache data on Issue#closed_by_merge_requests method - Fix Sign in page 'Forgot your password?' link overlaps on medium-large screens - Show full status link on MR & commit pipelines - Fix documents and comments on Build API `scope` - Initialize Sidekiq with the list of queues used by GitLab - Refactor email, use setter method instead AR callbacks for email attribute (Semyon Pupkov) - Shortened merge request modal to let clipboard button not overlap - Adds JavaScript validation for group path editing field - In all filterable drop downs, put input field in focus only after load is complete (Ido @leibo) - Improve search query parameter naming in /admin/users !7115 (YarNayar) - Fix table pagination to be responsive - Fix applying GitHub-imported labels when importing job is interrupted - Allow to search for user by secondary email address in the admin interface(/admin/users) !7115 (YarNayar) - Updated commit SHA styling on the branches page. - Fix "Without projects" filter. !6611 (Ben Bodenmiller) - Fix 404 when visit /projects page ## 8.13.11 (2017-01-10) - Update the gitlab-markup gem to the version 1.5.1. !8509 - Updated Turbolinks to mitigate potential XSS attacks. ## 8.13.10 (2016-12-14) - API: Memoize the current_user so that sudo can work properly. !8017 - Filter `authentication_token`, `incoming_email_token` and `runners_token` parameters. - Issue#visible_to_user moved to IssuesFinder to prevent accidental use. - Fix missing Note access checks by moving Note#search to updated NoteFinder. ## 8.13.9 (2016-12-08) - Reenables /user API request to return private-token if user is admin and request is made with sudo. !7615 - Replace MR access checks with use of MergeRequestsFinder. ## 8.13.8 (2016-12-02) - Pass tag SHA to post-receive hook when tag is created via UI. !7700 - Validate state param when filtering issuables. ## 8.13.7 (2016-11-28) - fixes 500 error on project show when user is not logged in and project is still empty. !7376 - Update grape entity to 0.6.0. !7491 - Fix information disclosure in `Projects::BlobController#update`. - Fix missing access checks on issue lookup using IssuableFinder. - Replace issue access checks with use of IssuableFinder. - Non members cannot create labels through the API. ## 8.13.6 (2016-11-17) - Omniauth auto link LDAP user falls back to find by DN when user cannot be found by UID. !7002 - Fix Milestone dropdown not stay selected for `Upcoming` and `No Milestone` option. !7117 - Fix relative links in Markdown wiki when displayed in "Project" tab. !7218 - Fix no "Register" tab if ldap auth is enabled (#24038). !7274 (Luc Didry) - Fix cache for commit status in commits list to respect branches. !7372 - Fix issue causing Labels not to appear in sidebar on MR page. !7416 (Alex Sanford) - Limit labels returned for a specific project as an administrator. !7496 - Clicking "force remove source branch" label now toggles the checkbox again. - Allow commit note to be visible if repo is visible. - Fix project Visibility Level selector not using default values. ## 8.13.5 (2016-11-08) - Restore unauthenticated access to public container registries - Fix showing pipeline status for a given commit from correct branch. !7034 - Only skip group when it's actually a group in the "Share with group" select. !7262 - Introduce round-robin project creation to spread load over multiple shards. !7266 - Ensure merge request's "remove branch" accessors return booleans. !7267 - Ensure external users are not able to clone disabled repositories. - Fix XSS issue in Markdown autolinker. - Respect event visibility in Gitlab::ContributionsCalendar. - Honour issue and merge request visibility in their respective finders. - Disable reference Markdown for unavailable features. - Fix lightweight tags not processed correctly by GitTagPushService. !6532 - Allow owners to fetch source code in CI builds. !6943 - Return conflict error in label API when title is taken by group label. !7014 - Reduce the overhead to calculate number of open/closed issues and merge requests within the group or project. !7123 - Fix builds tab visibility. !7178 - Fix project features default values. !7181 ## 8.13.4 - Pulled due to packaging error. ## 8.13.3 (2016-11-02) - Removes any symlinks before importing a project export file. CVE-2016-9086 - Fixed Import/Export foreign key issue to do with project members. - Changed build dropdown list length to be 6,5 builds long in the pipeline graph ## 8.13.2 (2016-10-31) - Fix encoding issues on pipeline commits. !6832 - Use Hash rocket syntax to fix cycle analytics under Ruby 2.1. !6977 - Modify GitHub importer to be retryable. !7003 - Fix refs dropdown selection with special characters. !7061 - Fix horizontal padding for highlight blocks. !7062 - Pass user instance to `Labels::FindOrCreateService` or `skip_authorization: true`. !7093 - Fix builds dropdown overlapping bug. !7124 - Fix applying labels for GitHub-imported MRs. !7139 - Fix importing MR comments from GitHub. !7139 - Fix project member access for group links. !7144 - API: Fix booleans not recognized as such when using the `to_boolean` helper. !7149 - Fix and improve `Sortable.highest_label_priority`. !7165 - Fixed sticky merge request tabs when sidebar is pinned. !7167 - Only remove right connector of first build of last stage. !7179 ## 8.13.1 (2016-10-25) - Fix branch protection API. !6215 - Fix hidden pipeline graph on commit and MR page. !6895 - Fix Cycle analytics not showing correct data when filtering by date. !6906 - Ensure custom provider tab labels don't break layout. !6993 - Fix issue boards user link when in subdirectory. !7018 - Refactor and add new environment functionality to CI yaml reference. !7026 - Fix typo in project settings that prevents users from enabling container registry. !7037 - Fix events order in `users/:id/events` endpoint. !7039 - Remove extra line for empty issue description. !7045 - Don't append issue/MR templates to any existing text. !7050 - Fix error in generating labels. !7055 - Stop clearing the database cache on `rake cache:clear`. !7056 - Only show register tab if signup enabled. !7058 - Fix lightweight tags not processed correctly by GitTagPushService - Expire and build repository cache after project import. !7064 - Fix bug where labels would be assigned to issues that were moved. !7065 - Fix reply-by-email not working due to queue name mismatch. !7068 - Fix 404 for group pages when GitLab setup uses relative url. !7071 - Fix `User#to_reference`. !7088 - Reduce overhead of `LabelFinder` by avoiding `#presence` call. !7094 - Fix unauthorized users dragging on issue boards. !7096 - Only schedule `ProjectCacheWorker` jobs when needed. !7099 ## 8.13.0 (2016-10-22) - Fix save button on project pipeline settings page. (!6955) - All Sidekiq workers now use their own queue - Avoid race condition when asynchronously removing expired artifacts. (!6881) - Improve Merge When Build Succeeds triggers and execute on pipeline success. (!6675) - Respond with 404 Not Found for non-existent tags (Linus Thiel) - Truncate long labels with ellipsis in labels page - Improve tabbing usability for sign in page (ClemMakesApps) - Enforce TrailingSemicolon and EmptyLineBetweenBlocks in scss-lint - Adding members no longer silently fails when there is extra whitespace - Update runner version only when updating contacted_at - Add link from system note to compare with previous version - Use gitlab-shell v3.6.6 - Ignore references to internal issues when using external issues tracker - Ability to resolve merge request conflicts with editor !6374 - Add `/projects/visible` API endpoint (Ben Boeckel) - Fix centering of custom header logos (Ashley Dumaine) - Keep around commits only pipeline creation as pipeline data doesn't change over time - Update duration at the end of pipeline - ExpireBuildArtifactsWorker query builds table without ordering enqueuing one job per build to cleanup - Add group level labels. (!6425) - Add an example for testing a phoenix application with Gitlab CI in the docs (Manthan Mallikarjun) - Cancelled pipelines could be retried. !6927 - Updating verbiage on git basics to be more intuitive - Fix project_feature record not generated on project creation - Clarify documentation for Runners API (Gennady Trafimenkov) - Use optimistic locking for pipelines and builds - The instrumentation for Banzai::Renderer has been restored - Change user & group landing page routing from /u/:username to /:username - Added documentation for .gitattributes files - Move Pipeline Metrics to separate worker - AbstractReferenceFilter caches project_refs on RequestStore when active - Replaced the check sign to arrow in the show build view. !6501 - Add a /wip slash command to toggle the Work In Progress status of a merge request. !6259 (tbalthazar) - ProjectCacheWorker updates caches at most once per 15 minutes per project - Fix Error 500 when viewing old merge requests with bad diff data - Create a new /templates namespace for the /licenses, /gitignores and /gitlab_ci_ymls API endpoints. !5717 (tbalthazar) - Fix viewing merged MRs when the source project has been removed !6991 - Speed-up group milestones show page - Fix inconsistent options dropdown caret on mobile viewports (ClemMakesApps) - Extract project#update_merge_requests and SystemHooks to its own worker from GitPushService - Fix discussion thread from emails for merge requests. !7010 - Don't include archived projects when creating group milestones. !4940 (Jeroen Jacobs) - Add tag shortcut from the Commit page. !6543 - Keep refs for each deployment - Close open tooltips on page navigation (Linus Thiel) - Allow browsing branches that end with '.atom' - Log LDAP lookup errors and don't swallow unrelated exceptions. !6103 (Markus Koller) - Replace unique keyframes mixin with keyframe mixin with specific names (ClemMakesApps) - Add more tests for calendar contribution (ClemMakesApps) - Update Gitlab Shell to fix some problems with moving projects between storages - Cache rendered markdown in the database, rather than Redis - Add todo toggle event (ClemMakesApps) - Avoid database queries on Banzai::ReferenceParser::BaseParser for nodes without references - Simplify Mentionable concern instance methods - API: Ability to retrieve version information (Robert Schilling) - Fix permission for setting an issue's due date - API: Multi-file commit !6096 (mahcsig) - Unicode emoji are now converted to images - Revert "Label list shows all issues (opened or closed) with that label" - Expose expires_at field when sharing project on API - Fix VueJS template tags being rendered in code comments - Added copy file path button to merge request diff files - Fix issue with page scrolling to top when closing or pinning sidebar (lukehowell) - Add Issue Board API support (andrebsguedes) - Allow the Koding integration to be configured through the API - Add new issue button to each list on Issues Board - Execute specific named route method from toggle_award_url helper method - Added soft wrap button to repository file/blob editor - Update namespace validation to forbid reserved names (.git and .atom) (Will Starms) - Show the time ago a merge request was deployed to an environment - Add RTL support to markdown renderer (Ebrahim Byagowi) - Add word-wrap to issue title on issue and milestone boards (ClemMakesApps) - Fix todos page mobile viewport layout (ClemMakesApps) - Make issues search less finicky - Fix inconsistent highlighting of already selected activity nav-links (ClemMakesApps) - Remove redundant mixins (ClemMakesApps) - Added 'Download' button to the Snippets page (Justin DiPierro) - Add visibility level to project repository - Fix robots.txt disallowing access to groups starting with "s" (Matt Harrison) - Close open merge request without source project (Katarzyna Kobierska Ula Budziszewska) - Fix showing commits from source project for merge request !6658 - Fix that manual jobs would no longer block jobs in the next stage. !6604 - Add configurable email subject suffix (Fu Xu) - Use defined colour for a language when available !6748 (nilsding) - Added tooltip to fork count on project show page. (Justin DiPierro) - Use a ConnectionPool for Rails.cache on Sidekiq servers - Replace `alias_method_chain` with `Module#prepend` - Enable GitLab Import/Export for non-admin users. - Preserve label filters when sorting !6136 (Joseph Frazier) - MergeRequest#new form load diff asynchronously - Only update issuable labels if they have been changed - Take filters in account in issuable counters. !6496 - Use custom Ruby images to test builds (registry.dev.gitlab.org/gitlab/gitlab-build-images:*) - Replace static issue fixtures by script !6059 (winniehell) - Append issue template to existing description !6149 (Joseph Frazier) - Trending projects now only show public projects and the list of projects is cached for a day - Memoize Gitlab Shell's secret token (!6599, Justin DiPierro) - Revoke button in Applications Settings underlines on hover. - Use higher size on Gitlab::Redis connection pool on Sidekiq servers - Add missing values to linter !6276 (Katarzyna Kobierska Ula Budziszewska) - Revert avoid touching file system on Build#artifacts? - Stop using a Redis lease when updating the project activity timestamp whenever a new event is created - Add disabled delete button to protected branches (ClemMakesApps) - Add broadcast messages and alerts below sub-nav - Better empty state for Groups view - API: New /users/:id/events endpoint - Update ruby-prof to 0.16.2. !6026 (Elan Ruusamäe) - Replace bootstrap caret with fontawesome caret (ClemMakesApps) - Fix unnecessary escaping of reserved HTML characters in milestone title. !6533 - Add organization field to user profile - Change user pages routing from /u/:username/PATH to /users/:username/PATH. Old routes will redirect to the new ones for the time being. - Fix enter key when navigating search site search dropdown. !6643 (Brennan Roberts) - Fix deploy status responsiveness error !6633 - Make searching for commits case insensitive - Fix resolved discussion display in side-by-side diff view !6575 - Optimize GitHub importing for speed and memory - API: expose pipeline data in builds API (!6502, Guilherme Salazar) - Notify the Merger about merge after successful build (Dimitris Karakasilis) - Reduce queries needed to find users using their SSH keys when pushing commits - Prevent rendering the link to all when the author has no access (Katarzyna Kobierska Ula Budziszewska) - Fix broken repository 500 errors in project list - Fix the diff in the merge request view when converting a symlink to a regular file - Fix Pipeline list commit column width should be adjusted - Close todos when accepting merge requests via the API !6486 (tonygambone) - Ability to batch assign issues relating to a merge request to the author. !5725 (jamedjo) - Changed Slack service user referencing from full name to username (Sebastian Poxhofer) - Retouch environments list and deployments list - Add multiple command support for all label related slash commands !6780 (barthc) - Add Container Registry on/off status to Admin Area !6638 (the-undefined) - Add Nofollow for uppercased scheme in external urls !6820 (the-undefined) - Allow empty merge requests !6384 (Artem Sidorenko) - Grouped pipeline dropdown is a scrollable container - Cleanup Ci::ApplicationController. !6757 (Takuya Noguchi) - Fixes padding in all clipboard icons that have .btn class - Fix a typo in doc/api/labels.md - Fix double-escaping in activities tab (Alexandre Maia) - API: all unknown routing will be handled with 404 Not Found - Add docs for request profiling - Delete dynamic environments - Fix buggy iOS tooltip layering behavior. - Make guests unable to view MRs on private projects - Fix broken Project API docs (Takuya Noguchi) - Migrate invalid project members (owner -> master) ## 8.12.12 (2016-12-08) - Replace MR access checks with use of MergeRequestsFinder - Reenables /user API request to return private-token if user is admin and request is made with sudo ## 8.12.11 (2016-12-02) - No changes ## 8.12.10 (2016-11-28) - Fix information disclosure in `Projects::BlobController#update` - Fix missing access checks on issue lookup using IssuableFinder - Replace issue access checks with use of IssuableFinder ## 8.12.9 (2016-11-07) - Fix XSS issue in Markdown autolinker ## 8.12.8 (2016-11-02) - Removes any symlinks before importing a project export file. CVE-2016-9086 - Fixed Import/Export foreign key issue to do with project members. ## 8.12.7 - Prevent running `GfmAutocomplete` setup for each diff note. !6569 - Fix long commit messages overflow viewport in file tree. !6573 - Use `gitlab-markup` gem instead of `github-markup` to fix `.rst` file rendering. !6659 - Prevent flash alert text from being obscured when container is fluid. !6694 - Fix due date being displayed as `NaN` in Safari. !6797 - Fix JS bug with select2 because of missing `data-field` attribute in select box. !6812 - Do not alter `force_remove_source_branch` options on MergeRequest unless specified. !6817 - Fix GFM autocomplete setup being called several times. !6840 - Handle case where deployment ref no longer exists. !6855 ## 8.12.6 - Update mailroom to 0.8.1 in Gemfile.lock !6814 ## 8.12.5 - Switch from request to env in ::API::Helpers. !6615 - Update the mail_room gem to 0.8.1 to fix a race condition with the mailbox watching thread. !6714 - Improve issue load time performance by avoiding ORDER BY in find_by call. !6724 - Add a new gitlab:users:clear_all_authentication_tokens task. !6745 - Don't send Private-Token (API authentication) headers to Sentry - Share projects via the API only with groups the authenticated user can access ## 8.12.4 - Fix "Copy to clipboard" tooltip to say "Copied!" when clipboard button is clicked. !6294 (lukehowell) - Fix padding in build sidebar. !6506 - Changed compare dropdowns to dropdowns with isolated search input. !6550 - Fix race condition on LFS Token. !6592 - Fix type mismatch bug when closing Jira issue. !6619 - Fix lint-doc error. !6623 - Skip wiki creation when GitHub project has wiki enabled. !6665 - Fix issues importing services via Import/Export. !6667 - Restrict failed login attempts for users with 2FA enabled. !6668 - Fix failed project deletion when feature visibility set to private. !6688 - Prevent claiming associated model IDs via import. - Set GitLab project exported file permissions to owner only - Improve the way merge request versions are compared with each other ## 8.12.3 - Update Gitlab Shell to support low IO priority for storage moves ## 8.12.2 - Fix Import/Export not recognising correctly the imported services. - Fix snippets pagination - Fix "Create project" button layout when visibility options are restricted - Fix List-Unsubscribe header in emails - Fix IssuesController#show degradation including project on loaded notes - Fix an issue with the "Commits" section of the cycle analytics summary. !6513 - Fix errors importing project feature and milestone models using GitLab project import - Make JWT messages Docker-compatible - Fix duplicate branch entry in the merge request version compare dropdown - Respect the fork_project permission when forking projects - Only update issuable labels if they have been changed - Fix bug where 'Search results' repeated many times when a search in the emoji search form is cleared (Xavier Bick) (@zeiv) - Fix resolve discussion buttons endpoint path - Refactor remnants of CoffeeScript destructured opts and super !6261 ## 8.12.1 - Fix a memory leak in HTML::Pipeline::SanitizationFilter::WHITELIST - Fix issue with search filter labels not displaying ## 8.12.0 (2016-09-22) - Removes inconsistency regarding tagging immediatelly as merged once you create a new branch. !6408 - Update the rouge gem to 2.0.6, which adds highlighting support for JSX, Prometheus, and others. !6251 - Only check :can_resolve permission if the note is resolvable - Bump fog-aws to v0.11.0 to support ap-south-1 region - Add ability to fork to a specific namespace using API. (ritave) - Allow to set request_access_enabled for groups and projects - Cleanup misalignments in Issue list view !6206 - Only create a protected branch upon a push to a new branch if a rule for that branch doesn't exist - Add Pipelines for Commit - Prune events older than 12 months. (ritave) - Prepend blank line to `Closes` message on merge request linked to issue (lukehowell) - Fix issues/merge-request templates dropdown for forked projects - Filter tags by name !6121 - Update gitlab shell secret file also when it is empty. !3774 (glensc) - Give project selection dropdowns responsive width, make non-wrapping. - Fix note form hint showing slash commands supported for commits. - Make push events have equal vertical spacing. - API: Ensure invitees are not returned in Members API. - Preserve applied filters on issues search. - Add two-factor recovery endpoint to internal API !5510 - Pass the "Remember me" value to the U2F authentication form - Display stages in valid order in stages dropdown on build page - Only update projects.last_activity_at once per hour when creating a new event - Cycle analytics (first iteration) !5986 - Remove vendor prefixes for linear-gradient CSS (ClemMakesApps) - Move pushes_since_gc from the database to Redis - Limit number of shown environments on Merge Request: show only environments for target_branch, source_branch and tags - Add font color contrast to external label in admin area (ClemMakesApps) - Fix find file navigation links (ClemMakesApps) - Change logo animation to CSS (ClemMakesApps) - Instructions for enabling Git packfile bitmaps !6104 - Use Search::GlobalService.new in the `GET /projects/search/:query` endpoint - Fix long comments in diffs messing with table width - Add spec covering 'Gitlab::Git::committer_hash' !6433 (dandunckelman) - Fix pagination on user snippets page - Honor "fixed layout" preference in more places !6422 - Run CI builds with the permissions of users !5735 - Fix sorting of issues in API - Fix download artifacts button links !6407 - Sort project variables by key. !6275 (Diego Souza) - Ensure specs on sorting of issues in API are deterministic on MySQL - Added ability to use predefined CI variables for environment name - Added ability to specify URL in environment configuration in gitlab-ci.yml - Escape search term before passing it to Regexp.new !6241 (winniehell) - Fix pinned sidebar behavior in smaller viewports !6169 - Fix file permissions change when updating a file on the Gitlab UI !5979 - Added horizontal padding on build page sidebar on code coverage block. !6196 (Vitaly Baev) - Change merge_error column from string to text type - Reduce contributions calendar data payload (ClemMakesApps) - Show all pipelines for merge requests even from discarded commits !6414 - Replace contributions calendar timezone payload with dates (ClemMakesApps) - Changed MR widget build status to pipeline status !6335 - Add `web_url` field to issue, merge request, and snippet API objects (Ben Boeckel) - Enable pipeline events by default !6278 - Add pipeline email service !6019 - Move parsing of sidekiq ps into helper !6245 (pascalbetz) - Added go to issue boards keyboard shortcut - Expose `sha` and `merge_commit_sha` in merge request API (Ben Boeckel) - Emoji can be awarded on Snippets !4456 - Set path for all JavaScript cookies to honor GitLab's subdirectory setting !5627 (Mike Greiling) - Fix blame table layout width - Spec testing if issue authors can read issues on private projects - Fix bug where pagination is still displayed despite all todos marked as done (ClemMakesApps) - Request only the LDAP attributes we need !6187 - Center build stage columns in pipeline overview (ClemMakesApps) - Fix bug with tooltip not hiding on discussion toggle button - Rename behaviour to behavior in bug issue template for consistency (ClemMakesApps) - Fix bug stopping issue description being scrollable after selecting issue template - Remove suggested colors hover underline (ClemMakesApps) - Fix jump to discussion button being displayed on commit notes - Shorten task status phrase (ClemMakesApps) - Fix project visibility level fields on settings - Add hover color to emoji icon (ClemMakesApps) - Increase ci_builds artifacts_size column to 8-byte integer to allow larger files - Add textarea autoresize after comment (ClemMakesApps) - Do not write SSH public key 'comments' to authorized_keys !6381 - Add due date to issue todos - Refresh todos count cache when an Issue/MR is deleted - Fix branches page dropdown sort alignment (ClemMakesApps) - Hides merge request button on branches page is user doesn't have permissions - Add white background for no readme container (ClemMakesApps) - API: Expose issue confidentiality flag. (Robert Schilling) - Fix markdown anchor icon interaction (ClemMakesApps) - Test migration paths from 8.5 until current release !4874 - Replace animateEmoji timeout with eventListener (ClemMakesApps) - Show badges in Milestone tabs. !5946 (Dan Rowden) - Optimistic locking for Issues and Merge Requests (title and description overriding prevention) - Require confirmation when not logged in for unsubscribe links !6223 (Maximiliano Perez Coto) - Add `wiki_page_events` to project hook APIs (Ben Boeckel) - Remove Gitorious import - Loads GFM autocomplete source only when required - Fix issue with slash commands not loading on new issue page - Fix inconsistent background color for filter input field (ClemMakesApps) - Remove prefixes from transition CSS property (ClemMakesApps) - Add Sentry logging to API calls - Add BroadcastMessage API - Merge request tabs are fixed when scrolling page - Use 'git update-ref' for safer web commits !6130 - Sort pipelines requested through the API - Automatically expand hidden discussions when accessed by a permalink !5585 (Mike Greiling) - Fix issue boards loading on large screens - Change pipeline duration to be jobs running time instead of simple wall time from start to end !6084 - Show queued time when showing a pipeline !6084 - Remove unused mixins (ClemMakesApps) - Fix issue board label filtering appending already filtered labels - Add search to all issue board lists - Scroll active tab into view on mobile - Fix groups sort dropdown alignment (ClemMakesApps) - Add horizontal scrolling to all sub-navs on mobile viewports (ClemMakesApps) - Use JavaScript tooltips for mentions !5301 (winniehell) - Add hover state to todos !5361 (winniehell) - Fix icon alignment of star and fork buttons !5451 (winniehell) - Fix alignment of icon buttons !5887 (winniehell) - Added Ubuntu 16.04 support for packager.io (JonTheNiceGuy) - Fix markdown help references (ClemMakesApps) - Add last commit time to repo view (ClemMakesApps) - Fix accessibility and visibility of project list dropdown button !6140 - Fix missing flash messages on service edit page (airatshigapov) - Added project-specific enable/disable setting for LFS !5997 - Added group-specific enable/disable setting for LFS !6164 - Add optional 'author' param when making commits. !5822 (dandunckelman) - Don't expose a user's token in the `/api/v3/user` API (!6047) - Remove redundant js-timeago-pending from user activity log (ClemMakesApps) - Ability to manage project issues, snippets, wiki, merge requests and builds access level - Remove inconsistent font weight for sidebar's labels (ClemMakesApps) - Align add button on repository view (ClemMakesApps) - Fix contributions calendar month label truncation (ClemMakesApps) - Import release note descriptions from GitHub (EspadaV8) - Added tests for diff notes - Add pipeline events to Slack integration !5525 - Add a button to download latest successful artifacts for branches and tags !5142 - Remove redundant pipeline tooltips (ClemMakesApps) - Expire commit info views after one day, instead of two weeks, to allow for user email updates - Add delimiter to project stars and forks count (ClemMakesApps) - Fix badge count alignment (ClemMakesApps) - Remove green outline from `New branch unavailable` button on issue page !5858 (winniehell) - Fix repo title alignment (ClemMakesApps) - Change update interval of contacted_at - Add LFS support to SSH !6043 - Fix branch title trailing space on hover (ClemMakesApps) - Don't include 'Created By' tag line when importing from GitHub if there is a linked GitLab account (EspadaV8) - Award emoji tooltips containing more than 10 usernames are now truncated !4780 (jlogandavison) - Fix duplicate "me" in award emoji tooltip !5218 (jlogandavison) - Order award emoji tooltips in order they were added (EspadaV8) - Fix spacing and vertical alignment on build status icon on commits page (ClemMakesApps) - Update merge_requests.md with a simpler way to check out a merge request. !5944 - Fix button missing type (ClemMakesApps) - Gitlab::Checks is now instrumented - Move to project dropdown with infinite scroll for better performance - Fix leaking of submit buttons outside the width of a main container !18731 (originally by @pavelloz) - Load branches asynchronously in Cherry Pick and Revert dialogs. - Convert datetime coffeescript spec to ES6 (ClemMakesApps) - Add merge request versions !5467 - Change using size to use count and caching it for number of group members. !5935 - Replace play icon font with svg (ClemMakesApps) - Added 'only_allow_merge_if_build_succeeds' project setting in the API. !5930 (Duck) - Reduce number of database queries on builds tab - Wrap text in commit message containers - Capitalize mentioned issue timeline notes (ClemMakesApps) - Fix inconsistent checkbox alignment (ClemMakesApps) - Use the default branch for displaying the project icon instead of master !5792 (Hannes Rosenögger) - Adds response mime type to transaction metric action when it's not HTML - Fix hover leading space bug in pipeline graph !5980 - Avoid conflict with admin labels when importing GitHub labels - User can edit closed MR with deleted fork (Katarzyna Kobierska Ula Budziszewska) !5496 - Fix repository page ui issues - Avoid protected branches checks when verifying access without branch name - Add information about user and manual build start to runner as variables !6201 (Sergey Gnuskov) - Fixed invisible scroll controls on build page on iPhone - Fix error on raw build trace download for old builds stored in database !4822 - Refactor the triggers page and documentation !6217 - Show values of CI trigger variables only when clicked (Katarzyna Kobierska Ula Budziszewska) - Use default clone protocol on "check out, review, and merge locally" help page URL - Let the user choose a namespace and name on GitHub imports - API for Ci Lint !5953 (Katarzyna Kobierska Urszula Budziszewska) - Allow bulk update merge requests from merge requests index page - Ensure validation messages are shown within the milestone form - Add notification_settings API calls !5632 (mahcsig) - Remove duplication between project builds and admin builds view !5680 (Katarzyna Kobierska Ula Budziszewska) - Fix URLs with anchors in wiki !6300 (houqp) - Deleting source project with existing fork link will close all related merge requests !6177 (Katarzyna Kobierska Ula Budziszeska) - Return 204 instead of 404 for /ci/api/v1/builds/register.json if no builds are scheduled for a runner !6225 - Fix Gitlab::Popen.popen thread-safety issue - Add specs to removing project (Katarzyna Kobierska Ula Budziszewska) - Clean environment variables when running git hooks - Fix Import/Export issues importing protected branches and some specific models - Fix non-master branch readme display in tree view - Add UX improvements for merge request version diffs ## 8.11.11 (2016-11-07) - Fix XSS issue in Markdown autolinker ## 8.11.10 (2016-11-02) - Removes any symlinks before importing a project export file. CVE-2016-9086 ## 8.11.9 - Don't send Private-Token (API authentication) headers to Sentry - Share projects via the API only with groups the authenticated user can access ## 8.11.8 - Respect the fork_project permission when forking projects - Set a restrictive CORS policy on the API for credentialed requests - API: disable rails session auth for non-GET/HEAD requests - Escape HTML nodes in builds commands in CI linter ## 8.11.7 - Avoid conflict with admin labels when importing GitHub labels. !6158 - Restores `fieldName` to allow only string values in `gl_dropdown.js`. !6234 - Allow the Rails cookie to be used for API authentication. - Login/Register UX upgrade !6328 ## 8.11.6 - Fix unnecessary horizontal scroll area in pipeline visualizations. !6005 - Make merge conflict file size limit 200 KB, to match the docs. !6052 - Fix an error where we were unable to create a CommitStatus for running state. !6107 - Optimize discussion notes resolving and unresolving. !6141 - Fix GitLab import button. !6167 - Restore SSH Key title auto-population behavior. !6186 - Fix DB schema to match latest migration. !6256 - Exclude some pending or inactivated rows in Member scopes. ## 8.11.5 - Optimize branch lookups and force a repository reload for Repository#find_branch. !6087 - Fix member expiration date picker after update. !6184 - Fix suggested colors options for new labels in the admin area. !6138 - Optimize discussion notes resolving and unresolving - Fix GitLab import button - Fix confidential issues being exposed as public using gitlab.com export - Remove gitorious from import_sources. !6180 - Scope webhooks/services that will run for confidential issues - Remove gitorious from import_sources - Fix confidential issues being exposed as public using gitlab.com export - Use oj gem for faster JSON processing ## 8.11.4 - Fix resolving conflicts on forks. !6082 - Fix diff commenting on merge requests created prior to 8.10. !6029 - Fix pipelines tab layout regression. !5952 - Fix "Wiki" link not appearing in navigation for projects with external wiki. !6057 - Do not enforce using hash with hidden key in CI configuration. !6079 - Fix hover leading space bug in pipeline graph !5980 - Fix sorting issues by "last updated" doesn't work after import from GitHub - GitHub importer use default project visibility for non-private projects - Creating an issue through our API now emails label subscribers !5720 - Block concurrent updates for Pipeline - Don't create groups for unallowed users when importing projects - Fix issue boards leak private label names and descriptions - Fix broken gitlab:backup:restore because of bad permissions on repo storage !6098 (Dirk Hörner) - Remove gitorious. !5866 - Allow compare merge request versions ## 8.11.3 - Allow system info page to handle case where info is unavailable - Label list shows all issues (opened or closed) with that label - Don't show resolve conflicts link before MR status is updated - Fix IE11 fork button bug !5982 - Don't prevent viewing the MR when git refs for conflicts can't be found on disk - Fix external issue tracker "Issues" link leading to 404s - Don't try to show merge conflict resolution info if a merge conflict contains non-UTF-8 characters
https://gitlab.com/gitlab-org/gitlab-foss/-/blame/8a7c822dccfb612c8ae3cb646467c3deac648af8/CHANGELOG.md
CC-MAIN-2020-24
refinedweb
13,834
60.01
Subject: Re: [boost] [bind] Placeholders suggestion, std and boost From: Glen Fernandes (glen.fernandes_at_[hidden]) Date: 2015-05-24 22:03:36 On Sun, May 24, 2015 at 6:21 PM, Edward Diener <eldiener_at_[hidden]> wrote: > I realize that changing boost::bind so by default that placeholders of the > form _n needing some sort of namespace in front of it will break plenty of > code, so I am not suggesting doing that. What I would like to suggest is a > Boost.bind macro, which when used before including <boost/bind>, would put > the boost::bind placeholders of the form _n in a boost::placeholders > namespace. > I propose creating <boost/bind/bind.hpp>. Including it should result in the placeholders being in boost::placeholders namespace. <boost/bind.hpp> would now do nothing more than just include <boost/bind/bind.hpp> and bring all the placeholders into the global namespace. ... e.g. Contents of <boost/bind.hpp> #ifndef BOOST_BIND_HPP #define BOOST_BIND_HPP #include <boost/bind/bind.hpp> using boost::placeholders::_1; using boost::placeholders::_2; using boost::placeholders::_3; #endif ... Documentation can be updated to remove all mention of <boost/bind.hpp> in favor of <boost/bind/bind.hpp> and now state that placeholders are within boost::placeholders. (Existing code that includes <boost/bind.hpp> would not be affected). Glen Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk
https://lists.boost.org/Archives/boost/2015/05/222623.php
CC-MAIN-2020-45
refinedweb
239
53.27
I’m doing a little cleaning in the icanhaz code repository. One of the things I’m throwing out is the code to connect different machines to the Skype API (below): import os import Skype4Py if os.name == "nt": print("Windows") #32 bit and 64 bit windows behave differently with Skype if 'PROGRAMFILES(X85)' in os.environ: sconn = Skype4Py.Skype() #64-bit else: sconn = Skype4Py.Skype() #32-bit elif os.name == "os2": print("Mac") sconn = Skype4Py.Skype() else: print("Linux machine or similar") sconn = Skype4Py.Skype(Transport='x11') #Now go do the usual Skype API things. I’m leaving the code here because - I sometimes need to write code that works differently on different machine types (here’s a more detailed discussion about that), and - One day Skype might recant their somewhat strange decision to shut down their API to more than a handful of developers. What Skype’s API decision means in practice is that anyone wanting to search a Skypechat for an interesting set of words, or scrape urls out of it, or even know who made which comments when, has to now do that with cut-and-paste and hoping that people don’t change their nicknames halfway through a chat, instead of automating those processes. Which when you’re halfway through a sudden onset disaster can be a bit of a pain.
http://overcognition.com/2014/11/29/rip-skype-api/
CC-MAIN-2021-10
refinedweb
226
71.34
Quake 3 BSP-to-AAS compiler bnoordhuis/amazing-graceful-fs 4 Like graceful-fs, but without eval() hacks and polyfills. bnoordhuis/chicken-core 4 Apache Axis2/C is a Web services engine implemented in the C programming language. bnoordhuis/bnoordhuis.github.com 3 GitHub Pages block China and other South Asian countries at the firewall level just another quake 3 mod c-ares is a C library that performs DNS requests and name resolves asynchronously. pull request commentlibuv/libuv win: consider a broken pipe a normal EOF @mmomtchev the test runner is sensitive to the working directory. Make sure to run the test from the main folder - call build/uv_run_tests_a, not uv_run_tests_a. CI-in-node: CI: comment created time in 7 minutes PR opened denoland/rusty_v8 Exposes v8::Isolate::SetOOMErrorHandler. pr created time in an hour issue openedlibuv/libuv Sporadic `SIGILL` on M1/arm64 Apple Macs Just wanted to bring this into attention, hopefully it's the right place to post. I've been using an M1 Mac Mini with 8GB of ram (this is important). While testing out the new (beta) VSCode arm64 build, I've been running into frequent crashes with a SIGILL exit code. Besides VSCode I've seen SIGILL in some other CLI apps as well, for example while running some python scripts. I recently came across this issue report that was originally discovered in Go: This occurs whenever the copyout call in sendsig fails. The copyout call is responsible for writing the user-space signal handler’s stack frame. It should not be possible for copyout to fail in a well-behaved program where the stack frame is to be written to memory that is validly mapped in the target process. However, on arm64, if the copyout triggers a page fault, the copyout fails. The absent page should be paged in and used. In the wild, the bug occurs most readily on a system under heavy load (particularly, memory pressure). I have attached some crash dumps from VSCode here: The stack trace for the SIGILL crashes mention libuv: 52 Electron Framework!node::LibuvStreamWrap::OnUvRead(long, uv_buf_t const*) [stream_base-inl.h : 126 + 0x10] sp = 0x000000016b956790 pc = 0x0000000106e80710 Found by: stack scanning 53 Electron Framework!node::LibuvStreamWrap::ReadStart()::$_1::__invoke(uv_handle_s*, unsigned long, uv_buf_t*) [stream_wrap.cc : 218 + 0x4] sp = 0x000000016b9567c0 pc = 0x0000000106e80ed0 Found by: stack scanning 54 Electron Framework!uv__stream_io [stream.c : 1239 + 0xc] sp = 0x000000016b956810 pc = 0x00000001046d6f80 Found by: stack scanning In the issue linked above, we thought this might be fixed by but I now believe this is a separate problem. Note that the Golang guys were able to find a workaround, see: Also important is that nodejs crashes with EFAULT or EPIPE quite frequently by itself on the M1, as reported in: - Version: (not sure, latest from nodejs 15.5.1 and from Electron) - Platform: Darwin Andreis-Mac-mini.local 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:40:21 PST 2020; root:xnu-7195.60.75~1/RELEASE_ARM64_T8101 arm64 created time in 3 hours issue openedlibuv/help how to generate x86 specific sln using cmake I have generate x64 sln for successfully using "cmake .." in windows 10. but is there any defines to generate x86 specific sln ? thanks! created time in 6 hours issue commentlibuv/libuv get_ibmi_physical_address can't handle when Qp2getifaddrs returns names longer than 10 characters This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. comment created time in 7 hours pull request commentlibuv/libuv This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. comment created time in 7 hours pull request commentlibuv/libuv win: consider a broken pipe a normal EOF @bzoz I removed a workaround for this special case on Win32 from another test There are quite lots of tests that do not pass when run manually - but do when run through ctest - I don't know if this is a problem on my end? comment created time in 7 hours startedbnoordhuis/node-heapdump started time in 11 hours issue openedlibuv/libuv how to generate x86 specific sln using cmake I have generate x64 sln for successfully using "cmake .." in windows 10. but is there any defines to generate x86 specific sln ? thanks! created time in 12 hours pull request commentcisco/ChezScheme If a wide-screen user wants a narrower text they can make their web browser window narrower. With this change a user who wants text wider than 640 pixels (on my system, using the default font size) has no recourse aside from manually overriding the style sheet. comment created time in 19 hours PR opened cisco/ChezScheme According to Matthew Butterick in "Practical Typography" [1] the maximal line length should not be much higher than 90 characters. This commit changes style of csug style to set the maximal line length. This should only affect users with wide screens. [1] pr created time in 20 hours pull request commentlibuv/libuv win: consider a broken pipe a normal EOF @mmomtchev could you add a test for this? comment created time in a day pull request commentlibuv/libuv win,fsevent: optionally ignore change to last access time Generally, LGTM, but this needs a test. comment created time in a day startedbnoordhuis/node-heapdump started time in a day pull request commentlibuv/libuv Document that uv_read_stop always succeeds I will be honest I'm not a big fan of this "stale bot" comment created time in a day startedmikeal/IPSQL started time in 2 days startedu-u-h/swapforth started time in 2 days startedAlim-Oezdemir/RamenEngine started time in 2 days issue commentForthHub/discussion Minimal set of low level words to build forth "I still can't see for example how to build rot from your 7 words: nop, nand, !, @, um+, special, lit. can you define rot in those words." - One can build flip flops and address decoders from NANDs, SRAM and registers from flip flops and decoders, and stacks from SRAM and register (if not implemented as cascaded shift register). From there, it needs moving stack tops between two stacks and from/to a temporary holding register (to avoid, at this point, swap), and voila, there's your ROT :) comment created time in 2 days startedbnoordhuis/node-heapdump started time in 2 days issue commentdenoland/rusty_v8 mingw-32 windows build failed I used this tutorial - comment created time in 2 days issue commentdenoland/rusty_v8 mingw-32 windows build failed So an you pls tell me what to write in the config file for msvc and what commands do I use to compile my software for windows . comment created time in 2 days issue openeddenoland/rusty_v8 mingw-32 windows build failed Hi,My windows build failed while I ran the following commands: rustup target add x86_64-pc-windows-gnu cargo build --release --target x86_64-pc-windows-gnu I even created a .cargo folder and created a config file but I got an error. File to small to be an archive created time in 2 days startedbnoordhuis/node-heapdump started time in 2 days startedbnoordhuis/node-iconv started time in 3 days Pull request review commentlibuv/libuv darwin: Use posix_spawn to spawn subprocesses in macOS static void uv__process_child_init(const uv_process_options_t* options, #endif +#if defined(__APPLE__)+typedef struct uv__posix_spawn_fncs_tag {+ struct {+ int (*set_uid_np)(const posix_spawnattr_t *, uid_t);+ int (*set_gid_np)(const posix_spawnattr_t *, gid_t);+ int (*set_groups_np)(const posix_spawnattr_t*, int, gid_t*, uid_t);+ } spawnattr;++ struct {+ int (*addchdir_np)(const posix_spawn_file_actions_t *, const char *);+ } file_actions;+} uv__posix_spawn_fncs_t;+++static uv_once_t posix_spawn_init_fncs_once = UV_ONCE_INIT;+static uv__posix_spawn_fncs_t posix_spawn_fncs;+++void uv__spawn_init_posix_spawn_fncs(void) {+ /* Try to locate all non-portable functions at runtime */+ posix_spawn_fncs.spawnattr.set_uid_np = + dlsym(RTLD_DEFAULT, "posix_spawnattr_set_uid_np");+ posix_spawn_fncs.spawnattr.set_gid_np = + dlsym(RTLD_DEFAULT, "posix_spawnattr_set_gid_np");+ posix_spawn_fncs.spawnattr.set_groups_np = + dlsym(RTLD_DEFAULT, "posix_spawnattr_set_groups_np");+ posix_spawn_fncs.file_actions.addchdir_np = + dlsym(RTLD_DEFAULT, "posix_spawn_file_actions_addchdir_np");+}+++int uv__spawn_set_posix_spawn_attrs(posix_spawnattr_t* attrs,+ const uv__posix_spawn_fncs_t* posix_spawn_fncs,+ const uv_process_options_t* options) {+ int err;+ unsigned int flags;+ sigset_t signal_set;++ err = posix_spawnattr_init(attrs);+ if (err != 0) {+ /* If initialization fails, no need to de-init, just return */+ return err;+ }++ if (options->flags & UV_PROCESS_SETUID) {+ if (posix_spawn_fncs->spawnattr.set_uid_np == NULL) {+ err = ENOSYS;+ goto error;+ }++ err = posix_spawn_fncs->spawnattr.set_uid_np(attrs, options->uid);+ if (err != 0)+ goto error;+ }++ if (options->flags & UV_PROCESS_SETGID) {+ if (posix_spawn_fncs->spawnattr.set_gid_np == NULL) {+ err = ENOSYS;+ goto error;+ }++ err = posix_spawn_fncs->spawnattr.set_gid_np(attrs, options->gid);+ if (err != 0) + goto error;+ }++ if (options->flags & (UV_PROCESS_SETUID | UV_PROCESS_SETGID)) {+ /* Using ngroups = 0 implied the group_array is empty, and so + * its contents are never traversed. Still the + * posix_spawn_set_groups_np function seems to require that the + * group_array pointer be non-null */+ const int ngroups = 0;+ gid_t group_array = KAUTH_GID_NONE;++ if (posix_spawn_fncs->spawnattr.set_groups_np == NULL) {+ err = ENOSYS;+ goto error;+ }+ + /* See the comment on the call to setgroups in uv__process_child_init above+ * for why this is not a fatal error */+ SAVE_ERRNO(posix_spawn_fncs->spawnattr.set_groups_np(+ attrs, + ngroups, + &group_array, + KAUTH_UID_NONE));+ }++ /* Set flags for spawn behavior + * 1) POSIX_SPAWN_CLOEXEC_DEFAULT: (Apple Extension) All descriptors in+ * the parent will be treated as if they had been created with O_CLOEXEC.+ * The only fds that will be passed on to the child are those manipulated+ * by the file actions+ * 2) POSIX_SPAWN_SETSIGDEF: Signals mentioned in spawn-sigdefault in+ * the spawn attributes will be reset to behave as their default+ * 3) POSIX_SPAWN_SETSIGMASK: Signal mask will be set to the value of+ * spawn-sigmask in attributes+ * 4) POSIX_SPAWN_SETSID: Make the process a new session leader if a+ * detached session was requested. */+ flags = POSIX_SPAWN_CLOEXEC_DEFAULT |+ POSIX_SPAWN_SETSIGDEF |+ POSIX_SPAWN_SETSIGMASK;+ if (options->flags & UV_PROCESS_DETACHED) + flags |= POSIX_SPAWN_SETSID; You can check that with sysctlbyname("kern.osrelease", str, &size, NULL, 0); >= 19.0.0 comment created time in 3 days startednushell/vscode-nushell-lang started time in 3 days pull request commentlibuv/libuv zos: build in ASCII code page and introduce zoslib The release is currently waiting on (cc: @vtjnash). After that lands, I'll also need to run the CI and Node.js integration CI before cutting the release. comment created time in 3 days pull request commentlibuv/libuv zos: build in ASCII code page and introduce zoslib CI: Resume-CI: CI looks good (one instance of and the libuv-test-commit-zos-cmake job is expected to fail with this PR until it is updated as per). We'll need to coordinate landing this PR and updating to avoid broken builds. @cjihrig what's the current outlook on? I'd like not to break the CI while a release is in progress. FWIW I don't think this PR needs to make 1.41.0 (but equally no objections if it does). comment created time in 3 days
https://www.gitmemory.com/bnoordhuis
CC-MAIN-2021-04
refinedweb
1,758
51.78
Hi, I am trying to concatenate dataset in a such a way that which will also able to return path. Hi, I am trying to concatenate dataset in a such a way that which will also able to return path. Hi, I write a simple demo for you, just use tensor_data, you can have a modification on it to meet your needs. class custom_dataset1(torch.utils.data.Dataset): def __init__(self): super(custom_dataset1, self).__init__() self.tensor_data = torch.tensor([1., 2., 3., 4., 5.]) def __getitem__(self, index): return self.tensor_data[index], index def __len__(self): return len(self.tensor_data) class custom_dataset2(torch.utils.data.Dataset): def __init__(self): super(custom_dataset2, self).__init__() self.tensor_data = torch.tensor([6., 7., 8., 9., 10.]) def __getitem__(self, index): return self.tensor_data[index], index def __len__(self): return len(self.tensor_data) dataset1 = custom_dataset1() dataset2 = custom_dataset2() concate_dataset = torch.utils.data.ConcatDataset([dataset1, dataset2]) value ,index = next(iter(concate_dataset)) print(value, index) you can change index in to path, then using corresponding loss function. If we want to combine two imbalanced datasets and get balanced samples, I think we could use ConcatDataset and pass a WeightedRandomSampler to the DataLoader dataset1 = custom_dataset1() dataset2 = custom_dataset2() concat_dataset = torch.utils.data.ConcatDataset([dataset1, dataset2]) dataloader = torch.utils.data.DataLoader(concat_dataset, batch_size= bs, weighted_sampler) I am looking for an answer for this do you have any idea about it? and thank you for your help. Thanks a lot. Really helped me with training my CycleGAN network. Maybe we can solve this by: class ConcatDataset(torch.utils.data.Dataset): def __init__(self, *datasets): self.datasets = datasets def __getitem__(self, i): return tuple(d[i %len(d)] for d in self.datasets) def __len__(self): return max(len(d) for d in self.datasets) train_loader = torch.utils.data.DataLoader( ConcatDataset( datasets.ImageFolder(traindir_A), datasets.ImageFolder(traindir_B) ), batch_size=args.batch_size, shuffle=True, num_workers=args.workers, pin_memory=True) for i, (input, target) in enumerate(train_loader): ... Question #1: When I try this, it loops through the shorter dataset in the group. So if dataset A is 100 and dataset B is 1000 images and if I call ConcatDataset(dataset_A, dataset_B)[100], I’ll get a tuple with the contents filled by (dataset_A[0], dataset_B[100]). Does this make sense when putting this into a loader for training? Won’t I overfit on the smaller dataset? Question #2: Now we don’t just have (input, target), we have ((input_1, target_1), (input_2, target_2)). How do I train when the loader gives me a list of lists like this? Do I select randomly from the first list for my input? Or is this where weighted sampling comes in? I also have the same question.Please let me know what is the best way to solve this problem. I dont think we can use weighted random sampling here if yes please let me know how can i do it? Hello I’m facing a similar problem and none of the solutions above are fitting. I’m running semi-supervised experiments and I’d like each batch to contain say n observations from the labelled data set set and say m observations from the unlabelled data set. Of course each of these go through different objective functions but are added together before making and optimization set. Thus I would really need to have loader formatted to sample from 2 two different data set at a time. Anyone know a ingenious to do so ? class BalancedConcatDataset(torch.utils.data.Dataset): def __init__(self, *datasets): self.datasets = datasets self.max_len = max(len(d) for d in self.datasets) self.min_len = min(len(d) for d in self.datasets) def __getitem__(self, i): return tuple(d[i % len(d)] for d in self.datasets) def masks_collate(self, batch): # Only image - mask images, masks = [], [] for item in range(len(batch)): for c_dataset in range(len(batch[item])): images.append(batch[item][c_dataset][0]) masks.append(batch[item][c_dataset][1]) images = torch.stack(images) masks = torch.stack(masks) return images, masks def __len__(self): return self.max_len It would be masks or labels Hi @apaszke when i use this function it transforms my dataset which is combined of tensors to lists is there a solution for this ?? Any luck on a solution @MarkovChain? Currently I pass multiple datasets to CycleConcatDataset and then define a dataloader on it with a single batch size. This essentially will batch all the datasets and will cycle through the shorter ones until the longest dataset finishes. In my use case (semi supervised and domain adaptation) I would like to keep the parameter updates as balanced as possible. This cycling method is a bit unfair as the shorter datasets update the parameters more. I think one way to help my particular use case is to somehow use different batch sizes for each dataset. class CycleConcatDataset(data.Dataset): '''Dataset wrapping multiple train datasets Parameters ---------- *datasets : sequence of torch.utils.data.Dataset Datasets to be concatenated and cycled ''' def __init__(self, *datasets): self.datasets = datasets def __getitem__(self, i): result = [] for dataset in self.datasets: cycled_i = i % len(dataset) result.append(dataset[cycled_i]) return tuple(result) def __len__(self): return max(len(d) for d in self.datasets) If you are looking for using multiple dataloaders at the same time this should work class cat_dataloaders(): """Class to concatenate multiple dataloaders""" def __init__(self, dataloaders): self.dataloaders = dataloaders len(self.dataloaders) def __iter__(self): self.loader_iter = [] for data_loader in self.dataloaders: self.loader_iter.append(iter(data_loader)) return self def __next__(self): out = [] for data_iter in self.loader_iter: out.append(next(data_iter)) # may raise StopIteration return tuple(out) Here is a quick example class DEBUG_dataset(Dataset): def __init__(self,alpha): self.d = (torch.arange(20) + 1) * alpha def __len__(self): return self.d.shape[0] def __getitem__(self, index): return self.d[index] train_dl1 = DataLoader(DEBUG_dataset(10), batch_size = 4,num_workers = 0 , shuffle=True) train_dl2 = DataLoader(DEBUG_dataset(1), batch_size = 4,num_workers = 0 , shuffle=True) tmp = cat_dataloaders([train_dl1,train_dl2]) for x in tmp: print(x) output is (tensor([140, 160, 130, 90]), tensor([ 5, 10, 8, 9])) (tensor([120, 30, 170, 70]), tensor([15, 17, 18, 7])) (tensor([180, 50, 190, 80]), tensor([ 6, 14, 3, 2])) (tensor([ 10, 40, 150, 100]), tensor([11, 13, 4, 1])) (tensor([ 60, 200, 110, 20]), tensor([19, 12, 20, 16])) Bro, thanks for saving my time lol. import numpy as np def cycle(iterable): while True: for x in iterable: yield x class MultiTaskDataloader(object): def __init__(self, tau=1.0, **dataloaders): self.dataloaders = dataloaders Z = sum(pow(v, tau) for v in self.dataloader_sizes.values()) self.tasknames, self.sampling_weights = zip(*((k, pow(v, tau) / Z) for k, v in self.dataloader_sizes.items())) self.dataiters = {k: cycle(v) for k, v in dataloaders.items()} @property def dataloader_sizes(self): if not hasattr(self, '_dataloader_sizes'): self._dataloader_sizes = {k: len(v) for k, v in self.dataloaders.items()} return self._dataloader_sizes def __len__(self): return sum(v for k, v in self.dataloader_sizes.items()) def __iter__(self): for i in range(len(self)): taskname = np.random.choice(self.tasknames, p=self.sampling_weights) dataiter = self.dataiters[taskname] batch = next(dataiter) batch['task'] = taskname yield batch Hi, could you provide me with how one can define distributed Sampler for the MultiTaskDataloader that @AlongWY wrote? This is basically for training a model across multiple TPU cores, where data needs to be distributed over multiple cores. thanks a lot in advance. Hi there, could you provide an example, in case this was not iterable dataset, but was mapping based on, how would the sampling be done? thanks HI I found a much easier solution and wanted to share here dataset_3 = torch.utils.data.ConcatDataset((dataset_1,dataset_2)) each of the dataset are of type torch.utils.data.dataset.Dataset this command helped me to concatenate both the dataset and later prepare a data loader from it. len(dataset_1)=200 len(dataset_2)=300 len(dataset_3)=500 Thank you, it really helps.
https://discuss.pytorch.org/t/train-simultaneously-on-two-datasets/649?page=2
CC-MAIN-2022-05
refinedweb
1,322
59.5
I previously wrote this article in my blog, Think Big!. Attached with the article: The following is a list of some of the major e-mail service providers who provide SMTP services for their clients: The following is a simple code segment uses classes from System.Net.Mail namespace to send mail messages via GMX's SMTP server. Visit GMX; one of the leader internet mail service providers. Visit GMX; one of the leader internet mail service providers. Do not forget to add a using statement (Imports in VB.NET) for the System.Net.Mail namespace.("C:\\Site.lnk")); // Connecting to the server and configuring it SmtpClient client =("D:\Site.lnk")) ' Connecting to the server and configuring it Dim client As" // C# Code client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; client.PickupDirectoryLocation = "C:\\mails"; ' VB.NET Code client.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory client.PickupDirectoryLocation = "C:\mails" Attached with the article, Geming Mail+, an application that is used to send mails via extendable variety of SMTP servers. This application created using .NET 2.0 and Visual Studio 2008. The following are snapshots of the application: Summary This lesson was a great introduction to e-mail programming in .NET Framework. You learned how to send mails via a SMTP server. Soon we will cover how to receive mails in .NET Framework. Have a nice day... Retrieve all images from a folder and display them using a DataList control Looking inside Global.asax application file in ASP.NET 3.5 Just set the SmtpClient.DeliveryMethod property to Network and it should work fine. Tried to send with Vista Home premium, just seems some problem : 'specify the pickup directory' where and how to specify kindly reply , thanks a lot Heinz aheneghana@anet.net.th
http://www.c-sharpcorner.com/uploadfile/GemingLeader/sending-mails-in-net-framework/
CC-MAIN-2013-20
refinedweb
286
51.75
Ruthless self-denial is the non sun qua of creativity’-We never ever thought that we would be proud to calculate the statistics of ‘rat race’ as to us, transforming the education was our only most objective. they least bother regarding number game, but really very serious regarding a game programming assigned by a student ,as objective is very simple ,the support system to the student must be accurate, the student should not suffer in any point. That is why in our third year of ‘Reliable Tutor’,I can still able to recall that faint voice of ‘John’, he called us shivering ‘Pristley tomorrow is my last date of submitting assignment, but concerned online tutor has refused to submit me the assignment, can you help?’ It was really, really tough at that moment ,but our tutor, Shouvonik, spending his entire night finished that assignment and rescued the student from a ‘critical fall’; we are happy with this as we have justified our profession, and that is only our job. they are very pleased when our first student who approached to us when he newly joined to the under graduate program, and in his third year he has assigned to us his major project spelling to us ‘I am completely tension free as I have given the responsibility to you’. Expertise Any kind of assignment helps for University students to PHD students with our best qualified tutors. We are expert in the field of complete portfolio of assignment help as well as online tutoring. Our quality team is monitoring 24*7 with our tutors to give the best satisfaction to student. We take care each and every student till he completely satisfy with provided solution. Services Computer Science Assignment Help Matlab Assignment Help Physics Assignment Help Biology Assignment Help English Assignment Help Economics Assignment Help Academic Assignment Help HR Assignment Help Programming Assignment Help Engineering Assignment Help Project Assistance Business Writing Management Writing Thesis Writing Exam Preparation Online Tutoring Workshop / Intern Ship Industrial Training Assignment help You are frustrated with your assignment . Do not have time to do by own . Facing problems in preparing Thesis or Dissertation ?? No need to worry about that. Reliabletutors.com is the perfect place to help you. They offer 24/7 online support to their customer to give the best satisfaction. Their skillful experts are there to help us till we are not satisfied. they have qualified experts in maximum subjects having minimum Master degree in respective fields. They are well trained in online tutoring filed and know how to satisfy our students. they are having experts in Academic, Management, Programming, Engineering, Business studies and other subjects too. We are an ongoing assignment help provider in India having world class resources which make learning both fun and easy. Assignment help areas: Academic Subjects: Engineering Subjects: Programming Help: Business Studies: Business studies References Academic knwlege Dissertation mentoring provided by us guarantee that your dissertation is exclusive and never being suffered by plagiarism. ready to be submitted. proper design and format and the given guideline point by point giving the birth of an ideal dissertation. output is a justified high marks gaining smart creature. world famous scientists also at a corner of student age gain assistance from their teacher. they offer a unique. every thesis writing goes through a life cycle and we guide our students in each stage of it. self-sufficient package to the students which starts parallel movement with the students from the nascent stage (topic selection). even . whether it is selection of topic or whether it is assigning the respective potential mentor drafting the proposal. mentor assigning till the project gets . we take your tension on us leaving you hackle free. it is always difficult to construct a dissertation. rest gets our nourishing. How Reliable Tutors handle your dissertations? We absolutely take care at the time of writing dissertations. actual style. Nothing wrong in it. all have gained high marks and satisfied the need of the students in India and abroad. Our personalized solving methods make student capable gain in-depth knowledge of subjects Thesis help For a student. Your job is to send the topic and instruction set. A story of Success their teachers and drafter till time have completed around 300 dissertations for the students. We offer the best solution in online assignment help to our students across the globe. .Type of company After lot of research in the field of e-learning.There is no exception of it. we established the company Reliable Tutors with best qualified tutors to satisfy our students. As you know. the thesis. A student in his student age at any point of time at least once takes support from his/her teacher . as simply this matter is unavoidable particularly for designing thesis that is why ‘mentor’ this terminology originated. Engineering students submit their project/ thesis in the final year of their study.results. Thesis Writing Thesis is the passport of a Master’s student to enter into the world of their deserved profession. but in reality the nature and complexity of the task is very high. procedures and data collection). statistical analysis. When you are here. conclusion. measures. You can get this superb service very easily only by filling an online form.discussion.submitted for wining a high score. reviewing the literature. in a very short time will help you refocus and prepare significant progress on your PHD thesis. At Reliable Tutors. They have to represent various modules of their thesis in front of the examiner and this part is really delegate and sensitive as without the high score in the project/thesis they are not . Avail our dissertation help to seek professional writers working on your paper marking success. The steps involved in such tedious task include. Approval of the draft or document It seems very simple. problem statement. If you are confused about selecting dissertation topic then get help here on how to select topics and proceed right from the desk of our expertise. The process of thesis research involves this life cycle Proposal Drafting Approval Conducting the study process Writing the entire abstract and body. and it is tedious to accomplish each and every step with accuracy. you don’t have to be bothered as you would start making the ladder of trust and hope in us as soon as you approach us with your thesis writing problems. research question(s) and research hypothesis development. interpretation). identification of topic. Without it they are incomplete to their professional life. as it is a mandatory. data entry and screening. (data analysis preparation.recommendation. we understand this pain point and hence so much cautious . Engineering thesis We accept Engineering Dissertation and projects (major and minor both) as well. research design (Sampling.particular and specific towards the selection of the topic and following guideline hop by hop. innovative. services include: Dissertation editing services Thesis editing services SPSS / SAS help services Formatting. Hence. topic selection for an engineering student is a touchy issue. but in reality the native or foreign professional world to them asks specific topic. technical students can educate themselves with various resources during their research paper writing. Engineering Dissertation Services: Semiconductor Devices and Circuits.eligible for GRE or entry in profession. particular and well-informed about various engineering subjects. without plagiarism and fed with self-sufficient idea thesis. They can choose any technical topic for their project/thesis. At Reliable Tutors. Analog Electronic Circuits Analog Integrated Circuits Analog VLSI Design Electronic Circuits Physics and Modeling of Semiconductor Devices Television and Video Engineering Electrical and Electronics . We specifically focus on it and strongly prepare them for defending Viva voce increasing their level of confidence (‘confidential defense’). Post doctoral . talented. Our writers who handle engineering projects are highly qualified. Reliable Tutors has in-house internal committee which consists of PhD holders for writing and as research advisors. Proof reading and Translating Rephrasing [Free of plagiarism] Dissertation writers and tutors at Reliable Tutors Our tutors are very much particular to engineer complete. Our unique methods helped hundreds of scholars to complete and submit their thesis successfully. and have mentioned below step by step process how thing works: 1. 6. following the above mentioned process when payment is finished. Teachers mention the details of subject. find slot and schedule . from Reliable Tutor confirmation email goes to student mail box. teacher confirms the receiving of assignment/or share the lesson plan after Reliable Tutor getting an advance payment (usually 50% of the quote) in lieu of primary invoice. If all would tally. 4. 2. Create your own account. This payment part is committed either via Paypal or via credit card/online transaction 5. Students matches the quality issue and pricing part by chatting 3. After receiving an assignment. reliable Tutor sends the completed assignment by two way hand shaking method.D holding PhD with rich experience in research. or seeking the subject plan. Browse the topic by a search using a key word for example ‘Micro-programming ’. then generates secondary invoice for rest payment. Students Community How learning begins? 1. Students and Teachers meet online. and University of Birmingham. Specialization of/Work Culture in the training organization. 7. Student quotes the price and schedule in the next stage. The teacher and student once again chat at the day of schedule time ends either via Skype or Google Chat or by direct calling in accordance with both parties comfort-ability. 3. London School of Business. Send request message embedding the desire assignment as an attachment. 2. specialty and pricing for an assignment/subject in web. Some of our writers are trained at Harvard School. When Reliable Tutor confirms the completion of assignment.fellows and M. If you are stuck with your project or wanna make a project for your future use just talk to us or chat with our representative. In few cases like Real Time System there is no difference between implementation and maintenance as maintenance is complimentary to implementation. once fails system is crashed hence here the life cycle of the project called ‘Spiral Model’ . documentation. We are here to assist you in any project where programming tool is no matter whether it is C or Lua .This is more delegate and difficult to handle . cover letter.A self sufficient complete project is that which when being studied by any other software engineer apart from the project owner can understand. PROJECT ASSISTANCE Any technical project consists of two things a) Abstract b) Detailed documentation. We usually provide the orthodox support to our students following the rule of software engineering. and then the original project life cycle begins.4. Only thing we can assure you is SATISFACTION insuring the score High. Wait for token message of acceptance from Reliable Tutor. power point/flash presentation etc. complete portfolio of project management like source codes.Our think tank is efficient enough to take care any technology existing on the earth.Enjoy your lesson. Once abstract being approved. receive the confirmation of acknowledging the assignment or lesson plan. This the complete life period and called by the language of software engineering ‘water fall model’ . 5. As we believe certain code snippet or flip is not a project. . A project is defined as a complete project when it can give the birth of its successor that is why ‘life cycle’ this term is introduced in project. Reliable Tutor’s team is ready to help you to solve your final year project. reuse and generate a new project. Finish (only 5 steps). we will guide you with our expertise and knowledge. the result is undefined and difficult to predict. Multithreaded is the path of execution for a program to perform several tasks simultaneously within a program. a memory leak occurs. This can be partially remedied by the use of smart pointers. It is intended to let application developers "write once. Java is as of 2012 one of the most popular programming languages in use. Note that garbage collection does not prevent "logical" memory leaks.Technology Learnt Java is a programming language originally developed by James Gosling at Sun Microsystems (which has since merged into Oracle Corporation) and released in 1995 as a core component of Sun Microsystems' Java platform. In some languages. If the program does not deallocate an object. Java is a generalpurpose. Areas of Application World Wide Web Applets . operating system-specific procedures have to be called in order to work on multithreading.Java supports multithreaded. or explicitly allocated and deallocated from the heap. object-oriented language that is specifically designed to have as few implementation dependencies as possible. concurrent. as Java compilers are able to detect many error problem in program during the execution of respective program code. One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden of having to perform manual memory management. The language derives much of itssyntax from C and C++ but has a simpler object model and fewer low-level facilities. . Java emphasis on checking for possible errors. particularly for client-server web applications. and the program is likely to become unstable and/or crash. but these add overhead and complexity. with a reported 10 million users. If the program attempts to access or deallocate memory that has already been deallocated. The java come with the concept of Multithreaded Program.e. i.class-based. In the latter case the responsibility of managing memory resides with the programmer. In other languages. run anywhere" (WORA). those where the memory is still referenced but never used. memory for the creation of objects is implicitly allocated on the stack. meaning that code that runs on one platform does not need to be recompiled to run on another. Java applications are typically compiled to bytecode (class file) that can run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is fast. From laptops to datacenters. Java is object-oriented. game consoles to scientific supercomputers. and business applications. compiler. Java is platform-independent and flexible in nature. It is the underlying technology that powers state-of-the-art programs including utilities.Java is secure. easy to write. interpreter and runtime environment are securable . that is used to build modular programs and reusable code in other application. and on billions of devices worldwide. Java works on distributed environment. Java emphasis on checking for possible errors. as Java compilers are able to detect many error problem in program during the execution of respective program code. secure. cell phones to the Internet. Robust means reliability. and reliable. Why do I need Java? There are lots of applications and websites that won't work unless you have Java installed. operating system-specific procedures have to be called in order to work on multithreading. One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden .Java is robust.Java supports multithreaded. In other languages. The java come with the concept of Multithreaded Program. easy to design . games. Java is everywhere What is the advantages of java? Java is simple. The Java language. debug. Multithreaded is the path of execution for a program to perform several tasks simultaneously within a program. It is designed to work on distributed computing . Any network programs in Java is same as sending and receiving data to and from a file. and therefore easy to compile. including mobile and TV devices. Java runs on more than 850 million personal computers worldwide. and more are created every day. and learn than any other programming languages. The most significant feature of Java is to run a program easily from one computer system to another. Cross-Platform Application Development Other Network Applications What is Java technology and why do I need it? Java is a programming language and computing platform first released by Sun Microsystems in 1995. a memory leak occurs. and the Java runtime is responsible for recovering the memory once objects are no longer in use. It should be "architecture-neutral and portable" 4. It should execute with "high performance" 5. memory for the creation of objects is implicitly allocated on the stack. If methods for a nonexistent object are called. or .of having to perform manual memory management. memory for the creation of objects is implicitly allocated on the stack. threaded. If the program does not deallocate an object.e. It should be "interpreted. or explicitly allocated and deallocated from the heap. In some languages. It should be "simple. In the latter case the responsibility of managing memory resides with the programmer.[28][29] One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden of having to perform manual memory management. the unreachable memory becomes eligible to be freed automatically by the garbage collector. This can be partially remedied by the use of smart pointers. and dynamic" Java uses Automatic memory management Java uses an automatic garbage collector to manage memory in the object lifecycle. Principals There were five primary goals in the creation of the Java language: 1. Something similar to a memory leak may still occur if a programmer's code holds a reference to an object that is no longer needed. Note that garbage collection does not prevent "logical" memory leaks. It should be "robust and secure" 3. The programmer determines when objects are created. the result is undefined and difficult to predict. i. object-oriented and familiar" 2. and the program is likely to become unstable and/or crash. typically when objects that are no longer needed are stored in containers that are still in use. those where the memory is still referenced but never used. a "null pointer exception" is thrown. but these add overhead and complexity. In some languages. Once no references to an object remain. If the program attempts to access or deallocate memory that has already been deallocated. It is guaranteed to be triggered if there is insufficient free memory on the heap to allocate a new object. Interpreter. Explicit memory management is not possible in Java. and the java doc documentation tool. it will occur when a program is idle. but these add overhead and complexity. It provides basic objects and interface to networking and security. Graphical User Interface Toolkits: The Swing and Java 2D toolkits provide us the feature of Graphical User Interfaces (GUIs). and documenting your applications. those where the memory is still referenced but never used. as commonly true for objects (but seeEscape analysis). as of Java 5. and much more. It gives a wide collection of useful classes. autoboxing enables programmers to proceed as if primitive types were instances of their wrapper class. to XML generation and database access. If the program attempts to access or deallocate memory that has already been deallocated. Ideally. where object addresses and unsigned integers (usually long integers) can be used interchangeably. In the latter case the responsibility of managing memory resides with the programmer.e. If the program does not deallocate an object. Application Programming Interface (API): The API provides the core functionality of the Java programming language. JDK Tools: The JDK tools provide compiling. Garbage collection may happen at any time. . This allows the garbage collector to relocate referenced objects and ensures type safety and security. Values of primitive types are either stored directly in fields (for objects) or on the stack (for methods) rather than on the heap. Because of this. Java does not support C/C++ style pointer arithmetic. debugging. Note that garbage collection does not prevent "logical" memory leaks. which is further used in your own applications. Deployment Technologies: The JDK software provides two type of deployment technology such as the Java Web Start software and Java Plug-In software for deploying your applications to end users. the result is undefined and difficult to predict. a memory leak occurs. The main tools used are the Javac compiler the java launcher. monitoring. and the program is likely to become unstable and/or crash. Java was not considered to be a pure object-oriented programming language. This was a conscious decision by Java's designers for performance reasons. As in C++ and some other object-oriented languages. variables of Java's primitive data types are not objects. This can be partially remedied by the use of smart pointers. running. this can cause a program to stall momentarily.explicitly allocated and deallocated from the heap.0. However. i. JDBC API. Graphical User Interface Toolkits: The Swing and Java 2D toolkits provide us the feature of Graphical User Interfaces (GUIs).") API. monitoring. Java was built almost exclusively as an object-oriented language.Java contains multiple types of garbage collectors. Integrated Libraries: Integrated with various libraries such as the Java IDL API. debugging. with the exception of the primitive data types (integers. On full implementation of the Java platform gives you the following features: JDK Tools: The JDK tools provide compiling. Java RMI.N. Java uses similar commenting methods to C++. Interpreter. which are not classes for performance reasons. HotSpot uses the Concurrent Mark Sweep collector. and everything is an object. which combines the syntax for structured. All code is written inside a class. Java Technology Works Java is a high-level programming language and powerful software platform. By default. Unlike C++. there are also several other garbage collectors that can be used to manage the Heap.D. generic. Unlike C++. The main tools used are the Javac compiler the java launcher. which is further used in your own applications. and characters). It gives a wide collection of useful classes. floating-point numbers. There are three different styles of comments: a single line style marked with two slashes (//). and object-oriented programming. Application Programming Interface (API): The API provides the core functionality of the Java programming language. and much more. and the java doc documentation tool. Java Naming and Directory Interface TM ("J. Java does not support operator overloading or multiple inheritance for classes. boolean values. It provides basic objects and interface to networking and security. However. a multiple line style opened with /* and . running. to XML generation and database access.I. Deployment Technologies: The JDK software provides two type of deployment technology such as the Java Web Start software and Java Plug-In software for deploying your applications to end users. also known as the CMS Garbage Collector. This simplifies the language and aids in preventing potential errors and anti-pattern design. and Java Remote Method Invocation over Internet Inter-ORB Protocol Technology (Java RMI-IIOP Technology) enable database to access and changes of remote objects Syntax The syntax of Java is largely derived from C++. and documenting your applications. Besides the fact that the operating system. the Android SDK uses Java to design applications for the Android platform. and so on) tell us that a program written in the Java programming language can be four times smaller as compare to the same program written in C++. and the Javadoc commenting style opened with /** and closed with */. method counts. The Javadoc style of commenting allows the user to run the Javadoc executable to compile documentation for the program. that APIs cannot be copyrighted (Scope)Java Technology Changes Our Life Easy to Start: Since Java programming language is completely based on object-oriented language. . a San Francisco jury found that if APIs could be copyrighted. Hon. it's easy very simple and easy to learn. built on the Linux 2. 2012. Inc. Easy to write code: As compared to program metrics (class counts. have chosen to use Java as a key pillar in the creation of the Android operating system.closed with */. was written largely in Java. then Google had infringed Oracle's copyrights by the use of Java in Android devices. William Alsup ruled on May 31.6 kernel. an open-source smartphone operating system. 2012. Oracle's stance in this case has raised questions about the legal status of the language. On May 7. However. Use by external companies(like google) Google and Android. especially for programmers already known with C or C++. Write better code: The Java programming language encourages good coding practices. Platform Independencies: The program keep portable and platform independent by avoiding the use of libraries written in other languages. that is compiled into machine-independent byte codes and run consistently on any platform of java. The Java platform differs from other platforms. and wide-range. manages your development time upto twice as fast when writing in it. tested code and introduce fewer bugs. and Macintoshes OS. The Java platform has two components: The Java Virtual Machine(JVM) The Java Application Programming Interface (API) The Java Virtual Machine is the root for the Java platform and is integrated into various hardware-based platforms. An automatic version check initially weather users are always up to date with the latest version of your software. Linux. the Java Web Start software will automatically update their installation Java Platform Platform is cross-combination of hardware or software environment in which a program runs. . flexibility and API can reuse existing. easily extendible. Based on the concept of object orientation. and manages automatic garbage collection which helps you avoid memory leaks. that is only software-only platform which runs on other hardware-based platforms. We are already known with the most popular platform like Microsoft Windows. Develop programs and Time Safer: The Java programming language is easier and simpler than C++. Solaris OS. Distribute software makes work easy : Using Java Web Start software. users will be able to launch own applications with a single click on mouse. its Java Beans component architecture. as such. Write Once and Used in any Java Platform : Any Source code of Program are written in the Java programming language. If an update is available for it. The programs will also require fewer lines of code. new changes in compiler and virtual machine brings performance close to that of native code without posing any threatening to portability security. However.class file contains byte codes ? the machine language of the Java Virtual Machine (JVM).java extension in the Java programming language. A .The API is a vast collection of various software components that provide you many useful functionality to the application.class files by the java compiler. . It is grouped into logical collection of related classes and interfaces. The java launcher tool runs your application with an instance of the Java Virtual Machine. these logical collection are known as packages. Schematic Flow of Java Software Development Life Cycle JVM works on different Operating System . The . Java work on platform-independent environment. There are some virtual machines.class files(bytecode) capable of running on various Operating System. The API and Java Virtual Machine insulate the program from hardware. such as the Java Hotspots virtual machine that boost up your application performance at runtime . This include various tasks such as Efficiency of Programme and recompiling (to native code) which is frequently used sections of code. All source code is written in text files (Notepad Editor) save with the . the Java platform is bit slower than native code. The source files are compiled into . Java JVM. Java Preferred Over Other Languages The Java is a high-level programming language that can be supported by all of the following features: Simple Object oriented Distributed Architecture neutral Portable High performance Multithreaded Robust Dynamic Secure Java has advantages over other languages and environments that make it suitable for just about any programming task. . the same application is capable to run on multiple platforms. Historically.). The goal of Java is to make all implementations of Java compatible. This implementation is based on the original implementation of Java by Sun. Implementations Oracle Corporation is the current owner of the official implementation of the Java SE platform. microbenchmarks show Java 7 is approximately 1. the addition of language features supporting better code analysis (such as inner classes. The Java Development Kit (JDK). Some platforms offer direct hardware support for Java.Performance Programs written in Java have a reputation for being slower and requiring more memory than those written in C. Sun's trademark license for usage of the Java brand insists that all implementations be . the StringBuffer class. Javadoc. Windows and Solaris. and ARM based processors can have hardware support for executing Java bytecode through their Jazelle option. The Oracle implementation are packaged into two different distributions. Because Java lacks any formal standardization recognized by Ecma International. This package is intended for end-users. OpenJDK is the official Java reference implementation. there are microcontrollers that can run Java in hardware instead of a software Java Virtual Machine. The Oracle implementation is available for Mac OS X. etc. The implementation started when Sun began releasing the Java source code under the GPL. OpenJDK is another notable Java SE implementation that is licensed under the GPL. and a debugger. ANSI. As of Java SE 7. However. and optimizations in the Java Virtual Machine itself. Java programs' execution speed improved significantly with the introduction of Just-in-time compilationin 1997/1998 for Java 1. or any other third-party standards organization. Currently (February 2012). Jar. ISO/IEC.1. such as HotSpot becoming the default for Sun's JVM in 2000. The Java Runtime Environment (JRE) which contains the parts of the Java SE platform required to run Java programs.5 times slower than C. the Oracle implementation is the de facto standard. optional assertions. is intended for software developers and includes development tools such as the Java compiler. This resulted in a legal dispute with Microsoft after Sun claimed that the Microsoft implementation did not support RMI or JNI and had added platform-specific features of their own. 2011) Reason for choosing this company 1)WORKSHOP: Recent Workshop: A short story never ends but it messages to the reader to be curious and without being curious your knowledge is incomplete as curiosity is the basic condition to be an ideal student. Microsoft no longer shipsWindows with Java. 2006) Java SE 7 (July 28. 2002) J2SE 5. This environment enables portable server-side applications. 1998) J2SE 1.1 (February 19. 1997) J2SE 1. as well as a court order enforcing the terms of the license from Sun. 1996) JDK 1. As a result. Platform-independent Java is essential to Java EE. 2004) Java SE 6 (December 11. Versions Major release versions of Java. Sun sued in 1997. and an even more rigorous validation is required to certify an implementation.2 (December 8. along with their release dates: JDK 1. and in 2001 won a settlement of US$20 million.3 (May 8."compatible".4 (February 6. 2000) J2SE 1.0 (January 23. .0 (September 30. UBUNTU. It is the bridge between a subject and knowledge seeker. there would be an entire city down to sea. openGL like add on apart from conventional J2ME and J2EE . every day a new programming language is getting birth.VLSI and Chip set programming(including MOSFET and Spice). workshop is that pilot. materialistic is. Our developers.LONO and JOLI like clouds.RT-LINUX.) 2)INDUSTRIAL TRAINING As we have started our journey.gcc/gnu).Workshop carries exactly that sense. perhaps.ANDROID like Embedded and Real time Operating Systems. Keeping this matter in our mind we have introduced another educational wing ‘an important feather in the crown’ that is to conduct workshop based on a new emerging technology.cross platform compilers (COSMIC-C. Jena. until and unless it is going through the‘pilot’ process. rather you have to be ‘Jack of all trades’.KEIL. the word ‘No’ turns to ‘on’.. as we do not have any intention to be the world’s number .MATLAB etc. the way technology is jetting . JAVA . Sixty to seventy years back it was unbelievable to the earth that once time would come when humanoid might replace a human in the world of employment. Any new technology can never be adopted evenly. Haskell. researchers and content managers are working ruthless for a better as ‘education is a contiguous learning system’ even we handle and fulfill the ‘on demand’ requirement of corporate by organizing customized workshops (for example Processing like on board programming tool etc. at least you must be a ‘new technology literate ‘and that is why attending workshop based on a niche technology is smarter for a technical student.And we have to be at par with this ‘Jet Age’ as now the protocol is either be learnt or to leave! In the technical world.NET. System programming(by ANSIC. Dick and Harry’. Today nothing is impossible. as we have a dream to reach to the remote corner of the world to transform the knowledge. it is very difficult to learn all! And it is the reality for any ‘Tom. In contrary to it. C language now belonging to ‘Jurassic Age’! Have you heard about Meta Shell Script? Do you program on board? Are you conversant with ‘Processing’?”Hey Mike can you speak on ‘Lua’?” No??Then why are you here? It means. CLOUDO . network.TEXUS etc). We are currently dealing with Python. Embedded/Native and Objective C like programming tools apart from the conventional languages like . CGI. perhaps for all to be master in each subject and world is not seeking that. Eclipse. Perl. Mobile simulations. hence we are sailing well. 4. . This payment part is committed either via Paypal or via credit card/online transaction 5. MOSFET. we are comfortable by getting a plenty of blesses of our students and their relies. but we are trying our level best insuring to present more and more academic ventures for the benefit of the student and in a continuous process of upgrading our portal. This is our third year and we are still learning a lot from our ancestors and that learning taught us not to confine ourselves only to solve assignments or providing support to academic projects but also to be present in the student world more actively by the mean of workshops and boot camp training.online education hub. Our portal is still in nascent stage hence may be unable to communicate all to the outer world. Teachers mention the details of subject. from Reliable Tutor confirmation email goes to student mail box. specialty and pricing for an assignment/subject in web. Real Time Operating Systems. If all would tally. Network Protocol designing by Python/CGI/Lua etc. We are now limited to conduct boot camps only in Information emerging technologies like Embedded Robotics. Image Processing and signal processing by Matlab or tool like Objective C. Soon we will introduce boot camp projects in other ‘on demand’ domains like Health and Nutrition. teacher confirms the receiving of assignment/or share the lesson plan after Reliable Tutor getting an advance payment (usually 50% of the quote) in lieu of primary invoice. Student quotes the price and schedule in the next stage. that is why we are reliable tutors. After receiving an assignment. 3) Online tutoring Students and Teachers meet online. Alternative living strategy etc.You feel free to inquire as your feeds will enrich our output day by day. hence. and have mentioned below step by step process how thing works: 1. Students matches the quality issue and pricing part by chatting 3. VLSI with LASI. Clouds and Androids. 2. Disaster Management. The java come with the concept of Multithreaded Program. reuse and generate a new project.6. complete portfolio of project management like source codes. then generates secondary invoice for rest payment. We are here to assist you in any project where programming tool is no matter whether it is C or Lua . A project is defined as a complete project when it can give the birth of its successor that is why ‘life cycle’ this term is introduced in project. If you are stuck with your project or wanna make a project for your future use just talk to us or chat with our representative. we will guide you with our expertise and knowledge. Reliable Tutor’s team is ready to help you to solve your final year project.This is more delegate and difficult to handle . When Reliable Tutor confirms the completion of assignment. as Java compilers are able to detect many error problem in program during the execution of respective program code. operating system-specific procedures have to be called in order . power point/flash presentation etc. 7. cover letter.Java supports multithreaded. reliable Tutor sends the completed assignment by two way hand shaking method. As we believe certain code snippet or flip is not a project.Our think tank is efficient enough to take care any technology existing on the earth. Only thing we can assure you is SATISFACTION insuring the score . documentation. PROJECT ASSISTANCE In few cases like Real Time System there is no difference between implementation and maintenance as maintenance is complimentary to implementation. In other languages. The teacher and student once again chat at the day of schedule time ends either via Skype or Google Chat or by direct calling in accordance with both parties comfort-ability. Multithreaded is the path of execution for a program to perform several tasks simultaneously within a program. We usually provide the orthodox support to our students following the rule of software engineering. once fails system is crashed hence here the life cycle of the project called ‘Spiral Model’ .A self sufficient complete project is that which when being studied by any other software engineer apart from the project owner can understand. following the above mentioned process when payment is finished. Java emphasis on checking for possible errors. Java is platform-independent: One of the most significant advantages of Java is its ability to move easily from one computer system to another. i. Advantages of JAVA Java is simple: Java was designed to be easy to use and is therefore easy to write. If the program does not deallocate an object. debug. In the latter case the responsibility of managing memory resides with the programmer.to work on multithreading. . the result is undefined and difficult to predict. a memory leak occurs. This allows you to create modular programs and reusable code. In some languages. manipulating objects. but these add overhead and complexity. and learn than other programming languages. and making objects work together. The ability to run the same program on many different systems is crucial to World Wide Web software. Java is distributed: Distributed computing involves several computers on a network working together. and Java succeeds at this by being platform-independent at both the source and binary levels. compile. The reason that why Java is much simpler than C++ is because Java uses automatic memory allocation and garbage collection where else C++ requires the programmer to allocate memory and to collect garbage. memory for the creation of objects is implicitly allocated on the stack. and the program is likely to become unstable and/or crash. If the program attempts to access or deallocate memory that has already been deallocated.e. Java is designed to make distributed computing easy with the networking capability that is inherently integrated into it. Note that garbage collection does not prevent "logical" memory leaks. or explicitly allocated and deallocated from the heap. One of the ideas behind Java's automatic memory management model is that programmers can be spared the burden of having to perform manual memory management. Java is object-oriented: Java is object-oriented because programming in Java is centered on creating objects. those where the memory is still referenced but never used. This can be partially remedied by the use of smart pointers. . Java is interpreted: An interpreter is needed in order to run Java programs. Java is secure: Java is one of the first programming languages to consider security as part of its design. Java is multithreaded: Multithreaded is the capability for a program to perform several tasks simultaneously within a program. the program need only be compiled once. compiler. and runtime environment were each developed with security in mind. communicating with each other to perform a joint task. while in other languages. and the bytecode generated by the Java compiler can run on any platform. In Java. interpreter. multithreaded programming has been smoothly integrated into it. Disadvantages of JAVA Performance: Java can be perceived as significantly slower and more memory-consuming than natively compiled languages such as C or C++. For example. The programs are compiled into Java Virtual Machine code called bytecode. Look and feel: The default look and feel of GUI applications written in Java using the Swing toolkit is very different from native applications.Writing network programs in Java is like sending and receiving data to and from a file. The bytecode is machine independent and is able to run on any machine that has a Java interpreter. Java puts a lot of emphasis on early checking for possible errors. The Java language. operating system-specific procedures have to be called in order to enable multithreading. the diagram below shows three programs running on three different systems. as Java compilers are able to detect many problems that would first show up during execution time in other languages. It is possible to specify a different look and feel through the pluggable look and feel system of Swing. Multithreading is a necessity in visual and network programming. With Java. Java is robust: Robust means reliable and no programming language can really assure reliability. Java also was specifically designed to be simpler than C++ but it keeps evolving above that simplification. C++ Java backwards compatible.0 the procedural paradigm is better accommodated than in earlier versions of Java.Single-paradigm language: Java is predominantly a single-paradigm language. secure. Java was created initially to support network computing on embedded systems. none of which were design goals for C++. multi-threaded and distributed. You can get a better understanding of Java in the Java Programming WikiBook. C++ and Java share many common traits. However. but direct compatibility with C was not maintained. with the addition of static imports in Java 5. Java was designed to be extremely portable. The syntax of Java was chosen to be familiar to C programmers. Comparision of java with other languages Java This is a comparison of the Java programming language with the C++ programming language. backwards compatibility with including C previous versions Focus execution efficiency developer productivity Freedom trusts the programmer Memory arbitrary memory access memory access only through Management possible objects Compatibility imposes some constraints to the programmer . Java runs on a virtual machine so with C++ you have greater power at the cost of portability. in Java it is package access. they are different. C++ allows namespace level constants. Foo<1>(3). int main() is a function by itself. C++ runs on the hardware. C++. but it creates an object if Foo is the name of a class template. . const in C++ indicates data to be 'read-only.Code Type Safety Programming Paradigm Operators Main Advantage concise expression type casting is restricted greatly explicit operation only compatible types can be cast procedural or object-oriented object-oriented operator overloading meaning of operators immutable powerful capabilities of feature-rich. C++ access to class members default to private.' and is applied to types. easy to use standard language library Differences between C++ and Java are: C++ parsing is somewhat more complicated than with Java. private) is done with labels and in groups. final in java indicates that the variable is not to be reassigned. but for complex classes. variables. All such Java declarations must be inside a class or interface. for example. C++ access specification (public. without a class. C++ classes declarations end in a semicolon. C++ doesn't support constructor delegation. and functions. For basic types such as const int vs final intthese are identical. is a sequence of comparisons if Foo is a variable. However. C++ provides some low-level features which Java lacks. the programmer can simulate by-reference parameters with by-value parameters and indirection. Similarly. C++ allows a range of implicit conversions between native types. As in C. Java provides a strict floating-point model that guarantees consistent results across platforms. but object (non-primitive) parameters are reference values. In Java. C++ lacks language level support for garbage collection while Java has built-in garbage collection to handle memory deallocation. A consequence of this is that although loop conditions (if. Java enforces structured control flow. C++ supports goto statements. through the Java Native Interface. In Java. but its labeled break and labeled continue statements provide some structured goto-like functionality. This is handy if the code were a typo for if(a == 5). pointers can be used to manipulate specific memory locations. meaning indirection is built-in. with the goal of code being easier to understand. all parameters are passed by value. Java does not. For passing parameters to functions. code such as if(a = 5) will cause a compile error in Java because there is no implicit narrowing conversion from int to boolean. ranges and representations. though normally a more lenient mode of operation is used to allow optimal floating-point performance. and also allows the programmer to define implicit conversions involving compound types. there is significant overhead for each call. any other conversions require explicit cast syntax. However. . The rounding and precision of floating point values and operations in C++ is platform dependent. but the need for an explicit cast can add verbosity when statements such as if (x) are translated from Java to C++. or be configurable via compiler switches. In C++. which may even change between different versions of the same compiler. Java built-in types are of a specified size and range. Generally. while and the exit condition in for) in Java and C++ both expect a boolean expression. Java only permits widening conversions between native types to be implicit. a task necessary for writing lowlevel operating systemcomponents. C++ supports both true pass-byreference and pass-by-value. In fact. assembly code can still be accessed as libraries. whereas C++ types have a variety of possible sizes. many C++ compilers support inline assembler. The synchronized keyword in Java provides simple and secure mutex locks to support multi-threaded applications. Java has generics. Java does not have pointers—it only has object references and array references. C++ has templates. which concatenate strings as well as performing addition. The only overloaded operators in Java are the "+" and "+=" operators. In C++ multiple inheritance and pure virtual functions makes it possible to define classes that function just as Java interfaces do. Java supports multiple inheritance of types. In C++ all types have value semantics. while Java references only access objects. Java has both language and standard library support for multi-threading. but a reference can be created to any object. Java explicitly distinguishes between interfaces and classes. but only single inheritance of implementation. and compound types have reference semantics only. C++ supports multiple inheritance of arbitrary classes. C++ features programmer-defined operator overloading. In Java. Java features standard API support for reflection and dynamic loading of arbitrary new code. In C++. neither of which allow direct access to memory addresses. While mutex lock mechanisms are available through libraries in C++. In C++ one can construct pointers to pointers. In Java. the lack of language semantics makes writing thread safe code more difficult and error prone Learning Outcome from training . but a class can implement multiple interfaces. native types have value semantics only. Both Java and C++ distinguish between native types (these are also known as "fundamental" or "built-in" types) and user-defined types (these are also known as "compound" types). The equivalent mechanism in Java uses object or interface references. In C++ pointers can point to functions or member functions (function pointers or functors). pointers can be manipulated directly as memory address values. which will allow the object to be manipulated via reference semantics. a class can derive from only one class. Learning outcomes reflect the goals of the instructional designer. is it for development or to correct performance deficiencies? Identifying the instructional strategies .Such as looking at job descriptions. Note that learning outcomes are different from learning objectives. or concept learning. . In addition. Whereas objectives specify what the learner will be able to accomplish after the completion of training.The 6 week training has been a rewarding experience in many ways. These learning outcomes are important. by the end of this course participants will be able to: Deploy a Java web application to a server Understand the architecture of web-based systems Develop components of a web based application using the Java Enterprise Edition Develop with the Struts framework Integrate server side programs with enterprise data sources. For example. they are linked to the design of the training. We have gained a lot of things and essentials of java programming language. exploration.Such as coaching. for once they are identified. they can be used to develop instructional strategies and generate learning objectives. Examining the performance domain . or interviewing subject matter experts. Learning outcomes may developed by viewing them through three different perspectives: Examining the goals of training. observing expert performers. Bibliography 1. The way of java By Gary Entsminger Websites. Teach yourself java in 24 hours By Rogers Cadenhead 3.com . Thinking in java By Bruce Eckel 2.
https://www.scribd.com/document/252709048/Amdfit-Report
CC-MAIN-2018-43
refinedweb
8,207
51.55
Your thoughts on Python Joel, I have been a regular reader of your articles and have admired your points of view on many things because of their practicality. I am curious to know your thoughts on the Python language. As a programmer and system designer, what aspects do you look for in a programming language? Hemanth Monday, March 15, 2004 I know practically nothing about Python. When I looked at it, it appeared to be "yet another late-bound slow interpreted scripting language" of which I already have more than I need, so I didn't look much closer. I do, however, agree wholeheartedly with Dave Winer's admiration of the way Python gives indenting semantic meaning. I'm sure most programmers consider this to be frighteningly annoying, but most programmers are wrong. Giving indentation semantic meaning is a stroke of genius. In one fell swoop, it forces code to be indented neatly and correctly, while avoiding an entire class of bugs caused by code that looks like it's doing X when it's really doing Y and averting a whole class of worthless flamewars. That said, I just don't have any use for another scripting language so I haven't been able to justify the time to learn Python. Joel Spolsky Fog Creek SoftwareMonday, March 15, 2004 And for a somewhat faster .net version of python: if you prefer the jvm to the clr, the same guy gave us jython: Then again, I'm severely biased ;-) fool for python Tuesday, March 16, 2004 Joel, Python might interest you because most people who use it considers it one of the most usable programming languages there is. It is just an absolute pleasure to work with -- everything is so intuitive and clean. The clean language design seems to have seeped through to most the API designs as well. I think it is an interesting question to see if there is any way to quantify these benefits, but they are very real nonetheless. I feel like python is so flexible and fast that I am less likely to write code with bugs, to let cases go untested. Its short iteration cycles let me mold the structure of my programs quickly and exactly how I want them. It does have a few warts -- in my opinion the import statement is one -- but overall it is fantastically usable. I can imagine that right now it's not the best language for business purposes, but it definitely is worth learning for anyone with a general interest in programming. Not to be too effusive, but for an experienced programmer it is not so much a question of learning python, but rather finding it within yourself. : ) And people can always pick on scripting languages for being slow (I know fast, I program almost exclusively in C for my job), but Python has the defense that there is the Python/C API. It is DESIGNED to be extended with C for performance critical applications. It can interface with existing C code with a wrapper. There are tons of C libraries that are available to python programmers, including the whole Win32 library, I believe MFC, OpenGL, TeX libraries, expat (XML), HTML, HTTP, encryption, compression, math, you name it... Though one thing I have a problem with is that, recently, it seems the development efforts going a little too far in the theoretical abstract direction, instead of focusing on developing professional development tools, polishing warts, and consolidating/maturing the already excellent libraries. I think it could easily be a lot more popular than it is now, given its benefits. And popularity is always a big plus when deciding to use any programming language. Roose Tuesday, March 16, 2004 Are there examples of succesfull commercail apps done with python? drazen Tuesday, March 16, 2004 Take a look at zope () There exist several commercial web-applications on top of this application server, e.g. a service desk / docflow system by Naumen (). There exist a bunch of scientific libraries / applications using python, it is very popular in bioinformatics (). tws Tuesday, March 16, 2004 I laughed at the indentation feature when I first heard about it, but got addicted within 5 minutes of actually using Python. It's a great too that one does not have to type semicolons at the end of each line of code. Now if only Python would dump this useless required colon at the end of each "if" and "def" line, it would definitely bring home the Oscar in the "Cleanest language that looks like plain English and does not require weird syntax" category. Jan Derk Tuesday, March 16, 2004 Heretic! And to think I bought FogBugz to manage a Python project :-) In all seriousness, Python isn't that slow, but then again, it's not for all apps. My current project () is put together with Python and wxWindows and has a fairly significant amount of code in it -- but none of that code is algorithmically complex. At my "real" job, I was using Java but we're speed freaks here (we use very complex finance/risk management model) so I've switched over to C++ (actually C++ written using mainly C functions and using Fortran-style memory layouts). Python would definitely not be appropriate for this environment! Anyway, in conclusion (as they say): Python is god -- for the right apps. 15 minutes can get one hooked for life. It did for me. David Janes Tuesday, March 16, 2004 The redundant colon comes from a usability study. Apparently complete newbies had a hard time realizing indentation was significant without it, in a Python precedessor. Of course, one can critique the applicability of the study, and it occasionally bites certain Pythonistas. (Then again, it might have bitten more people without colons.) But Guido likely didn't have the funds to commission more studies with Python, so I think it was understandable. Tayssir John Gabbour Tuesday, March 16, 2004 "Giving indentation semantic meaning is a stroke of genius." Python is *full* of strokes of genius; this is merely the most obvious, in-your-face example. Simon Brunning Tuesday, March 16, 2004 I've written lots of code in Python and I came away with three impressions: 1. The indentation thing is okay. I wouldn't call it a stroke of genius, but I didn't mind it. 2. Tuples are way cool. 3. The % operator for strings is great. C# should have this as a syntactic shortcut for String.Format(). Eric Sink Tuesday, March 16, 2004 If complete newbies have a hard time realizing that indentation is significant, then why not add parentheses or begin/end around each block? In your link van Rossum mentions that he likes uniformity in a language. This colon, however, is the dissonant in the otherwise brilliant Python symphony. The other clean language, Ruby, does not use it either. But then again Ruby suffers from its "end" statement. I guess nothing is perfect and I should not rant so much about a colon. Oh well, I just go back browsing the web for good scuba operators on Koh Tao, Thailand. BTW, BitTorrent is written in Python + wxWindows. Fred Tuesday, March 16, 2004 "Of course, one can critique the applicability of the study, and it occasionally bites certain Pythonistas. (Then again, it might have bitten more people without colons.)" People without colons are rare. I see no reason to compromise a language's design just to cater to such a small demographic. Karl von L. Tuesday, March 16, 2004 I am sure that one of the functional programming languages uses indentation, I think it was HUGS which is essentially Haskell. The only people who found indentation a problem were programming newbies who hadn't learned about writing clean and understandable code. Old timers like me didm't have those sort of problems, there was enough in Haskell to trip me up elsewhere. WhatTimeIsItEccles Tuesday, March 16, 2004 Ensim Webppliance, one of the more popular comercial hosting platform solutions, is written in Python. Guillermo Bertossi Tuesday, March 16, 2004 google uses python Tuesday, March 16, 2004 I wish Python had PHP's ease of implementation as a web development language. Two or three times now I've tried to get mod_python going without success. It's curiously hard to write the first "hello world" page in response to a GET. Requiring the twisted library and hence another whole web server seems a little excessive when I've got a perfectly good Apache installation. Similarly with Zope. julian Bond Tuesday, March 16, 2004 Julian, if it's been a while since you've used mod_python, you might take a look at the latest version (released last month). They've added a way of including Python code in HTML, like you do with PHP. If you're interested, there's an article about it at (I'm not crazy about the PHP way of doing things myself, but it certainly can be convenient sometimes.) Moss Collum Tuesday, March 16, 2004 The most popular daily use of Python are probably the parts of Google written in Python, but of course that isn't a typical app. As far as I know, the most popular pure Python app in use today is BitTorrent, which is getting between 1.3 - 1.5 million downloads a month from SourceForge. Those numbers also qualify BitTorrent as one of the most popular Open Source apps. Here's a direct link to the monthly download stats... When I first started using Python one of the first things I did was translate many of my VBScripts I used regularly to Python. Mark Hammond's pywin32 (win32all) makes this very easy as it gives you simple access to COM components and the Python code is very similar to the VBScript code for a given task like automating Outlook, so it is easy to understand and debug. In many cases, you can remove or isolate the Windows dependencies imposed by WSH or VBScript and you'll end up with a useful cross-platform script that will work on Mac OS X and Linux instead of just working on Windows. Organizations using Python I just started a page to track apps written in C/C++ that support Python for scripting the app and components. This is analogous to what many MS apps do with VBScript, but Python is much better at it and cross-platform. This use of Python is really catching on especially in the commercial game sector. And finally, if you're still wondering what all this Python hoopla is about, you should check out the following... ka Kevin Altis Tuesday, March 16, 2004 Anyone who once used Perl or PHP and now prefer Python for web apps? I started with Perl but now use PHP exclusively for the web (easier and much easier to deploy) but I still use Perl for cron jobs and command line stuff. Before I did PHP I would have said "use Perl" ... I wonder if someone can say the same for Python or maybe most of the people posting are coming down for C,C++,Java etc. I think they have a different perspective. I find Perl and PHP extremely easy to use to get things done ... why write 500 more lines ... if the speed doesn't make any difference? So I kind of fee like Joel, I've already got 2 scripting langauges, why bother with Python? Me Tuesday, March 16, 2004 >>> I find Perl and PHP extremely easy to use to get things done ... why write 500 more lines ... if the speed doesn't make any difference? So I kind of fee like Joel, I've already got 2 scripting langauges, why bother with Python? >>> (In Perl's case) because you might want to re read your code 6 months from now. Python favors cleanliness. Adriano Varoli Piazza Tuesday, March 16, 2004 I used perl for several years for some quite large scale projects (~30Kloc). A couple of years ago I discovered python. I won't use perl again unless I'm forced to. Python is not "just another scripting language" - it has lots of seriously good design. You'll find lots of people that have moved from python to perl - very few (any?) that have moved in the other direction. Mark Russell Tuesday, March 16, 2004 I have a Python story which I'm a little bit shocked by. I've always liked scripting languages. I like Perl Basic.. I'm sure decent Python IDEs exist, or are around the corner. And I hope I will be switching one day. But right now I'm kind of surprised I've been so happy in VB. Another interesting point. I'm generally against strong-typing. And I love Python's lack of typing. But I realize that I appreciate the *write-time* support that types give me in the VB IDE. Not sure how to transport that to Python. Also the reason I don't find the typing a pain in VB is because it's interpretted, so you still don't have the compile stage interupting the flow, phil jones Tuesday, March 16, 2004 I believe that in learning Python you are not learning any old scripting language. You are learning what it is to produce a truely elegant design; code that is beauty and art as much as it is function. I can only hope that this same beauty begins to seep into the other diciplines of software design and becomes the norm. The BitTorrent client GUI is a good example. But then, you really have to try it to grok it. Mars Tuesday, March 16, 2004 I've used both PHP and Python for professional web development -- started with home-grown Python system, moved to doing more PHP for professional reasons, then moved back to Python and Zope. It's definitely true that Python is a harder web environment to set up, and support for it is mixed. It's harder still that there's a lot of different environments, like Zope, Webware, mod_python, cgi, SkunkWeb, and the list goes on with about 20 other frameworks. It's a mess. But the language is great, and when you look past the lack of a canonical easy-to-administer environment I think you'll see that Python is much better suited for web programming than PHP. PHP is just a crazy bad language -- it's a really expedient environment, but it's a lousy language. At least Perl and Python differ by intention -- PHP is just way underdesigned. The web situation is a real shame, because Python is actually quite expedient in other domains. Anyway, I still use Python exclusively for my web programming, and quite happily, you just have to get over a certain hump to become productive. Ian Bicking Tuesday, March 16, 2004 You think Python has lots of web frameworks? Check this out: Phillip J. Eby Wednesday, March 17, 2004 Mars: "But then, you really have to try it to grok it." That's true of any language, isn't it? For instance, it's easy to slam Perl because it "looks ugly" to people who aren't used to sigils, but when you've used it for a while and think in it you don't read or understand the code the same way and the sigils aren't noise any longer. Personally, i think it will be a very interesting world when (if?) Python and other scripting languages have access to CPAN through Parrot... Chris Winters Wednesday, March 17, 2004 In my younger days, I was very interested in different programming languages and different ways of doing the same thing. I have learned well and used several programming languages a lot, including C++, Java, LISP, ObjectPascal, BASIC, Oberon, etc. Python is a fantastic language. When learning Python, I had this experience many times: I started working on a project, finished it, and was astonished at how little time it took to complete the project. The productivity gain is significant. However, most of the apps I write require a GUI, and I create the user interface using Delphi or VS .NET. Developing a GUI in Python is a lot slower than developing the same GUI in Delphi or VS .NET. So - when developing in Python, I save development time when writing the algorithms of the program, and then waste the savings on doing the GUI part. Because of this, developing a program in Python takes the same amount of time as developing the program in Delphi. And so I prefer to write in Delphi because I get a compiled .EXE which runs lightning-fast. Now, if there was a good, mature GUI builder for Python, I would immediately switch to Python because the combination of Python + good/fast GUI builder would enable me to develop applications a lot faster. I think that for such an environment, a 20% development time saving could realistically be obtained. This is VERY attractive and VERY significant. There is a Python GUI builder called BOA Constructor. Unfortunately, it's very beta :), and crashes a lot. MX Wednesday, March 17, 2004 BOA Constructor is an open-source GUI builder for Python. Project page: Screenshots: I'm curious, has anyone tried out Ruby? In the elegant languages department, Ruby is well worth a look. Highly recommended if you have some free time on your hands, and don't mind getting addicted. Download the windows installer, which comes with a basic IDE as well, at The best resource for starting is, IMO, The Pragmatic Programmer's Guide, by David and Andy. Link: SB Thursday, March 18, 2004 I have tried Ruby a while ago - so long ago, that I don't remember a lot. It is indeed elegant, however, I remember that it is the kind of language where lots of things are implicit and not spelled out in the code. I didn't get more into it because of the lack of mainstream acceptance. You can find lots of libraries for VB, Delphi, C++, etc. You will find a lot less libraries for Python. And even less libraries for Ruby. So this is why I avoided it. And I ended up avoiding Python for the lack of a good GUI builder, too. MX Thursday, March 18, 2004 In the 80s I was working for a governmental science lab and we did a lot of our data processing in a language called IDL(c) from rsi. This language had very many features that python or other scripting languages have now. It was a very strong boost in the productivity for the programmers (which were mostly scientists) and the whole lab was switching to this language (only time critical applications were written in fortran or c). When I left the lab and worked for a university I could not afford the high price of the software anymore and I was looking for alternatives. The requirements were ease of use and platform neutrality. After a while I found python and later on jython. I think the combination of jython (as a glue and scripting language) and java (for the low level parts) is the best that you can get. Using this on a large memory machine with a decent jvm like the one from bea gives you a strong advantage over programming in c++. The benchmarks that I were running on my machine were showing that the jython/java combination was faster than the python/c++ version. p.s. there is a decent python/jython mode for jedit which gives you a great jython/java ide with features like code completion, class browsing, in-process compilation, debugger support, built-in jython interpreter, javadoc generation and many many more. Ferdinand Jamitzky Thursday, March 18, 2004 """Personally, i think it will be a very interesting world when (if?) Python and other scripting languages have access to CPAN""" It's been possible for quite a while now. See: It allows you to embed a Perl interpreter in Python (via 'import perl') or a Python interpreter in Perl (via the 'Python::Object' package). Phillip J. Eby Thursday, March 18, 2004 In this day and age of automatic code formatters, I would find Python's indentation-is-significant to be very annoying. Forcing programmers to manually indent as part of the language makes automatic code formatting impossible, and is a waste of a million keystrokes per year. NoName Friday, March 19, 2004 Please tell me that's a joke. In this age of automatic indenting, your text editor should do all that work for you; no extra keypresses. NoName, is this a troll? Gareth McCaughan Friday, March 19, 2004 I am not trolling. Text editors can't read my mind. They can't predict what the next line should be, frequently forcing me to use backspace or spaces to put it where I really want. It's even worse when the indentation itself is used to designate the beginning and end of a logical block, thereby stopping the auto-indent from knowing when to back-dent. With braces to designate the end of logical blocks I can just type however I want and run it thru the auto-format when I'm ready. Still, I am looking into learning Python and the indentation issue won't stop me. It will be annoying but other languages have their own annoying characteristics. Most text editors I've used (and I am but a wee child of 29) indent or deindent with a single chord: shift-tab (or shift-alt-tab) on Windows and command-] and command-[ on Mac... and if you're really concerned about it, you can write all your code on a single line and then block-indent the whole thing later. So I hope you'll forgive my saying that citing that as a reason not to use a language seems... well... perhaps a bit trollish. "No, dammit, I can't drive this car -- it doesn't have a variable-speed rear window wiper control, and I *can't live without it!*" Sam Livingston-Gray Saturday, March 20, 2004 ...which should be continued, "No, that's fine -- I'll just walk. See you there next week." """Text editors can't read my mind. """ No, but they can read your keystrokes. In any editor with a proper Python mode, typing ':' and ENTER indents the next line, and all following ones. Outdent is then typically backspace, shift+TAB, or some such. So, compare with braces... open brace+ENTER, close brace... Hm, same number of keystrokes, including uses of the shift key, unless your Python outdent is backspace (in which case it's better) or your non-Python editor adds the closing brace for you (in which case it's better). Either way, not a lot to fuss about, and so automatic that it will probably disappear into the background during your very first coding session. Just like an editor indenting automatically after an open brace, it just "does what you mean". It may not be reading your mind, but it's close enough. Phillip J. Eby Saturday, March 20, 2004 Speaking of Python IDEs: has anyone tried Visual Python (VS.NET plug-in) from ActiveState: I used Visual XSLT from the same guys and it was a great experience for a XSLT newbie. Cristian Cheran Sunday, March 21, 2004 AFAIK, all the editors and IDEs listed on the wiki understand Python source enough to do smart indenting. ka Kevin Altis Sunday, March 21, 2004 A year ago I was of the same mind as Joel; when I needed to use a scripting language for text processing some years back, I thought Perl/Python?, Perl had the mind share, so I went Perl. Then last year I had the ask of extending a significant real time application, originally developed in Ada, that translates telephony switch control protocols on the fly. Various difficulties with continuing with the Ada led me to contemplate adopting Python, because mainly of relevant praise for the language from a colleague. (A few remarks about Ada for this purpose; experience translating other Ada programs to C++ suggests that at least for programs of 10-50KLOC 1 Ada Loc approximately equals 1 C++ LOC. If this had been Ada 95 instead of 83 then probably it would be much more economical in LOC than C++, but it was '83 vintage. The idea of implementing a real-time system such as this in C++ which has no semantic support for multi-tasking is a nightmare; I know that people do it, I just wouldn't pay for such a project myself). Now on closer examination one discovers that Python has threading and some very handy modules for common synchronisation semantics. Indeed this a feature of climbing the Python learning curve, everything you encounter has been done really well. What astonished me is that after two weeks I had written 2k lines in this unfamiliar language that reproduced the funtionality of the 20k lines of Ada (and the hypothetical 20k lines of C++). What' more, it worked. Bottom-up implementation of the Ada package architecture with its Python equivalent, with test programs for each component on the way, was a completely smooth process. No nasty surprises, obscure bugs, memory leaks, stress test collapses. An order of magnitude improvement in productivity for a particularly difficult application. In the intervening months I have used Python for several diverse projects: XML applications, exploratory data analysis with neural networks, etc. For anything algorithmic or data structure intensive it is fantastically useful. For most compute-intensive situations you can hand off to C modules (the numeric module is particularly convenient for this), and there are tools like psyco providing acceleratioin through JIT-style compilation to machine code. Don't be too worried about speed; write in 1month the app that takes a year in C++, and spend another month tu ning it if you really need to. Also scalability; I've absolutely no fear of developing large programs in Python, the source code is wonderfully readable and maintainable, especially compared with Perl or C++ which are very often write-only exercises. Two areas I have not tackled with Python: web applications and GUI applications. I note an earlier contributors remarks about IDEs; I too have recently been using VB and VBA where the client wouldn't allow Python. Despite the handy benefits of the IDE programming in VB compared to Python seems like swimming in treacle. If you enter the Python community you will discover it is populated by some very smart people who have done remarkable things with it. Don't worry about lack of library support; you can find everything you need and the benefit is it will be extraordinarily accessible when you use it. Pythonista Wednesday, March 24, 2004 "... Two areas I have not tackled with Python: web applications and GUI applications. ..." for me this cuts to reasons I use python. I use python as a systems tool doing all the boring scripting stuff I need to do ... for example *admin -backup of data -mirroring of data -status tools or as business logic in apps .... *code -scripting business logic -code boilerplate generation -testing or misc other things .... *misc -spider aggregators -munging python is the ideal cross platform system language for win,*nix (inc mac). python also can be embedded in applications for windows etc (try that with perl). but perl kills python (for me) server side because of CPAN (and mature Apache, mod_perl, DBI) so my mantra is " ... python on the desktop, perl on the server ..." peter renshaw Wednesday, March 24, 2004 """Text editors can't read my mind. """ if condition: pass else: if condition2: pass # # By putting single comment characters at the ends of blocks, Visual Slickedit can do all of it's smart-indet-on-paste and my eye can follow complex blocks more easily. Totally optional, but it should quiet anyone who complains that there are no end-of-block delimiters. Jim Carroll Tuesday, March 30, 2004 The phrase "'Scripting Language' My Arse" springs to mind: Michael Hudson Wednesday, March 31, 2004 Python is a nice language, Python with braces (I call it "braython") is even nicer. (I wrote a little processor to allow braces and then strip them out.) Contrary to Joel, using indentation to convey meaning give my tired brain cells conniptions. Gary Cornell Friday, April 02, 2004 """ (I wrote a little processor to allow braces and then strip them out.) """ I'm curious whether you find yourself indenting the code within the braces. sfb Wednesday, April 07, 2004 It's funny how no one mentions the relative genious of pyGTK and libglade here. I've written a fairly complex commercial application () entirely in Python, and used libglade to huge advantage. Having your GUI as an xml file separate from your codebase is a fantastic way to let you do rapid application development - and it's completely cross platform. Dave Aitel Saturday, April 17, 2004 I need help corecting this concrete calc. # Tk Gui from Tkinter import * # Messages import tkMessageBox # function definition for use in an event # ALL functionality must be in the def statement def doit(event): if tkMessageBox.askyesno("Alert...","Do you really want to compute?"): l = float(text1.get()) w = float(text2.get()) t = float(text3.get()) concrete = (l * w) * t / 27 c = 77.50 * concrete rock = (l * w) * 220 / 9 / 2000 cr = rock * 12 cl = l * w total = cl * 7 labor = total - (cr + c) text4.insert("end", answer) if total < 2500: peggy = 100 total = total + peggy elif total >= 2501 <= 5000: peggy = 200 total = total + peggy else: peggy = 300 total = total + peggy self.result_var.set('Waiting for a number...') # Put entries on text box answer = "the amount of concrete needed is " ,concrete, "cubic yards" + text4.get() + "\n" answer = "the cost of concrete is " ,c, + text4.get() + "\n" answer = "the rock needed is " ,rock, 'tons, based on the 2" standard' + text4.get() + "\n" answer = "the cost of rock is" , cr, + text4.get() + "\n" answer = "the cost of labor is " ,labor, "dollars" + text4.get() + "\n" answer = "the total cost of job is " , total, "dollars" + text4.get() + "\n" text.insert("end",answer) if s > 1000: text4.config(bg = "red") else: text4.config(bg = "blue") def clearit(event): text1.delete(0,"end") text2.delete(0,"end") text3.delete(0,"end") text3.config(bg = "white") text1.focus_set() root = Tk() root.title("Concrete Calculator") root.geometry("600x400") root.geometry("+100+100") # change background color root.config(bg = "pink") # create a frame frame = Frame(root,bg = "purple") # Text fields for Data Entry # pady puts space between the fields # Change cursor too, just for fun gumby etc Label(text='Enter the length of concrete job in feet').pack(side="top") text1 = Entry(root,width = 20) text1.pack(side = "top", pady = 10) Label(text='Enter the width of concrete job in feet').pack(side="top") text2 = Entry(root,width = 20) text2.pack(side = "top", pady = 10) Label(text='Enter the thickness of concrete in tenths').pack(side="top") text3 = Entry(root,width = 20) text3.pack(side = "top", pady = 10) # Add a button and change color of the button # Change cursor too, just for fun gumby etc click = Button(frame,text = "Enter",bg = "darkgreen",fg = "white") click.pack(side = "left", pady = 10,padx = 20) #click.bind("<ButtonRelease>",doit) # To release the button use this line click.bind("<ButtonRelease>",doit) clear = Button(frame,text = "Clear") clear.pack(side = "left",padx = 20) clear.bind("<ButtonRelease>",clearit) frame.pack(side = "top") # pack the buttons in an invisible frame # text box text = Text(root) text.pack(side = "top") # Use this code to make box expand with maximize #text.pack(side = "top",fill = "both",expand = 1) text1.focus_set() root.mainloop() peggy walker Monday, June 14, 2004 Recent Topics Fog Creek Home
http://discuss.fogcreek.com/newyork/default.asp?cmd=show&ixPost=3721
CC-MAIN-2016-26
refinedweb
5,302
63.09
Your process runs with extra privileges granted by the setuid or setgid bits on the executable. Because it requires those privileges at various times throughout its lifetime, it can’t permanently drop the extra privileges. You would like to limit the risk of those extra privileges being compromised in the event of an attack. When your program first initializes, create a Unix domain socket pair using socketpair( ), which will create two endpoints of a connected unnamed socket. Fork the process using fork( ) , drop the extra privileges in the child process, and keep them in the parent process. Establish communication between the parent and child processes. Whenever the child process needs to perform an operation that requires the extra privileges held by the parent process, defer the operation to the parent. The result is that the child performs the bulk of the program’s work. The parent retains the extra privileges and does nothing except communicate with the child and perform privileged operations on its behalf. If the privileged process opens files on behalf of the unprivileged process, you will need to use a Unix domain socket, as opposed to an anonymous pipe or some other other interprocess communication mechanism. The reason is that only Unix domain sockets provide a means by which file descriptors can be exchanged between the processes after the initial fork( ). In Recipe 1.3, we discussed setuid, setgid, and the importance of permanently dropping the extra privileges resulting from their use as quickly as possible to minimize the window of vulnerability to a privilege escalation attack. In many cases, the extra privileges are necessary for performing some initialization or other small amount of work, such as binding a socket to a privileged port. In other cases, however, the work requiring extra privileges cannot always be restricted to the beginning of the program, thus requiring that the extra privileges be dropped only temporarily so that they can later be restored when they’re needed. Unfortunately, this means that an attacker who compromises the program can also restore those privileges. One way to solve this problem is to use privilege separation . When privilege separation is employed, one process is solely responsible for performing all privileged operations, and it does absolutely nothing else. A second process is responsible for performing the remainder of the program’s work, which does not require any extra privileges. As illustrated in Figure 1-1, a bidirectional communications channel exists between the two processes to allow the unprivileged process to send requests to the privileged process and to receive the results. Normally, the two processes are closely related. Usually they’re the same program split during initialization into two separate processes using fork( ). The original process retains its privileges and enters a loop waiting to service requests from the child process. The child process starts by permanently dropping the extra privileges inherited from the parent process and continues normally, sending requests to the parent when it needs privileged operations to be performed. By separating the process into privileged and unprivileged pieces, the risk of a privilege escalation attack is significantly reduced. The risk is further reduced by the parent process refusing to perform any operations that it knows the child does not need. For example, if the program never needs to delete any files, the privileged process should refuse to service any requests to delete files. Because the unprivileged child process undertakes most of the program’s functionality, it stands the greatest risk of compromise by an attacker, but because it has no extra privileges of its own, an attacker does not stand to gain much from the compromise. NAI Labs has released a library that implements privilege separation on Unix with an easy-to-use API. This library, called privman , can be obtained from. As of this writing, the library is still in an alpha state and the API is subject to change, but it is quite usable, and it provides a good generic framework from which to work. A program using privman should include the privman.h header file and link to the privman library. As part of the program’s initialization, call the privman API function priv_init( ) , which requires a single argument specifying the name of the program. The program’s name is used for log entries to syslog (see Recipe 13.11 for a discussion of logging), as well as for the configuration file to use. The priv_init( ) function should be called by the program with root privileges enabled, and it will take care of splitting the program into two processes and adjusting privileges for each half appropriately. The privman library uses configuration files to determine what operations the privileged half of a program may perform on behalf of the unprivileged half of the same program. In addition, the configuration file determines what user the unprivileged half of the program runs as, and what directory is used in the call to chroot( ) in the unprivileged process (see Recipe 2.12). By default, privman runs the unprivileged process as the user “nobody” and does a chroot( ) to the root directory, but we strongly recommend that your program use a user specifically set up for it instead of “nobody”, and that you chroot( ) to a safe directory (see Recipe 2.4). When the priv_init( ) function returns control to your program, your code will be running in the unprivileged child process. The parent process retains its privileges, and control is never returned to you. Instead, the parent process remains in a loop that responds to requests from the unprivileged process to perform privileged operations. The privman library provides a number of functions intended to replace standard C runtime functions for performing privileged operations. When these functions are called, a request is sent to the privileged process to perform the operation, the privileged process performs the operation, and the results are returned to the calling process. The privman versions of the standard functions are named with the prefix of priv_, but otherwise they have the same signature as the functions they replace. For example, a call to fopen( ): FILE *f = fopen("/etc/shadow", "r"); becomes a call to priv_fopen( ): FILE *f = priv_fopen("/etc/shadow", "r"); The following code demonstrates calling priv_init( ) to initialize the privman library, which will split the program into privileged and unprivileged halves: #include <privman.h> #include <string.h> int main(int argc, char *argv[ ]) { char *progname; /* Get the program name to pass to the priv_init( ) function, and call * priv_init( ). */ if (!(progname = strrchr(argv[0], '/'))) progname = argv[0]; else progname++; priv_init(progname); /* Any code executed from here on out is running without any additional * privileges afforded by the program running setuid root. This process * is the child process created by the call in priv_init( ) to fork( ). */ return 0; } privman from NAI Labs: Recipe 1.3, Recipe 1.7, Recipe 2.4, Recipe 2.12, Recipe 13.11 Get Secure Programming Cookbook for C and C++ now with O’Reilly online learning. O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.
https://www.oreilly.com/library/view/secure-programming-cookbook/0596003943/ch01s04.html
CC-MAIN-2021-39
refinedweb
1,176
51.48
I want to know what should I put inside a jbutton action listener. I think I knew how to get the row in the table where the blob file exists and place the Blob file into a variable Blob... I want to know what should I put inside a jbutton action listener. I think I knew how to get the row in the table where the blob file exists and place the Blob file into a variable Blob... How do I upload and download a PDF file in mysql? the PDF that will be uploaded was the one created by itext. it's now working well import java.awt.*; import java.awt.event.*; import java.security.*; import java.math.*; import javax.swing.*; what do you mean I think only once. Here is my whole db class import java.awt.*; import java.awt.event.*; import java.security.*; import java.math.*; import javax.swing.*; import javax.swing.text.AttributeSet; public class HandlerClass1 implements ActionListener { public void actionPerformed(ActionEvent event) { 100 char[] pass = pfPword.getPassword(); 101 String s= new String(pass); 102... Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at db$HandlerClass1.actionPerformed(db.java:100) at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2012)... too bad I don't know how to get the value of JPasswordField using JButton as the trigger. I already knew converting from String to md5 but not from JPasswordField to md5. I tried this code but it... I want to convert the input in a jpasswordfield to md5 but the problem is I don't know how thanks it's already solved. I forgot the give the array a value I change my while statement to while(rs.next()) { array=rs.getString(2); } but I got an error Type mismatch cannot convert from String to String[] transferring mysql data to array is my problem here is the code that I'm playing with public int i; public String [] array; PreparedStatement pstmt = con.prepareStatement("Select * from... the field type is text i really have no idea hope you guys can help me Consider this as solved as I used hide() method instead. Thanks for your help anyways. here is my codes import java.awt.event.*; import javax.swing.*; public class test extends JFrame { /** * the remove method only disable the textfield I'm not using a container my setLayout is null so that I could use the setBounds I did try remove(txtfieldname); but it didn't work, it was not able to remove the textfield I want to program something that if I click the button it will remove the JTextfield public class HandlerClass1 implements ActionListener { public JTextField tf1; public void actionPerformed (ActionEvent event) { tf1 = new JTextField("");... I am creating a program and I don't want it to accept character or string in my textfield how to make query for mysql that will return if it is an empty table or not? I switched to prepared statement and it is working fine now the image you're give is in your computer we can't see it. I added sq.printStackTrace() in the catch sq here is my sq.printStackTrace() com.mysql.jdbc.exceptions.MySQLSyntaxErrorException: Unknown column 'first' in 'field list' at...
http://www.javaprogrammingforums.com/search.php?s=3e682ba0d93ddcee960ed3e1b91fcd7d&searchid=1028217
CC-MAIN-2014-35
refinedweb
536
63.29
Using file descriptor passing, we now develop an open server: a program that is executed by a process to open one or more files. But instead of sending the contents of the file back to the calling process, the server sends back an open file descriptor. This lets the server work with any type of file (such as a device or a socket) and not simply regular files. It also means that a minimum of information is exchanged using IPC: the filename and open mode from the client to the server, and the returned descriptor from the server to the client. The contents of the file are not exchanged using IPC. There are several advantages in designing the server to be a separate executable program (either one that is executed by the client, as we develop in this section, or a daemon server, which we develop in the next section). The server can easily be contacted by any client, similar to the client calling a library function. We are not hard coding a particular service into the application, but designing a general facility that others can reuse. If we need to change the server, only a single program is affected. Conversely, updating a library function can require that all programs that call the function be updated (i.e., relinked with the link editor). Shared libraries can simplify this updating (Section 7.7). The server can be a set-user-ID program, providing it with additional permissions that the client does not have. Note that a library function (or shared library function) can't provide this capability. The client process creates an s-pipe (either a STREAMS-based pipe or a UNIX domain socket pair) and then calls fork and exec to invoke the server. The client sends requests across the s-pipe, and the server sends back responses across the s-pipe. We define the following application protocol between the client and the server. The client sends a request of the form "open <pathname> <openmode>\0" across the s-pipe to the server. The <openmode> is the numeric value, in ASCII decimal, of the second argument to the open function. This request string is terminated by a null byte. The server sends back an open descriptor or an error by calling either send_fd or send_err. This is an example of a process sending an open descriptor to its parent. In Section 17.6, we'll modify this example to use a single daemon server, where the server sends a descriptor to a completely unrelated process. We first have the header, open.h (Figure), which includes the standard headers and defines the function prototypes. #include "apue.h" #include <errno.h> #define CL_OPEN "open" /* client's request for server */ int csopen(char *, int); The main function (Figure) is a loop that reads a pathname from standard input and copies the file to standard output. The function calls csopen to contact the open server and return an open descriptor. #include "open.h" #include <fcntl.h> #define BUFFSIZE 8192 int main(int argc, char *argv[]) { int n, fd; char buf[BUFFSIZE], line[MAXLINE]; /* read filename to cat from stdin */ while (fgets(line, MAXLINE, stdin) != NULL) { if (line[strlen(line) - 1] == '\n') line[strlen(line) - 1] = 0; /* replace newline with null */ /* open the file */ if ((fd = csopen(line, O_RDONLY)) < 0) continue; /* csopen() prints error from server */ /* and cat to stdout */ while ((n = read(fd, buf, BUFFSIZE)) > 0) if (write(STDOUT_FILENO, buf, n) != n) err_sys("write error"); if (n < 0) err_sys("read error"); close(fd); } exit(0); } The function csopen (Figure) does the fork and exec of the server, after creating the s-pipe. #include "open.h" #include <sys/uio.h> /* struct iovec */ /* * Open the file by sending the "name" and "oflag" to the * connection server and reading a file descriptor back. */ int csopen(char *name, int oflag) { pid_t pid; int len; char buf[10]; struct iovec iov[3]; static int fd[2] = { -1, -1 }; if (fd[0] < 0) { /* fork/exec our open server first time */ if (s_pipe(fd) < 0) err_sys("s_pipe error"); if ((pid = fork()) < 0) { err_sys("fork error"); } else if (pid == 0) { /* child */ close(fd[0]); if (fd[1] != STDIN_FILENO && dup2(fd[1], STDIN_FILENO) != STDIN_FILENO) err_sys("dup2 error to stdin"); if (fd[1] != STDOUT_FILENO && dup2(fd[1], STDOUT_FILENO) != STDOUT_FILENO) err_sys("dup2 error to stdout"); if (execl("./opend", "opend", (char *)0) < 0) err_sys("execl error"); } close(fd[1]); /* parent */ } sprintf(buf, " %d", oflag); /* oflag to ascii */ iov[0].iov_base = CL_OPEN " "; /* string concatenation */ iov[0].iov_len = strlen(CL_OPEN) + 1; iov[1].iov_base = name; iov[1].iov_len = strlen(name); iov[2].iov_base = buf; iov[2].iov_len = strlen(buf) + 1; /* +1 for null at end of buf */ len = iov[0].iov_len + iov[1].iov_len + iov[2].iov_len; if (writev(fd[0], &iov[0], 3) != len) err_sys("writev error"); /* read descriptor, returned errors handled by write() */ return(recv_fd(fd[0], write)); } The child closes one end of the pipe, and the parent closes the other. For the server that it executes, the child also duplicates its end of the pipe onto its standard input and standard output. (Another option would have been to pass the ASCII representation of the descriptor fd[1] as an argument to the server.) The parent sends to the server the request containing the pathname and open mode. Finally, the parent calls recv_fd to return either the descriptor or an error. If an error is returned by the server, write is called to output the message to standard error. Now let's look at the open server. It is the program opend that is executed by the client in Figure. First, we have the opend.h header (Figure), which includes the standard headers and declares the global variables and function prototypes. #include "apue.h" #include <errno.h> #define CL_OPEN "open" /* client's request for server */ extern char errmsg[]; /* error message string to return to client */ extern int oflag; /* open() flag: O_xxx ... */ extern char *pathname; /* of file to open() for client */ int cli_args(int, char **); void request(char *, int, int); The main function (Figure) reads the requests from the client on the s-pipe (its standard input) and calls the function request. #include "opend.h" char errmsg[MAXLINE]; int oflag; char *pathname; int main(void) { int nread; char buf[MAXLINE]; for ( ; ; ) { /* read arg buffer from client, process request */ if ((nread = read(STDIN_FILENO, buf, MAXLINE)) < 0) err_sys("read error on stream pipe"); else if (nread == 0) break; /* client has closed the stream pipe */ request(buf, nread, STDOUT_FILENO); } exit(0); } The function request in Figure does all the work. It calls the function buf_args to break up the client's request into a standard argv-style argument list and calls the function cli_args to process the client's arguments. If all is OK, open is called to open the file, and then send_fd sends the descriptor back to the client across the s-pipe (its standard output). If an error is encountered, send_err is called to send back an error message, using the clientserver protocol that we described earlier. #include "opend.h" #include <fcntl.h> void request(char *buf, int nread, int fd) { int newfd; if (buf[nread-1] != 0) { sprintf(errmsg, "request not null terminated: %*.*s\n", nread, nread, buf); send_err(fd, -1, errmsg); return; } if (buf_args(buf, cli_args) < 0) { /* parse args & set options */ send_err(fd, -1, errmsg); return; } if ((newfd = open(pathname, oflag)) < 0) { sprintf(errmsg, "can't open %s: %s\n", pathname, strerror(errno)); send_err(fd, -1, errmsg); return; } if (send_fd(fd, newfd) < 0) /* send the descriptor */ err_sys("send_fd error"); close(newfd); /* we're done with descriptor */ } The client's request is a null-terminated string of white-space-separated arguments. The function buf_args in Figure breaks this string into a standard argv-style argument list and calls a user function to process the arguments. We'll use the buf_args function later in this chapter. We use the ISO C function strtok to tokenize the string into separate arguments. #include "apue.h" #define MAXARGC 50 /* max number of arguments in buf */ #define WHITE " \t\n" /* white space for tokenizing arguments */ /* * buf[] contains white-space-separated arguments. We convert it to an * argv-style array of pointers, and call the user's function (optfunc) * to process the array. We return -1 if there's a problem parsing buf, * else we return whatever optfunc() returns. Note that user's buf[] * array is modified (nulls placed after each token). */ int buf_args(char *buf, int (*optfunc)(int, char **)) { char *ptr, *argv[MAXARGC]; int argc; if (strtok(buf, WHITE) == NULL) /* an argv[0] is required */ return(-1); argv[argc = 0] = buf; while ((ptr = strtok(NULL, WHITE)) != NULL) { if (++argc >= MAXARGC-1) /* -1 for room for NULL at end */ return(-1); argv[argc] = ptr; } argv[++argc] = NULL; /* * Since argv[] pointers point into the user's buf[], * user's function can just copy the pointers, even * though argv[] array will disappear on return. */ return((*optfunc)(argc, argv)); } The server's function that is called by buf_args is cli_args (Figure). It verifies that the client sent the right number of arguments and stores the pathname and open mode in global variables. #include "opend.h" /* * This function is called by buf_args(), which is called by * request(). buf_args() has broken up the client's buffer * into an argv[]-style array, which we now process. */ int cli_args(int argc, char **argv) { if (argc != 3 || strcmp(argv[0], CL_OPEN) != 0) { strcpy(errmsg, "usage: <pathname> <oflag>\n"); return(-1); } pathname = argv[1]; /* save ptr to pathname to open */ oflag = atoi(argv[2]); return(0); } This completes the open server that is invoked by a fork and exec from the client. A single s-pipe is created before the fork and is used to communicate between the client and the server. With this arrangement, we have one server per
http://codeidol.com/community/nix/an-open-server-version-1/5124/
CC-MAIN-2017-17
refinedweb
1,630
62.98
If... No, there is no way to fetch by month or for a date range. If you look at the YQL table fantasysports.leagues.scoreboard, you can see the parameters only accept the optional week parameter. This matches the Yahoo! Fantasy Sports API docs (search for 'scoreboard') which shows it can give results for the current week, or another specified week. I think this is because the Yahoo! Fantasy Sports scoreboards are all week-based, regardless of the actual frequency of games for the specific sport. To capture scores by month, you can make several individual calls for each week. YQL Fantasy Hockey - League Standings by Month? - Stack Overflow SELECT url FROM search.web(0,60) WHERE query="stackoverflow" Replace 60 with whatever other number your desire. Max is 500 afaik for the search.web YQL table because that is the limit of Yahoo BOSS which is used in this table. You can also replace the 0 with e.g. 10, to skip the first 10 results. So using search.web(10,60) would still give you 60 results while skipping the first 10. Also see the YQL documentation on remote limits - thats how this search.web(0,60) syntax is called. how to get yahoo search result according to page number in YQL/pipes? ... You can use a region value when querying against the search.web table, like select * from search.web where query="pizza" and region="in" Available region values are listed in the Supported Regions and Languages for Web and News Search page for the Yahoo! BOSS API, which the search.web data table uses. how to get results from Yahoo Ireland or Yahoo India search, using YQL... If... google.customsearch Thanks, but I am looking for something using Google's index. So not really a custom search for my website...unless you know of a way to make custom search work for the entire web? Look at this thread: news.ycombinator.com/item?id=2712386 it seems you can do that with custom search. Using YQL to perform a Google Search - Stack Overflow No, Google does not offer an equivalent to YQL. I wouldn't worry too much about "yahoo" versus "google", but instead see if the tool will help solve what you're trying to do. yahoo - Does Google provide a search like YQL? - Stack Overflow $(function() { function search(term) { var query = 'SELECT title FROM search.web WHERE query="' + term + '"', url = '' + encodeURIComponent(query) + '&format=json&diagnostics=true&callback=cbfunc'; $.get(url, function(data) { $('#searchResults').html(data); }); } $('#search').live('submit', function() { search($('#searchInput').val()); return false; }); }); As you can see, the response data is not JSON - that's why $.getJSON() does not work. For instance, if you search for "cars", you will get this response: cbfunc({"query":{"count":10,"created":"2011-02-21T20:40:16Z","lang":"en-US","diagnostics":{"publiclyCallable":"true","url":{"execution-time":"779","content":""},"user-time":"781","service-time":"779","build-version":"11323"},"results":{"result":[{"title":"New & Used Cars for Sale, Auto Dealers, Car Reviews and Car ..."},{"title":"Cars (Movie)"},{"title":"AutoTrader"},{"title":"New Cars, Used Cars, Blue Book Values & Car Prices - Kelley ..."},{"title":"Automobile - Wikipedia, the free encyclopedia"},{"title":"Car Allowance Rebate System (CARS)"},{"title":"Used Cars - Used Car Prices, Used Car Values & Reviews ..."},{"title":"Edmunds.com"},{"title":"Cars For Sale, Used Cars For Sale, New Cars For Sale ..."},{"title":"Research New Cars & Used Cars : Automobile Prices, Specs ..."}]}}}); Oh, I am sorry I didn't notice that you had already updated it. That fixed the undefined issue, but do you also know how I could display the YQL results? If you are not sure how to solve my YQL issues, I will still accept you answer as the correct one when I am able because you did fix the undefined issue. Thanks for your help @ime Vidas! If you know how I might solve my YQL issues, feel free to let me know! Thanks again! Oh, sorry again that I didn't notice you updated your answer. Thank you for pointing out that it is not JSON. I suppose I will have to try to learn how to extract values from JSONP now. Thanks for all your help @ime Vidas! javascript - Undefined Value Returned for Text Input and Display YQL Q... The only way to retrieve YQL results via client-side JavaScript is JSON-P (or by using an additional proxy). Here's a wrapper for the YQL service: function YQLQuery(query, callback) { this.query = query; this.callback = callback || function(){}; this.fetch = function() { if (!this.query || !this.callback) { throw new Error('YQLQuery.fetch(): Parameters may be undefined'); } var scriptEl = document.createElement('script'), uid = 'yql' + +new Date(), encodedQuery = encodeURIComponent(this.query.toLowerCase()), instance = this; YQLQuery[uid] = function(json) { instance.callback(json); delete YQLQuery[uid]; document.body.removeChild(scriptEl); }; scriptEl.src = '' + encodedQuery + '&format=json&callback=YQLQuery.' + uid; document.body.appendChild(scriptEl); }; } // Construct your query: var query = "select * from rss where url='somefeed.com' limit 1"; // Define your callback: var callback = function(data) { var post = data.query.results.item; alert(post.title); }; // Instantiate with the query: var firstFeedItem = new YQLQuery(query, callback); // If you're ready then go: firstFeedItem.fetch(); // Go!! How could I use tables in datatables.org with this method? javascript - How to use YQL to retrieve web results? - Stack Overflow The 'Truncate' module controls how many results pass through it. The website uses this method to control how many results appear on the page. Yahoo pipes:Using YQL to search a specific string in a website - Stack... I'm not completely sure, but you can use the YQL with Google Image Search Do you have example for that. Or can you describe it a little bit more detailed? json - javascript OCR API - Stack Overflow Following changes with the Yahoo Pipes V2 'upgrade' some YQL tables have been dropped. Thankfully some new ones have appeared but are not widely known about yet. SELECT * FROM microsoft.bing.web WHERE query="pizza india" how to get results from Yahoo Ireland or Yahoo India search, using YQL...? q=select%20*%20from%20html%20where%20url%3D%27https%3A%2F%2F The URL query parts are separated into the following (separated by &): +--------+---------------------------------------------------+ | q | select%20*%20from%20html%20where%20url%3D%27https | | | %3A%2F%2F | +--------+---------------------------------------------------+ | ie | utf-8%27%0A | +--------+---------------------------------------------------+ | format | json | +--------+---------------------------------------------------+ As you can see, YQL is not receiving the full query string as you wanted it to. This is because the & character that should be part of the query string has not been url-encoded to %26. Guice%26ie=utf Aside: There are a few other issues that you are going to face. The first is that the Google search URL embedded into the query is malformed since it will contain a literal space character between Google and Guice, which Google does not accept. Secondly, the URL is restricted by Google's robots.txt so even if the URL is fixed, you won't be able to get any results from there. url - YQL | why I'm getting a syntax error? - Stack Overflow The older Google Search API that the google.search YQL table uses has been deprecated by Google. It's still running, but I think there is a 100 query/day limit. When you see no results in YQL console, it likely means that it's being rate-limited. As an alternative you might try using the newer Google Custom Search API. Note that it's only free up to 100 queries/day, but they offer a paid plan above that. Yeah, I was thinking that also. It just seems terribly inconsistent to return what seems like a valid result that is essentially invalid. YQL Google Search inconsistent results - Stack Overflow See the YQL website itself for this. Search google for YQL and CSS (I can only post one link in here and the 2nd one is more useful.) The example they have there is actually no longer working but you can try out this example, which scrapes the questions from the frontpage of stackoverflow. Multiple Selects with one XPATH: You CAN do this directly with xpath syntax. e.g. SELECT * FROM html WHERE url="" and xpath="//head/meta[@name='title']|//head/meta[@name='description']|//head/meta[@name='keywords']" Thanks, wasn't sure about the syntax but that's cleared it up. Upvoted .. I figured this out myself but wanted to know if I can give a space or something between the result of two xPaths, so that later I could parse the result and get two different values. Sign up for our newsletter and get our top new questions delivered to your inbox (see an example). php - How to use multiple xpath selectors in a YQL query - Stack Overf... Other non-BOSS search APIs such as Web Search, Image Search, News Search, Related Suggestion, and Site Explorer APIs will shut down with no further support in YQL. so, how can I get authenticated to retrieve data/ statuses from twitter? PHP cURL: retrieve search data from yahoo/ google api? - Stack Overflo... public class Movie { public string Year { get; set; } public string Title { get; set; } public string[] Genre { get; set; } } class Program { static void Main(string[] args) { string url = System.Net.WebUtility.UrlDecode("*%20FROM%20html%20WHERE%20url%3D%22http%3A%2F%2Fthemoviedb.org%2Fsearch%2Fmovie%3Fquery%3Dsplit%22%20%20AND%20xpath%3D%27%2F%2Fdiv%5B%40class%3D%22info%22%5D%27&format=json&callback="); HttpClient cl = new HttpClient(); var response = cl.GetStringAsync(url).Result; JObject json = JObject.Parse(response); var movies = new List<Movie>(); foreach (var pchild in json["query"]["results"]["div"]) { // title var title = pchild["p"][0]["a"]["title"]; var titleStr = title != null ? title.Value<string>() : string.Empty; // year var releaseDate = pchild["p"][1]["span"][0]["content"]; string releaseYear = string.Empty; DateTime temp; if (releaseDate != null && DateTime.TryParse(releaseDate.Value<string>(), System.Globalization.CultureInfo.InvariantCulture, DateTimeStyles.None, out temp)) { releaseYear = temp.Year.ToString(); } // genres var genre = pchild["p"][1]["span"][1]["content"]; var genreArr = genre != null ? genre.Value<string>() .Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries) .Select(st => st.Trim()) .ToArray() : new string[0]; movies.Add( new Movie { Title = titleStr, Year = releaseYear, Genre = genreArr }); } // searching for the best match string titleFilter = "Split"; string yearFilter = "2017"; var genreFilter = new string[] { "Drama", "Thriller", "Action" }; var bestMatches = movies .OrderByDescending(m => m.Title == titleFilter) .ThenByDescending(m => m.Year == yearFilter) .ThenByDescending(m => m.Genre.Intersect(genreFilter).Count()); // the best match var bestMatch = bestMatches.First(); Console.WriteLine(bestMatch.Title); Console.WriteLine(bestMatch.Year); Console.WriteLine(string.Join(",", bestMatch.Genre)); // all the movies already ordered //foreach (var movie in bestMatches) //{ // Console.WriteLine(movie.Title); // Console.WriteLine(string.Join(",", movie.Genre)); // Console.WriteLine(movie.Year); // Console.WriteLine(); //} Console.ReadLine(); } string titleFilter = "Split"; string yearFilter = "2017"; var genreFilter = new string[] { "Drama", "Thriller", "Action" }; Split 2017 Drama,Horror,Thriller Note that you may have several movies with the same matches. Input: string titleFilter = "Split"; string yearFilter = "2016"; var genreFilter = new string[] { "Drama", "Thriller", "Action" }; Best matches (you can uncomment the last part of code to see all the movies ordered): Split Fantasy,Drama 2016 Split Drama 2016 hello Pedro, I found a bug on your pattern... if the Json object is exactly one your code crashes. see what I mean with this link - query.yahooapis.com/v1/public/yql?q=SELECT%20*%20FROM%20html%20WHERE%20url%3D'https%3A%2F%2F'%20AND%20xpath%3D'%2F%2Fdiv%5B%40class%3D%22info%22%5D'&format=json&callback= and to get around it you have to remove the for each loop and access the value direct but doing that will only give you one object in a case you have more than one objects. I can not access to this url. I have an Query Syntax error. Can you please verify the url?
https://recalll.co/?q=YQL%20Google%20Search%20inconsistent%20results&type=code
CC-MAIN-2019-18
refinedweb
1,943
58.79
13 March 2012 14:44 [Source: ICIS news] TORONTO (ICIS)--Brazilian mining and metals major Vale plans to build a another sulphuric acid facility at its nickel smelter site in Sudbury, about 400km (250 miles) north of Toronto, a petrochemicals engineering firm said on Tuesday. US-based Jacobs, which won a contract to design and build the project in Canada, said it was part of Vale's strategy to cut sulphur dioxide emissions at ?xml:namespace> Jacobs said its contract is worth about $55m (€42m). It did not disclose the facility's capacity or the expected start-up date. Jacobs was also in charge of work to modernise
http://www.icis.com/Articles/2012/03/13/9541220/vale-to-build-sulphuric-acid-plant-at-canada-smelter.html
CC-MAIN-2015-14
refinedweb
108
59.43
Date::Holidays - Date::Holidays::* adapter and aggregator for all your holiday needs This POD describes version 1.00 of Date::Holidays namenames'], ); Date::Holidays is an adapters exposing a uniform API to a set of dsitributions produceral.: { "20141225" : "" } In order for the calendar to be picked up by Date::Holidays, set the environment variable: $HOLIDAYS_FILE This should point to the JSON file. This is the constructor. It takes the following parameters:"; This is a wrapper around the loaded module's holidays method if this is implemented. If this method is not implemented it tries <countrycode>_holidays. Takes 3 optional named arguments: Not all countries support this parameter Not all countries support this parameter $hashref = $dh->holidays(year => 2007); This method is similar to holidays. It takes one named argument b<year>. The result is a hashref just as for holidays, but instead the names of the holidays are used as keys and the values are DateTime objects. This is yet another wrapper around the loaded module's is_holiday method if this is implemented. Also if this method is not implemented it tries is_<countrycode>_holiday. Takes 6 optional named arguments: This method is similar to is_holiday, but instead of 3 separate arguments it only takes a single argument, a DateTime object. Return 1 for true if the object is a holiday and 0 for false if not. There is no control of the Date::Holidays::* namespace at all, so I am by no means an authority, but this is recommendations on order to make the modules in the Date::Holidays more uniform and thereby more usable. If you want to participate in the effort to make the Date::Holidays::* namespace even more usable, feel free to do so, your feedback and suggestions will be more than welcome. If you want to add your country to the Date::Holidays::* namespace, please feel free to do so. If a module for you country is already present, I am sure the author would not mind patches, suggestions or even help. If however you country does not seem to be represented in the namespace, you are more than welcome to become the author of the module in question. Please note that the country code is expected to be a two letter code based on ISO3166 (or Locale::Country). As an experiment I have added two modules to the namespace, Date::Holidays::Abstract and Date::Holidays::Super, abstract is attempt to make sure that the module implements some, by me, expected methods. So by using abstract your module will not work until it follows the the abstract layed out for a Date::Holidays::* module. Unfortunately the module will only check for the presence of the methods not their prototypes. Date::Holidays::Super is for the lazy programmer, it implements the necessary methods as stubs and there for do not have to implement anything, but your module will not return anything of value. So the methods need to be overwritten in order to comply with the expected output of a Date::Holidays::* method. The methods which are currently interesting in a Date::Holidays::* module are: Takes 3 arguments: year, month, day and returns the name of the holiday as a scalar in the national language of the module context in question. Returns undef if the requested day is not a holiday. Modified example taken from: L<Date::Holidays::DK> use Date::Holidays::DK; my ($year, $month, $day) = (localtime)[ 5, 4, 3 ]; $year += 1900; $month += 1; print "Woohoo" if is_holiday( $year, $month, $day ); #The actual method might not be implemented at this time in the #example module. Same as above. This method however should be a wrapper of the above method (or the other way around). Takes 1 argument: year and returns a hashref containing all of the holidays in specied. This method however should be a wrapper of the above method (or the other way around). Only is_holiday and holidays are implemented in Date::Holidays::Super and are required by Date::Holidays::Abstract. Some countries are divided into regions or similar and might require additional parameters in order to give more exact holiday data. This is handled by adding additional parameters to is_holiday and holidays. These parameters are left to the module authors descretion and the actual Date::Holidays::* module should be consulted. Example Date::Holidays::AU use Date::Holidays::AU qw( is_holiday ); my ($year, $month, $day) = (localtime)[ 5, 4, 3 ]; $year += 1900; $month += 1; my ($state) = 'VIC'; print "Excellent\n" if is_holiday( $year, $month, $day, $state ); If you want to contribute with an adapter, please refer to the documentation in Date::Holidays::Adapter. No country code has been specified. This message is emitted if a given country code cannot be loaded. As mentioned in the section on defining your own calendar. You have to set the environment variable: $HOLIDAYS_FILE This environment variable should point to a JSON file containing holiday definitions to be used by Date::Holidays::Adapter::Local. None known at the moment, please refer to BUGS AND LIMITATIONS and or the specific adapter classes or their respective adaptees. Currently we have an exception for the Date::Holidays::AU module, so the additional parameter of state is defaulting to 'VIC', please refer to the POD for Date::Holidays::AU for documentation on this. Date::Holidays::DE and Date::Holidays::UK does not implement the holidays methods The adaptee module for Date::Holidays::Adapter Test coverage in version 1.00 ---------------------------- ------ ------ ------ ------ ------ ------ ------ File stmt bran cond sub pod time total ---------------------------- ------ ------ ------ ------ ------ ------ ------ lib/Date/Holidays.pm 95.9 77.5 60.0 100.0 100.0 87.0 90.9 lib/Date/Holidays/Adapter.pm 84.2 64.7 44.4 100.0 100.0 12.0 79.2 ...te/Holidays/Adapter/AU.pm 93.1 62.5 n/a 100.0 100.0 0.0 89.1 ...te/Holidays/Adapter/BR.pm 72.7 25.0 n/a 83.3 100.0 0.0 70.5 ...te/Holidays/Adapter/CN.pm 70.8 25.0 n/a 83.3 100.0 0.0 69.4 ...te/Holidays/Adapter/DE.pm 100.0 100.0 n/a 100.0 100.0 0.0 100.0 ...te/Holidays/Adapter/DK.pm 91.6 50.0 n/a 100.0 100.0 0.0 88.8 ...te/Holidays/Adapter/ES.pm 72.7 25.0 n/a 83.3 100.0 0.0 70.5 ...te/Holidays/Adapter/FR.pm 90.9 50.0 n/a 85.7 100.0 0.0 87.8 ...te/Holidays/Adapter/GB.pm 92.3 50.0 n/a 100.0 100.0 0.0 89.4 ...te/Holidays/Adapter/JP.pm 73.5 37.5 n/a 77.7 100.0 0.0 69.8 ...te/Holidays/Adapter/KR.pm 86.3 50.0 n/a 85.7 100.0 0.0 84.8 ...Holidays/Adapter/LOCAL.pm 86.9 50.0 12.5 100.0 100.0 0.3 64.5 ...te/Holidays/Adapter/NO.pm 70.8 25.0 n/a 83.3 100.0 0.0 69.4 ...te/Holidays/Adapter/PL.pm 90.9 50.0 n/a 85.7 100.0 0.0 87.8 ...te/Holidays/Adapter/PT.pm 90.9 50.0 n/a 100.0 100.0 0.0 88.2 Total 87.2 59.2 33.3 93.1 100.0 100.0 81.7 ---------------------------- ------ ------ ------ ------ ------ ------ ------ Jonas B. Nielsen, (jonasbn) - <jonasbn@cpan.org> Date-Holidays and related modules are (C) by Jonas B. Nielsen, (jonasbn) 2004-2014 Date-Holidays and related modules are released under the Artistic License 2.0
http://search.cpan.org/~jonasbn/Date-Holidays-1.00/lib/Date/Holidays.pm
CC-MAIN-2014-52
refinedweb
1,264
54.83