Posts

Showing posts from February, 2011

java - setContentView is not working with GoogleApiClient on release apk -

i've implemented google play games api in game recently, issues appeared after that. the problem reason game not loading custom view class when start aplication , call method setcontentview() happens when build release version of apk. gv = new gameview(this); setcontentview(gv); //not loading on release version or if debuggable set true in build.gradle i tryied put line on build.gradle debuggable false the result release version started working line cant upload playstore , reason of thread obviusly because need working on playstore. some notes of test: the google play services connects both release , debug apks, in release black screen appears isntead of gameview class the setcontentview() doesn't works when running apk on release version or if debuggable set true in build.gradle. the setcontentview() works fine when running apk on debug version the setcontentview() works fine if load xml file in situations (but game doesnt uses xmls). main

admob - Android interstitial only displaying once -

i can display once, when request ad or try display same ad again not work..it displays once no matter do. tried i have oncreate protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar toolbar = (toolbar) findviewbyid(r.id.toolbar); setsupportactionbar(toolbar); minterstitialad = new interstitialad(this); minterstitialad.setadunitid(getstring(r.string.interstitial_ad_unit_id)); adrequest adrequestinterstial = new adrequest.builder() .addtestdevice("xxxxxxxxxxxxxxxxxxx") .build(); minterstitialad.loadad(adrequestinterstial); then have summoning code if(minterstitialad.isloaded()){ minterstitialad.show(); requestnewinterstitial(); } and requestnewinterstitial code: private void requestnewinterstitial() { adrequest adrequest = new adrequest.builder() .addtestdevice(

c# - Flip coordinates when drawing set of rectangles -

Image
i trying draw set of squares origin(0,0) of squares in top left corner , wanted squares render bottom right corner, , found code flip co ordinates, nothing rendering on winform. i know have gone wrong in height attribute of translatetransform. dont why height required trying draw set of 2d squares. i tried hardcoding height attribute still of no use. public void scaletransformfloat(painteventargs e,list<square> lstsquare) { int height = 10; // begin graphics container graphicscontainer containerstate = e.graphics.begincontainer(); // flip y-axis e.graphics.scaletransform(1.0f, -1.0f); // translate drawing area accordingly // e.graphics.translatetransform(0.0f, -(float)height); // whatever draw (using graphics context) appear // though (0,0) @ bottom left corner //user-defined function draw square drawsquare(e,lstsquare); // end graphics container

scala - Is it necessary to "clean" SBT before "stage" for production builds? -

we using jenkins , sbt pluging build, test , deploy our application. see everywhere people use "clean" command before "test" or "stage" leads long compile times. is necessary clean each build? risk of using incremental compiler production builds? if build script and/or command line sbt have not changed should not necessary clean . i have been using spark several years - , 1 of complex sbt builds can find. works fine avoid doing clean long build process (as embodied in project/sbt build artifacts , sbt command line) same previous runs.

regex - htaccess [L] flag didn't work -

i have .htaccess file inside searchengine folder inside htdocs of xampps rewriteengine on rewriterule ^\/?test$ view/index.php [nc,l] rewriterule ^(.*)$ http://google.com [nc,l] then type in address bar: localhost/searchengine/test why redirect http://google.com not view/index.php? i thought must redirected view/index.php not http://google.com it because mod_rewrite runs in loop. first rule doing this: starting url: /searchengine/test ending url: /searchengine/view/index.php now l flag causes mod_rewrite loop again. starting url becomes: starting url: /searchengine/view/index.php now 1st rule' pattern ^test doesn't match 2nd rule using .* matching pattern hence redirects google . you can have rules follows prevent behavior: rewriteengine on rewriterule ^/?test$ view/index.php [nc,l] rewritecond %{env:redirect_status} ^$ rewriterule ^ http://google.com [r,l] 2nd rule has additional condition

java ClassNotFoundException thrown during deserialization of Generics following refactoring -

i refactored (moved) bunch of classes , getting classnotfoundexception while trying deserialize session. classic. i created custome deserializer sessiondeserializer extends objectinputstream works fine classes except generic class result<t> . the generic class in hasn't moved, guessing issue lies t object class has been moved. now issue stacktrace doesn't specify t class: java.lang.classnotfoundexception: com.mysite.shared.beans.result @ org.apache.catalina.loader.webappclassloader.loadclass(webappclassloader.java:1714) ... do know way work around problem: either finding t class contained inside result<t> object , adjusting sessiondeserializer , or skipping deserialization of result<t> object alltogether? edit added result class below: public class result<t> implements serializable{ private static final long serialversionuid=1l; protected t t=null; protected boolean success=false; protected map<string,string> errors=new h

How can I use a websocket with c++ -

i'm new c++ , i'm wondering how can use web sockets it, i've used web sockets in nodejs , javascript , want go on use them c++. sockets not part of c++ standard library yet. boost has boost.asio, cross platform library talking tcp/ip , udp among other things. there's great open source library called beast handles not websocket http well, , built on top of boost.asio. here's library home page: http://vinniefalco.github.io/ here's complete, compiling example program talks websocket: #include <beast/to_string.hpp> #include <beast/websocket.hpp> #include <boost/asio.hpp> #include <iostream> #include <string> int main() { // normal boost::asio setup std::string const host = "echo.websocket.org"; boost::asio::io_service ios; boost::asio::ip::tcp::resolver r(ios); boost::asio::ip::tcp::socket sock(ios); boost::asio::connect(sock, r.resolve(boost::asio::ip::tcp::resolver::query{hos

android - Filter activities with permission requirements -

i'm trying let user choose application app should send specific intent to. list of candidates, queryintentactivities() works, except applications define accepting activity permission requirement, can't start them. so, can filter them out in of these ways? have packagemanager filter them out me. from resolveinfo , check if activity (or parent application) requires permission, check checkselfpermission() . start activity picker (which filters them since android 4.1) , somehow activity picked. api level 22 has version of createchooser() lets use system activity chooser , receive chosen activity in broadcast. in older versions following method works: list<resolveinfo> candidates = pm.queryintentactivities(intent, 0); (int = candidates.size() - 1; >= 0; --i) { resolveinfo resolveinfo = candidates.get(i); string permission = resolveinfo.activityinfo.permission; if (permission == null) permission = resolveinfo.activityinfo.applic

ssl - Setup Lets Encrypt on VPS where the DNS is setup on CloudFlare -

Image
i have hosted website using vps , pointed using dns services of cloudflare, site working properly. trying install ssl provided lets encrypt , able complete steps site doesn't appear ssl enabled. when completed steps succesfully process didn't generate cert file.i have used https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04 tell me might going wrong. cloudflare supports using let's encrypt between cloudflare , origin; must use --webroot argument when run let's encrypt binary. by using webroot authentication method , temporary file placed validate domain certificate. there guide on how on cloudflare centre: how validate let’s encrypt certificate on site active on cloudflare by using method, able ensure connection between cloudflare , origin web server encrypted using strict ssl .

java - Passing 'data source' between activities -

i have generic 'chooser' activity - 1 can provided abstract data source, extract data said source, present data in listview , return selected item calling activity. akin ringtonepickeractivity . what can't figure out how pass generic data source 1 activity another. have seen far in term of sharing data between activities passing data through intent 's extras. doesn't seem work me here, since not want provide actual data - want pass reference abstract data source, can queried (not unlike cursor ). the point i'd emphasize i'd chooser agnostic of actual source of data - abstract data source provide methods getnextitem , getitemname , getitemvalue . best models of can think of cursors or iterators - purely abstract mechanisms of iterating on set of data. since activities of application hosted in same process, should possible? 1 thing do not want have global data source variable inside application, multitude of reasons (one of them being fact running

r - Plot multiple sparkles by overlapping each other -

Image
i use following code make plot first set of values (here number of crimes). this have now: here code use plot it: library(lattice) library(latticeextra) library(grid) library(reshape) library(rcurl) dd <- read.csv(text = geturl("https://gist.githubusercontent.com/geekonacid/da022affd36310c96cd4/raw/9c2ac2b033979fcf14a8d9b2e3e390a4bcc6f0e3/us_nr_of_crimes_1960_2014.csv")) d <- melt(dd, id="year") names(d)[1] <- "time" pdf("sparklines_lattice_multiple_ten.pdf", height=10, width=8) xyplot(value~time | variable, d, xlab="", ylab="", strip=f, lwd=0.7, col=1, type="l", layout=c(1,length(unique(d$variable))), between = list(y = 1), scales=list(y=list(at=null, relation="free"), x=list(fontfamily="serif")), par.settings = list(axis.line = list(col = "transparent"), layout.widths=list(right.padding=20, left.padding=-5)), p

c# - Database to declared variable -

i want pass studname contents declared variable. tried " +a.tostring+" still got errors string a; connection.close(); connection.open(); string strsql = "select *from students studname = '" +a.tostring() + "' , studnum = '" + studentnumber; oledbcommand command = new oledbcommand(strsql); studnum = '" + studentnumber the database column studentnumber numeric you're half treating alphanumeric. solution studnum = " + studentnumber you need use parameterised commands protect against sql injection attack . solve issues such variables containing apostrophes , etc cause sql fail.

scala - ScalaC exception on attempt to use upper bound and context bound at the same time -

i scalac exception on attempt use upper bound , context bound @ same time. allowed ? i'm on scala 2.11.8 consider this import spray.json._ abstract class crossrefmessage case class crossrefresponse[t <: crossrefmessage](status: string, `message-type`: string, `message-version`: string, message: t) implicit def crossrefresponseformat[t <: crossrefmessage](implicit reader: jsonformat[t]) = jsonformat4(crossrefresponse.apply[t]) on compilation get error:scalac: error: type mismatch; found : string required: co.zzzz.server.journalsmanager.crossrefmessage scala.reflect.internal.types$typeerror: type mismatch; found : string required: co.zzzz.server.journalsmanager.crossrefmessage @ scala.tools.nsc.typechecker.contexts$throwingreporter.handleerror(contexts.scala:1402) @ scala.tools.nsc.typechecker.contexts$contextreporter.issue(contexts.scala:1254) @ scala.tools.nsc.typechecker.contexts$context.issue(contexts.scala:573) @ scala.tools.nsc.typec

node.js - What happens if i reject / resolve multiple times in Kriskowal's q? -

i'm studying promises pattern , using kriskowal's q node.js, having snippet: var deferred = q.defer(); try { messagedata = json.parse(message); } catch (e) { global.logger.warn('error parsing json message.'); deferred.reject(e); } ... if (some_reason) deferred.resolve(something); ... return deferred.promise; what if both parser fails , some_reason true? will execution procede rejecting through resolving , both promise's method called @ different times, generating bug? should avoid call reject/resolve multiple times? since promises can resolve once (to either fulfilled or rejected), first resolution wins , further calls ignored. the docs : in cases promise resolved (i.e. either fulfilled or rejected), resolution permanent , cannot reset. attempting call resolve, reject, or notify if promise resolved no-op. should avoid call reject/resolve multiple times? you can design application letting 2 methods "race&

I have a jQuery function that alters titles in Wordpress and I tried to add a link to the title and it's not behaving right -

here's function: $('.entry-title').each(function() { var dotdotdot = $(this).html().indexof('…'); $(this).html('<a href="<?php the_permalink(); ?>"><span class="category">' + $(this).html().substring(0, dotdotdot) + '</span>' + $(this).html().substring(dotdotdot) + '</a>'); }); the original intent add span tag text of title , worked beautifully (thanks @making3). code <a href="<?php the_permalink(); ?> + '</a>' is later added original function. what trying wrap link around title link single post page. screwy part these titles looping through each post on page backwards , creating multiple empty links every post. last link has title in it, it's not correct link title. did totally wrong. here's markup: <article <?php post_class(); ?>> <script> $('.entry-title').each(function() { var dotdotdot = $(this).html

maven - hadoop mapreduce java program exception: java.lang.NoSuchMethodError -

this question has answer here: how fix nosuchmethoderror? 18 answers hadoop 2.6.0 browsing filesystem java 1 answer this first experience hadoop, , need solve problem stuck in (as shown in title). i found project looking for: https://github.com/tzulitai/distributed-svm before starting run mapreduce job, executed 3 commands on terminal, build info said: $ git clone https://github.com/tzulitai/distributed-svm.git $ cd distributed-svm $ mvn clean install a jar file cascade-svm-mr-0.0.1-snapshot.jar generated, , used on the command below run mapreduce job: $ '/usr/local/hadoop/bin/hadoop' jar \ >'/home/hduser/distributed-svm/cascade-svm-mr/target/cascade-svm-mr-0.0.1-snapshot.jar'\ > ncku.hpds.tzulitai.mapreduce.svm.cascade.cascadesvm input output

git - github contributions for branch different than master -

why, if make commit in, let's say, develop branch, doesn't appear in contribution? i expected if merge branch master commits made develop or other branches visible. doesn't seem case. is there anyway so? or commit has made directly master ?

Web API Owin self host multiple applications -

we trying setup owin self host service multiple applications (app1, app2). we'd use same behavior of iis 1 application pool uses 1 appdomain per application. here code use: using (webapp.start<webserverstartup>(url: "http://localhost:9000/")) { ... } ... , webserverstartup implementation: internal class webserverstartup { public void configuration(iappbuilder appbuilder) { // configure web api self-host. var config = new httpconfiguration(); config.routes.maphttproute( name: "defaultapi", routetemplate: "api/{controller}/{id}", defaults: new { id = routeparameter.optional } ); appbuilder.usewebapi(config); } how can use multiple appdomains each application? there way declare multiple webapps using webapp.start(...) in separate appdomains share same port? or there way route requests various appdomains somehow defining route app/api/{controller

ios - Adding NULL Values to SQLite Database with FMDB and NSDictionary -

i have run bit of catch 22. using fmdb's fancy withparameterdictionary method insert data sqlite database this: nsdictionary *aircraftdict = [nsdictionary dictionarywithobjectsandkeys: self.aircraftidtextfield.text, @"aircraft_id", self.makemodeltextfield.text, @"make_model", self.categoryclasstextfield.text, @"category_class", @yes, @"updated_flag", nil]; nsstring *addaircraftquery = @"insert aircrafts (aircraft_id, make_model, category_class, updated_flag) values (:aircraft_id, :make_model, :category_class, :updated_flag)"; [db executeupdate:addaircraftquery withparameterdictionary:aircraftdict]; the problem when 1 of text fields blank, truncates nsdictionary since nil value tells dictionary has arrived @

javascript - Export Data from dc.js dataTable into CSV -

i have data table done dc.js , crossfilter.js, , want export table csv file.. datatable.width(960).height(800) .dimension(by_id) .group(function(d) { return "" }) .size(data.length) .columns([ function(d) { return d.id; }, function(d) { return d.name; }, function(d) { return d.gender; }, function(d) { return parsefloat(d.gpa).tofixed(2); }, function(d) { return parsefloat(d.major_gpa).tofixed(2); }, function(d) { return parsefloat(d.math_gpa).tofixed(2); }, function(d) { return parsefloat(d.english_gpa).tofixed(2); }, function(d) { return parsefloat(d.science_gpa).tofixed(2); }, function(d) { return parsefloat(d.humanities_gpa).tofixed(2); } ]) .sortby(function(d){ return d.id; }) .order(d3.ascending); this common request, i've added example using filesaver.js . (there other ways to download browser, 1 i'm familiar with.) http://dc-js.github.io/dc.js/examples/download-table.html the key fetch data table

javascript - My js code does not work as expected unless i use an alert message -

i have input field : <input class="quantityinput" data-index="@table.rows.indexof(row)" type="number" value="@row[col.columnname]" min="1"/> here js code : $(document).ready(function () { $(function () { $(document).on('change', '.quantityinput', function () { var data = { id: $(this).data('index'), value: $(this).val() }; $.getjson("/order/basketsession/", data, function (result) { }); location.reload(true); alert("hi!"); }); }); in controller: public jsonresult basketsession(int id, int value) { (httpcontext.session["basket"] datatable).rows[id][2] = value; return json(true); } if don't use alert , json func not wok when change value of input field using keybord mouse click increase or decrease 1

iphone - big delay in loading a simple local html (no images) on UIWebView if running at xcode debugger -

Image
right experiencing weird issue. have screen contains uiwebview load local html content. found out if there big delay (about 20 seconds 50 seconds) load screen after methods viewdidload , viewdidappear of screen called. happens if load app iphone via xcode debugger , run @ xcode debugger. won't happen if run app directly @ iphone. if change uiwebview text view, won't see big delay. does see similar issue before? this puzzles me quite bit , appreciated if shed lights on this. [edit] add logging delegate method of uiwebview, call backs called after big delays. 2013/08/13 17:05:53|i|907|policyviewcontroller|37| entering viewdidload 2013/08/13 17:05:53|i|907|policyviewcontroller|58| exiting viewdidload 2013-08-13 17:06:49.590 [1885:907] reachability flag status: -r -----l- networkstatusforflags 2013/08/13 17:06:49|i|907|policyview|107| entering webview shouldstartloadwithrequest 2013/08/13 17:06:49|i|907|policyview|112| entering webviewdidsta

sql - Select statement that divides arbitrary data into buckets that sum up to a specific value -

is there way in oracle database of dividing amount of money several buckets equal parts , making sure sum of money equal initial 1 single select statement? maybe fancy combination of aggregate functions? for example: have amount of 100 dollars , 3 time buckets. need query result in like (33.33, 33.33, 33.34) so last value equilibrates there. example data: period start data 01/01/2015 period end date 01/01/2016 total volume 121 tons i need sql command output equally distributed total volume among months @ end: jan - 10 feb - 10 ... nov - 10 dec - 11 if have table of time buckets, use window functions: select 100.0 / count(*) on () bucket_amount buckets b; note gives equal amount three, there no 33.34. can tweaked purpose, need provide sample data , desired results.

php - How to trigger javascript on mysql update event -

this question has answer here: in situations ajax long/short polling preferred on html5 websockets? 3 answers i working on chat should display messages in real time. messages stored in mysql-database. every dataset has: an auto-increment, unique id name text timestamp the chat works fine, @ moment trigger javascript function setinterval. question: there way trigger function when there new set of data in database? i @ using web sockets. see ratchet example of implementing. believe sample chat application.

c++ - QML items are not rendered -

interesting problem qml. when create default qt quick application , run it, black screen. window , other items not rendered @ all. when minimize , return previous state again, items rendered. know kind of problem? before minimizing after minimizing import qtquick 2.5 import qtquick.window 2.2 window { visible: true width: 500 height: 500 rectangle { id: test width: 300 height: 200 color: "red" border.color: "black" border.width: 4 } rectangle { width: test.width / 2 height: test.height / 2 color: "red" border.color: "black" border.width: 4 anchors.centerin: parent rectangle { width: parent.width / 2 height: parent.height / 2 radius: width * 0.5 //x: 200 //y: 200 color: "green" border.color: "darkgreen"

arm - Alignment requirements for uint8x16_t being loaded from byte array? -

we have assert firing under debug builds checks alignment. assert byte array that's loaded uint8x16_t using vld1q_u8 . while assert fires, have not observed sig_bus . here's use in code: const byte* input = ...; ... assert(isalignedon(input, getalignmentof(uint8x16_t)); uint64x2_t message = vreinterpretq_u64_u8(vld1q_u8(input)); i tried following, , assert fires alignment of uint8_t* : assert(isalignedon(input, getalignmentof(uint8_t*)); uint64x2_t message = vreinterpretq_u64_u8(vld1q_u8(input)); what alignment requirements byte array when loading uint8x16_t vld1q_u8 ? in above code, input function paramter. isalignedon checks alignment of 2 arguments, ensuring first aligned @ least second. getalignmentof abstraction retrieves alignment type or variable. uint8x16_t , uint64x2_t 128-bit arm neon vector datatypes expected placed in q register . vld1q_u8 neon pseudo instruction expected compiled vld1.8 instruction. vreinterpretq_u64_u8 neon pseudo in

javascript - Uncaught SyntaxError: Unexpected token this Javasctript Error -

trying create actor class html5 game, uncaught syntaxerror. not sure @ means or how fix it. other questions jquery , couldn't find solutions fit problem. function actor(x, y){ //... this.direction = 270; //... } actor.prototype.update = function(){ if(this.speed >= this.maxspeed) this.speed = this.maxspeed; if(key.isdown(key.getcode("a")) this.direction -= 1; // < -- error occurs here if(key.isdown(key.getcode("d")) this.direction +=1; if(key.isdown(key.getcode(" ") this.move(); } if(key.isdown(key.getcode("a")) this.direction -= 1; you have 3 opening parens, , 2 closing ones. if(key.isdown(key.getcode("a"))) this.direction -= 1; // ^ added you have multiple lines same problem. correct them all.

compare - Nim vs Rock - how they are different? -

i knew nim , learned rock . seem similar, both transcompile c. what main differences between them? 1 recommend? there's not documentation on ooc of rock compiler. here key differences i've found. disclaimer: i'm bit biased towards nim ;). metaprogramming. while nim offers powerful tools please extreme metaprogrammers, ooc has nothing it. domain specific language (dsl) friendliness. nim better extendable custom dsls thanx syntax, metaprogramming capabilities , operator overload support. nim compiles (and provides decent ffi) c/c++/objective-c , javascript, while rock compiles c only. nim actively developed , supported. of writing last commit rock made half year ago. syntax. that's obvious one. nim somewhere in python+pascal camp. ooc more of coffeescript curly braces. there may more key differences depending on important you, overall opinion nim more sophisticated , feature-rich language, you're less hit limitations when writing bigger coup

c# - ShowDialog and UI interaction in BackGroundWorker Thread -

after 2 hours of researching, still couldn't find solution problem. the task process files in backgroundworker thread. however, need use showdialog let user choose savefile location i'm getting sta/mta error. mainform code: private void button2_click(object sender, eventargs e) { button1.enabled = false; processreportworker.runworkerasync(); } dowork code: void processreportworker_dowork(object sender, doworkeventargs e) { int reportcount = reports.count(); foreach (string report in reports) { processreport newreport = new processreport(report); string result = newreport.start(); } } processreport.start() code: class processreport { public string start() { if(file.exists(resultpath)) { savefiledialog savereport = new savefiledialog(); savereport.initialdirectory = "c:\somepath"; savereport.checkpathexists = true;

css - Expression Engine navigation and conditionals -

thanks in advance problem. it's expression engine site. i'm having trouble simple conditionals navigation, active state. have placed active color sate within styles; however, there appears problem "if statements" because when inspect element, render in code (the navigation embedded). <nav class="group" role="navigation"> <ul id="nav" class="group"> <li class="first"><a {if segment_1 == ""} class="active" {/if} href="{site_url}"><strong>now</strong></a></li> <li><a {if segment_1 == "articles"} class="active" {/if} href="/articles/"><strong>articles</strong></a></li> <li><a {if segment_2 == "readings"} class="active" {/if} href="/book-readings/readings"><strong>books</strong></a></li

Having trouble with jquery if/else statement and 'slide' effect hiding last element -

this first jquery script i've pieced myself. i'm having issue trying if/else statement working. want script not run if box/link click on visible. here script working without if statement: http://jsfiddle.net/vitruvius/yqman/ $('.link').click(function () { var parentname = $(this).closest('ul').attr('id'); var boxnumber = $(this).attr('id'); $('.' + parentname).children('.active').toggle('slide',{direction:'right'},function(){ $('.' + parentname + ' ' + 'div').removeclass('active'); $('.' + parentname).children('.' + boxnumber).show().effect('slide').addclass('active'); }); }); here attempt @ if statement: http://jsfiddle.net/vitruvius/h8cmu/ $('.link').click(function () { var parentname = $(this).closest('ul').attr('id'); var boxnumber = $(this).attr('id'); if($('.' + parentname).children(&#

parallel processing - MATLAB: Copying Global variable for all Workers -

i want pass "a" global variable function "tsfn", say function [ out ] = tsfn( ) global a; out=a+1; end when run following expected result: >> global a; a=1 out=[]; i=1:4 out =[out tsfn()]; end out = 1 out = 2 2 2 2 however if run parfor instead of end blank vector. leads me believe "a" not being passed function. i'm wondering if there way pass variable global variable workers. thanks works fine on platform. try restarting computer or matlab. generally, "parfor" loop accomplishes same task "for" loop--each loop computed in parallel. declaring "global" in 1 or more functions and/or base workspace allows each of them access contents of global variable, usage correct. here code: function[ out ] = tsfn() global a; out = + 1; end edu>> global a; edu>> = 1; edu>> out = []; edu>> parfor = 1 : 4 out = [ out tsfn() ];

Why is Oracle 10g R2 V$DATABASE.NAME maximum 8 characters long? -

i have database name contains more 8 characters, when run command select name v$database; returns first 8 characters of named database. i noticed eight-character version somewhere during installation summary , thought down fixed table width cutting off rest of name, getting same using sql*plus. database names in oracle limited 8 characters. if entered more somewhere else, has been truncated without notice. as why, presumably there technical reason "back in day", , while presumably not issue anymore, limitation has been preserved sake of compatibility.

matlab - change audio file sampling rate -

i want ask how can change sampling rate audio file in matlab r2016a?? default 44100 want change 22050 shown in code trying convert sampling rate, doesn't work... clear; fs1 = 44100; fs2 = 22050; src = dsp.samplerateconverter('inputsamplerate',fs1,'outputsamplerate',fs2); [sa,src] = audioread('w_sound_1.wav'); % sa : of sampling , fs :sampling rate sa_w = sa; audiowrite('w_sound_1_resampling.wav',sa_w,src) the reason it's not working don't use samplerateconverter object src anywhere. in fact, using src second output argument of audioread() , overwrite number containing current sample rate. if want use samplerateconverter , check out examples here . but, it's simpler use resample()

matlab - Numerical data from simulink to arduino uno -

i want send numerical data simulink arduino uno. because don't know how make work in simulink i'm trying matlab. this code sends numerical data char . 1 character @ time arduino. after that, have concatenate characters construct numerical value , give arduino treat. send matlab same way. i know if there possibility send numerical data numeric arduino, , send matlab/simulink numerical data. this code i'm using in matlab : close all; clear ; clc; delete (instrfind({'port'},{'com5'})) s = serial('com5'); set(s,'databits',8); set(s,'stopbits',1); set(s,'baudrate',4800); set(s,'parity','none'); fopen(s) while (1) if (s.bytesavailable) readdata=fscanf(s) else fprintf(s,'arduino'); end end fclose(s) and code i'm using in arduino : int sensorpin = a0; int sensorvalue = 0; char incomingdata; void setup() { serial.begin(4800); } void loop() { if

objective c - ASCII Code to NSData -

i'm trying figure out esc/pos commands , need code "gs" (ascii code 29) put nsdata. currently can put strings want print without problems using code: nsstring *str = @"text want print"; nsdata *data = [str datausingencoding:nsasciistringencoding]; is there easy way using either c++ or obj-c? c, c++, , objective-c let put arbitrary ascii codes string using so-called escape sequences . escape sequence start either in \x followed 2 hex digits, or \0 followed 3 octal digits. ascii gs 29 in decimal or 1d in hex, can put gs in nsdata this: nsdata *data = [@"\x1d" datausingencoding:nsasciistringencoding];

ios - How to dismiss a view controller after getting response from two separate web services -

in current project came across situation need call 2 separate web services , dismiss present view controller once response both services. in advance. @karthik reddy: use "if" conditional statement confirm when response , 'if' use following code dismiss view controller... dismissviewcontrolleranimated(true, completion: nil)

Can't exit Git commit in Windows -

Image
from powershell i've called git commit , presents me with i typed commit message (in yellow) have no idea next. pressing enter adds newline input. how complete commit? i've been through several tutorials none of them explained next step. edit : found can press : make cursor jump bottom line, type wq complete commit. this? correct? there alternatives? after typing message, press escape exit insert mode , type :wq ( w rite/save , q uit, or :q! if want cancel , return prompt). alternatively, can commit in 1 step typing git commit -m "message"

Swift flatMap on array with elements are optional has different behavior -

let arr: [int?] = [1,2,3,4,nil] let arr1 = arr.flatmap { next in next } // arr1: [1,2,3,4] let arr2: [int?] = arr.flatmap { next -> int? in next } // arr2: [optional(1), optional(2), optional(3), optional(4)] i'm confused these code, why make difference? update: please see these codes, let arr: [int?] = [1,2,3,4,nil] let arr1: [int?] = arr.flatmap { next in next } // arr1: [optional(1), optional(2), optional(3), optional(4), nil] let arr2: [int?] = arr.flatmap { next -> int? in next } // arr2: [optional(1), optional(2), optional(3), optional(4)] as @adam says , it's due explicit type you're supplying result. in second example, leading confusion caused double wrapped optionals. better understand problem, let's take @ flatmap function signature. @warn_unused_result public func flatmap<t>(@noescape transform: (self.generator.element) throws -> t?) rethrows -> [t] when explicitly specify result of type [int?] , beca

c++ - cmfcpropertygridctrl in dialog can't be edited -

i create dialog derived cdialogex, add cmfcpropertygridctrl on it, generate control value of m_wndproplist binding cmfcpropertygridctrl, in oninitdialog, add initial code: bool cpropdlg::oninitdialog() { cdialogex::oninitdialog(); initproplist(); // here add initial function return true; } the codes in initproplist() copy example code, generated vs2015 when creating mfc project visual studio style. when have done work, property ctrl display well, can't edited, , doesn't respons mouse. please kindly me, thanks!

php - converting object to array then adding element to end of array then shuffle -

i figured time ask because have been working on over hour. i need take object , convert array - done need add new element end of array [9] => value - issue :( need shuffle array - done everything try comes out here $wlist original class object captcha_class_wordlist object ( [jsobjectlist] => array ( [0] => providers [1] => chemical [2] => family [3] => supported [4] => urban [5] => produced [6] => continued [7] => stream [8] => administrative ) ) which after conversion this array ( [0] => array ( [0] => claim [1] => continued [2] => limit [3] => platform [4] => websites [5] => efforts [6] => dollars [7] => saint [8] => family ) [1] => water ) it has [9] => value i have tried $arrayname[9] = $value , $arrayname[0][9] without success..

Python Imaging Library makes an image reddish -

Image
i have opened grayscale image using python imaging library, copied every pixel value image variable of same size , saved it. when open new image image viewer looks reddish. have used image.new() method , without "white" , "black" arguments got same reddish output. my code: from pil import image import math def run(): im = image.open("hrabowski.jpg") pix = im.load() print im.size # print pix[0, 1] im2 = image.new("rgb", (2400, 2400)) in range(im.size[0]): j in range(im.size[0]): im2.putpixel((i, j), pix[i, j]) im2.save("hrabowski-2400-2400.jpg") original image (scaled down 500 x 500): python output of code (scaled down 500 x 500): could please tell me doing wrong? your problem want create rgb image has 3 channels. therefore 1 pixel value consists of 3 values , not 1 (in case use gray value of original image each of channels). i have modified code accordingly

node.js - Cannot fetch from or insert data to mongodb using mongoose -

i wrote node web app , created mongodb database on local system. using following code connect local mongodb node js var mongoose = require('mongoose'); mongoose.connect('mongodb://localhost/db_name'); //local and working fine on local machine. went on , created mlab account , created database. when tried run code changing connection string, connections still established believe. find , save requests not invoking callbacks, no errors shows up. requests getting timed out. var mongoose = require('mongoose'); mongoose.connect("mongodb://user:pass@ds036789.mlab.com:36789/db_name"); //mlab another thing noticed cannot ping ds036789.mlab.com. tcp connections succeeding when tried nc command nc -w 3 -v ds036789.mlab.com 36789 i tried deploying azure. doesn't work either. appreciated. thanks. edit: not being able ping due fact used azure hosting. expected. , found out error while trying connect : connection error: { [mongoerror: auth fai

unicode - Messed up with Java Declaration -

why java constant have strange behaviour (unicode character , normal representation).. mean see below example. note : code in java language. char = '\u0061'; //this correct char 'a' = 'a'; //this gives compile time error char \u0061 = 'a'; //this correct no error ch\u0061r = 'a'; //this works ch'a'r = 'a'; // confusing compile time error why last declaration not works whereas ch\u0061r a='a'; works? you cannot put literals ( 'a' ) in middle of identifiers. the line char 'a' = 'a'; does not compile because there no identifier, , cannot assign 1 literal another. unicode permitted, however. hard read :-)

php - How do I get a calendar like in the pic attached in my webpage? -

Image
i using php on client-side. usually datepickers done javascript, cannot make dynamic stuff select next/prev month using php without page reloading on each action. here list of javascript datepickers: http://www.bitrepository.com/a-collection-of-free-javascript-date-pickers.html

database design - Normalization to 3NF from un-normalized relation -

given insurance portfolio (portfolio id, insurance company name, insurance company phone, ((agent name, agent license number, state of residence, ((policy number, policy description, annual premium, benefit, beneficiary details)), number of policies)), number of policies in portfolio) i'm trying 3nf. on right track? 1nf: 1nf: insurance portfolio:(portfolio id, insurance company name, insurance company phone, ,agentname, number of policies in portfolio) agentdetails: (agent name, agent license number, state of residence, policy number,number of policies in portfolio#) policydetails:(agent name#,policy number#, policy description, annual premium, benefit, beneficiary details) 2nf 2nf: insurance portfolio:( agent name ,portfolio id, insurance company name, number of policies in portfolio) agentdetails: (agent name, agent license number, state of residence, policynumber,number of policies in portfolio#) policydetails:(agentname,policy number, policy description, an

I'm trying to write a c# program code to find the min distance between the closest numbers in an array and my c# program won't work? -

i'm having problems c# code calculating min distance between 2 closest numbers in array - can please help!! program trying pick random numbers , generate array , array j. finally, trying determine min distance between 2 closest numbers in array. don't know why won't provide output. namespace exercise { public class program { static int main(string[] args) { int n = 0; int[] firstarray = new int[n]; random r = new random(); int minimum = int.maxvalue; (int = 0; < n; i++) { (int j = 0; j < n - 1; j++) { if (minimum > math.abs(firstarray[i] - firstarray[j])) { minimum = math.abs(firstarray[i] - firstarray[j]); } } console.writeline("minimum = {0}", minimum); console.read(); return 0; } } class elemen

How to take a photo in your own view for an android app? -

Image
so below activity attempting build. below, see imageview of house , lake. when user enters activity, camera opened inside view (in case, view house , lake) , user press camera icon take picture. how go doing that? can't find example online. hope guys can provide example or point me documented source. cheers! short: no , don't have skills that. longer: every device maker makes camera app comes device, handles inner workings / hardware stuff. unless want deal (huge number) of device types, use intent & camera app there. no need grey hairs on this. can done, whatsapp it, there lot of brain power done on side. what can using intent , receive camera app. like so. to idea how hard is: capture photo without intent