Posts

Showing posts from June, 2014

jquery - hamburger menu should display above the background content -

i have created hamburger menu @ right top corner of html,css, jquery. when click on hamburger menu icon.it sliding down , existing background sliding down. want after clicking on hamburger icon menu should appear above background instead of sliding down existing content. $(".cross").hide(); $(".menu").hide(); $(".hamburger").click(function() { $(".menu").slidetoggle("slow", function() { $(".hamburger").hide(); $(".cross").show(); }); }); $(".cross").click(function() { $(".menu").slidetoggle("slow", function() { $(".cross").hide(); $(".hamburger").show(); }); }); html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfo

mixpanel - Is it possible to transfer data to Firebase Analytics? -

we trying migrate mixpanel firebase analytics. there way transfer historic data firebase? no there isn't solution that. alternative export firebase analytics data big query, in big query import data mixpanel. won't able visualise data imported in big query in classic firebase dashboard, you'll need build custom dashboard using google data studio instance.

android - Gradle build hanging when jackOptions is enabled for Java 1.8 -

i want use lambdas in project decided switch java 1.8. android studio (2.1.3) forced me enable jackoptions. did install java 1.8 on mac , when run javac -version in terminal javac 1.8.0_101 , jdk in android studio points right one. when try build project, gradle gets stuck on: :app:compiledebugjavawithjack i did following , nothing worked: gradlew clean git clean -fdx , reimport project gradlew --stacktrace assemble if revert java 1.7 lose lambdas feature project builds properly. any ideas problem? update ok after waiting more 5 minutes gradle did spit following error: error: dex writing phase: classes.dex has many ids. try using multi-dex com.android.jack.api.v01.compilationexception: dex writing phase: classes.dex has many ids. try using multi-dex @ com.android.jack.api.v01.impl.api01configimpl$api01compilationtaskimpl.run(api01configimpl.java:113) @ com.android.builder.core.androidbuilder.convertbytecodeusingjackapis(androidbuilder.java:1852)

php - Slim 3 post for every page with only one function -

i'm attempting add logout each 1 of pages when post request sent. code working have define every route. there way can have $app->post() on main routes file effect every page on site? for example, on admin page have add code logout working: $app->post('/admin', function ($request, $response) { // define post data $params = $request->getparams(); // logout user if ($params['logout']) { // logout user::logout(); // redirect login page return $response->withheader("location", "/"); } }); is there way can add single file , every other page such site.com/admin , site.com/panel able access this? thanks i solved using middleware. // middleware logout $app->add(function ($request, $response, $next) { // define post data $params = $request->getparams(); // logout user if ($params['logout']) { // logout user::logout();

Retrieve email subject from file via bash -

i've shell script downloads files servers mail folder nas devices client has copies made locally backup. the files saved 11469448248.h15587p19346.smtp.x14.eu_2,s files. i've changed extension standard .eml format email clients can read them disc. for f in *.smtp.x14.eu_2,s; #sed "9q;d" $f #tail -n+9 $f | head -n1 mv -- "$f" "${f%.smtp.x14.eu_2,s}.eml"; done as can see i've tried use sed , tail command 9th line file; problem subject isn't on 9th line , file names don't of content. i'm trying files names in understandable format, figured subject helpful. on nth line of email file line begins subject: pd: subject im trying find line fet rid of subject: pd: , leave rest ne file name the following wrong implements seem asking. subj=$(sed -n '/^subject: pd *//!d;p;q;/^$/q' "$f") the problem succeeds in trivial case, fails when have mime rfc2047-encoded subject: header, , (more tr

Convolution without any padding-opencv Python -

is there function in opencv-python can convolve image kernel without padding ? basically, want image in convolution takes place in regions kernel , portion of image overlaps. opencv supports convolving image output returned same size input image. such, can still use opencv's filter functions, ignore pixels along edges kernel didn't encapsulate inside image. assuming image kernel odd, can divide each of dimensions half, take floor (or round down) , use these cut away information isn't valid , return left. divakar mentioned, same method using scipy 's 2d convolution method 'valid' option. as such, assuming image stored in a , kernel stored in b , following filtered image kernel encapsulated inside image. take note we're going assume kernel odd , output stored in c . import cv2 import numpy np = cv2.imread('...') # load in image here b = (1.0/25.0)*np.ones((5,5)) # specify kernel here c = cv2.filter2d(a, -1, b) # convolve h =

How to integrate Capistrano with Docker for deployment? -

i not sure question relevant may try mix tools (capistrano , docker) should not mixed. i have dockerized application deployed capistrano. docker compose used both development , staging environments. this how project looks (the application files not shown): capfile docker-compose.yml docker-compose.staging.yml config/ deploy.rb deploy staging.rb the docker compose files creates necessary containers (nginx, php, mongodb, elasticsearch, etc.) run app in development or staging environment (hence specific parameters defined in docker-compose.staging.yml ). the app deployed staging environment command: cap staging deploy the folder architecture on server 1 of capistrano: current releases 20160912150720 20160912151003 20160912153905 shared the following command has been run in current directory of staging server instantiate necessary containers run app: docker-compose -f docker-compose.yml -f docker-compose.staging.yml -d so far good. thi

r - Quanteda kwic append data to output -

i'd append metadata kwic output such customer id (see below) it's easy lookup against master file. i've tried appending data using cbind nothing matches correctly. if possible examples appreciated. docname position contextpre keyword contextpost custid text3790 5 nothing @ looks , sounds great 1 text3801 11 think offer value , has lot 3 text3874 10 not sure thats word use 5 originating data.frame custid comment 1 nothing @ looks , sounds great 2 did not see appealing 3 think offer value , has lot of potential 4 these items terrible how still in business 5 not sure thats word use 6 having hard time believing place sell item low 7 may worth investing in additional equipment at first thought ideal solution use docvars , kwic don't seem have opti

twitter bootstrap - Inline minified CSS files between <head> tags rather than HTTP <link> to them -

i have been following , working google pagespeed insights checker. i'm close 100%; , while know suggestions listed in insights check advice, , near based on every need, need know general consensus of placing minified css bundles directly between <style></style> tags on each page instead of doing 1x <link href=...> file. to clarify, saying doing this: <html> <head> <style> <?php include('/path/to/compiledminified.css'); </style> </head> which outputs this: <html> <head> <style> /*! * bootstrap v3.3.7 (http://getbootstrap.com) * copyright 2011-2016 twitter, inc. * licensed under mit (https://github.com/twbs/bootstrap/blob/master/license) *//*! normalize.css v3.0.3 | mit license | github.com/necolas/normalize.css */html{font-family:sans-serif;-webkit-text-size-adjust:100%;-ms-text-size-adjust:100%}body{margin:0}article,aside,details,figcaption,figure,footer,header,hgroup,main,menu,nav,sectio

ruby on rails - Bonsai-Elasticsearch crashing in Heroku Production URI::InvalidURIError -

i've gotten elasticsearch not crash app on startup anytime try search app crashes , adding new record crashes app (but record added). the error message is: professor store (0.9ms) {"id":59,"exception":["uri::invalidurierror","bad uri(is not uri?): http://heroku config:0"]} 2016-09-12t16:48:34.008480+00:00 app[web.1]: completed 500 internal server error in 14ms (searchkick: 0.9ms | activerecord: 7.6ms | elasticsearch: 0.0ms) 2016-09-12t16:48:34.009289+00:00 app[web.1]: 2016-09-12t16:48:34.009290+00:00 app[web.1]: uri::invalidurierror (bad uri(is not uri?): http://heroku config:0): 2016-09-12t16:48:34.009291+00:00 app[web.1]: app/controllers/professors_controller.rb:51:in `block in create' 2016-09-12t16:48:34.009291+00:00 app[web.1]: app/controllers/professors_controller.rb:50:in `create' i'm not sure what's uri::invalidurierror (bad uri(is not uri?): http://heroku config:0): i've gone through here , , i&#

Ruby loop order? -

i'm trying bruteforce password. playing loops, i've noticed there's specific order. like, if have for in '.'..'~' puts . / 0 1 2 3 4 5 6 7 8 9 : ; < = > ? @ b c d e f g h j k l m n o p q r s t u v w x y z [ \ ] ^ _ ` b c d e f g h j k l m n o p q r s t u v w x y z { | } ~ after seeing this, wondered myself "what loop order in ruby?" character highest priority , lowest priority? sorry if question basic. haven't found site knows. if have questions question ask. hope clear enough! the order defined binary representation of letters. which, in turn, defined standard. standard used ascii (american standard code information interchange). http://www.asciitable.com/ other encoding standards exist, ebcdic used ibm mid-range computers.

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. although there portions of answer apply usage of the mail() function itself, many of these troubleshooting steps can applied php mailing system. th

java - Finding all regular expression/s from a value -

i have variable having url , file containing 100's of regular expression. how can find regular expression/s hold true variable. don't want pattern match each , every pattern in file. looking performance efficient solution. while, ultimately, won't away "true" performance-efficient solution, there simple heuristics can utilize cut down on number of patterns need evaluate. for instance, try "grouping" patterns using simplified versions. consider 2 patterns [a-z]\d[a-z] [a-z]{3} any string matching both of these patterns match pattern [a-z].[a-z] . if skip previous 2 patterns if more general pattern doesn't match, you'll (likely) save on overall processing time. more can generalize, more patterns can eliminate @ once. ultimate expression of hierarchical, in patterns follow file-system-like organization of groups. while worst-case performance of system worse going through patterns, average case better different groups of patterns

javascript - JWT Refresh token using Sails JS -

i have read lot of posts nothing helped. i using simple auth approach: user logs in, backend checks if valid user , gives access token using jwt. want implement refresh token. how be? should content of refresh token? when sign new access token, should sign refresh token , send both of them? when expired access token, how verify refresh token in order send 2 new tokens? im using sails js in backend, perfect have example that well, implementation create different jwtsignature, different secret, , refresh token on backend. know it's not fancy, work now.

c# - The Same instance of a list for all elements when using Select New List<> in linq to sql -

the same instance of list elements when using select new list<> in linq sql i ran across odd behavior clarifying. have workaround issue, don’t understand why it’s happening in first place , suspect either bug linq sql or understanding things wrong. the problem having select clause on linq sql statement. consider following code, db.messagestatustypes “table”. using table in custom database doesn’t seem matter table use long there @ least 2 rows in table. list<list<string>> construct = (from o in db.messagestatustypes select new list<string>() { "hello" } ).tolist(); construct[0].add("world"); return construct[1].count(); what expect construct list of x new list. x number of rows in db. and if modify 1 of lists others not modified. not case. in example above if add string world first array, gets added x of arrays. contrast same code without linq sql list<int> ilist

Bootstrap mobile nav not showing when using angularjs -

i've added angular bootstrap project , i've noticed mobile nav button doesn't collapse menu more. working. this page have issue <!-- top nav --> <div class="container-100-percent"> <div class="navbar navbar-default navbar-fixed-top navbar-header"> <button aria-controls="bs-navbar" aria-expanded="true" class="navbar-toggle" data-target=".navbar-collapse" data-toggle="collapse" type="button"> <span class="sr-only">toggle navigation</span> <span class="icon-bar"></span> <span class="icon-bar"></span> <span class="icon-bar"></span> </button> <a href="#" class="navbar-brand">top tech jobs</a> </div> <nav class="navbar-collapse collapse"> <ul class=

c# - How to show a localized exception message -

i need show exception message wcf service in localized language, different english. example, if run instruction anywhere in code: throw new argumentnullexception(name, "el parámetro es obligatorio."); the result text "el parámetro es obligatorio. parameter name: xxxx" shown. i need "parameter name" text translated spanish. think need modify thread culture, not sure how since wcf service. if language depends on particular client, i'd create overload of functions of service additional parameter language, , set both currentculture , currentuiculture. if language not depend on client (i.e. same language whole site), set somewhen during start. note new thread inherits language windows, not parent thread, hence have set again every freshly created thread (a newer version of .net framework allows overwrite behavior). in case, make sure language pack framework installed.

java - How can a Tomcat webapp access its "maxthreads" parameter? -

our application accepts incoming requests (rest) , satisfies them using of our services. when application boots, requests number of connections other service - our goal maintain 1:1, thread-to-connection, ratio (i won't why, way). naturally, want define number of threads/connections in 1 place, thought webapp discover "maxthreads" value configured in server.xml -- without having navigate , parse server.xml file. possible? thanks i'll answer own question - jmx / mbeans.

python - Tensorflow - adding L2 regularization loss simple example -

i familiar machine learning, learning tensorflow on own reading slides universities. below i'm setting loss function linear regression 1 feature. i'm adding l2 loss total loss, not sure if i'm doing correctly: # regularization reg_strength = 0.01 # create loss function. tf.variable_scope("linear-regression"): w = tf.get_variable("w", shape=(1, 1), initializer=tf.contrib.layers.xavier_initializer()) b = tf.get_variable("b", shape=(1,), initializer=tf.constant_initializer(0.0)) yhat = tf.matmul(x, w) + b error_loss = tf.reduce_sum(((y - yhat)**2)/number_of_examples) #reg_loss = reg_strength * tf.nn.l2_loss(w) # reg 1 reg_loss = reg_strength * tf.reduce_sum(w**2) # reg 2 loss = error_loss + reg_loss # set optimizer. opt_operation = tf.train.gradientdescentoptimizer(0.001).minimize(loss) my specific questions are: i have 2 lines (commented reg 1 , reg 2 ) compute l2 loss of weight w . lin

android - Get notification when a user wants to add data to the database -

i'm begin working on recipe android app college final project, , want users able add recipes database. however, don't want data added right away, i'd receive notification whenever wants add recipe, can confirm myself. i'm using back{4}app way. how can such thing in not-so-complicated way? thinking create admin account myself in app itself, there way send notifications said account? want able confirm recipe addition simple "confirm" button within app, require me create additional class pending recipes? need admin account in case? all can achieve using cloud code. parse.cloud.define("addrecipe", function(request, response) { const query = new parse.query("recipe"); query.set("name", "name"); query.save({ success function(result) { response(result); //call push notification function client or cloud code when error nil }, error: function(res

php - When creating a client via the API, how do we assign the Client+ role and project to them? -

when creating client via api, how assign client+ role them , assign them project? i've created script redirects users projects based on email address. the client created, believe can assigned role of client (no client+ role exists). additional client plus permissions come custom permission: manage tasks, can see in database. when include permission, client never created. this code create client: $payload = [ "type" => "client", "first_name" => $first_name, "last_name" => $last_name, "email" => $email, "password" => $this->rand_string(15), "company_id" => $company, ]; $result = $this->client->post("/users", $payload); $result_json = $result->getjson(); $client_id = @$result_json['single']['id']; $payload = [ "id" => $project, "members"

colors - How to prevent a failable initializer of a Swift enum from returning nil within a range of raw numbers? -

i implemented enum represent 256 colors of color map this: enum mapcolor:uint8 { case black = 0 case white = 1 case red = 2 case lightred = 3 case orange = 7 ... case rampblue = 78 ... case rampred = 255 } however, have not given case each color in color map. added specific cases important colors want specify name, green, orange, red, yellow, gray, lightyellow, etc. allows me specify color this: let color = mapcolor.orange without worrying underlying raw value. @ same time allow me have 256 colors used in gradients in game. why between 78 , 255 specified in color map gradient of colors goes blue (rampblue) , ends in red (rampred). however, wanted implement random color generator returned raw value between 0 , 255, possible color gamut color map, this: func fillcolor() -> mapcolor { return mapcolor(rawvalue: uint8(abs(utilities.random(maximum: 255))))! } however, obviously, causes segmentation fault whenever tries initialize m

java - Created the same program where one uses generics and the other ints but the generics one does not work -

i creating program class sorts 2d array faster teacher's implementation. i decided put data bst , remove each minimum element , put new sorted array. however, i've been having trouble wrote using int instead of t, when did program worked! however, converted use generic type t, no longer sorting correctly. class below i've written , inherits method sort(t[][] input) teacher's class hybridsort. i believe problem lies somewhere in way i've been dealing generic type t , treating int (i use x.compareto(y) don't believe problem). can post code wrote using int if necessary. thanks! public class ***<t extends comparable<t>> implements hybridsort<t> { public class bst { public t value; public bst left; public bst right; public bst root; public bst() { this.value = null; this.left = null; this.right = null; } public bst(t value, bst left, bst right) { this.value = value; t

angularjs - Tab is not switching but the URL of that tab is changing -

Image
i using tabstrip , angular ui routing navigate tabs. when click on tab, url changes tab not switch. i have 3 tabs. first 2 tabs work expected. last tab not switch though url changes. here code. please let me know if need further information. it appears have k-state-active class set on particular li , since you're using ui-sref can use ui-sref-active="k-state-active" on li elements instead of class have on first, ui-sref-active state apply https://github.com/angular-ui/ui-router/wiki/quick-reference#ui-sref-active

jquery - Unable to get value from appended table td -

i having trouble getting input value of appended row using unique id numbers. returns undefined. when remove ''x'' id="aaa1'+x+'" able value when add x (used apply unique id) returns undefined. appreciated. // alert($('#a').val()); // alert($('#b').val()); // alert($('#c').val()); // alert($('#d').val()); var x=0; $('#a1').click(function(){ $('#mytable1').append( '<tr><td><input class="form-control input-sm w3-input" id="aaa'+x+'" type="text"></td><td><input class="form-control input-sm w3-input" type="text" id="bbb'+x+'"></td><td><input class="form-control input-sm w3-input" id="ccc" type="text"></td><td><input class="form-control input-sm w3-input" id="ddd"

sql - How to join according to value of a field on mysql -

i have user table in database , there user_type field, has 0 or 1. if value 0, want joined teacher table if not student table. is possible? you use cross apply or cte dont specify db using should work generic solution select t1.fields,t2.fields user_table t1 left join teacher_table t2 on t1.id=t2.id , t1.user_type_field=0 union select t1.fields,t2.fields user_table t1 left join student_table t2 on t1.id=t2.id , t1.user_type_field=1

Github Desktop unwanted file duplication -

i'm uploading website i've built onto github, via github desktop (mac). reason, every 1 of files being duplicated on upload. if have 5 files upload, github try push 10. content of duplicate files blank, except text: mac os x 2°Ă˘attrâxthis resource fork intentionally left blank ÿÿ here's screenshot of i'm seeing in github desktop app: http://i.stack.imgur.com/gmuvk.png note there 2 of every file. i've removed css , js folders reduce clutter - duplicates of content well. i've never encountered issue github desktop before. location of project not have duplicates - on github desktop these show up. perhaps 'resource fork' sentence on these duplicate files clue? my github: http://www.github.com/kylevassella it seems files generated mac os. see more information here: https://apple.stackexchange.com/a/14981 you can avoid them creating git ignore .gitignore file @ root of project , add following line ._* git ignore file beginning

swift - enumerateObjects failing on NSOrderedSet -

in swift 2 able this: let foo = nsorderedset() foo.enumerateobjects { obj, idx, _ in ... } in swift 3 i'm getting error ambiguous use of 'enumerateobjects' i'm not sure why error happening, or how fix. try this: let foo = nsorderedset(array: [1, 2, 3, 1, 1, 6, 1]) (offset,element) in foo.enumerated() { print(offset) print(element) } you can using foreach follow: foo.enumerated().foreach { print($0.offset) print($0.element) } using enumerateobjects correct syntax be: foo.enumerateobjects({ (obj, idx, _) in print(obj) print(idx) })

Android Firebase NoClassDefFoundError: com.google.firebase.FirebaseOptions after updating to the new firebase -

this question has answer here: getting exception java.lang.noclassdeffounderror: com.google.firebase.firebaseoptions after updating new firebase 13 answers i have updated application new firebase using , when compile project on device using android kitkat following exception, function on android lollipop here logcat when run on android kitkat: androidruntime: fatal exception: main process: com.lemon.kenhnhacvn, pid: 23133 java.lang.noclassdeffounderror: com.google.firebase.firebaseoptions @ com.google.firebase.firebaseapp.zzek(unknown source) @ com.google.firebase.provider.firebaseinitprovider.oncreate(unknown source) @ android.content.contentprovider.attachinfo(contentprovider.java:1591) @ android.content.contentprovider.attachinfo(contentprovider.java:1562) @ com.google.firebase.provider.firebaseinitprovider.attachinfo(unkn

ios - fetch any data that contain ID core data -

how fetch these datas [account1, account3] in [account1, account2, account3, account4, ..] (id entity) with account1 & account3 id i tried below code, got random account, not specific account 1 , account 3. var ids = [account1id, account3id] let fetchrequest: nsfetchrequest<accounts> = accounts.fetchrequest() let titlesort = nssortdescriptor(key: "type", ascending: true) fetchrequest.sortdescriptors = [titlesort] fetchrequest.predicate = nspredicate(format: "any %@ in id", argumentarray: ids) var controller: nsfetchedresultscontroller<accounts> if #available(ios 10.0, *) { controller = nsfetchedresultscontroller(fetchrequest: fetchrequest, managedobjectcontext: context, sectionnamekeypath: nil, cachename: nil) } else { // fallback on earlier versions controller = nsfetchedresultscontroller(fetchrequest: fetchrequest, managedobjectc

javascript - How to show side menu like this on mobile? -

Image
how show side menu on mobile? in image 1 when touch on left menu (see ping arrow) image 1: it's show slide menu in image 2 , how can ? image 2: css or javascript ? you need use jquery plugin this. have @ slick-app-like-sliding-menu-plugin-with-jquery-mmenu

Data Division in MATLAB Neural Network Train Command -

while training neural network in matlab using "train" command. command auto divide data training, testing, , validation sets or have divide data manually. yes, does. can divide data manually, if want to. net.dividefcn , net.divideparam fields of net object should used: t=0:0.05:8; x= sin(t); net = feedforwardnet(3); net.dividefcn= 'dividerand'; % divide data randomly net.divideparam.trainratio= 0.7; % use 70% of data training net.divideparam.valratio= 0.3; % 30% validation net.divideparam.testratio= 0; % 0% testing net = train(net,t,x); plot(t,x,t,net(t)); here example of manual data division: net.dividefcn= 'divideind'; % divide data manually net.divideparam.trainind= 1:100; % training data indices net.divideparam.valind= 101:140; % validation data indices net.divideparam.testind= 141:161; % testing data indices

tomcat - Set HTTP response headers vs Server Configuration -

i'm aware of using http response headers can force additional security measures on java web applications. example have used resp.setheader( "x-frame-options", "sameorigin" ); resp.setheader("strict-transport-security", "max-age=16070400; includesubdomains;") but still penetration test done third party(symantec) shows same issues. wondering whether have configure in application server(tomcat 6 , jboss 5 , 6) well. ref : https://www.whitehatsec.com/blog/http-strict-transport-security/

.htaccess - mod_rewrite for SEO friendly URL using htaccess -

i trying write seo friendly url of below url. www.url.com/item.php?id=_84_113_112&lang=en i have written below code: rewriterule ^(.*)/(.*)/$ item.php?id=$2&lang=$1 [qsa,l] but not working, can help? probably / @ end (before $) problem. change this. rewriterule ^(.*)/(.*)$ item.php?id=$2&lang=$1 [qsa,l]

SonarQube jenkins plugin returns "Server returned HTTP response code: -1, message: 'null' for URL: https://api.github.com/user" -

This summary is not available. Please click here to view the post.