Posts

Showing posts from August, 2015

I can't get contentOwnerID on youtube API -

I can't get contentOwnerID on youtube API - i can't contentownerid on youtube api. $contentownerslistresponse = $youtubepartner->contentowners->listcontentowners(array('fetchmine' => true)); $contentownerid = $contentownerslistresponse['items'][0]['id']; this code can't contentownerid. i'm using sample code here [uploading , monetizing video ]1. why can't contentownerid? please help me. youtube-api

meteor - MongoDB replicate / master slave without remove transaction -

meteor - MongoDB replicate / master slave without remove transaction - i have meteor , mongodb project, , consisted mongodb 2 replica set. what want create secondary db backup system. means, want maintain secondary data, if primary db removed user. the secondary replica set's info removed when primary's info removed , couldn't find method prevent this, , think master / slave same replica. is there solution or application this? thanks in advance- misconceptions first of all: master/slave replication considered deprecated , removed in future versions. shouldn't utilize more. has no advantages on running replica set 2 info bearing nodes , arbiter (except fact doesn't need arbiter, inexpensive in memory, disk , cpu usage). second: replication of kind isn't replacement backup, enhances availability of data. more replica set, since failover , tailback automatic. third: prevent databases beingness dropped, might want utilize authent

ruby on rails - public_activity custom activities -

ruby on rails - public_activity custom activities - i seek store activity using #create_activity public_activity gem: model class grouping < activerecord::base include publicactivity::common end controller def send_invitation @user = user.where(email: params[:user][:email]) @user.create_activity :send_invitation, owner: @group, recipient: @user redirect_to root_path end the error undefined method `create_activity' #user::activerecord_relation:0x007febb0f0a610 use should use @user = user.where(email: params[:user][:email]).first instead. without first, homecoming activerecord relation specified in error ruby-on-rails public-activity

php - serious bug with random numbers -

php - serious bug with random numbers - i create way reproduce bug having. when 2 or more users phone call page @ same sec modsecurity generates same sequence of random numbers (using rand() function php) both users. here demonstration of bug: http://quemfazsite.com.br/em_criacao/modelo9/teste.php opening page, 2 iframes load , each 1 should generating random numbers independetly of each other both frames generating same sequence of random numbers! simple source code can seen below. if dont see same sequence inquire reload page few times till same number sequence. edit: bug happens modsecurity active. if comment "loadmodule" line loads modsecurity bug wont happen! <?php if (isset($_get["test"])) { $output= ""; ($i=0;$i<10;$i++) { $output.= rand(0,99999999) . "<br />"; } echo $output; exit(); } ?> <iframe src="put_the_same_name_of_this_file_h

Error in google spreadsheet with arrays -

Error in google spreadsheet with arrays - in google spreadsheet receive error , says, "array result not expanded because overwrite info in m261". looked in m261 , blank cell, weird thing if nail delete button on empty cell, error goes away. sadly keeps coming back. there prepare this? here formula: =arrayformula(if(e2:e>0,if(d2:d=0,"need due date",""),"")) i did not see "array result not expanded because overwrite info in m261" @ 1 point did see "...add more rows". one approach should think work restrict output range of formula. illustration if wish apply 100 rows, use: =array_constrain(arrayformula(if(e2:e>0,if(d2:d=0,"need due date",""),"")),100,1) however problem mention , error message saw both because array formula. there seems little need such , like: =if(and(d2=0,e2>0),"need due date",) is much faster, specially big number of

r - Combining spatial data -

r - Combining spatial data - i trying combine 2 datasets found here: one world map taken map_data('world') , other lat/lon of black carbon emissions in 1960. merge 2 can summarize emissions based on country. far have been unsuccessful. my impression sp bundle right tool here. specifically, over() function world map beingness spatialpolygonsdataframe , emissions info beingness spatialpointsdataframe can't seem things work. any help much appreciated. happy hear of suggestions solid references on gis , r. edit: ended using data(countriescoarse) rworldmap bundle instead of map_data('world') . had advantage of beingness spatialpolygonsdataframe . over() appears working desired. took downwards broken link data. r gis sp rworldmap

Git history starting from a specific commit up to the last commit -

Git history starting from a specific commit up to the last commit - i know can utilize next command commit history starting specific commit first commit in history (going backwards). git log --pretty=format:"%h - %an, %ar : %s" "de37b49d8f06321275079e6b3a3f00aa22bbff99" however, how reverse display history starting specific commit -including it- lastly commit in history (going upwards)? thanks presuming de37b49 isn't merge commit git log --pretty=format:"%h - %an, %ar : %s" de37b49~1..head which saying "not reachable parent of de37b49" "reachable head" if merge commit, need utilize git log ... ^de37b49^1 ^de37b49^2 head (for many parents has, presuming 2) git

How to achieve Base64 URL safe encoding in C#? -

How to achieve Base64 URL safe encoding in C#? - i want accomplish base64 url safe encoding in c#. in java, have mutual codec library gives me url safe encoded string. how can accomplish same using c#? byte[] toencodeasbytes = system.text.asciiencoding.ascii.getbytes("stringtoencode"); string returnvalue = system.convert.tobase64string(toencodeasbytes); the above code converts base64, pads == . there way accomplish url safe encoding? it mutual simply swap alphabet utilize in urls, no %-encoding necessary; 3 of 65 characters problematic - + , / , = . mutual replacements - in place of + , _ in place of / . padding: just remove it (the = ); can infer amount of padding needed. @ other end: reverse process: string returnvalue = system.convert.tobase64string(toencodeasbytes) .trimend(padding).replace('+', '-').replace('/', '_'); with: static readonly char[] padding = { '=' }; and reverse: s

android - Store data in SQLite at first app execution -

android - Store data in SQLite at first app execution - i wonder if possible create sqlite database when app got run first time , save info in it. i don't want save every time app gets started. after installation. is possible? just override oncreate() method in class extends sqliteopenhelper , insert there data. called when database created first time. creation of tables , initial population of tables should happen. http://developer.android.com/reference/android/database/sqlite/sqliteopenhelper.html#oncreate(android.database.sqlite.sqlitedatabase) . android android-sqlite

ios - Alert before switch to maps if clicking on address in UIWebView -

ios - Alert before switch to maps if clicking on address in UIWebView - i using next code observe if link clicked in uiwebview , show alert. user needs confirm leave app. detection addresses in active. if user tapping on address straight switch maps app apple. want observe show alert before switching maps app. how can observe if address(location) clicked in uiwebview? -(bool) webview:(uiwebview *)webview shouldstartloadwithrequest:(nsurlrequest *)request navigationtype:(uiwebviewnavigationtype)navigationtype { savedlink = [request url]; if ( ( [ [ savedlink scheme ] isequaltostring: @"http" ] || [ [ savedlink scheme ] isequaltostring: @"https" ]) && ( navigationtype == uiwebviewnavigationtypelinkclicked ) ) { uialertview *leaveapp = [[uialertview alloc]initwithtitle:@"warning!" message:@"you want leave app?" delegate:self cancelbuttontitle:@"no" otherbuttontitles:@"yes", nil]; [leav

ios - Local notification app crashes simulator -

ios - Local notification app crashes simulator - i'm using local notification plugin (https://github.com/katzer/cordova-plugin-local-notifications/) ng-cordova ionic poject: this controller: .controller('dashctrl', function($scope, $state, $cordovalocalnotification) { $scope.addnotification = function() { $cordovalocalnotification.add({ id: 'some_notification_id' // parameter documentation: // https://github.com/katzer/cordova-plugin-local-notifications#further-informations-1 }).then(function() { console.log('callback adding background notification'); }); }; $scope.checkifistriggered = function() { $cordovalocalnotification.istriggered('some_notification_id').then( function(istriggered) { alert('istriggered'); }); }; }) i have button on default view loaded when app starts ng-click, so:

Display image from MYSQL using php pdo -

Display image from MYSQL using php pdo - having problem seeing image on webpage. verified image inserted correctly exporting blob field jpg file , viewing it. here code. why cannot see image on webpage ? $mysql2 = "select pfilename,actual_img brigpics pfilename = '".$flist."'"; $stmt = $db1->prepare($mysql2); $stmt->execute(); $stmt->bindcolumn(1, $pfname, pdo::param_str); $stmt->bindcolumn(2, $actual_img, pdo::param_lob); $stmt->fetch(pdo::fetch_bound); header("content-type: image/jpeg"); echo $actual_img; php mysql html5

php - Using multiple select boxes to filter MySQL data -

php - Using multiple select boxes to filter MySQL data - i have table echo'd php displays data. i'm trying info filter based on dropdowns , submit button. each individual dropdown query works 100%...just on own without elseif. i.e. if test them 1 1 , comment out others filter works, not when they're uncommented. here's code: if ($_post['racename']!="select race") { $racename = mysqli_real_escape_string($mysqli, $_post["racename"]); $filter = "select a.membershipid, a.firstname, a.surname, t.raceid, t.time, r.raceid, r.racename, r.distance, r.clubyear athlete inner bring together time t on a.membershipid=t.membershipid inner bring together race r on t.raceid=r.raceid r.racename= '$racename'

c# - Deserialize json array in web api project -

c# - Deserialize json array in web api project - my controller method follows public actionresult index() { tweets model = null; var client = new httpclient(); var task = client.getasync("http://localhost:33615/api/product").continuewith((t) => { var response = t.result; var readtask = response.content.readasasync<tweets>(); readtask.wait(); model = readtask.result; }); task.wait(); homecoming view(model.result); } the url homecoming row follws: [{"id":1,"name":"honda civic","description":"luxury model 2013"},{"id":2,"name":"honda accord","description":"deluxe model 2012"},{"id":3,"name":"bmw v6","description":"v6 engine luxury 2013"},{"id":4,"name":"audi a8","description":"v8 engine 2013"},{&quo

ruby on rails 3 - Designing the relationship between models where the child model attributes vary based on the "type" of its parent -

ruby on rails 3 - Designing the relationship between models where the child model attributes vary based on the "type" of its parent - how should go designing relationship between models when kid model's attributes vary based on parent type belongs to? for example: player has_many :projections fields on instance of projection vary depending on "type" of player belongs to. class player < activerecord::base attr_accessible :name, :position, :team has_many :projections validates_uniqueness_of :name, :scope => [:position, :team] end class projection < activerecord::base attr_accessible :ppr, :salary, :score, :week, :player_id belongs_to :player validates_uniqueness_of :ppr, :scope => [:week, :player_id] end so, want modify , add together attributes/fields projection fields different depending on "position" attribute of player model examples of new fields added are: :passing, :completions, :receptions, :targets

java - I keep getting an exception in main error after i enter my first array -

java - I keep getting an exception in main error after i enter my first array - for reason getting error: exception in thread "main" java.lang.stringindexoutofboundsexception: string index out of range: 11 @ java.lang.string.charat(string.java:646) @ identicalarrays.main(identicalarrays.java:28) /* * class: cs 2301/08 * term: fall 2014 * name: clarence e. hollins iii * instructor: rashad jones * assignment: 4 */ //create programme receives 2 strings user , prints whether or not identical import java.util.scanner; import java.util.arrays; public class identicalarrays { public static void main(string [] args) { scanner input = new scanner(system.in); system.out.println("enter list: "); string s = input.nextline(); char sizeofarray = s.charat(0); int size = (int)sizeofarray; int[] firstlist = new int [size]; for(int = 0; < firstlist.length; i++) {

c++ - Get system username in Qt -

c++ - Get system username in Qt - is there cross platform way current username in qt c++ program? i've crawled net , documentation solution, thing find os dependent scheme calls. i thinking couple of days ago, , came conclusion of having different alternatives, each own trade-off, namely: environment variables using qgetenv. the advantage of solution easy implement. drawback if environment variable set else, solution unreliable then. #include <qstring> #include <qdebug> int main() { qstring name = qgetenv("user"); if (name.isempty()) name = qgetenv("username"); qdebug() << name; homecoming 0; } home location qstandardpaths the advantage that, relatively easy implement, again, can go unreliable since valid utilize different username , "entry" in user home location. #include <qstandardpaths> #include <qstringlist> #include <qdebug> #include <qdir> int main(

java - nth number in the Fibonacci sequence -

java - nth number in the Fibonacci sequence - i not know how print, in fibonacci sequence number (nth number). bold text i'm having problem , have utilize while loop. please input number analysis >> 1 1 fibonacci number whose order in sequence both 2 , 3. please input number analysis >> 56 55 not fibonacci number. however 56 between 11 , 12. here code import java.util.scanner; public class while { public static void main(string[] args) { system.out.println("welcome fibonacci sequence detector\n\n"); scanner in = new scanner(system.in); system.out.print("please input number analysis: "); int input = in.nextint(); int fib = 0; int fib1 = 1; int n; while(true) { n=fib+fib1; if(input == fib1) { fib = -1; break; } if(input>fib1 && input < n) { break; } fib = fib1; fib1=n; } if (fib == -1 || input == 0) system.out.println(input+" fibonacci number order

How to run a batch file on all sub directories within a directory? -

How to run a batch file on all sub directories within a directory? - i have batch file (reduceflacpadding.bat) cut down padding in flac files within directory using metaflac.exe these flac files stored in subdirectories (one per album) within directory e:\flac library at moment processing flac files 1 album @ time, moving batch file targeted subdirectory each time. (the batch file set process flac files within directory) my question is; there way run batch file on *.flac files in subdirectories of e:\flac in 1 go? please allow me know if need more information windows 7 i alter command finds *.flac files find recursively rather running batch file on every directory. batch-file

c# - Assign Generic Exception a message -

c# - Assign Generic Exception <TException> a message - since lot of argument null checking, wanted simplify little bit. created next method: public static void throwexceptionif<texception>(bool condition, string message = null, params keyvaluepair<string, string>[] data) texception : exception, new() { if (condition) { return; } var exception = new texception(); data.asparallel().forall(d => exception.data.add(d.key, d.value)); throw exception; } which used like: public validatablebase(iuser user, ieventaggregator eventservice) : this() { exceptionfactory .throwexceptionif<argumentnullexception>(user == null || eventservice == null); this.user = user; this.eventservice = eventservice; } the problem can't assign message exception. message property readonly , generic doesn't see constrained type accepts parameters. i've seen people instance customexception , pass message

windows - Cannot create files in C:\ProgramData\ even after granting Users group full permission -

windows - Cannot create files in C:\ProgramData\ even after granting Users group full permission - we have application tries write access database (.mdb) in c:\programdata\ folder. on computers uac enabled find accessing database fails seems cannot create lock file. seems default (and perhaps due uac) users (including admins) don't have permission write applications folder default. we thought granting "users" grouping total permissions folder prepare problem, makes no difference. granting "everyone" total command still doesn't help. thing fixes problem seems to move database folder (eg c:\applicationname) not best practice or running application administrator privileges changing shortcut. how can create normal users can write (and create files) in c:\programdata\ folder? or misusing folder? under impression right place set shared programme info (for users) , many other applications seem have set info there on computer. update: i

Implementing Settings page in Android Application -

Implementing Settings page in Android Application - i new developer, , i'm trying implement settings page in android, not much luck. i using checkboxpreference, , i'm trying create sharedpreferences alter when check/uncheck checkboxpreference. here code: package com.entu.bocterapp; //imports public class settings extends preferenceactivity implements sharedpreferences.onsharedpreferencechangelistener { checkboxpreference pushnotificationsetting; checkboxpreference locationsupportsetting; protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); addpreferencesfromresource(r.xml.settings_design); initializeactionbar(); } public void initializeactionbar(){ actionbar actionbar = getactionbar(); actionbar.setbackgrounddrawable(new colordrawable(0xff50aaf1)); getactionbar().setdisplayoptions(actionbar.display_show_custom); getactionbar().setcustomview(r.layo

Different random number output at the same time (Unity C#) -

Different random number output at the same time (Unity C#) - i'm making first game using using unity3d written in c#. i'm doing part player can different attack chance. eg. if it's critical chance set 20%, it'll create critical damage. my problem it's random number generator making same output eg. when makes critical damage, create stun harm when requirements met. want is, there's different random value critical, stun, etc. have read can utilize random.next, it's not working in unity3d though it's both c#. i've done private float _criticalchance; private float _stunchance; // utilize initialization void start() { _criticalchance = random.range (0f, 1f); _stunchance = random.range (0f, 1f); } then see in it's debug.log outputs same value. this i've , want want. i'm getting , error when seek initialise variable method i've do. private float chance; private i

google bigquery - On streaming inserts we got timeout but only for certain rows -

google bigquery - On streaming inserts we got timeout but only for certain rows - we have streaming insert 72 lines, error message empty, , reason timeout , first 3 lines. error on line 0, reason: timeout, msg: error on line 1, reason: timeout, msg: error on line 2, reason: timeout, msg: how possible, , shall replay these 3 lines or rest of rows too? we have case 05044644 on paid google enterprise support. code segment is: $resp = new google_service_bigquery_tabledatainsertallresponse(); $resp = $bq->tabledata->insertall($project_id, $dataset_id, static::tableid(), $request); $errors = new google_service_bigquery_tabledatainsertallresponseinserterrors(); $errors = @$resp->getinserterrors(); if (!empty($errors)) { $error_msg = ''; if (is_array($errors)) { $line = 0; foreach ($errors $ep) { $arr = $ep->geterrors(); if (is_array($arr)) { foreach ($arr $e) { switch

java - spring boot external config -

java - spring boot external config - i trying load external properties file spring boot app. used @propertysource in config class. want remove annotation class not dependent on location. tried use: java -jar my-boot-ws.war --spring_config_name=file:///users/tmp/resources/ based on http://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html documentation next error: caused by: java.lang.illegalargumentexception: not resolve placeholder using annotation works fine move away that. help on great thanks ****** correction ******* sorry re-create paste error above command supposed be: java -jar my-boot-ws.war --spring.config.location=file:///users/tmp/resources/ i'm not trying alter name of config file add together additional location. explained here: if spring.config.location contains directories (as opposed files) should end in / (and appended names generated spring.config.name before beingness loaded).

windows - create process in user session from service -

windows - create process in user session from service - i trying create service create process in opened session in windows. have code: sessionid =wtsgetactiveconsolesessionid(); if (wtsqueryusertoken(sessionid,&dummy)) { if (!duplicatetokenex(dummy, token_all_access, null, securitydelegation, tokenprimary, &token)) { closehandle(dummy); homecoming false; } closehandle(dummy); // create process user desktop myfile = fopen("c:\\temp\\test123.txt", "a"); fprintf(myfile, "before create!!!!\n"); fclose(myfile); if (!createprocessasuser(token, null,null, null, null, false, create_new_console, null, null, &si, &pi)) { // "new console" necessary. otherwise process can hang our main process closehandle(token); myfile = fopen("c:\\temp\\test123.txt", "a"); fprintf(myfile, " create failed!\n"); fclose(myfile);

Mule ESB: Is it possible to start 2 instances of the Mule ESB -

Mule ESB: Is it possible to start 2 instances of the Mule ESB - i created 2 sepaerate directories in installed standalone mule esb server: /ee/mmc-distribution-mule-console-bundle-3.5.2-hf1 /ee2/mmc-distribution-mule-console-bundle-3.5.2-hf1 i start first server, , below status: [root@x240perf2 mmc-distribution-mule-console-bundle-3.5.2-hf1]# ./status.sh mmc running pid=1998. mule enterprise edition running pid=2619. then seek start sec instance: [root@x240perf2 mmc-distribution-mule-console-bundle-3.5.2-hf1]# ./startup.sh port 8585 in use, please create available , seek again. so apparently port 8585 beingness used original instnace so stop first instnace, , start sec istance, comes successfully, follows: ./startup.sh please come in desired port mule [default 7777]: starting mmc, please wait... class com.sun.jersey.multipart.impl.multipartconfigprovider class com.sun.jersey.multipart.impl.multipartreader class com.sun.jersey.multipart.impl.mu

ios - error refreshing Developer provisoning profile in xcode 6 -

ios - error refreshing Developer provisoning profile in xcode 6 - i getting error refreshing provisoning profile in xcode . moving xcode-> prefreneces->account->choosing team-> view details-> refresh, i error shown in next screenshot. working fine till yesterday , of sudden started crashing when seek click refresh button. generates same error when seek refresh in xcode 5 too. have done different yesterday have added new udid, but, far know not cause error. the same error generates when seek fetch team profile trying build ipa xocde 6 well. can help me solve problem? actually, server error. did nothing, next day, started working itself. so, apple server error. ios objective-c xcode

javascript - jquery click not chaning text/numbers correctly with if conditions -

javascript - jquery click not chaning text/numbers correctly with if conditions - i'm writing button jquery have problems conditionals. other problem have total_likes counter: if click , click unlike counter set 0 if 1 time again te counter goes 2 instead of 1... the php/html: if (total_likes > 0) { $hide = 'block'; } $hide = 'none'; $photos_box .= '<input type="hidden" class="tl' . $imgid . '" value="' . $total_likes . '" /> <a id="' . $imgid . '" class="like_button" title="' . $like_title . '">' . $like . '</a> //the counter <a id="" style="display: '. $hide . '"> <span id="color" class="mod' . $imgid . '">' . $total_likes . '</span> </a> // text <li id="counter" style="display: ' . $hide . ';">

c# - Edit a List item -

c# - Edit a List<Tuple> item - with list<string> can edit item this: var index = list.findindex(s => s.number == box.text); list[index] = new string; but, how apply on list<tuple<string, string>> example? var tuple = list.find(s => s.item1 == box.text); //assuming you're searching first string, can alter predicate anyway. tuple = new tuple<string, string>(new string, tuple.item2); as mentioned in other answer, can of course of study utilize index too, can find object , update it, should work well. c# list tuples

javascript - How to dynamically change meta tag viewport after page load in windows phonegap application? -

javascript - How to dynamically change meta tag viewport after page load in windows phonegap application? - i want dynamically alter meta tag viewport in "index.html" in windows phonegap app on button click. i using windows os 8 phonegap 3.5 device nokia lumia 1320 windows 8 os i want alter below meta tag <meta id="viewport" name="viewport" content="width=device-width"> to <meta id="viewport" name="viewport" content="width=720"> i have tried below urls nil worked windows phone. how set viewport 380x800 or 800x380 depending on orientation? setting viewport scale fit both width , height here found link says not possible alter meta tag dynamically in winodws 8 os http://www.quirksmode.org/blog/archives/2011/06/dynamically_cha.html try observe device/os , alter meta tag accordingly http://www.sitepoint.com/detect-mobile-devices-jquery/ javascript css html5

opengl - glutPostRedisplay not working inside a loop -

opengl - glutPostRedisplay not working inside a loop - i trying create man jump on y axis, utilize loop of 2 seconds, first sec should move downwards , bend knees, , sec second should move , finish in starting position. right starting create man go downwards , bend it's knees in first second, haven't programmed rest of animation. problem glutpostredisplay not refreshing screen within loop needed looks animation, re displays screen after loop has completed. how glutpostredisplay refresh screen within loop looks animation? case ' ': miliseconds = 0; movemany = 0; start = clock(); i=0; while (miliseconds<2000) { finish = clock(); miliseconds = (finish - start); sleep(1); if (miliseconds<1000) { movemany=movemany-0.02; } glutpostredisplay(); } break; glutpostredisplay not straight trigger redrawing screen. indicates scheme screen nee

ruby - Accepting polymorphic associations through checkbox in rails -

ruby - Accepting polymorphic associations through checkbox in rails - i have got products class,products visible 0 or many roles. so, have created polymorphic model called content_roles,which stores id of role , content_id (which product_id,or event_id),and content_type(product,event etc). i using nested_form gem accepting role id(using check_box) store product , role relation in content_role i error no implicit conversion of string integer in products#create function parameters: {"utf8"=>"✓", "authenticity_token"=>"xxxxxxxxxxxxxxxxxxxxdlh99zwlrf8dgt3gcbops=", "product"=>{"product_name"=>"some product", "product_description"=>"some product description", "content_roles_attributes"=>{"role_id"=>["1", "2", ""]}}, "commit"=>"create product"} in view have written = f.simple_fields_for :con

r - knitr source code box width -

r - knitr source code box width - knitr offers helpful background shading blocks of code. resulting shaded panels wider rest of text in article. how can code panels shading same width text sections? (you can see width in panels of code in yihui's book.) r knitr

c# - Errors with new MVC5 project in Visual Studio 2013.3 -

c# - Errors with new MVC5 project in Visual Studio 2013.3 - wondering if else has experienced , solution if so. in visual studio 2013 create new asp.net web application, leaving defaults are in next screen pick mvc, adding folders , core references mvc not other 2 options. authentication left @ individual user accounts , i've unchecked host in cloud option, shown below. the project wizard completes , can see there 26 errors in before else. the first prepare removes bunch of these errors views\account\ _setpasswordpartial.cshtml , _changepasswordpartial.cshtml files contain invalid models alter follows: [my project name here webapplication1, substitute own value] in _setpasswordpartial.cshtml: @model webapplication1.models.manageuserviewmodel @model webapplication1.models.setpasswordviewmodel in file _changepasswordpartial.cshtml: @model microsoft.aspnet.identity.manageuserviewmodel @model webapplication1.models.changepasswordviewmodel that drops me downw

Python-wand: How can I read image properties/statistics -

Python-wand: How can I read image properties/statistics - i trying extract statistics image such "mean", "standard-deviation" etc. however, cannot find related in python-wand documentation it. from command line can such statistics this: convert myimage.jpg -format '%[standard-deviation], %[mean], %[max], %[min]' info: or convert myimage.jpg -verbose info: how such info python programme using wand? currently, wand doesn't back upwards of statistic methods imagemagick's c-api (outside of histogram , exif). luckily wand.api offered extending functionality. find method need in magickwand's documentation. use ctypes implement info types/structures (reference header .h files) class="lang-py prettyprint-override"> from wand.api import library import ctypes class channelstatistics(ctypes.structure): _fields_ = [('depth', ctypes.c_size_t), ('minima', ctypes.c_double),

ios - Swift: Undefined Symbols -

ios - Swift: Undefined Symbols - im working xcode6. lastly memory i've remove swift file in project , add together again, , encountered error: you need @uiapplicationmain attribute appdelegate . or forgot add together appdelegate? @uiapplicationmain class appdelegate: uiresponder, uiapplicationdelegate { ... } ios xcode swift undefined

java - My program prints 0 as the Output all the time dispite that there are specific Words. I am trying to count the number of specif words in a document -

java - My program prints 0 as the Output all the time dispite that there are specific Words. I am trying to count the number of specif words in a document - paste source here: add new lines after "{" , before "}" add together new lines before "{" remove empty lines. add together comment lines before function. add together new lines after ";" add together new lines after "}" (for .css) (thanks david) remove new lines (useful if add together them 1 time again other functions above) add together new lines after ";" not in loops (don't check "remove new lines" check "remove empty lines")(thanks chris) (experimental, uses heuristic might fail ) add together new lines after ";" not in loops , skip quotes (don't check "remove new lines" check "remove empty lines") (thanks chris) (experimental, uses heuristic might fail ) cut down whitespace set code 1 time

javascript - get jsx compiler to ignore lines referring to other APIs -

javascript - get jsx compiler to ignore lines referring to other APIs - i'm using react.js create components in chrome content script. the react components should re-render when info in local storage changes. readuserinfo : function() { chrome.storage.onchanged.addlistener(function(object changes, string areaname) { this.setstate({userinfo:changes["userinfo"].newvalue}); }); with mount function componentdidmount: function() { this.readuserinfo(); } of course of study jsx compiler complains chrome api calls. how can jsx compiler ignore line, i.e. leave vanilla js? try instead: componentdidmount: function() { chrome.storage.onchanged.addlistener(this.onchromestoragechange) }, onchromestoragechange: function(changes, areaname) { this.setstate({ userinfo:changes["userinfo"].newvalue }) } i used react’s autobinding , removed invalid argument look had (probably copy/pasted docs). don’t forget remove listener when compo

MIPS assembly looping multiple .data -

MIPS assembly looping multiple .data - i'm wondering how store value 0xaaaaaaaa in loop throughout 4 of info words. i've been comfortable calling single info , looping that, i'm dealing 4 info words , have no thought how set them loop. here's have code far: .text main: la $t0, w la $t1, x la $t2, y la $t3, z li $t4, 0xaaaaaaaa loop: lb $t5, ($t4) bqez end: li $v0, 10 syscall .data w: .word 0 x: .word 0 y: .word 0 z: .word 0 mips

readline - Ignore lines while reading a file in Python -

readline - Ignore lines while reading a file in Python - the first part of programme requires me read in file ignore first few lines. file read in like: blah blah blah character(%% example) more blah. my question is, how read lines in file ignore %% , every line above it? just read , dump lines til find 1 want. file iterator internal buffering, differently depending on want afterwards. with open('somefile') f: # ignore first line "%%" line in f: if "%%" in line: break # process rest line in f: do_amazing_stuff(line) or perhaps with open('somefile') f: # ignore first line "%%" while true: line = f.readline() if not line or "%%" in line: break # process rest do_amazing_stuff(f.read()) python readline

java - Sorting Algorithms Comparison -

java - Sorting Algorithms Comparison - i have project, need test 3 sorting algorithms , find out 1 of them insertion sort, bubble sort, selection sort. can't reach methods test using stopwatch in java. created 3 arrays. int[] arr = new int[100000]; //this array sorted int[] randomarr = new int[100000]; //this array random int[] reversearr = new int[100000]; //this array reversed i tested these algorithms , here results : - sort1 sorted array took 11 seconds--reversed array took 13 seconds--random array took 24 seconds - sort2 sorted array took 12 second--reversed array took 12 seconds--random array took 10 seconds - sort3 sorted array took 1 millisecond--reversed array took 12 seconds--random array took 4 seconds i pretty sure sort3 insertion sort because faster other ones in sorted array. confused sort1 , sort2. bubble sort has o(n) in best case, insertion sort have o(n) in best case when check results, insertion sort best case 1 millisecond bubble sort&#

javascript - JS Form Validation: adding a red border on input fields with errors; removing it on focus? -

javascript - JS Form Validation: adding a red border on input fields with errors; removing it on focus? - i'm trying set form validation website. want accomplish is: when js detects empty field, puts reddish border around it; , later, when user focuses (puts cursor in input field) border removed , not return. tried doing css because may have been shorter way, reddish border returns 1 time user removes input field out of focus. it seems problem function parameter. js unable utilize parameter ( fieldname ) if in middle of method? ( document.contactform. fieldname .style.border="none !important"; ) here link illustration of problem on jsfiddle: http://jsfiddle.net/sonbrl2r/ the first function called upon form submission. if detects empty form puts reddish border around text field; the sec function meant remove said border upon focus of text field. html: <body> <form name="contactform" onsubmit="return formvalidate();&quo

pagination - How to add attribute class in theme('pager') in drupal 7? -

pagination - How to add attribute class in theme('pager') in drupal 7? - how add together attribute class in theme('pager') in drupal 7 ? my code following: $directory_table .= theme('pager', array('quantity', $staff_count ),array( 'element' => array( 'class' => array('pagination pull-right')))); but not applying class pager. as theme_pager function expects 1 parameter (an array of variables), theme function phone call should this: $directory_table .= theme('pager', array('quantity' => $staff_count, 'element' => array('class' => array('pagination pull-right')))); but: seems theme_pager sets 'pager' class ignoring variables may send function. so, best bet override theme_pager function. copying themes template.php file , renaming function mytheme_pager. can add together classes need in function, or add together logic need ad

Matlab GUI: Do I need to pass hObject AND handles? -

Matlab GUI: Do I need to pass hObject AND handles? - i new writing guis in matlab , noticed when passing info between callbacks 2 values hobject , handles passed. from read , understood, hobject handle object contains real info (or @ to the lowest degree handles it) , handles not handle, struct reproducing construction of objects "behind" hobject . changing (or adding to) handles not alter real info seen calling function local copy. write changed info object pointed hobject need phone call guidata(hobject, handles) . is right far or did wrong? i read can create struct similar handles calling handles = guidata(hobject) . so there point in passing both hobject , handles 1 of own functions instead of passing hobject , creating handles locally? you right far. input parameter handles handy way of keeping track of components of ui. standard handles not input parameter. if utilize guide set parameter follows setting illustration callba

xml - Use python to determine what element(s) a value is in -

xml - Use python to determine what element(s) a value is in - i've tried searching in every way can think, have had no luck. apologize in advance if has been asked answered in different way. what need help accomplishing: i have set of name values like: ['john smith', 'new york', 'toys'] , know exist in xml document, like: <doc> <people> <name>john smith</name> </people> <places> <name>new york</name> </places> <things> <name>toys</name> </things> <about> <name>john smith male.</name> </about> </doc> using elementtree, can loop through list , find values in document. what i'm trying figure out how title states is: loop through list , find values in document figure out xml tag(s) is/are around each value , homecoming tag name i can't figure out, imagine there mu

converter - How to convert raw BGRA image to JPG using GStreamer 1.0? -

converter - How to convert raw BGRA image to JPG using GStreamer 1.0? - i'm trying display raw image (1.8mb) gst-launch-1.0 . understand info needs encoded jpg before can achieve. if image stored jpg file story quite simple: gst-launch-1.0.exe -v filesrc location=output.jpg ! decodebin ! imagefreeze ! autovideosink however, need assemble pipeline display raw bgra 800x600 image (looks same above) dumped disk 3d application. this i've done far, problem creates black image on disk: gst-launch-1.0.exe -v filesrc location=dumped.bin ! video/x-raw,format=bgra,width=800,height=600,framerate=1/1 ! videoconvert ! video/x-raw,format=rgb,framerate=1/1 ! jpegenc ! filesink location=out.jpg can gstreamer handle task? solved! 2 major issues faced were: dump.bin symlink on scheme (cygwin) , reason gst-launch-1.0 unable work it; when working raw data, 1 must specify blocksize filesrc . ❄ gst-launch-1.0.exe -v filesrc location=dumped.bin blocksize=192000

ember.js - EmberJS - Computed property referencing firstObject do not update -

ember.js - EmberJS - Computed property referencing firstObject do not update - i have model this: app.conversation = ds.model.extend({ body : ds.attr('string'), created_at : ds.attr('date'), entry : ds.hasmany('entry', {async: true}), user : ds.belongsto('user'), allentriesloaded : ds.attr('boolean'), entryproxybody : function() { homecoming this.get('entry.firstobject.body'); }.property('entry.firstobject.body') }); as can see references entry hasmany relationsship in function entryproxybody. reference works great, calling entryproxybody indeed homecoming body-attribute first object in entry. however problem is, computed property not updated, when new value added entry-store. i add together new record this: app.newcontroller = em.objectcontroller.extend({ actions: { save: function() { var entry = this.store

haskell - "requested module differs from name found in the interface file" -

haskell - "requested module differs from name found in the interface file" - what want is: cabal build modules; make build 1 script. the script links objective-c (see https://github.com/mchakravarty/language-c-inline/tree/master/tests/objc/marshal-array). when build script, fails on import: $ create main.hs:1:1: bad interface file: dist/build/commands/osx/events.hi amiss; requested module main:commands.osx.events differs name found in interface file commands-0.0.0:commands.osx.events here file contents: $ cat makefile packages = -package template-haskell -package language-c-quote -package language-c-inline -package commands frameworks = -framework carbon -framework cocoa -framework foundation ldflags = $(packages) $(frameworks) main: main.o cabal exec -- ghc -o main main.o $(ldflags) main.o: cabal build cabal exec -- ghc -c main.hs -idist/build/ -v ... $ cat commands.cabal exposed-modules: commands.osx.events hs-source-di

objective c - iOS how to print the equivalent of "view memory of * " in xCode? -

objective c - iOS how to print the equivalent of "view memory of * " in xCode? - i'm trying print out "issuer" info available keychain item in ios. can't seem find proper encoding or understand how info stored. when take thew "view memory of*" alternative in xcode, see see text among garbage. i'm trying understand how can print both text , garbage memory pointer addressing. below screenshot of i'm trying do i tried these, either nil strings, or japaneese characters utf16 id info = [innerobject objectforkey:@"issr"]; nsstring* string8 = [[nsstring alloc] initwithdata:data encoding:nsutf8stringencoding]; nsstring* string16 = [[nsstring alloc] initwithdata:data encoding:nsutf16stringencoding]; nsstring* string16be = [[nsstring alloc] initwithdata:data encoding:nsutf16bigendianstringencoding]; nsstring* string16le = [[nsstring alloc] initwithdata:data encoding:nsutf16lit

javascript - Jasmine async test using promises -

javascript - Jasmine async test using promises - i doing jasmine testing using angular promises , have question related timing. found reply here unit-test promise-based code in angular, need clarification how works. given then method handled in asynchronous way how next test guaranteed pass. isn't there risk expect run ahead of then block beingness executed , run expect before value has been assigned. or... digest cycle guarantee value assigned before expect runs. meaning, digest cycle behave blocking phone call guarantees promises resolved before code allowed proceed. function someservice(){ var deferred = $q.defer(); deferred.resolve(myobj); homecoming deferred.promise; } ('testing promise', function() { var res; var res2; someservice().then(function(obj){ res = "test"; }); someservice().then(function(obj){ res2 = "test2"; }); $rootscope.$apply(); expect(res).tobe('test'); expect(res2).tobe(

ruby on rails - RoR get key name from hash -

ruby on rails - RoR get key name from hash - i new ror , working hashes. trying name keys hash can print them on page. maintain getting undefined method hash. i'm not sure i'm doing wrong , appreciate guidance. when run this: - position_names = @contest.positions.map(&:name) = position_names i this: undefined method 'name' {"name"=>"p", num=>"3", "ep"=>["sp", "rp"]}:hash what should here , best way name keys hash? if @contest.positions returns hash can list this:- @contest.positions.keys edited: try doing this:- names = [] names = @contest.positions.map {|array| array["name"]} this give names , can modify way want use. ruby-on-rails hash

c# - Flickering issue when overriding WM_PAINT in windows forms -

c# - Flickering issue when overriding WM_PAINT in windows forms - i guess generic issue , not limited combobox, have problem combobox. extended combobox object mycb mycb : combobox ) what happens every time hover on control, leave control, expand selection box or select value, command flickers. short while can see default (non-replaced) command beingness instantly replaced mine. i believe what's happening windows first draws "original" command (by calling base.wndproc() ) , repaints mine. the question is, can somehow stop windows painting it's own command , instantly paint mine? below code overriding wndproc protected override void wndproc(ref message m) { base.wndproc(ref m); if (m.msg == wm_paint) { graphics gg = this.creategraphics(); gg.fillrectangle(borderbrush, this.clientrectangle); // ... // //draw arrow gg.fillpath(arrowbrush, pth); // ... // if(this.text == &