Posts

Showing posts from August, 2015

package - What to do with setup.cfg in Python? -

in disutil2, seemed used for entire setup . disutils , setuptools have merged, see setup.cfg used stuff small options in addition setup.py, there. i hoping replace setup.py static config file. seems not can't replace it, have 2 files : .py , .cfg. is willingly have file little ? or can replace setup.py ? if not now, 1 day ? or stay additional config file have add bunch vars because of failed attempt @ making new standard ? what suppose ?

Does Liferay uses active internet connection to deploy to localhost? -

i using liferay first time. , saw 1 thing today. if not connected internet won't allow deploy project on localhost. is in built in functionality of liferay or there can problem @ end? mean in machine. i think yes, if haven't stored certificate locally in system, looks online. if have certificate stored problem @ end.

ios - Black launchscreen -

i have problem when run application. launchscreen black , have following message inside console: objc[4358]: class `springboard' not linked application corefoundation = 1240.100000 do have ideas ? is related question ? if yes, suggesting restarting simulator.

javascript - Code appended with JQuery does not fire click event on input file -

this question has answer here: event binding on dynamically created elements? 19 answers i appending small block of code has inside of image when clicked triggers click event on input file uploading. when page loaded and/or refreshed, there 1 block once changed, fires event append new one. <div class="add_new_image"> <div class="img"> <div class="file-upload-trigger"> <input type="file" name="imagem[]" class="none file-chooser" required/> <img class="more" src="/assets/auto/images/add_image.png"/> </div> </div> </div> the jquery code appending: $('#novo_anuncio .file-chooser').change(function() { readurl(this); $('#novo_anuncio .add_new_image').append( &

Java blocking local applet from running -

does know way enable java run local applet? work on os x java 8 update 71 java security settings go high high. don't know how add local file exception. doesn't accept it. this applet have html page links java class , run without ide, web browser. mean it's not complex program needs me jsp , sort of things.

iphone - iOS: Which function to override when I need to do something after the view is visible to the user? -

so first thing app list of movies api. i'm trying handle if there's network issue. currently, in viewdidload method, call "updateapiinfo", contains following code: if self.movies == nil { print("stuff went wrong") let alert = uialertcontroller(title: "network error", message: "there nework error.\nyou must connected internet use flicks.", preferredstyle: uialertcontrollerstyle.alert) alert.addaction(uialertaction(title: "exit", style: uialertactionstyle.default, handler: {(uialertaction) in uicontrol().sendaction(selector("suspend"), to: uiapplication.sharedapplication(), forevent: nil) })) self.presentviewcontroller(alert, animated: true, completion: nil) } when viewdidload calls updateapiinfo, message: warning: attempt present <uialertcontroller: 0x7fad10e3ad80> on <flicks.moviesviewcontroller: 0x7fad10e35cc0> view not i

objective c - addSubView not working, attempting to switch views -

// viewcontroller.m 1: - (ibaction)done:(id)sender { 2: 3: [self.view removefromsuperview]; 4: [self.view addsubview:masterviewcontroller]; 4: } error on line 4: "unexpected interface name masterviewcontroller :expected expression". have 2 view controllers: viewcontroller , masterviewcontroller . i've set first view viewcontroller i'm trying button change view. you can move first oneviewcontroller anotherviewcontroller using this. - (ibaction)buttonpressed:(id)sender { masterviewcontroller *createusercontroller = [[masterviewcontroller alloc] initwithnibname:@"masterviewcontroller" bundle:[nsbundle mainbundle] keywrapper:keychainwrapper]; [self presentviewcontroller:createusercontroller animated:yes completion:nil]; } and if using uinavigationviewcontroller can push viewcontroller like [self.navigationcontroller pushviewcontroller:createusercontroller animated:yes]; and using [self.navigationcontroller popviewc

java - Are javax.servlet-api and commons-dbcp important in our Spring Apps? -

how understand importance of javax.servlet-api , commons-dbcp in our spring application. when must use , implementation should do? because have build.gradle this dependencies { //compile('javax.servlet:javax.servlet-api:3.1.0') //compile('commons-dbcp:commons-dbcp:1.4') compile('org.springframework.boot:spring-boot-starter-thymeleaf') compile('org.springframework.boot:spring-boot-starter-data-jpa') compile('mysql:mysql-connector-java:5.1.31') compile('com.google.code.gson:gson:2.4') testcompile("org.springframework.boot:spring-boot-starter-test") } if remove javax.servlet-api , commons-dbcp build.gradle, application can still run expected. and (javax.servlet-api , commons-dbcp) in behind of scene? maybe know why, because it's has been covered out-of-the-box spring boot starter. but, explanation it, can't found anywhere. you don't need dependencies. javax.servle

rust - How to insert data submitted from an HTML form into a Redis database? -

i trying save user-submitted http data redis. code using nickel: #[macro_use] extern crate nickel; extern crate redis; extern crate hyper; use redis::{client,parser, commands, connection, redisresult}; use nickel::{nickel, request, response, httprouter, middlewareresult,middleware, mediatype,jsonbody}; use std::collections::hashmap; use nickel::status::statuscode; use nickel_redis::{redismiddleware, redisrequestextensions}; use hyper::url; use url::form_urlencoded; use std::sync::{arc, mutex}; use std::io; use std::io::prelude::*; use std::fs::file; fn save_db<'a>(req: &mut request, res: response<'a>) -> middlewareresult<'a> { let mut server = nickel::new(); /* fixme: connect redis*/ let client = client::open("redis://127.0.0.1/").unwrap(); let conn = client.get_connection().unwrap(); server.post("/confirmation", middleware!{|req, res| let mut form_data = string::new(); req.origin.rea

ios - Apple Push Notification can not send push on AWS EC2 -

i sent push notification simple push on local server success , app message normally. but push notification can not sent on aws ec2, sent android normally, check device token correct. i don't know why, please me! i found issue device token invalid, that, can not send push notification more. use houston on web server ruby. changed push instead of write, , now, work normally.

microsoft band - Convert and format data in a web tile -

i want create web tile microsoft band display json data received web service. service returns data in raw format, possible format them before displayed on band? or options display data returned service? for example timestamps returned numbers want convert human readable dates , times; or concatenate strings multiple json property. thank you. györgy conversion of data not possible. if need process json need build endpoint's json data (or create endpoint handles conversion).

commit - git I forgot to edit a line before commiting and pushing -

i decided integrate library code. add library, , change couple lines of code start implementing it. compiles, commit , push repo. i realise later i've missed line still on old code. give google search , find out git commit --amend , , lucky me, there no other commits. thought had fix line of code, git add file, git commit --amend , , git push repo, git tells me ! [rejected] master -> master (non-fast-forward) hint: updates rejected because tip of current branch behind i find strange since i'm on latest commit , if git reset -soft head~1 being aligned repo, besides single line of code i've changed. am doing wrong? don't want make entirely new commit single line of code should've been part of last commit. if want amend commit, need force branch remote: git push origin master --force keep in mind overwrite remote branch, might potentially cause havoc else sharing branch. also, need ascertain no new commits added remote bra

eclipse - Aptana 3: How to set PHP to execute a php file as a script? -

i new in php world , have install apatana 3 studio , have question php configuration in development environment. seems configuration work don't know if configured in smart way... i use ubuntu , have installed apache 2 web server executing simple php file (that inside /var/www folder) conteining phpinfo() functiion: <?php phpinfo(); ?> i obtain information , seems have installed apache 2 web server under path: /etc/php5/apache2 , php.ini file have path: /etc/php5/apache2/php.ini infact, part of phpinfo() output obtain: configuration file (php.ini) path /etc/php5/apache2 loaded configuration file /etc/php5/apache2/php.ini as web server use external version of apache+php , work well. doubt related execution of php file script (not on web server): if select php file inside project , do: run --> php script appear me error message me have set php executable location , open wizard it. so under: preferences ---> aptana studio ---> php ---> php

html - nesting an svg inside a div -

i trying create filled svg triangle placed @ some place on page. to accomplish wrap svg in div , place div appropriately. however, svg rendered outside of div. how svg element rendered inside div? i can't use <object> or <embed> tag due scripting , templating constraints sample html <div id="container"> <div id="inner_container"> <svg height="6" width="6"> <path d="m 0 6 l 3 0 l 6 6 l 0 6"/> </svg> </div> </div> and css #container {width:100px; height:25px; border:1px solid green;} #container #inner_container {width:6px; height:6px; border:1px solid red;} #inner_container svg path {fill:black;} the filled triangle should inside red rectangle rendered outside see on jsfiddle change css selector, write svg{...} , add float:left here path drawing not element. svg {fill:black; float:left} demo

sql - Update table according to the another table value -

i have 2 tables employees empid | empname | empdob and warehouseemployeers warehouseempid | position | province i need update employee table according warehouseemployers table's values. how update details employee table according warehouse province , position? i have tried it's not working: update employee set a.empname = 'steven', a.empdob = '5-5-1990' employee a, warehouseemployee b, a.empid = b.warehouseempid , position = 'manager', province = 'central' can please me in sql server? please use script update set a.empname = 'steven' , a.empdob='5-5-1990' employee inner join warehouseemployee b on a.empid = b.warehouseempid , position = 'manager' , province = 'central'

jquery - Using has() in a validation form -

hi guys i'm trying validate form, 1 of fields url , rules far are: rules: { url: { required: true, url: true}, name: { required: true }, provider: { required: true } } i use url:has(http) within rules check existence of protocol. how achieve this? try $.validator.addmethod("checkurl", function(value, element) { var return_val = null; var message = null; var reg = /http(s?):\/\/www/; if (!reg.test($(element).val())) { return_val = false; message = "false message"; } else { return_val = true; message = ""; } jquery.validator.messages.checkurl = message; return return_val; }, jquery.validator.messages.checkurl); use rules: { url: { required: true, checkurl: true}, name: { required: true }, provider: { required: true } }

How to specify Spark properties when starting Spark History Server? -

does know how set values in sparkconf when starting spark history server? if using <spark_home>/sbin/start-history-server.sh cannot specify command line argument can specify spark_history_opts environment variable , specify various environment variables like: - export spark_history_opts="$spark_history_opts -dspark.history.ui.port=9000 but if using <spark_home>/sbin/start-daemon.sh script can specify multiple command line options. this: - <spark_home>/sbin/spark-daemon.sh start org.apache.spark.deploy.history.historyserver -dspark.history.ui.port=9000

sonarqube - Sonar-SQL Queries in Java -

we can use sql query in .html.erb files , .rb files retrieve data sonar database. how can use sql queries in java files retrieve data sonar. there way this. examples. appreciated. you should not query directly db not api. please use sonar api instead. i understand currently, ruby templates directly query db through active record, evil db may change without notice. consequently, remove feature sooner or later , provide real api access resources on rails side. the database not api.

asp.net mvc - How to Insert an Inline Razor Expression into Javascript -

i have following script: <script type="text/javascript"> function addrow() { var count = $("#tbluploaddocs").prop('rows').length; count += 1; alert(count); var html = '<tr>'; html += '<td><input type="file" name="files" id="file' + count + '" /></td>'; html += '<td>bu dilden</td>'; html += '<tr>'; alert(html); } </script> i trying insert following line script, not achieve desired result: <td>@html.dropdownlist("ddlfromlanguage1", viewbag.languages selectlist)</td> i tried both , @: not make work. looking forward hearing solution. thanks in advance use <text> pseudo-element, described here , force razor compiler content mode: <script type="text/javascript"> function addrow() { <text> var count = $("#tbluploaddocs&

matlab - retrieve data at specific loop values -

i wondering how achieve following: have vector (scalar) called timesteps. timesteps increments according length of vector (nbins_max) set @ fixed length (but may change occasionally). declare 5 full system rotations use: timesteps = 5*nbins_max; i retrieve data each rotation of system. in pseduo-code i'm looking achieve following: where timesteps = each multiple of nbins_max retrieve data end i set manually @ each number of timesteps i'm interested in, however, due number of rollers in of systems prove tedious , potentially error prone! also, timesteps varies considerably in it's range, 1*nbins_max, 1000*nbins_max, perhaps more this! any pointers or general appreciated! reading richard the modulus 0 @ each multiple of nbins_max: where mod(timesteps, nbins_max)==0 retrieve data end hope helps?

c# - Generate xml with table constraints as tags and column names as value -

i need generate xml below 1 constraints tags , column name values specific db table in c#. <tablename> <key>productid</key> <composite> <column>productid</column> <column>productcode</column> <composite> <foreignkey> <column>productbaseid</column> </foreignkey> </tablename> can on this? here find primary key: select col.column_name information_schema.table_constraints tab, information_schema.constraint_column_usage col col.constraint_name = tab.constraint_name , col.table_name = tab.table_name , constraint_type = 'primary key' , col.table_name = 'tablename' if have multiple primary keys, them same query above. can count primary key , if more 1 can list them in composite. otherwise put them key. here point, if there 2 primary keys, in <key> tag ? here find foreign keys: select col.column_name information_schema.table_constrain

unity3d - Sorting array of points in clockwise order -

is there such algorithm sort array of 3d points in clockwise order? i'm dealing right triangle in case 3 points. (for build mesh) the algorithm sorting not difficult. problem is, plane points lie on. , side facing only bunch of points cannot clockwise or counter clockwise itself. need plane , side reference point edit : used said bit inaccurate. need position , direction reference, not plane

android - Fragment accessing other java class -

i have been searching internet, not correct answer need. new android, please provide detailed answer. i have fragment gets data user, ex: name, occupation etc. every single time data, store using gson sharedpreferences. based on searches, need construct regular java user class , pass object ( android - save object sharedpreferences , anywhere in app ). so question have is, can fragments access other regular java class functions? class userfragment extends fragment { // data edittext user newuser = new user("tom"); newuser.setoccupation("programmer"); //etc } can fragment instantiate class , set variables? if yes 1 , 2, add user class java file, same file fragment implementation of folder , include it? i provided user example, generically know answer 1 , 2. thanks yes fragment object can instantiate class object. yes can set variables , call functions on object. entirely you. if class small , local fragment class, can create inside

python - Issue with the optional list of label indices to include in the classification report -

i having issues labels , target_names attributes of sklearn.metrics.classification_report . the documentation says: labels : array, shape = [n_labels]. optional list of label indices include in report. target_names : list of strings. optional display names matching labels (same order). however, in cases not seem follow specify in labels , target_names . example: from sklearn.metrics import classification_report sklearn.preprocessing import labelbinarizer y_true = ['default_label', 'location', 'date', 'default_label', 'name', 'id', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label', 'date', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label', 'default_label

How to calculate run time for fork() system call in C? -

i'm trying find run time of fork() system call. each child process needs exit, , parent needs wait() on each child before creating next. want use shell built-in command named time measure execution time of program. i have code far, not sure if i'm doing right. #include <sys/types.h> #include <stdlib.h> #include <stdio.h> #include <unistd.h> int global = 100; int main(int argc, char** argv) { int local = 5; pid_t pid; pid = fork(); if (pid < 0) { fprintf(stderr, "error -- failed fork()"); return 1; } if (pid > 0) { int child_ret; waitpid(pid, &child_ret, 0); printf("parent -- global: %i, local: %i\n", global, local); printf("parent -- child exited code %i\n", child_ret); } else { global++; local++; printf("child -- global: %i, local: %i\n", global, local); exit (0); } }

Azure Data Lake : The request to Azure Data Lake Store was unauthorized -

we trying move our data azure table storage azure data lake. created data factory (with linked services, data sets , pipeline). pipline created copy action. one of linked service choose "azure data lake store" , authorized configuration , configuration below { "name": "xxxxxstorelinkedservice", "properties": { "description": "", "hubname": "xxxxxxdatafactory_hub", "type": "azuredatalakestore", "typeproperties": { "datalakestoreuri": "https://xxxxxx.azuredatalakestore.net/webhdfs/v1", "authorization": "**********", "sessionid": "**********", "subscriptionid": "xxxxxxxxxxxxxxxxxxx", "resourcegroupname": "xxxxxxxxxxxxxxx" } } } after creating pipeline , seems dat

ruby on rails - How to increment the value in Hash/Object without pre-defining them -

i working on rails project i have hash of products unique codes keys products = [ {"dt": "2016-01-01", "quantity": 122, "amount": 123000 }, {"dt": "2016-01-02", "quantity": 97, "amount": 97800 } {"dt": "2016-01-03", "quantity": 142, "amount": 163000 } ] my objective create sum of quantity of these 3 days report. iterate through object. want add new attribute each of object inside array named "total_quantity" increased in each iteration. products.each |row| rowqty += row['quantity'] rowamount += row['amount'] row['total_quantity'] = rowqty row['total_amount'] = rowamount end you can see define 2 additional variables "rowqty" , "rowamount" hold updated data before using them create new attributes of each object. but error

view - Codeigniter index.php page -

i'd set default page script views directory, example \application\views\index.php , delete index.php file root of application. possible? (i tried change value of config['index_page'] like, gives me error page not found). or maybe codeigniter has strict project structure can't such changes? you can't delete index.php file root directory, instead of can remove index.php url. you have define default controller first, follow steps have the.htaccess file in application root directory, along index.php file. (check if htaccess extension correct , bz htaccess.txt did not work me.) and add following rules .htaccess file, rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^(.*)$ index.php/$1 [l] then find following line in application/config/config.php file $config['index_page'] = 'index.php'; set variable empty below. $config['index_page'] = ''; that's it,

c++ - Knowing the type of the template outside the class -

to make clear, want imitate behaviour of value_type member of std::vector . for example: template <class t> class foo{ //some declaration , definition value_type }; int main(){ foo<int> bar; bar::value_type x=5; //x int } how can implement it? try: template <class t> class foo { public: typedef t value_type; }; btw: bar::value_type invalid, should use as: foo<int>::value_type x = 5; //x int

c# - Take contents of an excel file (.xls or .xlsx) in to Dataset -

i have excel file named test.xls , want contents in excel sheet dataset.is possible tried code throws exception,here code string filepath = server.mappath("portals\\_default") + "\\" + upprice.filename; upprice.postedfile.saveas(filepath); filestream stream = file.open(filepath, filemode.open, fileaccess.read); if (upprice.filename.contains(".xlsx")) { iexceldatareader excelreader = excelreaderfactory.createbinaryreader(stream); dataset result = excelreader.asdataset(); } i'm going assume you're using http://exceldatareader.codeplex.com/ from code: if (upprice.filename.contains(".xlsx")) { iexceldatareader excelreader = excelreaderfactory.createbinaryreader(stream); dataset result = excelreader.asdataset(); } else if (upprice.filename.contains(".xls")) { iexceldatareader excelreader = excelreaderfactory.createopenxmlreader(stream); dataset result = excelreader.asdataset(); } thes

login - How to only allow approved users to log in to my wiki? -

i have added column in wikidatabase in user table called approved_account . standard value on column 0 (zero). i add exception when user tries log in wiki, such if approved_account = 0 login attempt denied. does know how , should place if statement? edit: i've come far. using abortlogin hook, since need verify if statement true every time user tries log in. however, code won't let anyone in. blocks login attempts, if have correct value in approved_account field. can me fix this? <?php /** * prevent user accessing file directly , provide helpful * message explaining how install extension. */ if ( !defined( 'mediawiki' ) ) { echo <<<eot install test extension, put following line in localsettings.php file: require_once( "$ip/extensions/approvedaccount.php" ); eot; exit( 1 ); } // extension credits show on special:version $wgextensioncredits['parserhook'][] = array( 'name' => 'approved accoun

android - Simultaneous volley request always returns Server error -

i trying develop android application in hitting server api using volley. have made singleton requestqueue object , sending multiple json request 1 after other. when send first request, receive json object without error. parsing json, extracting ids , again making url , making volley request. time, getting "com.android.volley.servererror". below code: jsonobjectrequest jreq = new jsonobjectrequest(request.method.get, url, (string) null, new response.listener<jsonobject>() { @override public void onresponse(jsonobject jsonobject) { final volleyparser vp = new volleyparser(); arraylist<integer> searchids = vp.parsejsonobject(jsonobject, kf, null); r.cancelall("saz"); for(integer id : searchids) { final fetch pf = new productfetch(); string url = pf.searchurl(id.t

HTML button not working in Android WebView -

in android webview i'm displaying page html button works fine when makes request. button loads pdf document in browser when it's working correctly. i need post request, however, because passing lot of data in query string, when making post request nothing happens @ (on smartphone) or downloaded file corrupted (on tablet). same button works fine when clicked on windows browser, whichever of or post used. here's js code , html makes call: function exportpdf() { var name = document.getelementbyid('lblname').innerhtml; var surname = document.getelementbyid('lblsurname').innerhtml; var div = '<form id="myform" method="post" action="url"><input type="hidden" name="name" value="'+name+'"><input type="hidden" name="surname" value="'+surname+'"></form>'; jquery('#divexportpdf').append(div); jquery('#myfo

Java for loop isn't terminating in my code -

for reason loop not terminating in capitalizefirstsentence method. set breakpoint @ line , condition (i != -1) unmet, loop should terminate, doesn't! it works when use (i > 0) condition. i'm not sure what's going on here. import javax.swing.joptionpane; public class sentencecapitalizer { //main method public static void main(string[] args) { string input; //creates string hold keyboard input //prompt user enter string using joptionpane , set equal input input = joptionpane.showinputdialog("enter string. "); //display new string first letter of each sentenced capitalized joptionpane.showmessagedialog(null, capitalizefirstsentence(input)); //exit program system.exit(0); } //capitalize first letter of each sentence public static string capitalizefirstsentence(string in) { //creates stringbuilder object initiralized string argument "in" string

c++ - Abbreviated function template vs. function template with forwarding reference param -

what differences between function templates forwarding reference parameters template<typename t> void universal_func(t && a) { } and abbreviated function templates ? void auto_fun(auto && a) { } can replace universal_func auto_fun ? universal_func of auto_fun or equal? i have tested below program. seems both same. template<typename t> void universal_func(t && a) { } void auto_fun(auto && a) { } int main() { int i; const int const_i = 0; const int const_ref =const_i; //forwarding reference template function example universal_func(1); //call void universal_func<int>(int&&) universal_func(i);//call void universal_func<int&>(int&): universal_func(const_i); //call void universal_func<int const&>(int const&) universal_func(const_ref);//call void universal_func<int const&>(int const&) //auto calls auto_fun(1); //call void auto_fun<int>(

c# - How to deserialize this json to a list of objects? -

i got json msg (don't pay attention encoding) : { "u1000 r2v": { "carac1": ["câble d'alimentation rigide rond"], "optionvj": ["oui"], "carac4": [""], "carac3": ["pour alimentation de ligne électrique", "pour alimentation des moteurs"] }, "h05 vvf": { "carac1": ["câble souple rond"], "optionvj": ["oui"], "carac4": [""], "carac3": ["pour câblage des sélecteurs à clé", "pour alimentation des lampe clignotantes"] } } i've tried objects : public class typeproductlist { public list<producttypedto> cables { get; set; } } public class producttypedto { public string[] carac1; public string[] optionvj; public string[] carac4; public string[] carac3; } but doesn't work, don't know how because "pare

How to show a drop down menu when click on link jquery -

i know how trap click event on link. here code <a id="piclink_1" class="piclinks">...</a> $('a.piclinks').click(function() { //split @ '_' , take second offset var picnumber = $(this).attr('id').split('_')[1]; viewer.show(picnumber); }); i want show drop down menu appear 2 sub menu below link when click on link. , if click outside of link of drop down menu drow down menu hide.please guide me how can achieve this. thanks my markup like <a id="link">about</a> <div id="submenu"> <a href="#">about company</a><br /> <a href="#">careers</a> </div> try this $('a.piclinks').click(function() { $('#submenu').show(); }); var mousein = false; $('a.piclinks').click(function() { $('#submenu').hover(function(){ mousein =true;

ios - MvvmCross: RaisePropertyChanged not updating binding -

i instantiating view viewmodel this: var myview = new myview { datacontext = new myviewmodel() }; i want make view accessible anywhere in application adding view rootviewcontroller: window.rootviewcontroller.view.add(myview.view); where viewmodel inherits mvxviewmodel , myview inherist mvxviewcontroller inside myview binding uilabel text property this this.createbinding(mylabel).to<myviewmodel>(vm => vm.mytextprop).apply(); the text property defined inside viewmodel this private string mytextprop; public string mytextprop { { return mytextprop; } set { mytextprop = value; raisepropertychanged(() => mytextprop); } } the binding works when loaded. when change mytextprop property , raisepropertychanged called uilabel not being updated. i binding icommand works fine , triggers normally. instead of doing var myview = new myview { datacontext = new myviewmodel() }; let mvvm

c++ - Qsort doesn't sort properly array of strings -

i'm trying sort array declared string *names1 = new string[1]; (the size of array growing adding more items). i'm putting there strings. items in array before sorting are: novot svobodovaa novakj6 3 vondraj1234 after calling qsort(names1, size, sizeof (string), compare); , compare implemented this int compare(const void * a, const void * b) { return ( *(char*) - *(char*) b); } the items in array scrambled way vondraj1234 novakj6 novot svobodovaa does know, can bug doesn't allow me sort array in alphabetical order? you can only use qsort types can copied memcpy . std::string (and other type non-trivial assignment operator) not qualify. instead, use std::sort . knows how copy objects correctly.

swift - Postfix is reserved error -

the below code entered swift 2 , getting error saying "postfix reserved". can tell me how went wrong? if (pfuser.currentuser() == nil){ self.loginviewcontroller.fields = pfloginfields.usernameandpassword | pfloginfields.loginbutton | pfloginfields.signupbutton | pfloginfields.passwordforgotten | pfloginfields.dismissbutton can ensure or compound expression not contain spurious spaces?. can spot 1 before .loginbutton. have corrected here. please check- if (pfuser.currentuser() == nil){ self.loginviewcontroller.fields = pfloginfields.usernameandpassword | pfloginfields.loginbutton | pfloginfields.signupbutton | pfloginfields.passwordforgotten | pfloginfields.dismissbutton

binomial theorem - Finding the last digit of certain number raised to any power -

i'm trying find last digit of result of number raised power, using binomial theorem, not modulus or something. please explain me why last digit of number's unit number raised power same original number raised same power using binomial theorem. ex. xv^y = v^y also, found out each integer each cyclicity , understand that. i'm confused since: 17^8 = 7^8 = 7^4 since 8 multiple of 4. why not 7^2 = 7^8 well? 8 multiple of 2. it's because of last digit raising power several times , not power. 7^1=...7 <= 7^2=...9 7^3=...3 7^4=...1 7^5=...7 <= 7^6=...9 7^7=...3 7^8=...1 7^9=...7 <=

javascript - Reseting Dropdown menu Jquery -

i'm trying make reusable dropdown menu using css/jquery : https://codepen.io/anon/pen/nxxxpg can find way reset 'active' when clicking on blank space or html element? in advance ! heres code $(document).ready(function(){ $('.drpd-ver > .label').on('click', function(){ // check if active class there , remove if if($( ).hasclass( "active" )){ $(this).removeclass('active'); } else{ // else remove other opened tabs , add needed 1 $('.drpd-ver > .label').removeclass('active'); $(this).toggleclass('active'); } }); // removing active class if clicked anywhere else ?? }); body{ background-color: lightblue; } .drpd-ver{ position: relative; display: inline-block; font-size: 16px; color: #000; margin-left:400px; } /* click expand button */ .drpd-ver label{ box-sizing: bord

php - Laravel - Functional Testing: current route is not get cleared -

we using laravel version 5.0, perhaps issue apply laravel 5.0+ too. in functional tests if call paths, router finds matching routes, if call 404 url, router not resets current route: public function testpages() { $response = $this->call('get', '/about'); $this->assertequals(200, $response->getstatuscode()); // \route::current() not null // call 404-route $response = $this->call('get', '/asdfasdfasdf'); $this->assertequals(404, $response->getstatuscode()); } when handling 404 call \route::current() in view composers, , running tests not null , running in browser null . how reset laravel state initial between $this->call() s? my current solution add $this->refreshapplication() before each of $this->call() : public function call($method, $uri, $parameters = [], $cookies = [], $files = [], $server = [], $content = null) { $this->refreshapplication(); if (0 !== strpos($u

android - Swipe action on Application screens -

i need common swipe gesture application. how can possible. suppose have app 2 activity , whenever swipe(left/right) on of screen , action . but don't want attach swipe gesture separately in activity. need common place attach it. (because may have many screens , fragments)

android - nullpointerexception when trying to get json array or json object from json string -

this question has answer here: android problems parsing json 2 answers hello keep getting npe when try object jsonstring. tried alot of things changed json coople of times it's not working. httpresponse works fine , when log "myobject" gives right object. when try object in it gives me npe. tested json , valid. tried retrieve array instead of object gives npe. can tell me how fix this. i made simple jsontester activity test json: public class jsontester extends activity { private defaulthttpclient createhttpclient() { httpparams my_httpparams = new basichttpparams(); httpconnectionparams.setconnectiontimeout(my_httpparams, 3000); schemeregistry registry = new schemeregistry(); registry.register(new scheme("http", plainsocketfactory.getsocketfactory(), 80)); threadsafeclientconnmanager multithreadedconnectionmanager = n