Posts

Showing posts from August, 2013

android - Removing ActionBar (Tittle) splash screen with icon -

just started developing action bar. having problem. have customized action bar wanted ( sort of, still cant position buttons on left :)). have removed icons, button, tittle action bar. problem is, when i'm launching application tittle bar (with icon , tittle) flashes second, before customized action bar appear... how can stop splash? i have saw answers include removing tittlebar android theme, because tittlebar , actionbar same thing, removing tittlebar causes actionbar dissapear. if want remove actionbar in 1 activity in particular, best way deal use theme. in androidmanifest, declare application theme of app, , can declare activity 1 theme in particular : <application android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:theme="@style/apptheme"> <activity android:name="splashactivity" android:theme="@style/appthemenotitle" android:label=&

php - Get XML code count using XMLReader -

i trying parse product feed provided google merchant. thing want more interactive using function convert xml array , show percentage user how products updated. have read xmlreader more efficient other parsing techniques. how can make xmlreader more effective. can number of nodes using xmlreader. or how can iterate on xml can more responsive. converting xml array wrong idea. mean build data structure in memory. have data structure, converting array mean loose data , features. read xml directly , use it. here several ways archive want. if feed small can use dom directly. allows use xpaths count() function. the google product-feed bases on rss 2.0 or atom 1.0. atom better format let's use that. // create dom document , load xml $dom = new domdocument(); $dom->loadxml($xml); // create xpath object , register prefixes 2 namespaces $xpath = new domxpath($dom); $xpath->registernamespace('atom', 'http://www.w3.org/2005/atom'); $xpath->reg

jquery - Bootstrap popover to appear on hover and remain for a second -

i popover appear on hover, remain if user interacting (it contains links) if not, should disappear after 500ms. javascript $(document).ready(function(){ $('[data-toggle="tooltip"]').popover({ title: 'look! bird!', html:true, delay: { show: 100, hide: 1000 } }); }); php <button type="button" class="badge btn btn-default" data-trigger="click" data-toggle="tooltip" data-placement="top" data-html=true data-content="@foreach($tag->tracks $track) <a href='/tracks/{{ $track->mdbid }}'>{{ $track->title }}</a> @endforeach">{{ $tag->tracks->count() }}</button> ignore funny code inside brackets (it laravel blade syntax) jsfiddle i have created jsfiddle although doesn't work (it on machine). have got delay working. however, if mouse within popover, still disappears. how can prevent , make disappear when mouse outside popover? this

Speed up a loop in R -

i using following function estimate kernel density of data kdens = function(x,h,n) { fx = matrix(0,n,1) kx = ak(x,h,n) (i in 1:n) { fx[i] = sum(kx[i,], na.rm=t)/n } return(fx) } i know not first question speeding loop. checked around in site, found using apply function faster, not case if manage correctly set loop. in above code, every "not needed thing" left out of loop, - if understood correctly - suggested speed computation. however, made comparison between above kdens function , density function implemented in r default. well, density needs 1 or 2 seconds, while kdens needs ~30 on machine. trywiththis <- rnorm(4800) x = trywiththis n = length(trywiththis) h = 1.059*sd(trywiththis , na.rm=t)*(n^(-0.2)) edit: information provided not complete kerf = function(x){ return(dnorm(x)) } ker = function(x,x0,h){ temp = kerf((x-x0)/h)/h return(temp) } ak = function(x,h,n) { k =

ios7 AVFoundation performance issues (memory leak) -

i using avfoundation capture qr codes in app. in ios 7.0 seeing major issues regards video capture. capture takes longer , longer each time it, leading app crash due memory leak issues. it works fine ios 7.1 . known issue? to fix this, had add following code when stopping capturesession [_capturesession removeinput:self.captureinput]; i not sure why didn't present issue on ios 7.1 though.

java - AWS S3 - Listing all objects inside a folder without the prefix -

i'm having problems retrieving objects(filenames) inside folder in aws s3. here's code: listobjectsrequest listobjectsrequest = new listobjectsrequest() .withbucketname(bucket) .withprefix(foldername + "/") .withmarker(foldername + "/") objectlisting objectlisting = amazonwebservice.s3.listobjects(listobjectsrequest) (s3objectsummary summary : objectlisting.getobjectsummaries()) { print summary.getkey() } it returns correct object prefix in it, e.g. foldename/filename i know can use java perhaps substring exclude prefix wanted know if there method in aws sdk. there not. linked list of methods available. reason behind s3 design. s3 not have "subfolders". instead list of files, filename "prefix" plus filename desire. gui shows data similar windows stored in "folders", there not folder logic present in s3. http://docs.aws.amazon.com/awsjavasdk/latest/jav

Using Servicestacks c# redis client how do I set the URN? -

i have code like: public vehicle neworupdate(vehicle vehicle) { try { redismanager.execas<vehicle>(r => { r.store(vehicle); //save new or update }); } catch (exception ex) { errormessage = ex.tostring(); haserror = true; throw; } return vehicle; } how can set urn item being added? see createurn extension on object don't see way set explicitly. default creates urn of "urn:vehicle:id". id have urn "urn:vehicles-{myspecialid}:id" possible control this? or way ask this... can make own urn objects store? vehicle v = new vehicle(); v.createurn = "urn:mine"; redismanager.execas<vehicle>(r => { r.store(v); }); it looks it's not hard, if know look. create list urn want: string urn = string.format("urn:dealer:{0}:vehicles", dealer.dealerid); var vehicleclient

android - How to display decimal numbers in Java? -

this question has answer here: how round number n decimal places in java 28 answers i'm using float display decimal numbers, doesn't display correct result. for example, 6.2/1000 result 0.0061999997. i know why happening, wonder there way display correct result, in case, 0.0062? edit: how round number n decimal places in java not answer question, why did marked question been answered in other place? numbers wrote example. in app user can enter number , divide / multiply number other number, result maybe won't have decimal points, maybe have 4 decimals, maybe have 7 decimals,... first, need understand isn't display issue - if want avoid displaying incorrect values, helps have right values start with. you should use bigdecimal instead of float . stores value integer scaled factor of 10 exp rather 2 exp used double , float . i

c# - Trying to filter data in grid, receiving "Cannot create an instance of the static class" error -

i attempting filter items populated in grid in code behind. when try call adapter data access layer, receiving following error: cannot create instance of static class 'sftip.dataaccesslayer.inventoryadapter' the filter meant display items in grid related user role ( assetownershipprogramids ). the error in segment new inventoryadapter() of line: filteredlist = new inventoryadapter().getallbyfilter(inventoryfilter); here code filter trying build: public list<inventory> bindgrid() { list<inventory> filteredlist = new list<inventory>(); searchfilterinventory inventoryfilter = new searchfilterinventory(); user currentuser; currentuser = (session["currentuser"] == null) ? (user)session["currentuser"] : new user(); if (currentuser.adminprograms.count > 0) { inventoryfilter.assetownershipprogramids.add(currentuser.adminprograms[0].referenceid); filteredlist = new inventoryadapter().geta

oracle - Best Practices for Separating Database Security from Application Tier -

in oracle documentation, repeatedly mentioned preferable users of application database users instead of records in kind of 'user' table numerous reasons. example, @ docs.oracle.com/cd/b28359_01/network.111/b28531/… -- "where possible, should build applications in application users database users. in way, can leverage intrinsic security mechanisms of database." i reasonably familiar call 1 big application user pattern, have been suitably convinced not best way. however, seems creating database user every web user not particularly possible either, question is, best practices keeping security definition of data separate application accesses it? some ideas: a secure interface in between database , application. application never knows database. create views utilize application context automatically filter out rows application user cannot read, , grant application user access view. similarly create procedures utilize application context allow authorized data ac

java - Error in taking multiple picture in one second on Android -

i want use android take multiple images in 1 second. basic idea use timer @ fps trigger camera capture images. the problem when want trigger camera more 1 times in 1 second, every 500ms, there error in startpreview. java.lang.runtimeexception: startpreview failed how can fixed this?. thanks. you should call startpreview() in onpicturetaken() callback, , nothing guarantees callback activated @ frame rate expected. many cameras provide burst-shot mode, there no common api yet. hopefully, api will arrive .

regex - Split a word with regexp in matlab; startIndex for 'split'? -

my aim generate phonetic transcription word according set of rules. first, want split words syllables. example, want algorithm find 'ch' in word , separate shown below: input: 'aachbutcher' output: 'a' 'a' 'ch' 'b' 'u' 't' 'ch' 'e' 'r' i have come far: check=regexp('aachbutcher','ch'); if (isempty(check{1,1})==0) % returns 0, when 'ch' found. [match split startindex endindex] = regexp('aachbutcher','ch','match','split') %now split 'aa', 'but' , 'er' single characters: = 1:length(split) singleletters{i} = regexp(split{1,i},'.','match'); end end my problem is: how put cells together, such formatted desired output? have starting indexes match parts ('ch') not split parts ('aa', 'but','er'). any ideas? you don't need

IllegalStateException when trying to use facebook android API -

i'm trying use facebooks api android make login function in app.... i've followed tutorial http://javatechig.com/android/using-facebook-sdk-in-android-example and copied exact same code... took me time discover there wasn't nothing wrong code... but, whenever click login button exception , login performs when app returned session not opened. in logcat got this. 04-22 22:11:15.570 31114-31122/com.myapppackage.app e/system﹕ uncaught exception thrown finalizer 04-22 22:11:15.570 31114-31122/com.myapppackage.app e/system﹕ java.lang.illegalstateexception: binder has been finalized! @ android.os.binderproxy.transact(native method) @ android.database.bulkcursorproxy.close(bulkcursornative.java:288) @ android.database.bulkcursortocursoradaptor.close(bulkcursortocursoradaptor.java:133) @ android.database.cursorwrapper.close(cursorwrapper.java:49) @ android.content.contentresolver$cursorwrapperinner.close(con

ruby - Can't resolve rubygems.org (too many redirects) -

for reason vagrant vm cannot resolve rubygems.org . working fine yesterday, today made no changes , no longer works: fresh unbuntu install vagrant -v # 1.5.3 vagrant init hashicorp/precise64 # ubuntu vagrant vagrant ssh installing ruby gems (fails) sudo apt-get update sudo apt-get install rubygems -y # here comes failure... sudo gem install librarian-puppet "error: not find valid gem 'librarian-puppet' (>= 0) in repository error: while executing gem ... (gem::remotefetcher::fetcherror) many redirects (http://www1.dlinksearch.com/?..." can't resolve rubygems.org wget rubygems.org "resolving rubygems.org (rubygems.org)... ::ffff:67.215.65.145, 54.245.255.174 connecting rubygems.org (rubygems.org)|::ffff:67.215.65.145|:80... connected. http request sent, awaiting response... 303 see other location: http://www1.dlinksearch.com/?url=rubygems%2eorg [following] --2014-04-23 02:28:15-- http://www1.dlinksearch.com/?url=rubygems%2eorg resolvin

c# - Uploading a BitmapImage as JSON post for Windows Runtime apps -

i've got bitmapimage defined as: bitmapimage bitmapimage = new bitmapimage(new uri("http://link.com/image.jpg")); now, need encode image base64 , post json . haven't found many guides on this, , when do, uses silverlight or .net libraries aren't available windows store development, think uses winrt. appreciated. depending on scenario might able use urisource bitmapimage read image again , convert base64 string: bitmapimage bitmapimage = new bitmapimage(new uri("http://i.stack.imgur.com/830ke.jpg?s=128&g=1")); randomaccessstreamreference rasr = randomaccessstreamreference.createfromuri(bitmapimage.urisource); var streamwithcontent = await rasr.openreadasync(); byte[] buffer = new byte[streamwithcontent.size]; await streamwithcontent.readasync(buffer.asbuffer(), (uint)streamwithcontent.size, inputstreamoptions.none); string base64string = convert.tobase64string(buffer); it seems if doing windows store app prior windows 8.1

oracle - How can I insert a long XML string into a blob in pl/sql? -

i have xml string has more 5000 characters. have store xml string in oracle db having blob data type shown toad. how can stored? try insert tabblename values(utl_raw.cast_to_raw(varchar2data)); varchar2 has size 4000 column , 32767 variable.

ruby on rails - Model association that spans across parent app and engine -

i'm making rails engine makes reference current_user in controller so: require_dependency "lesson_notes/application_controller" module lessonnotes class notescontroller < applicationcontroller def index if current_user @notes = note.where(student: current_user) if current_user.user_type.name == "student" @notes = note.where(teacher: current_user) if current_user.user_type.name == "teacher" end end end end this quite verbose , seem instead: require_dependency "lesson_notes/application_controller" module lessonnotes class notescontroller < applicationcontroller def index @notes = current_user.notes if current_user end end end however, the user model exists in parent app, not engine . in note model have define belongs_to association: module lessonnotes class note < activerecord::base belongs_to :student, class_name: "::user" belongs_to

javascript - showModalDialog - Is it possible to Dynamically Resize? -

i'm using showmodaldialog opening dialog inside dialog, although dialog have more fields depending on information required. possible make resize dynamically rather giving fixed size? showmodaldialog( v_location, '', 'dialogheight:260px; dialogwidth:560px; edge: raised; center: yes; help: no; resizable: no; status: yes; scroll: yes' ); try one: showmodaldialog( v_location, '', 'dialogheight:260px; dialogwidth:560px; edge: raised; center: yes; help: no; resizable: yes; status: yes; scroll: yes'); that give window can resized user/visitor. , yes possible dynamically change size of windows based example on screen resolution, need replace 'dialogheight:260px; dialogwidth:560px;...' 'dialogheight:<%=windowsheight%>px; dialogwidth:<%=windowwidth%>px;...' specifics depend on needs are.

android - ActivityManager kills running process of system app -

we facing problem activitymanager kills our system app: "i/activitymanager( 831): killing 3267:de.oursystemapp.tsc/u0a199 (adj 15): empty #31" why happen? don't have ui parts system app, lives in background. after boot of device intentservices triggered app download data backend. don't understand why process considered empty? i don't have explanation right now, ideas help.

java - Print a set collection -

i'm studying collections right , learned saw set type of collection don't permit duplicate elements. ok, i've created class adds 3 int numbers collection. seems ok question is: how print collection? know override string method since elements integer type how that? expected output be: 2,3,2 4,5,6 the code (adding numbers) public class adaugarenumere { int c=0; int f=0; int r=0; adaugarenumere(int c, int f, int r){ this.c=c; this.f=f; this.r=r; } } main class: import java.util.*; public class executare { public static void main(string[] args) { adaugarenumere primulrand=new adaugarenumere(2,3,2); adaugarenumere aldoilearand=new adaugarenumere(2,3,2); adaugarenumere altreilearand=new adaugarenumere(4,5,6); set<adaugarenumere> lista=new hashset<adaugarenumere>(); lista.add(primulrand); lista.add(aldoilearand); lista.add(altreilearand); system.out.println("elementele listei: "+arrays.aslist(lista.tostring())

c# - Why does the new feature "binary literals" start with 0b instead of being suffixed? -

the next c# version planned ( april 2014 ) have binary literals can see in language features status of roslyn project . the example in page this: 0b00000100 so use this: var mybynaryliteral = 0b00000100; i want understand why choose prefix 0b instead of use letter in end did double , float , decimal , on. double = 1d; float b = 1f; decimal c = 1m; integer literals possess 2 varying properties: types, can specified suffixes l or ul , , radices (called "forms" in documentation ), can specified prefixes 0x , 0b . specifying type done through suffix, , specifying radix done through prefix, makes sense keep same convention. in addition, can combine both specifiers. for instance: 0b00101010ul would denote literal 42 , stored unsigned long, , expressed in radix 2.

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null .

php - Add Collector to ZendDeveloperTools -

the question had answered solution doesn't work , don't know why : how log zend developer tools toolbar? i open new question because can't comment , can't reply ask (it's avoid, right ?) so, wanna add collector zenddevelopertools display variables. tried code , got error : fatal error: uncaught exception 'zend\servicemanager\exception\servicenotfoundexception' message 'unable fetch or create instance modsession\configcollector. and put in modsession/config/module.config.php 'invokables' => array( 'modsession\configcollector' => 'modsession\collector\configcollector', ), 'view_manager' => array( 'template_map' => array( 'zend-developer-tools/toolbar/modsession-configs' => __dir__ . '/../view/zend-developer-tools/toolbar/modsession-configs.phtml', ), ), 'zenddevelopertools' => array( 'profiler' => array(

database schema - Use official identification card id or generated id's from MongoDB for identifying users? -

i designing schema simple mongodb database there collection customers. natural way of identifying customer use official identification card id (6 numbers , letter, unique each person in country). way of doing letting mongodb choose _id field value , using card id field. any suggestion of advantages / disadvantages of choosing 1 string 6 numbers , letter _id, or choosing , objectid created mongo? uh, old " surrogate key vs. non-surrogate (natural) key" discussion. bit of flame war... i think surrogate keys (i.e. objectids ) way go. key objections "natural" key (the official id card id) these: you can't verify them. if user entered wrong number (but valid format), do? since primary keys can't changed , you'll have re-insert new object , fix links user. ugly. you have no control of them. if government decides re-issue number , you're out of luck their format can change on time , isn't big problem mongodb might problem in c

c# - How add multiple rows with one Insert query in EF -

i have list of strings of unknown length. i'm adding them database: if (somentenovasclas.any()) { foreach (string item in wsclassificacoes) { dc.classificacaos.add(new classificacao { descricao = item }); } dc.savechanges(); } but ef generate 1 insert each row: exec sp_executesql n'insert [dbo].[classificacao]([descricao], [excluido]) values (@0, @1) select [codclassificacao] [dbo].[classificacao] @@rowcount > 0 , [codclassificacao] = scope_identity()',n'@0 varchar(255),@1 bit',@0='mercado',@1=0 go exec sp_executesql n'insert [dbo].[classificacao]([descricao], [excluido]) values (@0, @1) select [codclassificacao] [dbo].[classificacao] @@rowcount > 0 , [codclassificacao] = scope_identity()',n'@0 varchar(255),@1 bit',@0='concorrência',@1=0 go i'd know how insert in 1 time ef generate command like: insert table (column) values ([array[0]]), ([array[1]]), ... instead of 1 insert foreach.. id

How can I use recursion to find increments of a number in python? -

i have following code, doesn't work when run it. return like: [5,10,15,20] if inputed value n 4. advice appreciated. def multiplerecursive(n): multiples=[] if n==0: multiples.append(n) else: total=5*multiplerecursive(n-1) multiples.append(total) return multiples a trivial version is: def mr(n): if n == 0: return [] return mr(n-1) + [5*n]

jquery - Highchart -change posistion of yaxis title -

Image
in current project using hightchart show charts various analysis. in column chart move position of title shown in picture , there should enough space between last observation on yaxis , yaxis title. per image there should space between rainfall , 250(which last item on yaxis) fiddle i able change title position squeezed. as have define chart conainer this <div id="chartborder"> <div id="chartcontainer" class="chartcontainer"> <div> </div> and not able apply css please help add following part: title: { "textalign": 'right', "rotation": 0, x: 34, y: -140 } demo: http://jsfiddle.net/46ue4/ related question: highcharts: how aligned horizontal yaxis title

javascript - <button> not working in IE -

i have multiple buttons different functionality, each button behaves submit button. want give different behavior each of button created. <form action="/createupdate"> <!--here have form elements textbox , checkboxes etc --!> <button name="buttonname" id="submitbutton1" value="create">create</button> <button name="buttonname" id="submitbutton2" value="update">update</button> </form> if change buttons input type=submit, pressed button sent. for example: <form action="/createupdate"> <!--here have form elements textbox , checkboxes etc --> <input type="submit" name="buttonname" id="submitbutton1" value="create" /> <input type="submit" name="buttonname" id="submitbutton2" value="update" /> </form>

ssl - Connection to HSM launch error 48 -

i'm trying access safenet hsm computer, added computer how client , sent pem file hsm, right here. problem when typed " vtl verify ", because launch following error: ssl connect failing error: unable find luna sa slots/partitions among registered servers. ensure client assigned partitions on luna sa servers, , check vtl supportinfo command other possible problems such unable ping server, or missing configuration files. i can solve problem follow steps: delete certificates computer delete server file configuration regenerate certificate hsm command sysconf regencert <ip_of_hsm> run command ntls bind eth0 run commands registry hsm in computer , append computer hsm then vtl verify should run correctly

Updating variable from different model rails -

my system has review process paper object. want update paper status published if 3 reviews paper accepted. i've made review part , works. user reviews paper , once review accepted paper given point. is there way can implement using ajax once review points has come 3, update paper status in database published? what i've done doesn't update paper's status shows it's published: <p class="status"> <strong>status:</strong> <% status = 0 %> <% @paper.reviews.each |review| %> <% status += review.review_status %> <% end %> <% if status >= 3 %> paper published <% else %> paper under reviewing process <% end %> <p> paper model: belongs_to :user belongs_to :subject has_many :comments has_many :reviews #file dependencies has_attached_file :pdf, :url => "/assets/:attachment/:id/:basename.:extension", :path => &qu

java - forward issues after file download in struts 1.3 action class -

i have create , download excel file using struts1.3, here have created excel file dynamically , downloaded successfully, after file download need forward other page success page , not forwarding( mapping.findforward("success") ) struts action class. please me solve issue. thanks, siva. what want send 2 response single request : the excel file downloaded the success page. technically not possible. if commit stream downloading file, mark end of request. there couple of workarounds requirement: show success page , link user can download excel file show success page , through onload script trigger form submit enabling user download file without additional clicks. in both situtations must first show success page , download image. alternate solution problem use ajax (however not sure if acceptable).

javascript - sinon.js fake server responses -

i created fake server , 2 things in end: answer request check passed data this works way: server.respondwith("post", serveruri, [ 200, {"content-type": "application/text"}, "answer fake server" ]); // f1 server.respondwith(function(data) { // f2 try { var datasenttoserver = data.requestbody; ok(datatoregister === datasenttoserver, testcomment); } catch (e) { console.error(e); } } ); but @ beginning of test don't want response. leave f1 away. after statements want server call f1 , f2. adding line of f1 doesn't work because f2 not called more. seems f1 overwrites f2. need redeclare f2 well. is there possibility add behaviour existing respondwith() functions? it's similar task of fake-server test. must leave 1 function respondwith , write inside logic of data , answers of server. server.respondwith(method

ruby symbol in the ruby class attr_accessor -

example class persion attr_accessor :name, :age end can write in format? class persion attr_accessor name, age end no, because ones in first example symbols, while in second example try call nonexistent name , age methods, result in exception.

Redis server console output clarification? -

i'm looking @ redis output console , i'm trying understand displayed info : (didn't find info in quick guide ) so redis-server.exe outputs : /*1*/ [2476] 24 apr 11:46:28 # open data file dump.rdb: no such file or directory /*2*/ [2476] 24 apr 11:46:28 * server ready accept connections on port 6379 /*3*/ [2476] 24 apr 11:42:35 - 1 clients connected (0 slaves), 1188312 bytes in use /*4*/ [2476] 24 apr 11:42:40 - db 0: 1 keys (0 volatile) in 4 slots ht. regarding line #1 - dump.rdb file used ? data ? what [2476] number ? not port since line #2 tells port 6379 what (0 slaves) means ? in line #3 - 1188312 bytes used - max value i'd know overflows ...? whole databases ? line #3 (0 volatile) means ? line #4 - why have 4 slots ht ? have no data yet [2476] - process id dump.rdb - redis can persist data snapshoting, dump.rdb default file name http://redis.io/topics/persistence 0 slaves - redis can work in master-slave mode, 0

android - Take a photo with custom camera resolution? -

i writing app allows take photo default camera. problem photo sending server, have reduce them size. (for example 3 mb 1 mb) how take photo: public void startcameraactivity() { intent imageintent = new intent(android.provider.mediastore.action_image_capture); string timestamp = new simpledateformat("yyyymmdd_hhmmss").format(new date()); file imagesfolder = new file(environment.getexternalstoragedirectory(), "path"); imagesfolder.mkdirs(); //string filepath = "path" + timestamp + ".jpg" ; file image = new file(imagesfolder, "path" + timestamp + ".jpg"); uri urisavedimage = uri.fromfile(image); nomefilejpg = "path"+timestamp+".jpg"; log.i(tag,"nome del file: "+nomefilejpg); imageintent.putextra(mediastore.extra_output, urisavedimage); startactivityforresult(imageintent, 2); } how can add reduce dimension? you can reduce resolution t

c# - Creating nested objects from JSON -

i have following json needs represented object. [ { "to": "+27001234567", "scheduling":{ "date": datetime, "description": string }, "id": "hello world!" } ] the problem i'm having object inside of object. way this? you can represent nested objects json c# this: public class scheduling { public datetime date { get; set; } public string description { get; set; } } public class rootobject { public string { get; set; } public scheduling scheduling { get; set; } public string id { get; set; } } also want check site found useful: http://json2csharp.com/

Magento - Base tax removed, store tax applied -

we have multiple websites, each it's own base-currency , tax-rules. prices entered in admin including tax, in each stores own currency. the problem magento takes entered price, remove tax according "default"-store, apply tax correct store. example: price 33 in admin. "default" tax-rate 25%. 33 / 1,25 = 26,4 tax-rate in germany 19%. 26,4 * 1,19 = 31,416 31,42 displayed price in fronted, when should 33. config values of interest: tax calculation based on: shipping address catalog prices: including tax default country: sweden (default) default country: germany (website) display product prices in catalog: including tax can behavior configured? there reliable workaround. i'm afraid not have option change prices excluding tax. can't believe it, found solution right after posting question: the setting " system -> configuration -> sales - shipping settings -> origin " still set sweden. changed match tax-rule s

javascript/css - realize a attitude indicator -

someone can me realize attitude indicator this: http://www.clker.com/cliparts/c/6/b./2/1223615301572097144startright_attitude_indicator.svg.med.png must utilize inside web page html , modify rotation , vertical move of background image. tanks

Scheduled import from SQL Server to mySQL -

is possible setup scheduled(preferably hourly) import of data sql server mysql? manual import of data working through odbc using dbforge studio mysql (604942 rows imported). due large volume of data, not prefer triggering import command every , manually, rather automatically update recent updated rows only. have field called [last_modified_date]. the intention update rows condition: [last_modified_date] >= last 1 hour i complete beginner in databases. survived til date searching solutions online. you use sql agent schedule job. in query selecting records move, use add filter on [last_modified_date] align schedule of sql agent job.

javascript - Can't add marker on google maps -

i've tried many ways , still couldn't add marker google map. to understand, have @ following code below: var marker; var mycenter = new google.maps.latlng(55.1231231,-1.123131); function initialize() { var mapoption = { center: mycenter, zoom:15, maptypeid:google.maps.maptypeid.roadmap, pancontrol: true, pancontroloptions: { position: google.maps.controlposition.right_top }, }; var map = new google.maps.map(document.getelementbyid("googlemap"),mapoption); var customcontroldiv = document.createelement('div'); customcontroldiv.id="customcontroldiv"; addcustomcontrol(customcontroldiv, map); map.controls[google.maps.controlposition.top_center].push(customcontroldiv); } function placemarker(location) { var marker = new google.maps.marker({ position: mylatlng, map: map, title:"you here!"

uitableview - Xamarin.ios Refresh Button -

i have uitableview want reload when button clicked inside navigation bar looks refresh button. i have following setup connected via action display: partial void refreshbuttonclicked(monotouch.foundation.nsobject sender){ } but here want reload table data. im stumped, have tried use table.refresh()to no joy , can not find literature. help appreciated you should use table.reloaddata() also take @ populating table data

ios - UINavigationController Bar color update in viewWillAppear updating after visible -

in app working on, have uitabbarcontroller contains views each in uinavigationcontroller . one of views settings screen user can change color scheme of app. when so, , switch screen, every component supposed change color changed except background of uinavigationcontroller . updates fraction of second after visible, there annoying flicker. this simplification of viewwillappear (which tested make sure still causes error) - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; uicolor *foreground = [self.settings getforegroundcolor]; uicolor *background = [self.settings getbackgroundcolor]; self.navigationcontroller.navigationbar.bartintcolor = background; self.navigationcontroller.tabbarcontroller.tabbar.bartintcolor = background; self.view.backgroundcolor = background; self.navigationcontroller.navigationbar.tintcolor = foreground; self.navigationcontroller.tabbarcontroller.tabbar.tintcolor = foreground; self.view.tin

Display Image that is in an Array in Javascript -

i have series of arrays , output want display image. know how using document.write cant head around how using dom. document.write("<p><img src='"+stones.value+"' alt='mick'></p>"); how achieve without using document.write? var img = new image(); img.src = stones.value; img.alt = 'mick'; document.getelementbyid('targetelement').appendchild(img); i'm using image constructor here. oriol shows how pure dom. nice read: is there difference between `new image()` , `document.createelement('img')`?

objective c - How to pick the Path Asset in a existing image with ALAssetsLibrary? -

i have code write / create new image in ios photo library: alassetslibrary *library = [[alassetslibrary alloc] init]; // request save image camera roll [library writeimagetosavedphotosalbum:[imagem cgimage] orientation:(alassetorientation)[imagem imageorientation] completionblock:^(nsurl *asseturl, nserror *error){ //code here... } the code this, stamped in code writeimagetosavedphotosalbum , in time don`t need create new image in library, need path of image exist in library, in case image inside variable 'imagem'. what code change writeimagetosavedphotosalbum path of image? [edit] i image inside variable imagem in format: -(void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info{ uiimage *imagem = [info objectforkey:uiimagepickercontrolleroriginalimage]; [imagepicker dismissviewcontrolleranimated:yes completion:nil]; } you have: -(void)imagepickercontroller:(uiimagepickerco

android application crashing due to java.lang.NullPointerException -

i following andorid development guide , seem getting errror while trying register account, aware of issues , location (line 197) cannot seem fix issue please find below copy of logcat , register code, if there anymore information need please comment , try , help. 04-24 21:24:32.735: e/androidruntime(30368): fatal exception: main 04-24 21:24:32.735: e/androidruntime(30368): java.lang.nullpointerexception 04-24 21:24:32.735: e/androidruntime(30368): @ com.loggedin.register$processregister.onpostexecute(register.java:197) 04-24 21:24:32.735: e/androidruntime(30368): @ com.loggedin.register$processregister.onpostexecute(register.java:1) 04-24 21:24:32.735: e/androidruntime(30368): @ android.os.asynctask.finish(asynctask.java:631) 04-24 21:24:32.735: e/androidruntime(30368): @ android.os.asynctask.access$600(asynctask.java:177) 04-24 21:24:32.735: e/androidruntime(30368): @ android.os.asynctask$internalhandler.handlemessage(asynctask.java:644) 04-24 21:24:32.735: e/andr

how we can get which validation is invalid in AngularJS -

i have code figure out if element valid or invalid in directive : mymodule.directive('mydirective',function(){ return { restrict: 'a', scope: {}, require:'ngmodel', link: function(scope,element,attrs,ctrl){ if(ctrl.$invalid){ //do } } }}); so problem how can determine type of validation invalid, required? max-length? other custom-validations? because need generate proper validation-message show. ngmodelcontroller (or ctrl , in example) has $error property can use see validation errors are. so if "required" validation has failed, property truthy: ctrl.$error.required

c++ - Compiler error C4430: missing type specifier - int assumed -

this question has answer here: resolve build errors due circular dependency amongst classes 8 answers i have error: "error c4430: missing type specifier - int assumed. note: c++ not support default-int" with code example : //a.h #include "b.h" class a{ b* b; .. }; //b.h #include "a.h" class b{ a* a; // error error c4430: missing type specifier - int assumed. }; this circular dependency issue. declaring pointer class, definition of class not needed; i.e. type doesn't have complete type . don't need include a.h in b.h , forward declaration enough. such as: //b.h class a; // change include of a.h forward declaration class b { a* a; };

github - Git won't use second set of credentials when pushing to remote -

i've setup second git identity use company account, creating second ssh key , adding config file ~/.ssh directory, explained in blog post : i have set new user name , email of local repository: $(path repo directory) git config user.name "<company account user name>" $(path repo directory) git config user.email "<company account user email>" as suggested in 1 of comments in blog post. i've created local repository, , 1 on github (company account). i've added (public) repo on github remote (origin) of local one. i can pull remote, (using either command line , sourcetree), when try push, error: error: permission <company user name>/test.git denied <personal user name>. fatal: not read remote repository. that is, git trying push using existing, personal account, not new, work one. how can have git push using proper account's credentials? i think whole osx keychain/keychain helper thingy might blame

Bubble sort on 2D Array Java -

string[][] 2darray = new string[counter][2]; 2darray [counter][column1] = string.valueof(counter); 2darray [counter][column2] = "something something"; for(int = 0; < 2darray.length-1; i++){ for(int j = + 1; j > 0; j--){ if(2darray[i][j] < 2darray[i-1][j]){ int[][] temp = 2darray[i-1][j]; 2darray[i-1][j] = 2darray[i][j]; 2darray[i][j] = temp; } } } attempting sort array column 1 ascending. i've studied other references on here , mimic'd them reason ide not above... if understand correctly, suggest following: what need compare integer values of array: if(integer.valueof(2darray[i][0]) < integer.valueof(2darray[i-1][0])){ the reason don't include j because sorting value of first column. 2darray[i][0] gets value of counter @ particular row. i've seen other stuff in code use fixing: for(int = 0; < 2darray.length; i++){ for(int j = i; j < 2da

c - Is it necessary to supply the null character when declaring an character's array? -

a string constant in c stored character array, while creating such array element element, necessary supply null character. i need store string constant, say, s[number]= "hello\n" . string constant stored character array in c, further, such string terminated null character '\0' . while storing phrase in array, need account null character , allocate additional space or need mention number of characters need store? if going use c-string functions, strlen, - answer yes . string should null-terminated. if introduce custom functions deal string - can store like. it's important mention, if create array using string constant, reserves space null-character automatically. e.g. output following code: char s[] = "hello"; printf("%d", sizeof(s) / sizeof(char)); is 6 which 5 'h, 'e', 'l', 'l', 'o' , 1 '\0'.

c++ - SDL PollEvent() never returns anything -

i'm trying sdl detect keyboard activity c++ console application/game on os x. not sdl_pollevent() not returning keyboard activity, far can tell debugging sdl_event* it's supposed update never updated @ all. experience sdl amounts few minutes of tutorials on web, i'm sure there's didn't correctly when setting sdl that's causing problem. below class wrote manages polling events, , supposed notify objects via callback when requested keypress detected (see listenforkeyevents() ). since depends on sdl_pollevent() , however, it's not doing @ all. using namespace std ; template<class t> struct keyinputregister { /** * string representing keyboard key * client wishes listen */ const char * requestedchar ; t * caller ; /** * pointer function called * when requested keyboard input detected. */ void (t::*callback)() ; keyinputregister(const char* ch, t * callr, void (t::*cb)()) : requested