Posts

Showing posts from April, 2010

google chrome extension - Using REST to Invoke JSON Custom Search API -

i'm attempting json data google custom search api using javascript, have been unsuccessful @ retrieving data. this chrome extension. i've read using rest article multiple times, have still been having problems. all right results, , show json result in .html file. help/insight. popup.js file function getcurrenttaburl(callback) { var queryinfo = { active: true, currentwindow: true }; chrome.tabs.query(queryinfo, function(tabs) { var tab = tabs[0]; var url = tab.url; console.assert(typeof url == 'string', 'tab.url should string'); callback(url); }); // methods of chrome extension apis asynchronous. means // cannot this: // // var url; // chrome.tabs.query(queryinfo, function(tabs) { // url = tabs[0].url; // }); // alert(url); // shows "undefined", because chrome.tabs.query async. } function getsearchurl(searchterm, callback, errorcallback) { var mgoogleapikey = "myapikey";...

What is the expected behavior of posting a form with an expired auth token in asp.net mvc with openid connect via azure ad? -

i have asp.net mvc 5 web application uses openid connect via azure ad manage user authentication. think understand once authenticated, auth token valid 1 hour @ point owin middleware handle refreshing auth token in background without user having redirected login page , re-enter username/password. have observed watching address change in address bar of browser after auth token expires. my problem have form users stay on long time (60+ minutes) while doing interviews , entering in data. auth token expires , when user tries submit form auth token refresh happens in background , form never posted application. instead, view refreshed (from http happens after auth token refreshed) , user loses of data they've collected on last hour. is expected behavior or have configured incorrectly?

Container Managed Security, Spring Security and Authentication -

i have been looking everywhere on how can implement spring security based on container managed security model. in test case, using tomcat , it's corresponding tomcat-users.xml file. issue is, cannot spring security play (meaning pass authentication on tomcat) let app server perform authentication , have spring manage role based security once authenticated. using latest spring versions, it's java config not familiar enough xml based config. have read many examples talk using preauthenticatedauthenticationprovider examples poor not mention spring documentation quite confusing imho. downloaded sample preauth code spring security git hub still cannot see how example code tied authentication tomcat performing. when run spring sample code preauth, doesn't authenticate of users in tomcat-users xml file deployed code tomcat 8. wondering if has ideas on can in order understand how spring security , authentication performed tomcat (container managed) happens? update: appe...

Getting undefined setting object's property value using this in javascript -

i trying set fullname property of object person using this , got undefined when logging out full name. var person = { name:'yask', fullname: this.name + ' srivastava' } console.log(person.fullname); this strange, using this while using inside function refers object. here looks it's being referred global object.(window maybe..?) you can use of getter , var person = { name:'yask', fullname(){ return this.name + ' srivastava' } } console.log(person.fullname); basically this in case point context of lexical scope function of object, not object itself.

regex - Breaking up PascalCase in R -

i have series of character strings using pascalcase. "bobdylan" "mikhailgorbachev" "helpfulstackoverflowpeople" i want function in r put spaces between each word. have achieved perl regular expression , gsub( ) function. essentially, putting space before every capital letter not first letter of string. gsub("(?!^)(?=[a-z])", " ","bobdylan",perl=true) [1] "bob dylan" however, of words in list may have capitalized abbreviations in them not want have separated spaces. "bobdylanusa" "mikhailgorbachevussr" "helpfulstackoverflowpeople" applying same syntax before create spaces between every capital letter. gsub("(?!^)(?=[a-z])", " ","mikhailgorbachevussr",perl=true) [1] "mikhail gorbachev u s s r" however, abbreviations stay same. desired output following. [1] "bob dylan usa" [1] "mikhail gorbachev ussr" [1] ...

asp.net core mvc - The required column was not present in the results of a 'FromSql' operation -

i've starting learning mvc6 ef7. have stored proc i'd return portion of fields in model. if don't return every field in model, i'm getting "the required column 'firstname' not present in results of 'fromsql' operation". is there way make columns not required can return portion of fields in model? model: public class loginviewmodel { [key] public int userid { get; set; } [required] [display(name = "username")] public string username { get; set; } [required] [datatype(datatype.password)] [display(name = "password")] public string password { get; set; } [required] [datatype(datatype.password)] [display(name = "protected id")] public string protectedid { get; set; } public string firstname { get; set; } public string lastname { get; set; } } my proc testing: create procedure [dbo].[aaa_topxxuserstest] @numtoreturn int = 10 begin set noc...

multithreading - How to execute multiple django celery tasks with a single worker? -

here celery file: from __future__ import absolute_import import os celery import celery # set default django settings module 'celery' program. os.environ.setdefault('django_settings_module', 'ets.settings') django.conf import settings # noqa app = celery('proj', broker='redis://myredishost:6379/0', backend='redis://myredishost:6379/0', include=['tracking.tasks']) # optional configuration, see application user guide. app.conf.update( celery_task_result_expires=3600, ) if __name__ == '__main__': app.start() here task file: @app.task def escalate_to_sup(id, group): escalation_email, created = escalationemail.objects.get_or_create() escalation_email.send() return 'sup email sent to: '+str(group) @app.task def escalate_to_fm(id, group): escalation_email, created = escalationemail.objects.get_or_create() escalation_email.send() r...

sql server - Split date range to multiple rows using SQL -

i have table: startdate enddate other_columns 1956-05-06 00:00:00.000 1960-04-05 00:00:00.000 myvalues i need query return results as: startdate enddate other_columns 1956-05-06 00:00:00.000 1956-12-31 00:00:00.000 myvalues 1957-01-01 00:00:00.000 1957-12-31 00:00:00.000 myvalues 1958-01-01 00:00:00.000 1958-12-31 00:00:00.000 myvalues 1959-01-01 00:00:00.000 1959-12-31 00:00:00.000 myvalues 1960-01-01 00:00:00.000 1960-04-05 00:00:00.000 myvalues basically query explode rows yearly results. need start , end dates retained. thanks! create table #inputtable ( startdate datetime, enddate datetime, other_columns varchar(20) ) insert #inputtable values('1956-05-06','1960-04-05','myvalues'); select * #inputtable output: startdate enddate other_columns 1956-05-06 00:00:00.000 1960-04-05 00:00:00.000 myval...

javascript - React - Tree Component -

i trying make component in react recursively display names in data tree. not familiar react , not sure can in code remove error in console. the error uncaught syntaxerror: embedded: adjacent jsx elements must wrapped in enclosing tag here jsfiddle code: https://jsfiddle.net/go79b0dp/ here example code: var treeobj = [ { id: 1, name: 'bob', children: [ { id: 2, name: 'mary', children: [ {id: 4, name: 'suzy'} ] }, { id: 3, name: 'phil', children: [ {id: 5, name: 'jon'}, {id: 6, name: 'paul'} ] } ] } ]; var treeview = react.createclass({ getinitialstate: function() { return { people: treeobj }; }, render: function() { var people = this.state.people; var nodes = people.map((i) => <treenode node={i} children= {i.children} />) return ( <ul>{...

ios - Knowing when a view is going to be destroyed in UIView lifecycle -

i have uiview part of uipageviewcontroller. pass strong object view, , having problem releasing. in past think used viewdidunload release strong objects, , dealloc called. deal never called because of strong objects. what best way know icm uipageviewcontroller object not needed anymore. i.e. if view beside page user looking at, might come view. using viewwilldisappeart not work expect. @interface dotourfloorplanviewcontroller : uiviewcontroller <uiscrollviewdelegate, doasyncimageviewdelegate> { iboutlet doasyncimageview* _imageview; iboutlet uiscrollview* _scrollview; nsmutablearray* _beaconlabels; uiview* _circle; uiview* _centerdot; dotour* _tour; cgrect _zoomrect; int _circlecenterx; int _circlecentery; bool _didzoomtolocation; } @property (strong, nonatomic) dotour* tour; views aren't unloaded more, newer devices don't have quite such tight memory restrictions , there other optimisations. seems when view...

testing - How do I "stub" a child ember component in an integration test? -

say have component contains component b. i'm writing integration test component a, component b addon don't want include tests (mainly because makes xhr requests i'd rather keep out of integration test). there documentation on how this? or have best practice?

javascript - Why does my JS mobile nav work on all my pages but one? -

i'm building website, , have mobile dropdown menu controlled js (and appears @media queries devices under 400px). website jeffarries.com (and page i'm talking live there), mobile nav works on of other pages, not politics page. thing isn't working bars open , close nav dropdown don't rotate , body isn't set position: fixed; . why js work on page politics ? thanks! p.s. can provide code, it's 250+ line , in different files, think best if view on website. (i'm not trying sound lazy, if want code, ask , provide it) why js mobile nav work on pages one? because have javascript error! check browsers console , see it: typeerror: null not object (evaluating 'document.getelementbyid("javascript_warning").style') if on line 331 of politics.js file see following function: // hides javascript warning message function myfunction() { document.getelementbyid("javascript_warning").style.display = "none...

Java ignore NullPointerException in database? -

i new java coming c#. been trying figure out, can't right. so let's have table following contents: _id | body | partner_jid | bin_id ---------------------------------------------------------- 1 | hello | jid_2933219 | group_30 2 | null | jid_2933219 | group_30 3 | !cmd | jid_2933219 | group_30 4 | | jid_2933219 | group_30 5 | example | jid_2933219 | group_30 okay, needs happen, row body gets scanned text starts "!cmd" (and if gets found, something). but, once comes down number 2, program quits , returns nullpointerexception. i have this: import java.sql.connection; import java.sql.drivermanager; import java.sql.resultset; import java.sql.statement; public class main { public static void main(string[] args) { try { class.forname("org.sqlite.jdbc"); system.out.println(...

wordpress - hide a woocommerce setting tab -

i hide specific woocommerce setting tab user role. not entire submenu, tab(checkout specific). want shop managers able access of settings, unable affect checkout settings. how can achieve this? if want remove tabs instead of hiding them using css, can add following yours theme functions.php: add_filter( 'woocommerce_settings_tabs_array', 'remove_woocommerce_setting_tabs', 200, 1 ); function remove_woocommerce_setting_tabs( $tabs ) { // declare tabs want hide $tabs_to_hide = array( 'tax', 'checkout', 'emails', 'api', 'accounts', ); // current user $user = wp_get_current_user(); // check if user shop-manager if ( isset( $user->roles[0] ) && $user->roles[0] == 'shop_manager' ) { // remove tabs want hide $tabs = array_diff($tabs, $tabs_to_hide); } return $tabs; } this uses woocommerce 'wooc...

java - Return type of generic Map.entrySet() -

map.entryset() declared as: set<map.entry<k, v>> entryset(); somewhere define variable this: map<? extends number, string> wildcardmap = new hashmap<>(); now, assume type param k ? extends number , this: set<map.entry<? extends number, string>> entries = wildcardmap.entryset(); but gives compilation error, , have write: set<? extends map.entry<? extends number, string>> entries = wildcardmap.entryset(); can explain why wildcard necessary right before map.entry? the wildcard ? extends number means specific (unknown us) type extends number . let's try 1 possible type be, integer , , see happens: map<integer, string> wildcardmap; // doesn't compile set<map.entry<? extends number, string>> entries = wildcardmap.entryset(); why? because wildcardmap.entryset() returns set<map.entry<integer, string>> , not subtype of set<map.entry<? extends number, string>> . ...

git - How can I get rid of .DS_Store files that are stuck in remote repo? -

Image
i have re-initialized repos correct .gitignore files, there still .ds_store files in remote heroku. a git pull heroku master gives: how can rid of these files once , all? look have commited files already. once add , commit files git starts track them. you have 2 main option ignore files. remove them repository (see below code) use ``assume-unchanged` flag mark them unchanged form point on. in case wish use first option here how. a .gitignore file specifies intentionally untracked files git should ignore. files tracked git not affected how remove commited files , set git ignore them? you have remove & commit , ignored. # remove commited files: git rm --cached .ds_store # add files .gitignore , # commit , push git commit -m "removed..." git push origin <branch>

dotnetopenauth - Google Site Verification API -

i trying develop google site verification system using asp.net. using google explorer ( https://developers.google.com/site-verification/v1/webresource/insert ) test request method such json , http request format. this sending google. post https://www.googleapis.com/siteverification/v1/webresource?verificationmethod=site&key={your_api_key} content-type: application/json authorization: bearer xxxxxxxxxxxxxxx x-javascript-user-agent: google apis explorer { "id": "myid", "owners": [ "development@gmail.com" ], "site": { "type": "site", "identifier": "http://www.example.net/" } } i getting following response google. { "error": { "errors": [ { "domain": "global", "reason": "backenderror", "message": "backend error" } ], "code": 503, "message": ...

javascript - How to pass input values as arguments into the custom filter in Angularjs -

i want pass 2 argument custom filter ' from' , 'to' custom filter have created in controller. here can see custom filter have created: vm.filterminutes = function (prop, from, to) { return function (item) { return item[prop] >= && item[prop] <= to; }; }; and view looks this: <label>search from: <input ng-model="fromminutes"></label> <label>search from: <input ng-model="tominutes"></label> <tr style="cursor: pointer;" ng-repeat="student in adminreportsworksnaps.data | filter: adminreportsworksnaps.filterminutes('totalminutes', fromminutes,tominutes)"> <td>{{ student.studentid }}</td> <td>{{ student.firstname }}</td> <td>{{ student.lastname }}</td> <td>{{ student.municipality }}</td> <td...

Getting rule property from Yii model -

maybe question easy, did not find answer in model have rule: array('name', 'length', 'max'=>65), in view have code: $form->textfield($model,'name'); after rendering have: <input id="name" type="text" value="" maxlength="65" name="name"> everything fine, possible max length property model on view page? show max length somewhere on page, can't property. thanks try this: foreach ($model->getvalidators('name') $validator) { if ($validator instanceof cstringvalidator && $validator->max !== null) { echo 'this max length ' . $validator->max; break; } } this return validators 'name' attribute. search cstringvalidator , return max size.

c# - Visual Studio angle bracket alt gr not working -

Image
i'm using (win 10) czech keyboard layout (ces/cs) , typicaly able write angle bracket '>' combination of right alt (altgr + .) visual studio 2015 community edition seems ignore shortcut. message 'no quick actions availible here'. idea how force alt gr or map symbol on layout? keyboard shortcut (ctrl+alt+.) associated editorcontextmenus.codewindow.quickactionsforposition . remove it. (keyboard shortcut ctrl+alt+. corresponds altgr + .)

php - Homebrews php56-imagick module can not load because of liblzma -

i installed php56 via homebrew on os x yosemite. it's working installation. added imagemagick , php56-imagick packages. apache running ok, php -i shows imagick module. apache-server can not load module on startup following warning: php warning: php startup: unable load dynamic library '/usr/local/opt/php56-imagick/imagick.so' - dlopen(/usr/local/opt/php56-imagick/imagick.so, 9): library not loaded: /usr/local/opt/xz/lib/liblzma.5.dylib\n referenced from: /usr/local/opt/imagemagick/lib/libmagickwand-6.q16.2.dylib\n reason: incompatible library version: libmagickwand-6.q16.2.dylib requires version 8.0.0 or later, liblzma.5.dylib provides version 6.0.0 in unknown on line 0 therefore there no imagick class in php. the package xz (providing liblzma) up2date. is path issue (has /usr/lib precedence on /usr/local/lib)? /usr/lib/liblzma.5.dylib (probably os x provided) /usr/local/cellar/xz/5.2.2/lib/liblzma.5.dylib (homebrew) /usr/local/lib/liblzma.5.dylib (link hom...

c# - Passing Double Quotes in asp.net -

my web app requires double quotes passed within dropdownlist listitem value property because few of database names begin numbers. possible? i tried "\"123db\"" , getting error "this attribute name must followed equal..." <asp:listitem value="123db">123db</asp:listitem> thanks try this: <asp:listitem value="&quot;123db&quot;">123db</asp:listitem> since't it's html get's rendered in end of day. however, i advise not include quotes in value - value should programmatic string, , " not valid character in it.

jquery - Need help writing a Javascript to add values -

i need in writing javascript code form. need add values in text fields(credit cards, payday loans , unsecured personal loans) , if total gets more or equal $10000, on submit should take user page 1, else page 2. want add first 3 fields, doesn't matter user inputs in other fields. here's form: <form action="/fsg?pageid=0bd004f9-aabc-486e-be09-bf2621555e3e&amp;variant=b" method="post"> <input type="hidden" name="pageid" value="0bd004f9-aabc-486e-be09-bf2621555e3e"><input type="hidden" name="pagevariant" value="b"> <fieldset class="clearfix" style="width: 297px; height: -17px;"> <div class="lp-pom-form-field clearfix" id="container_what_state_do_you_live_in"> <label for="what_state_do_you_live_in" class="main lp-form-label" id="label_what_state_do_you_live_in"> state? *</label>...

css - Best group of selectors for all button types in HTML file -

currently, using: input[type="button"], input[type="submit"], input[type="reset"], button is solid group of selectors possible buttons in webpage? your reference here going html5 spec . it kind of depends on how define "button"--i assume you're looking @ form control buttons, not links styled buttons, so--do count upload input? <input type="file"> it has button in (in many uas) isn't only button, , want give different css. also, there's: <input type="image"> which input type table w3c describes " either clickable image, or button ." other that, looks you've covered, @ least according html5 w3c spec.

Async Task with multiple requests in android -

i using asynctask class update 2 different tables on sql server far code works fine i'm interested in more better , sufficient code structure of class specially in doinbackground() okay call multiple webservices methods in single thread? can 1 suggest me? private class update extends asynctask<void, void, integer> { private final int failed_invalid_response = 0; private final int success_get_data = 1; progressdialog progress; private string _phoneno; private string _ticket; updateticket(string phoneno,string ticket){ _phoneno=phoneno; _ticket=ticket; } @override protected void onpreexecute() { super.onpreexecute(); progress = progressdialog.show(xyz.this, "", "in progress...", false); } @override protected integer doinbackground(void... params) { method1(_phoneno...

Randomly drawing from a hypercube in Matlab -

consider n-cube (defined here ) n>3. suppose centered @ origin of cartesian plane , each edge has length 10. i write piece of code in matlab allows me randomly draw 1 point (with n coordinates) hypercube. there way without pre-defining n-dimensional grid? in particular application n=11. to draw 1 point volume of n-dimensional hypercube side s , points having equal probability, call s = 10; point = (rand(1,n)-0.5)*s; replace 1 larger number if want draw many points @ once.

java - Getting an ouput of null on 2d array not sure where I went wrong -

i have problem in programing class , stuck @ point im not sure fix. here problem: the world class contain 3 private data fields. first private data field 2 dimensional char array represents world. size of world depend on what’s passed constructor. next private data field characterrow , last private data field charactercolumn. constructor accept 2 values, width , height. using width , height, set size of 2 dimensional array. fill array dash, -. characterrow , charactercolumn data fields both set 0 , place character, ‘p’, @ position characterrow , charactercolumn. if world printed width 9, or 9 columns, , height 4, or 4 rows, after creation: p-------- --------- --------- --------- the world class contain 5 public methods. these methods moveup, movedown, moveleft, moveright , displayworld. i getting ouput of: enter number of rows: 9 enter number of columns: 9 p - null - null - null - null - null - null - null - null - null - null - null - null - null - null - null - n...

c# - Make child classes unable to override method implementation -

this question has answer here: is possible mark overridden method final 4 answers let's have base abstract class named animal has virtual method named move . i create child class named mammal inherits animal , defines move method. i create child class of mammal named rabbit . here's thing: i not want rabbit able override implementation of move mammal has defined (child classes of mammal must not change definition of move, mammal defined). since rabbit inherits mammal , possible "unvirtualize" move method in mammal class in order prevent inheriting classes overriding method definition in mammal ? sealed when applied class, sealed modifier prevents other classes inheriting it. in following example, class b inherits class a, no class can inherit class b. you can use sealed modifier on method or property ove...

php - Symfony2 -- Creating a form that use's differents entities -

i've been using symfony bit , i'm trying figure out way create form. need use mvc based solution. my form needs ask several information of different entities , need process information extracting in database. database wont problem. i figuring out how make form different types of entities ? and how make scrolldown menu data contained in database entity ? if comment @chalasr not apply, i.e., entities not related, possible following in controller. create $form variable each entity{x}type form in: $forma = $this->createform(appbundle\entity\entityatype($entitya)); $formb = $this->createform(appbundle\entity\entitybtype($entityb)); ... return array( 'forma' => $forma->createview(), 'formb' => $formb->createview(), ... );

javascript - Get all child nodes of div using cheerio? -

<div class="hello"> text1 <li>text2</li> <div class="bye">text3</div> text4 block <div class="bye">text5</div> last text5 </div> so have above grab in cheerio using $('div.hello') . want iterate through it. how iterate through including text nodes? tried using $('div.hello').contents() isn't grabbing text nodes("text1, "text4 block", , "last text5"). end goal split html block when reach first element has class of "bye". want array holding following html strings, final_array = ['text1 <li>text2</li>', '<div class="bye">text3</div> text4 block <div class="bye">text5</div> last text5'] you try use map or filter methods. for example: var text = $('div.hello').contents().map(function() { if (this.type === 'text') return $...

time series - Predictions with ARIMA (python statsmodels) -

i have time series data contains seasonal trends , want use arima model predict how series behave in future. in order predict how variable of interest ( log_var ) behave have taken weekly, monthly , annual difference , used these input arima model. below example. exog = np.column_stack([df_arima['log_var_diff_wk'], df_arima['log_var_diff_mth'], df_arima['log_var_diff_yr']]) model = arima(df_arima['log_var'], exog = exog, order=(1,0,1)) results_arima = model.fit() i doing several different data sources , in of them see great results, in sense if plot log_var against results_arima.fittedvalues training data matches (i tune p , q each data source separately, d 0 given have taken difference myself). however, want check predictions like, , in order redfine exog 'test' dataset. example, if train original arima model on 2014-01-01 2016-01-01, 'test' set 2016-01-01 onwards. ...

javascript - ajax request call ending with error -

this question has answer here: post image php in ajax 3 answers i'm having problem ajax call. want pass information on server side when call ajax request ends error. weird is, used same code, same lines, in previous project. this ajax request (php_session_id not undefined, i'm checking every time): $.ajax({ data: { unique: php_session_id }, url: 'server/uploading_files.php', method: 'post', success: function (response) { console.log("response"); }, error: function() { console.log("some error"); } }); and uploading_files.php file: header('content-type: application/json'); session_start(); if( isset( $_post['unique'] ) ) {$_session['unique_id'] = $_post['unique'];} $path_to_save = 'upload/' ....

concurrency - Can I use a dummy lock file for PHP to implement mutual exclusion? -

i wondering whether way implement mutual exclusion on php: use php flock() , dummy lock file. because flock() allows 1 process access file. $file = fopen("dummylockfile"); flock($file, lock_ex) //critical section fflock($file, lock_un) fclose($file)

gmail - Gamil API get information from a wrong account -

i met weird situation. following tutorial below link retrieve information https://developers.google.com/gmail/api/quickstart/dotnet#step_1_turn_on_the_api_name in browser, login in gmail of account a, in program using client_serect.json account b, also, using account b userid. however, when test it, program , display information of account a. how can information account b??? the client_secret.json contains information identifies application @ google. { "web": { "client_id": "[[your_client_id]]", "client_secret": "[[your_client_secret]]", "redirect_uris": [], "auth_uri": "https://accounts.google.com/o/oauth2/auth", "token_uri": "https://accounts.google.com/o/oauth2/token" } } you don't need separate 1 each user. you need store access_token , potential refresh_token of each user, , use them separately. read the official documentation ...

smallest storage of integer array in mysql? -

i have table of user entries, , every entry have array of (2-byte) integers store (15-25, sporadically more). array elements written , read @ same time, never needed update or access them individually. order matters. makes sense think of array object. i have many millions of these user entries , want store minimum possible amount of disk space. i'm struggling mysql's lack of array datatype. i've been considering following options. do mysql way. make table my_data columns user_id , data_id , data_int . make efficient, 1 needs index on user_id , totalling on 10 bytes per integer. store array in text format. takes ~6.5 bytes per integer. making 35-40 columns ("enough") , having -32768 'empty' (since value cannot occur in data). takes 3.5-4 bytes per integer, ugly (as have impose strict limit on number of elements in array). is there better way in mysql? know mysql has efficient varchar type, ideally i'd store 2-byte integers 2-byte cha...

java - How to shoot bullets when space bar is pressed using LibGDX? -

i did follows: ... if (gdx.input.iskeypressed(keys.space)) { shoot(); } ... the problem if keep pressing space many bullets created. want bullet shot when press space not while i'm pressing key. took @ documentation library, , doesn't seem expose other way of getting key presses (particularly key down/release). in such case can keep track of keep changes spacealreadypressed variable persists between frames. ... boolean spaceispressed = gdx.input.iskeypressed(keys.space); if (spaceispressed && !spacealreadypressed) { shoot(); } ... spacealreadypressed = spaceispressed; it may safer use spaceispressed variable in case input state changes unexpectedly. alternatively, if want make shorter, can use logical laws reduce following, canshoot persists between frames , has initial value of false . ... canshoot = !canshoot && gdx.input.iskeypressed(keys.space); if (canshoot) { shoot(); } ...

debug symbols - Can't find PDBStr.exe on Windows 10 -

Image
i trying set gitlink our debugging symbols complains 'pdbstr not found on computer, please install 'debugging tools windows' after installing said debugging tools cannot find pdbstr.exe anywhere. missing something? after installing debugging tool windows 10 sdk , see pdbstr.exe under c:\program files (x86)\windows kits\10\debuggers\x64\srcsrv\ (64bit) , c:\program files (x86)\windows kits\10\debuggers\x86\srcsrv (32bit). the script may not updated windows 10.

Stuck on git commit window -

Image
i stuck on window. did git add -a before , git commit in git-cmd.exe . how can out of here? wrote commit message , press enter , nothing happened. i'm affraid close window , find nothing on internet, official site nothing how validate commit corectly. you in vi editor. in order save , exit vi need this: to save changes: esc + :wq or: zz discard changes: esc + :q! (look on button of screenshot how exit - the last line )

c# - Is it good practice to make a Model static in WPF (MVVM)? -

let's some, not all, models in application static , defined members of baseviewmodel such multiple viewmodels (and extension, views) can access exact same data hitting have inherited. here basic layout 2 derived classes can access same model: public class employeemodel { public string name; public int id; } public class baseviewmodel { private static employeemodel employeemodel = new employee model(); public employeemodel emodel { { return employeemodel; } set { employeemodel = value; } } public baseviewmodel() {} } public class employeeviewmodel : baseviewmodel { public employeeviewmodel() { base.emodel.name = ""; } } public class homeviewmodel : baseviewmodel { public employeeviewmodel() { base.emodel.name = ""; } } in end, got job done same data showing in multiple views without issue. however, not mean there isn't more appropriate way of unaware. new wp...

What is the sqlite default column type? -

in 1 of our company's scripts found sqlite create table script 1 of columns data type definition missing. default value of column type @ time of table creation? create table x( y, z int ); in above simplified example y column under question. when try check column with pragma table_info(x) the information y column missing. there no types of column type affinity. in case it's omitted, type affinity numeric . can read on here: https://www.sqlite.org/datatype3.html

javascript - Update Matrix According to Array elements -

i know title of questions seems bit odd answer i'm looking title. lets have array of arrays , want update according arrays elements. example; array of arrays; var arrayofarrays = [ [ [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], [false, false, false, false], ...

Vim indentation with python getting wierd -

def main(): todo=todo()#this line shows 1 tab 1 sublime text print("the indentation not right")# 1 shows 2 tabs i got wierd problem, cannot use vim edit python file anymore. indentation above same have, said indentation wrong. way, first line works right edit computer. use fedora 23 operating system , default tab vim 8 space on other files , need backspace delete, when create .py file, tab changes 4 spaces , need backspace 4 times cannot use vim edit files. if wanna use tabs 8 spaces wide , 1 tab each indentation level, use :set tabstop=8 softtabstop=8 shiftwidth=8 noexpandtab or put in .vimrc set tabstop=8 set softtabstop=8 set shiftwidth=8 set noexpandtab for setting preferences python, put in vimrc autocmd filetype python setlocal ts=8 sts=8 sw=8 or autocmd filetype python set tabstop=8|set shiftwidth=2|set expandtab for more information, please read secrets of tabs in vim , indenting source code (vim wiki) you can read i...

Hibernate -- object creation error -

i've set , running hibernate 3.6 on eclipse/juno ee. my first code giving me runtime error on instantiating class configuration of hn. so-- precise, sessionfactory afactory; configuration conf; are fine & running, but line next below conf=new configuration(); is throwing java.lang.exceptionininitializererror . the code sessionfactory afactory = new configuration().configure().buildsessionfactory(); is near running. my hibernate.cfg.xml follows: <?xml version='1.0' encoding='utf-8'?> <!doctype hibernate-configuration public "-//hibernate/hibernate configuration dtd 3.0//en" "http://www.hibernate.org/dtd/hibernate-configuration-3.0.dtd"> <hibernate-configuration> <session-factory> <property name="connection.driver_class">org.postgresql.driver</property> <property name="connection.url">jdbc:postgresql://localhost:5432/thisdb</...

ios - Adding an Xcode subproject: Shouldn't all the source files get copied? -

Image
i manually adding sqlite.swift subproject project. directions indicated, copied .xcodeproj file project. allows me see source files (unlike this question ). everything seemed working fine. however, discovered source files of subproject not copied project. still in original location downloaded them. design? if want share project source code other people in future? won't have subproject source necessary project work. if need copy subproject source project, how do that? add filesystem-structure first. example pressing "show in finder" on "chimee"-project lead folder it's located in. copy sqlite-project structure in there. afterwards can drag&drop xcodeproj project still link original path, it's inside project-structure isn't problem anymore. i guess design, because when try via add files "yourproject" can select copy items if needed -option still not copied (only .xcodeproj-files, works other filetypes)

javascript - Inserting an object to a global array? -

i have html file form person fill out take order. i have global array store objects. objects contain name, price, , quantity of item added order. <button type="button" onclick="addtoorder('app2-amount', 'house salad', '6')">+</button> this addtoorder() called. and function: var orderarray = []; function addtoorder(id, namein, pricein){ if (loggedin == true){ var quantityin = document.getelementbyid(id).value; var totalforthisitem = pricein*quantityin; var menuobject = { name: namein, price: totalforthisitem, quantity: quantityin }; // next must perform check see if object same name exists in order // if exist, replace new object. if (orderarray.length == 0){ orderarray.push(menuobject); } else{ orderarray.foreach( function (item) { if (item.name == menuobject.name){ item = menuobject; } else{ orderarray.push(menuobject); ...

java - Arrays Checking input -

so i'm trying check input , if entered integer not greater previous 1 should ask again. program checks if integer out of bounds , if it's not integer entered doesn't check if entered 1 greater previous one. for (int = 0; < finalgrades.length; i++){ //check input integer while(!input.hasnextint()){ system.out.print("please enter integers only: "); input.next(); } finalgrades[i] = input.nextint(); if(finalgrades[i] > 100 || finalgrades[i] < 0){ system.out.print("please enter integers between 0 , 100 only:"); finalgrades[i] = input.nextint(); } if(finalgrades[i] < finalgrades[i-1]){ system.out.print("please enter integers in ascending order only: "); finalgrades[i]= input.nextint(); continue; } } do error?. java.lang.arrayindexoutofboundsexception? what mean "my bottom if statement not running properly"?. ...

llvm clang - lld undefined symbol: mainCRTStartup -

my cpp code int main(int argc, char** argv){ } i use following command compile , link it: // want read result ir clang -s -emit-llvm main.cpp // want compile directly ir llc -filetype=obj main.ll lld -flavor link main.obj // <root>: undefined symbol: maincrtstartup link failed did miss something? maincrtstartup function defined crt (which clang implicitly using in first step, , generates ir file maincrtstartup entry point) try passing -nostdlib clang in first step this mean won't able use standard library functions, though if want use crt functions link lld need link in native libraries

Goto specific page in PDF using C# Visual Studio -

i'm using axacropdflib.axacropdf tool toolbox , having specific pdf when click button. have separate button (button2) , textbox want use automatically move pdf page page number entered textbox when button2 pressed. the following code isn't working , i'm not sure code use work (and no cannot use tools inside pdf reader need controls on monitor 1 , pdf displayed on montior 2, i've sorted part): key: dsm = form2 | pdfview = pdf reader inside form2 dsm.pdfview.setcurrentpage(textbox1.text); this isn't working. i've tried: dsm.pdfview.setcurrentpage = textbox1.text; also not working. great! thanks. the documentation shows syntax void setcurrentpage(long npage) you passing string in. need parse string int or long before passing in. how parse string number also, based on documentation original method call correct except passed in parameter of wrong type. once convert it, make same call new parameter. here's documentation adobe ...