#SampleCode
Explore tagged Tumblr posts
Text

Mau sambungkan aplikasi milikmu sendiri ke sensor sidik jari??
Jawabannya adalah pakai UareU Sensor HID Flexcode SDK 4500. FlexCode 4500 merupakan tools yang digunakan untuk mengembangkan aplikasi bisnis dengan mengintegrasikan aplikasi tersebut dengan sensor U.are.U 4500.
Mendukung berbagai bahasa pemrograman dan sample code diantaranya : VB6, Delphi 7, VB.Net, C#, PHP.
Selain itu, dapat diintegrasikan dengan aplikasi BPJS, sehingga sangat sesuai untuk pemindai identifikasi sidik jari peserta JKN-KIS dan BPJS Kesehatan.
Untuk Pemesanan bisa hubungi kami.
#fingerprint #fingerspot #bpjs #bpjskesehatan #rs #sdk #flexcode #hid #ditigalpersona #samplecode #php #vb #image #like #follow #instagram
0 notes
Text
Computer Systems Sample Code - Sample Sort
This section will demonstrate some sampled code for 3302ENG Computer System Lab which will be discussed below.
Parallel sort assignment
Question 1
Write a program that performs a sample sort on a dataset that you create. The dataset is a space delimited list of integers between 0 and 1000. The program should open a file called dataset.txt which contains the data to be sorted. The number of bins used is your choice. The program should also time the length of time taken to complete the sort.
Hints: The timing functions can easily be found in any slightly advanced C programming textbook or website. Also make sure that you use a large enough dataset to get a meaningful time.
Question 2
Modify Q1 so that it uses threads to perform a parallel sample sort.
Question 3
The aim of part 3 is to determine the effect of increasing the number of threads on the time taken to perform the parallel sort. This will be demonstrated by plotting a graph of the average time for the sort versus the number of threads used.
You should choose the number of threads so that range is 1 <= number of threads <= 10.
Repeat this procedure 3 times and calculate the average taken time for the different number of threads.
Plot the graph of the average time for the sort vs the number of threads used.
Write down the processor type and the number of cores for the computer that you used to perform this question.
Explain the graph.
Analysis of the implemented sample sort

Figure: Average time taken for each # of thread used in the parallel programming of a sample sort used in conjuncture with a Bucket Sort via multithreading.
The increasing of sorting ranges via the addition of another thread to sort a particular range of integers shows that certain thread numbers (using parallel sorting of 2 – 3) could be beneficial with dips in 5 and 7 where the larger of the resources being chewed up by the program from the system is happening around 8 to 10 threads.
The higher peaks happening at thread numbers 4 and 6 could be from a range for one bucket containing a majority of the randomised data, the distribution could be held entirely by accident from a poor sampling algorithm, decreasing the overall time can be achieved by re-evaluating how a random sample of the whole dataset is obtained, post sorting and acquiring splitters from the sorted random sample could help distribute the whole dataset evenly amongst the buckets (threads).
Code
Github link to Generating data to sample C File
The C File will contain the code to generate the needed data for the sampling algorithim.
Github link to Question 1 C File
This C File will contain the code for sample sorting the generated data Txt File - the code itself is different from the next C File which is a combination of Question 1 and Question 2, the main difference within this code is that the sorting algorithim will examine the amount of the pieces of data and resize for an appropriate amount of buckets to be used to sort the amount of data, it’s aim is to stay relatively in the low-middle section of the thread numbers such as (2 - 5).
Github link to Question 1 Question 2 C File
Alternative C File at Github
This C File will contain the code for sample sorting the generated data Txt File - the code itself will sort data at the number of threads that the user chooses. The alternative file is the same code with the removal of the printed to terminal data positions as a measure to examine whether it is working the way it should be.
Issues occurred and possible solution
Problem 1:
An occurrance was during the accessing of critical code, which content of first thread will be mixed by the content of the nth thread.
Possible solutions for problem 1:
Thread locking the critical code and allowing each thread to enter and submit the data at the appropriate position in the array of sorted data, which means keeping track of where it is between shared memory between threads.
Implemented solution for problem 1:
Mutex locking, conditional numbers with mutex condition broadcasting and waiting so that thread 1 will access the critical code sections and will allow the data to be inserted increasing the conditional number up until the nth thread, for this section of the code the parallel programming because serial however it is not destructive.
Problem 2:
The sorting of the random data resulted in one bucket taking most of the load of the data, when each bucket was given a number range.
Possible solutions for problem 2:
Eliminating the use of the number ranged buckets and give each bucket a random number of elements to be sorted with in perspective bucket and allowing a simple mutex lock and let each thread insertion sort each number - it will elminiate overhead of the storage for a slower time.
Implemented solution for problem 2:
A solution has yet to be implemented.
Revision
This is the revision of the code to make it a little more efficient.
0 notes
Text
How to deploy Ruby on Rails Code on production server with Passenger and Apache?
In this blog, you are going to learn about the deployment of rails application on the production server with its configuration setting in Apache. For this, you need to have Ruby, Rails, MySQL installed in your server system.
Let’s begin with the process of deploying the Rails application.
Step 1: Add the code copy to the server.
For adding code to the server, you need to take a copy of the code on your server by login using sftp.
$ sftp [email protected]
$ put samplecode
Stpe 2: Installation of project and configuration settings.
Install all libraries of the project and make configuration settings including configuration of database.yml and secrets.yml by using following commands. For this, you need to login to the server using ssh and go to the project folder.
$ ssh [email protected]
$ cd samplecode
Rails app has ruby versions and you have to use that specific version to run the application. So, use the ruby version of the application.
$ rvm use (ruby version)
Install all libraries of the project, set the database and compile assets. Rails have some specific commands to do that.
$ bundle install
$ rake db:create RAILS_ENV=production
$ rake db:migrate RAILS_ENV=production
$ rake assets:precompile RAILS_ENV=production
Rails provide a secret key which you have to mention it into the config/secret.yml file of the application to maintain the security.
$ rake secret
Above cammand provide a secret key, add it to theconfig/secrets.yml file of you RoR project.
Step 3: Apache settings
You have to do apache settings to run the application in production mode on apache server. For this first, you have to createsamplecode.conf file in etc/apache2/sites-available/ path.
The file content will look like as in Image 1. Where you have to mention the domain of your application like www.myapp.com and server name like myapp.com. With this, you also have to mention the path of a public folder of the application and ruby version of the application.
Image 1: Samplecode.conf File
You need to create the symlink of the file samplecode.conf to the sites-enabled folder. It is created for apache and virtual host settings. This virtual host setting will tell Apache where your application is located. Replace myapp.com with your application name and as well as mention path to ruby with the ruby version of the application into the samplecode.conf file.
If you start the application on some port and not on some domain like www.myapp.com, you need to specify the port number in the conf file in place of port “80” at the top of the file. And then mention that port to the ports.conf file which is located at /etc/apache/ports.conf.
Image 2: Ports.conf File
In the above image, you can see how to mention port, like I have mentioned port 3000 to be heard by apache while serving the page. At last restart the apache server by using the following command. It will run the application on the link like 127.0.0.0:3000 or if it is for a domain then it will run on www.myapp.com or myapp.com.
$ sudo restart apache2 restart
In this way, you can start a rails app on the production server.
#ruby on rails#software development company#apache#application deployment#web app#mobile apps#RoR development#deployment on production server
1 note
·
View note
Text
iOSのネットワーク接続状態の検出にはReachabilityよりシンプルなNWPathMonitorを使いましょう。
from https://qiita.com/meSummery/items/9d096162a351e2e922c5?utm_campaign=popular_items&utm_medium=feed&utm_source=popular_items
iOSでネットワーク接続状態の取得といえばReachabilityを使うといった印象が強くありませんか。
Reachabilityを使うには、まず https://developer.apple.com/library/archive/samplecode/Reachability/Introduction/Intro.html からApple の提供しているサンプルコードをダウンロードして・・・なんて手間がありましたが、もっと手軽に利用できるApple標準のクラスがありました。
簡単にネットワーク接続のモニタリングが可能
NWPathMonitor
ネットワークの接続状態やネットワークインターフェースなどの情報をモニタリングできるNetwork frameworkのクラス。iOS 12.0以降から利用可能。 https://developer.apple.com/documentation/network/nwpathmonitor
実装ステップ
利用箇所でまずフレームワークをインポートしておきましょう。
モニタリング用クラスのインスタンス化
解放されるとコールバックが受け取れないので、ViewControllerのプロパティなどとして保持しておきましょう。
let monitor = NWPathMonitor()
requiredInterfaceType引数を指定して、ネットワークインターフェース別にモニタリングすることも可能です。
let wifiMonitor = NWPathMonitor(requiredInterfaceType: .wifi)
サポートしているインターフェースのタイプは以下に記載があります。 https://developer.apple.com/documentation/network/nwinterface/interfacetype
ネットワーク接続状態の変更をハンドリングする
monitor.pathUpdateHandler = { path in if path.status == .satisfied { // Connected } }
後述しますが、モニタリングは通常バックグラウンドキューで指定して実行されます。 クロージャー内でUIを操作する場合には、メインスレッドで行うようにしましょう。
ネットワーク接続状態のモニタリングを開始する
モニタリングイベントを配信するためのDispatchQueueを定義して、モニタリングを開始します。
private let queue = DispatchQueue(label: "com.sample") monitor.start(queue: queue)
ソースコード全体
import UIKit import Network final class ViewController: UIViewController { private let monitor = NWPathMonitor() private let queue = DispatchQueue(label: "com.sample") override func viewDidLoad() { super.viewDidLoad() monitor.pathUpdateHandler = { path in if path.status == .satisfied { print("Connected") } else { print("Not Connected") } } monitor.start(queue: queue) } }
まとめ
動画で載せたデモアプリの実装ですが、ViewController内を30行前後で書くことができました。 iOS12以降対応ですし、実用性もばっちりですね。 「ネットワーク接続状態の検出��はNWPathMonitor!」が定着すれば良いなと思います。
以上です
ありがとうございました。
0 notes
Text
New comment by 0xCA in "Ask HN: Who wants to be hired? (August 2019)"
Location: Rio de Janeiro, Brazil Remote: Yes Willing to relocate: Yes Technologies: AWS, Linux administration, Python, Ansible, Chef, Docker, Kubernetes, Networking, etc. Résumé/CV:https://github.com/csouto/samplecode/blob/master/Cesar_Souto.pdf Email: cesar(dot)souto(at)gmail.com
0 notes
Text
Esempio di articolo tecnico
Vediamo come se la cava a formattare del codice:
<script> var citiesAU = [“Sydney”, “Melbourne”, “Brisbane”, “Perth”], citiesUS = [“New York”, “Miami”, “San Fransisco”, “Los Angeles”], cities = citiesAU.concat(citiesUS); document.getElementById(“msg”).innerHTML = cities; </script>`
Vediamo come te la cavi con PHP:
<?php require ‘vendor/autoload.php’; use net\authorize\api\contract\v1 as AnetAPI; use net\authorize\api\controller as AnetController; define(“AUTHORIZENET_LOG_FILE”, “phplog”); function decryptVisaCheckoutData() { /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $merchantAuthentication->setName(\SampleCode\Constants::MERCHANT_LOGIN_ID); $merchantAuthentication->setTransactionKey(\SampleCode\Constants::MERCHANT_TRANSACTION_KEY); } ?>
fatto
0 notes
Link
I decided to get started with the app using UIKit Dynamics. The catalog provides nice sample code to begin trying out stuff.
0 notes
Text

FlexCode SDK mendukung pemrograman VB6, Delphi 7, VB.Net, C#.Net, PHP dan mendukung sistem operasi Windows XP/7/8/10.
Dapat diintegrasikan dengan aplikasi BPJS, sehingga sangat sesuai untuk pemindai identifikasi sidik jari peserta JKN-KIS dan BPJS Kesehatan.
Harga SPESIAL SEPTEMBER 2023
Dapatkan hanya dengan harga 1Jutaan
Diskon untuk pembelian kwantitas
#fingerprint #flexcode #4500 #sdk #samplecode #os #programer #bpjs #sidikjari #fingerspot
0 notes
Link
PMA(Progressive Web Apps)에 관심 있다면 유용한 정보입니다. PMA를 제작한 샘플 코드와 기술 스택이 정리되어 있어 설계 및 공부하기에 좋습니다. #PMA #javascript #samplecode #developer #code
0 notes
Text
MetalKitでカメラアプリを作ってみた
MetalKitを使ってカメラアプリを作ってみたので簡単にまとめます。
コード
https://github.com/yoshimin/MetalCamera
実装方法
http://qiita.com/shu223/items/2e493645e2d9a1e35a0d
http://qiita.com/shu223/items/3301a1e64757c0bd73ef
https://developer.apple.com/library/content/samplecode/MetalShaderShowcase/Listings/MetalShaderShowcase_AAPLRenderer_mm.html
この辺りを参考に作りました。
手順は以下の通り。(実装はコードを見てください)
MTKView を持つ Single View Application を作成
AVCaptureSession を使って CMSampleBuffer を取得
CMSampleBuffer を CVImageBuffer に変換
CVImageBuffer から MTLTexture を生成して MTKView 上に描画する
撮影ボタンが押されたら currentDrawable#texture から UIImage を生成してカメラロールに保存する
ハマったところ
上記の参考URLに習えばカメラ映像をMTKViewに描画するところは簡単にできました。
ハマったのはスナップショットを取るところ。
この写真が

こうなったり

こうなったりしました

MTLtexture から CGContext を作る際の CGBitmapInfo をいろいろ間違えました。
MTKView の colorPixelFormat を見ると、bgra8Unorm となっていたので、premultipliedFirst と byteOrder32Little を指定しなければならなかったみたい。
CPU負荷
計測方法
以下の条件でAVCaptureStillImageOutputでを使ったカメラアプリと、今回作成したMetalKitを使ったカメラアプリのCPUを比較する。
端末:iPhone6
OS:10.1.1
計測内容:10秒ごとのスナップショットを1分間行う
AVCaptureStillImageOutput版
MetalKit版
スナップショットを撮る際のCPU使用率の上がり幅はMetalの方が低いですが、AVCaptureStillImageOutputを使ったアプリの方はスナップショットを撮る瞬間以外はほぼ0%なのに比べてMetalを使ったアプリの方はベースのCPU使用率が高いですね。
Metalを使ってエフェクトをかけたいとか出ない限り無駄にCPU喰ってしまいますね。
ただ、気になるのがMetalを使ったアプリの方はCPUが右肩上がりに増えています。実装の仕方が悪いのか...?
試しにスナップショットを一切行わず、ただ10分間AVCaptureSessionから得られた映像を画面に描画しただけの場合のCPUも取ってみました。
きれいな右肩上がりですね。。なんでだ?
TODO
右肩上がりのCPU使用率をなんとかしたい。
エフェクトなんかもかけられるようにしたいですね。
0 notes
Link
Check out the new Bot Builder SDK samples we released last week!
0 notes
Link
Easy step-by-step instructions on installing and configuring Tomcat 7 and using Eclipse to start/stop it and deploy apps to it
0 notes
Text
Excel VBA, Set Cell Alignment Properties (Sample Code + Download)
Excel VBA, Set Cell Alignment Properties (Sample Code + Download):
In this article I've provided a sample code that will set the alignment properties of the cells in the first row using VBA. The user selects different alignment properties using the drop down lists provided. The program then updates the alignment properties of the cells in row 1
Read more ...
0 notes
Text
'Grab latest Tweets' - reusable class
I'm developing a Twitter tool and needed to grab the latest tweets in the public timeline and chuck (technical term) in a tableview for testing.
I've been developing on and off for iOS since it 2008 and, i'm embarrassed to say, have only relatively recently started to design my code for reuse.
I'd also appreciate any comments if anyone spots any bad coding habits or would like to improve it.
Copy the code into your project making sure the calling class registers for the <latestTweetDelegate> in its header file.
Then instantiate the class using your URL, I just use the standard Twitter Public Timeline API:
latestTweets *lt = [[latestTweets alloc] initWithTwitterURL:@"http://api.twitter.com/1/statuses/public_timeline.json?include_entities=true"];
lt.delegate = self;
[lt release];
As it used the JSON parser you'll need to add that to your project as well:
https://github.com/stig/json-framework/
Hope you find it useful.
Nik
Header File:
#import <Foundation/Foundation.h>
@protocol latestTweetsDelegate
- (void)returnedArray:(NSArray*)tArray;
@end
@interface latestTweets : NSObject {
NSMutableData *responseData;
NSMutableArray *resultsArray;
id<latestTweetsDelegate> delegate;
}
@property (nonatomic, retain) NSMutableArray *resultsArray;
@property (retain,nonatomic) id<latestTweetsDelegate> delegate;
- (id)initWithTwitterURL:(NSString *)twitterURL;
@end
Implementation file:
#import "latestTweets.h"
#import "SBJson.h"
@implementation latestTweets
@synthesize resultsArray, delegate;
- (id)initWithTwitterURL:(NSString *)twitterURL
{
self = [super init];
if (self) {
responseData = [[NSMutableData data] retain];
NSURLRequest *request = [NSURLRequest requestWithURL:[NSURL URLWithString:twitterURL]];
[[NSURLConnection alloc] initWithRequest:request delegate:self];
}
return self;
}
- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response {
}
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data {
[responseData appendData:data];
}
- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error {
[connection release];
NSLog(@"Connection failed: %@", [error description]);
}
- (void)connectionDidFinishLoading:(NSURLConnection *)connection {
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
[responseData release];
NSArray *newData = [responseString JSONValue];
[responseString release];
[self.delegate returnedArray:newData];
}
#pragma mark Memory Management
- (void)dealloc {
self.resultsArray = nil;
responseData = nil;
self.delegate = nil;
[super dealloc];
}
@end
0 notes