Posts

Showing posts from 2012

c++ - Array size at run time without dynamic allocation is allowed? -

i've been using c++ few years, , today saw code, how can legal? int main(int argc, char **argv) { size_t size; cin >> size; int array[size]; for(size_t = 0; < size; i++) { array[i] = i; cout << << endl; } return 0; } compiled under gcc. how can size determined @ run-time without new or malloc ? just double check, i've googled , similar codes mine claimed give storage size error. even deitel's c++ how program p. 261 states under common programming error 4.5: only constants can used declare size of automatic , static arrays. enlight me. this valid in c99. c99 standard supports variable sized arrays on stack. compiler has chosen support construct too. note different malloc , new . gcc allocates array on stack, int array[100] adjusting stack pointer. no heap allocation done. it's pretty _alloca .

embedded linux - Yocto recipe : how to install in specific folder -

i have created yocto recipe program. default folders building image recipe ? @ time of building image, want move files folder like "/opt/xyz". should "mv" or there other options ? thank you i guess want copy compiled program folder such ${bindir} : quote yocto ref-manual 1.1: when specifying paths part of conffiles variable, practice use appropriate path variables. example, ${sysconfdir} rather /etc or ${bindir} rather /usr/bin. can find list of these variables @ top of meta/conf/bitbake.conf file in source directory . you can copy files working directory directory in target filesystem. see hello-world example instance (note example taken 1.1 reference manual, haven't found yet in newer version): description = "simple helloworld application" section = "examples" license = "mit" lic_files_chksum = "file://${common_license_dir}/mit;md5=0835ade698e0bcf8506ecda2f7b4f302" pr = "r0...

php - How to call procedure with select command using PDO? -

i have below procedure purpose of selecting base column contains parameter: create procedure getmap(p_team varchar(100) charset 'utf8') begin select base map map.base = p_team or ver1 = p_team or ver2 = p_team or ver3 = p_team or ver4 = p_team or ver5 = p_team or ver6 = p_team or ver7 = p_team or ver8 = p_team or ver9 = p_team or ver10 = p_team or ver11 = p_team or ver12 = p_team; end // when try call procedure php : function getmap($data){ $query = $this->pdo->prepare("call getmap(:data)"); $query->bindparam(':data', $data); $ex = $query->execute(); $res = $ex->fetchcolumn(); echo $res; if($res){ return $res; } else { return $data; } } it returns exception: call member function fetchcolumn() on non-object how can base column variable select procedure? you calling fetchcolumn on return value execute , that, can see here , boolean value. the method needs cal...

php - redirecting a survey user to last page that he/she was on -

i have been working on survey , done, there's 1 requirement has eaten me up. a user can take survey, , there 6 different sets of questions , each set of questions in question group 1-6. when user question group 1-4 , logs out, he/she should log in , redirected question group 5. far code working , redirecting first 3 pages (questions1.php, people.php , environment.php), refusing rest. i think problem if elseif statement. achieve desired result appreciated. cheers! here code if ($row['userid']==$user){ while($row = mysql_fetch_assoc($result_set)){ if($row['question_group_id']==1 && $row['choosen']==1){ header("location:people.php"); } elseif($row['question_group_id']==2 && $row['choosen']==1){ header("location:environment.php"); } elseif($row['question_group_id']==3 && $row['choosen']==1){ header("location:widerorganization.php"); } elseif($row...

javascript - jQuery .css property not working on scroll function -

i learning jquery implementing properties. having difficulties when i'm trying make div stick top of page when scrolled to. html div: <div class="col span_1_of_2 poll_div" id="poll-div"> <p>poll of week</p> <p>best pakistani singer?</p> <table> <tr> <td width="100%"> <input type="submit" id="op1" onclick="load(this.id);" class="options option1" value="option # 1"/> </td> <td class="numb"> <div id="votes1"><?php $conn = mysql_connect('localhost', 'root', ''); mysql_select_db('poll'); ...

ios - Trying to display image of tableView in circular form but its not showing it at the first time -

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { sublisttableviewcell *cell = [self.tvfestivallist dequeuereusablecellwithidentifier:@"sublisttableviewcell" forindexpath:indexpath]; cell._img.layer.cornerradius = cell._img.frame.size.width / 2; cell._img.clipstobounds = yes; cell._img.layer.borderwidth = 3.0f; cell._img.backgroundcolor=[uicolor redcolor]; return cell; } i trying display image of tableview in circular form not showing @ first time. when scroll tableview image in cell appearing in circular form

Add multiple columns in custom WordPress table if it does not exist -

this question has answer here: add new column wordpress database 3 answers i make plug-in in word press , create tables, during upgrading plug-in need add columns existing table, want add columns table if not exist in table.how can ? you can use query (change table name , column name) $row = $wpdb->get_results( "select column_name information_schema.columns table_name = 'wp_customer_say' , column_name = 'say_state'" ); if(empty($row)){ $wpdb->query("alter table wp_customer_say add say_state int(1) not null default 1"); }

c# - Return multiple files to download from asp.net -

who know how this? have loop , in loop list build up. want each list saved different file different filename (duh). using httpcontext.current.response this. single file works fine, however, cannot loop it. error receive upon second iteration "server cannot clear headers after http headers have been sent." code below. matters of course part commented // response user. comments highly appreciated! cheerz, ronald foreach (gridviewrow dr in gridview1.rows) { // find check box in row system.web.ui.webcontrols.checkbox cb = (system.web.ui.webcontrols.checkbox)dr.findcontrol("chkbx_selected"); // see if it's checked if (cb != null && cb.checked) { // cell datacontrolfieldcell cell = getcellbyname(dr, "guid"); string guid = new guid(cell.text); // record filtered on guid var result_json = ...

javascript - Show last few characters when data binding in angularjs -

i understand how data binding works in simple example, i'm curious on how limit output display last 4 characters of whatever number put in, instead of entire number: <!doctype html> <html ng-app> <head> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.2/angular.min.js"></script> </head> <body> <div> <label>name:</label> <input type="text" ng-model="number" placeholder="enter long number here"> <hr> <h1>hello {{number}}!</h1> </div> </body> </html> how go doing this? from angularjs limitto docs do: <h1>hello {{number | limitto: -4}}!</h1> or see plunkr more options.

android - How to add cursor and activate my editText? -

actually creating custom edittext in android application. have done have created class called customedittext , in drawing edittext. code follows: public class customedittext extends view { string mtext; context mcontext; paint paint = new paint(); public customedittext(context context) { super(context); mcontext = context; paint.setcolor(color.white); // setup background etc here paint.setstyle(style.fill); } @override protected void ondraw(canvas canvas) { super.ondraw(canvas); drawtextoncanvas(canvas, mtext); } private void drawtextoncanvas(final canvas canvas, string mtext) { canvas.drawpaint(paint); final edittext edittext = new edittext(mcontext); edittext.settextcolor(black); edittext.setenabled(true); edittext.setdrawingcacheenabled(true); edittext.measure(measurespec.makemeasurespec(canvas.getwidth(), measurespec.exactly), 50); edittext.layout(0, 0, edittext.getmeasuredwidth(), edittext.getmeasuredheight()); ...

javascript - Angular JS Binding not working -

i not sure going wrong in following code - doesn't seems working. can help? <body ng-controller="myfunction"> <script> function myfunction($scope) { $scope.author = { 'name':'test', 'title': 'mr', 'job': 'sde' } } </script> <h2> {{author.name}} </h2> <h2> {{author.title + " " + author.job}} </h2> </body> here are. incorrect in structure of angularjs, don't see ng-app , wrong declare controller: angular.module('app', []).controller('myfunction', function($scope) { $scope.author = { 'name': 'test', 'title': 'mr', 'job': 'sde' } }); <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.23/an...

html - Create custom interactive map -

i want create simple "interactive" map, there image (the map) , elements on it. i'd elements glow/open pop-up when hover or click on it, or open new page. my process create new div, add new elements on position:absolute , place them top/left/right/bottom... , add css hover proprieties elements. but, know might not appropriate way it. my questions : can using html/css ? or should start learning new programing languages ? is there plugins or sites available want ? i recommend use javascript interactivity. check out google maps api. can trying do. we have helper plugin maps api , jquery setting markers on map. http://github.com/lucien-consulting/google-map-marker.git those 2 suggestions started. jump in , try it!

html5 - Creating a SelectBox in intel XDK -

i have started coding in intel xdk. instead of showing select items in usual way (drop down menu), want them show in popup , select 1 of item there. have gone through several sites, not find single example give me desired result. <div data-role="fieldcontain"> <label for="select-choice-1" class="select">choose shipping method:</label> <select name="select-choice-1" id="select-choice-1" data-native-menu="false" > <option value="standard">standard: 7 day</option> <option value="rush">rush: 3 days</option> <option value="express">express: next day</option> <option value="overnight">overnight</option> </select> </div> it seems easy implement in jquery . problem , can use apis exposed intel xdk. ...

Rsync command variable, bash script -

rsync="rsync -avzhe 'ssh -i /path/to/deploy_keys/id_rsa' --delete " # files $rsync deploy@ip:/var/www/path1 /var/www/path1 $rsync deploy@ip:/var/www/path2 /var/www/path2 i'd introduce rsync variable more compact, throws error: unexpected remote arg: deploy@ip:/var/www/path1 if use rsync inside doublequotes, works fine. sake of readability, i'd keep them separate command invocations. i agree eval dangerous. in addition array approach @eugeniu rosca suggested, use shell function: my_rsync() { rsync -avzhe 'ssh -i /path/to/deploy_keys/id_rsa' --delete "$@" } my_rsync deploy@ip:/var/www/path1 /var/www/path1 my_rsync deploy@ip:/var/www/path2 /var/www/path2 btw, should read bashfaq #50: i'm trying put command in variable, complex cases fail! .

apache - Executing multiple exec() from PHP -

situation: i have php application need output exec() commands. exec() commands used on different locations throughout application. when user opens multiple pages in same browser, exec() commands allways executed sequentially; if user opens second page, second page waits exec() command of first page finish, before executing. if open second page in different browser, or in incognito, problem not occur. example test code: $exec = "notepad.exe" $data = shell_exec($exec); echo $data; when running code in browser, browser waits notepad process close. when running script second time simultaniously, second notepad process started when first 1 closed, unless it's ran different browser. question: how can run multiple exec() commands simultaniously same browser (in different tabs) while still beeing able catch output. tested on apache 2.4 running php 5.4.7 the issue combination use of sessions described here: https://bugs.php.net/bug.php?id=44942...

view - Laravel white page loading route -

i had login.blade.php code, , decided replace new one. renamed old_login.blade.php , create new file, in same path, name login.blade.php . after while, decided rollback old login page. delete login.blade.php , , renamed old_login.blad.php original name return back. no code edited, views. the problem page returned blanck white page many comments (the comment's tag not closed). i try make copy of view, called test.blade.php , , change route view. diplay them correctly. if change time route myapp.login display login.blade.php view, won't work. i try nothing changed. i'm using laravel 5.1. the code insiede routes.php is route::get('/', function () { return view('myapp.login'); }); the code inside login.blade.php (same ad test.blade.php) is: @extends("app") @section("content") {!! form::open(["url" => "home"]) !!} <div class="form-group"> {!!form::label("u...

java - Diffrent validation message from javax @Pattern -

my class user has 2 fields phones, 1 mobile phone , second work phone. @valid @notnull @jsonview({view.detail.class}) private phone workphone; @valid @jsonview({view.detail.class}) private phone mobilephone; class phone has field number validated @pattern @jsonview({view.country.class, view.detail.class, view.summary.class}) @notblank(message = "missing.phone") @pattern(regexp = regexps.only_digits, message = profilemessages.mobile_phone_invalid) @length(max = 25, message = commonmessages.length_max) private string number; my problem message attribute of @pattern profilemessages.mobile_phone_invalid right mobile phone. there way dynamically change message without example creating new classes? when tried adding new field , using message filler shows me error should constant value.

sorting - how does linux store negative number in text files? -

i made file using ed , named numeric. content follow: -100 -10 0 99 11 -56 12 then executed command on terminal: sort numeric and result was: 0 -10 -100 11 12 -56 99 and of course output not @ expected! sort want asked sort numerically (otherwise default lexigraphic sorting) $ sort -n numbers.dat -100 -56 -10 0 11 12 99 watch out "-n" parameter (see manual )

c++ - What is the best way to update a GTK interface in a multithreaded application? -

as understood, i'm doing way: my main function launch threads before entering gtk main loop. boost::thread p4(sensors_get_informations); gtk_main (); thoses threads stuff, , update corresponding element in interface. void sensors_get_informations() { while(!quit) { [...] //doing stuff gdk_threads_add_idle((gsourcefunc)update_label_sensors, &str_end); //here interface updated wait(1000); } } and function wich update element (here it's label) static bool update_label_sensors(....) { [...] gtk_label_set_label(gtk_label(label_sensors), label_string); [...] return false; } i have 5 threads working together, , seems work fine, usual way this, or there way improve ? here present other method update on interface, research appears updating widget other threads main gtk thread sometime cause segmentation fault. this usual way it. updating widgets other threads main gtk thread not allowed , cause program cr...

javascript - Gson generate json with &quot;,js throw error -

i use gson create string like: new gson.tojson(englishresult); englishresult list> type. result like: [{&quot;name&quot;:&quot;en3&quot;,&quot;value&quot;:234},{&quot;name&quot;:&quot;en4&quot;,&quot;value&quot;:135},{&quot;name&quot;:&quot;en1&quot;,&quot;value&quot;:335},{&quot;name&quot;:&quot;en2&quot;,&quot;value&quot;:310},{&quot;name&quot;:&quot;en5&quot;,&quot;value&quot;:1548}] and invoke js method throw error uncaught syntaxerror: unexpected token & i search goole,it tells me &quot json,because can contain escape,but why js throws error? how solve it? plz tell me suggestion,thanks much my server code : public static void pietestwithdata(){ map<string, integer> result = getchineseresultmap(); list<map<string, object>> englishresult = getformatteredpiedata(); renderargs.put("result...

swing - java.net.SocketException: permission denied is arising -

i tried run code create gui using java swing library send message localhost server.the gui contains text field type message , button send server.server code contained in class. when tried run code, socket exception shown in console as: java.net.socketexception: permission denied: connect @ java.net.dualstackplainsocketimpl.connect0(native method) @ java.net.dualstackplainsocketimpl.socketconnect(dualstackplainsocketimpl.java:79) @ java.net.abstractplainsocketimpl.doconnect(abstractplainsocketimpl.java:345) @ java.net.abstractplainsocketimpl.connecttoaddress(abstractplainsocketimpl.java:206) @ java.net.abstractplainsocketimpl.connect(abstractplainsocketimpl.java:188) please me connection server. i enclosing codes both gui , server here. class creating gui , establishing connection server: package org.myorg; import javax.swing.*; import java.awt.borderlayout; import java.awt.event.*; import java.*io.ioexception; impor...

xcode - How to automate the build number for iOS app based on Schema in Jenkins -

i automate build number of ios application based on schema building , if sandbox build need give {versionnumber}s , if production build {versionnumber}p . can guys suggest how achieve in jenkins automation build

passing char array as function parameters in C -

i want copy arr2 arr , pass arr function paramater void func(char * array) {} int main(void) { int a; char arr[6][50]; char arr2[][50]={"qweeeaa","bbbb","ffaa","eeaa","aaaa","ffaa"}; for(a=0; a<6;a++) { strcpy(arr[a], arr2[a]); } func(arr); return 0; } but can not pass arr function parameter. [warning] passing argument 1 of 'func' incompatible pointer type [enabled default] [note] expected 'char *' argument of type 'char (*)[50]' i using mingw gcc 4.8.1 the type pass , type function expects not match. change function receive pointer array: void func(char (*array)[50]) { } other problems: 1) haven't declared prototype func() either. in pre-c99 mode, compiler assume function returns int , cause problem. in c99 , c11, missing prototype makes code invalid. either declare prototype @ top of source file or move function above...

algorithm - Sum of all numbers in a given range with some constraints -

my objective find sum of numbers 4 666554 consists of 4,5,6 , satisfying below constraints. constraints on number of times digit appears number of time 4 appears in number <= 1 number of time 5 appears in number <= 2 number of time 6 appears in number <= 3 sum = 4+5+6+45+46+54+55+56+64+65+66+454+455+.....................+666554. simple method run loop , add numbers made of 4,5 , 6 satisfying above constraints. long long sum = 0; for(int i=4;i <=666554;i++){ /*check if number contains 4,5 , 6 , constraints not violated if condition true add number sum*/ } but seems inefficient. checking number made of 4,5 , 6 , number not violating constraints take time. there way increase efficiency. have tried lot no new approach have found.please help. you should examine consisting of digits 4,5 , 6, of there few hundred. that's not difficult: in loop, don't increase 1. if % 10 < 6 increase 1. otherwise, subtract 2 (for example 646 t...

c# - Entity Framework "Database First" not generating Foreign keys -

i used entity framework reverse engineering seems miss foreign key relations. here database sql code , generated classes: create table [dbo].[rapportanomalie] ( [code_rapport] int identity (1, 1) not null, [date_rapport] datetime not null, [etat] varchar (50) not null, [code_agence] int not null, primary key clustered ([code_rapport] asc), constraint [fk_rapportanomalie_totable] foreign key ([code_agence]) references [dbo].[agence] ([code_agence]) create table agence ( [code_agence] int not null primary key, [intitule_agence] varchar(100) not null, [adresse_agence] varchar(100) not null ) agence.cs: [table("agence")] public partial class agence { [key] [databasegenerated(databasegeneratedoption.none)] public int code_agence { get; set; } [required] [stringlength(100)] public string intitule_agence { get; set; } [required] [stringlength(100)] public string adresse_agence { get; set; } } } and...

php - Mysqli Select data From different table and show in one FOR loop -

my first query is: $query3 ="select * leave_status schoolid='$storedvalue' , studentregid='$regid' , approvestatus ='pending' order from_date desc "; $res3=mysqli_query($mysqli, $query3); echo "<select id=\"ddpurpose\">"; for($i=0; $row=mysqli_fetch_assoc($res3); $i++) { $slno = $row['slno']; $dat5 = $row['till_date']; $dat6 = $row['from_date']; $from_date=date("y-m-d", strtotime($dat6)); $till_date=date("y-m-d", strtotime($dat5)); echo "<div class=\"panel\" title=\"modify leave\" id=\"".$slno."\" data-footer=\"none\"> <input type='date' id='fromdate[".$i."] ' value='".$from_date."'></input> <input type='date' id='tilldate[".$i."] ' value='".$till_date."'></input...

syntax error, unexpected '′' (T_STRING) PHP -

this question has answer here: php parse/syntax errors; , how solve them? 11 answers i getting following error while running php script: symfony \ component \ debug \ exception \ fatalerrorexception syntax error, unexpected '′' (t_string) . symfony\component\debug\exception\fatalerrorexception …/­app/­filters.php:72 route::any(‘check/purchase-code’, function() {if ($code = input::get(‘code’)) {ini_set(‘user_agent’, ‘mozilla/5.0′);$result = “”;if ($result = 1) {session::put(‘valid-usage’,’1′);return redirect::route(‘install-db-info’);}}return redirect::to(‘/install’);}); route::filter(‘user-auth’, function() replace line (be sure ' , " ) route::any(‘check/purchase-code’, function() {if ($code = input::get(‘code’)) {ini_set(‘user_agent’, ‘mozilla/5.0′);$result = “”;if ($result = 1) {session::put(‘valid-usage’,’1′);return redirect:...

java - Why does System.in.read() wait till the user presses enter? -

system.in.read() used read single character . then why allow user enter many characters can until presses enter? why doesn't stop presses key , returns character? char ch = (char)system.in.read(); if user enter "example" , press enter, takes ch e . , discards other characters. if there multiple read() , messes whole thing. so, why doesn't take single character , return? system.in of type bufferedinputstream . type of stream caches input data until newline character recognized. following snippet shows type in output. system.out.println(system.in.getclass());

Android - Replace build in dialler screen with a Custom screen with controls -

as per requirement,i have replace android's build in dialler screen custom screen along controls. how achieve this..??? thanks efforts. you can download example , , edit how please. this one , this one better, may more want. response comments : so want edit stock dialer screen add button? not possible...though can create service runs overlay whenever dialer shown has clickable button can intercept. see post how it.

lucene - Weightened City Index -

i created index of cities following properties name population country with following code can run searches , got results var parser = new queryparser(lucene.net.util.version.lucene_30, "name", analyzer); query query = parser.parse(searchterm); topscoredoccollector result = topscoredoccollector.create(resultcount, true); searcher.search(query, result); for example, when run berlen~ fuzzy query got results. city berlin -with highest population- in middle. how can influence query have cities higher population value higher score? the default order of results relevance (score). should not manipulating score change order sorting results population field. check sorting search result in lucene based on numeric field

Paypal: "Hi Eugene. Not You?" message - nameOnButton.gif appearing erroneously - Digital Goods Express Checkout -

Image
when using digital goods express checkout, calling dgflow on pay button causes text "hi eugene. not you?" appear above pay button. occurs when returning page , can replicated loading below codepen , refreshing. this occurring in both live , sandboxed environment. var embeddedppflow = new paypal.apps.dgflow({trigger: 'submitbtn'}); p.s. name not eugene http://codepen.io/anon/pen/bdvzyx paypal adds greeting currently-cookied user on machine. if begin checkout, paypal query (the currently-cookied user) account begin checkout process, , depending upon outcome of security checks may permit check out without logging in again each payment. "eugene" name on 1 of sandbox accounts. paypal sees cookie when running live transactions, (of course) not permit sandbox account make live transactions; when "real" paypal code runs (once button clicked) sandbox account information rejected , user prompted log in. this 1 of several ways sandb...

php - Mysql debit credit balance calculation -

i have following table little financial web app made php mysql. need calculation of debit , credit balance in mysql. 1.table: entries +----+---------+------------+------------+ | id | type_id | narration | date | +----+---------+------------+------------+ | 1 | 3 | test input | 2015-01-05 | | 2 | 2 | test input | 2015-02-07 | | 3 | 2 | test input | 2015-04-02 | +----+---------+------------+------------+ 2.table: entry_items +----+----------+-----------+-------+--------+ | id | entry_id | ledger_id | type | amount | +----+----------+-----------+-------+--------+ | 1 | 1 | 1 | d | 2000 | | 3 | 1 | 2 | c | 2000 | | 4 | 2 | 2 | d | 550 | | 5 | 2 | 1 | c | 550 | +----+----------+-----------+-------+--------+ so able list amounts ledger id=1 select e.date date, i.type type, i.amount amount entries e left join entry_items on e.id=i.entry_id i.ledger_id = ...

eclipse rap - How to set own image for the cursor for drag operation -

it possible set/change image cursor drag-operatio way: listener listener = new listener() { public void handleevent(event event) { switch (event.type) { case swt.mousedown: movecomposite.setcursor(display.getcurrent().getsystemcursor(swt.cursor_wait)); ... } ... movecomposite.addlistener(swt.mousedown, listener); but in case standard cursors can set. is possible set own image cursor drag operation? either in css named control, programmatically named control or alternative globally changing standard cursors. as workaround missing api (see rüdiger's answer), try set custom variant while dragging: movecomposite.setdata(rwt.custom_variant, "dragging"); and configure custom cursor variant in css this: .dragging { cursor: url(resources/dragging.gif) }

Split a single workbook into multiple workbooks containing multiple worksheets using Excel VBA -

Image
i have workbook single worksheet given below. i want split many workbooks containing many worksheets according values in it. want make 'n' number of workbooks according 'n' unique values of column 1 in picture. , want make 'm' worksheets according 'm' unique values of column 2 in picture. each worksheet contains values in picture. want make chart 3 series. have make data table in picture columns 'levels', 'chart_vlaue_1', 'chart_vlaue_2', 'chart_vlaue_3' in each worksheet. want generate charts in each of worksheet. please me create sample chart. work on it. please me. the following code parse data in first 2 columns create workbooks each unique cell value first column , sheet each unique cell value second column. adds charts of type xlcolumnclustered , saves , closes new books. source data can un-sorted . important : change constants targetpath and/or databookname, datasheetname according condition...

java - Post to facebook wall through spring social InsufficientPermissionException -

i trying make simple app spring social, app not public. trying achieve post wall or page administer. trying ask facebook access manage_pages permission denied because said "you not need request these permissions because blog or cms integrated app admin. app admin, can access these permissions , post timeline or page admin. can provide access additional users adding them developers of app." now in code. altered bit spring social showcase example. , case follows: 1) login facebook through app 2) trying number of pages administer 3) post wall. for step 2 using code: if (facebook.pageoperations().getaccounts() != null) { system.out.println("size of acccounts is: " + facebook.pageoperations().getaccounts().size()); } the size of accounts 0. means although should able post pages administrator can not see them. correct? for step 3 now: facebook.feedoperations().updatestatus("i'm trying out spring social!"); facebook.feedopera...

spss - Creating a dummy variable from a string variable -

i'd create dummy variable string variable (q1) different comments in syntax. if q1 empty paste 0 q1_d , if q1 has text inside paste 1 q1_d. compute q1_d=length(q1)>0. which create dichotomous 0/1 variable q1_d. if row case data @ q1 has data/characters 1 (one) assigned @ q1_d else if q1 equals empty string 0 (zero) assigned.

c++ - How to set a limit on the number of lines for methods and functions? -

i check if (git) commit respects method length limit or not. ideally should check if of methods touched commit exceeds threshold. i guess tool integrates line counts in c++ code , git diffs may not readily avaialble, i'll glad find out contrary true. given such tool not exist, convenient way have list of method length, start , end line in file? i exclude using regular expression or simple parser work in cases c, c++, c++11 , possibly future versions of language solution using real parser preferrable. you use google style guide checker on this: cpplint.py --filter=readability/fn_size that restrict checking function size rule.

android - Problems with setvisibility for button on RelativeLayout Eclipse -

hy.... i'm making simple project on eclipse. i'm using relative layout shown below : <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:gravity="center" tools:context=".profileactivity" > <button android:id="@+id/prof_edit_btn" android:layout_below="@+id/prof_ll" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="edit" android:layout_margintop="17dp" android:layout_centerhorizontal="true" /> <linearlayout android:layout_below="@+id/prof_ll" android:layout_width="wrap_content" android:layout_...

javascript - Phone number regex validation -

need validate phone numbers separated comma , can have country code start parameter. need temporary validation in front end side such validating different numbers number country code(min length , max length should specified): +919845098450 number without country code(min length , max length should specified):9845098450 and these numbers separated comma(+919845098450,9845098450 etc) have done single phone number . ^([+])?[0-9()\-#+]*$ and comma separated ^([+])?[,\d{9}]*$ but above regex not showing error when input ends comma (+919845098450,9845098450,). i need comma separated numbers in jquery/javascript. if possible need specify min , max length , without country code. appreciated. you may try this, /^(?:\+\d{2})?\d{10}(?:,(?:\+\d{2})?\d{10})*$/.test(str); demo (?:\+\d{2})? helps match optional country code. \d{10} matches 10 digit number. (?:,(?:\+\d{2})?\d{10})* helps match following 0 or more phone numbers.

c++ - Most elegant way to combine chrono::time_point from hours, minutes, seconds etc -

i have " human readable " variables hours , minutes , seconds , day , month , year contains values corresponding names (let's have systemtime structure <windows.h> ). way found create chrono::time_point is: systemtime systime = ...; // came source (file, network, etc. ) tm t; t.tm_sec = systime.wsecond; t.tm_min = systime.wminute; t.tm_hour = systime.whour; t.tm_mday = systime.wday; t.tm_mon = systime.wmonth - 1; t.tm_year = systime.wyear - 1900; t.tm_isdst = 0; std::chrono::system_clock::time_point datetime = std::chrono::system_clock::from_time_t( mktime( & t ) ); first, lost milliseconds systemtime . second, (mmm...) don't sort of conversion )) could give more elegant way issue ? using this open source, header-only library , can: #include "date.h" #include <iostream> struct systemtime { int wmilliseconds; int wsecond; int wminute; int whour; int wday; int wmonth; int wyear; }; in...

Learning to write functions in R -

i point r start writing own functions because tend need same things on , over. however, struggling see how can generalize write. looking @ source code has not helped me learn because seems .internal or .primitive functions (or other commands not know) used extensively. start turning normal copy-pasted solutions functions - fancier things can come later! as example: lot of data formatting requires doing operation, , filling in data frame zeros other combinations did not have data (e.g., years did not have observations , therefore not recorded, etc). need on , on different data sets have different sets of variables, idea , implementation same. my non-function way of solving has been (for specific implementation , minimal example): df <- data.frame(county = c(1, 45, 57), year = c(2002, 2003, 2003), level = c("mean", "mean", "mean"), obs = c(1.4, 1.9, 10.2)) #create expanded version of data frame...

java - Execute jobs after JVM termination -

is possible schedule jobs inside jvm execution after jvm has been terminated? in application, user can opt receive notifications on new emails in inbox. accomplished using quartz, emailchecker job scheduled execute every 45 seconds. public void checkinbox() throws schedulerexception { jobdetail job = jobbuilder.newjob(emailchecker.class) .withidentity("emailjob", "jobgroup").build(); trigger trigger = triggerbuilder.newtrigger() .withidentity("emailtrigger", "jobgroup") .withschedule(cronschedulebuilder.cronschedule("0/45 * * * * ?")) .build(); scheduler scheduler = new stdschedulerfactory().getscheduler(); scheduler.start(); scheduler.schedulejob(job, trigger); } this works fine, while jvm running. once exits, no more notifications sent. the application desktop app, , therefore not running time. , feature majorly useless if worked inside jvm since user ...

android - Change the padding of TextView in TabLayout -

i want change padding on textview in tablayout. have tab that's called subcategories. breaking line wrapping 2 lines. there way this? there answers concerning old tabhost view, using tablayout used google's material design library using android.support.design.widget.tablayout. for tabhost: how add padding tabs label? the textview not padded out, layout surrounding textview is, change linearlayout's padding: int tabindex = 0; linearlayout layout = ((linearlayout)((linearlayout)mtablayout.getchildat(0)).getchildat(tabindex)); layout.setpadding(0, 0, 0, 0);

java - Cannot handle request by requestMapping -

i need handle requests like www.example.com/student/thisisname?age=23&country=uk&city=london i interested in thisisname part , value of city parameter. i have following requestmapping not work. tried {name}{.*:city} well. @requestmapping(value = "/{name:.*}{city}", method = requestmethod.get) you can 2 ways. either using @requestparam or @pathvariable by using @requestparam @requestmapping(value = "/name", method = requestmethod.get) public void somemethod(@requestparam string city){} by using @pathvariable @requestmapping(value = "/name/{city}", method = requestmethod.get) public void somemethod(@pathvariable string city){} you can use of method need concentrate on url

ios - Is there any chance I can detect the Wifi band connected with my iPhone, like 802.11ac, in Objective-C? -

forget grammar rules in question since english not mother tongue; i want detect current wifi hotspot, if in 2.4ghz or 5ghz in ios environment,anyone got idea or possibility? here code below: nsstring *wifiname = nil; cfarrayref myarray = cncopysupportedinterfaces(); if (myarray != nil) { cfdictionaryref mydict = cncopycurrentnetworkinfo(cfarraygetvalueatindex(myarray, 0)); if (mydict != nil) { nsdictionary *dict = (nsdictionary*)cfbridgingrelease(mydict); wifiname = [dict valueforkey:@"ssid"]; } } return wifiname; as know cant native apis. there private api stumbler working wifi in more advanced way. [warning]: if use private apis not able distribute app through appstore.

java - IntelliJ importing class settings issue -

http://pastebin.com/nxpvmkrq http://pastebin.com/pdamg5fr http://pastebin.com/0ekb2fsp the 3 links above of binary search tree assignment working on. 3 files in src folder in project. however, when try run problem2.java says: "cannot resolve symbol 'abstracttree'". also, in problem3.java says same thing: -- "cannot resolve symbol 'bst'" can run these files on ide (preferably intellij) & let me know if problem project settings or if made error in code. looks classes in default package. class in default package cannot import class in same package. need put class in non-default package.

c# - how to measure time in Windows Store apps -

i'm making windows store app (c#) communicate through bluetooth device, , i'm looking way measure how long process done. i've seen same question : where timer in windows store app? , timer while in case need time measurer (like millis() in arduino) does know how this? you can use stopwatch - stopwatch uses highpresission timer if available, othwise datetime.utcnow used var watch = stopwatch.startnew(); performwork(); watch.stop(); timespan elapsedtime = watch.elapsed;

html - Storing Large Form Data JavaScript -

i learning javascript make large form stays local( no web server involved what-so-ever ). familiar php, javascript new me. have form has 100+ checkboxes , text fields. of fields show "[x] other: [/ text field /]" when select "other" selection, have enter input. making validation make sure you, a: enter text if selected "other." b: make sure selected check box if have entered text. when validation function finds wrong, shows alert box. then, page reloads( not sure why ) , of data put form wiped. so, need find way store form data load upon page reload. started cookies, came upon me there limits number of cookies , sizes. else can do??? please help! your submit button reloading page. for example, if form set this: <form name="main" method="post"> <!-- lots of input fields --> <button type="submit" id="subbutton">submit!</button> </form> this doing post un...

jar - Android Support 0 devices SignalR -

Image
i having issue submitting app google play store because every time upload apk "android supported devices : 0" i have no idea how fix this. when remove references signalr , remove jar files, 8k devices supported. here information project edit here manifest <?xml version="1.0" encoding="utf-8"?> <uses-sdk android:minsdkversion="15" android:targetsdkversion="21" /> <!-- <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="com.google.android.providers.gsf.permission.read_gservices" /> <uses-permission android:name="android.permission.access_network_state" /> <uses-permission android:name="android.permission.internet" /> <uses-permission android:name="android.permission.access_coarse_location...

php - Wordpress Shortcode with Select from table syntax error -

i have table called wp_pp_seller , , there have different columns, 2 of user_id , credits . i'm trying create shortcode in function.php in child theme. my code follows: function custom_shortcode() { global $wpdb; $credits = $wpdb->get_results("select {$credits} * {$wp_pp_seller} user_id=current_user_id"); mysql_query($credits); echo "<p>, {$credits} creditos</p>"; } add_filter('init', 'add_custom_shortcode'); function add_custom_shortcode() { add_shortcode('pp_credits', 'custom_shortcode'); } what doing wrong? $current_user = wp_get_current_user(); $credits = $wpdb->get_results("select {$credits} * {$wp_pp_seller} user_id=" . $current_user->id)

c++ - FCTRL code chef too slow -

i having issues cpp code in code chef factorial problem. http://www.codechef.com/problems/fctrl keep getting error telling me slow, , wondering if there way speed up? #include <iostream> using namespace std; int divisible_by_5(long &number) { long hold = 0; int result = 0; if(number % 5 == 0) { result++; hold = number/5; while(hold % 5 == 0) { result++; hold = hold/5; } } return result; } int factorial_expansion(long &number) { int result = 0; while(number > 4) { result += divisible_by_5(number); number--; } return result; } int main() { ios_base::sync_with_stdio(false); int *p_results_array; int lines; cin >> lines; p_results_array = new int [lines]; for(int = 0; < lines; i++) { long input; cin >> input; p_results_array[i] = factorial_expansion(input); } for(int = 0; < lines; i++) { cout <...