Posts

Showing posts from August, 2015

c# - What is the easiest way to get ZedGraph to use scientific notation instead of engineering notation? -

zedgraph likes use engineering notation axes, e.g. 300*10^3 instead of scientific notation, e.g. 3*10^5. easiest way change this? i couldn't figure out automatic way this, it's 1 line of code manually: zedgraph1.graphpane.yaxis.scale.mag = (int)math.floor(math.log10(zedgraph1.graphpane.yaxis.scale.max));

oracle - How to connect to a standby database which is in MOUNTED state and know the applied archive log sequence number? -

how connect standby database in mounted state , know applied archive log sequence number? i want connect database in standby mode , fire select query know archive log number. connect instance sysdba: export oracle_sid=*database_name* export oracle_home=/path/to/oracle/home sqlplus / sysdba to last log file should able query v$archived_log. select max(sequence#) v$archived_log

If Aurelia understands "import", why use dependency injection? -

i don't understand.. if can use import in aurelia, why have wire constructor @autoinject() , that? i'm sure i'm missing something, but, can tell, can use imported module whenever want. import "whatever" export class someviewmodel { activate() { // use } } typically, in aurelia application, thing import ing isn't instance of something it's class something . use whatever has been import ed, need instance of it. import 'whatever'; let = new something(); when use aurelia's dependency injection system, utilizing design pattern called "inversion of control." instead of class (or you) being in charge of instantiating dependencies, lists dependencies has , has instances of dependencies injected in constructor function. this helps testability, can pass mocked instances of dependencies class in test fixtures (note in tests, tests pass mocks constructor, , not rely on aurelia's di container).this all

magento - How to unistall extension from Mangeto without access admin area? -

i trying install extension "enhanced admin grids extension" did fine magento connect. realized wanted install github version thought doing correctly replacing folders github version. turned out didnt work , getting errors when trying login admin area. how can remove able login site again? this error i'm getting: mage registry key "_singleton/customgrid/observer" exists if know extension lives in website, can try deleting extension's directory - try checking app/code/local/... , app/code/community/... this won't undo database changes though. alternatively, complete hack, can open app/mage.php. following function public static function register($key, $value, $graceful = false) { if (isset(self::$_registry[$key])) { if ($graceful) { return; } self::throwexception('mage registry key "'.$key.'" exists'); } self::$_registry[$key] = $value; } change function one:

React-Router same-page anchors with browserHistory -

using react-router browserhistory , how can create same-page link item on page? in 1 component: <link to='/coolroute#coolthing'>cool thing</link> in another: render () { return ( <div id='coolthing'></div> ); } when click link browser url changes properly, nothing happens (i expect scroll up/down page element. i know id present on page because doing document.getelementbyid('coolthing') works fine.

multidimensional array - How can I chage the index count in a matrix? (Python) -

i have multidimensional array looks this: matrix = [[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0],[0,0,0,0,0]] if wanted find value in first spot inside matrix have this: matrix[0][0] is there way in can make instead of having input coordinates find position can ask specific position? so if wanted first position input matrix[1] instead of matrix[0][0] if wanted second position input matrix[2] instead of matrix[1][0] and on. thanks help. one of simplest (and cleanest) solution wrap matrix inside class, , define bracket operator class. however, aware usually, positions go 0 n-1, not 1 n. the code compatible both python 2 , python 3 class matrix: def __init__(self, matrix): self.matrix = matrix self.n = len(matrix) def __getitem__(self, index): index -= 1 return self.matrix[int(index%self.n)][int(index/self.n)] = [[1,5,9,13], [2,6,10,14], [3,7,11,15], [4,8,12,16]] mtx = matrix(a) prin

vsts - TFS File Changed Notifications in future branches -

we've got tfs email alerts set when files changed. in future, many of these files have "copies" via branching. other manually creating additional alerts each time branch created, can offer strategies scenario? or strategies make sure we're covered in case branch created , forget create these alerts. thanks help! there no out of box feature this, can submit feature request on vsts user voice . however, if name of files unique,you can create email alert "file name = filename.extension" , "folder path contains xxx". track change file in specified folders/branches.

ruby on rails - hostname "project-name.appspot.com.storage.googleapis.com" does not match the server certificate (OpenSSL::SSL::SSLError) - using fog and carriewave -

i'm trying implement image upload google cloud storage rails 4.2 app using carrierwave gem. whenever go upload image error hostname "project-name.appspot.com.storage.googleapis.com" not match server certificate (openssl::ssl::sslerror) . i cant see need here. carrierwave.rb file carrierwave.configure |config| config.fog_credentials = { provider: 'google', google_storage_access_key_id: 'key', google_storage_secret_access_key: 'secret key' } config.fog_directory = 'project-name.appspot.com' end uploaders/check_item_value_image_uploader.rb class checkitemvalueimageuploader < carrierwave::uploader::base # include rmagick or minimagick support: # include carrierwave::rmagick # include carrierwave::minimagick # choose kind of storage use uploader: #storage :file storage :fog # override directory uploaded files stored. # sensible default uploaders meant mounted: d

keyboard shortcuts - Any alternative for Winkey on Windows 7 64 bit? -

i'd setup quick keys on windows box open things sublime or chrome file explorer rooted @ common directory etc. on xp used use winkey, copernic discontinued support. (for unfamiliar winkey: it's simple utility maps ms windows key + other keys commands, example, shift+winkey+t might point textpad exe , open that, etc). anyone know of alternative.... or how write similar using c# or something? (also, i've heard of launchy, etc , i'm not fan -- i'm looking quick key-chord run command or .bat or whatever.) winhotkey identical in every way works on newer os's

android - how to access api with api_key Using Retrofit -

i new on android.can 1 tell me how add header api_key using retrofit.i not able understand how can this. i find code net.where have put code in android folder structure.i confused this.where have add api_key. // define interceptor, add authentication headers interceptor interceptor = new interceptor() { @override public okhttp3.response intercept(chain chain) throws ioexception { request newrequest = chain.request().newbuilder().addheader("user-agent", "retrofit-sample-app").build(); return chain.proceed(newrequest); } }; // add interceptor okhttpclient okhttpclient.builder builder = new okhttpclient.builder(); builder.interceptors().add(interceptor); okhttpclient client = builder.build(); // set custom client when building adapter retrofit retrofit = new retrofit.builder() .baseurl("https://api.github.com") .addconverterfactory(gsonconverterfactory.create()) .client(client) .build(); you can store api_key in string

ios - Cannot add JSON response to realm -

i'm trying add post response realm thrown error: cannot convert value of type 'string' expected argument type 'object' this code: alamofire.request(.post, data.loginendpoint, parameters: parameters) .responseobject { (response: response<particulars, nserror>) in print(response.request) print(response.response) print(response.result) if let result = response.result.value { do{ print(realm.configuration.defaultconfiguration.fileurl) let realm = try realm() realm.add(result.name, update: true) } catch let err nserror { print("error realm: " + err.localizeddescription) } } else { print("json data nil. 123") } } update i getting error fa

android - How to set scale to object image in unity 3D by Code? -

i'm new unity 3d developer create button c# code , set image button image show small. how resize scale image ? if image component, use assign new vector3 image.recttransform.localscale . suggest use vector3 instead of vector2 can use 1 z value. code below scale x , y 4 leave z 1. public image myimage; void start() { myimage.recttransform.localscale = new vector3(4, 4, 1); } for texture2d use method below. public texture2d myimage; void start() { myimage.resize(4, 4); myimage.apply(); } for sprite public sprite myimage; void start() { myimage.texture.resize(4,4); myimage.texture.apply(); } for spriterenderer public spriterenderer myimage; void start() { myimage.transform.localscale = new vector3(4, 4, 1); } for gui.button float x = 300; float y = 300; float width = 150; float height = 150; void ongui() { if (gui.button(new rect(x, y,width, height), new guicontent(icon))) { } //scale width width = 4

python - Sorting FreqDist in NLTK with get vs get() -

i playing around nltk , module freqdist import nltk nltk.corpus import gutenberg print(gutenberg.fileids()) nltk import freqdist fd = freqdist() word in gutenberg.words('austen-persuasion.txt'): fd[word] += 1 newfd = sorted(fd, key=fd.get, reverse=true)[:10] so playing around nltk , have question regarding sort portion. when run code sorts freqdist object. when run get() instead of encounter error traceback (most recent call last): file "c:\python34\nlp\nlp.py", line 21, in <module> newfd = sorted(fd, key=fd.get(), reverse=true)[:10] typeerror: expected @ least 1 arguments, got 0 why right , get() wrong. under impression get() should correct, guess not. essentially, freqdist object in nltk sub-class of native python's collections.counter , let's see how counter works: a counter dictionary stores elements in list key , counts of elements values: >>> collections import counter >>> counter(['a',

html - center my footer divs -

Image
hello need centering footer divs (.footer-top). need 'cottons story , contact' sit in middle time , not on left. .footer-container { padding-top: 35px; position: relative; z-index: 1; line-height: 24px; } .footer-container .footer-top h3.module-title{ text-transform: uppercase; font-size: 20px; font-weight: 500; margin: 0; padding: 15px 0 40px; letter-spacing: 1px; font-family: 'bell gothic blk'; } .footer-container .footer-top h3.module-title:before{ content: ""; height: 1px; width: 60px; background: #464646; position: absolute; top: 45px; } .footer-container .footer-top h3.module-title ul li a{ line-height:1px; } .footer-container .images{ text-align: center; } .footer-container .icon{ margin: 45px 0 25px; text-align: center; } .footer-container ul.content{ margin-bottom: 0; } .footer-container div.content{ max-width: 750px; font-size: 1.0

loopbackjs - NaN userId while setting userContext loopback -

i have model userb2b extended user . have enabled authorization using server.authenabled in boot script requests pass through auth middleware. problem: whenever have non-numeric username in userb2b model, nan userid accesstoken.findforrequest in loopback/common/model/access-token.js . here models. accesstoken { "name": "accesstoken", "base": "accesstoken", "idinjection": false, "options": { "validateupsert": true }, "mysql": { "table": "accesstoken" }, "properties": { "ttl": { "type": "number", "required": false, "length": null, "precision": 10, "scale": 0, "mysql": { "columnname": "ttl", "datatype": "int", "datalength": null, "datapr

ios - An error About Kiwi unit test -

i learning unit test.i going use kiwi framework.i wrote simple test code using kiwi blow: #import <kiwi/kiwi.h> spec_begin(simplestringspec) describe(@"simplestring", ^{ context(@"when assigned 'hello world'", ^{ nsstring *greeting = @"hello world"; it(@"should exist", ^{ [[greeting shouldnot] benil]; }); it(@"should equal 'hello world'", ^{ [[greeting should] equal:@"hello world"]; }); }); }); spec_end when testing code, project crash error blow: 12:26:50.842 xctest_demo[8053:93923] _xct_testbundlereadywithprotocolversion:minimumversion: reply received 12:26:50.852 xctest_demo[8053:93923] _ide_startexecutingtestplanwithprotocolversion:16 2016-05-25 12:26:50.856 xctest_demo[8053:93891] *** terminating app due uncaught exception 'nsinvalidargumentexception', reason: '+[nsinvocation _invocationwithmethod

machine learning - Confusion between Binary_crossentropy and Categorical_crossentropy -

i doing binary class classification using deep neural network. whenever using binary_crossentropy model not giving accuracy (it closer random prediction). if use categorical crossentropy making size of output layer 2, getting accuracy in 1 epoch close 0.90. can please explain happening here? i have problem while trying use binary_crossentropy softmax activation in output layer. far know, softmax give probability of each class, if output layer has 2 nodes, p(x1) , p(x2) , x1 + x2 = x . therefore, if have 1 output node, equals 1.0 (100%), that's why have close random prediction (honestly, close category distribution in evaluation set). try changing activation method sigmoid or relu .

.net - Memory increases with each request due to AutoMapper.Map in c# component -

Image
we using automapper 4.2.1.0 in our dot net application. having lots of classes neeed map. performance problem have got solution creator itself. due initial loading time & memory decreases. https://stackoverflow.com/a/37398552/6343798 but still facing incresed memory issue after each request. our concern suppose @ start component size 70 mb after each request size increses 1 mb, lot of request creates lot of memory use. we call mapper.map each request may taking memory. dump file memory usages shows. we did lot of work on memory 5.0, have tried 5.0 beta?

What does "$-" mean in bash or zsh? -

this question has answer here: how can ask bash current options? 1 answer today found variable '$-' random string, don't know stands for. ➜ ~ echo $- 569jnrtxzghikms and can't change value: ➜ ~ -='sss' zsh: command not found: -=sss ➜ ~ and, in docker was: ➜ ~ docker run --rm -ti ubuntu root@7084255fd54e:/# echo $- himbh or: ➜ ~ docker run --rm -ti alpine ash / # echo $- smi does it's value related system? $- current options set shell. from the bash reference manual : using ‘+’ rather ‘-’ causes these options turned off. options can used upon invocation of shell. current set of options may found in $-. the remaining n arguments positional parameters , assigned, in order, $1, $2, … $n. special parameter # set n. the return status 0 unless invalid option supplied.

Is it possible to pause and resume rake tasks in rails -

is there option pause , resume rake tasks in rails . i've 1 rake task run every night times needs paused , run one. how can achieve this? thanking advance. you can run rake task through cron, recommend use whenever gem that, in rake task can put check match case condition , if satisfy run different rake task saying, check mean put conditional block(if) checks if time condition saying fulfills, fire rake task there , return. you can share code , exact scenario, more clear way.

javascript - Displaying result of AJAX request -

i have looked far , wide how below, have come short, , struggling find resource explains ajax , how works. i have sent through ajax request php file below code, , using network tab in mozillas developer console , see response code (which echo'd out info inside html elements) although can see response, don't know how display it, using below code (which i've compiled after looking through numerous similar questions on stack overflow). please have , see why not displaying? <div id='picoutput'></div> <script> $.ajax({ url: 'resources/listposts.php', type: 'post', datatype: \"json\", data: { uname: $('$uname').val(), }, success:function(data) { if(data) { // $('#picoutput').html(data).value; } else { // } } } }); </script> the response is <div

.net - How To Use C# Linq Predicate with custom Extension Method -

i'm trying write c# extension method, should take predicate , return iqueryable can reuse complicated where predicate here i'm looking at public static ienumerable<t> addcomplexwhere<t>(this ienumerable<t> query, dbcontext context, func<t, string> permissionkeycolumn) { return query.where(pp => context.permissions .where(p => /*permissionkeycolumn in permissions table p.permissionkey ??????*/) .where(p => true/* complicated where*/).any()); } usage context.orders.addcomplexwhere(context,o=>o.permissionkey).tolist().. this way can keep reusing to achieve need use expression<func<t, bool>> here example: public static ienumerable<t> addcomplexwhere<t>(this ienumerable<t> query, dbcontext context, expression<func<t, bool>> expression) { return query.where(expression).any()); } after modification code should work:

java - which exception to throw when user tries to add to a full container -

i trying write fixed sized queue generic type elements.the user can call constructor, providing size , internal array created size.(see below) class fixedsizeq<e>{ private e[] q; private int n; public fixedsizeq(int max) { super(); q = (e[]) new object[max]; n = 0; } .. } i thought of defining isempty() , isfull() methods , insert() method above.if client tries add element full array,i want throw exception.going through javadocs,i thought illegalstateexception correct exception throw. public boolean isfull(){ return n == q.length; } public void insert(item item){ if(isfull()){ throw new illegalstateexception("queue full"); } ... } i want know if understanding correct..someone suggested illegalargumentexception more appropriate.can advise? i think should make insert method return boolean, , return true if object inserted , false if queue full. adding objects full queue not seem e

javascript - Dollar Sign is not declared -

this question has answer here: why “$ undefined” after using jquery plugin? 4 answers https://studio.code.org/projects/applab/sl7lkbrbxvqbhrgbf54wrq/ my project generating random sentences. how make here, program picks random sentence index, , displays on screen? please help. it says '$ not declared'. eddie my coding picture. all need include jquery in html file so: <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script

iot - Pango-1.40.1: Error while compiling on Wind River Linux -

i trying install gtk-2+xx on wind river linux. have installed below dependencies in term install gtk. glib-2.48.1 atk-2.20.0 cairo-1.14.6 have put related *.pc pkg_config_path. trying install pango-1.40.1 1 of dependency gtk. ./configure pango done successfully. please see result below. checking harfbuzz... yes // found harfbuzz checking fontconfig... yes // found fontconfig checking fcweightfromopentype... no checking freetype... yes // found freetype checking xft... no checking coretext availability... no checking cairo... yes* checking cairo font backends used... freetype checking glib... yes checking libthai... no checking gobject-introspection... no checking flockfile... yes checking strtok_r... yes configuration: backends: cairo freetype // configured cairo's font backend of type freetype but "make" giving error. below snippet of error received. same error repeated in different lines of source code of frimini.c file. fribidi.c:73:24: error

java - Stop background music for cocos2d Android -

to stop background music after pressing "playgame" button in cocos2d-android, have given soundengine.sharedengine().playsound(context, r.raw.rock, true); since not find code stop background music, have given pause method, once resume game again music starts, need abort music after splashscreen itself, have search not find cocos2d-android game engine, please me. on press of play button use below line : soundengine.sharedengine().pausesound();

browser - IE8 and previous Internet Explorer versions -

i've been learning code while now, , keep coming across notes @ bottom of tutorial , manual pages saying "this isn't covered/won't work in previous versions of internet explorer." i've started wonder, matter? don't want sound open-ended or off-topic , what-not, i'm wondering if more .5% of population uses old versions of ie8. furthermore, i'm building financial website users potentially enter in financial information in dangerous manners. if person isn't internet-savvy enough have @ least updated internet explorer, think not target audience. so, not off-topic or open ended, , stay relevant, asking: is notable (more .5%) amount of internet-using population using older versions of ie? is notable amount of internet-using population using ie? is there reason user have not updated internet browser (i.e. public libraries not update in places because take time update every computer)? is notable (more .5%) amount of internet-using

javascript - Using Cordova-sqlite-storage plugin -

i using cordova-sqlite plugin in order select , insert data database embedded in android device. in case create database native code , trying read data javascript source. but, think javascript not reading same location android do. this js file : var db = window.sqliteplugin.opendatabase({name: 'db',iosdatabaselocation: 'library'}); var session = this._sessioninfoservice.getsessioninfo(); db.transaction(function (tx) { var firstname = session.firstname; var lastname = session.lastname; var userid = session.id; tx.executesql("create table if not exists user (user_id integer, firstname varchar, lastname varchar)"); tx.executesql('select * user', [], function (tx, results) { var len = results.rows.length, i; console.log(len); (i = 0; < len; i++){ var id =results.rows.item(i).user_id; console.log(

asp.net mvc - How to validate Date in ClientSide using FluentValidation? -

question the below code working fine server side , not client side. why ? when submit form, control goes beavaliddate function check date valid or not. there way validate date without going server using fluent validation ? scripts <script src="jquery-1.7.1.min.js" type="text/javascript"></script> <script src="jquery.validate.js" type="text/javascript"></script> <script src="jquery.validate.unobtrusive.js" type="text/javascript"></script> model public class personvalidator : abstractvalidator<person> { public personvalidator() { rulefor(x => x.fromdate) .notempty() .withmessage("date required!") .must(beavaliddate) .withmessage("invalid date"); } private bool beavaliddate(string value) { datetime date; return datetime.tryparse(value, out date); } }

css - Can I have a SVG Pattern with background color? -

i have svg polygons , polygons use pattern fill. want background color pattern. pattern on background color. var pattern = me.canvas.append('defs') .append('pattern') .attr('id', 'diagonalhatch') .attr('patternunits', 'userspaceonuse') .attr('width', 4) .attr('height', 4) .append('path') .attr('d', 'm-1,1 l2,-2 m0,4 l4,-4 m3,5 l2,-2') .attr('stroke', '#010101') .attr('stroke-width', 1) .attr("opacity",0.5); var polyobj = polygonlayer.append("polygon") .attr('stroke','black') .attr('stroke-width','2') .style('fill','url(#diagonalhatch)'); i have fiddle . want color behind pattern. please help. as had mentioned in comment, 1 way add 4x4 rect inside pattern (before path ) , give rect required fill. <script src="

regex - find the mobile number and print using regular expression using php -

<div> <span onclick="find('test','call now!');phone.open('ayyappa','970-363-9869',32659874,0)" > call now! </span> <span onclick="find('test','call now!');phone.open('ayyappa','949-858-3181',38596380,0)" > call now! </span> </div> expected out put : 949-858-3181 , 38596380 for specific use, regex (\d{3}-\d{3}-\d{4})\',(\d{8}) preg_match('/(\d{3}-\d{3}-\d{4})\',(\d{8})/', $input_html, $matches); $n1 = $matches[1]; $n2 = $matches[2]; n1 have phone number , n2 second number.

sql server 2008 - Why tablle variable stored procedure taking more time to execute than temp tables stored procedure -

in 1 sp1 used 7 @table variables , in sp2 used 7 #temp tables. both sps using same tables. sp1 taking more time execute compare sp2. can 1 give clear explanation. table variable designed hold small amount of data (statistics not applied on them) temp table can hold bigger , faster (but not suitable very large dataset, uses io operations on disk) if using these paging, use fetch next rows method or group (generate row number) filtering row number

asp.net mvc - Unit testing sessions is still returning null after Mocking -

i trying write unit test test controller makes use of session. understand concept httpcontext generated request browser , since calling controller action form unit test, current context null. i tried solve issue based on first part of article http://www.dontpaniclabs.com/blog/post/2011/03/22/testing-session-in-mvc-in-four-lines-of-code/ still isn't working me. see code below. [testfixturesetup] public void configure_automapper() { _product = new productviewmodel() { id = guid.newguid(), category = guid.parse("72e42a11-dfa4-4ab9-a735-5cd5c18396d4"), brand = guid.parse("96e68b67-60fb-4531-898e-815433b44d89"), description = "from test", costprice = parse("17.00"), saleprice = parse("25.00"), quantity = 7, businessid = guid.parse("bdf9fb7f-db40-4365-9872-aecd616ed415") }; var con

Batch file to copy newest excel file in new folder -

i want copy newest excel spreadsheet (.xlsm) new folder. problem original data dump folder thousands of excel , word documents big navigate. i found link " how write windows batch script copy newest file directory? " not address component of copying excel files @ all. can fill gap showing way ahead? thanks help! newlearner

android - The number of method references in a .dex file exceed 64K -

currently working on android application after including play services , firebase library in project i'm getting error , unable run code :app:prepackagemarkerfordebug :app:transformclasseswithdexfordebug run dex in process, gradle daemon needs larger heap. has approximately 910 mb. faster builds, increase maximum heap size gradle daemon more 2048 mb. set org.gradle.jvmargs=-xmx2048m in project gradle.properties. more information see https://docs.gradle.org/current/userguide/build_environment.html error:the number of method references in .dex file cannot exceed 64k. learn how resolve issue @ https://developer.android.com/tools/building/multidex.html :app:transformclasseswithdexfordebug failed error:execution failed task ':app:transformclasseswithdexfordebug'. com.android.build.api.transform.transformexception: com.android.ide.common.process.processexception: java.util.concurrent.executionexception: com.android.ide.common.process.processexcept

java - Not able to get the SONAR dashboard -

Image
i configuring sonar java project. followed below steps. downloaded sonarqube 5.5 version , started using startsonar.bat added maven configuration(plugin , profiles). right click on project , run maven build sonar:sonar goal. i seeing build successful, on dashboard, not seeing anything. shows project name. , when click on project, showing following page. i not able see sonar dashboard. sonar uses standard database after installation. have tell first db should use. defined in config files: %sonarinstallation%\conf\sonar.properties this file explains behavior of using standard db until user changes it.

sql server - SQL analytical function to DAX -

Image
although might sound want add window function powerpivot table, i'm not... want exclude records based on windowing function. i have such query similar (sql server): select line_number, suite_name, group_name, revision, status ( select line_number, suite_name, group_name, revision, status, row_number() on (partition line_number, suite_name, group_name order revision desc) r tablea ) t t.r = 1 this query returns highest revision's row per line_number , suite_name , , group_name . i want same, dax in excel power pivot. the result count of line numbers, selected (slicers) suite , group. the goal select rows tabular data model, , then, using similar functionality, filter records , keep latest revision per applied slicers. i tried far: calculate , filter , topn , rankx , generate . none of them helped me dynamically "exclude" rows calculati

dynamic alias in sql server -

i want query field different alias in stored procedure select count(empcode) countemp+@para result shoud be countemp1 45 countemp2 54 countemp1 76 query loop in c# code: select count(empcode) = @something countemp+@para approach without dynamic sql: --i create temp table demonstration declare @some_table table ( int, empcode int ) insert @some_table (something, empcode) values (1, 10),(1, 22),(1, 12),(2, 12),(2, 30),(3, 65),(3, 15),(3, 11),(3, 5) --declare parameter want search declare @param int = 1 --query --in cte select need based on parameter ;with cte ( select 'countemp'+cast(@param nvarchar(10)) something, cast(count(empcode) nvarchar(10)) empcodecount, row_number() on (order ) rn @some_table = @param group ) --and here comes union select result ( select something,rn cte union select empcodecount ,rn cte ) t order rn, desc output: result ------------------ countemp1 3 (2 ro

C++ use function argument type for template argument deduction -

template<typename t> void f(void (*func)(const t&)) { (*func)(t()); } void func(const int& i) { std::cout << << std::endl; } int main() { f(&func); } here template argument t (= int) of f automatically deducted based on first argument of function func . can extended work general functors (lambda functions or other function objects.) possibly second function, i.e. like template<typename t, typename function> void f(function func); template<typename function> void call_f(function func) { using arg_type = first_argument_type_t<function>; // ??? f<arg_type, function>(func); } the fall func in f should able inlined compiler, std::function cannot used. i use function traits code this (gpl-3 licensed) that: template <typename f> using first_argument_type_t = typename sharemind::functiontraits<f>::template argument<0u>::type; but there's boost function_traits

jquery - Why does $(document).height() return too high number? -

i alerting document height: alert($(document).height()); the result 3307px while full web page has 1800px. from other answers here on so, learned needed check doctype did , looks this: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> any idea why can document height show higher number expected? there no hidden elements in page, or that. edit: reason showing high number @ time of me retrieving document height, menu, containing elements increased overall height. try : alert($(window).height()); if want , browser window height;

javascript - Angularjs - More than 10 digit regex validation -

how accept more 10 digit regex using ng-pattern in angularjs? example 1 12. /^(1[0-2]|[1-9])$/ you might not need ^ , $ in ng-pattern

java - One or more required project facets are missing from the project -

i've imported java-project eclipse , error " one or more required project facets missing project myproject " without further details. project's facet switched on " java ". thats description "problems view": description=one or more required project facets missing project myproject. resource=myproject path= location=unknown type=project facet missing marker how discover facet missing? how eclipse detect such problems? can related else facet? f.e. compilance level or else? ps i've cleaned project several times. thanks in advance you need add @ least spring facet , possibly others depending on features you're using. the eclipse page describes how this.