Posts

Showing posts from March, 2014

node.js - Nodejs: npm SOAP: unexpected tag in body, args -

"solved": bug in github package i used read-me of node-soap git have unexpected problem: see 'requestcontext'-tag bellow. var args = {readenterprisebyphoneme: {"phoneme":"a", "typeofenterprise": "epp", "activefilter":"true"}}; var url = 'http://kbopub-acc.economie.fgov.be/kbopubws030000/services/wskbopub?wsdl'; soap.createclient(url,function(err, client){ client.setsecurity(new soap.wssecurity('username', 'password', 'passworddigest')); client.addsoapheader({'id': 'c1576d0a-e762-40fe-abf9-ec3f2102650b', 'language': 'nl'}); console.log('log:'); console.log(client.describe().wskbopubservice.wskbopub.readenterprisebyphoneme); client.wskbopubservice.wskbopub.readenterprisebyphoneme(args, function(err, response){ if(err){ console.log('soap error!'); //console.log(err); }else{ console...

sql - PostgreSQL: order by column, with specific NON-NULL value LAST -

when discovered nulls last , kinda hoped generalised 'x last' in case statement in order by portion of query. not so, seem. i'm trying sort table 2 columns (easy), output in specific order (easy), one specific value of 1 column appear last (got done... ugly). let's columns zone , status (don't blame me naming column zone - didn't name them). status takes 2 values ('u' , 's'), whereas zone can take of 100 values. one subset of zone 's values (in pseudo-regexp) in[0-7]z , , first in result. that's easy case . zone can take value 'future', should appear last in result. in typical kludgy-munge way, have imposed case value of 1000 follows: group zone, status order ( case when zone='in1z' 1 when zone='in2z' 2 when zone='in3z' 3 . . -- other in[x]z etc . when zone = 'future' 1000 else 11 -- [number of defined cases +1] end),...

c++ - Is Qt 5.5's QWebEngineView compatible with FramelessWindowHint? -

Image
i'm writing cross-platform web browser in qt, since has built-in webkit support via qwebview or more up-to-date qwebengineview. compact window chrome, want disable native window title bar , border via qt::framelesswindowhint, still native behavior resizing , windows' aero snap. first trimmed down pke 's borderlesswindow demo. worked fine: on windows 8.1 x64, window resizable, custom title bar can dragged or double-clicked, , aero snap works. then tried replacing central qlabel qwebengineview. caused gray native-size borders appear around window. when have interactive widgets @ top of window (like menu or toolbar), "ghost" title bar qwebengineview pushes them down accepts cursor clicks in place. here's screenshot comparing 2 windows. (view on dark background better see light-gray border on right.) is qwebengineview @ compatible frameless window, or should deal wasted space of native window chrome? edit: replacing qwebengineview qwebview avoi...

php - Customer Login Doesn't work (Magento EE-1.14.2.0) -

system , enviroment: magento ee-1.14.2.0, using secure urls on front-end (for customer login, checkout page , payment page.). ssl working should. no console errors on customer login page. session cookie management setup cookie lifetime: 7200 tried changing 33600, doesn't solve problem cookie path: (blank) cookie domain: .mydomain.com when blank, problem same use http only: no cookie restriction mode: no problem: when customer tries login (with valid username , password) gets redirected login page without error message , without logging in well. if customer uses wrong username or password redirected login page , error displayed. one of solutions: set session cookie management -> http yes. , in case, if customer logging on https, logged in. find strange, since customer using https protocol. shouldn't set no in case? note: customer cookies (customer, customer_auth, customer_info, customer_rates) not in resources when customer tries login. question: sh...

c# - WinForms - Link a TextBox with a ScrollBar -

i won't write long paragraph here , post question directly. is possible make scrollbar , textbox related ? well , i've made new customized scrollbar use later , problem not able find way related control . example : image i can't imagine way relate them :( do want external scrollbar or scrollbar in textbox. can set multiline = true , choose type of scrollbars. need more details understand question correctly. this.textbox1.scrollbars = system.windows.forms.scrollbars.vertical; https://msdn.microsoft.com/en-us/library/system.windows.forms.textbox(v=vs.110).aspx

.net - Create a List of a Referenced Type -

this question has answer here: creating generic<t> type instance variable containing type 2 answers i attempting create function pass type of object , function use type create list of object.gettype public function dosomething(byref objecttype type) dim list list(of objecttype) return 0 end function the problem having list creation proccess doesn't accept reference types in construction. i've tried passing on object object , use .gettype() function create list doesn't accept also. any me appreciated, in advance. try this: public function dosomething(byref objecttype type) ilist return ctype(activator.createinstance(gettype(list(of )).makegenerictype(objecttype)), ilist) end function

python - Printing from a dictionary -

for school homework assignment, have write code following: write program test knowledge of scientific names of animals. program should read in these scientific animal names animals.txt , ask user multiple lines of input. example animals.txt shown below: arachnocampa luminosa,glow worm pongo abelii,sumatran orang-utan felis lynx,lynx spheniscus humboldti,humboldt penguin animals.txt contain 0 or more lines, each line describing animal. each line contains 2 values, separated comma (,). left hand side of comma contains scientific name of animal, , right hand side of comma contains common name animal. your program should read in these scientific animal names animals.txt , ask user multiple lines of input. each time, program should ask user enter scientific name of animal. if scientific name exists in data read in animals.txt, program should print out common name animal. otherwise, if scientific name unknown, program should print out not know animal. example: scient...

r - Subtract mean from individual response, across separate data frames -

my data structure my experiment effect of condition (placebo or experimental) on power produced individuals during 3 sprint efforts, measured across 2 seperate sessions. 1 data.frame containes individual responses (individ) , structured as: individ <- data.frame(subjectid = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4), sprint = c(1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3), session = c(1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2, 1, 1, 1, 2, 2, 2), condition = c(placebo, placebo, placebo, placebo, placebo, placebo, exper, exper, exper, exper, exper, exper, placebo, placebo, placebo, placebo, placebo, placebo, exper, exper, exper, exper, exper, exper), power = c(400, 250, 180, 500, 300, 450, 600, 512, 300, 500, 450, 200, 460, 254, 183, 540, 360, 420, 610, 514, 307, 508, 454, 201)) i obtained mean power each session via library(dplyr) , following code second data.frame : averagenmt <- summaris...

javascript - Column chart in Google Chart displays bar below min -

ok, i've been looking similar i'm experiencing online can't decided ask around here advise solve issue. i'm using angular google chart , trying create column chart display historical values portfolio totals. code create chart $scope.createportfoliobalancechart = function(){ var data = json.parse($scope.portfoliochartdata.rows.tojson()); console.log(json.stringify($scope.portfoliochartdata).replace(/\\/g,'')); var minvalue = _.reduce(data.rows, function(memo, bal){ var value = bal.c[1].v; return (value !== null && value < memo) ? value : memo; }, number.max_safe_integer); var maxvalue = _.reduce(data.rows, function(memo, bal){ var value = bal.c[1].v; return value > memo ? value : memo; }, number.min_safe_integer); var ran...

javascript - Java Script Code Is Not Working On Mozila Firefox But Works in Other Browser -

i trying madserve ads script not working on firefox works on other browsers. please if there method work on firefox. help please don't know javascript.... (function(window) { document._write = document.write; undefined = "undefined"; var isie = false; if (navigator.appname == "microsoft internet explorer") { isie = true; var onload = function(func,unique) { document._write('<script type="text/javascript" ' + 'id="loading_ie_fallback' + unique + '" defer="defer" ' + 'src="javascript:void(0)">' + '<\/script>'); var cload = document.getelementbyid("loading_ie_fallback"+unique); cload.onreadystatechange = function() { if( this.readystate=="complete" ) { func(); } ...

Why can I not import arabic csv file into SQL Server? -

i have arabic .csv file on pc, , want import file sql server, when import it, error: text truncated or 1 or more characters had no match in target code page what happened? for storing data other english language arabic, hindi etc, need nvarchar(max) or nchar(max), instead of varchar(max). below example shows difference between varchar , nvarchar create table tab (remark varchar(max) ); insert tab values('this test'); create table tab_arabic (remark nvarchar(max) ); insert tab_arabic values(n'هذا هو الاختبار');

Android No resource found that matches given name Error -

i have set app's min sdk version jelly bean. (created kit kat) after error occurred. android studio : no resource found matches given name: attr 'android:actionmodesharedrawable' how can solve ? from error no resource found matches given name: attr 'android:actionmodesharedrawable' the issue compling application lower target. appcompat v21 builds themes require new apis provided in api 21 (android 5.0). compile application appcompat, must compile against api 21. recommended setup compiling/building api 21 compilesdkversion of 21 , buildtoolsversion of 21.0.1 (which highest @ time - want use latest build tools). make sure value target (which tells target android version) in project.properties file of both project folder , appcompat_v7 folder same : inside 'your_project'/project.properties target=android-21 android.library.reference.1=../appcompat_v7 and : inside appcompat_v7/project.properties target=android-21 android.libra...

Unable to add action buttons to my action bar in android studio -

Image
i closely following steps on website https://developer.android.com/training/basics/actionbar/adding-buttons.html , @ stage of tutorial wants me copy , paste code add action search , action settings. however, when run application, action search doesn't want appear. i have made sure include .png icon of action search, still won't show. i have tried changing minimumsdk version in build.gradle 8 11 suggested website, didn't work either. however, if not mistaken, action bar present in app though since overflow there. from wild guess, might code outdated since have noticed lot of things have changed since tutorial written. still clueless weird problem. <menu xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto"> <item android:id="@+id/action_settings" android:orderincategory="1" app:showasaction="always" android:icon=...

sapply - Is there a way to vectorize this operation using xapply in R -

i have vector a <- c("there and", "walk and", "and see", "go there", "was i", "and see", "i walk", "to go", "to was") and data frame bg where bg <- data.frame(term=c("there and", "walk and", "and see", "go there", "was i", "and see", "i walk", "to go", "to was"), freq=c(1,1,2,1,1,2,1,1,1)) i need create vectorized version following code using either sapply,tapply, or vapply or apply etc d <- null for(i in 1:length(a)){ temp <- filter(bg,term==a[i]) d <- rbind(d,temp) } the need search bg data when term==a[i] , create data frame d i need vector version loops excruciatingly slow in r. here sample data > bg term freq 1 there , 1 2 walk , 1 3 , see 2 4 go there 1 5 1 6 , see 2 7 walk 1 8 go 1 9 1 and ...

why null value display in actionbar in android? -

Image
i making simple demo of tab view .but on first line getting null pointer exception . getting null value method getactionbar() why ? share class import android.app.actionbar; import android.app.fragmenttransaction; import android.os.bundle; import android.support.v4.app.fragmentactivity; public class mainactivity extends fragmentactivity implements actionbar.tablistener { actionbar actionbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); actionbar=getactionbar(); /// <- line causing issue actionbar.setnavigationmode(actionbar.navigation_mode_tabs); } // ---------- methods ---------------// } i null value on line actionbar=getactionbar(); here manifest file , style.xml <resources> <!-- base application theme. --> <style name="apptheme" parent="theme.appcompat.light"> <...

html5 - How to open an excel sheet on click of html hyper link? -

i want open excel sheet (.csv file) on click of hyper link in html.the document stored in folder within current project root folder. //for action need following code public string execute() throws exception { fileinputstream = new fileinputstream(new file("c:\\test.csv")); return success; } //struts.xml file need following changes.fileinputstream contains fileinputstream added struts.xml. <action name="download" class="com.expertwebindia.action.downloadaction"> <result name="success" type="stream"> <param name="contenttype">application/octet-stream</param> <param name="inputname">fileinputstream</param> <param name="contentdisposition">attachment;filename="test.csv"</param> <param name="buffersize">1024</param> </result> </action>

java - AsyncTask must be abstract -

i'm pretty new asynctask on android, i'm trying pass int new starttestasync().execute(grayval); to asynctask public class starttestasync extends asynctask<integer, void, void> { double[] timearray = new double[500]; // set array double lagstarttime; double lagendtime; double lagtimeresult; int testamount; protected void doinbackground(int...grayval) { (testamount = 0; testamount < 500; testamount++) { lagstarttime = system.nanotime(); //start lagtimer start while (grayval >= 100) { log.i("mat value", string.valueof(grayval)); lagendtime = system.nanotime(); } } } android studio says "asynctask must abstract", have no idea how fix new asynctasks. edit: full code http://pastebin.com/vrf8rb3h from documentation : asynctask must subclassed used. subclass override @ least 1 method (doinbackground(params...)), , override second 1 (onpostexecute(result).) that m...

html - CSS Width:100% not working in Google Chrome -

i'm trying build gallery-section captions based on figure , figcaptions . must responsive , work different height / width along its figcaption`. everything works in firefox , unfortunately chrome doesn't follow 100% width in css significant. figure { margin: 6px; color: #333; /*display: table; float: left;*/ display: inline-block; -webkit-box-sizing: border-box ; -moz-box-sizing: border-box ; box-sizing: border-box ; } figure figcaption { background: #e3e3e3; padding: 10px 12px 12px; color: #333; text-align: center; font-size: 13px; width: 100%; display: table-caption; caption-side: bottom; -webkit-box-sizing: border-box ; -moz-box-sizing: border-box ; box-sizing: border-box ; } here's jsfiddle please help. use display:inline-table figure , remove width:100% figcaption . here's fiddle working in both chrome , firefox . figure { margin: 6px; color: #333; display: inline-table; /*chan...

CSS3 selecting nested tables using :nth selectors -

i have set mark up. here's link . i'm having trouble figuring out how select tables within table individually. need select tr , td of nested tables using :nth selectors. based on markup, following css should you're after. if read question correctly is... table tr:nth-child(4) td:nth-child(1) table{background-color:#f0f;} table tr:nth-child(4) td:nth-child(2) table{background-color:#0ff;} this selects table row contains 2 inner tables, selects each table. a better approach of course use divs ids/class names. tables should used tabular data, not layout. your fiddle updated

haskell - Why does this code run slower on spoj, triggering the timeout? -

i trying solve problem on spoj: http://www.spoj.com/problems/palin/ my code works fine , fast on laptop (even slower cpu 1 spoj provides) spoj keeps giving me time exceeded: import control.monad main = num <- getline inputs <- replicatem (read num) getline test inputs test [] = return () test (l:ls) = putstrln (send l) test ls send :: string -> string send str | odd (length str) = makepalindrome str (take (length str `div` 2 + 1) str ++ ( reverse $ take (length str `div` 2) str)) | otherwise = makepalindrome str (take (length str `div` 2) str ++ (reverse $ take (length str `div` 2) str)) makepalindrome :: string -> string -> string makepalindrome str pal | (read str :: integer) < (read pal :: integer) = pal | otherwise = makepalindrome str (nextpalindrome pal) nextpalindrome :: string -> string nextpalindrome (x:xs) = succ' ++ (reverse $ take rightlen succ') st...

PHP: Getting HTML code in file while writing a .txt file -

i new php, want write text file , download @ same time clicking on button that, wrote function in php create text file , write content in , start downloading when file generated. writing content want issue is writing html code in file. my function write file below function generatereportfile($content){ $filename="test.txt"; $handle = fopen($filename,'w') or die("can't open files"); fwrite($handle, $content); fclose($handle); header('content-type: application/octet-stream'); header('content-disposition: attachment; filename='.basename($filename)); header('expires: 0'); header('cache-control: must-revalidate'); header('pragma: public'); header('content-length: ' . filesize($filename)); readfile($filename); exit; } and calling function @ home page index.php , code :- <html> <head> <title> formatted report generator </title> ...

c# - Linq to json filtering results with Where clause -

i'm new json. i'm trying filter json data using linq json query in c#. i'm trying retrieve multiple values json data: string json= @"{ "parts": [ { "attributes": { "motherboard": "gigabyte ga-h81m-s2h", "max ram": "16gb", "form factor": "micro atx", "ram slots": 2, "socket / cpu": "lga1150" }, "type": "motherboard", "name": "gigabyte ga-h81m-s2h", "slug": "gigabyte-motherboard-gah81ms2h" }, { "attributes": { "motherboard": "msi h55-g43", "max ram": "16gb", "form factor": "atx", "ram slots": 4, "socket / cpu": "lga1156" }, "type": "motherboard...

java ee - J2EE and virtual filesystem for file storage -

i'm struggling problem now "how store files on filesystem in j2ee web application" it said, portability reasons accessing fs @ least not recommended. i'd know other possibilities, make more portable , not performance heavy in mean time. i can think of following ways use directly fs(temp files, webapp folder etc.) not portable - maybe user dir use virtual fs(apache commons vfs) - adding possibility switch fs impl. store files in db - lucene index files, looses sense jca - overcomplicated , need adapter every fs used jcr - idea use it(apache jackrabbit) where store .properties files, lucene indexes, user files, user pictures? if using different environments application in development pipeline(openshift, heroku, web containers, application servers)

elasticsearch - How do I increment my count field of my document from logstash? -

i want update 1 field of document/log in elasticsearch logstash. my logstash conf file input { http { host => "127.0.0.1" # default: 0.0.0.0 port => 31311 # default: 8080 } } output { stdout { codec => json }, elasticsearch { action => "update" bind_host => "127.0.0.1" bind_port => 9200 document_id => "et00009682" index => "in12" type => "event" } } i want increment count field 1 how specify in output of logstash. note: know update need use script "script" : "ctx._source.count += 1" but not sure place in output of logstash? kindly thanks you can conf: output { stdout { codec => json }, elasticsearch { action => "update" bind_host => "127.0.0.1" bind_port => 9200 document_id => "et00009682" inde...

How can I replace every characters in a txt file for another one using Windows Batch Scripting? -

i have test.txt lot of characters. however, need replace of . /. how can this? tried using follow code: @echo off setlocal enabledelayedexpansion set "sourcedir=c:\users\home\desktop" set "destdir=c:\users\home\desktop" set "filename=%sourcedir%\test.txt" set "outfile=%destdir%\outfile.txt" ( /f "usebackq delims=" %%a in ("%filename%") ( set "line=%%a" set "line=!line:.=/!" echo !line! ) )>"%outfile%" goto :eof anyone can me, please?

r - Get specific column value for each row -

i want "m" length vector that, considering m x n matrix, each row, gives value on column identified column (say column "z"). made using loop: for (i in 1:dim(data.frame)[1]){vector[i] <- data.frame[i,data.frame$z[i]]} do see simpler way code avoiding loop? "apply" possibility: > m <- cbind( matrix(1:15,3,5), "z"=c(3,1,2) ) > m z [1,] 1 4 7 10 13 3 [2,] 2 5 8 11 14 1 [3,] 3 6 9 12 15 2 > v <- apply(m,1,function(x){x[x["z"]]}) > v [1] 7 2 6 >

http - Responding Globally to a 401 in Polymer -

using polymer 1.0, looking best approach showing login user when app receives 401 app services. using angular looking @ using httpinterceptor this, there equivalent in polymer? here's approach explicitly routes errors service element (using iron-ajax) <template is="dom-bind" id="app"> <values-service values="{{items}}" on-error="onerror"></values-service> <h1>items <span>{{items}}</span></h1> <template is="dom-repeat" items="{{items}}"> <p>{{item}}</p> </template> </template> <script src="app.js"></script> and app script (function (document) { 'use strict'; var app = document.queryselector('#app'); app.onerror = function (e) { console.log('app.onerror ' + e.detail.request.status); }; app.addeventlistener('error', app.onerror); ...

android - Wait until GPS location is retrived for ListActivity -

i working on android project in using gps data showing nearby restaurants. on server side, have implemented haversine formula nearby restaurants depending upon longitude , latitude retrieved. but, having problem how should tell listactivity class wait until non-zero gps location retrieved. i checked similar questions, didn't provide listactivity. nice. lot. listrestaurants code : public class restaurantlist extends listactivity { private responseentity<restrestaurant[]> responseentity; private orderadapter m_adapter; private arraylist<restrestaurant> m_orders = null; gpstracker gps; double longitude, latitude; @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.restos); final resttemplate resttemplate = staticresttemplate.getrest(); final string restaurantlist = staticresttemplate.baseurl+"getnearbyrestaurants"; ...

java - "Please wait" message with delay -

i have long task , show "please wait" message during execution. use swingworker it. long task not long, want show message 1 second delay, don't know how it. swingworker<void, void> myswingworker = new swingworker<void, void>(){ @override protected string doinbackground() throws interruptedexception /** execute operation */ } @override protected void done() { dialog.dispose(); } }; myswingworker.execute(); jprogressbar progressbar = new jprogressbar(); progressbar.setindeterminate(true); jpanel panel = new jpanel(new borderlayout()); panel.add(progressbar, borderlayout.center); panel.add(new jlabel("please wait......."), borderlayout.page_start); dialog.add(panel); dialog.pack(); dialog.setlocationrelativeto(win); dialog.setvisible(true); } before start swingworker , start swing timer (at least) 1 second delay , set not repeat. pass timer swingworker has access...

c# - Generic Class:: Type Parameter <T> Property Inheritance -

my code: class classx; class class2 : classx; class class3 : classx; class2 , class3 have no association each other whatsoever, except them sharing same base class. class2 , class3 don't share same properties, data types or amount of properties. now, want able is: class class<t> : t; static void main() { class<class2> foo = new class<class2>(); foo.class2_property = value; console.read(); } i'm aware code not possible, there work around? in c++, can use operator overload so: public : operator return_data_type const; thanks in advance. ps: opened question right here , wasn't how ask question, now. left open in-case finds answer question through answers i've gotten. edit #1: i've got packet class has shared packet properties , methods, , different packets have own header , different content. i'm changing packet system. want packet packetclass name of specific packet, example logininfo. logininfo class c...

Error in converting txt to xlsx using python -

my code following. import csv import openpyxl import sys def convert(input_path, output_path): """ read csv file (with no quoting), , save contents in excel file. """ wb = openpyxl.workbook() ws = wb.worksheets[0] open(input_path) f: reader = csv.reader(f, delimiter='\t', quoting=csv.quote_none) row_index, row in enumerate(reader): col_index, value in enumerate(row): ws.cell(row=row_index, column=col_index).value = value wb.save(output_path) def main(): try: input_path, output_path = sys.argv[1:] except valueerror: print 'usage: python %s input_path output_path' % (sys.argv[0],) else: convert(input_path, output_path) if __name__ == '__main__': main() but got error. traceback (most recent call last): file "txt2xlsx.py", line 33, in <module> main() file "txt2xlsx.py", l...

javascript - Isotope height of elements not set correctly -

so height of isotope elements isn't set correctly, elements overlap each other: http://bz-fotografie.de/kundengalerie/gallery-1/ strange thing is, works on localhost, not live. i'm not js guru, structure in helper.js might not best... the problem when run .isotope images not yet loaded, plugin cannot calculate size.. you have different options choose from start isotope after images have loaded.. $(window).load(function(){/ init plugin here /}) use imagesloaded plugin: http://isotope.metafizzy.co/docs/help.html#imagesloaded_plugin 3.call relayout once images loaded $(window).load(function(){$('#thumbs').isotope('relayout');}); 4.if li elements fixed size, give them dimensions through css, , isotope pick them up.. credits: stack overflow..

java - Uiautomator Didn't find class <class> on path DexPathList -

i developing java project in order perform automatic screenshots of android application, however, when performing uiautomator command: adb shell uiautomator runtest autoscreenshot.jar -c test.screenshotroutine i getting following error: instrumentation_result: shortmsg=java.lang.runtimeexception instrumentation_result: longmsg=didn't find class "test.screenshotroutine" on pa th: dexpathlist[[zip file "/system/framework/android.test.runner.jar", zip file "/system/framework/uiautomator.jar", zip file "/data/local/tmp/autosc reenshot.jar"],nativelibrarydirectories=[/system/lib]] instrumentation_code: 0 i have searched everywhere , lost around 1 day around issue. seems answers around these kind of questions on 1 year old , none of solutions have worked me. have followed examples found here , here , , changed project , have following project structure: src |- test |- <class extending uiautomatortestcase> |- interfaces ...

Type guards for function in TypeScript -

i've defined type filter in typescript, can string , regexp or predicator , function. type defines listed below. export type predicator = (input: string) => boolean; export type singlefilter = string | regexp | predicator; there's function taking singlefilter input. however, type guards seems not working predicator , long regexp presists. issue gone if type string | predicator only. function singlepredicator(value: any) { if (typeof value === 'string') { // string } else if (value instanceof regexp) { // } else { // function // error ts2349: cannot invoke expression type lacks call signature. value(foo); } } is there solution make work in case? thanks. i'm using tsc 1.5.3 the first change in example below have typed value paramater singlefilter rather `any. the second change type assertion in last else statement hint compiler value predicator . export type predicator = (input: string) => boolea...

wcf - Paging using WPF and using stored procedure -

paging control used in wpf application. paging controls created in stored procedure after wcf application refer stored procedure. i have using paging control in stored procedure. set ansi_nulls on go set quoted_identifier on go create procedure [dbo].[usp_employee] ( /* properties*/ @employeeid int=null, @employeename nvarchar(50)=null, @employeeaddress nvarchar(50)=null, @employeephoneno nvarchar(50)=null, @action varchar(10)='action', /*paging parameter */ @pagenumber int=1, @pagesize int=5, /*sorting parameter */ @sortcolumn nvarchar(20)='title', @sortorder nvarchar(10)='' ) begin /* declaring local variables corresponding parameter modifications*/ declare @lemployeeid int, @lemployeename nvarchar(50), @lemployeeaddress nvarchar(50), @lemployeephoneno nvarchar(50), @lpagenumber int, @lpagesize int, @lsortcolumn nvarchar(20), @lfirstrecord int, @lla...

Wordpress and laravel -

i want use laravel 5 , wordpress cms frontend , backend respectly , trying load wordpress posts laravel using wp_query.i know how display images in laravel's view page ? check out these: http://grossi.io/2014/working-with-laravel-4-and-wordpress-together/ laravel 5 , wordpress 4.1.1 in same server

How to bind jQuery .css() function when click menu? -

i have following code: html part: <div id="primary"></div> js part: $(function() { var menu_contents = [ {title: "aa", href: "a.html", submenu: [ {title: "bb", href: "b.html", id: "bb"}, {title: "cc", href: "c.html", id: "cc"}, {title: "dd", href: "d.html", id: "dd"} ] }, {title: "ee", href: "e.html", id: "ee"}, ]; html = $('<div id="secondary">').append($('<div class="block">') .append('<h1 id="h1" style="color:#ffffff;">settings</h1>') .append($('<div class="content">') .append('<div id="menu">'))); html.insertafter(...

wordpress - WooCommerce reverse behavior of Ship to different address checkbox? -

i'd reverse behavior of "ship different address" checkbox on checkout page. when checked, shipping form goes hide , billing form takes information. found , changed line in checkout.js $( 'div.shipping_address' ).hide(); if ( $( ).is( ':checked' ) ) { $( 'div.shipping_address' ).slidedown(); } to $( 'div.shipping_address' ).slidedown(); if ( $( ).is( ':checked' ) ) { $( 'div.shipping_address' ).hide(); } it works fine (display reverse) when place order shipping-form data updating. how fix it? below code prevent updating shipping-form data during place order add_action('woocommerce_checkout_fields', 'woo_optional_fields'); function woo_optional_fields($wccheckout_fields) { if(//check shipping condition here){ //unset shipping fields manually here..!!! unset($wccheckout_fields['shipping']['your_all_shipping_fields']); ...

c# - How to read function table (COM type libraries) from unmanaged DLL -

i want list of functions , interfaces unmanaged dll provides. first attempt read export table of dll, there 4 standard functions dllregisterserver, dllunregisterserver etc. when scanning dll dllexp.exe there option "scan com type libraries". scaning dll option gives me wanted informations interfaces , methods. how can access "table" or whatever in pe-file-header functionnames? if has working example c# awesome.

java - Frequency of obtaining and releasing JDBC connections from ConnectionPools? -

i in process of refactoring legacy system has been designed in mid-1990s. days, jdbc connection scarce resource, there no reliable connection pool implementations , therefore connection held long possible. lead constructs these: class clienthandler { connection conn=drivermanager.createconnection(...); statement stmt=conn.createstatement(); statement stmt2=conn.createstatement(); public replytype handlecommand(requesttype req) { if (req.requesttype==requesttype.login) return new loginmanager(stmt,stmt2).login(req.requestdata); ... } } class loginmanager { statement stmt,stmt2; public loginmanager(statement stmtx,statement stmt2x) { stmt=stmtx; stmt2=stmt2x; } public login(requestdata data) { resultset rs=stmt.executequery("select count(*) users name="+data.getname()+" , pw="+data.getpassword()); if (!rs.next()) throw new illegalstateexception(); if (rs.getint(1)==0) throw new whateverexception("error.wrong...

android - Wallpaper not properly fit on Samsung devices -

Image
i want set wallpaper through app device problem following approach work moto, sony, micromax not fit any samsung device samsung s3, samsung duos, tab etc, in these devices wallpaper zoom see in screenshots. please guide me solve problem. private void setmywallpaper() { wallpapermanager mywallpapermanager = wallpapermanager .getinstance(getapplicationcontext()); displaymetrics metrics = new displaymetrics(); getwindowmanager().getdefaultdisplay().getmetrics(metrics); // height , width of screen int height = metrics.heightpixels; int width = metrics.widthpixels; drawable drawable = null; if (who.equals("color")) drawable = getresources().getdrawable(colorwallpaper[i]); else drawable = getresources().getdrawable(graywallpaper[i]); bitmap bitmap = ((bitmapdrawable) drawable).getbitmap(); bitmap wallpaper = bitmap.createscaledbitmap(bitmap, width, height,true); mywallpapermanager.suggestde...