Posts

Showing posts from May, 2011

sublimetext2 - Sublime Text: How to jump to file from Find Results using keyboard? -

if file > find in files... ⇧ + ⌘ + f you're brought find results , listing files , highlighted matches. can double-click either filename/path or matched line open file @ right line. i wonder if there way double-click via keyboard? with sublimes great file switching capabilities, thought there must way keep hands on keyboard when doing find in files... . it appears plugin has been created this. took quick look, there additional features in plugin. while original answer below work, easier install existing plugin. https://sublime.wbond.net/packages/betterfindbuffer doable plugin. import sublime import sublime_plugin import re import os class findinfilesgotocommand(sublime_plugin.textcommand): def run(self, edit): view = self.view if view.name() == "find results": line_no = self.get_line_no() file_name = self.get_file() if line_no not none , file_name not none: file_loc = ...

java - Looking for method to remove spaces on sides, change all letters to small with first letter as capital letter -

i have been trying while make method takes user input , changes potential spaces infront , after text should removed. tried .trim() doesnt seem work on input strings 2 words. didnt manage make both first , second word have first letter capital. if user inputs following string want separate words have small letters except first in word. e.g: long jump if user inputs: "long jump" or " long jump " change to "long jump" private string normalisera(string s) { return s.trim().substring(0,1).touppercase() + s.substring(1).tolowercase(); } i tried method above didnt work 2 words, if input one. should work both to remove spaces spaces can this string = string.trim().replaceall(" +", " "); the above code call trim rid of spaces @ start , end, use regex replace has 2 or more spaces single space. to capitalize first word, if you're using apache's commons-lang , can use wordutils.capitalizefully . ...

How to add ip address of machine to field in logstash? -

logstash returns hostname of machine in field "host". our servers have same host name, difficult differentiate data servers. not possible change host name of server because use amazon ame servers. possible add ip fields in logstash? i used ansible push configs, , have write ip address config each server. both logstash-forwarder , logstash can add static fields on input.

scala - Case object enumerations, order and implicits -

for pedagogical purposes have implemented enumeration using both enumeration , case objects. i'm comfortable enumeration version, although cannot warn of missing cases in match statement. i have tried write equivalent using case objects finding that, although compiles, doesn't run. in particular, seems go infinite loop @ run time (i haven't been able confirm in debugger, however). here's code i'm trying run: sealed abstract class suit extends ordered[suit] { val name: string val priority: int override def tostring = name def compare(that: suit) = priority-that.priority } case object spades extends suit { val name = "spades"; val priority = 0 } case object hearts extends suit { val name = "hearts"; val priority = 1 } case object diamonds extends suit { val name = "diamonds"; val priority = 2 } case object clubs extends suit { val name = "clubs"; val priority = 3 } object suit { implicit def ordering[a <: s...

java - JUnit Plug-in Tests Ignoring Target Platform -

i've used archetype tycho-eclipse-plugin-archetype create simple eclipse plug-in working integration test project. except... doesn't. when start test "junit plug-in test" following exception: !entry org.eclipse.osgi 2 0 2016-01-07 14:43:35.734 !message 1 or more bundles not resolved because following root constraints not resolved: !subentry 1 org.eclipse.osgi 2 0 2016-01-07 14:43:35.734 !message bundle initial@reference:file:../../../../../../../users/myname/.eclipse/org.eclipse.platform_4.5.1_2043537226_win32_win32_x86_64/plugins/org.eclipse.pde.junit.runtime_3.4.500.v20150423-1241.jar/ not resolved. !subentry 2 org.eclipse.pde.junit.runtime 2 0 2016-01-07 14:43:35.734 !message missing required bundle org.eclipse.core.runtime_[3.11.0,4.0.0). (and similar messages other plug-ins.) which weird, because target platform contains org.eclipse.pde.junit.runtime 3.4.300, not 3.4.500, requires org.eclipse.core.runtime version [3.3.0,4.0.0). run configuration te...

android - InAppBrowser not closing? -

i'm using inappbrowser plugin (v1.1.1) cordova oauth login process. unfortunately, inappbrowser doesn't appear closing browser. "closebrowser" function instead continually triggers interval, , browser remains on-screen on android (i have not tried other devices @ time.) is there way forcibly close inappbrowser other .close() , or hide it? or maybe there's flaw in code somewhere locking browser. loginpage.prototype.handleexternallogin = function (externallogin) { var _this = this; var ref = window.open(environment_1.settings.baseurl + externallogin.route.url, "_blank", "location=no"); ref.addeventlistener('loadstart', function (event) { if (_.startswith(event.url, environment_1.settings.baseurl + "/api/account/account/externallogincallback")) { // want load different url give mobile access token console.log('get external-mobile-token'); _this.closebrowser(...

Iterating through Python dictionary very slow -

i'm trying compute distance between pairs of users based on values of items assigned them. distance calculation should null when 2 users not have intersecting items. i'm calculating lower half of distance matrix (eg. usera-userb equivalent userb-usera calculate one). so have following python script works, starts chugging when feed more few hundred users. sample script below shows input structure, i'm trying thousands, not 4 have shown here. the line s = {k:v k,v in data.items() if k in (user1,user2)} seems add overhead import math decimal import * def has_matching_product(data,user1,user2): c1=set(data[user1].keys()) c2=[k k in data[user2].keys()] return any([x in c1 x in c2]) def get_euclidean_dist(data,user1,user2): #tried subsetting run quicker? s = {k:v k,v in data.items() if k in (user1,user2)} #ignore users no overlapping items if has_matching_product(s,user1,user2): items=set() k,v in s.items(): ki...

MySQL select post and comment count relative to comment count -

i'm trying select posts comment count select id,title ,(select count(*) ci_comments (post_id = p.id)) comment_count ci_posts p type='post' , active=1 order comment_count desc , date_modified desc limit 6 this works but need filter comment_count > 10 : select id,title ,(select count(*) ci_comments (post_id = p.id)) comment_count ci_posts p type='post' , active=1 , comment_count > 10 order comment_count desc , date_modified desc limit 6 result : unknown column 'comment_count' in 'where clause' so solution ? try having .. having evaul result of query select id,title ,(select count(*) ci_comments (post_id = p.id)) comment_count ci_posts p type='post' , active=1 having comment_count >10 order comment_count desc , date_modified desc limit 6

java - Runtime.exec().waitFor() doesn't wait until process is done -

i have code: file file = new file(path + "\\runfromcode.bat"); file.createnewfile(); printwriter writer = new printwriter(file, "utf-8"); (int = 0; <= max; i++) { writer.println("@cd " + i); writer.println(native system commands); // more things } writer.close(); process p = runtime.getruntime().exec("cmd /c start " + path + "\\runfromcode.bat"); p.waitfor(); file.delete(); what happens file deleted before executed. is because .bat file contains native system call? how can make deletion after execution of .bat file? (i don't know output of .bat file be, since dynamically changes). by using start , asking cmd.exe start batch file in background: process p = runtime.getruntime().exec("cmd /c start " + path + "\\runfromcode.bat"); so, process launch java ( cmd.exe ) returns before background process finished. remove start command run batch file in foreground - then, w...

sql - What is wrong with the syntax on this case statement? -

i trying insert values temp table via cursor , if have period on end, remove period. here code having syntax issues with. while @@fetch_status = 0 begin case select charindex('.',reverse(@category)) when 1 insert #category values (substring(@category,1,len(@category)-1))) end; what doing incorrectly here? i'm open more efficient answers know how solve way. case yields expression, not statement. looking if statement . as better way this: scrap cursor , use insert ... select ... charindex('.', reverse(category)) = 1 statement.

java - How to ask user to unlock device on clicking notification action in android? -

      i displaying notification application , notification has action in it, when user clicks on action, corresponding action class called intent set. now, want perform particular action before user needs unlock screen if pin/pattern protected. not able ask user unlock device, i.e open unlock keypad/pattern on lock screen. below code have, //handleaction java class extends intentservice intent intent = new intent(context, handleaction.class); intent.putextra(key, "my_value"); //used send information action class pendingintent pi = pendingintent.getservice(context, 0, intent, pendingintent.flag_update_current); notificationcompat.builder notification = new notificationcompat.builder(mcontext); //set title, icon etc builder , add action below notification.addaction(icon, "my_label", pi); when user clicks on notification action, control onhandleintent in myaction.java in here, want reques...

rust - Problems with lifetimes when one instance of a struct needs a reference to another -

i'm trying write simple game sfml , rust, borrow-checker proving greatest enemy on journey. there bunch of cases sfml needs reference object. in code below, need reference font or else text doesn't show user. problem is, i've tried bunch of things , reference never lives long enough. works if create text object on draw method, avoid creating things inside main loop of application. is case should take onto unsafe operations? there combination of rc, refcell, box, etc. meets needs? please try explain me should doing , wrong in current mindset, if possible. extern crate sfml; use sfml::system::{ clock, vector2f }; use sfml::graphics::{ color, font, rendertarget, renderwindow, text, transformable }; pub struct fpsmeter<'a> { position: vector2f, clock: clock, value: f32, text: text<'a> } impl<'a> fpsmeter<'a> { pub fn new() -> self { let font = match font::new_from_file("asset...

c++ - Determine if a dll is being called by multiple threads from an application - Use ThreadId? -

i have created static dll file used application. wanted know if exported methods of dll being called separate threads of application or single thread. thinking if output threadid of thread calls method in dll might me figure out if function being called single thread or multiple threads. ? how threadid of thread calling dll ? use getcurrentthreadid function. std::vector<dword> ids; __declspec(dllexport) int __stdcall somefunction() { dword id = getcurrentthreadid(); if (std::find(ids.begin(), ids.end(), id) != ids.end()) { // new thread uses function ids.push_back(id); } }

c# - Replacing the character between angle brackets -

story: have list box shows methods of current application. need colorize method parameters' data type blue. solution: first, extract content between parenthesis. second, want split them comma problem: if arguments entail idictionary<string, string> occurs multiple times, above solution faces problem!! thus, decided first grab content between angle brackets , replace comma "#comma#" , after performing task using above solution replace "#comma#" ",". but, based on solution found here , not possible set value match.value . here code: if (methodargumenttype.contains("<") && methodargumenttype.contains(">")) { var regex = new regex("(?<=<).*?(?=>)"); foreach (match match in regex.matches(methodargumenttype)) { match.value = match.value.replace(",", "#comma#"); } } any suggestion highly...

Printf & Scanf in assembly languange x86 using notepad++ and ollydebugger -

can explain me how scanf , printf works in assembly? enter 1 number , when try print number again random character. here's code: .data msg1 db "n=",0 msg2 db "n is:",0 n dd 0 formatd db "%d",0 .code start: push offset msg1 ; put msg1 on stack call printf ; print msg1 add esp,8 ; clear stack push offset n ; put n on stack push offset formatd ; put n format on stack call scanf ; write n value add esp,12 ; clear stack mov ebx,n ; copy n in ebx push offset msg2 ; put msg2 on stack call printf ; print msg2 push ebx ; put n on stack push offset formatd ; put n format on stack call printf ; print n value add esp,20 ; clear stack push 0 call exit end start

android - Which handler class to import? for webview twice backpress exit app -

i want go on app on 1 time press.. , if key presesd twice, want app exit. got following code on internet , stackoverflow. @override public void onbackpressed() { if (doublebacktoexitpressedonce) { super.onbackpressed(); return; } this.doublebacktoexitpressedonce = true; toast.maketext(this, "please click again exit", toast.length_short).show(); new handler().postdelayed(new runnable() { @override public void run() { doublebacktoexitpressedonce=false; } }, 2000); } now don't know handler class should imported here? either `java.util.loggin.handler or `android.os.handler the second 1 (android.os.handler). can't explain more. 1 handler @ operating system level, , other used logging purposes (it's on package names, though)

list - Running through appended data frame to locate where the first positive number is in python -

i have appended series using pandas. call s. each s[i], i, has 50 data points. call these j. i want go through each i, , instance j=1, find first positive s[i][1] occurs , record number is. output looking hence 2 dataframe [i,1] records j's each , [i,2] records positive number was. preferably, vectorized version instance sapply/apply in r. i hope description made sense.. hope there out there me this! the following example i=4 , j=6. s[0]: 2013-01-02_59 -0.004739 2013-01-02_61 +0.002435 2013-01-02_74 -0.004772 2013-01-02_75 -0.004772 2013-01-02_77 -0.002452 2013-01-02_78 -0.009423 s[1]: 2013-01-02_60 -0.007048 2013-01-02_62 -0.002435 2013-01-02_75 +0.004772 2013-01-02_76 -0.002446 2013-01-02_78 +0.007114 2013-01-02_79 -0.004772 s[2]: 2013-01-02_61 -0.004739 2013-01-02_63 +0.002435 2013-01-02_76 -0.002446 2013-01-02_77 -0.004772 2013-01-02_79 -0.002452 2013-01-02_80 +0.002446 s[3]: 2013-01-02_62 -0.004739 2013-01-02_64 +0.002...

Backup Exchange Mailboxes in powershell -

is there way without receiving error of non mailbox accounts well... i finding in order backup mailboxes of disabled user account in ad need following: $baseou = "ou=companies,dc=triangle,dc=com" $mydisabledusers = search-adaccount -searchbase $baseou -accountdisabled | select name $mylistofdisabledusersthathavemailboxes = foreach ($mbx in $mydisabledusers) {get-mailbox $mbx.name -erroraction silentlycontinue} foreach ($allmailboxes in $mylistofdisabledusersthathavemailboxes) { new-mailboxexportrequest -mailbox $allmailboxes -filepath "\\it-fs02\pst$\$($allmailboxes.database)-$($allmailboxes.displayname)-$($allmailboxes.alias).pst" } however, though works receiving bunch of errors each disabled user account not have mailbox. warning: cmdlet extension agent index 0 has thrown exception in oncomplete(). exception is: system.invalidoperationexception: operation not valid due current sta te of object. @ microsoft.exchange.data.storage.exchangepr...

c# - Trying to work out these interfaces -

i'm trying create interfaces. ireportsection object have 1 string , collection of items, different depending on we're working with. need make generic? the ireport have 1 string , collection of ireportsection . here's how i'm trying define now. public interface ireport { string reportname { get; set; } icollection<ireportsection> reportsections { get; } } public interface ireportsection { string reportsectionname { get; set; } icollection reportitems { get; } } public abstract class reportsectionbase : ireportsection { public string reportsectionname { get; set; } public icollection reportitems { get; set; } } and models: pulic class projectsubmissionviewmodel { public int projectsubmissionid { get; set; } public string submissiontitle { get; set; } } pulic class affiliateviewmodel { public int affiliateid { get; set; } public string affiliatename { get; set; } } this how i'm trying use in code: ...

sql - MySQL: Return all rows with same ID but filter by a different field -

in application, have table identifies resources (i.e. pictures) id. said resources have been "tagged" (field1). i.e. picture 3 in table below tagged both 'a' , 'b'. whereas picture 1 tagged 'a' , picture 2 tagged 'b'. here "tagging" table: +--------------+ | id | field1 | +--------------+ | 1 | | | 2 | b | | 3 | | | 3 | b | +--------------+ note: id's neither unique nor auto-incrementing. problem: want return pictures tagged 'b', not want return tagged 'a'. select id pictures field1 = 'b'; returns: +-----+ | id | +-----+ | 2 | | 3 | +-----+ this not want want, because includes picture 3 tagged 'a' (in row preceding [3, b] in original table) i want: +-----+ | id | +-----+ | 2 | +-----+ here 2 methods: exists subclause: select id pictures pictures1 field1 = 'b' , not exists ( select * pictures picutures2 ...

javascript - ng-bind-html blank the page when binding data change -

i trying achieve quora's read on feature when expanded more content displayed. i using ng-bind-html binding html page p element. <p ng-show="viewmodel.level==0" ng-bind-html="viewmodel.content0 | sanitize"> <p ng-show="viewmodel.level==1" ng-bind-html="viewmodel.content1 | sanitize"> the expanding works fine, when collapse level 1 0 (more content less), html page went blank stuck there until click or drag page. how avoid ? i answer accident. what need notification list size has changed: $scope.$broadcast('scroll.resize');

c# - Edit and search item in listview -

is there control jquery datatable in wpf searching item listview or how can implement efficient search in listvew. secondly, have image , title in listview control. how can add "edit functionality" change image title. don't have clue because i'm new in wpf. how can perform task. example or useful code helpfull me. <listview name="lvdatabinding"> <listview.view> <gridview > <gridviewcolumn > <gridviewcolumn.celltemplate> <datatemplate > <stackpanel margin="20,5,0,0" orientation="horizontal" horizontalalignment="center"> <image margin="15,5,0,0" style="{staticresource popupimagestyle}" horizontalalignment="center" width="60" tooltip="{binding name}" height="60" source=...

symfony - Two foreign keys to the same same table in Symfony2 -

if have 2 foreign keys, how create querybuilder sql: select * mappaths m join unitids n on (m.ref_unitids2 = n.id or m.ref_unitids1 = n.id) m.id = 2 for design querybuilder not think correct: $query = $qb->select('m') ->from('apimapbundle:mappaths','m') ->innerjoin('m.refunitids1','u') ->innerjoin('m.refunitids2','v') ->where('m.id=:test') ->setparameter('test',1) ->getquery() ->getresult() ; $users = $reposity->getresult(); return $users; $dql = $qb->getdql(); echo $dql; $result = $query->getresult(); echo $result; any idea how can solve above query using querybuilder? your example not work both innerjoins have realised return row. something may work (i have not tested this): $query = $qb->select('m') ->from('apimapbundle:mappaths','m') ->join('yourbundle:yourotherentity', ...

perl - DBD::Mock specify output values for stored procedure -

i'm trying use dbd::mock test code uses database. far, normal sql queries work fine, i'm @ loss how can test code calls stored procedures. using bound_params key dbd::mock::session->new constructor, can specify input parameters, can't seem find way of setting mock results of parameters bound using dbi::statementhandle::bind_param_inout() . to provide example code going tested, have @ following: use dbi; $dbh = dbi->connect('dbi:mock', '', '', { raiseerror => 1, printerror => 1 }); $sth = $dbh->prepare(q{ begin some_stored_proc(i_arg1 => :arg1, o_arg2 => :arg2); end; }); ($arg1, $arg2) = ('foo', 'bar'); $sth->bind_param(':arg1', $arg1); $sth->bind_param_inout(':arg2', \$arg2, 200); $sth->execute(); print stderr "output value of arg2 = $arg2\n"; now, want seed db 'frobnication' arg2 parameter, such when above code executed, $arg2 variable contains string ,...

php - how to pass hidden id using json in jquery ui autocomplete? -

perhaps duplicate,but can't found solution posted question.i use jquery ui auto complete search box. works fine problem want search using id.example:when user type paris,i try send city_id in mysql search. problem how pass hidden id json? here code: <input type="text" name="grno" id="grno" class="input" title="<?php echo $lng['vldgrno'];?> jquery code: <script> $(function() { function split( val ) { return val.split( /,\s*/ ); } function extractlast( term ) { return split( term ).pop(); } $( "#grno" ) // don't navigate away field on tab when selecting item .bind( "keydown", function( event ) { if ( event.keycode === $.ui.keycode.tab && $( ).data( "ui-autocomplete" ).menu.active ) { event.preventdefault(); } }) .autocomplete({ source: function( request, response ) { $.getjson( "pages/search.php", { ...

sql server - Convert excel csv to plain text csv -

i have on 2 hundred individual files need load sql server database, , unfortunately coming way excel csv files. excel csv files formatted corectly, use utf-8 or utf-16 character format (i forget which), trips sql server when try , bulk insert them. have fiddled around different arguments bulk insert run other problems. simplest solution has been use clipboard copy them file, because clip board copies plain text. what use command line tool convert files plain text ascii character format in 1 pass. using windows 7 operating system. thank you.

vb.net - WPF/VB ComboBox SelectionChanged Fires Twice -

i new wpf. project working on has requirements use vb language , flat files data (i can not change requirements). found (2) books on wpf vb compared dozens in c , web searches scarce. hoping out there has insight on issue vb experience. this cascading event on page. load combobox called unit. when selection made in unit, makes facility combobox available , loads data based on unit value selected. if unit changes again, clears facility box , reload based on new unit value. my code below. confuses me results of load of facility combobox. loaded if reading of flat file looped twice. @ top of function code clear list before loading combobox. so, if if function called twice, code should technically clear list, load, clear list again , load. put in series of popups confirm selectionchange called twice , therefor load facility called twice. i looked @ sender , e arguments , same in both calls not sure how trap , stop second call or triggering it. oh, strange thing happened p...

sql - Why I cannot compare date using ">" in MySQL? -

i using mysql filter date according creationdate . if did without comparing creationdate , return results. use todo; select * todoitem todolistid = 1 , completed = 1 , priority>=2; the result however, when add comparison date, there no result. use todo; select * todoitem todolistid = 1 , completed = 1 , priority>=2 , creationdate > ´2004-11-18 15:26:58´; no return it says there "sql syntax error near '15:26:58' " , "query interrupted". i not why not work because saw examples on stackoverflow using ">" , "<" compare 2 date directly. any appreciated. thank you. use single quotes ( ' ) instead of backticks (`), query should be: use todo; select * todoitem todolistid = 1 , completed = 1 , priority>=2 , creationdate > '2004-11-18 15:26:58';

linux - OpenOffice Macro to Access Contents of a Table -

i wrote macro, should take 2 dates (dd.mm.yyyy) string table in openoffice document (writer, not calc). these 2 dates should merged this: ddmmyyyy-ddmmyyyy. should used filename then. the table has 1 row , 6 columns, first date being in table2:d1:d1 , second 1 in table2:f1:f1. "translated" table2(1, 4) , table2(1, 6) this german site doing want do, spreadsheets in oocalc document , not oowriter. enough talk, here code: sub save odoc=thiscomponent sstartdate = odoc.table2(1, 4) senddate = odoc.table2(1, 6)) sfilename = sstartdate.string & senddate.string surl = converttourl("file:///home/cp/documents/" & sfilename & ".odt") msgbox surl ' odoc.storeasurl(surl, array()) end sub yes, run linux, path should correct. when try run script says: property or method not found table2 i of course tried google somehow not find solution. hint in right direction enough, guessed have write "more": sstartdate...

javascript - React-router need a way to detect route change -

i search way detect route change / leave. try exemple https://github.com/rackt/react-router/blob/master/docs/guides/advanced/confirmingnavigation.md can't make work in project. http://pastebin.com/txw71gmv i need next route too, route argument onleave doesn't provide anything. i know can detect url document.location in onleave function, want more consistant or built in. does can me this? thank you the route leave hook indeed called next location, when transition triggered react router. if you're leaving page outright, you're not going see this, because hitting "before unload" hook, router can't build next location, since it's not router managing.

Error when trying to get the URL of a page in a Google Apps Script -

i writing google apps script embedded google sites retrieve names , urls child pages of current page. when call geturl() function getting following error: 'typeerror: cannot find function geturl in object webpage.' my code follows: function doget() { var app = uiapp.createapplication(); var pages = sitesapp.getactivepage().getchildren(); (var = 0; < pages.length; i++) { logger.log(pages[i].geturl()); } return app; } i new google apps scripts struggling work out means. appreciated. use pages[i].geturl() you should use autocomplete feature in script editor avoid such typing errors (control space after dot : page[i]. here type ctrl space , you'll see possible methods...) note : general rule in javascript use called camelcase format : getrange , createlabel ... there few exceptions sethtml every rule must have exceptions doesn't ?

unit testing - How to "match" complex patterns like tables with Geb Page? -

suppose have complex construct repeating patterns long table data or nesting constructs. just small example: <div id="mycontroller1"> <div class="myfield1">some text11</div> <div class="myfield2">some text12</div> </div> <div id="mycontroller2"> <div class="myfield1">some text21</div> <div class="myfield2">some text22</div> </div> and suppose content of these divs can changed javascript , wish check it. write like: def 'whether page worked correctly'() { when: mypage ... then: assert mycontroller1.myfield1 == "some text11" assert mycontroller1.myfield2 == "some text12" assert mycontroller2.myfield1 == "some text21" assert mycontroller2.myfield2 == "some text22" } i.e. access fields via intermediate hierarchy member...

objective c - iOS: UIButton's title color when disabled -

i'm using mac os x el capitan 10.11.2, xcode 7.1.1 , ios 7 deployment target ios application @ hand. currently, want stylize uibutton, it's text , background (color/image) grayed out/has lowered alpha when disabled. started playing control in .xib editor , started changing text color, background color , button image. also, after each change of aforementioned parameters altering enabled state well. results surprising. if button's title color set default 1 - blue one, disabling button .xib editor in xcode results in grayed out button's title, great - no need manually stylize title in disabled state. awkward behavior takes place when button's title color set value differing default 1 (green let's say) - no grayscaling, lowering alpha component or other visual disabling effect applied. the result - 1 should manually apply visual disabling in case button's title color differs default one. bad partial behavior. no such thing observed when using uilabel. no...

node.js - NodeJS Mongoose Not Save Data -

my system create around 30 collection every hour. server thousands request 1 hour. have big data , multiple collections. , use mongodb-nodejs saving data. the modelcontrol function of paritemodel class @ paritemodel.js - as below codes - check if schema created before. , create schema or use created schema. first collections creating , saving data mongodb. when create collections it's not doing. example: eurjpy_20160107_ 16 collection created eurjpy_20160107_ 17 collection not create. have check mongoose.models @ modelparite.js eurjpy_20160107_17 created instance created eurjpy_20160107_17 schema not saved database. my server files this: app.js file bootstrap file: var http = require('http'), dispatcher = require('httpdispatcher'); require('./mongo.js'); function handlerequest(request, response){ try { dispatcher.dispatch(request, response); } catch(err) { console.log(err); } } var server = ...

javascript - How to test json formated actions in Rails 4 -

i'm trying test rails app actions return json formated data. example, inside userscontroller # post /users.json def create @user = user.new(user_params) respond_to |format| if @user.save format.json { render json: @user, status: :created } else format.json { render json: @user.errors, status: :unprocessable_entity } end end end i use action javascript ajax , works perfectly. try test action piece of code test "should create user" assert_difference('user.count') post "/users.json", user: { email: @user.email, name: @user.name } end end that throws 1) error: userscontrollertest#test_should_create_user: actioncontroller::urlgenerationerror: no route matches {:action=>"/users.json", :controller=>"users", :user=>{:email=>"mystring", :name=>"mystring"}} test/controllers/users_controller_test.rb:16:in ...

python - Matplotlib: Saved files in a loop aren't the same as in show() -

my program shows correct graph in plt.show() pop not in fig.savefig one. i'm quite new python apologies if simple. i'm using python 2.7.10, windows (10) . import numpy np import matplotlib.pyplot plt data = np.genfromtxt('strike_details.txt') #, skip_header= 0 header= 3 information=10000 width = 5 files = 16 types = 4 length = information + header frames = data[header:length,0] fig= plt.figure() plt.grid(true) in range(0,int(files)): density=data[(header+i*length):(length+i*length),4] plt.plot(frames,density, label=data[i*length+1][2]) j in range (0,files/types): if i==(types*(j+1)-1): plt.legend(loc='best') plt.xlabel('$frames$', fontsize=22) plt.ylabel('$density$', fontsize=22) fig.savefig(str(data[j*length+1][0])+'_'+str(data[j*length+1][1])+'_'+str(data[j*length+1][2])+'.png',format='png', dpi=fig.dpi) plt.sh...

ruby on rails - Getting error when pushing notification after deploy on linux -

i'm getting error when sending notification using rpush gem after deploying on linux server while notification data saved table. on local pushing notification rpush push command on linux command not found please me sort out problem. rpush not being found in path (an environment variable contains file paths executable files). can confirm which command. which rpush the fact returns nothing tells not in path. if in path return file path of executable file runs when enter command terminal. prior adding path, check installed. you can add path opening ~/.profile or ~/.bash_profile or ~/.bashrc (where squiggle ~ home directory) , entering: export path=$path:/path/to/rpush/executable then reload terminal or type source ~/.profile example. for documentation on paths there linux info site , , bash profiles can check out this page .

java - Implementation of a simple file transfer client server -

hi have following code client - server through thread, have errors, can't setup server on port number. can't setup server on port number. but why? class client: import java.io.*; import java.net.socket; // create class client public class client extends thread { socket socket = null; socket socket1 = null; // create send method public void sendfile() throws ioexception { string host = "127.0.0.1"; string host1 = "127.0.0.2"; socket = new socket(host, 4444); socket1 = new socket(host1, 444); file file = new file("/home/reza/desktop/link help"); file file1 = new file("/home/reza/desktop/hi"); long length = file.length(); long length1 = file1.length(); byte[] bytes = new byte[(int) length]; byte[] bytes1 = new byte[(int) length1]; fileinputstream fis = new fileinputstream(file); fileinputstream fis1 = new fileinputstream(file1); bufferedinputstream bis = new bufferedinputstream(fis); bufferedoutputstream out = new bu...

ruby on rails - include statement works in spec, not in rake task -

i have module stored in root/vendor/app_name/lib/qa.rb , rake task in root/vendor/app_name/lib/qa.rake this top of qa.rb module qa include module1, module2 ... end and top of rake task has require 'qa' module2 , module1 both stored in root/vendor/app_name/app/models/module_name when run test, stored in root/spec/app_name/unit/qa/qa_spec.rb , tests pass. when run rake task calls method in qa.rb, following error: nameerror: uninitialized constant qa::module1 /root/vendor/app_name/lib/qa.rb:2:in `<module:qa>' /root/vendor/app_name/lib/qa.rb:1:in `<top (required)>' /root/vendor/app_name/lib/tasks/qa.rake:2:in `block in <top (required)>' /root/vendor/app_name/lib/tasks/qa.rake:1:in `<top (required)>' /var/lib/gems/2.1.0/gems/zeus-0.15.3/lib/zeus/load_tracking.rb:50:in `load' /var/lib/gems/2.1.0/gems/zeus-0.15.3/lib/zeus/load_tracking.rb:50:in `load' /var/lib/gems/2.1.0/gems/zeus-0.15.3/lib/zeus/load_tracking.rb...

angularjs - Best practise to format a hibernate date in angular -

what best way format time value of json objects (in milliseconds) date , render in view. reason angular seems not format therefore input field stays empty? a hibernate entity returned json via rest. entity account: @entity @table(name = "account") @jsonignoreproperties(ignoreunknown = true) public class account extends baseentity implements serializable { private static final long serialversionuid = 1l; @column(name = "name") private string name; @column(name = "email") private string email; @temporal(temporaltype.timestamp) @column(name = "birthday") ... rest ws: @requestmapping(value = "upsert", method = requestmethod.post) public responseentity<account> upsert(@requestbody account account) { account response = accountaccess.upsert(account); return new responseentity<>(response, httpstatus.ok); } angular account controller: $scope.updateaccount = function(flow) { $http.post("re...

javascript - set country by default using -

my code doesn't seem work. i'm trying set country dropdown usa page loads default without hard coding. <tr> <td><label for="state_province__c">state/province:</label></td> <td><select id="state_province__c" name="state_province__c" title="state/province"></select></td> </tr> <tr> <td><label for="country__c">*country:</label></td> <td><select id="country__c" name="country__c" title="country"></select></td> </tr> <script type="text/javascript"> jquery(document).ready(function() { populatecountries("country__c", "state_province__c"); jquery("#country__c").val("usa...

java - Velocity's FileResourceLoader can't find resources -

i use velocity in order load email templates. templates first downloaded ftp server , saved temporary files. however, when try load template exception: org.apache.velocity.exception.resourcenotfoundexception: unable find resource 'c:\users\someusername\appdata\local\temp\template1526050996884865454.html' and i'm sure file there , it's not damaged. that's how try load template: template = velocityengine.gettemplate(tempfile.getcanonicalpath()); here's velocity.properties file load (and i've checked properties initialized!) file.resource.loader.class=org.apache.velocity.runtime.resource.loader.fileresourceloader file.resource.loader=file file.resource.loader.path=. so lies problem? because appdata folder hidden default? i think there's design flaw in velocity fileresourceloader . if file.resource.loader.path other empty string, it'll mangle absolute paths handed file . additionally has unix/linux-specific code "nip off...

javascript - How to pass a variable in ajax append function (into html element with razor)? -

i need pass id of object html element (razor part), doesn't recognize it. id not in scope, or something. there way pass value razor part of html element in append function? $.ajax({ data: data, url: url + "?searchterm=" + data }).success(function (response) { console.log(response); var table = $('#companytable'); var tbody = table.children('tbody'); tbody.html(""); var textbox = document.getelementbyid("searchbar"); textbox.value = ""; tbody.append( "<tr><td>" +response.companyname + " </td><td>" + response.companyidnumber + "</td><td>" + response.companytaxnumber + "</td><td>" + "<p><button onclick=\"location.href='@url.action("edit", "company", ...

How to Convert Excel File To CSV ( Comma Separated values) File in SSIS Package -

i need import excel data netezza using ssis. there columns first 100-200 rows blank , due getting null output columns. need have output 0 's columns(which decimal , numeric datatype) rows empty , ' '(blank) columns(varchar, char datatype) rows empty. the way believe using script task , appreciate if can share script. if there better solution type of problem without changing in excel property please share it.

ios - AVSampleBufferDisplayLayer with VTDecompressionSession -

i've been struggling avsamplebufferdisplaylayer being choppy lot of motion. when there motion in live stream, come pixelated , half frozen multiple frames displaying @ once. however, once added following piece of code, solved: vtdecodeframeflags flags = kvtdecodeframe_enableasynchronousdecompression | kvtdecodeframe_enabletemporalprocessing; vtdecodeinfoflags flagout; vtdecompressionsessiondecodeframe(decompressionsession, samplebuffer, flags, (void*)cfbridgingretain(null), &flagout); note did create decompression session before, don't in callback. still calling enqueuesamplebuffer: on avsamplebufferdisplaylayer , how video displayed on screen. do have call vtdecompressionsessiondecodeframe avsamplebufferdisplaylayer display correctly? thought avsamplebufferdisplaylayerr use vtdecompressionsessiondecodeframe internally. due being on ios simulator? avsamplebufferdisplaylayer , vtdecompressionsession 2 different things, although avsamplebufferdisplaylayer ...

android - Hide warnings in layout files -

i updated eclipse , sdk , in every xml file textviews have warning "consider making text value selectable specifying android:textisselectable="true"". is possible hide warnings, hate have project lot of yellow exclamation marks. go propeties of project. go android lint preferences. search selectabletext , change severity ignore. you can in eclipse preferences projects.