Posts

Showing posts from February, 2011

html - How to prevent contents from going outside its container -

Image
i'm developing wordpress responsive theme blog. structure of theme. content goes in div "post". how make elements in div "post" take width it's container. elements images, texts displayed fine embedded code youtube videos, tweets, , facebook looks cropped in mobile browser. current css code is: .container{ display: flex; } .content-area{ margin: 10px; flex: 3; order: 1; border-radius: 3px; } .sidebar{ margin: 10px; flex: 1; order: 2; } .post{ background-color: #fbfbfb; padding: 10px; border-radius: 3px; } .post img{ width: 100%; } it sounds you're embedding <iframe> elements when mention facebook, twitter , youtube. if so, simple rule following solve problem: iframe { max-width: 100%!important; }

cuda - calling Thrust device_vector from a device function -

i have struct cap inside have thrust::device_vector of structure. when compile code, error complains calling host function ( thrust::device_vector<floatintpair> ) device function sphericalfacemanager::makecaps . when add __host__ __device__ instead of __device__ member functions , constructors code compiles receive warning same aforementioned error , think copies data between host , device. question how can access device vectors in classes avoiding data transfer between cpu , gpu? hereafter can find code: struct particleid { int solver; int ngb; int oldngb; llint no; llint masterno; __device__ particleid() { solver = -8; ngb = 0; oldngb = 0; no = 0; masterno = -1; } }; struct baseparticle { float h; float3 pos; particleid id; __device__ baseparticle(const float3& _pos, const float& _h, const particleid& _id) : h(_h), pos(_pos), id(_id) { } }; struct floatintpair{ float first; int second; __device__ floatintpair(const flo...

javascript - Why am I getting an error with this 2d array? -

var arr = [[],[]]; var si = 5; var c = 0; if (arr[si][c] == null) { arr[si][c] = { code : "test", }; } alert(arr[si][c].code); hello, trying run sample code getting error, saying attribute "0" of undefined can not called. the awkward thing if use numeric values instead of variables "si" , "c" index, error doesn't show up! is possible in js can not use variables index? think work non 2 dimensional array. thank , best regards javascript doesn't have concept of 2 dimensional arrays. arrays contain other arrays. arr[si][c] arr[5][0] . arr array 2 members ( 0 , 1 ), each of array. when access arr[5] undefined because have gone beyond end. undefined[0] error. the awkward thing if use numeric values instead of variables "si" , "c" index, error doesn't show up! you same error if use literals instead of variables. presumably working test involved different nu...

matlab - How to load variables from a parent code? -

i have following "parent" code, call solve.m : s1 = .01; v = 1; fun1 = @rootd; x0 = [.2, .3, .4] options = optimset('maxfunevals',100000,'maxiter', 10000 ); x1 = fsolve(fun1,x0, options) i have following code function rootd.m function d = rootd(x1) f = @(p) 1 - ((3.*x1(3).^2 - 7.*x1(3) + 6).*(x1(2)./p -1))./(2.*x1(3).*(1-x1(3))); h = @(p) (1 - ((3.*x1(3).^2 - 7.*x1(3) + 6).*(x1(2)./p -1))./(2.*x1(3).*(1-x1(3)))).^2; f1 = @(p) 1 - ((6 - 7.*x1(3) + 3.*x1(3)^2).*(min(v,x1(2))./p - 1 ))./(2.*x1(3).*(1-x1(3))); h1 = @(p) (1 - ((6 - 7.*x1(3) + 3.*x1(3)^2).*(min(v,x1(2))./p - 1))./(2.*x1(3).*(1-x1(3)))).^2; g = @(p) integral(@(p) f(p), x1(1), x1(2)); f = @(p) integral(@(p) f1(p), x1(1), (min(v,x1(2)))); h = @(p) integral(@(p) h1(p), x1(1),(min(v,x1(2)))); d(1) = g(x1) - s1; d(2) = x1(3).*(2-x1(3)).*(v - min(v, x1(2))) - (((x1(3)^2)/2).*h(x1)) + (2.*x1(3)... - (1/2).*x1(3).^2).*f(x1) - ((v-min(v, x1(2))) + f(x1) -s1); d(3) = (6 - 7.*x1(3) + 3.*x1...

javascript - Shortcut for accessing member of an object [, of an object...] -

this question has answer here: javascript test existence of nested object key 41 answers is there short way accessing nested object without checking each parent object? this throw exception if foo or bar undefined: var exists = (foo.bar.value !== undefined); i expect check function like: var exists = object.exists(foo.bar.value); is there build-in javascript? use typeof if (typeof myobject!= "undefined") { console.log('it exists') }

How to create generator to merge values from iterables in Python? -

i want create generator, can merge values iterables on fly (continuously) in endless look. the main idea, generator produce values output each time, when ask it. so, main function endless loop, ask generator values 1 one , print them output. while values comes iterators generator returns values 1 one print them output. now, in code i'm passing values 1 list . not necessary collect values 1 single list before print. def merge(*iterables): # create generator generator = (iter(current) current in iterables) # convert generator list iters = list(generator) # while have iterable while iters: #loop through each iterable in iters: try: # yields values 1 one yield i.__next__() except stopiteration: iters.remove(i) when i'm running this: >>> callmerge([1,5,9],[2,5],[1,6,10,11]) result is: [1, 1, 2, 5, 5, 6, 9, 10, 11] to clear have example: lets imagine taking balls numbers (like bingo) several bla...

sql - Instead of the set of "?" use an array -

how make request without using lot of characters, , use array instead of them? inside array @rowcashiergrps numbers "0001,0020,0027,0700"; i tried not work. first: use strict; use warnings; use dbix::simple; $dbfile='dptdat.db'; $db = dbi->connect("dbi:sqlite:$dbfile", "", "", $result = $db->query( 'select b.id,cashnum,f1,f2,f3,f4,f5,sum(f6),sum(f7),sum(f8) ckrdata inner join ckrdatcashiername b a.id =b.id , b.cashnum =? group f1,b.id order b.id,f1', @rowcashiergrps); second: use strict; use warnings; use dbi; $dbfile='dptdat.db'; $db = dbi->connect("dbi:sqlite:$dbfile", "", "", {raiseerror => 1, autocommit => 1}); $sqlt = "select b.id,cashnum,f1,f2,f3,f4,f5,sum(f6),sum(f7),sum(f8) ckrdata inner join ckrdatcashiername b a.id = b.id , b.cashnum in (" . "join(', ', ('?') x @rowcashiergrps)" . "group f1, b.id ord...

swift - AKSwiftSlideMenu activity indicator -

i using akswiftslidemenu project web , trying put activity indicator display indicator when user pressed menu bars on top right. tried everything. there way once user pressed 3menubar @ top display activity indicator until menu appear side. i database processing build menu item before slide out. since akswiftslidemenu using uinavigationcontroller , can add uiactivityindicator on right side of navigation controller. something that: func showactivityindicator() { let activityindicator = uiactivityindicatorview(frame: cgrect(x: 0, y: 0, width: 20, height: 20)) let barbutton = uibarbuttonitem(customview: activityindicator) self.navigationitem.setrightbarbutton(barbutton, animated: true) activityindicator.startanimating() } don't forget, need prevent segue happening, , halt program until done loading.

python - Globally available object in django for frequent acess -

i'm relatively new django & learning bit-by-bit. i've subscribed service, uses dll provide data need. required data service, have make few initializations; code takes around 2-3 seconds (requires dispatching dll, , making init call follows:) from win32com.client import dispatch #pythoncom.coinitialize() zk = dispatch("easyconnect.serverside") print(zk.cmdinit(my_id, my_pass, server_ip)) i need zk object available globally, other modules not have perform init ambiguously , speed data access process. i tried django's caching framework , helps caching entire site, or web pages, think it's not want. also, putting zk cache returns me error states cannot put cache. what alternatives address problem? yes can define client globally , access in other modules, problem client initialized app loaded not want connection time during app loading want start client when need , once hence need django.utils.functional.lazyobject (a wrapper class can...

html lists - Mathjax font size shrinks when playing with `position` CSS attribute -

i want make html document list of math formulas mimicking \itemize latex environment (i.e. markers should "1), 2), etc") , have two-columns layout. for math formulas use mathjax, markers used css trick @ https://stackoverflow.com/a/1636635/3025740 , two-columns use css property column-count adding vendor-specific properties in http://www.w3schools.com/cssref/css3_pr_column-count.asp any 2 of these 3 mechanisms seem work fine, when mix 3 of them not: font size of math formulas (recall, rendered mathjax) way small. here minimal code reproduce problem (tested on ubuntu 16.04 lts firefox 49.0.2) <html> <head> <meta charset="utf-8"> <script type="text/javascript" async src="https://cdn.mathjax.org/mathjax/latest/mathjax.js?config=tex-mml-am_chtml"> </script> <style media="screen"> ol { counter-reset: list; } ol > li { list-style: none; /*r...

Firebase Rules for a Chat feature -

Image
in project have chat feature allow users speak in private message. it's one-to-one, improved later allow group discussion. currently i'm struggling custom rules. indeed, projet need users have theirs own list of discussion. example, user , b talk through private message, user c, d or whatever shouldn't able read discussion. here how database json : { "room-messages": { "-kwgoxt567vzgxz-1gii": { "-kwgoxt567vzgxz-1gii": { "name": "friendly chat", "sent": 1479294463723, "text": "nice ! have created new chat", "uid": "user_a_id" }, "-kwh5_w12qsxfajhyovx": { "name": "lucien guimaraes", "sent": 1479294463728, "text": "a text message", "uid": "user_b_id" } }, ...

plsql - Grant permission to queues to another schema in oracle -

hi have oracle queue in 1 schema namely aqs sample queue begin dbms_aqadm.create_queue( queue_name => 'aqs.mob_msg', queue_table => 'aqs.mob_qt', queue_type => 0, max_retries => 5, retry_delay => 0, dependency_tracking => false, comment => 'sample'); end; i have corresponding queue table created.it works fine. now want provide select grant queue using schema named "mob".how provide grant schema queue?do need provide select access queue or queue table. i tried using grant select on aqs.mob_msg mob , not working! saying object not exists. execute dbms_aqadm.grant_queue_privilege ( privilege => 'all', or (enqueue) or (dequeue) queue_name => 'aqs.mob_msg', grantee => 'grantee_user', grant_option => false/true); if want grant direct ac...

boot2docker - How can I install docker toolbox on windows 7 -

Image
docker , kitematic can't launch after successfull installation of docker-toolbox. i have error when launching kitematic : error: connect enoent //./pipe/docker_engine and : command failed: c:\program files\docker toolbox\docker-machine.exe -d create -d virtualbox --virtualbox-memory 2048 default,docker machine version: 0.8.2, build e18a919,found binary path @ c:\program files\docker toolbox\docker-machine.exe,launching plugin server driver virtualbox,plugin server listening @ address 127.0.0.1:53159,() calling .getversion,using api version 1,() calling .setconfigraw,() calling .getmachinename,(flag-lookup) calling .getmachinename,(flag-lookup) calling .drivername,(flag-lookup) calling .getcreateflags,found binary path @ c:\program files\docker toolbox\docker-machine.exe,launching plugin server driver virtualbox,plugin server listening @ address 127.0.0.1:53163,() calling .getversion,using api version 1,() calling .setconfigraw,() calling .getmachinename,(default) callin...

amazon web services - Why are CloudWatch Logs sent from my Windows EC2 Instance not showing up on AWS Console? -

Image
i have set cloudwatch logs on ec2 windows server-r2 doesn't show on aws console. (my iam user has fullaccess) https://aws.amazon.com/blogs/devops/using-cloudwatch-logs-with-amazon-ec2-running-microsoft-windows-server/ my cloudwatch json file looks below: { "engineconfiguration": { "pollinterval": "00:00:15", "components": [ { "id": "applicationeventlog", "fullname": "aws.ec2.windows.cloudwatch.eventlog.eventloginputcomponent,aws.ec2.windows.cloudwatch", "parameters": { "logname": "application", "levels": "1" } }, { "id": "systemeventlog", "fullname": "aws.ec2.windows.cloudwatch.eventlog.eventloginputcomponent,aws.ec2.windows.cloudwatch", "parameters": { "logname": "syste...

php - Connection between two servers using Federated -

i have 1 database in server application running in server b so, in order separate information, used federated in server b access tables server a. tried 2 things: create server s foreign data wrapper mysql options (database 'xpto', user 'aaa', password 'aaa', host 'servera'); create table if not exists `test` ( `col1` int(11) not null auto_increment, `col2` int(11) not null, primary key (`col1`) ) engine=federated default charset=utf8 connection='s'; and tried this: create table if not exists `test` ( `col1` int(11) not null auto_increment, `col2` int(11) not null, primary key (`col1`) ) engine=federated default charset=utf8 connection='mysql://aaa:aaa@ip_address:3306/xpto/test' the problem have lot of connections. 1 connection foreach table , every time execute query again, creates new connection. if have 11 tables, creates 11 connections, after executing again, 11+11 connections = 22 connections, , on... afte...

subprocess - Issue with sharing data between Python processes with multiprocessing -

i've seen several posts this, know straightforward do, seem coming short. i'm not sure if need create worker pool, or use queue class. basically, want able create several processes each act autonomously (which why inherit agent superclass). at random ticks of main loop want update each agent. i'm using time.sleep different values in main loop , agent's run loop simulate different processor speeds. here agent superclass: # generic class handle mpc of each agent class agent(mpc.process): # initialize agent parameters def __init__(self,): # init mpc mpc.process.__init__(self) self.exit = mpc.event() # agent's main loop...generally should overridden def run(self): while not self.exit.is_set(): pass print "you exited!" # safely shutdown agent def shutdown(self): print "shutdown initiated" self.exit.set() # safely communicate values agent def communicate(self,value): print value ...

C++14 Syntax in Eclipse CDT compiles but marked as syntax error (indexer) -

Image
eclipse cdt gives me syntax error valid c++14 syntax. compiles , runs syntax highlighting broken. i have mingw , eclipse running. c++14 program compiles , executes incorrect syntax highlighting / syntax checking. here source code: #include <iostream> auto main() -> int { //binary literals c++14 digit separators c++14 auto 7 = int{0b0000'0111}; std::cout << 7 << std::endl; std::cout << __cplusplus << std::endl; return int{0}; } and here output / build log. can see compiler settings ( -d__gxx_experimental_cxx0x__ -o0 -g3 -wall -c -fmessage-length=0 -std=c++14 ) , highlighting in it. what need setup syntax detecition allows c++14 syntax? edit: seems indexer right bet - unable make indexer work intended. on windows 7 using mingw. open providers , click on "cdt built-in compiler settings mingw" add -std=c++14 . whole string ${command} ${flags} -e -p -v -dd "${inputs}" -std=c++14 after hit appl...

Looking for a headless driver for a C# Selenium test framework -

currently running test automation on microsoft crm using c# .net test framework supporting ie. know if there exists headless browser driver can replace existing ie driver. phantomjs looking for.

java - Run specific Android test with gradle -

i need execute android test case (class or method) gradle console. located @ src/androidtest/java/com/example/certaintest.java . android studio makes available via complicated adb shell instrument . is possible invoke android test via gradle? i have read how run 1 test class on gradle , test command line quite complicated way of doing that. this how android studio launches specific test class: launching tests $ adb push /.../app/build/outputs/apk/app-debug.apk /data/local/tmp/com.example.andrii.espressotutorial $ adb shell pm install -r "/data/local/tmp/com.example.andrii.espressotutorial" pkg: /data/local/tmp/com.example.andrii.espressotutorial success $ adb push /.../app/build/outputs/apk/app-debug-androidtest.apk /data/local/tmp/com.example.andrii.espressotutorial.test $ adb shell pm install -r "/data/local/tmp/com.example.andrii.espressotutorial.test" pkg: /data/local/tmp/com.example.andrii.espressotutorial.test success running tests $ adb...

javascript - Why do these values repeat when outputted from my .ajax() request? -

i have no idea what's going on snippet of code. i'm trying output values json request using .ajax(). this line of code: $.each(posts, function(k, v){ $("section ul").append("<li><p>" + v.webtitle + "</p></li>"); }); outputs title of each post in p tag on 1 line. added pull thumbnail url too $("section ul li").append("<p>" + v.fields.thumbnail + "</p>"); however, line outputs this json preview could tell me: why happening images not text how can amend code output 1 image per list item i think should work $.each(posts, function(k, v){ var li = $("<li>"); // create single li element li.append("<p>" + v.webtitle + "</p><p>" + v.fields.thumbnail + "</p>"); // append before lose reference $("section ul").append(li); // append once ul }); the main idea ...

javascript - Why do the images in my gallery return 403 errors? -

i trying build basic gallery , can't images show. if access image in tab directly image displaying correctly in angular. browser can display image if accessing url directly, unable angular. 1 of images: https://lookpic.com/o/i2/593/ehc7oq7d.jpeg gallerycomponent: import {component, input, elementref} "@angular/core"; import {http, response} "@angular/http"; import {logger} "angular2-logger/core"; import {imagemodel} "app/core/index"; @component({ selector: "[app-gallery]", template: ` <div class="gallery--main"> <img [src]="src"> <div *ngif="images.length > 1"> <span class="prev" (click)="prev()"><i class="fa fa-chevron-left"></i></span> <span class="next" (click)="next()"><i class="fa fa-chevron-right"></i></span> </div> <ul class=...

asp classic - Multiple fields to display from Access DB to simple table in asp page -

i need have series of tables on page each have list of categories. each category has salary , number of respondents. said , done, should on page: https://i.stack.imgur.com/rk5xa.jpg my database looks this: https://i.stack.imgur.com/bqoz3.jpg i tried this: <% until myresults.eof %> <tr> <td><% response.write myresults.fields.item("categories").value %></td> <td><% response.write myresults.fields.item("salary").value %></td> <td><% response.write myresults.fields.item("respondents").value %></td> </tr> <% myresults.movenext loop %> ...but shows all of information in database. example need ones under "bybusinesssector" show in table. (and yes, in classic asp. can't other version @ time due company wanting format.) i don't know if built database wrong including informat...

android - onTaskRemoved() not getting called in HUAWEI and XIOMI devices -

i've been using ontaskremoved() method in service detect when app removed device recent list swiping away. preform logging , other operations need take place when happens. works perfectly. then checked method in huawei device running android 6.0. method never gets called. added log.d call , expected, log never appeared. same happens on xiomi device. any ideas why happens , how resolve this? or there way detect app removed recent list out relying on ontaskremoved() ? thanks when user has installed app on xiaomi device, redirect user auto start activity , tell user switch on: if (build.brand.equalsignorecase("xiaomi")) { intent intent = new intent(); intent.setcomponent(new componentname("com.miui.securitycenter", "com.miui.permcenter.autostart.autostartmanagementactivity")); startactivity(intent); } use above code launch autostart activity page on xiaomi

javascript - password regex - raw brace is not allowed in regular expression with unicode flag -

i using jquery plugin bootstrap validator real-time frontend validations. when add pattern/regex validation validate password (any string @ least 8 characters long), following error unable check <input pattern='^.*{8,}$'> because pattern not valid regexp: raw brace not allowed in regular expression unicode flag the html is <input pattern="^.*{8,}$" class="form-control" required="required" name="user[password]" id="user_password" type="password"> how should write regex ? you should use ^.{8,}$ instead. this regex valid char - 8 times or more. note allow spaces inside password. if want allow char not space, can use ^[^\s]{8,}$ instead. your current regex accept char ( . ) - number of times (*), , accept (the "any char number of times") @ least 8 chars {8,} (which makes no sense).

Visual Studio 2017 RC install error 0x80131500 Failed to deserialize packages -

i'm trying install new visual studio 2017 rc on 1 on machines. first attempt failed during download because of not enough free disc space. after each try of install again results in following error/excpetion: 2016-11-17t16:50:08 : error : failed installed product summaries. [installerid: setupengine, error: jsonreaderexception @ bei newtonsoft.json.jsontextreader.readstringintobuffer(char quote) bei newtonsoft.json.jsontextreader.parsestring(char quote, readtype readtype) bei newtonsoft.json.jsontextreader.readstringvalue(readtype readtype) bei newtonsoft.json.jsontextreader.readasstring() bei newtonsoft.json.serialization.jsonserializerinternalreader.readfortype(jsonreader reader, jsoncontract contract, boolean hasconverter) bei newtonsoft.json.serialization.jsonserializerinternalreader.populateobject(object newobject, jsonreader reader, jsonobjectcontract contract, jsonproperty member, string id) bei newtonsoft.json.serialization.jsonserializerinternal...

jquery - Canvas drawImage() not working - Javascript game -

i have been working on snake game in javascript using html 5 canvas. game works no errors , image being loaded webpage, image not drawn. <script> $(document).ready(function(){ // canvas context var cvs = $("canvas").get(0); var ctx = cvs.getcontext("2d"); // declare variables var food; var snake; var grid = 20; var h = cvs.height; var w = cvs.width; var apple = new image(); //makes canvas sharp cvs.width *= 2; cvs.height *= 2; cvs.style.width = cvs.width / 2; cvs.style.height = cvs.height / 2; ctx.scale(2, 2); function init(){ apple.src = "food.png"; keypress(); reset(); setinterval(draw, 1000 / 10); } function reset(){ snake = { direction: "right", x: 0, ...

DirectShow SNDDEVInError device error -

sometimes when invoking "imediacontrol::run" snddevinerror error occurs output prameters 1 , 4. according msdn first parameter (1) means error in opening device ( https://msdn.microsoft.com/en-us/library/windows/desktop/dd377614(v=vs.85).aspx ). second parameter have no idea meaning of second parameter is. can tell why error happens? besides, seams sound input device randomly disconnects, regardless if internal soundcard or usb acquisition sound card.

Cannot create circular shadow in Adobe Edge animate CC -

i developing infographic timeline, in circles act buttons. want create "pulsing" button effect using keyframed shadows of circular button(drawn in animate). works fine, before convert button symbol set hovering play/pause states. circle occurs wrapped square , getting square shadow. there way fix problem? screenshot of problem the answer is: wrap circle div , convert div symbol

algorithm - calculating point of intersection between far or near plane and a triangle -

Image
suppose, near , far values of gluperspective 1 , 100 respectively. want clip portion of triangle having z values greater (-near) or less (-far) , divide remaining polygon 2 triangles following images. considering far plane: considering near plane: another case: i have calculated intersection points in following way: z_clip=-far (for considering far plane) or z_clip=-near (for considering near plane) for example: f consider edge between (x1,y1,z1) , (x2,y2,z2), then: co-efficient = (z_clip - z1) / (z2 - z1) xc = x1 + co-efficient * (x2 - x1) yc = y1 + co-efficient * (y2 - y1) zc = z_clip (xc,yc,zc) point of intersection. similarly, can calculate point of intersection other edge. example: edge between (10, 0, -50) , (0, 0, -150) cut in point (5, 0, -100). original triangle: 0 0 -150 10 0 -50 0 10 -50 after clipping: triangle1: 0 10 -50 5 0 100 0 5 -100 triangle2: 10 0 -50 0 5 -100 0 10 -50 am right in calculation procedure or there wrong in procedure? ...

chart.js - Remove space for unrequired ticks -

Image
i'm trying generate chart has year & week numbers (201601, 201602 ... 201651, 201652) across x-axis. i've managed trim out unwanted ticks, chartjs not trimming out dead space. here's example: here's code have tried far... don't worry white bar on blue bar, i'm happy artefact now, i'm trying trim out dead space. ignore fact data empty, being loaded in dynamically via ajax call: chart = new chart(canvas, { type: 'horizontalbar', data: { labels: [], datasets: [] }, options: { legend: { display: false }, scales: { xaxes: [{ ticks: { autoskip: true, beginatzero: false, stepsize: 1 }, position: 'top', type: "linear", afterbuildticks: function (scale) { var tickslength = scale.ticks.length; ...

how can i add a view like textview from another layout to current layout in android -

i want create layout form programmatically . example want add view textview in form couple of times . created layout has textview want add textview couple of times in current layout . public class fileform extends activity { linearlayout lin_main; textview tv_grouptitle; layoutinflater lyotinf; view viw_allitems; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_file_form); lin_main = (linearlayout) findviewbyid(r.id.lin_main); lyotinf = (layoutinflater) getsystemservice(context.layout_inflater_service); viw_allitems = lyotinf.inflate(r.layout.item,null); tv_grouptitle = (textview) viw_allitems.findviewbyid(r.id.tv_grouptitle); int int_groupnum = 0; list<integer> int_emnumingroup = new arraylist<integer>();; emmanager emm = null; emm = emm.getinstance(); element emnode ...

How to check a string while entering it in MySQL DB for characters in the beginning by DEFAULT? -

i want create table want list books on different subject. want include first letter of topic in book id. example, books on mathematics contain 'm', literature contain 'c'. had idea use create table book (id varchar(5) default 'm%', book_name varchar(10)) but, it's showing error. static analysis: 2 errors found during analysis. a comma or closing bracket expected. (near "'m%'" @ position 46) blockquote unexpected beginning of statement. (near "10" @ position 71) sql query: create table book (id varchar(5) default 'm%', book_name varchar(10)) mysql said: documentation 1064 - have error in sql syntax; check manual corresponds mariadb server version right syntax use near 'like 'm%', book_name varchar(10))' @ line 1 the query usage of default wrong. can have fixed text in default. not sure if want text ending m in id or book_name, looking @ query assuming id. yo...

java - Multiple Navigation-Drawer Content onclick action -

have basic activity implemented custom toolbar&navigation drawer. had no problem until add buttons on main layout. assigned multiple drawer xml files under menu folder. problem is, when click toolbar hamburger icon, "r.menu.activity_main_drawer1" content coming correctly. when click on button on activity,, other menus comes too. problem starts there. having 2 issues on solutions. toolbar hamburger icon disappearing or menu contents not coming correctly.(when click on button first, "r.menu.activity_main_drawer2" coming right, after closing drawer, if click on toolbar menu, same "r.menu.activity_main_drawer2" appearing again.) hope explain. in advance. public class index extends appcompatactivity implements view.onclicklistener{ protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.index_p_activity); button 1 = (button) findviewbyid(r.id.finans); one.setonclicklistener(t...

javascript - Unable to access my array -

i keep getting error cannot set property '0' of undefined @ create2darray. mind explaining what's wrong logic here? know it's rookie mistake cause still haven't gotten hang of arrays. const row = 10; const col = 11; const size = 64; var canvas = document.getelementbyid("canvas"); var surface = canvas.getcontext("2d"); const image = new image(); image.src = "box_image.png"; //creating tile function box() { this.xaxis = 0; this.yaxis = 0; this.img = image; } create2darray(); //creating map var map = []; function create2darray() { (var i=0; < row; i++){ map[i] = []; (var j=0; j<col; j++){ map[i][j] = new box(); } } } you should aware of variable hoisting here. the way declared map, declared , initialized after create2darray call. there 2 catches here variables declared , defined anywhere in function, hoisted top of function, declarations not initiali...

C++ conflicting namespaces -

i developing c++ project in prj_cpp.h starts as // prj_cpp.h #include "lib_cpp.h" extern "c" { #include "lib_c.h" } where lib_cpp.h , lib_c.h header files of external c++ , c libraries respectively. external c++ library lib_cpp.h uses lib_c in following way. // lib_cpp.h namespace some_weird_namespace { extern "c" { #include "lib_c.h" } } because lib_c.h prevents double inclusion, turns out objects in lib_c.h reside in some_weird_namespace has nothing project prj_cpp . on other hand if header file looks like // prj_cpp.h extern "c" { #include "lib_c.h" } #include "lib_cpp.h" i break external c++ project because there nothing under some_weird_namespace because include lib_c.h first. i not allowed modify neither lib_cpp.h nor lib_c.h is there can in prj_cpp.h resolve such issue? i not using some_weird_namespace in project because namespace has nothing it. moreover, num...

c - Variable cast to double in printf produces random output -

i trying see hex representation of floating point numbers , compiled code gcc-4.9.2: #include <stdio.h> int main() { double = 100; printf("%f %x\n", i, (double)i); return 0; } i surprised find everytime ran code hex value printed out changed. going on? how can safely print hex representation of floating point number? the %x format specifier requires argument of type unsigned int . you're giving argument of type double . behavior undefined, means far c standard concerned anything can happen -- including changing output other specifiers in same format string. to print hex representation of floating-point number, copy array of unsigned char , print elements of array.

ibm mobilefirst - Mobile First Json store push BUG -

i underline issue in cordova-plugin-mfp-jsonstore during investigation notice in method sendresourcerequest on pushinstance data not sent resourcerequest = new wlresourcerequest('adapters/' + invocationdata.adapter + '/' + invocationdata.procedure, wlresourcerequest.post); resourcerequest.send().then(ipopts.onsuccess, ipopts.onfailure); according me should become: resourcerequest = new wlresourcerequest('adapters/' + invocationdata.adapter + '/' + invocationdata.procedure, wlresourcerequest.post); resourcerequest.sendformparameters({ "params":"['" + json.stringify(collectiondocument) + "']" }); i need use in important project, possible fix possible? regards. daniele if require changes/fixes in jsonstore plug-in ibm need open pmr ibm correct , provide ifix.

legend - R Plotly stacked bar chart issue -

Image
i using plotly create stacked bar chart below df <- data.frame( var1 = c("ny", "ny", "ny", "sfo", "sfo", "sfo"), var2 = c("low", "medium", "high", "low", "medium", "high"), value = c(10,15,20,10,20,25) ) df$var2 <- factor(df$var2, levels = c("low","medium","high")) # sort factor table df <- arrange(df, var2) col <- list( color = ifelse( df$var2 == "low", "steelblue", ifelse( df$var2 == "medium", "darkorange", "olivedrab" ) )) # plot plot_ly( df, x = ~ var1, y = ~ value, color = ~ var2, marker = col, type = "bar" ) %>% layout(barmode = "stack") there 2 issues facing: first legend not coming correctly (see image) . second since have dynamic table, there possibility there 1 value in var1 ,...

javascript - What technology has this website been built with? -

i apologise in advance if kind of question not allowed here. do know technology has been used build website? https://ride.uber.com/en_us/ viewing dev console , source has offered me no clues! technologies seen user: javascript json css html

android - Compile-time failure when reading texels from samplerExternalOES -

minimal failing fragment shader: #version 320 es #extension gl_oes_egl_image_external_essl3 : require precision highp float; precision highp int; vec4 x(samplerexternaloes sampler) { return texture(sampler, vec2(0, 0)); } void main() { } on samsung g-930p, opengl es 3.2 v@145.0 (git@i5bc0f577f9) , fails compile, shader log reading: internal compiler error: error: array indexing out of boundary on samsung g-930f - same phone, same android version, etc. opengl es 3.2 v1.r12p1-00dev0.60546d7cd0bfd82d0ba92ca3bb825c75 , compiles - , latter device can correctly execute more complex shaders read texels samplerexternaloes . is bug in opengl es implementation on g-930p? unreasonable way specify parameters of function wants call texture on samplerexternaloes ? is bug in opengl es implementation on g-930p? it sure looks ... on samsung g-930f - same phone, same android version, etc. opengl es 3.2 v1.r12p1-00dev0.60546d7cd0bfd82d0ba92ca3bb825c75, i...

scala - Spark: how to not use aws credentials explicitly in Spark application -

in spark application, have aws credentials passed in via command line arguments. spark.sparkcontext.hadoopconfiguration.set("fs.s3.awsaccesskeyid", awsaccesskeyid) spark.sparkcontext.hadoopconfiguration.set("fs.s3.awssecretaccesskey", awssecretaccesskey) spark.sparkcontext.hadoopconfiguration.set("fs.s3.impl", "org.apache.hadoop.fs.s3native.natives3filesystem") however, in cluster mode explicitly passing credential between nodes huge security issue since these credentials being passed text. how make application work iamrole or other proper approach doesn't need 2 lines of code in spark app: spark.sparkcontext.hadoopconfiguration.set("fs.s3.awsaccesskeyid", awsaccesskeyid) spark.sparkcontext.hadoopconfiguration.set("fs.s3.awssecretaccesskey", awssecretaccesskey) you can add following config in core-site.xml of hadoop conf , cannot add in code base <?xml version="1.0"?> <?xml-stylesh...

emacs - How to record and save macros or regex in spacemacs -

i want reuse series of regular expression replacements regularly. in plain emacs, record keyboard macro, entering more useful regular expressions provided spacemacs, recording stops automatically after first replacement step. how can this, , more general macro recording? also, 2 recording mechanisms (the emacs , vim one) implemented same under hood, or coexist? thanks

c++ - How to inherit from yyFlexLexer? -

i'm writing trying learn flex / bison. i've got basic c examples now, i'd move on doing c++ ast tree. c++ makes type of object oriented program easier c. however, there seems issue c++ generation flex , i'm unsure how resolve it. want add methods warning/error reporting going inherit yyflexlexer , in '.l' file call stuff warning(const char* str) , error(const char* str) appropriate. however, 'yyflexlexer redefinition' error among others when try perform inheritance in way believe documentation says this. lexer.l %option nounistd %option noyywrap %option c++ %option yyclass="nlexer" %{ #include "nlexer.h" #include <iostream> using namespace std; %} %% [ \t]+ \n { return '\n';} [0-9]+(\.[0-9]+)? { cout << "double: " << atof(yytext()) << endl;} . {return yytext()[0];} %% int main(int , char**) { nlexer lexer; while(lexer.yylex() != 0) { }; return 0; } nlexer.h #ifn...