Posts

Showing posts from September, 2013

xcode - NSTableView inside NSOutlineView and NSView-Encapsulated-Layout-Height -

i'm building os x application using swift , xcode 6.4 on os x 10.10.5. on specific view of application have view this 1 xcode has on data model editor. i tried replicate view using outlineview each "row" have title , tableview plus 2 buttons (for plus , minus buttons). tests purposes i've separated title tableview+buttons, this (this 1 of many different attempts). everything working expected except view has tableview+buttons, never higher 17 pixels. if define in 1 view, have same problem. i've tried defining needed constraints in case there problem constraint seems automatic called nsview-encapsulated-layout-height, forces height 17 pixels: nslayoutconstraint:0x61800008ea10 'nsview-encapsulated-layout-height' > v:[notestable(17)] (names: notestable:0x60000012e2e0 ) i'm not defining constraint 17 pixels, i've tried testing parameters insert automatic constraints (autoresizessubviews/translatesautoresizingmaskintoconstraints/...

javascript - forge.js Replicate what I do with rsa but with aes -

im using javascript library forge.js ( https://github.com/digitalbazaar/forge ) rsa publickey if 896 bits in length lets me encrypt fare bit of text but, length of publickey it's self long needs. if shorten key of 460 bits length of key ok but, limited encrypting short amount. i features of rsa (encrypt/decrypt & sign/verify) don't length of key it's self , limit on size. is there form of encryption better suited use? needs: a public key 20 characters long to able encrypt around 140 characters same or similar features rsa i have been playing around forge aes looks encryption sort of shared thing - have 1 key (that shared?). can create cypher , decypher. don't see how work similar rsa as; rsa can share publickey , safe sign , decrypt don't see how can same current understanding of aes. how opperate: //make sure user has said both hasn't been tampered , var kp=forge.pki.rsa.generatekeypair({bits: 896,e:0x10001}); var m=['hi!']...

optimization - MySQL, the index of text can`t work -

i create table this create table `text_tests` ( `id` int(11) not null auto_increment, `text_st_date` text not null, `varchar_st_date` varchar(255) not null default '2015-08-25', `text_id` text not null, `varchar_id` varchar(255) not null default '0', `int_id` int(11) not null default '0', `created_at` datetime default null, `updated_at` datetime default null, primary key (`id`), key `idx_of_text_st_date` (`text_st_date`(50),`id`), key `idx_of_varchar_st_date` (`varchar_st_date`,`id`), key `idx_of_text_id` (`text_id`(20),`id`), key `idx_of_varchar_id` (`varchar_id`,`id`), key `idx_of_int_id` (`int_id`,`id`) ) engine=innodb default charset=utf8 then make datas use ruby (1..10000).each |_i| item = texttest.new item.text_st_date = (time.now + _i.days).to_s item.varchar_st_date = (time.now + _i.days).to_s item.text_id = _i item.varchar_id = _i item.int_id = _i item.save end...

ajax - jQuery - Off() not working depending of the event -

i'm using "off event" avoid multiple ajax requests (if user multiple clicks, example). works perfectly. the problem is, depending on how "on('click')" event called, event off() doesn't work. give example: function: var addcomment(elem) = function(){ $.ajax({ type: "post", url: '../../ajax/request.php', datatype: 'json', data: data, beforesend: function(){ // after line, click elem doesn't elem.off('click'); }, success: function(result){ if (result.success){ console.log('success!'); }else{ console.log('no success...'); } //making "elem" clickable again elem.on('click',function(){ addcomment(elem); }); }, error: function(xhr, ajaxoptions, thrownerror){ ...

java - Can I override PageImpl in Spring Data? -

there few methods incorporate pageimpl. there anyway override default page implementation returned spring data's repository methods? if want add methods, use aspectj so. like: public privileged aspect pageimplaspect { public boolean pageimpl.isempty() { // implementation here. } } you need instruct aspectj compiler wave springdata library, can done in maven using weavedependencies in aspectj-maven-plugin plugin.

java - Logging duplicate messages once -

i'm in unique situation receiving duplicate messages 10-25 sources @ same time or @ same time. code came counter was: private queue<string> messages = new concurrentlinkedqueue<>(); public void log(string message) { if(!messages.contains(message)) { if(messages.size() >= 5) { messages.remove(0); } messages.add(message); main.getlogger().info(message); } } the problem code since method being called concurrently, log messages 2-4 times instead of once. consider putting actual writes logger in separate thread reads incoming log messages thread safe queue , checks duplicates before writing. apps perform logging write log messages queue , writer monitor queue new messages. when message comes in, it's checked uniqueness against number of previous messages , if unique, it's both written queue , stashed in set of older messages check against (potentially pushing out older message).

android - makeSceneTransitionAnimation when opening an activity from an intent from a button within a fragment -

i opening activity screen on-click of fragment button. trying make button move fragment screen activity screen via makescenetransitionanimation. not animating . how can open activity intent fragment , have animation going. appreciate help. public class listfragment extends fragment { floatingactionbutton fab; @nullable @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { r.layout.fragment, container, false); } @override public void onactivitycreated(@nullable bundle savedinstancestate) { super.onactivitycreated(savedinstancestate); fab.setonclicklistener(new view.onclicklistener() { @override public void onclick(view view) { intent = new intent(getactivity(), mainactivity.class); i.putextra("title", "title"); activityoptionscompat options = activityoptionscompat.makescenetra...

git - How to find the original commit of an amended one? -

actually accident found out interesting. amended change existing local commit. know change hash of original commit - @ least that's thought. seems git creates complete new commit. no problem far. $ vim foo $ git add foo $ git commit -m "edited foo" $ git log --oneline -n 1 5b122c7 edited foo $ vim foo $ git add foo $ git commit --amend $ git log --oneline -n 1 98f1e64 edited foo $ git show 5b122c7 # wait what? git show 5b122c7 show me original commit - amended commit effictively new commit. but why old commit still in repository? okay neat have original commit go back. but original commit 5b122c7 not appear in git log --all git revert 5b122c7 not fall 5b122c7 instead previous commit of original one. i'm curious behavior , want know: there way find original commit 5b122c7 git log or something? in case don't know hash of original commit: how can find hash? the old commit still in repository, no longer included in history of branch. ...

symfony - doctrine2 symfony2 relations entities -

i have big problem. 1 . have class user of fos have form of register supervisors , process of registration works well. 2 . every supervisor has personals , has form of adding personal , form registration of supervisor , add process in same class of supervisor class user . --> supervisor , personals there in same class . the question : when supervisor login how select him personals , there in same table ? suggestions : 1 . manytoone , onetomany in same class user 2 attributes parent , childs : /** * @orm\onetomany(targetentity="common\authenticationbundle\entity\user", mappedby="parent") */ protected $childs; public function __construct() { $this->childs = new arraycollection(); } /** * @orm\manytoone(targetentity="common\authenticationbundle\entity\user", inversedby="childs") * @orm\joincolumn(nullable=false) */ private $parent; i don't know how work ? 2 . create class supervisorpersonal put supervi...

Bigcommerce - View who is Currently Signed-in -

scenario: there more 1 person working on developing bigcommerce store. there way see if logged in prevent overwriting each other's work? thanks looking , in advance answer! you can view successful admin log-ins viewing store logs area: your-domain.com/manage/settings/logs however cannot view actively logged in. there no current way using bigcommerce api check backend users logged in. the log feature bigcommerce offers date/time log listing backend logins, not indicate currently logged in. if building solution necessary, recommend using sort of webdriver log store via normal backend, , parse user log file compare timestamps of users logged in. your app logic compare differences in timestamps separate users. example: parse users logged in within last hour. assume users actively logged in (again, there no sure way of knowing actively logged in on backend).

android - where is AndroidManifest in unity 5? -

salaam want build scene android in unity 5, huge error.\n part of error: commandinvokationfailure: failed re-package resources. see console details. . . . androidmanifest.xml:4: error: no resource identifier found attribute 'isgame' in package 'android' androidmanifest remove attribute 'isgame'? go search , type androidmanifest screenshot , open monodeveloper , edit android:targetsdkversion="type version"

Where to find a Carrot2 C# API? -

i'm been trying use carrot2 (clustering engine) in c# project. state offer c# api, download links[1] broken (404 - not found). support page[2] suggests ask questions on so, thought i'll post here. anyone information on official or other non-official c# api carrot2? [1] http://project.carrot2.org/download.html , http://download.carrot2.org/head/manual/index.html#section.integration.compiling-csharp-program-with-carrot2 [2] http://project.carrot2.org/contact.html here latest carrot2 c# api: http://get.carrot2.org/stable/3.10.3/ http://get.carrot2.org/stable/3.10.3/carrot2-csharp-api-3.10.3.zip

php - How to display var_dump(unserialize($data)) each item in newline -

$data=memcache->get($key) if(!empty($data)) { var_dump(unserialize($data)); } how can each item in new line instead of displaying paragraph array.? echo '<pre>'.var_dump(unserialize($data)).'</pre>';

Rails 4 Carrierwave, post updating isn't working correctly after implementing multiple uploads -

i implemented multiple uploads carrierwave , i'm unable update post correctly. here controller: class postscontroller < applicationcontroller before_action :find_posts, only: [:show, :edit, :update, :destroy, :upvote, :downvote] before_action :authenticate_user!, except: [:index, :show, :home] def home end def index if params[:category].blank? @posts = post.all.order("created_at desc") else @category_id = category.find_by(name: params[:category]).id @posts = post.where(category_id: @category_id).order("created_at desc") end end def show @inquiries = inquiry.where(post_id: @post).order("created_at desc") @random_post = post.where.not(id: @post).order("random()").first @post_attachments = @post.post_attachments.all end def new @post = current_user.posts.build @post_attachment = @post.post_atta...

ios - Core Data NSFetchedResultsController not updated after a batchUpadate on the device but ok on simulator -

i have nsfetchedresultscontroller managed uitableview data source. i trying modify property of nsmanagedobject called amounttocompute using nsbatchupdaterequest . create batch update: let batchupdate = nsbatchupdaterequest(entityname: "myentity") batchupdate.propertiestoupdate = ["amounttocompute" : newamount] batchupdate.resulttype = .updatedobjectidsresulttype i execute it: var batcherror: nserror? let batchresult = managedcontext.executerequest(batchupdate, error: &batcherror) as! nsbatchupdateresult? and update current managed context, update each managedobject in managedcontext , perform new fetch of fetchedresultscontroller : if let result = batchresult { let objectids = result.result as! [nsmanagedobjectid] objectid in objectids { let managedobject: nsmanagedobject = managedcontext.objectwithid(objectid) if !managedobject.fault { managedcontext.refreshobject(managedobject, mergechanges: true) ...

jquery - Form Validation with ajax request -

i have general validation method validatefields application. script check every field needs validated against several conditions , increment counter. if(validate_for_nil(field) == true){ // return true , continue other validations } else { //stop further actions , raise error } if(validate_max_chars(field) == true){ //continue other validations }else{ //stop , raise error } similarly uniqueness validation, need send ajax request. problem is, function not waiting ajax response.it check condition undefined ajax response.how can make entire function wait till ajax response comes? async:false in ajax request not convenient me. please here code: function form_validation() { $("[data-required=true]:visible").each(function(){ element = $(this); errors = validate_fields(element); total_errors = total_errors + errors; }) if(total_errors == 0) { //submit form }else{ //do nothing } } function validate_fields(field) { erro...

powershell - Can you create a complex CSV file inside the Testdrive? -

i want ask if possible create complex csv file inside testdrive in creating pester test function? complex in sense has 13 headers , no null values? you can create kind of file inside testdrive:\ (which kind of psdrive) although of course available temporarily within context or describe block used. testdrive powershell psdrive file activity limited scope of single describe or context block. https://github.com/pester/pester/wiki/testdrive

javascript - How to return value from array to the function -

here calculating distance , time between 2 latitude , longitude points.almost getting answer not able return value function. please me. in advance my codings : function initmap() { console.log(getdistanceandtime(srcrouteaddress.lat,srcrouteaddress.lng,destrouteaddress.lat,destrouteaddress.lng)); function getdistanceandtime(lat1,lon1,lat2,lon2){ var origin = {lat: parsefloat(lat1), lng: parsefloat(lon1)}; var destination = {lat: parsefloat(lat2), lng: parsefloat(lon2)}; var service = new google.maps.distancematrixservice; //var test = []; service.getdistancematrix({ origins: [origin], destinations: [destination], travelmode: google.maps.travelmode.driving }, function (response, status) { if (status == google.maps.distancematrixstatus.ok) { var test_values = []; var originlist = response.originaddresses; (var = 0; <...

c# - Replace Query String of a page -

i want replace query string of page this- firstly move page on clicking on menu bar items setting url- response.redirect("searchtworkforcereport.aspx?page=search"); then want change url this- "searchtworkforcereport.aspx?page= search " "searchtworkforcereport.aspx?page= edit " on check box change event. try code- string strquerystring = request.querystring.tostring(); if (strquerystring.contains("page")) { strquerystring = strquerystring.replace("search", "edit"); } and it'll replace query string on page load if query string should give again previous set string. type = request.querystring["page"].tostring(); you can't edit query string of page editing request.querystring . should redirect current page. use code below: if (request.rawurl.contains("page")) { response.redirect(request.rawurl.replace("search", "edit")) }

c# - Using Thread with Parameter as object -

how start thread object parameter in c#. i wanted pass object parameter thread function. to pass parameter thread use parametrizedthreadstart : thread thread = new thread(new parametrizedthreadstart(func)); thread.start(obj); the parameterizedthreadstart delegate , thread.start(object) method overload make easy to pass data thread procedure .

asp.net - Select option can't be clicked in firefox in modal panel -

i have ajax modal panel select inside. when want change selected value in firefox nothing happens. tried trick autocomplete attribute on select no success. ideas? ok did it. caused popupdraghandlecontrolid attribute set whole panel. true thing should associated header if wants drag anywhere on panel bug can appear.

php - Redirect to index.html page from server with message -

i want traverse : index.html(with form data) --> save_message.php(process form data) --> index.html(show success/error message) my html code : <script type="text/javascript"> var messageform = $('#message-form'); messageform.submit(function(event){ event.preventdefault(); var form_status = $('<div class="form_status"></div>'); $.ajax({ url: "save_message.php", type: "post", data: $("#message-form").serialize(), datatype: "json", beforesend: function(){ messageform.prepend(form_status.html('<p><i class="fa fa-spinner fa-spin"></i> email sending...</p>').fadein()); }, success: function(data) { if(data.type == 'success'){ alert("thank subscribing!"); ...

ios - anyone know when the method -photoLibraryDidChange called? -

i have test method many times, 1 thing sure ,when photo library changes ,the method called. after change , method called twice( doesn't ). 1 know why 2015-08-25 14:16:04.420 photolibrary[25742:3293667] enter photolibrarydidchange methods 2015-08-25 14:16:04.445 photolibrary[25742:3283461] inserted. 2015-08-25 14:16:17.199 photolibrary[25742:3293667] enter photolibrarydidchange methods 2015-08-25 14:16:17.522 photolibrary[25742:3293668] enter photolibrarydidchange methods 2015-08-25 14:17:04.762 photolibrary[25742:3295134] enter photolibrarydidchange methods 2015-08-25 14:17:04.796 photolibrary[25742:3283461] changed. 2015-08-25 14:17:18.056 photolibrary[25742:3295135] enter photolibrarydidchange methods 2015-08-25 14:17:18.366 photolibrary[25742:3295137] enter photolibrarydidchange methods 2015-08-25 14:18:22.915 photolibrary[25742:3297134] enter photolibrarydidchange methods 2015-08-25 14:18:22.932 photolibrary[25742:3283461] changed. 2015-08-25 14:18:34.275 photol...

wordpress - Woocommerce Checkout not Working with No CAPTCHA reCAPTCHA for WooCommerce Plugin -

when active 'no captcha recaptcha woocommerce' plugin, on checkout page of woocommerce when customer checked 'create account?' check-box , place order, not work. page scroll on top , nothing action. any idea? reagrds faizan add functions.php function my_woocommerce_before_checkout_process() { remove_filter( 'woocommerce_registration_errors', array('wc_ncr_registration_captcha', 'validate_captcha_wc_registration'), 10 ); } add_action('woocommerce_before_checkout_process', 'my_woocommerce_before_checkout_process');

angularjs - anchorScroll not working, going to top of page -

i have below code $scope.scrollto = function(id) { alog($location.hash()); var toscrollid = "anchor" + id; if($location.hash() !== toscrollid){ alog(" hash not equal") $location.hash(toscrollid); }else{ alog(" hash equal") $anchorscroll(); } }; and html looks like <button ng-click="scrollto(raceid)">go this</button> <div ng-repeat="race in races" id="{{ 'anchor' + race.raceid}}"> </div> but scroll goes top of page. doing wrongly? your ng-repeat assigning id parent element (in case, races div) might need modify first: <div ng-repeat="race in races" id="races"> <div id="{{ 'anchor' + race.raceid }}">some race</div> </div>

joomla3.0 - Want to add Skype, Whatsapp, Call,Email to joomla menu bar -

this link site http://safehandindia.com/orgch/ i have code 4 icons. if go create joomla menu item icon confused place respective code it. skype icon button have code <script type="text/javascript" src="http://www.skypeassets.com/i/scom/js/skype-uri.js"></script> <div id="skypebutton_call"> <script type="text/javascript"> skype.ui({ "name": "dropdown", "element": "skypebutton_call", "participants": ["name"], "imagesize": 24 }); </script> </div> where should lace code icon beside 'search' menu item in page. when 1 clicks on it goes skype app. if solution rest can solve you can create custom html module in paste code. (switch text editor html) then publish module on pages in same position search module. order of modules important place icons ...

javascript - Edit specific record that inside php looped -

at moment i've coded out <div class="row"> <div class="col-lg-12"> <table id="usertable" class="table table-bordered table-hover text-center"> <thead> <th class="col-lg-1 text-center">user id</th> <th class="col-lg-4 text-center">username</th> <th class="col-lg-4 text-center">password</th> <th class="col-lg-2 text-center">role</th> </thead> <tbody> <?php require('dbconnectmssql.php'); $sql = "select [user_id],[user_decoded],[pass_decoded],[permission] [rfttest].[dbo].[users]"; $query = sqlsrv_query ($conn , $sql); if($query === false) {die( print_r( sqlsrv_errors(), true));} while($row = sqlsrv_fetch_array( $query, sqlsrv_fetch_numeric)) { echo "<tr>"; foreach($row $x => $a) { echo "<td...

Excel-Vba - Double/Date/Time matching and tolerance -

my code far this: sub findmatchingvalue() dim integer, timevaluetofind date timevaluetofind = "04:00:00" sheets("vessels").range("f07").clearcontents = 1 25 ' if cdate(sheets("vessels").cells(i, 1).value) = timevaluetofind msgbox ("found value on row " & i) sheets("vessels").range("f07").value = cells(i, 1).offset(1, 1).resize(1).value exit sub end if next msgbox ("value not found in range!") end sub this code checks column time inputted in format xx:xx:xx both input is, , times written set "time" format. cdate edit not added. , caused code return false because, had been put, trying "compare apples oranges". however adding cdate addition produces mismatch error. changing both double did not work: sub findmatchingvalue() dim integer, timevaluetofind date timevaluetofind = "04:...

javascript - AngularJS: Set element to class active by default -

i've created custom tabbed element using following code: <div class="row step"> <div class="col-md-4 arrow active" ui-sref-active="active"> <a ui-sref="dashboard.create.key_elements" ui-sref-opts="{ reload: true }"> <span class="number">1</span> <span class="h5">key elements</span> </a> </div> <div class="col-md-4 arrow" ui-sref-active="active"> <a ui-sref="dashboard.create.questions" ui-sref-opts="{ reload: true }"> <span class="number">2</span> <span class="h5">questions</span> </a> </div> <div class="col-md-4 arrow" ui-sref-active="active"> <a ui-sref="dashboard.create.publish" ui-sref-opts="{ re...

ios - How can I retrieve object from DBResultSet (DBAccess) in Swift? -

Image
i have class user.swift: import uikit @objc(user) class user: dbobject { dynamic var sync: nsnumber? dynamic var login: nsstring? dynamic var password: nsstring? dynamic var id_worker: nsnumber? static func authorize(login: string, password: string) -> bool{ var query = user.query().wherewithformat("login = %@ , password = %@", withparameters: [login, password.md5]) var resset = query.fetch() dbresultset if resset.count > 0 { var user = resset[0] as! user } if resset.count > 0{ return true } else { return false } } } i want retrieve user object dbresultset. under debbuger strange construction: how can retrieve object user dbresultset?

Using stubs in a basic Java maven project -

i have basic maven project folder structure: -main , -test directories. i have 1 package in main source directory consists of few classes, a.class b.class , c.class, under same package. classes have dependencies each other. proper unit testing, , cut dependencies each class, write stub classes of each a, b , c class, define them have same package , put them inside test source directory. run: mvn test fine, stubs being found first classpath , used, want modify classpath (on fly?) that, when testing class a, need have original a.class , stubs used b.class , c.class. similarly, when testing class b, need have original class b , stubs used a.class , c.class. how accomplish using maven , junit? this kind of frustrating in java, because in c++, 1 can use makefile source path , user defined include paths in unit test header files force stubs found first , explicitly add include original class tested. if have dependent classes schould use interface each class. can resolve ...

Best practices for global resources in c# -

when want make our application users(speak different languages),we need global technology. in c# use resourcemanager follow: using system; using system.reflection; using system.resources; public class example { public static void main() { // retrieve resource. resourcemanager rm = new resourcemanager("exampleresources" , typeof(example).assembly); string greeting = rm.getstring("greeting"); console.write("enter name: "); string name = console.readline(); console.writeline("{0} {1}!", greeting, name); } } // example produces output similar following: // enter name: john // hello john! the assembly have 2 or more language resources: assembly |--assembly.en-us.resx |--assembly.zh-cn.resx then archive change resource changing thread cultureinfo use different resource. if application have lot of dll(assembly) files. want have single point...

angularjs - Can't show json in angular -

body: object und: array[1] 0: object format: "full_html" safe_summary: "" safe_value: "<p dir="rtl" style="text-align: justify;">اگر دوست دارید قدرت <a href="http://30zin.com/content/%d8%af%d9%88%db%8c%d8%af%d9%86-%d8%a8%d8%b1%d8%a7%db%8c-%d8%ad%d8%a7%d9%81%d8%b8%d9%87-%d8%ae%d9%88%d8%a8-%d8%a7%d8%b3%d8%aa">دویدنتان</a> زیاد شود و بیشتر بدوید و آسیب های ناشی از دویدن را هم نداشه باشید توصیه های زیر را بخوانید تا موفقیت خوبی هنگام دویدن نصیبتان شود.<br /><strong>1- هر روز بدوید</strong><br />تداوم، کلید موفقیت در برنامه است. اگر هر روز بدوید، توانایی بدن برای سوزاندن چربی هم بیشتر می شود.<br /><br /><strong>2- لباس مناسب برای دویدن بپوشید</strong><br />بلوز،‌ شلوار و کفش ورزشی مناسب برای دویدن بپوشید. این کار هم بدن شما را در بهترین فرم و حالت نگه می دارد و هم انگیزه بخش بوده و یک وسیله تشویقی برای دویدن محسوب می شود.<br /><...

unit testing - Executing code only when a python unittest has failed -

i working on project has lot of selenium tests. tests run using python binding of selenium , python unittest . when tests fail unittest displays exception stack trace , error message. of tests not enough information debug problem. screenshot of browser , copy of browser log helpful. so want is: if test fails, before closing selenium driver want take screenshot , save somewhere. need function teardown() should called when test fails. looked @ source code of unittest , specificaly testcase class , couldn't find anything. can help? the stackoverflow community recommended adding try...except.. blocks around each test solution there hundreds of tests. cannot possible edit each one. looking general, non hacky way doing this. adding try..except.. blocks require me going through each test , copy/pasting try..except part or writing decorator , decorating each test. working in team other developers , don't want have long conversation why should decorate each test write , happe...

Kendo UI grid drag&drop placeholder -

i have grid drag&drop functionality: var data = [ { id: 1, text: "text 1", position: 0 }, { id: 2, text: "text 2", position: 1 }, { id: 3, text: "text 3", position: 2 } ] var datasource = new kendo.data.datasource({ data: data, schema: { model: { id: "id", fields: { id: { type: "number" }, text: { type: "string" }, position: { type: "number" } } } } }); var grid = $("#grid").kendogrid({ datasource: datasource, scrollable: false, columns: ["id", "text", "position"] }).data("kendogrid"); grid.table.kendodraggable({ filter: "tbody > tr", group: "gridgroup", threshold: 100, hint: function(e) { return $(...

grouping - R - apply adf.test by group -

i have data.frame bbm variables ticker , variable , value . want apply augmented dickey fuller test via adf.test function grouped ticker , variable. r should add new column initial data.frame corresponding p-values. i tried x <- with(bbm, tapply(value, list(ticker, variable), adf.test$p.value)) cbind(bbm, x) this yields error in adf.test$p.value : object of type 'closure' not subsettable . then tried x <- with(bbm, tapply(value, list(ticker, variable), as.list(adf.test)$p.value)) cbind(bbm, x) this yields result, in new column not want. when change p.value on code method stills yields odd number. then tried using ddply: bbm<-ddply(bbm, .(ticker, variable), mutate, df=adf.test(value)$p.value) which yields error: wrong embedding dimension . how can solve this? suggestions? here's sample of df: ticker variable value 1 1002z av equity bs_customer_deposits 29898.0 2 1002z av equity bs_custome...

cocoa - Activate other Application - OSX -

i writing application opens application up. other application agent user not see in dock. if user clicks on dock symbol of first app, i'd check if there other agent opened not active. if it's want activate second app instead of opening first app. if there's no other agent opened want open main app in normal way. does know if possible , or have solution? i'd appreciate every help, cheers. so question is, how activate app? nsrunningapplication has -activatewithoptions: purpose. this: nsrunningapplication *otherapp = [nsrunnungapplication runningapplicationwithbundleidentifier:…]; [otherapp activatewithoptions:0];

java - How to quickly insert an element into array with duplicates after all of the equal elements? -

i have arraylist, contains game objects sorted 'z' (float) position lower higher. i'm not sure if arraylist best choice have come such solution find index of insertion in complexity faster linear (worst case): gameobject go = new gameobject(); int index = 0; int start = 0, end = displaylist.size(); // displaylist arraylist while(end - start > 0) { index = (start + end) / 2; if(go.depthz >= displaylist.get(index).depthz) start = index + 1; else if(go.depthz < displaylist.get(index).depthz) end = index - 1; } while(index > 0 && go.depthz < displaylist.get(index).depthz) index--; while(index < displaylist.size() && go.depthz >= displaylist.get(index).depthz) index++; the catch element has inserted in specific place in chain of elements equal value of depthz - @ end of chain. that...

Java UncaughtExceptionHandler + LOG4J + Maven -

i log file exceptions (shown in console) in maven projects. create class witch implements uncaughtexceptionhandler , call log4j logger.error. works in main maven project (where main class), not inside others maven projects connected (with dependencies in pom.xml). maybe default uncaughtexceptionhandler overridden maven, how can make works? public static void main(string[] args) throws exception{ thread.setdefaultuncaughtexceptionhandler(new defaultexceptionhandler()); } public class defaultexceptionhandler implements uncaughtexceptionhandler{ private static final logger logger = loggerfactory.getlogger(defaultexceptionhandler.class); @override public void uncaughtexception(thread thread, throwable ex) { logger.error("exception thread: "+thread.getname(), ex); } } you can create instance of java.io.printstream below public static printstream createloggingproxy( final printstream realprintstream) { return new prin...

r - how to extract coefficients in logistic regression using gbm? -

i using gbm package generalized boosted regression models, , able extract coefficients produced storage in database. i using r automatically generate formulas can export database , store. example, have been using dr. harrell's lrm package perform logistic regression, e.g.: output <- lrm(outcome~predictor1+predictor2,data=dataset) cat(output$coefficients) is possible gbm? know gbm gives number of trees linearly combined weights there possibility each of tree printed? or perhaps @ least possible in case interaction.depth=1 (e.g., no interactions allowed)? gbm's (and other tree-based models) don't have coefficients there isn't extract. trying score database using gbm object? if have 2 options: 1) encode each of gbm trees sql queries 2) pull data r, score it, , write database.

node.js - Sticky load balancing on nginx reverse proxy not working -

i'm trying setup reverse proxy on existing nginx web server. have started 3 nodejs-socket.io servers on 195.93.x.x:6001; 195.93.x.x:6002; 195.93.x.x:6003; i can access socket.io on them separately, such as: http://195.93.x.x:6001/socket.io/socket.io.js through nginx reverse proxy can't access socket.io servers. request http://myserver.com/push/socket.io/socket.io.js returns cannot /push/socket.io/socket.io.js status 404. any highly appreciated below contents nginx.conf file: server { listen 80; server_name myserver.com www.myserver.com; error_log /var/log/nginx-error.log; upstream pusher { ip_hash; server 195.93.x.x:6001; server 195.93.x.x:6002; server 195.93.x.x:6003; } location /push { proxy_set_header upgrade $http_upgrade; proxy_set_header connection "upgrade"; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header host $host; proxy_http_version 1.1; proxy_pass http://pus...

go - How come I get cannot use type *sql.Row as type error when doing err == sql.ErrNoRows -

i trying follow example in answer given here: golang: how check empty array (array of struct) on how check if database return empty so have this: err = db.queryrow("select accounts steamid=?", steamid) switch { case err == sql.errnorows: case err != nil: default: //do stuff } but error: cannot use db.queryrow("select accounts steamid=?", steamid) (type *sql.row) type error in assignment: *sql.row not implement error (missing error method) not sure why worked in example not when try implement it. thanks. you've missed scan part of example, returns error: err := db.queryrow("select ...").scan(&id, &secret, &shortname)

sql - SubSelects for Order and Count -

Image
i have select this: select faculty,department,season,student,score table i want 2 new columns this: numberinseason order of scores in faculty, department , season. totalinseason count of students in faculty, department , season. i think need subselects can not figure out right now. help? window functions should task: select faculty, department, season, student, score, dense_rank() on (partition faculty, department, season order score desc) numberinseason, count(*) on (partition faculty, department, season) totalinseason table

ios7 - keyboard pushes bottom elements upward -

Image
in app when select give input particular input field positioned @ top keyboard pushes bottom element upward. using ionic framework. in android platform solved changing windowsoftinput adjustpan autoresize. how solve problem in case of ios platform. you should able add class hide-on-keyboard-open items want stay "behind keyboard" can read more how works here involves using ionic keyboard plugin

arp - Fail to ping other ports in the loopback connection -

[physical layout] 192.168.0.100(eth0)---rj45----192.168.0.101(eth1) [execution] # show destination host unreachable. $ ping -i eth0 192.168.0.101 # no mac address $ arp -an [question] i run tcpdump -i eth1 , see arp package sent eth1 .! is there methods let me able ping eth1 ? os:rhel7 you can set static arp entry corresponding eth1. i'm not sure understand architecture. eth0 , eth1 on same machine ?

c# - UI automation for office 2013 -

i need automate pressing file->info->"check issues" in office 2013. managed press file button code: automationelement window = automationelement.fromhandle(window.handle); automationelementcollection buttons = window.findall(treescope.descendants, new propertycondition( automationelement.controltypeproperty, controltype.button)); automationelement file=buttons.cast<automationelement>().firstordefault(x => x.current.name == "file tab"); invokepattern ipclickloadsettings = (invokepattern)file.getcurrentpattern(invokepattern.pattern); ipclickloadsettings.invoke(); how can press "check issues" button or other button in info window? thanks i took @ word 2013 ui using inspect sdk tool, , shows related ui can programmatically invoked through uia invoke pattern, can't. instead, other ui needs selected or expanded. wrote test code below following... invoke file tab. select info item. expand check issues ui. invoke check a...