Posts

Showing posts from January, 2013

Add new variable with for loop and if statements in R -

let's assume have data set 2 variables, , b, b's a's, not a's b's. a<-rbind(1,1,1,1,1) b<-rbind(0,0,0,1,1) d<-cbind(a,b) d [,1] [,2] [1,] 1 0 [2,] 1 0 [3,] 1 0 [4,] 1 1 [5,] 1 1 i want create new third variable condense information single data frame. attempted writing loop 1 in nrows, if variable 1 write 2, , if b variable 1 write 1 e<- (i in 1:nrow(d)) { if (d[,1]==1) { e$new[,i] <- 2 } # end if 1 else (d[,2]==1) e$new[,i]<-1 } # end 2 } # end i want output such: > d [,1] [,2] [,3] [1,] 1 0 2 [2,] 1 0 2 [3,] 1 0 2 [4,] 1 1 1 [5,] 1 1 1 i keep getting error: error in e$new[, i] <- 0 : incorrect number of subscripts on matrix in addition: warning messages: 1: in 1:x : numerical expression has 2 elements: first used 2: in if (d[, 1] == 1) { : condition has length > 1 , first element used any debugg

ibm mobilefirst - MFP 7.1 - SRVE0190E: File not found: /apps/services/my_custom_auth_request_url -

we see error lot on our test server. happens after application has been background while. once error occurs user not able thing. issue goes off once app killed , restarted. [4/24/16 19:08:23:195 edt] 0000927c com.ibm.ws.webcontainer.extension w srve0190e: file not found: /apps/services/my_custom_auth_request_url [4/24/16 19:08:23:195 edt] 0000927c com.worklight.core.auth.impl.authenticationfilter e fwlse0048e: unhandled exception caught: srve0190e: file not found: /apps/services/my_custom_auth_request_url java.io.filenotfoundexception: srve0190e: file not found: /apps/services/my_custom_auth_request_url @ com.ibm.ws.webcontainer.extension.defaultextensionprocessor.handlerequest(defaultextensionprocessor.java:528) @ com.ibm.ws.webcontainer.filter.webappfilterchain.invoketarget(webappfilterchain.java:150) @ com.ibm.ws.webcontainer.filter.webappfilterchain.dofilter(webappfilterchain.java:93) @ com.worklight.core.auth.impl.authen

Angularjs How to clear angularjs-bootstrap-datepicker -

on click of reset button i'm trying clear form fields i'm unable clear angular-bootstrap-datepicker.this code <div class="form-group"> <label class="col-sm-3 control-label">strting, ending date</label> <div class="col-sm-7"> <div class="input-group" style="width: 45%;float: left;"> <input class="fa fa-calendar" id="dpstartdate" name="startdate" type="text" data-ng-datepicker data-ng-options="datepickeroptions" ng-model="job.startdate"> </div> <div class="input-group" style="width: 45%;float: right;"> <input class="form-control" id="dpenddate" name="enddate" type="text" data-ng-datepicker data-ng-options="datepickeroptions" ng-model="job.enddate"> </div> </d

python - pygame.error: Couldn't open image.bmp -

whenever run code message pygame.error: couldn't open ship.bmp appears. keeping file ship.bmp in same place code. appreciate help. import sys import pygame pygame.init() screen_width = 800 screen_height = 600 screen = pygame.display.set_mode((screen_width,screen_height)) bg_color = (0, 13, 114) pygame.display.set_caption('space invaders') shipimg = pygame.image.load("ship.bmp") def ship(x,y): screen.blit(shipimg, (x,y)) x = (screen_width * 0.45) y = (screen_height * 0.8) crashed = false while not crashed: #keyboard events event in pygame.event.get(): if event.type == pygame.quit: crashed = true screen.fill(bg_color) ship(x,y) pygame.display.flip() pygame.quit() quit() i tried code , worked fine. see image in root directory. same folder save script/py file. other reason there hidden characters in file name. happened me several times. try rename function, delete entire name including file extension ,

date - Get the first and last day of current month in Go/Golang? -

i'm trying first , last day of current month. can add days , hours not month, thinking of subtracting 1 day next month last day of month. this: package main import ( "fmt" "time" ) func main() { date := time.now() nextmonth := date.add(time.month) lastday := nextmonth.add(-time.hour * 24) fmt.println(lastday) } you can use now library, simple : now.beginningofmonth() // 2013-11-01 00:00:00 fri now.endofmonth() // 2013-11-30 23:59:59.999999999 sat please take here detail : https://github.com/jinzhu/now

oracle - TNS-12514: TNS:listener does not currently know of service requested in connect descriptor 4/2016 -

i getting error when trying connect freshly installed oracle enterprise either sql developer or net manager. did try every solution find no luck. i trying connect system account , able log in sqlplus, know credentials correct. listener.ora sid_list_listener = (sid_list = (sid_desc = (program = extproc) (envs = "extproc_dlls=only:c:\oracle\oracleuser\product\12.1.0\dbhome_2\bin\oraclr12.dll") (sid_name = clrextproc) (oracle_home = c:\oracle\oracleuser\product\12.1.0\dbhome_2) ) ) listener = (description_list = (description = (address = (protocol = ipc)(key = extproc1521)) ) (description = (address = (protocol = tcp)(host = localhost)(port = 1521)) ) ) adr_base_listener = c:\oracle\oracleuser\product\12.1.0\dbhome_2\log tnsnames.ora listener_orcl = (address = (protocol = tcp)(host = localhost)(port = 1521)) oraclr_connection_data = (description = (address_list = (address = (prot

Migrating files compressed with gzcompress() [PHP] -

i have files on home/domain.com/path/to/file.txt data compressed using gzcompress() . need move files home/otherdomain.com/newpath/to/file.txt . copied files, when change path on file read compressed data warning: gzuncompress(): data error . i tried copy files again in case of error during copy didn't solve it. if try old uri works well. how solve , can avoid same issue in case need move files again in future (ie: server migration)?

ios - Move textview up depending on predictive text -

is there way change scale or position of textview depending on whether user has predictive text on? textview scale vertically when user has on , down disabled. thanks. there several notification can subscribe in order keyboard size information: uikeyboardwillshownotification uikeyboarddidshownotification uikeyboardwillhidenotification uikeyboarddidhidenotification use uikeyboardframebeginuserinfokey , uikeyboardframeenduserinfokey keys in notification's userinfo dictionary keyboard size information. have not verified, size should include predictive text area of keyboard. reference

Why obj[-0] not equal to obj['-0'] in JavaScript -

in javascript var obj = { '34': 'i 34', '-777': 'i -777', '0': 'i 0' } obj[34] // 'i 34' obj[-777] // 'i -777' obj[0] // 'i 0' it seems obj[number] equal obj[number.tostring()] . comes different -0 , +0 : var obj = { '-0': '-0 here', '+0': '+0 here' } obj[+0]; // undefined obj['+0']; // '-0 here' obj['0'] = 'just 0'; obj[+0]; // 'just 0' obj[-0]; // 'just 0' why? it seems obj[number] equal obj[number.tostring()] . yes. in ecmascript 5, properties have property names strings - , whatever pass property access operator (bracket notation) implicitly cast string. but comes different -0 , +0 no, it's same those. seem confused fact both string(-0) , string(+0) yield "0" , that's how is.

ruby on rails - Determine if Thin server is running as daemon -

i have problem rails , thin server. reason, thin clears out argv variable (i don't ask why :/), , rails application needs determine if thin running daemon server. tried access/find server object in application , rack variables, no luck. if way access thin instance options, or original argv, can parse , figure out if thin running daemon? solved :) objectspace.each_object(thin::runner) { |obj| @options = obj.options } @options[:daemonize]

sh script linux vacuumdb -

i want vacuumdb database wsemp0331 everytime ran in crontab, i'm getting error in log file: line 3: vacuumdb: command not found the command use is: vacuumdb -h 127.0.0.1 -p 5432 -u janet -d wsemp0331 -vz > /home/empbackup/public_html/backup/log/dbmaintenance_`date +%y%m%d%h%m`.log i have added host, port, , user. idea? the database in same server script (crontab) located.

How to replicate java encryption in c# -

i have public modulus , exponent key. encoding test piece of text , getting different results java code trying replicate. the java code here: rsapublickeyspec rsapublicspec = new rsapublickeyspec(modulus, exponent); keyfactory keyfactory = keyfactory.getinstance("rsa"); publickey publickey = keyfactory.generatepublic(rsapublicspec); x509encodedkeyspec encodedpublickeyspec = new x509encodedkeyspec(publickey.getencoded()); keyfactory keyfactory = keyfactory.getinstance(“rsa”); publickey publickey = keyfactory.generatepublic(encodedpublickeyspec); cipher cipher = cipher.getinstance(“rsa / ecb / pkcs1padding”); cipher.init(cipher.encrypt_mode, publickey); byte[] encryptedbytes = cipher.dofinal(cleartextstring.getbytes()); base64encoder b64 = new base64encoder(); string base64encodedstr = b64.encode(encryptedbytes); what have in c# right using bouncy castle is: biginteger publicmodulus = new biginteger(1, convert.frombase64string(publickeystring)); biginteger publ

css - Have list item take all the height -

i have page looks this: <ion-navbar *navbar> <ion-title>my list</ion-title> </ion-navbar> <ion-content class="has-header"> <ion-list> <ion-item *ngfor="#item of items"> <ion-toolbar> <ion-buttons end> <button>something</button> </ion-buttons> </ion-toolbar> <img [src]="slide.image" class="slide-image"/> <h2 class="slide-title" [innerhtml]="slide.title"></h2> <p [innerhtml]="slide.description"></p> </ion-item> </ion-list> </ion-content> let says there 100 items. each item take full height. should not able see next or previous item @ unless scroll. height of every item same size of ion-content guess. how can this? have tried playing around height, min-height, positioning, flex, have not been able make work? y

teradata - Comparing two fileds in select command -

i trying select records transaction_table tr_amount = instrument_number using following code select * transaction_table abs(tr_amount) = cast(instrument_number integer) however there rows in table instrument_number alphanumeric instead of numeric data. there way skip alphanumeric instances in instrument_number field in command. switch to_number , returns null bad data: select * transaction_table abs(tr_amount) = to_number(instrument_number) td15.10 implements trycast : select * transaction_table abs(tr_amount) = try_cast(instrument_number integer)

ruby on rails - Link doesn't hide after some time capybara -

Image
i use capybara test code located in comment model (5 minutes conventional): def editable? self.created_at < (time.now - 5.minute) end the view of link: - unless comment.editable? = link_to 'edit', edit_category_theme_comment_path(@category, @theme, comment) so after 5 minutes link edit must hide page (but need refresh page). here code in rspec creating comments , testing link-hide functionality: def create_comment(options={}) options[:content] ||= 'i comment' visit category_theme_path(category, theme) within '.comment-form' fill_in 'content', with: options[:content] click_button 'submit' end end context 'comment has content' before(:each) { create_comment } 'hides edit symbol due 5 minutes after comment created' using_wait_time 400 visit category_theme_path(category, theme) save_and_open_page expect(page).to have_no_css('.comment-edit')

queue - How to set max number of threads running concurrently using ThreadPool in .NET -

i need execute fixed number of threads,say 5, in parallel, , en-queue remaining threads. here piece of code tried. threadpool.setmaxthreads(5, 0); threadpool.queueuserworkitem(new waitcallback(threadproc), task1); thread.sleep(1000);//'threadproc' callback function now, when i'm trying run, 7 threads in parallel running threads simultaneously instead of running 5 thread , queuing next 2 threads. how achieve this? if can use parallel for/foreach have paralleloptions.maxdegreeofparallelism limit number of concurrent operations.

Adjusting width & height for view after rotating it by 90 degree in Android -

Image
i want add view & rotate 90 degree programmatically, can't figure how set dimensions properly. this placeholder: <framelayout android:layout_width="40dp" android:layout_height="match_parent" android:id="@+id/placeholder" android:orientation="vertical" android:background="@color/green" android:layout_weight="1"> and how code looks like: framelayout placeholderview = (framelayout) findviewbyid(r.id.placeholder); view myview = new view(getapplicationcontext()); myview.setbackgroundcolor(color.red); myview.setrotation(90); framelayout.layoutparams layoutparams = new framelayout.layoutparams(viewgroup.layoutparams.match_parent, viewgroup.layoutparams.match_parent); myview.setlayoutparams(layoutparams); placeholderview.addview(myview); the result both width & height same value, view looks this:

PredicateBuilder issue with ServiceStack OrmLite -

i using servicestack ormlite predicatebuilder build statement dynamically: var q = predicatebuilder.true<itemlist>(); if (!filter.keyword.isnullorwhitespace()) { q = q.and(i => i.brand.contains(filter.keyword) || i.itemdescription.contains(filter.keyword) || i.serial.contains(filter.keyword)); } if (!filter.itemstatus.isnullorwhitespace()) { q=q.and(i => i.itemstatus == filter.itemstatus); } var count = await db.countasync(db.from<itemlist>().where(q)); if none of if statements conditions met, error on executing query: an expression of non-boolean type specified in context condition expected, near 'order' the reason query generated is: select [list of fields] itemlist true update: using sql server 2012 dialect provider. and not valid, expected behaviour? i can use boolean check if condition being met , apply predicate expression, cumbersome. i expecting if using predicate without

jquery - How to pass batch data to controller action from kendo UI grid in case of batch editing? -

i'm trying implement kendo grid in mvc 3 apps. i'm interested in batch editing. need send batch data view controller action method. here code view: <!doctype html> <html> <head> <title> home!! </title> <link href="../../content/kendo/2013.1.319/kendo.common.min.css" rel="stylesheet" /> <link href="../../content/kendo/2013.1.319/kendo.metro.min.css" rel="stylesheet" /> <script src="../../scripts/jquery-2.0.2.min.js"></script> <script src="../../scripts/kendo/2013.1.319/kendo.web.min.js"></script> <script type="text/javascript"> var datasource = new kendo.data.datasource({ schema: { model: { id: "employeeid", fields: { employeeid: { editable: false, nullable: true }, employeename: { validation: { required: true } }

C Programing Boolean expression -

i trying write code in c programming prompting people answer boolean yes or no question run action accordingly. instead of if or switch . include <stdlib.h> include <stdio.h> int main() { int children; int age; printf("please enter age"); scanf("%d", age); printf("are married?, please enter y yes , n no"\n\n); scanf("%s", mstatus); if (mstatus y or y) { printf("how many children have: \n\n") scanf("%d", children) } return 0; } scanf("%d", age); should : scanf("%d", &age); // missing ampersand here. printf("are married?, please enter y yes , n no"\n\n); to printf("are married?, please enter y yes , n no\n\n"); // newlines should inside format string though other answer addresses issue, believe using switch-case better here : printf("are married?, please enter y yes , n no\

html - Applying style to <a href> tag placed inside C# code -

i using html code inside .cs file design template sending emails. have added style tag <a href> tag, not take effect when email sent. here code: public static void email() { stringbuilder sb= new stringbuilder(); sb.append("<a href='#' style='font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:14px;color:#fff;text-decoration:none;line-height:2em;font-weight:bold;text-align:center;display:inline-block;border-radius:5px;text-transform:capitalize;background-color:#208ed5;margin:0;border-color:#208ed5;border-style:solid;border-width:10px 20px' target='_blank'>"); sb.append("link</a>"); } escape quotes backslash: style=\"font-family:\'helvetica neue\',helvetica,arial,sans-serif;font-size:14px;color:#fff;text-decoration:none;line-height:2em;font-weight:bold;text-align:center;display:inline-block;border-radius:5px;text-transform:capitalize;background-color:#208ed5;margin

c# - How to get edited values in ObservableCollectionin WPF(MVVM) -

public class pricinggrpmodel { public string name { get; set; } public string description { get; set; } } private observablecollection<pricinggrpmodel> _mycollection; public observablecollection<pricinggrpmodel> mycollection { { return _mycollection; } set { _mycollection= value; onpropertychanged("mycollection"); } } mycollection.collectionchanged += new notifycollectionchangedeventhandler(mycollection_collectionchanged); void mycollection_collectionchanged(object sender, notifycollectionchangedeventargs e) { try { switch (e.action) { case notifycollectionchangedaction.add: break; case notifycollectionchangedaction.remove: break; } } catch(exception exception) { } } i have bound 'mycollection' observablecollection datagrid's itemssource. collection chang

Android layout_below in RelativeLayout -

Image
i came across strange issue, below layout: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="match_parent" android:layout_height="wrap_content" > <imageview android:src="@color/coloraccent" android:layout_width="match_parent" android:layout_height="200dp"/> <imageview android:id="@+id/image" android:src="@mipmap/ic_launcher" android:layout_centerinparent="true" android:layout_width="wrap_content" android:layout_height="wrap_content"/> <textview android:text="text" android:layout_below="@+id/image" android:layout_width="wrap_content" android:layout_height="wrap_content"/> </relativelayout> textview not below imageview expected, it's below original position of imageview . if set layout_

php - Define default values for Laravel form fields -

to pre-populate form field, can add 'value' form field in create.blade.php: {{ form::text('title', 'some default title') }} is there way task elsewhere (maybe in model or controller?). i'd have code form fields identical in create & edit view. thanks! okay, here are... used laravel's form model binding in example. (i work user model/db table). if topic not clear you, take @ http://laravel.com/docs/html#form-model-binding // controller class userscontroller extends basecontroller { ... // method show 'create' form & initialize 'blank' user's object public function create() { $user = new user; return view::make('users.form', compact('user')); } // method should store data sent form form (for new user) public function store() { print_r(input::all()); } // retrieve user's data db given id & show 'edit' form

javascript - Array.from doesn't work as a direct callback function in Array#map -

i've discovered odd behavior array.from . appears not work callback function directly when mapped on array of array-like objects. i've tested in chrome. here's test code (es6): const fails = () => { const x = { 0: 'help', length: 1 }; const y = [x].map(array.from); // throw error return y; }; const works = () => { const x = { 0: 'help', length: 1 }; const y = [x].map(item => array.from(item)); // work return y; }; console.log(works()); console.log(fails()); https://jsfiddle.net/dox6wnya/ this peculiar behavior. i'm wondering why happens. .map passes three arguments callback ( currentvalue , index , array ), , .from accepts 3 arguments ( arraylike , mapfn , thisarg ). types of arguments don't match and/or produce unexpected results; in particular " 0 not function ", 0 index argument passed mapfn . real compatible argument first one, why it's 1 should pass.

php - Executing phpunit test in laravel -

when run phpunit tests in laravel using /vendor/bin/phpunit tests executed , results generated. able tests on single file /vendor/bin/phpunit </tests/<filename> however, when execute following command fails: ./vendor/bin/phpunit ./ fatal error: class 'codeception\module\orderhelper' not found in /vendor/codeception/codeception/tests/data/claypit/tests/order/parsedloadedtest.php on line 2 but see orderhelper file still exist. <project-folder>/vendor/codeception/codeception/tests/data/claypit/tests/_support/orderhelper.php can me in this? the directory passed phpunit should directory tests are. change ./vendor/bin/phpunit ./tests , should work fine.

ruby on rails - Want to write api of twitter to post tweet without any gem/library means with curl command -

i new ruby want create api post tweet twitter without of gem include did on command line running below code: curl --request 'post' 'https://api.twitter.com/1.1/statuses/update.json' --data 'status=maybe+he%27ll+finally+find+his+keys.+%23peterfalk' --header 'authorization: oauth oauth_consumer_key="i6baqctt1scxao8ywckhuly9z", oauth_nonce="12f94f3e4b2ded3bbfdfe781de60ae73", oauth_signature="x6%2fi2w%2f0rjn4prcfma5hthozu3q%3d", oauth_signature_method="hmac-sha1", oauth_timestamp="1461568353", oauth_token="2291131736-lpqkfe5dimtung5mvq0dc5eka9u8qnigwupqau9", oauth_version="1.0"' --verbose but in controller how can use command ouath_signature , post tweet. as in php did curl want same way ion ruby. please me out of it you may use rest-client make api calls. or if don't want use gem also. try : http://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/net/http.html

javascript - ACE editor installed with bower does not find my mode -

i wrote custom mode ace editor my-mode.js ace.define('my-mode', [/* ... */], function(require, exports, module) { /* ... */ }); that try use index.js var editor = ace.edit('editor'); editor.getsession().setmode('my-mode'); i installed ace editor ( ace-builds ) , requirejs bower bower.json { "name": "my-project", "dependencies": { "ace-builds": "^1.2.3", "requirejs": "^2.2.0" } } and configured requirejs requirejs-config.js require.config({ paths: { ace: "bower_components/ace-builds/src-noconflict/ace" } }); my page looks this index.html <body> <div id="editor"></div> <script src="bower_components/requirejs/require.js"></script> <script src="requirejs-config.js"></script> <script src="bower_components/ace-builds/src-noconflict/ace.js">

C++ CFile sharing with C# App not working? -

i'm having trouble getting file created , populated c++ application read different c# application while it's still open in c++ application. i create file line: txtfile.open(m_filename, cfile::modecreate | cfile::modewrite | cfile::sharedenywrite, &e) i've tried using lines: txtfile.open(m_filename, cfile::modecreate|cfile::modewrite|cfile::sharedenynone, &e) and: txtfile.open(m_filename, cfile::modecreate|cfile::modewrite, &e) with same results. then in c# app i've tried 2 different ways of opening file: filestream fs = file.openread(inputfilepath); byte[] buffer = new byte[fs.length]; fs.read(buffer, 0, buffer.length); fs.close(); and byte[] buffer; using (filestream stream = new filestream(inputfilepath, filemode.open, fileaccess.read, fileshare.read)) { buffer = new byte[stream.length]; stream.read(buffer, 0, buffer.length); } both methods catch error: the process cannot access file 'filename.txt' because bein

windows - Migrating from Kinect SDK 1.8 to 2.0 unable to find windosPreview.Kinect.dll -

im working on kinect building project of virtual mouse using kinect sensor gestures. im facing problems while migrating new sdk 2.0 sdk 1.8. above mentioned im unable find windowspreview.kinect.dll contains of functions gesture controll in v1.8 not there in v2.0 kinect sdk 1.8 , 2.0 2 different sdks. they use different ideas , api gesture recognition capabilities, if planning reuse library made sdk 1.8, option rewrite library or find newer version sdk 2.0.

php - Create a Custom Block from Observer in Magento -

i need write observer show products block @ bottom of product details page. so, have written capturing event ' catalog_product_load_after '. need create custom block can called through getchildhtml() in product details page. any appreciated. it sounds don't need observer @ if event you're waiting fire product details / view page load? might wrong please provide context , gist of want happen. i assume want add static block bottom of product's view? if so, no need add observer. to use getchildhtml('block_name') , need define in theme's catalog.xml . add following within <reference name="content"> of layout handle catalog_product_view : <block type="cms/block" name="block_name"> <action method="setblockid"><block_id>block_identifier</block_id></action> </block> then, in product view.phtml, can add: <?php echo $this->getchildhtml('block

c# - How to join nth list -

first of patience read such long question. shortest version, can produce far. this question sub question of my previous question . once clarify it, update , ask reopen can answer it my question is there practical way of nth combination of below code. i have itinerary composed connected flights count 1,2 .. n each flight may have classes such a, b, c ... i combining each flight same class here code produces combinations: //combination of 1 flightsegments var firstflightsegments = flightsegments.where(s => s.count == 1).tolist(); var origindestination = (from firstflightsegment in firstflightsegments select new origindestination { pnr = utils.generatepnr(), flightsegments = new list<flightsegment>{firstflightsegment} } ) //combinations of 2 flightsegments var firstflightsegments = flightsegments.where(s => s.count == 1).tolist(); var secondsecondsegments = flightsegments.where(s => s.count == 2)

sql - Improve query performance in MySQL -

i posting thread in order have advices regarding performance of sql query. have 2 tables, 1 called hgvs_snp 44657169 rows , on run table has average of 2000 rows. when try update field comment of run table takes lot's of time perform query. wondering if there method increase sql query. structure of hgvs_snp table: +-----------+-------------+------+-----+---------+-------+ | field | type | null | key | default | | +-----------+-------------+------+-----+---------+-------+ | snp_id | int(11) | yes | mul | null | | | hgvs_name | text | yes | | null | | | source | varchar(8) | no | | null | | | upd_time | varchar(32) | no | | null | | +-----------+-------------+------+-----+---------+-------+ my run table has following structure: +----------------------+--------------+------+-----+---------+-------+ | field | type | null | key | default | | +----------------------+

c# - Powerpivot Odata feed provide credentials -

Image
i created odata web services hosted in secure server, access these services, user need provide credentials gets authenticated using cookie (tmg fore front server forms) how can provide credentials table import wizard > connect data feed ? as 401 when enter svc , test connection. update quiet weird giving me 401 if button clicked after putting url it, tried start again, instead of adding url, clicked on advance button , can see now, now if add password , userid, error, ============================ error message: ============================ remote server returned error: (401) unauthorized. ============================ call stack: ============================ @ system.net.httpwebrequest.getresponse() @ microsoft.analysisservices.common.datasourcebasic.updatedatafeedparametersinternal(connectionstringbuilder connbuilder, idatasource datasource, boolean checkfeedvalid, boolean fkeepalive) @ microsoft.analysisservices.common.datasourcebasic.updatedatafeedp

Ajax load from LAN's mysql using chrome app -

i trying ajax load lan's mysql using chrome app. i proposing ajax because need chrome app load update in sql instantaneously. since app used in lan network, presume there no need maintain web server (aka running apache). can provide hints answer found on forum not me (an absolute newbie) much. https://developer.chrome.com/extensions/xhr thank you. yy since app used in lan network, presume there no need maintain web server (aka running apache). ajax refers making http request to.. something. something can answer http requests called web server. so, need some sort of web server. may component of mysql server, it's still web server. that said, doesn't mysql has supported http interface. there experimental http plugin provides rest api, it's experimental . therefore, need separate server application need. that said, i proposing ajax because need chrome app load update in sql instantaneously. ajax not magic bullet. works re

linux - ncurses disable kernel messages on console screen? -

im looking way how rid of (kernel?) messages appear in ncurses app. wrote app myself, prefer api redirects these messages /dev/null. mean messages like, usb stick inserted. i tried add this, unfortunately doesn't work freopen("/dev/null", "w", stderr); i'm not running x, ncurses direct console. i mean messages like, usb stick inserted. thanks! update 1: someone votes close question because not related programming. is, wrote ncurses app myself, i'm looking way how disable kernel message. updated question. update 2: let me explain i'm doing, , whats problem in more detail: i'm using tiny core linux, thats after boots starts (self written) ncurses program. when example connect usb drive, message (i suspect kernel) shown on program. guess message written straight framebuffer. im using tc 5.x since need 32 bit, im running root , have full access os. you should able use openvt have program run on new virtual terminal. i

How to enable or disable a button based on a value in angularjs? -

how enable or disable button according select value? want button disabled once select value changed vaue "xxxx" button enabled. use ng-disabled directive this: <div class="form-group"> <label class="control-label"> etat</label> <select class="form-control" name="singleselect" ng-model="demande.etat"> <option value="etude">etude</option> <option value="accepte">accepte</option> <option value="refus">refus</option> </select><br> </div> and in button markup use this: <button ng-disabled="demande.etat != 'accepte'"> .... </button>

python - Taking only 1 on 3 <tr> -

i'm parsing website extract data in python using xpaths. but don't know how thing : <tr> </tr> <tr> </tr> <tr> data </tr> <tr> </tr> <tr> </tr> <tr> data </tr> <tr> </tr> <tr> </tr> <tr> data </tr> i know can //tr[3] thrid one. how can thirds ? use position funxtion , take remainder of division 3. because xpath understand 0 false, can write //tr[not(position() mod 3)]

java - Bundle an application inside IzPack -

i have software needs config.xml file during installation. what zip "software.exe" "config.xml" , give our customers. un-zip , launch software. we remove un-zip part , bundle "software.exe" , "config.xml" produce software2.exe launch software.exe. the difficult part zipping operation taking place during server installation izpack. so there way, during izpack installation, produce "pack" file specified? wanted use innosetup i'm not sure can use external program inside izpack..

c++ - std::vector segmentation fault during push_back -

i have class named book, contains books. #ifndef book_h #include<string> #include<vector> #include<iostream> #define book_h class book { public: std::string author, title; int year; book(){} book(std::string author, std::string title, int year); ~book(){} void add_book(); std::vector<book*>library; }; #endif book.cpp file #include "book.h" book::book(std::string author, std::string title, int year) :author(author), title(title), year(year){} void book::add_book() { int y; std::string a, t; std::cin>>a; std::cin>>t; std::cin>>y; library.push_back(new book(a, t, y)); } but when want add new book library, i'm getting segmentation fault during push_back of new object in main.cpp file #include "book.h" int main() { book* ptr; ptr->add_book(); return 0; } could explain me problem is? i'm new in oop, , though i've read lot of po

Sending Emails from java using specific Gmail accont -

i have email hosting account company gmail , trying send emails account in java facing following error: javax.mail.authenticationfailedexception: 534-5.7.14 <https://accounts.google.com/signin/continue?sarp=1&scc=1&plt=akgnsbsf 534-5.7.14 i7zvgrt2ia4he_atvycpueorgulhg4yvg6hw_jgdagbyukbfjysvdr_xvkzlzzqp88f-un 534-5.7.14 aogu0un-ubur91zw7jsbzeq8ojr6fejfqcpsvkpv9glaupy3ee-puk3y6enabfea8dgdlu 534-5.7.14 fndqwlg_r1i5-veywj8qe73r833f8phwfurancjtkypjqogqo-vrbg6omrzhsp3i-8wphr 534-5.7.14 ajvaiqquhwnrurmkjyk6rkajnyaia> please log in via web browser , 534-5.7.14 try again. 534-5.7.14 learn more @ 534 5.7.14 https://support.google.com/mail/answer/78754 w77sm17182835wmw.10 - gsmtp and here properties using in code: final string username = "email@mycompnay.com"; final string password = "********"; final string host = "smtp.gmail.com"; final string port = "587"; // creating properties object properties prop

java - How to use Spring Security @Pre and @Post annotations with collections -

we using spring security's acl annotations allow access web services. @preauthorize , @postauthorize seems extremely useful , favours of use cases having. spel based rules on individual methods et al helping in fine grain security on application , services. for eg:- check owner of returned object below @preauthorize("hasrole('role_admin') , returnobject.owner == authentication.name") public somedto getsomedto(){ ... } this works fine when single object returned. equivalent if list returned? how loop through collection , check individual element properties in collection using spel? in case of collection should use @prefilter , @postfilter annotations. when using @postfilter annotation, spring security iterates through returned collection , removes elements supplied expression false. name filterobject refers current object in collection. can filter before method call, using @prefilter, though less common requirement. see exam

php - "visibility:hidden;" is not working with TCPDF -

i try html pdf tcpdf but wrong the css visibility property not working me this php code: <?php include main tcpdf library (search installation path). require_once('tcpdf_include.php'); create new pdf document $pdf = new tcpdf(pdf_page_orientation, pdf_unit, pdf_page_format, true, 'utf-8', false); set document information $pdf->setcreator(pdf_creator); $pdf->setauthor('nicola asuni'); $pdf->settitle('tcpdf example 061'); $pdf->setsubject('tcpdf tutorial'); $pdf->setkeywords('tcpdf, pdf, example, test, guide'); set default header data $pdf->setheaderdata(pdf_header_logo, pdf_header_logo_width, pdf_header_title.' 061', pdf_header_string); // set header , footer fonts $pdf->setheaderfont(array(pdf_font_name_main, '', pdf_font_size_main)); $pdf->setfooterfont(array(pdf_font_name_data, '', pdf_font_size_data)); // set default monospaced font $pdf->setdefaultmonosp

Meteor passing variable from template to iron router -

i'm wondering if possible access variable / method of template in iron:router. my problem : want reset lot of stuff launched template (timer / subscription / whatever) on page unload (from change page menu) but window.onbeforeunload triggered when changing url. iron:router not reffreshing page , way found unload event passing iron:router's unload event. there, can't access template variable or method. way found @ moment passing reset var session... , find awful ! router.route('/printlist', { name: 'printjoblistlist', unload: function () { var reset = session.get("sessiontestironrouter"); } have got advice, tips , bests ways ? :) ok, solved this, not clean though. i declared globalhelper in template client size : template.registerhelper('functiontocall', function () { // code here }); and in unload iron's route : router.route('/template', { name: 'mytemplate', unload: function

linux - Kernel and Rootfs booting through tftp -

task: load kernel , rootfs image , execute ram without storing onto spi flash i loaded flashable image (zimage @ 0x200000) , flashable rootfs (jffs2 @ 0x200000+offset) tftp zimage 0x200000 tftp jffs2 0x200000+offset bootm 0x200000 0x200000+offset it giving me error: root-nfs: no nfs server available, giving up. vfs: unable mount root fs via nfs, trying floppy. vfs: cannot open root device "ram0" or unknown-block(2,0) please append correct "root=" boot option; here available partitions: 1f00 256 mtdblock0 (driver?) 1f01 256 mtdblock1 (driver?) 1f02 2048 mtdblock2 (driver?) 1f03 13824 mtdblock3 (driver?) kernel panic - not syncing: vfs: unable mount root fs on unknown-block(2,0) and : bad magic number any appreciated @sawdust, right. jffs2 cannot used in ram if initrd or initramfs. i loaded both images onto ram , executed onto ram based on ext2 filesystem. bootargs: setenv bootargs root=/dev/ram0 console=ttymcs m

c# - PL/SQL call doesn't return entire varchar2 return value -

i wrote procedure in pl/sql. @ end of procedure have this: create or replace procedure lottery_titlebook(pout_count out varchar2) --get title-book. cursor s1 select * gilads.titlebook; rand float; randg varchar2(100); titlename varchar2(100); counter number(38); temp number(38); res_row s1%rowtype; begin counter := 0; temp:=0; --make random number generator: randg := to_char(systimestamp,'yyyyddmmhh24missffff'); dbms_random.seed (val => randg); --count how many title-book in cursor s1 open s1; loop fetch s1 res_row; exit when s1%notfound; counter := counter +1; end loop; close s1; --the random number 1 counter rand := dbms_random.value(low => 1, high => counter); --get titlebook.id determined random number: open s1; loop fetch s1 res_row; exit when s1%notfound; titlename := res_row.title; temp := temp + 1; if temp >= rand or temp = counter exit; end if; end loop; close s1; --print title book: pout_count:

mysql workbench - selected ID from table 1 to retrieve username from similar id in table 2 vb.net -

i've have 2 tables. recipes , foodcategories recipes table: id| recipe name |description|foodcategoryid| --+---------------------+-----------+--------------| 1 | chicken soup | ********* | 3 | 2 | sunrise surprise | ********* | 1 | 3 | toated ham & cheese | ********* | 5 | foodcategories table: foodcategoryid | foodcategory | ---------------+--------------| 1 | breakfast | 2 | lunch | 3 | dinner | 4 | snack | 5 | brunch | the recipes table have displaying on windows form in datagridview1. once user clicks on row pops new form several text boxes filled data row clicked on. textbox have trouble foodcategory textbox named categorytxtbox . displays foodcategoryid foodcategories table , need display foodcategory. the code have sofar is: private sub datagridview1_cellclick(byval sender object, byval e datagridviewcelleve

PHP XML reversed array sizeof() and count() returns incorrect values -

i've been trying figure out why code, simple is, not work way want to. the problem i'm having getting correct values when trying check sizeof() or count() on reversed simplexml array. i'm making comments form stores comments comments.xml, reads 5 newest comments , lists them newest on top, oldest on bottom. what have inside comments.xml: <root> <entry> <name>admin</name> <comment>some nice comment</comment> <postedon>07.07.2013</postedon> <postedby>***.***.***.***</postedby> </entry> </root> what have inside .php: <?php $xml = simplexml_load_file("comments.xml"); $reversearray = (array) $xml; $reversearray = array_reverse($reversearray["entry"]); $limit = sizeof($reversearray); //$limit = count($reversearray); if($limit > 5){ $limit = 5; } ($i = 0 ; $i < $limit; $i++){ echo "<div class='panel'>"; echo "<span

typescript - Extending component decorator with base class decorator -

i have several component decorator declarations repeat on every component, example: @component({ moduleid: module.id, directives: [bootstrapinputdirective] }) how can apply these declarations components? tried create base class decorator , extend other classes base class decorations doesn't seem apply derivative classes. @component decorator. means handles class applies on adding metadata data leveraging reflect-metadata library. angular2 doesn't metadata on parent classes. reason, it's not possible use decorators on parent classes. regarding bootstrapinputdirective directive, define platform one. way wouldn't need include each time directives attribute of components. here sample: (...) import {platform_directives} 'angular2/core'; bootstrap(appcomponent, [ provide(platform_directives, {usevalue: [bootstrapinputdirective], multi:true}) ]); edit yes, create own decorator implement this. here sample: export function custo