Posts

Showing posts from January, 2011

css - Simple responsive vertical image gallery with 80% viewheight / 100% width -

or thought that easy. wanted keep simple work in browsers, no javascript. ended css works in chrome/safari/ios not in internet explorer, , seems behave weird on android well: img { max-width: 100%; max-height: 80vh; -o-object-fit: contain; /* these lines prevent distortion on chrome/safari */ object-fit: contain; width: 2000px; /* seems needed make small images bigger, creates distortion on ie */ } the basic idea have simple gallery ever works on mobile phones , in normal browser. idea images should not bigger 80% of view height, , never more 100% of width. still take space possible , still maintain aspect ratio. the idea behind 80% viewheight notices there multiple pictures. the page/content consists of <img><br/> tags images of different sizes , dimensions. nothing exiting. with simple max-width/max-height seems work, except small pictures never bigger. how work on browsers? simple question have simple css answer? edit: added reproduction we...

android - File not found exception on webview - when in real the file exists -

i trying load webpage in webview, getting following exception: java.io.filenotfoundexception: https://fonts.googleapis.com/css?family=roboto:400,300,500,700,900,700italic 02-05 18:52:44.497 5263-6265/com.rm w/system.err: @ com.android.okhttp.internal.http.httpurlconnectionimpl.getinputstream(httpurlconnectionimpl.java:206) 02-05 18:52:44.497 5263-6265/com.rm w/system.err: @ com.android.okhttp.internal.http.delegatinghttpsurlconnection.getinputstream(delegatinghttpsurlconnection.java:210) 02-05 18:52:44.497 5263-6265/com.rm w/system.err: @ com.android.okhttp.internal.http.httpsurlconnectionimpl.getinputstream(httpsurlconnectionimpl.java:25) 02-05 18:52:44.497 5263-6265/com.rm w/system.err: @ navigationfragments.fragmentwebview$1.shouldinterceptrequest(fragmentwebview.java:124) 02-05 18:52:44.497 5263-6265/com.rm w/system.err: @ android.webkit.webviewclient.shouldinterceptrequest(webviewclient.java:125) 02-05 18:52:44.498 5263-6265/com.rm w/system.err: @ com...

Jquery: prevent submit after for validation -

formvalidator plugin submits form after form validation. want prevent form submission after validation , call function offerpricepopup(), in function submit form. not happening form automatically submits after form validation. var sss = $('#submitbtn1').formvalidator({ onsuccess : function() { console.log('success!'); }, scope : '#postform', errordiv : '#errordiv1' }); $("#postform").on("submit", function(e){ e.preventdefault(); offerpricepopup(); }); thanks in advance maybe try using different function validate. looking through documentation, looks there way check , see if form validates without submitting. found description of here (second 1 down) http://www.formvalidator.net/#advanced

reactjs - React Component Image Issue -

my image component won't seem put image in, url correct can add physically adding html page. component seems failing. tried found @ http://facebook.github.io/react/docs/jsx-in-depth.html#attribute-expressions did not help. export default class mainlogo extends react.component { render() { return ( <div> <img src = {'/src/app/assets/images/home/mainlogo.png'}/> </div> ); } } the class name should start capital letter (mainlogo) , shouldn't use {} on src, because sending img url directly src. it's not variable or state. this should work: export default class mainlogo extends react.component { render() { return ( <div> <img src='/src/app/assets/images/home/mainlogo.png' /> </div> ); } }

c# - DbMigration.SqlFile generate SqlException (0x80131904): Transaction context in use by another session -

i have created database migration , in method want execute sql files sqlfile method. each of files contains 2 statements: first drop procedure if exists , second 1 create procedure. both statements finishes go. here exception, got when tried apply migration: system.data.sqlclient.sqlexception (0x80131904): transaction context in use session. @ system.data.sqlclient.sqlconnection.onerror(sqlexception exception, boolean breakconnection, action`1 wrapcloseinaction) @ system.data.sqlclient.sqlinternalconnection.onerror(sqlexception exception, boolean breakconnection, action`1 wrapcloseinaction) @ system.data.sqlclient.tdsparser.throwexceptionandwarning(tdsparserstateobject stateobj, boolean callerhasconnectionlock, boolean asyncclose) @ system.data.sqlclient.tdsparser.tryrun(runbehavior runbehavior, sqlcommand cmdhandler, sqldatareader datastream, bulkcopysimpleresultset bulkcopyhandler, tdsparserstateobject stateobj, boolean& dataready) @ system.data.sqlclient.sql...

vhdl - Unite two arrays -

i want make 1 array out of two. type character_string array (0 15) of unsigned (7 downto 0); type full_string array (0 31) of unsigned (7 downto 0); signal lcd_oben, lcd_unten : character_string; signal lcd_data : full_string; and want take 2 smaller arrays , put them togehter in big one. this: lcd_data <= lcd_oben & lcd_unten; but gives error: error (10327): vhdl error @ seqdec.vhd(55): can't determine definition of operator ""&"" -- found 0 possible definitions can help? best regards adrian you have declared these wholly unrelated array types, have told compiler not mix them without type conversions. i don't think that's wanted do. make both array types, subtypes of unconstrained array, array(<>) of unsigned(7 downto 0) . not separate types , there should predefined & operator them. type lcd_string array (natural range <>...

caching - Create cache depending on a variable stored in cookie with Varnish and Magento -

let's have variable, can either 1, 2 or 3, stored in user cookie. eg: foo=2 the first time access pagex foo=2, page shall cached. next visitors foo=2 in cookie shall see same version (hit). the first time access pagex foo=1, page shall cached (as second version). next visitors foo=1 in cookie shall see specific version (hit). same principle foo=3 in other words, pages of website have 3 versions, if same url, 1 each value of foo in visitor's cookie. is feasible? thanks, rod i think answer looking can found in varnish docs https://www.varnish-cache.org/trac/wiki/vclexamplecachingloggedinusers there example in how use cookie variable create unique hash. this used create different pages same url. careful browsercache settings of page. may page change url , browser cache set high might strange behaviour.

xml - Split an Ordered Dictionary into variables in Python -

here snippet of code far import osmapi import geopy geopy.geocoders import nominatim import requests import xmltodict geolocator = nominatim() location = geolocator.reverse("{}, {}".format(lat, lon)) dict = location.raw osmid = dict.get('osm_id', 'default_value_if_null_here') osmtype = dict.get('osm_type', 'default_value_if_null_here') if(osmtype == 'node'): node_info = requests.get("http://api.openstreetmap.org/api/0.6/node/"+ osmid) d = xmltodict.parse(node_info.content) amenity_tags = [tag tag in d['osm']['node']['tag'] if tag['@k'] == 'amenity'] if len(amenity_tags) != 0: print amenity_tags i want check if location corresponding node on openstreetmap , if so, check if amenity , type of amenity. sample output follows: [ordereddict([(u'@k', u'amenity'), (u'@v', u'cafe')])] [ordereddict([(u'@k', u'amenity...

javascript - How to load "raw" row data into ag-grid -

i'm dealing high throughput problem. goal display, @ least on chrome browser, grid composed 1m of rows. these rows dynamically fetched python server running on same machine. server has loaded whole dataset in memory. communications between client (the browser) , server (python) take place through websocket. grid has option virtualpaging: true . so far reach performances loading pages of 100 rows each. despite that, loading whole 1m dataset @ beginning (therefore without remote fetching of rows) , shows significant improvement in scrolling (no "white rows" effect). i want achieve same performance without storing in browser memory whole dataset. the first step try avoid conversions steps. client receives server array of arrays, means row model on server "positional" (given r generic row, r[0] element related first column, r[1] second , on). callback function successcallback of ag-grid, require array of objects, means each row takes keys related col...

xcode - Can you stream from a HTTPS server using HLS? -

i'm wondering wether or not it's possible stream https server using hls, using following code - let url = nsurl(string:"http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8") let player = avplayer(url: url!) let playercontroller = avplayerviewcontroller() playercontroller.player = player self.addchildviewcontroller(playercontroller) self.view.addsubview(playercontroller.view) playercontroller.view.frame = self.view.frame player.play() i can stream http server, when changed url url of company's server doesn't work, difference video of company has https in it's url , apple's sample video doesn't, i'm testing on emulator in xcode yes, can stream hls https server. hls streams transfered on http , https http on tls , of time transparent client. thing need support https in player major ones have. https://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8 no...

sql - How to save the results of a query on variables for each field on Java? -

i need accomplish following: 1.- save on different variables each field of query result (oracle db). query result 1 o more rows (5 average). 2.- invoke webservice each row. 4.- wait webservice answer , repeat process. i think saving result of 1 row , invoke webservice easy problem when query result throws more 1 row. how can this? arraylist answer? edit: using following code. how can print arraylist see if connection working? if run get: com.packagename.somebean@1d251891 com.packagename.somebean@48140564 com.packagename.somebean@58ceff1 connection con = null; statement stmt = null; resultset rs = null; list<somebean> v = new arraylist<somebean>(); string query = "select * table rownum between 1 , 3"; try { class.forname("oracle.jdbc.driver.oracledriver"); con = drivermanager.getconnection("jdbc:oracle:thin:user/pass@localhost:port:sid"); stmt = con.createstatement(); rs = stmt.executequery(query...

jpa - java.lang.IllegalStateException: Unable to retrieve EntityManagerFactory for unitName CarLocPU -

Image
i'm beginning java ee netbeans 8.1, glassfish 4.1 , apache derby (included in glassfish). for purpose i'm calling put , store car data attributes. but simple facade returns "java.lang.illegalstateexception" whereas i'm seeing no mistakes in class files. here simple entity of model.car basic getters , setters : @entity @table(name = "car") public class car implements java.io.serializable { @id @generatedvalue(strategy = generationtype.sequence) private integer id; private string brand; private string model; private string year; private string energy; private string hp; private string tp; private byte[] picture; here "facade" entity store data in apache derby : @stateless public class carfacade extends abstractfacade<car> { @persistencecontext(unitname = "carlocpu") private entitymanager em; @override protected entitymanager getentitymanager() { retu...

ios - How To Create a iPad Device Difference Using Objective C? -

i trying create programmatically multiple devices screen sizes multiple ui differences on sizes. below code using different sizes within condition ipad screen sizes not showing full screen. me create full screen sizes within different device ipad. my code below : if (ui_user_interface_idiom() == uiuserinterfaceidiompad) { // device ipad , ipad mini running ios 3.2 or later. cgsize result = [[uiscreen mainscreen] bounds].size; if(result.height == 1366) { // ipad, ipad 2, ipad mini splashimage.frame = cgrectmake(0, 0, 768,result.height); [splashimage setimage:[uiimage imagenamed: @"default-portrait.png" ]]; activityindicator.frame=cgrectmake(145, 240, 30, 30); } if(result.height == 2008) { // ipad air, ipad mini retina splashimage.frame = cgrectmake(0, 0, 1536,result.height); [splashimage setimage:[uiimage imagenamed: @"default-portrait...

doctrine2 - Entity field type symfony 2.0 - show data from database in edit action -

here situation: i have 3 tables (one-to-many): product, productlabel, labeltag (label reserved -_-) as may have guessed, product can have many labels. now have form product shows labels available. new , create actions have been able show , save labels selected. problem comes when try display labels + show selected labels in edit action database. some code: entity product: /** * @var doctrine\common\collections\arraycollection $productlabels * * @orm\onetomany(targetentity="labeyrie\bundle\mainsitebundle\entity\productlabel", mappedby="product") */ protected $productlabels; entity labeltag: /** * @var doctrine\common\collections\arraycollection $productlabels * * @orm\onetomany(targetentity="labeyrie\bundle\mainsitebundle\entity\productlabel", mappedby="labeltag") */ protected $productlabels; entity productlabel: /** * @var labeyrie\bundle\mainsitebundle\entity\product $product * * @orm\id * @orm\manytoone(tar...

Can't connect Release Management client for Visual Studio to VSTS -

i want test microsoft release management visual studio online. i installed release management client visual studio 2013. installation worked fine unable configure , error message @ start: " current client version not compatible. must upgrade client " i installed update 4 latest version vs 2013. so don't understand can do. does solved issue? unclea me client not compatible because happend vso ou tfs 2013 well thank it's suggested use new features release hub in account. release templates , releases data create in wpf client not migrated new vnext service. 2 services (rm client + rm service , vnext rm services) co-exist until march 1st 2016 . have re-create release definitions using web interface before time.

c++ - boost::serialization with immutable abstract base and virtual inheritance -

the code below current thinking permit boost::serialization of immutable abstract base virtual inheritance. hope missed , there simpler solution...? as stands, raises few questions: is comment in iobject::serialize valid? the comment in bs::save_construct_data house seems indicate bug in boost::serialization . correct, or there better way this? is there more elegant way deserialise building deserialise function combined protected constructor? the result of (3) building implementation necessitate chunk of duplicated code. suspect require bit of crtp mitigate - alternatives? how 1 make work if virtual base contains data members? suspect similar (or identical) building::deserialise . #include <fstream> #include <boost/archive/xml_oarchive.hpp> #include <boost/archive/xml_iarchive.hpp> #include <boost/serialization/export.hpp> namespace bs = boost::serialization; // ibase comes external library, , not interested in...

Why am I seeing version numbers that shouldn't exist for my Android app? -

my app has option send support email, auto-includes app version @ bottom of email. email version doesn't exist. example current version of app 2.2 , may support email says version 2.2.9. in addition, i'm using crashlytics, shows versions. my assumption pirated versions don't know sure , hoping second opinion before respond or ignore support emails. from u said,somebody pirating apps , changing app version possible outcome think of. for making harder app piracting u use proguard

error handling - R - How to log messages to file AND console -

i want copy messages (such errors , warnings) file, still have them output console well, sink() not work. additionally, messages in file come line number or other location identifier, such as: line 20: there 18 warnings(use warnings() see them)

dictionary - How to plot a vector field with colormap in gnuplot? -

i have data in text file in following way x y dx dy z 1 0 1 2 5 2 3 3 3 6 2 4 5 4 8 . . . . . i'm using gnuplot , can plot vector field using columns x,y,dx,dy want plot color map using x,y , z on same graph. want vector field color map have no idea how this. please help! you can plot 'data' image . can plotting styles in gnuplot doc . then can combine vector plot , one. examples source code can find here: image « gnuplotting . way should able create graphs desired one: #your plot script without plot... plot 'data' u 1:2:5 image, \ # not scaled yet '' u 1:2:3:4 vector ...#your vector field plot note: thies works, if have data in form of 1 1 z1 1 2 z2 . . .. 1 n zn 2 1 z21 2 2 z22 . . ... 2 n z2n 3 1 ... . . ... so need datapoints without 'hole' in it... i'll continue tomorrow...

user interface - Unity 3D Several objects not showing on the screen everytime the level is loaded -

Image
i have simple 2d game , have strange problem whenever level loaded several of objects include platforms , enemies won't display on screen , neither 2d background objects there, can see in hierarchy , functioning should killing player , such. don't show on screen. able show them while pausing player during gameplay , set z position of camera -11 , above every time level reloads after death of player, same problem happens. i tested on mobile device same problem occurs furthermore can't interact of ui buttons on level, though check code them appropriate. please help. edit: okay after reading, replies, thought may help. o these errors every time load project in unity disappear once game running. as can see platforms , enemies appear on camera frustum when start game disappear. it's because near clipping of cam high; set 0.1 , try again.

python - Add key/values to dictionary using condition -

i have list of items i'm adding dictionary below: cols = ['cust', 'model', 'sn', 'date', 'charge', 'qty', 'total'] open('userfeeinvoicing.csv', 'r') infile: ranpak_dict = { row[2]: dict(zip(cols, row)) row in csv.reader(infile) } is there anyway add records have charge =/= 0 or charge > 0 rather use csv.reader() , use csv.dictreader() object . object makes lot easier both create dictionaries , filter rows; code, refactored use dictreader() , looks this: cols = ['cust', 'model', 'sn', 'date', 'charge', 'qty', 'total'] open('userfeeinvoicing.csv', 'r') infile: reader = csv.dictreader(infile, fieldnames=cols) ranpak_dict = {row['sn']: row row in reader} the csv.dictreader() object exactly dict(zip(cols, row)) call does; build dictionary each row, given sequence of fieldnames. filte...

c++ - How large should matrices be if I use BLAS/cuBLAS for it to perform better than plain C/CUDA? -

Image
i implementing stochastic gradient descent on gpu using cuda, thrust , cublas. in initial implementation used plain cuda perform matrix-vector operations, , i'm trying optimize using cublas such operations instead. what i'm observing matrices of size rows x cols, small number of cols, plain cuda consistently outperforms cublas, apparently regardless of number of rows. large number of cols however, cublas implementation wins out. so wondering: there rules of thumb/guidelines should minimal dimensions of matrices/vectors after using blas or cublas better performing plain c/cuda, or dependent on application/blas function? i have run few benchmarks post here: results linear regression task running 10 iterations of sgd, on datasets 10000 rows. implementation , more results available here: https://github.com/thvasilo/cuda-sgd-sese-project runtimes 10-100 features/columns: so implementation change-point @ plain cuda becomes slower @ 50 columns. there jump in ...

android - Query Content Resolver get all logs between two days -

i want create query contentresolver return call logs ( name , number , photo ) between specified time, needs sorted number of counts. mysql query like: select count(*) counts, calllog.calls.cached_name, calllog.calls.number, calllog.calls.cached_photo_id calls calllog.calls.date > '2016-02-02' , calllog.calls.date < '2016-02-04' group calllog.calls.cached_name order counts desc; this how made query, need group by , order : cursor cur = .getcontentresolver() .query(calluri, null, calllog.calls.date + " between ? , ?", wherevalue, null); can please me add group by name , order by count of each item?

entity framework - How to set optional field in code first approach in ASP.NET 5 and EF7 -

i working on project , set properties optional in code first approach. in class file have added [required] properties set not null in sql , properties not have [required] should set allow null in sql, properties contains id in it, sets not null in sql. below sample class contains properties should used when generating tables in database. set environmentlastdeployedid property optional when creates new database in mssql. public class version { public int id { get; set; } [required] public string packagename { get; set; } public string versionname { get; set; } public string originalpackagename { get; set; } [required] public string commitid { get; set; } public string commitmessage { get; set; } public int applicationid { get; set; } public application application { get; set; } public string createdby { get; set; } public int environmentlastdeployedid { get; set; } public environment environmentlastdeployed { get; set; } ...

java - Cannot Maximize Window with JavaFX -

i made custom minimize button way: public minimizebutton() { button button = new button("-"); button.getstyleclass().clear(); button.getstyleclass().add("actionbutton"); button.setonaction(new eventhandler<actionevent>() { @override public void handle(actionevent event) { stage stage = (stage) ((button) event.getsource()).getscene().getwindow(); stage.seticonified(true); } }); this.getchildren().add(button); } and called primarystage.initstyle(stagestyle.undecorated); the button working well. the issue when try maximize window once stage iconified, takes couple of seconds window redraw stage. any ideas on how make "maximizing process" of window faster? fixed using primarystage.initstyle(stagestyle.transparent); instead of primarystage.initstyle(stagestyle.undecorated);

database - python mysql.connector fetchall() run extremely slow -

i have simple sql query using python , mysql.connector query = 'select age, score patient' cursor.execute(query) dr = cursor.fetchall() or cursor.fetchone() print(dr) in phpmyadmin, query fast (0.003s). runs fast in python if use fecthone(). however, becomes extremely slow if use fetchall(). take few minutes , prints result. failed , halt. my data 440,000 lines. want plot score against age, have read data out. can me? ps: if rid of fetchall(), fetchone() , print, runs fast. how data , plot it? fetching all 440k records can legitimately slow. if want draw plot, don't need 440k points; screen 2000 4000 pixels wide, 100-200 times smaller. can show parts of plot fetching relevant part of data, or can pre-compute scaled-down version (iirc mysql not have native table sampling support). as side note: if care database performance @ all, routinely inspect query plans . plan fetching 1 record can drastically different plan fetching of them, , have different ...

php - Loop through database and display them in new file -

i have script loops through database , displays of it's contents. $select_report = $conn->prepare("select test_db report"); $select_report->execute(); while ($result_report = $select_report->fetch(pdo::fetch_assoc)){ echo $result_report["test_db"]; } my question is, can create html file has looped content? tried using script displays last row in generated html file. $select_report = $conn->prepare("select test_db report"); $select_report->execute(); while ($result_report = $select_report->fetch(pdo::fetch_assoc)){ $html_report = " <!doctype html> <html> <head> <title>sales report</head> </head> <body> <div class='container'> <table> <thead> <tr> ...

Qt images don't display in deployed app -

i deployed app because images don't show up. here did: created c:\deployment copied release version of myapp.exe c:\deployment copied .dll files c:\qt\5.2.1\mingw48_32\bin c:\deployment copied folders c:\qt\5.2.1\mingw48_32\plugins\ c:\deployment the program runs fine missing 2 images 1 displayed on label , on button. i tried creating c:\deployment\qml\myapp folder in moved images following direction in link below no success. https://wiki.qt.io/deploy_an_application_on_windows

java - Android: method call expected error -

i've searched internet error , have not found right answer. i've got error saying "method call expected" on mprefskeys in bindpreferencesummarytovalue(findpreference(mprefskeys(i))) public final static string [] mprefskeys = new string[]{"username", "devicename"} bindpreferencesummarytovalue(findpreference(mprefskeys(i))) public preference findpreference(charsequence key) { if (mpreferencemanager == null) { return null; } return mpreferencemanager.findpreference(key); } what error means? i spent significant effort search answer error means. then somehow reading ( java method call expected ) enlighted: array items should referenced [], not ().

rails i18n association -

i have question regarding i18n in rails when meeting assciations class user belongs_to :billing_address, :class_name => "address' belongs_to :delivery_address, :class_name => "address' end en: activerecord: attributes: user: billing_address_id: "billing address" delivery_address_id: "delivery address" the above code works, wonder if there way achieve not using _id suffix in yml? you heading in right direction. bit better: en: activerecord: models: address: 'address' user: 'user' attributes: address: city: 'city' zip_code: 'zip code' user: address_id: 'address id' have @ http://xyzpub.com/en/ruby-on-rails/3.2/i18n_mehrsprachige_rails_applikation.html

sql server - join confusion for mssql -

so want data table-a if attributes available items. i'm using following criteria filter out records select * product p inner join attributecodesbyproduct atp on atp.product_id = p.product_id , ltrim(rtrim(atp.attrval)) 'sil - ghi' or ltrim(rtrim(atp.attrval)) 'sil - def' or ltrim(rtrim(atp.attrval)) 'sil - abc' or ltrim(rtrim(atp.attrval)) not 'xyz' p.class = 2 basically want retrieve products class 2 , check attribute table make sure have attributes such ('sil - ghi', 'sil - def', 'sil - abc') , don't have attribute 'xyz'. i'm not sure if should right join or inner join don't want items attribute. single product, there may many different attributes. appreciate this. better way write query select * product p inner join attributecodesbyproduct atp on atp.product_id = p.product_id , ltrim(rtrim(atp.attrval)) in ( 'sil - ghi','si...

python - using a while loop instead of for loop -

secret_word = "python" correct_word = "yo" count = 0 in secret_word: if in correct_word: print(i,end=" ") else: print('_',end=" ") so outcome of code _ y _ _ o _ question how can same output using while loop instead of using loop. know have use index iterate on each character when tried failed . help? while count < len(secret_word): if correct_word [count]in secret_word[count]: print(correct_word,end=" ") else: print("_",end=" ") count = count + 1 thanks you can this: secret_word = "python" correct_word = "yo" count = 0 while count < len(secret_word): print(secret_word[count] if secret_word[count] in correct_word else '_', end=" ") count += 1

python - Serializer field filtering in Django Rest Framework? -

in serializers.py can do: class boxserializer(serializers.modelserializer): user = serializers.readonlyfield(source='user.email') playlist = primarykeyrelatedfield(allow_null=true, source='playlist.name', queryset=playlist.objects.all(), required=false) class meta: model = box i can (hardcoded, works): playlist = primarykeyrelatedfield(allow_null=true, source='playlist.name', queryset=playlist.objects.filter(user=user.objects.get(id=4)), required=false) i'm new @ this, , wondering if there way can request.user via method or something this: (i know incorrect, serves point across): playlist = primarykeyrelatedfield(allow_null=true, source='playlist.name', queryset=playlist.objects.filter(user=request.user), required=false) or can this(again incorrect): playlist = primarykeyrelatedfield(allow_null=true, source='playlist.name', queryset='get_playlists', requi...

python - PostgreSQL table inheritance and moving rows with SQLAlchemy -

in app (python, postgres, sqlalchemy) had 1 large table tasks . app works recent 1k rows in tasks , selecting , updating rows. such frequent operations slow due size of tasks decided split table 2 tasks tasks_all , table tasks inheried tasks_all (postgresql feature). thus app can work small table fast , when old data, can work large table, includes rows self , it's successor. here simplified classes tables: class taskbase: def __init__(self, id, parent_id, data): self.id = id self.parent_id = parent_id self.data = data def __repr__(self): return '<task: {} {}>'.format(self.id, self.data) class task(taskbase, base): __tablename__ = 'tasks' id = column(int, primary_key=true) parent_id = column(int, foreignkey('tasks.id')) data = column(text) children = relationship("task", backref=backref('parent', remote_side=[id])) class taskall(taskbase, base): __tab...

html - How do you add text vertically underneath a heading -

i creating marking form , there 4 headings, 1 comments, 1 max, 1 mark , last 1 section. how create subheadings directly underneath section heading vertically inline each other. **section** **max** **comments** **mark** dynamic intellij control active database underneath comments heading have 5 textboxes created centred in middle of page <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title></title> <style type="text/css"> p { text-align: center; color: red; font-weight: bold; } p1 { position: relative; left: 1040px; color: red; font-weight: bold; bottom:32px } p2 { position: relative; left: 100px; color: red; font-weight: bold; top:35px } p3 { position: relative; left: 350px; color: red; font-weight: bold; top:35px } </s...

Control SplitView borders in QML -

i have splitview , inside split view have 2 elements ( rectangle (users) , 1 item contains columnlayout (processes) ). user can choose if see users or not. if doesn't want see users, then, set rectangle width 0 , able see processes, problem in window, there 2 borders. 1 window, 1 splitview . any idea how can rid of these double border? try set visible attribute of rectangle false (instead of changing width 0) in example can change visible left 'border' of splitview (the border not border, it's splitview slider between first , second element): applicationwindow { title: qstr("hello world") width: 640 height: 480 visible: true splitview { anchors.fill: parent rectangle { id: rec width: 0 height: parent.height visible: false } rectangle { width: 200 color:"red" height: parent.height ...

mysql-connector-python loop over cursors very slow -

i not able query mysql database using mysql-connector-python (python version 3.5). trying pull out air_temperature particular datetime range entire list of stations. first query first stn works fine, 2nd hangs forever. import mysql.connector import datetime connection = mysql.connector.connect(host=' ', user=' ', passwd=' ', database=' ', port= ) stn_id = [‘stn_01’,’stn_02’, ’stn_03’, ’stn_04’, ’stn_05’] datetime_start = datetime.datetime(2016, 1, 1, 00, 00, 00) datetime_end = datetime.datetime(2016, 2, 1, 00, 00, 00) stn in range(0,n_stn,1): cursor = connection.cursor(buffered=true) q = """ select time_stamp, air_temperature %s time_stamp >= %s , time_stamp <= %s """ cursor.execute(q,(stn_id[stn], datetime_start, datetime_end)) temp_r...

mysql - INSERT INTO ... SELECT if destination column has a generated column -

have tables: create table `asource` ( `id` int(10) unsigned not null default '0' ); create table `adestination` ( `id` int(10) unsigned not null default '0', `generated` tinyint(1) generated (id = 2) stored not null ); i copy row asource adestination : insert adestination select asource.* asource; the above generates error: error code: 1136. column count doesn't match value count @ row 1 ok, quite strange require me mention generated query. ok, add column query: insert adestination select asource.*, null `generated` asource; this has worked fine in 5.7.10. however, generates error in 5.7.11 ( due fix : error code: 3105. value specified generated column 'generated' in table 'adestination' not allowed. ok, next try: insert adestination select asource.*, 1 `generated` asource; but still same error. have tried 0, true, false error persists. the default value stated allowed value ( specs or docs ). however, foll...

regex - How to write correct htacess rule? -

i have url looks like: http://example.com/index.php?page=item&id=92954 and need redirect http://example.com/item/show/92954 instead of 92954 there can other number id of item. how can create such htaccess rule? i using laravel backend. laravel provides within it: resource controllers make painless build restful controllers around resources. example, may wish create controller handles http requests regarding "photos" stored application. using make:controller artisan command, can create such controller read more resources in laravel laravel

mysql - Current_Timestamp on different time zone -

i made table this: create table options( id medium int not null auto_increment, email varchar(254) not null, created_at datetime default null, primary key(id) ); however.. after inserting value like: insert options values(0,'test@test.com',current_timestamp) i got created_at column value : 10:29 right time 16:29 . i believe that's because server/db located in , i'm in brazil. is there way my current time when inserting values table?

fileinputstream - Can we write data to a config.properties file using FileWriter and BufferedWrirter combination in a key value pair format -

using filewriter , can write key value pair username = "login_data" .properties file instead of .txt file? string value1 = "this value file writer"; system.out.println("key1 == " + value1); filewriter fw = new filewriter(datafilepath, true); bufferedwriter bw = new bufferedwriter(fw); bw.write(value1); bw.close(); to store properties better create properties object, put values , save via store() method. if want keep layout , comments too, it's worth looking @ apache commons propertiesconfigurationlayout : propertiesconfiguration config = new propertiesconfiguration(); propertiesconfigurationlayout layout = new propertiesconfigurationlayout(); config.setproperty("key", "value"); layout.setcomment("key", "description of key"); layout.setheadercomment("file description"); layout.save(config, new filewriter (file));

android - ListView layout weight -

Image
i have 2 linearlayouts in main activity. 1 of them used hold buttons , other 1 used hold listviews. add them dynamically clicking button @ bottom of screen. i want set layout weight ( 3f 1st , 2nd button , list , 1f third one) so, layout: <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context="majewski.ninja.myphonelibrary.listactivity" android:background="#000000"> <linearlayout android:orientation="horizontal" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" an...

yaml - Creating a new syntax for Sublime text 3 -

i'm trying create syntax highlighting flex . i'm using packagedev , yaml. so, want find blocks, starting %{ , ending %} , need highlight inside block c++ code. i thought 2 variants, both of them don't work: # ... # first - begin: '%\{' end: '%\}' contentname: patterns: - include: source.c++ # that's doesn't work # second - match: '%\{((?:.|\n)*)%\}' # regexpr works correctly name: source.c++ captures: '1': - include: source.c++ # that's doesn't work it works: - name: markup.italic.lex begin: '%\{' end: '%\}' patterns: - include: source.c++ manuals this , this . manual scope names here .

Are there specific performance benefits to upgrading a WinForms app from .NET 3.5 to the 4.6.x? -

i have number of older winforms apps on .net 3.5. i've read lot of speed improvements later .net frameworks seemed focused on server side. are there specific performance benefits reap on winforms side documented somewhere? see new features each asp.net version , able determine whether code heavily uses libraries have been optimized. what's new in .net framework .net 4.6.1 .net 3.5

Marketo activities.json API endpoint causing a timeout -

i trying use marketo activities.json api endpoint , , getting timeout everytime try. have set curl timeout 25 seconds , using valid nextpagetoken parameter filter results. timeframe yesterday , today. when try other endpoints ( lists.json , activities/pagingtoken.json , leads.json , lists.json , , stats/usage/last7days.json ) response , request not timeout. here request making activities.json : method: "get" url: "https://[marketo-id].mktorest.com/rest/v1/activities.json" parameters: array ( [nextpagetoken] => [paging-token] [listid] => [list-id] [activitytypeids] => 24 [access_token] => [access-token] ) why getting timeout activities.json endpoint? api endpoint broken or down? the global timeout marketo's rest api 30 seconds, can first try adjusting local timeout match this? if remove list id from call happens?

Calculating Averages Max and Min C++ -

// input : student name, 1 test grade perstudent // output: student averages, class averages, top student last student #include <string> #include <iostream> using namespace std; float calcavgclassgrade(int s1, int s2, int s3, int s4, int s5) { float avg, sum; // sum grades, , avg sum = s1 + s2 + s3 + s4 + s5; avg = sum / 2; return avg; } string getmax(int s1, int s2, int s3, int s4, int s5, string n1, string n2, string n3, string n4, string n5) { float max; string maxname; // compares each grade find max max = s1; maxname = n1; if (max < s2) { max = s2; maxname = n2; } if (max < s3) { max = s3; maxname = n3; } if (max < s4) { max = s4; maxname = n4; } if (max < s5) { max = s5; maxname = n5; } return maxname; } string getmin(int s1, int s2, int s3, int s4, int s5, string n1, string n2, strin...