Posts

Showing posts from March, 2014

javascript - Birghtcove chromeless video player controls not working in Safari -

issue happening brightcove's chromeless player the controls (pause, play, , move specific time in video) appear on hover when clicked disappear (instead of pausing/playing or moving specified time). they appear , work in firefox , chrome... :( here configuration: <object id={this.props.elemid} classname="brightcoveexperience"> <param name="allowfullscreen" value="false" /> <param name="bgcolor" value="#000000" /> <param name="width" value="960" /> <param name="playerid" value="**********" /> <param name="playerkey" value="**********" /> <param name="height" value="540" /> <param name="isui" value="true" /> <param name="isvid" value="true" /> <param name="dynamicstreaming

ruby - Strong params: How to process nested json code? -

i'm trying write update method processes json. json looks this: { "organization": { "id": 1, "nodes": [ { "id": 1, "title": "hello", "description": "my description." }, { "id": 101, "title": "fdhgh", "description": "my description." } ] } } my update method follows: def update organization = organization.find(params[:id]) nodes = params[:organization][:nodes] nodes.each |node| n = node.find(node[:id]) unless n.update_attributes(node_params) render json: organization, status: :failed end end render json: diagram, status: :ok end private def node_params params.require(:organization).permit(nodes: [:title, :description]) end unfortunately, n.update_attributes(node_params) generates: unpermi

html - Override CSS File -

this question has answer here: overriding css style? 2 answers i using optimizepress template has css file following line part of theme: .container{width:1060px;margin-left:auto;margin-right:auto;background-color:#fff} . i want override make width 900px. how can without changing css file? optimizepress theme has ability on page css tried use important not working me. you link css file, underneath current one. in css, if have 2 styles same class, last 1 computer reads 1 gets chosen. that's why need link new css after. so make new css file , write .container { width: 1060px; } then in html header, directly underneath linkg current css put <link rel="stylesheet" href="path/to/yournewcssfile.css">

c++ - "undefined reference to" in G++ Cpp -

can't seem errors go away. errors below. have looked on google , still can't figure out. not new cpp, have not fooled in while. weird thing worked g++ in windows... errors: [ze@fed0r! - - -** _ _*]$ g++ main.cpp /tmp/ccjl2zhe.o: in function `main': main.cpp:(.text+0x11): undefined reference `help::help()' main.cpp:(.text+0x1d): undefined reference `help::sayname()' main.cpp:(.text+0x2e): undefined reference `help::~help()' main.cpp:(.text+0x46): undefined reference `help::~help()' collect2: ld returned 1 exit status main.cpp #include <iostream> #include "help.h" using namespace std; int main () { h; h.sayname(); // *** // *** // *** return 0; } help.h #ifndef help_h #define help_h class { public: help(); ~help(); void sayname(); protected: private: }; #endif // help_h help.cpp #include <iostream> #include "help.h" using namespac

android.database.sqlite.SQLiteException: near ",": syntax error (code 1): , while compiling -

android.database.sqlite.sqliteexception: near ",": syntax error (code 1): , while compiling: select id, title, tagline, overview, release_date, vote_average, popularity, posterpath, runtime, genres, cast, crew, follow, notified moviesnowplaying . @override public cursor query(uri uri, string[] projection, string selection, string[] selectionargs, string sortorder) { sqlitequerybuilder querybuilder = new sqlitequerybuilder(); switch (urimatcher.match(uri)) { case uricodenowplaying: querybuilder.settables(moviesschema.moviesnowplaying.table_name); break; case uricodeupcoming: querybuilder.settables(moviesschema.moviesupcoming.table_name); break; case uricodepopular: querybuilder.settables(moviesschema.moviespopular.table_name); break; default: throw new illegalargumentexception("unknown uri " + uri); } cursor cursor = querybuil

r - PCA prcomp: how to get PC1 to PC3 graph -

Image
in script pca (below), graph of pc1 vs pc2. mydata.pca <- prcomp(mydata.fixed, center = true, scale. = true) g <- ggbiplot(mydata.pca, obs.scale = 1, var.scale = 1, groups = mysamples, ellipse = false, circle = false, var.axes=false) g <- g + scale_color_discrete(name = '') g <- g + theme(legend.direction ='horizontal', legend.position = 'top') g <- g + theme_bw() however, when run like: summary(mydata.pca) i see info pc1 pc4. how can change ggbioplot script graph of pc1 vs pc3? the choices argument ggbiplot looking for: iris_pca <- prcomp(iris[, 1:4], center = true, scale. = t) # pc1 vs pc 2 ggbiplot(iris_pca, choices = c(1,2), obs.scale = 1, var.scale = 1, groups = iris$species, ellipse = true, circle = true) + scale_color_discrete(name = '') + theme(legend.direction = 'horizontal', legend.position = 'top&#

css - Fix an image in the middle of the page with HTML -

i not deal html , thought should pretty easy seems not. wanted image , text displayed in middle of page. can align image , text middle horizontally cannot vertically. found solution , wondered why working , if there better way. code version 1 (not working): <!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"> <body> <div style="width:100%; height:100%; text-align:center"> <img src="http://dummyimage.com/100x50/fc0/000000.png" style="float:middle"> <br> hello world! </div> </body> </html> although read use tables when table tried: code version 2 (not working): <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd&quo

How should multiple Fortran strings be passed to C? -

to pass fortran string c, hidden parameter passed variable's size. here's working fortran definition, , c (actually c++/cli) method: interface subroutine appendextension( + filename) + bind(c, name="appendextension") character *1, intent(inout):: filename end subroutine appendextension end interface and here's c++/cli gets called: extern "c" { void __declspec(dllexport) __cdecl appendextension( char * name, int buffersize) { string^ clistr = gcnew string(name); clistr = system::io::path::changeextension(clistr->trim(), gcnew string("out")); intptr p = marshal::stringtohglobalansi(clistr); char *pnewcharstr = static_cast<char*>(p.topointer()); int cstrlen = strlen(pnewcharstr); memcpy_s(name, buffersize, pnewcharstr, cstrlen); if (cstrlen < buffersize) { // backfill spaces, since fortran st

gradle - How do I add dependencies to grandchildren projects from root? -

i have multi level nested project goes 3 levels , add dependency 3rd level root project build.gradle file. how do that? for example, have following project structure. gp (grandparent) @ root, p1 , p2 direct subprojects under gp, , gc1 , gc2 subprojects under p1 , gc3 , gc4 subprojects under p2. gp |____ p1 ...........|____gc1 ...........|____gc2 |____ p2 ...........|____ gc3 .......... |____ gc4 from gp's build.gradle, want add dependencies gc1, gc2, gc3 , gc4. tried following in build.gradle of gp: configure(subprojects) { compile group: 'org.slf4j', name: 'jul-to-slf4j', version: '1.7.7' } it fails message when trying process gc1, gc2, gc3 or gc4, passes p1 , p2. no signature of method: org.gradle.api.internal.artifacts.dsl.dependencies.defaultdependencyhandler.compile() applicable argument types: (org.gradle.api.internal.file.collections.defaultconfigurablefilecollection) values: [file collection] possible solutions: mod

Javascript low poly generator with color change -

Image
ok, fell in love i've found on wata.pimmey.com , think color changing low poly background beautiful. i've checked source code of page , scripts attached it, couldn't find helpful. maybe it's because i'm noob , didn't see obvious in there. i'd thankful if me find exact code make similar background or find third-party tools re-create same thing. thanks in advance. pd: i'm sorry grammar errors have made in post, english not native language. i'll study bit more. edit: nevermind, found github.com/msurguy/triangles its done using multiple svg shapes , tracking mouse mouse moves around screen calculates how shade different triangles if closely can see changing color values based on mouse position for method of calculating color have use ur imagination or inspect further have try @ geteventlisteners(document.getelementbyidname('triangles') )

angular - How to target specific element with DynamicComponentLoader -

background i have data represent list of folders , categories of documents; our information management software through web interface. raw list each item has parentfolderno i've created object children: any[] property - have nested list of items; this: { id: 123, guid: "8dcaae38-4dcc-48f7-bd91-c8b0cb725890" children: [ { id: 234, guid: "...." }, { id: 345, guid: "...." children: [...] } ] } implementation there many more objects there, have it's own children, don't, each unique , has unique guid . object need create ui element lets user select specific folder or category , limit search. can think of selectable breadcrumbs. i've created component uses dynamiccomponentloader display specific 'tree' of data: @component({ host: { "[attr.id]": "category.guid" }, selector: 'category-group', template: ` <ul class="category__

visual studio 2012 - .DS-store problems when trying to publish with web deploy -

i'm trying use web-deploy when running web deploy error 4 copying file content\font\ui-fonts\font - logo, headlines.ds_store obj\release\package\packagetmp\content\font\ui-fonts\font - logo, headlines.ds_store failed. not find file 'content\font\ui-fonts\font - logo, headlines.ds_store'. 0 0 ui.webui my ms build works fine

angularjs - Pass data to ngDialog in Angular -

how can pass data ngdialog in angular? examples using scope this. don't use scope in controller. should do? here code inside controller: var vm = this; authservice.login(user.name,user.password).then(function() { $state.go('dashboard'); },function(error) { vm.user.password = ''; ngdialog.open({ template: '<h2>error</h2><p>{{error}}</p>', plain: true }); }) any idea? thanks. you using resolve same way routers. whatever properties define in resolve can injected controller ngdialog.open({ template: '<h2>error</h2><p>{{error}}</p>', plain: true, resolve:{ error: function(){ return error; } }, controller: function($scope,error){ $scope.error = error; } });

php - Failed to select data with where clause in array -

i have array $deptid : array(5) { [0]=> string(1) "2" [1]=> string(1) "8" [2]=> string(2) "11" [3]=> string(2) "15" [4]=> string(2) "17" } then, want select mysql database data deptid in array. query: $deptdid = implode(',', $deptid); $this->db->select(*) ->from('tabel_data') ->where('deptid in ('.$deptid.')') ->group_by('deptid', 'asc') ->get(''): but error occur. you have error in sql syntax; check manual corresponds mysql server version right syntax use near (array) group `deptid` @ line 6. maybe can give me solution since you're using codeigniter can try using where_in function instead of implode , where . where_in method you. $this->db->select(*) ->from('tabel_data') ->where_in('deptid', $deptid) ->group_by('deptid', 'asc') ->get(''):

Decoding a Python 2 `tempfile` with python-future -

i'm attempting write python 2/3 compatible routine fetch csv file, decode latin_1 unicode , feed csv.dictreader in robust, scalable manner. for python 2/3 support, i'm using python-future including imporing open builtins , , importing unicode_literals consistent behaviour i'm hoping handle exceptionally large files spilling disk, using tempfile.spooledtemporaryfile i'm using io.textiowrapper handle decoding latin_1 encoding before feeding dictreader this works fine under python 3. the problem textiowrapper expects wrap stream conforms bufferediobase . unfortunately under python 2, although have imported python 3-style open , vanilla python 2 tempfile.spooledtemporaryfile still of course returns python 2 cstringio.stringo , instead of python 3 io.bytesio required textiowrapper . i can think of these possible approaches: wrap python 2 cstringio.stringo python 3-style io.bytesio . i'm not sure how approach - need write such wrapper or 1 ex

How to update specified row in html table using php -

i have table employee in database. able add, fetch , display each row in table in html table dynamically using php. <a href='add-employee.php' style='float:right;'>add employee</a> <table class="table table-responsive"> <thead> <th><strong>employee id</strong></th> <th><strong>last name</strong></th> <th><strong>first name</strong></th> <th><strong>department</strong></th> <th><strong>position</strong></th> <th><strong>telephone</strong></th> </thead> <tbody> <?php $load_employees = mysql_query("select * tbl_employee"); $loaded_employees = mysql_num_rows($load_employees); while($y=mysql_fetch_array($load_employees)){

How to get the five highest values from a list in Excel -

Image
in sheet have column1 text , column2 random numbers. i column3 5 "highest texts" example: i know can text if make index/match looking number, i'm lost @ sorting part. place in cell c1 , drag down: =lookup(rept("z",255),if(large($b$1:$b$10-(row($b$1:$b$10)/9^9),rows($a$1:a1))=$b$1:$b$10-(row($b$1:$b$10)/9^9),$a$1:$a$10)) this needs entered ctrl + shift + enter .

Need help: getting a Bootstrap email contact form to work from HTML/PHP code -

i setting blog , have contact form page (standard bootstrap blog template) i have uploaded onto host - hostgator, can't manage contact form send email out properly. i have tried both external email account , account on same domain name no luck. here original html source contact page bootstrap: https://github.com/ironsummitmedia/startbootstrap-clean-blog/blob/gh-pages/contact.html and original source contact_me.php: https://github.com/ironsummitmedia/startbootstrap-clean-blog/blob/gh-pages/mail/contact_me.php is there setting need change hostgator cpanel or in code i'm missing? edit: here domain if want view source have in place: www.decentralizeblog.com i have made bit changes form have not used attributes in form link method , action , name attribute in text field <form name="sentmessage" id="contactform" action="mailer.php" method="post" novalidate> <div class="r

arrays - Twitter API sendSynchronousRequest -

i have error :"extrat argument error in call" when remove error attribute nothing fixed let verify = nsurl(string: "https://api.twitter.com/1.1/account/verify_credentials.json") var request = nsmutableurlrequest(url: verify!) pftwitterutils.twitter()!.signrequest(request) var response: nsurlresponse? var error: nserror? var data = nsurlconnection.sendsynchronousrequest(request, returningresponse: &response, error: &error) if pftwitterutils.islinkedwithuser(pfuser.currentuser()!) { let screenname = pftwitterutils.twitter()?.screenname! pfuser.currentuser()?.username=screenname! pfuser.currentuser()?.saveeventually() let url = nsurl(string: "https://api.twitter.com/1.1/users/show.json?screen_name=" + screenname!) let request = nsurlrequest(url: url!, cachepolicy: .reloadignoringlocalandremotecachedata, timeoutinterval: 5.0) let session = nsurlsession.sharedsession() session.datataskwi

How to grab values from key:value pairs in parsed JSON in Python -

i trying extract data json file. here code. import json json_file = open('test.json') data = json.load(json_file) json_file.close() at point can print file using print data , appears file has been read in properly. now grab value key:value pair in dictionary nested within list nested within dictionary (phew!). initial strategy create dictionary , plop dictionary nested within list in , extract key:value pairs need. dict = {} dict = json_file.get('dataobjects', none) dict[0] when try @ contents of dict, see there 1 element. entire dictionary appears have been read list. i've tried couple of different approaches, still wind dictionary read list. love grab nested dictionary , use .get grab values need. here sample of json working with. specifically, trying pull out identifier , description values dataobjects section. { "identi

Extended list comprehension options - Python -

i use example of code project euler exercise. [(a, b, c) in range(1, 334) b in range(1, 334) c in range(1,334) if c == 1000 - - b , < b , b < c , a**2 + b**2 == c**2] i know little list comprehensions wondering if there way imply a, b, c ints > 0 , want increment them two pseudo code examples might like: [(a, b, c) > 0 b > c > b if c == 1000 - - b] [(a, b, c) int(a) int(b) int(c) if c == 1000 - - b] is possible this? here simplification approach: [(a, b, 1000 - - b) in range(1, 332) b in range(a+1, 333) if a**2 + b**2 == (1000 - - b)**2] c fix, 1000 - - b no need make loop of values it. you can start range of b range(a+1,333) dont have test if b>a though wrong solution problem think

php - how to attach a page to a custom post type -

this has worked me in past, unsure why not working now. i have created custom post type: add_action('init', 'register_team'); function register_team(){ $args = array( 'label' => __('design team'), 'singular_label' => __('design team'), 'public' => true, 'show_ui' => true, 'capability_type' => 'post', 'hierarchical' => true, 'rewrite' => array("slug" => "design-team",'with_front' => true), // permalinks format 'supports' => array( 'title', 'editor', 'thumbnail' ), 'add_new' => __( 'add new member' ), 'add_new_item' => __( 'add new member' ), 'edit' => __( 'edit member' ), 'edit_item&#

Python script runs fine for a while then returns MemoryError (python 3.3) -

i have small script utilizes python imaging library module python3.3 (on win7, 8 gb of ram) take screenshot of small (~40x50) pixel area of screen once each second , compare image have detect particular pattern , execute 2 other modules created if found. script seems work flawlessly first 30 minutes or so, script crashes , following error: traceback (most recent call last): file "<string>", line 420, in run_nodebug file "c:\users\nate simon\dropbox\captchalibrary\detectnrun.py", line 68, in <module>: im2 = imagegrab.grab((left,upper,right,lower)) file "c:\python33\lib\site-packages\pil\imagegrab.py", line 47, in grab: size, data = grabber() memoryerror i've adjusted time between screenshots , delay when program crashes. here seems offending code: im2 = imagegrab.grab((left,upper,right,lower)) # take screenshot @ given coordinates x in range(im2.size[0]): # section changes image black/white better comparing m

objective c - if NSString does not equal function? -

i have searched on place this, including apple's docs on nsstring (maybe didn't see?) trying find method in xcode checking wether nsstring not equal something. like if (mynssting = @"text" {... except want check if not equal 'text'. if(![mynsstring isequaltostring:@"text"])

asp.net mvc - Is there a method of creating a bundle of bundles? -

i load minimum number of files per page without lot of redundant code in bundleconfig.cs file. var thirdpartyscriptbundle = new scriptbundle("~/bundle/core").include( "~/scripts/jquery-{version}.js", // jquery core "~/scripts/bootstrap.js", // bootstrap "~/scripts/knockout-{version}.js", // knockout "~/scripts/underscore.js", // underscore "~/scripts/moment.js" // moment ); bundles.add(thirdpartyscriptbundle); var page1specificscriptbundle = new scriptbundle("~/bundle/page1").include( "~/scripts/page1.js" ); bundles.add(page1specificscriptbundle); var page1mergedscriptbundle = new scriptbundle("~/bundle/page1merged") .include("~/bundle/core") .include

ajax - Rails 4 Login/Sign up using devise during form submission authenticity token error -

i have project model. there's one-to-many association project model , devise user model. want users perform ajax login using devise before submitting projects form data. the ajax login works fine. but, after login when try , submit projects form authenticity token error. understand due change of session token change. wonder if there's way maintain kind of user flow? i think fixed simple jquery code. needed replace existing authenticity token on parent form new 1 after sign in. had enabled devise session method respond js format , had file /devise/sessions/create.js.erb . on same file had append following jquery code replace existing authenticity token on form new 1 generated after logging in. $("input[name='authenticity_token'").val("<%= form_authenticity_token %>");

ios - React.createElement : type should not be null -

Image
i copied code here . this throws warning: . how fix warning? code: 'use strict'; var react = require('react-native'); // have import scrollview , refreshcontrol var{ stylesheet, image, scrollview, refreshcontrol, view, } = react; var carousel = require('react-native-looped-carousel'); var dimensions = require('dimensions'); var {width, height} = dimensions.get('window'); var newslistview = react.createclass({ getinitialstate: function () { return { isrefreshing: false, loaded: 0, }; }, componentdidmount: function () { }, render: function () { return ( // if remove refreshcontrol , warming missing. how fix problem <scrollview style={styles.scrollview} refreshcontrol={ <refreshcontrol refreshing={this.state.isrefreshing

c# - How to cast a list of concrete classes which implement an interface -

i have interface ianimal , 2 classes(dog, cat), both implement interface. public interface ianimal { int age { get; set; } } public class dog : ianimal { public int age { get; set; } } public class cat : ianimal { public int age { get; set; } } also, have animalsmanager class shown in code below. public class animalsmanager { private readonly list<dog> _dogs = new list<dog>(); private readonly list<cat> _cats = new list<cat>(); public void settargetanimalsage(bool isdog, int age) { if (isdog) { setanimalsage(_dogs, age); } else { setanimalsage(_cats, age); } } private static void setanimalsage<t>(ienumerable<t> animals, int age) t : class, ianimal { foreach (var animal in animals) { animal.age = age; } } } in method settargetanimalsage, setanimalsage used twice depending on value of is

hadoop - Diagram / graphical view of Hive metadata -

i want obtain graphical view (a diagram) of hive metadata (table definition , properties + mapping on hdfs). the obvious tool browsing these information hue . there alternatives 1 proposed toad , tool used relational databases. but these tools -- far know -- not provide graphical view. know tool, maybe based on hcatalog , permitting obtain view ? you can use data modeling tools such microsoft visio, erwin. tools toad, sql developer etc provide visualization layer data models. but ms visio, erwin better visualize data models.

java - android eclipse button OnClick event -

i have 2 files: main_activity.xml , home.xml. made button in main_activity.xml here code snippet: <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:background="@drawable/splash_background" android:layout_height="match_parent" android:paddingbottom="@dimen/activity_vertical_margin" android:paddingleft="@dimen/activity_horizontal_margin" android:paddingright="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" tools:context=".mainactivity" > <button android:id="@+id/home" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignparentright="true" android:layout_alignparenttop="true" android:layout_marginri

iphone - Delete row on sms.db iOS 6 -

i want delete row in many tables: chat , handle in sms.db on ios6. seems work not . example: if want delete row rowid = 123 in handle table, delete worked, in handle table, row appears row deleted rowid 124 (not 123). does know why?

android - Can someone please explain me with an example how interface can be used as a method parameter in Java? -

clicking button in android: final button savebutton = (button) findviewbyid(r.id.savebutton); savebutton.setonclicklistener(new onclicklistener(){ public void onclick(view v){} savebutton.settest("clicked") } onclicklister interface passed inside methodd setonclicklistener, unsure how working? what see there called anonymous class (you've chopped bit off end, though). it's not instance of interface (interfaces can't have instances), although looks bit one. code creates class implements interface given onclick method, , creates instance of class pass setonclicklistener , in 1 new expression. anonymous classes meant situations need one-off instance pass method accepts interface. rather making write separate class definition, several years (java 5, think was) added ability define class , create instance on-the-fly that. the code in onclick method has access final variables in method it's created. the link above java tutorial on an

html - mysterious margin for nav dots -

i have created simple dot navigation on site banner here . html code have used follows: <ul class="carousel-dots"> <li> <a href=""></a> </li> <li> <a href=""></a> </li> <li class="active"> <a href=""></a> </li> </ul> now <li> element have following code: .banner ul.carousel-dots li { height: 13px; width: 13px; display: inline-block; background: url(../img/res/carousel-dots.png) 0 0 no-repeat; margin: 0; cursor: pointer; } now though have margin: 0; in style, margin between left , right, don't know these spaces coming , want dots touching each other , side side. whats causing mysterious margin ? white space between inline-block elements? the space created "enter" between elements. how remove space between inline-block elements? in quest

How to get a piece of text from PHP file -

from wp-config.php file need db name, username, password values without including wp-config file , assign them 3 separate variable further use. define('db_name', 'somedb'); define('db_user', 'someuser'); define('db_password', 'somepass'); my script in same folder. no don't want use wordpress functions. if really don't want include file, mentioned in comments already, can read file contents array file() . the iterate on each line , apply cleanup, until format can work with: <?php $config = file('wp-config.php'); $dblines = []; foreach($config $line){ if (stristr($line,"define('db_")!==false){ $dblines[] = $line; } } array_walk($dblines, 'cleanup'); // apply cleanup() function members of array, each line function cleanup(&$value){ // replace leading 'define(' , trailing closing bracket $value = str_replace( array("define(&q

angularjs - Timeout - Async callback was not invoked within timeout specified by jasmine.DEFAULT_TIMEOUT_INTERVAL -

i know error appears in questions lot despite efforts didn't manage solve problem. i have service fetches categories parse. done when running test getting error shown in title. my code following: parseservice.js angular.module('starter').service('parseservice', ['$q', function ($q) { this.getallcategories = function() { var deferred = $q.defer(); var categories = []; var query = new parse.query("category"); query.find({ success: function(results) { console.log('succesfully queried parse.'); (var = 0; < results.length; i++) { var result = results[i]; categories.push(result.get("name")); } deferred.resolve(categories); console.log(categories); }, error: function(error) { console.log('error querying parse.'); console.log(error); deferred.reject(error); } }); retur

Alternative to External Storage Android -

in app, calling camera should capture picture , store on given path: intent intent = new intent(mediastore.action_image_capture); public static string pic_path =environment.getexternalstoragedirectory().tostring()+name; file file = new file(pic_path); uri outputfileuri = uri.fromfile(file); intent.putextra(mediastore.extra_output, outputfileuri); startactivityforresult(intent, request_camera); it works fine on devices have sd card or kind of external storage. not work on others (it crashes). so, alternative? how make code work devices without sd card/external storage?

blackberry 10 - Extract a version number from bar-descriptor.xml file programatically -

is there way extract version number , other information bar-descriptor.xml file similar how it's done in android world via getpackageinfo() in packagemanager ? for reason missed classes allow exactly: packageinfo applicaitoninfo

wpf - C# Entity Framework Entity State Modified -

i pretty new c#. trying make user profile database , display in wpf listview in c#, entity framework code-first. i have managed add , delete profiles database, , display them. got stuck on modifying existing object , after while of trying make work, closest thing got selected object (selected in listview) makes 1 above receive update. here code "save" button private void btnsavechanges_click(object sender, routedeventargs e) { using (userscontext ctx = new userscontext()) { user user = ctx.users.find(userstable.selectedindex); if (user != null) { user.name = txtuname.text; user.idnumber = txtidnumber.text; user.department = txtdepartment.text; user.position = txtposition.text; user.username = txtusername.text; user.password = pwbpassword.password; } ctx.entry(user).state = system.data.entity.ent

node.js - display error 404 - when required file fails -

new node.js not want use frameworks design multi page web site. idea grab url path name , add .js extension , require it. but happens when pathname not correspond valid .js file required ? node.js server crashes. the question how display 'error 404' ? var http = require('http'); var url = require('url'); var server=http.createserver(function(req,res){ res.writehead(200,{'content-type': 'text/html; charset=utf-8'}); var pathname=url.parse(req.url).pathname; pathname = pathname.replace('-', '') var page = require(pathname + '.js') res.end(pathname + '.js included successfully') }).listen(80); when run domain.tld/22 this script display " 22.js included " because have 22.js but when try domain.tld/23 the whole thing crashes. following error module.js:339 throw err; ^ error: cannot find module '/23.js' @ function.module

google chrome - Creating File/Folder with pure JavaScript -

i want know more filesystem in google chrome, mozilla or opera . have used fso.js didnt me create, delete or list local files. is there way of filesystem pure javascript? no, there not. there brief attempt create sandboxed file area via filesystem api , abandoned. right now, real file access have in browser-hosted javascript code via file api , more limited (though still useful). lets read files user explicitly gives permission read via input type="file" or drag-and-drop event.

ios - Issues with delivering chat messages to offline user -

i have issue delivering messages in chat when 1 of users goes "offline". when 1-on-1 chat initialized , 2 users chatting, messages being delivered , works great, when app of 1 of users goes background, other 1 keeps messaging. looks messages being sent, saved history , cache (i log it), when other users goes online , retrieves history — these messages not appear. in logs see them coming delay after app restarts: 2013-03-13 01:14:42.983 myapp[2314:1103] qbchat/xmppstreamdidreceivemessage: <message xmlns="jabber:client" id="0" type="chat" from="xxxxx-xxxx@chat.quickblox.com" to="xxxxxx-xxxx@chat.quickblox.com"> <body>i try again</body> <delay xmlns="urn:xmpp:delay" from="chat.quickblox.com" stamp="2013-03-13t07:58:14.455+0000"> entire messaging process built using code simplesample chat (also, not use push notifications yet). can you, please, advise me on issue

javascript - Global variable unavailable within function? -

Image
i'm working on reproducing live filter box handsontable based on built in search functionality @ http://docs.handsontable.com/0.15.0-beta6/demo-search-for-values.html . right i'm working simplest use case ( http://jsfiddle.net/kc11/ul3l4tel/ ) docs. as explained in docs, in code if enter search string, matching cells outputted console using following function: handsontable.dom.addevent(searchfiled, 'keyup', function (event) { var queryresult = hot.search.query(this.value); console.log(queryresult); hot.render(); i want grab rows in data array match search string , filter original data 'data' search string before redisplaying table. partially works using: handsontable.dom.addevent(searchfiled, 'keyup', function (event) { var queryresult = hot.search.query(this.value); console.log(queryresult); rows = getrowsfromobjects(queryresult); console.log('hot', hot.g

babeljs - Async function not getting hoisted in Babel 6 -

trying compile piece of code in babel 6 function a() { return async function b() { some.thing = c; async function c() {} } } the async function c supposed hoisted up, right? , on babel's online repl site : ... c = function c() { ... }; some.thing = c; ... but on system compiles differently (and incorrectly): ... some.thing = c; c = (function () { var ref = _asynctogenerator(regeneratorruntime.mark(function _callee() { ... here c defined variable , not getting hoisted, results in some.thing undefined complete code gist why difference on system? i'm using babel 6.3 presets: ['es2015', 'stage-0'] this known bug in babel 6. issue tracked in https://phabricator.babeljs.io/t6760

mysql - Php Post Insert Error Access denied for user 'root'@'localhost' (using password: YES) -

i'm posting data using php mysqlserver. (rest service) problem i'm getting error: connection failed: access denied user 'root'@'localhost' (using password: yes). i changed query insert select statement , works, retrieve data cant seem insert. have checked privileges , changed password. i'm sure question has been asked before solutions have tried don't work problem unique context. i'm not sure if code or what? please help. <?php $servername = "localhost"; $username = "root"; $password = "****"; $dbname = "tripbuddy"; $name = $_post['name']; $surname = $_post['surname']; $email = $_post['email']; $password = $_post['password']; // create connection $conn = new mysqli($servername, $username, $password, $dbname); // check connection if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "insert 'tr

When adding a YGuard Target to an ANT build in NetBeans, exactly where in the build.xml file should the YGuard Ant Target be placed? -

when adding yguard ant target xml build.xml in netbeans, in build.xml file should yguard ant target xml placed? or, should yguard ant target xml placed somewhere else? i've placed yguard ant target xml in build.xml file, out .jar, java_obf.jar, obfuscated .jar, not created when running build. any appreciated. here yguard ant target: <target name="yguard"> <taskdef name="yguard" classname="com.yworks.yguard.yguardtask" classpath="yguard.jar"/> <yguard> <inoutpair in="/users/user/netbeansprojects/project/dist/java.jar" out="/users/user/netbeansprojects/project/dist/java_obf.jar"/> </yguard> </target>

How can I restart the ruby script from inside the script? -

i looking way stop current running script , restart if continuation met. how can that? write this: at_exit{ # whatever way started program such `program_name`. # make sure new process detached original. } and do: exit somewhere want break.

How to set Multiple Langues support into android application -

hi doing 1 application here need enter edittext , data after button click need save in database,up here code working fine.but problm in activity listview have 10 languages if user select french,that time if enter data in edittext time need write data in edit text in french format , save data in data base french format..or else user select hindi means need write data in edit text in hindi format , save data in data base hindi format.but in app default languge english,please how have suggest me... language.class: public class language extends activity { relativelayout main,sub; public void setnotitle() { requestwindowfeature(window.feature_no_title); } float screenheight,screenwidth,screendensity; textview heading; button back; private listview lv; private edittext et; private string listview_array[] = { "arabic", "dutch", "english", "french", "german", "hindi", "italian", "japanese