Posts

Showing posts from February, 2015

java - should I pay much attention on NullPointerException? -

when use junit test check coding process,i find there problems bother me. example: list<user> list = userdao.findby("id",id); list.get(0).getname(); there problem.i didn't use assert check list not null before using may cause nullpointexception.but @ business logic. when create new user this. if(user!=null){ userdao.save(user) } it should not null.because check user not null when add one, know user successful in database. if add lot of when user: if(list!=null||list.size()>0){...}; in similar place makes code chaos. should add or not?how make choice? thx anyway. i think looking method preconditions or, more generally, contracts . let's assume code split many small methods, should be. define preconditions , postconditions every method. these need met, otherwise failure expected. if consistently, question of put these checks pretty answer in quite intuitive way. as example, let's consider 2 ways write method user : p

c++ - Using WMI to monitor process creation event -

i using wmi monitor process creation event according other post( how detect win32 process creation/termination in c++ ) i follow register callback function, doesn't work. nothing happened when run program , open iexplore please me, thank you #define _win32_dcom #include <iostream> using namespace std; #include <comdef.h> #include <wbemidl.h> #include <atlcomcli.h> #pragma comment(lib, "wbemuuid.lib") #include "creationevent.h" class eventsink : public iwbemobjectsink { friend void creationevent::registercreationcallback(tnotificationfunc callback); ccomptr<iwbemservices> psvc; ccomptr<iwbemobjectsink> pstubsink; long m_iref; creationevent::tnotificationfunc m_callback; public: eventsink(creationevent::tnotificationfunc callback) :m_iref(0), m_callback(callback){} ~eventsink(){ } virtual ulong stdmethodcalltype addref() { return interlockedincrement(&m_iref);

Linux undefined symbol _mkdir in the .so file of swmm5 python package -

i new python , linux. installed swmm5 package in linux downloading source swmm5-5.1.0.102.zip: python setup.py install before typing previous syntax install swmm5, have unquoted #define cle , deleted #include <direct.h> in file swmm5.c, otherwise installation won't succeed. then tried test swmm5 package , following error: from swmm5.swmm5tools import swmm5simulation traceback (most recent call last): file "<stdin>", line 1, in <module> file "/home/pyangac/py_libs/lib64/python/swmm5-5.1.0.102-py2.7-linux-x86_64.egg/swmm5/swmm5tools.py", line 1, in <module> . import swmm5 file "/home/pyangac/py_libs/lib64/python/swmm5-5.1.0.102-py2.7-linux-x86_64.egg/swmm5/swmm5.py", line 28, in <module> _swmm5 = swig_import_helper() file "/home/pyangac/py_libs/lib64/python/swmm5-5.1.0.102-py2.7-linux-x86_64.egg/swmm5/swmm5.py", line 20, in swig_import_helper import _swmm5 importerror: /home/pyanga

php - Google Font Blocked by Origin Access Policy -

i have errors when try load google font. errors show in console. access font @ ' http://fonts.gstatic.com/s/opensans/v13/dxi1orhcpsqm3vp6mxoategdm0lzdjqr5-oayxsoefg.woff2 ' origin ' http://example.com ' has been blocked cors policy: no 'access-control-allow-origin' header present on requested resource. origin ' http://example.com ' therefore not allowed access. i have been try various ways still cannot solve errors. this have been try. first, add in .htaccess <ifmodule mod_headers.c> <filesmatch "\.(ttf|ttc|otf|eot|woff|woff2|font.css|css|js)$"> header set access-control-allow-origin "*" </filesmatch> </ifmodule> second, put on top of php file <?php header('access-control-allow-origin: *'); ?> third, add .htaccess <filesmatch "\.(ttf|otf|eot|woff)$"> <ifmodule mod_headers.c> header set access-control-allow-origin "

node.js - Unresolved function or method for pipe() -

Image
i'm trying write simple file web file server. i'm using phpstorm. var http = require('http'); var fs = require('fs'); function send404request(response) { response.writehead("404", {"content-type": "text/html"}); response.write("404 page not found"); response.end(); } function onrequest(request, response) { if (request.method === 'get' && request.url === '/') { response.writehead("200", {"content-type": "text/plain"}); fs.createreadstream("./index.html").pipe(response); } else { send404request(response); } } http.createserver(onrequest).listen(8888); console.log("file server running..."); however, phpstorm says "unresolved function or method pipe()" here setting javascript libraries in phpstorm: any idea goes wrong? in settings/project settings/javascript/libraries,

c# - Need to install Xamarin Android Support Library v4 -

need install support library v4 cannot select 4.0 in options target android app. has options target 2.3 , 4.1 none of these work. should do. the reason need in order use "viewpager" private viewpager mviewpager; private viewpager.ionpagechangelistener mviewpagerpagechangelistener; thanks

php - Gmail API getting all Gmail Inbox messages limits to 500 -

Image
i trying inbox messages in gmail api, it's limiting 500 per request. messages, , current messages in repository 1600+ able 500 on 1 request. $service = new google_service_gmail($client); $user = 'me'; $params = array( 'labelids' => 'inbox', 'maxresults' => 20000 ); $last_date = mysqli_fetch_array($query); extract($last_date); $date = date_create($latest); $date->modify('-1 day'); $filter_date = date_format($date, 'y/m/d'); $params['q'] = 'in:inbox after:'.$filter_date ; $messages = $service->users_messages->listusersmessages( $user, $params ); $list = $messages->getmessages(); //$list has 500 messages returned me. just add clarity, what's happening. performed users.messages: list fetches 1600+ messages. i'm pretty sure gmail fetched 1600+ messages can display 500 messages @ time. if want access next 501-1000 messages, need use nextpagetoken comes every successf

hapijs - route config 'id' attribute - won't accept string value -

i'm not sure if bug or not, i'm asking here, rather submitting bug report. in documentation latest version of hapijs (16.1.1) https://hapijs.com/api#serverlookupid for server.lookup, indicates 'id' property can string. const route = server.lookup('root'); however strings expressively forbidden actual implementation code. https://github.com/hapijs/hapi/blob/master/lib/connection.js#l340 hoek.assert(id && typeof id === 'string', 'invalid route id:', id); am missing here? bug, or error in documentation, or misunderstanding something? it seems strange limitation impose. strings lot more logical route id. the other issue, in index.d.ts, forces use of string parameter. this functionality seems broken. how supposed use it, if when creating route need use numeric id, , when trying retrieve i'm forced use string? you reading assert backwards. error message displays if assertion fails. if id provided can of ty

reporting - Interactive PDF with filtering capability -

i need figure out way create interactive pdf output table display values related filter chosen. example: filter: country choice (u.s., germany, france) data table output when "u.s." selected in filter: +-------+------+------+------+ | ctry | yr 1 | yr 2 | yr 3 | +-------+------+------+------+ | u.s. | $10m | $15m | $20m | +-------+------+------+------+ data table output when "germany" selected: +-------+------+------+------+ | ctry | yr 1 | yr 2 | yr 3 | +-------+------+------+------+ |germany| $1m | $1m | $2m | +-------+------+------+------+ main argument not using excel pivots - not end users may have ms office. storing every country report in single pdf - report becomes busy when there more 10 countries. i got far finding links on pdf javascript, may accomplish task, although not sure start. my main questions are: can create such interactive pdfs @ all? are there tools can create pdfs little coding effort (i not developer)? are t

javascript - Angular - 10 $digest() iterations reached. Aborting when creation deep copy of array -

i create table filters in table header. filter list of unique values in each column. here simplified code: <table> <tr> <th class="dropdown" ng-repeat="field in data.columns"> <span>{{field.title}}</span> <ul class="dropdown-menu"> <li ng-repeat="item in unique(data.items, field)"><checkbox> {{item.text}}</li> </ul> </th> </tr> <tr ng-repeat="item in data.items"></tr> </table> i use same object array filter , table filter create copy of array , remove copy values repeated. , here problem. when copy array array.slice(0) deleted values not in filter in table (array contains objects). problem in references, used deepcopy jquery.extend(true, [], array) , angular throws error: [$rootscope:infdig] 10 $digest() iterations reached. aborting! watchers fired in last 5 iterations

Mail not send in contact form using codeigniter and godaddy linux server -

i designed http://gmgroups.co/ website using codeigniter. in website contact form mailing function not working. using godaddy linux server.. ask customer care in godaddy cant solve problem.. keep call on hold only.. try solve issue more 2 day cant solve problem.. can 1 pls me solve issue. this codeing public function contactform(){ //get form data $name = $this->input->post('name'); $from_email = $this->input->post('email'); $subject = $this->input->post('subject'); $message = $this->input->post('msg'); //set to_email id want receive mails $to_email = 'info@gmgroups.co'; //configure email settings $config['protocol'] = 'smtp'; $config['smtp_user'] = 'info@gmgroups.co'; $config['smtp_pass'] = 'xxxxxx'; $config['smt

html - PHP mail function doesn't complete sending of e-mail -

<?php $name = $_post['name']; $email = $_post['email']; $message = $_post['message']; $from = 'from: yoursite.com'; $to = 'contact@yoursite.com'; $subject = 'customer inquiry'; $body = "from: $name\n e-mail: $email\n message:\n $message"; if ($_post['submit']) { if (mail ($to, $subject, $body, $from)) { echo '<p>your message has been sent!</p>'; } else { echo '<p>something went wrong, go , try again!</p>'; } } ?> i've tried creating simple mail form. form on index.html page, submits separate "thank submission" page, thankyou.php , above php code embedded. code submits perfectly, never sends email. please help. there variety of reasons script appears not sending emails. it's difficult diagnose these things unless there obvious syntax error. without 1 need

sql - Open Access Ole-Object From C#-Code -

hello, i'm working access-db , succeeded in getting , changing various datatypes per c# code. public static datatable getbetreuer() { conn.open(); dbcommand = new oledbcommand("select id, email, name betreuer", conn); dbdataadapter = new oledbdataadapter(dbcommand); datatable resultdatatable = new datatable(); dbdataadapter.fill(resultdatatable); conn.close(); return resultdatatable; } that's pretty basic right now. want do, open ole-object code. example, if ole-object in access db pfd-file, want open standard app pdf-files. other idea, in case it's not possible, copy file in temp dir , open process.start() . couldn't find related working ole-object code. add ole-object . are talking pdf files? recommend performance issues once db size crosses limit rather can save file path db , store pdf somewhere on machine. can follow link same. storing documents blobs in database - disadvantages?

mysql - How do I conduct referencial integrity using foreign key constraints in netbeans sql? -

i trying write sql code in netbeans. have 2 tables: create table building( building_name varchar(10) not null primary key, building_location varchar(20), building_room_number integer); insert building values('building a', 'location a',34); insert building values('building b','location b',45); insert building values('building c', 'location c',40); create table room( room_number integer primary key, building_name varchar(10)); insert room values(1, 'building a'); insert room values(2, 'building b'); insert room values(3, 'building c'); then want create foreign key conduct referential integrity. alter table room add constraint fk_room foreign key (building_name) references building(building_name) on delete restrict on update cascade; netbeans kept giving me error [exception, error code 905, sqlstate 42000] ora-00905: missing keyword i m not sure what's

unit testing - How to mock rest-easy's asynchronous HTTP request? -

is there offical way mock rest-easy asynchronous http request? the sample code: @get @path("test") public void test(@suspended final asyncresponse response) { thread t = new thread() { @override public void run() { try { response jaxrs = response.ok("basic").type(mediatype.application_json).build(); response.resume(jaxrs); } catch (exception e) { e.printstacktrace(); } } }; t.start(); } i offen mock rest-easy's request way: @test public void test() throws exception { /** * mock */ dispatcher dispatcher = mockdispatcherfactory.createdispatcher(); dispatcher.getregistry().addsingletonresource(action); mockhttprequest request = mockhttprequest.get("/hello/test"); request.addformheader("x-forwarded-for", "122.122.122.122"); mockhttprespon

python - Getting Error "NameError: name 'TLSExtSupportedGroup' is not defined" while executing the program -

i trying execute program full_rsa_connection_with_application_data.py given here . however, dont know why getting following error traceback (most recent call last): file "full_rsa_connection_with_application_data.py", line 21, in <module> extensions = [tlsextension() / tlsextecpointsformat(),tlsextension()/ tlsextsupportedgroup()] nameerror: name 'tlsextsupportedgroup' not defined how can proceed further? with pip install installing code of release 1.2.3.2 should try example instead: https://github.com/tintinweb/scapy-ssl_tls/blob/release/1.2.3/examples/full_rsa_connection_with_application_data.py the example linked there working master branch @ has classes release hasnt tlsextsupportedgroup

cakephp 2.9.7 $this->auth->login() always returns bool(false) for vallid users also -

i have checked sinarios mentioned in stackoverflow related problem.nothing working fine me.please me in solving problem. table hold users data create table users ( id int unsigned auto_increment primary key, username varchar(50), password varchar(255), role varchar(20), created datetime default null, modified datetime default null ); app/controller/userscontroller.php file looks this <?php // app/controller/userscontroller.php app::uses('appcontroller', 'controller'); class userscontroller extends appcontroller { public function beforefilter() { parent::beforefilter(); // allow users register , logout. $this->auth->allow('add', 'logout'); } public function login() { if ($this->request->is('post')) { pr($this->request->data); // echo $this->flash->render('auth'); // die(); var_dump($this->auth->login()); // die(); if ($this-&g

ftp - mulesoft, loop over a properties file and start inbound endpoints -

i working on mule flow need read properties file have multiple organizations ftp endpoints. whenever flow starts, should iterate on property file , start consuming data different ftp endpoints. sample property file: organizations: orga: ftpendpoint: sftp://{orgauser}:{password}@{hosta}:22/incoming/test orgb: ftpendpoint: sftp://{orgbuser}:{password}@{hostb}:22/incoming/test i want understand how iterate on yaml property file? code snippet appreciated. also, read in mulesoft document cannot put inbound endpoint in foreach loop. if case how can achieve this? thanks & regards, vikas gite i want understand how iterate on yaml property file reading config file (yaml): <context:property-placeholder properties-ref="myconfig" /> <spring:beans> <spring:bean id="myconfig" class="org.springframework.beans.factory.config.yamlpropertiesfactorybean"> <spring:property name="r

html - Flex-wrap:wrap-reverse in Edge -

Image
in following sample, flex items start flowing top-right corner of wrapper: div { outline: 1px solid teal; } #wrap { width: 400px; height: 200px; display: flex; flex-direction: column; flex-wrap: wrap-reverse; } #wrap div { width: 50px; height: 50px; } <div id="wrap"> <div>1</div> <div>2</div> <div>3</div> <div>4</div> <div>5</div> <div>6</div> </div> but how see them in edge: and flex-direction: row; this: but how in edge: is edge behaving correctly? edge appeared have this bug in version dated april, 2016. in report it's stated (on march 29, 2017), version 15063 bug have been fixed. side note: appears fixed 1 has been released insider preview, creators update comes month (april, 2017), should it

Update and Delete button for each item of a database table using php and javascript -

i can show items of table in database , create delete , update button. want when press delete button of item, id of item , delete database not right , can not find it. when press delete button of item nothing happens. here code: php file: <body> <?php $con = mysql_connect("localhost:3307", "root", ""); mysql_select_db("seiis_notes", $con); $result = mysql_query("select * tbl_notes"); ?> <table> <?php while($row = mysql_fetch_array($result)) { ?> <div class="note_and_btns"> <div class="notedescription_editnote"> <form action="updateordelete.php" method="post"> id: <input type="text" name="id" value="<?php echo $row["noteid"] ?>" readonly/> &l

javascript - Jquery is not submitting the form with the custom button -

my requirement upload file form upon clicking custom button using jquery stuff. my form details below: <form id="createattachmentform" method="post" enctype="multipart/form-data" action="../../fileuploadservlet" > my file defined below: <input type="file" id="fileupload1" name="fileupload1" accept="image/*,application/pdf" "/> my custom button related code below: <contact:contactbutton id="printbutton" style="position:relative; width:90px; top:27px; height:30px; left:160px;" texttop="7px" defaultbutton="false" tabindex="" accesskey="c" onclickex="createattachmentrequest();" onfocus="if(event.altkey){click();}"> <u>c</u>reate </contact:contactbutton> whenever user clicks on custom button, for

angularjs radio validation bootstrap-switch -

i'm trying have radio input styled bootstrap-switch using angular-bootstrap-switch have set input required form valid when radio checked. using indeterminate feature when form loads - expecting input required until user selects either yes or no. any thoughts? - plunker below plunker <ng-form name="testform" class="form-horiztonal"> <input bs-switch type="radio" name="radio_1" ng-model="rac.tempanswer[1]" switch-on-text="yes" switch-off-text="no" ng-true-value="'yes'" ng-false-value="'no'" required/> <p class="help-block" ng-show="testform.radio_1.$invalid">answer required</p> </ng-form>

How to clear all Javascript function in android -

i'm new in android webview. in application's webview, it's javascript functions specific native buttons interacted webview. however, problem is, there many function in single webview. have check lot coditions detect funtion using or not. can let me know how reset or clear javascript function in webview android? by default javascript disable in web view, can enable using method void setjavascriptenabled (boolean flag) check out doc method https://developer.android.com/reference/android/webkit/websettings.html#setjavascriptenabled(boolean)

How to split the list and execute parallelly using java -

this question has answer here: common util break list batch [closed] 7 answers how split list , execute parallelly. scenario-- getting 1000+ vehicles using below list webservices. list<vehicle> vehiclelist = vehicleservices.getvehicles(); i want split 100 vehicles each list , execute list parallelly. thanks you can use parallelstream . check the doc know more abour java parallelism

excel - vba pivot does not refresh after adding new lines -

with of vba able create pivot table. when new lines added in sheet , refresh pivot table wkssource1.pivottables(1).refreshtable , not updating pivot table. dim pcache pivotcache dim ptable pivottable dim prange range dim lastrowv long dim lastcolv long lastrowv = wkssource.cells(rows.count, 3).end(xlup).row lastcolv = wkssource.cells(5, columns.count).end(xltoleft).column set prange = wkssource.cells(5, 1).resize(lastrowv - 4, lastcolv) activeworkbook.pivotcaches.create(sourcetype:=xldatabase, sourcedata:= _ prange, version:=xlpivottableversion14).createpivottable _ tabledestination:=wkssource1.cells(1, 1), tablename:="pivottable14", _ defaultversion:=xlpivottableversion14 wkssource1.select cells(1, 1).select activesheet.pivottables("pivottable14").pivotfields("term - phases") .orientation = xlrowfield .position = 1 end activesheet.pivottables("pivottable14").pivotfields(&quo

camera - Why is there a blur on the outer edges of my captured image? -

i using raspberry pi camera noir v2 along raspberry pi 3b capture images. camera mounted on top surface of box, on inside. have used led strips provide lighting. capturing image of sheet of text placed @ bottom of box using following raspistill command: raspistill -w 3280 -h 2464 -q 100 -e png -ex night -sh 100 -co 100 -o new.png the height of box 30cm, unscrewed camera lens little adjust focal length. from captured image, there visible blur present on outer edges (like radial blur) while text in middle portions appears focused. considered hardware limitation of spherical lenses or thing that, while seeing preview of raspistill, image appears in focus right until moment captures it, @ point, blur @ top , bottom becomes evident. is problem hardware, or because of our lighting, or there other way rectify this? additionally, best attributes of raspistill manually set image of text in given situation? have been experimenting brightness , iso result not satisfactory. this

FFMPEG, Create video from frame with different format -

i want ask can create video using ffmpeg frame different format? usually, create video ffmpeg use command generate same format like: pic001.png pic002.png ... or: pic001.jpg pic002.jpg ... what if have picture this: pic001.png pic002.jpg thanks.

r - Access hive using sparklyr package? -

library(sparklyr) library(dplyr) home <- "/usr/hdp/current/spark-client" sc <- spark_connect(master = "yarn-client", spark_home = home, version = "1.6.2") readfromspark <- spark_read_csv(sc, name="test", path ="hdfs://hostname/user/test.csv",header=true) i access hdfs using sparklyr. how access hive table/command using sparklyr because need store df hive. afaik, sparklyr doesn't have function create database/table directly. can use dbi create database/table. library(dbi) iris_preview <- dbexecute(sc, "create external table...")

html - Window is not getting responsive in small devices -

i using bootstrap web page, works in large devices when check in small devices can see space , horizontal scrolling not required. confused if table using creating problem or grid . attaching live website link view app when see live page , in small width screen there horizontal scroll, not getting if table overflowing or div area, it's want know how remove horizontal scroll and providing code : <!doctype html> <html> <head> <title>god among computers</title> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial- scale=1"> <link rel="stylesheet" type="text/css" href="css/style.css"> <link rel="icon" href="images/favicon.png" type="image/x-icon"/> <script src="script/script.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrap

.htaccess - How to point a domain to a sub-folder in a Digital Ocean VPS (LAMP)? -

i trying point domain abcd.xyz sub-folder in digital ocean lamp vps. i can point domain directly default folder is: /var/www/html/ but want redirect sub-folder named project_balloon created under folder workspace located inside default location. i have created folder structure & want point domain at: /var/www/html/workspace/project_balloon note: domain records has been pointed vps ip address.

java - Is the Classloader part of the JVM or in the JRE? -

i relatively new java, forgive me if question might seem "silly". know jvm (java virtual machine) contained within jre (java runtime environment) not sure if classloader , execution engine part of jvm. most sources have read did not specify this. instead, when describing components of jvm discuss 5 components of runtime data area (i.e. heap, jvm stack, method area, pc registers , native method stack) . although common sense tells complete virtual machine needs input, memory & processing, still need verify exact locations of these components.

javascript - jQuery - toggleClass + slideToggle not working as expected -

i relatively new learning html, css , javascript. creating sort of test site, learning purposes , have started diving in mobile responsive websites. i have test site has mobile navigation button hidden, css media query set display block , hide normal navigation menu. have list items mobile navigation menu. show/hide this, i've created .toggleclass() jquery function: function clicktouchmenu() { $('#menuico').on('click touch', function() { var $mobmen = $(".mobilemenu"); $mobmen.toggleclass('clicked'); }); }; the above working, wanted add .slidetoggle() menu effect. if add in underneath .toggleclass() $('.clicked').slidetoggle(); menu acts bit strange, if click on menu icon, nothing happens, repeatedly clicking, seems kick in life , start working sliding , down. as new this, expect doing wrong, or on complicating quite simple. try removing clicked class , using slidetoggle() on mobilemenu

c++ - Optimised range checking and returning a value -

i have below function returns value based on input. need make code fast possible, without using divison or modulo operator or loops. each consecutive value separated amount equal 6553. int getscalingfactor(int input) { unsigned int factor = 0; if(input < 13107) factor = 72816; else if(input < 19660) factor = 81918; else if(input < 26214) factor = 93621; else if(input < 32767) factor = 109225; else if(input < 39321) factor = 131070; else if(input < 45874) factor = 163837; else if(input < 52428) factor = 218450; else if(input < 58981) factor = 327675; return factor; } you prepare table containing 72816 repeated 13107 times, 81918 repeated 19660-13107 times, , on, , check upper bound (58981). if within bounds, return table[input] else return 0 (should) do. no division, no modulo, allocated memory (well below 1 megabyte), , pre-computed table. proof of concept: #include <stdio.h> #include &l

r - Keep UI Text Input after adding or removing Inputs -

Image
i'm building small ui user enter splitlayout row of text builds statement (not needed question) solve puzzle. however, if user decides he/she needs additional row or less rows solve puzzle i'd adding or removing new row of inputs not delete remaining input rows. * gray placeholder. how can best achieve desired result of: please find trimmed code below. input. library(shiny) # define ui ui <- fluidpage( # application title titlepanel("identify a, b , c"), sidebarlayout( sidebarpanel(width = 5, helptext("present statement , receive response: 1 knight tells truth, 2 knave lies, , 3 normal can either."), # number of questions numericinput(inputid = "questions", label = "number of questions", value = 1, min = 1, max = 10, step = 1), splitlayout(cellwidths = c("25%","70%"),

SQL SERVER 2014 - Memory Full even after set value for "max server memory" -

i'm using sql server 2014 on server has 76gb ram. "max server memory" in sql 32 gb, database size 600gb. sql memory consumption hit 99% , affect server performance. can know reason? thank you. i found problem !! in procedure move data sql server mysql every minutes using linked server. linked server activities not included in "max server memory" reason memory full.

C# ASP.NET 3.5: zip more than 65535 dynamic files with SharpZipLib -

i'm trying zip 100 000 dynamic files, , on console app can without problem, on web app appears it's @ kind impossible. console static void main(string[] args) { using (zipoutputstream zipoutputstream = new zipoutputstream(file.create("test.zip"))) { zipoutputstream.setlevel(0); (long = 1; < 100000; i++) { string txt = "file " + i.tostring(); byte[] bytes = system.text.encoding.utf8.getbytes(txt); using (memorystream ms = new memorystream(bytes)) { zipentry entry = new zipentry(zipentry.cleanname(i.tostring() + ".txt")) { datetime = datetime.now, compressionmethod = compressionmethod.stored, size = bytes.length }; zipoutputstream.putnextentry(entry); byte[] buffer = new byte[1024];

PDf.js canvas scroll bar missing -

i using pdf.js display pdf documents in jsf page. input blob pass pdf.js . works fine documents single pages if document has more 1 page see first page , unable scroll. tried encapsulating <div> overflow:scroll; property cannot navigate next page. <div id="the-container" style="width:1000px;height:600px;overflow-y:scroll;"> <canvas id="the-canvas"></canvas> </div> a sample link have used below. please ! https://jsfiddle.net/qj9tau8e/ the sample document has 2 pages 1 displayed

javascript - How do I restrict past dates in html5 input type Date -

i trying restrict past dates in input type="date" .i can able restrict future dates,but don't have idea restricting past dates. $(function(){ var dttoday = new date(); var month = dttoday.getmonth() + 1; var day = dttoday.getdate(); var year = dttoday.getfullyear(); if(month < 10) month = '0' + month.tostring(); if(day < 10) day = '0' + day.tostring(); var mindate= year + '-' + month + '-' + day; $('#txtdate').attr('min', mindate); }); <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="date" id="txtdate" /> any suggestion? you can try this var maxdate = year + '-' + month + '-' + day; alert(maxdate); $('#txtdate').attr('min', maxdate); $(function(){ var dttoday =

iis - Enterprise library logging blocks Web Deploy from Visual Studio because the log file is locked -

any idea how fix this? have defined: <loggingconfiguration name="" tracingenabled="true" defaultcategory="general"> <listeners> <add name="listener1" type="microsoft.practices.enterpriselibrary.logging.tracelisteners.formattedeventlogtracelistener, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=11bf3356af364e15" listenerdatatype="microsoft.practices.enterpriselibrary.logging.configuration.formattedeventlogtracelistenerdata, microsoft.practices.enterpriselibrary.logging, version=6.0.0.0, culture=neutral, publickeytoken=11bf3356af364e15" source="enterprise library logging" formatter="text formatter" log="" machinename="." traceoutputoptions="none" /> <add name="listener2" type="microsoft.practices.enterpriselibrary.logging.tracelisteners.rollingflatfiletracelistener, microso

parenthesis for R function -

i reading hadley wickham's book "advanced r" , came across following code. `(` <- function(e1) { if (is.numeric(e1) && runif(1) < 0.1) { e1 + 1 } else { e1 } } i follwing output when running function > (1) [1] 1 > (1) [1] 2 q: why (1) run above function rather ((1) ? i tried below, f <- function(e1){if (is.numeric(e1) && runif(1) < 0.1) { e1 + 1 } else { e1 } } > f(1) [1] 2 > f1) error: unexpected ')' in "f1)" you can check definition of ( in r: > `(` .primitive("(") now construct function ( in global environment (that's hadley if run code @ console). when r looks function, uses search path starts in global environment. hence first finds function definition of hadley. why keeps working. the second part of explanation r interpreter itself. if sees symbol ( (but [ or + or other special operator) looks function name , "rearranges" arguments. example, a +

apache - laravel not working on https (https ssl provided by amazon) centos 6.8 Amazon web services -

i have ec2 instance , running on centos 6.8. after installed lamp , laravel using cli. i edited httpd config , added script. <virtualhost *:80> #servername laravel.example.com documentroot /var/www/html/application/public <directory /var/www/html/application> allowoverride </directory> <virtualhost *:443> #servername laravel.example.com documentroot /var/www/html/application/public <directory /var/www/html/application> allowoverride </directory> </virtualhost> i tried running web app using http , https(ssl certificate using amazon certificate manager). after running on http. working. on https, application not working. edit: (i used ssl certificate provided amazon web services , correct me if i'm wrong, put in on route 53 , amazon didn't provide me certificates.) tried using vhost port 443 same config. after restart httpd config. both http , https did not work)

node.js - nodejs convert string like php pack function -

i trying convert string ascii in php: >>> pack('h*', '123') => "\x120" how same thing in nodejs? i trying use https://github.com/peze/node-pack package pack result following : > pack.pack('h*', '123') outputpos=2 <buffer 12 30>

angularjs - "Object doesn't support this action" error when navigate to new component in IE -

Image
i got error message when stayed @ component , navigate one. error not show if stay @ component , refresh. happen in components. tried create new component nothing in content, it's still happen if navigate component. error message showed in none-stop way. i'm using angular 2 final. it's happen in ie (using ie11). here package.json: "dependencies": { "@angular/common": "~2.2.0", "@angular/compiler": "~2.2.0", "@angular/core": "~2.2.0", "@angular/forms": "~2.2.0", "@angular/http": "~2.2.0", "@angular/platform-browser": "~2.2.0", "@angular/platform-browser-dynamic": "~2.2.0", "@angular/router": "~3.2.0", "@angular/upgrade": "^2.2.0", "@ng-idle/core": "^2.0.0-beta.4", "@ng-idle/keepalive": "^2.0.0-beta.4&qu

python 2.7 - Not able to get running the timeout mechanism shown in https://github.com/tyarkoni/transitions/issues/198. -

need help. trying put in place timeout functionality state machine mentioned here transitions library . on init of machine keep receiving: typeerror: init () got unexpected keyword argument 'parent' although cunstructor parameters propagated. my code(python 2.7.6/ipython 5.1.0): from transitions.extensions import hierarchicalmachine machine import time threading import thread transitions import state class timeout(thread): def __init__(self, func, timeout): super(timeout, self).__init__() self.func = func self.timeout = timeout self.canceled = false print 'starting countdown' self.start() def run(self): time.sleep(self.timeout) print 'timeout occurred' if not self.canceled: self.func() class timeoutstate(state): def __init__(self, name, timeout=none, *args, **kwargs): self.timeout = timeout super(timeoutstate, self).__init_