Posts

Showing posts from August, 2013

javascript - Types of conversion of images -

i converting images base64 , sending them websocket. using javacript: var reader = new filereader(); reader.onload = (function(aimg){ return function(e){ aimg.src = e.target.result; imagemessage = aimg.src; }; }(image)) var ret = reader.readasdataurl(file); in socket server string: data:image/jpeg;base64,/9j/4aaqskzjrgabaqeayabgaad/4rfgrxhpzgaatu0akgaaaagacaeyaaiaaaauaaaiege7aaiaaaahaaaijkdgaamaaaabaamaaedjaamaaaabadiaaikyaaiaaaahaaailodpaaqaaaabaaaiujydaaeaaaaoaaarmoocaacaaagmaaaabgaaaaac6gaaaagaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.........

java - call a parameterized Junit test case from main method -

class containing test case public class seleniumtestcaseparameterized { webdriver driver; private string username, password, baseurl; public seleniumtestcaseparameterized(string username, string password) { this.username = username; this.password = password; } @before public void setup() { } @test public void testseleniumtestcaseparameterized() throws exception { driver.get(baseurl + "url"); driver.findelement(by.id("username")).sendkeys(username); driver.findelement(by.id("password")).sendkeys(password); } @after public void teardown() { driver.quit(); } class test case called in main method public class mainclass { public static void main(string[] args) { string name =joptionpane.showinputdialog("please enter username"); seleniumtestcaseparameterized c = new seleniumtestcaseparameterized(name,name); junit.textui.testrunner.run(c.getclass()); } i unable pass parameters test case...

tfsbuild - TFS Online build server post build scripts not available -

Image
according this link , there option add powershell scripts build via post build script path property. to invoke our script front-end build tasks (clientcompile.bat), need configure build process. open ‘process’ tab , expand section ‘5. advanced’ inside build section. we’re going provide ‘post-build script’ information. script executed on build infrastructure after source code has been compiled, hence post-build. i'm using tfs online , have 3 sections, '3. advanced' , no option enter post-build script information. how can option available? available on online tfs build? build process parameters surfaced build process template. build process templates in existing projects don't upgraded because of potential break customizations, that's why you're not seeing new parameters. new build process template, create new team project, create new build definition , download process tab. alternatively, i've uploaded here . once you'...

objective c - iOS UITableView content offset not working in iOS7 -

in app have search bar in header of my uitableview . tried set content offset uitableview hiding search bar giving me problems. finally solved this: - (void)viewwillappear:(bool)animated { [self performselector:@selector(hidesearchbar) withobject:nil afterdelay:0.0f]; } - (void)hidesearchbar { self.tblview.contentoffset = cgpointmake(0, 40); } the problem works ios 8. how can achieve correctly work both ios 7 & 8 ???? sorry poor english. in advance. if set header self.tblview.tableheaderview = yoursearchbar (recommended way),try self.tblview.tableheaderview = nil; or self.tblview.tableheaderview = [[uiview alloc] initwithframe:cgrectzero]; to hide it. ps. yoursearchbar should instance variable or property displayed conveniently in future.

c# - How can I edit controls inside master page? -

in short want edit controls inside master page in .net framework content page during design time. because in content page during design time master page controls not accessible content page question is: how can make master page controls accessible content page during design time? possible or not? in advance i think can't edit them in derived page. not make sense. can edit them in master page in designer, , can still change master page's control in derived page's codebehind @ runtime.

linux - make: nothing can be done for all -

i'm trying run make using makefile below command line. receive following error make: nothing can done all . contents of makefile given below. generated_files = \ dw.js/dw-2.0.js \ www/static/css/datawrapper.css \ www/static/css/chart.base.css all: $(generated_files) clean: rm -f -- $(generated_files) dw.js/dw-2.0.js: dw.js/src/*.js cd dw.js grunt assets: www/static/css/datawrapper.css www/static/css/chart.base.css # www/static/js/dw-2.0.js: dw.js/dw-2.0.js # @cp dw.js/dw-2.0.js www/static/js/ # www/static/js/dw-2.0.min.js: dw.js/dw-2.0.js # @php -r "require 'vendor/autoload.php'; file_put_contents('www/static/js/dw-2.0.min.js', \jshrink\minifier::minify(file_get_contents('dw.js/dw-2.0.js')));" messages: scripts/update-messages.sh www/static/css/datawrapper.css: assets/styles/datawrapper/* assets/styles/datawrapper/**/* node_modules/.bin/lessc assets/styles/datawrapper/main.less > $@ www/stati...

Searching an element of array type struct in c -

i have array of structures store basic informations pc within company (code,model,connected internet). typedef struct database{ char code[5]; char brand[20]; char model[20]; int lab; int connect; }database; now want search through array find pc coresponding code c01a here little example of info stored in struct: c01a hp sjh1740 1 0 b02a hp sj1290 3 1 a03b dell pq240 2 1 a02b dell pq240 3 1 c09h fujitsu np0001 1 0 a06d dell pq240 3 1 c00x fujitsu lp1050 2 0 b89a hp sj1290 3 1 a03f dell pt1000 2 0 c12p hp aa0012 1 1 d01d dell bb2300h 3 0 you can see first pc has code c01a . here see 11 pc's randomly picked file in there can millions of pc's (imagine big company, array able hold 10 million pc's because can). i search every single element in array until find right one. (using quick calculation dunno if it's ok). means have scroll trough 10.5mb of memory, quite lot if searching process not optimalized. so came this: step 1: sort arr...

javascript - Angular's ng-options work incorrect | Angularjs -

angular's ng-options works incorrect. it must render select this: <option value="1" label="not available">not available</option> <option value="3" selected="selected" label="available">available</option> but not. value keys aren't match , selected tag doesn't work. what i'm doing wrong here? product model object db object {id: "7", name: "some name", category_id: "1", img_big: "uploads/products/5552f2ba31694@big.jpeg", img_thumb: "uploads/products/5552f2ba31694@thumb.jpeg"…} isavailable object $rootscope.isavailablescope = [ { status: 1, name : 'not available' }, { status: 3, name : 'available' } ] html <select class="form-control" ng-model="product.is_available" ng-options="isavailable.status isavailable.name isavai...

vtiger - Invoke custom function that display a form -

i need use multiple custom function on vtiger. create custom function passing data vtiger other system whenever project saved. now need create custom function prompt form user fill in. data fill user saved on database. is there anyway call custom function can display form user fill in , processing form. thank you. unfortunately impossible invoke form vtiger custom function.

php - ZF2 Pagination does not work with Union -

i using php zend framework 2.3.3 . used paginator select union . code this: $where = new where(); $where->like('value', "%$infotosearch%"); $select = new select(); $select->columns(array(new expression('distinct(id)'))); $select->from('products'); $select->where($where); $select2 = new select(); $select2->columns(array(new expression('distinct(id)'))); $select2->from('products_archive'); $select2->where($where); $select->combine($select2); $paginatoradapter = new dbselect($select, $this->getadapter()); $paginator = new paginator($paginatoradapter); $paginator->setcurrentpagenumber(1); $paginator->setitemcountperpage(10); foreach($paginator $product){ var_dump($product); } then wrong number of products. checked mysql query log , saw query: ...

objective c - set checkmark in uitableView as the data is being loaded in the cell in ios -

i want checkmark data when data being loaded in uitablecell . know works when put in didselect section can use in cellforrowatindexpath . if yes how use it? have tried doesn't show checkmarks. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *simpletableidentifier = @"addgoalstableviewcell"; addgoalstableviewcell *cell = (addgoalstableviewcell *)[self.tableview dequeuereusablecellwithidentifier:simpletableidentifier]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"addgoalstableviewcell" owner:self options:nil]; cell = [nib objectatindex:0]; } cell.addgoalstext.font = [uifont fontwithname:@"avenirnext-medium" size:17]; cell.addgoalstext.textcolor = [uicolor colorwithred:102.0f/255.0f green:102.0f/255.0f blue:102.0f/255.0f alpha:1.0f]; cell.addgoalstext.text = [[goalsarray objectatindex:indexpath.row] valueforkey:@"name"]; p...

android - why my adapter can't refresh it's view -

below adapter code , logs (log tag "jieke"), problem times can't display whole items in list, display 8 items meanwhile list size 10! see in log: getcount returns 10, getview called 10 times, still seen 8 views, why? public class numberadapter extends baseadapter{ private layoutinflater minflater; private arraylist<numbermodel> mphonenumberlist; public numberadapter(context context, arraylist<numbermodel> phonenumberlist){ minflater = layoutinflater.from(context); mphonenumberlist = phonenumberlist; } @override public int getcount() { if (mphonenumberlist != null) { logutils.d("jieke", "count="+mphonenumberlist.size() ); return mphonenumberlist.size(); } return 0; } @override public object getitem(int position) { if (position > -1 && mphonenumberlist != null && position < mphonenumberlist.size()) { ...

android - How to use viewclient traverse method in AndroidViewClient -

i have following codes traverse listview in androidviewclient build list of accounts. works fine way because can't find more proper way pass variable list_accounts function findaccount() raises argument error must use globally. there way pass parameter transform method of vc.traverse() ? def findaccount(view): if view.getclass() == 'android.widget.textview': text = view.gettext() if re.match(re.compile('.*@yahoo.com'), text): list_accounts.append(text) list_accounts = [] listview_id = vc.findviewbyidorraise('id/no_id/11') vc.traverse(root=listview_id, transform=findaccount) item in list_accounts: print "account:", item you can this def findaccount(la, view): if view.getclass() == 'android.widget.textview': text = view.gettext() if re.match(re.compile('.*@yahoo.com'), text): la.append(text) list_accounts = [] listview_id = vc.findviewbyidorraise(...

ember.js - Cannot read property 'connectOutlet' of undefined TypeError: -

here route. when calling route using trasitiontoroute method controller getting error. here router : app.allsectionsroute = ember.route.extend({ rendertemplate: function() { //this._super(); this.render('fire', { outlet: 'fire', into: 'allsections' }); this.render('gas', { outlet: 'gas', into: 'allsections' }); } }); here template : <script type="text/x-handlebars" data-template-name="allsections"> <hr/> <hr/> <div class='outletarea'> {{outlet "fire"}} </div> <hr/> <div class='outletarea'> {{outlet "gas"}} </div> </script> if don't call this._super(controller, model); statement, @ time getting error of connectoutlet of undefined . but when call statement, error not come out, templates h...

drm - Second bind() call failed with license expire for Non persistence license type in Playready -

second bind()call failed license expire non persistence license in play ready, i working support 1 service: play sequence of service below: do wi. call bind()--> failed license not found do la (acquire license). call bind() -- success call commit -- success call manifest url player tries play content. found encrypted. bind()--> failed license expired. my question: why second bind() failed license expired? license type service provider non persistence. is there other reason behind license expire? on bases microsoft playready give license expired non persistance license type? please me regarding this. nonpersistent licenses usable one playback , not until application restarted. far playready device porting kit concerned, 1 playback equal 1 drm_reader_bind() call. why second call fails. while information license persistence public, more in-depth information nda-protected , cannot discuss on public website. if need further , can prove work pla...

wordpress plugin - WooCommerce inquiry if no price available -

i'm helping friend setting woocommerce shop. since shop going bigger , products pretty variable , customizable not able provide/configure prizes beginning. however products in shop , ad inquiry lead form in case no price available. since never programmed woocommerce wondering right hook implement such functionality? had exact same issue , couldn't find plugin or solution anywhere figured workaround myself: you need edit file /wp-content/themes/your-theme-name/woocommerce/single-product/add-to-cart/simple.php (if it's not there copy woocommerce plugin /wp-content/plugins/woocommerce/templates/single-product/add-to-cart/simple.php ) and on line 14 says if ( ! $product->is_purchasable() ) return; you need comment out , write if ( ! $product->is_purchasable() ) { // put code here return; } and in //put code here line can enter example shortcode form or more complicated solution put code button when clicked open pop...

TYPO3 6.2 fluid pagination not working as expected -

my typo3 6.2 (upgraded typo3 4.5) fluid paginate displays items instead of 5 items. my repository method : public function getrandomlocation($ilimit) { $query = $this->createquery(); $result = $query->statement("select * tx_sfel_domain_model_ttblocationsproduktegruppen hidden = 0 , deleted = 0 , logo != '' order uid limit 0, ".$ilimit." "); return $result->execute(); } my controller code : $asresultslocations = $this->ttblocationsproduktegruppenrepository->getrandomlocation($ilimit); $this->view->assign('asresultslocations', $asresultslocations); my template : <f:widget.paginate objects="{asresultslocations}" as="asresultslocationss" configuration="{itemsperpage: 5, insertabove: 1 insertbelow: 1}"> <f:for each="{asresultslocationss}" as="asresultslocation"> ................. ...

closures - Multiple where clause in YII2 -

i have question, how use closure type active records query in yii2 conditional where. here want achive: public function getusers($limit = 10, $type = 1, $company_id = 0) { return user::find()->where( function($query) use ($type, $company_id){ $query->where(['type' => $type]); if($company_id != 0) { $query->andwhere(['company_id' => $company_id]); } }) ->orderby([ 'created_at'=> sort_desc, ]) ->limit($limit); } please if know this.1 can't figure out closure here. can use andfilterwhere() company_id condition, should set null default, condition ignored if company_id wasn't initialized: public function getusers($limit = 10, $type = 1, $company_id = null) { return user::find() ->where(['type' => $type]) ->andfilterwhere(['company_id' =...

ios - ImagePickerController should open in landscape mode -

uiimagepickercontroller should open in landscape? tried using category not working. how fix orientation uiimagepickercontroller ? you should use uipopovercontroller display imagepickercontroller in landscape mode -(void)showimagepicker:(id)sender { uibutton *button = (uibutton *)sender; // button on user tap show image picker uiimagepickercontroller *imgpicker = [[uiimagepickercontroller alloc] init]; imgpicker.delegate = self; imgpicker.allowsediting = yes; imgpicker.sourcetype = uiimagepickercontrollersourcetypephotolibrary; self.popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:imgpicker]; [self.popover presentpopoverfromrect:button.frame inview:self.view permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; }

custom directive in cell template in ui-grid angularjs -

i define ui-grid display data, , define cell template set column style. @ same time create directive, here add cell template. link function execution times less expectation. here's whole thing on plunker: link var app = angular.module("app", ['ui.grid']); app.controller("datactrl", function ($scope, $element, $attrs) { var vm = this; vm.gridoptions = { data: "ctrl.datalist", columndefs: [ { name: "id", displayname: "user id", width: 200 }, { name: "name", displayname: "user name", celltemplate: "<div class=\"ui-grid-cell-contents\" pop-tip><span style=\"margin-left:5px\">{{row.entity[\"name\"]}}</span></div>" } ], enablerowselection: true, enablerowhead...

plugins - Is it possible to reuse code from atlassian's stash *.soy -

is possible reuse code atlassian's stash *.soy? i need add button on login page of stash's login.soy . after research have come know can rewrite .soy using soytemplaterenderer no luck. can explain me how rewrite or change template of stash? i don't know if can use existing template, can web item plugin module , specify context stash.page.login .

android - The method visible() is undefined for the type ActivityController -

i using robolectric unit testing of android application when using the line below activitymain activitymain = robolectric.buildactivity(activitymain.class) .create() .visible() .get(); its giving me method visible() undefined type activitycontroller error. note using robolectric-2.0-alpha-3-jar-with-dependencies.jar . i using older version robolectric-2.0-alpha-3-jar-with-dependencies.jar not contain visible() after using robolectric-2.3-jar-with-dependencies.jar working.for information check this

Import/Exporting certain columns of a table across two databases and excluding duplicate emails in mysql -

i have run problem mysql queries: basically, have 2 databases both contain table called tblclients db1 has far more records db2 , there duplicate records (the users have email address in both databases excluded operation). intend append db1 db2 in way columns appended long email address not found. i have done mysql gives me error. first complains no database selected , if type use db1 ; before actual statement, generates error: error 1064 (42000) @ line 1: have error in sql syntax; check manual corresponds mysql server version right syntax use near db1.tblclients (db1.tblclients.firstname, db1 @ line 1 any though on this? someone told me use mysqldump instead believe done in 1 line mysql query used in bash script file. thanks insert db1.tblclients (db1.tblclients.firstname, db1.tblclients.lastname, db1.tblclients.companyname, db1.tblclients.email, db1.tblclients.address1, db1.tblcli...

javascript - jQuery attr() failing -

in following code, on line commented "problem line", attr causes console.log print out "undefined" when click on 1 of s. can't seem figure out why: test.js var html = ''; // number of panels in carousel var panelcount = 0; // panel forefront of carousel var currentpanel = 0; $(document).ready(function(){ (var i=0; < 5; i++) { html += '<div class="team-member" id="' + panelcount + '">' + panelcount + '</div>'; html += '<div class="reflection" id="' + panelcount + '"></div>'; panelcount++; } $('#carousel').html(html); $(".container-carousel").on('click', '.team-member', function(e) { var target = $(e.currenttarget); var targetid = parseint(target.attr('id')); var frontrota...

recursion - Scala Case Class Recursive -

i trying recursively create key, value pair map hierarchical case class structure, no luck. case class country(id: option[long], name: string, states: option[list[state]]) case class state(id: option[long], name: string, cities: option[list[city]]) case class city(id: option[long], name: string) so trying extract in lists , zip key value pair, trying recursive computation obtain same in lists of objects. val keys = country.getclass.getdeclaredfields.map(f => f.getname) val values = country.productiterator val m = (keys zip values.tolist).tomap this gives me 3 keys values. my problem solve recursive way in list[city] inside state , list[state] inside country. is there way that? can't think in solution. trying iterate on map, matching there list , iterate , trying save progress in bufferlist. has trying this? edit i wasn't specific desirable output. i want child other maps, getting example @tienan ren tried this: def tomap[t: typ...

How to transplant the java MD5 encrypt code into Python? -

here standard code java use md5 encryption string, import java.security.messagedigest; public class transcode{ public static byte[] transcode(string text) throws exception{ byte[] bytes = text.getbytes("utf-8"); return bytes; } public static void main(string[] args){ try{ system.out.println("origin string: hello world"); byte[] bytearray = transcode.transcode("hello world"); int arrlen = bytearray.length; messagedigest messagedigest = messagedigest.getinstance("md5"); messagedigest.update(bytearray); system.out.print("byte array: "); (int i=0;i<arrlen;i++){ system.out.print(bytearray[i]); system.out.print(" "); } system.out.println(); bytearray = messagedigest.digest(); system.out.print("md5 result: "); (int i=0;i<arrlen;i++){ system.out.print(bytearray[i]); ...

html - Using dropdown button and Materialize -

i'm making website uses materialize. have following code: <ul class="right hide-on-med-and-down"> <li><a class="dropdown-button" href="#" data-activates="login"><%= t('layouts.navbar_off.login') %><i class="mdi-navigation-arrow-drop-down right"></i></a></li> </ul> and: <ul id="login" class="dropdown-content"> <li><%= link_to t('layouts.navbar_off.like_school'), new_school_sessions_path %></li> <li class="divider"></li> <li><%= link_to t('layouts.navbar_off.like_student'), new_student_sessions_path %></li> but when click in button, # added url. have refresh page , works fine. how can solve problem? did activate dropdown? know docs have if dynamically create them, had anyways. chalked weirdness angular integration, although experience re...

web services - How do pass parameter datasrc DataTables Jquery? -

i have small question follow: have function takes on values input , returns json string. in function get_product input parameter string @product_name . result json , not know how pass parameters in here . must declare how use datasrc in here (suppose webmethod get_product work parameter input ) var table; table = $('#div_table').datatable({ "processing": false, "serverside": false, "ajax": { "url": "../bus/webservice.asmx/get_product", "datatype": "json", "contenttype": "application/json; charset=utf-8", "type": "post", datasrc: function (json) { //datasrc: function (json(candy)) { //transfer parameter in here //result json string parsed , fill in datatables return $.pa...

php - Update database phone number -

Image
currently running program, when click submit new phone number button, ajax shows response pop empty. i don't have running errors don't see issue. main index.php file: case 'updatephone' : include('assets/header.php'); // create top box include('assets/sidemenu.php'); // create side menu // use template display result include('views/displayupdatephoneform.php'); include('assets/footer.php'); // create footer break; case 'changephone' : $sql = 'update members set mobilephone=:mobilephone indid=:indid'; $phone = $_post['mobilephone']; $values = array(':indid'=>$_post['indid'], ':mobilephone'=>$phone); $stm = $db->prepare($sql); $result = $stm->execute($values); echo $result; break; displayupdatephoneform.php <h4>changing mobile phone</h4> <p>enter new number: <input type='tel' id='new...

mysql - Duplicating existing cakephp app for development -

i need make development version of cakephp app own db developer can work on without disturbing current users. i thought simple, copied entire director /project /project_dev , copied db "project_db" "project_db_dev". went /project_dev/config/database.php , changed db "project_db_dev". when went see had done, saw app still connecting same db, if i'd changed nothing. realized original folder name referenced in /app/webroot/.htaccess need find/replace instances of folder name? what steps should follow duplicate existing cakephp app? you need setup kind of development lifecycle. generally speaking developer shouldn't doing development on server. best way handle locally using stack of kind such lamp (linux, apache, mysql, php) switch out linux other os's. there multiple cloud solution these environments such koding.com using git version control developer can develop locally push code through server after being thoroughly tested...

javascript - Angularjs: call one route without the hash? -

i know $locationprovider.html5mode(true) can remove hash routes, don't want that. i use api makes callback call app, explicitly forbid callback url contains hash. therefore, need provide callback url without hash, , url can accessed without hash /index.html. i guess handling callback in index.html quite ugly, best option create rule in web server configuration create valid url without hash , redirect app. does know other option solve issue? bonus question: why (linkedin in case) forbid put hash in callback url? there security issue that? thanks!

javascript - Trouble changing object value in page, but shows up in console log as working (angularjs) -

i want change object variable mf depending on user clicks, assign object array of objects variable mf , , take them next "page". i using ng-click assign objects mf through function. i'm using {{ mf.name }} test if new object has been assigned mf , keep drawing blank (nothing outputs page). however, when assign object manually within controller , output using console.log() , it's working. why not outputting page? code: app.js: app.controller('devicecontroller', function($scope) { $scope.showoptions = false; var device1 = [ { name: 'pc', os: 'windows', chosen: false, }, ... ]; var device2 = [ {...} ... ]; var mf = {}; $scope.mf = mf; console.log(mf); function calculate (x) { mf = device1[x]; } mf = device1[0]; console.log(mf.name); //outputs correctly in console - "pc" }); html: <div ng-hide="showoptions"> <div class="osselect">...

java - Does Android care about exit status code passed to System.exit(...)? -

if kill android app system.exit(...) , matter status code pass? couldn't find documentation on whether android ignores or whether ones lead error messages example or have other meaning. android not care, no. java thing -- can use them own debugging etc etc. here's example of system exit codes: http://www.opensource.apple.com/source/libc/libc-320/include/sysexits.h but pretty much, > 0 means abnormal exit. can set whatever want, i'd stick 0 unless you're interacting other things. it seems accepted convention.

Google OAuth Token Force Expiration Not Happening -

i forcibly trying expire google api oauth access token contacts api. here general outline of test: get code: auth_uri = flow.step1_get_authorize_url() redirect(auth_uri) code here exchange access token: code = request.get.get('code') credentials = flow.step2_exchange(code) store_for_reuse(key, credentials) store_for_refresh(key, credentials) get new access token: credentials_original = get_for_reuse(key) credentials_for_refresh = get_for_refresh(key) credentials_for_refresh.refresh(http) now, can verify 2 credentials object have different access token values credentials_original.access_token != credentials_for_refresh.acesss_token surprisingly, can still make successful api calls original access token. shouldn't original 1 expire when new access token issued? getting new token not expire existing tokens. tokens valid designated lifespan unless explicitly revoked .

printf - C Wrong Answer when squaring -

i'm learning c using c example. there question need take input integer , square , print screen. i'm having strange error, when no matter int enter give me output: please enter number. 5 number = 2686764 square of number = 2686760 here program wrote. #include <stdio.h> #include <conio.h> //for getch() main(){ int number, square; printf("please enter number. \n"); scanf("%d", &number); square = number*number; printf("\n number = %d ", &number); printf("\t square of number = %d", &square); getch(); } to add above answers ... @ example: int number = 5; printf(" %d\n", number); // prints value of 'number'. printf(" %p\n", &number); // prints address of 'number'. printf(" %d\n", *(&number)); // prints value @ address of 'number' ...

C++ Multidimensional string array initialization (std::map) -

i have special array of strings in c++: #include <map> #include <string> std::map<std::string, std::map<int, std::string>> oparam; oparam["pa"][0] = "a"; oparam["pa"][1] = "b"; oparam["pa"][2] = "c"; oparam["pb"][0] = "x"; oparam["pb"][1] = "y"; oparam["pb"][2] = "z"; but initialize initialization list , this: std::map<std::string, std::map<int, std::string>> oparam{ { "pa", { "a", "b", "c" } }, { "pb", { "x", "y", "z" } }, }; but giving me error. missing brackets? if integers acting keys in internal map going contiguous, use vector instead: std::map<std::string, std::vector<std::string>> oparam; with that, initialization you've given should work. if continue use std::map instead, you'll have coupl...

javascript - Materialize dropdown doesn't work -

i'm trying make dropdown menu inside sidebar materialize, doesn't work. width of dropdown isn't same trigger , padding move anchor bottom of list item. (the code same docs website) here codepen issue: example thanks :) $(document).ready(function(){ // sidebar $(".button-collapse").sidenav({menuwidth: 320, activationwidth: 70, edge: 'left'}); // dropdown $('.dropdown-button').dropdown({ induration: 300, outduration: 225, constrain_width: false, // not change width of dropdown of activator hover: false, // activate on hover gutter: 0, // spacing edge beloworigin: false // displays dropdown below button } ); }); <div id="slide-out" class="side-nav full"> <ul> <li><a href="#">first link</span></a></li> <li><a h...

simulink - How can i save previous value of variable in Matlab Function -

hello know how save previous value of output variable in matlab function. function y = fcn(x,d,yp) yp=0; %here want initialize value @ start of simulation if (x-yp<=d) y=x; else y=yp + d; end yp=y; % here want load output value thanks help using persistent variable correct way go, found out, cannot use varargin in matlab function block. trick check whether variable empty or not, in: function y = fcn(x,d,yp) persistent yp if isempty(yp) yp=0; %only if yp empty, i.e. @ beginning of simulation end if (x-yp<=d) y=x; else y=yp + d; end yp=y; % here want load output value

c - Under what circumstances (if ever) does strcat() hang? -

i have code in function in c: char* root = "/home/os/homework/user/honorsupgrade/html"; requestinfo->resource = "/bing" printf("1\n"); int counter = 0; for(counter = 0; counter < 100; counter++) { if(root[counter] == '\0') { printf("true1\n"); break; } } for(counter = 0; counter < 100; counter++) { if(requestinfo->resource[counter] == '\0') { printf("true2\n"); break; } } printf("2\n"); fflush(stdout); strcat(root, requestinfo->resource); printf("3\n"); fflush(stdout); return open(root, 0_rdonly); ... request info's stuff, needed struct reqinfo { char *resource; } i have created 2 string (character pointers) in c, reason when pass these methods strcat(), strcat() never returns. causes program hang. have tested ensure both strings have null terminators (so strcat isn't trying concatenate more should). pr...

many to many - Django: Reverse M2M query with a "through" model -

i have following setup: class ride(models.model): ... riders = models.manytomanyfield(user, through='rideriders', null=true, blank=true) class meta: db_table = 'rides' app_label = 'rides' class rideriders(models.model): user = models.foreignkey(user) ride = models.foreignkey(ride) # other information ... class meta: db_table = 'rides_riders' app_label = 'rides' so, example, can rides user using following (is best way?): ride.objects.filter(riders__id=user_id) i want able users particular ride can't seem figure out how. rideriders model seems sticking point can't seem pass beyond user. example: ride.objects.get(id=ride_id).riders.all() ...gives list of riderider objects (i think). any suggestions? edit: add more context, i'm attempting fetch riders particular ride api call using django rest framework. how i'm using it: class rideriders(generi...

javascript - ExtendScript get index number from searched Comp result -

i've got code sorting through various items in after effects , returning compositions in project, narrow down based on specific composition i'm looking for, in case 1 ending assemble. name , that's great need index number come along name, when search assemble return of app.project.item(3), index in project window. every time try number array seem total number of items doesn't help. thanks. function retrieveprojectitems(itemtype){ var typeoptions = ["composition", "folder", "footage"]; for(var t = 0; t<3; t++){ if(itemtype == typeoptions[t]){ var proj, itemtotal, curitem, itemarray; itemary = []; proj = app.project; itemtotal = proj.numitems; for(var = 1; <= itemtotal; i++){ curitem = proj.item(i); //alert(curitem.name); if(curitem.typename == itemtype){ itemary[itemary.length] = curitem.name; } } ...

html5 - Grails Project - Open dialog box -

in application, when hit run button scripted in gsp page as: <input type="button" value="run" onclick="submitjob()"></input> submitjob() function defined in extjs javascript file operations , calls controller code renders different gsp output page as: render(template: "/plugin/jobplot_out", model:[jobname:jobname], contextpath:plugincontextpath) in application in web browser displays output in same web page. how display same output in dialog box , not in same page? i new javascript posted question. did: had search div id of run button , had search url div id gets loaded. upon finding this, had write jquery code open dialog box , resulting output rendered there.

php - WNS X_WNS_MATCH bad request -

i've strange problem wns , push notification windows\ windows phone devices (8.1). if send push notification works well. problem when try send wns x-wns-match request. i'm sending current header: delete /?token=<channel> http/1.1 host: db3.notify.windows.com accept: */* authorization: bearer <token> content-type: text/xml x-wns-match: type=wns/toast;all content-length: 0 the answer service is: http/1.1 400 bad request content-length: 0 x-wns-status: dropped x-wns-error-description: content type not supported x-wns-msg-id: c51e1a17972ea7a x-wns-debug-trace: db3wns2011131 strict-transport-security: max-age=31536000; includesubdomains date: wed, 13 may 2015 21:05:06 gmt i've tried set in request header the: x-wns-type: wns/toast now doubt is: maybe server doesn't support delete method http? or maybe need set of different content type? i've followed wns documentation: https://msdn.microsoft.com/en-us/library/windows/apps/hh465435.aspx i'...

ios - WatchKit NSUserDefaults are null -

doing real basic test in setting / receiving data using nsuserdefaults. iphone app working , setting data fine, on watch, it's coming null. i have app group enabled both , have verified identical using same group. entitlement files each bit bit same. in viewcontroller.m defaults = [[nsuserdefaults alloc] initwithsuitename:@"com.defaultmethod.share"]; [defaults setobject:playername forkey:@"playername"]; [defaults synchronize]; in interfacecontroller.m - (void)awakewithcontext:(id)context { [super awakewithcontext:context]; // configure interface objects here. defaults = [[nsuserdefaults alloc] initwithsuitename:@"com.defaultmethod.share"]; [defaults synchronize]; } - (void)willactivate { // method called when watch view controller visible user [super willactivate]; nslog(@"playername: %@", [defaults objectforkey:@"playername"]); } and is: playername: (null) i've got missi...

html - Tidy adding too many newlines -

i quite new tidy, , trying format html files. have section looks like: <table> <tr><th class="x">some stuff:</th><th class="x"><span class="y">{{qwe}}</span></th></tr> <tr><th class="x">some more stuff:</th><th class="x">{{rty}}</th></tr> <tr><th class="x">thing 1 / thing 2 / thing 3:</th><th class="x">{{asd}} / {{fgh}} / {{poi}}</th></tr> <tr><th class="x">some file name:</th><th class="x"><a href="{{lkj}}" target="_blank">{{mnb}}</a></th></tr> </table> i created tidy config file: vertical-space: no wrap: 0 new-blocklevel-tags: section, header sort-attribute: alpha i ran tidy -config ~/tidy-config.txt -m myfile.html on file , section above gets formatted this: <table...

Send Mail Php oop -

this question has answer here: php mail function doesn't complete sending of e-mail 22 answers i plan create contact form. validation errors operating @ 100% when there no error when sending can not receive email , not know why. i've tried several ways can me. code this: contact: <?php require_once('../classes/db_funcoes.php'); require_once("../classes/contacto_class.php"); ?> <form method="post"> <p style="padding: 0 20px; margin-top: -15px;"><span style="color: red;"> <?php if(isset($_post['submit'])) { $sendmail = new contactos(); $sendmail->nome = $_post['nome']; $sendmail->email ...

sass - Fixed gutter width with susy -

i found example here fixed gutters ( http://sassmeister.com/gist/7da95c41fff076dd7266 ) , first looked simple: $susy: ( gutter-position: inside-static, container: 100%, columns: 4, column-width: 120px, gutter: 15px/120px, debug: ( image: show, ), ); i thought need change 15px , fine.. it's not. tried change it, no result. tried search on official website, didn't find gutter , gutters . difference? how gutter work? i columns percentages, fixed 25px padding. there no gutter setting. need use gutters . else here looks good.

eclipse - Authentication failed. Please make sure that you added your private key to the ssh preferences -

Image
i trying deploy jersey project openshift eclipse plugin getting error authentication failed. please make sure added private key ssh preferences have gernerated ssh key , saved in .ssh directory. added key on openshif- seetings- add new key- named id_rsa stored 1 in .git directory. openshift ssh key: the eclipse tooling needs private key matches public key in openshit. otherwise git in eclipse cannot clone git repo in openshift. make sure have private key set in eclipse ssh2 preferences. another possible reason (i dont habe enough details know) if you're telling openshift host install cartridge available in source git repo openshift should clone. above error shows using ssh-git-url. in case have make sure openshift host has private key clone git repo source code. known issue work around using cartreflect descrbed here: https://issues.jboss.org/plugins/servlet/mobile#issue/jbide-18866 https://issues.jboss.org/plugins/servlet/mobile#issue/jbide-18911 for d...

ruby on rails - Trying to switch from SQLite to PostgreSQL -

i using sqlite in development , test, , postgresql in production on heroku. replace sqlite postgresql. programming in cloud9 environment (rails 4). have no data potentially lose. what did do: first, edited database.yml: default: &default adapter: postgresql encoding: unicode pool: 5 development: <<: *default database: app_development test: <<: *default database: app_test production: <<: *default database: app_production then: in gemfile moved gem 'pg' production environment environments , removed gem 'sqlite3' i ran bundle install . i ran sudo service postgresql start i ran sudo sudo -u postgres psql and entered create database "app_development"; entered \q update: added following additional steps: i created new user in psql create user my_username superuser password 'my_password'; in database.yml added username , password in database.yml added host: myurl.c9.io i ent...

String Comparison from text file does not return anything -

i beginner in java, trying read text text file , compare strings created within class, reason not output on console , can't wonder why. here's simple code package binaryserver; import java.io.bufferedreader; import java.io.filenotfoundexception; import java.io.filereader; import java.io.ioexception; public class driverstate { public static void main (string[]args) throws filenotfoundexception, ioexception{ string driverstate=""; string not="not drowsy"; string yes="drowsy"; try(bufferedreader br = new bufferedreader(new filereader("c:/users/mohamed ayman/desktop/state.txt"))) { stringbuilder sb = new stringbuilder(); string line = br.readline(); while (line != null) { sb.append(line); sb.append(system.lineseparator()); line = br.readline(); } driverstat...

charts - PrimeFaces Piechart: Tooltips are not displaying in my local environment -

i have recreated example page shown in primefaces showcase at: http://www.primefaces.org/showcase/ui/chart/pie.xhtml the pie chart display , able tweak pie chart model available setters , getters, hovering on piece of pie not display tooltip @ all. this not browser issue, in same browser tooltips display on demo site. the jqplot-highlighter-tooltip div showing in html source, not getting updated on hover. there no errors shown in javascript console. i using 5.2 maven dependancy, , have tried 4.0 - no change. would appreciate ideas. thanks. the code managed bean follows: package org.primefaces.examples; import org.primefaces.model.chart.piechartmodel; import javax.annotation.postconstruct; import javax.faces.bean.managedbean; import java.io.serializable; @managedbean public class chartview implements serializable { private static final long serialversionuid = 1075867144472594293l; private piechartmodel piemodel1; private piechartmodel piemodel2; ...