Posts

Showing posts from February, 2015

where are device screenshots visible in Xcode6? -

where are device screenshots visible in Xcode6? - for xcode 6, older xcode 4 & 5 organizer menu item has been split both organizer , devices set of menu choices. under devices menu item, you'll see list of various devices xcode knows about, in add-on simulators , things that. and cleaner looking interface lists device information, installed apps each of devices, etc. here's question: there 2 bigger buttons on new devices page. 1 "view device logs" , other "take screenshot". if 1 presses "take screenshot" button take screenshot of what's on connected device, there's no obvious way view screenshot. does know how view screenshots taken xcode 6 devices menu? hard believe that's oversight on dev tool team's part. six minutes after asking question figured out answer. there's tooltip pops when hovering on "take screenshot" button. the screenshots saved straight desktop , you'll see the

android - Shared Preferences not persistent after app restart -

android - Shared Preferences not persistent after app restart - i found answers here , tried solutions, still shared prefs not persistent. here's code: public static void setactivated(boolean activated) { sharedpreferences sp = utils.getcontext().getsharedpreferences( user_prefs, context.mode_private); sharedpreferences.editor editor = sp.edit(); editor.putboolean(asd, activated); editor.commit(); } public static boolean isactivated() { sharedpreferences sp = utils.getcontext().getsharedpreferences(user_prefs, context.mode_private); homecoming sp.getboolean(asd, true); } i've tried also: editor.clear(); editor.put .. editor.commit(); i've tried with editor.apply(); i tried both .apply() , .commit() , no luck. another thought seek using different mode files: ...getsharedpreferences(user_prefs, context.mode_multi_process); the problem values saved not persistent. if close app , re-open values wrong.

asp.net mvc - Sharing session between MVC controller and WebApi controller -

asp.net mvc - Sharing session between MVC controller and WebApi controller - i have web service has mvc controller , wepapi 2 controller. the job of mvc controller render , homecoming html partial view. different mvc application makes phone call , embeds resulting html own page. the partial view contains controls create calls webapi controller temporarily store data. purpose enabled session in webapi controller using code in global.asax.cs : protected void application_postauthorizerequest() { httpcontext.current.setsessionstatebehavior( system.web.sessionstate.sessionstatebehavior.required); } when calling application makes phone call mvc controller, passes model it. model contains initial info controls on partial view need display. same kind of info controls create/update/delete using webapi controller. want set info model session controls in partial view able read/update/delete data. my question this: there way give mvc controller access wepapi

jQuery: If character limit is "x" do "this"? -

jQuery: If character limit is "x" do "this"? - i'm trying set class on div there's text inside, add together class if there's character count of 60. so like, "if character count = 60 {" , i'll add together class. possible? can utilize jquery filter() : $(selector).filter(function(){ homecoming $(this).text().length >= 60; }).addclass('someclass'); filter() cut down elements defined in selector subset ( or none) match conditions returned callback demo jquery

swing - Conway's Game of Life Visualizing Java -

swing - Conway's Game of Life Visualizing Java - i'm trying write conway's game of life in java eclipse. algorithm works have problem in visualizing. can draw little little rectangles live in array did not work @ animations. here code. how can visual ? thanks. public class conwaysgameoflife extends jpanel { private int[][] grid; private static final random rnd = new random(); public conwaysgameoflife(int width, int height) { this.grid = new int[width][height]; setupgrid(); } private void setupgrid() { (int[] row : grid) { (int j = 0; j < row.length; j++) { if (rnd.nextdouble() < 0.92) continue; row[j] = rnd.nextint(2); } } } public void updategrid() { (int = 0; < grid.length; i++) { (int j = 0; j < grid[i].length; j++) { countanddecidedeadoralive(i, j); } }

objective c - failed to find PDF header: `%PDF' not found - works fine in iOS simulator but not on iphone -

objective c - failed to find PDF header: `%PDF' not found - works fine in iOS simulator but not on iphone - this code works fine in ios simulator , displays pdf file, error when run same code on iphone "failed find pdf header: `%pdf' not found" nsstring *urladress= [nsstring stringwithformat: @"http://foodinspections.ocgov.com/foodinspections/inspectionarchives/%@.pdf", self.inspectionresult.serialnumber]; nslog(@"url= %@", urladress); nsdata *pdfdata = [[nsdata alloc] initwithcontentsofurl:[nsurl urlwithstring:urladress]]; [self.webview loaddata:pdfdata mimetype:@"application/pdf" textencodingname:@"utf-8" baseurl:nil]; objective-c uiwebview

java - what is this dropdown looking layout called? -

java - what is this dropdown looking layout called? - ithere cool layout feature in quizup app when click button shows menu under button , pushes else down, here mean: this: http://m.imgur.com/p5iqs5c to this: http://m.imgur.com/ws931xs i'm wondering called in terms of java/android can , larn how implement it. this called expandablelistview feature in android . see link start android expandable list view tutorial java android xml android-layout android-activity

java - Error when exporting a project with Log4j2 into a JAR -

java - Error when exporting a project with Log4j2 into a JAR - i'm creating jar file project uses log4j2. have saved log4j2 jars (for core , api) in 'lib' folder under 'src' folder. within eclipse, exported project create jar file , have checked 'lib' folder included/present in jar file. when run project within eclipse, runs absolutely fine when seek execute jar via cmd prompt, next error: c:\users\workspace>java -jar connectorclient.jar exception in thread "main" java.lang.noclassdeffounderror: org/apache/logging/log4j/logmanager @ com.client.connectionclient.<clinit>(connectionclient.java:20) caused by: java.lang.classnotfoundexception: org.apache.logging.log4j.logmanager @ java.net.urlclassloader$1.run(urlclassloader.java:372) @ java.net.urlclassloader$1.run(urlclassloader.java:361) @ java.security.accesscontroller.doprivileged(native method) @ java.net.url

javascript - Custom markers for points from a geoJson file with Google Maps -

javascript - Custom markers for points from a geoJson file with Google Maps - i'm using geojson info source google maps. i'm using v3 of api create dat layers follows; <script src="https://maps.googleapis.com/maps/api/js?v=3.exp"></script> <script> var map; function initialize() { //initialise map var mylatlng = new google.maps.latlng(53.231472,-0.539783); map = new google.maps.map(document.getelementbyid('map-canvas'), { zoom: 17, center: mylatlng, scrollwheel: false, pancontrol: false, zoomcontrol: false, scalecontrol: true, disabledefaultui: true }); //initialise base of operations folder icons var iconbase = '/static/images/icons/'; //load json show places map.data.loadgeojson('/api/geo'); } google.maps.event.adddomlistener(window, 'load', initialize); </script> <div id="map-canvas"></div> the source of json info follows;

Generate Random Numbers excluding a certain range of values- C# -

Generate Random Numbers excluding a certain range of values- C# - i have 4 batches: 10000-30000 30001-50000 50001-70000 71000-99999 i have generate 500 random numbers followings groups excluding values {70000-71000} my code this. datagrid shows 500 records has numbers between {70-71k}.i need calculate count not giving me required "500" count because random numbers getting generated between {70-71k} need exclude. int i=10000, j=99999; int batch1count = 0, batch2count = 0, batch3count = 0, batch4count = 0; private void button1_click(object sender, eventargs e) { seek { this.datagridview1.rows.clear(); string prefix = combobox1.selectedvalue.tostring(); switch (prefix) { case "1": prefix = "usn"; break; case "2": prefix = "dot"; break; case "3": prefix = "usaf"; break;

c++ - How to pass a lambda function an instantiantion of a class with a template class -

c++ - How to pass a lambda function an instantiantion of a class with a template class - i'm trying create c++ class wraps posix timer functions have timer class can used in flexible manner , pass in user defined info ( can't done straight posix c timer functions ). have following: timer class implementation: #include <functional> #include <utility> #include <sys/time.h> #include <signal.h> #include <time.h> #include <string.h> template<typename f> class timer { public: struct sigaction signalaction; struct sigevent signalevent; struct itimerval timer_ms; timer_t timerid; timer(f callback, int milliseconds) : ontimeout(std::move(callback)) { timer_ms.it_value.tv_sec = milliseconds / 1000; timer_ms.it_value.tv_usec = ( milliseconds % 1000 ) / 1000; timer_ms.it_interval.tv_sec = milliseconds / 1000; timer_ms.it_inte

javascript - How to get value of jquery variable into php variable without ajax? -

javascript - How to get value of jquery variable into php variable without ajax? - my js : $('#affiliates_name').change(function(){ var id = $('#affiliates_name').val(); }); and html is: <select id="affiliates_name" style="display: none;" name="affiliates_name"> <?php foreach($users_names $value){ echo "<option value='".$value['id']."'>".$value['first_name']." ".$value['last_name']." (".$value['id'].")</option>"; }?> </select> <?php $get_value ?> and want var id value in php variable $get_value without ajax, using jquery. as other members suggested, should read ajax , difference between server-side , client-side code. however, if correctly understand willing do, don't need of those. if want display different content according alternative chosen user can maniupulate dom constru

python - how to replace an array containing indices with values from another array? -

python - how to replace an array containing indices with values from another array? - i have array b containing indices of array a. want insert values of array c in array b same indices. import numpy np a1=np.array([[1, 3, 5, 2, 3],[7, 6, 5, 2, 4],[2, 0, 5, 6, 4]]) a=a1.argsort()[:,:2] ## create array indices of 2 smallest values of a1 [[0 3] [3 4] [1 0]] b=np.array([[1],[2],[3],[4],[5],[6]]) now want replace value 0 in 1 in b ; 3 4 , on i tried using: [a[index]]=b[index] but not right way array handles these indices values please help if understood correctly, can utilize flattened version of a index b : result = b.ravel()[a.ravel()] [1, 4, 4, 5, 2, 1] if need in same dimensions a can reshape it: result = result.reshape(a.shape) [[1, 4] [4, 5] [2, 1]] python python-2.7 numpy

ios - How To Stream Local Files Such As .MP4 Files To Chrome Cast? -

ios - How To Stream Local Files Such As .MP4 Files To Chrome Cast? - okay i'm developing application supports casting local media chrome cast. far have connected device , have streamed sample video i'm know struggerling streaming local files such .mp4/.mp3 files located in documents directory of application. have tried utilize url of file instead of sample video. not work. believe due fact file path not within @ http:// format i'm not sure. if right in thinking how can round it? here code i'm using stream google sample video chrome cat: gckmediainformation *mediainformation = [[gckmediainformation alloc] initwithcontentid: @"http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/bigbuckbunny.mp4" streamtype:gckmediastreamtypenone contenttype:type metadata:metadata streamdurat

animation - Unable to cancel animated loading in onPostExecute() in android -

animation - Unable to cancel animated loading in onPostExecute() in android - i trying show animation loading using asynctask in android.but im unable show animation im expecting,more on couldn't able cancel animation well. can help me solve issue. thanks precious time!.. show_animatedloading.java imageview imageview; @override protected void oncreate(bundle savedinstancestate) { // todo auto-generated method stub super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); imageview=(imageview) findviewbyid(r.id.imageview1); customload task = new customload(); task.execute(); } public class customload extends asynctask<void, void, void> { @override protected void onpreexecute() { // todo auto-generated method stub show_animation(); } private void show_animation() { // todo auto-generated method stub animation = animationutils.loadanimation(show_animatedloading.this, r.anim.progres

html - My wordpress theme is hyphenating and can't turn it off using CSS -

html - My wordpress theme is hyphenating and can't turn it off using CSS - i'd stop hyphenation on wordpress site. using function theme woothemes. i've added style.css file in kid theme (note added more specificity , !important tags continued not work). html body #wrapper #content p { -moz-hyphens: none !important; -ms-hyphens: none !important; -webkit-hyphens: none !important; hyphens: none !important; } i can't find declaration on ruled in firebug understand why it's not working... i've set illustration of what's going on over here: http://dev.thecyclery.net.au/home-test/hyphens/ thanks! jon there appears trailing slash in comment that's breaking css plenty cause problem. /* =theme customization starts here -------------------------------------------------------------- *// that lastly slash on end, that's culprit. delete , should work expected. comment should this: /* =theme customization starts

Apps Script to open of a Google Document "open in my browser" with function -

Apps Script to open of a Google Document "open in my browser" with function - just trying utilize simple script "open in browser" doc not spredsheet specified file id , opens document . function onopen() { // add together menu items, separators, , sub-menu. documentapp.getui().createmenu('oar') .additem('maj date + oar', 'test') .additem('maj date auto', 'testdate') ***.additem('accès direct url', 'href=/d/1udvlspazngalg6nid jmjvkkw3i9ocaeka-a_cac79cykvszkd545dyzn/edit?')*** .addtoui(); } google-apps-script google-docs

sql server - SQL Update Trigger with If Else logic with Multiple Rows -

sql server - SQL Update Trigger with If Else logic with Multiple Rows - i'm having problem getting trigger function multiple records while containing if/else logic need conduct test before inserting records. my goal here enable front end end user of scheme alter event type between values 1,2, , 3, if alter event type 1 must come in occurrence date otherwise transaction rolled back. if come in occurrence date transaction entered. below logic works 1 record updated through front end end, problem when multiple changes written via sql receive error: "msg 512, level 16, state 1, procedure tg_tbl_le_event_occurence_date_validation, line 9 subquery returned more 1 value. not permitted when subquery follows =, !=, <, <= , >, >= or when subquery used expression. statement has been terminated. " i know trigger can rewritten business relationship multiple records, cannot find way write if else test still functions. input appreciated. alter trigger

authentication - Laravel - log out specific user -

authentication - Laravel - log out specific user - i know how log in user, how log out specified user application? there doesn't seem plenty coverage on this. you can logout specific user logout in laravel 4.2 , using multi auth /* normal user logout */ auth::user()->logout(); /* admin user logout */ auth::admin()->logout(); /* manager user logout */ auth::manager()->logout(); as made users auth authentication laravel logout

python - All possible tuples -

python - All possible tuples - possible_frequency = [0,1,2,3,4,5,6,7,8] clamp_range = list(xrange(0, 51, 1)) possible_clamp_levels = int(len(clamp_range)*len(possible_frequency)) print possible_clamp_levels i want find way print possible tuples (459) using possible_frequency , clamp_range is, (0,0),(0,1), (0,2).....(8, 50) is there bundle in python allow me this. this do possible_tuples = [] for in range(0, len(possible_frequency)): b in range(0, len(clamp_range)): test = (possible_frequency[a], clamp_range[b]) possible_tuples.append(test) print possible_tuples i need more sophisticated way. you can utilize itertools.product() : from itertools import product list(product(possible_frequency, clamp_range)) python itertools

c# - ConfigurationManager.AppSettings Returns Null In Unit Test Project -

c# - ConfigurationManager.AppSettings Returns Null In Unit Test Project - i have c# unit test project application settings in app.config file. testing class exists in different project. class depends on both, configurationmanager.appsettings , configurationmanager.connectionstrings . the project class beingness tested resides in not have app.config file. have thought because class beingness instantiated in context of unit test project utilize unit test project's app.config file. indeed, seem case connection string. the class retrieves connection string without issues. however, when class tries retrieve application settings configuration manager returns null . going on here? edit 1 i thought maybe thought seek load settings in test project see happens. tried load setting in unit test before calling code instantiates class in external project. same result, nothing. guess can exclude other project equation time being. here excerpt config file: <c

reflection - how to get name of a variable in groovy -

reflection - how to get name of a variable in groovy - i have groovy script has function 2 arguments, 1 of hashmap. want check name of hashmap variable contains substring or not, within function. how do it? def myfunc(string var, hashmap var2) { // need routine retrive name of variable var2 } it's explained here : getting name of method parameter to access groovy script's method follow syntax : metaclass.methods reflection groovy

php - How to get data from database between date pickers -

php - How to get data from database between date pickers - i have simple form , contain 2 date pickers. start , end. date picker show mm-yy-dddd format. database table contain yyyy-mm-dd format. want info table.. how info format using mysql , php ? <?php if(isset($_post['submitted'])){ // grab info $startdate = $_post['start_date']; $enddate = $_post['end_date']; // echo $startdate; // echo "<br />"; // echo $enddate; $result = mysql_query('select sum(amount) total tbl_loan (created between "'.$startdate.'" , "'.$enddate.'") '); $row = mysql_fetch_assoc($result); $sum = $row['total']; } ?> use strtotime if(isset($_post['submitted'])){ // grab info $startdate = $_post['start_date']; $enddate = $_post['end_date']; // echo $startdate; // echo "<br />

Modify the function variables from inner function in python -

Modify the function variables from inner function in python - it's ok , print outer function variable a def outer(): = 1 def inner(): print it's ok outer function array a , append something def outer(): = [] def inner(): a.append(1) print however, caused problem when tried increment integer: def outer(): = 1 def inner(): += 1 #or = + 1 print >> unboundlocalerror: local variable 'a' referenced before assignment why happen , how can accomplish goal (increase integer)? workaround python 2: def outer(): = [1] def inner(): a[0] += 1 print a[0] python function variables scope

css - bootstrap input form-control display horizontally than cascading -

css - bootstrap input form-control display horizontally than cascading - i have problem input bootstrap form-control in table column. dont want cascading ontop of each other want stacked horizontally how tables rows should be. here problem code: <td colspan="4"> a: <input class="form-control" id="a" type="text" value="a" /> b: <input class="form-control" id="a" type="text" value="a" /> </td> and here illustration see problem. http://jsfiddle.net/gv6y8/27/ you have few issues in code, should wrap inputs in form-group class, form-control automatically takes 100% width. furthermore, sounds want using form-inline . try this: html: first change: add together form-inline class <table id="paymenttable" class="table table-condensed form-inlin

puppet - Conditional logic on whether to include subclass -

puppet - Conditional logic on whether to include subclass - i'm trying edit init.pp file include subclass if variable has been set. i've initialized variables undef, when if statement below errors , says: syntax error @ 'if'; expected '}' when write case statement, works fine not if. thought why is? class {'wlsvr': } -> case $jdbc_filename { undef: {} default: {class {'jdbc':}} } -> if $managedsvr_name != undef { class {'managedsvr': } } please rid of unfortunate habit of using -> between every other puppet statement. this chainging arrow introduces dependency between resources/classes connects. should used when dependency needed. issues opening to gratuitous dependency trees when building dependencies between classes (you here) issues when refactoring code, because if , cases statements not (always) form equivalent of resources or classes as aside, benefic

ios - Get current type of internet connection -

ios - Get current type of internet connection - i want technology of radio access (internet connection), observe if device connected wifi or wwan connection (and in case, type of wwan : gprs, egde, 3g, 3g+, 3g++, or 4g). does cttelephonynetworkinfo works iphone , ipad on ios7.1 ? i've tried observe wifi connection on ipad print null result. code : cttelephonynetworkinfo *telephonyinfo = [cttelephonynetworkinfo new]; nslog(@"current radio access technology: %@", telephonyinfo.currentradioaccesstechnology); someone can told me why ? i'm not sure understand this... thanks help (source : http://www.objc.io/issue-5/ios7-hidden-gems-and-workarounds.html, section "know radio") that's because currentradioaccesstechnology homecoming radio access technology (not whether it's wifi or wwan). illustration of homecoming value ctradioaccesstechnologylte . to informed whether app connect wifi or wwan, should utilize reachability.

node.js - Unable to use NPM without sudo -

node.js - Unable to use NPM without sudo - i have installed node , npm using homebrew, , before bundle downloaded nodejs website , still cannot utilize npm @ without prefixing sudo. when seek npm -v example, no error shown, terminal waits , waits , waits until finally, [process completed] message appears. why , how prepare it? i have searched around , tried many things, including advice in so post have added homebrew location "$path" adding "export path="/usr/local/bin:$path" bash profile? node.js osx npm sudo

c# - ASP.net gridview, autorefresh, txt as source and maintain scroll position -

c# - ASP.net gridview, autorefresh, txt as source and maintain scroll position - i want gridview emulate console, text file have server console log. i want to: *refresh when file changes.(thus timer) *scroll bar position maintained when updated, unless @ bottom. *when scroll bar position @ bottom,stay @ bottom after databind update. current problem: on timer, databind() moves scrollbar position top, , refresh can't scroll downwards @ all. here current code. give thanks help! asp.net <%@ page language="c#" autoeventwireup="true" codebehind="test console.aspx.cs" inherits="webapplication1.test_console" %> <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" > <head runat="server"> </head> <body> <form id="form1" run

ruby on rails - has_many through form not registering in the join table -

ruby on rails - has_many through form not registering in the join table - i have problem ruby on rails 4 app activeadmin gem have generated multiple resources works have problem resource has has_many through relationship. new records not registered through bring together table. here model : video.rb class video < activerecord::base has_many :album_videos has_many :albums, :through => :album_videos end album.rb class album < activerecord::base has_many :album_videos has_many :videos, :through => :album_videos end album_video.rb class albumvideo < activerecord::base belongs_to :video belongs_to :album end and activeadmin file album album.rb activeadmin.register album menu :priority => 6, :label => proc{ "album de vidéos" } filter :album_videos permit_params :titre, :description, videos_attributes: [:id, :titre, :_update,:_create] form |f| f.inputs f.inputs "vidéos" f.input :video

php - RabbitMQ for high volume MySql inserts and updates? -

php - RabbitMQ for high volume MySql inserts and updates? - we have mysql database has many writes & updates per sec , rate growing rapidly. to handle writes , updates thinking adding queuing instance rabbit mq between application , db, each query sent queue , users not have wait database finish inserting , updating records. we understand using queue cause delay in db info update , not problem our application. for inserts utilize 'insert delayed' , myisam table can't updates. after digging came queuing option. is recommended method lowering working high volume writes db? or should consider solution? if have recommendation other rabbitmq open new ideas. also - known plugins php mysql pdo rabbitmq? thanks perhaps library may help you: https://github.com/videlalvaro/php-amqplib php mysql rabbitmq

How do i refactor one JSON array into other format in JAVA? -

How do i refactor one JSON array into other format in JAVA? - i have json array this, jsonarray content= "[ {"+"\"pageid\":\"19\","+"\"company\":"+"\"c1\","+"\"pageview\":"+"\"10\","+"\"visitfreq\":"+"\"2\"},{"+"\"pageid\":\"19\","+"\"company\":"+"\"c2\","+"\"pageview\":"+"\"20\","+"\"visitfreq\":"+"\"4\"},{"+"\"pageid\":\"200\","+"\"company\":"+"\"c3\","+"\"pageview\":"+"\"30\","+"\"visitfreq\":"+"\"3\"} ]"; code jsonarray: jsonobject jobj1 = new jsonobject(); jobj1.put("pageid", "19"); jobj1.put(&qu

android - Default custom font -

android - Default custom font - is possible set custom font default in android application? because typing every textview not efficient. login = (textview)findviewbyid(r.id.tvlogin); login.settypeface(titlefont); is possible set custom font default in android application? not custom typeface loaded own font file, sorry. others have noted, there workarounds , libraries help simplify matters bit. personally, i'd @ calligraphy or perhaps fontify. android fonts

How to represent this data structure in Javascript -

How to represent this data structure in Javascript - can help me datastructure represents next scenario in javascript.help appreciated. looking @ different options tree traversal ,doubly linked list need improve inputs. use case : object representation comes server follows behaviour id 1 [checkbox] combinable [2,3] behaviour 2 [checkbox] combinable [8] behaviour 3 [checkbox] combinable [5] behaviour 4 [checkbox] combinable [7] behaviour 5 [checkbox] combinable [] behaviour 6 [checkbox] combinable [] behaviour 7 [checkbox] combinable [] behaviour 8 [checkbox] combinable [9] behaviour 9 [checkbox] combinable [] considering next scenario, need traverse bi-directional. use case 1 : when user selects behaviour id 1, [1,2,8,9] , [1,3,5] should enabled.rest of checkboxes disabled. use case 2 : bi-directional. in continuation utilize case 1, when user selects 8 , deselects id 1, then[8,9] should enabled [1,2,3,4,5,6] should disabled. i edite

php - ERROR 4 Start tag expected, '<' not found (in n/a - line 1, column 1) -

php - ERROR 4 Start tag expected, '<' not found (in n/a - line 1, column 1) - i'm getting error when add together new service: [error 4] start tag expected, '<' not found (in n/a - line 1, column 1) this new services.yml file: parameters: acme_foo.class: acme\foobundle\services\foos services: acme_foo: class: %acme_foo.class% arguments: [@doctrine] there no tabs in file, spaces. dependencyinjection/configuration.php file: <?php namespace acme\foobundle\dependencyinjection; utilize symfony\component\config\definition\builder\treebuilder; utilize symfony\component\config\definition\configurationinterface; /** * class validates , merges configuration app/config files * * larn more see {@link http://symfony.com/doc/current/cookbook/bundles/extension.html#cookbook-bundles-extension-config-class} */ class configuration implements configurationinterface { /** * {@inheritdoc} */ public f

Output MySQL variables in PHP array -

Output MySQL variables in PHP array - i have mysql variables, echoing want utilize them in array , randomly display results - it's competition - random working great can't variable show correctly when they're in array(). i have written following: <?php $answer = array('$this->item->correct_answer','$this->item->false_answer1','$this->item->false_answer2'); shuffle($answer); ?> <ol class="answers"> <?php for( $i = 0; $i < 3; $i++) echo "<li>$answer[$i]</li>"; ?> </ol> this outputting: $this->item->correct_answer$this->item->false_answer2$this->item->false_answer1 that's because you've got ' array inputs. means you're setting string. revise to: $answer = array($this->item->correct_answer,$this->item->false_answer1,$this->item->fal

javascript - Keeping a div box intact just like gmail -

javascript - Keeping a div box intact just like gmail - for illustration have webpage few links made. now want divbox should appear (just when compose message in gmail divbox appears). when appears, click on link available @ webpage (which mentioned in first line), take me webpage, don't want divbox disappear, should remain was. how can this? the divbox should not refresh , page should refreshed 1 time click on link. javascript html css

drop down menu - Android Spinner click away from dropdown -

drop down menu - Android Spinner click away from dropdown - if user clicks on spinner, dropdown menu items show up, , onitemselected listener activated if 1 of items selected, however, how can detect, if user clicks away dropdown menu? thanks i think can utilize onnothingselected method that, public class spinneractivity extends activity implements onitemselectedlistener { ... public void onnothingselected(adapterview<?> parent) { // add together code here } } according doc onnothingselected callback method invoked when selection disappears view. selection can disappear instance when touch activated or when adapter becomes empty. if spinner disappear other reason except selecting item onnothingselected called. it's name tells needed find out when nil selected. android drop-down-menu spinner android-spinner

objective c - Setting up a UITableView within a UIViewController -

objective c - Setting up a UITableView within a UIViewController - i know there hoards of questions out there topic, after looking through of them sense though nil working, bare me. i have viewcontroller named quicklookview , need implement table view it. have declared tableview in header file: @interface quicklookview : uiviewcontroller <uitableviewdelegate, uitableviewdatasource> ... @property (weak, nonatomic) iboutlet uitableview *medtableview; @end in quicklookview.m synthesized medtableview , added standard uitableview methods: #pragma mark - table view info source - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { homecoming 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { nsmutablearray * timeline = [gcore getdosagecontainer]; homecoming [timeline count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath* )indexpath { st

c++ - Windows IStream interface on std::istream -

c++ - Windows IStream interface on std::istream - within c++ on windows, there easy way create (com) istream interface existing std::stream object? an illustration read image iwicstream::initializefromistream() std::cin . there no standard implementation that. need write class (or find third-party one) implements istream interface , internally delegates std::stream needed. however, have problem implementing istream::stat() , commonly used retrieve stream's info size. in case of std::cin , not know how much info beingness provided. c++ windows com istream

Python: How to write to CSV and append date from a DataFrame to the filename -

Python: How to write to CSV and append date from a DataFrame to the filename - i using next method write csv file date appended filename. outpath = r'c:\test' filename = "filename_"+(time.strftime("%y%m%d")+".csv") df.to_csv(outpath + "\\" + filename) print outpath + "\\" + filename c:\test\filename_20140621.csv but have problem when routine crosses midnight , date added incorrect. i have right date in dataframe df, this: df['date/time'].head() out[54]: 0 2014-06-20 1 2014-06-20 2 2014-06-20 3 2014-06-20 4 2014-06-20 name: date/time, dtype: object i utilize date in filename, can't find right way reference it for example, set date in new dataframe named 'date' 1 column: date = pd.to_datetime(df['date/time']) date.head() out[15]: 0 2014-06-20 1 2014-06-20 2 2014-06-20 3 2014-06-20 4 2014-06-20 name: date/time, dtype: datetime64[ns] and tried fol

javascript - What are the concerns for exposing an api key from a service? -

javascript - What are the concerns for exposing an api key from a service? - a lot of sites utilize api key access services. prime illustration mapquest's geocoding service. prior using service, required sign assigned api key. an illustration of querying key: 5-box address format: json request http://open.mapquestapi.com/geocoding/v1/address?key=your_key_here&informat=json&json={"location":{"street": "1090 n charlotte st","city":"lancaster","state":"pa","postalcode":"17603"}} are there security concerns if key exposed clientside (ie, through javascript)? in particular instance, it's useful geocoding clientside avoid unnecessary load on server. 1 problem might else can utilize same key own purpose or maybe spam service until key locked. javascript security geocoding api-key

iphone - UIImageView allocs with strange addresses -

iphone - UIImageView allocs with strange addresses - i have 5 uiviews alloc same image. after alloc appear kind of addresses: [0] = 0x0000000117068650 [1] = 0x00000001151ea1c0 [2] = 0x00000001151a77f0 [3] = 0x00000001170026c0 [4] = 0x00000001151b5c40 this i'm doing uiimage *image = [uiimage imagenamed:@"something.png"]; uiimageview *containers[5]; (int = 0;i < 5; i++) { containers[i] = [[uiimageview alloc] initwithimage:image]; containers[i].frame = cgrectmake(0,0, image.size.width, image.size.height); [self.view addsubview:containers[i]]; } of course of study project much more complex how can happen? related how i'm declaring uiimageviews? iphone memory-management

Facebook FQL is deprecated, but there's no way to directly get friend_count with Graph API? -

Facebook FQL is deprecated, but there's no way to directly get friend_count with Graph API? - using fql can friend count of user with: select uid,friend_count user uid in (<list of user ids/>) but looks graph api, have create requests until pagination runs out, , count how many results returned using like: array( 'method' => 'get', 'relative_url' => 'me/friends?access_token='. $token ) i tried using array( 'method' => 'get', 'relative_url' => 'me/friends?summary=true&access_token='. $token ) but didn't work. there single graph api request can user's friend count? if not, how create feature request? facebook implemented feature graph api since release of v2.1: /friends border on user object provides access total friend count. retroactively supported in v2.0 well. graph-api-v2.1 facebook-graph-api facebook-fql

javascript - How to call a script embedded into a HTML element -

javascript - How to call a script embedded into a HTML element - having next html : <div id="plugin"> <script> (function(){ this.do = function(e){ alert("cool!"); }; }); <script> <div> how phone call this.do (say parent element click button event handler)? maybe more info help advising on right solution. it's plugin, want both markup , script part of same file. want able like: $("#plugin").*controller*.do(); outside of plugin. here's candidate solution, inspired scott's answer: <div> (function(){ var plugin = $("#plugin"); plugin.do = function(e){ alert("cool!"); }; }); </div> then outside: $("#plugin").do(); any issues it? why against doing? <script> function do(){ alert('cool!'); } <script> you : <script> window.do = function(){ ... } </s

Use User Service in Openfire to Register new user via xmpp framework for iOS -

Use User Service in Openfire to Register new user via xmpp framework for iOS - i can see users manually created in openfire server, working book accomplish but, there way programmer register user via http using openfire , user service plugin. want know how register new user feature , if can check if user exists on openfire server ios application. how can http link of openfire accomplish registration or there way? read custom registration create webservice know little webservices please can help, thanks. you need register user creating nsxmlelement , pass xmppstream register new user.make sure have xmppstream object able fire queries server , required output. nsmutablearray *elements = [nsmutablearray array]; [elements addobject:[nsxmlelement elementwithname:@"username" stringvalue:@"abc"]]; [elements addobject:[nsxmlelement elementwithname:@"password" stringvalue:@"xyz"]]; [elements addobject:[nsxmlelement elementwithname:@"

java - Are bindings automatically removed in a TreeCell -

java - Are bindings automatically removed in a TreeCell - i have treeview has cell mill set on it. treecells i'm returning displayed below: import javafx.beans.binding.stringbinding; import javafx.collections.observablemap; import javafx.scene.control.treecell; public class treecelltest extends treecell<string> { private observablemap<string, stringbinding> lookup; public treecelltest(observablemap<string, stringbinding> lookup) { this.lookup = lookup; } @override protected void updateitem(string id, boolean empty) { super.updateitem(id, empty); if (empty) { settext(null); } else { stringbinding stringbinding = lookup.get(id); textproperty().bind(stringbinding); } } } notice i'm not setting text i'm binding textproperty stringbinding. works fine in normal situations i'm wondering if ok utilize within treecell. the treecell gets recycle

PHP echo MySQL value in If/Else -

PHP echo MySQL value in If/Else - i have php echo value displays value mysql database this: <?php echo($row_wadahtg_techprops["emptype"]); ?> i need build if/else value getting syntax error no matter how seek arrange this: <?php if (echo($row_wadahtg_techprops["emptype"]) = "6001") { echo "have day!"; } else { echo "have night!"; } ?> try that: <?php if ($row_wadahtg_techprops["emptype"] == "6001") { echo "have day!"; } else { echo "have night!"; } ?> php mysql

CouchDB and Ruby on Rails Tutorials -

CouchDB and Ruby on Rails Tutorials - i new rails , couchdb , looking tutorials describe how create project using 2 technologies. does has links useful resources/tutorials? i recommend article: http://mattscodecave.com/posts/getting-couchdb-to-work-with-couchrest-in-rails-4.html (updated) also here step-by-step manual: http://railskey.wordpress.com/2013/07/10/rails-couchdb-demo-application/ good luck couchdb. ruby-on-rails couchdb

c# - Assert.Fail failed. System.NotSupportedException: GetProperty of "HasFocus" is not supported on control type: Window -

c# - Assert.Fail failed. System.NotSupportedException: GetProperty of "HasFocus" is not supported on control type: Window - i trying run coded ui test in firefox browser , getting error message: assert.fail failed. system.notsupportedexception: getproperty of "hasfocus" not supported on command type: window i trying run coded ui test in firefox browser , getting error message: assert.fail failed. system.notsupportedexception: getproperty of "hasfocus" not supported on command type: window private void newhousecalctest(action<test.web.testing.utility> testgroup) { datarow dr = testcontext.datarow; assertions assert = new assertions(testcontext); newhouseuimapclasses.loadnewhouseurlparams win = this.newhouseuimap.loadnewhouseurlparams; win.uinewhousecalculatorhowindowurl = common.getparamvalue(dr, "newhouseurl", win.uinewhousecalculatorhowindowurl); if (common.isiter

html - drop down menu Sub-menu doesn't show -

html - drop down menu Sub-menu doesn't show - i can't sub-menu show when hover list item. did wrong ? it hides using display:none, doesnt show when hover. nav ul ul {display: none;} nav ul li:hover > ul{display: block;} complete code: <nav> <ul> <li><a href="#">link</a></li> <li><a href="#">link2</a></li> <ul> <li><a href="#">submenu</a></li> </ul> </ul> </nav> css: /* start navbar */ nav ul,li{ display: flex; -webkit-justify-content: center; -moz-justify-content: center; -ms-justify-content: center; justify-content: center; list-style: none; } nav ul ul {display: none;} nav ul li:hover > ul{display: block;} nav ul {position: relative;} nav ul li { position: relative; flex: 1; background-color: g

ext.net - Invalid data source source type. The data source must be of type IListSource, IEnumerable or IDataSource -

ext.net - Invalid data source source type. The data source must be of type IListSource, IEnumerable or IDataSource - i prety new on mvc app.my problem vs gives me error this. "invalid info source source type. info source must of type ilistsource, ienumerable or idatasource." **what wanna in senario using sample making pagination entitiy. here view @( html.x().panel() .id("imagepanel") .cls("images-view") .frame(true) .width(535) .collapsible(true) .title("urunler") .items( html.x().dataview() .id("imageview") .store( html.x().store() .remotepaging(true) .autoload(false) .id("store1") .pagesize(5) .datasource(m

Implement chat using websocket in android with php -

Implement chat using websocket in android with php - i want implement chat functionality using websocket in android php. i need php code same. the scenerio this. the android developer send message android device php application , php message sent users android phone meant for. after need save chats in database well. i have no thought how it. please help , provide code fo this. the code have written follows. $address = "0.0.0.0"; $port = 5000; $max_clients = 10; if(!($sock = socket_create(af_inet, sock_stream, 0))) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("couldn't create socket: [$errorcode] $errormsg \n"); } echo "socket created \n"; // bind source address if( !socket_bind($sock, $address , 5000) ) { $errorcode = socket_last_error(); $errormsg = socket_strerror($errorcode); die("could not bind socket : [$errorcode] $errormsg \n"); } echo "socke

postgresql - Python psycopg2-2.5.1 installation on Windows 8 -

postgresql - Python psycopg2-2.5.1 installation on Windows 8 - i installing python psycopg2 , compilation fails: os: windows 8 64 bit python: 2.7 mingw-w64 c:/mingw-w64/x86_64-4.9.0-win32-seh-rt_v3-rev2/mingw64/bin/../lib/gcc/x86_64-w64 -mingw32/4.9.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lpython27 collect2.exe: error: ld returned 1 exit status error: command 'c:\\mingw-w64\\x86_64-4.9.0-win32-seh-rt_v3-rev2\\mingw64\\bin\\ gcc.exe' failed exit status 1 cannot find -lpython27 python27.lib not on library_path . it's hard why or provide more info because didn't explain how got point - commands run, python version installed, etc. in case, recommend just utilize binary installers. see these existing answers: install psycopg2 on windows 8.1 how easy_install psycopg2 on windows 7? how install psycopg2 "pip" on python? installing psycopg2 on windows xp using pip , virtualenv can't install psycopg2 py

json - How to fetch data from World Bank API (status is 200 But executing error block in jquery/ajax) -

json - How to fetch data from World Bank API (status is 200 But executing error block in jquery/ajax) - i have below code fetch info in json format (http://api.worldbank.org/countries/all/indicators/palm_oil?date=2000m01:2020m12&per_page=1000&format=json) actually, have specified datatype: jsonp , request happening status 200 , info coming in response success handler not invoked, invoking error block. code below <script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <script type="text/javascript"> $(function(){ $.ajax({ contenttype: "application/json", datatype: 'jsonp', crossdomain: true, url: "http://api.worldbank.org/countries/all/indicators/palm_oil?date=2000m01:2020m12&per_page=1000&format=json", success: function() { console.log("success"); }, error: function() { console.log("error&q

php - Comparing 2 different values returns true -

php - Comparing 2 different values returns true - this question has reply here: why (0 == 'hello') homecoming true in php? 5 answers i came across while playing php $test1 = '123abc'; $test2 = 123; var_dump($test1); echo "<br />"; var_dump($test2); echo "<br />"; $test3 = ($test1 == $test2) ? true : false; var_dump($test3); this resulted in: string(6) "123abc" int(123) bool(true) could explain why $test3 came out true? using "===" create false due comparing string int. also notice if forcefulness (string)$test2 give me expected false, , forcing (int)$test1 returns expected true; does mean $test3 homecoming true because php automatically converted $test1 int before comparison? look @ the details here: a string' == 0 evaluates true because any string converted i

ruby on rails 4 - Rspec controller tests with chaining method calls -

ruby on rails 4 - Rspec controller tests with chaining method calls - my controller looks this: class="lang-rb prettyprint-override"> def index params[:page]||1 @stories = story.all.page(params[:page]).per(5) end when seek write controller tests chaining line through using rspec, can't seem tests pass. my controller_spec looks like: class="lang-rb prettyprint-override"> describe '#index' let(:story) {double(story)} before allow(story).to receive(:all).and_return(story) allow(story).to receive(:page).and_return(story) allow(story).to receive(:per).and_return(story) :index end context 'when user not logged in' 'should page 1' expect(story).to receive(:page).with(1)