Posts

Showing posts from January, 2012

c# - FTPWebRequest: The underlying connection was closed: An unexpected error occurred on a receive -

i've got problem when uploading files ftp server. connection works fine on local connection - however, im trying connect public ip address of system ( ftp://xx.xxx.xxx.xx ). can connect fine on filezilla upload , download files - however, reason not seem work. this code im using create webrequest: ftpwebrequest request = (ftpwebrequest)webrequest.create("ftp://xx.xxx.xx.xxx" + uploadpath); request.usebinary = true; request.keepalive = false; request.method = webrequestmethods.ftp.uploadfile; that runs fine in debug mode, filepaths allowed, etc.. however, code throwing error in section here: byte[] b = file.readallbytes(tarpath); request.contentlength = b.length; using (stream s = request.getrequeststream()) { s.write(b, 0, b.length); } ftpwebresponse ftpresp = (ftpwebresponse)request.getresponse(); if (ftpresp != null) { debug.writeline(ftpresp.statusdescription); } any ideas? i've searched through various online posts error , of them in regard...

logstash - Remove unnecessary fields in ElasticSearch -

we populating elasticsearch via logstash. thing see unnecessary fields had remove example: @version file geoip host message offset tags is possible defining/extending dynamic template? if yes, how? if no, can via logstash configuration? your appreciated. you can remove fields using logstash filter - when filter succeeds, remove field. it makes sense me use mutate: filter { mutate { remove_field => [ "file" ] } } that said, of these fields incredibly useful , should not removed.

Atom editor locking git -

whenever open project in atom editor, git throws permission denied whenever merge branches. closing atom resolves issue. is possible avoid behavior in atom? edit: using sourcetree https://www.sourcetreeapp.com/ i not see such behavior git , atom. may issue 1 of packages have atom. can provide list of packages have installed in atom?

android - I am using Google Maps service (Places, directions). After using for a while I am receiving response : -

i using google maps service places , directions after using while receiving response server. { "error_message" : "you have exceeded daily request quota api.", "predictions" : [], "status" : "over_query_limit" } please solve problem thanks you'll need upgrade paid plan raise query limit. see https://developers.google.com/maps/pricing-and-plans/

java - How to get Enum when it's string representation and type are known at Runtime? -

suppose have enum as: com.mypackage.enums public enum days { monday, tuesday, wednesday } now somewhere know need enum monday runtime string provided "monday". know enum lies in com.mypackage.enums.days how can this? or without reflection? edit: both string "monday" , class com.mypackage.enum.days determined @ runtime. class provided object of class , not string. an alternative @jonskeet solution not involve raw types (only unchecked cast): static <t extends enum<t>> enum<t> getvalue(string classname, string name) throws classnotfoundexception { @suppresswarnings("unchecked") class<t> clazz = (class<t>) class.forname(classname); return enum.valueof(clazz, name); } public static void main(string[] args) throws exception { string classname = "day"; string name = "saturday"; // note use of raw type system.out.println("parsed:...

iphone - Reading large files from NSInputstream is not working in ios -

i trying read large image file more 300kb nsinputstream. i'm getting upto 300kb. other data missing. please me if know. i'm waiting valuable answer. mentioned code below : call readalldata method nsstreameventshasbytesavailable: - (void)readalldata { if (_readdata == nil) { _readdata = [[nsmutabledata data] retain]; } while ([[_session inputstream] hasbytesavailable]) { unsigned int bytesread = 0; bytesread = [[_session inputstream] read:buf maxlength:ead_input_buffer_size]; if (bytesread) { nsmutablestring *_string = [nsmutablestring stringwithstring:@""]; (int = 0; < _readdata.length; i++) { unsigned char _byte; [_readdata getbytes:&_byte range:nsmakerange(i, 1)]; if (_byte >= 32 && _byte < 127) { [_string appendformat:@"%c", _byte]; } else { [_string appendformat:@"[%d]", _byte]; ...

azure - What is the difference between Worker Role and Worker Role with Service Bus Queue -

what difference between these 2 implementations, can tell 1 use under scenario? also pros , cons if there any? in advance. there isn't difference between two. worker role service bus queue vs project template adds service bus dependencies , configures empty message handling function , adds code ready set own connection string etc. if planning on implementing worker role reads queue save little typing time. if prefer can create basic worker role project , add queue handling logic it, achieve same thing.

listview - Android ExpandableListview -

any tutorial expandablelistview android fold animation ? m using adapter it's not smooth don't know why , suggestions smooth adapter , how can include fold animation while collapse , expand my adapter : public class customlistadapter extends baseexpandablelistadapter { list<categoriesobject> categoriesobjectlist; context context; imageview rightimage; imageview iconimage; public layoutinflater inflater; public servicehelper servicehandler; imageloader imgloader; public customlistadapter(activity context, list<categoriesobject> categoriesobjectlist) { // super(context, r.layout.list_content_row); // todo auto-generated constructor stub this.categoriesobjectlist = categoriesobjectlist; this.context = context; inflater = context.getlayoutinflater(); imgloader = new imageloader(context); } @override public serviceobject getchild(int groupposition, int childposition) { list<serviceobject> chlist = categoriesobjectlist.get...

css - How to avoid iframe embedding code? -

i want change style of text embedding following markup <iframe src="url"> my web page has limited amount of characters can used fast coding in css , html. code i'm using iframe embed this: <style type="text/css"> body { color: black; } h1 { color: #ffffff; } h2 { color: rgb(255,255,255); } </style> <h1>hello world!</h1> but when i'm using following embed it: <iframe src="the raw url of code above" frameborder="0"> ...the whole code showing, not hello world! in #ffffff. what doing wrong here? embed hello world! know css on parent page not change style of source i'm putting in iframe. since iframe embedding html documents, should try using valid html external file. this: <!doctype html> <html> <head> <title>iframe example</title> </head> <body> <style type="text/css"> body { color:...

java - Youtube CommentThread not returning all comments -

i trying create small app can retrieve comments youtube video. using youtube data api v3 try , retrieve comments, reason gives me fraction of comments on video. thd id of video being tested on ozpqv1mylce this code using count number of comments right now. uses auth package sample code provided google. import com.google.api.client.auth.oauth2.credential; import com.google.api.services.samples.youtube.cmdline.auth; import com.google.api.services.youtube.youtube; import com.google.api.services.youtube.model.commentthread; import com.google.api.services.youtube.model.commentthreadlistresponse; import com.google.common.collect.lists; import java.util.list; public class youtubetest { public static void main(string args[]){ list<string> scopes = lists.newarraylist("https://www.googleapis.com/auth/youtube.force-ssl"); try{ credential credential = auth.authorize(scopes, "commentthreads"); youtube youtube =...

javascript - Bootstrap / Css - 2 DIV same height -

Image
i've got html+css code. need 1st div (row-1, white colored) take first half of container height, , 2nd div (row-2, orange-colored) take second part. here html: http://pastebin.com/ipiekhbz , css: http://pastebin.com/jtxw695f revised answer: after realising default approach did not work html, should work. have classes .content-row-1 , 2 respectively. can use tell corresponding rows use portion of height. work need manually fix positioning. (someone correct me if can done more elegantly) example classes like: .content-row-1 { background: #eee; position: absolute; top: 10%; display: block; height: 40%; width: 100%; } i noticed footer takes 10% of height , and assumed did not want overlap or gaps. work should give header percentage height (10% in example keep things simple). and future: try using https://jsfiddle.net/ when showing code samples. put @ https://jsfiddle.net/kvbyk3f1/ .

cpu usage - NUMA domain(Equal node binding among All the processes) can not increase throughput why? -

i have run 15 processes on linux system. system architecture have 40 core cpu on 2 node(0 , 1). each process contains 2 application threads. without doing numa node binding processes, have achieved 92% cpu utilization specific load on processes. with numa node binding(8 process on node 0 , 7 process on node 1) of processes; system not able handle more load above scenario while cpu utilization less(85%) in scenario. why system can not able handle more load cpu utilization less previous scenario?

android - how to change the font of PagerTabStrip -

Image
i'm using viewpager pagertabstrip , need set custom fonts (typeface) , there no .settypeface function pagertabstrip! here xml code: <android.support.v4.view.viewpager xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/viewpager" android:layout_width="fill_parent" android:layout_height="fill_parent"> <android.support.v4.view.pagertabstrip android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/pagertabstrip" android:layout_gravity="top" android:background="#ff0000" android:textcolor="#ffffff" /> </android.support.v4.view.viewpager> according : link found solution maybe solve problam... get child views of pagertabstrip , check if instance of textview. if is, set typeface: for (int = 0; < pagertabstrip.getchildcount(); ++...

xaml - Xamarin forms designing for multiple resolutions -

how can design according various resolutions in xamarin forms application. have been using viewbox control windows application not found in xamarin forms.my requirement is, if set 50 px control , should scale or down according various resolutions. please provide design guide lines achieve this. have been using grid row definitions , column definitions, cases have manually set height / width or padding controls. please me. xamarin.forms not use pixels. uses platform specific density aware units. xamarin.forms has philosophy of using conventions of underlying platforms as possible. in accordance philosophy, xamarin.forms programmer works sizes defined each particular platform. sizes programmer encounters through xamarin.forms api in these platform-specific device-independent units. that "points" in ios , "dpi" on android. there's whole book chapter (free) https://download.xamarin.com/developer/xamarin-forms-book/bookpreview2-ch05-r...

Why when django picks up data from Mysql, the data shown on the html is messy code -

here's views.py code #!/usr/bin/env python # -*- coding: utf-8 -*- import sys #import chardet reload(sys) sys.setdefaultencoding('utf8') django.shortcuts import render import mysqldb def myview(request): db = mysqldb.connect( host = 'localhost', port = 3306, user = 'root', passwd = '123', db = 'new_gkgw', ) cur = db.cursor() db.commit() aa = cur.execute("select * shici") bb = cur.fetchmany(aa) return render(request, 'dict/mytemplate.html', {"rows": bb}) here's template's code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> </head> <body> <ul> {% row in rows %} <li>{{ row }}</li> {% endfor %} </ul> </body> </html> here's my.cnf [mysqld] default-storage-engine ...

c# - Customizing autogenerated partial classes -

i have autogenerated partial classes like: public partial class myentity { ... } i use myentity.partial.cs file extend partial class. want avoid situation autogenerated myentity disappears or renamed customized myentity.partial.cs stays , compiles without errors. how ensure can extend existing partial classes? i not sure there exists good solution this. here a solution. have auto-generated classes contain following: partial void compiletimecheckthatautogeneratedpartexists(); then write in each of hand-written extensions: partial void compiletimecheckthatautogeneratedpartexists() { } note: body in auto-generated part semicolon ; while body in extension part empty block { } . when ever auto-generated part disappears, renamed or moved namespace , compile-time error occur.

python - pysftp: how to get remote folder size -

how size of remote folder when using pysftp? the object return stat seems doesn't looks right, code: fdstat = sftpclient.stat(remotepath); print(fdstat.st_size); output: drwxr-xr-x 1 0 99 4096 21 sep 11:13 ? 4096 => folder remotepath huge , it's size larger 4096. the .stat method returns same information *nix ls command. size here represents size of data, directory (= metadata contained files) occupies on disk. it's not size of contained files. there's no direct way obtain total size of files in directory using single call in pysftp or sftp protocol in general. all can list directory (recursively if needed) , sum sizes of individual files.

angular ui grid - Prevent Keypress-events ( f.e. enter-key) -

i'm looking stop keyboard events ui-grid . example: ui-grid navigates next row pressing enter-key, here need prevent action. using celltemplate implements ng-keypress-listener, can't stop ui-grid switch next row hitting enter-key. does know how prevent ui-grid or switch off keyboards events? you can adjust default functionality overwriting services/directives. i created plunkr case. copy whole service containing keylistener cellnavigation , remove enter -watcher. getdirection: function (evt) { if (evt.keycode === uigridconstants.keymap.left || (evt.keycode === uigridconstants.keymap.tab && evt.shiftkey)) { return uigridcellnavconstants.direction.left; } if (evt.keycode === uigridconstants.keymap.right || evt.keycode === uigridconstants.keymap.tab) { return uigridcellnavconstants.direction.right; } /* if (evt.keycode === uigridconstants.keymap.up || (evt.keycode === uigrid...

c# - different ways String Join -

can recommend better way joining string together. i've got 2 lists i'm joining this: textbox1.text = string.join(environment.newline, changeswithvalues); however data out has got bit in should there. my on code bit looks this: private void convertotext(dictionary<string, int> dictionarylist) { list<keyvaluepair<string, int>> changeswithvalues = dictionarylist.tolist(); display(changeswithvalues); } private void display(list<keyvaluepair<string, int>> changeswithvalues) { textbox1.text = string.join(environment.newline, changeswithvalues); } private void show_click(object sender, system.eventargs e) { convertotext(_dictionary); } you need combine key , value of keyvaluepair format want, e.g. textbox1.text = string.join(environment.newline, changeswithvalues.select(kvp => string.format("{0} {1}", kvp.key, kvp.value)));

c++ boost xml parser ptree.get function -- doesnot accept white space in node name -

trying content xml file using boost xml parser using c++.. opencv.xml <opencv_storage> <labels type_id="opencv-matrix"> <data>0 0 0 0 1 1 0 0</data> </labels> </opencv_storage> c++ code snippet using boost::property_tree::ptree; ptree pt; boost::property_tree::read_xml("opencv.xml", pt); std::string m_file = pt.get<std::string>("opencv_storage.labels type_id=\"opencv-matrix\".data"); std::cout<<"m_file "<<m_file<<std::endl; while executing, program throws exception : no such node (opencv_storage.labels type_id="opencv-matrix".data) i doubt, white space prevails between labels , type_id thanks in advance, appreciated, since trying used boost. of course doesn't. whitespace in element names illegal in xml. what want attributes: parsing xml attributes boost or, better yet, want use xml parser, her...

performance testing - How to take multiple values of a column in single column field in HP loadrunner -

i have 1 script in hp-loadrunner, want take multiple values of column in single field. i have this: variable1 test1 test2 test3 test4 i trying this: variale1 test1,test2,test3,test4 i tried writing 'c' code solve unfortunately not able find proper solution. is possible writing code change single column field during 1st test run , take values single column field ? kindly me out, either in terms of writing 'c' code in script or change in excel/.dat file. i think faced same problem try this:- long fp; int i,j; char *searchvalue; char ch[10]; action() { fp=fopen("external file path","w"); for(i=1;i<=5;i++) { fputs("\"",fp); fputs(lr_eval_string("{internal file parameter}"),fp); for(j=1;j<=10;j++) { fputs(",",fp); fputs(lr_eval_string("{internal file parameter}"),fp); ...

oracle - SQL query, create groups by dates -

this initial table, (the dates in dd/mm/yy format) id day type_id type num start_date end_date ---- --------- ------- ---- ---- --------- --------- 4241 15/09/15 2 1 66 01/01/00 31/12/99 4241 16/09/15 2 1 66 01/01/00 31/12/99 4241 17/09/15 9 1 59 17/09/15 18/09/15 4241 18/09/15 9 1 59 17/09/15 18/09/15 4241 19/09/15 2 1 66 01/01/00 31/12/99 4241 20/09/15 2 1 66 01/01/00 31/12/99 4241 15/09/15 3 2 63 01/01/00 31/12/99 4241 16/09/15 8 2 159 16/09/15 17/09/15 4241 17/09/15 8 2 159 16/09/15 17/09/15 4241 18/09/15 3 2 63 01/01/00 31/12/99 4241 19/09/15 3 2 63 01/01/00 31/12/99 4241 20/09/15 3 2 63 01/01/00 31/12/99 2134 15/09/15 2 1 66 01/01/00 31/12/99 2134 16/09/15 2 1 66 01/01/00 31/12/99 2134 17/09/15 9 1 59 17/09/15 18/0...

c# - Concurrency access with Entity Framework -

i m developing signalr application communicates database. manage database using entity framework 6. i'd implement scheduled task, deleting records in given table. the problem task not running on main thread of application. so, if task removes record while main thread trying read same record, application crashes. i m managing database context way: using (var dbcontext = new databasecontext()) //code , remove record... dbcontext.savechanges(); which best solution avoid concurrency problems ? should force scheduled task run on main thread ? if yes, how can ? or should use transactions locks using transactionscope class ? edit scenario: 500ms between each task execution execution 1 task called first time => new dbcontext instance => record => delete record => savechanges ... in meantime, task called again. execution 2 task called second time => new dbcontext instance (as first task still running, 2 dbcontext objects alive) => record => de...

Javascript string index -

i working on javascript on website helps companies see how campaigns doing on 1 collective screen. using if statement separate of information when go check code says string index out of range -1 here sample code: var place = {media buy name}; if(place.indexof("prospecting")){ return "prospecting"; } else if(place.indexof("audiencetargeting")){ return "audiencetargeting"; } else if(place.indexof("retargeting")){ return "retargeting"; } else{ return "other"; } 1) javascript case-sensitive. indexof not same indexof . 2) array , string have indexof method ( 1 , 2 ). place plain object, has no indexof method, neither indexof . therefore have make place variable either array or string . code work.

sql - mysql nested select in update -

good morning, i have problem updating database. this orders table: id | parent_id | type | paid now need update orders parent_id paid. have little trouble doing this, because of nested queries. i tried this update orders set orders.paid = now() ( select orders.parent_id orders orders.id = orders.parent_id ) but won't magic. can't :/ 1 | null | 8 | 2015-20-09 12:00:00 2 | 1 | 7 | 0000-00-00 00:00:00 3 | 1 | 7 | 0000-00-00 00:00:00 4 | null | 8 | 2015-18-09 12:00:00 5 | 4 | 7 | 0000-00-00 00:00:00 you may use join doing update as update orders o1 join orders o2 on o2.id = o1.parent_id set o1.paid = now() o2.paid <> '0000-00-00 00:00:00'

c# - Custom WinForms data binding with converter not working on nullable type (double?) -

in winforms application implemented custom data binding support value converters , similar wpf. the sample has new binding class derives binding , allows attach custom converter: public class custombinding : binding { private readonly ivalueconverter _converter; private readonly object _converterparameter; private readonly cultureinfo _converterculture; public custombinding(string propertyname, object datasource, string datamember, ivalueconverter valueconverter, cultureinfo culture, object converterparameter = null) : base(propertyname, datasource, datamember) { if (valueconverter != null) this._converter = valueconverter; this.datasourceupdatemode = datasourceupdatemode.onpropertychanged; this.formattingenabled = false; this._converterculture = culture; this._converterparameter = converterparameter; } public custombinding(string propertyname, object datasource, string datamember, ival...

SQL: Insert multiple row with common columns -

i have table insert , has 4 columns. while inserting 3 columns same , other 1 column different each , taken table. how that? exmaple; insert sendmsg (type,name,sendername,message) values(4, 'john','mike','hi, blabla') i insert same message bob, instead of john. , names send contained in names table. thank you. use select statement build insert. work (as didn't provide more details): insert sendmsg (type,name,sendername,message) select 4, "name" ,'mike','hi, blabla' anothertable -- .... column names in ", don't confused. it's ensure difference between string , database object. inside optinal maybe where name in ('bob', 'john', ...) or whichever algorithm need determine names.

asp.net - Why is a file still accessible (until cache is cleared) when anonymous access is denied through web.config on the parent folder? -

i have asp.net mvc website. , want deny access particular folder , contents on website. have done in web.config denying access anonymous users, using following: <system.web> <authorization> <deny users="?" /> </authorization> </system.web> now facing problem, when try access file folder after logging out. if try access file, text file, without logging in, browser url, redirects me login page expected. the url example is: " https://www.mywebsite.com/content/mynotepad.txt ". if hit above url after logging in, file opens, again expected. but after logout facing problem. file remains accessible after signing out. when ctrl+f5 redirects me login page. i know caching causing happen, unable find solution this. appreciated. if file cached, browser doesn't need hit server it. if browser doesn't hit server it, matter whether server considers "logged in" or not? if set cache setting o...

css - Fonts are not rendered correctly in Release Mode, but is working on Debug Mode in ASP NET Webforms -

we able solve problem regarding rendering of fonts during release in vs2013. the font urls in " app.css " , " style.css " fonts pointing location example " fonts/icomoon.eot " technically cannot find specific path based on directory browsing of iis . we changed adding " /content/stylesheets/ " of current font urls like" /content/stylesheets/fonts/icomoon.eot " and worked . however still not understand why debug mode okay previous urls of our css files , fonts rendering fine. can suggest fix? or fix of ours okay ( manually editing font-urls inside css files )? we have found better solution font issues. the asp.net bundling source why different result between debug , release mode. by default, if compilation on debug mode, bundling turned off while if on release mode, turned on. to fix issue have turned off asp.net bundling while on release mode adding lines bundleconfig.cs . bundletable.enableoptimizations =...

php - Facebook login using Javascript -

i'm going insane! i have been trying facebook login pop appear on website using facebook javascript api. i've followed tutorial multiple times login not appear in pop , if follow login process through ens logging me in , not redirecting me website. once i'm @ site i'm logged in , works fine. i have tried multiple variations of below code (too many write them all): <script> window.fbasyncinit = function() { fb.init({ appid : '123456789012345', status : true, xfbml : true, version : 'v2.4' }); fb.getloginstatus(function(response) { if (response.status === 'connected') { console.log('logged in.'); showlogoutoption(); // shows logout option } else { showloginoption(); // shows login option console.log('not logged in'); } }); $('#loginoption').click(function() { ...

How can I extract decision tree's node in scikit-learn -

i want extract decision tree's detail information threshold, gini... when searched using google, can find information displaying barely no information node's information. gays know this? you can export decision tree in dot format, , whatever want it, no 1 forces visualize it: link source code official documentation from sklearn.datasets import load_iris sklearn import tree iris = load_iris() clf = tree.decisiontreeclassifier() clf = clf.fit(iris.data, iris.target) open("iris.dot", 'w') f: f = tree.export_graphviz(clf, out_file=f) iris.dot file contains: digraph tree { node [shape=box] ; 0 [label="x[3] <= 0.8\ngini = 0.6667\nsamples = 150\nvalue = [50, 50, 50]"] ; 1 [label="gini = 0.0\nsamples = 50\nvalue = [50, 0, 0]"] ; 0 -> 1 [labeldistance=2.5, labelangle=45, headlabel="true"] ; 2 [label="x[3] <= 1.75\ngini = 0.5\nsamples = 100\nvalue = [0, 50, 50]"] ; 0 -> 2 [labeldistance=2.5, la...

spring security - replace .permitAll() method with a method that can provide access to only USER and COMP roles -

i want replace .permitall() method method can provide access user , comp roles @override protected void configure(httpsecurity http) throws exception { http.authorizerequests().antmatchers("/success/**").permitall() //instead of .permiitall() want define access "user" , "comp" roles .antmatchers("/userprofilehomepage/**").access("hasrole('user')") .antmatchers("/companyhome/**").access("hasrole('comp')") .and().formlogin().loginpage("/login") .failureurl("/login?error").usernameparameter("username").passwordparameter("password") .defaultsuccessurl("/success").and().logout().logoutsuccessurl("/login?logout").and().csrf() .disable().exceptionhandling().accessdeniedpage("/error"); }

javascript - Controller property not being show in view in this Angular js app -

below aap.js angularjs app. var app = angular.module('gallery',[]); (function(){ app.controller('gallerycontroller',function(){ this.tab = true; }); })(); and gallery.html is: <html ng-app="gallery"> <head> <link rel="stylesheet" type="text/css" href="bootstrap.min.css"> <script type="text/javascript" src="angular.js"></script> <script type="text/javascript" src="app.js"></script> <link rel="shortcut icon" href=""> </head> <body ng-contoller="gallerycontroller g"> <section > <ul> <li><img ng-click="tab=1" src="images/gem-01.jpg" height="100" /></li> </ul> <h1>{{g.tab}}</h1> </section> </body> </html> g.tab , property of controller, not bei...

java - I want to return true when my sprite is touched -

i want return true method touch, when sprite touched (also finger) how can make? public class skipbutton extends rectanglebutton { protected textureatlas atlastexture; protected sprite sprite; protected spritebatch batch ; public skipbutton(vector2 coordinates, float width, float height) { super(coordinates, width, height); atlastexture = assets.manager.get(constants.interface_atlas_path, textureatlas.class); sprite = new sprite(atlastexture.findregion("skip_big")); } @override public void draw(spritebatch batch) { sprite.draw(batch); } public boolean touch() { ........... } libgdx has great button class has included boolean ispressed() want. can still make public method returns result of ispressed if want button private. atlastexture = assets.manager.get(constants.interface_atlas_path, textureatlas.class); drawable drawable =...

digital signature - Get notified about new filename of saved PDF document from Adobe Reader DC -

based on data sql database, dynamically create reports pdf report, costs-2015_01.pdf. document automatically saved on pre-configured (application wide) directory, e.g. c:\reports\costs-2015_01.pdf. the full path (incl. filename) gets stored in database table called tbldocuments. after that, call acroread.exe document path argument open report. the problematic part is, document contains 2 digital signature fields. if user signs document, reader asks automatically after signature process new file location (save-as dialog). users saving new file under different name , location instead of overriding origin file, example 'c:\my documents...'. the problem is: calling application, don't notified new path , can not update file location in database document table. best solution prevent reader asking new file location, instead save report incl. signature origin file. seems impossible. i'm asking if possible notified reader if document saved under new file name/path. ...

razor - Nesting TagHelpers in ASP.NET Core MVC 6 -

the asp.net core taghelper documentation gives following example: public class websitecontext { public version version { get; set; } public int copyrightyear { get; set; } public bool approved { get; set; } public int tagstoshow { get; set; } } [targetelement("website-information")] public class websiteinformationtaghelper : taghelper { public websitecontext info { get; set; } public override void process(taghelpercontext context, taghelperoutput output) { output.tagname = "section"; output.content.setcontent( $@"<ul><li><strong>version:</strong> {info.version}</li> <li><strong>copyright year:</strong> {info.copyrightyear}</li> <li><strong>approved:</strong> {info.approved}</li> <li><strong>number of tags show:</strong> {info.tagstoshow}</li></ul>"); ...

sql - Bulk insert with Blank values -

i have 1 table 48 columns in want import data csv file. csv file consist of blank values. whenever uses bulk insert getting error: 1) bulk load data conversion error (type mismatch or invalid character specified codepage) row 1, column 1 (column name) 2)the ole db provider "bulk" linked server "(null)" reported error. provider did not give information error. 3)cannot fetch row ole db provider "bulk" linked server "(null)". i using sql server 2008 below bulk insert command using:- ** bulk insert databasename.dbo.tablename 'c:\foldername\filename.csv' ( firstrow = 1, fieldterminator =',', rowterminator ='\n', keepnulls )** please suggest how handle it..? for type of errors make sure below things: 1.the datalength should matched according .csv file(use trial , error method , reach lengths). the number of columns should matched(need check manually). the datatype conve...

php - How can I store string from object as a variable? -

i object in echo $output: { "key":"a-string-with-letters-and-numbers" } how can store string ("a-string-with-letters-and-numbers") variable, or can echo directly selectors? i need store string script: options({ key: "<?php echo $output ?>" }); your object not object in php, json string need decode convert in php object or array $json = '{"key":"a-string-with-letters-and-numbers"}'; $object = json_decode($json); echo $object->key; // object $array = json_decode($json, true); echo $array['key']; // array

php - Laravel - Compare Dates -

im using laravell framework. banner events, showing events exist after current date. this current function on routes.php route::get('/banner', function() { $date = time(); $events = event::where('date', '>', $date)->get(); return view::make('banner')->with('events', $events); }); in view, shows events, doesnt matter if before or after current date. , if change: $events = event::where('date', '<', $date)->get(); this dont show anything. the view working good, main problem here cant find how fix this. you can this. in event model add following line. protected $dates = ['date']; by doing when event saved date saved carbon instance. then when query this. $events = event::where('date', '>', carbon::now())->get(); make sure import carbon this. use carbon\carbon; refer fun dates laracasts more details.

c++ - Compile project with static and dynamic linked libs -

i'm happy dynamic linking while creating small c++ windows applications. need add third part library. have both dll , lib file. prefer not copy third party dll each time install application. can somehow link newly provided library statically while keeping whole project dynamically linked? in microsoft visual studio ide found 1 place can choose static/dynamic linking, in properties->configuration properties->code generation->runtime library . suppose selection whole project , need link libs statically , of them dynamically. update in general need link libs dynamically , others statically in same project. provided link tells static or dynamic linking in same project

javascript - MomentJS returns obscure date for 1st of month -

i'm having small problem momentjs returning nonsense date. attempting set date first of given month , year. have tried following:- var _year = 2015; var _month = 10; var _datestring = _year.tostring() + '-' + _month.tostring() + '-1'; var _date = moment(_datestring, 'yyyy-mm-d'); console.log('_date', _date.format('dddd, mmmm yyyy')); this gives thursday, 4th october 2015 _date . doesn't exist. tried using .set() , .date() , both give same result:- var _date = moment(_datestring, 'yyyy-mm-d').set('date', 1); > thursday, 4th october 2015 var _date = moment(_datestring, 'yyyy-mm-d').date(1); > thursday, 4th october 2015 so, can't see i'm doing wrong now, can offer suggestions or help? many thanks. your code correct except should use capital d not small d in do : console.log('_date', _date.format('dddd, mmmm yyyy')); difference between do , do is: do ...

java - Android Sending mail to gmail using smtp -

session session = null; progressdialog pdialog = null; context context = null; edittext reciep, sub, msg; string rec, subject, textmessage; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.b9); context = this; button login = (button) findviewbyid(r.id.btn_submit); reciep = (edittext) findviewbyid(r.id.et_to); sub = (edittext) findviewbyid(r.id.et_sub); msg = (edittext) findviewbyid(r.id.et_text); login.setonclicklistener(this); } @override public void onclick(view v) { rec = reciep.gettext().tostring(); subject = sub.gettext().tostring(); textmessage = msg.gettext().tostring(); properties props = new properties(); props.put("mail.smtp.host", "smtp.gmail.com"); props.put("mail.smtp.socketfactory.port", "587"); props.put("mail.smtp.socketfactory.class", "javax.net.ssl.sslsocketfactory"); ...

parse.com - PARSE and BITCODE warning in XCODE 7 -

in app use parse.....till xcode6 , ok. yesterday update in xcode 7 , try build app in xcode 7 , got following warning : "full bitcode bundle not generated because parseui.framework/parseui(pfloginviewcontroller.o) built bitcode marker. library must generated xcode archive build bitcode enabled (xcode setting enable_bitcode)" mention in xcode 7 have enable bitcode , use last parse sdk 1.8.5 can me please.. george gerardis you have disable bitcode in parse's target's build settings it's used developers slim down app's ( doc ) you have wait parse release new version bit code enabled.

php - Monolog: how to catch all errors and exceptions -

i'm missing obvious. how can make monolog record php errors, php user errors, , exceptions? before using monolog, wrote own functions passed set_error_handler() , register_shutdown_function() , set_exception_handler() . there way of doing using monolog's api, or have following? write error handler , exception handler pass php's functions above in handlers, call appropriate monolog functions such logger::adderror(...) using switch statement or similar surely there must monolog api above in single call? old question since not yet answered - errorhandler you're after. from the documentation : errorhandler: monolog\errorhandler class allows register logger instance exception handler, error handler or fatal error handler.

android - How to align message textview to the center in snackbar? -

how align message textview center horizontally in snackbar in android? below sample, making snackbar text center horizontal snackbar snackbar = snackbar.make(findviewbyid(r.id.coordinatorlayout), "hello", snackbar.length_short); snackbar.show(); view view = snackbar.getview(); textview txtv = (textview) view.findviewbyid(android.support.design.r.id.snackbar_text); txtv.setgravity(gravity.center_horizontal);

Table merge cells - Vaadin -

Image
i'm creating table vaadin. of cells repeating. want them merge in 1 cell, can see on image: the first image show how table looks now, , second how want merged cells. i'm using code: table table = new table(appdata.getmessage("menu.report2")); table.addcontainerproperty(tableheaders[0], string.class, null); table.addcontainerproperty(tableheaders[1], string.class, null); table.addcontainerproperty(tableheaders[2], string.class, null); table.addcontainerproperty(tableheaders[3], string.class, null); list<user> employeelist = employeedao.findallemployees(); int i; (i = 0; < employeelist.size(); i++) { user employee = employeelist.get(i); table.additem(new object[]{ casestatus.open, tasksdao.counttasks(casestatus.open), employee.getfirstandlastname(), tasksdao.counttasks(employee, casestatus.open)}, i); } (int j = 0; j < employeelist.size(); j++) { user employee = employeelist....

Unable to add --select--value at the top of drop down drupal entity registration module required field -

i using registration entity module in drupal website.and have dropdowns of home phone , mobile no on form.home phone no required , doesn't show --select-- value @ top of dropdown.while mobile no not required , hence show --select-- @ top. now want alter form , add --select-- option value @ top of home phone no.and writing code in custom module. function custom_va_form_alter(&$form, $form_state, $form_id) { if($form_id == 'commerce_checkout_form_registration'){ if($form['registration_information']['prod-va_application']['prod-va_application-reg-0']['field_phone']['und'][0]['field_home_phone']['und']['#required'] == 1){ dsm($form); $form['registration_information']['prod-va_application']['prod-va_application-reg-0']['field_phone']['und'][0]['field_home_phone']['und'][0]['country_codes']['#options']= '--select--...

ruby on rails + optimistic locking + best_in_place -

faced problem, best_in_place bypasses optimistic record locking, keeps on top of new value. how can fix this? had same problem. i have best_in_place fields within form , added hidden field named lock_version , seems work. <%= form_for(commission, :remote => true) |f| %> <%= best_in_place commission, :commission_ma if admin? %> <%= f.hidden_field :lock_version %> <% end %> hope solves problem well.

c# - DataGridView doesn't update when assigning datasource of second datagrid -

i have 2 datagridviews 1 displayed. both have same columns different values. problem 1 displayed , when select first or second datagridview, datagridview showing someting, stops , doesn't work @ anymore. i tried this datagridview1 = datagridview2; like this bindingsource b = new bindingsource(); b.datasource = datagridview2.datasource; datagridview1.datasource = null; datagridview1.datasource = b; datagridview1.visible = true; datagridview1.autogeneratecolumns = true; but nothing working... , yes, tried update() , refresh() you can verify application of following simple example namespace gridview { public partial class form1 : form { public form1() { initializecomponent(); dataset ds= new dataset(); ds.readxml(@"c:\users\user\desktop\students.xml"); datagridview1.autogeneratecolumns = true; datagridview1.datasource = ds; datagridview1.d...