hexsha stringlengths 40 40 | size int64 5 1.05M | ext stringclasses 98
values | lang stringclasses 21
values | max_stars_repo_path stringlengths 3 945 | max_stars_repo_name stringlengths 4 118 | max_stars_repo_head_hexsha stringlengths 40 78 | max_stars_repo_licenses listlengths 1 10 | max_stars_count int64 1 368k ⌀ | max_stars_repo_stars_event_min_datetime stringlengths 24 24 ⌀ | max_stars_repo_stars_event_max_datetime stringlengths 24 24 ⌀ | max_issues_repo_path stringlengths 3 945 | max_issues_repo_name stringlengths 4 118 | max_issues_repo_head_hexsha stringlengths 40 78 | max_issues_repo_licenses listlengths 1 10 | max_issues_count int64 1 134k ⌀ | max_issues_repo_issues_event_min_datetime stringlengths 24 24 ⌀ | max_issues_repo_issues_event_max_datetime stringlengths 24 24 ⌀ | max_forks_repo_path stringlengths 3 945 | max_forks_repo_name stringlengths 4 135 | max_forks_repo_head_hexsha stringlengths 40 78 | max_forks_repo_licenses listlengths 1 10 | max_forks_count int64 1 105k ⌀ | max_forks_repo_forks_event_min_datetime stringlengths 24 24 ⌀ | max_forks_repo_forks_event_max_datetime stringlengths 24 24 ⌀ | content stringlengths 5 1.05M | avg_line_length float64 1 1.03M | max_line_length int64 2 1.03M | alphanum_fraction float64 0 1 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
16bc3e8b225ff006cf35dfa137c5514901cf0e07 | 255 | h | C | YEVideoPlayer/YE_MPViewController.h | muyang00/YEVideoPlayer | b43bf58e099aeb1d466e91454168de9be1e1e2b1 | [
"Apache-2.0"
] | 1 | 2019-03-04T02:55:58.000Z | 2019-03-04T02:55:58.000Z | YEVideoPlayer/YE_MPViewController.h | muyang00/YEVideoPlayer | b43bf58e099aeb1d466e91454168de9be1e1e2b1 | [
"Apache-2.0"
] | null | null | null | YEVideoPlayer/YE_MPViewController.h | muyang00/YEVideoPlayer | b43bf58e099aeb1d466e91454168de9be1e1e2b1 | [
"Apache-2.0"
] | null | null | null | //
// YE_MPViewController.h
// YEVideoPlayer
//
// Created by yongen on 2017/5/17.
// Copyright © 2017年 yongen. All rights reserved.
//
#import <UIKit/UIKit.h>
#import "BaseViewController.h"
@interface YE_MPViewController : BaseViewController
@end
| 17 | 51 | 0.72549 |
c6218757ad081415646c2339dde8833f96066473 | 439 | swift | Swift | Package.swift | BinaryBirds/Sunlight | 6a29064f66271cf10434896712168c1c29e2cc1a | [
"MIT"
] | 20 | 2019-02-13T23:11:46.000Z | 2022-03-27T08:12:52.000Z | Package.swift | BinaryBirds/Sunlight | 6a29064f66271cf10434896712168c1c29e2cc1a | [
"MIT"
] | null | null | null | Package.swift | BinaryBirds/Sunlight | 6a29064f66271cf10434896712168c1c29e2cc1a | [
"MIT"
] | 1 | 2019-10-26T19:53:50.000Z | 2019-10-26T19:53:50.000Z | // swift-tools-version:4.2
import PackageDescription
let package = Package(
name: "Sunlight",
products: [
.library(name: "Sunlight", targets: ["Sunlight"]),
],
dependencies: [
],
targets: [
.target(
name: "Sunlight",
dependencies: [],
path: "./Sources/"),
.testTarget(
name: "SunlightTests",
dependencies: ["Sunlight"]),
]
)
| 19.954545 | 58 | 0.503417 |
992a52fa741f8f9751969d9c3b73ac8e49a918e1 | 1,101 | h | C | Engine/Contents/function/CubeRankingUI.h | openlastchaos/lastchaos-source-client | 3d88594dba7347b1bb45378136605e31f73a8555 | [
"Apache-2.0"
] | 1 | 2022-02-14T15:46:44.000Z | 2022-02-14T15:46:44.000Z | Engine/Contents/function/CubeRankingUI.h | openlastchaos/lastchaos-source-client | 3d88594dba7347b1bb45378136605e31f73a8555 | [
"Apache-2.0"
] | null | null | null | Engine/Contents/function/CubeRankingUI.h | openlastchaos/lastchaos-source-client | 3d88594dba7347b1bb45378136605e31f73a8555 | [
"Apache-2.0"
] | 2 | 2022-01-10T22:17:06.000Z | 2022-01-17T09:34:08.000Z | #ifndef __DEF_CUBERANKING_UI_H__
#define __DEF_CUBERANKING_UI_H__
class CCubeRankingUI : public CUIWindow
{
private:
struct sCubeRank
{
sCubeRank()
{
Init();
}
void Init()
{
nRank = 0;
strGuildName = "";
strChaName = "";
lPoint = 0;
}
BYTE nRank;
CTString strGuildName;
CTString strChaName;
LONG lPoint;
};
enum eRANK_VIEW
{
eRANK_CUR = 0,
eRANK_PREV,
eRANK_MAX
};
CUIBase* m_pGroup[eRANK_MAX];
CUIList* m_pListRank[eRANK_MAX];
CUIText* m_pTextPoint;
CUIText* m_pTextTitle;
LONG m_lMypoint;
sCubeRank m_stCubeRank[eRANK_MAX][5];
BOOL m_bGuild;
void AddRankList(CUIList* list, BYTE rank, LONG point, char* c_name, char* g_name);
void SetTitle(bool bGuild);
public:
CCubeRankingUI();
~CCubeRankingUI();
void initialize();
// Adjust position
void ResetPosition( PIX pixMinI, PIX pixMinJ, PIX pixMaxI, PIX pixMaxJ );
void AdjustPosition( PIX pixMinI, PIX pixMinJ, PIX pixMaxI, PIX pixMaxJ );
void CubeRankInit();
void CubeRankClose();
void CreateCubeState(CNetworkMessage *istr, BOOL bGuild);
};
#endif // __DEF_CUBERANKING_UI_H__ | 19.315789 | 84 | 0.71753 |
f4ddf9297fd9f4a1f4ce6f83c312fb30cfd5fec5 | 9,199 | go | Go | pkg/console/helpers.go | mjsso/console | 036168a57c7e6fe38394e185c01d4091b7930db6 | [
"Apache-2.0"
] | null | null | null | pkg/console/helpers.go | mjsso/console | 036168a57c7e6fe38394e185c01d4091b7930db6 | [
"Apache-2.0"
] | null | null | null | pkg/console/helpers.go | mjsso/console | 036168a57c7e6fe38394e185c01d4091b7930db6 | [
"Apache-2.0"
] | null | null | null | package console
import (
"compress/gzip"
v1 "console/pkg/api/v1"
"console/pkg/auth"
"console/pkg/hypercloud/proxy"
"crypto/tls"
"crypto/x509"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"runtime"
"strings"
oscrypto "github.com/openshift/library-go/pkg/crypto"
// "github.com/openshift/library-go/pkg/crypto"
)
const (
k8sInClusterCA = "/var/run/secrets/kubernetes.io/serviceaccount/ca.crt"
k8sInClusterBearerToken = "/var/run/secrets/kubernetes.io/serviceaccount/token"
K8sEndpoint = "https://kubernetes.default.svc"
// Well-known location of the cluster monitoring (not user workload monitoring) Prometheus service for hypercloud.
// This is only accessible in-cluster. This is used for non-tenant global (alerting) rules requests.
hypercloudPrometheusEndpoint = "http://prometheus-k8s.monitoring.svc:9090/api"
// Well-known location of the tenant aware Thanos service for hypercloud. This is only accessible in-cluster.
// Thanos proxies requests to both cluster monitoring and user workload monitoring prometheus instances.
// hypercloudThanosTenancyEndpoint = "http://prometheus-k8s.monitoring.svc:9090/api"
// Well-known location of the Thanos service for hypercloud. This is only accessible in-cluster.
// This is used for non-tenant global query requests
// proxying to both cluster monitoring and user workload monitoring prometheus instances.
// hypercloudThanosEndpoint = "http://prometheus-k8s.monitoring.svc:9090/api"
// hypercloudThanosEndpoint = ""
// Well-known location of Alert Manager service for hypercloud. This is only accessible in-cluster.
hypercloudAlertManagerEndpoint = "http://alertmanager-main.monitoring.svc:9093/api"
// Well-known location of hypercloud-server for hypercloud. This is only accessible in-clsuter.
hypercloudServerEndpoint = "https://hypercloud5-api-server-service.hypercloud5-system.svc"
// Well-known location of hypercloud-server for hypercloud. This is only accessible in-clsuter. // http port : 80 don't require
multiHypercloudServerEndpoint = "https://hypercloud5-api-server-service.hypercloud5-system.svc"
// webhook for hypercloud. This is only accessible in-clsuter
webhookServerEndpoint = "https://hypercloud5-api-server-service.hypercloud5-system.svc"
// Well-known location of garafana for hypercloud
grafanaEndpoint = "http://grafana.monitoring.svc:3000/api/grafana/"
// Well-known location of kibana for hypercloud
kibanaEndpoint = "http://kibana.kube-logging.svc.cluster.local:5601/api/kibana/"
// Well-known location of kubeflow for hypercloud
kubeflowEndpoint = "http://istio-ingressgateway.istio-system.svc/api/kubeflow/"
)
func createConsole(config *v1.Config) (*Console, error) {
baseURL := &url.URL{}
if config.BaseAddress != "" {
baseURL = validateURL("base-address", config.BaseAddress)
}
baseURL.Path = config.BasePath
if config.PublicDir == "" {
config.PublicDir = "./frontend/public/dist"
}
// Proxy Setting
var (
k8sAuthServiceAccountBearerToken string
k8sURL *url.URL
)
k8sProxyConfig := &proxy.Config{}
k8sClient := &http.Client{}
// Console In Cluster
if config.K8sEndpoint == "" || config.K8sEndpoint == K8sEndpoint {
k8sCertPEM, err := ioutil.ReadFile(k8sInClusterCA)
if err != nil {
log.Fatalf("Error inferring Kubernetes config from environment: %v", err)
}
rootCAs := x509.NewCertPool()
if !rootCAs.AppendCertsFromPEM(k8sCertPEM) {
log.Fatalf("No CA found for the API server")
}
tlsConfig := oscrypto.SecureTLSConfig(&tls.Config{
RootCAs: rootCAs,
})
bearerToken, err := ioutil.ReadFile(k8sInClusterBearerToken)
k8sAuthServiceAccountBearerToken = string(bearerToken)
if err != nil {
log.Fatalf("failed to read bearer token: %v", err)
}
k8sURL = validateURL("k8sEndpoint", K8sEndpoint)
k8sProxyConfig = &proxy.Config{
TLSClientConfig: tlsConfig,
HeaderBlacklist: []string{"Cookie", "X-CSRFToken"},
Endpoint: k8sURL,
Origin: "http://localhost",
}
k8sClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: k8sProxyConfig.TLSClientConfig,
},
}
// Console Off Cluster
} else {
k8sAuthServiceAccountBearerToken = config.ClusterInfo.BearerToken
k8sURL = validateURL("k8sEndpoint", config.K8sEndpoint)
k8sProxyConfig = &proxy.Config{
HeaderBlacklist: []string{"Cookie", "X-CSRFToken"},
TLSClientConfig: oscrypto.SecureTLSConfig(&tls.Config{
InsecureSkipVerify: true,
}),
Endpoint: k8sURL,
Origin: "http://localhost",
}
k8sClient = &http.Client{
Transport: &http.Transport{
TLSClientConfig: k8sProxyConfig.TLSClientConfig,
},
}
}
if config.PrometheusEndpoint == "" {
config.PrometheusEndpoint = hypercloudPrometheusEndpoint
}
if config.AlertmanagerEndpoint == "" {
config.AlertmanagerEndpoint = hypercloudAlertManagerEndpoint
}
if config.HypercloudEndpoint == "" {
config.HypercloudEndpoint = hypercloudServerEndpoint
}
if config.MultiHypercloudEndpoint == "" {
config.MultiHypercloudEndpoint = multiHypercloudServerEndpoint
}
if config.WebhookEndpoint == "" {
config.WebhookEndpoint = webhookServerEndpoint
}
if config.GrafanaEndpoint == "" {
config.GrafanaEndpoint = grafanaEndpoint
}
if config.KialiEndpoint == "" {
config.KialiEndpoint = "https://0.0.0.0/api/kiali"
} // kiali doesn't have any default dns
if config.KibanaEndpoint == "" {
config.KibanaEndpoint = kibanaEndpoint
}
if config.KubeflowEndpoint == "" {
config.KubeflowEndpoint = kubeflowEndpoint
}
return &Console{
BaseURL: baseURL,
PublicDir: config.PublicDir,
StaticUser: &auth.User{
ID: "hypercloud",
Username: "hypercloud",
Token: k8sAuthServiceAccountBearerToken,
},
GOARCH: runtime.GOARCH,
GOOS: runtime.GOOS,
// Branding: config.Branding,
// CustomProductName: config.CustomProductName,
// CustomLogoFile: config.CustomLogoFile,
McMode: config.McMode,
ReleaseModeFlag: config.ReleaseMode,
GitlabURL: config.GitlabURL,
RegistryURL: config.RegistryURL,
KeycloakRealm: config.KeycloakRealm,
KeycloakAuthURL: config.KeycloakAuthURL,
KeycloakClientId: config.KeycloakClientId,
K8sProxyConfig: k8sProxyConfig,
K8sClient: k8sClient,
PrometheusProxyConfig: newProxy(config.PrometheusEndpoint),
// ThanosProxyConfig: newProxy(config.ThanosEndpoint),
// ThanosTenancyProxyConfig: newProxy(config.PrometheusEndpoint),
AlertManagerProxyConfig: newProxy(config.AlertmanagerEndpoint),
GrafanaProxyConfig: newProxy(config.GrafanaEndpoint),
KialiProxyConfig: newProxy(config.KialiEndpoint),
WebhookProxyConfig: newProxy(config.WebhookEndpoint),
HypercloudServerProxyConfig: newProxy(config.HypercloudEndpoint),
MultiHypercloudServerProxyConfig: newProxy(config.MultiHypercloudEndpoint),
KibanaProxyConfig: newProxy(config.KibanaEndpoint),
KubeflowProxyConfig: newProxy(config.KubeflowEndpoint),
}, nil
}
func newProxy(endpoint string) *proxy.Config {
url := validateURL(endpoint, endpoint)
return &proxy.Config{
HeaderBlacklist: []string{"X-CSRFToken"},
// TLSClientConfig: &tls.Config{
// InsecureSkipVerify: true,
// },
TLSClientConfig: oscrypto.SecureTLSConfig(&tls.Config{
InsecureSkipVerify: true,
}),
Endpoint: url,
Origin: "http://localhost",
}
}
func (c *Console) serverError(w http.ResponseWriter, err error) {
http.Error(w, http.StatusText(http.StatusInternalServerError), http.StatusInternalServerError)
}
func singleJoiningSlash(a, b string) string {
aslash := strings.HasSuffix(a, "/")
bslash := strings.HasPrefix(b, "/")
switch {
case aslash && bslash:
return a + b[1:]
case !aslash && !bslash:
return a + "/" + b
}
return a + b
}
type gzipResponseWriter struct {
io.Writer
http.ResponseWriter
sniffDone bool
}
func (w *gzipResponseWriter) Write(b []byte) (int, error) {
if !w.sniffDone {
if w.Header().Get("Content-Type") == "" {
w.Header().Set("Content-Type", http.DetectContentType(b))
}
w.sniffDone = true
}
return w.Writer.Write(b)
}
func gzipHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
w.Header().Add("Vary", "Accept-Encoding")
if !strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
h.ServeHTTP(w, r)
return
}
w.Header().Set("Content-Encoding", "gzip")
gz := gzip.NewWriter(w)
defer gz.Close()
h.ServeHTTP(&gzipResponseWriter{Writer: gz, ResponseWriter: w}, r)
})
}
func validateNotEmpty(name string, value string) string {
if value == "" {
FlagFatalf(name, "value is required")
}
return value
}
func validateURL(name string, value string) *url.URL {
validateNotEmpty(name, value)
ur, err := url.Parse(value)
if err != nil {
FlagFatalf(name, "%v", err)
}
if ur == nil || ur.String() == "" || ur.Scheme == "" || ur.Host == "" {
FlagFatalf(name, "malformed URL")
}
return ur
}
func FlagFatalf(name string, format string, a ...interface{}) {
log.Fatalf("Invalid flag: %s, error: %s", name, fmt.Sprintf(format, a...))
}
//
| 32.736655 | 128 | 0.716926 |
91578d3b824d7db676601f0454d859e06108e55e | 14,324 | html | HTML | assets/archives/www.setera.org/category/mobile/iphone/feed/index.html | csetera/csetera.github.io | 55a706f7a3892e890e17f50c3745e3df2e81b760 | [
"MIT"
] | null | null | null | assets/archives/www.setera.org/category/mobile/iphone/feed/index.html | csetera/csetera.github.io | 55a706f7a3892e890e17f50c3745e3df2e81b760 | [
"MIT"
] | null | null | null | assets/archives/www.setera.org/category/mobile/iphone/feed/index.html | csetera/csetera.github.io | 55a706f7a3892e890e17f50c3745e3df2e81b760 | [
"MIT"
] | null | null | null | <?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:wfw="http://wellformedweb.org/CommentAPI/">
<channel>
<title>
iPhone – Et-Setera
</title>
<atom:link href="https://www.setera.org/category/mobile/iphone/feed/" rel="self" type="application/rss+xml">
</atom:link>
<link/>
https://www.setera.org
<description>
Ramblings of a geek
</description>
<lastbuilddate>
Fri, 15 Nov 2013 00:56:48 +0000
</lastbuilddate>
<language>
en-US
</language>
<sy:updateperiod>
hourly
</sy:updateperiod>
<sy:updatefrequency>
1
</sy:updatefrequency>
<generator>
https://wordpress.org/?v=4.5.24
</generator>
<item>
<title>
More iPhone Versus Java Differences
</title>
<link/>
https://www.setera.org/2010/08/15/more-iphone-versus-java-differences/
<pubdate>
Sun, 15 Aug 2010 18:36:59 +0000
</pubdate>
<dc:creator>
<![CDATA[Craig Setera]]>
</dc:creator>
<category>
<![CDATA[iPhone]]>
</category>
<category>
<![CDATA[Java]]>
</category>
<category>
<![CDATA[Mobile]]>
</category>
<category>
<![CDATA[Software Development]]>
</category>
<category>
<![CDATA[Uncategorized]]>
</category>
<guid ispermalink="false">
https://www.setera.org/?p=264
</guid>
<description>
<![CDATA[In my previous entries, I’ve discussed a few things that caught me off guard while learning iPhone development. In the last couple of weeks, I’ve picked up an Android device to dig into that platform a bit and probably will spend less time playing with iPhone development. Before I move too far away from iPhone, […]]]>
</description>
<content:encoded>
<![CDATA[<p>In my <a href="https://www.setera.org/2010/04/25/iphone-versus-exceptions/">previous</a> <a href="https://www.setera.org/2010/03/07/still-a-geek/">entries</a>, I’ve discussed a few things that caught me off guard while learning iPhone development. In the last couple of weeks, I’ve picked up an Android device to dig into that platform a bit and probably will spend less time playing with iPhone development. Before I move too far away from iPhone, I wanted to wrap up the remaining differences I found interesting between the iPhone and Java platforms.</p>
<p><span id="more-264"></span></p>
<h2>Run Loop Required for Networking</h2>
<p>One of the earliest things I needed to do was build out the networking code for my Daap player. Initially, I was building this code as a standard Macintosh command-line application. I happily wrote code to set up a synchronous networking call using NSURL and NSURLConnection and then… nothing. Unlike Java, it was necessary to have a “run loop” executing. Had I done this test initially on the iPhone emulator, I would have never run across this since the iPhone has a run loop executing the application.</p>
<h2>Subclassing and Class Clusters</h2>
<p>In Java, it is not possible to add functionality to another class. The only real available option is to subclass the class of interest. In general, that works ok until you get a class like java.lang.String that isn’t mean to be subclassed, in which case you need to provide some kind of wrapper or utility class. My first attempt at adding some new functionality to NSMutableDictionary from the Foundation library was using a subclass. I was greeted at runtime by an error similar to:</p>
<p><em>2010-08-14 09:55:48.965 TestProject[1136:207] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘*** -[NSDictionary objectForKey:]: method only defined for abstract class. Define -[MyDictionarySubclass objectForKey:]!’<br />
</em></p>
<p>What the heck? It turns out that most of the collection classes in iPhone are implemented as class clusters. According to the <a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaFundamentals/CocoaObjects/CocoaObjects.html">Cocoa Fundamentals Guide</a> class clusters</p>
<p><em>… group a number of private, concrete subclasses under a public, abstract superclass. The grouping of classes in this way simplifies the publicly visible architecture of an object-oriented framework without reducing its functional richness.</em></p>
<p>Had I really needed to subclass NSMutableDictionary, <a href="http://cocoawithlove.com/2008/12/ordereddictionary-subclassing-cocoa.html">Matt Gallagher talks about how to create such a subclass</a>. In my case, it turns out what I really needed was just an Objective-C category to add methods to NSMutableDictionary directly rather than subclassing the class. Categories remind me of similar functionality available in Smalltalk, allowing additional methods to be attached to classes. The class “shape” (instance variables) cannot be changed using categories, but new methods can be added which is very helpful for creating utility methods on a specific class rather than having to do it on a separate class. Looking around the documentation for the various frameworks in the system, it is amazing to see how many classes are extended using categories.</p>
<h2>Summary</h2>
<p>Although my Daap player is nowhere near complete, the project did offer me plenty of visibility into Objective-C and iPhone development. Objective-C and, in particular, the various libraries for iPhone development are incredibly powerful. While there were a few growing pains along the way, the transition to doing iPhone development was relatively straightforward and enjoyable.</p>
]]>
</content:encoded>
</item>
<item>
<title>
iPhone Versus Exceptions
</title>
<link/>
https://www.setera.org/2010/04/25/iphone-versus-exceptions/
<pubdate>
Mon, 26 Apr 2010 00:55:15 +0000
</pubdate>
<dc:creator>
<![CDATA[Craig Setera]]>
</dc:creator>
<category>
<![CDATA[iPhone]]>
</category>
<category>
<![CDATA[Java]]>
</category>
<category>
<![CDATA[Mobile]]>
</category>
<category>
<![CDATA[Software Development]]>
</category>
<guid ispermalink="false">
https://www.setera.org/?p=249
</guid>
<description>
<![CDATA[I’m continuing to make slow forward progress with my DAAP-based music player for the iPhone. My most recent changes have taken this in the direction of being much more like the standard music player functionality on the iPhone. In particular, I’ve switched over to using a tab view controller for the major perspectives of viewing […]]]>
</description>
<content:encoded>
<![CDATA[<p>I’m continuing to make slow forward progress with my DAAP-based music player for the iPhone. My most recent changes have taken this in the direction of being much more like the standard music player functionality on the iPhone. In particular, I’ve switched over to using a tab view controller for the major perspectives of viewing the music database.</p>
<p><span id="more-249"></span></p>
<div id="attachment_250" style="width: 424px" class="wp-caption aligncenter"><a href="https://www.setera.org/wp-content/uploads/2010/04/mainscreen.png"><img class="size-full wp-image-250" title="Tab Based Main View" src="https://www.setera.org/wp-content/uploads/2010/04/mainscreen.png" alt="" width="414" height="770" srcset="https://www.setera.org/wp-content/uploads/2010/04/mainscreen.png 414w, https://www.setera.org/wp-content/uploads/2010/04/mainscreen-161x300.png 161w" sizes="(max-width: 414px) 100vw, 414px" /></a><p class="wp-caption-text">Tab Based Main View</p></div>
<p>In addition, there is now a (very) rudimentary <em>Now Playing</em> screen to control playback.</p>
<div id="attachment_251" style="width: 424px" class="wp-caption aligncenter"><a href="https://www.setera.org/wp-content/uploads/2010/04/nowplaying.png"><img class="size-full wp-image-251" title="Now Playing View" src="https://www.setera.org/wp-content/uploads/2010/04/nowplaying.png" alt="Now Playing View" width="414" height="770" srcset="https://www.setera.org/wp-content/uploads/2010/04/nowplaying.png 414w, https://www.setera.org/wp-content/uploads/2010/04/nowplaying-161x300.png 161w" sizes="(max-width: 414px) 100vw, 414px" /></a><p class="wp-caption-text">Now Playing View</p></div>
<h2>iPhone Versus Exceptions</h2>
<p>In my <a href="https://www.setera.org/2010/03/07/still-a-geek/">last entry</a>, I mentioned that I’ve struggled through some interesting differences when dealing with iPhone development when compared to my years of experience in Java. As a long time Java developer, I’m very accustomed to the use of checked exceptions. Most, if not all, error handling in Java is handled through the creation, throwing and catching of exceptions. I’m accustomed to catching/handling exceptions from the underlying libraries as well as creating and throwing my own exceptions. It was with that background that I approached iPhone development and quickly found out that is not the recommended way of handling error conditions. While, the standard try/catch functionality is supported in Objective-C, the documentation for Cocoa development makes it clear that using exceptions should be avoided:</p>
<p><em><strong>Important</strong>: You should reserve the use of exceptions for programming or unexpected runtime errors such as out-of-bounds collection access, attempts to mutate immutable objects, sending an invalid message, and losing the connection to the window server. You usually take care of these sorts of errors with exceptions when an application is being created rather than at runtime.</em></p>
<p><em>Instead of exceptions, error objects (NSError) and the Cocoa error-delivery mechanism are the recommended way to communicate expected errors in Cocoa applications. </em></p>
<p>This is an important difference to understand when transitioning to Cocoa development from Java development. While this is important to understand when making calls to library methods and functions, it must also be considered when defining your own calling conventions and libraries. In order to remain consistent, it is important to use the pattern of NSError usage.</p>
]]>
</content:encoded>
</item>
<item>
<title>
Still A Geek…
</title>
<link/>
https://www.setera.org/2010/03/07/still-a-geek/
<pubdate>
Mon, 08 Mar 2010 00:38:01 +0000
</pubdate>
<dc:creator>
<![CDATA[Craig Setera]]>
</dc:creator>
<category>
<![CDATA[iPhone]]>
</category>
<category>
<![CDATA[Miscellaneous]]>
</category>
<guid ispermalink="false">
https://www.setera.org/?p=228
</guid>
<description>
<![CDATA[Looking back to my last post way back in October it is pretty clear when things started getting crazy at work. The team survived and managed to finish another awesome version of mFoundry’s mBanking product. These days I’m doing more management and less coding, but I’m definitely still a geek. Given that iPhone applications are […]]]>
</description>
<content:encoded>
<![CDATA[<p>Looking back to my last post<strong><em> <a href="https://www.setera.org/2009/10/17/once-a-geek/">way back in October</a> </em></strong>it is pretty clear when things started getting crazy at work. The team survived and managed to finish another awesome version of <a href="http://www.mfoundry.com">mFoundry’s</a> <a href="http://www.mfoundry.com/mbanking_overview.html">mBanking</a> product. These days I’m doing more management and less coding, but I’m definitely still a geek. Given that iPhone applications are all the rage in the industry, I’ve been trying to learn my way around iPhone development. During the process of learning, I’ve noticed a few things that have caught me off guard compared to Java. I hope to post a few of those things in the days and weeks to come that may help other Java programmers. In the meantime, I thought I would share some about the project I’ve been playing with to learn.</p>
<p><span id="more-228"></span></p>
<h3>The Project</h3>
<p>In order to learn a new platform, I always like to have a project to build. Looking around, I didn’t find any iPhone <a href="http://en.wikipedia.org/wiki/Digital_Audio_Access_Protocol">DAAP</a> clients for servers like the <a href="http://www.fireflymediaserver.org/">Firefly Media Server</a>. I’ve been trying to build a DAAP client as my learning experience. I have a good chunk of the navigation working at this point.</p>
<div id="attachment_236" style="width: 217px" class="wp-caption aligncenter"><a href="https://www.setera.org/wp-content/uploads/2010/03/player1.png"><img class="size-full wp-image-236" title="DAAP Player" src="https://www.setera.org/wp-content/uploads/2010/03/player1.png" alt="" width="207" height="385" /></a><p class="wp-caption-text">DAAP Player</p></div>
<p>The <a href="http://developer.apple.com/iphone/library/documentation/DataManagement/Conceptual/iPhoneCoreData01/Introduction/Introduction.html">iPhone Core Data support</a> is amazingly powerful, providing a good chunk of the underlying data source support for table views like those in the client.</p>
<div id="attachment_241" style="width: 217px" class="wp-caption aligncenter"><a href="https://www.setera.org/wp-content/uploads/2010/03/player2.png"><img class="size-full wp-image-241" title="DAAP Albums" src="https://www.setera.org/wp-content/uploads/2010/03/player2.png" alt="" width="207" height="385" srcset="https://www.setera.org/wp-content/uploads/2010/03/player2.png 207w, https://www.setera.org/wp-content/uploads/2010/03/player2-161x300.png 161w" sizes="(max-width: 207px) 100vw, 207px" /></a><p class="wp-caption-text">DAAP Albums</p></div>
<p>There is still much to be done, but the iPhone SDK has provided a large amount of functionality for a very small price. As always, I continue to be impressed with the power packed into modern handsets.</p>
]]>
</content:encoded>
</item>
</channel>
</rss>
| 88.968944 | 974 | 0.740645 |
a07cdd152fddaa8391dd1623107be81baeaddb49 | 1,178 | sql | SQL | src/main/resources/schema.sql | HamidurRahman1/Spring-Security | 624d7a616e068c89186aa2e00964974d122d924a | [
"MIT"
] | 2 | 2021-07-11T15:54:58.000Z | 2021-09-09T10:53:18.000Z | src/main/resources/schema.sql | HamidurRahman1/Spring-Security | 624d7a616e068c89186aa2e00964974d122d924a | [
"MIT"
] | 1 | 2022-01-21T23:43:21.000Z | 2022-01-21T23:43:21.000Z | src/main/resources/schema.sql | HamidurRahman1/Spring-Security | 624d7a616e068c89186aa2e00964974d122d924a | [
"MIT"
] | 1 | 2021-06-02T23:26:23.000Z | 2021-06-02T23:26:23.000Z | create table users
(
user_id int primary key auto_increment,
first_name varchar(50) not null,
last_name varchar(50) not null,
username varchar(60) unique not null,
password varchar(70) not null,
enabled tinyint not null
);
create table roles
(
role_id int primary key auto_increment,
role varchar(15) unique not null
);
create table users_roles
(
user_id int not null,
role_id int not null,
primary key(user_id, role_id),
foreign key (user_id) references users(user_id),
foreign key (role_id) references roles(role_id)
);
create table articles
(
article_id int primary key auto_increment,
title varchar(1000) not null,
body varchar(10000) not null,
timestamp varchar (50) not null,
is_published tinyint not null
);
create table authors_articles
(
user_id int not null,
article_id int not null,
primary key(user_id, article_id),
foreign key (user_id) references users(user_id),
foreign key (article_id) references articles(article_id)
);
create table comments
(
comment_id int primary key auto_increment,
comment varchar(250) not null,
article_id int not null,
foreign key (article_id) references articles(article_id)
); | 23.56 | 58 | 0.754669 |
35aa02f5579dcad7834ecd6e727dc540ee04a2bd | 5,217 | swift | Swift | Hipstapaper/Stylize/MDL.swift | jeffreybergier/Hipstapaper | 7c7a38b71450017273337700513c043835bfe2c6 | [
"MIT"
] | 40 | 2016-12-21T15:42:50.000Z | 2022-03-29T16:15:45.000Z | Hipstapaper/Stylize/MDL.swift | jeffreybergier/Hipstapaper | 7c7a38b71450017273337700513c043835bfe2c6 | [
"MIT"
] | 9 | 2018-07-07T06:01:27.000Z | 2021-03-20T02:55:59.000Z | Hipstapaper/Stylize/MDL.swift | jeffreybergier/Hipstapaper | 7c7a38b71450017273337700513c043835bfe2c6 | [
"MIT"
] | 4 | 2019-08-17T11:02:59.000Z | 2022-03-22T18:01:44.000Z | //
// Created by Jeffrey Bergier on 2020/12/27.
//
// MIT License
//
// Copyright (c) 2021 Jeffrey Bergier
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in all
// copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
// SOFTWARE.
//
import SwiftUI
import Localize
extension STZ {
public enum MDL { }
}
extension STZ.MDL {
public struct Done: ViewModifier {
public let kind: Presentable.Type
public let doneAction: Action
public init(kind: Presentable.Type, done: @escaping Action) {
self.kind = kind
self.doneAction = done
}
#if os(macOS)
// TODO: Remove this once its not broken on the mac
public func body(content: Content) -> some View {
return VStack(spacing: 0) {
HStack {
Spacer()
STZ.VIEW.TXT(self.kind.noun.rawValue)
.modifier(STZ.FNT.MDL.Title.apply())
.modifier(STZ.CLR.MDL.Title.foreground())
Spacer()
STZ.BTN.Done.button(doneStyle: true, action: self.doneAction)
}
.modifier(STZ.VIEW.TB_HACK())
content
Spacer(minLength: 0)
}
}
#else
public func body(content: Content) -> some View {
return NavigationView {
content
.navigationBarTitle(self.kind.verb.rawValue, displayMode: .inline)
.toolbar(id: "Modal.Done") {
ToolbarItem(id: "Modal.Done.0", placement: .confirmationAction) {
STZ.BTN.Done.button(doneStyle: true, action: self.doneAction)
}
}
}.navigationViewStyle(StackNavigationViewStyle())
}
#endif
}
}
extension STZ.MDL {
public struct Save: ViewModifier {
public typealias CanSave = () -> Bool
public let kind: Presentable.Type
public let saveAction: Action
public let cancelAction: Action
public let canSave: CanSave
public init(kind: Presentable.Type,
cancel: @escaping Action,
save: @escaping Action,
canSave: CanSave?)
{
self.kind = kind
self.cancelAction = cancel
self.saveAction = save
self.canSave = canSave ?? { true }
}
#if os(macOS)
// TODO: Remove this once its not broken on the mac
public func body(content: Content) -> some View {
return VStack(spacing: 0) {
HStack {
STZ.BTN.Cancel.button(action: self.cancelAction)
Spacer()
STZ.VIEW.TXT(self.kind.noun.rawValue)
.modifier(STZ.FNT.MDL.Title.apply())
.modifier(STZ.CLR.MDL.Title.foreground())
Spacer()
STZ.BTN.Save.button(doneStyle: true,
isEnabled: self.canSave(),
action: self.saveAction)
}
.modifier(STZ.VIEW.TB_HACK())
content
Spacer(minLength: 0)
}
}
#else
public func body(content: Content) -> some View {
return NavigationView {
content
.navigationBarTitle(self.kind.verb.rawValue, displayMode: .inline)
.toolbar(id: "Modal.Save") {
ToolbarItem(id: "Modal.Save.0", placement: .cancellationAction) {
STZ.BTN.Cancel.button(action: self.cancelAction)
}
ToolbarItem(id: "Modal.Save.1", placement: .confirmationAction) {
STZ.BTN.Save.button(doneStyle: true,
isEnabled: self.canSave(),
action: self.saveAction)
}
}
}.navigationViewStyle(StackNavigationViewStyle())
}
#endif
}
}
| 38.932836 | 89 | 0.536899 |
3d316a4ce5ddb37cfe13896e7068297039588746 | 523 | asm | Assembly | oeis/176/A176108.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/176/A176108.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/176/A176108.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A176108: Decimal expansion of (9+sqrt(93))/6.
; Submitted by Christian Krause
; 3,1,0,7,2,7,5,1,2,6,8,3,2,1,5,9,1,6,5,9,6,0,0,0,5,1,7,4,5,7,2,1,1,0,5,3,0,6,5,1,1,5,0,6,1,5,5,1,0,5,4,2,0,6,7,8,8,3,3,6,2,8,1,4,6,2,1,8,8,1,0,6,9,7,7,8,1,0,8,2,8,7,1,5,0,0,0,9,1,1,8,2,1,5,6,0,1,4,3,1
mov $2,1
mov $3,$0
mul $3,4
mov $5,1
lpb $3
add $1,$2
add $5,$2
add $1,$5
mov $2,2
add $2,$1
mul $1,2
add $2,$1
mul $1,2
sub $3,1
lpe
mov $1,1
add $1,$5
add $1,1
mov $4,10
pow $4,$0
div $2,$4
div $1,$2
mov $0,$1
mod $0,10
| 18.034483 | 201 | 0.531549 |
4769b413b2ffcfe9873d07dbd9de25f4a4fd5c55 | 804 | html | HTML | src/pages/map/map.html | imrankhanjoya/iconic-app1 | b90ab15e4c7da7ccbc0729e581cb4f8c0122dedf | [
"MIT"
] | null | null | null | src/pages/map/map.html | imrankhanjoya/iconic-app1 | b90ab15e4c7da7ccbc0729e581cb4f8c0122dedf | [
"MIT"
] | null | null | null | src/pages/map/map.html | imrankhanjoya/iconic-app1 | b90ab15e4c7da7ccbc0729e581cb4f8c0122dedf | [
"MIT"
] | null | null | null | <ion-header no-border>
<ion-toolbar color="fulldark">
<button ion-button menuToggle>
<ion-icon name="people"></ion-icon>
</button>
<ion-buttons end>
<button ion-button icon-only color="royal" (click)="gotoSearchProduct()">
<img src="assets/img/agri bolo icon/hdpi/wallet.png">
</button>
</ion-buttons>
<ion-title>hello Ramesh</ion-title>
<ion-buttons end>
<button ion-button icon-only color="royal" (click)="presentPopover($event)">
<img src="assets/img/agri bolo icon/hdpi/notification.png">
</button>
</ion-buttons>
<ion-buttons end>
<button ion-button icon-only color="royal" (click)="presentPopover($event)">
<img src="assets/img/agri bolo icon/hdpi/Fill 31 + Fill 32 + Fill 33.png">
</button>
</ion-buttons>
</ion-toolbar>
</ion-header>
<ion-content>
<div #map id="map"></div>
</ion-content> | 28.714286 | 76 | 0.707711 |
620f27cf9e5e52d8a2e4b81c7e53761d89bc1e4d | 424 | swift | Swift | Tests/LeetCodeTests/2029 Stone Game IX/StoneGameIXSpec.swift | szwathub/LeetCode.swift | a15c8dc27cc3a23db61ff3034f5891f13ed4fffe | [
"MIT"
] | null | null | null | Tests/LeetCodeTests/2029 Stone Game IX/StoneGameIXSpec.swift | szwathub/LeetCode.swift | a15c8dc27cc3a23db61ff3034f5891f13ed4fffe | [
"MIT"
] | 204 | 2021-10-30T06:16:59.000Z | 2022-03-31T11:57:08.000Z | Tests/LeetCodeTests/2029 Stone Game IX/StoneGameIXSpec.swift | szwathub/LeetCode.swift | a15c8dc27cc3a23db61ff3034f5891f13ed4fffe | [
"MIT"
] | null | null | null | import XCTest
@testable import LeetCode
final class StoneGameIXSpec: XCTestCase {
fileprivate let questions: [(([Int]), Bool)] = [
(([2, 1]), true),
(([2]), false),
(([5, 1, 2, 4, 3]), false)
]
func testStoneGameIX() {
let solution = StoneGameIX()
for ((stones), answer) in questions {
XCTAssertEqual(solution.stoneGameIX(stones), answer)
}
}
}
| 22.315789 | 64 | 0.549528 |
12c28be9cf00f5f600fc2472063e1bb5bfcae067 | 517 | html | HTML | distribution/src/main/release/remote/docs/index.html | msfm/infinispan | 9a9135d58889747e152ba13a9b34e5a51ab48442 | [
"Apache-2.0"
] | null | null | null | distribution/src/main/release/remote/docs/index.html | msfm/infinispan | 9a9135d58889747e152ba13a9b34e5a51ab48442 | [
"Apache-2.0"
] | null | null | null | distribution/src/main/release/remote/docs/index.html | msfm/infinispan | 9a9135d58889747e152ba13a9b34e5a51ab48442 | [
"Apache-2.0"
] | null | null | null | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html" charset="UTF-8">
<title>${infinispan.brand.name}</title>
<link rel="stylesheet" type="text/css" href="api/stylesheet.css" title="Style">
</head>
<body>
<h1>${infinispan.brand.name} Documentation</h1>
<ul>
<li><a href="api/index.html">API</a> - The public API to use ${infinispan.brand.name} in your application</li>
</ul>
</body>
</html>
| 34.466667 | 110 | 0.688588 |
2f1e1f86b6708f4157b8f21640ff1bf582de60f8 | 5,687 | php | PHP | 1.32.0/var/www/html/indicia/client_helpers/prebuilt_forms/extensions/associations.php | vegetweb/warehouse-docker | 98bb5586818309cb352af449fd64725a227595a3 | [
"Apache-2.0"
] | null | null | null | 1.32.0/var/www/html/indicia/client_helpers/prebuilt_forms/extensions/associations.php | vegetweb/warehouse-docker | 98bb5586818309cb352af449fd64725a227595a3 | [
"Apache-2.0"
] | null | null | null | 1.32.0/var/www/html/indicia/client_helpers/prebuilt_forms/extensions/associations.php | vegetweb/warehouse-docker | 98bb5586818309cb352af449fd64725a227595a3 | [
"Apache-2.0"
] | null | null | null | <?php
/**
* Indicia, the OPAL Online Recording Toolkit.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* any later version.
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
* You should have received a copy of the GNU General Public License
* along with this program. If not, see http://www.gnu.org/licenses/gpl.html.
*
* @package Client
* @subpackage PrebuiltForms
* @author Indicia Team
* @license http://www.gnu.org/licenses/gpl.html GPL 3.0
* @link http://code.google.com/p/indicia/
*/
/**
* Extension class that supplies new controls to support species associations/interactions.
*/
class extension_associations {
/**
* @param $auth
* @param $args
* @param $tabalias
* @param $options Array of options provided as @ parameters in the configuration. The possibilities are:
* * from_grid_id - ID of the species checklist grid containing the species associations are being recorded from.
* * to_grid_id - ID of the species checklist grid containing the species associations are being recorded to.
* * association_type_termlist - Title of a termlist which is available for selection to set the type of
* association. You can alternatively provide association_type_termlist_id if you would prefer to specify
* the ID rather than the title, though this is less portable between staging and live warehouses.
* * association_type - Term from the termlist above which sets the type of association, if only
* one type allowed. This causes the association types select control to be ommitted from the output.
* * part_termlist - as above for parts
* * part
*
* @todo CHECK COMMENT ABOVE COMPLETE AND ACCURATE
*
*
* @param $path
* @return string
*/
public static function input_associations_list($auth, $args, $tabalias, $options, $path) {
if (empty($options['association_type_termlist']) && empty($options['association_type_termlist_id']))
return 'The associations.input_associations_list control requires an association_type_termlist parameter.';
if (empty($options['from_grid_id']) || empty($options['to_grid_id']))
return 'The associations.input_associations_list control requires a from_grid_id and to_grid_id parameter.';
$r = '<button type="button" id="associations-add">Add an association</button>';
self::read_termlist_details($auth, $options);
data_entry_helper::$javascript .= "indiciaData.associationCtrlOptions = " . json_encode($options) . ";\n";
$r .= '<div id="associations-list"></div>';
self::load_existing_data($auth);
return $r;
}
/**
* When editing an existing sample, load the associations data.
*/
private static function load_existing_data($auth) {
if (!empty(data_entry_helper::$entity_to_load['sample:id'])) {
$data = data_entry_helper::get_population_data(array(
'table' => 'occurrence_association',
'extraParams' => $auth['read'] + array('sample_id' => data_entry_helper::$entity_to_load['sample:id'], 'view'=>'detail'),
'caching' => false
));
data_entry_helper::$javascript .= "populate_existing_associations(" . json_encode($data) . ");\n";
}
}
/**
* Populates the options array with the termlist IDs and termlist contents needed for the form controls.
* @param $auth
* @param $options
*/
private static function read_termlist_details($auth, &$options) {
$allRelevantTermlists = array('association_type', 'position', 'part', 'impact');
// check which of all the termlists we have a title for but no ID so we know to convert them
$termlistsToConvert = array();
foreach ($allRelevantTermlists as $termlistToCheck) {
if (!empty($options["{$termlistToCheck}_termlist"]) && empty($options["{$termlistToCheck}_termlist_id"])) {
$termlistsToConvert[] = $options["{$termlistToCheck}_termlist"];
}
}
if (!empty($termlistsToConvert)) {
$termlists = data_entry_helper::get_population_data(array(
'table' => 'termlist',
'extraParams' => $auth['read'] + array(
'query' => json_encode(array(
'in' => array(
'title',
$termlistsToConvert
)
))
)
));
foreach ($termlists as $termlist) {
foreach ($allRelevantTermlists as $termlistToCheck) {
if (!empty($options["{$termlistToCheck}_termlist"]) && $termlist['title']===$options["{$termlistToCheck}_termlist"])
$options["{$termlistToCheck}_termlist_id"] = $termlist['id'];
}
}
}
// now for each termlist, get the term records
foreach ($allRelevantTermlists as $termlistToCheck) {
if (!empty($options["{$termlistToCheck}_termlist_id"])) {
$terms = data_entry_helper::get_population_data(array(
'table' => 'termlists_term',
'extraParams' => $auth['read'] + array(
'view' => 'cache',
'termlist_id' => $options["{$termlistToCheck}_termlist_id"],
'preferred' => 't',
'columns' => 'id,term'
)
));
$termsArray = array();
foreach ($terms as $term) {
$termsArray[$term['id']] = $term['term'];
}
$options["{$termlistToCheck}_terms"] = $termsArray;
}
}
}
} | 43.746154 | 129 | 0.65975 |
98ddfb2b19d4257137cd7a3aea6e66f9e19da8e2 | 323 | html | HTML | src/server/www/src/templates/interview_list_tmpl.html | lutzer/MNKServer | 29f326e243298ebcb3a6a981ce64d7eb627711cc | [
"MIT"
] | 1 | 2017-06-11T15:03:30.000Z | 2017-06-11T15:03:30.000Z | src/server/www/src/templates/interview_list_tmpl.html | lutzer/MNKServer | 29f326e243298ebcb3a6a981ce64d7eb627711cc | [
"MIT"
] | 2 | 2017-05-30T12:53:19.000Z | 2018-02-02T15:59:21.000Z | src/server/www/src/templates/interview_list_tmpl.html | lutzer/MNKServer | 29f326e243298ebcb3a6a981ce64d7eb627711cc | [
"MIT"
] | 2 | 2017-04-24T12:55:58.000Z | 2020-09-08T09:20:39.000Z | <div id="interview-list" class="list-view cards column"></div>
<div class="more-button-div"><a id="load-more-button" class="button hidden" href="#">Load More</a></div>
<div id="fetch-spinner">
<div class="spinner">
<div class="bounce1"></div>
<div class="bounce2"></div>
<div class="bounce3"></div>
</div>
</div> | 35.888889 | 104 | 0.643963 |
874334f4c805d4aa150704304bdd0912ef31e5f8 | 13,828 | html | HTML | docs/util_emoji.js.html | urmommagey/kahoot.js-updated-reupload | 268d71606bc8daf1f1793c42f54799fd3b4d7ed0 | [
"MIT"
] | 7 | 2021-07-29T23:34:07.000Z | 2021-11-17T10:45:44.000Z | docs/util_emoji.js.html | urmommagey/kahoot.js-updated-reupload | 268d71606bc8daf1f1793c42f54799fd3b4d7ed0 | [
"MIT"
] | null | null | null | docs/util_emoji.js.html | urmommagey/kahoot.js-updated-reupload | 268d71606bc8daf1f1793c42f54799fd3b4d7ed0 | [
"MIT"
] | 1 | 2021-06-26T15:48:56.000Z | 2021-06-26T15:48:56.000Z | <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Source: util/emoji.js</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Source: util/emoji.js</h1>
<section>
<article>
<pre class="prettyprint source linenums"><code>/**
* @fileinfo This is regex that matches emojis.
*/
module.exports = /\uD83C\uDFF4\uDB40\uDC67\uDB40\uDC62(?:\uDB40\uDC77\uDB40\uDC6C\uDB40\uDC73|\uDB40\uDC73\uDB40\uDC63\uDB40\uDC74|\uDB40\uDC65\uDB40\uDC6E\uDB40\uDC67)\uDB40\uDC7F|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC68(?:\uD83C\uDFFF\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFE])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83E\uDD1D\u200D\uD83D\uDC68(?:\uD83C[\uDFFC-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D)?\uD83D\uDC68|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67]))|\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D[\uDC68\uDC69])\u200D(?:\uD83D[\uDC66\uDC67])|[\u2695\u2696\u2708]\uFE0F|\uD83D[\uDC66\uDC67]|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708])\uFE0F|\uD83C[\uDFFB-\uDFFF])|\uD83E\uDDD1(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\u200D(?:\uD83E\uDD1D\u200D\uD83E\uDDD1|\uD83C[\uDF3E\uDF73\uDF7C\uDF84\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69(?:\u200D(?:\u2764\uFE0F\u200D(?:\uD83D\uDC8B\u200D(?:\uD83D[\uDC68\uDC69])|\uD83D[\uDC68\uDC69])|\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFF\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFE\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFD\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFC\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD])|\uD83C\uDFFB\u200D(?:\uD83C[\uDF3E\uDF73\uDF7C\uDF93\uDFA4\uDFA8\uDFEB\uDFED]|\uD83D[\uDCBB\uDCBC\uDD27\uDD2C\uDE80\uDE92]|\uD83E[\uDDAF-\uDDB3\uDDBC\uDDBD]))|\uD83D\uDC69\uD83C\uDFFF\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFE])|\uD83D\uDC69\uD83C\uDFFE\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB-\uDFFD\uDFFF])|\uD83D\uDC69\uD83C\uDFFD\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFC\uDFFE\uDFFF])|\uD83D\uDC69\uD83C\uDFFC\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFB\uDFFD-\uDFFF])|\uD83D\uDC69\uD83C\uDFFB\u200D\uD83E\uDD1D\u200D(?:\uD83D[\uDC68\uDC69])(?:\uD83C[\uDFFC-\uDFFF])|\uD83D\uDC69\u200D\uD83D\uDC66\u200D\uD83D\uDC66|\uD83D\uDC69\u200D\uD83D\uDC69\u200D(?:\uD83D[\uDC66\uDC67])|(?:\uD83D\uDC41\uFE0F\u200D\uD83D\uDDE8|\uD83D\uDC69(?:\uD83C\uDFFF\u200D[\u2695\u2696\u2708]|\uD83C\uDFFE\u200D[\u2695\u2696\u2708]|\uD83C\uDFFD\u200D[\u2695\u2696\u2708]|\uD83C\uDFFC\u200D[\u2695\u2696\u2708]|\uD83C\uDFFB\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83C\uDFF3\uFE0F\u200D\u26A7|\uD83E\uDDD1(?:(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2695\u2696\u2708]|\u200D[\u2695\u2696\u2708])|\uD83D\uDC3B\u200D\u2744|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642]|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uFE0F\u200D[\u2640\u2642]|(?:\uD83C[\uDFFB-\uDFFF])\u200D[\u2640\u2642])|\uD83C\uDFF4\u200D\u2620|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E-\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3C-\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDF])\u200D[\u2640\u2642])\uFE0F|\uD83D\uDC69\u200D\uD83D\uDC67\u200D(?:\uD83D[\uDC66\uDC67])|\uD83C\uDFF3\uFE0F\u200D\uD83C\uDF08|\uD83D\uDC69\u200D\uD83D\uDC67|\uD83D\uDC69\u200D\uD83D\uDC66|\uD83D\uDC15\u200D\uD83E\uDDBA|\uD83C\uDDFD\uD83C\uDDF0|\uD83C\uDDF6\uD83C\uDDE6|\uD83C\uDDF4\uD83C\uDDF2|\uD83D\uDC08\u200D\u2B1B|\uD83E\uDDD1(?:\uD83C[\uDFFB-\uDFFF])|\uD83D\uDC69(?:\uD83C[\uDFFB-\uDFFF])|\uD83C\uDDFF(?:\uD83C[\uDDE6\uDDF2\uDDFC])|\uD83C\uDDFE(?:\uD83C[\uDDEA\uDDF9])|\uD83C\uDDFC(?:\uD83C[\uDDEB\uDDF8])|\uD83C\uDDFB(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDEE\uDDF3\uDDFA])|\uD83C\uDDFA(?:\uD83C[\uDDE6\uDDEC\uDDF2\uDDF3\uDDF8\uDDFE\uDDFF])|\uD83C\uDDF9(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDED\uDDEF-\uDDF4\uDDF7\uDDF9\uDDFB\uDDFC\uDDFF])|\uD83C\uDDF8(?:\uD83C[\uDDE6-\uDDEA\uDDEC-\uDDF4\uDDF7-\uDDF9\uDDFB\uDDFD-\uDDFF])|\uD83C\uDDF7(?:\uD83C[\uDDEA\uDDF4\uDDF8\uDDFA\uDDFC])|\uD83C\uDDF5(?:\uD83C[\uDDE6\uDDEA-\uDDED\uDDF0-\uDDF3\uDDF7-\uDDF9\uDDFC\uDDFE])|\uD83C\uDDF3(?:\uD83C[\uDDE6\uDDE8\uDDEA-\uDDEC\uDDEE\uDDF1\uDDF4\uDDF5\uDDF7\uDDFA\uDDFF])|\uD83C\uDDF2(?:\uD83C[\uDDE6\uDDE8-\uDDED\uDDF0-\uDDFF])|\uD83C\uDDF1(?:\uD83C[\uDDE6-\uDDE8\uDDEE\uDDF0\uDDF7-\uDDFB\uDDFE])|\uD83C\uDDF0(?:\uD83C[\uDDEA\uDDEC-\uDDEE\uDDF2\uDDF3\uDDF5\uDDF7\uDDFC\uDDFE\uDDFF])|\uD83C\uDDEF(?:\uD83C[\uDDEA\uDDF2\uDDF4\uDDF5])|\uD83C\uDDEE(?:\uD83C[\uDDE8-\uDDEA\uDDF1-\uDDF4\uDDF6-\uDDF9])|\uD83C\uDDED(?:\uD83C[\uDDF0\uDDF2\uDDF3\uDDF7\uDDF9\uDDFA])|\uD83C\uDDEC(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEE\uDDF1-\uDDF3\uDDF5-\uDDFA\uDDFC\uDDFE])|\uD83C\uDDEB(?:\uD83C[\uDDEE-\uDDF0\uDDF2\uDDF4\uDDF7])|\uD83C\uDDEA(?:\uD83C[\uDDE6\uDDE8\uDDEA\uDDEC\uDDED\uDDF7-\uDDFA])|\uD83C\uDDE9(?:\uD83C[\uDDEA\uDDEC\uDDEF\uDDF0\uDDF2\uDDF4\uDDFF])|\uD83C\uDDE8(?:\uD83C[\uDDE6\uDDE8\uDDE9\uDDEB-\uDDEE\uDDF0-\uDDF5\uDDF7\uDDFA-\uDDFF])|\uD83C\uDDE7(?:\uD83C[\uDDE6\uDDE7\uDDE9-\uDDEF\uDDF1-\uDDF4\uDDF6-\uDDF9\uDDFB\uDDFC\uDDFE\uDDFF])|\uD83C\uDDE6(?:\uD83C[\uDDE8-\uDDEC\uDDEE\uDDF1\uDDF2\uDDF4\uDDF6-\uDDFA\uDDFC\uDDFD\uDDFF])|[#*0-9]\uFE0F\u20E3|(?:\uD83C[\uDFC3\uDFC4\uDFCA]|\uD83D[\uDC6E\uDC70\uDC71\uDC73\uDC77\uDC81\uDC82\uDC86\uDC87\uDE45-\uDE47\uDE4B\uDE4D\uDE4E\uDEA3\uDEB4-\uDEB6]|\uD83E[\uDD26\uDD35\uDD37-\uDD39\uDD3D\uDD3E\uDDB8\uDDB9\uDDCD-\uDDCF\uDDD6-\uDDDD])(?:\uD83C[\uDFFB-\uDFFF])|(?:\u26F9|\uD83C[\uDFCB\uDFCC]|\uD83D\uDD75)(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u261D\u270A-\u270D]|\uD83C[\uDF85\uDFC2\uDFC7]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66\uDC67\uDC6B-\uDC6D\uDC72\uDC74-\uDC76\uDC78\uDC7C\uDC83\uDC85\uDCAA\uDD74\uDD7A\uDD90\uDD95\uDD96\uDE4C\uDE4F\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1C\uDD1E\uDD1F\uDD30-\uDD34\uDD36\uDD77\uDDB5\uDDB6\uDDBB\uDDD2-\uDDD5])(?:\uD83C[\uDFFB-\uDFFF])|(?:[\u231A\u231B\u23E9-\u23EC\u23F0\u23F3\u25FD\u25FE\u2614\u2615\u2648-\u2653\u267F\u2693\u26A1\u26AA\u26AB\u26BD\u26BE\u26C4\u26C5\u26CE\u26D4\u26EA\u26F2\u26F3\u26F5\u26FA\u26FD\u2705\u270A\u270B\u2728\u274C\u274E\u2753-\u2755\u2757\u2795-\u2797\u27B0\u27BF\u2B1B\u2B1C\u2B50\u2B55]|\uD83C[\uDC04\uDCCF\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE1A\uDE2F\uDE32-\uDE36\uDE38-\uDE3A\uDE50\uDE51\uDF00-\uDF20\uDF2D-\uDF35\uDF37-\uDF7C\uDF7E-\uDF93\uDFA0-\uDFCA\uDFCF-\uDFD3\uDFE0-\uDFF0\uDFF4\uDFF8-\uDFFF]|\uD83D[\uDC00-\uDC3E\uDC40\uDC42-\uDCFC\uDCFF-\uDD3D\uDD4B-\uDD4E\uDD50-\uDD67\uDD7A\uDD95\uDD96\uDDA4\uDDFB-\uDE4F\uDE80-\uDEC5\uDECC\uDED0-\uDED2\uDED5-\uDED7\uDEEB\uDEEC\uDEF4-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])|(?:[#*0-9\xA9\xAE\u203C\u2049\u2122\u2139\u2194-\u2199\u21A9\u21AA\u231A\u231B\u2328\u23CF\u23E9-\u23F3\u23F8-\u23FA\u24C2\u25AA\u25AB\u25B6\u25C0\u25FB-\u25FE\u2600-\u2604\u260E\u2611\u2614\u2615\u2618\u261D\u2620\u2622\u2623\u2626\u262A\u262E\u262F\u2638-\u263A\u2640\u2642\u2648-\u2653\u265F\u2660\u2663\u2665\u2666\u2668\u267B\u267E\u267F\u2692-\u2697\u2699\u269B\u269C\u26A0\u26A1\u26A7\u26AA\u26AB\u26B0\u26B1\u26BD\u26BE\u26C4\u26C5\u26C8\u26CE\u26CF\u26D1\u26D3\u26D4\u26E9\u26EA\u26F0-\u26F5\u26F7-\u26FA\u26FD\u2702\u2705\u2708-\u270D\u270F\u2712\u2714\u2716\u271D\u2721\u2728\u2733\u2734\u2744\u2747\u274C\u274E\u2753-\u2755\u2757\u2763\u2764\u2795-\u2797\u27A1\u27B0\u27BF\u2934\u2935\u2B05-\u2B07\u2B1B\u2B1C\u2B50\u2B55\u3030\u303D\u3297\u3299]|\uD83C[\uDC04\uDCCF\uDD70\uDD71\uDD7E\uDD7F\uDD8E\uDD91-\uDD9A\uDDE6-\uDDFF\uDE01\uDE02\uDE1A\uDE2F\uDE32-\uDE3A\uDE50\uDE51\uDF00-\uDF21\uDF24-\uDF93\uDF96\uDF97\uDF99-\uDF9B\uDF9E-\uDFF0\uDFF3-\uDFF5\uDFF7-\uDFFF]|\uD83D[\uDC00-\uDCFD\uDCFF-\uDD3D\uDD49-\uDD4E\uDD50-\uDD67\uDD6F\uDD70\uDD73-\uDD7A\uDD87\uDD8A-\uDD8D\uDD90\uDD95\uDD96\uDDA4\uDDA5\uDDA8\uDDB1\uDDB2\uDDBC\uDDC2-\uDDC4\uDDD1-\uDDD3\uDDDC-\uDDDE\uDDE1\uDDE3\uDDE8\uDDEF\uDDF3\uDDFA-\uDE4F\uDE80-\uDEC5\uDECB-\uDED2\uDED5-\uDED7\uDEE0-\uDEE5\uDEE9\uDEEB\uDEEC\uDEF0\uDEF3-\uDEFC\uDFE0-\uDFEB]|\uD83E[\uDD0C-\uDD3A\uDD3C-\uDD45\uDD47-\uDD78\uDD7A-\uDDCB\uDDCD-\uDDFF\uDE70-\uDE74\uDE78-\uDE7A\uDE80-\uDE86\uDE90-\uDEA8\uDEB0-\uDEB6\uDEC0-\uDEC2\uDED0-\uDED6])\uFE0F|(?:[\u261D\u26F9\u270A-\u270D]|\uD83C[\uDF85\uDFC2-\uDFC4\uDFC7\uDFCA-\uDFCC]|\uD83D[\uDC42\uDC43\uDC46-\uDC50\uDC66-\uDC78\uDC7C\uDC81-\uDC83\uDC85-\uDC87\uDC8F\uDC91\uDCAA\uDD74\uDD75\uDD7A\uDD90\uDD95\uDD96\uDE45-\uDE47\uDE4B-\uDE4F\uDEA3\uDEB4-\uDEB6\uDEC0\uDECC]|\uD83E[\uDD0C\uDD0F\uDD18-\uDD1F\uDD26\uDD30-\uDD39\uDD3C-\uDD3E\uDD77\uDDB5\uDDB6\uDDB8\uDDB9\uDDBB\uDDCD-\uDDCF\uDDD1-\uDDDD])/g;
</code></pre>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Home</a></h2><h3>Namespaces</h3><ul><li><a href="Client_data.html">data</a></li><li><a href="Client_defaults.html">defaults</a></li><li><a href="Client_defaults.modules.html">modules</a></li><li><a href="Client_defaults.options.html">options</a></li><li><a href="Client_defaults.wsproxy.WsProxyReturn.html">WsProxyReturn</a></li><li><a href="Client_quiz.html">quiz</a></li><li><a href="Client_quiz.currentQuestion.html">currentQuestion</a></li><li><a href="LiveEventTimetrack.html">LiveEventTimetrack</a></li><li><a href="Nemesis.html">Nemesis</a></li><li><a href="PointsData.html">PointsData</a></li><li><a href="StreakPoints.html">StreakPoints</a></li></ul><h3>Classes</h3><ul><li><a href="Client.html">Client</a></li></ul><h3>Events</h3><ul><li><a href="Client.html#event:Disconnect">Disconnect</a></li><li><a href="Client.html#event:Feedback">Feedback</a></li><li><a href="Client.html#event:GameReset">GameReset</a></li><li><a href="Client.html#event:Joined">Joined</a></li><li><a href="Client.html#event:NameAccept">NameAccept</a></li><li><a href="Client.html#event:Podium">Podium</a></li><li><a href="Client.html#event:QuestionEnd">QuestionEnd</a></li><li><a href="Client.html#event:QuestionReady">QuestionReady</a></li><li><a href="Client.html#event:QuestionStart">QuestionStart</a></li><li><a href="Client.html#event:QuizEnd">QuizEnd</a></li><li><a href="Client.html#event:QuizStart">QuizStart</a></li><li><a href="Client.html#event:RecoveryData">RecoveryData</a></li><li><a href="Client.html#event:TeamAccept">TeamAccept</a></li><li><a href="Client.html#event:TeamTalk">TeamTalk</a></li><li><a href="Client.html#event:TimeOver">TimeOver</a></li><li><a href="Client.html#event:TwoFactorCorrect">TwoFactorCorrect</a></li><li><a href="Client.html#event:TwoFactorReset">TwoFactorReset</a></li><li><a href="Client.html#event:TwoFactorWrong">TwoFactorWrong</a></li></ul><h3>Global</h3><ul><li><a href="global.html#EventEmitter">EventEmitter</a></li></ul>
</nav>
<br class="clear">
<footer>
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.5</a> on Sun Oct 11 2020 19:45:43 GMT-0700 (Pacific Daylight Time)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>
| 246.928571 | 10,728 | 0.737272 |
cc395a5ff0111007913ea783412e457a1f61b042 | 380 | sql | SQL | target/run/agency_data_pipeline/base/adwords/adwords_stats.sql | analiticaqeresformacion/dbt | cb36ed6d98097cbe60be96522a68b157089dbdbc | [
"MIT"
] | 12 | 2018-07-12T00:00:01.000Z | 2021-06-03T09:46:09.000Z | target/run/agency_data_pipeline/base/adwords/adwords_stats.sql | analiticaqeresformacion/dbt | cb36ed6d98097cbe60be96522a68b157089dbdbc | [
"MIT"
] | null | null | null | target/run/agency_data_pipeline/base/adwords/adwords_stats.sql | analiticaqeresformacion/dbt | cb36ed6d98097cbe60be96522a68b157089dbdbc | [
"MIT"
] | 9 | 2018-07-10T14:40:16.000Z | 2021-11-25T05:19:32.000Z | create or replace table `agency_data_pipeline`.`adwords_stats`
as (
SELECT
cast(day as date) date,
account,
platform,
channel,
url,
campaign,
sum(cost) cost,
sum(impressions) impressions,
sum(clicks) clicks,
sum(conversions) conversions
FROM `adp-apprenticeship`.`agency_data_pipeline`.`adwords_join`
GROUP BY date, account, platform, channel, url, campaign
);
| 20 | 63 | 0.747368 |
dd80e1200618fba92f8dc57828b5155cde751067 | 1,040 | php | PHP | src/mvc/model/actions/order.php | nabab/appui-dashboard | 2443280f689d78010891400519b93960f555dc1c | [
"MIT"
] | 2 | 2019-10-22T02:32:28.000Z | 2020-05-20T08:19:35.000Z | src/mvc/model/actions/order.php | nabab/appui-dashboard | 2443280f689d78010891400519b93960f555dc1c | [
"MIT"
] | null | null | null | src/mvc/model/actions/order.php | nabab/appui-dashboard | 2443280f689d78010891400519b93960f555dc1c | [
"MIT"
] | null | null | null | <?php
/**
* @var bbn\Mvc\Model $model
*/
/*
$res = ['success' => false];
if ( isset($model->data['order']) && is_array($model->data['order']) && defined('BBN_REFERER') ){
if (
($route = $ctrl->getRoute(BBN_REFERER, 'public')) &&
($id_perm = $ctrl->inc->perm->fromPath($route['path']))
){
if ( !$model->inc->pref->userHas($id_perm) ){
$model->inc->pref->add($id_perm, []);
}
$pref = $model->inc->pref->getByOption($id_perm);
if ( $pref ){
$i = 0;
$res['deleted'] = $model->inc->pref->deleteBits($pref['id']);
foreach ( $model->data['order'] as $i => $id ){
$i += (int)$model->inc->pref->addBit($pref['id'], [
'id_option' => $id,
'num' => $i + 1
]);
}
if ( $i ){
$res['success'] = true;
$res['num'] = $i;
}
}
}
}
return $res;
*/
if ( isset($model->data['order']) && is_array($model->data['order']) ){
return ['success' => $model->inc->dashboard->sort($model->data['order'])];
}
return ['success' => false]; | 26.666667 | 97 | 0.491346 |
80c4e10ae0cbeee4e1d8921e4463a415ef5f00a7 | 1,133 | swift | Swift | Tests/SwiftBeanCountParserTests/TestUtils.swift | Nef10/SwiftBeanCountParser | a6f7df3acdae2502576329d9e03d1db9b980fdbf | [
"MIT"
] | null | null | null | Tests/SwiftBeanCountParserTests/TestUtils.swift | Nef10/SwiftBeanCountParser | a6f7df3acdae2502576329d9e03d1db9b980fdbf | [
"MIT"
] | 87 | 2020-05-31T19:32:09.000Z | 2022-03-21T01:17:45.000Z | Tests/SwiftBeanCountParserTests/TestUtils.swift | Nef10/SwiftBeanCountParser | a6f7df3acdae2502576329d9e03d1db9b980fdbf | [
"MIT"
] | null | null | null | //
// TestUtils.swift
// SwiftBeanCountParserTests
//
// Created by Steffen Kötte on 2017-09-02.
// Copyright © 2017 Steffen Kötte. All rights reserved.
//
import Foundation
enum TestUtils {
static let calendar = Calendar.current
static var date20170608: Date = {
var dateComponents = DateComponents()
dateComponents.year = 2_017
dateComponents.month = 6
dateComponents.day = 8
dateComponents.timeZone = TimeZone.current
return calendar.date(from: dateComponents)!
}()
static var date20170609: Date = {
var dateComponents = DateComponents()
dateComponents.year = 2_017
dateComponents.month = 6
dateComponents.day = 9
dateComponents.timeZone = TimeZone.current
return calendar.date(from: dateComponents)!
}()
static var date20170610: Date = {
var dateComponents = DateComponents()
dateComponents.year = 2_017
dateComponents.month = 6
dateComponents.day = 10
dateComponents.timeZone = TimeZone.current
return calendar.date(from: dateComponents)!
}()
}
| 26.348837 | 56 | 0.656664 |
85c10db30bb372de75f578f100e01f20bf5f67db | 4,803 | rs | Rust | 07-rust/stm32f446/stm32f446_pac/src/uart4.rs | aaronhktan/stm32-exploration | dcd7674424cd17b02b85c6b3ce533456d5037d65 | [
"MIT"
] | null | null | null | 07-rust/stm32f446/stm32f446_pac/src/uart4.rs | aaronhktan/stm32-exploration | dcd7674424cd17b02b85c6b3ce533456d5037d65 | [
"MIT"
] | null | null | null | 07-rust/stm32f446/stm32f446_pac/src/uart4.rs | aaronhktan/stm32-exploration | dcd7674424cd17b02b85c6b3ce533456d5037d65 | [
"MIT"
] | null | null | null | #[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Status register"]
pub sr: SR,
#[doc = "0x04 - Data register"]
pub dr: DR,
#[doc = "0x08 - Baud rate register"]
pub brr: BRR,
#[doc = "0x0c - Control register 1"]
pub cr1: CR1,
#[doc = "0x10 - Control register 2"]
pub cr2: CR2,
#[doc = "0x14 - Control register 3"]
pub cr3: CR3,
}
#[doc = "Status register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [sr](sr) module"]
pub type SR = crate::Reg<u32, _SR>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _SR;
#[doc = "`read()` method returns [sr::R](sr::R) reader structure"]
impl crate::Readable for SR {}
#[doc = "`write(|w| ..)` method takes [sr::W](sr::W) writer structure"]
impl crate::Writable for SR {}
#[doc = "Status register"]
pub mod sr;
#[doc = "Data register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [dr](dr) module"]
pub type DR = crate::Reg<u32, _DR>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _DR;
#[doc = "`read()` method returns [dr::R](dr::R) reader structure"]
impl crate::Readable for DR {}
#[doc = "`write(|w| ..)` method takes [dr::W](dr::W) writer structure"]
impl crate::Writable for DR {}
#[doc = "Data register"]
pub mod dr;
#[doc = "Baud rate register\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [brr](brr) module"]
pub type BRR = crate::Reg<u32, _BRR>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _BRR;
#[doc = "`read()` method returns [brr::R](brr::R) reader structure"]
impl crate::Readable for BRR {}
#[doc = "`write(|w| ..)` method takes [brr::W](brr::W) writer structure"]
impl crate::Writable for BRR {}
#[doc = "Baud rate register"]
pub mod brr;
#[doc = "Control register 1\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr1](cr1) module"]
pub type CR1 = crate::Reg<u32, _CR1>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _CR1;
#[doc = "`read()` method returns [cr1::R](cr1::R) reader structure"]
impl crate::Readable for CR1 {}
#[doc = "`write(|w| ..)` method takes [cr1::W](cr1::W) writer structure"]
impl crate::Writable for CR1 {}
#[doc = "Control register 1"]
pub mod cr1;
#[doc = "Control register 2\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr2](cr2) module"]
pub type CR2 = crate::Reg<u32, _CR2>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _CR2;
#[doc = "`read()` method returns [cr2::R](cr2::R) reader structure"]
impl crate::Readable for CR2 {}
#[doc = "`write(|w| ..)` method takes [cr2::W](cr2::W) writer structure"]
impl crate::Writable for CR2 {}
#[doc = "Control register 2"]
pub mod cr2;
#[doc = "Control register 3\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/#read--modify--write-api).\n\nFor information about available fields see [cr3](cr3) module"]
pub type CR3 = crate::Reg<u32, _CR3>;
#[allow(missing_docs)]
#[doc(hidden)]
pub struct _CR3;
#[doc = "`read()` method returns [cr3::R](cr3::R) reader structure"]
impl crate::Readable for CR3 {}
#[doc = "`write(|w| ..)` method takes [cr3::W](cr3::W) writer structure"]
impl crate::Writable for CR3 {}
#[doc = "Control register 3"]
pub mod cr3;
| 57.86747 | 395 | 0.666667 |
865626f297b05f64103a0929d367f56d73288d75 | 46 | asm | Assembly | examples/data.asm | dcpzorg/white-rabbit | be88440b86a993f36b88bfe42b0f01ac1a8d0375 | [
"WTFPL"
] | null | null | null | examples/data.asm | dcpzorg/white-rabbit | be88440b86a993f36b88bfe42b0f01ac1a8d0375 | [
"WTFPL"
] | null | null | null | examples/data.asm | dcpzorg/white-rabbit | be88440b86a993f36b88bfe42b0f01ac1a8d0375 | [
"WTFPL"
] | null | null | null | 4
2a
2a
40
40
4
1
0
0
1
2
0
1
4
64
c8
12c
190
| 2.421053 | 3 | 0.608696 |
bf7c9848401afc29dc803ca20b3d6b92b4d1b3fb | 551 | rs | Rust | src/AtCoder/ABC18x/ABC185/b.rs | burokoron/rust_training | a93b78833a7e929e0a2d81dff604ac71e521825e | [
"MIT"
] | null | null | null | src/AtCoder/ABC18x/ABC185/b.rs | burokoron/rust_training | a93b78833a7e929e0a2d81dff604ac71e521825e | [
"MIT"
] | null | null | null | src/AtCoder/ABC18x/ABC185/b.rs | burokoron/rust_training | a93b78833a7e929e0a2d81dff604ac71e521825e | [
"MIT"
] | null | null | null | use proconio::input;
fn main() {
input! {
n: i64,
m: usize,
t: i64,
ab: [(i64, i64); m],
}
let mut battery = n - ab[0].0;
for i in 0..m {
if battery <= 0 {
break;
}
battery += ab[i].1 - ab[i].0;
if battery > n {
battery = n;
}
if i != m - 1 {
battery -= ab[i+1].0 - ab[i].1;
}
}
battery -= t - ab[m-1].1;
if battery > 0 {
println!("Yes");
}
else {
println!("No");
}
}
| 16.69697 | 43 | 0.346642 |
df7c4ffa983d0dbee9c2989438a33acd84e62ed8 | 486 | sql | SQL | shimazu/documentation/SQL/[11][VIEW]datos_historicos_programados.sql | ANamelessWolf/avalon | e89bbb0fd71f8164185997461d57390c538ac037 | [
"MIT"
] | null | null | null | shimazu/documentation/SQL/[11][VIEW]datos_historicos_programados.sql | ANamelessWolf/avalon | e89bbb0fd71f8164185997461d57390c538ac037 | [
"MIT"
] | null | null | null | shimazu/documentation/SQL/[11][VIEW]datos_historicos_programados.sql | ANamelessWolf/avalon | e89bbb0fd71f8164185997461d57390c538ac037 | [
"MIT"
] | null | null | null | USE `cdmx_obras`;
CREATE OR REPLACE VIEW datos_historicos_programados AS
(SELECT
P.`clv_programa`,
IF(H.`fecha_captura`>=P.`fecha_inicio`, H.`id_captura`, H.id_captura*-1) AS `id`,
H.`fecha_captura`, H.`avance_programado_total`,
H.`avance_fisico_total`,
H.`avance_financiero_total`
FROM
`partidas` AS P,
`historicos` AS H
WHERE
P.`clv_programa` = H.`clv_programa`
GROUP BY `id` HAVING `id`>0 ) | 34.714286 | 90 | 0.609053 |
249ab9272b59cb0d557277f270c02e1bf1e59dad | 175 | dart | Dart | test/generated/service_test_interface.dart | alxhub/streamy-dart | c0ba2304ea7f80d6e96e33a579c9401330838a33 | [
"Apache-2.0"
] | 36 | 2015-01-13T10:10:03.000Z | 2020-06-01T20:11:52.000Z | test/generated/service_test_interface.dart | alxhub/streamy-dart | c0ba2304ea7f80d6e96e33a579c9401330838a33 | [
"Apache-2.0"
] | 19 | 2015-03-06T18:19:58.000Z | 2017-12-04T22:55:11.000Z | test/generated/service_test_interface.dart | alxhub/streamy-dart | c0ba2304ea7f80d6e96e33a579c9401330838a33 | [
"Apache-2.0"
] | 20 | 2015-03-12T02:29:48.000Z | 2021-09-05T09:16:08.000Z | library streamy.test.generated.service.interface;
class Foo {
int id;
String name;
}
class Bar {
int id;
Foo foo;
}
class Service {
Future<Bar> barFor(Foo foo);
} | 11.666667 | 49 | 0.674286 |
6687dd91770665572fc5de5142a51979bbdec197 | 1,314 | kt | Kotlin | layout-inspector/testSrc/com/android/tools/idea/layoutinspector/metrics/MetricsTrackerRule.kt | phpc0de/idea-android | 79e20f027ca1d047b91aa7acd92fb71fa2968a09 | [
"Apache-2.0"
] | null | null | null | layout-inspector/testSrc/com/android/tools/idea/layoutinspector/metrics/MetricsTrackerRule.kt | phpc0de/idea-android | 79e20f027ca1d047b91aa7acd92fb71fa2968a09 | [
"Apache-2.0"
] | null | null | null | layout-inspector/testSrc/com/android/tools/idea/layoutinspector/metrics/MetricsTrackerRule.kt | phpc0de/idea-android | 79e20f027ca1d047b91aa7acd92fb71fa2968a09 | [
"Apache-2.0"
] | null | null | null | /*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.tools.idea.layoutinspector.metrics
import com.android.testutils.VirtualTimeScheduler
import com.android.tools.analytics.TestUsageTracker
import com.android.tools.analytics.UsageTracker
import org.junit.rules.ExternalResource
/**
* Rule that sets up and tears down a [TestUsageTracker]
*
* TODO: move this to a common place
*/
class MetricsTrackerRule(scheduler: VirtualTimeScheduler = VirtualTimeScheduler()) : ExternalResource() {
val testTracker: TestUsageTracker = TestUsageTracker(scheduler)
override fun before() {
UsageTracker.setWriterForTest(testTracker)
}
override fun after() {
testTracker.close()
UsageTracker.cleanAfterTesting()
}
} | 33.692308 | 105 | 0.762557 |
3bdf54bd1398cb0839691f823c77c602485343c0 | 1,076 | h | C | include/il2cpp/System/Predicate_KeyValuePair_UgPokeLottery.TypeAndSize__int__.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | 1 | 2022-01-15T20:20:27.000Z | 2022-01-15T20:20:27.000Z | include/il2cpp/System/Predicate_KeyValuePair_UgPokeLottery.TypeAndSize__int__.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | include/il2cpp/System/Predicate_KeyValuePair_UgPokeLottery.TypeAndSize__int__.h | martmists-gh/BDSP | d6326c5d3ad9697ea65269ed47aa0b63abac2a0a | [
"MIT"
] | null | null | null | #pragma once
#include "il2cpp.h"
void System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int_____ctor (System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int___o* __this, Il2CppObject* object, intptr_t method, const MethodInfo* method_info);
bool System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int____Invoke (System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int___o* __this, System_Collections_Generic_KeyValuePair_UgPokeLottery_TypeAndSize__int__o obj, const MethodInfo* method_info);
System_IAsyncResult_o* System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int____BeginInvoke (System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int___o* __this, System_Collections_Generic_KeyValuePair_UgPokeLottery_TypeAndSize__int__o obj, System_AsyncCallback_o* callback, Il2CppObject* object, const MethodInfo* method_info);
bool System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int____EndInvoke (System_Predicate_KeyValuePair_UgPokeLottery_TypeAndSize__int___o* __this, System_IAsyncResult_o* result, const MethodInfo* method_info);
| 119.555556 | 340 | 0.917286 |
f01636a07a87cf93e98d3a0d5e5e79dd6e4913ce | 1,260 | py | Python | 8/code.py | DeclanOGorman/AdventofCode2021 | 71a25327d5ab1f88124d09ec8ef853610cbff8ef | [
"MIT"
] | null | null | null | 8/code.py | DeclanOGorman/AdventofCode2021 | 71a25327d5ab1f88124d09ec8ef853610cbff8ef | [
"MIT"
] | null | null | null | 8/code.py | DeclanOGorman/AdventofCode2021 | 71a25327d5ab1f88124d09ec8ef853610cbff8ef | [
"MIT"
] | null | null | null | with open('./8/input_a.txt', 'r') as f:
input = [[a.strip().split(' | ')[0].split(' '), a.strip().split(' | ')[1].split(' ')] for a in f]
num = sum([sum([1 if len(a) in {2,3,4,7} else 0 for a in o[1]]) for o in input ])
print(f'Part A: Number of 1,4,7 or 8s in output - {num}')
def getoutput(i):
nums = ['0','1','2','3','4','5','6','7','8','9']
nums[1] = [a for a in i[0] if len(a) == 2][0]
nums[4] = [a for a in i[0] if len(a) == 4][0]
nums[7] = [a for a in i[0] if len(a) == 3][0]
nums[8] = [a for a in i[0] if len(a) == 7][0]
nums[9] = [a for a in i[0] if len(a) == 6 and set(nums[4]).issubset(set(a))][0]
nums[0] = [a for a in i[0] if len(a) == 6 and set(nums[1]).issubset(set(a)) and a not in nums][0]
nums[6] = [a for a in i[0] if len(a) == 6 and a not in nums][0]
nums[3] = [a for a in i[0] if len(a) == 5 and set(nums[1]).issubset(set(a))][0]
nums[5] = [a for a in i[0] if len(a) == 5 and (set(nums[4]) - set(nums[1])).issubset(set(a)) and a not in nums][0]
nums[2] = [a for a in i[0] if len(a) == 5 and a not in nums][0]
return int(''.join([str(nums.index([n for n in nums if set(n) == set(a)][0])) for a in i[1]]))
print(f'Part B: total output sum value - {sum([getoutput(a) for a in input])}') | 57.272727 | 118 | 0.52381 |
e77d76c7ae89f2f5048b5bc53fa33a3e4347ea72 | 519 | js | JavaScript | src/components/contactUs/popup1.js | Alrfati-Hazem/Project-8 | 1940c3023ac94dc7f7fa91cdc42a2d9db8f6b5e5 | [
"MIT"
] | null | null | null | src/components/contactUs/popup1.js | Alrfati-Hazem/Project-8 | 1940c3023ac94dc7f7fa91cdc42a2d9db8f6b5e5 | [
"MIT"
] | null | null | null | src/components/contactUs/popup1.js | Alrfati-Hazem/Project-8 | 1940c3023ac94dc7f7fa91cdc42a2d9db8f6b5e5 | [
"MIT"
] | 1 | 2022-02-20T18:31:19.000Z | 2022-02-20T18:31:19.000Z | import React from "react";
import { useNavigate } from "react-router-dom";
import "./popup1.css";
const Popup1 = (props) => {
const navigate = useNavigate();
return (
<div className="popup-box">
<div className="box">
<h3>
Your message is succesfully sent, we will contact you as soon as
possible!
</h3>
<button className="finalBtn" onClick={() => navigate("/")}>
Back to Home
</button>
</div>
</div>
);
};
export default Popup1;
| 22.565217 | 74 | 0.566474 |
9c5ae19394967c67d864f9d70ab008df93af80fe | 445 | js | JavaScript | src/dream-team.js | KiriaLbk/basic-js | 01304f1463346c62f85623bb6adca8196bf0a2a2 | [
"MIT"
] | null | null | null | src/dream-team.js | KiriaLbk/basic-js | 01304f1463346c62f85623bb6adca8196bf0a2a2 | [
"MIT"
] | null | null | null | src/dream-team.js | KiriaLbk/basic-js | 01304f1463346c62f85623bb6adca8196bf0a2a2 | [
"MIT"
] | null | null | null | module.exports = function createDreamTeam(members) {
if(Array.isArray(members))
{
members=members.filter((item, index, array)=>typeof(array[index])=="string");
for(let count=0;count<members.length;count++)
{
members[count]=members[count].trim();
}
members = members.map((item, index, array)=> array[index][0].toUpperCase()).sort().join('');
}
else
{
members=false;
}
return members;
}; | 27.8125 | 98 | 0.613483 |
66d34fda785d0cc00adc997fe299e15dc7770ac8 | 644 | swift | Swift | Sources/CollectionViewInteractorInput.swift | 0x0c/CompositionalLayoutViewControllerViperExtension | 6b83ea96591a9bd5f58e72f8b303a1cb29390fad | [
"MIT"
] | null | null | null | Sources/CollectionViewInteractorInput.swift | 0x0c/CompositionalLayoutViewControllerViperExtension | 6b83ea96591a9bd5f58e72f8b303a1cb29390fad | [
"MIT"
] | null | null | null | Sources/CollectionViewInteractorInput.swift | 0x0c/CompositionalLayoutViewControllerViperExtension | 6b83ea96591a9bd5f58e72f8b303a1cb29390fad | [
"MIT"
] | null | null | null | //
// CollectionViewInteractorInput.swift
//
//
// Created by Akira Matsuda on 2021/01/14.
//
import CompositionalLayoutViewController
import UIKit
public protocol CollectionViewInteractorInput: AnyObject {
var sections: [CollectionViewSection] { get set }
func store(_ sections: [CollectionViewSection])
func section(for sectionIndex: Int) -> CollectionViewSection
}
public extension CollectionViewInteractorInput {
func store(_ sections: [CollectionViewSection]) {
self.sections = sections
}
func section(for sectionIndex: Int) -> CollectionViewSection {
return sections[sectionIndex]
}
}
| 23.851852 | 66 | 0.734472 |
a9081e3744a08f2865ed35d459c79dec24afb778 | 313 | asm | Assembly | programs/oeis/113/A113763.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 22 | 2018-02-06T19:19:31.000Z | 2022-01-17T21:53:31.000Z | programs/oeis/113/A113763.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 41 | 2021-02-22T19:00:34.000Z | 2021-08-28T10:47:47.000Z | programs/oeis/113/A113763.asm | neoneye/loda | afe9559fb53ee12e3040da54bd6aa47283e0d9ec | [
"Apache-2.0"
] | 5 | 2021-02-24T21:14:16.000Z | 2021-08-09T19:48:05.000Z | ; A113763: Non-multiples of 13, or numbers not divisible by 13.
; 1,2,3,4,5,6,7,8,9,10,11,12,14,15,16,17,18,19,20,21,22,23,24,25,27,28,29,30,31,32,33,34,35,36,37,38,40,41,42,43,44,45,46,47,48,49,50,51,53,54,55,56,57,58,59,60,61,62,63,64,66,67,68,69,70,71,72,73,74,75,76,77
mov $1,$0
div $1,12
add $0,$1
add $0,1
| 39.125 | 208 | 0.651757 |
e9d957c31c75b01ebcbbedcbf62c803dff6c1dc9 | 10,560 | go | Go | script/generate.go | flowcommerce/lib-reference-scala | 10f401130c6fc505a8106bab1466b7e6e990bc32 | [
"MIT"
] | 1 | 2021-01-24T20:56:17.000Z | 2021-01-24T20:56:17.000Z | script/generate.go | flowcommerce/lib-reference-scala | 10f401130c6fc505a8106bab1466b7e6e990bc32 | [
"MIT"
] | 13 | 2017-12-18T13:15:38.000Z | 2021-04-21T17:40:26.000Z | script/generate.go | flowcommerce/lib-reference-scala | 10f401130c6fc505a8106bab1466b7e6e990bc32 | [
"MIT"
] | 1 | 2017-11-04T18:40:07.000Z | 2017-11-04T18:40:07.000Z | /**
* Reads reference data from json files, generated scala libraries
*
* Run using:
* go run generate.go
**/
package main
import (
"bufio"
"fmt"
"github.com/flowcommerce/json-reference/common"
"github.com/flowcommerce/tools/util"
"os"
"regexp"
"strconv"
"strings"
"unicode"
)
const Directory = "src/main/scala/io/flow/reference/data"
type Instance struct {
Name string
Value string
}
func writeFile(objectName string, imports string, instances []Instance) {
path := fmt.Sprintf("%s/%s.scala", Directory, objectName)
fo, err := os.Create(path)
util.ExitIfError(err, fmt.Sprintf("Error creating file %s: %s", path, err))
defer fo.Close()
writer := bufio.NewWriter(fo)
writer.WriteString("package io.flow.reference.data\n\n")
writer.WriteString(fmt.Sprintf("import io.flow.reference.v0.models.%s\n\n", imports))
writer.WriteString(fmt.Sprintf("object %s {\n\n", objectName))
for _, instance := range instances {
writer.WriteString(fmt.Sprintf(" val %s = %s\n", scalaName(instance.Name), instance.Value))
}
writer.WriteString("\n")
writer.WriteString(" val all = Seq(\n ")
for i, instance := range instances {
if i > 0 {
writer.WriteString(",\n ")
}
writer.WriteString(scalaName(instance.Name))
}
writer.WriteString("\n )\n\n}\n")
err = writer.Flush()
util.ExitIfError(err, fmt.Sprintf("Failed to flush file %s: %s", path, err))
fmt.Printf(" ==> %s\n", path)
}
func main() {
processLocales()
processCountries()
processCurrencies()
processLanguages()
processRegions()
processTimezones()
processPaymentMethods()
processProvinces()
processCarriers()
processCarrierServices()
}
func processCarriers() {
instances := []Instance{}
for _, c := range common.Carriers() {
instances = append(instances, Instance{
Name: strings.Replace(c.Id, "-", "_", -1),
Value: fmt.Sprintf("Carrier(id = \"%s\", name = \"%s\", trackingUrl = \"%s\")", c.Id, c.Name, c.TrackingUrl),
})
}
writeFile("Carriers", "Carrier", instances)
}
func processCarrierServices() {
instances := []Instance{}
for _, cs := range common.CarrierServices() {
instances = append(instances, Instance{
Name: strings.Replace(cs.Id, "-", "_", -1),
Value: fmt.Sprintf("CarrierService(id = \"%s\", name = \"%s\", carrier = io.flow.reference.v0.models.Carrier(id = \"%s\", name = \"%s\", trackingUrl = \"%s\"))", cs.Id, cs.Name, cs.Carrier.Id, cs.Carrier.Name, cs.Carrier.TrackingUrl),
})
}
writeFile("CarrierServices", "CarrierService", instances)
}
func processProvinces() {
instances := []Instance{}
for _, p := range common.Provinces() {
// translations is a list of locales with their translated names
var localizedTranslations []string
for _, t := range p.Translations {
l := t.Locale
localizedTranslations = append(
localizedTranslations,
fmt.Sprintf("io.flow.reference.v0.models.LocalizedTranslation(locale = io.flow.reference.v0.models.Locale(id = \"%s\", name = \"%s\", country = \"%s\", language = \"%s\", numbers = io.flow.reference.v0.models.LocaleNumbers(decimal = \"%s\", group = \"%s\")), name = \"%s\")", l.Id, l.Name, l.Country, l.Language, l.Numbers.Decimal, l.Numbers.Group, t.Name),
)
}
translations := strings.Join(localizedTranslations, ", ")
// now create the province and simply add the locale translations
instances = append(instances, Instance{
Name: strings.Replace(p.Id, "-", "_", -1),
Value: fmt.Sprintf("Province(id = \"%s\", iso31662 = \"%s\", name = \"%s\", country = \"%s\", provinceType = io.flow.reference.v0.models.ProvinceType(\"%s\"), translations = Some(Seq(%s)))", p.Id, p.Iso_3166_2, p.Name, p.Country, p.ProvinceType, translations),
})
}
writeFile("Provinces", "Province", instances)
}
func processCountries() {
instances := []Instance{}
for _, c := range common.Countries() {
measurementSystem := c.MeasurementSystem
var defaultCurrency string
if c.DefaultCurrency == "" {
defaultCurrency = "None"
} else {
defaultCurrency = fmt.Sprintf("Some(\"%s\")", c.DefaultCurrency)
}
var defaultLanguage string
if c.DefaultLanguage == "" {
defaultLanguage = "None"
} else {
defaultLanguage = fmt.Sprintf("Some(\"%s\")", c.DefaultLanguage)
}
instances = append(instances, Instance{
Name: c.Iso_3166_3,
Value: fmt.Sprintf("Country(iso31662 = \"%s\", iso31663 = \"%s\", defaultCurrency = %s, defaultLanguage = %s, measurementSystem = \"%s\", name = \"%s\", languages = %s, timezones = %s)", c.Iso_3166_2, c.Iso_3166_3, defaultCurrency, defaultLanguage, measurementSystem, c.Name, scalaArrayQuoted(c.Languages), scalaArrayQuoted(c.Timezones)),
})
}
writeFile("Countries", "Country", instances)
}
func processRegions() {
instances := []Instance{}
for _, r := range common.Regions() {
measurementSystems := []string{}
for _, system := range r.MeasurementSystems {
measurementSystems = append(measurementSystems, system)
}
instances = append(instances, Instance{
Name: r.Name,
Value: fmt.Sprintf("Region(id = \"%s\", name = \"%s\", countries = %s, languages = %s, currencies = %s, measurementSystems = %s, timezones = %s)", r.Id, r.Name, scalaArrayQuoted(r.Countries), scalaArrayQuoted(r.Languages), scalaArrayQuoted(r.Currencies), scalaArrayQuoted(measurementSystems), scalaArrayQuoted(r.Timezones)),
})
}
writeFile("Regions", "Region", instances)
}
func processCurrencies() {
instances := []Instance{}
for _, c := range common.Currencies() {
symbols := "None"
if c.Symbols != nil {
narrow := "None"
if c.Symbols.Narrow != "" {
narrow = fmt.Sprintf("Some(\"%s\")", c.Symbols.Narrow)
}
symbols = fmt.Sprintf("Some(CurrencySymbols(primary = \"%s\", narrow = %s))", c.Symbols.Primary, narrow)
}
defaultLocale := "None"
if c.DefaultLocale != "" {
defaultLocale = fmt.Sprintf("Some(\"%s\")", c.DefaultLocale)
}
instances = append(instances, Instance{
Name: c.Iso_4217_3,
Value: fmt.Sprintf("Currency(iso42173 = \"%s\", name = \"%s\", numberDecimals = %v, defaultLocale = %s, symbols = %s)", c.Iso_4217_3, c.Name, c.NumberDecimals, defaultLocale, symbols),
})
}
writeFile("Currencies", "{Currency, CurrencySymbols}", instances)
}
func processLanguages() {
instances := []Instance{}
for _, l := range common.Languages() {
instances = append(instances, Instance{
Name: l.Iso_639_2,
Value: fmt.Sprintf("Language(iso6392 = \"%s\", name = \"%s\")", l.Iso_639_2, l.Name),
})
}
writeFile("Languages", "Language", instances)
}
func processLocales() {
instances := []Instance{}
for _, l := range common.Locales() {
instances = append(instances, Instance{
Name: formatLocaleIdForName(l.Id),
Value: fmt.Sprintf("Locale(id = \"%s\", name = \"%s\", country = \"%s\", language = \"%s\", numbers = LocaleNumbers(decimal = \"%s\", group = \"%s\"))", l.Id, l.Name, l.Country, l.Language, l.Numbers.Decimal, l.Numbers.Group),
})
}
writeFile("Locales", "{Locale, LocaleNumbers}", instances)
}
func processTimezones() {
instances := []Instance{}
for _, t := range common.Timezones() {
instances = append(instances, Instance{
Name: t.Name,
Value: fmt.Sprintf("Timezone(name = \"%s\", offset = %d, description = \"%s\")", t.Name, t.Offset, t.Description),
})
}
writeFile("Timezones", "Timezone", instances)
}
func processPaymentMethods() {
instances := []Instance{}
for _, pm := range common.PaymentMethods() {
var typ string
if pm.Type == "card" {
typ = "PaymentMethodType.Card"
} else if pm.Type == "online" {
typ = "PaymentMethodType.Online"
} else if pm.Type == "offline" {
typ = "PaymentMethodType.Offline"
} else {
fmt.Printf("ERROR: Unknown PaymentMethodType[%s]\n", pm.Type)
os.Exit(1)
}
// capabilities is a list of strings
var capabilities []string
for _, cap := range pm.Capabilities {
var c string
if cap == "credit" {
c = "PaymentMethodCapability.Credit"
} else if cap == "debit" {
c = "PaymentMethodCapability.Debit"
} else {
fmt.Printf("ERROR: Unknown PaymentMethodCapability[%s]\n", cap)
os.Exit(1)
}
capabilities = append(
capabilities,
c,
)
}
divider := "\n "
images := fmt.Sprintf("PaymentMethodImages(%s small = %s,%s medium = %s,%s large = %s%s)", divider, toImage(pm.Images.Small), divider, toImage(pm.Images.Medium), divider, toImage(pm.Images.Large), divider)
instances = append(instances, Instance{
Name: pm.Id,
Value: fmt.Sprintf("PaymentMethod(id = \"%s\", `type` = %s, name = \"%s\", images = %s, regions = %s, capabilities = Some(%s))", pm.Id, typ, pm.Name, images, scalaArrayQuoted(pm.Regions), scalaArrayUnquoted(capabilities)),
})
}
writeFile("PaymentMethods", "{PaymentMethod, PaymentMethodImage, PaymentMethodImages, PaymentMethodType, PaymentMethodCapability}", instances)
}
func toImage(i common.PaymentMethodImage) string {
return fmt.Sprintf("PaymentMethodImage(url = \"%s\", width = %s, height = %s)", i.Url, strconv.Itoa(i.Width), strconv.Itoa(i.Height))
}
func scalaArrayQuoted(values []string) string {
value := ""
for i, v := range values {
if i > 0 {
value = value + ", "
}
value = value + fmt.Sprintf("\"%s\"", v)
}
if value == "" {
return "Nil"
} else {
return "Seq(" + value + ")"
}
}
func scalaArrayUnquoted(values []string) string {
value := ""
for i, v := range values {
if i > 0 {
value = value + ", "
}
value = value + v
}
if value == "" {
return "Nil"
} else {
return "Seq(" + value + ")"
}
}
/**
* Turns a string name into a scala constant. We do this by:
* - replacing '+' with Plus
* - replacing '-' with Minus
* - replacing any other non alphanumerics into underscores, splitting
* on underscore, and init capping
*/
func scalaName(name string) string {
// +, - handling for timezones
safe := strings.Replace(name, "+", "_plus_", -1)
safe = strings.Replace(safe, "-", "_minus_", -1)
safe = strings.Replace(safe, "&", "and", -1)
safe = regexp.MustCompile("[^A-Za-z0-9Åçôãéí]+").ReplaceAllString(safe, "_")
s := ""
for _, el := range strings.Split(safe, "_") {
s = s + UpcaseInitial(strings.ToLower(el))
}
return s
}
func formatLocaleIdForName(id string) string {
return strings.Replace(id, "-", "_", -1)
}
func UpcaseInitial(str string) string {
for pos, char := range str {
return string(unicode.ToUpper(char)) + string([]rune(str)[pos+1:])
}
return ""
}
| 31.242604 | 361 | 0.642235 |
1abc8c09cac2cb9b7083e3e9cdaf24b52388bf58 | 5,385 | kt | Kotlin | app/src/main/java/com/zhugeng/materialdesign/activity/tab/TabIconActivity.kt | duxiu-chen/Materials | 3a744d27abd7b147d081ce980c96599e7b511eab | [
"MIT"
] | 9 | 2019-08-28T17:19:18.000Z | 2020-06-10T03:22:40.000Z | app/src/main/java/com/zhugeng/materialdesign/activity/tab/TabIconActivity.kt | duxiu-chen/Materials | 3a744d27abd7b147d081ce980c96599e7b511eab | [
"MIT"
] | 1 | 2021-03-25T07:30:08.000Z | 2021-03-25T07:30:08.000Z | app/src/main/java/com/zhugeng/materialdesign/activity/tab/TabIconActivity.kt | duxiu-chen/Materials | 3a744d27abd7b147d081ce980c96599e7b511eab | [
"MIT"
] | 2 | 2020-06-10T06:46:12.000Z | 2022-02-08T09:29:37.000Z | package com.zhugeng.materialdesign.activity.tab
import android.content.res.ColorStateList
import android.graphics.drawable.Drawable
import android.os.Bundle
import android.support.design.widget.TabLayout
import android.support.v4.app.Fragment
import android.support.v4.app.FragmentManager
import android.support.v4.app.FragmentPagerAdapter
import android.support.v7.app.AppCompatActivity
import android.text.Spannable
import android.text.SpannableString
import android.text.style.ImageSpan
import android.view.View
import android.view.ViewGroup
import android.widget.ImageView
import com.zhugeng.materialdesign.R
import com.zhugeng.materialdesign.fragment.ContentFragment
import kotlinx.android.synthetic.main.activity_tab_icon.*
import java.util.*
import android.support.v4.content.ContextCompat
import android.support.v4.view.ViewPager
class TabIconActivity: AppCompatActivity() {
private var fragments: LinkedList<Fragment> = LinkedList()
private var datas: IntArray = intArrayOf(R.drawable.ic_music,
R.drawable.ic_movie,
R.drawable.ic_book,
R.drawable.ic_newsstand)
private var resId: LinkedList<Drawable> = LinkedList()
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_tab_icon)
initView()
initListener()
}
private fun initListener() {
viewpager.addOnPageChangeListener(object : ViewPager.OnPageChangeListener{
override fun onPageScrollStateChanged(state: Int) {
}
override fun onPageScrolled(position: Int, positionOffset: Float, positionOffsetPixels: Int) {
tabLayout.setScrollPosition(position, positionOffset, false)
}
override fun onPageSelected(position: Int) {
for (item in 0..3){
var img = tabLayout.getTabAt(item)!!.customView!!.findViewById<ImageView>(R.id.tab_icon)
img.imageTintList = ColorStateList.valueOf(resources.getColor(R.color.white2))
}
var img = tabLayout.getTabAt(position)!!.customView!!.findViewById<ImageView>(R.id.tab_icon)
img.imageTintList = ColorStateList.valueOf(resources.getColor(R.color.white))
}
})
tabLayout.addOnTabSelectedListener(object : TabLayout.OnTabSelectedListener{
override fun onTabReselected(tab: TabLayout.Tab?) {
}
override fun onTabUnselected(tab: TabLayout.Tab?) {
}
override fun onTabSelected(tab: TabLayout.Tab?) {
for (item in 0..3){
var img = tabLayout.getTabAt(item)!!.customView!!.findViewById<ImageView>(R.id.tab_icon)
img.imageTintList = ColorStateList.valueOf(resources.getColor(R.color.white2))
}
var img = tab!!.customView!!.findViewById<ImageView>(R.id.tab_icon)
img.imageTintList = ColorStateList.valueOf(resources.getColor(R.color.white))
viewpager.currentItem = tab.position
}
})
viewpager.currentItem = 0
}
private fun initView() {
toolbar.title = "Tab Icon"
toolbar.setTitleTextColor(resources.getColor(R.color.white))
toolbar.inflateMenu(R.menu.menu_bottom_navigation_dark_toolbar)
toolbar.setNavigationOnClickListener {
finish()
}
fragments.add(ContentFragment())
fragments.add(ContentFragment())
fragments.add(ContentFragment())
fragments.add(ContentFragment())
resId.add(resources.getDrawable(R.drawable.ic_music))
resId.add(resources.getDrawable(R.drawable.ic_movie))
resId.add(resources.getDrawable(R.drawable.ic_book))
resId.add(resources.getDrawable(R.drawable.ic_newsstand))
for (item in 0..3){
var view = layoutInflater.inflate(R.layout.item_tablayout_tab, null)
var img = view.findViewById<ImageView>(R.id.tab_icon)
img.setImageResource(datas[item])
if (item == 0)
img.imageTintList = ColorStateList.valueOf(resources.getColor(R.color.white))
var tab = tabLayout.newTab()
tab.customView = view
tabLayout.addTab(tab)
}
var adapter = MyAdapter(supportFragmentManager, fragments, resId)
viewpager.adapter = adapter
//tabLayout.setupWithViewPager(viewpager)
}
class MyAdapter(fm: FragmentManager?, private var fragments: LinkedList<Fragment>, private var resId: LinkedList<Drawable>) : FragmentPagerAdapter(fm) {
override fun getItem(position: Int): Fragment {
return fragments[position]
}
override fun getCount(): Int {
return fragments.size
}
/*override fun getPageTitle(position: Int): CharSequence? {
val drawable: Drawable = resId[position]
drawable!!.setBounds(0, 0, drawable.intrinsicWidth, drawable.intrinsicHeight)
val imageSpan = ImageSpan(drawable, ImageSpan.ALIGN_BASELINE)
val spannableString = SpannableString(" ")
spannableString.setSpan(imageSpan, 24, 30, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE)
return spannableString
}*/
}
} | 38.464286 | 156 | 0.664067 |
f200a069a35c0339810aeb8d025582d9f7fb1378 | 796 | asm | Assembly | oeis/254/A254332.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/254/A254332.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/254/A254332.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A254332: Indices of centered pentagonal numbers (A005891) which are also squares (A000290).
; Submitted by Christian Krause
; 1,3,22,96,817,3627,31006,137712,1177393,5229411,44709910,198579888,1697799169,7540806315,64471658494,286352060064,2448225223585,10873837476099,92968086837718,412919472031680,3530339074609681,15680066099727723,134059916748330142,595429592317621776,5090746497361935697,22610644441969899747,193314306983005226326,858609059202538568592,7340852918856836664673,32604533605254495706731,278759096609576788031230,1238113667940468298287168,10585504818245061108522049,47015714848132540839205635
add $0,1
mov $2,1
lpb $0
mov $3,$0
mul $0,2
sub $0,1
div $0,2
add $2,$1
mod $3,2
mul $3,6
add $3,2
mul $3,$2
add $1,$3
add $2,2
lpe
mov $0,$3
div $0,16
add $0,1
| 34.608696 | 485 | 0.801508 |
5fc52f48dd47a55b01bb34a392031982c632a0be | 5,682 | h | C | DxGuiFramework/DGWindowSurface.h | Maultasche/DxGui | ad540f96bf4df2f1d941b03596bb9927c21e3581 | [
"MIT"
] | null | null | null | DxGuiFramework/DGWindowSurface.h | Maultasche/DxGui | ad540f96bf4df2f1d941b03596bb9927c21e3581 | [
"MIT"
] | null | null | null | DxGuiFramework/DGWindowSurface.h | Maultasche/DxGui | ad540f96bf4df2f1d941b03596bb9927c21e3581 | [
"MIT"
] | null | null | null | /*------------------------------------------------------------------------
File Name: DGWindowSurface.h
Description: This file contains the DG::WindowSurface class, which
represents the area of a window.
Version:
1.0.0 12.08.2001 Created the file
2.0.0 02.06.2002 Changed the file to use namespaces and adapt
to Visual Studio .NET
------------------------------------------------------------------------*/
#pragma once
namespace DG
{
class WindowSurface
{
public:
/*------------------------------------------------------------------------
Function Name: Constructor
Parameters:
Surface* surface : the area on the screen to which the window is to
be clipped
Point winOrigin: the surface coordinates of the upper-left corner
of the window
Description:
This function constructs the DG::WindowSurface object. If winOrigin is
(0, 0), then the upper-left corner of the window is the same as the
upper-left corner of the screen surface. If winOrigin coordinates are
negative then, some of the top and left parts of the window will be
clipped.
------------------------------------------------------------------------*/
WindowSurface(Surface* surface, Point winOrigin)
{
screenSurface = surface;
windowOrigin = winOrigin;
}
Point GetWindowOrigin(void) {return windowOrigin;}
void SetWindowOrigin(Point origin) {windowOrigin = origin;}
Surface* GetScreenSurface(void) {return screenSurface;}
void SetScreenSurface(Surface* surface) {screenSurface = surface;}
//Drawing Functions
void FC LockSurface(void) {screenSurface->LockSurface();}
void FC UnlockSurface(void) {screenSurface->UnlockSurface();}
//Non-Blit Drawing Functions
void FC SetPixel(int x, int y, Color& color)
{
screenSurface->SetPixel(x + windowOrigin.x, y + windowOrigin.y, color);
}
void FC DrawHorizontalLine(int x1, int x2, int y, Color& color)
{
screenSurface->DrawHorizontalLine(x1 + windowOrigin.x, x2 + windowOrigin.x,
y + windowOrigin.y, color);
}
void FC DrawVerticalLine(int x, int y1, int y2, Color& color)
{
screenSurface->DrawVerticalLine(x + windowOrigin.x, y1 + windowOrigin.y,
y2 + windowOrigin.y, color);
}
void FC DrawLine(Point p1, Point p2, Color& color)
{
p1.Offset(windowOrigin.x, windowOrigin.y);
p2.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawLine(p1, p2, color);
}
void FC DrawRectangle(Rectangle rect, Color& color)
{
rect.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawRectangle(rect, color);
}
void FC DrawFilledRectangle(Rectangle rect, Color& color)
{
rect.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawRectangle(rect, color);
}
//Blit Drawing Functions
void FC FillArea(Area area, Color& color)
{
area.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->FillArea(area, color);
}
void FC FillSurface(Color& color)
{
screenSurface->FillSurface(color);
}
void FC DrawBitmap(Point location, UINT bitmapID)
{
location.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawBitmap(location, bitmapID);
}
void FC DrawScaledBitmap(Area area, UINT bitmapID)
{
area.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawScaledBitmap(area, bitmapID);
}
void FC DrawTransparentBitmap(Point location, UINT bitmapID,
Color& transparentColor)
{
location.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawTransparentBitmap(location, bitmapID,
transparentColor);
}
void FC DrawTransparentScaledBitmap(Area area, UINT bitmapID,
Color& transparentColor)
{
area.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawTransparentScaledBitmap(area, bitmapID,
transparentColor);
}
void FC DrawTransparentBitmap(Point location, UINT bitmapID)
{
location.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawTransparentBitmap(location, bitmapID);
}
void FC DrawTransparentScaledBitmap(Area area, UINT bitmapID)
{
area.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawTransparentScaledBitmap(area, bitmapID);
}
//GDI Drawing Functions
void FC SetGDIFont(Font& font)
{screenSurface->SetGDIFont(font);}
void FC SetTextTransparency(int mode)
{screenSurface->SetTextTransparency(mode);}
void FC SetTextColor(Color& color)
{screenSurface->SetTextColor(color);}
void FC SetTextBackgroundColor(Color& color)
{screenSurface->SetTextBackgroundColor(color);}
void FC DrawText(char* text, Rectangle& rect, UINT flags)
{
rect.Offset(windowOrigin.x, windowOrigin.y);
screenSurface->DrawText(text, rect, flags);
//If there is DT_CALCRECT flag, translate the result
//of the method call.
if(flags & DT_CALCRECT)
rect.Offset(-windowOrigin.x, -windowOrigin.y);
}
protected:
Surface* screenSurface;
Point windowOrigin;
};
} | 33.821429 | 85 | 0.590109 |
0c800881227fbd84b9daa79bea4698f463302f6e | 187 | asm | Assembly | oeis/028/A028737.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 11 | 2021-08-22T19:44:55.000Z | 2022-03-20T16:47:57.000Z | oeis/028/A028737.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 9 | 2021-08-29T13:15:54.000Z | 2022-03-09T19:52:31.000Z | oeis/028/A028737.asm | neoneye/loda-programs | 84790877f8e6c2e821b183d2e334d612045d29c0 | [
"Apache-2.0"
] | 3 | 2021-08-22T20:56:47.000Z | 2021-09-29T06:26:12.000Z | ; A028737: Nonsquares mod 24.
; 2,3,5,6,7,8,10,11,13,14,15,17,18,19,20,21,22,23
mov $2,$0
lpb $2
add $0,1
mov $2,7
lpe
seq $0,37 ; Numbers that are not squares (or, the nonsquares).
| 18.7 | 62 | 0.636364 |
525e6b221b8b54152f99d87f1950f8a5c3f29af8 | 3,202 | asm | Assembly | timerend.asm | juanstdio/SemaforoSPD | dc3b365a22b7cacf155f84f2d611c0d07dd79ebc | [
"MIT"
] | null | null | null | timerend.asm | juanstdio/SemaforoSPD | dc3b365a22b7cacf155f84f2d611c0d07dd79ebc | [
"MIT"
] | null | null | null | timerend.asm | juanstdio/SemaforoSPD | dc3b365a22b7cacf155f84f2d611c0d07dd79ebc | [
"MIT"
] | null | null | null | ;-----------------------------------------------------------------------
; Programa TIMEREND que se instala en el vector de interrupciones 81h
; que genera un retardo de un tiempo recibido por AL.
; Se debe generar el ejecutable .COM con los siguientes comandos:
; tasm timerend.asm
; tlink /t timerend.obj
;-----------------------------------------------------------------------
.8086
.model tiny ; Definicion para generar un archivo .COM
.code
org 100h ; Definicion para generar un archivo .COM
start:
jmp main ; Comienza con un salto para dejar la parte residente primero
;------------------------------------------------------------------------ ;
;- Interrupción que temporiza el tiempo entre 1 y 9 segundos, que viene por al ;
;------------------------------------------------------------------------ ;
CRONOMETRO PROC FAR
push dx ; guardo todos los registros, MENOS AX
; en al --> segundos que vinieron del programa
; en cl -> minutos
; en dh -> segundos
mov bl,al ; como mi programa usa ax, lo muevo a bl para trabajarlo
primero:
mov ah,2ch ; llamo a la hora
int 21h ;pido al DOS
mov bh,dh ; la guardo en la parte alta de bx
segundos: ; pasa un ratito
mov ah,2ch ; vuelvo a pedir la hora
int 21h ; pido al DOS
cmp bh,dh ; comparo si son distintos los tiempos
jne pasoalgo ; si no son iguales, paso un segundo
jmp segundos ; sino, que vuelva a pedir la hora
pasoalgo: ; si pasa un segundo entra aca
mov ah,02h ; pido cursor
mov dl,2Eh ; escribo un punto para indicar un segundo
int 21h ; llamo al DOS escribir
dec bl ; decremento bl, registro que tenia guardado el tiempo de al
cmp bl,0 ; comparo bl con cero, para saber si el tiempo paso
je fin ; si es igual a cero, termine
jmp primero ; sino, me vuelvo arriba
fin: ; si termine el tiempo, llegue aca
pop dx ; devuelvo todos los registros en forma invertida
iret ; me voy de la rutina de interrupcion
endp
; Datos usados dentro de la ISR ya que no hay DS dentro de una ISR
DespIntXX dw 0
SegIntXX dw 0
FinResidente LABEL BYTE ; Marca el fin de la porcion a dejar residente
;------------------------------------------------------------------------
; Datos a ser usados por el Instalador
;------------------------------------------------------------------------
Cartel DB "Driver de timer instalado :-) ",0dh, 0ah, '$'
main:
; Se apunta todos los registros de segmentos al mismo lugar CS.
mov ax,CS
mov DS,ax
mov ES,ax
InstalarInt:
mov AX,3581h ; Obtiene la ISR que esta instalada en la interrupcion
int 21h
mov DespIntXX,BX
mov SegIntXX,ES
mov AX,2581h ; Coloca la nueva ISR en el vector de interrupciones 81
mov DX,Offset CRONOMETRO
int 21h
MostrarCartel:
mov dx, offset Cartel
mov ah,9
int 21h
DejarResidente:
Mov AX,(15+offset FinResidente)
Shr AX,1
Shr AX,1 ;Se obtiene la cantidad de paragraphs
Shr AX,1
Shr AX,1 ;ocupado por el codigo
Mov DX,AX
Mov AX,3100h ;y termina sin error 0, dejando el
Int 21h ;programa residente
end start
| 34.804348 | 80 | 0.580575 |
558e8c35a32b44c151bb97441cfa0f9d4219e63e | 532 | kt | Kotlin | core/src/main/kotlin/materialui/styles/createMixins.kt | oxc/kotlin-material-ui | ddd289ab89cf51885fb99f384175e98aa6da6698 | [
"MIT"
] | 1 | 2021-02-20T12:20:28.000Z | 2021-02-20T12:20:28.000Z | core/src/main/kotlin/materialui/styles/createMixins.kt | oxc/kotlin-material-ui | ddd289ab89cf51885fb99f384175e98aa6da6698 | [
"MIT"
] | null | null | null | core/src/main/kotlin/materialui/styles/createMixins.kt | oxc/kotlin-material-ui | ddd289ab89cf51885fb99f384175e98aa6da6698 | [
"MIT"
] | null | null | null | @file:Suppress("UNCHECKED_CAST_TO_EXTERNAL_INTERFACE")
package materialui.styles
import materialui.styles.breakpoint.Breakpoints
import materialui.styles.mixins.Mixins
import materialui.styles.mixins.options.MixinsOptions
import materialui.styles.spacing.Spacing
@JsModule("@material-ui/core/styles/createMixins")
private external val createMixinsModule: dynamic
fun createMixins(breakpoints: Breakpoints, spacing: Spacing, mixins: MixinsOptions): Mixins
= createMixinsModule.default(breakpoints, spacing, mixins) as Mixins
| 35.466667 | 91 | 0.842105 |
f4b94c83d9372a6c3794f28ef3495cdb222dd833 | 576 | go | Go | getting-started/slice.go | dev0x13/learning-go | f1c229352a3245c156ffa1934ca7551bdd3ad4cc | [
"MIT"
] | null | null | null | getting-started/slice.go | dev0x13/learning-go | f1c229352a3245c156ffa1934ca7551bdd3ad4cc | [
"MIT"
] | null | null | null | getting-started/slice.go | dev0x13/learning-go | f1c229352a3245c156ffa1934ca7551bdd3ad4cc | [
"MIT"
] | null | null | null | package main
import "fmt"
import "strconv"
import "sort"
func main() {
slice := make([]int, 0, 3)
var input string
for {
_, err := fmt.Scan(&input)
if err == nil {
if input == "X" {
break;
}
i, err := strconv.Atoi(input)
if err == nil {
slice = append(slice, i)
sort.Ints(slice)
fmt.Println(slice)
} else {
fmt.Println(err)
}
} else {
fmt.Println(err)
}
}
}
| 17.454545 | 41 | 0.392361 |
a1361a5bd9e05898b218e42183f8bbff15c75c49 | 615 | kt | Kotlin | advent_of_code/2018/solutions/day_1_b.kt | migafgarcia/programming-challenges | 82f5e482c0c3c03fd39e46aa70cab79391ed2dc5 | [
"MIT"
] | 6 | 2017-06-29T16:36:38.000Z | 2022-01-10T17:14:38.000Z | advent_of_code/2018/solutions/day_1_b.kt | migafgarcia/programming-challenges | 82f5e482c0c3c03fd39e46aa70cab79391ed2dc5 | [
"MIT"
] | null | null | null | advent_of_code/2018/solutions/day_1_b.kt | migafgarcia/programming-challenges | 82f5e482c0c3c03fd39e46aa70cab79391ed2dc5 | [
"MIT"
] | 2 | 2020-08-09T02:06:33.000Z | 2020-12-25T13:13:59.000Z | import java.io.File
fun main(args: Array<String>) {
var currentFrequency = 0
val history = HashSet<Int>()
val file = File(args[0])
var bf = file.bufferedReader()
var itr = bf.lines().iterator()
while(true) {
if(!itr.hasNext()) {
bf.close()
bf = file.bufferedReader()
itr = bf.lines().iterator()
}
currentFrequency += itr.next().toInt()
if(history.contains(currentFrequency)) {
bf.close()
println(currentFrequency)
break
}
history.add(currentFrequency)
}
}
| 18.088235 | 48 | 0.530081 |
1d166254cb95288c58a9fd78d5b896bb0ade0d92 | 942 | kt | Kotlin | bootstrap/src/test/kotlin/net/dontdrinkandroot/wicket/bootstrap/component/item/BookmarkablePageLinkItemTest.kt | dontdrinkandroot/wicket.java | 51fba9712321f0fdb5faa452fddc63aa9b360fe6 | [
"Apache-2.0"
] | 2 | 2016-07-13T23:30:05.000Z | 2018-04-21T21:06:16.000Z | bootstrap/src/test/kotlin/net/dontdrinkandroot/wicket/bootstrap/component/item/BookmarkablePageLinkItemTest.kt | dontdrinkandroot/wicket.java | 51fba9712321f0fdb5faa452fddc63aa9b360fe6 | [
"Apache-2.0"
] | 61 | 2016-04-11T23:52:28.000Z | 2021-02-19T11:25:18.000Z | bootstrap/src/test/kotlin/net/dontdrinkandroot/wicket/bootstrap/component/item/BookmarkablePageLinkItemTest.kt | dontdrinkandroot/wicket.java | 51fba9712321f0fdb5faa452fddc63aa9b360fe6 | [
"Apache-2.0"
] | null | null | null | package net.dontdrinkandroot.wicket.bootstrap.component.item
import net.dontdrinkandroot.wicket.bootstrap.test.AbstractWicketTest
import net.dontdrinkandroot.wicket.bootstrap.test.TestHomePage
import org.apache.wicket.core.util.string.ComponentRenderer
import org.apache.wicket.model.Model
import org.junit.jupiter.api.Assertions
import org.junit.jupiter.api.Test
class BookmarkablePageLinkItemTest : AbstractWicketTest() {
@Test
fun testMarkup() {
val component: BookmarkablePageLinkItem<*> =
BookmarkablePageLinkItem<Any?>("id", label = Model("Label"), pageClass = TestHomePage::class.java)
val componentMarkup = ComponentRenderer.renderComponent(component)
Assertions.assertEquals(
"""<wicket:container wicket:id="id"><wicket:panel>
<a href="./" wicket:id="link">Label</a>
<wicket:child/>
</wicket:panel></wicket:container>""", componentMarkup.toString()
)
}
} | 39.25 | 110 | 0.737792 |
36fe2d5a8fc428e02dc45146456223f64ab9ab38 | 806 | swift | Swift | Packages/Backend/Sources/Backend/Models/Squad.swift | qeude/MarvelousSquad | 7dd5aca9e0980d63ffd4ce35a57dce9fc77b1d03 | [
"MIT"
] | null | null | null | Packages/Backend/Sources/Backend/Models/Squad.swift | qeude/MarvelousSquad | 7dd5aca9e0980d63ffd4ce35a57dce9fc77b1d03 | [
"MIT"
] | null | null | null | Packages/Backend/Sources/Backend/Models/Squad.swift | qeude/MarvelousSquad | 7dd5aca9e0980d63ffd4ce35a57dce9fc77b1d03 | [
"MIT"
] | null | null | null | //
// File.swift
//
//
// Created by Quentin Eude on 11/08/2021.
//
import CoreData
import Foundation
public class Squad: NSManagedObject {}
public extension Squad {
static func getSquad(with persistentContainer: PersistentContainer) -> Squad {
let request: NSFetchRequest<Squad> = Squad.fetchRequest()
request.returnsObjectsAsFaults = false
do {
if let squad = try persistentContainer.viewContext.fetch(request).first {
return squad
}
} catch {
print("Detele all data in SuperHero error :", error)
}
let squad = Squad(context: persistentContainer.viewContext)
squad.identifier = UUID()
squad.superheroes = []
persistentContainer.saveContext()
return squad
}
}
| 26 | 85 | 0.630273 |
3efd1f6add71e3ed91f7ddd21c3c5a5a6f615968 | 472 | c | C | src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsTimerNitro.c | clayne/xray-16 | 32ebf81a252c7179e2824b2874f911a91e822ad1 | [
"OML",
"Linux-OpenIB"
] | 38 | 2015-10-20T02:21:32.000Z | 2021-12-27T22:02:36.000Z | src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsTimerNitro.c | clayne/xray-16 | 32ebf81a252c7179e2824b2874f911a91e822ad1 | [
"OML",
"Linux-OpenIB"
] | 21 | 2018-05-25T21:27:14.000Z | 2020-05-20T16:31:47.000Z | src/utils/mp_gpprof_server/libraries/gamespy/common/nitro/gsTimerNitro.c | clayne/xray-16 | 32ebf81a252c7179e2824b2874f911a91e822ad1 | [
"OML",
"Linux-OpenIB"
] | 33 | 2015-02-11T01:08:38.000Z | 2021-12-10T05:03:41.000Z | // NITRO
///////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
#include "../gsCommon.h"
// note that this doesn't return the standard time() value
// because the DS doesn't know what timezone it's in
time_t time(time_t *timer)
{
time_t t;
assert(OS_IsTickAvailable() == TRUE);
t = (time_t)OS_TicksToSeconds(OS_GetTick());
if(timer)
*timer = t;
return t;
} | 24.842105 | 79 | 0.45339 |
6a3068cac41d6f816f0a7c321550eb3377073436 | 365 | dart | Dart | lib/src/api/model/offersecret.dart | harsh-kr-jha/instiapp-flutter | b70a7218af3baabeb18f07d8a1f94b83b5715ce8 | [
"MIT"
] | 1 | 2021-06-02T12:36:58.000Z | 2021-06-02T12:36:58.000Z | lib/src/api/model/offersecret.dart | harsh-kr-jha/instiapp-flutter | b70a7218af3baabeb18f07d8a1f94b83b5715ce8 | [
"MIT"
] | null | null | null | lib/src/api/model/offersecret.dart | harsh-kr-jha/instiapp-flutter | b70a7218af3baabeb18f07d8a1f94b83b5715ce8 | [
"MIT"
] | 4 | 2021-07-30T06:45:28.000Z | 2022-01-07T16:16:44.000Z | import 'package:json_annotation/json_annotation.dart';
part 'offersecret.g.dart';
@JsonSerializable()
class Offersecret {
@JsonKey(name: "secret")
String? secret;
Offersecret({this.secret});
factory Offersecret.fromJson(Map<String, dynamic> json) =>
_$OffersecretFromJson(json);
Map<String, dynamic> toJson() => _$OffersecretToJson(this);
}
| 20.277778 | 61 | 0.720548 |
0bd4c6c5dd9108d045404ea7048c02900e929d37 | 2,856 | js | JavaScript | js/main.js | GopinathMaddula/praveenportfolio | dca00e05e989ebabc8a5e7e187522b5c4211544c | [
"MIT"
] | null | null | null | js/main.js | GopinathMaddula/praveenportfolio | dca00e05e989ebabc8a5e7e187522b5c4211544c | [
"MIT"
] | 2 | 2022-03-15T18:52:21.000Z | 2022-03-21T07:16:53.000Z | js/main.js | GopinathMaddula/praveenportfolio | dca00e05e989ebabc8a5e7e187522b5c4211544c | [
"MIT"
] | null | null | null | (function ($) {
'use strict';
jQuery(document).ready(function () {
/* START MENU-JS */
var $link = $(".smoothScroll");
$link.on('click', function (event) {
if (this.hash !== "") {
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function () {
window.location.hash = hash;
});
}
});
$(window).scroll(function () {
if ($(this).scrollTop() > 100) {
// $('.menu-top').addClass('sticky_menu');
} else {
// $('.menu-top').removeClass('sticky_menu');
}
});
$(document).on('click', '.navbar-collapse.in', function (e) {
if ($(e.target).is('a') && $(e.target).attr('class') != 'dropdown-toggle') {
$(this).collapse('hide');
}
});
/* END MENU-JS */
/* START ISOTOP JS */
var $grid = $('.work_content_area').isotope({
// options
});
// filter items on button click
$('.work_filter').on('click', 'li', function () {
var filterValue = $(this).attr('data-filter');
$grid.isotope({ filter: filterValue });
});
// filter items on button click
$('.work_filter').on('click', 'li', function () {
$(this).addClass('active').siblings().removeClass('active')
});
/* END ISOTOP JS */
/* START LIGHTBOX */
lightbox.option({
'resizeDuration': 200,
'wrapAround': true
});
/* END LIGHTBOX JS */
/* START COUNDOWN JS */
$('#counter_area').on('inview', function (event, visible, visiblePartX, visiblePartY) {
if (visible) {
$(this).find('.counter').each(function () {
var $this = $(this);
$({ Counter: 0 }).animate({ Counter: $this.text() }, {
duration: 5000,
easing: 'swing',
step: function () {
$this.text(Math.ceil(this.Counter));
}
});
});
$(this).unbind('inview');
}
});
/* END COUNDOWN JS */
/* START SERVICE JS */
$(".service_slider").owlCarousel({
loop: true,
navText: false,
autoplayHoverPause: false,
autoplay: 6000,
smartSpeed: 1000,
margin: 20,
autoPlay: true,
items: 3,
responsive: {
320: {
items: 1
},
767: {
items: 2
},
991: {
items: 3
},
1200: {
items: 3
}
}
});
/* END SERVICE JS */
/* START TESTIMONIAL JS */
$(".testimonial_area").owlCarousel({
loop: true,
navText: false,
autoplayHoverPause: false,
autoplay: 6000,
smartSpeed: 1000,
margin: 30,
autoPlay: true,
items: 1,
responsive: {
320: {
items: 1
},
767: {
items: 1
},
991: {
items: 1
},
1200: {
items: 1
}
}
});
/* END TESTIMONIAL JS */
});
/*PRELOADER JS*/
$(window).on('load', function () {
$('.spinner').fadeOut();
$('.preloader').delay(350).fadeOut('slow');
});
/*END PRELOADER JS*/
/*START WOW ANIMATION JS*/
new WOW().init();
/*END WOW ANIMATION JS*/
})(jQuery); | 20.112676 | 89 | 0.531863 |
a163a32bf0f15d8e26a029112dc82b39c233d5de | 109 | go | Go | ssaUtils/testdata/Functions/General/DataRaceNestedSameFunction/prog1.go | amit-davidson/Chronos | 3f68a515195facb796e9dd9b9394f312f1650c14 | [
"MIT"
] | 376 | 2020-10-14T21:34:34.000Z | 2022-03-26T10:07:43.000Z | ssaUtils/testdata/Functions/General/DataRaceNestedSameFunction/prog1.go | amit-davidson/Chronos | 3f68a515195facb796e9dd9b9394f312f1650c14 | [
"MIT"
] | 23 | 2020-10-16T09:36:11.000Z | 2021-08-23T19:13:12.000Z | ssaUtils/testdata/Functions/General/DataRaceNestedSameFunction/prog1.go | amit-davidson/Chronos | 3f68a515195facb796e9dd9b9394f312f1650c14 | [
"MIT"
] | 10 | 2020-10-17T18:09:51.000Z | 2021-12-07T09:25:58.000Z | package main
var count int
func race() {
count++
}
func f() {
race()
}
func main() {
go f()
go f()
}
| 6.411765 | 13 | 0.53211 |
21b990ceaaa826b59eeaf68924a0f433a611c4ae | 5,343 | swift | Swift | TipCalculator/TipCalculator/ViewController.swift | CindyXie/CodePath1Prework_TipCalculator | adb4d01f2fe704e39cfc50a0bc527b99559525a9 | [
"Apache-2.0"
] | null | null | null | TipCalculator/TipCalculator/ViewController.swift | CindyXie/CodePath1Prework_TipCalculator | adb4d01f2fe704e39cfc50a0bc527b99559525a9 | [
"Apache-2.0"
] | 1 | 2015-12-08T07:32:52.000Z | 2016-01-01T21:29:27.000Z | TipCalculator/TipCalculator/ViewController.swift | CindyXie/CodePath1Prework_TipCalculator | adb4d01f2fe704e39cfc50a0bc527b99559525a9 | [
"Apache-2.0"
] | null | null | null | //
// ViewController.swift
// TipCalculator
//
// Created by Xinxin Xie on 12/5/15.
// Copyright © 2015 Xinxin Xie. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var tipLabel: UILabel!
@IBOutlet weak var billField: UITextField!
@IBOutlet weak var totalLabel: UILabel!
@IBOutlet weak var splitField: UITextField!
@IBOutlet weak var splittedLabel: UILabel!
@IBOutlet weak var tipControl: UISegmentedControl!
@IBOutlet weak var separatorView: UIView!
@IBOutlet weak var containerView1: UIView!
@IBOutlet weak var containerView2: UIView!
@IBOutlet var superView: UIView!
let tipPercentage = TipPercentage()
let backgroundColorSetting = BackgroundColorSetting()
var tip = 0.00
var total = 0.00
var splitted = 0.00
let currencyFormat = NSNumberFormatter()
let defaults : NSUserDefaults = NSUserDefaults.standardUserDefaults()
var originalContainerView1Center: CGPoint!
override func viewDidLoad() {
super.viewDidLoad()
originalContainerView1Center = containerView1.center
containerView1.center = superView.convertPoint(superView.center, fromView: superView)
containerView1.alpha = 1
containerView2.alpha = 0
tipLabel.text = String(format: "$%.2f", tip)
totalLabel.text = String(format: "$%.2f", total)
splittedLabel.text = String(format: "$%.2f", splitted)
let lastTime = defaults.objectForKey("lastTime")
let now = NSDate.timeIntervalSinceReferenceDate()
if lastTime != nil {
let difference = now - (lastTime as! Double)
if difference < 60 * 10 {
let billValue = defaults.objectForKey("billValue")
let numPeople = defaults.objectForKey("numPeople")
if billValue != nil {
billField.text = String(billValue!)
splitField.text = String(numPeople!)
}
}
}
}
override func viewWillAppear(animated: Bool) {
super.viewWillAppear(animated)
tipControl.selectedSegmentIndex = tipPercentage.index
updateTips()
billField.becomeFirstResponder()
let foregroundColor: UIColor
if backgroundColorSetting.isNight {
view.backgroundColor = UIColor.blackColor()
foregroundColor = UIColor.whiteColor()
} else {
view.backgroundColor = UIColor.whiteColor()
foregroundColor = UIColor.blackColor()
}
separatorView.backgroundColor = foregroundColor
for containerView in view.subviews {
for subview in containerView.subviews {
if let label = subview as? UILabel {
label.textColor = foregroundColor
}
}
}
}
override func viewWillDisappear(animated: Bool) {
if billField.text != "" {
defaults.setDouble(Double(billField.text!)!,forKey: "billValue")
}else{
defaults.setDouble(0.0,forKey: "billValue")
}
if splitField.text != "" {
defaults.setDouble(Double(splitField.text!)!,forKey: "numPeople")
}else{
defaults.setDouble(1.0,forKey: "numPeople")
}
defaults.setDouble(NSDate.timeIntervalSinceReferenceDate(),forKey: "lastTime")
defaults.synchronize()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func onEditingChanged(sender: AnyObject) {
updateTips()
UIView.animateWithDuration(0.4, animations: {
self.containerView1.center = self.originalContainerView1Center
self.containerView1.alpha = 1
self.containerView2.alpha = 1
})
if billField.text == "" {
UIView.animateWithDuration(0.4, animations: {
self.containerView1.center = self.superView.convertPoint(self.superView.center, fromView: self.superView)
self.containerView1.alpha = 1
self.containerView2.alpha = 0
})
}
}
func updateTips() {
let text = (billField.text ?? "") as NSString
let num = (splitField.text ?? "") as NSString
let billAmount = text.doubleValue
let numPeople = num.doubleValue
let index = tipControl.selectedSegmentIndex
tip = billAmount * tipPercentage.tipPercentageAtIndex(index)
total = billAmount + tip
if(numPeople == 0)
{
splitted = total / 1
}
else
{
splitted = total / numPeople
}
currencyFormat.numberStyle = NSNumberFormatterStyle.CurrencyStyle
currencyFormat.locale = NSLocale.currentLocale()
tipLabel.text = currencyFormat.stringFromNumber(tip)
totalLabel.text = currencyFormat.stringFromNumber(total)
splittedLabel.text = currencyFormat.stringFromNumber(splitted)
}
@IBAction func onTap(sender: AnyObject) {
view.endEditing(true)
}
}
| 32.186747 | 121 | 0.606027 |
177052b33dbd3ba1fa6397f06a7fbd40a9dfc623 | 2,432 | html | HTML | _posts/2017-08-09-a-fresh-look-at-the-embeddable-tools-built-on-the-twitter-api.html | kinlane/api-evangelist | 60747b44c2f87e93e0d2008b578d4f351c1f4ffc | [
"CC-BY-3.0"
] | 44 | 2015-02-09T10:28:37.000Z | 2022-03-18T03:12:04.000Z | _posts/2017-08-09-a-fresh-look-at-the-embeddable-tools-built-on-the-twitter-api.html | kinlane/api-evangelist | 60747b44c2f87e93e0d2008b578d4f351c1f4ffc | [
"CC-BY-3.0"
] | 23 | 2015-01-02T18:58:25.000Z | 2019-06-14T00:10:02.000Z | _posts/2017-08-09-a-fresh-look-at-the-embeddable-tools-built-on-the-twitter-api.html | kinlane/api-evangelist | 60747b44c2f87e93e0d2008b578d4f351c1f4ffc | [
"CC-BY-3.0"
] | 30 | 2015-03-05T16:40:36.000Z | 2020-10-01T18:08:49.000Z | ---
published: true
layout: post
title: 'A Fresh Look At The Embeddable Tools Built On The Twitter API'
image: https://s3.amazonaws.com/kinlane-productions2/twitter/twitter-websites-embeddable.png
---
<p><img src="https://s3.amazonaws.com/kinlane-productions2/twitter/twitter-websites-embeddable.png" align="right" width="40%" style="padding: 15px;" />
<p>Over the years I have regularly showcased Twitter as an example API driven embeddable tools like buttons, badges, and widgets. In 2017, after spending some time in the Twitter developer portal, it is good to see <a href="https://dev.twitter.com/products/web">Twitter still investing in their embeddable tools</a>. The landing page for the Twitter embeddables still provides the best example out there of the value of using APIs to drive data and content across a large number of remote web sites.
<p>Twitter has distinct elements of their web embeddables:
<ul>
<li>Tweet Button - That classic tweet button, allowing users to quickly Tweet from any website.</li>
<li>Embedded Tweets - Taking any Tweet and embedding on a web page showing its full content.</li>
<li>Embedded Timeline - Showing curated timelines on any website using a Twitter embeddable widget.</li>
<li>Follow Button - Helping users quickly follow your Twitter account, or your companies Twitter account.</li>
<li>Twitter Cards - Present link summaries, engaging images, product information, or inline video as embeddable cards in timeline.</li>
</ul>
<p>Account interactions, messaging, posting, and other API enabled function made portable using JavaScript allowing it to be embedded and executed on any website. JavaScript widgets, buttons, and other embeddables are still a very tangible, useful example of APIs in action. Something I can talk about to anyone about, helping them understand why you might want to do APIs, or at least know about APIs.
<p>We bash on Twitter a lot in the API community. However, after a decade of operation, you have to give it to them. They are still doing it. They are still keeping it simple with embeddable tools like this. I can confidently say that APIs are automating some serious illness on the Twitter API platform at the moment, and there are many things I’d like to be different with the Twitter API, but I am still pleased that I can keep finding examples from the Twitter platform to showcase on API Evangelist seven years of writing about them.
| 97.28 | 538 | 0.784539 |
fe4862c1610a50e2ffc890721617cef5e258e934 | 6,683 | h | C | solve.h | chili-epfl/Carpenter-App-RoofDesigner | c50ace5e1d806f2a63cec0b6e459a6a9118f8307 | [
"MIT"
] | 1 | 2021-03-25T18:19:38.000Z | 2021-03-25T18:19:38.000Z | solve.h | chili-epfl/Carpenter-App-RoofDesigner | c50ace5e1d806f2a63cec0b6e459a6a9118f8307 | [
"MIT"
] | 3 | 2016-01-22T11:09:19.000Z | 2016-01-22T11:17:32.000Z | solve.h | chili-epfl/Carpenter-App-RoofDesigner | c50ace5e1d806f2a63cec0b6e459a6a9118f8307 | [
"MIT"
] | 5 | 2016-09-26T15:34:28.000Z | 2018-11-08T06:29:46.000Z | /*
* solve.h
*
* Created on: May 4, 2009
* Author: Jonathan
* Copyright (c) 2009, Jonathan George
* This program is released under the BSD license. See the file COPYING for details.
*/
#include <iostream>
#ifndef WIN32
#define _hypot hypot
#endif
#define DEBUG
//This define selects between the old arc define by start point end point and center point
// and the new arc defined by a centerpoint, radius, start angle, and end angle
#define NEWARC
// Eventually after everything is changed we will get rid of the old arc type.
#ifndef SOLVE_H_
#define SOLVE_H_
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
#define pointOnPoint 0
#define pointToLine 1
#define pointOnLine 2
#define sketchSolveHorizontal 3
#define sketchSolveVertical 4
#define internalAngle 5
#define radiusValue 6
#define tangentToArc 7
#define tangentToCircle 8
#define arcRules 9
#define P2PDistance 10
#define P2PDistanceVert 11
#define P2PDistanceHorz 12
#define P2LDistance 13
#define P2LDistanceVert 14
#define P2LDistanceHorz 15
#define lineLength 16
#define equalLegnth 17
#define arcRadius 18
#define equalRadiusArcs 19
#define equalRadiusCircles 20
#define equalRadiusCircArc 21
#define concentricArcs 22
#define concentricCircles 23
#define concentricCircArc 24
#define circleRadius 25
#define externalAngle 26
#define parallel 27
#define perpendicular 28
#define colinear 29
#define pointOnCircle 30
#define pointOnArc 31
#define pointOnLineMidpoint 32
#define pointOnArcMidpoint 33
#define pointOnCircleQuad 34
#define symmetricPoints 35
#define symmetricLines 36
#define symmetricCircles 37
#define symmetricArcs 38
///////////////////////////////////////
/// BFGS Solver parameters
///////////////////////////////////////
#define pertMag 1e-6
#define pertMin 1e-10
#define XconvergenceRough 1e-8
#define XconvergenceFine 1e-10
#define smallF 1e-20
#define validSolutionFine 1e-12
#define validSoltuionRough 1e-4
#define rough 0
#define fine 1
#define MaxIterations 50 //Note that the total number of iterations allowed is MaxIterations *xLength
///////////////////////////////////////
/// Solve exit codes
///////////////////////////////////////
#define succsess 0
#define noSolution 1
///////////////////////////////////////////////////////////////////////
/// constraint defines (these make writing constraint equations easier
///////////////////////////////////////////////////////////////////////
#define P1_x *cons[i].point1.x
#define P1_y *cons[i].point1.y
#define P2_x *cons[i].point2.x
#define P2_y *cons[i].point2.y
#define L1_P1_x *cons[i].line1.p1.x
#define L1_P1_y *cons[i].line1.p1.y
#define L1_P2_x *cons[i].line1.p2.x
#define L1_P2_y *cons[i].line1.p2.y
#define L2_P1_x *cons[i].line2.p1.x
#define L2_P1_y *cons[i].line2.p1.y
#define L2_P2_x *cons[i].line2.p2.x
#define L2_P2_y *cons[i].line2.p2.y
#define C1_Center_x *cons[i].circle1.center.x
#define C1_Center_y *cons[i].circle1.center.y
#define C1_rad *cons[i].circle1.rad
#define C2_Center_x *cons[i].circle2.center.x
#define C2_Center_y *cons[i].circle2.center.y
#define C2_rad *cons[i].circle2.rad
#ifndef NEWARC
#define A1_Start_x *cons[i].arc1.start.x
#define A1_Start_y *cons[i].arc1.start.y
#define A1_End_x *cons[i].arc1.end.x
#define A1_End_y *cons[i].arc1.end.y
#define A1_Center_x *cons[i].arc1.center.x
#define A1_Center_y *cons[i].arc1.center.y
#define A2_Start_x *cons[i].arc2.start.x
#define A2_Start_y *cons[i].arc2.start.y
#define A2_End_x *cons[i].arc2.end.x
#define A2_End_y *cons[i].arc2.end.y
#define A2_Center_x *cons[i].arc2.center.x
#define A2_Center_y *cons[i].arc2.center.y
#else
#define A1_startA *cons[i].arc1.startAngle
#define A1_endA *cons[i].arc1.endAngle
#define A1_radius *cons[i].arc1.rad
#define A1_Center_x *cons[i].arc1.center.x
#define A1_Center_y *cons[i].arc1.center.y
#define A2_startA *cons[i].arc2.startAngle
#define A2_endA *cons[i].arc2.endAngle
#define A2_radius *cons[i].arc2.rad
#define A2_Center_x *cons[i].arc2.center.x
#define A2_Center_y *cons[i].arc2.center.y
#define A1_Start_x (A1_Center_x+A1_radius*cos(A1_startA))
#define A1_Start_y (A1_Center_y+A1_radius*sin(A1_startA))
#define A1_End_x (A1_Center_x+A1_radius*cos(A1_endA))
#define A1_End_y (A1_Center_y+A1_radius*sin(A1_endA))
#define A2_Start_x (A1_Center_x+A2_radius*cos(A2_startA))
#define A2_Start_y (A1_Center_y+A2_radius*sin(A2_startA))
#define A2_End_x (A1_Center_x+A2_radius*cos(A2_endA))
#define A2_End_y (A1_Center_y+A2_radius*sin(A2_endA))
#endif
#define sketchSolveLength *cons[i].parameter
#define sketchSolveDistance *cons[i].parameter
#define radius *cons[i].parameter
#define angleP *cons[i].parameter
#define quadIndex *cons[i].parameter
#define Sym_P1_x *cons[i].SymLine.p1.x
#define Sym_P1_y *cons[i].SymLine.p1.y
#define Sym_P2_x *cons[i].SymLine.p2.x
#define Sym_P2_y *cons[i].SymLine.p2.y
class SketchSolvePoint
{
public:
SketchSolvePoint(){x = 0; y = 0;}
double * x;
double * y;
};
class Line
{
public:
Line(){}
SketchSolvePoint p1;
SketchSolvePoint p2;
};
#ifndef NEWARC
class arc
{
public:
arc(){}
point start;
point end;
point center;
};
#else
class Arc
{
public:
Arc(){}
double * startAngle;
double * endAngle;
double * rad;//This is called parameter in the constraint class.
SketchSolvePoint center;
};
#endif
class Circle
{
public:
Circle(){rad = 0;}
SketchSolvePoint center;
double *rad;
};
class Constraint
{
public:
Constraint(){parameter = 0;}
int type;
SketchSolvePoint point1;
SketchSolvePoint point2;
Line line1;
Line line2;
Line SymLine;
Circle circle1;
Circle circle2;
Arc arc1;
Arc arc2;
double *parameter; //radius, length, angle etc...
};
void debugprint(std::string s);
//Function Prototypes
int solve(double **x,int xLength, Constraint * cons, int consLength, int isFine);
double calc(Constraint * cons, int consLength);
void derivatives(double **x,double *gradF,int xLength, Constraint * cons, int consLength);
#endif /* SOLVE_H_ */
| 28.317797 | 103 | 0.644022 |
76ef55dc94cf73cc51ab603b409c50b9e40bb0f6 | 1,240 | h | C | kernel-3.10/drivers/misc/mediatek/xhci_test/mtk-test.h | zhengdejin/SC1_Code | dccccf55f2875fb64ec621f4356c625cd48bef7e | [
"Apache-2.0"
] | null | null | null | kernel-3.10/drivers/misc/mediatek/xhci_test/mtk-test.h | zhengdejin/SC1_Code | dccccf55f2875fb64ec621f4356c625cd48bef7e | [
"Apache-2.0"
] | null | null | null | kernel-3.10/drivers/misc/mediatek/xhci_test/mtk-test.h | zhengdejin/SC1_Code | dccccf55f2875fb64ec621f4356c625cd48bef7e | [
"Apache-2.0"
] | null | null | null |
#define XHCI_MTK_TEST_MAJOR 235
#define DEVICE_NAME "clih"
/* for auto test struct defs */
#define USBIF_OTG_EVENT_DEV_CONN_TMOUT "DEV_CONN_TMOUT"
#define USBIF_OTG_EVENT_NO_RESP_FOR_HNP_ENABLE "NO_RESP_FOR_HNP_ENABLE"
#define USBIF_OTG_EVENT_HUB_NOT_SUPPORTED "HUB_NOT_SUPPORTED"
#define USBIF_OTG_EVENT_DEV_NOT_SUPPORTED "DEV_NOT_SUPPORTED"
//#define USBIF_OTG_EVENT_HNP_FAILED "HNP_FAILED"
//#define USBIF_OTG_EVENT_NO_RESP_FOR_SRP "NO_RESP_FOR_SRP"
typedef enum
{
USB_TX = 0,
USB_RX
} USB_DIR;
typedef enum
{
Ctrol_Transfer = 0,
Bulk_Random,
Test_Loopback,
Test_End
} USB_TEST_CASE;
/* CTRL, BULK, INTR, ISO endpoint */
typedef enum
{
USB_CTRL = 0,
USB_BULK,
USB_INTR,
USB_ISO
}USB_TRANSFER_TYPE;
typedef enum
{
SPEED_HIGH = 0,
SPEED_FULL
}USB_SPEED;
typedef enum
{
BUSY = 0,
READY,
END
}state;
typedef enum
{
TRANSFER_SUCCESS = 0,
TRANSFER_FAIL
}status;
typedef struct
{
unsigned char type;
unsigned char speed;
unsigned int length;
unsigned short maxp;
unsigned char state;
unsigned char status;
}USB_TRANSFER;
typedef struct
{
unsigned short header;
unsigned char testcase;
USB_TRANSFER transfer;
unsigned short end;
}USB_MSG;
| 16.315789 | 71 | 0.73871 |
95bea48c7afc04c9a9d4056689228700ce717171 | 1,131 | html | HTML | layouts/partials/header.html | bonprosoft/hugo-theme-vbcpp | a3cee10d75fa597c48c975da582770022864812b | [
"MIT"
] | null | null | null | layouts/partials/header.html | bonprosoft/hugo-theme-vbcpp | a3cee10d75fa597c48c975da582770022864812b | [
"MIT"
] | null | null | null | layouts/partials/header.html | bonprosoft/hugo-theme-vbcpp | a3cee10d75fa597c48c975da582770022864812b | [
"MIT"
] | null | null | null | <header>
<nav class="navbar navbar-expand-md">
<div class="container">
{{ $baseURL := .Site.BaseURL }}
{{ with .Site.Params.avatar }}
<div class="navbar-logo">
<a class="navbar-brand" href="{{ $baseURL }}">
<img src="{{ . | relURL }}" alt="avatar">
</a>
</div>
{{ end }}
<button class="navbar-toggler navbar-dark" type="button" data-toggle="collapse" data-target="#navbar-links"
aria-controls="navbar-links" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbar-links">
<ul class="navbar-nav mr-auto mt-2 mt-lg-0">
{{ range .Site.Menus.navigation }}
<li class="nav-item">
<a class="nav-link" href="{{ .URL }}">{{.Name }}</a>
</li>
{{ end }}
</ul>
</div>
</div>
</nav>
</header> | 40.392857 | 119 | 0.446508 |
260c098a0ecbd0136862487c13e1e7f749a47dcd | 1,306 | java | Java | src/main/java/jrds/probe/snmp/PartitionSpaceWindows.java | kkllwww007/Mycat-Web | fe23bdabbf0fe109d86a1ac5c7ae060d44313907 | [
"Apache-2.0"
] | null | null | null | src/main/java/jrds/probe/snmp/PartitionSpaceWindows.java | kkllwww007/Mycat-Web | fe23bdabbf0fe109d86a1ac5c7ae060d44313907 | [
"Apache-2.0"
] | null | null | null | src/main/java/jrds/probe/snmp/PartitionSpaceWindows.java | kkllwww007/Mycat-Web | fe23bdabbf0fe109d86a1ac5c7ae060d44313907 | [
"Apache-2.0"
] | null | null | null | /*##########################################################################
_##
_## $Id: NumProcesses.java 187 2006-01-18 19:08:14 +0100 (mer., 18 janv. 2006) fbacchella $
_##
_##########################################################################*/
package jrds.probe.snmp;
import org.apache.log4j.Level;
/**
* A extention of the partitionSpace probe, used tom manager the long naming convention
* of disks in windows
* For example :
* HOST-RESOURCES-MIB::hrStorageDescr.2 = STRING: C:\ Label:Win2003 Serial Number 123abc
* But we only want c:\
* @param monitoredHost
* @param indexKey
* @author Fabrice Bacchella
*/
public class PartitionSpaceWindows extends PartitionSpace {
static final private char separator=' ';
/**
*only compare with String found before " "
* @see jrds.probe.snmp.RdsIndexedSnmpRrd#matchIndex(java.lang.String, java.lang.String)
*/
public boolean matchIndex(String key) {
int nameIndex = key.indexOf(separator);
log(Level.DEBUG, "index split: found separator=\"%s\" in \"%s\" index=%s", separator, key, key);
if (nameIndex != -1) {
key = key.substring(0, nameIndex);
log(Level.DEBUG, "index split: new name=\"%s\"", key);
}
return super.matchIndex(key);
}
}
| 32.65 | 104 | 0.574273 |
107bf2c336fb3659b440061d87b53125ff6c8199 | 5,505 | swift | Swift | ios-app-bootstrap/components/UIGestureRecognizerViewController.swift | app-bootstrap/ios-app-bootstrap | 2b5443a39b7ae9f32bc3f59bafd8e7216b7a0a82 | [
"MIT"
] | 23 | 2018-03-30T03:51:18.000Z | 2022-03-01T02:58:18.000Z | ios-app-bootstrap/components/UIGestureRecognizerViewController.swift | xudafeng/ios-app-bootstrap | 64a77d4302696053c88518f2770f4a743d24b58b | [
"MIT"
] | 6 | 2015-09-04T08:44:44.000Z | 2017-10-27T09:52:33.000Z | ios-app-bootstrap/components/UIGestureRecognizerViewController.swift | xudafeng/ios-app-bootstrap | 64a77d4302696053c88518f2770f4a743d24b58b | [
"MIT"
] | 13 | 2016-03-24T07:15:41.000Z | 2018-03-17T21:54:51.000Z | //
// UIGestureRecognizerViewController.swift
// ios-app-bootstrap
//
// Created by xdf on 11/12/2016.
// Copyright © 2016 open source. All rights reserved.
//
import UIKit
import Logger_swift
class UIGestureRecognizerViewController: UIViewController {
let logger = Logger()
var rect:UIView!
var text:UITextView!
override func viewDidLoad() {
super.viewDidLoad()
initView()
}
func initView() {
navigationItem.title = Utils.Path.basename(#file)
view.backgroundColor = UIColor.white
self.automaticallyAdjustsScrollViewInsets = false
rect = UIView(frame:CGRect(x:0, y:0, width:150, height:100))
rect.center = view.center
rect.backgroundColor = Utils.getRGB(Const.COLOR_1)
text = UITextView(frame:CGRect(x:0, y:0, width:rect.frame.width, height:rect.frame.height))
text.text = "haha~"
text.accessibilityIdentifier = "info"
text.backgroundColor = UIColor.clear
text.isEditable = false
text.isSelectable = false
text.textAlignment = .left
text.textColor = UIColor.white
rect.addSubview(text)
view.addSubview(rect)
bindEvents()
}
// singleTap/doubleTap/rotate/swipe/longPress/pinch/drag
func bindEvents() {
// singleTap
let tapSingle = UITapGestureRecognizer(target:self,action:#selector(tapSingleDid))
tapSingle.numberOfTapsRequired = 1
tapSingle.numberOfTouchesRequired = 1
view.addGestureRecognizer(tapSingle)
// doubleTap
let tapDouble = UITapGestureRecognizer(target:self,action:#selector(tapDoubleDid(_:)))
tapDouble.numberOfTapsRequired = 2
tapDouble.numberOfTouchesRequired = 1
tapSingle.require(toFail: tapDouble)
view.addGestureRecognizer(tapDouble)
// two finger rotation
let rotation = UIRotationGestureRecognizer(target:self,action:#selector(rotationDid(_:)))
view.addGestureRecognizer(rotation)
// swipe up down left right
let swipeUp = UISwipeGestureRecognizer(target:self,action:#selector(swipeDid(_:)))
swipeUp.direction = .up
view.addGestureRecognizer(swipeUp)
let swipeDown = UISwipeGestureRecognizer(target:self,action:#selector(swipeDid(_:)))
swipeDown.direction = .down
view.addGestureRecognizer(swipeDown)
let swipeLeft = UISwipeGestureRecognizer(target:self,action:#selector(swipeDid(_:)))
swipeLeft.direction = .left
view.addGestureRecognizer(swipeLeft)
let swipeRight = UISwipeGestureRecognizer(target:self,action:#selector(swipeDid(_:)))
swipeRight.direction = .right
view.addGestureRecognizer(swipeRight)
// longPress
let longPress = UILongPressGestureRecognizer(target:self,action:#selector(longPressDid(_:)))
view.addGestureRecognizer(longPress)
// pinch
let pinch = UIPinchGestureRecognizer(target:self,action:#selector(pinchDid(_:)))
view.addGestureRecognizer(pinch)
// drag(pan)
let pan = UIPanGestureRecognizer(target:self,action:#selector(panDid(_:)))
pan.maximumNumberOfTouches = 1
rect.addGestureRecognizer(pan)
}
func printInfo(name:String, other:String) {
text.text = "event: \(name)\n\n\(other)";
}
@objc func tapSingleDid(_ recognizer:UISwipeGestureRecognizer) {
let point = recognizer.location(in: view)
printInfo(name: "singleTap", other: "x:\(point.x) y:\(point.y)")
}
@objc func tapDoubleDid(_ recognizer:UISwipeGestureRecognizer) {
let point = recognizer.location(in: view)
printInfo(name: "doubleTap", other: "x:\(point.x) y:\(point.y)")
}
@objc func rotationDid(_ recognizer:UIRotationGestureRecognizer) {
let point = recognizer.location(in: view)
let rotation = recognizer.rotation * (180 / CGFloat(M_PI))
printInfo(name: "rotation", other: "x:\(point.x) y:\(point.y)\nrotation:\(rotation)")
}
@objc func longPressDid(_ recognizer: UILongPressGestureRecognizer) {
let point = recognizer.location(in: view)
if recognizer.state == .began {
printInfo(name: "longPress", other: "x:\(point.x) y:\(point.y)\nstate: start")
} else {
printInfo(name: "longPress", other: "x:\(point.x) y:\(point.y)\nstate: end")
}
}
@objc func pinchDid(_ recognizer:UIPinchGestureRecognizer) {
let point = recognizer.location(in: view)
printInfo(name: "pinch", other: "x:\(point.x) y:\(point.y)\nscale: \(recognizer.scale)")
}
@objc func swipeDid(_ recognizer:UISwipeGestureRecognizer) {
let point = recognizer.location(in: view)
var temp:String = ""
if (recognizer.direction == .up) {
temp = "up"
} else if (recognizer.direction == .down) {
temp = "down"
} else if (recognizer.direction == .left) {
temp = "left"
} else if (recognizer.direction == .right) {
temp = "right"
}
printInfo(name: "swipe \(temp)", other: "x:\(point.x) y:\(point.y)\n")
}
@objc func panDid(_ recognizer:UISwipeGestureRecognizer) {
let point = recognizer.location(in: view)
rect.center = point
printInfo(name: "drag", other: "x:\(point.x) y:\(point.y)\n")
}
}
| 37.705479 | 100 | 0.633606 |
e5fdce57f1934dde582f304381757405642ef95e | 5,103 | swift | Swift | KarteTests/KarteCoreTests/IntegrationTests/Tracking/TrackCommonSpec.swift | orchid69/karte-ios-sdk | 42f33499f65c2b889b98946115eb1337925a2493 | [
"Apache-2.0"
] | 6 | 2020-05-12T02:37:19.000Z | 2022-01-18T08:10:03.000Z | KarteTests/KarteCoreTests/IntegrationTests/Tracking/TrackCommonSpec.swift | orchid69/karte-ios-sdk | 42f33499f65c2b889b98946115eb1337925a2493 | [
"Apache-2.0"
] | 13 | 2020-08-08T02:58:28.000Z | 2022-03-11T14:40:16.000Z | KarteTests/KarteCoreTests/IntegrationTests/Tracking/TrackCommonSpec.swift | orchid69/karte-ios-sdk | 42f33499f65c2b889b98946115eb1337925a2493 | [
"Apache-2.0"
] | 4 | 2020-07-02T04:03:22.000Z | 2022-03-09T01:18:40.000Z | //
// Copyright 2020 PLAID, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
import Quick
import Nimble
import Mockingjay
@testable import KarteCore
class TrackCommonSpec: QuickSpec {
override func spec() {
var idfa: IDFA!
var configuration: KarteCore.Configuration!
var builder: Builder!
beforeSuite {
idfa = IDFA()
configuration = Configuration { (configuration) in
configuration.isSendInitializationEventEnabled = false
configuration.idfaDelegate = idfa
}
builder = StubBuilder(spec: self, resource: .empty).build()
}
describe("a tracker") {
describe("its track common") {
var body: TrackBodyParameters!
beforeEachWithMetadata { (metadata) in
let module = StubActionModule(self, metadata: metadata, builder: builder, eventName: EventName("test")) { (_, b, _) in
body = b
}
KarteApp.setup(appKey: APP_KEY, configuration: configuration)
let event = Event(eventName: EventName("test"))
Tracker.track(event: event)
module.wait()
}
it("keys.visitor_id is `dummy_visitor_id`") {
expect(body.keys.visitorId).to(equal("dummy_visitor_id"))
}
it("keys.pv_id is `dummy_pv_id`") {
expect(body.keys.pvId.identifier).to(equal("dummy_pv_id"))
}
it("keys.original_pv_id is `dummy_original_pv_id`") {
expect(body.keys.originalPvId.identifier).to(equal("dummy_original_pv_id"))
}
it("app_info.version_name is `1.0.0`") {
expect(body.appInfo.versionName).to(equal("1.0.0"))
}
it("app_info.version_code is `1`") {
expect(body.appInfo.versionCode).to(equal("1"))
}
it("app_info.karte_sdk_version is `1.0.0`") {
expect(body.appInfo.karteSdkVersion).to(equal("1.0.0"))
}
it("app_info.module_info.core is `2.0.0`") {
expect(body.appInfo.moduleInfo["core"]).to(equal("2.0.0"))
}
it("app_info.module_info.in_app_messaging is `2.0.0`") {
expect(body.appInfo.moduleInfo["in_app_messaging"]).to(equal("2.0.0"))
}
it("app_info.system_info.os is `iOS`") {
expect(body.appInfo.systemInfo.os).to(equal("iOS"))
}
it("app_info.system_info.os_version is `13.0`") {
expect(body.appInfo.systemInfo.osVersion).to(equal("13.0"))
}
it("app_info.system_info.device is `iPhone`") {
expect(body.appInfo.systemInfo.device).to(equal("iPhone"))
}
it("app_info.system_info.model is `iPhone10,3`") {
expect(body.appInfo.systemInfo.model).to(equal("iPhone10,3"))
}
it("app_info.system_info.bundle_id is `io.karte`") {
expect(body.appInfo.systemInfo.bundleId).to(equal("io.karte"))
}
it("app_info.system_info.language is `ja-JP`") {
expect(body.appInfo.systemInfo.language).to(equal("ja-JP"))
}
it("app_info.system_info.idfv is `dummy_idfv`") {
expect(body.appInfo.systemInfo.idfv).to(equal("dummy_idfv"))
}
it("app_info.system_info.idfa is `dummy_idfa`") {
expect(body.appInfo.systemInfo.idfa).to(equal("dummy_idfa"))
}
it("app_info.system_info.screen.width is 375") {
expect(body.appInfo.systemInfo.screen.width).to(equal(375))
}
it("app_info.system_info.screen.height is 812") {
expect(body.appInfo.systemInfo.screen.height).to(equal(812))
}
}
}
}
}
| 39.55814 | 138 | 0.499118 |
d10682882dcec868a5cb6b59be556cbd61e5b665 | 1,333 | swift | Swift | BitmovinAnalyticsCollector/Classes/BitmovinPlayer/Classes/util/BitmovinPlayerUtil.swift | djr/bitmovin-analytics-collector-ios | 2f4b2aca5979f60898c5fd43343d6ad080db8fc1 | [
"MIT"
] | 3 | 2019-10-03T05:24:44.000Z | 2021-10-05T15:58:04.000Z | BitmovinAnalyticsCollector/Classes/BitmovinPlayer/Classes/util/BitmovinPlayerUtil.swift | djr/bitmovin-analytics-collector-ios | 2f4b2aca5979f60898c5fd43343d6ad080db8fc1 | [
"MIT"
] | 13 | 2018-06-19T13:56:59.000Z | 2022-01-20T14:33:50.000Z | BitmovinAnalyticsCollector/Classes/BitmovinPlayer/Classes/util/BitmovinPlayerUtil.swift | djr/bitmovin-analytics-collector-ios | 2f4b2aca5979f60898c5fd43343d6ad080db8fc1 | [
"MIT"
] | 13 | 2019-06-21T13:04:37.000Z | 2021-10-05T14:20:23.000Z | import Foundation
import BitmovinPlayer
public class BitmovinPlayerUtil {
static func playerVersion() -> String? {
return Bundle(for: Player.self).object(forInfoDictionaryKey: "CFBundleShortVersionString") as? String
}
static func getAdPositionFromString(string: String?)-> AdPosition? {
if (string == nil) {
return nil;
}
switch string {
case "pre":
return .pre;
case "post":
return .post;
case "mid":
return .mid;
default:
return .mid;
}
}
static func getAdTagTypeFromAdTag(adTag: AdTag)-> AnalyticsAdTagType {
switch adTag.type {
case .VAST:
return .VAST;
case .VMAP:
return .VMAP;
default:
return .UNKNOWN;
}
}
static func getAdQuartileFromPlayerAdQuartile(adQuartile: AdQuartile) -> AnalyticsAdQuartile {
switch adQuartile {
case .firstQuartile:
return .FIRST_QUARTILE;
case .midpoint:
return .MIDPOINT;
case .thirdQuartile:
return .THIRD_QUARTILE;
@unknown default:
fatalError()
}
}
}
| 26.137255 | 109 | 0.513128 |
f4df1eaf85a1114d35acee74b3fd950d4fe1be55 | 5,629 | go | Go | runtime/storage.go | bradleyjkemp/simple-fuzz | ddf11ae33dedfcd1d68f1e698633d895ab9ac26d | [
"Apache-2.0"
] | 11 | 2019-11-24T17:30:30.000Z | 2020-02-16T21:59:43.000Z | runtime/storage.go | bradleyjkemp/simple-fuzz | ddf11ae33dedfcd1d68f1e698633d895ab9ac26d | [
"Apache-2.0"
] | null | null | null | runtime/storage.go | bradleyjkemp/simple-fuzz | ddf11ae33dedfcd1d68f1e698633d895ab9ac26d | [
"Apache-2.0"
] | null | null | null | package main
import (
"bytes"
"crypto/sha1"
"encoding/json"
"fmt"
"io/ioutil"
"os"
"path/filepath"
"regexp"
"sort"
"strconv"
"strings"
"text/template"
"time"
)
type Sig [sha1.Size]byte
func hash(data []byte) Sig {
return Sig(sha1.Sum(data))
}
type corpusItem struct {
data []byte
cover []byte
coverFrequency *int
}
type storage struct {
initialCorpus [][]byte
crashersDir string
corpusDir string
crashers map[Sig][]byte
suppressions map[string]bool
corpusItems []*corpusItem
currentInputID int
currentInputCount int
// Stores how many times each unique cover has been seen
// Used to prioritise mutating inputs which exercise rare paths
coverFrequencies map[Sig]*int
lastCorpusSort time.Time
}
type crasherMetadata struct {
Data []byte
Suppression string
}
func newStorage() (*storage, error) {
dir := "."
crashersDir := filepath.Join(dir, "crashers")
corpusDir := filepath.Join(dir, "corpus")
s := &storage{
crashersDir: crashersDir,
corpusDir: corpusDir,
crashers: map[Sig][]byte{},
suppressions: map[string]bool{},
coverFrequencies: map[Sig]*int{},
}
os.MkdirAll(crashersDir, 0755)
os.MkdirAll(corpusDir, 0755)
err := filepath.Walk(crashersDir, s.crasherWalker)
if err != nil {
return nil, err
}
err = filepath.Walk(corpusDir, s.corpusWalker)
if err != nil {
return nil, err
}
return s, nil
}
var (
minPriority = 100
maxPriority = 500 * minPriority
)
func (s *storage) getNextInput() []byte {
if s.currentInputCount > 0 {
s.currentInputCount--
return s.corpusItems[s.currentInputID].data
}
s.currentInputID++
if s.currentInputID >= len(s.corpusItems) {
if time.Since(s.lastCorpusSort) > 10*time.Second {
s.lastCorpusSort = time.Now()
s.sortCorpus()
}
s.currentInputID = 0
}
maxFrequency := *s.corpusItems[0].coverFrequency
s.currentInputCount = maxFrequency / *s.corpusItems[s.currentInputID].coverFrequency
// Enforce a minimum number of iterations for performance reasons
if s.currentInputCount < minPriority {
s.currentInputCount = minPriority
}
// Cap the multiplier at 500x the lowest priority input to prevent starvation
// TODO: enforce a max time mutating each input
if s.currentInputCount > maxPriority {
s.currentInputCount = maxPriority
}
return s.getNextInput()
}
var missedCoverages int
var hitCoverages int
func (s *storage) reportCoverage(cover []byte) {
if count := s.coverFrequencies[hash(cover)]; count != nil {
*count++
hitCoverages++
} else {
missedCoverages++
}
}
func (s *storage) addInput(input, cover []byte) error {
coverFrequency := s.coverFrequencies[hash(cover)]
if coverFrequency == nil {
count := 1
s.coverFrequencies[hash(cover)] = &count
coverFrequency = &count
}
item := &corpusItem{data: input, cover: makeCopy(cover), coverFrequency: coverFrequency}
s.corpusItems = append(s.corpusItems, item)
filename := fmt.Sprintf("%x", hash(input))
return ioutil.WriteFile(filepath.Join(s.corpusDir, filename), input, 0644)
}
func (s *storage) sortCorpus() {
// Sort by decreasing coverFrequencies value (i.e. so inputs that exercise rarer paths
// are nearer the end of the list)
sort.Slice(s.corpusItems, func(i, j int) bool {
return *(s.corpusItems[i].coverFrequency) > *s.corpusItems[j].coverFrequency
})
}
func (s *storage) addCrasher(input []byte, error []byte, hanging bool, suppression []byte) {
s.crashers[hash(input)] = input
s.suppressions[string(suppression)] = true
crashFileContents := &bytes.Buffer{}
jsonMetadata, _ := json.Marshal(crasherMetadata{
Data: input,
Suppression: string(suppression),
})
err := crasherTemplate.Execute(crashFileContents, map[string]interface{}{
"JSON": string(jsonMetadata),
"Error": string(error),
"Input": strconv.Quote(string(input)),
})
if err != nil {
panic(err)
}
h := hash(input)
filename := fmt.Sprintf("%x.md", h[:7])
ioutil.WriteFile(filepath.Join(s.crashersDir, filename), crashFileContents.Bytes(), 0644)
}
// TODO: include a fully runnable example in this output
var crasherTemplate = template.Must(template.New("crasher").Parse(
`[fuzz-crasher]: <> ({{.JSON}})
simple-fuzz detected the following crash:
` + "```" + `
{{.Error}}
` + "```" + `
When run on this input:
` + "```" + `
{{.Input}}
` + "```" + `
`))
var rCrasherMetadata = regexp.MustCompile(`(?m)^\[fuzz-crasher]: <> \((.*)\)$`)
func (s *storage) crasherWalker(path string, info os.FileInfo, err error) error {
if info.IsDir() && path != "crashers" {
// Only load crashers from the top level directory
return filepath.SkipDir
}
if !strings.EqualFold(filepath.Ext(info.Name()), ".md") {
return nil
}
contents, err := ioutil.ReadFile(path)
if err != nil {
return err
}
metadata := rCrasherMetadata.FindSubmatch(contents)
if metadata == nil {
// This is just a markdown file without any metadata.
// Odd (this is not generated by us) but not an error
return nil
}
crasher := &crasherMetadata{}
if err := json.Unmarshal(metadata[1], crasher); err != nil {
// metadata existed but was invalid: probably a bad thing
return fmt.Errorf("invalid crasher metadata: %v", err)
}
s.crashers[hash(crasher.Data)] = crasher.Data
s.suppressions[crasher.Suppression] = true
return nil
}
// Simply recursively reads all files and puts them into the corpus
func (s *storage) corpusWalker(path string, info os.FileInfo, err error) error {
if info.IsDir() {
return nil
}
contents, err := ioutil.ReadFile(path)
if err != nil {
return err
}
s.initialCorpus = append(s.initialCorpus, contents)
return nil
}
| 24.473913 | 92 | 0.691775 |
d07e64fe7fb642d5d0cd93ae8085cc096d864359 | 2,812 | css | CSS | css/styles.css | rachelegibbons/vacation-match | b58c026622420dbcdf68caa732c1f0363799999d | [
"MIT"
] | null | null | null | css/styles.css | rachelegibbons/vacation-match | b58c026622420dbcdf68caa732c1f0363799999d | [
"MIT"
] | null | null | null | css/styles.css | rachelegibbons/vacation-match | b58c026622420dbcdf68caa732c1f0363799999d | [
"MIT"
] | null | null | null | .container {
width: 100%;
}
#hawaii, #philadelphia, #mtBachelor, #noMatch {
display: none;
}
body {
font-family: 'Work Sans', sans-serif;
color: black;
text-align: center;
}
.icon {
width: 40px !important;
height: 40px !important;
}
/* Header Styling */
#header {
color: white;
margin: auto;
padding-top: 60px;
padding-bottom: 40px;
text-align: center;
background-color: rgb(100%, 37%, 2%);
}
#header h1 {
font-weight: 900;
font-size: 74px;
color: white;
}
#header p {
font-size: 20px;
font-weight: 300;
}
.arrow {
width: 60px !important;
height: 60px !important;
padding-top: 40px;
}
/* Form Styling */
#input {
padding: 40px 40px;
color: black;
font-weight: 300;
text-align: center;
}
.form-control {
text-align: center;
}
label {
font-weight: 400;
font-size: 17px;
}
#submit {
background-color: white;
color: rgb(100%, 37%, 2%);
border: 1px solid;
border-radius: 0px;
padding: 15px 20px;
margin-top: 10px;
}
#submit:hover {
background-color: rgb(100%, 37%, 2%);
color: white;
}
/* Hawaii Styling */
#hawaii {
padding: 120px 40px;
background-color: rgb(91%, 81%, 0%);
text-align: center;
}
#hawaii p {
padding-bottom: 20px;
}
#returnHawaii {
background-color: rgb(91%, 81%, 0%);
color: black;
border: 1px solid;
border-radius: 0px;
padding: 15px 20px;
}
#returnHawaii:hover {
background-color: black;
color: rgb(91%, 81%, 0%);
}
/* Philadelphia Styling */
#philadelphia {
padding: 120px 40px;
background-color: rgb(71%, 95%, 15%);
text-align: center;
}
#Philadelphia p {
padding-bottom: 20px;
}
#returnPhiladelphia {
background-color: rgb(71%, 95%, 15%);
color: black;
border: 1px solid;
border-radius: 0px;
padding: 15px 20px;
}
#returnPhiladelphia:hover {
background-color: black;
color: rgb(71%, 95%, 15%);
}
/* Mt Bachelor Styling */
#mtBachelor {
color: white;
padding: 120px 40px;
background-color: rgb(0%, 47%, 86%);
text-align: center;
}
#mtBachelor p {
padding-bottom: 20px;
}
#returnBachelor {
background-color: rgb(0%, 47%, 86%);
color: white;
border: 1px solid;
border-radius: 0px;
padding: 15px 20px;
}
#returnBachelor:hover {
background-color: white;
color: rgb(0%, 47%, 86%);
}
#noMatch {
color: white;
padding-top: 60px;
padding-bottom: 40px;
background-color: rgb(96%, 11%, 21%);
}
#noMatch a {
color: white;
font-style: normal;
}
#noMatch a:hover {
text-decoration: underline;
}
#returnNoMatch {
background-color: rgb(96%, 11%, 21%);
color: white;
border: 1px solid;
border-radius: 0px;
padding: 15px 20px;
}
#returnNoMatch:hover {
background-color: white;
color: rgb(96%, 11%, 21%);
}
#noMatch img {
max-width: 20%;
}
#noMatchDestinations {
margin-top: 40px;
margin-bottom: 40px;
}
| 14.645833 | 47 | 0.635135 |
1d5c31a3f42ac929531965e9a6e1d745d549405d | 906 | swift | Swift | Tests/CodableDataTests/Name.swift | SleekDiamond41/CodablePackage | 11f140af7bb77a11448fbcef641ef0edd150d487 | [
"MIT"
] | 1 | 2021-03-05T01:17:05.000Z | 2021-03-05T01:17:05.000Z | Tests/CodableDataTests/Name.swift | SleekDiamond41/CodablePackage | 11f140af7bb77a11448fbcef641ef0edd150d487 | [
"MIT"
] | null | null | null | Tests/CodableDataTests/Name.swift | SleekDiamond41/CodablePackage | 11f140af7bb77a11448fbcef641ef0edd150d487 | [
"MIT"
] | null | null | null | //
// Name.swift
//
//
// Created by Michael Arrington on 1/31/20.
//
import Foundation
import CodableData
struct Name: UUIDModel, Codable, Filterable, Equatable {
let id: UUID
var first: String
var last: String
var age: Int = 0
static var idKey = \Name.id
enum CodingKeys: String, CodingKey {
case id
case first
case last
case age
}
static func key(for path: PartialKeyPath<Name>) -> CodingKeys {
switch path {
case \Name.id: return .id
case \Name.first: return .first
case \Name.last: return .last
case \Name.age: return .age
default:
preconditionFailure()
}
}
static func path(for key: CodingKeys) -> PartialKeyPath<Name> {
switch key {
case .id: return \.id
case .first: return \.first
case .last: return \.last
case .age: return \.age
}
}
}
| 19.276596 | 67 | 0.592715 |
092299c4b8a8ae5c0bc32a00e726ae2a896a668a | 423 | dart | Dart | lib/components/test_details_page.dart | XguangY/flutter_ov_template | 0ff16b7efc3f74665d4a0b430533a3ebb427ce71 | [
"MIT"
] | null | null | null | lib/components/test_details_page.dart | XguangY/flutter_ov_template | 0ff16b7efc3f74665d4a0b430533a3ebb427ce71 | [
"MIT"
] | null | null | null | lib/components/test_details_page.dart | XguangY/flutter_ov_template | 0ff16b7efc3f74665d4a0b430533a3ebb427ce71 | [
"MIT"
] | null | null | null | /*
* @Author: XguangY
* @Date: 2020-08-18 17:41:25
* @LastEditors: XguangY
* @LastEditTime: 2020-08-18 17:42:16
* @Description: 用于测试路由fluro插件的页面
* @version: 0.01
*/
import 'package:flutter/material.dart';
class DetailsPage extends StatelessWidget {
final String goodsId;
DetailsPage(this.goodsId);
@override
Widget build(BuildContext context) {
return Container(child: Text('商品ID为:' + goodsId));
}
}
| 21.15 | 54 | 0.699764 |
90bbf96a5d1ff0556bd9e10a043c803bd444c9d7 | 1,940 | py | Python | test/exploration/broadcast_ibeacon.py | gotoiot/service-beacons-broadcaster | e0e409f948a5f18f7f4eb5d1dfdf95182fb9aa14 | [
"MIT"
] | 1 | 2021-11-26T20:33:17.000Z | 2021-11-26T20:33:17.000Z | test/exploration/broadcast_ibeacon.py | gotoiot/service-beacons-broadcaster | e0e409f948a5f18f7f4eb5d1dfdf95182fb9aa14 | [
"MIT"
] | null | null | null | test/exploration/broadcast_ibeacon.py | gotoiot/service-beacons-broadcaster | e0e409f948a5f18f7f4eb5d1dfdf95182fb9aa14 | [
"MIT"
] | 4 | 2021-07-09T20:39:02.000Z | 2022-02-06T17:37:44.000Z | import os
import subprocess
import sys
import re
import getopt
import uuid
device = "hci0"
uuid = "E20A39F473F54BC4A12F17D1AD07A961"
major = 0
minor = 0
power = 200
def hexsplit(string):
""" Split a hex string into 8-bit/2-hex-character groupings separated by spaces"""
return ' '.join([string[i:i+2] for i in range(0, len(string), 2)])
def hexify(i, digits=4):
""" convert an integer into a hex value of a given number of digits"""
format_string = "0%dx" % digits
return format(i, format_string).upper()
def process_command(command):
print(f" | >>> {command}")
os.system(command)
split_uuid = hexsplit(uuid)
# convert major/minor id into hex
major_hex = hexify(major, 4)
minor_hex = hexify(minor, 4)
# create split versions of these (for the hcitool command)
split_major_hex = hexsplit(major_hex)
split_minor_hex = hexsplit(minor_hex)
# convert power into hex
power_hex = hexify(power, 2)
def print_settings(**kwargs):
print(f"Advertising on device {device}. Parameters:")
print(f" uuid: 0x{uuid}")
print(f"major/minor: {major}/{minor} (0x{major_hex}/0x{minor_hex})")
print(f" power: {power} (0x{power_hex})")
def start_ibeacon_broadcast():
print (f"Starting iBeacon broadcasting on {device}")
process_command(f"hciconfig {device} up")
process_command(f"hciconfig {device} leadv")
process_command(f"hciconfig {device} noscan")
process_command(f"hcitool -i {device} cmd 0x08 0x0008 1E 02 01 1A 1A FF 4C 00 02 15 {split_uuid} {split_major_hex} {split_minor_hex} {power_hex} 00 >/dev/null")
def stop_ibeacon_broadcast():
print (f"Starting iBeacon broadcasting on {device}")
process_command(f"hciconfig {device} noleadv")
process_command(f"hciconfig {device} piscan")
process_command(f"hciconfig {device} down")
if __name__ == "__main__":
print_settings()
start_ibeacon_broadcast()
time.sleep(10)
stop_ibeacon_broadcast
| 28.529412 | 164 | 0.709278 |
54bfc4062eb22c9030442aef97737fa8c61f40e3 | 7,453 | swift | Swift | ui/WindfishIDE/Project/ViewController/OutlineViewController.swift | jverkoey/awaken | 743755248996deb7181ae92f6e60be5656439c44 | [
"Apache-2.0"
] | 68 | 2020-12-16T10:06:48.000Z | 2022-03-29T19:54:01.000Z | ui/WindfishIDE/Project/ViewController/OutlineViewController.swift | jverkoey/awaken | 743755248996deb7181ae92f6e60be5656439c44 | [
"Apache-2.0"
] | 62 | 2020-12-19T04:28:41.000Z | 2021-02-15T22:18:16.000Z | ui/WindfishIDE/Project/ViewController/OutlineViewController.swift | jverkoey/awaken | 743755248996deb7181ae92f6e60be5656439c44 | [
"Apache-2.0"
] | 4 | 2021-01-17T03:51:22.000Z | 2021-01-21T16:26:53.000Z | import AppKit
import Foundation
import Cocoa
import Combine
class ProjectOutlineNode: NSObject {
enum NodeType: Int, Codable {
case container
case document
case unknown
}
var type: NodeType = .unknown
var title: String = ""
var identifier: String = ""
var url: URL?
@objc dynamic var children = [ProjectOutlineNode]()
}
extension ProjectOutlineNode {
@objc var count: Int {
children.count
}
@objc dynamic var isLeaf: Bool {
return type == .document
}
}
final class OutlineViewController: NSViewController {
let project: Project
let containerView = NSScrollView()
let outlineView = NSOutlineView()
let treeController = NSTreeController()
@objc var contents: [ProjectOutlineNode] = []
private var disassembledSubscriber: AnyCancellable?
private var treeControllerObserver: NSKeyValueObservation?
init(project: Project) {
self.project = project
super.init(nibName: nil, bundle: nil)
}
override func viewWillAppear() {
super.viewWillAppear()
populateFromDocument()
disassembledSubscriber = NotificationCenter.default.publisher(for: .disassembled, object: project)
.receive(on: RunLoop.main)
.sink(receiveValue: { notification in
let selectionIndexPaths = self.treeController.selectionIndexPaths
self.populateFromDocument()
self.treeController.setSelectionIndexPaths(selectionIndexPaths)
})
}
private func populateFromDocument() {
guard let disassemblyFiles = project.disassemblyResults?.files else {
return
}
let children = treeController.arrangedObjects.children![0]
children.mutableChildren.removeAllObjects()
disassemblyFiles.keys.sorted().reversed().forEach {
let node = ProjectOutlineNode()
node.title = $0
node.type = .document
treeController.insert(node, atArrangedObjectIndexPath: IndexPath(indexes: [0, 0]))
}
}
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}
override func loadView() {
view = NSView()
containerView.hasVerticalScroller = true
containerView.hasHorizontalScroller = true
containerView.autohidesScrollers = true
containerView.drawsBackground = false
containerView.usesPredominantAxisScrolling = false
for subview in [containerView] {
subview.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(subview)
}
// Data bindings
treeController.objectClass = ProjectOutlineNode.self
treeController.childrenKeyPath = "children"
treeController.countKeyPath = "count"
treeController.leafKeyPath = "isLeaf"
treeController.preservesSelection = true
treeController.selectsInsertedObjects = false
treeController.bind(.contentArray,
to: self,
withKeyPath: "contents",
options: nil)
outlineView.bind(.content,
to: treeController,
withKeyPath: "arrangedObjects",
options: nil)
outlineView.bind(.selectionIndexPaths,
to: treeController,
withKeyPath: "selectionIndexPaths",
options: nil)
let column = NSTableColumn(identifier: .init(rawValue: "col1"))
column.isEditable = false
column.headerCell.stringValue = "Header"
column.resizingMask = .autoresizingMask
outlineView.addTableColumn(column)
outlineView.outlineTableColumn = column
outlineView.headerView = nil // Hide the header
outlineView.delegate = self
outlineView.backgroundColor = .clear
if #available(OSX 11.0, *) {
outlineView.style = .plain
}
// outlineView.selectionHighlightStyle = .sourceList
outlineView.columnAutoresizingStyle = .lastColumnOnlyAutoresizingStyle
outlineView.allowsMultipleSelection = false
outlineView.allowsEmptySelection = true
outlineView.allowsColumnSelection = false
// outlineView.autosaveName = "OutlineView"
outlineView.autosaveTableColumns = false
outlineView.indentationPerLevel = 13
outlineView.indentationMarkerFollowsCell = true
outlineView.rowSizeStyle = .default
outlineView.autosaveExpandedItems = true
outlineView.allowsColumnResizing = false
outlineView.allowsColumnReordering = false
outlineView.floatsGroupRows = false
NSLayoutConstraint.activate([
containerView.leftAnchor.constraint(equalTo: view.leftAnchor),
containerView.rightAnchor.constraint(equalTo: view.rightAnchor),
containerView.topAnchor.constraint(equalTo: view.topAnchor),
containerView.bottomAnchor.constraint(equalTo: view.bottomAnchor),
])
addGroupNode("Source", identifier: "disassembly")
outlineView.expandItem(treeController.arrangedObjects.children![0])
containerView.documentView = outlineView
// Clear any default selection.
outlineView.deselectAll(self)
var lastSelectedObjects: [ProjectOutlineNode] = []
treeControllerObserver = treeController.observe(\.selectedObjects, options: [.new]) { (treeController, change) in
precondition(treeController.selectedObjects.count <= 1, "Multiple selection not supported")
guard let selectedNodes = treeController.selectedObjects as? [ProjectOutlineNode] else {
return
}
guard lastSelectedObjects != selectedNodes else {
return
}
lastSelectedObjects = selectedNodes
NotificationCenter.default.post(
name: .selectedFileDidChange,
object: self.project,
userInfo: ["selectedNodes": treeController.selectedObjects]
)
}
}
private func addGroupNode(_ folderName: String, identifier: String) {
let node = ProjectOutlineNode()
node.type = .container
node.title = folderName
node.identifier = identifier
let insertionIndexPath = IndexPath(index: contents.count)
treeController.insert(node, atArrangedObjectIndexPath: insertionIndexPath)
}
}
extension OutlineViewController: NSOutlineViewDelegate {
// Return a Node class from the given outline view item, through it's representedObject.
class func node(from item: Any) -> ProjectOutlineNode? {
if let treeNode = item as? NSTreeNode, let node = treeNode.representedObject as? ProjectOutlineNode {
return node
} else {
return nil
}
}
func outlineView(_ outlineView: NSOutlineView, isGroupItem item: Any) -> Bool {
if let node = OutlineViewController.node(from: item) {
return node.type == .container
}
return false
}
func outlineView(_ outlineView: NSOutlineView, shouldSelectItem item: Any) -> Bool {
if let node = OutlineViewController.node(from: item) {
return node.type != .container
}
return true
}
func outlineView(_ outlineView: NSOutlineView, viewFor tableColumn: NSTableColumn?, item: Any) -> NSView? {
guard let node = OutlineViewController.node(from: item) else {
return nil
}
let identifier = NSUserInterfaceItemIdentifier("content-cell")
var view: NSTableCellView?
if let recycledView = outlineView.makeView(withIdentifier: identifier, owner: self) as? NSTableCellView {
view = recycledView
} else {
let newCell = TextTableCellView()
newCell.identifier = identifier
view = newCell
}
view?.textField?.stringValue = node.title
view?.textField?.isEditable = false
return view
}
}
| 31.580508 | 117 | 0.706159 |
85be268bd34154aa478b51ee12fbb079689d37f7 | 268 | h | C | edu_examples/AlarmaBuzzer/inc/Buzzer.h | envido32/edu-CIAA-TPs | 1310ed6a10845230086676bb42e811cf12074668 | [
"BSD-3-Clause"
] | null | null | null | edu_examples/AlarmaBuzzer/inc/Buzzer.h | envido32/edu-CIAA-TPs | 1310ed6a10845230086676bb42e811cf12074668 | [
"BSD-3-Clause"
] | null | null | null | edu_examples/AlarmaBuzzer/inc/Buzzer.h | envido32/edu-CIAA-TPs | 1310ed6a10845230086676bb42e811cf12074668 | [
"BSD-3-Clause"
] | null | null | null | /*
* Buzzer.h
*
* Created on: 18 de abr. de 2016
* Author: Leo
*/
#include "stdint.h"
#include "puertos.h"
#include "chip.h"
#define ALARMA 12
void alarma_init(void);
void alarma_on(void);
void alarma_off(void);
void delay(void);
void delay2(void);
| 12.181818 | 34 | 0.649254 |
801e32fdff8dda0a8cac2c70b677be652cf39843 | 325 | asm | Assembly | core/boot/limine_entry.asm | TheUltimateFoxOS/horizon | a68210d9c2afcfbb4c621cf199a24d5b65046c8f | [
"MIT"
] | 4 | 2022-01-06T09:19:46.000Z | 2022-03-27T18:08:36.000Z | core/boot/limine_entry.asm | TheUltimateFoxOS/horizon | a68210d9c2afcfbb4c621cf199a24d5b65046c8f | [
"MIT"
] | null | null | null | core/boot/limine_entry.asm | TheUltimateFoxOS/horizon | a68210d9c2afcfbb4c621cf199a24d5b65046c8f | [
"MIT"
] | 1 | 2022-03-22T19:10:05.000Z | 2022-03-22T19:10:05.000Z | [global _start_limine]
[extern limine_entry]
_start_limine:
push qword 0
push qword 0
mov rbp, rsp
call cpu_init
call limine_entry
cpu_init:
cli
push rbx
; enable coprocessor (fpu and sse)
mov rax, cr0
and ax, 0xFFFB
or ax, 0x2
mov cr0, rax
mov rax, cr4
or ax, 3 << 9
mov cr4, rax
fninit
pop rbx
ret | 11.206897 | 35 | 0.695385 |
61d8d4979907d3c1b96cd2f31d59b5a7b440eb3b | 1,187 | swift | Swift | ProgressKit/DeterminateVC.swift | EpicDraws/ProgressKit | 4a02dd081aa03a672e6f9f4988df43abbab89dd6 | [
"MIT"
] | 550 | 2015-10-15T20:32:44.000Z | 2021-12-16T17:10:19.000Z | ProgressKit/DeterminateVC.swift | EpicDraws/ProgressKit | 4a02dd081aa03a672e6f9f4988df43abbab89dd6 | [
"MIT"
] | 21 | 2015-10-26T07:08:01.000Z | 2020-08-08T12:06:00.000Z | ProgressKit/DeterminateVC.swift | EpicDraws/ProgressKit | 4a02dd081aa03a672e6f9f4988df43abbab89dd6 | [
"MIT"
] | 92 | 2015-10-11T14:31:33.000Z | 2022-02-09T05:53:05.000Z | //
// ViewController.swift
// ProgressKit
//
// Created by Kauntey Suryawanshi on 30/06/15.
// Copyright (c) 2015 Kauntey Suryawanshi. All rights reserved.
//
import Cocoa
class DeterminateViewController: NSViewController {
@objc dynamic var liveProgress: Bool = true
@objc dynamic var labelPercentage: String = "30%"
override func viewDidLoad() {
preferredContentSize = NSMakeSize(500, 300)
}
@IBOutlet weak var slider: NSSlider!
@IBAction func sliderDragged(_ sender: NSSlider) {
let event = NSApplication.shared.currentEvent
// let dragStart = event!.type == NSEventType.LeftMouseDown
let dragEnd = event!.type == NSEvent.EventType.leftMouseUp
// let dragging = event!.type == NSEventType.LeftMouseDragged
if liveProgress || dragEnd {
setProgress(CGFloat(sender.floatValue))
}
labelPercentage = "\(Int(sender.floatValue * 100))%"
}
func setProgress(_ progress: CGFloat) {
for view in self.view.subviews {
if view is DeterminateAnimation {
(view as! DeterminateAnimation).progress = progress
}
}
}
}
| 26.377778 | 68 | 0.644482 |
1bed0fd900c26fe855cc95490e52dee62fcf50ba | 4,851 | py | Python | old/generate_aa_volume_data.py | iskandr/mhcpred | 71f082d94bbde9616ab31f0e70e7076240690163 | [
"Apache-2.0"
] | 1 | 2016-03-16T09:24:56.000Z | 2016-03-16T09:24:56.000Z | old/generate_aa_volume_data.py | iskandr/mhcpred | 71f082d94bbde9616ab31f0e70e7076240690163 | [
"Apache-2.0"
] | null | null | null | old/generate_aa_volume_data.py | iskandr/mhcpred | 71f082d94bbde9616ab31f0e70e7076240690163 | [
"Apache-2.0"
] | null | null | null | from collections import OrderedDict
import pandas as pd
import numpy as np
from os.path import exists
import subprocess
import pandas as pd
import logging
from epitopes.amino_acid import volume
from dataset_helpers import filter_dataframe, extract_columns
def generate_pairwise_index_data(
df_peptides,
df_mhc,
neighboring_residue_interactions=False):
(peptide_alleles, peptide_seqs, category, ic50, ic50_mask) = \
extract_columns(df_peptides)
print "%d unique peptide alleles" % len(peptide_alleles.unique())
mhc_alleles = df_mhc['Allele'].str.replace('*', '')
mhc_seqs = df_mhc['Residues']
assert len(mhc_alleles) == len(df_mhc)
assert len(mhc_seqs) == len(df_mhc)
unique_alleles = set(peptide_alleles.unique())
print list(sorted(unique_alleles))
logging.info(
"%d / %d available alleles",
len(set(mhc_alleles).intersection(unique_alleles)),
len(unique_alleles)
)
logging.info(
"Missing allele sequences for %s",
list(sorted(unique_alleles.difference(set(mhc_alleles))))
)
mhc_seqs_dict = {}
for allele, seq in zip(mhc_alleles, mhc_seqs):
mhc_seqs_dict[allele] = seq
X = []
Y_IC50 = []
Y_category = []
alleles = []
n_dims = length * len(mhc_seqs[0])
Volume = volume.value_dict
for peptide_idx, allele in enumerate(peptide_alleles):
if allele in mhc_seqs_dict:
allele_seq = mhc_seqs_dict[allele]
peptide = peptide_seqs.ix[peptide_idx]
n_peptide_letters = len(peptide)
n_mhc_letters = len(allele_seq)
curr_ic50 = ic50[peptide_idx] * ic50_mask[peptide_idx]
binder = category[peptide_idx]
print peptide_idx, allele, peptide, curr_ic50, binder
#print peptide_idx, allele, peptide, allele_seq, ic50
vec_pep = [Volume[x] for x in peptide]
vec_contact = [Volume[x] for x in allele_seq]
vec = vec_pep + vec_contact
assert vec
assert len(vec) > 0
if len(X) > 0:
assert len(vec) == len(X[-1]), \
"Weird vector length %d (expected %d)" % \
(len(vec), len(X[-1]))
X.append(np.array(vec))
Y_IC50.append(curr_ic50)
Y_category.append(binder)
alleles.append(allele)
X = np.array(X)
assert X.ndim == 2, "Expected two-dimensional X, got %s" % (X.shape,)
Y_IC50 = np.array(Y_IC50)
Y_category = np.array(Y_category)
assert Y_IC50.ndim == 1, "Expected Y_IC50 to be a vector"
assert Y_category.ndim == 1, "Expected Y_category to be a vector"
assert len(Y_IC50) == X.shape[0]
assert len(Y_category) == X.shape[0]
return X, Y_IC50, Y_category, alleles
def generate_aa_feature_data(df_peptides, df_mhc):
alleles, epitopes, category, ic50, ic50_mask = extract_columns(df_peptides)
for i, epitope in enumerate(epitopes):
allele = alleles.irow(i)
if __name__ == '__main__':
logging.basicConfig(level=logging.INFO)
import argparse
parser = argparse.ArgumentParser(
description=
"""
Create pairwise interaction index features
and labels from MHC binding data
""".replace("\n", ' ')
)
parser.add_argument(
"--input-file",
default='mhc_grouped.csv')
parser.add_argument(
"--mhc-seq-filename",
default = "MHC_aa_seqs.csv")
parser.add_argument(
"--length",
type=int,
default=9)
parser.add_argument("--human",
default = False,
action="store_true")
parser.add_argument(
"--mhc-class",
default="I")
args = parser.parse_args()
df_peptides = pd.read_csv(args.input_file)
print "Loaded %d peptide/allele entries", len(df_peptides)
print df_peptides.columns
length = args.length
df_peptides = filter_dataframe(
df_peptides,
mhc_class = args.mhc_class,
length = args.length,
human = args.human)
df_mhc = pd.read_csv(args.mhc_seq_filename)
print df_mhc
print "Loaded %d MHC alleles" % len(df_mhc)
X, Y_IC50, Y_category, alleles = generate_pairwise_index_data(
df_peptides,
df_mhc)
print "Generated X.shape = %s" % (X.shape,)
print "# IC50 target values = %d" % (Y_IC50> 0).sum()
print "# binding category values = %d" % (Y_category!=0).sum()
print "Saving to disk..."
np.save("volume_X.npy", X)
np.save("volume_Y_IC50.npy", Y_IC50)
np.save("volume_Y_category.npy", Y_category)
with open('volume_alleles.txt', 'w') as f:
for allele in alleles:
f.write(allele)
f.write("\n")
| 30.702532 | 79 | 0.613069 |
c0ae3c88ed143c1277b900f0b7fe9eaea6ac261c | 11,532 | swift | Swift | Sources/PodToBUILD/SwiftLibrary.swift | iftechio/PodToBUILD | c938fc6036e145439c07789376f42012c4e870e4 | [
"Apache-2.0"
] | null | null | null | Sources/PodToBUILD/SwiftLibrary.swift | iftechio/PodToBUILD | c938fc6036e145439c07789376f42012c4e870e4 | [
"Apache-2.0"
] | null | null | null | Sources/PodToBUILD/SwiftLibrary.swift | iftechio/PodToBUILD | c938fc6036e145439c07789376f42012c4e870e4 | [
"Apache-2.0"
] | null | null | null | //
// SwiftLibrary.swift
// PodToBUILD
//
// Created by Jerry Marino on 10/16/18.
// Copyright © 2018 Pinterest Inc. All rights reserved.
//
// Represent a swift_library in Bazel
// https://github.com/bazelbuild/rules_swift/blob/master/doc/rules.md#swift_library
// Note: Swift support is currently in progress
// TODO:
// - XCConfig / compiler flags
public struct SwiftLibrary: BazelTarget {
public let name: String
public let sourceFiles: AttrSet<GlobNode>
public let moduleMap: ModuleMap?
public let moduleName: String
public let deps: AttrSet<[String]>
public let copts: AttrSet<[String]>
public let swiftcInputs: AttrSet<[String]>
public let isTopLevelTarget: Bool
public let externalName: String
public let data: AttrSet<GlobNode>
public init(name: String,
sourceFiles: AttrSet<GlobNode>,
moduleMap: ModuleMap?,
moduleName: String,
deps: AttrSet<[String]>,
copts: AttrSet<[String]>,
swiftcInputs: AttrSet<[String]>,
isTopLevelTarget: Bool,
externalName: String,
data: AttrSet<GlobNode>) {
self.name = name
self.sourceFiles = sourceFiles
self.moduleMap = moduleMap
self.moduleName = moduleName
self.externalName = externalName
self.isTopLevelTarget = isTopLevelTarget
self.deps = deps
self.copts = copts
self.swiftcInputs = swiftcInputs
self.data = data
}
public static func hasSwiftSources(spec: PodSpec) -> Bool {
return SwiftLibrary.getSources(spec: spec).hasSourcesOnDisk()
}
/// For swift, we crush the podspec sources into 1 lib
/// The function returns a union all the the spec's sources
private static func getSources(spec: PodSpec) -> AttrSet<GlobNode> {
let allSourceFiles = spec.attr(\.sourceFiles)
let implFiles = extractFiles(fromPattern: allSourceFiles,
includingFileTypes: SwiftLikeFileTypes)
.unpackToMulti()
.map { Set($0) }
let allExcludes = spec.attr(\.excludeFiles)
let implExcludes = extractFiles(fromPattern: allExcludes,
includingFileTypes: SwiftLikeFileTypes)
.unpackToMulti()
.map { Set($0) }
// Apply excludes to the sources
let specSources = implFiles.zip(implExcludes).map {
GlobNode(include: .left($0.first ?? Set()), exclude: .left($0.second ?? Set()))
}
let subspecSources: [AttrSet<GlobNode>] = spec.selectedSubspecs()
.map { getSources(spec: $0) }
return specSources.zip(AttrSet.empty.sequence(subspecSources))
.map {
attrTuple -> GlobNode in
let first = attrTuple.first ?? .empty
let second: [GlobNode] = attrTuple.second ?? []
if first != .empty, second.count > 0 {
let include = ([first] + second).map { Either<Set<String>, GlobNode>.right($0) }
return GlobNode(include: include, exclude: [])
} else if second.count > 0 {
return GlobNode(include: second.map { Either<Set<String>, GlobNode>.right($0) }, exclude: [])
} else if first != .empty {
return first
} else {
return .empty
}
}
}
/// Note: this initializer has assumptions on the way that it's used, and
/// all subspec sources are collected here.
/// there is 1 swift_library per podspec
init(parentSpecs: [PodSpec], spec: PodSpec, extraDeps: [String] = [],
isSplitDep: Bool = false,
moduleMap: ModuleMap? = nil) {
isTopLevelTarget = parentSpecs.isEmpty && isSplitDep == false
let podName = GetBuildOptions().podName
let name = computeLibName(
parentSpecs: parentSpecs,
spec: spec,
podName: podName,
isSplitDep: isSplitDep,
sourceType: .swift
)
self.name = name
self.sourceFiles = SwiftLibrary.getSources(spec: spec)
let externalName = getNamePrefix() + (parentSpecs.first?.name ?? spec.name)
self.externalName = externalName
let resourceFiles = (spec.attr(\.resources).map { (strArr: [String]) -> [String] in
strArr.filter { (str: String) -> Bool in
!str.hasSuffix(".bundle")
}
}).map(extractResources)
let fallbackSpec = FallbackSpec(specs: [spec] + parentSpecs)
let headerDirectoryName: AttrSet<String?> = fallbackSpec.attr(\.headerDirectory)
let moduleName: AttrSet<String> = fallbackSpec.attr(\.moduleName).map {
$0 ?? ""
}
let headerName = (moduleName.isEmpty ? nil : moduleName) ??
(headerDirectoryName.basic == nil ? nil :
headerDirectoryName.denormalize()) ?? AttrSet<String>(value:
externalName)
let clangModuleName = headerName.basic?.replacingOccurrences(of: "-", with: "_") ?? ""
self.moduleName = clangModuleName
self.data = resourceFiles.map { GlobNode(include: Set($0)) }
// Extract deps from the entire podspec
let allDepsArr: [AttrSet<[String]>] = ([spec] + spec.selectedSubspecs())
.map { $0.attr(\.dependencies) }
let allDeps = AttrSet.empty.sequence(allDepsArr).map {
depsArr -> [String] in
return depsArr.reduce([String]()) { $0 + $1 }
}
// `swift_library` depends on the public interface
self.deps = allDeps.map {
$0.map {
getDependencyName(fromPodDepName: $0, podName: podName)
}.filter {
$0.hasPrefix("//") || $0.hasPrefix("@")
}
}
let swiftFlags = XCConfigTransformer.defaultTransformer(
externalName: externalName, sourceType: .swift)
.compilerFlags(for: fallbackSpec)
let objcFlags = XCConfigTransformer.defaultTransformer(
externalName: externalName, sourceType: .objc)
.compilerFlags(for: fallbackSpec)
let includes = objcFlags.filter { $0.hasPrefix("-I") }
// Insert the clang import flags
// This adds -DCOCOAPODS and -DCOCOAPODS=1 to the clang importer ( via
// -Xcc ) - by doing this, clang sees -DCOCOAPODS=1. I'm not 100% sure
// why it doesn't pass -DCOCOAPODS=1 to swift, but this is the behavior
// in Xcode make it identical
let clangImporterCopts = (includes + ["-DCOCOAPODS=1"])
.reduce([String]()) { $0 + ["-Xcc", $1] }
self.copts = AttrSet(basic: [
"-DCOCOAPODS",
] + swiftFlags + clangImporterCopts)
self.swiftcInputs = AttrSet.empty
self.moduleMap = moduleMap
}
public func toSkylark() -> SkylarkNode {
var swiftcInputs = self.swiftcInputs
var copts = self.copts
let options = GetBuildOptions()
// Note: we don't expose this module map upwards.
// Dependent top level objc libraries will expose an extended module map
let headerMapName = self.name.replacingOccurrences(of: "_swift", with: "")
var deps = self.deps
if options.generateHeaderMap {
let hmapDep = AttrSet(basic: [
":" + headerMapName + "_hmap",
])
swiftcInputs = swiftcInputs <> hmapDep
deps = deps <> hmapDep
copts = copts <> AttrSet(basic: [
"-Xcc",
"-I$(execpath " + headerMapName + "_hmap)",
])
}
copts = copts <> AttrSet(basic: [
"-Xcc",
"-I.",
])
if let moduleMap = self.moduleMap {
copts = copts <> AttrSet(basic: [
"-Xcc",
"-D__SWIFTC__",
"-Xfrontend",
"-no-clang-module-breadcrumbs",
"-Xcc",
"-fmodule-map-file=$(execpath " + moduleMap.name + ")",
"-import-underlying-module",
])
let moduleMapDep = AttrSet(basic: [ ":" + moduleMap.name ])
swiftcInputs = swiftcInputs <> moduleMapDep
deps = deps <> moduleMapDep
if let umbrellaHeader = moduleMap.umbrellaHeader {
let umbrellaDep = AttrSet(basic: [
":" + umbrellaHeader
])
swiftcInputs = swiftcInputs <> umbrellaDep
deps = deps <> umbrellaDep
}
}
copts = copts <> AttrSet(basic: ["-I\(getPodBaseDir() + "/" + headerMapName + "/" + PodSupportSystemPublicHeaderDir + headerMapName)"])
let depsSkylark = deps.map {
Set($0).sorted(by: (<))
}.toSkylark()
let buildConfigDependenctCOpts: SkylarkNode =
.functionCall(name: "select",
arguments: [
.basic([
":release": [
"-Xcc", "-DPOD_CONFIGURATION_RELEASE=1",
],
"//conditions:default": [
"-enable-testing",
"-DDEBUG",
"-Xcc", "-DPOD_CONFIGURATION_DEBUG=1",
"-Xcc", "-DDEBUG=1",
],
].toSkylark()
),
])
let coptsSkylark = buildConfigDependenctCOpts .+. copts.toSkylark()
return .functionCall(
name: "swift_library",
arguments: [
.named(name: "name", value: name.toSkylark()),
.named(name: "module_name", value: moduleName.toSkylark()),
.named(name: "srcs", value: sourceFiles.toSkylark()),
.named(name: "deps", value: depsSkylark),
.named(name: "data", value: data.toSkylark()),
.named(name: "copts", value: coptsSkylark),
.named(name: "swiftc_inputs", value: swiftcInputs.toSkylark()),
.named(name: "generated_header_name", value: (externalName + "-Swift.h").toSkylark()),
.named(name: "generates_header", value: 1.toSkylark()),
.named(name: "features", value: ["swift.no_generated_module_map"].toSkylark()),
.named(name: "visibility", value: ["//visibility:public"].toSkylark()),
]
)
}
}
private func extractResources(patterns: [String]) -> [String] {
return patterns.flatMap { (p: String) -> [String] in
pattern(fromPattern: p, includingFileTypes: [])
}
}
extension PodSpec {
func allSubspecs(_ isSubspec: Bool = false) -> [PodSpec] {
return (isSubspec ? [self] : []) + self.subspecs.reduce([PodSpec]()) {
return $0 + $1.allSubspecs(true)
}
}
/// Returns selected subspecs
/// Note: because we reduce sources into a single swift library, it must
/// consider subspecs that are included, otherwise, it would pull in sources
/// from the entire podspec.
/// Currently it uses `Default` subspecs.
/// Ideally, should be a way to add other sources to this.
func selectedSubspecs() -> [PodSpec] {
let defaultSubspecs = Set(self.defaultSubspecs)
let subspecs = allSubspecs()
guard !defaultSubspecs.isEmpty else {
return subspecs
}
return subspecs.filter { defaultSubspecs.contains($0.name) }
}
}
| 38.828283 | 143 | 0.562435 |
f9a7304b4e2610eb3779daa9d56a2de2a5f76fd3 | 1,038 | go | Go | team_members.go | rjz/github-random-assignee | 7cfc134a87365971d8cbe9d8283f09dfe309d07a | [
"MIT"
] | null | null | null | team_members.go | rjz/github-random-assignee | 7cfc134a87365971d8cbe9d8283f09dfe309d07a | [
"MIT"
] | 4 | 2015-11-17T22:19:54.000Z | 2015-12-02T14:48:12.000Z | team_members.go | rjz/github-random-assignee | 7cfc134a87365971d8cbe9d8283f09dfe309d07a | [
"MIT"
] | null | null | null | package main
import (
"fmt"
"math/rand"
"strings"
"time"
)
type TeamMember struct {
Github *string `json:"github,omitempty"`
Slack *string `json:"slack,omitempty"`
}
// SlackHandle returns the TeamMember's slack handle if available and falls
// back on github if it isn't.
func (tm *TeamMember) SlackHandle() string {
if tm.Slack != nil {
return fmt.Sprintf("@%s", *tm.Slack)
}
return *tm.Github
}
type TeamMembers []TeamMember
func (users *TeamMembers) FindByGithubLogin(login *string) *TeamMember {
for _, u := range *users {
if strings.EqualFold(*u.Github, *login) {
return &u
}
}
return nil
}
func (users *TeamMembers) Without(login *string) *TeamMembers {
rest := TeamMembers{}
for i, u := range *users {
if !strings.EqualFold(*u.Github, *login) {
rest = append(rest, (*users)[i])
}
}
return &rest
}
func (users *TeamMembers) Sample() *TeamMember {
count := len(*users)
if count == 0 {
return nil
}
t := time.Now()
rand.Seed(int64(t.Nanosecond()))
return &(*users)[rand.Intn(count)]
}
| 19.222222 | 75 | 0.663776 |
1c06c31719d13280810ae480db4e1802aa544ac9 | 5,566 | swift | Swift | MakerMate/View Controllers/StepsProjectViewController.swift | jensvansteen/MakerMateApp-MAV | 1b034e8d79446672acb34078fcb4db3122fe7f43 | [
"MIT"
] | null | null | null | MakerMate/View Controllers/StepsProjectViewController.swift | jensvansteen/MakerMateApp-MAV | 1b034e8d79446672acb34078fcb4db3122fe7f43 | [
"MIT"
] | null | null | null | MakerMate/View Controllers/StepsProjectViewController.swift | jensvansteen/MakerMateApp-MAV | 1b034e8d79446672acb34078fcb4db3122fe7f43 | [
"MIT"
] | null | null | null | //
// StepsProjectViewController.swift
// MakerMate
//
// Created by Jens Van Steen on 31/01/2019.
// Copyright © 2019 Jens Van Steen. All rights reserved.
//
import UIKit
class StepsProjectViewController: UIViewController, UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout {
var kennisMakingDone = false
var hackGetest = false
var hackInProject: HackInProject?
@IBOutlet weak var stepsCollectionView: UICollectionView!
@IBOutlet weak var closeButton: UIImageView!
var steps = [
[
"step": "Kennismaking",
"access": "unlocked",
"completed": false,
"description": "Ben je ter plaatse? Dan kunnen we beginnen! Enkele vragen over de persoon, omgeving en handeling gidsen je naar de juiste hack(s).",
"buttonTekst": "Ready, set, go!",
"height": 170
],
[
"step": "Hacks testen",
"access": "locked",
"completed": false,
"description": "Is de hack klaar? Ben je ter plaatse? Prima, laten we ze testen!",
"buttonTekst": "Test de hack",
"height": 123
],
[
"step": "Evaluatie",
"access": "locked",
"completed": false,
"description": "De juiste hack gevonden! We doen nog een laatste check om te kijken of de hack veilig, duurzaam en gebruiksvriendelijk is.",
"buttonTekst": "Start evaluatie!",
"height": 159
]
]
override func viewDidLoad() {
super.viewDidLoad()
self.stepsCollectionView.delegate = self
self.stepsCollectionView.dataSource = self
// Do any additional setup after loading the view.
let tapAanvraag = UITapGestureRecognizer(target: self, action: #selector(closeThis))
closeButton.addGestureRecognizer(tapAanvraag)
closeButton.isUserInteractionEnabled = true
setupUI()
}
override var prefersStatusBarHidden: Bool {
return true
}
func setupUI() {
if let hackInProject = hackInProject {
steps[0]["completed"] = true
steps[1]["access"] = "unlocked"
}
stepsCollectionView.reloadData()
}
func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int {
return steps.count
}
func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell(withReuseIdentifier: "stepCell", for: indexPath) as! stepsCollectionViewCell
cell.stepName.text = steps[indexPath.row]["step"] as? String
cell.stepDescription.text = steps[indexPath.row]["description"] as? String
cell.actionStep.text = steps[indexPath.row]["buttonTekst"] as? String
if steps[indexPath.row]["access"] as! String == "locked" {
cell.actionStep.isHidden = true
cell.stepDescription.isHidden = false
cell.imageStep.isHidden = true
cell.stepName.textColor = #colorLiteral(red: 0.7254901961, green: 0.5882352941, blue: 0.2980392157, alpha: 1)
} else if steps[indexPath.row]["access"] as! String == "unlocked" && steps[indexPath.row]["completed"] as! Bool == true {
cell.statusImage.image = UIImage(named: "done")
cell.actionStep.isHidden = true
cell.stepDescription.isHidden = true
cell.imageStep.isHidden = true
}
return cell
}
func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize {
if steps[indexPath.row]["completed"] as! Bool == false {
if steps[indexPath.row]["access"] as! String == "locked" {
return CGSize(width: 290, height: CGFloat(steps[indexPath.row]["height"] as! Int - 10))
} else {
return CGSize(width: 290, height: CGFloat(steps[indexPath.row]["height"] as! Int))
}
} else if steps[indexPath.row]["completed"] as! Bool == true {
return CGSize(width: 290, height: 46)
}
return CGSize(width: 290, height: 78)
}
func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
if indexPath.row == 0 && !kennisMakingDone {
performSegue(withIdentifier: "startKennismaking", sender: nil)
} else if indexPath.row == 1 {
if let hackInProject = hackInProject {
let nextViewController = storyboard!.instantiateViewController(withIdentifier: "navigationTest") as! AlwaysPoppableNavigationController
let newVC = nextViewController.viewControllers.first as! Stap1TestHackViewController
self.present(nextViewController, animated: true, completion: nil)
}
}
}
@objc private func closeThis() {
self.dismiss(animated: true, completion: nil)
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destination.
// Pass the selected object to the new view controller.
}
*/
}
| 36.379085 | 160 | 0.621991 |
c7c99b11b86d3309a0a8d8fda156e014a58a4e8b | 1,808 | py | Python | models/__init__.py | mbroso/constraintnet_facial_detect | 3f53a4694f3c6b229679ef9014ac98573f45fd43 | [
"BSD-3-Clause"
] | null | null | null | models/__init__.py | mbroso/constraintnet_facial_detect | 3f53a4694f3c6b229679ef9014ac98573f45fd43 | [
"BSD-3-Clause"
] | null | null | null | models/__init__.py | mbroso/constraintnet_facial_detect | 3f53a4694f3c6b229679ef9014ac98573f45fd43 | [
"BSD-3-Clause"
] | null | null | null | """This module implements a model selection by filename and class name
according to opts.
Opts must contain attributes opts.model_module and opts.model_cls. The
specified class must be a subclass of nn.Module.
"""
import torch.nn as nn
import importlib
from pathlib import Path
from torch.utils.data import Dataset, DataLoader
def my_model(opts):
"""Creates model object according to settings in parsed options.
Calls function with name opts.opts2model in module opts.model_module to
create model instance.
Args:
opts (obj): Namespace object with options. Required attributes are
opts.model_module and opts.opts2model.
Returns:
my_model (obj): Instantiated model object construtcted by function
opts.opts2model in module opts.model_module.
Raises:
NotImplementedError: When model wrapper opts.opts2model does not exist
in model module opts.model_module.
"""
model_import = 'models.' + opts.model_module
model_lib = importlib.import_module(model_import)
my_model = None
for name, fct in model_lib.__dict__.items():
if name==opts.opts2model:
my_model = fct(opts)
if my_model==None:
raise NotImplementedError(
"""Model wrapper function {opts2model} is not implemented in
model module {model_module}""".format(
opts2model=opts.opts2model,
model_module=opts.model_module
)
)
print("""Model was constructed by calling model function
{opts2model} in model module {model_module}.""".format(
opts2model=opts.opts2model,
model_module=opts.model_module
)
)
return my_model
| 30.644068 | 79 | 0.651549 |
14d67e55db8c1252f2b564b68edcaa67e257905f | 4,716 | kt | Kotlin | src/main/kotlin/eu/scisneromam/game/snake/HamiltonianSnake.kt | awsdcrafting/SnakeFX | 080d201816f43404cb92b144074dda46ca6fd7a7 | [
"MIT"
] | null | null | null | src/main/kotlin/eu/scisneromam/game/snake/HamiltonianSnake.kt | awsdcrafting/SnakeFX | 080d201816f43404cb92b144074dda46ca6fd7a7 | [
"MIT"
] | null | null | null | src/main/kotlin/eu/scisneromam/game/snake/HamiltonianSnake.kt | awsdcrafting/SnakeFX | 080d201816f43404cb92b144074dda46ca6fd7a7 | [
"MIT"
] | null | null | null | package eu.scisneromam.game.snake
import eu.scisneromam.game.IGame
import eu.scisneromam.game.MoveDirection
import eu.scisneromam.game.Tile
import kotlin.math.abs
/**
* Project: SnakeFX
* Initially created by scisneromam on 01.12.2019.
* @author scisneromam
* ---------------------------------------------------------------------
* Copyright © 2019 | scisneromam | All rights reserved.
*/
open class HamiltonianSnake(game: IGame) : Snake(game, false)
{
val cycleMap: MutableMap<Tile, Tile> = HashMap()
val dist = if (game.gameInfo.walls)
{
1
} else
{
0
}
init
{
val width = game.gameInfo.gameWidth
val height = game.gameInfo.gameHeight
if (width == 1 || height == 1 || (width % 2 != 0 && height % 2 != 0))
{
throw IllegalArgumentException("Impossible to generate Hamiltonian Path!")
}
var start = game.getTile(dist, dist)
if (width % 2 == 0)
{
var currentTile = start
var nextTile = game.getTile(currentTile, MoveDirection.SOUTH)
cycleMap[currentTile] = nextTile
do
{
currentTile = nextTile
nextTile = when
{
currentTile.y == dist -> game.getTile(currentTile, MoveDirection.WEST)
currentTile.x == width - dist - 1 -> game.getTile(currentTile, MoveDirection.NORTH)
(currentTile.y == height - dist - 1 && currentTile.x % 2 == dist) || (currentTile.y == dist + 1 && currentTile.x % 2 != dist) ->
game.getTile(
currentTile,
MoveDirection.EAST
)
currentTile.x % 2 == dist -> game.getTile(currentTile, MoveDirection.SOUTH)
currentTile.x % 2 != dist -> game.getTile(currentTile, MoveDirection.NORTH)
else -> throw IllegalStateException("Should not happen")
}
cycleMap[currentTile] = nextTile
} while (nextTile != start)
} else if (height % 2 == 0)
{
var currentTile = start
var nextTile = game.getTile(currentTile, MoveDirection.EAST)
cycleMap[currentTile] = nextTile
do
{
currentTile = nextTile
nextTile = when
{
currentTile.x == dist -> game.getTile(currentTile, MoveDirection.NORTH)
currentTile.y == height - dist - 1 -> game.getTile(currentTile, MoveDirection.WEST)
(currentTile.x == width - dist - 1 && currentTile.y % 2 == dist) || (currentTile.x == dist + 1 && currentTile.y % 2 != dist) -> game.getTile(
currentTile,
MoveDirection.SOUTH
)
currentTile.y % 2 == dist -> game.getTile(currentTile, MoveDirection.EAST)
currentTile.y % 2 != dist -> game.getTile(currentTile, MoveDirection.WEST)
else -> throw IllegalStateException("Should not happen")
}
cycleMap[currentTile] = nextTile
} while (currentTile != start)
} else
{
throw IllegalArgumentException("Impossible to generate Hamiltonian Path!")
}
}
override fun getMoveDirection(): MoveDirection
{
var tile: Tile =
cycleMap[headTile] ?: throw IllegalStateException("Snake doesnt know where to get from $headTile")
val directions = MoveDirection.values()
var index = 0
while (tile.state.deadly)
{
if (index >= directions.size)
{
println("Nowhere to get from $headTile")
return MoveDirection.NONE
}
tile = game.getTile(headTile, directions[index++])
}
return directionToTileFromTile(headTile, tile)
}
fun directionToTileFromTile(from: Tile, to: Tile): MoveDirection
{
if (from.game != to.game)
{
return MoveDirection.NONE
}
val deltaX = from.x - to.x
val deltaY = from.y - to.y
return when
{
deltaX < 0 && (deltaY == 0 || abs(deltaX) >= abs(deltaY)) -> MoveDirection.EAST
deltaX > 0 && (deltaY == 0 || abs(deltaX) >= abs(deltaY)) -> MoveDirection.WEST
deltaY < 0 && (deltaX == 0 || abs(deltaY) >= abs(deltaX)) -> MoveDirection.SOUTH
deltaY > 0 && (deltaX == 0 || abs(deltaY) >= abs(deltaX)) -> MoveDirection.NORTH
else -> MoveDirection.NONE
}
}
} | 37.428571 | 161 | 0.523961 |
8d5cb66fc62d0f02c405aeac33d82e4030f263f8 | 1,739 | sql | SQL | src/Entity/CSharp_Poco_Fields_Generator.sql | theilgazcode/sql-cookbook | b45b74ce50e4739f0daed0009cc55ee70ba4e26d | [
"MIT"
] | 4 | 2020-05-31T16:39:02.000Z | 2021-03-12T11:11:45.000Z | src/Entity/CSharp_Poco_Fields_Generator.sql | theilgazcode/sql-cookbook | b45b74ce50e4739f0daed0009cc55ee70ba4e26d | [
"MIT"
] | null | null | null | src/Entity/CSharp_Poco_Fields_Generator.sql | theilgazcode/sql-cookbook | b45b74ce50e4739f0daed0009cc55ee70ba4e26d | [
"MIT"
] | null | null | null | -- Author: Abdullah ILGAZ, abdullah@entegreyazilim.com.tr
-- Output: Gives you a list of fields as prepared prop for C# poco class.
-- Sample: public int Id { get; set; }
select 'public ' + ColumnType + NullableSign + ' ' + ColumnName + ' { get; set; } ' as Prop from
( select replace(col.name, ' ', '_') ColumnName, column_id ColumnId, case typ.name when 'bigint' then 'long' when 'binary' then 'byte[]'
when 'bit' then 'bool' when 'char' then 'string' when 'date' then 'DateTime' when 'datetime' then 'DateTime'
when 'datetime2' then 'DateTime' when 'datetimeoffset' then 'DateTimeOffset' when 'decimal' then 'decimal' when 'float' then 'double'
when 'image' then 'byte[]' when 'int' then 'int' when 'money' then 'decimal' when 'nchar' then 'string' when 'ntext' then 'string' when 'numeric' then 'decimal'
when 'nvarchar' then 'string' when 'real' then 'float' when 'smalldatetime' then 'DateTime' when 'smallint' then 'short'
when 'smallmoney' then 'decimal' when 'text' then 'string' when 'time' then 'TimeSpan' when 'timestamp' then 'long'
when 'tinyint' then 'byte' when 'uniqueidentifier' then 'Guid' when 'varbinary' then 'byte[]' when 'varchar' then 'string' else 'UNKNOWN_' + typ.name end ColumnType, case
when col.is_nullable = 1 and typ.name in ('bigint', 'bit', 'date', 'datetime', 'datetime2', 'datetimeoffset', 'decimal', 'float', 'int', 'money', 'numeric', 'real', 'smalldatetime', 'smallint', 'smallmoney', 'time', 'tinyint', 'uniqueidentifier')
then '?' else '' end NullableSign from sys.columns col join sys.types typ on
col.system_type_id = typ.system_type_id AND col.user_type_id = typ.user_type_id where object_id = object_id('SCHEMA_NAME.TABLE_NAME')) t order by ColumnId | 115.933333 | 250 | 0.698102 |
214542cea3f32e92e3b08de721f498d8ea8e3b71 | 943 | sql | SQL | src/main/resources/db/migration/V1_5__Epost_tabell.sql | navikt/syfomoteadmin | d0d989fe4703c37f0cf37502ba0639ceeb4e2516 | [
"MIT"
] | 1 | 2022-02-17T07:37:12.000Z | 2022-02-17T07:37:12.000Z | src/main/resources/db/migration/V1_5__Epost_tabell.sql | navikt/syfomoteadmin | d0d989fe4703c37f0cf37502ba0639ceeb4e2516 | [
"MIT"
] | 3 | 2021-06-22T11:37:06.000Z | 2022-02-16T11:02:57.000Z | src/main/resources/db/migration/V1_5__Epost_tabell.sql | navikt/syfomoteadmin | d0d989fe4703c37f0cf37502ba0639ceeb4e2516 | [
"MIT"
] | null | null | null | -- ROLLBACK-START
------------------
-- DROP SEQUENCE EPOST_ID_SEQ;
-- DROP SEQUENCE EPOST_VEDLEGG_ID_SEQ;
-- DROP TABLE EPOST
-- DROP TABLE EPOST_VEDLEGG
---------------
-- ROLLBACK-END
CREATE SEQUENCE EPOST_ID_SEQ START WITH 1 INCREMENT BY 1;
CREATE SEQUENCE EPOST_VEDLEGG_ID_SEQ START WITH 1 INCREMENT BY 1;
CREATE TABLE EPOST (
epost_id NUMBER(19, 0) NOT NULL,
mottaker VARCHAR(100) NOT NULL,
emne VARCHAR(100) NOT NULL,
innhold VARCHAR(2000) NOT NULL,
sendt NUMBER(1) NOT NULL,
CONSTRAINT EPOST_PK PRIMARY KEY (epost_id)
);
CREATE TABLE EPOST_VEDLEGG (
epost_vedlegg_id NUMBER(19, 0) NOT NULL,
epost_id NUMBER(19, 0) NOT NULL,
innhold VARCHAR(2000) NOT NULL,
type VARCHAR(20) NOT NULL,
CONSTRAINT EPOST_FK FOREIGN KEY (epost_id) REFERENCES EPOST (epost_id),
CONSTRAINT EPOST_VEDLEGG_PK PRIMARY KEY (epost_vedlegg_id)
);
| 30.419355 | 73 | 0.659597 |
f9d39f30a340c7caa96b0fea76bfb963dd7e771f | 4,365 | go | Go | monitoring/pingcounterpartyd/pingcounterpartyd.go | vennd/enu | 485d38d07082bdf4d59b5f6214d1c97e95aa15d6 | [
"MIT"
] | 1 | 2017-04-30T12:29:09.000Z | 2017-04-30T12:29:09.000Z | monitoring/pingcounterpartyd/pingcounterpartyd.go | vennd/enu | 485d38d07082bdf4d59b5f6214d1c97e95aa15d6 | [
"MIT"
] | 7 | 2017-04-14T19:30:33.000Z | 2017-05-04T03:35:03.000Z | monitoring/pingcounterpartyd/pingcounterpartyd.go | vennd/enu | 485d38d07082bdf4d59b5f6214d1c97e95aa15d6 | [
"MIT"
] | null | null | null | package main
import (
"io/ioutil"
// "log"
"net/http"
"os"
"strconv"
"time"
"github.com/vennd/enu/consts"
"github.com/vennd/enu/counterpartyapi"
"github.com/vennd/enu/counterpartycrypto"
"github.com/vennd/enu/enulib"
"github.com/vennd/enu/log"
"github.com/vennd/enu/internal/golang.org/x/net/context"
)
var passphrase string = "attention stranger fate plain huge poetry view precious drug world try age"
var sendAddress string = "1CipmbDRHn89cgqs6XbjswkrDxvCKA8Tfb"
var destinationAddress string = "1HpkZBjNFRFagyj6Q2adRSagkfNDERZhg1"
// This application is to be used for monitoring purposes of counterpartyd
//
// Calls get_running_info() to retrieve the last block that counterpartyd processed
// Compares the last block counterpartyd processed against blockchain.info
// If the difference is < 5 blocks pass, otherwise fail test
// Attempt to construct a send with counterparty. The send construction should complete within 10 seconds, or consider bitcoind and counterpartyd stalled
//
// Returns 1 if there was a problem reading the counterpartyd last processed block
// Returns 2 if there was a problem reading from blockchain.info
// Returns 3 if there is a different > 5 blocks between counterpartyd last processed block and blockchain.info
// Returns 4 if the construction of a send with counterpartyd didn't complete successfully (or within 10 seconds)
// Returns 5 if there was a unexpected error
// Returns 6 if Counterparty returned a 503
func main() {
var result1, result2 uint64
var result3 string
c := context.TODO()
c = context.WithValue(c, consts.RequestIdKey, enulib.GenerateRequestId())
// First check the internal block height via our API
c1 := make(chan uint64, 1)
go func() {
result, errorCode, err := counterpartyapi.GetRunningInfo(c)
if err != nil || errorCode != 0 {
log.Fluentf(consts.LOGERROR, "Error retrieving our block height: %s, errorCode: %d", err.Error(), errorCode)
if errorCode == 1002 {
os.Exit(int(6))
} else {
os.Exit(int(5))
}
}
c1 <- result.LastBlock.BlockIndex
}()
select {
case result1 = <-c1:
log.Fluentf(consts.LOGINFO, "Counterpartyd last processed block: %d\n", result1)
case <-time.After(time.Second * 10):
log.Fluentf(consts.LOGERROR, "Timeout when retrieving last processed counterpartyd block")
os.Exit(1)
}
// Then check the block height from blockchain.info
c2 := make(chan uint64, 1)
go func() {
request, err2 := http.Get("https://blockchain.info/q/getblockcount")
defer request.Body.Close()
response, err := ioutil.ReadAll(request.Body)
if err != nil {
log.Fluentf(consts.LOGERROR, "Error reading from blockchain.info")
log.Fluentf(consts.LOGERROR, err.Error())
os.Exit(2)
}
result, err2 := strconv.ParseUint(string(response), 10, 64)
if err2 != nil {
log.Fluentf(consts.LOGERROR, "Error reading from blockchain.info")
log.Fluentf(consts.LOGERROR, err2.Error())
os.Exit(2)
}
c2 <- result
}()
select {
case result2 = <-c2:
log.Fluentf(consts.LOGINFO, "Blockchain.info block height: %d\n", result2)
case <-time.After(time.Second * 10):
log.Fluentf(consts.LOGERROR, "Timeout when retrieving blockchain.info block height")
os.Exit(2)
}
var difference uint64
if result1 < result2 {
difference = result2 - result1
} else {
difference = result1 - result2
}
// Check the difference < 5
if difference > 5 {
log.Fluentf(consts.LOGERROR, "result1: %d, result2: %d, difference %d", result1, result2, difference)
os.Exit(3)
}
// Attempt to create a send
c3 := make(chan string, 1)
go func() {
pubKey, err := counterpartycrypto.GetPublicKey(passphrase, sendAddress)
if err != nil {
log.Fluentf(consts.LOGERROR, "Error getting pubkey")
log.Fluentf(consts.LOGERROR, err.Error())
}
resultCreateSend, errorCode2, err2 := counterpartyapi.CreateSend(c, sendAddress, destinationAddress, "SHIMA", 1000, pubKey)
if err2 != nil || errorCode2 != 0 {
log.Fluentf(consts.LOGERROR, "Error creating counterparty send: %s, errorCode: %d", err2.Error(), errorCode2)
os.Exit(int(5))
}
c3 <- resultCreateSend
}()
select {
case result3 = <-c3:
log.Fluentf(consts.LOGINFO, "Successfully created transaction: %s\n", result3)
case <-time.After(time.Second * 30):
log.Fluentf(consts.LOGERROR, "Timeout when creating counterparty send")
os.Exit(4)
}
return
}
| 30.3125 | 153 | 0.719359 |
e74b073604e70e99c1d734b070432c3ffc05c6e4 | 461 | js | JavaScript | resources/angular/tenant/app/entity/index/entityIndex.controller.js | rezariantono/solumax2_entities | 1fc47d092ab3bbd0db77a0e8ff93d4f3dad20370 | [
"MIT"
] | null | null | null | resources/angular/tenant/app/entity/index/entityIndex.controller.js | rezariantono/solumax2_entities | 1fc47d092ab3bbd0db77a0e8ff93d4f3dad20370 | [
"MIT"
] | null | null | null | resources/angular/tenant/app/entity/index/entityIndex.controller.js | rezariantono/solumax2_entities | 1fc47d092ab3bbd0db77a0e8ff93d4f3dad20370 | [
"MIT"
] | null | null | null | app
.controller('EntityIndexController', function(
$state,
EntityModel) {
var vm = this;
vm.filter = {
paginate: true,
page: 1,
order: 'desc',
};
vm.get = function() {
EntityModel.index(vm.filter)
.success(function(data) {
vm.entities = data.data;
vm.meta = data.meta;
});
}
if ($state.params.encodedQuery) {
_.assign(vm.filter, JSON.parse(decodeURI($state.params.encodedQuery)));
vm.get();
};
}); | 13.558824 | 74 | 0.596529 |
abea829757b8af655f04e8ffeb24a03e10d84455 | 2,016 | swift | Swift | SiriShortcut/IntegrateSiriShortcuts/IntegrateSiriShortcuts/ArticleFeedViewController.swift | DerekYuYi/Records | eafc1c233e5ff4e635a14deff0688412586f9497 | [
"Apache-2.0"
] | null | null | null | SiriShortcut/IntegrateSiriShortcuts/IntegrateSiriShortcuts/ArticleFeedViewController.swift | DerekYuYi/Records | eafc1c233e5ff4e635a14deff0688412586f9497 | [
"Apache-2.0"
] | null | null | null | SiriShortcut/IntegrateSiriShortcuts/IntegrateSiriShortcuts/ArticleFeedViewController.swift | DerekYuYi/Records | eafc1c233e5ff4e635a14deff0688412586f9497 | [
"Apache-2.0"
] | null | null | null | //
// ArticleFeedViewController.swift
// IntegrateSiriShortcuts
//
// Created by DerekYuYi on 2019/1/30.
// Copyright © 2019 Wenlemon. All rights reserved.
//
import UIKit
import Intents
import ArticleKit
import CoreSpotlight
import MobileCoreServices
// NOTE: Use `Layouts.swift` to manage life cycle and part of UI.
class ArticleFeedViewController: UIViewController {
let tableView = UITableView(frame: .zero, style: .plain)
let cellIdentifier = "kArticleCellReuse"
var articles: [Article] = []
@objc func newArticleWastapped() {
let vc = NewArticleViewController()
// --------------------------------------------------- //
// Create and donate an activity-based Shortcut
let activity = Article.newArticleShortcut(with: UIImage(named: "notePad.jpg"))
vc.userActivity = activity // 继承 Responder 的类, 拥有这个属性
activity.becomeCurrent() // register activity
navigationController?.pushViewController(vc, animated: true)
}
// MARK: - Initialization
override init(nibName nibNameOrNil: String?, bundle nibBundleOrNil: Bundle?) {
super.init(nibName: nibNameOrNil, bundle: nibBundleOrNil)
tableView.delegate = self
tableView.dataSource = self
tableView.register(ArticleTableViewCell.classForCoder(), forCellReuseIdentifier: cellIdentifier)
}
required init?(coder aDecoder: NSCoder) {
super.init(coder: aDecoder)
}
}
extension ArticleFeedViewController: UITableViewDelegate {
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
let vc = EditDraftViewController(article: articles[indexPath.row])
navigationController?.pushViewController(vc, animated: true)
}
func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool {
return true
}
func remove(article: Article, at indexPath: IndexPath) {
}
}
| 29.647059 | 104 | 0.661706 |
cbfb7406c534ac1b4ace5cc9122c03af808aa648 | 2,925 | sql | SQL | farrago/unitsql/optimizer/cartesian.sql | alexavila150/luciddb | e3125564eb18238677e6efb384b630cab17bb472 | [
"Apache-2.0"
] | 14 | 2015-07-21T06:31:22.000Z | 2020-05-13T14:18:33.000Z | farrago/unitsql/optimizer/cartesian.sql | alexavila150/luciddb | e3125564eb18238677e6efb384b630cab17bb472 | [
"Apache-2.0"
] | 1 | 2020-05-04T23:08:51.000Z | 2020-05-04T23:08:51.000Z | farrago/unitsql/optimizer/cartesian.sql | alexavila150/luciddb | e3125564eb18238677e6efb384b630cab17bb472 | [
"Apache-2.0"
] | 22 | 2015-01-03T14:27:36.000Z | 2021-09-14T02:09:13.000Z | -- $Id$
-- Test queries which require Cartesian products
set schema 'sales';
-- force usage of Java calculator
alter system set "calcVirtualMachine" = 'CALCVM_JAVA';
-- simple cross product
select emps.name as ename,depts.name as dname
from emps,depts
order by 1,2;
-- cross product requiring a Java plan restart for the right-hand input
select emps.name as ename,d.dnoplus
from emps,(select deptno+1 as dnoplus from depts) d
order by 1,2;
-- weird cross product used for uncorrelated subqueries
select depts.name from emps left outer join depts on TRUE
order by 1;
-- verify plans
!set outputformat csv
explain plan for
select emps.name as ename,depts.name as dname from emps,depts;
explain plan for
select emps.name as ename,depts.name as dname from emps,depts
order by 1,2;
explain plan for
select emps.name as ename,d.dnoplus
from emps,(select deptno+1 as dnoplus from depts) d;
explain plan for
select depts.name from emps left outer join depts on TRUE;
-- try lcs tables; lcs costing doesn't have a weird fudge factor so there will
-- be cases where it doesn't make sense to buffer
create schema lcscartesian;
set schema 'lcscartesian';
alter session implementation set jar sys_boot.sys_boot.luciddb_plugin;
create table lcsemps(
empno int, name varchar(12), deptno int, gender char(1), city varchar(12),
empid int, age int);
insert into lcsemps
select empno, name, deptno, gender, city, empid, age from sales.emps;
create table lcsdepts(deptno int, name varchar(12));
insert into lcsdepts select * from sales.depts;
!set outputformat table
-- should not use buffering
select * from lcsemps e, lcsdepts d order by 1, 2, 3, 4, 5, 6, 7, 8, 9;
select e.name, d.deptno from lcsemps e, lcsdepts d order by 1, 2;
-- should use buffering
select e.name, d.*
from lcsemps e, (select min(deptno) from lcsdepts) d order by 1;
-- should still use buffering, swapping the join operands
select e.name, d.*
from (select min(deptno) from lcsdepts) d, lcsemps e order by 1;
select d.*, e.name
from (select min(deptno) from lcsdepts) d, lcsemps e order by 2;
!set outputformat csv
-- the following 2 should not use buffering
explain plan for
select * from lcsemps e, lcsdepts d order by 1, 2, 3, 4, 5, 6, 7, 8, 9;
explain plan for
select e.name, d.deptno from lcsemps e, lcsdepts d order by 1, 2;
-- should use buffering
explain plan for
select e.name, d.*
from lcsemps e, (select min(deptno) from lcsdepts) d order by 1;
-- should still use buffering, swapping the join operands
explain plan for
select e.name, d.*
from (select min(deptno) from lcsdepts) d, lcsemps e order by 1;
explain plan for
select d.*, e.name
from (select min(deptno) from lcsdepts) d, lcsemps e order by 2;
-- with dtbug 2070, constant reduction throws the volcano planner into a loop
explain plan for
select * from (values (1)) as va(i), (values (4, 4)) as vb(x, j) where j = x;
-- End cartesian.sql
| 30.789474 | 78 | 0.736068 |
a453e47d39ce4ec701b45dd5836d8eca0e249e0f | 17,991 | sql | SQL | bd/sb_sicais.sql | david-byte/desenvolvimento | e49889e83b1020342ce519e5f2f5df1f2ef33f03 | [
"MIT"
] | null | null | null | bd/sb_sicais.sql | david-byte/desenvolvimento | e49889e83b1020342ce519e5f2f5df1f2ef33f03 | [
"MIT"
] | null | null | null | bd/sb_sicais.sql | david-byte/desenvolvimento | e49889e83b1020342ce519e5f2f5df1f2ef33f03 | [
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 5.0.3
-- https://www.phpmyadmin.net/
--
-- Host: 127.0.0.1
-- Tempo de geração: 03-Dez-2020 às 04:57
-- Versão do servidor: 10.4.14-MariaDB
-- versão do PHP: 7.4.11
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
START TRANSACTION;
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8mb4 */;
--
-- Banco de dados: `sb_sicais`
--
-- --------------------------------------------------------
--
-- Estrutura da tabela `acidentado`
--
CREATE TABLE `acidentado` (
`id_acidentado` int(11) NOT NULL,
`idade` int(11) NOT NULL,
`fk_id_posto_graduacao` int(11) NOT NULL,
`fk_id_om` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `acidente`
--
CREATE TABLE `acidente` (
`id_acidente` int(11) NOT NULL,
`description` varchar(255) NOT NULL,
`date_acidente` datetime NOT NULL,
`medidas_preventivas` varchar(100) NOT NULL,
`fk_id_om` int(11) NOT NULL,
`fk_id_acidentado` int(11) NOT NULL,
`fk_id_situacao` int(11) NOT NULL,
`fk_id_gradacao` int(11) NOT NULL,
`fk_id_tipo` int(11) NOT NULL,
`fk_users_id` int(10) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `aspecto`
--
CREATE TABLE `aspecto` (
`id_aspecto` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `cidade`
--
CREATE TABLE `cidade` (
`id_cidade` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`fk_id_estado` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `c_a_mil`
--
CREATE TABLE `c_a_mil` (
`id_c_a_mil` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`sigla` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `estado`
--
CREATE TABLE `estado` (
`id_estado` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`uf` varchar(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `fator`
--
CREATE TABLE `fator` (
`id_fator` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `fatores_contribuintes`
--
CREATE TABLE `fatores_contribuintes` (
`id_fatores_contribuintes` int(11) NOT NULL,
`fk_id_terminologia` int(11) NOT NULL,
`fk_id_aspecto` int(11) NOT NULL,
`fk_id_fator` int(11) NOT NULL,
`fk_id_acidente` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `gradacao`
--
CREATE TABLE `gradacao` (
`id_gradacao` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`description` varchar(255) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `groups`
--
CREATE TABLE `groups` (
`id` mediumint(8) UNSIGNED NOT NULL,
`name` varchar(20) NOT NULL,
`description` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `groups`
--
INSERT INTO `groups` (`id`, `name`, `description`) VALUES
(1, 'admin', 'Administrator'),
(2, 'members', 'General User');
-- --------------------------------------------------------
--
-- Estrutura da tabela `login_attempts`
--
CREATE TABLE `login_attempts` (
`id` int(10) UNSIGNED NOT NULL,
`ip_address` varchar(45) NOT NULL,
`login` varchar(100) NOT NULL,
`time` int(10) UNSIGNED DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
-- --------------------------------------------------------
--
-- Estrutura da tabela `om`
--
CREATE TABLE `om` (
`id_om` int(11) NOT NULL,
`name` varchar(100) NOT NULL,
`sigla` varchar(45) NOT NULL,
`codom` varchar(45) NOT NULL,
`fk_id_cidade` int(11) NOT NULL,
`fk_id_c_a_mil` int(11) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `posto_graduacao`
--
CREATE TABLE `posto_graduacao` (
`id_posto_graduacao` int(11) NOT NULL,
`name` varchar(45) DEFAULT NULL,
`sigla` varchar(45) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `situacao`
--
CREATE TABLE `situacao` (
`id_situacao` int(11) NOT NULL,
`name` varchar(45) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `terminologia`
--
CREATE TABLE `terminologia` (
`id_terminologia` int(11) NOT NULL,
`name` varchar(45) NOT NULL,
`description` varchar(255) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `tipo`
--
CREATE TABLE `tipo` (
`id_tipo` int(11) NOT NULL,
`name` varchar(100) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4;
-- --------------------------------------------------------
--
-- Estrutura da tabela `users`
--
CREATE TABLE `users` (
`id` int(10) UNSIGNED NOT NULL,
`ip_address` varchar(45) NOT NULL,
`username` varchar(100) DEFAULT NULL,
`cpf` varchar(45) DEFAULT NULL,
`identidade` varchar(45) DEFAULT NULL,
`password` varchar(255) NOT NULL,
`email` varchar(254) NOT NULL,
`phone` varchar(20) DEFAULT NULL,
`ramal` varchar(45) DEFAULT NULL,
`activation_selector` varchar(255) DEFAULT NULL,
`activation_code` varchar(255) DEFAULT NULL,
`forgotten_password_selector` varchar(255) DEFAULT NULL,
`forgotten_password_code` varchar(255) DEFAULT NULL,
`forgotten_password_time` int(10) UNSIGNED DEFAULT NULL,
`remember_selector` varchar(255) DEFAULT NULL,
`remember_code` varchar(255) DEFAULT NULL,
`created_on` int(10) UNSIGNED NOT NULL,
`last_login` int(10) UNSIGNED DEFAULT NULL,
`active` tinyint(3) UNSIGNED DEFAULT NULL,
`first_name` varchar(50) DEFAULT NULL,
`last_name` varchar(50) DEFAULT NULL,
`company` varchar(100) DEFAULT NULL,
`fk_id_posto_graduacao` int(11) DEFAULT NULL,
`fk_om_id_om` int(11) DEFAULT NULL,
`nome_guerra` varchar(100) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `users`
--
INSERT INTO `users` (`id`, `ip_address`, `username`, `cpf`, `identidade`, `password`, `email`, `phone`, `ramal`, `activation_selector`, `activation_code`, `forgotten_password_selector`, `forgotten_password_code`, `forgotten_password_time`, `remember_selector`, `remember_code`, `created_on`, `last_login`, `active`, `first_name`, `last_name`, `company`, `fk_id_posto_graduacao`, `fk_om_id_om`, `nome_guerra`) VALUES
(1, '127.0.0.1', 'administrator', NULL, NULL, '$2y$08$200Z6ZZbp3RAEXoaWcMA6uJOFicwNZaqk4oDhqTUiFXFe63MG.Daa', 'admin@admin.com', '0', NULL, NULL, '', NULL, NULL, NULL, NULL, NULL, 1268889823, 1268889823, 1, 'Admin', 'istrator', 'ADMIN', NULL, NULL, NULL),
(2, '::1', NULL, NULL, NULL, '$2y$10$B64QjlypeXlt9AysQ/B7weZN06HEhkvI/3Rls0PuVsFdb0.B.cwKW', 'davidanderson04@live.com', NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, 1606967169, NULL, 1, 'David Anderson Lopes de Araujo', NULL, NULL, NULL, NULL, NULL);
-- --------------------------------------------------------
--
-- Estrutura da tabela `users_groups`
--
CREATE TABLE `users_groups` (
`id` int(10) UNSIGNED NOT NULL,
`user_id` int(10) UNSIGNED NOT NULL,
`group_id` mediumint(8) UNSIGNED NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
--
-- Extraindo dados da tabela `users_groups`
--
INSERT INTO `users_groups` (`id`, `user_id`, `group_id`) VALUES
(1, 1, 1),
(2, 1, 2),
(3, 2, 1);
--
-- Índices para tabelas despejadas
--
--
-- Índices para tabela `acidentado`
--
ALTER TABLE `acidentado`
ADD PRIMARY KEY (`id_acidentado`),
ADD UNIQUE KEY `id_acidentado_UNIQUE` (`id_acidentado`),
ADD KEY `fk_acidentado_posto_graduacao1_idx` (`fk_id_posto_graduacao`),
ADD KEY `fk_acidentado_om1_idx` (`fk_id_om`);
--
-- Índices para tabela `acidente`
--
ALTER TABLE `acidente`
ADD PRIMARY KEY (`id_acidente`),
ADD UNIQUE KEY `id_acidente_UNIQUE` (`id_acidente`),
ADD KEY `fk_acidente_om1_idx` (`fk_id_om`),
ADD KEY `fk_acidente_acidentado1_idx` (`fk_id_acidentado`),
ADD KEY `fk_acidente_situacao1_idx` (`fk_id_situacao`),
ADD KEY `fk_acidente_gradacao1_idx` (`fk_id_gradacao`),
ADD KEY `fk_acidente_tipo1_idx` (`fk_id_tipo`),
ADD KEY `fk_acidente_users1_idx` (`fk_users_id`);
--
-- Índices para tabela `aspecto`
--
ALTER TABLE `aspecto`
ADD PRIMARY KEY (`id_aspecto`),
ADD UNIQUE KEY `id_aspecto_UNIQUE` (`id_aspecto`);
--
-- Índices para tabela `cidade`
--
ALTER TABLE `cidade`
ADD PRIMARY KEY (`id_cidade`),
ADD UNIQUE KEY `id_cidade_UNIQUE` (`id_cidade`),
ADD KEY `fk_cidade_estado1_idx` (`fk_id_estado`);
--
-- Índices para tabela `c_a_mil`
--
ALTER TABLE `c_a_mil`
ADD PRIMARY KEY (`id_c_a_mil`),
ADD UNIQUE KEY `id_c_a_mil_UNIQUE` (`id_c_a_mil`);
--
-- Índices para tabela `estado`
--
ALTER TABLE `estado`
ADD PRIMARY KEY (`id_estado`),
ADD UNIQUE KEY `id_estado_UNIQUE` (`id_estado`),
ADD UNIQUE KEY `name_UNIQUE` (`name`),
ADD UNIQUE KEY `uf_UNIQUE` (`uf`);
--
-- Índices para tabela `fator`
--
ALTER TABLE `fator`
ADD PRIMARY KEY (`id_fator`),
ADD UNIQUE KEY `id_fator_UNIQUE` (`id_fator`);
--
-- Índices para tabela `fatores_contribuintes`
--
ALTER TABLE `fatores_contribuintes`
ADD PRIMARY KEY (`id_fatores_contribuintes`),
ADD UNIQUE KEY `id_fatores_contribuintes_UNIQUE` (`id_fatores_contribuintes`),
ADD KEY `fk_fatores_contribuintes_terminologia1_idx` (`fk_id_terminologia`),
ADD KEY `fk_fatores_contribuintes_aspecto1_idx` (`fk_id_aspecto`),
ADD KEY `fk_fatores_contribuintes_fator1_idx` (`fk_id_fator`),
ADD KEY `fk_fatores_contribuintes_acidente1_idx` (`fk_id_acidente`);
--
-- Índices para tabela `gradacao`
--
ALTER TABLE `gradacao`
ADD PRIMARY KEY (`id_gradacao`),
ADD UNIQUE KEY `id_gradacao_UNIQUE` (`id_gradacao`);
--
-- Índices para tabela `groups`
--
ALTER TABLE `groups`
ADD PRIMARY KEY (`id`);
--
-- Índices para tabela `login_attempts`
--
ALTER TABLE `login_attempts`
ADD PRIMARY KEY (`id`);
--
-- Índices para tabela `om`
--
ALTER TABLE `om`
ADD PRIMARY KEY (`id_om`),
ADD UNIQUE KEY `id_om_UNIQUE` (`id_om`),
ADD KEY `fk_om_cidade1_idx` (`fk_id_cidade`),
ADD KEY `fk_om_c_a_mil1_idx` (`fk_id_c_a_mil`);
--
-- Índices para tabela `posto_graduacao`
--
ALTER TABLE `posto_graduacao`
ADD PRIMARY KEY (`id_posto_graduacao`),
ADD UNIQUE KEY `id_posto_graduacao_UNIQUE` (`id_posto_graduacao`),
ADD UNIQUE KEY `sigla_UNIQUE` (`sigla`),
ADD UNIQUE KEY `name_UNIQUE` (`name`);
--
-- Índices para tabela `situacao`
--
ALTER TABLE `situacao`
ADD PRIMARY KEY (`id_situacao`),
ADD UNIQUE KEY `id_situacao_UNIQUE` (`id_situacao`),
ADD UNIQUE KEY `name_UNIQUE` (`name`);
--
-- Índices para tabela `terminologia`
--
ALTER TABLE `terminologia`
ADD PRIMARY KEY (`id_terminologia`),
ADD UNIQUE KEY `id_terminologia_UNIQUE` (`id_terminologia`);
--
-- Índices para tabela `tipo`
--
ALTER TABLE `tipo`
ADD PRIMARY KEY (`id_tipo`),
ADD UNIQUE KEY `id_tipo_UNIQUE` (`id_tipo`);
--
-- Índices para tabela `users`
--
ALTER TABLE `users`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `uc_email` (`email`),
ADD UNIQUE KEY `uc_activation_selector` (`activation_selector`),
ADD UNIQUE KEY `uc_forgotten_password_selector` (`forgotten_password_selector`),
ADD UNIQUE KEY `uc_remember_selector` (`remember_selector`),
ADD UNIQUE KEY `cpf_UNIQUE` (`cpf`),
ADD UNIQUE KEY `identidade_UNIQUE` (`identidade`),
ADD KEY `fk_users_posto_graduacao1_idx` (`fk_id_posto_graduacao`),
ADD KEY `fk_users_om1_idx` (`fk_om_id_om`);
--
-- Índices para tabela `users_groups`
--
ALTER TABLE `users_groups`
ADD PRIMARY KEY (`id`),
ADD UNIQUE KEY `uc_users_groups` (`user_id`,`group_id`),
ADD KEY `fk_users_groups_users1_idx` (`user_id`),
ADD KEY `fk_users_groups_groups1_idx` (`group_id`);
--
-- AUTO_INCREMENT de tabelas despejadas
--
--
-- AUTO_INCREMENT de tabela `acidentado`
--
ALTER TABLE `acidentado`
MODIFY `id_acidentado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `acidente`
--
ALTER TABLE `acidente`
MODIFY `id_acidente` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de tabela `aspecto`
--
ALTER TABLE `aspecto`
MODIFY `id_aspecto` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `cidade`
--
ALTER TABLE `cidade`
MODIFY `id_cidade` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- AUTO_INCREMENT de tabela `c_a_mil`
--
ALTER TABLE `c_a_mil`
MODIFY `id_c_a_mil` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `estado`
--
ALTER TABLE `estado`
MODIFY `id_estado` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `fator`
--
ALTER TABLE `fator`
MODIFY `id_fator` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `fatores_contribuintes`
--
ALTER TABLE `fatores_contribuintes`
MODIFY `id_fatores_contribuintes` int(11) NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de tabela `gradacao`
--
ALTER TABLE `gradacao`
MODIFY `id_gradacao` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=7;
--
-- AUTO_INCREMENT de tabela `groups`
--
ALTER TABLE `groups`
MODIFY `id` mediumint(8) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `login_attempts`
--
ALTER TABLE `login_attempts`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT;
--
-- AUTO_INCREMENT de tabela `om`
--
ALTER TABLE `om`
MODIFY `id_om` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=8;
--
-- AUTO_INCREMENT de tabela `posto_graduacao`
--
ALTER TABLE `posto_graduacao`
MODIFY `id_posto_graduacao` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `situacao`
--
ALTER TABLE `situacao`
MODIFY `id_situacao` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=3;
--
-- AUTO_INCREMENT de tabela `terminologia`
--
ALTER TABLE `terminologia`
MODIFY `id_terminologia` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de tabela `tipo`
--
ALTER TABLE `tipo`
MODIFY `id_tipo` int(11) NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de tabela `users`
--
ALTER TABLE `users`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=4;
--
-- AUTO_INCREMENT de tabela `users_groups`
--
ALTER TABLE `users_groups`
MODIFY `id` int(10) UNSIGNED NOT NULL AUTO_INCREMENT, AUTO_INCREMENT=5;
--
-- Restrições para despejos de tabelas
--
--
-- Limitadores para a tabela `acidentado`
--
ALTER TABLE `acidentado`
ADD CONSTRAINT `fk_acidentado_om1` FOREIGN KEY (`fk_id_om`) REFERENCES `om` (`id_om`),
ADD CONSTRAINT `fk_acidentado_posto_graduacao1` FOREIGN KEY (`fk_id_posto_graduacao`) REFERENCES `posto_graduacao` (`id_posto_graduacao`);
--
-- Limitadores para a tabela `acidente`
--
ALTER TABLE `acidente`
ADD CONSTRAINT `fk_acidente_acidentado1` FOREIGN KEY (`fk_id_acidentado`) REFERENCES `acidentado` (`id_acidentado`),
ADD CONSTRAINT `fk_acidente_gradacao1` FOREIGN KEY (`fk_id_gradacao`) REFERENCES `gradacao` (`id_gradacao`),
ADD CONSTRAINT `fk_acidente_om1` FOREIGN KEY (`fk_id_om`) REFERENCES `om` (`id_om`),
ADD CONSTRAINT `fk_acidente_situacao1` FOREIGN KEY (`fk_id_situacao`) REFERENCES `situacao` (`id_situacao`),
ADD CONSTRAINT `fk_acidente_tipo1` FOREIGN KEY (`fk_id_tipo`) REFERENCES `tipo` (`id_tipo`),
ADD CONSTRAINT `fk_acidente_users1` FOREIGN KEY (`fk_users_id`) REFERENCES `users` (`id`),
ADD CONSTRAINT `fk_id_acidente` FOREIGN KEY (`id_acidente`) REFERENCES `acidente` (`id_acidente`);
--
-- Limitadores para a tabela `cidade`
--
ALTER TABLE `cidade`
ADD CONSTRAINT `fk_cidade_estado1` FOREIGN KEY (`fk_id_estado`) REFERENCES `estado` (`id_estado`);
--
-- Limitadores para a tabela `fatores_contribuintes`
--
ALTER TABLE `fatores_contribuintes`
ADD CONSTRAINT `fk_fatores_contribuintes_acidente1` FOREIGN KEY (`fk_id_acidente`) REFERENCES `acidente` (`id_acidente`),
ADD CONSTRAINT `fk_fatores_contribuintes_aspecto1` FOREIGN KEY (`fk_id_aspecto`) REFERENCES `aspecto` (`id_aspecto`),
ADD CONSTRAINT `fk_fatores_contribuintes_fator1` FOREIGN KEY (`fk_id_fator`) REFERENCES `fator` (`id_fator`),
ADD CONSTRAINT `fk_fatores_contribuintes_terminologia1` FOREIGN KEY (`fk_id_terminologia`) REFERENCES `terminologia` (`id_terminologia`);
--
-- Limitadores para a tabela `om`
--
ALTER TABLE `om`
ADD CONSTRAINT `fk_om_c_a_mil1` FOREIGN KEY (`fk_id_c_a_mil`) REFERENCES `c_a_mil` (`id_c_a_mil`),
ADD CONSTRAINT `fk_om_cidade1` FOREIGN KEY (`fk_id_cidade`) REFERENCES `cidade` (`id_cidade`);
--
-- Limitadores para a tabela `users`
--
ALTER TABLE `users`
ADD CONSTRAINT `fk_users_om1` FOREIGN KEY (`fk_om_id_om`) REFERENCES `om` (`id_om`),
ADD CONSTRAINT `fk_users_posto_graduacao1` FOREIGN KEY (`fk_id_posto_graduacao`) REFERENCES `posto_graduacao` (`id_posto_graduacao`);
--
-- Limitadores para a tabela `users_groups`
--
ALTER TABLE `users_groups`
ADD CONSTRAINT `fk_users_groups_groups1` FOREIGN KEY (`group_id`) REFERENCES `groups` (`id`) ON DELETE CASCADE,
ADD CONSTRAINT `fk_users_groups_users1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE;
COMMIT;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 28.602544 | 415 | 0.680396 |
f42953edaebc1df262e492d22c0cd96c13b34195 | 373 | go | Go | problems/roman-to-integer/roman_to_integer_test.go | fossabot/leetcode-3 | d356fe466bd0cbe1fe2c830622d31bf242679ac9 | [
"MIT"
] | 1 | 2020-09-09T08:22:40.000Z | 2020-09-09T08:22:40.000Z | problems/roman-to-integer/roman_to_integer_test.go | tonymontaro/leetcode-hints | 678df921f9a1322454c1e52d3723a448b4bbb135 | [
"MIT"
] | null | null | null | problems/roman-to-integer/roman_to_integer_test.go | tonymontaro/leetcode-hints | 678df921f9a1322454c1e52d3723a448b4bbb135 | [
"MIT"
] | null | null | null | package roman_to_integer
import "testing"
func TestRomanToInt(t *testing.T) {
tests := map[string]int{
"III": 3,
"IV": 4,
"IX": 9,
"LVIII": 58,
"MCMXCIV": 1994,
}
for input, expected := range tests {
output := romanToInt(input)
if output != expected {
t.Fatalf("input: %v, output: %v, expected: %v", input, output, expected)
}
}
}
| 17.761905 | 75 | 0.587131 |
6741821c1d53fba489c8e9dc910bd326d4326620 | 900 | kt | Kotlin | src/main/java/com/pl/customtoster/toasterModule.kt | Pl4Tech/customToaster | 6b016aa7094a3ab93bf85fdc0f543f873a7a05da | [
"Apache-2.0"
] | null | null | null | src/main/java/com/pl/customtoster/toasterModule.kt | Pl4Tech/customToaster | 6b016aa7094a3ab93bf85fdc0f543f873a7a05da | [
"Apache-2.0"
] | null | null | null | src/main/java/com/pl/customtoster/toasterModule.kt | Pl4Tech/customToaster | 6b016aa7094a3ab93bf85fdc0f543f873a7a05da | [
"Apache-2.0"
] | null | null | null | package com.pl.customtoster
import android.content.Context
import com.pl.customtoster.utilities.CustomToast
import com.pl.customtoster.utilities.CustomToastInteractor
import org.koin.dsl.module
val toasterModule = module {
/**
* providing custom toaster object to be injected later in the view
* @param context of application or activity
* @return CustomToastInteractor as singleton class
* */
single<CustomToastInteractor> { provideCustomToastInteractor(get()) }
}
/**
* function that provides the and builds Toaster Object with a predefined text
* @param context
* @return CustomToastInteractor an object of Custom Toaster Class to be used later
* */
fun provideCustomToastInteractor(context: Context): CustomToastInteractor =
CustomToast.Builder().setBackGroundRes(R.drawable.bg_rounded_toast)
.setTextColorRes(R.color.colorToastTxt).build(context)
| 34.615385 | 83 | 0.773333 |
b4321d3d04626ee213a44af94a3d8380f5960add | 1,685 | swift | Swift | AccessibilityTestApp/Transitions/PresentationAnimator.swift | eugeneheckert/AccessibilityTestApp | 8429846abc9fcf6b38c5a7d376ddc77526e3d619 | [
"Apache-2.0"
] | null | null | null | AccessibilityTestApp/Transitions/PresentationAnimator.swift | eugeneheckert/AccessibilityTestApp | 8429846abc9fcf6b38c5a7d376ddc77526e3d619 | [
"Apache-2.0"
] | null | null | null | AccessibilityTestApp/Transitions/PresentationAnimator.swift | eugeneheckert/AccessibilityTestApp | 8429846abc9fcf6b38c5a7d376ddc77526e3d619 | [
"Apache-2.0"
] | null | null | null | //
// PresentationAnimator.swift
// AccessibilityTestApp
//
// Created by Eugene Heckert on 2/28/19.
// Copyright © 2019 Bottle Rocket. All rights reserved.
//
import UIKit
class PresentationAnimator: NSObject, UIViewControllerAnimatedTransitioning {
func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
return 0.3
}
func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
guard let destination = transitionContext.viewController(forKey: .to),
let source = transitionContext.viewController(forKey: .from) else {
fatalError()
}
let containerView = transitionContext.containerView
containerView.insertSubview(destination.view, belowSubview: source.view)
let sourceFrame = source.view.frame
var initialFrame = transitionContext.initialFrame(for: destination)
initialFrame = initialFrame == .zero ? containerView.bounds : initialFrame
destination.view.frame = initialFrame.applying(CGAffineTransform(translationX: -(containerView.frame.size.width), y: 0))
UIView.animateKeyframes(withDuration: transitionDuration(using: transitionContext), delay: 0.0, options: [], animations: {
destination.view.frame = transitionContext.finalFrame(for: destination)
source.view.frame = sourceFrame.applying(CGAffineTransform(translationX: source.view.bounds.size.width * 0.75, y: 0))
}) { finished in
transitionContext.completeTransition(!transitionContext.transitionWasCancelled && finished)
}
}
}
| 42.125 | 130 | 0.709199 |
603e7119a2ad45aecf63ec3dfae2afc8f31f675c | 23,341 | html | HTML | employers.html | robincare/sampurcell.github.io | 43b6564a943038b7c107cad914c9cc85bed5d641 | [
"MIT"
] | null | null | null | employers.html | robincare/sampurcell.github.io | 43b6564a943038b7c107cad914c9cc85bed5d641 | [
"MIT"
] | null | null | null | employers.html | robincare/sampurcell.github.io | 43b6564a943038b7c107cad914c9cc85bed5d641 | [
"MIT"
] | null | null | null | <!DOCTYPE html>
<html lang="en">
<head>
<title>Robin Care</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="Robin Care gives cancer patients and their loved ones the help they need.">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/css/bootstrap.min.css" integrity="sha384-/Y6pD6FV/Vv2HJnA6t+vslU6fwYXjCFtcEpHbNJ0lyAFsXTsjBbfaDjzALeQsN6M" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.2.0/css/font-awesome.min.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.min.css">
<link rel="stylesheet" type="text/css" href="index.css">
<link rel="stylesheet" href="css/employers.css">
<link href="https://cdnjs.cloudflare.com/ajax/libs/hover.css/2.1.1/css/hover-min.css" rel="stylesheet">
<link rel="shortcut icon" type="image/png" href="favicon.png"/>
<META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-552SP46');</script>
<!-- End Google Tag Manager -->
</head>
<body>
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-552SP46"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<!-- End Google Tag Manager (noscript) -->
<div id="page-content">
<header class="animated fadeInDown">
<div class="row" id="header-content" style="display: flex;">
<div class="col-xl-5 col-lg-2 col-md-2 col-sm-4 col-4" style="margin:0px;padding: 0px;">
<a href="http://www.getrobincare.com/"><img src="img/robin-care-logo-white.png" alt="Logo" id="logo-img" ></a>
</div>
<div class="col-xl-7 col-lg-10 col-md-10 col-sm-8 col-8" id="menu-id" style="margin:0px;padding: 0px;">
<div style="display: block;float: right;padding-top: 20px;">
<div class="menu-space">
<a class="header-link-btn" href="#" data-toggle="modal" data-target="#myModala" class="learn-more-btn">REQUEST A DEMO</a>
</div>
</div>
</div>
</div>
</header>
<div class="modal fade" id="myModala" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog modalul" role="document">
<div class="modal-content">
<div id="m-a">
<div id="m-aa">
<div id="m-a-1">
REQUEST A DEMO
</div>
<div id="m-a-2" >
<a data-dismiss="modal" aria-label="Close" style="color: #fff; "><i class="fa fa-times" aria-hidden="true"></i></a>
</div>
</div>
</div>
<div id="m-b" class="modal-body">
<div id="modal-a-first" >
<div id="m-b-3">
<div id="m-b-3-1" >
<div id="m-b-3-1-a">
<input id="organization" name="organization" type="text" class="form-control sign-up-input" placeholder="Organization" required style="margin-bottom: 30px;" />
</div>
<div id="m-b-3-1-b">
<input id="name" name="name" type="text" class="form-control sign-up-input" placeholder="Name*" required style="margin-bottom: 30px;"/>
</div>
</div>
<div id="m-b-3-1" >
<div id="m-b-3-1-a">
<input id="title" name="title" type="text" class="form-control sign-up-input" placeholder="Title" required style="margin-bottom: 30px;" />
</div>
<div id="m-b-3-1-b">
<input id="email" name="email" type="text" class="form-control sign-up-input" placeholder="Email address*" required style="margin-bottom: 30px;"/>
</div>
</div>
<div id="m-b-3-2">
<input id="message" name="message" type="text" class="form-control sign-up-input" placeholder="Message*" required style="margin-bottom: 15px;" />
</div>
<div id="s-4th-form-updates-row">
<div id="s-4th-form-updates-col-1">
<input name="checkbox" id="checkbox-f2" type="checkbox">
<label for="checkbox-f2"></label>
</div>
<div id="s-4th-form-updates-col-2" >
Get updates about Robin Care
</div>
</div>
</div>
<div id="form-error2"></div>
<div id="m-b-4">
<div id="m-b-2-1"></div>
</div>
<div id="m-b-5">
<div id="m-b-5-a">
<strong>Email</strong>: <a class="modal-social-links" href="mailto:hello@getrobincare.com?Subject=Hello" target="_top">hello@getrobincare.com</a><br>
<strong>Phone</strong>: <a href="tel:6508003195" class="modal-social-links">(650) 800-3195</a>
</div>
<div id="m-b-5-b">
<a class="back-link-btn" onclick="submit_modala();" style="color:#fff;">SUBMIT</a>
</div>
</div>
</div>
<div id="modal-a-second" class="hidden-pic">
<div id="m-b-1-s">
Thanks for your interest! We’ll contact you to set up a demo shortly.
</div>
<div id="m-b-2-s">
<img src="img/mail-heart.png" alt="" id="m-b-2-s-pic">
</div>
<div id="m-b-4">
<div id="m-b-2-1"></div>
</div>
<div id="m-b-5-s">
<a class="back-link-btn" data-dismiss="modal" aria-label="Close" style="color:#fff;">CLOSE</a>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-xl-12 col-lg-12 col-md-12 col-sm-12" id="section-1">
<div id="section-1-content" >
<div id="s1-both-top">
<div id="s1-both">
<div id="s1-left-side" >
<div class="wow bounceInLeft">
<div id="s1-l-2">
<div id="s1-l-2-a">
<div id="s1-l-2-a-1">
INTRODUCING ROBIN CARE
</div>
<div id="s1-l-2-a-2">
Cancer is Complicated
</div>
<div id="s1-l-2-a-3">
<div id="s1-l-2-a-3-1"></div>
</div>
<div id="s1-l-2-a-4">
Robin Care helps simplify the complicated cancer journey by connecting patients and families with the resources they need, when they need them. Our multi-modality approach allows individuals to interact via mobile app, website or phone and our care advocates’ diverse areas of expertise can help to remove confusion around treatment plans; assist in identifying local support groups; and navigate employee benefits programs.
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div id="section-7">
<div id="s7-1">
<div id="s7-1-b">
<div id="s7-1-b-1">
<img src="img/CancerWorkplace_FINAL.jpg" alt="" style="height: 350px; cursor: pointer;" id="s7-1-b-pic" >
</div>
</div>
<div id="s7-1-a">
<div id="s7-1-a-3" class="wow bounceInUp">
<p>“Employers report a level of complexity in managing employees’ cancer-related needs beyond that associated with any other type of disease or condition.” ~ Northeast Business Group on Health (NEBGH)</p>
<p>According to NEBGH, employees or family members facing a cancer diagnosis experience challenges in 3 main areas:</p>
<ol>
<li>Deciding which treatment regimen is most medically appropriate for them and then
where and with whom to get that care;</li>
<li>Understanding and managing their healthcare, disability and other employee benefits
and the impact of disease on finances, lifestyles and logistics; and</li>
<li>Enduring significant emotional and social issues in the workplace, at home and in their communities.</li>
</ol>
<br />
<a class="learn-more-link" target="_blank" href="https://nebgh.org/wp-content/uploads/2015/10/CancerWorkplace_FINAL.pdf">Read more ></a>
</div>
</div>
</div>
</div>
<div id="section-2">
<div id="section-2-first">
<div class="quote-container">
<div style="font-size: 24px; color: #b7cee4; padding-bottom: 30px; padding-top: 10px; text-align: center; font-style: italic;">
“It has been so valuable to talk to Jessica when I was nauseous and could not think straight about what I can eat or do. I also had a hard time choosing between all my nausea meds and their side effects. She has been very helpful in guiding me to talk to my pharmacist and oncologist, as well as encouraging me to seek physical therapy when I was hesitant and doubtful.” ~ Robin Care User
</div>
</div>
</div>
</div>
<!-- <div id="">
<div id="">
<h2>VIDEO GOES HERE</h2>
</div>
</div> -->
<div id="section6" style="background-color: #fff;">
<div id="section-6">
<div id="section-6-b" class="wow fadeIn">
<div class="section-6-b-1">
<div>
<a target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/?term=%22cancer+support%22+%22cost+savings%22"><img src="img/cost-saving.jpg" alt="" class="section-6-b-1-photo hvr-grow"></a>
</div>
<div class="section-6-b-1-d">
Self-selected participation in cancer support programs was associated with a 57% reduction in cancer-related medical costs.
<br />
<a class="learn-more-link" target="_blank" href="https://www.ncbi.nlm.nih.gov/pubmed/?term=%22cancer+support%22+%22cost+savings%22">Read more ></a>
</div>
</div>
<div class="hide-mobile section-6-b-1">
<div>
<a target="_blank" href="http://www.ncbi.nlm.nih.gov/pubmed/23549959"><img src="img/social-support.jpg" alt="" class="section-6-b-1-photo hvr-grow"></a>
</div>
<div class="section-6-b-1-d">
Limited social support has been associated with a higher risk of both cancer incidence and mortality. Social support may affect cancer prognosis via a range of factors including adherence to therapeutic regimens.
<br />
<a class="learn-more-link" target="_blank" href="http://www.ncbi.nlm.nih.gov/pubmed/23549959">Read more ></a>
</div>
</div>
<div class="hide-mobile section-6-b-1">
<div>
<a target="_blank" href="http://www.ascopost.com/News/41629"><img src="img/digital-device.jpg" alt="" class="section-6-b-1-photo hvr-grow"></a>
</div>
<div class="section-6-b-1-d">
ASCO 2016: Study Finds Use of Mobile Web App Associated With Improved Outcomes in Lung Cancer
<br />
<a class="learn-more-link" target="_blank" href="http://www.ascopost.com/News/41629">Read more ></a>
</div>
</div>
</div>
</div>
</div>
<div id="section-2" class="light">
<div id="section-2-first">
<div class="quote-container">
<div style="font-size: 24px; color: #b7cee4; padding-bottom: 30px; padding-top: 10px; text-align: center; font-style: italic;">
“It has been useful to have the support of valuable information and people during this challenging time. It is nice to have 24/7 support through chat.” ~ Robin Care User
</div>
</div>
</div>
</div>
<footer >
<div class="row" style="padding-top: 40px;padding-bottom: 40px;" id="footer-id">
<div class="col-xl-6 col-lg-6 col-md-8 col-sm-8 col-8">
<div style="display: flex;" class="wow fadeInUp">
<div>
<div style="padding-bottom: 10px;" class="wow fadeInLeft">
<img src="./img/robin-care-logo-white.png" style="max-width: 120px;" alt="Logo">
</div>
<div style="color: #fff;font-size: 13px;padding-right: 25px;padding-top: 5px;">
All Rights Reserved
</div>
</div>
</div>
</div>
</div>
</footer>
<div id="footer-mobile">
<div style="background-color: #2e3f50;padding: 40px 0px 30px 0px;">
<div style="text-align: center;padding-bottom: 20px;">
<img src="img/robin-care-logo-white.png" style="max-width: 140px;" alt="Logo">
</div>
<div style="color: #fff;font-size: 13px;text-align: center;padding-top: 10px;">
All Rights Reserved
</div>
</div>
</div>
</div>
<div id="mobile-menu-content" class="hidden-pic animated fadeInDownBig">
<div class="row" style="padding: 15px 15px 15px 25px;">
<div class="col-md-6 col-sm-6 col-6">
<a href="http://www.getrobincare.com/"><img src="img/robin-care-logo-white.png" alt="Logo" id="logo-img"></a>
</div>
<div class="col-md-6 col-sm-6 col-6 text-right">
<a onclick="close_menu_mobile();"><img src="img/close.png" alt="Close" style="max-width: 17px;"></a>
</div>
</div>
</div>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.11.0/umd/popper.min.js" integrity="sha384-b/U6ypiBEHpOf/4+1nzFpr53nxSS+GLCkfwBdFNTxtclqqenISfwAzpKaMNFNmj4" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta/js/bootstrap.min.js" integrity="sha384-h0AbiXch4ZDo7tp9hKZ4TsHbi047NrKGLO3SEJAg45jXxnGIfYzk4Si90RDIqNm1" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/wow/1.1.2/wow.min.js"></script>
</body>
</html>
<script type="text/javascript">
new WOW().init();
function submit_contact() {
var b_name = $('#your-name').val();
var b_email = $('#email-address').val();
var b_message = $('#text-message').val();
if($('#checkbox-f').is(':checked')) { var updates = 1; }
else { var updates = 0; }
$('#form-error').html('');
if(b_name.length==0 || b_email.lenght==0 || b_message==0) {
if(b_name.length==0) { $('#form-error').append('The name field is required!<br>'); }
if(b_email.length==0) { $('#form-error').append('The email field is required!<br>'); }
if(b_message.length==0) { $('#form-error').append('The message field is required!<br>'); }
}
else {
$.ajax({
url: "https://formspree.io/hello@getrobincare.com",
method: "POST",
data: {Contact_Name: b_name, Contact_Email: b_email, Contact_Message: b_message},
dataType: "json"
});
$('#s-4th-form-content-first').addClass('hidden-pic');
$('#s-4th-form-thank-you').removeClass('hidden-pic');
}
}
function submit_modala() {
var a_organization = $('#organization').val();
var a_name = $('#name').val();
var a_title = $('#title').val();
var a_email = $('#email').val();
var a_message = $('#message').val();
if($('#checkbox-f2').is(':checked')) { var updates = 1; }
else { var updates = 0; }
$('#form-error2').html('');
if(a_name.length==0 || a_email.lenght==0 || a_message==0) {
if(a_name.length==0) { $('#form-error2').append('The name field is required!<br>'); }
if(a_email.length==0) { $('#form-error2').append('The email field is required!<br>'); }
if(a_message.length==0) { $('#form-error2').append('The message field is required!<br>'); }
}
else {
$.ajax({
url: "https://formspree.io/hello@getrobincare.com",
method: "POST",
data: {Demo_Organization: a_organization ,Demo_Name: a_name, Demo_Title: a_title, Demo_Email: a_email, Demo_Message: a_message},
dataType: "json"
});
$('#modal-a-first').addClass('hidden-pic');
$('#modal-a-second').removeClass('hidden-pic');
}
}
function submit_modala_m() {
var a_organization = $('#organization-m').val();
var a_name = $('#name-m').val();
var a_title = $('#title-m').val();
var a_email = $('#email-m').val();
var a_message = $('#message-m').val();
if($('#checkbox-f2-m').is(':checked')) { var updates = 1; }
else { var updates = 0; }
$('#form-error2-m').html('');
if(a_name.length==0 || a_email.lenght==0 || a_message==0) {
if(a_name.length==0) { $('#form-error2-m').append('The name field is required!<br>'); }
if(a_email.length==0) { $('#form-error2-m').append('The email field is required!<br>'); }
if(a_message.length==0) { $('#form-error2-m').append('The message field is required!<br>'); }
}
else {
$.ajax({
url: "https://formspree.io/hello@getrobincare.com",
method: "POST",
data: {Demo_Organization: a_organization ,Demo_Name: a_name, Demo_Title: a_title, Demo_Email: a_email, Demo_Message: a_message},
dataType: "json"
});
$('#mobile-modal-div-content').addClass('hidden-pic');
$('#mobile-modal-div-thank-you').removeClass('hidden-pic');
window.scrollTo(0,0);
}
}
var slide_index = 4;
function slide_images(slide) {
var slide_number;
if(slide==0) { //if the value is 0, it'll calculate the index of next slide
if(slide_index==4) { slide_number = 1; }
else { slide_number = slide_index+1; }
}
else { //if the user click on controllers to change the slide
slide_number = slide;
clearInterval(time);
time = setInterval(call_slide_images, 7000);
}
if(slide_index != slide_number) { //if the slide is different to the current one
if(slide_number==1) {
$('.s-3rd-slide').css('background-image', 'url(img/swiper-img-1.jpg)');
$('#s-3rd-card-subtitle').html('EARLY ENGAGEMENT');
$('#s-3rd-card-text').html('We onboard patients at diagnosis and create a tailored plan of attack that complements their clinical care plan.');
}
else if(slide_number==2) {
$('.s-3rd-slide').css('background-image', 'url(img/swiper-img-2.jpg)');
$('#s-3rd-card-subtitle').html('CONTINUOUS SUPPORT');
$('#s-3rd-card-text').html('We are there for patients when they need us. We offer 24/7 access to our network of experts.');
}
else if(slide_number==3) {
$('.s-3rd-slide').css('background-image', 'url(img/swiper-img-1.jpg)');
$('#s-3rd-card-subtitle').html('SCALING RESOURCES');
$('#s-3rd-card-text').html('We use technology to extend the impact of our Robin team.');
}
else if(slide_number==4) {
$('.s-3rd-slide').css('background-image', 'url(img/swiper-img-4.jpg)');
$('#s-3rd-card-subtitle').html('ACTIONABLE CONTENT');
$('#s-3rd-card-text').html('We deliver engaging, highly personalized education and planning tools to proactively guide patients through the journey.');
}
slide_index = slide_number;
$('#slider-circle-1,#slider-circle-2,#slider-circle-3,#slider-circle-4').removeClass('circle-active');
$('#slider-circle-'+slide_number).addClass('circle-active');
}
}
function call_slide_images() {
slide_images(0);
}
var time = setInterval(call_slide_images, 7000);
slide_images(1);
function menu_mobile() {
$('body').css("background-color","#35cdcd");
$('#page-content').addClass('hidden-pic');
$('#mobile-menu-content').removeClass('hidden-pic');
}
function close_menu_mobile() {
$('body').css("background-color","#fff");
$('#page-content').removeClass('hidden-pic');
$('#mobile-menu-content').addClass('hidden-pic');
}
function download_mobile() {
close_menu_mobile();
location.href = "#footer-mobile";
}
var mmodal = 1;
function mobile_modal() {
if(mmodal==1) {
mmodal = 0;
$('#page-content2').addClass('hidden-pic');
$('#section-1').addClass('hidden-pic');
$('#mobile-modal-div').removeClass('hidden-pic');
window.scrollTo(0,0);
}
else if(mmodal==0) {
mmodal = 1;
$('#page-content2').removeClass('hidden-pic');
$('#section-1').removeClass('hidden-pic');
$('#mobile-modal-div').addClass('hidden-pic');
}
}
</script>
| 50.962882 | 464 | 0.518872 |
1611aca37081b757040f9df81c98896495ea63fb | 3,027 | ts | TypeScript | src/cqrx.module.ts | unlight/nestjs-cqrx | db6c2d73a698545106a05498ae9ea4fa0bfc6fff | [
"MIT"
] | 1 | 2022-03-22T06:26:53.000Z | 2022-03-22T06:26:53.000Z | src/cqrx.module.ts | unlight/nestjs-cqrx | db6c2d73a698545106a05498ae9ea4fa0bfc6fff | [
"MIT"
] | 1 | 2022-02-25T21:37:34.000Z | 2022-02-25T21:39:13.000Z | src/cqrx.module.ts | unlight/nestjs-cqrx | db6c2d73a698545106a05498ae9ea4fa0bfc6fff | [
"MIT"
] | null | null | null | import { DynamicModule, Module, Provider, Type } from '@nestjs/common';
import { AggregateRepository, aggregateRepositoryToken } from './aggregate.repository';
import { AggregateRoot } from './aggregate-root';
import { EVENT_TRANSFORMERS } from './constants';
import {
CqrxCoreModule,
CqrxModuleAsyncOptions,
CqrxModuleOptions,
} from './cqrx-core.module';
import { EventStoreService } from './eventstore.service';
import { AsyncAggregateRootFactory } from './interfaces';
import { Transformers } from './transform.service';
@Module({})
export class CqrxModule {
static forRoot(options: Partial<CqrxModuleOptions>): DynamicModule {
return {
module: CqrxModule,
imports: [CqrxCoreModule.forRoot(options)],
};
}
static forRootAsync(options: CqrxModuleAsyncOptions): DynamicModule {
return {
module: CqrxModule,
imports: [CqrxCoreModule.forRootAsync(options)],
};
}
static forFeature(
aggregateRoots: Array<Type<AggregateRoot>>,
transformers: Transformers = [], // Transforms stream event to domain event
): DynamicModule {
const aggregateRepoProviders =
this.createAggregateRepositoryProviders(aggregateRoots);
const transformersProvider = {
provide: EVENT_TRANSFORMERS,
useValue: transformers,
} as const;
return {
module: CqrxModule,
imports: [],
providers: [transformersProvider, ...aggregateRepoProviders],
exports: [transformersProvider, ...aggregateRepoProviders],
};
}
private static createAggregateRepositoryProviders(
aggregateRoots: Array<Type<AggregateRoot>>,
): Provider[] {
return aggregateRoots.map(aggregateRoot => ({
provide: aggregateRepositoryToken(aggregateRoot),
useFactory: (eventStoreService: EventStoreService) =>
new AggregateRepository(
eventStoreService,
aggregateRoot,
aggregateRoot.name,
),
inject: [EventStoreService],
}));
}
private static createAsyncAggregateRepositoryProviders(
factories: AsyncAggregateRootFactory[] = [],
): Provider[] {
return factories.map(factory => {
return {
provide: aggregateRepositoryToken(factory),
inject: [...(factory.inject || [])],
useFactory: (...args: unknown[]) => factory.useFactory(...args),
};
});
}
static forFeatureAsync(factories: AsyncAggregateRootFactory[] = []): DynamicModule {
const providers = this.createAsyncAggregateRepositoryProviders(factories);
const imports = factories.flatMap(factory => factory.imports || []);
return {
module: CqrxModule,
imports: [...imports],
providers: providers,
exports: providers,
};
}
}
| 34.011236 | 88 | 0.613479 |
c6b7bfe47a9bfe6f7d0f1de8319e7a3fec779f93 | 946 | sql | SQL | lab_02/query12.sql | Justarone/bmstu-db | 15fdd77c930d0059443f90d854f16b7b6aa9c499 | [
"MIT"
] | 3 | 2021-09-23T17:23:51.000Z | 2022-01-13T16:07:44.000Z | lab_02/query12.sql | Justarone/bmstu-db | 15fdd77c930d0059443f90d854f16b7b6aa9c499 | [
"MIT"
] | null | null | null | lab_02/query12.sql | Justarone/bmstu-db | 15fdd77c930d0059443f90d854f16b7b6aa9c499 | [
"MIT"
] | null | null | null | -- Инструкция SELECT, использующая вложенные коррелированные подзапросы в качетсве производных таблиц в предложении FROM
-- Все игроки, которые выходили на лед при участии определенной команды в определенный период времени
-- (изначально другой немного запрос планировался, но пусть будет этот)
SELECT DISTINCT firstName, lastName, birthDate
FROM player_info
JOIN (
SELECT game_shifts.game_id, player_id
FROM game_shifts
JOIN (
SELECT game_id
FROM game
JOIN team_info ateam
ON ateam.team_id = game.away_team_id
JOIN team_info hteam
ON hteam.team_id = game.home_team_id
WHERE (ateam.shortName LIKE '%Tampa%' OR hteam.shortName LIKE '%Tampa%') -- team
AND
(game.date_time > '2017-01-01' AND game.date_time < '2017-01-07') -- time
) AS extGame ON game_shifts.game_id = extGame.game_id
) AS timeAndTeam ON player_info.player_id = timeAndTeam.player_id;
| 39.416667 | 120 | 0.718816 |
41cdc04a45e7e1729e03a24194747070a952e544 | 13,374 | c | C | src/cmd/linuxkit/vendor/github.com/moby/hyperkit/src/lib/firmware/multiboot.c | munkyboy/linuxkit | 4a9de16e03a14a9895876042938f3217b977deb3 | [
"Apache-2.0"
] | 3 | 2021-03-26T05:41:34.000Z | 2022-02-10T17:27:41.000Z | src/cmd/linuxkit/vendor/github.com/moby/hyperkit/src/lib/firmware/multiboot.c | munkyboy/linuxkit | 4a9de16e03a14a9895876042938f3217b977deb3 | [
"Apache-2.0"
] | 1 | 2020-07-16T08:40:05.000Z | 2020-07-16T08:40:50.000Z | src/cmd/linuxkit/vendor/github.com/moby/hyperkit/src/lib/firmware/multiboot.c | munkyboy/linuxkit | 4a9de16e03a14a9895876042938f3217b977deb3 | [
"Apache-2.0"
] | 1 | 2020-12-14T15:04:02.000Z | 2020-12-14T15:04:02.000Z | /*-
* Copyright (c) 2016 Thomas Haggett
* Copyright (c) 2017 Pavel Borzenkov
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THOMAS HAGGETT ``AS IS'' AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL NETAPP, INC OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <stdint.h>
#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/fcntl.h>
#include <sys/mman.h>
#include <xhyve/firmware/multiboot.h>
#include <xhyve/vmm/vmm_api.h>
#define MULTIBOOT_MAGIC 0x1BADB002
#define MULTIBOOT_SEARCH_END 0x2000
struct multiboot_load_header {
uint32_t header_addr;
uint32_t load_addr;
uint32_t load_end_addr;
uint32_t bss_end_addr;
uint32_t entry_addr;
};
struct multiboot_video_header {
uint32_t mode_type;
uint32_t width;
uint32_t height;
uint32_t depth;
};
struct multiboot_header {
struct {
uint32_t magic;
uint32_t flags;
uint32_t checksum;
} hdr;
struct multiboot_load_header lhdr;
struct multiboot_video_header vhdr;
};
struct multiboot_info {
uint32_t flags;
uint32_t mem_lower;
uint32_t mem_upper;
uint32_t boot_device;
uint32_t cmdline_addr;
uint32_t mods_count;
uint32_t mods_addr;
};
struct multiboot_module_entry {
uint32_t addr_start;
uint32_t addr_end;
uint32_t cmdline;
uint32_t pad;
};
static struct multiboot_config {
char* kernel_path;
char* module_list;
char* kernel_append;
} config;
struct image {
void *mapping;
uint32_t size;
};
struct multiboot_state {
uintptr_t guest_mem_base; // HVA of guest's memory
uint32_t guest_mem_size; // size of guest's memory
uint32_t load_addr; // current data load GPA
uint32_t kernel_load_addr; // kernel load GPA
uint32_t kernel_size; // size of the kernel
uint32_t kernel_offset; // offset of the kernel in file
uint32_t kernel_entry_addr; // kernel entry GPA
uint32_t mbi_addr; // GPA of MBI header
struct multiboot_info mbi; // MBI
struct multiboot_module_entry *modules; // modules info
unsigned modules_count;
char *cmdline; // combined kernel and modules cmdline
uint32_t cmdline_len;
};
struct elf_ehdr {
uint8_t e_ident[16];
uint16_t e_type;
uint16_t e_machine;
uint32_t e_version;
uint32_t e_entry;
uint32_t e_phoff;
uint32_t e_shoff;
uint32_t e_flags;
uint16_t e_hsize;
uint16_t e_phentsize;
uint16_t e_phnum;
uint16_t e_shentsize;
uint16_t e_shnum;
uint16_t e_shstrndx;
};
#define EM_X86_64 62
struct elf_phdr {
uint32_t p_type;
uint32_t p_offset;
uint32_t p_vaddr;
uint32_t p_paddr;
uint32_t p_filesz;
uint32_t p_memsz;
uint32_t p_flags;
uint32_t p_align;
};
#define PT_LOAD 1
#define PF_X 0x1
#define ROUND_UP(a, b) (((a) + (b) - 1) / (b) * (b))
#define MIN(a, b) ((a) < (b) ? (a) : (b))
#define PAGE_SIZE 4096
static void __attribute__((noreturn,format(printf,1,2)))
die(const char *format, ...)
{
va_list args;
va_start(args, format);
vfprintf(stderr, format, args);
va_end(args);
exit(1);
}
// get_image maps file at path into process's address space.
static void
get_image(char *path, struct image *img)
{
int fd;
struct stat st;
fd = open(path, O_RDONLY);
if (fd < 0)
die("multiboot: failed to open '%s': %s\n", path, strerror(errno));
if (fstat(fd, &st) < 0) {
close(fd);
die("multiboot: failed to stat '%s': %s\n", path, strerror(errno));
}
img->size = (uint32_t)st.st_size;
img->mapping = mmap(NULL, ROUND_UP(img->size, 4096), PROT_READ, MAP_PRIVATE, fd, 0);
close(fd);
if (img->mapping == (void *)MAP_FAILED)
die("multiboot: failed to mmap '%s': %s\n", path, strerror(errno));
}
// put_image releases mmaped file.
static int
put_image(struct image *img)
{
if (munmap(img->mapping, ROUND_UP(img->size, 4096)) < 0)
die("multiboot: failed to munmap: %s\n", strerror(errno));
img->mapping = NULL;
img->size = 0;
return 0;
}
// multiboot_init is called by xhyve to pass in the firmware arguments.
int
multiboot_init(char *kernel_path, char *module_list, char *kernel_append)
{
if (!kernel_path)
return 1;
config.kernel_path = kernel_path;
config.module_list = module_list;
config.kernel_append = kernel_append;
return 0;
}
// multiboot_parse_elf parses ELF header and determines kernel load/entry
// addresses.
static void
multiboot_parse_elf(struct multiboot_state *s, struct image *img)
{
struct elf_ehdr *ehdr = img->mapping;
struct elf_phdr *phdr;
uint32_t low = (uint32_t)-1, high = 0, memsize, addr, entry;
int i;
if (ehdr->e_ident[0] != 0x7f ||
ehdr->e_ident[1] != 'E' ||
ehdr->e_ident[2] != 'L' ||
ehdr->e_ident[3] != 'F')
die("multiboot: invalid ELF magic\n");
if (ehdr->e_machine == EM_X86_64)
die("multiboot: 64-bit ELFs are not supported\n");
entry = ehdr->e_entry;
phdr = (struct elf_phdr *)((uintptr_t)img->mapping + ehdr->e_phoff);
for (i = 0; i < ehdr->e_phnum; i++) {
if (phdr[i].p_type != PT_LOAD)
continue;
memsize = phdr[i].p_filesz;
addr = phdr[i].p_paddr;
if (phdr[i].p_flags & PF_X &&
phdr[i].p_vaddr != phdr[i].p_paddr &&
entry >= phdr[i].p_vaddr &&
entry < phdr[i].p_vaddr + phdr[i].p_filesz)
entry = entry - phdr[i].p_vaddr + phdr[i].p_paddr;
if (addr < low)
low = addr;
if (addr + memsize > high)
high = addr + memsize;
}
if (low == (uint32_t)-1 || high == 0)
die("multiboot: failed to parse ELF file\n");
s->kernel_load_addr = low;
s->kernel_size = high - low;
s->kernel_entry_addr = entry;
}
// multiboot_find_header scans the configured kernel for it's multiboot header.
static void
multiboot_find_header(struct multiboot_state *s, struct image *img)
{
struct multiboot_header *header = NULL;
uintptr_t ptr = (uintptr_t)img->mapping;
uintptr_t sz = MIN(img->size, MULTIBOOT_SEARCH_END);
uintptr_t end = ptr + sz - sizeof(struct multiboot_header);
int found = 0;
for (; ptr < end; ptr += 4) {
header = (struct multiboot_header *)ptr;
if (header->hdr.magic != MULTIBOOT_MAGIC)
continue;
if (header->hdr.checksum + header->hdr.flags + header->hdr.magic != 0)
continue;
found = 1;
break;
}
if (!found)
die("multiboot: failed to find multiboot header in '%s'\n", config.kernel_path);
// are there any mandatory flags that we don't support? (any other than 0 and 1 set)
uint16_t supported_mandatory = ((1 << 1) | (1 << 0));
if (((header->hdr.flags & ~supported_mandatory) & 0xFFFF) != 0x0)
die("multiboot: header has unsupported mandatory flags (0x%x), bailing.\n", header->hdr.flags & 0xFFFF);
if (!(header->hdr.flags & (1 << 16))) {
multiboot_parse_elf(s, img);
return;
}
s->kernel_offset = (uint32_t)((uintptr_t)header - (uintptr_t)img->mapping -
(header->lhdr.header_addr - header->lhdr.load_addr));
if (header->lhdr.load_end_addr) {
s->kernel_size = header->lhdr.load_end_addr - header->lhdr.load_addr;
} else {
s->kernel_size = img->size - s->kernel_offset;
}
s->kernel_load_addr = header->lhdr.load_addr;
s->kernel_entry_addr = header->lhdr.entry_addr;
}
// guest_to_host translates GPA to HVA.
static uintptr_t
guest_to_host(uint32_t guest_addr, struct multiboot_state *s)
{
return s->guest_mem_base + guest_addr;
}
// multiboot_load_data loads data pointed to by from of size into current load
// address in guest's memory. The load address is advanced taken align into
// account.
static uint32_t
multiboot_load_data(struct multiboot_state *s, void *from, uint32_t size, unsigned align)
{
uintptr_t to = guest_to_host(s->load_addr, s);
uint32_t loaded_at = s->load_addr;
if (from == NULL || size == 0)
return 0;
if ((s->load_addr >= s->guest_mem_size) ||
((s->load_addr + size) > s->guest_mem_size))
die("multiboot: %x+%x is beyond guest's memory\n", s->load_addr, size);
memcpy((void *)to, from, size);
s->load_addr = s->load_addr + size;
if (align)
s->load_addr = ROUND_UP(s->load_addr, align);
return loaded_at;
}
// multiboot_set_guest_state prepares guest registers/descriptors per Multiboot
// specification.
static uint64_t
multiboot_set_guest_state(struct multiboot_state *s)
{
xh_vcpu_reset(0);
xh_vm_set_register(0, VM_REG_GUEST_RAX, 0x2BADB002);
xh_vm_set_register(0, VM_REG_GUEST_RBX, s->mbi_addr);
xh_vm_set_register(0, VM_REG_GUEST_RIP, s->kernel_entry_addr);
xh_vm_set_desc(0, VM_REG_GUEST_CS, 0, 0xffffffff, 0xc09b);
xh_vm_set_desc(0, VM_REG_GUEST_DS, 0, 0xffffffff, 0xc093);
xh_vm_set_desc(0, VM_REG_GUEST_ES, 0, 0xffffffff, 0xc093);
xh_vm_set_desc(0, VM_REG_GUEST_FS, 0, 0xffffffff, 0xc093);
xh_vm_set_desc(0, VM_REG_GUEST_GS, 0, 0xffffffff, 0xc093);
xh_vm_set_desc(0, VM_REG_GUEST_SS, 0, 0xffffffff, 0xc093);
xh_vm_set_register(0, VM_REG_GUEST_CR0, 0x21);
return s->kernel_entry_addr;
}
// multiboot_add_cmdline add boot_file cmdline into combined command line
// buffer.
static uint32_t
multiboot_add_cmdline(struct multiboot_state *s, char *boot_file, char *cmdline)
{
uint32_t offset = s->cmdline_len;
unsigned len = (unsigned)strlen(boot_file) + 1;
if (cmdline != NULL)
len += (unsigned)strlen(cmdline) + 1;
s->cmdline = realloc(s->cmdline, s->cmdline_len + len);
if (s->cmdline == NULL)
die("multiboot: failed to allocate memory for command line\n");
if (cmdline != NULL)
snprintf(s->cmdline + s->cmdline_len, len, "%s %s", boot_file, cmdline);
else
snprintf(s->cmdline + s->cmdline_len, len, "%s", boot_file);
s->cmdline_len += len;
return offset;
}
// multiboot_count_modules returns the amount of passed modules.
static unsigned
multiboot_count_modules()
{
if (config.module_list == NULL || !*config.module_list)
return 0;
unsigned count = 1;
char *p = config.module_list;
while (*p) {
if (*p == ':')
count++;
p++;
}
return count;
}
// multiboot_process_module processes a single module.
static void
multiboot_process_module(struct multiboot_state *s, char *modname, struct multiboot_module_entry *mod_info)
{
char *cmd = NULL, *d;
struct image img;
if ((d = strchr(modname, ';')) != NULL) {
cmd = d + 1;
*d = '\0';
}
get_image(modname, &img);
mod_info->addr_start = multiboot_load_data(s, img.mapping, img.size, PAGE_SIZE);
mod_info->addr_end = mod_info->addr_start + img.size;
put_image(&img);
mod_info->cmdline = multiboot_add_cmdline(s, modname, cmd);
}
uint64_t
multiboot(void)
{
void *gpa = xh_vm_map_gpa(0, xh_vm_get_lowmem_size());
uint32_t mem_size = (uint32_t)xh_vm_get_lowmem_size();
struct multiboot_state state = {
.guest_mem_base = (uintptr_t)gpa,
.guest_mem_size = mem_size,
};
struct image img;
// mmap kernel and locate multiboot header
get_image(config.kernel_path, &img);
multiboot_find_header(&state, &img);
state.load_addr = state.kernel_load_addr;
// actually load the image into the guest's memory
multiboot_load_data(&state, (void *)((uintptr_t)img.mapping + state.kernel_offset), state.kernel_size, PAGE_SIZE);
put_image(&img);
// prepare memory for modules info
state.modules_count = multiboot_count_modules();
state.modules = malloc(sizeof(*state.modules) * state.modules_count);
if (state.modules == NULL)
die("multiboot: failed to allocate memory for modules info info\n");
memset(state.modules, 0, sizeof(*state.modules) * state.modules_count);
// load modules and their command lines
char *modname;
unsigned i = 0;
while ((modname = strsep(&config.module_list, ":")) != NULL)
multiboot_process_module(&state, modname, &state.modules[i++]);
// load combined command line (all modules + kernel)
if (config.kernel_append) {
state.mbi.cmdline_addr = multiboot_add_cmdline(&state, config.kernel_path, config.kernel_append);
state.mbi.cmdline_addr += state.load_addr;
}
for (i = 0; i < state.modules_count; i++)
state.modules[i].cmdline += state.load_addr;
multiboot_load_data(&state, state.cmdline, state.cmdline_len, 4);
// finally load MBI header
state.mbi_addr = state.load_addr;
state.mbi.flags = (1 << 0) | (1 << 2) | (1 << 3);
state.mbi.mem_lower = (uint32_t)640;
state.mbi.mem_upper = state.guest_mem_size / 1024 - 1024;
state.mbi.mods_count = state.modules_count;
state.mbi.mods_addr = state.mbi_addr + sizeof(state.mbi);
multiboot_load_data(&state, &state.mbi, sizeof(state.mbi), 0);
multiboot_load_data(&state, state.modules, sizeof(*state.modules) * state.modules_count, 0);
free(state.modules);
free(state.cmdline);
return multiboot_set_guest_state(&state);
}
| 27.920668 | 115 | 0.720203 |
39c951267de7306f7f077d92446afd8580e47e36 | 6,695 | js | JavaScript | js/components/sidebarRecruiter/index.js | baskoropn/kerjain | 34aa0ca9057456a896ae63630b5285ce23b497d9 | [
"Apache-2.0"
] | null | null | null | js/components/sidebarRecruiter/index.js | baskoropn/kerjain | 34aa0ca9057456a896ae63630b5285ce23b497d9 | [
"Apache-2.0"
] | 14 | 2017-10-23T02:57:51.000Z | 2017-11-20T09:50:48.000Z | js/components/sidebarRecruiter/index.js | baskoropn/kerjain | 34aa0ca9057456a896ae63630b5285ce23b497d9 | [
"Apache-2.0"
] | null | null | null | import React, { Component } from "react";
import { Image, StatusBar, Switch, Share, Alert} from "react-native";
import {
Content,
Text,
List,
ListItem,
Icon,
Container,
Left,
Right,
Badge,
Button,
View,
StyleProvider,
getTheme,
variables,
Thumbnail,
cover
} from "native-base";
import styles from "./style";
const drawerImage = require("../../../img/company/dataon/dataonb.png");
const drawcerCover = require("../../../img/company/dataon/112116_NBC_1.jpg");
class SideBarRecruiter extends Component {
constructor(props) {
super(props);
this.state = {
shadowOffsetWidth: 1,
shadowRadius: 4,
};
}
_shareTextMessage () {
Share.share({
message: 'Try SunFish Talent App'
})
.then(this._showResult)
.catch(err => console.log(err))
}
_showResult (result) {
console.log(result)
}
render() {
return (
<Container>
<Content>
<StatusBar barStyle="light-content" backgroundColor='#d35400' />
<View>
<Image source={drawcerCover} style={styles.drawerCover}>
<View style={styles.overlay}/>
<Thumbnail large source={drawerImage} style={styles.drawerImage} />
<Text style={styles.textDrawer1}> DataOn Corporation </Text>
<Text style={styles.textDrawer2}> recruitment@dataon.com </Text>
</Image>
</View>
<List>
<ListItem itemDivider>
<Text style={styles.mnuDevider}>My Account</Text>
</ListItem>
<ListItem button style={styles.listItem} onPress={() =>this.props.navigation.navigate("Home")}>
<Left>
<Icon name="home" style={styles.mnuIconSelected} />
<Text style={styles.mnuItemSelected}>Home</Text>
</Left>
</ListItem>
<ListItem button style={styles.listItem} onPress={() =>this.props.navigation.navigate("MyProfile")}>
<Left>
<Icon name="person" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>My Profile</Text>
</Left>
</ListItem>
<ListItem button style={styles.listItem} onPress={() => this.props.navigation.navigate("Jobs")}>
<Left>
<Icon name="bookmarks" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>My Post Jobs</Text>
</Left>
</ListItem>
<ListItem button style={styles.listItem} onPress={() => this.props.navigation.navigate("Schedule")}>
<Left>
<Icon name="copy" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Share Interview</Text>
</Left>
</ListItem>
<ListItem button style={{ borderBottomWidth:0, marginRight: 20 }} onPress={() => this.props.navigation.navigate("Agenda")}>
<Left>
<Icon name="calendar" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Agenda</Text>
</Left>
</ListItem>
<ListItem itemDivider>
<Text style={styles.mnuDevider}>Setting</Text>
</ListItem>
<ListItem button style={styles.listItem}>
<Left>
<Icon name="flag" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Language</Text>
</Left>
<Right>
<Text style={styles.mnuItemRight}>English</Text>
</Right>
</ListItem>
<ListItem button style={styles.listItem}>
<Left>
<Icon name="navigate" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Location</Text>
</Left>
<Right>
<Text style={styles.mnuItemRight}>Jakarta</Text>
</Right>
</ListItem>
<ListItem button style={{ borderBottomWidth:0, marginRight: 20 }}>
<Left>
<Icon name="settings" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Notification</Text>
</Left>
<Right>
<Switch
value={ this.state.value }
onValueChange={(value) => this.setState({value})}
onTintColor='#ea6c18'
thumbTintColor='#ea6c18'
/>
</Right>
</ListItem>
<ListItem itemDivider>
<Text style={styles.mnuDevider}>Information</Text>
</ListItem>
<ListItem button style={styles.listItem} onPress={() =>this.props.navigation.navigate("About")}>
<Left>
<Icon name="bulb" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>About</Text>
</Left>
</ListItem>
<ListItem button style={styles.listItem} onPress={() =>this.props.navigation.navigate("Rate")}>
<Left>
<Icon name="star" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Rate Us</Text>
</Left>
</ListItem>
<ListItem button style={styles.listItem} onPress={() =>this.props.navigation.navigate("ContactUs")}>
<Left>
<Icon name="mail" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Contact Us</Text>
</Left>
</ListItem>
<ListItem button style={styles.listItem} onPress={this._shareTextMessage}>
<Left>
<Icon name="share"style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Share</Text>
</Left>
</ListItem>
<ListItem button
onPress={() => Alert.alert(
'SunFis Recruiter',
'Do you really want to exit?',
[
{text: 'Cancel', onPress: () => console.log('Cancel Pressed!')},
{text: 'OK', onPress: () => this.props.navigation.navigate("Login")},
]
)}
style={styles.listItem} >
<Left>
<Icon name="power" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Sign Out</Text>
</Left>
</ListItem>
</List>
</Content>
</Container>
);
}
}
export default SideBarRecruiter;
/*
<ListItem button style={styles.listItem}>
<Left>
<Icon name="chatboxes" style={styles.mnuIcon} />
<Text style={styles.mnuItem}>Chat</Text>
</Left>
</ListItem>
<List
dataArray={datas}
renderRow={data =>
<ListItem button noBorder onPress={() => this.props.navigation.navigate(data.route)}>
<Left>
<Icon active name={data.icon} style={{ color: "#777", fontSize: 26, width: 30 }} />
<Text style={styles.text}>
{data.name}
</Text>
</Left>
{data.types &&
<Right style={{ flex: 1 }}>
<Badge
style={{
borderRadius: 3,
height: 25,
width: 72,
backgroundColor: data.bg,
}}
>
<Text style={styles.badgeText}>{`${data.types} Types`}</Text>
</Badge>
</Right>}
</ListItem>}
/>
*/ | 30.431818 | 129 | 0.565646 |
804fc2dc57abbb9df9b6cf887141bff07fb6e87b | 334 | swift | Swift | Wikipedia/Code/UIApplication+SystemSettings.swift | slchristensen7/bpwiki | f2bc295958d6dd3b849569a0c06c02b214a1fcd8 | [
"MIT"
] | null | null | null | Wikipedia/Code/UIApplication+SystemSettings.swift | slchristensen7/bpwiki | f2bc295958d6dd3b849569a0c06c02b214a1fcd8 | [
"MIT"
] | null | null | null | Wikipedia/Code/UIApplication+SystemSettings.swift | slchristensen7/bpwiki | f2bc295958d6dd3b849569a0c06c02b214a1fcd8 | [
"MIT"
] | null | null | null | import Foundation
extension UIApplication {
func wmf_openAppSpecificSystemSettings() {
guard let bundleIdentifier = Bundle.main.bundleIdentifier, let settingsURL = URL(string: UIApplicationOpenSettingsURLString + bundleIdentifier) else {
return
}
self.openURL(settingsURL as URL)
}
}
| 27.833333 | 158 | 0.703593 |
f7a5dc12565878e52c8354fc611c4cb3e10ae1e9 | 281 | asm | Assembly | data/mapHeaders/celadonprizeroom.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 16 | 2018-08-28T21:47:01.000Z | 2022-02-20T20:29:59.000Z | data/mapHeaders/celadonprizeroom.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 5 | 2019-04-03T19:53:11.000Z | 2022-03-11T22:49:34.000Z | data/mapHeaders/celadonprizeroom.asm | adhi-thirumala/EvoYellow | 6fb1b1d6a1fa84b02e2d982f270887f6c63cdf4c | [
"Unlicense"
] | 2 | 2019-12-09T19:46:02.000Z | 2020-12-05T21:36:30.000Z | CeladonPrizeRoom_h:
db LOBBY ; tileset
db CELADON_PRIZE_ROOM_HEIGHT, CELADON_PRIZE_ROOM_WIDTH ; dimensions (y, x)
dw CeladonPrizeRoomBlocks, CeladonPrizeRoomTextPointers, CeladonPrizeRoomScript ; blocks, texts, scripts
db $00 ; connections
dw CeladonPrizeRoomObject ; objects
| 40.142857 | 105 | 0.829181 |
407408e08206a36be310e021508804c664b8f2b9 | 51,885 | py | Python | tensorflow_checkpoint_reader/pb/tensorflow/compiler/xla/python/tpu_driver/tpu_service_pb2.py | shawwn/tensorflow-checkpoint-reader | f0e65548411e3bd66a07e36bb1850907a05952d0 | [
"MIT"
] | 1 | 2021-12-02T15:06:09.000Z | 2021-12-02T15:06:09.000Z | tensorflow_checkpoint_reader/pb/tensorflow/compiler/xla/python/tpu_driver/tpu_service_pb2.py | shawwn/tensorflow-checkpoint-reader | f0e65548411e3bd66a07e36bb1850907a05952d0 | [
"MIT"
] | null | null | null | tensorflow_checkpoint_reader/pb/tensorflow/compiler/xla/python/tpu_driver/tpu_service_pb2.py | shawwn/tensorflow-checkpoint-reader | f0e65548411e3bd66a07e36bb1850907a05952d0 | [
"MIT"
] | null | null | null |
'Generated protocol buffer code.'
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf import reflection as _reflection
from google.protobuf import symbol_database as _symbol_database
_sym_db = _symbol_database.Default()
from tensorflow.compiler.xla.python.tpu_driver import tpu_driver_pb2 as tensorflow_dot_compiler_dot_xla_dot_python_dot_tpu__driver_dot_tpu__driver__pb2
from ......tensorflow.compiler.xla.service import hlo_pb2 as tensorflow_dot_compiler_dot_xla_dot_service_dot_hlo__pb2
from ......tensorflow.compiler.xla import xla_data_pb2 as tensorflow_dot_compiler_dot_xla_dot_xla__data__pb2
DESCRIPTOR = _descriptor.FileDescriptor(name='tensorflow/compiler/xla/python/tpu_driver/tpu_service.proto', package='tpu_driver', syntax='proto2', serialized_options=b'H\x01', create_key=_descriptor._internal_create_key, serialized_pb=b'\n;tensorflow/compiler/xla/python/tpu_driver/tpu_service.proto\x12\ntpu_driver\x1a:tensorflow/compiler/xla/python/tpu_driver/tpu_driver.proto\x1a)tensorflow/compiler/xla/service/hlo.proto\x1a&tensorflow/compiler/xla/xla_data.proto".\n\rStatusMessage\x12\x0c\n\x04code\x18\x01 \x02(\x05\x12\x0f\n\x07message\x18\x02 \x01(\t"\x8b\x01\n\x0fAllocateRequest\x12\x0f\n\x07core_id\x18\x01 \x02(\x05\x12(\n\x06region\x18\x02 \x02(\x0e2\x18.tpu_driver.MemoryRegion\x12\x13\n\tnum_bytes\x18\x03 \x01(\x03H\x00\x12 \n\x05shape\x18\x04 \x01(\x0b2\x0f.xla.ShapeProtoH\x00B\x06\n\x04size"c\n\x14AllocateTupleRequest\x12\x0f\n\x07core_id\x18\x01 \x02(\x05\x12(\n\x06region\x18\x02 \x02(\x0e2\x18.tpu_driver.MemoryRegion\x12\x10\n\x08children\x18\x03 \x03(\x03"#\n\x11DeallocateRequest\x12\x0e\n\x06handle\x18\x01 \x02(\x03">\n\x17TransferToDeviceRequest\x12\x15\n\rtarget_handle\x18\x01 \x02(\x03\x12\x0c\n\x04data\x18\x02 \x02(\x0c"2\n\x19TransferFromDeviceRequest\x12\x15\n\rsource_handle\x18\x01 \x02(\x03"*\n\x1aTransferFromDeviceResponse\x12\x0c\n\x04data\x18\x02 \x02(\x0c"Q\n!TransferFromDeviceToDeviceRequest\x12\x15\n\rsource_handle\x18\x01 \x02(\x03\x12\x15\n\rtarget_handle\x18\x02 \x02(\x03"J\n\x0eCompileRequest\x12"\n\x0bhlo_program\x18\x01 \x02(\x0b2\r.xla.HloProto\x12\x14\n\x0cnum_replicas\x18\x02 \x01(\x03"H\n\x17CompiledProgramMetadata\x12-\n\rprogram_shape\x18\x01 \x02(\x0b2\x16.xla.ProgramShapeProto"H\n\x0fCompileResponse\x125\n\x08metadata\x18\x01 \x02(\x0b2#.tpu_driver.CompiledProgramMetadata"F\n\x12LoadProgramRequest\x12\x0f\n\x07core_id\x18\x01 \x02(\x05\x12\x1f\n\x17compiled_program_handle\x18\x02 \x02(\x03"5\n\x14UnloadProgramRequest\x12\x1d\n\x15loaded_program_handle\x18\x01 \x02(\x03"\x93\x01\n\x0eExecuteRequest\x12\x1d\n\x15loaded_program_handle\x18\x01 \x02(\x03\x12\x14\n\x0cinput_handle\x18\x02 \x03(\x03\x12\x15\n\routput_handle\x18\x03 \x03(\x03\x125\n\x11device_assignment\x18\x04 \x01(\x0b2\x1a.xla.DeviceAssignmentProto"\xb4\x05\n\rStreamRequest\x12.\n\x05entry\x18\x1e \x03(\x0b2\x1f.tpu_driver.StreamRequest.Entry\x1a\xf2\x04\n\x05Entry\x12,\n\x05alloc\x18\x01 \x01(\x0b2\x1b.tpu_driver.AllocateRequestH\x00\x127\n\x0balloc_tuple\x18\x02 \x01(\x0b2 .tpu_driver.AllocateTupleRequestH\x00\x120\n\x07dealloc\x18\x03 \x01(\x0b2\x1d.tpu_driver.DeallocateRequestH\x00\x12:\n\x0btransfer_to\x18\x04 \x01(\x0b2#.tpu_driver.TransferToDeviceRequestH\x00\x12>\n\rtransfer_from\x18\x05 \x01(\x0b2%.tpu_driver.TransferFromDeviceRequestH\x00\x12I\n\x10transfer_from_to\x18\n \x01(\x0b2-.tpu_driver.TransferFromDeviceToDeviceRequestH\x00\x12-\n\x07compile\x18\x06 \x01(\x0b2\x1a.tpu_driver.CompileRequestH\x00\x12.\n\x04load\x18\x07 \x01(\x0b2\x1e.tpu_driver.LoadProgramRequestH\x00\x122\n\x06unload\x18\x08 \x01(\x0b2 .tpu_driver.UnloadProgramRequestH\x00\x12-\n\x07execute\x18\t \x01(\x0b2\x1a.tpu_driver.ExecuteRequestH\x00\x12\x13\n\x0bwait_for_id\x18\x14 \x03(\x03\x12\x14\n\x0coperation_id\x18\x15 \x02(\x03\x12\x11\n\tthread_id\x18\x16 \x01(\x03B\t\n\x07request"\x89\x02\n\x0eStreamResponse\x12/\n\x05entry\x18\x14 \x03(\x0b2 .tpu_driver.StreamResponse.Entry\x1a\xc5\x01\n\x05Entry\x12?\n\rtransfer_from\x18\x03 \x01(\x0b2&.tpu_driver.TransferFromDeviceResponseH\x00\x12.\n\x07compile\x18\x04 \x01(\x0b2\x1b.tpu_driver.CompileResponseH\x00\x12)\n\x06status\x18\n \x02(\x0b2\x19.tpu_driver.StatusMessage\x12\x14\n\x0coperation_id\x18\x0b \x02(\x03B\n\n\x08response"(\n\x0bOpenRequest\x12\x19\n\x0eclient_version\x18\x01 \x01(\x05:\x010"F\n\x0cOpenResponse\x12\x11\n\tclient_id\x18\x01 \x02(\r\x12#\n\x15max_idle_time_seconds\x18\x02 \x01(\x05:\x043600"!\n\x0cCloseRequest\x12\x11\n\tclient_id\x18\x01 \x02(\x07"\x0f\n\rCloseResponse"\x0e\n\x0cResetRequest"\x0f\n\rResetResponse"\x18\n\x16QuerySystemInfoRequest"F\n\x17QuerySystemInfoResponse\x12+\n\x0bsystem_info\x18\x01 \x02(\x0b2\x16.tpu_driver.SystemInfo2\xef\x02\n\x0eCloudTpuDriver\x129\n\x04Open\x12\x17.tpu_driver.OpenRequest\x1a\x18.tpu_driver.OpenResponse\x12<\n\x05Close\x12\x18.tpu_driver.CloseRequest\x1a\x19.tpu_driver.CloseResponse\x12<\n\x05Reset\x12\x18.tpu_driver.ResetRequest\x1a\x19.tpu_driver.ResetResponse\x12Z\n\x0fQuerySystemInfo\x12".tpu_driver.QuerySystemInfoRequest\x1a#.tpu_driver.QuerySystemInfoResponse\x12J\n\rStreamExecute\x12\x19.tpu_driver.StreamRequest\x1a\x1a.tpu_driver.StreamResponse(\x010\x01B\x02H\x01', dependencies=[tensorflow_dot_compiler_dot_xla_dot_python_dot_tpu__driver_dot_tpu__driver__pb2.DESCRIPTOR, tensorflow_dot_compiler_dot_xla_dot_service_dot_hlo__pb2.DESCRIPTOR, tensorflow_dot_compiler_dot_xla_dot_xla__data__pb2.DESCRIPTOR])
_STATUSMESSAGE = _descriptor.Descriptor(name='StatusMessage', full_name='tpu_driver.StatusMessage', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='code', full_name='tpu_driver.StatusMessage.code', index=0, number=1, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='message', full_name='tpu_driver.StatusMessage.message', index=1, number=2, type=9, cpp_type=9, label=1, has_default_value=False, default_value=b''.decode('utf-8'), message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=218, serialized_end=264)
_ALLOCATEREQUEST = _descriptor.Descriptor(name='AllocateRequest', full_name='tpu_driver.AllocateRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='core_id', full_name='tpu_driver.AllocateRequest.core_id', index=0, number=1, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='region', full_name='tpu_driver.AllocateRequest.region', index=1, number=2, type=14, cpp_type=8, label=2, has_default_value=False, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='num_bytes', full_name='tpu_driver.AllocateRequest.num_bytes', index=2, number=3, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='shape', full_name='tpu_driver.AllocateRequest.shape', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[_descriptor.OneofDescriptor(name='size', full_name='tpu_driver.AllocateRequest.size', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[])], serialized_start=267, serialized_end=406)
_ALLOCATETUPLEREQUEST = _descriptor.Descriptor(name='AllocateTupleRequest', full_name='tpu_driver.AllocateTupleRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='core_id', full_name='tpu_driver.AllocateTupleRequest.core_id', index=0, number=1, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='region', full_name='tpu_driver.AllocateTupleRequest.region', index=1, number=2, type=14, cpp_type=8, label=2, has_default_value=False, default_value=1, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='children', full_name='tpu_driver.AllocateTupleRequest.children', index=2, number=3, type=3, cpp_type=2, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=408, serialized_end=507)
_DEALLOCATEREQUEST = _descriptor.Descriptor(name='DeallocateRequest', full_name='tpu_driver.DeallocateRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='handle', full_name='tpu_driver.DeallocateRequest.handle', index=0, number=1, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=509, serialized_end=544)
_TRANSFERTODEVICEREQUEST = _descriptor.Descriptor(name='TransferToDeviceRequest', full_name='tpu_driver.TransferToDeviceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='target_handle', full_name='tpu_driver.TransferToDeviceRequest.target_handle', index=0, number=1, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='data', full_name='tpu_driver.TransferToDeviceRequest.data', index=1, number=2, type=12, cpp_type=9, label=2, has_default_value=False, default_value=b'', message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=546, serialized_end=608)
_TRANSFERFROMDEVICEREQUEST = _descriptor.Descriptor(name='TransferFromDeviceRequest', full_name='tpu_driver.TransferFromDeviceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='source_handle', full_name='tpu_driver.TransferFromDeviceRequest.source_handle', index=0, number=1, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=610, serialized_end=660)
_TRANSFERFROMDEVICERESPONSE = _descriptor.Descriptor(name='TransferFromDeviceResponse', full_name='tpu_driver.TransferFromDeviceResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='data', full_name='tpu_driver.TransferFromDeviceResponse.data', index=0, number=2, type=12, cpp_type=9, label=2, has_default_value=False, default_value=b'', message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=662, serialized_end=704)
_TRANSFERFROMDEVICETODEVICEREQUEST = _descriptor.Descriptor(name='TransferFromDeviceToDeviceRequest', full_name='tpu_driver.TransferFromDeviceToDeviceRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='source_handle', full_name='tpu_driver.TransferFromDeviceToDeviceRequest.source_handle', index=0, number=1, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='target_handle', full_name='tpu_driver.TransferFromDeviceToDeviceRequest.target_handle', index=1, number=2, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=706, serialized_end=787)
_COMPILEREQUEST = _descriptor.Descriptor(name='CompileRequest', full_name='tpu_driver.CompileRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='hlo_program', full_name='tpu_driver.CompileRequest.hlo_program', index=0, number=1, type=11, cpp_type=10, label=2, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='num_replicas', full_name='tpu_driver.CompileRequest.num_replicas', index=1, number=2, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=789, serialized_end=863)
_COMPILEDPROGRAMMETADATA = _descriptor.Descriptor(name='CompiledProgramMetadata', full_name='tpu_driver.CompiledProgramMetadata', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='program_shape', full_name='tpu_driver.CompiledProgramMetadata.program_shape', index=0, number=1, type=11, cpp_type=10, label=2, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=865, serialized_end=937)
_COMPILERESPONSE = _descriptor.Descriptor(name='CompileResponse', full_name='tpu_driver.CompileResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='metadata', full_name='tpu_driver.CompileResponse.metadata', index=0, number=1, type=11, cpp_type=10, label=2, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=939, serialized_end=1011)
_LOADPROGRAMREQUEST = _descriptor.Descriptor(name='LoadProgramRequest', full_name='tpu_driver.LoadProgramRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='core_id', full_name='tpu_driver.LoadProgramRequest.core_id', index=0, number=1, type=5, cpp_type=1, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='compiled_program_handle', full_name='tpu_driver.LoadProgramRequest.compiled_program_handle', index=1, number=2, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=1013, serialized_end=1083)
_UNLOADPROGRAMREQUEST = _descriptor.Descriptor(name='UnloadProgramRequest', full_name='tpu_driver.UnloadProgramRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='loaded_program_handle', full_name='tpu_driver.UnloadProgramRequest.loaded_program_handle', index=0, number=1, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=1085, serialized_end=1138)
_EXECUTEREQUEST = _descriptor.Descriptor(name='ExecuteRequest', full_name='tpu_driver.ExecuteRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='loaded_program_handle', full_name='tpu_driver.ExecuteRequest.loaded_program_handle', index=0, number=1, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='input_handle', full_name='tpu_driver.ExecuteRequest.input_handle', index=1, number=2, type=3, cpp_type=2, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='output_handle', full_name='tpu_driver.ExecuteRequest.output_handle', index=2, number=3, type=3, cpp_type=2, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='device_assignment', full_name='tpu_driver.ExecuteRequest.device_assignment', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=1141, serialized_end=1288)
_STREAMREQUEST_ENTRY = _descriptor.Descriptor(name='Entry', full_name='tpu_driver.StreamRequest.Entry', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='alloc', full_name='tpu_driver.StreamRequest.Entry.alloc', index=0, number=1, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='alloc_tuple', full_name='tpu_driver.StreamRequest.Entry.alloc_tuple', index=1, number=2, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='dealloc', full_name='tpu_driver.StreamRequest.Entry.dealloc', index=2, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='transfer_to', full_name='tpu_driver.StreamRequest.Entry.transfer_to', index=3, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='transfer_from', full_name='tpu_driver.StreamRequest.Entry.transfer_from', index=4, number=5, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='transfer_from_to', full_name='tpu_driver.StreamRequest.Entry.transfer_from_to', index=5, number=10, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='compile', full_name='tpu_driver.StreamRequest.Entry.compile', index=6, number=6, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='load', full_name='tpu_driver.StreamRequest.Entry.load', index=7, number=7, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='unload', full_name='tpu_driver.StreamRequest.Entry.unload', index=8, number=8, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='execute', full_name='tpu_driver.StreamRequest.Entry.execute', index=9, number=9, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='wait_for_id', full_name='tpu_driver.StreamRequest.Entry.wait_for_id', index=10, number=20, type=3, cpp_type=2, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='operation_id', full_name='tpu_driver.StreamRequest.Entry.operation_id', index=11, number=21, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='thread_id', full_name='tpu_driver.StreamRequest.Entry.thread_id', index=12, number=22, type=3, cpp_type=2, label=1, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[_descriptor.OneofDescriptor(name='request', full_name='tpu_driver.StreamRequest.Entry.request', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[])], serialized_start=1357, serialized_end=1983)
_STREAMREQUEST = _descriptor.Descriptor(name='StreamRequest', full_name='tpu_driver.StreamRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='entry', full_name='tpu_driver.StreamRequest.entry', index=0, number=30, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[_STREAMREQUEST_ENTRY], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=1291, serialized_end=1983)
_STREAMRESPONSE_ENTRY = _descriptor.Descriptor(name='Entry', full_name='tpu_driver.StreamResponse.Entry', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='transfer_from', full_name='tpu_driver.StreamResponse.Entry.transfer_from', index=0, number=3, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='compile', full_name='tpu_driver.StreamResponse.Entry.compile', index=1, number=4, type=11, cpp_type=10, label=1, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='status', full_name='tpu_driver.StreamResponse.Entry.status', index=2, number=10, type=11, cpp_type=10, label=2, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='operation_id', full_name='tpu_driver.StreamResponse.Entry.operation_id', index=3, number=11, type=3, cpp_type=2, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[_descriptor.OneofDescriptor(name='response', full_name='tpu_driver.StreamResponse.Entry.response', index=0, containing_type=None, create_key=_descriptor._internal_create_key, fields=[])], serialized_start=2054, serialized_end=2251)
_STREAMRESPONSE = _descriptor.Descriptor(name='StreamResponse', full_name='tpu_driver.StreamResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='entry', full_name='tpu_driver.StreamResponse.entry', index=0, number=20, type=11, cpp_type=10, label=3, has_default_value=False, default_value=[], message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[_STREAMRESPONSE_ENTRY], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=1986, serialized_end=2251)
_OPENREQUEST = _descriptor.Descriptor(name='OpenRequest', full_name='tpu_driver.OpenRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='client_version', full_name='tpu_driver.OpenRequest.client_version', index=0, number=1, type=5, cpp_type=1, label=1, has_default_value=True, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2253, serialized_end=2293)
_OPENRESPONSE = _descriptor.Descriptor(name='OpenResponse', full_name='tpu_driver.OpenResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='client_id', full_name='tpu_driver.OpenResponse.client_id', index=0, number=1, type=13, cpp_type=3, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key), _descriptor.FieldDescriptor(name='max_idle_time_seconds', full_name='tpu_driver.OpenResponse.max_idle_time_seconds', index=1, number=2, type=5, cpp_type=1, label=1, has_default_value=True, default_value=3600, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2295, serialized_end=2365)
_CLOSEREQUEST = _descriptor.Descriptor(name='CloseRequest', full_name='tpu_driver.CloseRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='client_id', full_name='tpu_driver.CloseRequest.client_id', index=0, number=1, type=7, cpp_type=3, label=2, has_default_value=False, default_value=0, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2367, serialized_end=2400)
_CLOSERESPONSE = _descriptor.Descriptor(name='CloseResponse', full_name='tpu_driver.CloseResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2402, serialized_end=2417)
_RESETREQUEST = _descriptor.Descriptor(name='ResetRequest', full_name='tpu_driver.ResetRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2419, serialized_end=2433)
_RESETRESPONSE = _descriptor.Descriptor(name='ResetResponse', full_name='tpu_driver.ResetResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2435, serialized_end=2450)
_QUERYSYSTEMINFOREQUEST = _descriptor.Descriptor(name='QuerySystemInfoRequest', full_name='tpu_driver.QuerySystemInfoRequest', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2452, serialized_end=2476)
_QUERYSYSTEMINFORESPONSE = _descriptor.Descriptor(name='QuerySystemInfoResponse', full_name='tpu_driver.QuerySystemInfoResponse', filename=None, file=DESCRIPTOR, containing_type=None, create_key=_descriptor._internal_create_key, fields=[_descriptor.FieldDescriptor(name='system_info', full_name='tpu_driver.QuerySystemInfoResponse.system_info', index=0, number=1, type=11, cpp_type=10, label=2, has_default_value=False, default_value=None, message_type=None, enum_type=None, containing_type=None, is_extension=False, extension_scope=None, serialized_options=None, file=DESCRIPTOR, create_key=_descriptor._internal_create_key)], extensions=[], nested_types=[], enum_types=[], serialized_options=None, is_extendable=False, syntax='proto2', extension_ranges=[], oneofs=[], serialized_start=2478, serialized_end=2548)
_ALLOCATEREQUEST.fields_by_name['region'].enum_type = tensorflow_dot_compiler_dot_xla_dot_python_dot_tpu__driver_dot_tpu__driver__pb2._MEMORYREGION
_ALLOCATEREQUEST.fields_by_name['shape'].message_type = tensorflow_dot_compiler_dot_xla_dot_xla__data__pb2._SHAPEPROTO
_ALLOCATEREQUEST.oneofs_by_name['size'].fields.append(_ALLOCATEREQUEST.fields_by_name['num_bytes'])
_ALLOCATEREQUEST.fields_by_name['num_bytes'].containing_oneof = _ALLOCATEREQUEST.oneofs_by_name['size']
_ALLOCATEREQUEST.oneofs_by_name['size'].fields.append(_ALLOCATEREQUEST.fields_by_name['shape'])
_ALLOCATEREQUEST.fields_by_name['shape'].containing_oneof = _ALLOCATEREQUEST.oneofs_by_name['size']
_ALLOCATETUPLEREQUEST.fields_by_name['region'].enum_type = tensorflow_dot_compiler_dot_xla_dot_python_dot_tpu__driver_dot_tpu__driver__pb2._MEMORYREGION
_COMPILEREQUEST.fields_by_name['hlo_program'].message_type = tensorflow_dot_compiler_dot_xla_dot_service_dot_hlo__pb2._HLOPROTO
_COMPILEDPROGRAMMETADATA.fields_by_name['program_shape'].message_type = tensorflow_dot_compiler_dot_xla_dot_xla__data__pb2._PROGRAMSHAPEPROTO
_COMPILERESPONSE.fields_by_name['metadata'].message_type = _COMPILEDPROGRAMMETADATA
_EXECUTEREQUEST.fields_by_name['device_assignment'].message_type = tensorflow_dot_compiler_dot_xla_dot_xla__data__pb2._DEVICEASSIGNMENTPROTO
_STREAMREQUEST_ENTRY.fields_by_name['alloc'].message_type = _ALLOCATEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['alloc_tuple'].message_type = _ALLOCATETUPLEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['dealloc'].message_type = _DEALLOCATEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['transfer_to'].message_type = _TRANSFERTODEVICEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['transfer_from'].message_type = _TRANSFERFROMDEVICEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['transfer_from_to'].message_type = _TRANSFERFROMDEVICETODEVICEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['compile'].message_type = _COMPILEREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['load'].message_type = _LOADPROGRAMREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['unload'].message_type = _UNLOADPROGRAMREQUEST
_STREAMREQUEST_ENTRY.fields_by_name['execute'].message_type = _EXECUTEREQUEST
_STREAMREQUEST_ENTRY.containing_type = _STREAMREQUEST
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['alloc'])
_STREAMREQUEST_ENTRY.fields_by_name['alloc'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['alloc_tuple'])
_STREAMREQUEST_ENTRY.fields_by_name['alloc_tuple'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['dealloc'])
_STREAMREQUEST_ENTRY.fields_by_name['dealloc'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['transfer_to'])
_STREAMREQUEST_ENTRY.fields_by_name['transfer_to'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['transfer_from'])
_STREAMREQUEST_ENTRY.fields_by_name['transfer_from'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['transfer_from_to'])
_STREAMREQUEST_ENTRY.fields_by_name['transfer_from_to'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['compile'])
_STREAMREQUEST_ENTRY.fields_by_name['compile'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['load'])
_STREAMREQUEST_ENTRY.fields_by_name['load'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['unload'])
_STREAMREQUEST_ENTRY.fields_by_name['unload'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST_ENTRY.oneofs_by_name['request'].fields.append(_STREAMREQUEST_ENTRY.fields_by_name['execute'])
_STREAMREQUEST_ENTRY.fields_by_name['execute'].containing_oneof = _STREAMREQUEST_ENTRY.oneofs_by_name['request']
_STREAMREQUEST.fields_by_name['entry'].message_type = _STREAMREQUEST_ENTRY
_STREAMRESPONSE_ENTRY.fields_by_name['transfer_from'].message_type = _TRANSFERFROMDEVICERESPONSE
_STREAMRESPONSE_ENTRY.fields_by_name['compile'].message_type = _COMPILERESPONSE
_STREAMRESPONSE_ENTRY.fields_by_name['status'].message_type = _STATUSMESSAGE
_STREAMRESPONSE_ENTRY.containing_type = _STREAMRESPONSE
_STREAMRESPONSE_ENTRY.oneofs_by_name['response'].fields.append(_STREAMRESPONSE_ENTRY.fields_by_name['transfer_from'])
_STREAMRESPONSE_ENTRY.fields_by_name['transfer_from'].containing_oneof = _STREAMRESPONSE_ENTRY.oneofs_by_name['response']
_STREAMRESPONSE_ENTRY.oneofs_by_name['response'].fields.append(_STREAMRESPONSE_ENTRY.fields_by_name['compile'])
_STREAMRESPONSE_ENTRY.fields_by_name['compile'].containing_oneof = _STREAMRESPONSE_ENTRY.oneofs_by_name['response']
_STREAMRESPONSE.fields_by_name['entry'].message_type = _STREAMRESPONSE_ENTRY
_QUERYSYSTEMINFORESPONSE.fields_by_name['system_info'].message_type = tensorflow_dot_compiler_dot_xla_dot_python_dot_tpu__driver_dot_tpu__driver__pb2._SYSTEMINFO
DESCRIPTOR.message_types_by_name['StatusMessage'] = _STATUSMESSAGE
DESCRIPTOR.message_types_by_name['AllocateRequest'] = _ALLOCATEREQUEST
DESCRIPTOR.message_types_by_name['AllocateTupleRequest'] = _ALLOCATETUPLEREQUEST
DESCRIPTOR.message_types_by_name['DeallocateRequest'] = _DEALLOCATEREQUEST
DESCRIPTOR.message_types_by_name['TransferToDeviceRequest'] = _TRANSFERTODEVICEREQUEST
DESCRIPTOR.message_types_by_name['TransferFromDeviceRequest'] = _TRANSFERFROMDEVICEREQUEST
DESCRIPTOR.message_types_by_name['TransferFromDeviceResponse'] = _TRANSFERFROMDEVICERESPONSE
DESCRIPTOR.message_types_by_name['TransferFromDeviceToDeviceRequest'] = _TRANSFERFROMDEVICETODEVICEREQUEST
DESCRIPTOR.message_types_by_name['CompileRequest'] = _COMPILEREQUEST
DESCRIPTOR.message_types_by_name['CompiledProgramMetadata'] = _COMPILEDPROGRAMMETADATA
DESCRIPTOR.message_types_by_name['CompileResponse'] = _COMPILERESPONSE
DESCRIPTOR.message_types_by_name['LoadProgramRequest'] = _LOADPROGRAMREQUEST
DESCRIPTOR.message_types_by_name['UnloadProgramRequest'] = _UNLOADPROGRAMREQUEST
DESCRIPTOR.message_types_by_name['ExecuteRequest'] = _EXECUTEREQUEST
DESCRIPTOR.message_types_by_name['StreamRequest'] = _STREAMREQUEST
DESCRIPTOR.message_types_by_name['StreamResponse'] = _STREAMRESPONSE
DESCRIPTOR.message_types_by_name['OpenRequest'] = _OPENREQUEST
DESCRIPTOR.message_types_by_name['OpenResponse'] = _OPENRESPONSE
DESCRIPTOR.message_types_by_name['CloseRequest'] = _CLOSEREQUEST
DESCRIPTOR.message_types_by_name['CloseResponse'] = _CLOSERESPONSE
DESCRIPTOR.message_types_by_name['ResetRequest'] = _RESETREQUEST
DESCRIPTOR.message_types_by_name['ResetResponse'] = _RESETRESPONSE
DESCRIPTOR.message_types_by_name['QuerySystemInfoRequest'] = _QUERYSYSTEMINFOREQUEST
DESCRIPTOR.message_types_by_name['QuerySystemInfoResponse'] = _QUERYSYSTEMINFORESPONSE
_sym_db.RegisterFileDescriptor(DESCRIPTOR)
StatusMessage = _reflection.GeneratedProtocolMessageType('StatusMessage', (_message.Message,), {'DESCRIPTOR': _STATUSMESSAGE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(StatusMessage)
AllocateRequest = _reflection.GeneratedProtocolMessageType('AllocateRequest', (_message.Message,), {'DESCRIPTOR': _ALLOCATEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(AllocateRequest)
AllocateTupleRequest = _reflection.GeneratedProtocolMessageType('AllocateTupleRequest', (_message.Message,), {'DESCRIPTOR': _ALLOCATETUPLEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(AllocateTupleRequest)
DeallocateRequest = _reflection.GeneratedProtocolMessageType('DeallocateRequest', (_message.Message,), {'DESCRIPTOR': _DEALLOCATEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(DeallocateRequest)
TransferToDeviceRequest = _reflection.GeneratedProtocolMessageType('TransferToDeviceRequest', (_message.Message,), {'DESCRIPTOR': _TRANSFERTODEVICEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(TransferToDeviceRequest)
TransferFromDeviceRequest = _reflection.GeneratedProtocolMessageType('TransferFromDeviceRequest', (_message.Message,), {'DESCRIPTOR': _TRANSFERFROMDEVICEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(TransferFromDeviceRequest)
TransferFromDeviceResponse = _reflection.GeneratedProtocolMessageType('TransferFromDeviceResponse', (_message.Message,), {'DESCRIPTOR': _TRANSFERFROMDEVICERESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(TransferFromDeviceResponse)
TransferFromDeviceToDeviceRequest = _reflection.GeneratedProtocolMessageType('TransferFromDeviceToDeviceRequest', (_message.Message,), {'DESCRIPTOR': _TRANSFERFROMDEVICETODEVICEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(TransferFromDeviceToDeviceRequest)
CompileRequest = _reflection.GeneratedProtocolMessageType('CompileRequest', (_message.Message,), {'DESCRIPTOR': _COMPILEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(CompileRequest)
CompiledProgramMetadata = _reflection.GeneratedProtocolMessageType('CompiledProgramMetadata', (_message.Message,), {'DESCRIPTOR': _COMPILEDPROGRAMMETADATA, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(CompiledProgramMetadata)
CompileResponse = _reflection.GeneratedProtocolMessageType('CompileResponse', (_message.Message,), {'DESCRIPTOR': _COMPILERESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(CompileResponse)
LoadProgramRequest = _reflection.GeneratedProtocolMessageType('LoadProgramRequest', (_message.Message,), {'DESCRIPTOR': _LOADPROGRAMREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(LoadProgramRequest)
UnloadProgramRequest = _reflection.GeneratedProtocolMessageType('UnloadProgramRequest', (_message.Message,), {'DESCRIPTOR': _UNLOADPROGRAMREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(UnloadProgramRequest)
ExecuteRequest = _reflection.GeneratedProtocolMessageType('ExecuteRequest', (_message.Message,), {'DESCRIPTOR': _EXECUTEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(ExecuteRequest)
StreamRequest = _reflection.GeneratedProtocolMessageType('StreamRequest', (_message.Message,), {'Entry': _reflection.GeneratedProtocolMessageType('Entry', (_message.Message,), {'DESCRIPTOR': _STREAMREQUEST_ENTRY, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'}), 'DESCRIPTOR': _STREAMREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(StreamRequest)
_sym_db.RegisterMessage(StreamRequest.Entry)
StreamResponse = _reflection.GeneratedProtocolMessageType('StreamResponse', (_message.Message,), {'Entry': _reflection.GeneratedProtocolMessageType('Entry', (_message.Message,), {'DESCRIPTOR': _STREAMRESPONSE_ENTRY, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'}), 'DESCRIPTOR': _STREAMRESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(StreamResponse)
_sym_db.RegisterMessage(StreamResponse.Entry)
OpenRequest = _reflection.GeneratedProtocolMessageType('OpenRequest', (_message.Message,), {'DESCRIPTOR': _OPENREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(OpenRequest)
OpenResponse = _reflection.GeneratedProtocolMessageType('OpenResponse', (_message.Message,), {'DESCRIPTOR': _OPENRESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(OpenResponse)
CloseRequest = _reflection.GeneratedProtocolMessageType('CloseRequest', (_message.Message,), {'DESCRIPTOR': _CLOSEREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(CloseRequest)
CloseResponse = _reflection.GeneratedProtocolMessageType('CloseResponse', (_message.Message,), {'DESCRIPTOR': _CLOSERESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(CloseResponse)
ResetRequest = _reflection.GeneratedProtocolMessageType('ResetRequest', (_message.Message,), {'DESCRIPTOR': _RESETREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(ResetRequest)
ResetResponse = _reflection.GeneratedProtocolMessageType('ResetResponse', (_message.Message,), {'DESCRIPTOR': _RESETRESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(ResetResponse)
QuerySystemInfoRequest = _reflection.GeneratedProtocolMessageType('QuerySystemInfoRequest', (_message.Message,), {'DESCRIPTOR': _QUERYSYSTEMINFOREQUEST, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(QuerySystemInfoRequest)
QuerySystemInfoResponse = _reflection.GeneratedProtocolMessageType('QuerySystemInfoResponse', (_message.Message,), {'DESCRIPTOR': _QUERYSYSTEMINFORESPONSE, '__module__': 'tensorflow.compiler.xla.python.tpu_driver.tpu_service_pb2'})
_sym_db.RegisterMessage(QuerySystemInfoResponse)
DESCRIPTOR._options = None
_CLOUDTPUDRIVER = _descriptor.ServiceDescriptor(name='CloudTpuDriver', full_name='tpu_driver.CloudTpuDriver', file=DESCRIPTOR, index=0, serialized_options=None, create_key=_descriptor._internal_create_key, serialized_start=2551, serialized_end=2918, methods=[_descriptor.MethodDescriptor(name='Open', full_name='tpu_driver.CloudTpuDriver.Open', index=0, containing_service=None, input_type=_OPENREQUEST, output_type=_OPENRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key), _descriptor.MethodDescriptor(name='Close', full_name='tpu_driver.CloudTpuDriver.Close', index=1, containing_service=None, input_type=_CLOSEREQUEST, output_type=_CLOSERESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key), _descriptor.MethodDescriptor(name='Reset', full_name='tpu_driver.CloudTpuDriver.Reset', index=2, containing_service=None, input_type=_RESETREQUEST, output_type=_RESETRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key), _descriptor.MethodDescriptor(name='QuerySystemInfo', full_name='tpu_driver.CloudTpuDriver.QuerySystemInfo', index=3, containing_service=None, input_type=_QUERYSYSTEMINFOREQUEST, output_type=_QUERYSYSTEMINFORESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key), _descriptor.MethodDescriptor(name='StreamExecute', full_name='tpu_driver.CloudTpuDriver.StreamExecute', index=4, containing_service=None, input_type=_STREAMREQUEST, output_type=_STREAMRESPONSE, serialized_options=None, create_key=_descriptor._internal_create_key)])
_sym_db.RegisterServiceDescriptor(_CLOUDTPUDRIVER)
DESCRIPTOR.services_by_name['CloudTpuDriver'] = _CLOUDTPUDRIVER
| 305.205882 | 5,542 | 0.840705 |
2f7f72c88637ad36636f3a9fc987346a80a0a6f7 | 285 | swift | Swift | Unified/Interfaces/Threading/Executor.swift | melsomino/unified-ios | 6b322a99e69817e1c70b3e3bd62a8e942d18c977 | [
"MIT"
] | null | null | null | Unified/Interfaces/Threading/Executor.swift | melsomino/unified-ios | 6b322a99e69817e1c70b3e3bd62a8e942d18c977 | [
"MIT"
] | null | null | null | Unified/Interfaces/Threading/Executor.swift | melsomino/unified-ios | 6b322a99e69817e1c70b3e3bd62a8e942d18c977 | [
"MIT"
] | null | null | null | //
// Created by Власов М.Ю. on 16.05.16.
//
import Foundation
public class Test {
// static func test(threading: DefaultThreading) {
// let sequence = Sequence.inBackground(threading) {
// (execution, value: String) in
// print(value)
// }
// sequence.start("step 1")
// }
} | 17.8125 | 53 | 0.649123 |
2598e4a33f1f3260c48308e9d944b9c2af96f01f | 5,573 | dart | Dart | lib/src/features/quran/bloc/quran_theme/quran_theme_bloc.dart | muhammadtalhasultan/sirat_e_mustaqeem | d1df80e53dcc4e4e4e1aebd5797ae4085d55b53b | [
"MIT"
] | 96 | 2021-09-22T04:37:13.000Z | 2022-03-29T02:57:54.000Z | lib/src/features/quran/bloc/quran_theme/quran_theme_bloc.dart | muhammadtalhasultan/sirat_e_mustaqeem | d1df80e53dcc4e4e4e1aebd5797ae4085d55b53b | [
"MIT"
] | 1 | 2021-09-25T07:41:30.000Z | 2021-11-26T13:15:41.000Z | lib/src/features/quran/bloc/quran_theme/quran_theme_bloc.dart | muhammadtalhasultan/sirat_e_mustaqeem | d1df80e53dcc4e4e4e1aebd5797ae4085d55b53b | [
"MIT"
] | 31 | 2021-09-22T09:16:20.000Z | 2022-03-28T12:13:12.000Z | import 'dart:async';
import 'package:equatable/equatable.dart';
import 'package:hydrated_bloc/hydrated_bloc.dart';
part 'quran_theme_event.dart';
part 'quran_theme_state.dart';
class QuranThemeBloc extends HydratedBloc<QuranThemeEvent, QuranThemeState> {
QuranThemeBloc()
: super(
QuranThemeState(
showTranslation: true,
translationMode: 'Urdu',
withArabs: true,
quranFontSize: 24,
quranFontFamily: 'Uthman',
translationFontSize: 16,
translationFontFamily: 'Jameel',
),
);
@override
Stream<QuranThemeState> mapEventToState(
QuranThemeEvent event,
) async* {
if (event is ShowTranslation) {
yield QuranThemeState(
showTranslation: event.show,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize,
translationFontFamily: state.translationFontFamily,
);
}
if (event is SwitchTranslationMode) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: event.mode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize,
translationFontFamily: state.translationFontFamily,
);
}
if (event is ShowWithArab) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: event.show,
quranFontSize: state.quranFontSize,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize,
translationFontFamily: state.translationFontFamily,
);
}
if (event is AddQuranFontSize) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize + 1,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize,
translationFontFamily: state.translationFontFamily,
);
}
if (event is ReduceQuranFontSize) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize - 1,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize,
translationFontFamily: state.translationFontFamily,
);
}
if (event is SetQuranFontFamily) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize,
quranFontFamily: event.family,
translationFontSize: state.translationFontSize,
translationFontFamily: state.translationFontFamily,
);
}
if (event is AddTranslationFontSize) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize + 1,
translationFontFamily: state.translationFontFamily,
);
}
if (event is ReduceTranslationFontSize) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize - 1,
translationFontFamily: state.translationFontFamily,
);
}
if (event is SetTranslationFontFamily) {
yield QuranThemeState(
showTranslation: state.showTranslation,
translationMode: state.translationMode,
withArabs: state.withArabs,
quranFontSize: state.quranFontSize,
quranFontFamily: state.quranFontFamily,
translationFontSize: state.translationFontSize,
translationFontFamily: event.family,
);
}
}
@override
QuranThemeState? fromJson(Map<String, dynamic> json) {
try {
return QuranThemeState(
showTranslation: json['showTranslation'] as bool,
translationMode: json['translationMode'].toString(),
withArabs: json['withArabs'] as bool,
quranFontSize: json['quranFontSize'] as double,
quranFontFamily: json['quranFontFamily'].toString(),
translationFontSize: json['translationFontSize'] as double,
translationFontFamily: json['translationFontFamily'].toString(),
);
} catch (e) {
return null;
}
}
@override
Map<String, dynamic>? toJson(QuranThemeState state) {
try {
return {
'showTranslation': state.showTranslation,
'translationMode': state.translationMode,
'withArabs': state.withArabs,
'quranFontSize': state.quranFontSize,
'quranFontFamily': state.quranFontFamily,
'translationFontSize': state.translationFontSize,
'translationFontFamily': state.translationFontFamily,
};
} catch (e) {
return null;
}
}
}
| 34.401235 | 77 | 0.679167 |
60d19cc4833b1b866dda570a5a9c887d87d44ea3 | 295 | sql | SQL | classes/2013.09.20/etim.sql | alessandrojean/TBD-2013 | e916f1aa37a9994062daa15c5c258dd211e7dc72 | [
"Apache-2.0"
] | null | null | null | classes/2013.09.20/etim.sql | alessandrojean/TBD-2013 | e916f1aa37a9994062daa15c5c258dd211e7dc72 | [
"Apache-2.0"
] | null | null | null | classes/2013.09.20/etim.sql | alessandrojean/TBD-2013 | e916f1aa37a9994062daa15c5c258dd211e7dc72 | [
"Apache-2.0"
] | null | null | null | use master /*Para acessar a base de dados "master"*/
create database etim /*Cria uma nova base de dados*/
go /*Para executar*/
use etim /*Para acessar a base de dados "etim"*/
create table aluno( /*Cria uma nova tabela*/
nome varchar(50),
rm int,
idade int,
data_nascimento date
)
| 22.692308 | 53 | 0.691525 |
134e927643d62bf2383794fac00dec5ed417021b | 41,592 | c | C | libsrc/etree.c | baagaard-usgs/euclid-etree | 85c3f2fa6cd6a410496183abd03ff17d7dc996b8 | [
"BSD-3-Clause"
] | null | null | null | libsrc/etree.c | baagaard-usgs/euclid-etree | 85c3f2fa6cd6a410496183abd03ff17d7dc996b8 | [
"BSD-3-Clause"
] | 2 | 2022-01-06T04:47:45.000Z | 2022-01-06T16:07:24.000Z | libsrc/etree.c | baagaard-usgs/euclid-etree | 85c3f2fa6cd6a410496183abd03ff17d7dc996b8 | [
"BSD-3-Clause"
] | null | null | null | /**
* etree.c - A library for manipulating large octrees on disk
*
* Copyright (c) 2003, Tiankai Tu and David R. O'Hallaron.
* All rights reserved. May not be used, modified, or copied
* without permission.
*
* Contact:
* Tiankai Tu
* Computer Science Department
* Carnegie Mellon University
* 5000 Forbes Avenue
* Pittsburgh, PA 15213
* email: tutk@cs.cmu.edu
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <math.h>
#include <assert.h>
#include <errno.h>
#include "etree.h"
#include "buffer.h"
#include "code.h"
#ifndef ROOTPAGE
#define ROOTPAGE 1
#endif /* ROOTPAGE */
#ifndef DEFAULTBUFSIZE
#define DEFAULTBUFSIZE 20
#endif
#ifndef PATH_MAX
#define PATH_MAX 2048
#endif
const static
int HEADERSIZE = 1 + 4 * 4 + 2 * sizeof(BIGINT) * (ETREE_MAXLEVEL + 1);
const static char msg_NOERROR[] = "No error occurs";
const static char msg_UNKNOWN[] = "Unknown error code";
const static char msg_LEVEL_OOB[] = "Octant level out of bounds";
const static char msg_LEVEL_OOB2[] = "Returned octant level out of bounds";
const static char msg_LEVEL_CHILD_OOB[] = "Child octant level out of bounds";
const static char msg_OP_CONFLICT[] = "Operation conflicts with ongoing append or cursor";
const static char msg_EMPTY_TREE[] = "The etree is empty";
const static char msg_DUPLICATE[] = "Octant already exists in the etree";
const static char msg_NOT_FOUND[] = "Can't find the octant";
const static char msg_NO_MEMORY[] = "Out of memory";
const static char msg_NOT_LEAF_SPROUT[] = "Sprouting point is not a leaf";
const static char msg_NO_ANCHOR[] = "Cannot find sprouting octant in etree";
const static char msg_NO_CURSOR[] = "No cursor in effect";
const static char msg_NOT_APPENDING[] = "Etree not in appending mode";
const static char msg_ILLEGAL_FILL[] = "Invalid fill ratio";
const static char msg_APPEND_OOO[] = "Attempted to append an octant out of order";
const static char msg_END_OF_TREE[] = "Already at the end of the tree";
const static char msg_NOT_NEWTREE[] = "Etree not opened with O_CREAT|O_TRUNC";
const static char msg_NOT_3D[] = "Sprouting not supported for 4D etrees";
const static char msg_CREATE_FAILURE[] = "Unable to create boundary etree";
/* const static char msg_OCTREE_FAILURE[] = "Unable to rebuild incore octree image"; */
const static char msg_BOUNDARY_ERROR[] = "Unable to record boundary octants";
const static char msg_INVALID_NEIGHBOR[] = "Searching for corner neighbor not supported";
const static char msg_IO_ERROR[] = "Low level IO error";
const static char msg_NOT_WRITABLE[] = "Etree is not opened as writable";
const static char msg_APPMETA_ERROR[] = "Unable to access application-specific meta data";
const static char msg_NO_SCHEMA[] = "No schema defined but request a particular filed";
const static char msg_NO_FIELD[] = "The reuqested field is not defined in the schema registered";
const static char msg_DISALLOW_SCHEMA[] = "A schema must be registered after an etree is newly created or truncated and before any insertion/appending operation";
const static char msg_CREATE_SCHEMA[] = "Attempt to register a schema failed";
/* const static char msg_CONTAIN_INTERIOR[] = "Contain interior nodes"; */
const static char msg_TOO_BIG[] = "Domain larger than the etree address space";
const static char msg_NOT_ALIGNED[] = "Left-lower corner not aligned";
/* Statistics routine */
static void updatestat(etree_t * ep, etree_addr_t addr, int mode);
int writemeta(etree_t *ep, off_t endoffset);
static int writeheader(etree_t *ep);
static int readheader(etree_t *ep);
static int storeappmeta(etree_t *ep, off_t endoffset);
static int loadappmeta(etree_t *ep);
/*
* etree_straddr - Format a string representation of an octant address
*/
char *etree_straddr(etree_t *ep, char *buf, etree_addr_t addr)
{
if (ep->dimensions == 3) { /* 3d case */
sprintf(buf, "(%u %u %u %d)%c",
addr.x, addr.y, addr.z, addr.level,
addr.type == ETREE_INTERIOR ? 'I' : 'L');
}
else { /* 4d case */
sprintf(buf, "[%u %u %u %u %d]%c",
addr.x, addr.y, addr.z, addr.t, addr.level,
addr.type == ETREE_INTERIOR ? 'I' : 'L');
}
return buf;
}
/*
* etree_errno - Return the result error of the last operation
*
*/
etree_error_t etree_errno(etree_t *ep)
{
return ep->error;
}
/*
* etree_strerror - Return a string describing the error of the latest
* operation
*
*/
const char * etree_strerror(etree_error_t error)
{
switch (error) {
case(ET_NOERROR):
return msg_NOERROR;
case(ET_LEVEL_OOB):
return msg_LEVEL_OOB;
case(ET_LEVEL_OOB2):
return msg_LEVEL_OOB2;
case(ET_LEVEL_CHILD_OOB):
return msg_LEVEL_CHILD_OOB;
case(ET_OP_CONFLICT):
return msg_OP_CONFLICT;
case(ET_DUPLICATE):
return msg_DUPLICATE;
case(ET_NOT_FOUND):
return msg_NOT_FOUND;
case(ET_NO_MEMORY):
return msg_NO_MEMORY;
case(ET_NOT_LEAF_SPROUT):
return msg_NOT_LEAF_SPROUT;
case(ET_EMPTY_TREE):
return msg_EMPTY_TREE;
case(ET_NO_ANCHOR):
return msg_NO_ANCHOR;
case(ET_NO_CURSOR):
return msg_NO_CURSOR;
case(ET_NOT_APPENDING):
return msg_NOT_APPENDING;
case(ET_ILLEGAL_FILL):
return msg_ILLEGAL_FILL;
case(ET_APPEND_OOO):
return msg_APPEND_OOO;
case(ET_END_OF_TREE):
return msg_END_OF_TREE;
case(ET_NOT_NEWTREE):
return msg_NOT_NEWTREE;
case(ET_NOT_3D):
return msg_NOT_3D;
case(ET_CREATE_FAILURE):
return msg_CREATE_FAILURE;
case(ET_BOUNDARY_ERROR):
return msg_BOUNDARY_ERROR;
case(ET_INVALID_NEIGHBOR):
return msg_INVALID_NEIGHBOR;
case(ET_IO_ERROR):
return msg_IO_ERROR;
case(ET_NOT_WRITABLE):
return msg_NOT_WRITABLE;
case(ET_APPMETA_ERROR):
return msg_APPMETA_ERROR;
case(ET_NO_SCHEMA):
return msg_NO_SCHEMA;
case(ET_NO_FIELD):
return msg_NO_FIELD;
case(ET_CREATE_SCHEMA):
return msg_CREATE_SCHEMA;
case(ET_DISALLOW_SCHEMA):
return msg_DISALLOW_SCHEMA;
case(ET_TOO_BIG) :
return msg_TOO_BIG;
case (ET_NOT_ALIGNED):
return msg_NOT_ALIGNED;
default:
return msg_UNKNOWN;
}
}
/*
* etree_open - Open or create an etree for operation
*
* - "flags" is one of O_RDONLY or O_RDWR. flags may also be bitwise-or'd
* with O_CREAT or O_TRUNC. The semantics is the same as that in UNIX
* - "bufsize" is the internal buffer space being allocated, specified in
* terms of megabytes.
* - Allocate and initialize control structure for manipulating the etree.
* - Create and initialize I/O buffer
* - Return pointer to etree_t if OK, NULL on error. Applications should
* invoke perror() to check the details for the error.
*
*/
etree_t *etree_open(const char *pathname, int32_t flags, int32_t bufsize,
int32_t payloadsize, int32_t dimensions)
{
etree_t *ep;
int32_t level;
struct stat buf;
int existed;
uint32_t pagesize;
const char *fullpathname;
char pathbuf[PATH_MAX * 2];
/* check the existence of the pathname */
if (stat(pathname, &buf) == 0)
existed = 1;
else{
existed = 0;
/* errno is freshly set by stat() */
if (errno != ENOENT)
return NULL;
}
if (((flags & O_CREAT) == 0) && !existed) {
/* O_CREAT is not specified but the file does not exist */
fprintf(stderr, "etree_open: O_CREAT must be specified to open ");
fprintf(stderr, "a non-existent etree\n");
return NULL;
}
if (flags & O_TRUNC) {
if (!((flags & O_WRONLY) || (flags & O_RDWR))) {
fprintf(stderr, "etree_open: O_TRUNC must be specified with ");
fprintf(stderr, "the open mode that allows writing (i.e., is ");
fprintf(stderr, "O_WRONLY or O_RDWR\n");
return NULL;
}
}
/* allocate the control structure */
if ((ep = (etree_t *)malloc(sizeof(etree_t))) == NULL) {
/* perror("etree_open: malloc etree_t structure");*/
return NULL;
}
memset(ep, 0, sizeof(etree_t));
/* record the full path name of the etree */
if (*pathname == '/')
fullpathname = pathname;
else {
int length;
char *charptr;
if (getcwd(pathbuf, PATH_MAX) == NULL) {
/* perror("etree_open:getcwd"); */
return NULL;
}
length = strlen(pathbuf);
charptr = pathbuf + length;
*(charptr) = '/';
if (strlen(pathname) > PATH_MAX ) {
fprintf(stderr, "etree_open: pathname too long\n");
return NULL;
}
charptr++;
strcpy(charptr, pathname);
fullpathname = pathbuf;
}
/* absolute path to the tree name, strdup it */
if ((ep->pathname = strdup(fullpathname)) == NULL) {
/* perror("etree_open: strdup"); */
return NULL;
}
ep->flags = flags;
if (((flags & O_TRUNC) != 0) ||
(((flags & O_CREAT) != 0) && (!existed))) {
/*
Either O_TRUNC is specified or create a brand new file
initialize the Etree meta data
*/
ep->endian = xplatform_testendian();
ep->version = ETREE_VERSION;
if ((dimensions < 1) || (dimensions > 4)) {
fprintf(stderr, "etree_open: invalid dimension parameter.\n");
fprintf(stderr, "etree_open: the dimension should be either 1, 2");
fprintf(stderr, ", 3, or 4.\n");
return NULL;
}
ep->dimensions = dimensions;
ep->rootlevel = 0; /* default value */
for (level = 0; level <= ETREE_MAXLEVEL; level++)
ep->leafcount[level] = ep->indexcount[level] = 0;
ep->appmetasize = 0; /* default: no app meta defined */
ep->appmetadata = NULL;
}
else {
/* open an existing etree */
if (readheader(ep) != 0) {
fprintf(stderr, "etree_open: corrupted meta data.\n");
return NULL;
}
}
/* init dynamic control fields */
ep->keysize = ep->dimensions * sizeof(etree_tick_t) + 1;
if (((ep->key = malloc(ep->keysize)) == NULL) ||
((ep->hitkey = malloc(ep->keysize)) == NULL)) {
/* perror("etree_open: malloc temp key"); */
return NULL;
}
/* init the pagesize of the underlying Btree if it's new/truncated*/
pagesize = getpagesize();
bufsize = (bufsize <= 0) ? DEFAULTBUFSIZE : bufsize;
ep->bp = btree_open(fullpathname, flags, ep->keysize, "byte string",
payloadsize, pagesize, bufsize, code_comparekey,
HEADERSIZE);
if (ep->bp == NULL) {
/* perror("etree_open"); */
fprintf(stderr, "etree_open: Fail to open B-tree\n");
return NULL;
}
/* store the application meta data in memory if one is defined; the
Btree might grow into the appmeta data region */
if (ep->appmetasize > 0) {
if (loadappmeta(ep) != 0) {
fprintf(stderr, "etree_open: Fail to load appl. meta data.\n");
return NULL;
}
}
ep->error = ET_NOERROR;
ep->searchcount = ep->insertcount = 0;
ep->appendcount = ep->sproutcount = ep->deletecount = 0;
ep->cursorcount = 0;
return ep;
}
/*
* etree_registerschema - register schema with the underlying Btree
*
* - ERROR:
* ET_DISALLOW_SCHEMA
* ET_CREATE_SCHEMA
*/
int etree_registerschema(etree_t *ep, const char *defstring)
{
int res;
res = btree_registerschema(ep->bp, defstring);
switch (res){
case(-11) :
ep->error = ET_DISALLOW_SCHEMA;
return -1;
case(-12) :
case(-15) :
ep->error = ET_CREATE_SCHEMA;
return -1;
default:
return 0;
}
}
/*
* etree_getschema - return the original ASCII schema definition string
*
*/
char* etree_getschema(etree_t *ep)
{
return btree_getschema(ep->bp);
}
/*
* etree_close - close the etree handle
*
* - this is a more destructive function than others
* - release resource no matter what error may occur
* - write metadata if the etree was opened for write
* - return 0 if OK, -1 on error; application programs should
* invoke perror() to identify the problem reported by the
* underlying system
*
*/
int etree_close(etree_t *ep)
{
off_t endoffset;
free(ep->key);
free(ep->hitkey);
/* record the end of the etree */
endoffset = btree_getendoffset(ep->bp);
/* done with the underlying btree */
if (btree_close(ep->bp) != 0)
return -1;
if (((ep->flags & O_INCORE) == 0) &&
((ep->flags & O_RDWR) || (ep->flags & O_WRONLY)))
if (writemeta(ep, endoffset) != 0)
return -1;
free(ep->pathname); /*strdup'ed */
if (ep->appmetadata != NULL)
free(ep->appmetadata);
free(ep);
return 0;
}
/*
* etree_insert - Insert an octant into etree
*
* - Convert the octant address to the locational key
* - Insert the octant into the underlying B-tree
* - Ignore duplicate and set the errno
* - "duplicate" refers to
* an octant cannot be inserted twice
* an octant cannot be inserted as both ETREE_LEAF and ETREE_INTERIOR
* - Return 0 if inserted, -1 otherwise;
* - ERROR:
*
* ET_LEVEL_OOB
* ET_OP_CONFLICT
* ET_DUPLICATE
* ET_IO_ERROR
* ET_NOT_WRITABLE
*
*/
int etree_insert(etree_t *ep, etree_addr_t addr, const void *payload)
{
int insed, res;
if (((ep->flags & O_RDWR) == 0) &&
((ep->flags & O_WRONLY) == 0)) {
ep->error = ET_NOT_WRITABLE;
return -1;
}
if (code_addr2key(ep, addr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
res = btree_insert(ep->bp, ep->key, payload, &insed);
if (res != 0) {
switch (res) {
case(-1) : ep->error = ET_OP_CONFLICT; break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
if (insed == 0) {
ep->error = ET_DUPLICATE;
return -1;
}
updatestat(ep, addr, 1);
ep->error = ET_NOERROR;
ep->insertcount++;
return 0;
}
/*
* etree_search - Search an octant in the etree database
*
* - The search octant address "addr" does not need to specify the "type"
* - Convert the search address to the locational key
* - Search the key in the B-tree
* - Convert the hit locational key back to hit octant address, which now
* contains the hit octant's type info
* - Return 0 if found, -1 if not found;
* - "found" is defined as
* 1) an octant with the exact same address is located
* 2) an octant (at a higher octree level) that encloses the extent
* of the search octant is located; in this case, we call it
* ancestor hit.
* - ERROR:
*
* ET_LEVEL_OOB
* ET_LEVEL_OOB2
* ET_EMPTY_TREE
* ET_NOT_FOUND
* ET_IO_ERROR
* ET_NO_SCHEMA
* ET_NO_FIELD
*
*/
int etree_search(etree_t *ep, etree_addr_t addr, etree_addr_t *hitaddr,
const char *fieldname, void *payload)
{
etree_addr_t probeaddr, leafaddr;
int res;
ep->searchcount++;
leafaddr = addr;
leafaddr.type = ETREE_LEAF;
if (code_addr2key(ep, leafaddr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
res = btree_search(ep->bp, ep->key, ep->hitkey, fieldname, payload);
if (res != 0) {
switch (res) {
case(-2) : ep->error = ET_EMPTY_TREE; break;
case(-3) : ep->error = ET_NOT_FOUND; break;
case(-9) : ep->error = ET_IO_ERROR; break;
case(-13) : ep->error = ET_NO_SCHEMA; break;
case(-14) : ep->error = ET_NO_FIELD; break;
}
return -1;
}
if (ep->dimensions == 3) {
if (!code_isancestorkey(ep->hitkey, ep->key)) {
ep->error = ET_NOT_FOUND;
return -1;
}
} else {
if (memcmp(ep->hitkey, ep->key, ep->keysize) != 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
}
if (code_key2addr(ep, ep->hitkey, &probeaddr) != 0) {
ep->error = ET_LEVEL_OOB2;
return -1;
}
if (hitaddr != NULL)
*hitaddr = probeaddr;
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_findneighbor - Search for a neighbor in the etree database
*
* - Valid only for 3D
* - Derive the neighbor at dir direction of current code
* ( we are not interested in corner neighbors )
* - The neighbor may be out of the etree address space. In this case,
* return not found as result
* - Search the etree for the octant
* - Return 0 if found, -1 if failed;
* - ERROR:
*
* ET_NOT_3D
* ET_INVALID_NEIGHBOR
* ET_LEVEL_OOB
* ET_LEVEL_OOB2
* ET_EMPTY_TREE
* ET_NOT_FOUND
* ET_IO_ERROR
* ET_NO_SCHEMA
* ET_NO_FIELD
*
*/
int etree_findneighbor(etree_t *ep, etree_addr_t addr, etree_dir_t dir,
etree_addr_t *nbaddr, const char *fieldname,
void *payload)
{
etree_addr_t probeaddr;
etree_tick_t size;
if (ep->dimensions != 3) {
ep->error = ET_NOT_3D;
return -1;
}
if (addr.level > ETREE_MAXLEVEL) {
ep->error = ET_LEVEL_OOB;
return -1;
}
size = (etree_tick_t)1 << (ETREE_MAXLEVEL - addr.level);
probeaddr = addr;
probeaddr.level = ETREE_MAXLEVEL;
switch (dir){
case(d_L) :
if (probeaddr.x == 0) {
/* out of the domain */
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.x--;
break;
case(d_R) :
probeaddr.x += size;
break;
case(d_D) :
if (probeaddr.y == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.y--;
break;
case(d_U) :
probeaddr.y += size;
break;
case(d_B) :
if (probeaddr.z == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.z--;
break;
case(d_F) :
probeaddr.z += size;
break;
case(d_LB):
if ((probeaddr.x == 0) || (probeaddr.z == 0)) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.x--;
probeaddr.z--;
break;
case(d_UB) :
if (probeaddr.z == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.y += size;
probeaddr.z--;
break;
case(d_RB) :
if (probeaddr.z == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.x += size;
probeaddr.z--;
break;
case(d_DB) :
if ((probeaddr.y == 0) || (probeaddr.z == 0)) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.y--;
probeaddr.z--;
break;
case(d_LF) :
if (probeaddr.x == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.x--;
probeaddr.z += size;
break;
case(d_UF):
probeaddr.y += size;
probeaddr.z += size;
break;
case(d_RF):
probeaddr.x += size;
probeaddr.z += size;
break;
case(d_DF):
if (probeaddr.y == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.y--;
probeaddr.z += size;
break;
case(d_LD):
if ((probeaddr.x == 0) || (probeaddr.y == 0)) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.x--;
probeaddr.y--;
break;
case(d_LU):
if (probeaddr.x == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.x--;
probeaddr.y += size;
break;
case(d_RU):
probeaddr.x += size;
probeaddr.y += size;
break;
case(d_RD):
if (probeaddr.y == 0) {
ep->error = ET_NOT_FOUND;
return -1;
}
probeaddr.y--;
probeaddr.x += size;
break;
default:
ep->error = ET_INVALID_NEIGHBOR;
return -1;
}
return etree_search(ep, probeaddr, nbaddr, fieldname, payload);
}
/*
* etree_sprout - Sprout a leaf octant into eight children
*
* - Only valid for 3D
* - Check the sprouting addr is a leaf octant
* - Remove the sprouting addr from the etree;
* - Derive the children's address from the sprouting octant
* - The childpayload array is assumed to hold the payload for the eight
* children in Z-order
* - Return 0 if OK, -1 if failed;
* - ERRORS:
*
* ET_NOT_3D
* ET_NOT_LEAF_SPROUT
* ET_LEVEL_OOB
* ET_NO_MEMORY
* ET_LEVEL_CHILD_OOB
* ET_NO_ANCHOR
* ET_EMPTY_TREE
* ET_OP_CONFLICT
* ET_IO_ERROR
* ET_NOT_WRITABLE
*
*/
int etree_sprout(etree_t *ep, etree_addr_t addr, const void *childpayload[8])
{
int index, res;
void *keyset[8];
if (((ep->flags & O_RDWR) == 0) &&
((ep->flags & O_WRONLY) == 0)){
ep->error = ET_NOT_WRITABLE;
return -1;
}
if (ep->dimensions != 3) {
ep->error = ET_NOT_3D;
return -1;
}
if (addr.type != ETREE_LEAF) {
ep->error = ET_NOT_LEAF_SPROUT;
return -1;
}
if (code_addr2key(ep, addr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
for (index = 0; index < 8; index++) {
if ((keyset[index] = malloc(ep->keysize)) == NULL) {
ep->error = ET_NO_MEMORY;
return -1;
}
if (code_derivechildkey(ep->key, keyset[index], index) != 0) {
ep->error = ET_LEVEL_CHILD_OOB;
return -1;
}
}
res = btree_bulkupdate(ep->bp, ep->key, 8, (const void **)keyset,
childpayload);
for (index = 0; index < 8; index++)
free(keyset[index]);
if (res != 0) {
switch(res) {
case(-1): ep->error = ET_OP_CONFLICT; break;
case(-2): ep->error = ET_EMPTY_TREE; break;
case(-3): ep->error = ET_NO_ANCHOR; break;
case(-4): /* This should never happen */ break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
updatestat(ep, addr, 2);
ep->error = ET_NOERROR;
ep->sproutcount++;
return 0;
}
/*
* etree_delete - Delete an octant from the etree
*
* - Lazy method: NO merge of underflow B-tree nodes is done
* - Return 0 if successfully deleted, -1 otherwise
* - ERRORS:
*
* ET_LEVEL_OOB
* ET_OP_CONFLICT
* ET_EMPTY_TREE
* ET_NOT_FOUND
* ET_IO_ERROR
*
*/
int etree_delete(etree_t *ep, etree_addr_t addr)
{
int res;
if (((ep->flags & O_RDWR) == 0) &&
((ep->flags & O_WRONLY) == 0)) {
ep->error = ET_NOT_WRITABLE;
return -1;
}
if (code_addr2key(ep, addr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
res = btree_delete(ep->bp, ep->key);
if (res != 0) {
switch(res){
case(-1): ep->error = ET_OP_CONFLICT; break;
case(-2): ep->error = ET_EMPTY_TREE; break;
case(-3): ep->error = ET_NOT_FOUND; break;
}
return -1;
}
updatestat(ep, addr, -1);
ep->error = ET_NOERROR;
ep->deletecount++;
return 0;
}
/*
* etree_update - Modify the content/payload of an octant in the etree
*
* - Update the payload for the object with exact hit
* - Return 0 if updated, -1 otherwise
* - ERRORS:
*
* ET_LEVEL_OOB
* ET_EMPTY_TREE
* ET_NOT_FOUND
* ET_IO_ERROR
* ET_NOT_WRITABLE
*
*/
int etree_update(etree_t *ep, etree_addr_t addr, const void *payload)
{
int res;
if (((ep->flags & O_RDWR) == 0) &&
((ep->flags & O_WRONLY) == 0)) {
ep->error = ET_NOT_WRITABLE;
return -1;
}
if (code_addr2key(ep, addr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
res = btree_update(ep->bp, ep->key, payload);
if (res != 0) {
switch(res){
case(-2) : ep->error = ET_EMPTY_TREE; break;
case(-3) : ep->error = ET_NOT_FOUND; break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_initcursor - Set the cursor in the etree for preorder traversal
*
* - The preorder traversal starts from octant with addr
* - To start from the first octant in the etree, set the fields of addr
* to 0. That is addr.x = addr.y = addr.z = addr.level = 0
* - Return 0 if OK, -1 on error
* - ERRORS:
*
* ET_LEVEL_OOB
* ET_EMPTY_TREE
* ET_IO_ERROR
*
*/
int etree_initcursor(etree_t *ep, etree_addr_t addr)
{
int res;
if (code_addr2key(ep, addr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
res = btree_initcursor(ep->bp, ep->key);
if (res != 0) {
switch (res) {
case(-2) : ep->error = ET_EMPTY_TREE; break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_getcursor - Obtain the content of the octant currently pointed to
* by the cursor
*
* - retrieve the cursor from B-tree
* - convert the locational key properly
* - return 0 if OK, -1 otherwise
* - ERROR:
*
* ET_NO_CURSOR:
* ET_LEVEL_OOB2
* ET_NO_SCHEMA
* ET_NO_FIELD
*
*/
int etree_getcursor(etree_t *ep, etree_addr_t *addr, const char *fieldname,
void *payload)
{
int res;
res = btree_getcursor(ep->bp, ep->key, fieldname, payload);
if (res != 0) {
switch (res) {
case(-5) : ep->error = ET_NO_CURSOR; break;
case(-13) : ep->error = ET_NO_SCHEMA; break;
case(-14) : ep->error = ET_NO_FIELD; break;
}
return -1;
}
if (code_key2addr(ep, ep->key, addr) != 0) {
ep->error = ET_LEVEL_OOB2;
return -1;
}
ep->error = ET_NOERROR;
ep->cursorcount++;
return 0;
}
/*
* etree_advcursor - Move the cursor to the next octant in pre-order
*
* - wrapper function to call advcursor in the underlying B-tree
* - return 0 if OK, -1 otherwise
* - ERROR:
*
* ET_NO_CURSOR
* ET_END_OF_TREE
* ET_IO_ERROR
*
*/
int etree_advcursor(etree_t *ep)
{
int res;
res = btree_advcursor(ep->bp);
if (res != 0) {
switch(res){
case(-5) : ep->error = ET_NO_CURSOR; break;
case(1) : ep->error = ET_END_OF_TREE; break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_stopcursor - Stop the cursor operation
*
* - wrapper function
* - return 0 if OK, -1 otherwise
* - ERROR:
*
* ET_NO_CURSOR
*
*/
int etree_stopcursor(etree_t *ep)
{
if (btree_stopcursor(ep->bp) != 0) {
ep->error = ET_NO_CURSOR;
return -1;
}
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_beginappend - Start a transcation of appending octant in preorder
*
* - wrapper function
* - return 0 if OK, -1 otherwise
* - ERROR:
*
* ET_ILLEGAL_FILL
* ET_IO_ERROR
*
*/
int etree_beginappend(etree_t *ep, double fillratio)
{
int res;
res = btree_beginappend(ep->bp, fillratio);
if (res != 0) {
switch (res) {
case(-6) : ep->error = ET_ILLEGAL_FILL; break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_append - Append an octant to the end of the etree
*
* - wrapper function
* - return 0 if OK, -1 otherwise
* - ERROR:
*
* ET_LEVEL_OOB:
* ET_APPEND_OOO:
* ET_NOT_WRITABLE
* ET_IO_ERROR
*
*/
int etree_append(etree_t *ep, etree_addr_t addr, const void *payload)
{
int res;
if (((ep->flags & O_RDWR) == 0) &&
((ep->flags & O_WRONLY) == 0)) {
ep->error = ET_NOT_WRITABLE;
return -1;
}
if (code_addr2key(ep, addr, ep->key) != 0) {
ep->error = ET_LEVEL_OOB;
return -1;
}
res = btree_append(ep->bp, ep->key, payload);
if (res != 0) {
switch (res) {
case(-8) : ep->error = ET_APPEND_OOO; break;
case(-9) : ep->error = ET_IO_ERROR; break;
}
return -1;
}
updatestat(ep, addr, 1);
ep->error = ET_NOERROR;
ep->appendcount++;
return 0;
}
/*
* etree_endappend - Terminate the appending transaction
*
* - return 0 if OK, -1 on error
* - ERROR:
*
* ET_NOT_APPENDING:
*
*/
int etree_endappend(etree_t *ep)
{
if (btree_endappend(ep->bp) != 0) {
ep->error = ET_NOT_APPENDING;
return -1;
}
ep->error = ET_NOERROR;
return 0;
}
/*
* etree_getmaxleaflevel - Return the max leaf level in the etree
*
*/
int etree_getmaxleaflevel(etree_t *ep)
{
int level;
for (level = ETREE_MAXLEVEL; level >= 0; level--) {
if (ep->leafcount[level] != 0)
return level;
}
return -1;
}
/*
* etree_getminleaflevel - Return the min leaf level in the etree
*
*/
int etree_getminleaflevel(etree_t *ep)
{
int level;
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
if (ep->leafcount[level] != 0)
return level;
}
return -1;
}
/*
* etree_getavgleaflevel - Return the average leaf level in the etree
*
*/
float etree_getavgleaflevel(etree_t *ep)
{
double totallevels;
uint64_t totalcount;
int level;
totalcount = totallevels = 0;
for (level = 0; level <= ETREE_MAXLEVEL; level++ ) {
totallevels += level * ep->leafcount[level];
totalcount += ep->leafcount[level];
}
return (float)(totallevels / totalcount);
}
/**
* etree_gettotalcount
*
*/
uint64_t etree_gettotalcount(etree_t *ep)
{
int level;
uint64_t totalcount;
totalcount = 0;
for (level = 0; level <= ETREE_MAXLEVEL; level++ ) {
totalcount += ep->leafcount[level];
totalcount += ep->indexcount[level];
}
return totalcount;
}
/**
* etree_isempty
*
* return 1 if true, 0 if false
*/
int etree_isempty(etree_t *ep)
{
return btree_isempty(ep->bp);
}
/*
* etree_hasleafonly
*
*/
int etree_hasleafonly(etree_t *ep)
{
int level;
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
if (ep->indexcount[level] != 0)
return 0;
}
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
if (ep->leafcount[level] != 0)
return 1;
}
return 0; /* empty */
}
/*
* etree_getpayloadsize
*
*/
int etree_getpayloadsize(etree_t *ep)
{
return btree_getvaluesize(ep->bp);
}
/*
* etree_getkeysize
*
*/
int etree_getkeysize(etree_t *ep)
{
return ep->keysize;
}
/*
* etree_getappmeta - get the application meta data string
*
* return a pointer to (an allocated) meta data string if application meta
* data is defined, NULL if no application meta data is defined
*
*/
char *etree_getappmeta(etree_t *ep)
{
char *appmetadata;
if (ep->appmetasize == 0) {
ep->error = ET_APPMETA_ERROR;
return NULL;
}
else {
appmetadata = strdup(ep->appmetadata);
if (appmetadata == NULL) {
ep->error = ET_NO_MEMORY;
return NULL;
} else
return appmetadata;
}
}
/*
* etree_setappmeta - set the application meta data
*
* return 0 if OK, -1 on error
*
*/
int etree_setappmeta(etree_t *ep, const char *appmetadata)
{
if (((ep->flags & O_RDWR) == 0) &&
((ep->flags & O_WRONLY) == 0)) {
ep->error = ET_NOT_WRITABLE;
return -1;
}
if (ep->appmetadata != NULL) {
free(ep->appmetadata);
ep->appmetasize = 0;
}
ep->appmetadata = strdup(appmetadata);
if (ep->appmetadata == NULL) {
ep->error = ET_NO_MEMORY;
return -1;
} else {
/* application meta data successfully strdup'ed
+1 for the trailing NULL
*/
ep->appmetasize = strlen(appmetadata) + 1;
return 0;
}
}
/*-------------------
*
* Local routines
*
*-------------------
*/
/*
* updatestat - Update the etree statistics according the mode
*
* - Mode:
* 1: insert or append addr to the etree
* 2: sprout octant
* -1: delete octant
*
* - Assume addr has a valid level range, which should have been checked
* earlier
*
*/
void updatestat(etree_t * ep, etree_addr_t addr, int mode)
{
switch (mode) {
case(1) :
if (addr.type == 0)
ep->indexcount[addr.level]++;
else
ep->leafcount[addr.level]++;
break;
case(2) : /* Address type must be 1 (leaf ) */
ep->leafcount[addr.level]--;
ep->leafcount[addr.level + 1] += 8;
break;
case(-1):
if (addr.type == 0)
ep->indexcount[addr.level]--;
else
ep->leafcount[addr.level]--;
break;
default:
/* this should never occur */
break;
}
return;
}
/*
* writeheader - write the meta data to the etree header
*
* - return 0 if OK, -1 on error
*/
int writeheader(etree_t *ep)
{
int etreefd;
uint32_t version, dimensions, rootlevel, appmetasize;
BIGINT level;
BIGINT leafcount[ETREE_MAXLEVEL + 1];
BIGINT indexcount[ETREE_MAXLEVEL + 1];
/* convert the header data if byte swapping is necessary */
if (xplatform_testendian() != ep->endian) {
xplatform_swapbytes(&version, &ep->version, 4);
xplatform_swapbytes(&dimensions, &ep->dimensions, 4);
xplatform_swapbytes(&rootlevel, &ep->rootlevel, 4);
xplatform_swapbytes(&appmetasize, &ep->appmetasize, 4);
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
xplatform_swapbytes(&leafcount[level], &ep->leafcount[level],
sizeof(BIGINT));
xplatform_swapbytes(&indexcount[level], &ep->indexcount[level],
sizeof(BIGINT));
}
} else {
version = ep->version;
dimensions = ep->dimensions;
rootlevel = ep->rootlevel;
appmetasize = ep->appmetasize;
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
leafcount[level] = ep->leafcount[level];
indexcount[level] = ep->indexcount[level];
}
}
/* write meta data to the etree header */
etreefd = open(ep->pathname, O_WRONLY);
if (etreefd == -1) {
fprintf(stderr, "writeheader: open etree file\n");
return -1;
}
if ((write(etreefd, (ep->endian == little) ? "L" : "B", 1) != 1) ||
(write(etreefd, &version, 4) != 4) ||
(write(etreefd, &dimensions, 4) != 4) ||
(write(etreefd, &rootlevel, 4) != 4) ||
(write(etreefd, &appmetasize, 4) != 4)) {
fprintf(stderr, "writeheader: write\n");
return -1;
}
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
if (write(etreefd, &leafcount[level], sizeof(BIGINT))
!= sizeof(BIGINT)) {
fprintf(stderr, "writeheader: write\n");
return -1;
}
if (write(etreefd, &indexcount[level], sizeof(BIGINT))
!= sizeof(BIGINT)) {
fprintf(stderr, "writeheader: write\n");
return -1;
}
}
if (close(etreefd) != 0) {
fprintf(stderr, "writeheader: close\n");
return -1;
}
return 0;
}
/*
* readheader - read the etree header from the beginning of the etree file
*
* - return 0 if OK, -1 on error
*/
int readheader(etree_t *ep)
{
int etreefd;
char endianchar;
uint32_t version, dimensions, rootlevel, appmetasize;
BIGINT level;
BIGINT leafcount[ETREE_MAXLEVEL + 1];
BIGINT indexcount[ETREE_MAXLEVEL + 1];
etreefd = open(ep->pathname, O_RDONLY);
if (etreefd == -1) {
fprintf(stderr, "readheader: open etree file\n");
return -1;
}
if (read(etreefd, &endianchar, 1) != 1) {
fprintf(stderr,"readheader: read header (endian)\n");
return -1;
}
if (read(etreefd, &version, 4) != 4) {
fprintf(stderr,"readheader: read header (version)\n");
return -1;
}
if (read(etreefd, &dimensions, 4) != 4) {
fprintf(stderr,"readheader: read header (dimension)\n");
return -1;
}
if (read(etreefd, &rootlevel, 4) != 4) {
fprintf(stderr,"readheader: read header (rootlevel)\n");
return -1;
}
if (read(etreefd, &appmetasize, 4) != 4) {
fprintf(stderr,"readheader: read header (appmetasize)\n");
return -1;
}
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
if (read(etreefd, &leafcount[level], sizeof(BIGINT))
!= sizeof(BIGINT)) {
fprintf(stderr, "readheader: read header (leafcount[%d])", level);
return -1;
}
if (read(etreefd, &indexcount[level], sizeof(BIGINT))
!= sizeof(BIGINT)) {
fprintf(stderr, "readheader: read header (indexcount[%d])", level);
return -1;
}
}
/* load the data into runtime control structure */
if (endianchar == 'L')
ep->endian = little;
else if (endianchar == 'B')
ep->endian = big;
else {
fprintf(stderr, "readheader: corrupted meta(endian) : %c\n",
endianchar);
return -1;
}
if (xplatform_testendian() != ep->endian) {
xplatform_swapbytes(&ep->version, &version, 4);
xplatform_swapbytes(&ep->dimensions, &dimensions, 4);
xplatform_swapbytes(&ep->rootlevel, &rootlevel, 4);
xplatform_swapbytes(&ep->appmetasize, &appmetasize, 4);
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
xplatform_swapbytes(&ep->leafcount[level],&leafcount[level],
sizeof(BIGINT));
xplatform_swapbytes(&ep->indexcount[level],&indexcount[level],
sizeof(BIGINT));
}
} else {
ep->version = version;
ep->dimensions = dimensions;
ep->rootlevel = rootlevel;
ep->appmetasize = appmetasize;
for (level = 0; level <= ETREE_MAXLEVEL; level++) {
ep->leafcount[level] = leafcount[level];
ep->indexcount[level] = indexcount[level];
}
}
if (ep->version != ETREE_VERSION) {
fprintf(stderr, "readheader: incompatible library version\n");
return -1;
}
if (close(etreefd) != 0) {
fprintf(stderr, "readheader: close etree file\n");
return -1;
}
return 0;
}
/*
* writemeta - write the meta data to the etree header and trailer
* appropriately
*
* - return 0 if OK, -1 on error
*/
int writemeta(etree_t *ep, off_t endoffset)
{
if ((writeheader(ep) == 0) &&
(storeappmeta(ep, endoffset) == 0))
return 0;
else
return -1;
}
/*
* storeappmeta - store application meta data to etree trailer
*
* - return 0 if OK, -1 on error
*
*/
int storeappmeta(etree_t *ep, off_t endoffset)
{
int etreefd;
/* Note: use the host/platform variable */
if (ep->appmetasize == 0)
/* no application meta data defined */
return 0;
etreefd = open(ep->pathname, O_WRONLY);
if (etreefd == -1) {
fprintf(stderr, "storeappmeta: open etree file\n");
return -1;
}
if (lseek(etreefd, endoffset, SEEK_SET) != endoffset) {
fprintf(stderr, "storeappmeta: lseek\n");
return -1;
}
if (write(etreefd, ep->appmetadata, ep->appmetasize) !=
ep->appmetasize) {
fprintf(stderr, "storeappmeta: write\n");
return -1;
}
if (close(etreefd) != 0) {
fprintf(stderr, "storeappmeta: close\n");
return -1;
}
return 0;
}
/*
* loadappmeta - load application meta data from etree into memory
*
* - return 0 if OK, -1 on error
*
*/
int loadappmeta(etree_t *ep)
{
int etreefd;
off_t endoffset;
ep->appmetadata = (char *)malloc(ep->appmetasize);
if (ep->appmetadata == NULL) {
fprintf(stderr, "loadappmeta: malloc ascii schema\n");
return -1;
}
etreefd = open(ep->pathname, O_RDONLY);
if (etreefd == -1) {
fprintf(stderr, "loadappmeta: open etree file\n");
return -1;
}
endoffset = btree_getendoffset(ep->bp);
if (lseek(etreefd, endoffset, SEEK_SET) != endoffset) {
fprintf(stderr, "loadappmeta: lseek etree file\n");
return -1;
}
if (read(etreefd, ep->appmetadata, ep->appmetasize) != ep->appmetasize) {
fprintf(stderr, "loadappmeta: read application meta data\n");
return -1;
}
if (close(etreefd) != 0) {
fprintf(stderr, "loadappmeta: close etree file\n");
return -1;
}
return 0;
}
| 23.848624 | 162 | 0.5716 |
9958249dd2f700d0a936ff379788d8e32b6bb2bd | 536 | h | C | Communication.h | Complete-Foods-are-Good-2nd/LittleBrotherRPi | e3ac7b1a8a10a6ce80742ba981f31ae569e8e575 | [
"MIT"
] | null | null | null | Communication.h | Complete-Foods-are-Good-2nd/LittleBrotherRPi | e3ac7b1a8a10a6ce80742ba981f31ae569e8e575 | [
"MIT"
] | 2 | 2021-02-03T10:38:09.000Z | 2021-02-09T12:46:37.000Z | Communication.h | Complete-Foods-are-Good-2nd/LittleBrotherRPi | e3ac7b1a8a10a6ce80742ba981f31ae569e8e575 | [
"MIT"
] | null | null | null | #include <dirent.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <iostream>
#include <set>
#include <string>
#include <vector>
class Communication {
private:
std::set<std::string> get_serial_device_names();
std::pair<std::string, std::string> generate_loopback_serial_devices();
public:
std::string serial_device_dir;
std::string momo_serial_device_name;
std::string my_serial_device_name;
Communication();
// ~Communication();
void start_stream();
};
| 21.44 | 75 | 0.701493 |
c0b253afcb72dd52102d97668d78850eac09b8d1 | 2,098 | swift | Swift | ios/CallOfBeacons/CallOfBeacons/COBGridView.swift | sjchmiela/call-of-beacons | 8dca3f1fbb58f9cbcefb473ae013a4b5dc01182e | [
"MIT"
] | null | null | null | ios/CallOfBeacons/CallOfBeacons/COBGridView.swift | sjchmiela/call-of-beacons | 8dca3f1fbb58f9cbcefb473ae013a4b5dc01182e | [
"MIT"
] | null | null | null | ios/CallOfBeacons/CallOfBeacons/COBGridView.swift | sjchmiela/call-of-beacons | 8dca3f1fbb58f9cbcefb473ae013a4b5dc01182e | [
"MIT"
] | null | null | null | //
// COBGridView.swift
// CallOfBeacons
//
// Created by Stanisław Chmiela on 04.06.2016.
// Copyright © 2016 Stanisław Chmiela, Rafał Żelazko. All rights reserved.
//
import UIKit
import QuartzCore
@IBDesignable
class COBGridView: UIView {
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
override func drawRect(rect: CGRect) {
let context = UIGraphicsGetCurrentContext()
(backgroundColor ?? UIColor.whiteColor()).setFill()
CGContextFillRect(context, rect)
for i in (1...Int(bounds.size.height / 10)).reverse() {
switch (i + 9) % 10 {
case 0:
UIColor(red:0.25, green:0.32, blue:0.36, alpha:1.00).set()
case 5:
UIColor(red:0.25, green:0.32, blue:0.36, alpha:0.50).set()
default:
UIColor(red:0.25, green:0.32, blue:0.36, alpha:0.25).set()
}
let path = UIBezierPath()
path.moveToPoint(CGPoint(x: 0, y: bounds.size.height - CGFloat(i) * 10 - 0.5))
path.addLineToPoint(CGPoint(x: bounds.size.width, y: bounds.size.height - CGFloat(i) * 10 - 0.5))
path.stroke()
}
let xCenter = bounds.size.width / 2
let xCenterIndex = Int(bounds.size.width / 2)
let xOffset = xCenter - CGFloat(xCenterIndex)
for i in 1...Int(bounds.size.width / 10) {
switch abs(i - (xCenterIndex / 10)) % 10 {
case 0:
UIColor(red:0.25, green:0.32, blue:0.36, alpha:1.00).set()
case 5:
UIColor(red:0.25, green:0.32, blue:0.36, alpha:0.50).set()
default:
UIColor(red:0.25, green:0.32, blue:0.36, alpha:0.15).set()
}
let path = UIBezierPath()
path.moveToPoint(CGPoint(x: CGFloat(i) * 10 + xOffset + 1, y: 0))
path.addLineToPoint(CGPoint(x: CGFloat(i) * 10 + xOffset + 1, y: bounds.size.height))
path.stroke()
}
}
}
| 36.807018 | 109 | 0.558627 |
e83d4934fe456eca14723df0f4640d7c4b698eaf | 2,897 | sql | SQL | schema/generate/43-schema_update_45.sql | SteveKola/augur | e50ca402f0c71c8404454df624e6ee9461805982 | [
"MIT"
] | null | null | null | schema/generate/43-schema_update_45.sql | SteveKola/augur | e50ca402f0c71c8404454df624e6ee9461805982 | [
"MIT"
] | null | null | null | schema/generate/43-schema_update_45.sql | SteveKola/augur | e50ca402f0c71c8404454df624e6ee9461805982 | [
"MIT"
] | null | null | null |
CREATE SEQUENCE IF NOT EXISTS "augur_operations"."worker_oauth_oauth_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 620000
CACHE 1;
COMMENT ON TABLE "augur_operations"."augur_settings" IS 'Augur settings include the schema version, and the Augur API Key as of 10/25/2020. Future augur settings may be stored in this table, which has the basic structure of a name-value pair. ';
COMMENT ON TABLE "augur_operations"."repos_fetch_log" IS 'For future use when we move all working tables to the augur_operations schema. ';
COMMENT ON TABLE "augur_operations"."worker_history" IS 'This table stores the complete history of job execution, including success and failure. It is useful for troubleshooting. ';
COMMENT ON TABLE "augur_operations"."worker_job" IS 'This table stores the jobs workers collect data for. A job is found in the code, and in the augur.config.json under the construct of a “model”. ';
ALTER TABLE "augur_operations"."worker_job" ALTER COLUMN "description" SET DEFAULT 'None'::character varying;
COMMENT ON TABLE "augur_operations"."worker_oauth" IS 'This table stores credentials for retrieving data from platform API’s. Entries in this table must comply with the terms of service for each platform. ';
ALTER TABLE "augur_operations"."worker_oauth" ALTER COLUMN "oauth_id" TYPE int8 USING "oauth_id"::int8;
ALTER TABLE "augur_operations"."worker_oauth" ALTER COLUMN "oauth_id" SET DEFAULT nextval('"augur_operations".worker_oauth_oauth_id_seq'::regclass);
ALTER TABLE "augur_operations"."worker_oauth" DROP CONSTRAINT "worker_oauth_pkey";
ALTER TABLE "augur_operations"."worker_oauth" ADD CONSTRAINT "worker_oauth_pkey" PRIMARY KEY ("oauth_id");
COMMENT ON TABLE "augur_operations"."worker_settings_facade" IS 'For future use when we move all working tables to the augur_operations schema. ';
COMMENT ON TABLE "augur_operations"."working_commits" IS 'For future use when we move all working tables to the augur_operations schema. ';
CREATE SEQUENCE IF NOT EXISTS "augur_operations"."affiliations_corp_id_seq"
INCREMENT 1
MINVALUE 1
MAXVALUE 9223372036854775807
START 620000
CACHE 1;
SELECT setval('"augur_operations"."affiliations_corp_id_seq"', 1, false);
ALTER SEQUENCE "augur_operations"."affiliations_corp_id_seq" OWNER TO "augur";
SELECT setval('"augur_operations"."gh_worker_history_history_id_seq"', 6300000, true);
SELECT setval('"augur_operations"."worker_oauth_oauth_id_seq"', 6300000, true);
ALTER SEQUENCE "augur_operations"."worker_oauth_oauth_id_seq" OWNER TO "augur";
CREATE INDEX CONCURRENTLY IF NOT EXISTS "repos_id,statusops" ON "augur_operations"."repos_fetch_log" USING btree (
"repos_id" "pg_catalog"."int4_ops" ASC NULLS LAST,
"status" COLLATE "pg_catalog"."default" "pg_catalog"."text_ops" ASC NULLS LAST
);
update "augur_operations"."augur_settings" set value = 45 where setting = 'augur_data_version';
| 45.984127 | 245 | 0.793925 |
2fa0ab90f1b67b8d2ae1c2d0a2f2ee2354044e3e | 134 | kt | Kotlin | simulator/src/main/kotlin/components/simulator/time.kt | jGleitz/transformationnetwork-simulator | d5d0bd7722abe3260bc204f128337c25c0fb340e | [
"MIT"
] | null | null | null | simulator/src/main/kotlin/components/simulator/time.kt | jGleitz/transformationnetwork-simulator | d5d0bd7722abe3260bc204f128337c25c0fb340e | [
"MIT"
] | 5 | 2020-04-18T01:26:22.000Z | 2021-08-30T09:23:58.000Z | simulator/src/main/kotlin/components/simulator/time.kt | jGleitz/transformationnetwork-simulator | d5d0bd7722abe3260bc204f128337c25c0fb340e | [
"MIT"
] | null | null | null | package de.joshuagleitze.transformationnetwork.simulator.components.simulator
import react.createContext
val time = createContext(0) | 26.8 | 77 | 0.865672 |
aa8d0ca0e4eaaacc2845b2ddc1921cceb95cae67 | 980 | asm | Assembly | programs/oeis/018/A018210.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | 1 | 2021-03-15T11:38:20.000Z | 2021-03-15T11:38:20.000Z | programs/oeis/018/A018210.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | programs/oeis/018/A018210.asm | jmorken/loda | 99c09d2641e858b074f6344a352d13bc55601571 | [
"Apache-2.0"
] | null | null | null | ; A018210: Alkane (or paraffin) numbers l(9,n).
; 1,4,16,44,110,236,472,868,1519,2520,4032,6216,9324,13608,19440,27192,37389,50556,67408,88660,115258,148148,188552,237692,297115,368368,453376,554064,672792,811920,974304,1162800,1380825,1631796
mov $18,$0
mov $20,$0
add $20,1
lpb $20
clr $0,18
mov $0,$18
sub $20,1
sub $0,$20
mov $15,$0
mov $17,$0
add $17,1
lpb $17
clr $0,15
mov $0,$15
sub $17,1
sub $0,$17
mov $12,$0
mov $14,$0
add $14,1
lpb $14
clr $0,12
mov $0,$12
sub $14,1
sub $0,$14
mov $9,$0
mov $11,$0
add $11,1
lpb $11
mov $0,$9
sub $11,1
sub $0,$11
mov $6,2
add $6,$0
add $0,5
mod $0,2
add $4,1
mul $6,$4
mov $7,$0
mov $0,$6
mul $0,$7
mov $1,$0
div $1,2
add $10,$1
lpe
add $13,$10
lpe
add $16,$13
lpe
add $19,$16
lpe
mov $1,$19
| 17.818182 | 195 | 0.482653 |
2f0ad63fc6baee023530cda48a37050e7d884155 | 13,760 | sql | SQL | sql/shopping_cart (1).sql | adarshm07/eshop | d2ac651314dfa6e9cc2b0124358735a0450e0e63 | [
"CC-BY-3.0",
"MIT"
] | null | null | null | sql/shopping_cart (1).sql | adarshm07/eshop | d2ac651314dfa6e9cc2b0124358735a0450e0e63 | [
"CC-BY-3.0",
"MIT"
] | null | null | null | sql/shopping_cart (1).sql | adarshm07/eshop | d2ac651314dfa6e9cc2b0124358735a0450e0e63 | [
"CC-BY-3.0",
"MIT"
] | null | null | null | -- phpMyAdmin SQL Dump
-- version 3.5.1
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Nov 22, 2018 at 12:31 PM
-- Server version: 5.5.24-log
-- PHP Version: 5.4.3
SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `shopping_cart`
--
-- --------------------------------------------------------
--
-- Table structure for table `cart`
--
CREATE TABLE IF NOT EXISTS `cart` (
`id` int(10) NOT NULL AUTO_INCREMENT,
`name` varchar(50) NOT NULL,
`price` varchar(10) NOT NULL,
`qty` int(10) NOT NULL,
`total` int(10) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=25 ;
--
-- Dumping data for table `cart`
--
INSERT INTO `cart` (`id`, `name`, `price`, `qty`, `total`) VALUES
(1, 'product1', '1500', 1, 1500),
(2, 'product1', '1500', 1, 1500),
(3, 'product1', '1500', 1, 1500),
(4, 'product1', '1500', 1, 1500),
(5, 'product1', '1500', 1, 1500),
(6, 'product1', '1500', 1, 1500),
(7, 'product1', '1500', 1, 1500),
(8, 'product1', '1500', 1, 1500),
(9, 'product1', '1500', 1, 1500),
(10, 'product1', '1500', 1, 1500),
(11, 'product1', '1500', 1, 1500),
(12, 'product1', '1500', 1, 1500),
(13, 'product1', '1500', 1, 1500),
(14, 'product1', '1500', 1, 1500),
(15, 'product1', '1500', 1, 1500),
(16, 'product1', '1500', 1, 1500),
(17, 'product1', '1500', 1, 1500),
(18, 'product1', '1500', 1, 1500),
(19, 'product1', '1500', 1, 1500),
(20, 'product1', '1500', 1, 1500),
(21, 'product1', '1500', 1, 1500),
(22, 'product1', '1500', 1, 1500),
(23, 'product1', '1500', 1, 1500),
(24, 'product1', '1500', 1, 1500);
-- --------------------------------------------------------
--
-- Table structure for table `shop_products`
--
CREATE TABLE IF NOT EXISTS `shop_products` (
`id` int(11) NOT NULL,
`product_name` varchar(60) NOT NULL,
`product_desc` text NOT NULL,
`product_code` varchar(60) NOT NULL,
`product_image` varchar(60) NOT NULL,
`product_price` int(11) NOT NULL,
`qty` int(10) NOT NULL
) ENGINE=InnoDB DEFAULT CHARSET=latin1;
--
-- Dumping data for table `shop_products`
--
INSERT INTO `shop_products` (`id`, `product_name`, `product_desc`, `product_code`, `product_image`, `product_price`, `qty`) VALUES
(1, 'product1', 'product 1', 'p1', 'g1.jpg', 1500, 19),
(2, 'Product 2', 'product 2', 'p2', 'g2.jpg', 1200, 10),
(0, 'Product5', 'product5', 'p5', 'about2.jpg', 1523, 30),
(0, 'Product5', 'product5', 'p5', 'about3.jpg', 1523, 20);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_cart`
--
CREATE TABLE IF NOT EXISTS `tbl_cart` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`product_id` int(11) NOT NULL,
`quantity` int(11) NOT NULL,
`member_id` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=17 ;
--
-- Dumping data for table `tbl_cart`
--
INSERT INTO `tbl_cart` (`id`, `product_id`, `quantity`, `member_id`) VALUES
(16, 1, 1, 2);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_order`
--
CREATE TABLE IF NOT EXISTS `tbl_order` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`customer_id` int(11) NOT NULL,
`amount` double NOT NULL,
`name` varchar(255) NOT NULL,
`address` varchar(255) NOT NULL,
`city` varchar(255) NOT NULL,
`state` varchar(255) NOT NULL,
`zip` varchar(255) NOT NULL,
`country` varchar(255) NOT NULL,
`payment_type` varchar(255) NOT NULL,
`order_status` varchar(255) NOT NULL,
`order_at` datetime NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=62 ;
--
-- Dumping data for table `tbl_order`
--
INSERT INTO `tbl_order` (`id`, `customer_id`, `amount`, `name`, `address`, `city`, `state`, `zip`, `country`, `payment_type`, `order_status`, `order_at`) VALUES
(5, 2, 3100, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 06:32:42'),
(6, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 08:57:18'),
(7, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:40:19'),
(8, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:41:13'),
(9, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:42:21'),
(10, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:42:45'),
(11, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:43:14'),
(12, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:44:22'),
(13, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:45:06'),
(14, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:45:53'),
(15, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:46:28'),
(16, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:46:44'),
(17, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:47:01'),
(18, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:47:22'),
(19, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:48:55'),
(20, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:50:18'),
(21, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:50:57'),
(22, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:54:52'),
(23, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:55:25'),
(24, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:55:47'),
(25, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:56:50'),
(26, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:57:13'),
(27, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:57:37'),
(28, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:58:29'),
(29, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 09:59:24'),
(30, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:00:15'),
(31, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:01:06'),
(32, 2, 1500, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:03:45'),
(33, 2, 1500, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:05:15'),
(34, 2, 1500, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:06:48'),
(35, 2, 1500, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:10:38'),
(36, 2, 1500, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:11:41'),
(37, 2, 1500, 'Soumya', 'jgjgj', ',n,', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-20 10:13:29'),
(38, 2, 1500, 'Soumya', 'knkcbkbjbjb', 'jbjbjb', 'jbjbn', '3646464', 'jbjvbjbv', 'PAYPAL', 'PENDING', '2018-11-22 10:00:15'),
(39, 2, 1500, 'Soumya', 'knkcbkbjbjb', 'jbjbjb', 'jbjbn', '3646464', 'jbjvbjbv', 'PAYPAL', 'PENDING', '2018-11-22 10:01:14'),
(40, 2, 1500, 'Soumya', 'knkcbkbjbjb', 'jbjbjb', 'jbjbn', '3646464', 'jbjvbjbv', 'PAYPAL', 'PENDING', '2018-11-22 10:02:03'),
(41, 2, 1500, 'marble', 'bcgcg', 'hvhvh', 'nvn', '5454', 'hvhv', 'PAYPAL', 'PENDING', '2018-11-22 10:06:05'),
(42, 2, 1500, 'Soumya', 'ms.,md', 'jbjbjb', 'm cs ', '2', '224', 'PAYPAL', 'PENDING', '2018-11-22 10:06:53'),
(43, 2, 1500, 'Soumya', 'ms.,md', 'jbjbjb', 'm cs ', '2', '224', 'PAYPAL', 'PENDING', '2018-11-22 10:08:11'),
(44, 2, 1500, 'marble', 'jbjvhjvhv', 'jbjbjb', 'jbjbn', '3646464', 'jbjvbjbv', 'PAYPAL', 'PENDING', '2018-11-22 10:09:59'),
(45, 2, 1500, 'marble', 'bcgcg', 'hvhvh', 'nvn', '5454', 'hvhv', 'PAYPAL', 'PENDING', '2018-11-22 10:10:14'),
(46, 2, 1500, 'bmba', 'nanbz ', 'nnzx', 'nabxnb', '5', '5', 'PAYPAL', 'PENDING', '2018-11-22 10:14:50'),
(47, 2, 1500, 'marble', 'jbjvhjvhv', 'jbjbjb', 'hvhv', '5454', 'hvhv', 'PAYPAL', 'PENDING', '2018-11-22 10:16:00'),
(48, 2, 1500, 'marble', 'jbjvhjvhv', 'jbjbjb', 'mnm', '1', '4', 'PAYPAL', 'PENDING', '2018-11-22 10:16:50'),
(49, 2, 1500, 'marble', 'jbjvhjvhv', 'jbjbjb', 'hvhv', '5454', 'hvhv', 'PAYPAL', 'PENDING', '2018-11-22 10:16:59'),
(50, 2, 1500, 'Soumya', 'jbjvhjvhv', ',n,', 'jbjbn', '3646464', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:19:51'),
(51, 2, 1500, 'Soumya', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:21:18'),
(52, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:24:02'),
(53, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:24:22'),
(54, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:24:55'),
(55, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:26:06'),
(56, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:26:55'),
(57, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:27:28'),
(58, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:28:22'),
(59, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:28:55'),
(60, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:30:23'),
(61, 2, 1500, 'marble', 'jgjgj', 'jbjbjb', 'mnm', '35656', 'mnmn', 'PAYPAL', 'PENDING', '2018-11-22 10:31:07');
-- --------------------------------------------------------
--
-- Table structure for table `tbl_order_item`
--
CREATE TABLE IF NOT EXISTS `tbl_order_item` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL,
`product_id` int(11) NOT NULL,
`item_price` double NOT NULL,
`quantity` int(11) NOT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=67 ;
--
-- Dumping data for table `tbl_order_item`
--
INSERT INTO `tbl_order_item` (`id`, `order_id`, `product_id`, `item_price`, `quantity`) VALUES
(9, 5, 1, 1500, 1),
(10, 5, 2, 800, 2),
(11, 6, 1, 1500, 1),
(12, 7, 1, 1500, 1),
(13, 8, 1, 1500, 1),
(14, 9, 1, 1500, 1),
(15, 10, 1, 1500, 1),
(16, 11, 1, 1500, 1),
(17, 12, 1, 1500, 1),
(18, 13, 1, 1500, 1),
(19, 14, 1, 1500, 1),
(20, 15, 1, 1500, 1),
(21, 16, 1, 1500, 1),
(22, 17, 1, 1500, 1),
(23, 18, 1, 1500, 1),
(24, 19, 1, 1500, 1),
(25, 20, 1, 1500, 1),
(26, 21, 1, 1500, 1),
(27, 22, 1, 1500, 1),
(28, 23, 1, 1500, 1),
(29, 24, 1, 1500, 1),
(30, 25, 1, 1500, 1),
(31, 26, 1, 1500, 1),
(32, 27, 1, 1500, 1),
(33, 28, 1, 1500, 1),
(34, 29, 1, 1500, 1),
(35, 30, 1, 1500, 1),
(36, 31, 1, 1500, 1),
(37, 32, 1, 1500, 1),
(38, 33, 1, 1500, 1),
(39, 34, 1, 1500, 1),
(40, 35, 1, 1500, 1),
(41, 36, 1, 1500, 1),
(42, 37, 1, 1500, 1),
(43, 38, 1, 1500, 1),
(44, 39, 1, 1500, 1),
(45, 40, 1, 1500, 1),
(46, 41, 1, 1500, 1),
(47, 42, 1, 1500, 1),
(48, 43, 1, 1500, 1),
(49, 44, 1, 1500, 1),
(50, 45, 1, 1500, 1),
(51, 46, 1, 1500, 1),
(52, 47, 1, 1500, 1),
(53, 48, 1, 1500, 1),
(54, 49, 1, 1500, 1),
(55, 50, 1, 1500, 1),
(56, 51, 1, 1500, 1),
(57, 52, 1, 1500, 1),
(58, 53, 1, 1500, 1),
(59, 54, 1, 1500, 1),
(60, 55, 1, 1500, 1),
(61, 56, 1, 1500, 1),
(62, 57, 1, 1500, 1),
(63, 58, 1, 1500, 1),
(64, 59, 1, 1500, 1),
(65, 60, 1, 1500, 1),
(66, 61, 1, 1500, 1);
-- --------------------------------------------------------
--
-- Table structure for table `tbl_payment`
--
CREATE TABLE IF NOT EXISTS `tbl_payment` (
`id` int(11) NOT NULL AUTO_INCREMENT,
`order_id` int(11) NOT NULL,
`payment_status` varchar(255) NOT NULL,
`payment_response` text NOT NULL,
`create_at` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;
-- --------------------------------------------------------
--
-- Table structure for table `tbl_product`
--
CREATE TABLE IF NOT EXISTS `tbl_product` (
`id` int(8) NOT NULL AUTO_INCREMENT,
`name` varchar(255) NOT NULL,
`code` varchar(255) NOT NULL,
`image` text NOT NULL,
`price` double(10,2) NOT NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `product_code` (`code`)
) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=5 ;
--
-- Dumping data for table `tbl_product`
--
INSERT INTO `tbl_product` (`id`, `name`, `code`, `image`, `price`) VALUES
(1, 'Strawberry Cake', '3DcAM01', 'product/cake1.png', 1500.00),
(2, 'Chocolate Cake', 'USB02', 'product/cake3.png', 800.00),
(3, 'Pastries', 'wr023', 'product/cake1.jpg', 300.00),
(4, 'Coconut Delight', 'cde123', 'product/about2.jpg', 1500.00);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 42.600619 | 160 | 0.572747 |
40f82998cd6193a7a582fb1d43b57ee8b161f1c9 | 14,256 | py | Python | masterclass.py | anshu1905/ECE3501-Project | e40581cc34f615faadcf3a160fe6901a5f26c1a9 | [
"MIT"
] | 1 | 2021-12-17T13:04:53.000Z | 2021-12-17T13:04:53.000Z | masterclass.py | anshu1905/ECE3501-Project | e40581cc34f615faadcf3a160fe6901a5f26c1a9 | [
"MIT"
] | null | null | null | masterclass.py | anshu1905/ECE3501-Project | e40581cc34f615faadcf3a160fe6901a5f26c1a9 | [
"MIT"
] | null | null | null |
try: # import the important library
from urllib import request
from urllib.request import urlopen
import threading # import threadding
import json # import json
import random # import random
import requests # import requests for web API
import ssl
import geocoder # for Locations
import datetime # for date time
from twilio.rest import Client # for Sms
from serial import Serial # for arduino
import numpy as np
from Adafruit_IO import Client # for Adafruit IO
import os
from os import system # For Text to speech
import paho.mqtt.publish as publish
import sqlite3 # for Database
import paho.mqtt.publish as publish
import urllib # for web Api
except:
print("No Library Found")
class Thingspeak(object): # define a class called Thingspeak
def __init__(self, write_api_key = None, read_api_key=None, channel_id=0):
"""
:param write_key: takes a string of write api key
:param timer: can take integer values
"""
# self.url = 'https://api.thingspeak.com/update?api_key='
# self.read_url = 'https://api.thingspeak.com/channels/{}/feeds.json?api_key='.format(channel_id)
self.write_key = write_api_key
self.channel_id = channel_id
self.read_api_key = read_api_key
# Private Var cannot change
self.__url = 'http://api.thingspeak.com/update?api_key'
self.__read_url = 'https://api.thingspeak.com/channels/{}/feeds.json?api_key='.format(channel_id)
self.feild1 = []
self.feild2 = []
def post_cloud(self, value1, value2,value3,value4):
try:
"""
:param value1: can be integer or float
:param value2: can be integer or float
:return: updated to cloud storage
"""
URL = self.__url
KEY = self.write_key
HEADER = '&field1={}&field2={}&field3={}&field4={}'.format(str(value1), str(value2),str(value3),str(value4))
NEW_URL = str(URL) + "=" + str(KEY) + str(HEADER)
print(NEW_URL)
context = ssl._create_unverified_context()
data = request.urlopen(NEW_URL,context=context)
print(data)
except:
print('could not post to the cloud server ')
def read_cloud(self, result=1):
try:
"""
:param result: how many data you want to fetch accept interger
:return: Two List which contains Sensor data
"""
URL_R = self.__read_url
read_key = self.read_api_key
header_r = '&results={}'.format(result)
new_read_url = URL_R + read_key + header_r
data = requests.get(new_read_url).json()
field1 = data['feeds']
for x in field1:
self.feild1.append(x['field1'])
self.feild2.append(x['field2'])
return self.feild1, self.feild2
except:
print('read_cloud failed !!!! ')
class IfTTT(object):
def __init__(self, eventname='', key=''):
self.eventname = eventname
self.Key = key
self.__Url = 'https://maker.ifttt.com/trigger/{}/with/key/'.format(self.eventname)
self.New_Url = self.__Url + self.Key
print(self.New_Url)
def iftt_post(self, data1=10, data2=11):
try:
"""
:param data1: pass your sensor value only integer
:param data2: pass your data as interger only
:return: True if it was successful
"""
URl = self.New_Url
Key = self.Key
payload = {'value1': data1,
'value2': data2}
requests.post(self.New_Url, data=payload)
print("Done posted on IFTTT")
return True
except:
print('failed to post to cloud sever ! ')
class Location(object):
def __init__(self):
pass
def get_locations(self):
"""
:return: Lat and Long
"""
try:
g = geocoder.ip('me')
my_string=g.latlng
longitude=my_string[0]
latitude=my_string[1]
return longitude,latitude
except:
print('Error make sure you have Geo-Coder Installed ')
class DateandTime(object):
def __init__(self):
pass
@ staticmethod
def get_time_date():
try:
"""
:return: date and time
"""
my = datetime.datetime.now()
data_time = '{}:{}:{}'.format(my.hour,my.minute,my.second)
data_date = '{}/{}/{}'.format(my.day,my.month,my.year)
return data_date,data_time
except:
print('could now get date and time ')
def convert_timestamp(self,timestamp):
timestamp = 1554506464
dt_object = datetime.fromtimestamp(timestamp)
return dt_object
class Weather_details(object):
def __init__(self,key='', city=''):
self.city = city
self.key = key
def get_weather_data(self):
try:
city = self.city
key = self.key
URL='http://api.openweathermap.org/data/2.5/weather?appid={}&q={}'.format(key,city)
print(URL)
data = requests.get(URL).json()
long = data['coord']['lon']
lat = data['coord']['lat']
humidity = data['main']['humidity']
wind_speed = data['wind']['speed']
wind_degree = data['wind']['deg']
sunrise = data['sys']['sunrise']
sunset = data['sys']['sunset']
m1 = data['weather'][0]['description']
m2 = data['weather'][0]['main']
body = '{} {}'.format(m1, m2)
return long, lat, humidity, wind_speed, wind_degree, sunrise, sunset,body
except:
print('Error occured ')
class Arduino(object):
def __init__(self,comport='/dev/cu.usbmodem14101', baudrate=9600):
self.comport = comport
self.baudrate = baudrate
def read_data(self):
try:
"""
:return: data after reading from serial object
"""
arduino = Serial(self.comport, self.baudrate,timeout=1)
data = arduino.readline().decode('ascii')
return data
except:
print("please check your com port and baud rate ")
def write_data(self,data='1'):
try:
"""
:param data: pass string 1 or 0 or any character and write if statment in Arduino
to compare and trigger events
:return: NONE
"""
arduinodata = Serial(self.comport, self.baudrate,timeout=1)
data_send = data.encode('utf-8')
arduinodata.write(data_send)
except:
print("cannot write data please check com port and baud rate ")
class Adafruit_cloud():
def __init__(self, username='', Aio_key=''):
self.username = username
self.Aio_key = Aio_key
self.aio = Client(self.username,self.Aio_key)
self.feed_name = []
def adafruit_send(self,feed_name='',data=''):
try:
sensor = self.aio.feeds(feed_name)
self.aio.send_data(sensor.key,data)
print('Data was uploaded ')
except:
print("cannot send Data !")
def adafruit_get(self, feedname=''):
try:
data = self.aio.receive(feedname)
return data.value
except:
print('cannot get data ! ')
def adafruit_feed_list(self):
try:
feeds = self.aio.feeds()
for f in feeds:
print(f)
self.feed_name.append(f.name)
return self.feed_name
except:
print("cannot get feed list ! ")
class TextSpeech_Mac(object):
def __init__(self):
"""
This script works for mac only
"""
pass
def speak(self,text):
try:
"""
:param text: Takes String as Input
:return: Return None
"""
system("say {}".format(text))
except:
print("This works for mac only ! ")
class Mqtt(object):
def __init__(self, data):
self.data= data
self.hostname="test.mosquitto.org"
self.topic = ''
def post(self):
"""
POst teh
:return:
"""
publish.single(self.topic, "{}".format(self.data), hostname=self.hostname)
class YoutubeSub(object):
def __init__(self,name ='',google_key=''):
"""
:param name: Name of Youtube Person , Google Cloud API key
:param google_key:
"""
self.name = name
self.google_key = google_key
self.context = ssl._create_unverified_context()
def get_subscriber(self):
"""
:return: Youtube Sub Count
"""
self.url = 'https://www.googleapis.com/youtube/v3/channels?part=statistics&forUsername=' \
+ self.name+'&key='+self.google_key
data = urllib.request.urlopen(self.url, context=self.context).read()
subs = json.loads(data)["items"][0]["statistics"]["subscriberCount"]
subs = int(subs)
return subs
class Text_MP3_converter(object):
def __init__(self):
self.__url = 'https://text-to-speech-demo.ng.bluemix.net/api/v1/synthesize?t'
self.__header ={
'Accept-Encoding': 'gzip, deflate, sdch',
'Accept-Language': 'en-US,en;q=0.8',
'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/39.0.2171.95 Safari/537.36',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Referer': 'http://www.wikipedia.org/',
'Connection': 'keep-alive'}
self.__params = {
'text': 'hello everyone i am going to teach you python',
'voice': 'en-US_AllisonV2Voice',
'download': True,
'accept': 'audio/mp3'}
def text_audio(self,name ='test', text='hello world'):
"""
:param name_file:
:param text:
:return: saves MP3 File on your computer
"""
try:
response = requests.get(self.__url, headers=self.__header,params=self.__params)
with open("{}.mp3".format(name),'wb') as f:
f.write(response.content)
print("File has been downloaded on your computer with name {}".format(name))
except:
print('Error cannot convert File')
class Spotifypy(object):
def __init__(self,client_id='', client_secret='',oauth_token=''):
self.client_id = client_id
self.client_secret = client_secret
self.oauth_token = oauth_token
self.__header = {'Authorization': self.oauth_token,
'Accept':'application/json',
'Content-Type':'application/json'}
def play_song(self):
self.__url_play = 'https://api.spotify.com/v1/me/player/play'
response = requests.put(self.__url_play, headers=self.__header)
print(response)
def pause_song(self):
self.__url_pause = 'https://api.spotify.com/v1/me/player/pause'
response = requests.put(self.__url_pause, headers=self.__header)
print(response)
def get_recommendation(self):
self.__url_recommendation = 'https://api.spotify.com/v1/recommendations/available-genre-seeds'
response = requests.get(self.__url_recommendation, headers=self.__header)
# print(response.json())
return response.json()
def get_device(self):
self.__url_device = 'https://api.spotify.com/v1/me/player/devices'
response = requests.get(self.__url_recommendation, headers=self.__header)
return response.json()
class Converter(object):
def __init__(self):
self.__url = "https://www.binaryhexconverter.com/hesapla.php"
self.__params = {
'fonksiyon': 'dec2hex',
'deger': 12,
'pad': False,
'v': 2
}
def bin2hex(self,binnum=1):
self.__params['deger'] = binnum
self.__params['fonksiyon'] = 'bin2hex'
response = requests.get(self.__url,params=self.__params)
return response.text
def bin2dec(self, binnum=1):
self.__params['deger'] = binnum
self.__params['fonksiyon'] = 'bin2dec'
response = requests.get(self.__url, params=self.__params)
return response.text
def bin2asc(self,binnum=1):
self.__params['deger'] = binnum
self.__params['fonksiyon'] = 'bin2asc'
response = requests.get(self.__url, params=self.__params)
return response.text
def hex2bin(self, hexnum ='A'):
self.__params['deger'] = hexnum
self.__params['fonksiyon'] = 'hex2bin'
response = requests.get(self.__url, params=self.__params)
return response.text
def hex2dec(self,hexnum ='A'):
self.__params['deger'] = hexnum
self.__params['fonksiyon'] = 'hex2dec'
response = requests.get(self.__url, params=self.__params)
return response.text
def dec2hex(self, decnum='10'):
self.__params['deger'] = decnum
self.__params['fonksiyon'] = 'dec2hex'
response = requests.get(self.__url, params=self.__params)
return response.text
def dec2bin(self, decnum='10'):
self.__params['deger'] = decnum
self.__params['fonksiyon'] = 'dec2bin'
response = requests.get(self.__url, params=self.__params)
return response.text
def dec2oct(self, decnum='10'):
self.__params['deger'] = decnum
self.__params['fonksiyon'] = 'dec2oct'
response = requests.get(self.__url, params=self.__params)
return response.text
| 29.213115 | 141 | 0.564043 |
a314181e359c36b9d614668ab2b3d496149de37e | 2,612 | swift | Swift | 03_mvc/demo/MatchingCardGame/MatchingCardGame/controller/MatchingCardViewController.swift | alexdobry/FSIOS_WS18-29 | a3ac7000019de9bec56ae3413899ba32245675db | [
"MIT"
] | 1 | 2018-10-15T15:51:06.000Z | 2018-10-15T15:51:06.000Z | 03_mvc/demo/MatchingCardGame/MatchingCardGame/controller/MatchingCardViewController.swift | alexdobry/FSIOS_WS18-29 | a3ac7000019de9bec56ae3413899ba32245675db | [
"MIT"
] | null | null | null | 03_mvc/demo/MatchingCardGame/MatchingCardGame/controller/MatchingCardViewController.swift | alexdobry/FSIOS_WS18-29 | a3ac7000019de9bec56ae3413899ba32245675db | [
"MIT"
] | 1 | 2018-10-15T17:37:00.000Z | 2018-10-15T17:37:00.000Z | //
// MatchingCardViewController.swift
// MatchingCardGame
//
// Created by Student on 16.10.18.
// Copyright © 2018 Alexander Dobrynin. All rights reserved.
//
import UIKit
class MatchingCardViewController: UIViewController {
// View
@IBOutlet var cardViews: [CardView]!
@IBOutlet weak var scoreLabel: UILabel!
// Model
var game: MatchingCardGame!
// Lifecycle
override func viewDidLoad() {
super.viewDidLoad()
cardViews.forEach { cardView in
cardView.delegate = self
}
initGame()
}
// Interaction
@IBAction func playAgain(_ sender: Any) {
cardViews.forEach { cardView in
cardView.matched = false
cardView.card = nil
}
initGame()
}
// Helper
private func initGame() {
scoreLabel.text = "Score: 0"
game = MatchingCardGame(numberOfCards: cardViews.count)
game.delegate = self
}
func cardView(matching card: Card) -> CardView {
return cardViews.first(where: { (cardView: CardView) -> Bool in
return cardView.card == card
})!
}
}
extension MatchingCardViewController: CardViewDelegate {
func cardView(_ cardView: CardView, tapped card: Card?) {
let index = cardViews.firstIndex(of: cardView)!
let result = game.flipCard(at: index)
switch result {
case .pending(let card):
cardView.card = card
case .noMatch(let pending, let card):
cardView.card = card
Timer.scheduledTimer(withTimeInterval: 1, repeats: false) { _ in
cardView.card = nil
let other = self.cardView(matching: pending)
other.card = nil
}
case let .match(pending, card):
cardView.card = card
let other = self.cardView(matching: pending)
other.matched = true
cardView.matched = true
case .alreadySelected: break
// sender.setTitle("NO", for: .normal)
//
// Timer.scheduledTimer(withTimeInterval: 0.5, repeats: false) { _ in
// sender.setTitle(card.description, for: .normal)
// }
}
}
}
extension MatchingCardViewController: MatchingCardGameDelegate {
func matchingCardGameScoreDidChange(to value: Int) {
scoreLabel.text = "Score: \(value)"
}
}
| 26.653061 | 92 | 0.547856 |
61a49fb1974dd7d2044f76cfa340889e1d1942c2 | 1,736 | sql | SQL | sql/cheat_types.sql | PaulAnthonyReitz/topaz | ffa3a785f86ffdb2f6a5baf9895b649e3e3de006 | [
"FTL"
] | 6 | 2021-06-01T04:17:10.000Z | 2021-06-01T04:32:21.000Z | sql/cheat_types.sql | PaulAnthonyReitz/topaz | ffa3a785f86ffdb2f6a5baf9895b649e3e3de006 | [
"FTL"
] | 5 | 2020-04-10T19:33:53.000Z | 2021-06-27T17:50:05.000Z | sql/cheat_types.sql | PaulAnthonyReitz/topaz | ffa3a785f86ffdb2f6a5baf9895b649e3e3de006 | [
"FTL"
] | 2 | 2020-04-11T16:56:14.000Z | 2021-06-26T12:21:12.000Z | -- phpMyAdmin SQL Dump
-- version 4.3.10
-- http://www.phpmyadmin.net
--
-- Host: localhost
-- Generation Time: Oct 31, 2019 at 12:33 PM
-- Server version: 10.3.12-MariaDB
-- PHP Version: 5.6.6
SET SQL_MODE = "NO_AUTO_VALUE_ON_ZERO";
SET time_zone = "+00:00";
/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;
--
-- Database: `tpzdb`
--
-- --------------------------------------------------------
--
-- Table structure for table `cheat_types`
--
DROP TABLE IF EXISTS `cheat_types`;
CREATE TABLE IF NOT EXISTS `cheat_types` (
`cheatid` int(10) unsigned NOT NULL,
`name` varchar(15) NOT NULL,
`description` varchar(128) NOT NULL,
`argument` int(10) unsigned NOT NULL,
`action_bitmask` int(10) unsigned NOT NULL,
`warning_message` varchar(128) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=utf8;
--
-- Dumping data for table `cheat_types`
--
INSERT INTO `cheat_types` (`cheatid`, `name`, `description`, `argument`, `action_bitmask`, `warning_message`) VALUES
(1, 'FASTSYNTH', 'Player injects a synth done (0x59) packet to perform synth and craft skillups faster than the game allows.', 0, 7, 'A fast craft cheating attempt has been attempted. Successful craft has been blocked and the incident will be reported.');
--
-- Indexes for dumped tables
--
--
-- Indexes for table `cheat_types`
--
ALTER TABLE `cheat_types`
ADD PRIMARY KEY (`cheatid`);
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
| 29.423729 | 255 | 0.701613 |
1b94630c0b31e189540c711294105fa13ff629cd | 195 | swift | Swift | MeliApp/SearchModule/Presentation/ViewModel/SearchViewModel.swift | yxzandra/MeliApp | 6e232bad200689ac259a46da49f65aa811f7b301 | [
"Apache-2.0"
] | null | null | null | MeliApp/SearchModule/Presentation/ViewModel/SearchViewModel.swift | yxzandra/MeliApp | 6e232bad200689ac259a46da49f65aa811f7b301 | [
"Apache-2.0"
] | null | null | null | MeliApp/SearchModule/Presentation/ViewModel/SearchViewModel.swift | yxzandra/MeliApp | 6e232bad200689ac259a46da49f65aa811f7b301 | [
"Apache-2.0"
] | null | null | null | struct SearchViewModel {
let id: String
let title: String
let idSite: String
let price: String
let mercadoPago: String
let thumbnail: String
let address: String
}
| 19.5 | 27 | 0.661538 |