Posts

Showing posts from January, 2015

vb.net - Sheets API v4 OVERWRITE and INSERTROWS in AppendRequest.InsertDataOptionEnum in VB .NET -

i using sheets api v4 in vb .net following lines gives same result: dim appendrequest spreadsheetsresource.valuesresource.appendrequest = service.spreadsheets.values.append(valuerange, updatespreadsheetid, updaterange) appendrequest.insertdataoption = spreadsheetsresource.valuesresource.appendrequest.insertdataoptionenum.overwrite appendrequest.insertdataoption = spreadsheetsresource.valuesresource.appendrequest.insertdataoptionenum.insertrows in doumentation link , it's mentioned that: "additionally, can choose if want overwrite existing data after table or insert new rows new data. default, input overwrites data after table. write new data new rows, specify insertdataoption=insert_rows in url." instead of adding data last empty row of range, want insert new data @ first row of provided range. the values.append api not support writing starting @ top of table, supports adding rows bottom of table (either overwriting data below tab

java - HikariCP Connection leak -

i'm working on game runs on java server. database pooling i'm using hikaricp, excellent library, throwing following error way: [hikari housekeeper (pool hikaripool-0)] warn com.zaxxer.hikari.pool.proxyleaktask - connection leak detection triggered connection com.mysql.jdbc.jdbc4connection@5910e440, stack trace follows java.lang.exception: apparent connection leak detected @ nl.finicky.lemonade.database.database.prepare(database.java:43) @ nl.finicky.lemonade.rooms.roomfactory.loadroom(roomfactory.java:25) @ nl.finicky.lemonade.rooms.roomfactory.<init>(roomfactory.java:20) @ nl.finicky.lemonade.lemonade.main(lemonade.java:30) now know connection leak means open connection floating around somewhere, can't figure out how or where. the following method in database class, error should occur according stack trace. public preparedstatement prepare(string query) { preparedstatement statement = null; try { while (statement == null)

sql - What declarative language is good at analysis of tree-like data? -

i'm thinking developing system perform highly parallel queries on nested (but tree-like) data. potential users data analysts (physicists, specifically), not programmers. user interface, want use well-known query language avoid proliferating new languages. most of data structured (imagine following schema billions of event structures): event: struct | +--- timestamp: bigint +--- missing energy: float +--- tracks: array of struct | | | +--- momentum: float | +--- theta angle: float | +--- hits: array of struct | | | +--- detector id: int | +--- charge: float | +--- time: float | +--- ... +--- showers: array of struct | +--- ... the database read-only, , of queries things like: momentum of track hits theta between -2.4 , 2.4 average charge of hits time in 0-10 ps on tracks momentum greater 10 gev/c weighted average theta of 2 tracks highest mome

android - Video Chat feature for Django and possibly Ionic -

i developed website django (python). website allows users make 1-to-1 video chat each others. video chat feature i'm using webrtc quite results. now i'm planning to: upgrade paid service video chat (to improve preformances , fix browser incompatibilities) ideally using same paid service ionic app (both android , ios) - service should provide android/ios sdks i'm thinking cometchat. have experience or other services? suggestion appreciated. you have create api charging users , provide same according below-mentioned steps: create feature on site allows users purchase credits (by making payment) create simple api deduct credits , check number of credits once provide api, modify cometchat when user sends message can check number of credits , deduct them using api. please let know if need further assistance same. regards

qt - Why Q_ASSERT instead of assert -

in qt there q_assert macro. what's advantage of using instead of assert <cassert> ? q_assert custom assert macro supposedly enhances standard assert function. the error message handled qfatal() , can behave better on platforms standard assert macro. example on windows trigger visual studio debugger @ point assertion fails instead of calling abort() . you can redirect output of qt error message functions such qfatal to custom message handler ( qinstallmessagehandler() ). can useful example if want redirect errors message file. also note q_assert disabled macro qt_no_debug (while assert disabled ndebug ) : can used separate asserts between qt-related code , rest.

php - Codeigniter URI issue...No URI present. Default controller set -

i have issue codeigniter application deployed on ec2 instance on amazon. $config['base_url'] = 'http://xx.xx.xxx.107/'; $config['index_page'] = 'index.php'; this route.php (without particular rule) $route['default_controller'] = 'home'; $route['404_override'] = ''; $route['translate_uri_dashes'] = false; actually if call http://xx.xx.xxx.107/ correctly show first page (it loads default controller home.php , shows home.php view). if call example http://52.59.107.107/index.php/home/sign_in_form , instead of showing sign_in form view, shows again home view. i enabled log, , get info - 2016-08-08 15:43:25 --> config class initialized info - 2016-08-08 15:43:25 --> hooks class initialized debug - 2016-08-08 15:43:25 --> utf-8 support enabled info - 2016-08-08 15:43:25 --> utf8 class initialized info - 2016-08-08 15:43:25 --> uri class initialized debug - 2016-08-08 15:43:25 --> no uri

scheme - Difference between 3 methods of detecting true in Racket -

it seem big deal there significant differences in following 3 methods of counting number of true items? #lang racket (define (counttrue . vars) (length (remove* (list #f) vars)) ) (define (counttrue2 . vars) (define c 0) (for ((item vars)) (when item (set! c (add1 c)))) c ) (define (counttrue3 . vars) (count (lambda(x) x) vars) ) they produce identical results there reason why particular 1 should or should not chosen? edit: on using time function, following results obtained 3 functions above , 2 each answers @chrisjester-young , @sylwester : "---------- counttrue ------------" cpu time: 751 real time: 751 gc time: 16 "---------- counttrue2 ------------" cpu time: 946 real time: 947 gc time: 10 "---------- counttrue3 ------------" cpu time: 456 real time: 457 gc time: 8 "---------- counttrue_chris1 ------------" cpu time: 726 real time: 727 gc time: 9 "---------- counttrue_chris2 ------------" cpu ti

java - Apache Camel deleteAfterRead does not work -

so want fetch file amazon s3 bucket , delete (use s3 queue). huge problem apache camel receiving same messages , not try delete them. here have route from("aws-s3://bucket?amazons3client=#s3client&deleteafterread=true") flag. the whole route from("aws-s3://bucket?amazons3client=#s3client&deleteafterread=true") .to("seda:queue"); i tried add processor reads inputstreams (though read , delete) .process(new processor() { @override public void process(exchange exchange) throws exception { inputstream stream = (inputstream) exchange.getin().getbody(); exchange.getin().setbody(ioutils.tostring(stream)); } }) also have camel context file. here is. <bean id="awsregion" class="org.springframework.beans.factory.config.methodinvokingfactorybean"> <property name="targetclass" value="

java - How to Inner Join Two Independent Entities in Hibernate -

i have 2 entities: documententity (docnumber (primary key), dateoffill, ...) , fileentity (id, title, size, ...) . have hql query inner join of 2, should run on oracle db: string querystr = "select docnumber " + + "from documententity d " + + "inner join fileentity f " + + "on d.docnumber = f.title " + + "where d.date > to_date('01.01.2011','dd.mm.yyyy')" query query = em.createquery(query_string); return query.getresultlist(); when run code snippet i'm getting exception org.hibernate.hql.ast.querysyntaxexception: path expected join! i looked through hibernate 4.3.6 querysyntaxexception: path expected join hql error: path expected join path expected join! nhibernate error hql hibernate inner join but none resolved problem. suggested paths cannot used in example (at least gives wrong path error). answer of last link says that: joins can u

microcontroller - What is write protection in flash/EEPROM memory? -

i'm pretty new in microcontroller area. project, told implement write/read function writing/reading data flash/eeprom memory. did quick search , saw terminologies like: " write protection ", " flash page ", " protected flash page ". these mean? when , why need these "write protection" or " protected flash page" ? thanks, bien eeprom , flash , other roms implemented pages, blobs of bits erase in 1 action. can typically erase whole pages @ time. erase ones, other way around, erase 1 case, can think of way way "write" ones erase page, can write zeros on bit bit basis. (by writing byte or whatever smallest write , changing zeros want). write protection means says, writing protecting whole part, or fractions of part or page page basis per design. sometimes write protection uses pins being pulled high or low or pins protect ability unlock things after being locked. again on design design, vendor vendor ba

java - detached entity passed to persist error with liquibase -

i have 2 domains @entity public class model extends baselongidmodel { @notnull @size(min = 2, max = 50) @column(length = 50, nullable = false) private string name; @notnull @column(nullable = false) private long threshold; @onetomany(mappedby = "model", cascade = cascadetype.all, orphanremoval = true) @cache(usage = cacheconcurrencystrategy.nonstrict_read_write) private set<modelweight> weights; public string getname() { return name; } public model setname(string name) { this.name = name; return this; } public long getthreshold() { return threshold; } public model setthreshold(long threshold) { this.threshold = threshold; return this; } public set<modelweight> getweights() { return weights; } public model setweights(set<modelweight> weights) { this.weights = weights; return this; }

face recognition - Eigenfaces Comlex number Eigenvalues -

when calculate covariance (a_transposed * a) , calculate eigenvalues , eigenvectors 1 small eigenval here have 3 images in training set. -0.0000000242 17221292.9979712702 11732978.3353619855 this first unsorted eigenval super small. when svd on these eigenvectors need eigenvalues[i]^(-0.5) @ point desired eigenvectors (initial eigenvectors smaller in length since did (a_transposed * a) instead of ( * a_transposed )). long storyshort, smallest eigenval turns out complex number when math.pow(eval_i,-0.5). suppose use comlex eigensolver ? such small number normal ? other eigenvalues huge, normal? i have followed this thanks

python - How to make a function determining the winner of Tic-Tac-Toe more concise -

i'm writing python script supposed allow human , computer players play tic tac toe. represent board, i'm using 3x3 numpy array 1 , 0 marks of players (instead of "x" , "o"). i've written following function determine winner: import numpy np class board(): def __init__(self, grid = np.ones((3,3))*np.nan): self.grid = grid def winner(self): rows = [self.grid[i,:] in range(3)] cols = [self.grid[:,j] j in range(3)] diag = [np.array([self.grid[i,i] in range(3)])] cross_diag = [np.array([self.grid[2-i,i] in range(3)])] lanes = np.concatenate((rows, cols, diag, cross_diag)) if any([np.array_equal(lane, np.ones(3)) lane in lanes]): return 1 elif any([np.array_equal(lane, np.zeros(3)) lane in lanes]): return 0 so example, if execute board = board() board.grid = np.diag(np.ones(3)) print board.winner() i result 1 . bothers me repetition of any statemen

ios - Prevent clicks to pass through in UIView in Swift -

suppose have tableview cell. on have uiview rating control works adding buttons subviews. when user clicks besides buttons, still on rating control, click passed through underlying cell. not want that. i thinking there must proper way inside rating control code (derived uiview) catch clicks passed , never pass them through further cell.

Slack API - Hide some information of profile in response -

when using users.list method i'm getting every profile information of every team member. need hide of information (because user can inspect page, listening requests , getting knowledge of skype id or phone number example). there special argument can send slack api return profile.images & profile.real_name? current request: $.ajax({ type: 'get', datatype: 'json', url: 'https://slack.com/api/users.list?token=' + slackaccesstoken + '&presence=1&pretty=1', data: {format: 'json'} }; after hours trying done, best way of doing building proxy (simple php file) endpoint of request , filter informations there. otherwise can create security leak.

android - Download image from URL, show it as a circular image with default behaviour -

after stucking few days on problem wanted share solution , save time. problem 1. download image url 2. show circular image (if download succeeded) 3. or show default image in same imageview (if download failed) [edit] removed answer because of useful hints coming @budius , better working solution offers below best way achieve task question using picasso circular transformation. like following code: picasso .with(context) .load(url) .placeholder(placeholderdrawable) .error(errordrawable) .transform(circletransform) .into(imageview); and code circletransform copied link: https://gist.github.com/julianshen/5829333 public class circletransform implements transformation { @override public bitmap transform(bitmap source) { int size = math.min(source.getwidth(), source.getheight()); int x = (source.getwidth() - size) / 2; int y = (source.getheight() - size) / 2; bitmap squaredbitmap = bitmap.createbitmap(sour

css - Bootstrap3 Replace input-lg with input-sm on small screens -

i'm using twitter bootstrap's input-lg class on inputs. there (maybe javascript) way replace twitter bootstrap's input-sm on smaller screens, font-size, height, line-height , padding on input "shrink" bootstrap way? or easier media-queries myself? the javascript (jquery) way (e.g.) (not tested): $(window).resize(function() { if ($(window).width() < 768) { $("input").addclass("input-sm"); } else if ($(window).width() >= 768 && $(window).width() <= 992) { $("input").removeclass("input-sm"); $("input").removeclass("input-lg"); } else if ($(window).width() > 992 && $(window).width() <= 1200) { $("input").addclass("input-lg"); } else { // greater screen sizes if want } }); i think better solution, because writing own media queries, copy bootstraps css these existing cl

sql - Why the following error occurs only in PGSQL and not in MYSQL? -

must appear in group clause or used in aggregate function i doing inner join between 2 tables , used 1 of foreign key in base table within group , above error thrown. works fine in mysql i believe speaking mysql < 5.7 non standard feature in mysql did away mysql 5.7 please see : https://dev.mysql.com/doc/refman/5.7/en/sql-mode.html#sqlmode_only_full_group_by sqlmode_only_full_group_by reject queries select list, having condition, or order list refer nonaggregated columns neither named in group clause nor functionally dependent on (uniquely determined by) group columns. as of mysql 5.7.5, default sql mode includes only_full_group_by. (before 5.7.5, mysql not detect functional dependency , only_full_group_by not enabled default. description of pre-5.7.5 behavior, see mysql 5.6 reference manual.)

javascript - Angular - Can't get json data from $scope -

im working on google maps project can't json work angular .module('angular-google-maps', ['uigmapgoogle-maps']) .controller('maincontroller', controller); function controller ($scope, $http, $filter) { $http.get('/data/markers.json').success(function(data) { $scope.markers = data; }); $scope.map = { center: { latitude: 52.339287, longitude: 4.925805 }, zoom: 8, markers: $scope.markers }; $scope.options = {}; }; if understand correctly can data using $scope.markers right? unfortunate not. when assign $scope.markers = data; changing object variable referencing, $scope.map.makers still referencing old value (which undefined ). two of simplest ways on come this: 1) reference variable derectly: $http.get('/data/markers.json').success(function(data) { $scope.map.markers = data; $scope.markers = data; }); 2) watch: $scope.markers = null; $http.get('

java - Concatenating chars to a String - Using StringBuilder's append() -

i doing research on concatenating char primitive values form string , came across post: concatenate chars form string in java i understand correct way of producing final string value use tostring() method, how come if not use method, still same output. have thought following code output heap address of object sb still prints 'ice'. thank you. public class charstostring { public static void main (string args[]) { char a, b, c; = 'i'; b = 'c'; c = 'e'; stringbuilder sb = new stringbuilder(); sb.append(a); sb.append(b); sb.append(c); system.out.println(sb); } } you need system.out.println(sb); does. calls in class java.io.printstream method. (because stringbuilder extends object) public void println(object x) { string s = string.valueof(x); synchronized (this) { print(s); newline(); } } and, string.valueof(x) calls tostring()

asp.net web api2 - Get user data from bearer token web api -

i implementing .net web api 2 in c# using. works fine, send username , password , bearer token returned. now token used other api calls, in each call know user data. because app call web api such python code etc, in such cases send bearer token not user name. i tried dig through code not locate it. any ideas appreciated here. the answer depends on type of bearer token you're dealing with. example, if jwt token, consists of 3 parts separated period: header, payload, , signature. user id payload, you'll need base-64 decode payload , grab "sub" property. 'sub' known 'claim'. token contains many claims 'sub' typically stores user id. see more details: https://jwt.io/introduction/ in c#, can parse out payload of token using string.split() , base 64 decode payload this: var payload = encoding.utf8.getstring(textencodings.base64url.decode(b64payload)); from there, need deserialize payload object matches format expect:

nginx - How to set DOCUMENT_ROOT and SCRIPT_NAME correctly for fcgiwrap -

i've got simple script cpuinfo.sh works , executable. i'm getting error *224 fastcgi sent in stderr: "cannot script name, document_root , script_name (or script_filename) set , script executable?" while reading response header upstream, client: 86.44.146.39, server: staging.example.com, request: "get /cpuinfo.sh http/1.1", upstream: "fastcgi://unix:/var/run/fcgiwrap.socket:", host: "staging.example.com" the nginx settings are location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$ { gzip off; autoindex on; fastcgi_pass unix:/var/run/fcgiwrap.socket; include fastcgi_params; fastcgi_param document_root /home/balance/balance-infosystems-web/scripts/; fastcgi_param script_filename $document_root$fastcgi_script_name; } i'm expecting fcgiwrap execute /home/balance/balance-infosystems-web/scripts/cpuinfo.sh i hard coded script path debug i'm still getting same error. location ~ (\.cgi|\.py|\.sh|\.pl|\.lua)$

ios - Position GMSMarker on bottom when clicked -

when gmsmarker clicked , infowindow opened camera moves point gmsmarker @ center of gmsmapview . how change camera move position marker @ bottom when moved? when implement gms didtapmarker delegate method without infowindow fine: func mapview(mapview: gmsmapview, didtapmarker marker: gmsmarker) -> bool { var point = mapview.projection.pointforcoordinate(marker.position) point.y = point.y - 200 let camera = gmscameraupdate.settarget(mapview.projection.coordinateforpoint(point)) mapview.animatewithcameraupdate(camera) return true } it positions marker on bottom. if return false shows infowindow , marker centered again. mapview.selectedmarker = marker missing in didtapmarker delegate method. method should this: func mapview(mapview: gmsmapview, didtapmarker marker: gmsmarker) -> bool { var point = mapview.projection.pointforcoordinate(marker.position) point.y = point.y - 150 let camera = gmscameraupdate.settarget(ma

php - Laravel join query with json data -

i have products id in json format in sales table. want fetch data , need join products table product details such product name, product image,etc here sample data sales table , orders column [{"pcode":"r1160","qty":1,"price":"270","default_shipping":30}, {"pcode":"r1112","qty":1,"price":"250","default_shipping":30}] now want join query products table , want products details

Android RecyclerView best practice -

i have page looks this: a line of text list of items more lines of text list of items currently xml layout follows: <textview/> <recyclerview/> <textview/> <textview/> <recyclerview/> i'm wondering if wouldn't better have 1 recyclerview different view types, instead of of this. considered best, , why? i quite new android development, sorry if question not relevant. you should use 2 recyclerviews because have 2 lists. putting 1 force items in list #1 scrolled before seeing items follow, including second list.

node.js - Heroku deployment crashing at start Nodejs -

i trying deploy existing nodejs application heroku . followed process listed in documentation. i wrote on procfile: web: node ./bin/www but getting: process exited status 1 2016-08-08t11:07:54.028983+00:00 heroku[web.1]: state changed starting crashed 2016-08-08t11:07:56.852268+00:00 heroku[router]: at=error code=h10 desc="app crashed" method=get path="/" host=agile-headland-49936.herokuapp.com request_id=357f1a83-adff-4353-8e6b-6f8166cdb09b fwd="202.166.207.112" dyno= connect= service= status=503 bytes= web: node ./bin/www gives me hint making express app . package.json might have like: "scripts": { "test": "echo \"error: no test specified\" && exit 1", "start": "node ./bin/www" } you can place web: npm start in procfile . should work. hope helps :)

How to add left navigation bar in mobile wireframe using Balsamiq. -

how add left navigation bar in mobile wireframe using balsamiq. can tell me name of component? while don't have navigator panel built in, can build 1 out of rectangles controls. or can steal 1 built on our web demo downloading project. won't tell anyone. :)

c# - Get the macro names only from excel sheet and display the names in a WPF combobox dynamically -

i have wpf application consisting of combobox , have excel file "macrosheet.xls" stored in computer in particular location. want fetch macro names only excel sheet , display in comboboxitem list dynamically on button click. xaml <combobox x:name="macrolist"> </combobox> <button x:name="showmacronames" content="showmacronames click="showmacronames_click"/> i've searched lot on internet didn't solution. note: don't want create new vsto project it. please suggest solution can implemented within application code.

html5 - ConvertTo-HTML <td> Class -

i have group of simple powershell functions retrieve system statistics, convert them html fragments & join 1 big html file @ end. i'm having problem specific functions, whereas others appear working fine although i'm using same principle. this retrieves system information: function get-applicationlogs { $query = '<querylist> <query id="0" path="application"> <select path="application">*[system[(level=1 or level=2 or level=3) , timecreated[timediff(@systemtime) &lt;= 86400000]]]</select> </query> </querylist>' $logs = get-winevent -computername $computername -erroraction silentlycontinue -filterxml $query | sort-object {$_.id} foreach ($log in $logs) { $props = [ordered]@{'id'=$log.id; 'error type'=$log.leveldisplayname; 'provider name'=$log.providerna

java - Time Complexity of while loop in case of while(boolean)? -

i trying understand time complexity calculation of function stuck @ point. unlike for loop while loop shown in code below depend on input string length. how calculate time complexity such cases? the function blockquote input data: 4gopi7krishna3msc5india output data: {"4":"gopi","7":"krishna","3":"msc","5":"india"} input data , length may vary each , every time. public static string splitdata(string input) { try { string outputjson = "{"; boolean run = true; while (run) { string firstchar = string.valueof(input.charat(0)); int length = integer.parseint(firstchar); if (length > 0) { string data = input.substring(1, (length + 1)); outputjson = outputjson + "\"" + string.valueof(length) + "\":\"" + data + "\"";

c++ - How does DBL_MAX addition work? -

code #include<stdio.h> #include<limits.h> #include<float.h> int f( double x, double y, double z){ return (x+y)+z == x+(y+z); } int ff( long long x, long long y, long long z){ return (x+y)+z == x+(y+z); } int main() { printf("%d\n",f(dbl_max,dbl_max,-dbl_max)); printf("%d\n",ff(llong_max,llong_max,-llong_max)); return 0; } output 0 1 i unable understand why both functions work differently. happening here? in eyes of c++ , c standard, integer version , floating point version potentially invoke undefined behavior because results of computation x + y not representable in type arithmetic performed on. † both functions may yield or anything. however, many real world platforms offer additional guarantees floating point operations , implement integers in way lets explain results get. considering f , note many popular platforms implement floating point math described in ieee 754. following rules of standa

C# Windows Forms - How to programmatically set image preview for file folder (VSTO 2010) -

windows forms - vsto - outlook background - creating digital archive add-in office user can search database client (whom document belongs to) , save file appropriate folder(s) based on nature of file. far working word planned using outlook has more consider (attachments, message body, etc.). i have got working far attachments saved temporary folder (which emptied each time windows form closes) ready sorted , can obtain information sender/subject/email body. list of attachments set out checkedlistbox current problem - when user looking archive attachment (a lot of documents/scanned documents come up), images confusing may necessary or entirely unimportant wish preview images. i trying on event of private void chkattachments_selectedvaluechanged(object sender, eventargs e) the image shows in picattachpreview (picturebox) preview of file. taking image tempfolder ( @"c:\temp\digitalarchive" ). i understand wrong trying set source image shown on screen on sel

MIMEMultipart, MIMEText, MIMEBase, and payloads for sending email with file attachment in Python -

without prior knowledge of mime, tried learned how write python script send email file attachment. after cross-referencing python documentation, stack overflow questions, , general web searching, settled following code [1] , tested working. import smtplib email.mimemultipart import mimemultipart email.mimetext import mimetext email.mimebase import mimebase email import encoders fromaddr = "your email" toaddr = "email address send to" msg = mimemultipart() msg['from'] = fromaddr msg['to'] = toaddr msg['subject'] = "subject of email" body = "text want send" msg.attach(mimetext(body, 'plain')) filename = "name of file extension" attachment = open("path of file", "rb") part = mimebase('application', 'octet-stream') part.set_payload((attachment).read()) encoders.encode_base64(part) part.add_header('content-disposition', "attachment; filename= %s&qu

angularjs - Uncaught Error: cannot call methods on sortable prior to initialization; attempted to call method 'option' -

i getting error when trying use ui-sortable. jquery-3.1.0.min.js:2 uncaught error: cannot call methods on sortable prior initialization; attempted call method 'option' thanks in advance. the meaning of error is : $this.draggable('enable'); called before $this.draggable();. check execution flow of program : make sure have indeed initialized plugin (e.g : called $this.draggable(); ) before trying it.

javascript - Hoisting does not work? -

i stumbled upon jsfiddle code sample hoisting https://jsfiddle.net/phusick/h4bh2m4y/ fn1('hello'); fn2('world'); function fn1(message) { console.log('mgs1:', message); } var fn2 = function(message) { console.log('msg2:', message); } surprisingly not work : uncaught typeerror: fn2 not function is there error in program ? your code equivalent this: // function declarations hoisted function fn1(message) { console.log('mgs1:', message); } // variable declarations hoisted var fn2; fn1('hello'); fn2('world'); // assignments variable not hoisted fn2 = function(message) { console.log('msg2:', message); } the declaration of fn1 function hoisted. the declaration of fn2 variable hoisted. the assignment fn2 variable not hoisted. declarations hoisted, assignments or initializations not. function assignments doing fn2 different function declarations such fn1 . assignments v

github - how to clone private git and create a new one from it -

i'm working in group project. have have private git repo on github. want clone repo , name 'new repo' in such way new repo can accessed or modified me. change on old repo must not affect repo. possible? keep in mind old git repo not created me, invited. git clone repo.git git remote remove origin // because want remove completely. create new repository on github manually. git remote add origin git@github.com:user_name/new_repo.git git push -u origin head

apache - How to rewrite paths for certain file types with .htaccess? -

i move static files cdn. there images, fonts, js, css, , of them include paths other files. e.g. file site.com/fonts/fontname.css @ static.othersite.com/folder/fonts/fontname.css , , contain path src:url(fontname.eot) . how rewrite paths .htaccess? the following code should work: rewriteengine on rewritecond %{http_host} ^site\.com$ [nc] rewritecond %{request_uri} \.(jpe?g|png|svg|css|js|eot|ttf|woff2?)$ [nc] rewriterule ^ http://static.othersite.com/folder%{request_uri} [r=301,l] keep adding other file extensions 2nd rewritecond directive above.

java - how to write rest service using @beanparam and @Get mthod -

please me write rest webservice using below class , @beanparam , @get method @queryparam("prop1") public string prop1; @queryparam("prop2") public string prop2; @queryparam("prop3") public string prop3; @queryparam("prop4") public string prop4; with pojo this: public class mybean { @queryparam("prop1") private string prop1; @queryparam("prop2") private string prop2; @queryparam("prop3") private string prop3; @queryparam("prop4") private string prop4; // getters , setters omitted } your resource method like: @get @path("/foo") public response foo(@beanparam mybean mybean) { ... } update: mentioned in comments, return mybean marshaled xml in http response payload, have following: @get @path("/foo") @produces(mediatype.application_xml) public response foo(@beanparam mybean mybean) { return respo

reactjs - Universal rendering for react app based on create-react-app -

i have app based on create-react-app starter kit , need switch universal/server rendering due seo issues. is there easy way or example of taking create-react-app teamplate , adding or modifying support universal rendering? a lot of examples see universal overly complex needs , prefer keep clean , simple, if possible. thanks. edit: fyi, found this medium post points @ this repository. seems simple enough, since i'm newbie on webpack/react/node related stuff, if thinks it's wrong approach, love know... there proof of concept of adding server rendering in this pr . can’t speak how it’s start with. you may @ of alternatives . few of them provide server rendering out of box.

laravel - How many tests for the same class? -

i using php laravel framework , have controller class. i have written unit test class. is necessary write integration test same class? or controller classes need integration instead of unit tests? how repository classes call eloquent models , adapters call third party packages? should have integration tests, since not under control? thanks

Automate the boring stuff with Python: Comma Code -

currently working way through beginners book , have completed 1 of practice projects 'comma code' asks user construct program which: takes list value argument , returns string items separated comma , space, , inserted before last item. example, passing below spam list function return 'apples, bananas, tofu, , cats'. function should able work list value passed it. spam = ['apples', 'bananas', 'tofu', 'cats'] my solution problem (which works fine): spam= ['apples', 'bananas', 'tofu', 'cats'] def list_thing(list): new_string = '' in list: new_string = new_string + str(i) if list.index(i) == (len(list)-2): new_string = new_string + ', , ' elif list.index(i) == (len(list)-1): new_string = new_string else: new_string = new_string + ', ' return new_string print (list_thing(spam)) my q

Upload files to BMC Remedy Mid-Tier -

i'm java developer, absolutely new in bmc remedy system, have 1 fast task solve. our remedy use java applet upload files remedy browser ui ftp server. should replace javascript (upload files via http server side, upload ftp server). in general web application, can add servlet, receive multipart file, connect ftp, upload , respond params. piece of cake. right way solve problem in remedy? i've read documentation , sort of plugins remedy mid-tier , there nothing simple servlets. what right way solve task? source samples helpful. thank you. if doing via api, record id, , field id , this: //first, retrieve form int[] fieldids = {1}; string formname = "my:form:name"; //request id. field id = 1. 14 chars long. string requestid = "00000000000001"; entry entry = arsconnection.getentry(formname, requestid, fieldids); //add attachment attachmentvalue attachment = new attachmentvalue("name_of_file.ext", "path/to/file.ext"); en

javascript - send form data to admin email in codeIgniter -

Image
i newer codeigniter. have 1 contact form fields of stream, name, email, contact. have problem form data not send admin email. when tried submit data on contact form page source alert have given other alert data. have tried following code, $('#interiorid').submit(function (e) { e.preventdefault(); var interiorstream = $('#interiorstream').val(); var interiorname = $('#interiorname').val(); var interiormobile = $('#interiormobile').val(); var interioremail = $('#interioremail').val(); var mobilevarify = /[0-9]/.test(interiormobile); var regex = /^([a-za-z0-9_.+-])+\@(([a-za-z0-9-])+\.)+([a-za-z0-9]{2,4})+$/; var datastring = 'interiorstream =' + interiorstream + '&interiorname =' + interiorname + '&interiormobile =' + interiormobile + '&interioremail =' + interioremail; alert(interiorstream); if (interiorstream ==

jquery - JQGrid : sorttype integer sort column as string -

i use jqgrid this: <@sjg.grid id="gridtable" datatype="json" loadonce="true" href="${remoteurl}" pager="true" gridmodel="mydatalist" navigator="true" navigatoradd="false" navigatoredit="false" navigatordelete="false" navigatorview="true" navigatorrefresh="false" navigatorsearch="false" rownum="20" rownumbers="true" rowlist="10,20,30,50,100" viewrecords="true" multiselect="true" autowidth="true" shrinktofit="true" oncompletetopics="loadcomplete" onfocustopics="onselectrow" onselectalltopics="onselectall" filter="true" filteroptions="{stringresult:true}" footerrow="true" > <@sjg.gridcolumn name="intcolumn" index="intcolumn" title="test int" sortable="true" search="true&quo

javascript - AngularJS - Conditionally hide a span -

i want hide <span ng-show="currencyobject.to != 'undefined'">=</span> until currencyobject.to undefined supposed undefined until user select option select box. used ng-show="currencyobject.to != 'undefined'" conditionally show-hide span not working. find is, when page freshly loaded, = visible. <div class="row" ng-controller="qconvertcontroller"> <div class="col-md-8 col-md-offset-2"> <div class="form-group"> <label for="amount">amount</label> <input type="number" step="any" class="form-control" id="amount" ng-model="currencyobject.amount"> </div> </div> <div class="col-md-8 col-md-offset-2"> <div class="form-group"> <label for="from">from</label> <select class="

'Adobe Acrobat Pro DC' - how to call preflight action by .net from action wizard? -

how call preflight action avactionperformproc method .net executed in adobe acrobat pro dc ? i found solution problem, create preflight droplet exe file, call batch file or whatever ..

ruby on rails - ActiveSupport notifications dont have a duration -

we use activesupport notifications log specific network calls (with faraday). in 1 of types of calls, when code reaches activesupport::notifications.subscribe(notification[:name]) |_name, starts, ends, _, env| handle_notification(starts, ends, env, notification[:service], env[:request_headers][notification[:header]]) end the starts , ends same, can't calculate duration of call. since happens 1 specific call, , code same, notice calls work extracted gems, calls aren't working no in gems. not sure if matters how can debug/solve this? the start , end values time objects. if log output of values appear time/date value 2017-01-12 10:51:00 +0100 . you have convert milliseconds or microseconds see fine values. you can convert time object milliseconds following: start.to_f * 1000 end.to_f * 1000 then can work values 1484216765256 in milliseconds , calculate duration subtracting end start .

mysql - Get latest row from each row in a set (5M+ rows) -

i have 2 tables - sensors , readings . there 1 many relation sensors readings . i need query rows sensors , newest (i.e max timestamp) data readings each row. i've tried with: select sensors.*, readings.value, readings.timestamp sensors left join readings on readings.sensor_id = sensors.id group readings.sensor_id the problem is, have 6 million rows of data , query taking 2 minutes execute. there more effecient way can hold of last reading/value each sensor? this how i'd go problem: it involves trigger populates latest_readings table it involves table named latest_readings . the table i made sensor_id unique because assumed have one reading per sensor. can categorized types adding additional column. reason unique index: we'll using mysql's insert ... on duplicate key update have hard work done us. if there's reading particular sensor, gets updated - otherwise, gets inserted (in 1 query). you can make sensor_id foreign key. sk