Posts

Showing posts from July, 2014

MSSQL server 2014 express database synchronize to linked server -

i need synchronize linked server primary server in mssql server 2014 express.when modification in primary server should reflect on linked server or secondary server . in express edition mirroring , replication not available. solution this? you try using trigger solve problem. first create trigger actions against local table created test. create on insert, update , delete trigger actions pretty execute same action against test table. once got work, replace test table target linked server table need in sync. let me know if worked you, can talk limitation might face.

r - How to run .sqlite files? -

i have downloaded file called "database.sqlite" " https://www.kaggle.com/benhamner/d/kaggle/college-scorecard/exploring-the-us-college-scorecard-data " .i have connect database r don't know how run file or create database , use data file .i use mac , sqlite version 3.8.5.any highly appreciated. hi can find sample referenced here library("rsqlite") con = dbconnect(drv="sqlite", dbname="country.sqlite") alltables = dblisttables(con) p1 = dbgetquery( con,'select * populationtable' ) p2 = dbgetquery( con,'select count(*) areastable' ) p3 = dbgetquery(con, "select population date(timestamp) < date('now', 'weekday 0', '-7 days')") dbclearresult(p3) p4 = dbgetquery(con, "select * populationtable jobdescription '%manager%'")

Java conditional compilation: how to prevent code chunks from being compiled? -

my project requires java 1.6 compilation , running. have requirement make working java 1.5 (from marketing side). want replace method body (return type , arguments remain same) make compiling java 1.5 without errors. details: have utility class called os encapsulates os-specific things. has method public static void openfile(java.io.file file) throws java.io.ioexception { // open file using java.awt.desktop ... } to open files double-click ( start windows command or open mac os x command equivalent). since cannot compiled java 1.5, want exclude during compilation , replace method calls run32dll windows or open mac os x using runtime.exec . question: how can that? can annotations here? note: use ant, , can make 2 java files os4j5.java , os4j6.java contain os class desired code java 1.5 , 1.6 , copy 1 of them os.java before compiling (or ugly way - replace content of os.java conditionally depending on java version) don't want that, if there way. elabora...

sql server - How to use BULK INSERT to move data between two tables? -

how use bulk insert move data between 2 tables? can't find tutorial examples. have 10 mln records move. sql server 2012 sp3. 1 time action. can't use cmdshell, can't use ssis. have move data in batches. going night job. "move" don't have delete records in source. target table exists already, don't have check constraints , no foreign keys. it easy shift data 1 database another, long both located in same server (as wrote it). as want use script , want copy records 1 table might use this: insert targetdb.dbo.tablename(col1,col2,col3...) select col1,col2, col3 ... sourcedb.dbo.tablename this copy rows here there. in question not provide enough information, want use script . above script... if have existing data should read merge if target , soure not have same structure, can adapt select return set need insert if not need copy rows, add where clause if user took connect has not necessary rights ask admin. - question or comment - ...

types - Typescript enums with parameters -

i'd have strictly typed mutable objects, haxe enums. in haxe, can do enum color { red; rgb(r:int, g:int, b:int); rgba(r:int, g:int, b:int, a:int); } i'd able access a parameter if object rgba , , can't access parameters if object red . i don't care if use enum keyword or not in typescript. is there way achieve in typescript ? as of version 2.0, typescript supports tagged unions extent. general syntax is type mytype = | b | c …; where a , b , c interfaces. mytype object can of types, , no other. announcement gives quick example: interface square { kind: "square"; size: number; } interface rectangle { kind: "rectangle"; width: number; height: number; } interface circle { kind: "circle"; radius: number; } type shape = square | rectangle | circle; function area(s: shape) { // in following switch statement, type of s narrowed in each case clause // according value ...

javascript - How to fix Material Design Light - SCEditor conflict? -

i'm looking fix material design light working mybb uses sceditor , js wysiwyg editor. there conflict because mdl adds layout classes break editors textbox. at github there similar issue tinymce i'm not sure how apply fix sceditor. any appreciated, thanks. initialising editor after layout has been upgraded seems fix issue me: document.addeventlistener('mdl-componentupgraded', function (e) { if (typeof e.target.materiallayout !== 'undefined') { // create editor js here $('textarea').sceditor({ plugins: 'bbcode', style: 'https://cdn.jsdelivr.net/sceditor/1.5.1/jquery.sceditor.default.min.css' /* other options options here */ }); } }); for mybb you'll need move js creates editor event handler it's called after mdl has upgraded layout. if can't move js, need remove , re-create editor fix it: document.addeventlistener('mdl-componentupgraded', function (e) { if (typ...

python - Add constant value column that changes half way down to pandas dataframe -

i have list: [['abc', 1, 2, 3], ['bfg', 4, 5, 6], ['abc', 7, 8, 9], ['bfg', 10, 11, 12]] and make pandas dataframe, returns (after adding column color lst[4] = 'blue' ): 0 1 2 3 4 0 abc 1 2 3 blue 1 bfg 4 5 6 blue 2 abc 7 8 9 blue 3 bfg 10 11 12 blue is there anyway make return instead: 0 1 2 3 4 0 abc 1 2 3 blue 1 bfg 4 5 6 blue 2 abc 7 8 9 red 3 bfg 10 11 12 red solution dataframe.from_records : lst = [['abc', 1, 2, 3], ['bfg', 4, 5, 6], ['abc', 7, 8, 9], ['bfg', 10, 11, 12]] df = pd.dataframe.from_records(lst) print (df) 0 1 2 3 0 abc 1 2 3 1 bfg 4 5 6 2 abc 7 8 9 3 bfg 10 11 12 add values loc : l = len(df.index) // 2 df.loc[:l - 1, 4] = 'blue' df.loc[l:, 4] = 'red' print (df) 0 1 2 3 4 0 abc 1 2 3 blue 1 bfg 4 5 6...

linux - How to rewrite timestamp in syslog-ng -

i'm trying figure out how rewrite timestamp being sent me cisco, can forward on parser. it nice perform rewrite in syslog-ng (where collecting logs), when both write-to-disk, , when send out there, timestamps in nice iso format. currently, timestamps in 2016 nov 17 13:13:13 utc format. want rewrite them simple iso08601 format (yyyy-mm-ddthh:mm:ssutc). i understand how use templates parse out info, , simple rewrite except month coming in. don't know how syslog-ng translate 'nov' '11'. anyone know of tricks?

swift - Implementing completion handlers for backgroundSession.uploadTask -

i have (almost) implemented urlsessiondelegate , urlsessiontaskdelegate , , urlsessiondatadelegate can upload objects in background. i'm not sure how implement completion handlers, can delete object sent, when server returns statuscode=200 i start uploadtask this let configuration = urlsessionconfiguration.background(withidentifier: "com.example.myobject\(myobject.id)") let backgroundsession = urlsession(configuration: configuration, delegate: customdelegate.sharedinstance, delegatequeue: nil) let url: nsurl = nsurl(string: "https://www.myurl.com")! let urlrequest = nsmutableurlrequest(url: url url) urlrequest.httpmethod = "post" urlrequest.setvalue("multipart/form-data; boundary=\(boundary)", forhttpheaderfield: "content-type") let uploadtask = backgroundsession.uploadtask(with: urlrequest urlrequest, fromfile: path) uploadtask.resume() i tried a...

java - How to handle drag & drop upload of folders? -

i implementing upload functionality in vaadin web application uses drag & drop, in vaadin sampler example . my code identical example code there. when trying code , linked example however, there 1 important difference: when dropping folder, code starts show progress spinner, never finishes. none of streamvariable callback methods ever called. no bytes ever uploaded. sample application nothing (user visible @ least). i don't want user able upload folders, need able detect whether dropped "file" folder. unfortunately, neither wrappertransferable nor html5file objects give me indication. i've come heuristics determine whether have file or folder: check mime type empty, check filesisze small, check there no dots in filename. none of these safe though. how can detect , prevent attempted upload of folder? here code (again, straight copy of linked vaadin example). public class attachmentdropbox extends draganddropwrapper implements drophandler { ...

php - sql table name with traditional chinese languange -

i got trouble when execute query traditional chinese language, table name 历史皮重 , query let select * 历史皮重 , return error number: s0002 [microsoft][odbc microsoft access driver] microsoft jet database engine cannot find input table or query '历史皮重'. make sure exists , name spelled correctly. select * 历史皮重 filename: c:/xampp/htdocs/mdb_test/system/database/db_driver.php line number: 691 but when change table name "abc" query works fine.. there anyway can query traditional chinese language? query execution php , ms.access database thank you

typo3 - Get next news record in Fluid Template? -

i creating custom news template tx_news uses fluid template. i need uid of next news record in loop. <f:for each="{news}" as="newsitem" iteration="iterator"> <div id="{newsitem.uid}"> <a href="#{newsitem.next.uid???}">go next</a> </div> </f:for> you use extension vhs , provides ton of useful viewhelpers - among them viewhelper v:iterator.next . i've never used it, reading documentation i'd use (using viewhelper v:variable.set same extension creating local variable): {namespace v=fluidtypo3\vhs\viewhelpers} <f:for each="{news}" as="newsitem" iteration="iterator"> <div id="{newsitem.uid}"> <v:variable.set name="nextnews" value="{news -> v:iterator.next(needle: newsitem)}"/> <a href="#{nextnews.uid}">go next</a> </div> </f:f...

python - numpy append to an indexed array (after np.where) -

i want append values selection of array without having go through loop. i.e. if want add 0 values locations of array: a=np.array([[1,2,3,4,5],[1,2,3,4,5]]) condition=np.where(a>2) a[condition]=np.append(a[condition],np.array([0]*len(condition[0]))) -> valueerror: shape mismatch: value array of shape (12,) not broadcast indexing result of shape (6,) edit clarification: i need add values (and dimension if needed) selected array location. loop looks that: for t in range(len(ind)): c = cols[t] r = rows[t] if data1[r, c] > 2: data2[r,c]=np.append(data2[r,c],t) is there way remove loop (~100 000 iterations)? thank let's @ pieces: in [92]: a=np.array([[1,2,3,4,5],[1,2,3,4,5]]) ...: condition=np.where(a>2) ...: in [93]: out[93]: array([[1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]) in [94]: condition out[94]: (array([0, 0, 0, 1, 1, 1], dtype=int32), array([2, 3, 4, 2, 3, 4], dtype=int32)) in [95]: a[condition]...

c# - Protobuff.net can't serialise Interface -

i'm getting error the type cannot changed once serializer has been generated when attempting serialise protobuff.net. i've managed reduce code find culprit, know why it's not able serialise property. i've found working solution i'm able use, interested in explanation of why code fails. wont serialise: [protocontract] public class somecontroller { [protomember(3)] public int controllervalue { get; set; } [protomember(4, asreference = true)] private itest itestobj { get; set; } private somecontroller(){} public somecontroller(object something, int value) { controllervalue = value; itestobj = itest; } } will serialise: the error caused somecontroller.itestobj . if change class to: [protocontract] public class somecontroller { [protomember(3)] public int controllervalue { get; set; } [protomember(4, asreference = true)] private testobj originalobject { get; set; } private i...

java - validate xmlns:h="http://xmlns.jcp.org/jsf/html" -

i cannot validate .xhtml file: <?xml version="1.0" encoding="utf-8"?> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://xmlns.jcp.org/jsf/html" xmlns:p="http://primefaces.org/ui" xml:lang="en" lang="en"> <h:head> <title>title</title> </h:head> <h:body> <p:editor /> </h:body> </html> i'm using intellij idea , maven download libraries. primesfaces schemas set correctly provided in primefaces-p.taglib.xml primefaces-6.0 jar. cannot find valid schema xmlns:h="http://xmlns.jcp.org/jsf/html" namespace. have tried .xml in jsf-impl-2.2.13.jar/com/sun/faces/metadata/taglib cannot validate tag.

How to convert unicode representation of non-ascii string to a python string as is? -

how can convert unicode-representation of non-ascii range string python string? > str = '<some-arabic-content>' > decoded_str = str.decode('utf-8') > decoded_str u'\u0623\u0646\u0633\u0646\u0629' > str(decoded_str) <will-throw-an-error-ofc> since ascii cannot encode unicode string how representation ('\u0623\u0646\u0633\u0646\u0629') python string? 1 below. > str_rep = '\u0623\u0646\u0633\u0646\u0629' i want land on str_rep decoded_str . how can go doing this? decoded_str.encode("unicode-escape") produces desired output.

Chnage url using .htaccess in Php -

i want change url --> localhost/mysitename/get_file.php to localhost/mysitename/file2 using .htaccess ..any suggestions.? this need create .htaccess file http://www.htaccessredirect.net/ this content of .htaccess file rewriteengine on rewriterule ^\file2$ /mysitename/get_file.php [l]

objective c - Bridging swift code into obj c project -

i added swift bridge , changed proper settings allow swift in objc project. big issue swift3 code trying bridge coming errors in project shows has no members, no types etc.. along parse giving off errors , not wanting work.. don't know if foundation of project if old , can't project 2 years old or what... swift errors of member issues parse errors here of errors see , hoping pointed in correct direction. tltr- of big issues i'm facing see type 'uiapplication' has no member 'shared' , use of unresolved identifier 'parse' along value of type 'uiimage' has no member 'draw' you need import projectname-swift.h. note it's project name - other answers make mistake of using class name. this single file autogenerated header defines objective-c interfaces swift classes in project either annotated @objc or inherit nsobject. if project name contain spaces, replace them underscores (e.g. "my project" be...

npm - Multiple versions of the same package using npmjs -

anyone knows trick install multiple versions of same package through npmjs ? know it's not possible use same package-name in package.json gives idea of try achieve: "dependencies": { "mypackage": "user/mypackage#v1.0", "mypackage": "user/mypackage#v2.0" } at end, want a/b test package different versions. lot ! based on npm discussion, won't implemented time soon. some reference: https://github.com/npm/npm/issues/5499 https://github.com/npm/npm/issues/2943

I can't find NDK in my SDK Manager on Android Studio -

Image
i want download ndk in sdk manager, can't find it. sdk manager different others, can show me exactly?

Can't build project using mongodb c++ driver with MSVC -

Image
i'm trying build following sample c++ code visual studio: #include <iostream> #include <bsoncxx/builder/stream/document.hpp> #include <bsoncxx/json.hpp> #include <mongocxx/client.hpp> #include <mongocxx/instance.hpp> int main(int, char**) { mongocxx::instance inst{}; mongocxx::client conn{mongocxx::uri{}}; bsoncxx::builder::stream::document document{}; auto collection = conn["testdb"]["testcollection"]; document << "hello" << "world"; collection.insert_one(document.view()); auto cursor = collection.find({}); (auto&& doc : cursor) { std::cout << bsoncxx::to_json(doc) << std::endl; } } i'm not getting errors code, during building i'm getting following errors: i've built the driver according this: https://github.com/mongodb/mongo-cxx-driver/blob/master/appveyor.yml system info: -win10 -visual studio communit...

unity3d - Unity Android - gms.iid.instanceID returns NoClassDefFoundError -

i'm trying integrate jar containing class "com.google.android.gms.iid.instanceid" unity project when run project in native java works, on unity following exception - java.lang.noclassdeffounderror: failed resolution of: lcom/google/android/gms/common/util/zzx; this exception triggered on following line - instanceid instanceid = instanceid.getinstance(context); i added play-services-iid jar unity.

javascript - Missing dependency when using webpack with bamboo -

i have code use xterm.js build using webpack babel , uglifyjs: import terminal 'xterm/src/xterm'; import 'xterm/addons/fit/fit'; function terminaldirective($http, config) { return { restrict: 'e', replace: true, scope: { service: '=' }, template: template, link: function($scope, $element, $attrs) { ... if (localstorage.getitem('sessionid')) { $scope.sessionid = localstorage.getitem('sessionid'); $scope.systemid = localstorage.getitem('systemid'); dopost = true; settimeout(function() { init(); }, 100); } ... function init() { xterm = new terminal({cursorblink: true}); xterm.open($element.find('.terminal')[0]); console.log(xterm); xter...

data warehouse - Most common granularities in datawarehouse designs -

i have been looking answer of question while: when asking granularity, immediate examples given are: transaction, day, week, month etc. couldn't find other type of example. instance, consider 'city', 'state' etc. granularity? when, example, consider sales nationwide company? in other words, granularity of type of time? no, granularity not related time. lowest granularity kind of transaction. 1 of examples kimball uses retail setting: lowest granularity relating product sales might item being scanned @ check-out. 2 such transactions happen @ same moment, not time-based granularity. just could granularity of table, kimball advises working lowest granularity far more flexible - can slice , dice data in more ways. might choose have aggregated tables sum data week level, or state level, or pretty else (possibly performance reasons, or make easier users) - these unlikely lowest granularity. using state example - presumably have lower level information ...

php - Aggregating View Counts with Laravel -

in micro-blogging application, user should able see breakdown of posts' views in statistics page. additionally, should have nice total of views across posts simplicity's sake. eg: if post #1 has 10 visitors , post #2 has 5 visitors, they'd see 15 visitors total count of visitors across of posted content. i'm aware can app\post::withcount('visitors')->get(); have each individual post's total views, what's best way aggregate of 1 total number? you can use sum function have sum of visitors app\post::withcount('visitors')->sum('visitors');

workflow - Activiti - Parent process of subprocess -

Image
we using activiti workflow engine on scenario: <?xml version="1.0" encoding="utf-8"?> <definitions xmlns="http://www.omg.org/spec/bpmn/20100524/model" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:xsd="http://www.w3.org/2001/xmlschema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/bpmn/20100524/di" xmlns:omgdc="http://www.omg.org/spec/dd/20100524/dc" xmlns:omgdi="http://www.omg.org/spec/dd/20100524/di" typelanguage="http://www.w3.org/2001/xmlschema" expressionlanguage="http://www.w3.org/1999/xpath" targetnamespace="http://www.activiti.org/test"> <signal id="alertsignal" name="alert" /> <process id="myprocess" name="myprocess" isexecutable="true"> <subprocess id="subprocess1" name="sub process"> <star...

java - SLF4J-Logback print root cause message -

i using slf4j logback log error messages. 1 of observations of root cause requires tostring() instead of getmessage() . example, if exception wrapped under another, slf4j prints 'null' of root cause instead of exception message indirectly referenced in tostring() . java util library logs fine. however, have use slf4j-logback. there way overrides default behaviour of slf4j , logback. class testexception extends exception { private string exceptioncode; private string exceptionmessage; @override public string tostring() { return "testexception [exceptioncode=" + exceptioncode + ", exceptionmessage=" + exceptionmessage + "]"; } } try { testexception testexception = new testexception(); testexception.exceptioncode = "test exception code"; testexception.exceptionmessage = "tes...

python - How to use string formatting in specific size based variables? -

i know when use "%2d"%(x) i string of x , in @ least size of 2, , if length of x shorter 2 spaces before it. how can give 2 variable too? example: "%nd"%(2,1) ' 1' is possible in python? or need create loop it? use * , actual width read next element of tuple of values, , value convert 1 following: >>> "%*d" % (2, 1) ' 1' this documented in string formatting operations section of documentation — says: minimum field width (optional). if specified '*' (asterisk), actual width read next element of tuple in values, , object convert comes after minimum field width , optional precision.

python - pandas Read undelimited text file to dataframe -

this question has answer here: create pandas dataframe txt file specific pattern 5 answers i new pandas. until i've been learning pandas using csv files , excel spreadsheets. now faced converting text file dataframe. text files call sequential data. format of file is: state name city name state name city name city name city name ... all 50 states plus territories listed number of cities varies. need convert dataframe like [[state name, city name1],[state name, city name2],...] using pandas read_table() method, i've been able @ least read file dataframe, i'm not how correct state name city name format. i have dictionary of state name/state 2 letter abbreviations available. format of dictionary is {'oh':'ohio', 'ky':'kentucky',...} is there way can use dictionary, loop on file , separate state , city? or there...

Using svg-pan-zoom from es6 with webpack -

how can use svg-pan-zoom es6 webpack? tried this: import {svgpanzoom} '../node_modules/svg-pan-zoom/src/svg-pan-zoom.js; but svgpanzoom undefined . tried simply: import * svg_pan_zoom 'svg-pan-zoom'; but svg-pan-zoom set {} ;

php - How do I calculate a payroll directly from an attendance records -

mysql database table: (name: attendance) recid | employeeid | date | name | workedhours | absence | overtime ------+------------+----------+------+-------------+---------+--------- 434 | 7 | 19/11/16 | jack | 8 | | 1 435 | 7 | 20/11/16 | jack | 8 | | 0 436 | 7 | 21/11/16 | jack | 8 | | 0 437 | 8 | 19/11/16 | nik | 8 | | 1 438 | 8 | 20/11/16 | nik | 0 | 1 | 0 439 | 8 | 21/11/16 | nik | 8 | | 1 i show following payroll report using php: employeeid | month | name | workeddays| deductions| overtime | net pay -----------+-------+------+-----------+-----------+----------+-------- 7 | 11/16 | jack | 3 | | | 1 8 | 11/16 | nik | 2 | | | 0 what tried far following using sql : select employeeid, name, count(*) workeddays...

Scan image in vba with cannon scanner not work -

i have vba code scan image scanner , code works , doesnt have problem type hp brother scanner when used canon can not find scanner , send message no wia device. how can solve problem private sub command10_click() const wiaformatjpeg = "{b96b3cae-0728-11d3-9d7b-0000f81ef32e}" on error goto handle_err dim dialog1 new wia.commondialog, dpi integer, pp integer, l integer dim scanner wia.device dim img wia.imagefile dim intpages integer dim strfilejpg string dim blncontscan boolean ' activate scanner start scan dim contscan string 'msgbox chk if more pages scanned dim strfilepdf string dim rptname string dim strprocname string strprocname = "scandocs" docmd.setwarnings false docmd.runsql "delete scantemp" docmd.setwarnings false blncontscan = true intpages = 0 while blncontscan = true dpi = 200 pp = 1 'no of pages set scanner = dialog...

gstreamer correct pipeline to decode rtsp stream to raw video -

using gstreamer-1.10 have been trying several version of pipeline decode rtsp stream starts webrtc connection. ffprobe reports stream as duration: n/a, start: 0.128000, bitrate: n/a stream #0:0: audio: aac (lc), 48000 hz, stereo, fltp stream #0:1: video: h264 (constrained baseline), yuv420p, 512x288 [sar 1:1 dar 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc using variations of following pipeline gst_debug=3 gst-launch-1.0 -e rtspsrc location=rtsp://xxx.xxx.xxx.xxx:1935/alpha/stream1 \ ! decodebin name=decode \ decode. \ ! x264enc bitrate=512 speed-preset=6 \ ! video/x-h264, profile=baseline \ ! queue ! mp4mux name=mp4mux ! filesink location=file.mp4 \ decode. ! avenc_aac bitrate=96000 ! aacparse ! queue ! mp4mux. i following errors 0:00:00.299416405 7705 0x7f0d48001e80 warn default grammar.y:510:gst_parse_no_more_pads:<decode> warning: delayed linking failed. 0:00:00.299435518 7705 0x7f0d48001e80 warn default grammar.y:510:gst_parse_...

javascript - How to run callback with jest --watch -

i started learn reactjs yesterday (to used in next product), willing set dev environment i'm stuck jest... having bluetooth lightbulb on desk (already op scripts etc..), want red light when tests launched jest --watch fail (see create-react-app fb devs here ) problem is, don't know how run callback after tests, seems no 1 ran issue on interwebz, no solution found yet me. update: i using log file grep: lamp.rb def ci if file.readlines("path/jest.log").grep(/failed/).any? file.truncate('path/jest.log', 0) fail_jest # method updates lightbulb :) (red blink) end rescue puts 'no jest log found :(' end launching jest tests this: unbuffer npm run test |& tee tmp/jest.log i still looking better solution ! thanks help your problem not specific react or jest. when run jest tests, running node/npm command , when tests fail process exists unsuccessful exit code. same mechanism used make automated ci builds fail w...

C++: Write BMP image format error on WINDOWS -

i have strange problem here... i'm using same code(copy-paste) linux in windows read , write , bmp image. , reason in linux every thing works perfectly fine , when i'm coming windows 10 can't open images , i've receive error message how said this: "it looks don't support file format." do have idea should do? put code below. edit: i've solved padding problem , it's write images white , idea why? i've update code also. struct bmp { int width; int height; unsigned char header[54]; unsigned char *pixels; int size; int row_padded; }; void writebmp(string filename, bmp image) { string filename = "output files\\" + filename; file *out = fopen(filename.c_str(), "wb"); fwrite(image.header, sizeof(unsigned char), 54, out); unsigned char tmp; (int = 0; < image.height; i++) { (int j = 0; j < image.width * 3; j += 3) { // convert (b, g, r) (r, ...

Apache httpd: Conditionally run a program if a specific *response* header is set -

i need configure httpd 2.2 filtering responses under conditions. can filter responses using external scripts mod_ext_filter , i'd trigger filter if specfic response-header set. how can achieve this?

c# - IL Emit base class name is the same as inherited class; protobuffer does not accept cyclic inheritance -

i have emitted code returns object of type passed in, propertychange notification wrapped virtual properties, modification tracking client. new type shared between client , server (serialized using protobuf.net). i'm limited not using third-party libraries, other use of protobuf.net. the issue i'm having when try serialize list of new objects (for example, typea) using protobuffer, run "unexpected sub-type: typea", , when try add subtype model protobuffer using runtimetypemodel, run "cyclic inheritance not allowed", protobuffer not accept @ time, afaik. i'm new reflection.emit - there way type new class emitted different type i'm emitting, @ least in name? may able overcome cyclic inheritance restriction in case. i'd avoid creating/copying new objects. for instance, emit new object as: newtypea -base typea instead of: typea -base typea -sub-type typea il emitter: usage: type atype = createproxy(typea); activator.create...

c# - SqlConnection.Open vs SqlConnection.OpenAsync - what's different between the two beyond the obvious? -

edit: boils down why changing sqlconnection.open() await sqlconnection.openasync() within asynchronous code result in different behavior. what's difference between sqlconnection.open call in synchronous code , await sqlconnection.openasync call in asynchronous code aside obvious asynchronous behavior? underlying connection made asynchronous database? the documentation on openasync lite, https://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.openasync%28v=vs.110%29.aspx?f=255&mspperror=-2147217396 . an asynchronous version of open, opens database connection settings specified connectionstring. method invokes virtual method openasync cancellationtoken.none.(inherited dbconnection.) i find interesting connection string required async=true within it, while in .net 4.5+ it's no longer required. connections behave differently? https://msdn.microsoft.com/en-us/library/hh211418(v=vs.110).aspx beginning in .net framework 4.5, the...

javascript - How to pass props from one class to another in React.js -

i'm new react. i'm practicing creating simple 9 grid box, user can select color want use @ moment using dropdown menu. thing is, can't quite figure out how pass variable class contains (colorpicker) the class contains grids (box). can give me pointers on how this? i'm still getting used passing props other classes. here's link codepen: http://codepen.io/anfperez/pen/rorkge here's code //this displays color selections boxes: red, green, , blue var colorpicker = react.createclass({ handlechange: function(e) { var newcolor = e.target.value; this.props.onchange(color); }, render: function() { return ( <div> <select id="pick-colors" onchange={this.handlechange}> <option value="red"> red </option> <option value="green"> green </option> <option value="blue"> ...

jquery - xmlHttpRequest/AJAX Calls are blocking all Servlet calls after refreshing 3 times -

i trying data ui making ajax calls servlet. following code using make these calls, function callservlet(paramstring, mapping){ var url = contextpath + "/" + mapping; var strobj; $.ajax({ url: url, data: paramstring, type: 'post', async : false, cache : false, beforesend:function(){ console.log("hello"); }, success: function(data) { if (data) { console.log('data', data); strobj = data; } }, error:function(a,b,e) { console.log(e); } }); return strobj; } i have 5 of these calls done when page loads populate various parts of ui. after refresh page 3 times, page gets stuck @ 1 of these 5 servlet calls. when restart tomcat server, works expected 3 times , gets stuck again. note: able make numerous calls above used servlet postman client. gets stuck when use ajax or xmlhttprequest call servlet. can suggest can issue? please ask if other information...

html - How to create a centered <div> which automatically shrinks if it doesn't fit within the viewport? -

i'd have html5 video box both vertically , horizontally centered within <div> fixed width. tricky thing is, want video shrink fit inside viewport, when viewport in either height or width smaller video. and of course accomplish resizing without javascript. fine, if older browsers fail resizing. i found quite nice solution (see code below). have quite bad feeling it, because webkit-based browsers have other understanding of css ie 11, 10 & 9 (while firefox here above both) to achieve desired result set max-width of video , outer container (#parent) 100%. however not work internet explorer 11, 10 & 9. looks ie interpreting #parent video {max-width:100%} 100% of video , not of containing block. result video juts out of it's container , not resize. ie behaving fine if set #parent video {width:100%} . the webkit-based browsers (safari, chrome, new opera) on other hand need #parent video {width:auto} . otherwise behave not nice, if small vertical size of v...

c# - Getting toggle player prefs to display in unity text field -

im having trouble displaying strings playerprefs in text fields public void activetoggle () { if (isnone.ison) { playerprefs.setstring("offer_schedule","none"); playerprefs.save(); debug.log("offer_schedule".tostring()); } else if (isdaily.ison) { playerprefs.setstring("offer_schedule","daily"); playerprefs.save(); debug.log("offer_schedule".tostring()); } else if (isweekly.ison) { playerprefs.setstring("offer_schedule","weekly"); playerprefs.save(); debug.log("offer_schedule".tostring()); } } offer_schedule =playerprefs.getstring("offer_schedule"); i save playerprefs offer schedule string based on toggle selected offerschedule.text = playerprefs.getstring("offer_schedule"); cannot string display in text field your mistake lays in debug.log("offer_schedule".to...

r - Counting 0`s, 1`s, 99`s and NA`s for each variable in a data frame -

i have data frame 118 variables 0's , 1's 99's , na's . need count each variable how many 99's , na's , 1's , 0's there (the 99 "not apply", 0 "no", 1 "yes" , na "no answer"). try table function works vectors, how can set of variables? there little reproducible example of data frame: forest<-c(1,1,1,1,0,0,0,1,1,1,0,na,0,na,0,99,99,1,0,na) water<-c(1,na,na,na,na,99,99,0,0,0,1,1,1,0,0,na,na,99,1,0) rain<-c(1,na,1,0,1,99,99,0,1,0,1,0,1,0,0,na,99,99,1,1) fire<-c(1,0,0,0,1,99,99,na,na,na,1,0,1,0,0,na,99,99,1,1) df<-data.frame(forest,water,rain,fire) and need write in data frame result variable, this: forest water rain fire 1 8 5 8 6 0 7 6 6 6 99 2 3 4 4 na 3 6 2 4 can't find dupe, here's comment answer: a data frame list of columns. lapply apply function ever...