Posts

Showing posts from April, 2011

javascript - how can append db values to a href (phonegap) -

this html page nextpage.html im lookig display db values category_id , category_name php controller in html page. clicking on category_name want go next html page , category_id passed page pls me.....pls </div> <div data-role="main" class="ui-content"> <form id="nextform" > <ul data-role="listview" data-inset="true" id="category"> <li> <a></a> </li> </ul> </form> </div> my js nextpage.js var base_url = "http://dev.edfutura.com/nithin/jps/edfuturamob/"; $(document).on("pageinit", "#catlist", function() { var submiturl = base_url + "categorylist/get_categorylist"; //$("#loading").css("display", "block"); $.ajax({

uibutton - What is the equivalent of Android's weightsum in iOS -

Image
i have bunch of uibutton's want them equally distributed on screen screensizes. possible achieve without using autolayout? view fits on 640*960 screen, if larger there empty space in bottom. there equivalent of weightsum in ios? have attached 2 images shows how view looks on 640*960 (second image) , 640*1136 (first image) screen. i suggest choose auto layout kind of behaviour. in case pretty straightforward constraints set in ib. if prefer setting code, visual language. also, me, bit of overkill, may use uicollectionview

the read only property is not able to disable using jquery -

this question has answer here: disable/enable input jquery? 8 answers in jquery according condition make 1 field read below code $("#name").attr("readonly", true); it working fine but when try disable using below codes $("#name").attr("readonly", false); or $("#name").attr("disabled", false); it not getting disabled. how can achieve it the value of disabled attribute not matter. if in attribute list, element disabled regardless of whether false or true or empty . need remove attribute enable back. use $("#name").removeattr('disabled') re-enable element.

multithreading - C# Form closing all threads join -

i have simple piece of code: private volaile bool working; private volatile list<thread> threads = new list<thread>(); private volatile form face; public void start(int n) { working = true; (int = 0; <= n; i++) { thread worker = new thread(() => { while(working) { // work } }); threads.add(worker); worker.start(); } } public void stop() { if(working) { working = false; logger.info("waiting threads join"); foreach (thread worker in threads) { worker.join(); } logger.info("threads joined"); } } private void face_closing(object sender, system.componentmodel.canceleventargs e) { face.invoke(new action(() => {stop();})); system.environment.exit(0); } face form creates on programm start , have controls, when use start() , stop() methods, works fi

updating a record at runtime using jdbc -

i have problem updating password @ runtime. gives no error doesn't work. please . in advance! here code: //here problem part not working try { system.out.println("id : "+j); system.out.println("what want new password be?"); scanner s8=new scanner(system.in); string s7=s8.nextline(); class.forname("com.mysql.jdbc.driver"); connection con5=drivermanager.getconnection("jdbc:mysql://localhost:3306/login","root","q"); preparedstatement ps=con5.preparestatement("update pass set password=? id=?"); ps.setstring(1,s7); ps.setint(2,j); } catch(exception e) { system.out.println(e); } you miss execution of statement using preparedstatement.executeupdate() . javadoc executes sql statement in preparedstatement object, must sql data manipulation language (dml) statement, such insert, update or delete; or sql statement returns nothing, such ddl state

ubuntu - How to resolve java errors that pop up when loading Mirth Connect Administrator -

i inherited server running mirth connect little documentation. mirth connect server running fine on server, , able connect web portal via port 8443 (and can log web-based administrator without issues). my problems occur when run ice tea java web start. things go fine until enter credentials , interface starts build; receive following error notice: could not load code template plugin: com.mirth.connect.connectors.http.httpsendercodete mplateplugin net.sourceforge.jnlp.runtime.jnlpclassloader.loadclass(jnlpclassloader.java:1535) java.lang.class.forname0(native method) java.lang.class.forname(class.java:191) com.mirth.connect.client.ui.loadedextensions.initialize(loadedextensions.java:131) com.mirth.connect.client.ui.frame.initializeextens ions(frame.java:484) com.mirth.connect.client.ui.frame.setupframe(frame .java:382) com.mirth.connect.client.ui.mirth.<init>(mirth.jav a:62) com.mirth.connect.client.ui.loginpanel$8.doinbackg round(loginpanel.java:438) com.mirth.conn

Implementing Charts.js in Laravel 5.1 -

hi i've been wondering around net getting answers can't find one. i'm trying display chart using charts.js.. in route: route::get('surveys/chart', 'aboutcontroller@projectchartdata'); in aboutcontroller: used json_encode() pass data view public function projectchartdata() { $devlist = json_encode(db::table('surveys') ->select(db::raw('monthname(updated_at) month'), db::raw("date_format(updated_at,'%y-%m') monthnum"), db::raw('count(*) projects')) ->groupby('monthnum') ->get()); return view('pages.chart',compact('devlist')); } in view: <canvas id="projects-graph" width="1000" height="400"></canvas> <script type="text/javascript"> $(function(){ $.getjson("surveys/chart", function (result) { alert('&#

ios - Get black & white image from UIImage in iPhone SDK? -

Image
i want convert image pure black & white. tried , got result left image have attached , result should right image have attached according requirements of application. i have used lots of cifilter ( cicolormonochrome, cicolorcontrols, ciphotoeffecttonal etc.) none of working. please check below code , attached result of images. - (uiimage *)imageblackandwhite { ciimage *beginimage = [ciimage imagewithdata: uiimagejpegrepresentation(self.captureimage.image, .1)]; //ciimage *beginimage = [ciimage imagewithcgimage:self.cgimage]; ciimage *output = [cifilter filterwithname:@"cicolormonochrome" keysandvalues:kciinputimagekey, beginimage, @"inputintensity", [nsnumber numberwithfloat:1.0], @"inputcolor", [[cicolor alloc] initwithcolor:[uicolor whitecolor]], nil].outputimage; cicontext *context = [cicontext contextwithoptions:nil]; cgimageref cgiimage = [context createcgimage:output fromrect:output.extent]; uiimage *newima

java - Building scala with SBT to make JAR and folder with dependencies -

i have project in scala (a kind of test utility) used in sbt run way. demo want prepare in form not require sbt or scala preinstalled (only jvm ). first i've tried use sbt-assembly plugin lost fighting duplicate entries. i'm curious whether can compile to: single jar -file containing application itself; and lib directory containing raw set of dependency jars. i hope in such case easy run of main-class , class-path: ./lib/* fields in manifest - wrong? if correct, how can achieve this? update: @ last conquered (it seems so) sbt-assembly approach, question not urgent (though i'm still curious extend knowledge of using sbt). when execute sbt-assembly , depedencies, app , resources package single jar file. you can override config properties in runtime by: java -cp conf/:myappdemo.jar app.run.mainclass put config properties files in conf folder.

javascript - How to using two <script> 's in single View Page -

i have write code onload function. have scritps execute in click function. in same script window.load=alert("loaded"); not working open new <script> window.load = alert("loaded"); </script> is working. whats wrong code.. thanks in advance. i think you. <!doctype html> <html> <body onload="myfunction()"> <h1>hello world!</h1> <script> function myfunction() { alert("page loaded"); } </script> </body> </html>

How can I send message to phone by using diafaan sms gateway with php -

i want send message web phone using diafaan sms gateway .but cann't send message using diafaan server api.the error "no recipient phone".if substitute to="my phone number",it correctly sent.how can that? $diafaan_user = "admin"; $diafaan_password = ""; $diafaan_url="http://localhost:9710/http/send-message?username=admin&password=&to=%2b44xxxxxxxx&message-type=sms.automatic&message=message+text"; function diafaansend($phone_no, $activate_code, $debug=false){ global $diafaan_user,$diafaan_password,$diafaan_url; $url.= 'username='.$diafaan_user; $url.= '&password='.$diafaan_password; $url.= '&action=sendmessage'; $url.= '&messagetype=sms.automatic'; $url.= '&recipient='.urlencode($phone_no); $url.= '&message='.urlencode($activate_code); $urltouse =$diafaan_url.$url; if ($debug) { ec

java - Prevent RecyclerView showing previous content when scrolling -

i have recyclerview gridlinearlayout , custom adapter. content of each item picture downloaded using json , parsing it. basically grid of pictures. everything works fine, however, when scrolling down content, , going again, shows previous views in each item less second, , show proper picture again. what prevent or fix this? in advance and/or guidance provide. this adapter code: package jahirfiquitiva.project.adapters; import android.content.context; import android.graphics.bitmap; import android.support.v7.graphics.palette; import android.support.v7.widget.recyclerview; import android.view.layoutinflater; import android.view.view; import android.view.viewgroup; import android.view.animation.animation; import android.view.animation.animationutils; import android.widget.imageview; import android.widget.linearlayout; import android.widget.progressbar; import android.widget.textview; import jahirfiquitiva.project.activities.wallpapersactivity; import com.koushikdutta.async.

html - full-screen fit images in two columns -

i'm beginner , tried make 1 page myself, however, result not good. try explain need: full-screen page 2 images, 1 image cover 50% of horizontal space of browser window, , second image on right side covering rest of page. need both images responsive , keep 100% height. when window resized, left , right sides of both images cropped. similar this: http://www.gt3themes.com/website-templates/soho/striped_landing.html is difficult make? tried follow guides on web, result images stretched , not cropped. maybe wrong , need create 2 columns , put images inside? appreciate help. my current code is: .photo{ size: 100%; position: relative; overflow: hidden; } .photo img{ max-width: 50%; height: 100%; } the site linked more or less did this: http://jsfiddle.net/xnln6s5o/ html <div id="container"> <div id="left" class="halfwidthcontainer"> <div id="left-image" class="image"&

go - Using new and assigning variable at the same time -

wd := new(time.weekday) fmt.println(wd.string()) the above 2 lines return sunday (weekdays start 0) is possible me assign value along new ? other method tried var wd time.weekday wd = 3 this 1 returns wednesday time.weekday int can assign such (or use defined constants adam suggested). can ask why need use new in situation? package main import ( "fmt" "time" ) func main() { var wd time.weekday = 3 fmt.println(wd) }

php - Wordpress connection error when update PHP5.4 and having MySQL4.1+ -

i have quite few problems page im helping fix. notice im not experienced in wordpress. right im trying use php5.4 globally on wordpress have installed. comes error database user , password might wrong. changed password instructed in quite few posts time ago. wont fix problem. right wordpress work php5.2 , mysql4.1+ if thats got problem. cant update mysql cause of server wordpress in. read problem having php5.4 , mysql5.1 there compatibility issues hashing of password. can point me in right direction. need upgrade php 5.4 cause need install plugin needs it. when read error .log, pops up: [01-jul-2015 16:47:56 utc] php warning: mysql_connect(): mysqlnd cannot connect mysql 4.1+ using old insecure authentication. please use administration tool reset password command set password = password('your_existing_password'). store new, , more secure, hash value in mysql.user. if user used in other scripts executed php 5.2 or earlier might need remove old-passwords flag my.cnf file

android - Push Notification on My app? -

Image
hi developing university android app , in have announcements section if announcement/notice appear university has updated , send via push notification end users. would suggest me best way it. use parse.com sending notifications , less code. first create accound in parse.com, next set parse.com sdk in app, use link . there 2 ways send push notifications using parse: channels , advanced targeting.sending notifications done parse.com push console, rest api or cloud code. the simplest way start sending notifications using channels. allows use publisher-subscriber model sending pushes. devices start subscribing 1 or more channels, , notifications can later sent these subscribers. eg:- channel "new books in library" give notification have subscribed channel. a channel identified string starts letter , consists of alphanumeric characters, underscores, , dashes. subscribing channel can done using single method call. example, in university app, do: parsepu

opengl - Unexpected results with GLSL when using 1D texture buffers -

in following test program, trying render green square (250 x 250) in bottom left corner of screen (500 x 500). i using 2 buffer textures pass in 2 int arrays (each array of size 500 * 500) fragment shader. arrays populated x (first array) , y (second array) values correspond (x, y) coordinates in screen space (this shown in init() part of code below). in fragment shader, if current fragment location (in screen space) less 250.0 in both x , y directions, fragment colored green. otherwise, colored red. images shown below. below full opengl code, along pass-through vertex shader (located in main program) , fragment shader (read in file). in fragment shader, there 3 tests (a, b, , c). tests b , c not working expected. draw green square on bottom right instead of bottom left. test (correct): output of code works expected (a green square in bottom left corner of screen) when use gl_fragcoord.xy in conditional if check. test b (incorrect): if use buffer textures along tex

liquid - How to hide products in Shopify search results based on a vendor name -

i'm in situation hiding vendors products in control panel isn't options due outside pos. test in search.liquid, used search.terms below. code works not type thevendor same way , see products if don't type thevendor. {% item in search.results %} {% if search.terms == 'thevendor' %} {% else %} {% include 'search-result' %} {% endif %} {% endfor %} i tried figure out how write code hide these products in better way. tried product.vendor below when search products individually not hidden. code: {% item in search.results %} {% if product.vendor == 'thevendor' %} {% else %} {% include 'search-result' %} {% endif %} {% endfor %} can tell me i'm missing here? seems doesn't know product.vendor when print out vendor is, displays vendor. don't understand why it's not hiding products associated vendor. {% item in search.results %} {% if item.product.vendor == 'thevendor' %} {% else %} {% include

Find an element when parsing HTML with jQuery no matter where it is -

how access element when parsing html jquery no matter is? more specifically, why equals 0 : $('<div class="messages"><p>just test.</p></div><div class="messages">another test</div>') .find('div.messages').length == 0 where equals 1 should: $('<div><div class="messages"><p>just test.</p></div></div>') .find('div.messages').length == 1 okay, can wrap every time, have to? the problem can't know if element i'm looking root element or not. in given html document need find no matter is. jsfiddle you need use filter() , filter root elements, .find() search descendant elements of root set find matches. snippet.log($('<div class="messages"><p>just test.</p></div>').filter('div.messages').length); <script src="https://ajax.googleapis.com/ajax/libs/jquery

angularjs - Angular-JS SEO no longer working -

we have site went live on aws. i'm using angularjs in front end make restful calls via restangular play framework backend. our service provides ability our clients dynamically create pages , push , changes/news items/etc deem necessary. includes dynamic "urls" can change on fly within our domain (like www.ourproductname.com/thisisanexample). 1 of things allow them change header item code is: <h1 class="text-center"> {{data.title}} </h1> when went live few weeks back, working fine google search. got things expected in title field. now, few weeks later, our searches still in top page of google, it's returning: {{data.title}}-name of our product i've done significant research this, , have been told "huh, that's weird...it should work." reply has , no longer is. registered when first started google webmasters , did fetch on page , registered crawler specific client url's have far, hasn't helped. i know cr

PHP Display a search result from MySQL Search -

i have 3 php pages: search.php sets out form fields used query mysql database query.php queries database variables set in search.php , , return result array (which can large array), redirect result.php result.php , display results in table form. page not connected database, , page bookmarkable, ie if bookmarks page, display result again without quering database. my problem don't know how make result page bookmarkable.. used session carry variable query.php result.php once browser closed, result page display nothing. if can help, highly appreciated. 1. bookmarks: know, browser bookmarks save link page, wise use $_get[] variables fields in form every time 1 visits page, server know search parameters automatically url eg. $search = $_get["s"] //query database parameter $search they bookmark link this: www.example.com/result.php?s=snoopy server know "snoopy" search term. 2. saving data "if bookmarks page, display res

c# - How can I open a file I've added to my Windows Store App project programatically? -

Image
i want load pdf file in response tapped event. i added file project (add > existing item), set "build action" "content" , "copy output directory" "copy if newer" i'm thinking code need may this: async task loadtutorial() { await launcher.launchuriasync(new uri("what should here access output folder?")); } if i'm right, need pass uri? otherwise, how accomplished? update on related note, add image xaml using suggested scheme, thought work: <image source="ms-appx:///assets/axxandspacelogo.jpg"></image> ...but doesn't. update 2 trying open pdf file (which located in root of project, not in subfolder): async private void opentutorial() { istoragefolder folder = windows.applicationmodel.package.current.installedlocation; istoragefile file = await folder.getfileasync("ms-appx:///platypustutorial.pdf"); await launcher.launchfileasync(file); } ...resulted

r - I cannot subset my data frame using column values -

i want subset data frame based on specific values of a column. code : data <- read.csv("file.csv") data1 <- data[ ,week_no < 2] write.csv(data1, "joda.csv",row.names=false) but r gives me error : error in `[.data.frame`(data, , week_no < 2) : object 'week_no' not found the column exists,but don't know why receive error. thankful if can help. there 3 errors in code, follows use mtcars dataset example; subset dataset condition disp < 200 data(mtcars) first index position wrong c8h10n4o2 noted in comments). when subsetting column wanting select rows match constraint. adding constraint in row position data[row, col] mtcars[mtcars$disp < 200, ] you need tell r disp is. will give error there no object called disp in global environment. seems presistent mistake making. mtcars[disp < 200, ] error in [.data.frame (mtcars, disp < 200, ) : object 'disp' not found so need pass dataframe na

c# - Best way for acquiring an element's height -

the code gets desired height element given datatemplate , object bound content. however, slow. have alternative, or idea how optimize code. public static double getdesiredheight(object content, datatemplate datatemplate) { try { contentpresenter element = new contentpresenter { content = content, contenttemplate = datatemplate, }; element.measure(new size(double.positiveinfinity, double.positiveinfinity)); var result = element.desiredsize.height; element.contenttemplate = null; return result; } catch (exception) { return 0; } } have tried using actualheight property instead of height property? try change line: var result = element.desiredsize.actualheight;

virtualenv uses Python 2.6 instead of 2.7 -

i created virtualenv , installed packages pip. want use python 2.7, default version on system. env's lib folder contains folder python 2.6, not 2.7. why not using 2.7, , how can correct it? $ python -v python 2.7.6 $ virtualenv flask flask/ bin/ app/ lib/ python2.6/ find python2.7 is, tell virtualenv use binary. $ python2.7 /usr/bin/python2.7 $ virtualenv -p $(which python2.7) flask for example, on ubuntu, install virtualenv sudo apt-get install virtualenv . create env virtualenv vpy . creates vpy directory. next run . ./vpy/bin/activate activate env. install packages pip pip install flask . every time start new shell, must activate env again . ./vpy/bin/activate .

php - Adding time stamp and adding unsuccessful database entries to a pdf -

i've started out programming in php & mysql. i'm wanting create csv file importer writes entries database, various validations. wanted add current time , date datetime column in products discontinued when database says "yes" issue date , time of product being discontinued. want add entries pdf file/ report format of various error conditions. errors include entries did not pass if conditions such regular expressions , not added database. <?php include_once('connection.php'); date_default_timezone_set('europe/london'); $date = date('d/m/y h:i:s a', time()); $filetxt = "./errors.txt"; $var1 = 5; $var2 = 1000; $var3 = 10; if(isset($_post["import"])) { echo $filename=$_files["file"]["tmp_name"]; if($_files["file"]["size"] > 0) { $file = fopen($filename, "r"); while(($emapdata = fg

javascript - HTML Fade music on link -

i like, when navigating away page, execute fade of musical cue instead of cutting if off abruptly. okay me if fade adds half second time needed execute link. i have following code execute fadeout of playing music cue. <audio id="myaudio" <source src="./audio/pluto.mp3" type="audio/mp3"> browser not support audio element. </audio> and <script> function fadeaudio() { if (myaudio.volume > 0) { myaudio.volume = math.max(0, myaudio.volume - 0.05); settimeout(fadeaudio, 20); } } </script> i tested code button, , works fine (sometimes there bit of zippering, prefer abrupt cutoff). <button onclick="fadeaudio()">try it</button> my problem don't know how call , execute fade before navigating away. looking @ html's onbeforeunload , seems geared entirely printing warning prompt, no way insert intervening fadeaudio() function. simply doing following ac

R: Search through multiple columns if value is present keep that row -

what want if search through each second column , if, within row, 1 column has value greater 0.95 keep it. ever row retained must have @ least 1 column >0.95. example df: id value_sample1 detectionscore_sample1 value_sample2 detectionscore_sample2 1 10265 -0.251 0.8874 -0.1850 0.2120 2 10265 0.560 0.9989 0.6610 0.9456 3 12346 0.874 1.0000 0.7545 0.9900 so want go through 'decetionscore_' columns , values greater 0.95 above return. id value_sample1 detectionscore_sample1 value_sample2 detectionscore_sample2 1 10265 0.560 0.9989 0.6610 0.9456 2 12346 0.874 1.0000 0.7545 0.9900 the code have attempt is newdf<-df[df[,(seq(3,151,2)] >= 0.95,] ## col 1 ids any ideas how approach this? df2 = df[which(apply(df[

Android custom font is created wrong -

the user can choose between different fonts in app. the typeface created in code: public static typeface gettypeface(context context, string assetpath) { synchronized (cache) { if (!cache.containskey(assetpath)) { try { typeface typeface = typeface.createfromasset( context.getassets(), assetpath); cache.put(assetpath, typeface); } catch (exception e) { return null; } } return cache.get(assetpath); } } the typeface created without error in android >5.0 typeface wrong... when use app android 4.4.2 os created correct. the font creates trouble one: http://www.dafont.com/julius-thyssen.font any ideas how handle this?

javascript - JQM 1.4.5 : disabling button breaks page rendering -

Image
going through steep learning curve, experimenting various ux 'toys' require implement app. 1 of these disable button , enable on fly. following instructions of the book , wrote little snippet of code test out. clicking on "soap" runs series of chained promises, , toggles "soap1" button disabled prop. my html/js <div data-role="content"> <a href="#" id="btn_soap1" class="ui-input-btn ui-btn ui-mini ui-btn-inline ui-icon-back " onclick="getinitialnotifications();">soap1</a> <button id="btn_soap" class="ui-btn ui-btn-inline ui-mini ui-icon-bullets " onclick="getinitialnotifications();"> soap </button> <script> $("#btn_soap1").button({ // required initialization disabled:false }); $("#btn_soap").on("click", function

java - Why dosen't my code continue when y is enter? -

i'm new programming (java) , stack overflow. code works except when run , press y keeps repeating "do want continue" , stuck in loop (everything else works). please tell me why happening , should fix it. import java.util.scanner; import java.text.numberformat; import java.text.numberformat; import java.util.scanner; public class ch03_ex3_downloadtime { public static void main(string[] args) { int dspeed = 0; int fsize = 0; scanner sc = new scanner(system.in); { // input user system.out.println("welcome download time estimator"); system.out.print("enter file size (mb): "); fsize = sc.nextint(); system.out.print("enter download speed (mb/sec): "); dspeed = sc.nextint(); } int dtime = fsize / dspeed; int hours; int remainder; remainder = dtime % 3600; hours = dtime / 3600; int minutes;

On Android, is library able to receive notification that app is backgrounded / foregrounded? -

i'm writing library uses timer perform scheduled background processing. 1 key feature conserve battery life, i'd have library pause background processing when app isn't actively used. ideally, great if equivalents activity.onpause() , activity.onresume() received library without having create api it. don't want have rely on dev, who's implementing library, have call mylibrary.onpause() , mylibrary.onresume() throughout various activities of app. are there other solutions apart api's ? thought maybe there broadcast library register - haven't found useful @ moment... looking suggestions... thanks !! you can use registeractivitylifecyclecallbacks() set listener activity life cycle events. it's api 14+ should not big deal nowadays.

opencv - R function Mclust slow -

i used mclust function in mclust package em-clustering of vector of 27,000 entries 2 clusters: mclust(data_vector, g=2) another software uses opencv em-clustering 3 times faster mclust (even if reduce maximum number of iterations in mclust e.g. 4). in mclust source looks function implemented in fortran. how can it seems slower opencv implementation? try running both exact same: initial conditions model (with/without covariance etc.) i believe mclust quite expensive initialization. if opencv starts random sample initialization, no wonder faster. so starter, give both exact same vector start with.

sql - How to merge two tables in a mysql query -

first of sorry know mysql not recommended more in case have no control , have use it. now onto question. i have 2 tables games , videos inside games have | id | gameid | gametitle | | 1 | 1 | halo odst | | 2 | 2 | disgaea 4 | inside videos have | id | game | videotitle | image | | 1 | 1 | title 1 | path | | 2 | 1 | title 2 | path | | 3 | 2 | title 3 | path | | 4 | 1 | title 4 | path | i need following select x,y,z video videos.game = games.gameid which read select id, videotitle, image videos video.game = 1 (or other numeric value) i’m aware have use join nothing have tried appears working , yeah i’m getting this. the closest below query says works returning empty result set wrong somewhere. select * `games` inner join `videos` on `game` `game` = 1 if i'm using phpmyadmins sql query tool rather actual code @ stage want working before coding it. any appreciated. thanks. select * `games`

arguments - C++ Multiple Functions Not Recognized -

this may simple error, made function called longin_page(); int login_page(string username,string password) { anyways, function header, function long. however, when call function in file(to function defined , referenced), seems not recognize 2 arguments have defined. else if (input1 == "login") { get_user_info(); login_page(file_username, file_password); } in visual studio, error saying function not take 2 arguments. in case wanted check files, posted below. login_page.cpp: #include <iostream> #include <windows.h> #include "login_page.h" #include <string> #include <fstream> #include "profile_main_menu.h"using namespace std; string file_username, file_password; int get_user_info() { ifstream user_info; user_info.open("user_info.txt"); if (user_info.is_open()) { user_info >> file_username; user_info >> file_password; cout << "file open" << endl; cou

php - multi deimensional array of cities -

i have multiple ids (0, 1, 2). how city name of respective id following array? here example array: $cities_array = array ( 0 => array ( 'city' => 'sant julià de lòria', 'region' => '06', 'country' => 'ad', 'latitude' => '42.46372', 'longitude' => '1.49129', ), 1 => array ( 'city' => 'pas de la casa', 'region' => '03', 'country' => 'ad', 'latitude' => '42.54277', 'longitude' => '1.73361', ), 2 => array ( 'city' => 'ordino', 'region' => '05', 'country' => 'ad', 'latitude' => '42.55623', 'longitude' => '1.53319', ) ); you can acceed city name using $cities_array[your_id]['city'];

Fill a column's blank spaces contingent on a second column in R -

i'd appreciate one. have similar data below. df$a df$b 1 . 1 . 1 . 1 6 2 . 2 . 2 7 what need fill in df$b each value corresponds end of run of values in df$a . example below. df$a df$b 1 6 1 6 1 6 1 6 2 7 2 7 2 7 any welcome. it seems me missing values denoted . . better read dataset na.strings="." missing values na . current dataset, 'b' column character/factor class (depending upon whether used stringsasfactors=false/true (default) in read.table/read.csv . using data.table , convert data.frame data.table ( setdt(df1) ), change 'character' class 'numeric' ( b:= as.numeric(b) ). result in coercing . na (a warning appear). grouped "a", change "b" values last element ( b:= b[.n] ) library(data.table) setdt(df1)[,b:= as.numeric(b)][,b:=b[.n] , = a] # b #1: 1 6 #2: 1 6 #3: 1 6 #4: 1 6 #5: 2 7 #6: 2 7 #7: 2 7 or dplyr library(dplyr) df1 %>% g

c++ - Code explanation for a While Loop within a For Loop -

can explain me why output program below, if input values: 5, 222, 2043, 29, 2, 20035 22222? i'm trying solve on paper , can't result. #include <iostream> using namespace std; int n=0; int x=0; int s=0; int i=1; int main() { cin >> n; for(i=1; i<=n; i++) { cin >> x; int nr=1; while(x>9) { nr=nr*10; x=x/10; } s=s+x*nr; } cout << s; return 0; } your while loop divides x 10 every time. , since you're dealing integers, shifts decimal number 1 right: 7234 -> 723 . untill smaller 10, or in other words, there 1 (the first) digit left: 7. multiplies again 10^(times divided 10): 7000. means code whitin for-loop makes first digits 0 in each x. in end you'll have: 200 + 2000 + 20 + 2 + 20000

python - set axis limits on individual facets of seaborn facetgrid -

i'm trying set x-axis limits different values each facet seaborn facetgrid distplot. understand can access axes within subplots through g.axes , i've tried iterate on them , set xlim with: g = sns.facetgrid(mapping, col=options.facetcol, row=options.facetrow, col_order=sorted(cols), hue=options.group) g = g.map(sns.distplot, options.axis) i, ax in enumerate(g.axes.flat): # set every-other axis testing purposes if % 2 == 0[enter link description here][1]: ax.set_xlim(-400,500) else: ax.set_xlim(-200,200) however, when this, axes set (-200, 200) not every other facet. what doing wrong? mwaskom had solution; posting here completeness - had change following line to: g = sns.facetgrid(mapping, col=options.facetcol, row=options.facetrow, col_order=sorted(cols), hue=options.group, sharex=false)

java - Change TableRow color based on content -

i want make table changes row color based on row's content. therefore use following code. did myself , seems cause of problem ;) because part row background set seems not work intended: not row goodfriends changes it's color 1 above. see placed system.out.println(row.getitem()); before color set sure row right 'row'. - , is. @ point have no idea why wrong row colored while row reference @ runtime (the right one). any ideas? persontable.setrowfactory(new callback<tableview<person>, tablerow<person>>() { person person; int counter = 0; @override public tablerow<person> call(tableview<person> tableview) { tablerow<person> row = new tablerow<>(); if (counter < tableview.getitems().size() && (person = tableview.getitems().get(counter)) != null) { row.setitem(person); counter++; } if (row.geti

jquery - How to choose array [0] and make it a link using javascript -

i have array, go different url when <a href="javascript:void(0)">hotel selection</a> clicked. here have far. help. <div id="menu"> <ul> <li class="left-edges inactive"></li> <li class="inactive" style="width: 149px;"> <a href="javascript:void(0)">hotel selection</a> </li> <li class="seperator"></li> <li class="inactive" style="width: 124px;"></li> <li class="seperator"></li> <li class="inactive" style="width: 170px;"></li> <li class="seperator"></li> <li class="active" style="width: 134px;"></li> <li class="seperator"></li> <li class="inactive" style="width: 71

angularjs - Can't access to methods that added via Prototype to Javascript object -

i have object declaration inside angular.js module: $scope.test=function(){ }; $scope.test.prototype.push = function(data) { return data; }; and call this: var = $scope.test.push(1); console.error(a); but error: error: undefined not function (evaluating '$scope.test.push(1)') why cant access methods added via prototype object? you seem mistaking function's prototype property internal prototype of object. a relevant quote book eloquent javascript : it important note distinction between way prototype associated constructor (through prototype property) , way objects have prototype (which can retrieved object.getprototypeof ). actual prototype of constructor function.prototype since constructors functions. prototype property prototype of instances created through not own prototype. what means in context of code sample: $scope.test.prototype.push = function(data) { return data; }; here you've added

Regex - How do you match everything except four digits in a row? -

using regex, how match except 4 digits in row? here sample text might using: foo1234bar baz 1111bat asdf 0000 fdsa a123b matches might following: "foo", "bar", "baz ", "bat", "asdf ", " fdsa", "a123b" here regular expressions i've come on own have failed capture need: [^\d]+ (this 1 includes a123b) ^.*(?=[\d]{4}) (this 1 not include line after 4 digits) ^.*(?=[\d]{4}).* (this 1 includes numbers) any ideas on how matches before , after 4 digit sequence? you haven't specified app language, practically every app language has split function, , you'll want if split on \d{4} . eg in java: string[] stufftokeep = input.split("\\d{4}");

computational geometry - Outermost Polygon from a set of Edges -

Image
suppose have set of 2d line segments connected. need algorithm finds outermost segments in set. is, minimal subset bounds same region. note: not same finding convex hull of points making segments. edit: on top initial set of segments. below same outline interior segments deleted. (ignore little grey crosses, they're mark intersection points.) how pencil...? find leftmost vertex (minimum x). if there's more one, choose lowest of them (minimum y). there no vertex below current one, take direction 'downwards' reference. find edges going current vertex , calculate directions (bearings). find 1 makes smallest positive angle (counter-clockwise) reference direction. outline segment. select other end new 'current' vertex , set direction from vertex recent one new reference direction. proceed step 2 until arrive start vertex. remove unvisited segments. remove orphaned vertices (if appeared in step 5).

Deleting android apps from activity -

good day! are there tools in android sdk, can use remove application activity. in particular, need activity method, removes other application same app-name, other package. if mean "same name app" app same label define in xml menifest label of app, snippest should work: private void deleteappbyactivityname(@nonnull string myapplabel,@nonnull context context){ try { packagemanager pm = context.getpackagemanager(); intent mainintent = new intent(intent.action_main, null); mainintent.addcategory(intent.category_launcher); list<resolveinfo> dataindevice = pm.queryintentactivities(mainintent, 0); (resolveinfo resolveinfo : dataindevice){ string label = resolveinfo.loadlabel(pm).tostring(); if (label.equals(myapplabel)) { //we find app same name ours intent intent = new intent(intent.action_delete); intent.setdata(uri.parse("package:" + resolveinfo.activityinfo.packagenam

ios - UIWebView for GIF Background loadData method error -

i keep receiving same error of: cannot invoke loaddata argument of list type '(nsdata, mimetype: string, textencodingname: nil, baseurl: nil)' for loaddata method. var filepath = nsbundle.mainbundle().pathforresource("fractal", oftype: "gif") var gif = nsdata(contentsoffile: filepath!) var webviewbg = uiwebview(frame: self.view.frame) webviewbg.loaddata(gif!,mimetype: "image/gif",textencodingname: nil,baseurl: nil) // line of code causes build error you should check loaddata function signature, is: func loaddata(_ data: nsdata, mimetype mimetype: string, textencodingname textencodingname: string, baseurl baseurl: nsurl) textencodingname string , not string? , can't pass nil . same applies baseurl type nsurl , not nsurl? . in case, can pass whatever values utf-8 , http://localhost/ meet non-nil criteria. check this thread other ways how it. try minimize usage of ! avoid runtime failures. more robust: gu

api - How to send an array using requests.post (Python)? "Value Error: Too many values to unpack" -

i'm trying send array(list) of requests wheniwork api using requests.post, , keep getting 1 of 2 errors. when send list list, unpacking error, , when send string, error asking me submit array. think has how requests handles lists. here examples: url='https://api.wheniwork.com/2/batch' headers={"w-token": "ilovemyboss"} data=[{'url': '/rest/shifts', 'params': {'user_id': 0,'other_stuff':'value'}, 'method':'post',{'url': '/rest/shifts', 'params': {'user_id': 1,'other_stuff':'value'}, 'method':'post'}] r = requests.post(url, headers=headers,data=data) print r.text # valueerror: many values unpack simply wrapping value data in quotes: url='https://api.wheniwork.com/2/batch' headers={"w-token": "ilovemyboss"} data="[]" #removed data here emphasize change quotes r = requests.post(url, h