Posts

Showing posts from May, 2010

java - How to store comma separated argument using scanner -

i taking user input using scanner , want store 2 argument given command line how ever able one. believe hasnextint() returns boolean value if there nextint, when enter non-int value doesnot break loop. i have checked sources online , on stackoverflow before posting questions did not looking for. scanner s = new scanner(system.in); int first = 0; int second = 0; system.out.println("please enter number: "); s.usedelimiter(","); while (s.hasnextint()) { first = s.nextint(); system.out.print("firstargument: " + first + "\n"); second = s.nextint(); system.out.print("secondargument: " + second + "\n"); } the problem code calls s.hasnextint() every odd-numbered input, tries take each even-numbered input without performing check. therefore, requires inputs this: 1,2,3,4,5,6,done 1,2,3,4,done 1,2,done however, inputs result in exception: 1,2,3,4,5,done 1,2,3,done 1,done note non-numeric input ...

Error setting up Kubernetes with Vagrant -

Image
when run kubernetes vagrant setup script: export kubernetes_provider=vagrant curl -ss https://get.k8s.io | bash i get: validating master validating minion-1 waiting each minion registered cloud provider error: couldn't read version server: https://10.245.1.2/api:dial tcp 10.245.1.2:443: connection refused anyone know how can fix this? it looks issue gone, i've tried 1 more time , installation went flawlessly:

Java find object reference -

i have panel more buttons of buttonclass different names. how can find out when click finish button on button clicked first(which object of buttonclass) , modify name ? public class buttonclass extends jbutton{ public string name; public buttonclass(string name){ this.name = name; this.addactionlistener(new buttonlistener()); } public class buttonlistener implements actionlistener { public void actionperformed(actionevent e) { jframe frame = new jframe(); jbutton finish = new jbutton("finish"); finish.addactionlistener(new finish()); panel.add(finish); frame.add(panel); frame.setfocusable(false); frame.setsize(1600,900); frame.setlocationrelativeto(null); frame.setvisible(true); frame.setdefaultcloseoperation(jframe.dispose_on_close); } } } and other actionlistner trying create finish butt...

ios - Removing object added in storyboard -

if want release uicollectionview in uiviewcontroller code, setting self.typecollectionview = nil; enough? no, have remove view hierarchy calling removefromsuperview method [typecollectionview removefromsuperview] the code using sets outlet nil doesn't remove view view hierarchy if outlet weak property/reference have call removefromsuperview . if strong 1 should set outlet nil .

java - Assign a name to every element of an array? -

is possible assign name every element of array? example in array myarr[5] , can give myarr[0] name "first", myarr[1] "second" , on? , if not, might feasible way achieve similar result? use map : map<string, whatever> yourmap = new hashmap<>(); yourmap.put("first", something); yourmap.put("second", somethingelse); then, elements out: system.out.println(yourmap.get("first")); // prints something.tostring() system.out.println(yourmap.get("second")); // prints somethingelse.tostring() // etc. but if you're going use "first" , "second" keys, you're better off using array. maps useful when it's more convenient access things using arbitrary objects rather simple integers keys.

c# - How to change FontFamily for Textbox while defined in Window -

i have issue defining fontfamily textboxes applicationwide, because font family defined @ window level style : <style targettype="window" > <setter property="fontfamily" value="lucida sans unicode"/> <setter property="fontsize" value="10pt"/> </style> i have defined font-family textboxes way : <style targettype="{x:type textbox}"> <setter property="fontfamily" value="arial"/> <setter property="fontsize" value="10pt"/> </style> however, textbox style not applied, , text textboxes still lucida, , not arial. how can ? there css-like !important equivalent in xaml style override previous 1 ? i notice appreciate xaml way perform on resourcedictionaries. thanks answers it working me. defined 2 styles, 1 window, 1 special text box. special style wins , result arial 30pt. if comment special style window style...

delphi - Where is the TIWFile.Filename property? -

i have old program made in delphi 7, using intraweb 80. i'm porting delphi xe8, latest intraweb library xiv. seems tiwfile control last version of intraweb missing tiwfile.filename property. i've been using e.g.: fname := iwfile1.filename; // iwfile1 1 tiwfile control this fails compile due missing property. happened tiwfile.filename property? should use instead?

nscalendar - NSCalendarUnit.Type doesnt have a member named CalendarUnitWeekDay -

let currentdayofweek = nscalendar.currentcalendar().component(.calendarunitweekday, fromdate: nsdate()) in place error: nscalendarunit.type doesnt have member named calendarunitweekday it doesn't, have weekday , can used in way: let calendar = nscalendar.currentcalendar() let component = calendar.component(.weekday, fromdate:nsdate())

python - Use main class' properties in subclass? -

sample: from django.db import models class basemodel(models.model): choices = ((0, 'nope'), (1, 'yep'),) # ... class p(basemodel): p = models.smallintegerfield(default=1, choices=basemodel.choices) it's unnecessary inherit basemodel if use basemodel.choices .but must inherit because other column. how let p inherit choices property instead of using it's father's choices ? in example p not inherited field, cannot "inherit" basemodel . p (the subclass) will inherit choices basemodel @ point field p defined p class doesn't yet exists (it exists after end of class statement body), cannot reference p.choices @ point, , since name choices not defined in p class statement's body, cannot reference either. snippet plain simple , obvious solution.

angularjs - Can't seem to be able to bind simple data to ons-list-item in Onsen UI -

i've been fighting getting onsen ui based app (running in monaca ) populate <ons-list-item> data , can't seem find right magic syntax. i started "sliding menu" sample template , works fine, choosing menu item navigates specific page, e.g.: announcements.html <ons-navigator var="mynavigator"> <ons-page> <ons-toolbar> <div class="left"> <ons-toolbar-button ng-click="app.slidingmenu.togglemenu()"><ons-icon icon="bars"></ons-icon></ons-toolbar-button> </div> <div class="center">announcements</div> </ons-toolbar> <ons-list> <ons-list-item modifier="chevron" ng-repeat="item in items">{{item.title}} ({{item.description}})</ons-list-item> </ons-list> </ons-page> </ons-navigator> if change ng-repeat attribute value items in [1,2,...

mysql - SQL Query is updated when user updates Excel -

i have excel document want link sql query. in excel document have list of item numbers. whenever item number gets changed want sql query query list of item numbers , return output. want excel sheet use item number parameter database item numbers ? excel item numbers updated daily. keep in mind mock example trying do. no knowledge of database or spreadsheet, can't guarantee of work. @ least, require make adjustments before can use it. with in mind, have commented on various parts of code let know going on there. sections have *** areas may want change. sections ### areas have change work you. this code assumes have list of item numbers in column of sheet 1, each item number return 1 record, , there no blank cells in list of item numbers. sub grabiteminfo() dim objado new adodb.connection dim objrecset new adodb.recordset dim objcmd new adodb.command dim strconn string dim strsql string dim rownum long dim errnum long 'open connection database '### chan...

Chart not clearing properly c# -

when getvalue button pressed chart behaves expected, when clearchart button pressed chart clears, numbers on x axis decimals e.g 1.99999999,2.99999999. seems x axis not being reset scroll bar @ bottom not keep right after chart cleared. how chart clear , start off @ start of program? here code. int i; random rnd = new random(); private void chart_load(object sender, eventargs e) { chart1.series.add("temp"); chart1.series["temp"].charttype = seriescharttype.spline; chart1.series["temp"].isvisibleinlegend = false; } private void getvalue_click(object sender, eventargs e) { chart1.chartareas["chartarea1"].axisx.scaleview.zoom(0, 20); chart1.chartareas["chartarea1"].axisx.scaleview.smallscrollsize = 20; chart1.series["temp"].points.addxy(i, rnd.next(1, 10)); i++; chart1.chartareas["chartarea1"].axisx.scaleview.position = chart1.series["temp"].points.count - chart1.chartareas["chartarea1"].a...

python - Basic Variable Indexing -

how do simple index/array in python? example, in traditional basic language, have like 10 dim v(5) 20 n = 1 5:v(n)=2^n+1/n:? n,v(n):next which output: 1 3.0 2 4.5 3 8.33333333333 4 16.25 5 32.2 if wanted weights of gaussian quadrature, do: ul=5 [x,w] = p_roots(ul) n in range(ul):     print n,w[n] which works: 1 0.236926885056 2 0.478628670499 3 0.568888888889 4 0.478628670499 5 0.236926885056 but if try basic, seem be ul=5 n in range(1,ul+1):    v[n]=2**n+1.0/n    print n,v[n] which rejects as    v[n]=2**n+1.0/n nameerror: name 'v' not defined and if try mimic gaussian example ul=5 [v]=2**ul+1.0/ul n in range(1,ul+1):    print n,v[n] i get    [v]=2**ul+1.0/ul typeerror: 'float' object not iterable in terms of arrays/indexing, isn't v[n] same w[n] (which works in example)? of python documentation seems jump more complicated cases, without providing more rudimentary examples above. your errors seem clear: in...

Postgres (8.0.2., Redshift) SQL function definition, error "The cursor is not located inside a statement" -

i super noob in postgresql. need define func map: int --> datetime after reading documentation i've come this: create function fut(num integer) returns datetime -- convert unix time integer datetime timestamp $$ select timestamp 'epoch'+interval '1 second'*num; $$ language plpgsql; select fut(500); but returns the cursor not located inside statement! could please point me doing wrong here? as far knew redshift doesn't permit user-defined functions. yeah: http://docs.aws.amazon.com/redshift/latest/dg/c_unsupported-postgresql-features.html : user-defined functions , stored procedures . think you're plain out of luck. a search redshift epoch timestamp or redshift to_timestamp finds lots of other people have looked already: http://yiyujia.blogspot.com.au/2014/04/redshift-convert-integer-to-timestamp.html http://www.valkrysa.com/tech/2015/1/30/amazon-redshift-converting-unix-epoch-time-into-timestamps etc. the sen...

amazon s3 - Logstash S3 output plugin codec issue -

i experiencing strange behavior logstash, using combination of codecs on input/file , output/s3. there seems issue output/s3 logstash plugin, cannot part files upload s3 unless specify codec in output/s3 plugin. i tailing java application log files, ideally using input/file plugin watch log files in directory , make sure stack traces encountered (and new lines) wrapped same logstash event. this: input { file { path => "c:/some/directory/logs/*" codec => multiline { pattern => "^%{datestamp}" negate => true => "previous" } } } this append stack traces parent events. want perform 2 different output/s3 operations (essentially recreating raw log line line, , uploading event json) : output { s3{ access_key_id => "mykey" secret_access_key => "myseckey" region => "us-east-1" bucket => "somebucket" size_file =...

c# - MouseEvent not working in chart Area -

Image
i writing program gives quick visual display of mysql data, add feature gives coordinates of mouse location when mouse on chart. problem is, mouse events work outside chart area in red, anytime try mouse event such as: move/click/rightclick/scroll on chart area (red area), not work. here simple piece of test code used: void chart1_mouseclick(object sender, mouseeventargs e) { messagebox.show(""); } clicking displays message box if clicked outside chart area (i.e. below red box in picure), while mouse on chart, nothing happens. the answer add line of code in form designer: (thanks comment jstreet letting me know) this.chart1.mouseclick += new system.windows.forms.mouseeventhandler(this.chart1_mouseclick);

C# Winforms DateTimePicker Custom Formatted to Tenths of a Second / Default Selection to Seconds -

Image
my application uses datetimepicker custom formatted display hh:mm:ss. how can format allow tenths of second? second question when tab datetimepicker, hours section selected first default, there anyway change seconds selected first default? noticed if click updown arrows without tabbing control seconds section selected default. any experts on datetimepicker out there? or have ideas on alternative can use implement these features? below picture of how formatted properties: you try force datetimepicker display milliseconds, painful experience. better off using maskedtextbox . can download timepicker.cs sourceforge: https://sourceforge.net/projects/time-picker/ here sample code: [stathread] static void main() { application.enablevisualstyles(); form f = new form(); var dp = new timepicker("hh:mm:ss.f", true) { location = new point(100, 100) }; dp.byvalue[2] = false; f.controls.add(dp); var bt1 = ...

ios - Swift UIScrollView setZoomScale Zooming To Wrong Point -

i have zoomable uiimageview within uiscrollview . if user double taps on image, uiscrollview zoom in until image fills screen. have zoom scale set in code. part of code works great. here code: func scrollviewdoubletapped(tapgesture: uitapgesturerecognizer) { // zoom zoom scale if @ min zoom, else zoom min zoom if (scrollview.zoomscale == scrollview.minimumzoomscale) { scrollview.setzoomscale(zoomscale, animated: true) } else { scrollview.setzoomscale(scrollview.minimumzoomscale, animated: true) } } the problem comes if want zoom specified zoom scale right when view loaded. when attempt zooming, offset incorrect. have println within function scrollviewdidendzooming show me offset, scale, , anchor point. func scrollviewdidendzooming(scrollview: uiscrollview, withview view: uiview!, atscale scale: cgfloat) { println("did end zooming scale: \(scale)") println("offset: \(scrollview.contentoffset)") println("...

java - How do I find out why Eclipse is stuck in an endless build cycle? -

i've got eclipse building maven project imported. have build automatically checked , eclipse building. builds , waits few seconds , builds again without me making changes. noticed happens when server running i'll include info on setup here: have local install of tomcat. eclipse set start tomcat points tomcat executables directory of own making (server location set "use workspace metadata"). eclipse set "automatically publish when resources change". as far know, eclipse (or eclipse's embedded maven) building target directory @ root of project. possible eclipse doesn't realize target directory not supposed scanned changes? there 0 references checked under project properties -> project references. i'm @ loss might be. if there other settings me confirm, please let me know. this seems same problem none of answers seem apply me. i'm not sure original poster's comment "added annotation processing project interfere bui...

php - htaccess rewrite specific parameter with dot -

i have issue rewrite url like: http://examplepage.com/news/?aid=n_557eb95ed07360.45147988 to http://examplepage.com/some-other-name but needs url if parameter changes should nothing. think problem dot in parameter? my current .htaccess matter this: rewritecond %{query_string} ^aid=n_557eb95ed07360.45147988$ rewriterule ^news/$ /some-other-url [nc,l] any appreciated. thanks. as drakes said, adding escape dot should trick. rewritecond %{query_string} ^aid=n_557eb95ed07360\.45147988$ rewriterule ^news/$ /some-other-url [nc,l] or, if aid going dynamic, can use: rewritecond %{query_string} ^aid=(.*)$ and if want search aid part of query: rewritecond %{query_string} !(^|&)aid=(.*)$

php - How can I access an array/object? -

i have following array , when print_r(array_values($get_user)); , get: array ( [0] => 10499478683521864 [1] => 07/22/1983 [2] => email@saya.com [3] => alan [4] => male [5] => malmsteen [6] => https://www.facebook.com app_scoped_user_id/1049213468352864/ [7] => stdclass object ( [id] => 102173722491792 [name] => jakarta, indonesia ) [8] => id_id [9] => el-nino [10] => alan el-nino malmsteen [11] => 7 [12] => 2015-05-28t04:09:50+0000 [13] => 1 ) i tried access array followed: echo $get_user[0]; but displays me: undefined 0 note: i array facebook sdk 4 , don't know original array strucutre. how can access example value email@saya.com array? to access array or object how use 2 different operators. arrays to access ...

angularjs - $watch not called when model property changes -

i starting angular , trying understand $watch function in scope api. here link js fiddle : js fiddle watch demo not working var myapp = angular.module('myapp1', []); angular.element(document).ready(function() { angular.bootstrap(document, ['myapp1']); }); function mycontroller($scope){ var mc = this; mc.focus = { 'name' :false, 'email':false }; $scope.$watch(mc.focus,function(oldval,newval){ console.log(oldval); console.log(newval); },false); mc.allfilled = false; mc.setfocus = function(prop) { mc.focus[prop] = true; }; }; myapp.controller("mycontroller",mycontroller); what want : 1) have 4 inputs have included 1 in above link brevity , demo. 2) each of inputs has corresponding keys in focus object initial values false. 3) changing property value true in focus object whenever appropriate input element focused using setf...

winapi - Low Level keyboard hook c++ -

i tried create application in c++ sets low level keyboard hook , each time user presses key write char of string made. can explain how can change user input without using keybd_event function changing key before os interprets it. i tried ths msg , changing wparam didn't work. if can show me code example better can explain how can change user input without using keybd_event function changing key before os interprets it. you cannot. have reject key inyour hook , post own key using keybd_event() or sendinput() . , sure check if kbdllhookstruct::flags field has llkhf_injected or llkhf_lower_il_injected flag enabled don't reject own simulated keys. i tried ths msg , changing wparam didn't work the msg structure not used wh_keyboard_ll hook.

asp.net - ProfiledDbConnection.cs not found -

i'm trying install umbraco in new, empty visual studio express 2013 project. the installation seems go ok , project builds ok when try run following error: profileddbconnection.cs not found i've found couple of references error message on none of them seem relate fresh installs , unclear how progress. can shed light on how fix this? i've never invested time bottom of can skip on or stop debugger , reattach when site has loaded. doesn't stop site running , think exception thrown in dependency somewhere handled before bubbles client.

c++ - char array outputting as weird symbols -

so ive been learning classes, , in main function when run it, shows character array members incorrectly. main program: #include <iostream> #include "account.h" #include "account.cpp" using namespace std; int main(){ char num [] = "2435457"; char name [] = "bob joe"; account bob(10000, num, name ); bob.show_account(); cout << num; // should output correctly, shows '♦' return 0; } output: account info: account holder : account number :♦ balance :10000 ♦ whats weird using cout<< directly on char array num shows '♦'. when copy char num [] = "2435457" new program like: #include <iostream> //including same headers not affect #include "account.h" //the output #include "account.cpp" using namespace std; int main(){ char num [] = "2435457"; cout << num; return 0; } it works correctly. edited : h...

c++ - Memory leak when calculating a determinant of a matrix -

while writing code calculate determinant of simple 3 x 3 matrix, noticed started accumulate memory leaks. i've reduced method following (meaning no longer use algorithm determine size of matrix, "by hand"): double determinant(double** &m) { return m[0][0] * (m[1][1] * m[2][2] - m[2][1] * m[1][2]) - m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0]) + m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]); } i can't find problem this, since not allocate memory inside method. if change , return double ( return 1.0 , example) leak gone. happening here? edit (more code): double logmultivariatenormaldensity(unsigned char* &x, unsigned char* &mean, double** &sigma) { double det = determinant(sigma); ... } which in turn called inside loop for(unsigned int = 0; < n; i++) { logmultivariatenormaldensity(_x[i], _mean[i], _sigma[i]) } being 2d array, _sigma allocated using malloc (in both dimensions). ...

php - How to print multiple QR labels continuously using TSC TTP-244 HTML -

hello excuse english: i making application manage inventory php - html, generating qr code using google api generates charts image show image in html format label printing while continuously when printing in tsc ttp-244 printer prints 1 single label me not all. when printing on normal printer prints page breaks css styles tsc ttp-244 printer installed via usb on laptop windows 8.1 using seagull driver 7.3.8 kids thank .. have several days , have not been solution. greetings clau

grunt contrib watch - Get livereload to work with Sails.js -

i new both sails , grunt might missing obvious. trying automatically refresh sails app in browser whenever files change . i start app sails lift , runs on default port 1337 . i tried adding options: {livereload:true} grunt-contrib-watch configuration far understand need somehow inject livereload javascript page? i tried use grunt-contrib-connect livereload option inject javascript seems start server. when navigate started server ( localhost:8000 ) see folder structure. livereload javascript injected however. i want avoid livereload chrome plugin if possible. what's best way inject livereload javascript sails app? or should use tool browsersync? thank you! :) add livereload option tasks/config/watch.js module.exports = function(grunt) { grunt.config.set('watch', { api: { // api files watch: files: ['api/**/*', '!**/node_modules/**'] }, assets: { // assets...

java - Setting up Ant home in Ubuntu -

i have installed apache ant , now, trying set ant_home variable on ubuntu os , according forums , solution founds in internet, there should require edit .bash_profile file in root directory follows: ant_home=/apache-install-dir/apache-ant-version ant_opts="-xms256m -xmx512m" path=$path:$home/bin:$ant_home/bin export ant_home ant_opts path but unfortunately haven't found .bash_profile in machine's root directory. so, on situation should exact solution problem, suggestion please please provide me, in advance. if users can use ant, put config in /etc/environment for per-user setting, put ~/.profile

angularjs - AngularStrap: typeahead not works -

i tried simplest possible angularstrap typeahead example , nothing shows when type in input box. please advice.. edit: jsfiddle code angular: v1.4.2 angularstrap: v2.2.4 jquery: v2.1.4 bootstrap v3.3.5

unity3d 2dtools - Make an endless 2D map in Unity -

basically, idea game this: have rocket launch ground, , keep adding speed. rises higher , higher, want camera follow rocket, , can move rocket pick special objects , avoid obstacles. how create endless map in unity, rocket won't fly off map. thank you! // singleton. translates existing obstacles , creates additional obstacles. // world moves around player. // when object collided into, level pieces deactivated. // level ends when level pieces deactivated public class leveltranslator : monobehaviour { public static leveltranslator instance = null; // fields public bool automaticallystart = false; public bool isendless = false; // of level pieces used? public bool levelover { { if (alllevelobjects.count == 0) return true; else return false; } } // of transforms attached public transform levelparent = null; // prefab add level public list<transform> endlesslevelobject_prefabs = null; // level starts. endless!...

c# - "The UserId field is required" - entity validation error -

i'm using asp.net identity base on entity framework mvc(5) app. problem : when want register new user , entity validation error. looked @ validation error property , 2 error(both same actually) on line : var result = await usermanager.createasync(user, model.password); errors : http://i62.tinypic.com/11acy0y.png now.....i have no idea 'userid' field coming from. looked @ identityuser base classes , not belong either , there "id" field works properly. if more info needed mention in comment plz. so have idea....what field ? , how solve this? edit : forgot mention create base user in seed method of dbinitializer....that works fine. in controller error. controller & related action : // //post : /account/register [httppost] [allowanonymous] [validateantiforgerytoken] public async task<actionresult> register(register_viewmodel model) { usermanager.uservalidator = new myuservalidation(); ...

android - SpeechRecognizer throws onError on the first listening -

in android 5 faced strange problem. first call startlistening of speechrecognizer results onerror error code 7 ( error_no_match ). i made test app following code: if (speechrecognizer == null) { speechrecognizer = speechrecognizer.createspeechrecognizer(this); speechrecognizer.setrecognitionlistener(new recognitionlistener() { @override public void onreadyforspeech(bundle bundle) { log.d(tag, "onreadyforspeech"); } @override public void onbeginningofspeech() { log.d(tag, "onbeginningofspeech"); } @override public void onrmschanged(float v) { log.d(tag, "onrmschanged"); } @override public void onbufferreceived(byte[] bytes) { log.d(tag, "onbufferreceived"); } @override public void onendofspeech() { log.d(tag, "onendofspeech"); } @...

year/month/day/hour/minute/second filters in django-rest-framework -

i've defined django-rest filter this: created_date = django_filters.datetimefilter( lookup_type=["year", "month", "day", "hour", "minute", "second", "lt", "lte", "gt", "gte"]) this url proper query: created_date < 2015-05-01: http://localhost:8000/path/objects/?created_date__lt=2015-05-01 the same thing works gt for: created_date > 2015-05-01: http://localhost:8000/path/objects/?created_date__gt=2015-05-01 this url proper query: created_date > 2015-05-01 however, when try query on year: http://localhost:8000/path/objects/?created_date__year=2015 i typeerror: int() argument must string or number, not 'datetime.datetime' i tried http://localhost:8000/path/objects/?created_date__year=2015-05-01 and same error. idea how year/month/day/hour/minute/second filters working? datetimefilter filter converts input value datetime, creat...

batch file - How to make two running command-prompt windows send commands to each other on the same computer? -

i new using command-prompt programming related purposes if makes no sense or seems unclear please request elaborate , best. what hoping able have 2 command-prompt windows open on windows machine (running windows 7) , have them communicate each other. instance want cmd window tell cmd window b print contents of file , vice versa. is in anyway possible? also, know there may way polling file in 1 command-prompt window, asynchronous/non-blocking way of doing if possible. thanks in advance! i found quite simple make 2 command windows interact each other. batch file 1: :keepsending set /p message= echo set run=%message% >command.bat goto :keepsending batch file 2: :running %run% set ran=%run% :check if not "%ran%"=="%run%" goto :running call command.bat timeout 1 >nul goto :check add in counter on , guess make work in longer code interacts each other. if want work on network use poshd/popd

asp.net mvc - Delete File in SharePoint folder using C# -

i using sharepoint excelservice manipulate excel file , save shared documents folder using excelservice.saveworkbookcopy() want delete files saved earlier. best way achieve using c# in asp.net mvc application? i tried using rest service, not find tutorials , code now, webexception "the remote server returned error: (403) forbidden." tried 2 versions rest url, neither worked. var filesavepath = "http://sharepointserver/collaboration/workrooms/mywebsitename/shared%20documents/"; var excelrestpath_1 = "http://sharepointserver/collaboration/workrooms/mywebsitename/_api/web/"; var excelrestpath_2 = "http://sharepointserver/_api/web/"; public static bool deleteexcelfromsharepoint(int id, string excelrestpath) { try { string filepath = "/shared%20documents/" + id + ".xlsm"; string url = excelrestpath + "getfilebyserverrelativeurl('" + filepath + "')...

unsigned right shift '>>>' Operator in sql server -

how write unsigned right shift operator in sql server? expression value >>> 0 here e.g. -5381>>>0 = 4294961915 t-sql has no bit-shift operators, you'd have implement 1 yourself. there's implementation of bitwise shifts here: http://sqlblog.com/blogs/adam_machanic/archive/2006/07/12/bitmask-handling-part-4-left-shift-and-right-shift.aspx you'd have cast integer varbinary, use bitwise shift function , cast integer , (hopefully) hey-presto! there's result you're expecting. implementation , testing left exercise reader... edit - try clarify have put in comments below, executing sql demonstrate different results given various casts: select -5381 signed_integer, cast(-5381 varbinary) binary_representation_of_signed_integer, cast(cast(-5381 bigint) varbinary) binary_representation_of_signed_big_integer, cast(cast(-5381 varbinary) bigint) signed_integer_transposed_onto_big_integer, cast(cast(cast(-53...

vba - Toggle Button to Alternate Multipliers (Access) -

my access db helps users process timecards , prepare payroll , invoices. part of process involves taking hours generated workers , attaching rate hours billing purposes. based on current headcount, there can 2 different bill rates need applied hours. i using toggle button (named tglhcflag) user specify billing rate wish use. being done because billable headcount must specified user @ time of processing , cannot calculated data. there table (tblrates) contains rates each state of toggle button. want save value selected user toggle button access can 'remember' last rate used user in table (defaultmarkup field). value used set state of button on form load because wont change , more of convenience user. private sub form_load() me.tglhcflag.value = dlookup("defaultmarkup", "tblrates") end sub and private sub tglhcflag_click() docmd.setwarnings false if me.tglhcflag.caption = "using 50+ markup" me.tglhcflag.caption = "using < 5...

c++ - GCC compiler cannot find hpp files -

i trying install hep-mc library listed here: https://github.com/cschwan/hep-mc use on compute using instructions listed in documentation here: https://github.com/cschwan/hep-mc#installation . compile 1 of example files, typed terminal: g++ -l/usr/local/hep-mc/include vegas_mpi_ex.cpp -o vegas_mpi but these error messages: mpi_vegas_ex.cpp:1:22: error: hep/mc.hpp: no such file or directory mpi_vegas_ex.cpp:2:26: error: hep/mc-mpi.hpp: no such file or directory mpi_vegas_ex.cpp:8:17: error: mpi.h: no such file or directory in beginning of code, declarations this: #include "hep/mc.hpp" #include "hep/mc-mpi.hpp" #include <mpi.h> the tutorial states should point compiler location of "include" folder contains .hpp files, have done. guys have idea i'm doing wrong? it should noted compiler cannot find mpi.h directory though have loaded openmpi module. -l sets paths linker searches libraries link. option you're looking ...

node.js - how to define the file path in nodejs require('') with "../ " Notations? -

Image
i having trouble in defining paths in nodejs. i need define path ../../ don't understand how use .. notations. example: var core=require('../../app/server/controllers'); in meanjs 0.3 worked good. now changed mean 0.4 little different folder structure eating time define path. could give helping explanation dot notation regarding path defining single . ? aim define path of core/server/controller/core.server.controller.js file in custom directory restaurants.server.controller.js screenshot: your restaurant.server.controller.js in modules/restaurants/server/controllers directory. ../ means go 1 directory, ../../../ (up 3 directories) put in /modules . can find core.server.controller.js following core/server/controllers directories. so final require want core is: var core = require('../../../core/server/controllers/core.server.controller');

android - set style of seek bar -

i noob on android graphics , change appearance of seek bar without creating new custom view. noticed if change android:theme="@android:style/theme..." of activity in android manifest style of seek bar change. if want particular style seek bar , keep unchanged style of activity? how can see possible precompiled styles? obviously, question other views also...

ios - How to perform a query by field using a predicate? -

Image
i can't seem figure out how write nspredicate filter query search field. i'm trying search field titled "location" , search string in field , see if string "ca" matches users string "currentstate" (which ca in case, "currentstate" users location (placemark.administrativearea) assigned in string) , retrieve records match filters. here's code i'm trying use: func retrievestatemoods(lateststatemood:string) { // create query let predicate:nspredicate = nspredicate(format: "location", "\(self.currentstate)%k") // crashes here!! let sort:nssortdescriptor = nssortdescriptor(key: "creationdate", ascending: false) let query:ckquery = ckquery(recordtype: "state", predicate: predicate) query.sortdescriptors = [sort] etc... it crashes when try create predicate. here's error code: terminating app due uncaught exception 'nsinvalidargumentexception', rea...

hdfs - Apache Drill: Not able to query the database -

i using ubuntu 14.04. i have started explore querying hdfs using apache drill, installed local system , configured storage plugin point remote hdfs. below configuration setup: { "type": "file", "enabled": true, "connection": "hdfs://devlpmnt.mycrop.kom:8020", "workspaces": { "root": { "location": "/", "writable": false, "defaultinputformat": null } }, "formats": { "json": { "type": "json" } } } after creating json file "rest.json", passed query: select * hdfs.`/tmp/rest.json` limit 1 i getting following error: org.apache.drill.common.exceptions.userremoteexception: parse error: line 1, column 15 line 1, column 18: table 'hdfs./tmp/rest.json' not found i appreciate if tries me figure out wrong. ...

github - Jenkins exclude regions (Git) not working -

Image
i'm trying set jenkins project whenever push readme.md, won't trigger build. have set up: but doesn't work. whenever push, builds anyway. doing wrong here? edit: should clarify works fine if edit readme.md, , push branch. if edit readme.md on say, master, merge change develop , push develop, triggers build.

ios - Autolayout constraint is not working after animation -

this question has answer here: ios: how 1 animate new autolayout constraint (height) 6 answers i little bit new @ autolayout.i know tons of question , tutorial available regarding autolayout have not found solution.so in advance help. what requirement? i have make uiview come screen after pressing button bottom side of screen animation.(like keyboard).i have made uiview in xib file using autolayout.so far have done this. in viewdidload: //loading custom uiview containerview = [[sharingpickerview alloc] init]; [containerview loadingmenus:pickerdata]; [self.view addsubview:containerview]; in view contatains (a scrollview page controller cancel button) in viewwilllayoutsubviews: -(void)viewwilllayoutsubviews{ [super viewwilllayoutsubviews]; //changing frame of view bottom side of screen can animate later bottom top later. containerview.frame = cgrectmak...

Eclipse C++ OpenGL - Cant Build Project -

i installed eclipse on new pc (using mint 17.1 ) , run error every project far. problem when want launch project error: "launch failed. binary not found." i tried build project 2 errors: ./src/main.o: undefined reference symbol 'glenable' make: *** [opengl] fehler 1 here console log: 01:49:45 **** incremental build of configuration debug project opengl **** make building target: opengl invoking: gcc c++ linker g++ -l/usr/lib/ -l/usr/lib/x86_64-linux-gnu/mesa/ -o "opengl" ./src/main.o -lglut -lglu /usr/bin/ld: ./src/main.o: undefined reference symbol 'glenable' //usr/lib/x86_64-linux-gnu/mesa/libgl.so.1: error adding symbols: dso missing command line collect2: error: ld returned 1 exit status make: *** [opengl] fehler 1 01:49:45 build finished (took 127ms) i searched web solutions can't seem find solution works. based on error log, haven't linked -lgl . try adding libraries in linker settings

serialize queryset via django-rest-framework -

i try use updating version of drf. used code tutorial serializer = snippetserializer(snippet.objects.all(), many=true) serializer.data i should [{ 'pk': 1, 'title': u'', 'code': u'foo = "bar"\n', 'linenos': false, 'language': u'python', 'style': u'friendly' }, { 'pk': 2, 'title': u'', 'code': u'print "hello, world"\n', 'linenos': false, 'language': u'python', 'style': u'friendly' }] but got: [ordereddict([ ('pk', 1), ('title', u''), ('code', u'foo = "bar"\n'), ('linenos', false), ('language', 'python'), ('style', 'friendly') ]), ordereddict([ ('pk', 2), ('title', u''), ('code', u'print "hello, world"\n'), ('linenos', false), (...

How to convert String to int in Java while taking care underflow and overflow int? -

i converting string int using following code: int foo = integer.parseint("1234"); how can make sure int value not overflow or underflow? as documentation says , if input string not contain parseable integer, numberformatexception thrown. includes inputs integers outside of range of int . the terms "underflow" , "overflow" aren't quite terms you're looking here: refer situations have couple of integers in valid range (say, 2 billion) , add them (or perform arithmetic operation achieves similar effect) , integer outside of valid range. results in problems wrapping negatives because of two's complement , such. question, on other hand, simple case of string-encoded integers lying outside of valid range.

android - remember last page in jquery mobile -

i making jquery mobile app phonegap turorial in how read quran want keep progress user nad made , resume when reopen or clue? you can store last page visited in cookie , redirect after app loads demo -- visit page re-click run https://jsfiddle.net/ldgz38s4/ code //check if lastpage exists , redirect page if ($.cookie('lastpage')) { $( ":mobile-pagecontainer" ).pagecontainer( "change", "#"+$.cookie('lastpage')) } //store page visited in cookie $(document).on("pageshow", function (e, data) { var pageid = $.mobile.pagecontainer.pagecontainer( 'getactivepage' ).attr( 'id' ); $.cookie('lastpage', pageid) }); you need include jquery cookie plugging cookies work https://github.com/carhartl/jquery-cookie ahh realized using cordova , may have issues storing cookies in android webview. if , above code(setting , reading cookie) doesn't work check here on how enable local...

sql - How to make a normalized table of adults and children? -

adults may have 0 or more nephews , nieces. children may have 0 or more aunts , uncles. how can model normalized if adults , children stored in 1 table? this test question got wrong , clarification on. in advance! if that's similar how question worded, i'm wondering if it's partially trick question. all adults , children stored in 1 table that say, of people's information needs in 1 table, relationship between them not have be? person --- personid pk gender dateofbirth firstname lastname personrelationship --- id pk -- not needed, simple primary keys personid fk -- elder descendantid fk -- youngling find nieces/nephews of specific person: select * person p inner join personrelationship pr on p.personid = pr.personid inner join person descendant on pr.descendantid = descendant.personid p.personid = 1 find aunts/uncles of specific person: select * person p inner join personrelationship pr on p.personid = pr.descendantid inner join person ...

java - Getting error javax.sip.PeerUnavailableException: The Peer SIP Stack: gov.nist.javax.sip.SipStackImpl could not be instantiated -

i getting error following code. i have included jars necessary sip; but, still not getting why error occurring. can explain me? my code class is: import java.net.inetaddress; import java.util.arraylist; import java.util.properties; import java.util.random; import javax.sip.dialogterminatedevent; import javax.sip.ioexceptionevent; import javax.sip.listeningpoint; import javax.sip.requestevent; import javax.sip.responseevent; import javax.sip.sipfactory; import javax.sip.siplistener; import javax.sip.sipprovider; import javax.sip.sipstack; import javax.sip.timeoutevent; import javax.sip.transactionterminatedevent; import javax.sip.address.address; import javax.sip.address.addressfactory; import javax.sip.header.cseqheader; import javax.sip.header.callidheader; import javax.sip.header.contactheader; import javax.sip.header.fromheader; import javax.sip.header.headerfactory; import javax.sip.header.maxforwardsheader; import javax.sip.header.toheader; import javax.sip.header....