Posts

Showing posts from July, 2013

How to limit image download size in WordPress responsive images? -

i'm using following attachment image sizes in theme: "thumbnail" (320) "medium" (640), "medium_large" (768) , "large" (1280). the default wordpress "srcset" , "sizes" attributes on tags causing browser download unnecessarily large images in large viewports. example, of layouts display images in grid multiple columns, it's not necessary load largest version of image in these cases. is there way me specify maximum image size should downloaded? specifically, tried looking way customize "srcset" attribute exclude larger 768px, can't seem figure out how this. any advice appreciated. try apply_filters( 'max_srcset_image_width',int $max_width,array $size_array ) https://developer.wordpress.org/reference/hooks/max_srcset_image_width more notes , hooks: https://make.wordpress.org/core/2015/11/10/responsive-images-in-wordpress-4-4/

javascript - How to make d3.js force layout gravity rectangular? -

Image
in d3.js force layout, giving gravity value makes layout circular. however, i'd make force layout rectangular, while nodes have negative charge , even distance . (like above) is there way make force layout rectangular? can achieve modifying tick function? here code: var background = d3.select('.background'); var width = background.node().getboundingclientrect().width, height = background.node().getboundingclientrect().height; var nodes = d3.range(50).map(function(d, i) { return { text: "hello" }; }); var messages = background.selectall('.message') .data(nodes) .enter() .append('div') .attr('class', 'message') .text(d => d.text) .each(function(d, i) { d.width = this.getboundingclientrect().width; d.height = this.getboundingclientrect().height; }); var force = d3.layout.force() .gravity(1/88) .charge(-50) .nodes(nodes) .size([width, height]); me...

google maps - NullPointerException error, in android.text.Editable android.widget.EditText.getText() -

i developing android apps. had problem. implemented 2 fragments in floating bar. , each floating bar button connected moving map , print listing. when clicked going map, print google maps normally. , in state, press button move home screen in smartphone. , when run app, print google map. but, in stae, if clicked on google location search @ top in application, app crash... the error message follows: 08-20 09:56:48.698 16761-16761/songjong.com.seongnamgiftcard e/androidruntime: fatal exception: main process: songjong.com.seongnamgiftcard, pid: 16761 java.lang.nullpointerexception: attempt invoke virtual method 'android.text.editable android.widget.edittext.gettext()' on null object reference @ com.google.android.gms.location.places.ui....

c++ - NVCC & Cygwin Enables non-standard inheritance of struct within a class || How to return a subclass from a super class -

utilizing cygwin, vs15 compiler, , nvcc following compiles... template typename<b> class base { int = 1; template typename <d> struct derived : public base<d> { int derived_a = 2; virtual int geta() override { return derived_a;} } virtual int geta() { return a;} } int main() { base b<int> base; std::cout << b.geta() << " " << b.getderived().geta() << std::endl; } //output 1 2 however without usage of templates code not compile giving expected "invalid use of incomplete type base" i wondering... given solve "superclass needs return subclass" pros/cons adding feature c++ standard. likewise sake of science, if can post other compilers allow please do. *edit -- tested vs15 compiler well

Where to see logs when meteor crash without any message while developing? (on Windows) -

Image
while developing, meteor app crashing without printing message : the last line of screenshot corresponding current project directory can type meteor command, meaning meteor crashed. it forces me restart meteor meteor command. where can see logs understand why meteor crashed ? that's ongoing problem meteor, crashes without logs after code reload. see issue: https://github.com/meteor/meteor/issues/8648

access vba - How can I set the value of a field located in a subform equal to a field on the main form after update? -

i creating form using access 2010 update table. have field, start date, in subform. set required in table properties. have field end date outside of subform. when user enters start date, end date should automatically populate same value. i tried following, receiving message "you must enter value in position.startdate' field. private sub startdate_afterupdate() if not isnull(me.startdate) me.startdate = me.enddate end sub the main form parent : private sub startdate_afterupdate() if not isnull(me!startdate.value) me.parent!enddate.value = me!startdate.value end if end sub

centos7 - CKFinder causes PORT FLOOD ban in CSF Firewall -

running multiple hosting servers centos7, csf firewall lfd. client sites using ckfinder file manager. lately lots of customers complaining time time, @ same time they're browsing file manager site won't connect anymore. not ckfinder whole domain. i managed recreate error, opening ckfinder, , browse between folders, never uploaded it. see ip blocked on server csf. notification email server tells me: time: sun aug 20 03:47:06 2017 +0200 ip: ***.**.***.*** (ph/philippines/-) hits: 11 blocked: temporary block sample of block hits: aug 20 03:46:41 app1 kernel: firewall: *port flood* in=eth0 out= mac=**:**:**:**:**:**:**:**:** src=***.**.***.*** dst=***.***.***.** len=52 tos=0x00 prec=0x00 ttl=107 id=22312 df proto=tcp spt=60306 dpt=80 window=65535 res=0x00 syn urgp=0 aug 20 03:46:41 app1 kernel: firewall: *port flood* in=eth0 out= mac=**:**:**:**:**:**:**:**:** src=***.**.***.*** dst=***.***.***.** len=52 tos=0x00 prec=0x00 ttl=107 id=22317 df proto=tcp spt=3010...

javascript - Puppeteer: How to submit a form? -

using puppeteer , how programmatically submit form? far i've been able using page.click('.input[type="submit"]') if form includes submit input. forms don't include submit input, focusing on form text input element , using page.press('enter') doesn't seem cause form submit: const puppeteer = require('puppeteer'); (async() => { const browser = await puppeteer.launch(); const page = await browser.newpage(); await page.goto('https://stackoverflow.com/', {waituntil: 'load'}); console.log(page.url()); // type our query search bar await page.focus('.js-search-field'); await page.type('puppeteer'); // submit form await page.press('enter'); // wait search results page load await page.waitfornavigation({waituntil: 'load'}); console.log('found!', page.url()); // extract results page const links = await page.evaluate(() =...

javascript - What is the difference between 'it' and 'test' in jest? -

i have 2 tests in test group. 1 uses other 1 uses test, , seem working similarly. difference between them? describe('updateall', () => { it('no force', () => { return updateall(tablename, ["filename"], {compandid: "test"}) .then(updateditems => { let undefinedcount = 0; (let item of updateditems) { undefinedcount += item === undefined ? 1 : 0; } // console.log("result", result); expect(undefinedcount).tobe(updateditems.length); }) }); test('force update', () => { return updateall(tablename, ["filename"], {compandid: "test"}, true) .then(updateditems => { let undefinedcount = 0; (let item of updateditems) { undefinedcount += item === undefined ? 1 : 0; } // console.log("result", result); expect(undefinedcount).tobe(0); ...

Proper form for printing a newline (python) -

if want print newline in python, better form use print('') , or print('\n', end = '') , or else? print('\n', end = '') seems on complicated, while print('') feels bit strange. using python3 , if need print newline character, use: print() looking @ documentation print() , shows default end character '\n' . print(value, ..., sep=' ', end='\n', file=sys.stdout, flush=false) prints values stream, or sys.stdout default. optional keyword arguments: file: file-like object (stream); defaults current sys.stdout. sep: string inserted between values, default space. end: string appended after last value, default newline. flush: whether forcibly flush stream. type: builtin_function_or_method

Kafka rack-id and min in-sync replicas -

Image
kafka has introduced rack-id provide redundancy capabilities if whole rack fails. there min in-sync replica setting specify minimum number of replicas need in-sync before producer receives ack (-1 / config). there unclean leader election setting specify whether leader can elected when not in-sync. so, given following scenario: two racks. rack 1, 2. replication count 4. min in-sync replicas = 2 producer ack=-1 (all). unclean leader election = false aiming have @ least once message delivery, redundancy of nodes , tolerant rack failure. is possible there moment 2 in-sync replicas both come rack 1, producer receives ack , @ point rack 1 crashes (before replicas rack 2 in-sync)? means rack 2 contain unclean replicas , no producers able add messages partition grinding halt. replicas unclean no new leader elected in case. is analysis correct, or there under hood ensure replicas forming min in-sync replicas have different racks? since replicas on same rack have lower late...

java - hibernate/jpa Autowire annotation producing Nullpointer exception errors -

new java on here. i using spring boot , working eclipse kepler make program. is possible define autowired in regular class - or - must use in controller class? i trying make group of functions/methods in class (valfuncsauth). 1 of methods (validateauthinfo), getting error: java.lang.nullpointerexception listed below. i created "helper" function because - in different controllers - executing same code. kind of check/validation. trying put (the check/validation code) in 1 place (like function). wanted make call particular function check/validation (and not repeating same code each controller). why getting error? there way fix this? tia java.lang.nullpointerexception: null @ ccinfw.helpfulfunctions.valfuncsauth.validateauthinfo(valfuncsauth.java:121) @ ccinfw.controller.work.workprojectcontroller.createproject(workprojectcontroller.java:97) @ sun.reflect.nativemethodaccessorimpl.invoke0(native method) @ sun.reflect.nativemethodaccessori...

java - i want to add a whole string column in arraylist from mysql and separate by comma, and display the array list -

private void jbutton1actionperformed(java.awt.event.actionevent evt) { try { class.forname("com.mysql.jdbc.driver"); connection con = drivermanager.getconnection("mysql:jdbc:///viru", "root", ""); string query = "select stations * trains"; preparedstatement pst = con.preparestatement(query); resultset rs = pst.executequery(); while (rs.next()) { string s = rs.getstring("stations"); stationlist.add(s); stationlist = new arraylist(arrays.aslist(s.split(","))); } (string value : stationlist) { system.out.println(value); } } catch (exception e) { }

Laravel : How to retrieve a column of intermediate table as an array? -

how retrieve column of intermediate table array? for example: intermediate table of users , roles ,named role_user ,it this: id user_id role_id i want current user's role_id s: public function test() { //$roles collection. $roles=auth::user()->roles; //i want `role_id`s this: //$roleids=[1,2,3]; } how it? use eloquent relationship function in user model public function roles() { return $this->belongstomany('app\role', 'role_user', 'user_id', 'role_id'); } public function getuserrole() { return $this->roles()->first(); } if user has 1 role can access auth::user()->getuserrole(); if user has many roles can call auth::user()->roles;

reactjs - Visual Studio Code is not npm start-ing my React JS app when debugging -

i want debug react js app on visual studio code i'm following tutorial: https://code.visualstudio.com/docs/nodejs/reactjs-tutorial i'm stuck at: ensure development server running ("npm start"). press f5 or green arrow launch debugger , open new browser instance. a new chrome instance being opened requesting " http://localhost:3000 " app not running, seems ran debugger. if mannually npm start app runs. guess launch.json missing visual studio code start app debugger. that's why i'm stuck @ ensuring development server running command, because don't know check this this launch.json: { "version": "0.2.0", "configurations": [ { "type": "chrome", "request": "launch", "name": "launch chrome against localhost", "url": "http://localhost:3000", ...

java - struts conversation plugin version 1.7.4 not working with struts core 2.5.12 -

struts conversation plugin version 1.7.4 not working struts core 2.5.12. exception starting filter struts2 java.lang.instantiationerror: **com.opensymphony.xwork2.util.finder.classfinder** @ com.google.code.rees.scope.struts2.strutsactionprovider.findactions(strutsactionprovider.java:331) @ com.google.code.rees.scope.struts2.strutsactionprovider.getactionclasses(strutsactionprovider.java:80) @ com.google.code.rees.scope.struts2.sessioninterceptor.init(sessioninterceptor.java:81) @ com.opensymphony.xwork2.factory.defaultinterceptorfactory.buildinterceptor(defaultinterceptorfactory.java:57) @ com.opensymphony.xwork2.objectfactory.buildinterceptor(objectfactory.java:207) @ com.opensymphony.xwork2.config.providers.interceptorbuilder.constructinterceptorreference(interceptorbuilder.java:70) @ com.opensymphony.xwork2.config.providers.xmlconfigurationprovider.lookupinterceptorreference(xmlconfigurationprovider.java:1149) @ com.opensymphony.xwork2.config...

ios - Loop one more time in For Enumerated -

i have code below that's looping through key string in dictionary . until want search string not on dictionary. when search string that's not in dictionary , code should have been doing 1 more loop fall in else of if index != patternfromdatabase.count , won't since loop finished enumerated count of patternfromdatabase . how can for-loop 1 last time after enumerated finished since cant write patternfromdatabase.enumerated() + 1 . do have suggestion? or should modify code little bit don't have face problem outcome purpose? thank much. if need more explanation i'll happy explain code you. for (index, key) in patternfromdatabase.enumerated() { let starttimeforbitap = date() print("i: \(index), db: \(patternfromdatabase.count), key: \(key)") if index != patternfromdatabase.count { if algorithm().searchstringwithbitap(key, pattern: insertedpattern) == -1 { continue ...

How to define an array of strings in TypeScript interface? -

i have object this: { address : ['line1', 'line2', line3']} how define address in interface? number of elements in array not fixed. interface addressable { address : string[]; }

android - ListView can appear in Activity but can't appear in Fragment -

listview can appear in activity can't appear in fragment use same code in kotlin android studio 3.0? and fragment code: class testfrag : fragment() { var adapter : mo3dadapter?=null var listofmkabala = arraylist<meetingdetails>() override fun oncreateview(inflater: layoutinflater?, container: viewgroup?, savedinstancestate: bundle?): view? { return inflater!!.inflate(r.layout.fragment_test, container, false) listofmkabala .add ( meetingdetails(" nour1", "ahmed1" , "aya1")) listofmkabala .add ( meetingdetails(" nour2", "ahmed2" , "aya2")) listofmkabala .add ( meetingdetails(" nour3", "ahmed3" , "aya3")) listofmkabala .add ( meetingdetails(" nour4", "ahmed4" , "aya4")) listofmkabala .add ( meetingdetails(" nour5", "ahmed5" , "aya5")) listofmkabala .add ( meetingdetails(" nour6", ...

api - Symfony, Invalid data (AppBundle\Entity\InterventionType), expected "AppBundle\Entity\Intervention -

i'm trying insert line base, postman local api foreign keys , have bug : "message": "invalid data \"1\"(appbundle\entity\interventiontype), expected \"appbundle\entity\intervention\"." it pointed bad entity , don't know why. i'm targeting "intervention", , doctrine seems go in interventiontype... here's entity : <?php namespace appbundle\entity; use doctrine\orm\mapping orm; use symfony\component\validator\constraints assert; use \datetime; /** * interventionrapport * * @orm\table(name="intervention_rapport", options={"comment":"table répertoriant les retours associés aux différentes interventions (commerciales et techniques) - egalement utilisée pour rémunérer les techniciens et calculer les frais kilométriques tech/com"}) * @orm\entity */ class interventionrapport { /** * @var integer * @orm\onetoone(targetentity="appbundl...

operating system - how can we read the content of stdin stdout stderr in c? -

#include<stdio.h> #include<unistd.h> #include<fcntl.h> void main() { int stdout_bk,stdin_bk,stderr_bk; char x[100],y[100],z[100]; stdout_bk=dup(fileno(stdout)); stdin_bk=dup(fileno(stdin)); stderr_bk=dup(fileno(stderr)); read(stdin_bk,x,100); read(stdout_bk,y,100); read(stderr_bk,z,100); printf("\n%s",x); printf("\n%s",y); printf("\n%s",z); } i have tried but, did not proper answer. how buffer works while running c program?

python - Peewee and Flask : 'Database' object has no attribute 'commit_select' -

i'm trying use peewee flask, don't understand why database connection not work. config.py class configuration(object): database = { 'name': 'test', 'engine': 'peewee.mysqldatabase', 'user': 'root', 'passwd': 'root' } debug = true secret_key = 'shhhh' app/ init .py from flask import flask flask_peewee.db import database app = flask(__name__) app.config.from_object('config.configuration') db = database(app) import views,models app/models.py from peewee import * . import db database = db class unknownfield(object): def __init__(self, *_, **__): pass class basemodel(model): class meta: database = database class tbcategory(basemodel): insert_dt = datetimefield() name = charfield() class meta: db_table = 'tbcategory' i generated models.py pwiz. if try use on interactive console error on title. if change line on models.py d...

Range class in Python -

if have lst2 = [11,22,33,44,55,66,77] , want 3 middle elements new list. how can proceed? i unsure on how can them add +1 each. example: for in range(1,100,10) print(i) this give me list [1,11,21,31,41,51...], when in want of list go more like: [11,22,33,44...]. stop = 100 result = [] in range(11,stop, 10): result.append(i) print(result) https://repl.it/kr6p

javascript - md-autocomplete to search local(browser object) and if not found then look for database object -

i have created md-autocomplete search , searching records using $http database directly want want md-autocomplete search object array of objects loading on form load , if not found should go database search. (function() { 'use strict' angular.module('gaiinsapp').controller('servicesmasterctrl', ['$scope', '$http', 'loadforminteractivity', function($scope, $http, loadforminteractivity) { $scope.formservice.allrecords = [{ "id": 83, "servicename": "blackberry global plan", "servicetype": "postpaid", "monthlyrental": 299, "serviceremarks": "testing", "servicestatus": 0, "activationdate": "/date(1498852800000)/", "deactivationdate": null }, { "id": 84, "servicename": "inter...

metadata - How to retreive image captions from cloudinary and rails? -

i'm trying add caption below cloudinary image. on cloudinary website, i've added caption under "edit metadata" field, can't figure out how retrieve it. my controller: require 'cloudinary' results = cloudinary::api.resources(:type => :upload) resources = results["resources"] @ids = resources.map {|res| res["public_id"]} my view: <% @ids.each |id| %> <%= cl_image_tag (id) %> **insert caption here** <% end %> to image metadata you've inserted, you'll have set context true when running resources method, this: results = cloudinary::api.resources(:type => :upload, :context => true) the above request return key-value pairs in metadata you've inserted, this: "context"=>{"custom"=>{"caption"=>"flowers"}}

simulator - How to change parameters in Contiki 2.7 simulation? -

i started learning on contiki os. trying analyze few parameters energy efficiency, latency, delivery ratio etc different deployment scenarios. first should change parameter like: channel check rate 16/s (i use rpl-sink) rpl mode of operation no_downward_route send interval 5s udp application packet size 100 bytes could please tell me how change these parameter in contiki 2.7? my answers reference: channel check rate 16/s (i use rpl-sink) #undef netstack_rdc_channel_check_rate #define netstack_rdc_channel_check_rate 16 rpl mode of operation no_downward_route it's called non-storing mode. enable it: #define rpl_conf_with_non_storing 1 send interval 5s depends on application; there no standard name parameter. if we're talking ipv6/rpl-collect/ , should #define period 5 in project-conf.h . udp application packet size 100 bytes the payload constructed in udp-sender.c : uip_udp_packet_sendto(client_conn, &msg, sizeof(m...

webpack not generating css file -

Image
implementing webpack asset management tutorial .but webpack not generating css file in output path webpack.config.js const config = { entry: './src/index.js', output: { filename: 'bundle.js', path: __dirname + '/build' }, module: { rules: [ { test: /\.css$/, use: [ 'style-loader', 'css-loader' ] }, { test: /\.(jpeg)$/, use: [ { loader: 'file-loader', options: { name: '[path][name].[ext]' } } ] } ] } }; index.js import './style.css'; import icon './yo1.jpg'; function component() { var element = document.createelement('div'); element.innerhtml = 'hello webpack' element.classlist.add('hello'); var myicon = new image(); myicon.src = icon; element.appendchild(myicon...

php - How do you send a CURL POST request to the second form from the same page as the first form? -

there 2 forms on html page , want send through curl post request second form. the forms of format: <form name="cod" action="/form.html" method="post"> <input type="text" name="cod" class="form2"> <input type="hidden" name="page" value="domains"> <input name="b1" type="submit" class="form1" value="view"> </form> <br/><br/> <form name="cod" action="/form.html" method="post"> <select name="an"> <option value="1">1</option> <option value="1">2</option> </select> <input type="hidden" name="cod" value="302"> <input type="hidden" name="captcha" value="null"> <input name="method.b" type...

jms - how to make jsp receive activemq offline message -

Image
i have web app, want is: if user executes struts action successfully, user b can receive message when he/she opens jsp page. my web.xml is: <context-param> <param-name>org.apache.activemq.brokerurl</param-name> <param-value>tcp://localhost:61616</param-value> </context-param> <context-param> <param-name>contextconfiglocation</param-name> <param-value>classpath:applicationcontext.xml</param-value> </context-param> <listener> <listener-class>org.springframework.web.context.contextloaderlistener</listener-class> </listener> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.ng.filter.strutsprepareandexecutefilter</filter-class> <async-supported>true</async-supported> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*...

php - "fopen(): Filename cannot be empty" and "fgetcsv() expects parameter 1 to be resource, boolean given" errors when uploading large csv files -

i'm getting these 2 errors when try upload large csv file. i'm not sure if errors being caused large file i'm using same script below page uploads different set of csvs , works fine. difference can see file size , number of entries on csv. my script: if(isset($_post["submit"])){ $file = $_files['file']['tmp_name']; $handle = fopen($file, "r"); $c = 1; $x = 0; $result = mysqli_query($conn, 'truncate table testreftb'); if ($result) { echo "reference table has been truncated. <br/>"; } else echo "something went wrong: " . mysql_error(); while(($filesop = fgetcsv($handle, 10000, ",")) !== false){ $lifex = $filesop[0]; $healthx = $filesop[1]; $autoom = $filesop[2]; $solar = $filesop[3]; $himp = $filesop[4]; $phone = $filesop[5]; $sql = "insert reftb (lifex, healthx, autoomit, solarzips, himpzips, homephone) values ('$lifex','$healthx...

django - How to access/create a proper Request object for DRF Serializer? -

i have created rest api using drf, , works enough. frontend simple page allows data viewed , updated. trying add more interactivity site using websockets django-channels . channels system simple use , works nicely. however issue facing trying combine of moving pieces work together. idea initial page refresh comes through rest api, , subsequent updates automagically come through websocket after every update (with of post_save signal). have nice drf serializers models, alas not work without request object (for instance hyperlinkedidentityfield ): assertionerror: `hyperlinkedidentityfield` requires request in serializer context. add `context={'request': request}` when instantiating serializer. so question is, how somehow create/fake proper request object serializers want when trying serialize model in signal handler? edit the more think this, more obvious becomes not right way go. there no way craft single, generic request object serializers, since model updates tr...

Converting TRUNC(TO_NUMBER(TO_DATE(SYSDATE) - MyTable.DOBDATE) / 365, 0) from Oracle to SQL Server? -

i converting oracle queries sql server equivalent, have been easier others, right stuck on query containing in clause trunc(to_number(to_date(sysdate) - mytable.dobdate) / 365, 0) i've read convert sql server's equivalent oracle's trunc, i know sysdate getdate() lost on part of query trunc(to_number(to_date(sysdate) what sql server's equivalent ? edit in short how take oracle statement trunc(to_number(to_date(sysdate) - mytable.dobdate) / 365, 0) and convert sql server equivalent the equivalent be: select datediff(day, mytable.dobdate, getdate()) / 365 note sql server integer division, result integer. no need additional function. the to_number() redundant in oracle, think. neither set of code calculates age in years, because neither takes leap years account.

c# - SqlException in .updateall after convert OLEDB to SQL Server -

i'm writing app in c# ms access backed ( .accdb ). made call (on advisement) sql server better idea system, spent last 8 hrs re-coding sql server. as background; changed oledb connection, command etc etc sql fixed parameters , variables ? @value fixed sql string errors now forms working exception of ones using binding done visual studio 'wizard' (if that's it's called). i have 5 forms filled using this.tbljobtableadapter.fill(this.websterdbdataset.tbljob); they using datagridview depending upon info. on "save , close", code runs: this.validate(); this.tbluserbindingsource.endedit(); this.tableadaptermanager.updateall(this.websterdbdataset); _owner.performrefresh(); this.close(); this.dispose(); this works 100% still .accdb version (i'm checking backup) not sql server. if press save , close , haven't changed anything, closes, if change field @ fails (from log): data time:21/08/2017 12:12:20 am exception name:...

html5 - JavaScript game Bouncing -

i've built js game. there game piece , obstacles , buttons (up,left,right,down) move game piece. when click button, game piece moves, stays on place moved to. want bottom of gamearea have gravity , if game piece hit bottom , top bounce back. possible? game structure i've token w3schools(see "game example")

qt - QML Virtual keyboard Hide button not working -

i having problem if click on keyboard hide button .following code : import qtquick 2.6 import qtquick.window 2.2 import qtquick.controls 2.2 import qtquick.virtualkeyboard 2.2 window { visible: true width: 600 height: 500 title: qstr("hello world") textfield { id: textfield anchors.bottom:(inputpanel.visible) ? inputpanel.top : parent.bottom color: "#2b2c2e" cursorvisible: activefocus selectioncolor: qt.rgba(0.0, 0.0, 0.0, 0.15) selectedtextcolor: color } inputpanel { id: inputpanel z: 89 anchors.bottom:parent.bottom anchors.left: parent.left anchors.right: parent.right visible: qt.inputmethod.visible //** warning here } } below use-cases: if click on textfield keyboard pops expected when click on hide keyboard button it's not hiding . if click on textfield keyboard pops expected, next if double-click on textfield ...

java - Secure non-repeating Random alphanumeric URL slug -

i'm able achieve non-repeating random alphanumeric url slug part base58, this, private static final char[] base58_chars = "123456789abcdefghjklmnpqrstuvwxyzabcdefghijkmnopqrstuvwxyz".tochararray(); private static final int length = base58_chars.length; public static string genslug(long priimarykeyid) { char[] buffer = new char[20]; int index = 0; { int = (int) (priimarykeyid % length); buffer[index++] = base58_chars[i]; priimarykeyid = priimarykeyid / length; } while (priimarykeyid > 0); return new string(buffer, 0, index); } but how achieve secure-randomness it? if hashing.sha256().hashstring(genslug(priimarykeyid), standardcharsets.utf_8).tostring(); the slug becomes 64 characters , that's long (expecting same length genslug, between 1 , 12 chars long).. you truncate output of hash function , still appear random, possibility of hash collision rise. since constraint maximum output of 12 character...

android - How do I save two sets of information in different tables in the same SQLite Database? -

i'm working on budgeting app , ask user add income , expenses , have sum of 2 sets of data in overview activity. researched online , found putting values 2 different tables best way.(if have other ideas please tell me.) how put income , expense on different tables , how link them sum? have completed saving data expense in 1 table not know how make table income. forgive me not knowing best way because new using sqlite. add_expense.java import android.content.intent; import android.os.bundle; import android.support.design.widget.floatingactionbutton; import android.support.design.widget.snackbar; import android.support.v7.app.appcompatactivity; import android.support.v7.widget.toolbar; import android.view.view; import android.widget.adapterview; import android.widget.arrayadapter; import android.widget.edittext; import android.widget.spinner; import android.widget.toast; public class add_expense extends appcompatactivity { databasehelper mydbexpense; edittext e...