Posts

Showing posts from June, 2010

asp.net - Correct update statement c# -

i'd know if update sql statement correct, because have form wanna edit data. but, reason, form doesn't save updates , nothing happens in db. this code-behind: using system; using system.collections.generic; using system.linq; using system.web; using system.web.ui; using system.web.ui.webcontrols; using system.data.sqlclient; using system.data; public partial class edit : system.web.ui.page { sqlconnection con = new sqlconnection("data source=cassia-pc\\sqlexpress;initial catalog=clientes;integrated security=true"); protected void page_load(object sender, eventargs e) { string v = request.querystring["id"]; sqlcommand cmd = new sqlcommand("select idcliente, nmcliente, fantasia, cpf, cep, logradouro, numero, complemento, bairro, cidade, estado, telefone, celular, insestadual, insmunicipal, email, homepage, tbclientes.tpcliente, tbtipoclientes.idtipocliente, tbtipoclientes.nmtipocliente tbclientes inner join tbtipoclie

linux - Drawtext FPS avconv -

is possible write fps drawtext off avconv, can't find information it. drawtext=fontfile=arial.ttf:text= the full command use without drawtext: avconv -f rawvideo -pix_fmt gray -r 8 -s 640x480 -i - -an -t 00:00:30 -f rawvideo -r 8 -y \"/dev/xillybus_write_32\"

matlab - Simulink: how to store a local variable in level 2 S-function? -

i'm starting msfuntmpl_basic.m , modifying output audio audio device. where can store device (dsp.audiorecorder)? the solution seems use 'persistent' attribute variable in function.

graphics - vtk projection matrix: from world to display -

i'm trying obtain 4x4 projection matrix transforms point in world display coordinates. having pixel (x, y) , corresponding z-value (from zbuffer ), obtain 3d world coordinates vtkworldpointpicker class. let's denote result x . according documentation , can compute view coordinates of world point applying matrix getcompositeprojectiontransformmatrix x . next, i'm using transformation view initial display coordinates using code found in vtkviewport::viewtodisplay (*): dx = (v[0] + 1.0) * (sizex*(v[2]-v[0])) / 2.0 + sizex*v[0]; dy = (v[1] + 1.0) * (sizey*(v[3]-v[1])) / 2.0 + sizey*v[1]; where sizex , sizey width , height of image in pixels, , v computed view coordinates. unfortunately, values not match original: display [0, 0, 0.716656] // x,y-pixel coordinates , zbuffer x = [0.0255492, -0.0392383, 0.00854707] // world coordinates (using vtkworldpointpicker) // camera->getcompositeprojectiontransformmatrix p = [ -1.84177 0 0

android - How to solve error java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0 -

this question has answer here: how solve java.lang.indexoutofboundsexception: invalid index 0, size 0? 3 answers this code used work added things contentprovider name[s]. no matter how check there wont null or empty arraylists, still same error. logcat 05-25 08:57:40.429: e/androidruntime(11600): fatal exception: main 05-25 08:57:40.429: e/androidruntime(11600): process: com.example.sillimaninquirer, pid: 11600 05-25 08:57:40.429: e/androidruntime(11600): java.lang.indexoutofboundsexception: invalid index 0, size 0 05-25 08:57:40.429: e/androidruntime(11600): @ java.util.arraylist.throwindexoutofboundsexception(arraylist.java:255) 05-25 08:57:40.429: e/androidruntime(11600): @ java.util.arraylist.get(arraylist.java:308) 05-25 08:57:40.429: e/androidruntime(11600): @ com.example.sillimaninquirer.adapter.getview(newsfeed.java:402) 05-25 08:57:40.429: e/an

ubuntu - Cannot connect to MongoDB instance on AWS EC2 instance -

Image
i have created mongodb instance on aws ec2 ubuntu instance. mongodb running , when ssh machine , run mongodb mongod console, able create databases, confident running successfully. however, not able gain access database local machine in browser. i have changed bindip in /etc/mongod.conf 0.0.0.0 , , have opened port 27017 executing sudo ufw allow 27017 browser still times out trying connect. when try configure instance using mongod --config /etc/mongod.conf , error: control [main] failed global initialization: filenotopen: failed open "/var/log/mongodb/mongod.log" this file exists! relevant portion of config file looks this: systemlog: destination: file logappend: true path: /var/log/mongodb/mongod.log i have read have enable rest interface specifying --rest , don't know how since starting database service sudo service mongod start command. my aws security settings looks this: what missing? you haven't specified mongodb ve

javascript - Multiple File Uploads As Email Attachments -

i display files before sent via email attachments. use script display files $(function(){ var ul = $('#po_award p#file_1'); $('#po_award').fileupload({ add: function (e, data) { var tpl = $('<li class="dialog"><a style="color: #777777"></a></li>'); tpl.find('a').text(data.files[0].name) .append('<a href="javascript:void(0)"><span style="color: red; float: right">delete</span></a>'); data.context = tpl.prependto(ul); tpl.find('span').click(function(){ if(tpl.hasclass('dialog')){ jqxhr.abort(); } tpl.fadeout(function(){ tpl.remove() }); }); var jqxhr = data.submit(); }, }); }); and script index , call script above <

PostgreSQL large single transaction slower than multiple transaction -

on postgres, saw case there huge amount of selects being handled in single transaction. slow, solution break selects multiple transactions, dramatically improved query time. has come across such case? seems counter intuitive , wondering if there technical reason why multiple transactions preferable? my theory it's easier db maintain acid properties multiple transactions opposed single gargantuan transaction. i wouldn't expect selects issue if there nothing writing database. there aren't locking issues there speak of in pure select statement. issues happen when there writes. if have writes, have deal fact autovacuum cannot clean items written after oldest write transaction started. if seeing issues this, critical investigate locks (in pg_locks ) can queries , functions , find out these coming from. keep in mind select not select , easy assume performance problems coming from.

excel 2013 - Power BI Service Analysis Services database connection string -

the power bi service "analyse in excel" feature produces .odc file exported, downloaded onto local machine, , when executed opens excel, creates excel cube , pivot table using power bi data. i have been trying use .odc connection file information put url can use in power query connect power bi analysis services database hosts report's data source. this connection string .odc file: <odc:connectionstring> provider=msolap.7; integrated security=claimstoken; data source=https://analysis.windows.net/powerbi/api; ; initial catalog=37c4ee9e-6cf5-49d2-aaa7-e66e42646274; location=https://wabi-west-us-redirect.analysis.windows.net/xmla?vs=sobe_wowvirtualserver&db=37c4ee9e-6cf5-49d2-aaa7-e66e42646274; mdx compatibility= 1; mdx missing member mode= error; safety options= 2; update isolation level= 2 </odc:connectionstring> the .odc file contains url in though ends in name field of excel data connection: <title>https://analysis.windows.ne

datatable select with dataview vb.net and excel -

Image
guys have problem trying sheet in excel using oledb , filter result using select statement in datatable got result.. getting sheetname without select getting sheetname select okey going answer own question maybe it’s not possible directly populate datagridview array of datarows. copytodatatable() may fix problem. ado.net: how filter data in datatable

javascript - How to Animate this Bingo? want to see ramdom image before to stop and select a image -

hi guys having trouble in code want animate before choose ball here code ' var imagesarray = []; for(var i=1;i<=75;i++) imagesarray.push(i+".png"); var usedimages = {}; var usedimagescount = 0; function displayimage() { var num =5+math.floor(math.random() * (imagesarray.length)); counter = 0; (a=0;a<num;a++) { if (!usedimages[num]){ document.canvas.src = imagesarray[num]; usedimages[num] = true; usedimagescount++; if (usedimagedcount === imagesarray.length){ usedimagedcount = 0; usedimages = {}; } } else { displayimage(); } } counter++; if (counter<100) {settimeout("displayimage(counter);",75);} else {checkmatch();} } } '

c# - browser notification only once for all opened tabs per site -

i have news site powered c# asp.net mvc 5.0 , want push notification clients browser when admin add/edit or delete news. added signalr script template used in pages. _layout.cshtml var notificationshub = $.connection.notificationhub; $.connection.hub.start(); jquery(function($) { notificationshub.client.toast = function (title, body) { var options = { body: body, }; var notification = new notification(title, options); }; }); and added code page redirects after news add/edit/delete done <script> $.connection.hub.start().done(function() { notificationshub.server.toast('@notificationhub.type.tostring()', '@html.raw(notificationhub.title)', '@html.raw(notificationhub.body)'); }); </script> when add/edit/delete news works fine problem pushes notification opened tabs in site. there trick avoid happening , show only one browser notification per site? then have know number o

Using Jupyter notebook with SparkR -

i want use jupyter notebook sparkr, want install ir kernel on jupyter installed on spark cluster. i find on using jupyter pyspark , not sparkr . i have created spark cluster on aws-emr cluster. if it's not essential use irkernel, use jupyter spark should consider installing apache toree kernel: https://toree.incubator.apache.org/ this kernel allow connect jupyter notebook spark using of spark apis. permits use of magics (eg %pyspark or %sparkr) switch between languages in different cells of single notebook.

jasmine - How to test observable containing a debounce operator? -

how 1 write jasmine test test observable debounce operator? i've followed this blog post , understand principles of how should tested, doesn't seem work. below factory using create observable: import rx "rx/dist/rx.all"; import domfactory "../utils/dom-factory"; import usernameservice "./username.service"; function createusernamecomponent(config) { const element = domfactory(config); const username = rx.observable .fromevent(element.find('input'), 'input') .pluck('target', 'value') .startwith(config.value); const isavailable = username .debounce(500) .tap(() => console.info('i never called!')) .flatmaplatest(usernameservice.isavailable) .startwith(false); const usernamestream = rx.observable.combinelatest(username, isavailable) .map((results) => { const [username, isavailable] = results; return isavailable ? username : '' })

c# - TargetInvokationException in Application.Run(new Form1()); -

i trying iterate through loop pressing start button , stop pressing stop button. using await task.run(() => works in expected manner. when press start button again, targetinvokationexception in application.run(new form1()); . my code below using system.threading; using system.threading.tasks; using system.windows.forms; namespace cancellationtest { public partial class form1 : form { private readonly synchronizationcontext synchronizationcontext; private datetime previoustime = datetime.now; cancellationtokensource cts = new cancellationtokensource(); public form1() { initializecomponent(); synchronizationcontext = synchronizationcontext.current; } private async void buttonclickhandlerasync(object sender, eventargs e) { button1.enabled = false; var count = 0; cancellationtoken token = cts.token; await task.run(() =>

c++ - How to Use SWIG for STL Maps? -

i using swig ruby. can use swig generate wrappers map using %include <std_map.i> %template(intmap) std::map<int,int>; this in interface file. example of usage 2.2.1 :001 > = example::intmap.new => std::map,std::allocator< std::pair< int const,int > > > {} 2.2.1 :002 > a[1] = 2 => 2 2.2.1 :003 > a[6] = -12 => -12 2.2.1 :004 > a[4] = 92 => 92 2.2.1 :005 > => std::map,std::allocator< std::pair< int const,int > > > {1=>2,4=>92,6=>-12} is there way define data type directly ruby type of key , value associated defined ruby ? example 2.2.1 :002 > b["asr"] = 2 => 2 2.2.1 :003 > b["tee"] = -12 => -12 2.2.1 :004 > b["wetwe"] = 92 use in interface file %include <std_map.i> namespace std { %template(imap) map<swig::gc_value, swig::gc_value>; }

azureservicebus - How to get connection string to existing servicebus without old azure portal -

due restrictions in company cannot use old azure portal. have requirement use servicebus in our project. able create servicebus ns using resource.azure.com , cannot find way connection string servicebus namespace. trying play around azure power shell, requires access old azure portal... advance. you can via powershell azure powershell cmdlets. you can find installer them via how install , configure azure powershell - see link under installing azure powershell webpi . once installed: add account first add-azureaccount enter credentials connect azure account select specific subscription want work with select-azuresubscription -subscriptionname "your_sub_name" list service bus namespaces get-azuresbnamespace all namespaces, along connection string (for rootmanagesharedaccesskey ) listed. (optional) if have specific shared access key names you've created, can them this: get-azuresbauthorizationrule -namespace your_namespace the namespace

.net - App Requirements -

Image
we've published app windows store , found there requirements (listed in bottom of app's store page) in our case following: mouse keyboard touch camera it says keyboard , touch required @ same time, app works fine touch or keyboard , mouse only. main problem store not allow user review app on device not fit requirements. result, user cannot review app on mobile phone (it doesn't have keyboard , mouse) , on desktop pc (it doesn't have touch support , camera sometimes) does know these requirements come , how can change or remove them? you set in dashboard when submit app. there checkboxes hardware preferences in submission's app properties page.

c++ - How to report a stack buffer overrun on Windows? -

in code shown below have used documented ways detect exception , produce diagnostic. uses c++ try/catch keywords, catches seh exception __try/__catch extension keywords, uses windows' addvectoredexceptionhandler() , setunhandledexceptionfilter() winapi functions install veh/seh filters. running visual c++ 2003: /gs: outputs "hello,world!" , terminates exit code 0. /gs-: outputs "hello,world!" , terminates exit code 0. running visual c++ 2013: /gs: no output, terminates exit code -1073740791 /gs-: outputs "hello,world!" , terminates exit 0. how produce diagnostic in vs2013 compiled program /gs in effect? #include "stdafx.h" #include <windows.h> #define call_first 1 #define call_last 0 long winapi myvectoredhandler(struct _exception_pointers *exceptioninfo) { unreferenced_parameter(exceptioninfo); printf("myvectoredhandler\n"); return exception_continue_search; } long winapi m

java - lwjgl attach or union shapes to make transparancy look correct -

Image
i've been trying figure out while now. there way have multiple shapes have rendered become 1 single object? manipulate object in way want? if try use glcolor method doesn't change because have multiple colors changing objects already. maybe i'm not realizing obvious, or it's can't find in tutorial. put i'm looking way change alpha value of multiple shapes draw make more complex shape, keeping colors have been predefined. if want multiple shapes become 1 single object calculate or write correct x, y, z numbers each vertex, fit together. for instance can make 2 triangles become square, this. to same in code this. glbegin(gl_triangles); glvertex3f(0f, 0f, 0f); glvertex3f(0f, 100f, 0f); glvertex3f(100f, 0f, 0f); glvertex3f(100f, 100f, 0f); glvertex3f(100f, 0f, 0f); glvertex3f(0f, 100f, 0f); glend(); you can of course use gl_quads , though triangles better in lot of ways. if want color shape 1 color, need , can write 1 color before. so ins

php - Is it possible to know all potential parameters of url? -

i have api link poor documentation. let's say: http://link.com/?<parameter>=### is possible know potential parameters of url link without contacting admin of site? with array_keys(), can return keys of array. know $_get array have query string keys , values. below command can printing keys passed page: print_r(array_keys($_get)); instead of printing array, can use want.

openerp - How to set default value for fields in odoo 8? -

i created checkbox , want set default value false unchecked default.i tried in 4 ways still checkbox checked default. raw = fields.boolean(default=0) raw = fields.boolean(default='0') raw = fields.boolean(default=false) raw = fields.boolean(default='false') default it's none boolean field not false(you can check database without setting default value of boolean field, see there none not false), need set raw = fields.boolean(string='raw', default=false)

R: dplyr group by date range -

i'm trying group data frame 3 date ranges based on "2016-04-10" , "2016-04-24". df <- structure(list(date = structure(c(16803, 16810, 16817, 16824, 16831, 16838, 16845, 16852, 16859, 16866, 16873, 16880, 16887, 16894, 16901, 16908, 16915, 16922, 16929, 16936, 16943), class = "date"), new = c(1507l, 2851l, 3550l, 5329l, 7557l, 5546l, 6264l, 7160l, 9468l, 5789l, 5928l, 4642l, 8145l, 4867l, 4846l, 5231l, 7137l, 3938l, 3741l, 2937l, 194l), resolved = c(21, 27, 15, 16, 56, 2773, 8490, 8748, 9325, 7734, 10264, 6739, 6110, 9613, 10314, 10349, 7200, 9637, 10831, 11170, 5666), ost = c(1486, 2824, 3535, 5313, 7501, 2773, -2226, -1588, 143, -1945, -4336, -2097, 2035, -4746, -5468, -5118, -63, -5699, -7090, -8233, -5472)), class = c("tbl_df", "tbl", "data.frame"), row.names = c(na, -21l), .names = c("date", "new", "resolved", "ost")) tried fo

angularjs - pass data between controllers -

Image
i'm stating learn angularjs, coming lot of different mv* frameworks. framework, i'm having trouble passing data between controllers. suppose have screen input (input.html) , controller, let's inputctrl. there's button on view takes screen, let's approve (approve.html) controller approvectrl. approvectrl needs data inputctrl. seems common scenario in bigger applications. in previous mv* frameworks, handled (pseudo-code): var self = this; onclick = function() { var approvectrl = di.resolve(approvectrl); approvectrl.property1 = self.property1; approvectrl.property1 = self.property2; self.router.show(approvectrl); } it work controller- first. create controller first, having chance put in right state; afterwards view gets created. now, in angularjs, i'm handling like: var self = this; onclick = function(){ self.$locationservice.path('approve'); } this wor

What is the best way to connect two many-to-many (belongsToMany) together in laravel? -

i have 2 working many-to-many ( belongstomany ) relations. looking third connection connects these 2 relations together. doing myself in manual way wonder if there built in laravel way. plus efficient , proper way accomplish this? here short presentation of tables: users name email password role_user role_id user_id roles name permission_role permission_id role_id permissions name route the users table related roles belongstomany using role_user pivot table, permissions table related roles table using permission_role table. okay how relate users , permissions together. how can $permissions = app\user::find(1)->permissions()->get(); done in laravel way. i can't use hasmanythrough relation because none of tables users , roles , permissions have relating columns users.role_id or roles.user_id use

javascript - jQuery toggle with gsap animation -

i want toggle div add height 10px 200px.. problem if click again animate 200px 10px. , dont know do. heres code. the css .container2 { width: 100%; height: 10px; border: 1px; } .container .box { padding: 10px; margin: 10px; background: blue; display: none; } the html <div class="container2"> <div class="box bouncein"></div> </div> the javascript var con = $('.container2'); var box = $('.box'); var click = $('.click'); click.click( function() { tweenmax.to(con, 1, {height: '200px', ease:bounce.easeout}); }); this code toggle , forth between 2 states. var clicked = false; click.click(function() { if(clicked){ tweenmax.to(con, 1, {height: '10', ease:bounce.easeout}); }else{ tweenmax.to(con, 1, {height: '200', ease:bounce.easeout}); } clicked = !clicked; });

PHP Form to Insert data in Database -

i've created form inserts data database. i've been given 2 functions data , display it, these located in file called querydb.php: function addcustomer($fname, $lname, $address, $phone) { $db = new mydb(); if(!$db){ echo '<script type="text/javascript">alert("'.$db->lasterrormsg().'");</script>'; } else { //echo "opened database successfully\n"; } $sql ='insert customers (firstname, lastname, address, phone) values ("'.$fname.'", "'.$lname.'", "'.$address.'", "'.$phone.'");'; $db->query($sql); } get function: function getcustomers($searchterm = null) { $db = new mydb(); if(!$db){ echo '<script type="text/javascript">alert("'.$db->lasterrormsg().'");</script>'; } else { //echo "opened database succe

git - Gitlab CI vs Jenkins -

can please let me know difference between jenkins , other ci gitlab-ci, drone.io coming git distribution. on research come gitlab community edition doesn't allow jenkins added gitlab enterprise edition does. there other significant differences. this experience: at work manage our repositories gitlab ee , have jenkins server (1.6) running. in basis pretty same. run scripts on server/docker image. tl;dr; jenkins easier use/learn has risk become plugin hell jenkins has gui (this can preferred if has accesible/maintainable other people) integration gitlab less gitlab-ci jenkins can split off repo most ci servers pretty straight forward ( concourse.ci , gitlab-ci , circle-ci , travis-ci , drone.io , gocd , else have you). allow execute shell/bat yaml file definition. jenkins more pluggable, , comes ui. can either advantage or disadvantage, depending on needs. jenkins configurable because of plugins available. downside of ci server can become spaghetti of

python - How to TABLESAMPLE with SQLAlchemy? -

is possible tablesample on of tables in orm query in sqlalchemy? the closest find query.suffix_with(*suffixes) , places suffix on end of query, rather on end of table. if helps, use case: my query currently: query = session.query(a).options( subqueryload(a.rel1), subqueryload(a.rel2) ).filter(a.id >= min_id, a.id < max_id, [...]) and tablesample on table a efficiently load subset of a , corresponding relations, filters. using postgresql 9.5 database. update sqlalchemy 1.1 , newer support tablesample selectables. fromclause elements have method fromclause.tablesample() (think table s) , sqlalchemy.tablesample() function can used selectables, example declarative model classes: from sqlalchemy import tablesample, func sqlalchemy.orm import aliased # create alias uses system sampling method (default) a_sampled = aliased(a, tablesample(a, 2.5)) # create alias uses bernoulli sampling method a_bernoulli = aliased(a, tablesample(a, func.berno

How to display background image in servlet -

Image
this question has answer here: browser can't access/find relative resources css, images , links when calling servlet forwards jsp 7 answers <?xml version="1.0" encoding="utf-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemalocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="webapp_id" version="2.5"> <display-name>servletapplication</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-

Jolt transformation with nested arrays. -

i'm trying write spec below transformation using jolt transformation. i'm interested in changing name of key in json, value should remain same. me out. input json: [ { "list1": [ { "id": "cpp1600000009846", "list2": [ { "amount": { "formattedprimeamount": "0.00", "primeamount": "0.00" }, "code": "conamp" }, { "amount": { "formattedprimeamount": "0.00", "primeamount": "0.00" }, "code": "pccpri" }, { "amount": { "formattedprimeamount": "0.00", "primeamount": "0.00" }, "code&qu

mysql - Getting the database structure of my existing database -

is possible database doesn't have database schema or information schema because have existing database, , want have database structure of it. can't able structure of select * information_schema.columns table_schema = 'test' , table_name ='products'; it gives error message information_schema doesn't exist. thanks!

GWT htmlDialogBox: How to set the size to wider width -

i want resize htmldialogbox wider width. have now. half of html cut off. want display entire html in htmldialogbox. gwt version: 2.8.0-snapshot verticalpanel = new verticalpanel(); verticalpanel.setspacing(0); setwidget(verticalpanel); verticalpanel.setsize("100%","100%"); scrollpanel = new scrollpanel(); verticalpanel.add(scrollpanel); htmldialogbox = new html(); verticalpanel.add(htmldialogbox); scrollpanel.setwidget(htmldialogbox); htmldialogbox.setsize("100%", "100%"); htmldialogbox.sethtml(html); setglassenabled(true); setanimationenabled(true); setpopupposition(clientutils.dialog_x_position,clientutils.dialog_y_position); show(); i find own answer. change setanimationenabled(true); setanimationenabled(false);

How to disable access security notice "A Potential security concern has been identified" -

Image
i have shared access application, created accde file 32-bit machine, when user open application he/she getting security warning is there way disable message appearing users thank you you have set computer trusted source. in order around issue, need create digital certificate. digital certificates on computer created on, if database used on multiple computers each 1 have create digital certificate. to this, need perform following tasks: click on start -> programs -> microsoft office -> microsoft office tools -> digital certificate vba projects (if don’t have this, need contact dept.) enter certificate name. make obvious myprogramname , click ok open access database contains security warning want bypass go design view of module click on tools -> digital signature choose digital certificate created in step 2 save , close database re-open database. prompted different security warning states file has been digitally signed. check off “alway

arduino - Find infrared hex code of toshiba wc-l03se -

i'm student, in homework, have use arduino control air conditioner: toshiba wc-l03se. i know how use arduino remote, don't know infrared hex code of wc-l03se, cannot find on internet so cannot control air conditioner please me! , sorry bad english thank

css - Display table and table-cell bug in Chrome -

Image
html <div class="circle"> <div class="content"> <span><h3>heading</h3><p>slogan goes here</p></span> </div> </div> css .circle { position: relative; width: 0; height: 0; padding: 20%; margin: 1em auto; border-radius: 50%; background: #a7cd80; } .content { position: absolute; top: 0; left: 0; width: 100%; height: 100%; display: table; overflow: hidden; } .content span{ display: table-cell; vertical-align: middle; text-align: center; } h3{ line-height: 1px; } this code working in firefox not in chrome etc. text displaying table-cell in firefox not in others text centered horizontally , vertically in circle in firefox. demo you see visually it because have given .circle width , height of 0, means there no space inside object , when give width , height of span 100%, it's actual width , height 0 if give circle actual width , hei

ios - How do I implement delegate methods through Swift extension -

my project mix of obj-c , swift, , i'm trying extend appdelegate class swift. so right have appdelegate.m , appdelegate.h , , appdelegate.swift . of methods in obj-c file, i'm trying implement 1 of methods: extension appdelegate { func application(application: uiapplication, continueuseractivity useractivity: nsuseractivity, restorationhandler: ([anyobject]?) -> void) -> bool { } } however it's complaining: appdelegate.swift:11:10: method 'application(_:continueuseractivity:restorationhandler:)' objective-c selector 'application:continueuseractivity:restorationhandler:' conflicts previous declaration same objective-c selector is limitation of swift extension? or there way implement delegate method in swift extension file? you cannot that. appdelegate has defined method ( uiapplicationdelegate protocol says so). the simplest solution rewrite appdelegate in swift. you have more difficult solution - remove uiapplica

javascript - Contenteditable div with max length and jquery -

there following task - need prevent input more n symbols in contenteditable div native js / jquery, i.e. user inputs 10 symbols , can't input more, clear. <div contenteditable="true" placeholder="Текст сообщения" class="editable ng-valid ng-valid-maxlength ng-dirty ng-valid-parse ng-touched"></div> this should work fiddle here $('#editcontent').on('keydown', function(event) { $('span').text('characters entered:' + $(this).text().length); if ($(this).text().length === 10 && event.keycode != 8) /*delete*/ { event.preventdefault(); } }); body { padding: 10px 0 0 10px; } #editcontent { width: 200px; height: 50px; border: 1px solid blue; } #editcontent:after { color: #999; content: 'enter text'; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <div id="editcontent

javascript - How to calculate page load time in mobile? -

for calculating page load time in desktop there several extensions in chrome , firefox. don't find type of extensions in mobile browsers? how can calculate page load time in mobiles? you can try using performance timing api, supposed measure relative performance.fetchstart (when page started load). time 0 measured when page starts being fetched (performance.fetchstart), , calls performance.now fetch time in milliseconds relative fetchstart . i don't think need put script in head did below since time measurement relative page fetch done when page "load" event fires , triggers callback. <!doctype> <html> <head> <!-- head content stuff --> <script> document.addeventlistener("load", function(event) { var t1 = performance.now(); console.log("pageload duration: " + t1 + " milliseconds.") }); </script> </head> <body> <!-- pag