Posts

Showing posts from February, 2015

php - Carbon::parse("25/10/1980") throws an error -

i'm facing odd issue, carbon::parse("25/10/1980") throws following error: exception message 'datetime::__construct(): failed parse time string (25/12/1980) @ position 0 (2): unexpected character' while having no problems whatsoever, if month (10) swapped places day (25) this: carbon::parse("10/25/1980") how should parse "d/m/y" string? try this: carbon::createfromformat('d/m/y', '25/10/1980')

reactjs - Global events and component's local state -

so have component, , let's when click on should trigger state change, e.g.: :on-click #(om/set-state! {:activated? true}) now, if want "deactivate" when clicked anywhere on document? guess use addeventlistener hooking onto document object, this: (componentdidmount [this] (events/listen (gdom/getdocument) (.-click events/eventtype) #(om/set-state! {:activated? false}) true)) now want, first of if have 200 instances of same component have 200 event listeners, right? which not desirable ok, guess the real question though how distinguish 1 instance of component when setting state? don't want of them "deactivated", 1 in context click event handler being triggered i think title of question points real problem: global events affecting local state. sounds me notion of being "activated" doesn't belong each of these components (as local state), higher in tree. otherwise, they'd function independently.

java - Spring Security multiple url ruleset not working together -

i have http spring security configuration appears work when comment out each individual aspect doesn't work when combine spring security rules together, know problem not regexmatcher or antmatcher rules applied in combination. here spring security class: package com.driver.website.config; import org.springframework.beans.factory.annotation.autowired; import org.springframework.beans.factory.annotation.value; import org.springframework.context.annotation.bean; import org.springframework.context.annotation.configuration; import org.springframework.security.config.annotation.authentication.builders.authenticationmanagerbuilder; import org.springframework.security.config.annotation.method.configuration.enableglobalmethodsecurity; import org.springframework.security.config.annotation.web.builders.httpsecurity; import org.springframework.security.config.annotation.web.builders.websecurity; import org.springframework.security.config.annotation.web.configuration.enablewebsecurit

c++ - 433 Receiver Arduino if statement -

433 mhz receiver arduino environment the transmitter sends y , n or m works fine. problem lies in receivers code. goal is, after receiver has value message equal n, suppose trigger if statement thing. need have system can determine if receiver takes in specific value. void loop() { if (vw_get_message(message, &messagelength)) // non-blocking { serial.print("received: "); (int = 0; < messagelength; i++) { serial.write(message[i]); const char *p = reinterpret_cast<const char*>(message); if(p == "n") { serial.print("if statement works when = n"); } } } } the problem, not job, , after 2 weeks of struggle, @ loss. code compile , run, if statement ignored. if (p=="n") compares 2 pointers. while contents point can identical, not mean pointers equal. you may want strcmp (c style) or std::string::

javascript - Displaying a DIV larger than its parent DIV -

i have 2 divs want display on same row (one on left, other on right). the left div: .leftdiv { position: relative; display: inline-block; width : 30%; } the right one: .right-div { float : right; width : 40%; background-color: lime; } the left div wraps 2 other divs: dropdown-content displayed after clicking on dropdiv . i want dropdown-content take half (50%) of page when set width 100% can not larger parent leftdiv (which must not exceed 30% of page). how fix this? js bin you can set 50vw (50% of viewport width).

ruby on rails - How to lazy-set Mongoid association -

i have 2 models associated has_one relationship. have callback initializes association. classes (roughly) this: class user has_one :relevance, class_name: 'user::relevance', inverse_of: :user, dependent: :destroy after_create :initialize_relevance def initialize_relevance self[:relevance] = user::relevance.new end # other garbage *should* irrelevant end class user::relevance belongs_to :user, inverse_of: :relevance, index: true # more other garbage *should* irrelevant end sometimes relevance association gets wonked state nil. when happens, want re-initialize relationship when called , return instead of nil. in class user , have this: def relevance self[:relevance] = user::relevance.new if self[:relevance].nil? self[:relevance] end except doesn't work , nil still returned. i've tried same update_attribute(user::relevance.new) , self.create_relevance nil seems returned. not sure go here , love ideas. can provide more code

ember.js - Ember js warning with three.js -

what correct way use ember js three.js . have tried using cdn editing index.html file works fine warning in ember-cli three not being defined. installing bower , using app.import gave me similar warnings. the app works fine wanted know best way import in case three.js ember application without warnings. that jshint warning because isn't aware of global three variable you're trying access. have 2 ways fix it: put globals directive @ top of file uses variable. setup .jshintrc 's predef . hope helps!

sql - Check string starts with specific letter -

please me below query , want check if string starts 'g' or 'f' in condition along existing condition. here query first query :- select top 1 lc_id, isnull(lc_ud, 0) record contract lc_id = 'f01' output f01 | 1 ( if available) else no record return. second query: if lc_id starts 'f%' or 'g%' how can integrate both query 1 if there no record available 'f01' value, check if lc_id starts f & g return output f04 | 1 else no record return. you want prioritize values being returned. because want one, can order by : select top 1 lc_id, coalesce(lc_ud, 0) record contract lc_id '[fg]%' order (case when lc_id = 'f01' 1 else 2 end); note: assumes using sql server (based on syntax).

Python: Turn List of Tuples into Dictionary of Nested Dictionaries -

so have bit of issue on hands. have list of tuples (made of level number , message) become html list. issues before happens, turn tuples values dictionary of nested dictionaries. here example: # have list of tuples in format of (level_number, message) tuple_list = [(1, 'line 1'), (2, 'line 2'), (3, 'line 3'), (1, 'line 4')] # , want turn a_dict = { 'line 1': { 'line 2': { 'line 3': {} } }, 'line 4': {} } any appreciated, long valid python 3. thanks! as pointed out in comment, should consider changing incoming data structure if have control @ on it. sequential list of tuples not ideal you're doing here. possible if treat tree. let's build (sane) data structure parse with class node(object): def __init__(self, name, level, parent=none): self.children = [] self.name = name self.level = level self.parent = parent def m

spring - MultiTenantConnectionProvider implementation has null autowired datasource -

i'm trying support multi-tenant schema in spring boot (1.4) application. have following in config: hibernate: format_sql: true default_schema: corrto multitenancy: schema tenant_identifier_resolver: com.config.headertenantidentifierresolver multi_tenant_connection_provider: com.config.schemapertenantconnectionprovider my multitenantconnectionprovider implementation follows: public class schemapertenantconnectionprovider implements multitenantconnectionprovider { @autowired private datasource datasource; @override public connection getanyconnection() throws sqlexception { return this.datasource.getconnection(); } @override public void releaseanyconnection(connection connection) throws sqlexception { connection.close(); } @override public connection getconnection(string tenantidentifier) throws sqlexception { final connection connection = this.getanyconnection();

streaming - Gstreamer. Multiple pcap to avi -

i have multiple .pcap files 01.pcap, 02.pcap,...n.pcap, includes 2 streams, audio-g.711 video-h.264. every pcap has ~1 min of streaming , need make 1 .avi. use mergecap.exe concatenate pcaps 1 big pcap. mergecap.exe -f pcap 01.pcap 02.pcap ....n.pcap -w out.pcap after use gstreamer make .avi file gst-launch-1.0 filesrc location=out.pcap ! tee name=t ! pcapparse dst-ip=192.168.2.55 dst-port=5010 ^ ! application/x-rtp, media=(string)video, clock-rate=(int)90000, encoding-name=(string)h264, payload=(int)96 ^ ! rtpjitterbuffer ^ ! rtph264depay ^ ! h264parse ^ ! queue^ ! mux. t. ! pcapparse dst-ip=192.168.2.55 dst-port=4010 ^ ! application/x-rtp, media=(string)audio, clock-rate=(int)8000, encoding-name=(string)pcma, channels=(int)1, payload=(int)8 ^ ! rtpjitterbuffer ^ ! rtppcmadepay ^ ! queue ^ ! mux. avimux name=mux ! filesink location=test.avi this pipeline works 1 pcap well.. when conate

elixir - Ecto declare schema for a query -

i'm trying run query: select last_sd.* (select distinct(sensor_id) sensor_data) s left join lateral (select * sensor_data sd1 sd1.sensor_id = s.sensor_id order sd1.received_at desc limit 1) last_sd on true the closest got is: from s in iotinabox.sensordata, distinct: true, select: s.sensor_id |> join(:left_lateral, [s], sd in fragment("select * sensor_data sd1 sd1.sensor_id = ? order sd1.received_at desc limit 1", s.sensor_id)) |> select([s, sd], sd) this works partially, since throws postgresql requires schema module when using selector "f1" none given. please specify schema or specify fields "f1" desire in query meaning since don't have from s in sensordata doesn't know ecto model use, is there way tell ecto schema use query result? maybe not perfect works me (using names project in example below): keys = division.__schema__(:fields) query = d in "divisions", select: map(d, ^keys) result = rep

c# - CSV file is not downloading in asp.net because Respose.Write isn't working -

i'm creating csv file stringbuilder and i'm trying download file following code: response.clear(); response.buffer = true; response.addheader("content-disposition", "attachment;filename=report.csv"); response.charset = "utf-8"; response.contenttype = "text/csv"; response.output.write(sb.tostring()); response.flush(); response.end(); i'been using same code in other projects no problem, in 1 when click export button code executed nothing happens, no exception, no error, nothing. also try following: response.write(sb.tostring()); , "application/text" or application/csv anyone can point me in right direction make work? update for reason don't understand yet, response.output.write or response.write not working because can't anything, not single string or javascript alert. any idea? remove line response.flush(); because response.buffer = true . and use response.write(sb.tostring());

bash - search through file for data and create new txt file with just that data -

i have txt file output machine bunch of writing/data/paragraphs not used graphing purposes, somewhere in middle of file have actual data need graph. need search file data , print data txt file can graph later. the data in middle of file looks (with each data file potentially having different amounts of rows/columns , numbers separated spaces): <> 1 2 3 4 5 6 etc. 1.2 1.3 1.4 etc. b 0.2 0.3 0.4 etc. c 2.2 2.3 2.4 etc. etc. my thinking far grep '<>' find first line (grep '^<>' file) i'm not sure how account variable amount of rows/columns when trying find them. also, using awk loop on .txt files in directory , print new outfile can multiple files @ once (so maybe can search/printing in awk well?). edit: --input/expected output file-- input file this data here paragraphs <> 1 2 3 1.2 1.3 1.4 b 0.2 0.3 0.4 c 2.2 2.3 2.4 more paragraphs more paragraphs output file: <> 1 2

windows 10 - UWP app definition -

we're going develop uwp app , it'll mobile , desktop. in our presentation, our app universal, not testing or deploying on surface hub, holo lens , xbox? if refer first paragraph of official documentation : the uwp provides guaranteed core api layer across devices. means you can create single app package can installed onto wide range of devices. but: because uwp app runs on wide variety of devices different form factors , input modalities, want tailored each device , able unlock unique capabilities of each device. devices add own unique apis guaranteed api layer. can write code access unique apis conditionally app lights features specific 1 type of device while presenting different experience on other devices. so universal on condition not triggering platform specific api codes. , ui, uwp using adaptive ui let app fit different screen size.

php - mysqli equivalent to mysql_query("BEGIN") -

i'm in process of upgrading our code base php5.4 php7. in our tests wrap entire test in transaction command mysql_query("begin"); then bunch of stuff mysql_query("rollback"); then between 2 commands treated transaction , rolled @ end of test. have not been able achieve functionality in php7 mysqli. tried using mysqli_autocommit function did not allow different queries within test have access created data earlier in test. if each insert in own transaction. update: the issue every time create new adapter table, seems creating new connection db. php5 , command above 'mysql_query("begin")' every connection contained in transaction , statements rolled back. have not found way php7. if use $mysqli->begin_transaction(); then single connection part of transaction. in order achieve desired functionality, have implicitly force every adapter use existing connection rather creating own. imagine there way php7 automatically you?

javascript - Handling linking accounts in Firebase -

i following firebase's instruction on social login. below example of using , working fine login authentication perspective. i have, however, both google , facebook login working independently. what able link accounts. can see below in fact might go ( see comment ): if using multiple auth providers on app should handle linking user's accounts here. i have tried many variations of think should go here, no avail. can guide me in relation think should go here? thanks! function initfbapp() { // result redirect auth flow. // [start getidptoken] firebase.auth().getredirectresult().then(function (result) { if (result.credential) { // gives facebook access token. can use access facebook api. var token = result.credential.accesstoken; // [start_exclude] document.getelementbyid('fbquickstart-oauthtoken').textcontent = token; } else { document.getelementbyid('fbqui

android - passing value from Service to many Activities -

i need pass value service many activities, of them haven't been initialized, want these value in initialization. know broadcast can useful way, it's relatively slow. there way can achieve goal? thank you! one option use greenrobot's eventbus , using sticky events feature. have activities register bus in onstart() , unregister in onstop() . have service post events on bus needed poststicky() . activities events: when posted when register on bus, if sticky event posted before created — last such event

javascript - Install all JSPM dependencies in gulp task -

i want have 1 command download dependencies project need. should gulp dependencies . have jspm dependencies in fronted , can install them typing jspm install in command line. want automate gulp (it take care other dependencies, too, pip, composer etc). here have tried: gulp.task('dependencies', ['deps-composer', 'deps-jspm', 'deps-pip']); // others gulp.task('deps-jspm', function (done) { require('jspm').install().then(done); }); however, creates empty jspm_packages directory , not download anything. i have succeeded following gulp.task('deps-jspm', function (done) { require('child_process').execsync('jspm install'); }); but looks overkill , requires jspm installed globally. the directory structure normal , i.e. there package.json , config.js , gulpfile.js in root directory. jspm.install() expects package name first argument in order install specific package. if want install al

group by - How to combine WHERE and HAVING in a MySQL query -

how write query mysql filter out total pay less zero. have tried different commands using 'having' can't figure out proper syntax. this command: select tickets.idno, tickets.pay, tickets.material tickets ( tickets.pay <> 0 or tickets.material <> 0 ) , tickets.district = 'ho' , tickets.datepaid null order tickets.name with result set: ho0045 -140 0 ho2203 -45 0 ho2411 -5 0 ho2411 20 0 ho3448 -156 0 ho2519 2000 0 ho0075 -300 0 ho1669 -55 0 ho2666 -200 0 ho2666 -200 0 ho3447 -400 0 ho3447 400 0 this result now, needs eliminate records total pay + total material rows given idno less zero. example; rows ho2411 , ho2519 should appear not rest. having meant filter out whole groups, that, need reduce query group by . unfortunately can't reverse grouping operation after filtering groups. so have subquery filter groups, join result table find rows corresponding idno: sel

indexing - Excel Cross Sheet INDEX/MATCH inconsistencies -

hi i'm trying run index match values table. my code =index(book2.xlsx!ti[[#all],[03- il]],match(b4,book2.xlsx!ti[[#all],[prog '#]])) i have values match against in column b, numbers in 100-900 range. matching them against table on sheet numbers in same range. i value want pull sheet in other 1 in line matches in table. the problem have values pulling correctly. wont pull, of them appear once. i've included pictures of tables relevant information blurred out. i've tried formatting cells numbers, text, , general. https://imgur.com/a/7ijuz chris neilsen answered question above. "you doing nearest match (by leaving out 3rd parameter of match, defaults 1) requires search column sorted, not. add 0 3rd parameter" – chris neilsen

MySQL table: BIT(1) not null default b'1', however, always default to '0' -

this how created table: create table `item_spa_cust` ( `id` int(10) not null auto_increment, `spa_id` int(10) null default null, `type` varchar(20) not null collate 'latin1_swedish_ci', `is_valid` bit(1) not null default b'1', `company_name` varchar(50) null default null collate 'latin1_swedish_ci', `custno` varchar(6) null default null collate 'latin1_swedish_ci', primary key (`id`), index `fk_item_spa_cust_item_spa` (`spa_id`), constraint `fk_item_spa_cust_item_spa` foreign key (`spa_id`) references `item_spa` (`id`)) ; i expecting is_valid field default '1' set it, however, it's defaulting '0'. i'm confused this, please help. you should use 1 , rather b'1' that being said, in sqlfiddle, works expected. if you're inserting , looking default value, should not specify in insert query.

Storm pulling in stale dependencies -

we trying upgrade storm 0.10.0 1.0.2 , our project uses kafka-spout between versions, backtype.storm package-names changed org.apache.storm package-names storm-community. as part of our own upgrade, had change storm-kafka 's version 1.0.2 but when run topology on storm, error missing classes older version: apache-storm-1.0.2/bin/storm \ jar \ $jarfile \ org.apache.storm.flux.flux \ $yamlfile \ --remote +- apache storm -+ +- data flow user experience -+ version: 1.0.2 parsing file: topology-config.yaml 333 [main] info o.a.s.f.p.fluxparser - loading yaml input stream... 335 [main] info o.a.s.f.p.fluxparser - not performing property substitution. 335 [main] info o.a.s.f.p.fluxparser - not performing environment variable substitution. exception in thread "main" java.lang.noclassdeffounderror: backtype/storm/spout/multischeme @ java.lang.class.forname0(native method) @ java.lang.class.forname(class.java:264) @ org.apache.sto

java - Add All Sub domain name on crosssorigin -

i have list of subdomain abc.sitename.com, xyz.sitename.com, pqr.sitename.com, etc. wondering can add *.sitename.com in cross-origin tag. @crossorigin(origins={"http://*.sitename.com"}) i using spring boot. having cross-origin issue able resolve using @crossorigin tag, have 55 sub-domain going access restful service. do have use regular expression this.? if how can write inside @crossorigin annotation.?

MAMP Pro 4 and Sophos Warning about Adminer Database Manager -

i have been using sophos anti-virus on mac several years results. when attempting download new mamp pro 4.x, received sophos alert mamp installer contains adminer database manager, identifies known adware , pua. has experienced similar warning, , there reason concern warning? the real information can find adminer this: http://philipdowner.com/2012/01/using-adminer-with-mamp-on-mac-os-x/ this post indicates adminer type of script designed alternative phpmyadmin. can remove adminer after installing? -- lee i got same warning , google chrome flags mamp 4 pkg file having virus. appears official download of adminer throws same warning sophos (from website): https://www.adminer.org/ so, issue not related mamp rather adminer application. think it's false positive since i've seen sophos antivirus software flags adminer.php, can remove file applications/mamp/bin/adminer.php without affecting functionality of mamp, since point out phpmyadmin alternative. del

amazon web services - creating instance and installing git using ansible -

i created ec2 instance using ansible after creating instance not downloading git package. code: ec2: key_name: "{{ key }}" aws_access_key: "{{ aws_id }}" aws_secret_key: "{{ aws_key }}" region: "{{ aws_region }}" image: ami-2322b6123 instance_type: t2.micro - name: install git yum: name=git state=present so , can please know if there way install package after creating ec2 instance using ansible? after launching ec2 instance, have run play (to install git) in newly launched instance, not in control host. have register launched, add host inventory , install package. follow example in ansible documentation: ec2 module - name: create instance ... ... tasks: - name: launch instance ec2: key_name: "{{ key }}" aws_access_key: "{{ aws_id }}" aws_secret_key: "{{ aws_key }}" region: "{{ aws_region }}"

asp.net - Using (Preferably) C# Razor or JQuery to find which button opened the modal and setup modal dynamically -

so have modals similar in our asp.net mvc project , want set them dynamically don't have have many files strewn on place. once i've clicked button , opened modal how check button opened modal can custom logic , inject specific html? button #1 : <a class="btn btn-primary margin-bottom-5" data-toggle="modal" data-target="#newbugmodal"> <i class="fa fa-lg fa-fw fa-plus"></i> new bug </a> <div class="modal fade" id="newbugmodal" tabindex="-1" role="dialog" aria-labelledby="newbugmodallabel" aria-hidden="true"> @html.partial("_bugmodal") </div> button #2 : <a href="#" class="btn btn-default" data-toggle="modal" data-target="#bugeditmodal"> edit </a> <div class="modal fade" id="bugeditmodal" tabindex="-1" role="dialog"

c# - Unable to edit db entries using EFCore, EntityState.Modified: "Database operation expected to affect 1 row(s) but actually affected 0 row(s)." -

i'm using identity core 1.0 asp.net mvc core 1.0 , entity framework core 1.0 create simple user registration system this article starting point, , trying add user roles. can add user roles, i'm unable edit them. here edit action in rolescontroller : [httppost] [validateantiforgerytoken] public iactionresult edit(identityrole role) { try { _db.roles.attach(role); _db.entry(role).state = microsoft.entityframeworkcore.entitystate.modified; _db.savechanges(); return redirecttoaction("index"); } catch (exception ex) { console.writeline(ex); return view(); } } here form in corresponding view: @model microsoft.aspnet.identity.entityframework.identityrole @{ viewbag.title = "edit"; } <h2>edit role</h2> <hr /> @using (html.beginform()) { @html.antiforgerytoken() @html.validationsummary(t

button in frames in python -

Image
design of game need develop strategic tic tac toe(where in each block of tic tac toe find tic tac toe)....so here created 9 frames , each frame has 9 buttons... when click button in frame changes appear in 1 frame ie; in (0,2) know because last frame called..so need rectify problem...i tried did not in advance here's code from tkinter import * root = tk() root.title("simple design") root.geometry("300x300") class design: count = 0 def __init__(self): self.duplicates = {} self.block = {} self.button = {} in range(3): j in range(3): self.duplicates[i, j] = "." self.frame() def frame(self): i, j in self.duplicates: self.block[i, j] = frame(root, background="blue") self.block[i, j].grid(row=i, column=j, ipadx=5, ipady=2) self.button_create(self.block[i, j]) def button_create(self, frame): i, j in sel

asp.net - Detect session timeout after Response.Redirect? -

i implementing log-in/log-out functionality on website. whenever user clicks on sign out button (anywhere @ login page, login.aspx ), following method execute: protected void signout(object sender, eventargs e) { session.abandon(); response.redirect("login.aspx"); } now, when redirect happens, want following in login.aspx : protected void page_init(object sender, eventargs e) { if ( session_has_timed_out ... ) sessiontimeoutdiv.text = "session timed out. please log in again."; else { // normal logic here ... } } q: how check session terminated, given need check (1) after actual call session.abandon() , (2) after redirected call session.abandon() had happened? yes that's why authentication recommended rely on cookie , use formsauth or asp.net identity. if mvc have tempdata webforms don't think there such thing. can use other state management techniques query string response.redirect("logi

asp.net - How to count value in array with exception? -

i have array having integer value dim array1() integer = new integer() {14,12,0,4,25,0} i count number of elements not zero. result 4 in array above. i used lambda expression , .findall : dim array1() integer = new integer() {14, 12, 0, 4, 25, 0} dim matcheditems() integer = array.findall(array1, _ function(x) x > 0) msgbox(matcheditems.count) it find items within array item > 0.

xamarin - GTK# - toolbar buttons with custom images -

when create toolbar buttons in gtk# in xamarin studio seems can assign images stockid (stock.new, stock.open etc). there way assign custom images toolbar buttons? you can pass widget parameter in toolbutton constructor: var tbar = new toolbar(); var icon = new image("icon.png"); var button = new toolbutton(icon, "so"); tbar.add(button); in case, icon.png no path assigned it, should exist in application directory, set "copy output directory". you can create image passing gdk image , mask, story...

Openstack swift with ceph backend (radosgw) -

Image
i trying use openstack (liberty) swift ceph (jewel) using radosgw. aim objects should stored under ceph osds. have working openstack , ceph cluster. to use ceph object storage backend installed , configured radosgw in ceph cluster . in openstack node installed "python-swiftclient", created object-store service , added endpoint service url of radosgw. i followed instructions given in link below. http://docs.ceph.com/docs/jewel/radosgw/keystone/ ceph.conf [client.rgw.rgw] rgw_frontends = "civetweb port=7480" rgw enable ops log = true rgw ops log rados = true rgw thread pool size = 2000 rgw override bucket index max shards = 23 ms dispatch throttle bytes = 209715200 [client.radosgw.gateway] rgw keystone url = http://controller:35357 rgw keystone admin token = admin rgw keystone accepted roles = _member_,admin rgw keystone token cache size = 200 rgw keystone revocation interval = 60 rgw s3 auth use keystone = true nss db path = /var/ceph/nss openstack

Camera screen goes to dark when return from another activity -- Android -

in program used camera take video , preview. both happens in surfacetexture. after preview when go previous page take video, texture went full dark , nothing happen. it shows failed open camera service dequeuebuffer: can't dequeue multiple buffers without setting buffer count so me solve issue

Android Default camera capture image return image URI null -

i opening default camera app capture image in application not getting captured image uri. below code - code open camera - inittmpuris(); intent intent = new intent(mediastore.action_image_capture); intent.putextra(mediastore.extra_output, capturedimageuri); intent.putextra("return-data", true); code create image path store - private void inittmpuris() { file proejctdirectory = new file(camerautil.folder_path + file.separator + camerautil.folder_name); if (!proejctdirectory.exists()) { proejctdirectory.mkdir(); } file tempdirectory = new file(proejctdirectory, "temp"); if (!tempdirectory.exists()) { tempdirectory.mkdir(); } else { // delete old files (file file : tempdirectory.listfiles()) { if (file.getname().startswith("tmp_") || file.getname().startswith("croped_")) { } } } capturedimageuri = uri.fromf

html - Transparent border to hidden background with CSS -

i've thrown jsfiddle try show i'm thinking, i'd have hidden background under whole site , have links display background through transparent border when hovered over. can't figure out how hide background , still able show in border during hover. here's i've got far. body { background-image: url("http://img05.deviantart.net/7fa2/i/2015/185/2/1/neon_rainbow_stripes_by_wolfy9r9r-d8zv7ba.png"); background-repeat: repeat; } ul { list-style-type: none; margin: 0; padding: 0; overflow: hidden; } li { float: left; } li { display: block; color: #666; text-align: center; padding: 14px 16px; text-decoration: none; } li a:hover { color: #222; border-bottom: 1px solid transparent; } .overlay { position: fixed; width: 100%; height: 100%; left: 0; top: 0; background: #fff; z-index: 10; } .content { position: relative; z-index: 15; } <div class='overlay'></

c - What does gcc linking option / LOCAL_CFLAGS -rdynamic do -

i working on android ndk project. when try modify project file (android.mk) found linking option -rdynamic after reading reference, still not sure meaning of flag. the project working on. has 2 parts: - multiple client applications. - multiple shared libraries. (each client has corresponding shared library) - background daemon processes: process manager , launcher. first, client application. once client starts run, able communicate manager process. manager use dlopen() load corresponding shared library based on launcher process. after that, manager create new launcher process. i felt link flag has background process, not sure. thanks reference: https://gcc.gnu.org/onlinedocs/gcc/link-options.html#link-options -rdynamic pass flag -export-dynamic elf linker, on targets support it. instructs linker add symbols, not used ones, dynamic symbol table. option needed uses of dlopen or allow obtaining backtraces within program. adding -rdynamic local_cflags nothi

sockets - c++ - What does ptr->ai_family do vs AF_INET -

i going through msdn's " getting started winsock " , open socket parameters struct addrinfo *result = null, *ptr = null, hints; iresult = getaddrinfo( argv[1], default_port, &hints, &result ); ptr=result; connectsocket = socket( ptr->ai_family, // address family (address families ipv6 ipv4) ptr->ai_socktype, // type (like tcp, udp ect) ptr->ai_protocol // protocol use (0 = service provider chooses) ); but binarytides " winsock tutorial " (they using c have seen people in c++) s = socket( af_inet , sock_stream , 0 ) what ptr-> do? , why use on setting af_inet? also if have free time , know sockets appreciate help. socket(ptr->ai_family,ptr->ai_socktype, ptr->ai_protocol); passes in variables create socket, instead of hard coding values. advantage code

python - Multiprocessing: main programm stops until process is finished -

i know, minimal working example gold standard , working on it. however, maybe there obvious error. function run_worker executed upon button press event. initiates class instance , should start method of class. function run_worker waits until class method has finished. result kivy gets stuck , cannot other stuff. ideas how should use multiprocessing in case ? from multiprocessing import process class settingsapp(app): """ short not working version of actual programm """ def build(self): """some kivy specific settings""" return interface """this part not work expected. run pushing button. however, function hang until process has finished (or has been killed).""" def run_worker(self): """the phbot application started second process. otherwise kivy blocked until function stops (which controlled close button) ""

XML to List in C# -

this xml: <packages> <package> <id>1</id> <prerequisites> <prerequisite>7</prerequisite> <prerequisite>8</prerequisite> </prerequisites> </package> <package> <id>2</id> ..... </package> .... </packages> and list: class lista { public int id {get; set;} public list<int> pre{get;set;} } how can add xml pattern list of lista class , have got far bot put 1 in second list. xdocument xdoc = xdocument.load("employee.xml"); var listpckage = (from item in xdoc.descendants("package") orderby item.element("id").value select new { id = item.element("id").value, prerequisite = item.element("prerequisites").element("prerequisite").value, }).tolist(); foreach works shoing them

javascript - Bootstrap Form Validation - color doesn't change -

i followed link build form validation consist of name , username @ localhost. the problem facing when clicked sign when both fields empty, error "the field required" displays when had input name or username, displays "ok!" in red though assigned css green under label.success. please help. index.html body { width: 100%; height: 100%; } html { width: 100%; height: 100%; } @import url("assets/css/bootstrap.min.css"); @import url("assets/css/bootstrap-responsive.min.css"); label.valid { font-weight: bold; color: green; padding: 2px 8px; margin-top: 2px; } label.error { font-weight: bold; color: red; padding: 2px 8px; margin-top: 2px; } <!doctype html> <html lang="en"> <head> <title>form</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <l

c# - How to Change URL in current Browser session while selenium Test is running -

i need change url while test running . example, i'm on https://www.google.com.au when select first link navigated particular link . doing need update link url . i tried below not working . string myaccounturi = "my-account /#account-validation"; string z = (configurationmanager.appsettings["testenv"] + string.join(",", myaccounturi)); pagemanager.driver.navigate().gotourl(z); above code working me. it's in myaccounturi white-space creating issue while trying navigateto url. below fixed . string myaccounturi = "my-account/#account-validation";

java - unable to see Maven In Eclipse -

i installed m2e plugin in eclipse mars , maven installed in system unable see maven option while i'm trying import maven project , unable see maven option while trying configure existing java project maven project. if have correct (64b) versions, follow this steps . installing maven in windows extract maven zipped file in folder (preferible c:\program files\ ) add bin directory of created directory apache-maven-3.0.3 path environment variable. check environment variable value e.g. echo %java_home% must like: c:\program files\java\jdk1.7.0_51 adding maven folder path: add unpacked distribution’s bin directory user path environment variable opening system properties ( winkey + pause ) select “advanced” tab, , “environment variables” button selecting path variable in user variables value , addd c:\program files\apache-maven-3.0.9\bin . check folder same!!! if not set, same dialog can used set java_home location of jdk , e.g. c:\program files

etl - Cannot remove any component / connection in Talend -

Image
i installed talend last month, , no component can deleted, shown below: no job running, , happens jobs. cannot modification @ all. how solve issue? case the context menu in talend inconsistent. no means actions available there time. need know specific menus or key commands. solution row iterators for case there 2 approaches: click row1 , hit del on keyboard re-route little black dot @ i drag , drop components input , set. components the same here, click on , hit del . note: if have further issues jobs, please open specific questions issues.

c++ - OpenCV goodFeaturesToTrack's status are zeros -

trying implement optical flow ios opencv 3.1 . i built basic stuff shown in below code , features points goodfeaturestotrack thing no point being tracked , , status results zeros (not tracked). cv::mat gray; // current gray-level image cv::mat gray_prev; std::vector<cv::point2f> features; // detected features std::vector<cv::point2f> newfeatures; std::vector<uchar> status; // status of tracked features std::vector<float> err; // error in tracking cv::termcriteria _termcrit = cv::termcriteria(cv::termcriteria::count|cv::termcriteria::eps,20,0.03); -(void)processimage:(cv::mat&)image { //-------------------- optical flow --------------------- cv::cvtcolor(image, gray, cv_bgr2gray); if(gray_prev.empty()) { gray.copyto(gray_prev); } cv::goodfeaturestotrack(gray, features, 20, 0.01, 10); cv::calcopticalflowpyrlk(gray_prev, gray, features, newfeatures, status, err, cv::size(10, 10), 3, _termcrit, 0, 0

multithreading - Why do I get Access Violation in mutithreading aplication in C while I exit the main() before the threads finish? -

i have 1 program, create 4 threads wait 1st thread[0]. threads print contents. when below program access violation sometimes . #include<windows.h> #include <stdio.h> #include<tchar.h> #define keylen 8 #define datalen 56 typedef struct _record{ char key[keylen]; tchar data[datalen]; }record; #define recsize sizeof(record) typedef record *lprecord; typedef struct _threadarg{ dword ith; lprecord lowrecord; // pointer low record lprecord highrecord; } threadarg, *pthreadarg; static int keycompare(lpctstr, lpctstr); static dword winapi sortthread(pthreadarg ptharg); static dword nrec; // total number of records sorted static handle *pthreadhandle; dword options (int argc, lpctstr argv [], lpctstr optstr, ...); int _tmain(int argc, lptstr argv[]){ handle hfile, mhandle; lprecord precords = null; dword lowrecordnum, nrecth,numfiles, ith; large_integer filesize; bool noprint; int iff, inp; pthreadarg threadarg; lptstr stringe

java - How to insert values in a table with dynamic columns Jdbc/Mysql -

i want add values in table has dynamic columns. managed create table dynamic columns cannot figure out how insert data. //create table sql = "create table mydb.mytable" + "(level integer(255) )"; int columnnumber = 5; //number of columns //add columns (i=0;i<columnnumber;i++){ string columnname = "level_" +i: string sql = "alter table mydb.mytable add " + columnname + " integer(30)"; } //insert data //how insert data dynamically, without knowing number of columns? you can use database metadata column names. has advantage don't need know column names, rather retrieved dynamically in code. public static list<string> getcolumns(string tablename, string schemaname) throws sqlexception{ resultset rs=null; resultsetmetadata rsmd=null; preparedstatement stmt=null; list<string> columnnames =null; string qualifiednam