Posts

Showing posts from September, 2013

c++ - How to pass QDataStream as parameter to signal in Qt5 -

i writing method parse network packet in form of qbytearray . extract few values using qdatastream , pass qdatastream along method further processing (to avoid overhead of making qdatastream later). here code: //datagram qbytearray qdatastream ds=new qdatastream(&datagram, qiodevice::readonly); qint64 somevalue = 0; *ds >> somevalue; emit receivepacket(ds,host, port); since using signals, passing reference not encouraged , since qdatastream q_disable_copy option left pass pointer. if decide pass pointer, how can manage memory? (deleting once) later?

android - generate a mp4 file from list of images by using jcodec library -

i using jcodec library convert list of bitmap images mp4 file. works fine generated mp4 file plays first image correctly , rest of images don't rendered properly. here encoder code private class encoder extends asynctask<file, integer, integer> { private static final string tag = "encoder"; protected integer doinbackground(file... params) { sequenceencoder se = null; bitmap[] arrayofbitmap = {bmp, bmpdef}; try { se = new sequenceencoder(new file(params[0].getparentfile(), "jcodec_enc.mp4")); (int = 0; < arraybitmap.length; i++) { se.encodeimage(arraybitmap[i]); } se.finish(); } catch (ioexception e) { log.e(tag, "io", e); } return 0; } @override protected void onprogressupdate(integer... values) { progress.settext(strin...

node.js - how to get logger name inside winston custom transport function? -

i have 2 loggers: var category1 = winston.loggers.get('category1'); var category2 = winston.loggers.get('category2'); and need custom names (or default). customlogger.prototype.log = function (level, msg, meta, callback) { // need logger name here! (category1 or category2 or undefined / default) } how right way it? thanks as hotfix .. // fix logger name metadata var originalgetlogger = winston.container.prototype.get // winston.loggers.get(loggername); winston.container.prototype.get = function(loggername,options){ var logger = originalgetlogger.call(winston.loggers,loggername,options) logger.rewriters.push(function(level, msg, meta) { meta._l = loggername; return meta; }); return logger; } im overriding fn add rewriter, , rewriter im adding logger name metadata. // each log insert loggername meta var loggera = winston.loggers.get('loggernamea'); var loggerb = winston.loggers.get('loggernameb...

sql - MySQL Select From Multiple Structurally Identical Tables -

let me preface saying yes aware beginner dba should know answer question, have never had formal training , can't find answer after quite bit of googling, please go easy on me :) i have database containing 88 identical (in structure, not data) tables total 20465 rows. looking way aggregate these can: select * [aggregate] id = 'some unique value'; the (working slow) solution came create view select * each table , union them together, apparent me when doing search not correct way this. example selecting ~200 records takes on minute. this not seem use case join tables have no relation 1 another, contain same kind of data. i feeling index looking for, unsure if should indexing view (my googling seems indicate not possible?) or if maybe not understanding indices properly. any tips in right direction appreciated! (even if it's link documentation). the commenter correct. use union all rather union . union all doesn't attempt deduplicate rows, u...

How get ints in Jekyll? -

i trying make blog , want make id tags correspond each time loop runs (e.g. #section_1, #section_2,#section_(insert variable) ). is there way in jekyll? this should produce you're looking for: {% assign indices = "1|2|3" | split: "|" %} {% index in indices %} <div id="{{ index }}">this div {{ index }}</div> {% endfor %} you'll have know in advance how many sections want created, , add each id 1|2|3 bit in first line.

sql - Count number of user in a certain age's range base on date of birth -

i have table user has user_id , user_name , user_dob . i want count how many users under 18 year old, 18-50 , on 50. the age calculation method need improved calculate exact age more interested in finding method count so tried: select count ([user_id]) [user] (datediff(yy,[user_dob], getdate()) < 18) union select count ([user_id]) [user] (datediff(yy,[user_dob], getdate()) >= 18 , datediff(yy,[user_dob], getdate()) <=50) union select count ([user_id]) [user] (datediff(yy,[user_dob], getdate()) > 50) it gives me result like: (no column name) 1218 3441 1540 but need this range | count ---------------- under 18 | 1218 18-50 | 3441 on 50 | 1540 any suggestions how archive above format? convert birthdate range name, group on count: select case when age < 18 'under 18' when age > 50 'over 50' else '18-50' end range, count(*) count (select datediff(yy, user_dob, getdate()) age customer...

java - Adding an ActionListener to a JButton from another class is giving a NullPointerException? -

i want able add acitonlistener jbutton class keep code neat. problem brings nullpointerexception when trying add it. i'm adding actionlistener through handler class defined 'h'. in display class: public class display { private handler h; //my handler object private jframe frame; private jbutton btncalculate; /** * launch application. */ public static void createdisplay() { eventqueue.invokelater(new runnable() { public void run() { try { display window = new display(); window.frame.setvisible(true); } catch (exception e) { e.printstacktrace(); } } }); } /** * create application. */ public display() { initialize(); } /** * initialize contents of frame. */ private void initialize() { frame = new jframe(); frame.setboun...

java - Populating TableView in JavaFX From Data in SQLite -

i trying populate tableview data in sqlite database experiencing weird scenario cannot understand causing it. the tableview populates 2 columns , not populate rest. tablecolumns 'no' , 'date created' not populated when tableview displayed. this code displays data sqlite database in 'title' , 'description' tableview columns. please hawk eye me identify going wrong on code. have spent better part of day trying figure out going wrong not seem figure out not doing right. gladly appreciate on this. here code main class blockquote public class notedb extends application { @override public void start(stage stage) throws exception { parent root = fxmlloader.load(getclass().getresource("listnotesui.fxml")); scene scene = new scene(root); stage.setscene(scene); stage.show(); } public static void main(string[] args) { launch(args); } } blockquote fxml ...

javascript - Django: How to load a script for every page? -

say want include bootstrap or angular every single page in views, there more elegant way copying same line each file? you need django template inheritance . include in template base.html , , in there define block filled in children templates: <html> <!-- base.html --> ...... {% block content %} {% endblock %} <!-- include js/css here --> <script type="text/javascipt" src="{{ static_url }}jquery.js"> <link rel="stylesheet" type="text/css" href="mystyle.css"> </html> then templates extend base.html , override block content so: <!-- sub.html --> {% extends "base.html" %} {% block content %} <!-- current page html goes here --> {% endblock %} in way, have included in base.html automatically inherited , available in sub.html.

C++ -- candidate expects 1 argument, 0 on class definition -

i have used c++ , opengl while have never realy dwelled classes. trying create block class voxel game compiler giving me error block.h:13:7: note: candidate expects 1 argument, 0 provided line 13 line create class. here block header file: #ifndef block_h #define block_h #include <gl/glew.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <glm/gtc/type_ptr.hpp> #include "shader.h" #include "camera.h" using namespace glm; class block{ public: void render(camera cam); glm::vec3 position; block(glm::vec3 position); private: void createmesh(); gluint vao, vbo; shader shader; }; #endif the complete error: world.cpp: in constructor ‘world::world(glfwwindow*)’: world.cpp:3:32: error: no matching function call ‘block::block()’ world::world(glfwwindow* window) ^ world.cpp:3:32: note: candidates are: in file included world.h:9:0, ...

Can I filter laravel collection using where method and some other Model's method? -

i have model called billboard. in model wrote method isdisplayable() . public function isdisplayable() { if (/* logic determine if billboard displayable */) return true; return false; } i want collection of billboards displayable. can utilize where method isdisplayable()? or should adopt other approach? if have collection, can use filter() method filter out results based on model method: $billboards = billboard::all(); $filtered = $billboards->filter(function ($billboard, $key) { // true keep; false remove return $billboard->isdisplayable(); }); if want use logic on query (before collection built), can create query scope on billboard model: public function scopedisplayable($query, $displayable = true) { if ($displayable) { // modify $query displayable items, e.g: $query->where('displayable', '=', 1); } else { // modify $query non-displayable items, e.g: $query...

backand - How to make foreign key required? -

for model example given in documentation, noticed can create pet object without requiring owner . how specify in json owner required? i see required switch fields tab, switch doesn't move when click on it. [ { "name": "pets", "fields": { "name": { "type": "string" }, "owner": { "object": "users" } } }, { "name": "users", "fields": { "email": { "type": "string" }, "firstname": { "type": "string" } "pets": { "collection": "pets", "via": "owner" } } } ] currently in json required field not supported foreign-key can workaround it. i'm backand , plan add in soon, meanwhile can either: add server s...

virtualhost - Must Apache virtual hosts be used when developing on localhost? -

my document root default /var/www/html . if create subdirectories inside html/ directory: html/ example/ dev/ test/ i seem have many sites can access in web browser: localhost/example localhost/dev localhost/test considering above, setting apache virtual hosts seems unnecessary. should use apache virtual hosts when developing on localhost? please why in answers provide. thanks in advance. i use virtual hosts development because prevents unintended cross contamination (i.e. using image etc belongs on site). but opinion. also separates work better.

linux - Daemonize 'child_process' that was 'fork'ed -

i trying achieve behavior similar 1 httpd has when starting nodejs. when say: service httpd start in ps , we'll see: [root@dev ~]# service httpd start starting httpd: [ ok ] [root@dev ~]# ps auxf | grep httpd root 3395 0.0 0.1 6336 304 pts/0 r+ 12:03 0:00 | \_ grep httpd root 3391 0.0 1.3 175216 3656 ? ss 12:02 0:00 /usr/sbin/httpd apache 3393 0.0 0.9 175216 2432 ? s 12:02 0:00 \_ /usr/sbin/httpd notice how httpd master , child have no terminal ( ? shown instead of pts/0 grep ). now... need ipc channel , therefore use child_process.fork no matter do, every time see terminal still attached daemon. here code welcome experiment on: c.js - controller var cp = require('child_process'); var d = cp.fork('d.js', {}); d.on('message', function() { d.disconnect(); d.unref(); }); d.js - daemon process.send('ready'); sett...

footer is fixed on viewpager in android -

i have footer using viewpager. when swipe left or right footer swipe left or right. want footer fixed on each page on viewpager. idea make footer stay fixed when swipe pages. you have create master layout. has viewpager , footer , load fragments view pager. <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent"> <!--header--> <textview android:id="@+id/headertextviewe" android:layout_height="50dp" android:layout_width="match_parent" android:text="header" android:textcolor="@android:color/black" android:textsize="24dip" android:typeface="sans" android:layout_gravity="center"...

printing - How to print smile emoticon from right to left reverse using assembly -

how print smile emoticon right left in assembler #make_com# ; .com org 100h start: mov ah, 0 ; screen 80x25 mov al, 2 ; character 'smiley face' int 10h ; set screen (and clear screen) mov dx, 0 ; start position 0,0 (dh dan dl) mov cx, 1 ; print 1 character set_kursor: mov ah, 2 int 10h ; set cursor position mov ah, 10 int 10h ; print character inc dh ; right inc dl ; enter 1 row cmp dh, 25 jne set_kursor ; try ret ; finish end the code this ☺ ☺ ☺ ☺ ☺ ☺ ☺ what want reverse this ☺ ☺ ☺ ☺ ☺ ☺ ☺ inc dh ; right inc dl ; enter 1 row these comments wrong! dl register has column , dh register has row. to solve question, first put cursor @ position far enough right. chose column 30 , row 0. on each iteration d...

string - Unexpected value when getting value from a map -

so have struct this: type magni struct { ... handlers map[string]func(*message) ... } and have function create new instance of struct: func new(nick, user, real string) *magni { return &magni{ ... handlers: make(map[string]func(*message)), ... } } but can't handlers map key "hey" when "hey" in variable, works if type myself. here method of struct magni , m pointer struct magni : handler := m.handlers[cmd[3][1:]] // cmd[3][1:] contains string "hey" handler2 := m.handlers["hey"] for reason, value of handler nil , value of handler2 0x401310 , not expecting handler nil . am doing wrong or expected behavior? getting value based on value of variable works: m := map[string]string{"hey": "found"} fmt.println(m["hey"]) // found cmd := []string{"1", "2", "3", "hey"} fmt.println(m[cmd[3]]) // found ...

angularjs - Angular ui router controlleras syntax not working -

i trying develop angular app using ui router, stuck trying controlleras syntax working correctly. my stateprovider looks this $stateprovider .state('microsite', { url: "/", templateurl: "microsite.tmpl.html", abstract: true }) .state('microsite.home', { url: "", templateurl: "home.tmpl.html", controller: 'micrositecontroller vm', data: { page_name: 'introduction' } }) .state('microsite.features', { url: "/features", templateurl: "features.tmpl.html", controller: 'micrositecontroller vm', data: { page_name: 'features' } }) .state('microsite.about', { url: "/about", templateurl: "about.tmpl.html", controller: 'micrositecontroller vm', data: { page_name: 'about' } ...

java - ListView not displaying text but displaying number (used SimpleAdapter) -

so i'm creating to-do app , i'm newbie @ java programming , android studio, hope can bear me. here's mainactivity containing simpleadapter display list. listview lv; arraylist<hashmap<string, string>> list; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_listview_main_activity); lv=(listview)findviewbyid(r.id.listingtasks); dbconnector db=new dbconnector(this); list=new arraylist<hashmap<string,string>>(); list=db.display(); string[] from=new string[]{"_id","task"}; int[] to=new int[]{r.id.id,r.id.tasknamecustom1}; listadapter ad; ad = new simpleadapter(listview_main_activity.this,list, r.layout.custom,from,to); lv.setadapter(ad); the dbconnector class extends sqliteopenhelper class , contains methods insert , display records in sqlitedatabase. here's dbconnector class: public class db...

.net - How to represent a C# property in UML? -

not quite attribute, not quite method. stereotypes? <<get>> <<set>> ? i'm retro-modelling existing system, need reflect not same readonly field or methods pair (regardless of il says), think i'll go stereotype, i'll accept language independant get_ set_ general solution. sanity test. properties convenient way of writing get_myvalue() , set_myvalue(value) allowing assignment rather normal method calling (using parenthesis). what accessing .net property, c# has own syntax accessing these. since under skin real get_ , set_ methods created, show methods (to make uml language independent - e.g. make uml equally applicable vb.net developer) ... or have suggested, introduce own stereotype!

java - Advice with super classes and inheritance -

i not know if on right track or not, have hit dead end. have read , reread books chapters super classes , inheritance , still lost. in assignment have to: write super class encapsulating circle; class has 1 attribute representing radius of circle. has methods returning perimeter , area of circle. class has subclass encapsulating cylinder. cylinder has circle base , attribute, length; has 2 methods, calculating , returning area , volumes. i wondering if 1 make sure on right track , give me advice on need finish lost. thank you first class: package question48; import java.awt.graphics; import java.awt.color; public class question48 { public static void main(string[] args) { } public abstract class figure { //varibles private int x; private int y; private color color; //constructor public figure() { x = 0; y = 0; color = color.black; } public figure(int startx, int starty, color startcolor) { x = ...

asp.net - How to convert any formatted text box date to DateTime(YYYY-mm-dd)format -

i working date function.data comes in different format like 1."2016-01-31" 2."31-01-2016" 3."31/01/2016" 4."2016/01/31" 5."jan 01 2016" 6."2016-01-02 12:00 am" now want convert above mentioned format date datetime format yyyy-mm-dd. i tried many methods format shows error message like 'string not correct format' 'unable convert string value datetime' i tried, datetime date=datetime.parseexact(txtdate.text,'yyyy-mm-dd',cultureinfo.invariantculture); how can cast/convert value datetime format(yyyy-mm-dd) format text box value. mostly geting error afteri upload server(godaddy , microsoft azure). can use this string datetimes=txtdate.text; string[] datetimes = new string[] { "yyyy-mm-dd", "dd-mm-yyyy","mm/dd/yyyy","yyyy/mm/dd"}; your code isn't quite right. date format string should surrounded " (double quotes)...

git - no commit button in Team menu in eclipse when checking out project from github -

i create local maven project in eclipse. share project on github remote repository. , team menu comes have list of buttons commit, revert etc. using svn. now checked out same project same remote repository on machine. project checked out team menu has share button. eclipse dose not recognize checked out scm. what make eclipse has list of buttons in team menu when checking out git project? chances are, have not installed egit plugin on second machine, therefore eclipse doesn't know git repositories.

mysql - PHP syntax error in UPDATE table statement -

i trying update table named mineraltable (which has primary key named itemid) foreign keys values sourcelocationtable (locationid), imagetable (imageid), itemtypetable (itemtypeid) , donatortable (donatorid). i want user able select location, image, itemtype , donator values dropdown select boxes value stored in variable , mineraltable updated foreign key numbers of value displayed in dropdown select boxes. the relationship of latter 4 tables mineraltable 1-many therefore can't use junction table hold foreign keys must go in mineral table. after trying run following sql code update mineraltable set locationid='160',itemtypeid='1',imageid='6', donatorid='4' itemid='372' this converted php formatting php variables substituted numerical values. $sql = "update mineraltable\n"     . "set locationid=\'$locationid\', itemtypeid=\'$itemtypeid\', imageid=\'$imageid\', donatorid=\'$donatori...

android - sharedpreferences not created -

i created application store jsonarray using sharedpreferences server.but not created sharedpreference. sharedpreferences sharedpreferences; public void vehiclecache(){ string json_url = "http://domain.com/api/vehicle"; jsonarrayrequest jsonobjectrequest=new jsonarrayrequest(json_url,new response.listener<jsonarray>(){ @override public void onresponse(jsonarray response) { log.d("vehicles", response.tostring()); sharedpreferences= preferencemanager .getdefaultsharedpreferences(g.context); sharedpreferences.editor editor=sharedpreferences.edit(); editor.putstring("vehicles",response.tostring()); editor.commit(); } }, new response.errorlistener() { @override public void onerrorresponse(volleyerror error) { volleylog.d("vehicles_error", "error: " + error.getmessage()); } })...

codeigniter - Codeignighter - Undefined variable in the view -

i have been scratching head while on one, public function business() { $org = $this->session->userdata['logged_in']['org_id']; $query['org_details'] = $this->business_model->org_account($org); $data = array('navigationcontent' => $this->load->view('parts/p_navigation', array(), true), 'maincontent' => $this->load->view('platform/business', array(), true),); $this->load->view('templates/platform', $data, $query); } produces error undefined variable: org_details in view. can't work out why not work edit view requested <?php foreach($org_details $row): ?> <fieldset> <div class="control-group"> <label class="control-label">platform company id:</label> <div class="controls"> <input type="text" value="<?= $row['org_id...

at command - ESP8266 AT firmware doesn't say it's ready -

Image
i'm using esp12e module. uploaded v1.1.1.1 @ firmware.bin, connected pin 0 ground 3.3 v, restarted module. when monitoring com port see : in end id doesn't it's ready , therefore none of @ commands work. any ideas how fix it? at end of image in question, see garbage. on top says ,rst cause:2, boot mode:(3,7) this tells device had external reset , configured boot flash. pin connections correct. if garbage tells loaded fw works different baud rate 74880 baud. possibly garbage "ready" message. try change baud rate terminal (arduino ide) , reboot module till see "ready" message.

python - html text area default value messing with page -

i have python cgi script creates text area , fills default value contents of file. used work noticed change in content on file ;the html rendered incorrectly , submit button , parts of file contents shown in text area(as default content) etc missing or messing total page's html print('<form action="x.cgi" method="post">') print('<textarea name="textcontent" cols="120" rows="50">') open('somefile', 'r') content_file: content = content_file.read() content_file.close() print(content) print('</textarea>') print('<hr>') print('<input type="submit" value="submit" />') print('</form>') what can done contents of somefile doesnt mess html form . note somefile configuration file , need in file printed such user can make necessary change , su...

c# - Detecting SQL Server reboot -

my c# console app runs on different machine sql server 2014. use ado.net connect it. how can detect if sql server automatically reboots after installing windows updates? on client application use systemevents_sessionending not me. i read connection resiliency, seems not solve problem. is there specific ado.net event can capture? creating app on server sending udp not prefered solution, aswell dont want use ping etc. i'm looking event react on. e.g. notification services: https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlnotificationinfo(v=vs.110).aspx thanks! if want see if server down or not can use ping class. using system.net.networkinformation; var ping = new ping(); var reply = ping.send("sqlserverip"); if (reply.status == ipstatus.success) { //server available } else { //server down }

Artoolkit Utilities programs doesn't execute on windows 10 -

i started use artoolkit , want work on normal image marker. i tried first step generate dataset artoolkit utilities couldn't open gentexdata program, open , close immediately. any solutions? i'm using windows 10 . artk sdk windows desktop , windows store (including phone) has rebuilt on windows 10 pro using visual studio 2015. i'm working on that. but before can done should know utility written c/c++ , built ms visual studio 2013. means need windows vs 2013 c/c++ runtime redistributables. try downloading , installing this .

php - how to get cell data with special characters from xlsx reader -

Image
i using simplexlsx php class reading data xlsx file , importing database. i facing 1 issue have not found after google also, issue having values in xlsx column 100%, $300 library parsing data , give output this: 1, 300 - evaluating values , removing symbols. excel file: after parsing library output is: [10] => simplexmlelement object ( [v] => 5 ) [11] => simplexmlelement object ( [v] => 1.2 ) [12] => simplexmlelement object ( [v] => 1.1000000000000001 ) [13] => simplexmlelement object ( [v] => 1 ) and expected out should this: [10] => simplexmlelement object ( [v] => 2.5% ) [11] => simplexmlelement object ( [v] => 2% ) [12] => simplexmlelement object ( [v] => 1.50% ) [13] => simplexmlelement object ...

Java - Hiding update functions in project -

i'm creating simple game engine in java , i've got packages a: game input time graphics each package handles lot of classes, of them have (and should have) public access. let's focus on 1 important class called mouseinput . mouseinput class handles public static methods getmouseposition(mouseaxis axis) {...} handles methods updatemouseposition() {...} . and want make method ( updatemouseposition() ) callable gamebase class inside game package. p.s. don't want put classes in 1 package! want separate them don't make project messy. 2th p.s. methods want make callable gamebase static. it possible restrict can call public method checking call stack . adds code method receiving call "wrong" calls can rejected.

Writing files in Google Cloud using PHP -

so trying write ppt file using php in google cloud app engine. the final code write file is $xmlwriter = iofactory::createwriter($phppresentation, "powerpoint2007"); $xmlwriter->save("php://output"); it workng in localhost when deploy google cloud gives error err_invalid_response in google chrome , file not found in mozilla firefox. when accessed logs says php fatal error: uncaught exception 'exception' message 'could not close zip file vfs://root/temp/.//phppttmp569a45e921e8a8.63056743.' in /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.390023055217794078/mediascout/ppt_export/src/phppresentation/writer/powerpoint2007.php:320 stack trace: #0 /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.390023055217794078/mediascout/ppt_export/samples/sample_header.php(72): phpoffice\phppresentation\writer\powerpoint2007->save('php://output') #1 /base/data/home/apps/s~frrolefrontend/mediascout:ms-080.3900230552177940...

javascript - typed.js jQuery trigger not working during typing -

i'm using typed.js type in text contains simple jquery modal trigger. however i'm finding trigger works once typing has completed. how can make clickable? (so in example below, works when 'sit amet' has appeared.) typed $(".js-typed").typed({ strings: ["lorem ipsum dolor <a class='js-modal-trigger'>open modal</a> sit amet."], showcursor: false, }); modal $(document).on('click', '.js-modal-trigger', function(){ $('.js-modal').addclass('active'); }); i changed using $('.js-modal-trigger').on('click', function() { . still doesn't appear work, until completed. i've wrapped modal trigger function , tried using typed.js callback: function() {} , onstringtyped: function() {} . neither seemed work. how can make link clickable appears in document? ) i'm new typed, , going through github stuff ... .... i think add 2 strings. first...

How to read local xml file using javascript? -

maybe problem wrote path file incorrectly, i'm using linux, have write path in different way? <script type="text/javascript"> function func(){ var xmlfile = new xmlhttprequest(); xmlfile.open("get", "/home/kat/course/data.xml", false); xmlfile.send(); xmldoc = xmlfile.responsexml; document.getelementbyid("result_field").value = xmldoc; } </script> the file needs in webroot. if have code in /var/www , site 'somedomain.com/index.html' need have xml file in same /var/www directory , access "get", "somedomain.com/anotherfolder/data.xml"... can't access server directories js... javascript runs on client side, not on server side, file needs accessible on website.