Posts

Showing posts from July, 2013

nim - Converting a seq[char] to string -

i'm in situation have seq[char] , so: import sequtils var s: seq[char] = toseq("abc".items) what's best way convert s string (i.e. "abc" )? stringifying $ seems give "@[a, b, c]" , not want. the efficient way write procedure of own. import sequtils var s = toseq("abc".items) proc tostring(str: seq[char]): string = result = newstringofcap(len(str)) ch in str: add(result, ch) echo tostring(s)

Jmeter Recording Controller is not working when use for url localhost -

Image
i new jmeter. used recording controller record script .when record url www.google.com recording when record url localhost/test/users/login not getting record.i using xampp apache local server @ port 80,443 i did setting in browser i have refer link https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.pdf remove firefox configuration in no proxy for: localhost, 127.0.0.1 and ensure start recorder

javascript - angular.js @local scope property coming as undefined if we initialized as null -

i have made custom angular directive <location zipcode="35423" cityname="" statecode=""></location> and take scope: { zipcode: "@", cityname: "@", statecode: "@" }, in contoller of directive : controller: function ($scope, $filter) { $scope.zipcode = "35423" // here values $scope.cityname = undefined // ?? why? $scope.statecode= undefined // ?? why? } i want $scope.cityname = "" in reality using mvc application zipcode="@zipcode" cityname="@city" statecode="@statecode" and might possible city null you can set value of scope properties "" if they're undefined so: $scope.cityname = $scope.cityname || ""; . i don't understand why though, since "" , undefined both evaluate false.

c# - Generating a table from another table - MVC5 -

i'm new mvc5 , .net. using asp application user , have additional table patient: [databasegenerated(databasegeneratedoption.identity)] public guid patientid { get; set; } [foreignkey("user")] [display(name = "user id")] public string userid { get; set; } public virtual applicationuser user { get; set; } my accountcontroller is: [httppost] [allowanonymous] [validateantiforgerytoken] public async task<actionresult> register(registerviewmodel model) { if (modelstate.isvalid) { var user = new applicationuser { username = model.email, email = model.email, title = model.title, firstname = model.firstname, lastname = model.lastname, dob = model.dob, gender = model.gender, contactnumber = model.contactnumber, address1 = model.address1,

css - unable to make html table column fixed size (not auto expand according to Data) -

Image
i have above data table . problem when data coming backend expand , make table awkard. i want wrap whole data in particular fixed column size. colmn should not expanded. html code like: <table width="100%" border="0" cellpadding="0" cellspacing="0" id="datatable" class="pretty searchtabel"> <thead> <tr class="ac-trhd serchtr"> <!-- colmn(subject) want restrict expand --> <th class="padng10">subject</th> <!-- other clumn headers --> </th> </thead> <tr> <td class="padng10"><s:property value="subject" /></td> <!-- other td --> </tr> </table> plz help. in advance to have fixed column widths, use table-layout: fixed; in css.

javascript - Sharing scope variables between two dynamically instantiated directives -

plunkr: http://plnkr.co/edit/9lcybn1468miu5mcgpqr?p=preview i can add form variable inside passed in options parameter, i'd bind other inside options parameter. i have panel directive create panel. part of options of panel, can specify directive panel should dynamically invoke: (function (ng, app) { "use strict"; app.directive( "panel", function ($compile) { return { scope: { options: '=', }, link: function(scope, element, attrs) { el = angular.element('<' + scope.options.directive + ' options=\'' + json.stringify(scope.options.directiveoptions) + '\' ' + additionaloptionsstring + '></>'); element.find(".panel-body").append(el); $compile(el)(scope); }, template

android - Image View surround with Text -

Image
how make thing , image view surround text mean , image appear inside text you can try textviewoverflowing

sprite kit - How to make a node visible before any user interaction -

i took , modified piece of code allows me shoot bullets in every direction. works perfectly. generating random bullet in moment when player touch ended. have 6 different bullets , purposes of game need player see them before tap screen. tried initialize bullet in global function , pass didmovetoview. it's not working, bullet generating once , stays @ place. code initializing bullet: class gamescene: skscene, skphysicscontactdelegate { var gameover = false let cannon = skspritenode(imagenamed: "cannon") let bulletincannon = skspritenode() var endofscreenright = cgfloat() var endofscreenleft = cgfloat() let bmrarray = ["blbl", "magbl", "rbl"] let cgyarray = ["cbl", "gbl", "ybl"] let yrmarray = ["ybl", "rbl", "magbl"] let bulletarray = ["rbullet","magbullet", "blbullet", "cbullet", "gbullet", "ybullet"] over

Translating concepts from SQL Server to DB2 -

i'm hoping catch eye of experience in both sql server , db2. thought i'd ask see if comment on these top of head. following list of features sql server, i'd db2 well. configuration option " optimize ad hoc workloads ", saves first-time query plans stubs, avoid memory pressure heavy-duty one-time queries (especially helpful extreme number of parameterized queries). - if - equivalent db2? on similar note, equivalents sql server configuration options auto create statistics , auto update statistics , auto update statistics async . fundamental creating , maintaining proper statistics without causing overhead during business hours? indexes . mssql standard index maintenance reorganize when fragmentation between 5 - 35%, rebuild (technically identical drop & recreate) when on 35%. importantly, mssql supports online index rebuilds keeps associated data accessible read / write operations. similar db2? statistics . in sql server standard statistics update pr

javascript - Element not visible error -

this question has answer here: element not visible error (not able click element) 1 answer i trying click on upload file link on page upload link said not visible. i've tried hovering on link , code below. has been fixed me before i'm confused on how go getting link clicked. i've tried: var ec = protractor.expectedconditions; var uploadlink = element(by.model('roomplanctrl.mm2010file')); browser.wait(ec.elementtobeclickable(uploadlink), 10000); uploadlink.click(); the html: <span class="dg-link ng-untouched ng-valid ng-dirty ng-valid-parse" ngf-select="" ng-model="roomplanctrl.mm2010file" accept=".mms" ng-hide="roomplanctrl.hideimportlinks">upload meetingmatrix 2010 file</span> if element not visible, can try scrolling element , click on it. if

html - Why is the dropdown menu displaying without hovering over the main menu itself? -

for site http://www.baptisteyoga.com/ if move cursor bit below main menu, dropdown menu displays. why? it's bit annoying/unnecessary. want submenu appear when hover on main nav menu itself. e.g. only hovering on "programs" shows dropdown menu programs. basically standard menu behaviour apply. anyone know? thanks. reason drop-down menu shows mouse not on menu because following css selector has opacity: 0; , on hover opacity: 1; , there no problem approach opacity doesn't hide element make transparent there not visible header .large-menu .has-dropdown .sub-menu { position: absolute; left: 50%; margin-left: -90px; top: 50px; height: 0; width: 180px; opacity: 0; <<<---here -webkit-transition: .3s; transition: .3s; background: rgba(255,255,255,.9); } header .large-menu .has-dropdown:hover .sub-menu { height: auto; opacity: 1; <<<---here -webkit-transition: .3s; transition: .3s

javascript - Upload image immediately on select -

here @ last question , no 1 can give me right solution. thank process upload image. now want upload image after selection input type file. how script. html: (here 888 dynamic id php) <form class="upload_reply" id="888'" method="post" enctype="multipart/form-data"> <label for="file">filename (max 200 kb) :</label> <input type="file" name="file" class="repfile" id="888" value="" /> </form> script: $(document).on('change','.repfile',function (){ previewpic(this); }); function previewpic(input) { if (input.files && input.files[0]) { var reader = new filereader(); reader.onload = function (e) { $("#preview_rep"+ input.id).attr('src', e.target.result); $("#output_rep"+ input.id).show(); var str = e.target.result; var id

ios ui automation - Why does running UIAutomation methods from KIF result in: "UIAutomation is not enabled on this device. UIAutomation must be enabled in Settings"? -

using: ios 8.4, xcode 6.4, kif 3.2.1 ( https://github.com/kif-framework/kif ) i encounter following problem on real device: while running kif test case, calling method, "deactivateappforduration" results in following output seen in xcode console: " uiautomation not enabled on device. uiautomation must enabled in settings. " on simulator, app indeed go background duration specified in parameter of method call. i can confirm setting in device settings, "developer > uiautomation" toggled on. the build compiling , running debug build , signed developer provisioning profile (not distribution profile). all possible compile configurations in scheme set debug (profile example) i can record , playback ui interactions in instruments developer tool (confirms app built right , phone settings correct) specific code: [tester deactivateappforduration:5]; what missing? this known issue uiautomation on device, see here .

windows - I am trying to make .jks file process automatic -

i have written script make .jks file automatic. having trouble how answer prompts in cmd. script: keytool -genkey -keyalg rsa -alias selfsigned -keystore c:\keystore5.jks -storepass password -validity 360 -keysize 2048 - ahad paracha / - company / - ny / - ny / - / - yes the prompts are: enter keystore password: re-enter new password: first , last name? [unknown]: - ahad paracha / - company / - ny / - ny / - / - yes name of organizational unit? [unknown]: name of organization? [unknown]: name of city or locality? [unknown]: name of state or province? [unknown]: two-letter country code unit? [unknown]: cn=ahad paracha, ou=, o=, l=, st=, c= correct? [no]: it wont answer other questions first one. writing cmd. powershell can pass strings interactive prompts: example: 'help', 'rescan' | diskpart in case, try: 'ahad paracha', 'company', 'ny', 'ny', 'us&

Check if directory have sub-directories PHP -

i trying file in directory. operation must fast.the inital directory can have childrens path/child/sub_child/sub_sub_child/afile . file can present before path child a file i not care file getting want fast way it. i stuck this $h = opendir($path); //open current directory while (false !== ($entry = readdir($h))) { if($entry != '.' && $entry != '..') { echo $entry; break; } }

Getting a 404 error when instantiating a core java class in a servlet -

i building web application in java , when trying instantiate core java class servlet class , use methods of class, getting 404 error. have been trying figure out reason long couldn't find any. code: servlet class: public class supportpage extends httpservlet { public void doget(httpservletrequest request, httpservletresponse response) throws ioexception, servletexception { printwriter out = response.getwriter(); // when remove part, app runs fine. jirarest jirarest = new jirarest(); string key = null; try { key = jirarest.createissue(12403, 10000, "test", "test"); } catch (jsonexception e) { e.printstacktrace(); } catch (urisyntaxexception e) { e.printstacktrace(); } catch (httpexception e) { e.printstacktrace(); } out.println("<html>"); out.println("ticket key: "+key +" created"); out.println("</html>"); return; }} ja

Postgresql streaming replication forward writes -

i've managed set streaming replication postgresql (9.3 if maters). however, applications access secondary server (of course) unable make insert statements. is there way have secondary server forward writes primary? there no built-in support @ time (9.5 or older, @ least) transparently redirecting sessions read-replica writeable master. nor aware of attempting develop such support. it's more complicated might expect redirection of write changes master read-replicas in way preserves acid transaction semantics (proper isolation, locking, etc) properly, apps don't have "know" , take special care. the pgpool-ii project has (limited) support doing via proxy layer, , best bet @ point. aware there significant limitations , potential transaction consistency violations created proxy-based read/write split. there couple of multi-master solutions, really shouldn't go there unless know need it. i'm active developer on one of them i'm aware of

html - CSS background-position top right corner -

Image
i want background image on button appear @ top right corner. i used background-position: bottom top 100px move image top, have been unsuccessful moving image right. is there similar background-position: bottom top 100px, right 900px might produce desired results? #addnewmeetingbutton { position: absolute; top: 0; text-align: center; background-image: url(images/add_icon_48x48.png); background-position: bottom top 100px, right 800px; background-repeat: no-repeat; height: 190px; width: 915px; background-color: transparent; outline: none; border: none; z-index: 2; } something this background-image: url(http://i.stack.imgur.com/cw9ak.png); background-repeat: no-repeat; background-size: 48px 48px; background-position: right 10px top 10px; jsfiddle demo mdn reference background-position:<position> where: <position> 1 4 values representing 2d position regarding edges of element's box. rela

c# - automapper optimization mapping (model to view model -> get latest version) -

i trying optimize part of code: mapper.createmap<document, documentviewmodel>() .formember(g => g.id, map => map.mapfrom(d => d.documentversion.where(v => v.version == d.documentversion.select(s => s.version).max()).orderbydescending(s => s.subversion).first().id)) .formember(g => g.idrootdocument, map => map.mapfrom(d => d.id)) .formember(g => g.certyficatetype, map => map.mapfrom(d => d.documentversion.where(v => v.version == d.documentversion.select(s => s.version).max()).orderbydescending(s => s.subversion).first().certyficatetype)) i'm using automapper, , i'm trying optimize part of code in part i'm trying mapping object document documentviewmodel, in complex model, source data latest document version: d => d.documentversion.where(v => v.version == d.documentversion.select(s => s.version).max()).orderbydescending(s => s.subversion).first().myproportyx could offer exa

vb.net - Handling TreeView MouseMove event in separate thread -

{vb.net} trying handle mousemove event of treeview element in separate thread, don't know how , searching net did not lot. private sub tv_serverlist_mousemove(sender object, e mouseeventargs) handles tv_serverlist.mousemove try selnode = directcast(tv_serverlist.getnodeat(tv_serverlist.pointtoclient(cursor.position)), treenode) dim screenheight integer = screen.primaryscreen.bounds.height - 220 if not oldnode.name = selnode.name frm.startposition = formstartposition.manual dim cursor_x = system.windows.forms.cursor.position.x - 800 dim cursor_y = system.windows.forms.cursor.position.y - 10 if cursor_y > screenheight cursor_y = screenheight end if frm.location = new point(cursor_x, cursor_y) try frm.change() catch ex exception end try frm.show() oldnode = selnode elsei

ubuntu - Execution of bash script differs when runned from Matlab and Terminal -

i have bash script , want execute matlab 2014b in ubuntu 14.04. when launch terminal (that start os) ok. try launch matlab this !./script.sh it executes cannot open image files have loaded. more if launch terminal window matlab !./gnome-terminal and use launch script got same 'file not found' problem. text files accessed no problem. path images global. load images opencv library used. guess reason opencv works different matlab, don't know do. i spend lot of time figure out problem, still cannot resolve it. appreciate advise or help. ld_library_path of matlab shell differs 1 of teminal shell. following command in matlab: setenv('ld_library_path', <content of ld_library_path terminal>) solves problem. content of ld_library_path terminal printed echo $ld_library_path

octave - suppressing printing every assignment -

i have written simple script in octave. when run command line, octave prints line every time variable gets assigned new value. how suppress that? mwe: function result = stuff() result = 0 i=0:10, j += end end when run it: octave:17> stuff() result = 0 result = 0 result = 1 result = 3 result = 6 result = 10 result = 15 result = 21 result = 28 result = 36 result = 45 result = 55 ans = 55 octave:18> i want rid of result = ... lines. new octave, please forgive me asking such basic question. by adding semicolon @ end of statement suppress intermediate result. in case: function result = stuff() result = 0; i=0:10, j += i; end end will trick.

automated tests - Espresso in Android - how to insert the text into more text inputs? -

i'm trying set text text inputs on same activity (one one). problem on first input text filled correctly on second input exception message. android.support.test.espresso.performexception: error performing 'single click' on view 'with id: com.example.xxx.test:id/txtfield2'. here test method: @test public void buttonshouldupdatetext(){ this.clickonactionbarmenuicon(); this.clickonactionbarmenuitem(10); this.clickonbutton(); this.checktextonactivity("hello world!"); this.inserttextintoinput(r.id.txtfieldone, "hello world!"); // works fine this.inserttextintoinput(r.id.txtfieldtwo, "hello world2"); // throws exception } and method following: public void inserttextintoinput(integer inputid, string text) { onview(withid(inputid)).perform(typetext(text)); } layout following: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android"

java - how to fix error on -

i have sql request delete bc_udv3_roles permission_id = 'x' or 0 < (select * bc_udv3_roles "substr"(permission_id, 0, 1)='d') or '1'='1' when execute error please help, how can fix it? delete bc_udv3_roles permission_id = 'x' or 0 < (select count(*) bc_udv3_roles substring(permission_id, 1, 1)='d') or '1'='1' condition evaluates true. not needed. also if using mysql function should substring instead of substr . there should no quotes around function name. can't compare 0 columns in table. use count(*) instead. alternately can try delete bc_udv3_roles permission_id = 'x' or substring(permission_id, 1, 1)='d'

replace part of a string in java -

i'm trying write function takes in string such string code = "<div> style="width: 3%" </div>" i replace 3% number (can more 2 digits) 400% etc. i'm getting charat(21) index of 3, if had 20% in place code not work. is there way replace place % stored. (also doing not knowing number current % is) you can using regular expression, example: string code = "<div> style=\"width: 3%\" </div>" string replaced = code.replacefirst("width: \\d+", "width: 400") to extract value in existing string: pattern pattern = pattern.compile("width: (\\d+?)%"); matcher matcher = pattern.matcher(code); matcher.find() matcher.group(1)//gives 3

javascript - How to set Google maps infoWindow on default without pressing it -

http://stages.a-wan.com/hybridmotors/ hi guys. can have @ website right @ bottom of map. when click in red marker display infowindow, want stay there default without pressing it. code should add? can please guide me along code add in i'm abit noob here. thank you var map; map = new gmaps({ el: '#gmap2', lat: 1.289701, lng: 103.812879, scrollwheel: false, zoom: 18, zoomcontrol: true, pancontrol: true, streetviewcontrol: true, maptypecontrol: true, overviewmapcontrol: true, clickable: true }); var image = ''; map.addmarker({ lat: 1.289701, lng: 103.812879, icon: image, animation: google.maps.animation.drop, verticalalign: 'bottom', horizontalalign: 'center', backgroundcolor: '#d3cfcf', title: 'lima', infowindow: {content: '<p>address: no. 2 kung chong road singapore 159140</p>' } }); i edited answer several times : t

javascript - Creating Express param middleware that updates the request object -

im trying update req.conversation before handled function called read. know middleware being called before read when log req.conversation object in read doesnt reflect updates made in middleware. /** * conversation middleware */ exports.conversationbyid = function(req, res, next, id) { if (!mongoose.types.objectid.isvalid(id)) { return res.status(400).send({ message: 'conversation invalid' }); } conversation.findbyid(id).populate('user', 'displayname').populate('readers', 'displayname').exec(function(err, conversation) { if (err) return next(err); if (!conversation) { return res.status(404).send({ message: 'conversation not available' }); } req.conversation = conversation; next(); }); }; where id parameter in middleware callback coming from? if it's url param (e.g. /conversations/:id ) should

version control - Clean git deployment workflow -

we trying implement automated workflow deployment based on git. currently, have 3 environments: development/staging/production. idea mark environments branches of same name (except production=master), have developed small cli takes commands this: cli deploy -e production -t patch this runs bunch of internal tasks and, final step, merges local branch correct environment branch (in case master), bumps version in package.json according semver specification (in case, patch level version increment major.minor. patch part) , tags commit appropriately. this works well: know deployed in environment, can rollback , have taken steps out of individual developers mistakes. however, results in less pretty git log. first off, branch master comprised of merge commits ( merge branch 'hotfix' , merge branch release-2.0.0 , etc.), since decided keep branch history intact. way supposed in git flow model? also, bump version after merge, master branch looks like: merge branch '

xaml - align a button to the right in a listItem wpf -

i trying create listview item delete button on far right side of box. button right of text, prefer "stuck" right side of control. have tried following: dockpanel : dockpanel.dock="right" horizontalalignment="right" horizontalcontentalignment="right" horizontalconteltalignment="stretch" (not last 2 @ same time) and adding area dock panel without specifying dock it grid : <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="*"/> </grid.columndefinitions> and <grid.columndefinitions> <columndefinition width="*"/> <columndefinition width="*"/> </grid.columndefinitions> and <grid.columndefinitions> <columndefinition width="auto"/> <columndefinition width="*"/> <columndefinition width="*"/> </grid.columndefinitio

Ruby On Rails server initiation errors -

i have been following tutorial on how learn ruby on rails basics. have installed latest 2.2.3 version , ran "gem install rails". have created new project, have got error when tried run server "rails server" command. received these errors: c:\users\kothas\desktop\rubyonrails\myproject>rails server c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.r:6:in `require': cannot load such file -- sqlite3/sqlite3_native (loaderror) c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/ib/sqlite3.rb:6:in `rescue in <top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/sqlite3-1.3.10-x64-mingw32/lib/sqlite3.rb:2:in `<top (required)>' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/ untime.rb:76:in `require' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/ untime.rb:76:in `block (2 levels) in require' c:/ruby22-x64/lib/ruby/gems/2.2.0/gems/bun

angularjs - angular ui router - open modal dialog -

i using angular ui router open modal ui dialog. following scripts , css importing <title>pipeline tracker | home</title> <link rel="stylesheet" type="text/css" href="<c:url value="/views/js/bootstrap/css/bootstrap.min.css"/>"> <link rel="stylesheet" type="text/css" href="<c:url value="/views/css/bootstrap-additions/dist/bootstrap-additions.css"/>"> <link rel="stylesheet" type="text/css" href="<c:url value="/views/js/angularjs-toaster/toaster.min.css"/> "> <link rel="stylesheet" type="text/css" href="<c:url value="/views/js/ladda/dist/ladda-themeless.min.css"/>"> <link rel="stylesheet" type="text/css" href="<c:url value="/views/css/font-awesome/css/font-awesome.css"/>"> <link rel="

android - how to add volley image request in an arraylist? -

i have below code 2 things , volley request set image , , array list adapter show static images. i need add volley request in array list , want volley images shown in arraylist how can me please? (note have phpscript send me in json path url of images) the code :main_activity protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); requestqueue mrequestqueue; final string image_url = "http://developer.android.com/images/training/system-ui.png"; mnetworkimageview = (networkimageview) findviewbyid(r.id.networkimageview); //instantiate cache cache cache = new diskbasedcache(getcachedir(), 1024 * 1024); // 1mb cap //set network use httpurlconnection http client. network network = new basicnetwork(new hurlstack()); //instantiate requestqueue cache , network. mrequestqueue = new requestqueue(cache, network); //start queue mrequestqueue.start(); imageloader mimagel

android - Accessing to the release artifact on TeamCity -

a couple days ago finished tc setup , started work on projects building setup. now succed in automated debug building develop branch, aim rc builds master or release brunch. to visible debug builds use "artifact paths: /build/outputs/apk/ .apk => ." for rc tried value " / .apk => .", because androidstudio place signed build directly module folder. in case can't see artifacts after successful building. does gets rc builds means on tc?

php - GMail Username and Password not accepted error when sending email with SwiftMailer -

i following error when trying use gmail account send email php application swiftmailer. 535-5.7.8 username , password not accepted this swiftmailer code: $transporter = swift_smtptransport::newinstance('smtp.gmail.com', 465, 'ssl') ->setusername('ayrshireminiscontact@gmail.com') ->setpassword('~password-in-here~'); $mailer = swift_mailer::newinstance($transporter); $message = swift_message::newinstance('portfolio enquiry') ->setfrom(array('ayrshireminiscontact@gmail.com' => 'crmpicco portfolio enquiry')) ->setto(array('picco@crmpicco.co.uk' => 'a name')) ->setbody($email_body); $result = $mailer->send($message); this entry in apache error log , stack trace. [wed aug 18 22:06:10.284728 2015] [:error] [pid 9298] [client 10.0.0.1:64806] php fatal error: uncaught exception 'swift_transportexception' message 'expected response code 250 got

android - Grab last line of 'cat' output without head, tail, sed or awk -

i have directory of files on (older) android device , want cat file comes last in file listing when call ls . on linux computer i'd have no problem that, do ls | tail -n 1 but on phone, neither tail , nor head , sed , or awk available. should do? try: for in *; :; done; echo "$a"

node.js - npm creates huge number of files, what am I doing wrong? -

the way read this section of phpstorm manual , add development tool can this: if tool documentation or test framework, of no need going re-use application, helpful have excluded download future. done marking tool development dependency, means adding tool in devdependencies section of package.json file. with phpstorm, can have tool marked development dependency right during installation. 1 of following: switch project root folder , type following command @ command line prompt: npm install --dev <tool name> [...] it seems not correct or understood wrong, because when ran npm install --dev del to tool can delete files clear cache during development, npm created nested folder structure several gigabytes in size millions of files. killed , spent half hour moving deeper folders further in tree paths short enough windows delete them. what did wrong? by way, adding package.json -> devdependencies , running npm install works fine. n

c# - When can IEnumerable not be converted to IList? -

i found code in project i'm working on: ienumerable<int> foo = ienumerableintvariable ilist<int> ?? ienumerableintvariable.tolist(); i know as returns null if can't convert , , tolist() kick in finish job, situations in happen? among others, consider simple case: public ienumerable<int> getlistofnumbers() { (int = 0; < 100; i++) yield return i; } this returns true ienumerable wouldn't implement ilist ( msdn ). clearly, adding/removing "collection" doesn't make sense, nor elements accessible via index.

javascript - why jquery id selector not support special character -

when using special character find element below $("#search@") exception occur. how resolve it? i've tried using special character it's working * character $("#search*") without error, others #$%^&() throw error.so why accepts * character why other character doesn't. if have special character id s, should escape them using \\ (two backslashes) when access them. far know allowed html5 . as stated in jquery selector documentation to use of meta-characters ( such !"#$%&'()*+,./:;<=>?@[]^`{|}~ ) literal part of name, must escaped with 2 backslashes: \. example, element id="foo.bar", can use selector $("#foo\.bar"). alert($("#search\\$").html()); <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <div id="search$">heh</div>

Delete/Drop similar tables in SQL Server -

i have database in sql server there many similar tables such dbo.dos_150602_xyz . tried delete tables 1506 in them typing: drop table dbo.dos_1506*; but didn't work. how else can perform this? thanks. just make things bit easier op. sample table creation script: create table table_pattern_name_1 ( s1 varchar(20), n1 int ); create table table_pattern_name_2 ( s1 varchar(20), n1 int ); create table table_pattern_name_3 ( s1 varchar(20), n1 int ); create table table_pattern_name_4 ( s1 varchar(20), n1 int ); table drop script: declare @cmd varchar(4000) declare cmds cursor select 'drop table [' + table_name + ']' information_schema.tables table_name 'table_pattern_name_%' open cmds while 1=1 begin fetch cmds @cmd if @@fetch_status != 0 break print @cmd exec(@cmd) end close cmds; deallocate cmds ssms output: drop table [table_

How to resolve/finalize an Ivy file (descriptor) without downloading any artifacts? -

using ivy, i'd run resolve task finalize ivy file dependency versions, not download artifacts. i see there type attribute on resolve task lets filter artifacts of type: resolve task the ivy resolve task not finalize ivy descriptor file. the ivy deliver task finalizes ivy descriptor file. running resolve task blank string type atttribute resolves prevents downloading artifact dependencies: <ivy:resolve type=""/> for deliver correctly finalize ivy descriptor file, must call resolve task dependency of deliver task (using ant): <target name="deliver" depends="resolve"> <ivy:deliver/> </target> <target name="resolve"> <ivy:resolve/> </target> calling resolve , deliver tasks separate executions of ant won't work.

polymer - Template repeat inside template repeat - get all item names -

i'm trying realise website using polymer 1.0. have custom element my-greeting template repeats inside. what do, , don't find how this, string called target looks : /constantpath/folder1/aaa.jpg /constantpath/folder1/bbb.jpg /constantpath/folder2/aaa.jpg /constantpath/folder2/bbb.jpg so general string : /constantpath/{{repeat1.id}}/{{repeat2.id}}.jpg how can ?? here code : <dom-module id="my-greeting"> <template> <template is="dom-repeat" items="{{repeat1}}"> <template is="dom-repeat" items="{{repeat2}}"> target : <iron-image src="target"></iron-image> </template> </template> </template> <script> polymer({ is: 'my-greeting', ready: function() { this.repeat1 = [ {id: 'folder1'}, {id: 'folder2'} ]; this.repeat2 = [

Create a button in CSS -

Image
i use these picture corner button. buttons name test background "#f1f2f2" how should create using css? please remember css code need adapt older web browser. thanks! why not use css? border radius half size of parent element , supported ie 9 , above. <span>hello</span> span { display: inline-block; background: grey; border-radius: 15px; height: 30px; line-height: 30px; padding: 0 30px; } http://jsfiddle.net/dbwl117m/ otherwise code below , apply appropriate css styles. <span> <span class="left-image">image here</span> <span>text</span> <span class="right-image>image here</span> </span>

pulling information from specific fields in Rails 4 Form -

i creating blog post versioning system. (i tried paper_trail , draftsman , don't have need). when user edits "live" page, instead of changing live version, app makes postversion table entry new information , calls "pending". however, if user edits "draft" page, no "pending" postversion created, edits page directly. i can't seem form params pass form postversion.create! method. submits nil values when i'm trying pull form values. posts_controller.rb def update @post = post.find(params[:id]) if @post.status == 'draft' #this not important end if @post.status == 'live' @pending_post = postversion.create!(title: params[:title], status: 'pending', body: params[:body], post_id: @post.id ) end end _form.html.slim = simple_form_for [:admin, @post ], multipart: true |f| = f.error_notification = f.input :title, label: 'title', required: true, focus: true #rest of form

java - BungeeCord not reachable after enabling ServerSocket -

i'm working on web based api bungeecord server after opening serversocket on port 8082 bungeecord on port 25565 isn't available furthermore. this class opening serversocket: package de.pardrox.bungeeapi; import java.io.bufferedreader; import java.io.inputstreamreader; import java.io.printwriter; import java.net.inetaddress; import java.net.serversocket; import java.net.socket; public class http { static router router = new router(); public static void main(int args) { try { int port = args; @suppresswarnings("resource") serversocket apiweb = new serversocket(port); (;;) { socket client = apiweb.accept(); bufferedreader in = new bufferedreader(new inputstreamreader(client.getinputstream())); printwriter out = new printwriter(client.getoutputstream()); out.print("http/1.1 200 \r\n"); out.print("content-type: text/plain\r\n"); out.print("connection: c

ruby on rails - Denying user permission that haven't completed the checkout process with stripe subscription -

so, followed tutorial on youtube on how set stripe subscription. have keys inserted correctly , sign form etc. set up. problem noticed if user doesn't pay , goes home page, they'll able see everything. what's best way deny access until have completed payment? currently subscriber controller class subscriberscontroller < applicationcontroller before_filter :authenticate_user! def new end def update token = params[:stripetoken] customer = stripe::customer.create( card: token, plan: 1020, email: current_user.email ) @user = user.find(current_user.id) @user.subscribed = true @user.stripeid = customer.id @user.save redirect_to people_path, notice: "welcome" end end registration controller: class registrationscontroller < devise::registrationscontroller protected def after_sign_up_path_for(resource) '/subscribers/new' end end you need create additional before_filter method if don't want non-paying customers able

python eval in "library" file -

if i've got file, we'll call him test1.py contains: code=''' class something(object): def __init__(self): print "blah blah blah, horrible idea" def run(): print "don't preach @ me pretentious fool" ''' eval(compile(code, '<string>', 'exec')) then below eval statement, in same test1.py file can of course stuff like: x = something() run() but... if i've got file called test2.py , want able run run() or instantiate something there after firing import test1 ? i'm assuming there manipulation of locals() or globals() necessary googles failing me here. no, not think need kind of locals() or globals() manipulation, can - import test1 , , instantiate something object - import test1 x = test1.something() test1.run() example/demo - my a.py has same code pasted test1.py , , can - >>> import >>> x = a.something() blah blah blah, horrible idea

sql server - SQL Table Valued Parameter - Default Value -

i'm passing table valued parameter stored procedure use in clause, want check whether parameter has been passed-in or not first. best way check parameter of type? example, want select along lines of: select * tablename @tvp null or recordid in (select * @tvp) if parameter of table valued type not passed, empty table. can use: select * tablename not exists(select * @tvp) or recordid in (select * @tvp)

ios - swift convert Range<Int> to [Int] -

how convert range array i tried: let min = 50 let max = 100 let intarray:[int] = (min...max) get error range<int> not convertible [int] i tried: let intarray:[int] = [min...max] and let intarray:[int] = (min...max) [int] they don't work either. you need create array<int> using range<int> rather cast it. let intarray: [int] = array(min...max)