

通天閣



黑門市場



select p.identifier, i.value from project p, intent i where identifier = 'qa_chat' and p.id = i.project_id order by i.id desc limit 10
with source as ( select row_number() over(partition by p.identifier order by i.id desc) as row_number, p.identifier, i.value from project p, intent i where identifier = 'qa_chat' and p.id = i.project_id limit 10 ) select case when row_number = 1 then identifier else '' end as identifier, value from source
F:\software\neo4j-community-3.3.3\bin>neo4j start Invoke-Neo4j : 找不到任何服務名稱為 'neo4j' 的服務。 位於 線路:1 字元:213 + ... community-3.3.3\bin\Neo4j-Management.psd1'; Exit (Invoke-Neo4j start) + ~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotSpecified: (:) [Write-Error], WriteErrorException + FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Invoke-Neo4j
F:\software\neo4j-community-3.3.3\bin>neo4j uninstall-service Neo4j uninstalled F:\software\neo4j-community-3.3.3\bin>neo4j install-service Neo4j service installed F:\software\neo4j-community-3.3.3\bin>neo4j start 警告: 正在等候 'Neo4j Graph Database - neo4j (neo4j)' 服務啟動... Neo4j windows service started
1 2 3 4 5 6 7 | select * from sentence where intent_id in ( select id from intent where project_id=5 ) |
1 2 3 4 5 6 7 8 | select * from sentence where intent_id in ( select id from intent where project_id=5 ) limit 1 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | intents:
- greet
- inform
- others
- question
entities:
- userid
- is_account_locked
- pass_company_check
action_masking: true
action_factory: remote
actions:
- utter_default
- utter_greet
- confirm:
dependency:
slots:
- userid
- unlock:
dependency:
slots:
- userid
- is_account_locked
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | package test.albert.snakeyaml; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.representer.Representer; import lombok.AllArgsConstructor; import lombok.Data; import lombok.extern.slf4j.Slf4j; @Slf4j public class SnakeYamlTest { public static void main(String[] args) { // Set DumperOptions options DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setPrettyFlow(true); // overwrite Representer Representer representer = new Representer(); representer.addClassTag(ActionAttribute.class, Tag.MAP); // Create Yaml instance with Representer and DumperOptions Yaml yaml = new Yaml(new Constructor(), representer, options); // Prepare map data for YAML Map<String, Object> actionMap1 = new HashMap<>(); actionMap1.put("confirm", new ActionAttribute(new Dependency(Arrays.asList("userid")))); Map<String, Object> actionMap2 = new HashMap<>(); actionMap2.put("unlock", new ActionAttribute(new Dependency(Arrays.asList("userid", "is_account_locked")))); Map<String, Object> map = new HashMap<>(); map.put("intents", Arrays.asList("greet", "inform", "others", "question")); map.put("entities", Arrays.asList("userid", "is_account_locked", "pass_company_check")); map.put("action_factory", "remote"); map.put("actions", Arrays.asList("utter_default", "utter_greet", actionMap1, actionMap2)); map.put("action_masking", "true"); // Serialize a Java object into a YAML String String output = yaml.dump(map); log.info("\n" + output); } @Data @AllArgsConstructor private static class ActionAttribute { Dependency dependency; } @Data @AllArgsConstructor private static class Dependency { private List<String> slots; } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | intents:
- greet
- inform
- others
- question
entities:
- userid
- is_account_locked
- pass_company_check
action_masking: 'true'
action_factory: remote
actions:
- utter_default
- utter_greet
- confirm:
dependency:
slots:
- userid
- unlock:
dependency:
slots:
- userid
- is_account_locked
|
1 2 3 4 5 6 7 8 9 10 | package test.albert.snakeyaml; import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.resolver.Resolver; public class CustomResolver extends Resolver { protected void addImplicitResolvers() { addImplicitResolver(Tag.BOOL, BOOL, "yYnNoO"); } } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | package test.albert.snakeyaml; import java.util.Arrays; import java.util.HashMap; import java.util.List; import java.util.Map; import org.yaml.snakeyaml.DumperOptions; import org.yaml.snakeyaml.Yaml; import org.yaml.snakeyaml.constructor.Constructor; import org.yaml.snakeyaml.nodes.Tag; import org.yaml.snakeyaml.representer.Representer; import lombok.AllArgsConstructor; import lombok.Data; import lombok.extern.slf4j.Slf4j; @Slf4j public class SnakeYamlTest { public static void main(String[] args) { // Set DumperOptions options DumperOptions options = new DumperOptions(); options.setDefaultFlowStyle(DumperOptions.FlowStyle.BLOCK); options.setPrettyFlow(true); // overwrite Representer Representer representer = new Representer(); representer.addClassTag(ActionAttribute.class, Tag.MAP); // Create Yaml instance with Representer, DumperOptions, CustomResolver Yaml yaml = new Yaml(new Constructor(), representer, options, new CustomResolver()); // Prepare map data for YAML Map<String, Object> actionMap1 = new HashMap<>(); actionMap1.put("confirm", new ActionAttribute(new Dependency(Arrays.asList("userid")))); Map<String, Object> actionMap2 = new HashMap<>(); actionMap2.put("unlock", new ActionAttribute(new Dependency(Arrays.asList("userid", "is_account_locked")))); Map<String, Object> map = new HashMap<>(); map.put("intents", Arrays.asList("greet", "inform", "others", "question")); map.put("entities", Arrays.asList("userid", "is_account_locked", "pass_company_check")); map.put("action_factory", "remote"); map.put("actions", Arrays.asList("utter_default", "utter_greet", actionMap1, actionMap2)); map.put("action_masking", "true"); // Serialize a Java object into a YAML String String output = yaml.dump(map); log.info("\n" + output); } @Data @AllArgsConstructor private static class ActionAttribute { Dependency dependency; } @Data @AllArgsConstructor private static class Dependency { private List<String> slots; } } |
1 2 3 4 5 6 7 8 9 10 11 | $scope.tab4.synonymCols = [{ field : 'value', displayName : 'value', cellClass : 'text-left', width : '25%' }, { field : 'synonyms', displayName : 'synonyms', cellClass : 'text-left', width : '70%' } ]; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | $scope.tab4.synonymCols = [{ field : 'seq', displayName : 'no', cellClass : 'text-left', width : '5%', cellTemplate: '<div class="ngCellText ng-scope col1 colt1" ng-class="col.colIndex()"><span ng-cell-text="">{{row.rowIndex + 1}}</span></div>' }, { field : 'value', displayName : 'value', cellClass : 'text-left', width : '25%' }, { field : 'synonyms', displayName : 'synonyms', cellClass : 'text-left', width : '70%' } ]; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | public static void main(String[] args) { List<Double> data = Arrays.asList(0.51, 0.53, 0.49, 0.74, 0.55, 0.47, 0.59, 0.47, 0.45, 0.72); DoubleSummaryStatistics summaryStatistics = data.stream().mapToDouble(d -> d.doubleValue()).summaryStatistics(); Double mean = summaryStatistics.getAverage(); Double variance = 0d; for (Double num : data) { variance += Math.pow(num - mean, 2); } variance = variance / 10; Double standardDeviation = Math.sqrt(variance); DecimalFormat df = new DecimalFormat("0.000"); log.info("variance = " + df.format(variance)); log.info("standardDeviation = " + df.format(standardDeviation)); } |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | $scope.doExport = function() { bootbox.dialog({ message: "請選擇要匯出 JSON 或 Excel", title: '匯出', buttons: { json: { label: 'JSON', callback: function() { $scope.exportJson(); } }, excel: { label: 'Excel', callback: function() { $scope.exportExcel(); } } } }); }; |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | $scope.doExport = function() { bootbox.dialog({ message: "請選擇要匯出 JSON 或 Excel", title: '匯出', buttons: { json: { label: 'JSON', className: 'btn-primary', callback: function() { $scope.exportJson(); } }, excel: { label: 'Excel', callback: function() { $scope.exportExcel(); } } } }); }; |
taskkill /IM test.exe /F del /F /Q C:\test\Bak\*.*
:loop taskkill /IM test.exe /F del /F /Q C:\test\Bak\*.* timeout /t 10 goto loop
In general, the String.replace method works fine and is pretty efficient, especially if you’re using Java 9. But if your application requires a lot of replace operations and you haven’t updated to the newest Java version, it still makes sense to check for faster and more efficient alternatives.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 | package your.simple.java; import java.util.Calendar; import java.util.Date; import org.apache.commons.lang.StringUtils; public class StringReplacementTest { private String test = "test"; private int count = 100000000; public static void main(String[] args) { new StringReplacementTest().test1(); new StringReplacementTest().test2(); } public void test1() { Date from = Calendar.getInstance().getTime(); for (int i = 0; i < count; i++) { test.replace("test", "simple test"); } Date to = Calendar.getInstance().getTime(); long seconds = (to.getTime() - from.getTime()) / 1000; System.out.println("[test1] seconds = " + seconds); } public void test2() { Date from = Calendar.getInstance().getTime(); for (int i = 0; i < count; i++) { StringUtils.replace(test, "test", "simple test"); } Date to = Calendar.getInstance().getTime(); long seconds = (to.getTime() - from.getTime()) / 1000; System.out.println("[test2] seconds = " + seconds); } } |
[test1] seconds = 56 [test2] seconds = 9
<div class="row"> <div class="col-sm-offset-1 col-sm-10"> <div class="form-group"> <label for="operaName" class="control-label">連續劇</label> <input type="text" class="form-control input-lg" id="operaName" data-ng-model="operaName" data-ng-mouseup="showOperaSelectedText()" > </div> <div class="form-group"> <label class="control-label">起訖</label> <span> {{operaNameFromIndex}} ~ {{operaNameToIndex}}</span> </div> <div class="form-group"> <label class="control-label">選擇文字</label> <span> {{operaNameSelected}}</span> </div> </div> </div>
$scope.operaName = "又,吳海英"; $scope.operaNameFromIndex = 0; $scope.operaNameToIndex = 0; $scope.operaNameSelected = ''; $scope.showOperaSelectedText = function() { // if selected if (window.getSelection) { // get selected text $scope.operaNameSelected = window.getSelection().toString(); // get from index $scope.operaNameFromIndex = $('#operaName').prop('selectionStart'); // get end index $scope.operaNameToIndex = $('#operaName').prop('selectionEnd'); } }