Posts

Showing posts from March, 2014

java - Refactoring Settings Activity -

i´m having problems refactoring settingsactivity.java. first, extended preferenceactivity didn't take addpreferencesfromresource(r.xml.pref_general) because marks decaprecated findpreference(getstring(r.string.pref_location_key). i've changed preferencefragment , took both methods above cannot resolve getmenuinflater().inflate(r.menu.menu_settings, menu); furthermore it's showing: "cannot resolve symbol pref_units_keys" in bindpreferencesummarytovalue(findpreference(getstring(r.string.pref_units_key))); finally in forecastfragment.java cannot method right: private string formathighlows(double high, double low){ // data fetched in celsius default. // if user prefers see in fahrenheit, convert values here. // rather fetching in fahrenheit user can // change option without having re-fetch data once // start storing values in database sharedpreferences sharedprefs = preferencemanager.ge

SQL Server 2008: Return users in DISTINCT Group -

we have group table setup follows groupid inactive name g1 0 person1 g2 0 person2 g3 0 person1 g1 1 person3 g2 0 person4 g4 0 person4 i don't know front how many groupids there or called or how many names there or called. i looking list of each person in each distinct group (who not have isactive state of 1) in table this g1 g2 g3 g4 etc... person1 person2 person1 person4 person4 is @ possible? have select access database creating temporary tables etc out. thanks looking, dt here have example script pivots data way want it. does: create temporary table #t sample data gave determine groupid's pivot dynamically in @groupidcols determine groupid's select dynamically in @groupidsel pivots data in #t . first row number assigned rows in #t distinguish between persons groupid (see derived table t ). pivot used on derived t

javascript - Mocha - Testing Promise, `done` never gets called in Promise -

i'm trying test spy called in .then block of promise, done in then block doesn't seem executed @ all. i'm getting timeout of 2000ms exceeded. here's i'm testing (async): /** * passed down loginform component * handle form submission. */ _submithandler(data) { return function(evt) { evt.preventdefault && evt.preventdefault(); evt.stoppropagation && evt.stoppropagation(); return request('post', 'auth', data) .then((res) => { authactions.login(); return res; }) } } here's test: describe('when succeeds', () => { it('should login', (done) => { sinon.spy(authactions, 'login'); instance._submithandler({})({}) .then((res) => { console.log('called!!!'); expect(authactions.login.called).to.equal(true); authactions.login.restore(); done(); }, done); }); }); i'm using karma

.htaccess - redirect m.php to m.domain.com htaccess -

is possible redirect http://www.url.com/m.php?name=bill to http://m.url.com/bill/ via htaccess? i have seen examples i'm not sure use accomplish that how about: rewriteengine on rewritecond %{http_host} ^(www\.)?url\.com$ [nc] rewritecond %{the_request} \ /+m\.php\?name=([^&\ ]+) rewriterule ^ http://m.url.com/%1/? [l,r] rewritecond %{http_host} ^m\.url\.com$ [nc] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^([^/]+)/?$ /m.php?name=$1 [l,qsa] assuming both m.url.com , www.url.com point same document root.

c# - How to find barcodes of a PDF document -

Image
i started searching how create windows phone 8 app recognize barcodes inside pdf document. my best guest following process below: find lib split pdf documents image streams (one per page). find lib recognize if there barcode in image stream: 2.1. try recognize barcode in each portion of image, i. e.: try #1 (from y = 0, x = 0 y = 100, x = 100); try #2 (from y = 100, x = 0 y = 200, x = 100); try #3 (from y = 200, x = 0 y = 300, x = 100); and on. i'm wondering if best approach accomplish barcode recognition in pdf document using wp8. another concern whether process when executed not device present acceptable performance. someone did that? advice? update i want scan itf barcodes, i. e., need scan barcode in image: i'm trying start achieving scanning barcodes image, i'm not getting success. below first try: //get assets folder app storagefolder folder = await windows.applicationmodel.package.current.installedlocation.getfoldera

css - How to wrapAll an ELEMENT from title by jQuery? -

now playing pagetranstioncollection and want wrapall element title="wrap pt-page1". after magic jquery script goes <div class='pt-page pt-page-2'> <div title='wrap pt-page-2'> element blahblahblah</div> so tried modificate classtitleadder: <script> $(document).on('ready', function() { $("[title*='class']").addclass(function(){ return $(this).attr('title');}).removeclass('class').removeattr('title'); });</script> to: <script>//Враппит страницу полностью $("[title*='wrap']").wrapall( (function(){ $(this).text('"<div class='pt-page'); return $(this).attr('title'); $(this).text('' />"'));}).removeattr('title');</script> yes, know foolish me, can me? maybe have right solution? thanks. hope understood question. some specific example more de

Customized validation messages in Ruby on rails -

i have model called user.rb . model has customized email validation: class user < activerecord::base # include default devise modules. others available are: # :token_authenticatable, :confirmable, :lockable , :timeoutable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable #,:validatable # setup accessible (or protected) attributes model attr_accessible :email, :password, :password_confirmation, :remember_me validates_presence_of :email,:message=>"el campo email requerido" end the problem browser shows " email el campo email requerido" while want "el campo email requerido" (without email before). as rails newer 3.2.2, uses defined errors.format internationalization build validation full message. i believe cannot change behavior 1 attribute, if want whole app, can follow answer on customise activemodel full_messages one alternative define message directly record's

python - Sorting certain info in a file -

i making program sorts file alphabetically highest score. file has 4 names separated tabs: jeff 12 17 16 dan 23 21 18 john 12 10 20 mary 13 24 24 this code: with open("file.txt","r") f: lines = f.readlines() lines.sort() fields = [line.split() line in f] name, grades = fields[0], fields[1:] grades = [int(grade) grade in grades] grades.sort() highest = max(grades) open('file.txt','w') fout: el in lines: fout.write('{0}\n'.format(' '.join(el))) open('file.txt','r') fsort: line in fsort: print(line[:-1]) fsort.close() i keep getting errors such list value out of range; field line. can give me solution code works? you need use fields = [line.split() line in lines] , not in f . f.readlines() called, file pointer moved end eventually, meaning fields empty list. however, have feeling name, grades = fields[0], fie

validation - Laravel 5 Validate many to many data -

when creating new role administrator can select different rights he'd assign role. after saving freshly created role database, selected rights sync'd right_role table. public function store(createrolerequest $request) { $role = new role(['name' => $request->get('name')]); $rights = []; foreach ($request->get('rights') $id => $enabled) { if ($enabled) { $rights[] = $id; } } $role->save(); $role->rights()->sync($rights); return redirect()->route('users.index'); } but how validate submitted rights against not existing values? can within createrolerequest ? this can done custom validator. here example how custom validators can used in createrolerequest public function __construct() { validator::extend("valid_rights", function($attribute, $value, $parameters) { $rules = [ 'right_id' => 'exists:rights

sql server - How to NOT SELECT the OUTPUT value from a command shell script inside a stored procedure? -

i have stored procedure used ssrs report. but need run before run query: sys.xp_cmdshell @sqlcmd; the problem running first returns output cell. throws off report because it's expecting proper query , not "output" how go omitting output select? tried add "no_output" still not work: set @sqlcmd = '"c:\program files (x86)\imageconverter\imageconverter.exe", no_output'; it looks syntax calling no_output clause may issue. though msdn docs show syntax in 1 of examples , msdn listed syntax, this technet article suggests passed literal 2nd parameter xp_cmdshell procedure without quotes, i.e.: set @sqlcmd = '"c:\program files (x86)\imageconverter\imageconverter.exe"' exec master..xp_cmdshell @sqlcmd, no_output;

Using awk, how I do specify doing something only when the first field is an integer? -

i starting out in awk, , wonder, using awk, proper way state, (such printing out record) when first field integer? do ... when first field integer? this command in braces, print in case, if first field positive integer: awk '$1 ~ /^[[:digit:]]+$/{print;}' floating point numbers rejected. if want accept either positive or negative integers, then, mklement0 suggests, use following: awk '$1 ~ /^[+-]?[[:digit:]]+$/{print;}' note that, because [:digit:] used, these tests unicode safe.

groovy - Execution of bubble sort is 5 times slower with --indy -

Image
i wrote implementation of bubble sort play around bit groovy , see if --indy have noticeable effect on performance. essentially, sorts list of 1 thousand random integers 1 thousand times , measures average execution time sorting list. half of time list integer[] , other half it's arraylist<integer> . the results confusing me: $ groovyc bubblesort.groovy $ time java -cp ~/.gvm/groovy/current/embeddable/groovy-all-2.4.3.jar:. bubblesort average: 22.926ms min: 11.202ms [...] 26.48s user 0.84s system 109% cpu 25.033 total $ groovyc --indy bubblesort.groovy $ time java -cp ~/.gvm/groovy/current/embeddable/groovy-all-2.4.3-indy.jar:. bubblesort average: 119.766ms min: 68.251ms [...] 166.05s user 1.52s system 135% cpu 2:03.82 total looking @ cpu usage when benchmarks running, cpu usage lot higher when compiled --indy without. this intrigued me ran benchmarks again - time yourkit agent , cpu tracing enabled. here recorded call trees: without --indy : with --i

c# - HTTP redirection issue in IIS, keep getting ERR_TOO_MANY_REDIRECTS on the browser -

i trying enable https on website on iis. want redirect user http https. i have updated rule accordingly in web.config to <rewrite> <rules> <rule name="redirect https" enabled="true" stopprocessing="true"> <match url="(.*)" /> <conditions> <add input="{https}" pattern="^off$" /> </conditions> <action type="redirect" url="https://{http_host}/" redirecttype="permanent" /> </rule> </rules> </rewrite> i able convert request https keeps redirecting same url https. problem rule apparently keeps redirecting urls including https , browser in network tab keeps lots of 301 , throws this webpage has redirect loop err_too_many_redirects please me out here if has tackled similar situation. can provide more in

clojure - I can pass a cookie in my http post with clj-http -

when use postman handler can cookie without problem, add header, i'm writing test , using clj-http send request rest server, first try hand , add cookie in header (:status (http/post "http://localhost:8080/create/article" {:throw-exceptions false} {:body "...." :headers {"cookie" "uid-session=12"} :content-type "application/json"})) and try using cookie property (is (= 200 (:status (http/post "http://localhost:8080/create/article" {:throw-exceptions false} {:cookies {"uid-session" {:value "12"}} :body " ... " :content-type "application/json"})))) debugging app handler doesn't receive cookie, reason?...thanks the problem you'r

python - Tkinter gui mainloop "ex =" -

hello i'm complete beginner in python , facing problem while creating simple gui in tkinter (trying make simple pong). anyways have code in python 3: tkinter import frame import tkinter class pong(frame): def __init__(self, parent): frame.__init__(self, parent) self.parent = parent self.parent.bind("<key>", self.key) self.initialize() def key(self, event): if event.char == 'q': #end self.quit() print("end") def initialize(self): print("initialize") pass def main(): root = tkinter.tk() ex = pong(root) root.overrideredirect(true) root.geometry("{0}x{1}+0+0".format(root.winfo_screenwidth(), root.winfo_screenheight())) root.mainloop() main() i'm wondering bottom "ex = pong(root)" part because if delete program doesn't work, cant press q quit, can't find ex means, literally can't

xml - Better way to retrieve values from matching keys in a ruby hash -

i'm trying create faster parser soap api turn xml hash, , match keys memory loaded schema based on yml structure. used nori parse xml hash: hash1 = { :key1 => { :@attr1=> "value1", :key2 => { :@attribute2 => "value2" }}} (old ruby syntax keep attributes keys clear) meanwhile have constant loaded in memory , stores relevant keys needed actions: hash2 = {:key1 => { :key2 => { :@attribute2 => nil }}} (old ruby syntax keep attributes keys clear) i need match first hash second 1 in efficient way. per understanding there ways it: iterate on 2 hash keys @ same time using second 1 origin: def iterate(hash2, hash1) hash2.each |k, v| if v.is_a? hash iterate(hash2[k], hash1[k]) else hash2[k] = hash1[k] end end end (multiline syntax, ¿clear?) some questions come mind: is there more efficient way without having iterate on keys? is more efficient accessing keys directly? is there better way parse xm

Azure SQL Database vs Azure SQL on VM -

we finding azure sql database slow. 10x slower same spend on sql on azure vm. however vm based solution requires maintenance , backups , im concerned i'll loose vm , data if horrible goes wrong. thus sql azure solution seems safer me. have 2 specific questions. are seeing speed difference , if there solution is there nice solution ensure sql on vm backed automatically , offsite. azure sql database slower sql server on azure virtual machine. however, didn't find slow 10x. may should try premium tier, delivers more powerful , predictable performance, in case database in other tier. regarding sql server on azure virtual machine, there support available automated backup , patching. please visit below link more details. http://azure.microsoft.com/blog/2015/01/29/automated-everything-with-sql-server-on-iaas-vms/

Find the most frequent value in an array of double in Java (without hashmaps or sorting) -

write full java program following: creates array of 100 double. reads in unknown number of doubles file named values.txt . there @ least 2 distinct values, , no more 100 distinct values in file. values in unsorted order. values no smaller 0, , no larger 99. outputs occurring value in file. outputs least occurring value in file. value must occur @ least once in order output. outputs average of array values. you must create , use separate methods each of items #2-5. this have far. cannot life of me figure out how right: import java.util.*; import java.io.*; public class arrayprogram2 { static scanner console = new scanner(system.in); static final int array_size = 100; static int numofelements = 0; public static void main(string[] args) throws filenotfoundexception { scanner infile = new scanner(new filereader("values.txt")); double[] arr1 = new double[array_size]; while (infile.hasnext()) { arr1[numofelem

python - Django rest update object from other model -

i using django 1.7 rest framework, . want update cart instance , create new instance of order. #models.py class cart(models.model): to_be_deleted = models.booleanfield(default=false) ... class order(models.model): ... #views.py class orderbuylist(generics.listcreateapiview): serializer_class = orderbuyserializer def create(self, request, *args, **kwargs): data = request.data # first mark cart instance deleted , create order instance # request can come cart. cart = cart.objects.filter(id=data['id'],user_id=data['user_id']) if cart: cart[0].to_be_deleted = true cart[0].save() return generics.listcreateapiview.create(self, request, *args, **kwargs) i feel not best way write logic. because following situation can occur, cart updated , order instance not created. don't know how know cart not converted order. there better way achieve this? you can manually create order , update cart after that, this:

android - How to check if location is on and in high priority on API 18 and below -

tried this: string locationproviders = settings.secure.getstring(getactivity().getcontentresolver(), settings.secure.location_providers_allowed); log.d(tag_map, locationproviders); output is: gps,network are phones api 18 , below dont' have high_accuracy priority? i assume you're wondering how using settings.secure.location_providers_allowed , depricated in api level 19, different using settings.secure.location_mode , introduced in api level 19. with settings.secure.location_mode , have these values (you know this): location_mode_high_accuracy, location_mode_sensors_only, location_mode_battery_saving, or location_mode_off you can map these values settings.secure.location_providers_allowed in way: location_mode_high_accuracy : "gps,network" location_mode_sensors_only : "gps" location_mode_battery_saving : "network" location_mode_off : "" note in code, it's best reference constan

java - Threads affected by Thread.yield()? -

here multi-threaded helloworld: public class helloworld { public static void main(string[] args) throws interruptedexception { thread mythread = new thread() { public void run() { system.out.println("hello world new thread"); } }; mythread.start(); thread.yield(); system.out.println("hello main thread"); mythread.join(); } } as understand, after mythread.start() , there 2 threads running. 1 main thread, , other newly-created mythread . then, thread referred in thread.yield() ? i checked java se6 doc, says thread.yield(): causes executing thread object temporarily pause , allow other threads execute but in codes, can't see currently excuting thread is, looks both threads running @ same time . isn't more clear mythread.yield() instead of thread.yield() ? have ideas this? with "current thread" in context, javadoc means &quo

testing - Visual Studio Associated Automation not showing tests when attempting to link to MTM -

when attempting link test in visual studio microsoft test manager (mtm) via "associated automation" tab, tests created in visual studio aren't showing up. this issue number of projects in solution. have tried re-building solution still not display. show, don't. issue occurring , how can remedied? the issue being if projects not created variation of of "test" projects in visual studio, tests won't show on associated automation test names when linking mtm test case.

php - Getting the Form input value in Laravel -

are there other ways value of <input> in laravel besides input::get('name'); ? here route tries , value route::get('delete_comment_action/{id}', function($id)/ { $status_id = input::get('status_id'); print_r($status_id); exit(); return redirect::back(); }); here form should have data in it <form action="" method="get"> <input type="hidden" name ="status_id" value="{{$swagger->status_id}}"> <a href ="{{{ url("delete_comment_action/$swagger->id") }}}"><button type="button" class="btn btn-danger">delete</button></a> </form> status_id should @ least equal 1, when try using, instead displays blank page. $variable = input::get('status_id'); print_r($variable); your routes looks okay change form submit tag instead link route::get('

dplyr - which R function to use for Text Auto-Correction? -

i have csv document 2 columns contains commodity category , commodity name. ex: sl.no. commodity category commodity name 1 stationary pencil 2 stationary pen 3 stationary marker 4 office utensils chair 5 office utensils drawer 6 hardware monitor 7 hardware cpu and have csv file contains various commodity names. ex: sl.no. commodity name 1 pancil 2 pencil-hb 02 3 pencil-apsara 4 pancil-nataraj 5 pen-parker 6 pen-reynolds 7 monitor-x001rl the output standardise , categorise commodity names , classify them respective commodity categories shown below : sl.no. commodity name commodity category 1 pencil stationary 2 pencil stationary 3 pencil stationary 4 pancil stationary 5 pen stationary 6 pen stationary 7 monitor hardware step 1) first have

android - Load Bitmap on BaseAdapter -

hi want load resource drawable in bitmap type @ baseadapter error bitmap bm = bitmapfactory.decoderesource(getresources(), r.drawable.messenger); the getresource() need make function on java file. how it? pass activity instance base adapter first , change function bitmap bm = bitmapfactory.decoderesource(activity.getresources(), r.drawable.messenger);

soap - Digest authentication using ksoap2-android-assembly-2.5.8-jar-with-dependencies.jar in android -

i want implement digest authentication on ksoap 2 library in android. my code:: try { responsevector = null; soapobject request = new soapobject(wsdl_target_namespace, method_name); (int = 0; < property_key.length; i++) { request.addproperty(property_key[i], property_value[i]); } system.out.println("input::" + request); soapserializationenvelope envelope = new soapserializationenvelope( soapenvelope.ver11); envelope.setoutputsoapobject(request); httptransportse androidhttptransport = null; sslconnection.allowallssl(); androidhttptransport = new httptransportse(url_location); list<headerproperty> headerlist = new arraylist<headerproperty>(); string ha1=convertpassmd5("abhishek:realm:123456"); uri myuri = uri.parse(url_location); string uri=method_name+":"+myuri; str

c++ - Copy exe file to Qt build directory -

i trying write qt application use qprocess call ffmpeg.exe convert media files. cannot figure out best way make sure ffmpeg.exe file gets copied development directory build directory built (and later deployed) application have access it. i have seen information using installs parameter in .pro file ( https://stackoverflow.com/a/13168287 ) qmake docs say: note qmake skip files executable. with of above said, how should 1 go making sure exe file want use qprocess ends in build directory (ready deployed later)? you can use qmake_post_link execute copy command when application built. put in .pro file : win32:{ file_pathes += "\"$$pwd/path/to/files/ffmpeg.exe\"" config(release, debug|release):{ destination_pathes += $$out_pwd/release/ destination_pathes += path/to/deploy/directory } else:config(debug, debug|release):{ destination_pathes += $$out_pwd/debug/ } for(file_path,file_pathes){

mysql - SQL percentage aggregation over group by clause -

i have table gives following sql query inputs gives. select server, count(*) servernames server not null , server != '' , timestamp >= '2015-03-18' , timestamp <= '2015-04-19' group server; server | count(*) _________________ server1 1700 server2 1554 select server, ip_address, count(*) servernames server not null , server != '' , ip_address not null , ip_address != '' , timestamp >= '2015-03-18' , timestamp <= '2015-04-19' group server, ip_address; server | ip_address | count(*) ______________________________________ server1 sample_ip_1 14 server2 sample_ip_2 209 server1 sample_ip_2 100 server1 sample_ip_1 50 i finding difficulty in writing query calculates percentage within group . instance in example output should be. server | ip_address | count(*) | percent ________________________________________________ server1 sample_ip_1 14 0.

Queues in Laravel 4.2 -

i working in project developed on laravel 4.2. not able idea queuing service of laravel. have read many documents still things not clear. should compare queue , cron job ? when put cron job on server, mention time when cron run. in case of queue not find place time of run mentioned. there files in app/command directory , code running on server helpless find time of run or how stop these queues. please guide me problem. queue service add tasks later. generally ask other service provider iron.io call application have task processes asynchronously , repeat call if fails first time. allows respond application user , leave task processed in background. if use local sync driver task done during same request.

verilog - Difference between Behavioral, RTL and gate Level -

i'm trying understand differences between abstraction levels of verilog, description of each level says still can't on play. for case, paste verilog codes , think them: the following code in behavioral level. always @ (a or b or sel) begin y = 0; if (sel == 0) begin y = a; end else begin y = b; end end this (just example) in gate level module test(clk, ready, next, q); input clk, enable, next; output q; \**seqgen** reg_1 (.clear(1'b0), .next_state(next), .clocked_on(clk), .q(q), .synch_enable(enable) ); endmodule i don't know if code in rtl or gate level ( expect keyword make rtl , not gate level ) module dff_from_nand(); wire q,q_bar; reg d,clk; nand u1 (x,d,clk) ; nand u2 (y,x,clk) ; nand u3 (q,q_bar,x); nand u4 (q_bar,q,y); // testbench of above code initial begin $monitor("clk = %b d = %b q = %b q_bar = %b",clk, d, q, q_bar); clk = 0; d = 0; #3 d = 1; #3 d = 0;

Filtering a json object using Swift's Map api and Objective-c's valueForKeyPath -

given http://jsonplaceholder.typicode.com/users for simplicity here abridged version of json var userdict: [[string, string]]? <-- string json converts foundation , saved here // json [{ "address" : { "geo" : { "lat" : "-37.3159" } } }] i trying array of lat latitude of of geographical point of address. have 2 choices, swift or objective-c i can array of lat using old valueforkeypath: method var keypathlatitude: [string] = (userdict! nsarray).valueforkeypath("address.geo.lat") as! [string] // objective-c api which give me ["-37.3159"] array 1 element. having difficulty doing swift's map api var maplatitude: [string] = userdict!.map({$0["address"]?["geo"]["lat"] as! string}) // <-- not this. want ["-37.3159"] result. update var maplatitude: [string] = userdict!.map({$0["address"]?["geo"]??["lat"] as! strin

/** and /* in Java Comments -

what's difference between /** * comment * * */ and /* * * comment * */ in java? when should use them? the first form called javadoc . use when you're writing formal apis code, generated javadoc tool. example, the java 7 api page uses javadoc , generated tool. some common elements you'd see in javadoc include: @param : used indicate parameters being passed method, , value they're expected have @return : used indicate result method going give back @throws : used indicate method throws exception or error in case of input @since : used indicate earliest java version class or function available in as example, here's javadoc compare method of integer : /** * compares 2 {@code int} values numerically. * value returned identical returned by: * <pre> * integer.valueof(x).compareto(integer.valueof(y)) * </pre> * * @param x first {@code int} compare * @param y second {@code int} compare * @return val

visual studio 2013 - Automatically upload local changes into windows azure / amazon s3 cloud server -

i have create visual studio project following functionality, once project created, service should automatically upload project files in cloud storage (using windows azure or amazon s3 server). if changes in project files, instead of uploading whole project, modified files has uploaded. ( svn commit). could please let me know if have ideas on this? what describe more-or-less "git deployment" - deploying changes web site or application pushing changes local git repository remote one. deployment triggers service or script on remote repository updates site. azure supports azure web sites. see example continuous deployment using git in azure app service step-by-step guid on how create new site, deploy , update using git. the engine automates git deployments in azure available open source project, project kudu can hosted outside azure, eg on own web server. amazon doesn't offer all of out of box. elastic beanstalk offering allows publish asp.net mv

multilanguage - Need solution to make multi-language website using codeigniter, that contents from database should also convert into selected language -

i want implement option multi-language on website. using codeigniter framework, , implement codeigniter language library convert labels desire language. want website should able convert contents database desired language. how can that? thanks. have on tutorial. creating multilingual website using codeigniter

javascript - $scope.$apply slows down performance -

i have single page application using angularjs , facing 1 performance issue in it. application processes incoming events server side passed angularjs framework on client side using asp.net signalr. there millions of events can received application , there no performance issue on server side , passes these number of events 1 after other angularjs framework. problem lies on client side. after processing event, use $scope.$apply() update page , display events. in such case there multiple events being received 1 after other, calling $scope.$apply() every time slows down application , not show events quickly. events passed @ random don't know how events received application @ point in time. any ideas on how issue resolved helpful. thanks. instead of using $scope.$apply() , use $scope.$evalasync() instead. from docs: executes expression on current scope @ later point in time. the $evalasync makes no guarantees when expression executed, that: it

javascript - jQuery validation message issue -

Image
i have 3 input radio buttons like <input type="radio" name="specific_parent" id="parent_one" class="radio" value="existing_parent"><label class="redio_label" for="existing_parent">existing parent</label> <input type="radio" name="specific_parent" id="parent_two" class="radio" value="prospective_parent"><label class="redio_label" for="prospective_parent">prospective parent</label> <input type="radio" name="specific_parent" id="parent_third" class="radio" value="other"><label class="redio_label" for="other">other</label> i have applied jquery validation this: rules: { specific_parent: { required: true } }, messages: { specific_parent: { required: 'please select radio button' } } problem

css - Nested Rows in Bootstrap with alternating padding -

i have layouting needs different padding div container of class "row". example that <div class="row row-no-padding"> <div class="col-md7"> test content </div> <div class="col-md5"> <div class="row"> <div class="col-sm-6"> <div class="form-group form-group-default"> {!! form::label('ticket_reference', 'ticket referenz') !!} {!! form::text('ticket_reference', null, ['class' => 'form-control']) !!} </div> </div> <div class="col-sm-6"> <div class="form-group form-group-default"> {!! form::label('eldis_reference', 'eldis referenz') !!} {!! form::text('eldis_reference', null, [&

android - Confirmation login dialog does not appear in facebook api, google+ api, vk api -

my question little broad, in case had same possible. after first launch facebook, google+ , vk.com asked me confirm requested permission (for example, facebook: "public_profile, email, user_friends"). every next time confirmation dialog did not appear. cleared cache, reinstalled app, still nothing. maybe lost something? or facebook remembered device , doesn't ask confirmation second time? still have information requested, without confirmation. google+ doesn't open activity , straight away shows me result. example facebook code. my grahrequest same in docs of facebook api , execute in onsuccess() callback added loginmanager . permissions set loginmanager aswell as: loginmanager..getinstance().loginwithreadpermissions(...) . graphrequest request = graphrequest.newmerequest( accesstoken, new graphrequest.graphjsonobjectcallback() { @override public void oncompleted( jsonobject object, graphresponse response

plugins - Wordpress website producing errors -

i have developed wordpress ecommerce website producing errors , preventing website functioning it's full potential, error code has been provided below: warning: division 0 in /home1/sandgco/public_html/wp-content/plugins/woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php on line 373 warning: division 0 in /home1/sandgco/public_html/wp-content/plugins/woocommerce-table-rate-shipping/woocommerce-table-rate-shipping.php on line 415 i have feeling error may occuring because of way in plugin has been set up. does have idea why getting error? the division 0 means enabled volumetric shipping without defining volumetric divisor. required field work, otherwise volumetric weight 0 , physical weight therefor win out.

android - Dynamic broadcast receiver registration doesnt work for Intent MEDIA_MOUNTED -

statically linked broadcast receiver works fine for android.intent.action.media_mounted android.intent.action.media_unmounted but when trying register dynamically doesn't work, suggestion ? @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); log.d( tag, "oncreate" ); cardreceiver = new cardreceiver(); filter1 = new intentfilter(); filter1.addaction(intent.action_media_mounted); filter1.addaction(intent.action_media_unmounted); this.getapplicationcontext().registerreceiver(cardreceiver, filter1); } @override protected void ondestroy() { super.ondestroy(); log.d( tag, "ondestroy" ); this.getapplicationcontext().unregisterreceiver(cardreceiver); } public class cardreceiver extends broadcastreceiver { private static final string card_log = "isdcard"; @override public void onreceive(context context

postgresql - How can I access my localhost from my Android device -

how can access localhost android device using fedora 21 , me android device nexus 5, can explain me step step path of connection. article [postgresql not connecting android using jdbc throwing org.postgresql.util.psqlexception: connection attempt failed i change file: pg_hba.conf # ipv4 local connections: host 10.0.2.2 trust postgresql.conf: listen_addresses = '*' # ip address(es) listen on; # comma-separated list of addresses; # defaults 'localhost'; use '*' # (change requires restart) port = 5432 # (change requires restart) max_connections = 100 but not me.... it's me java - jdbc source: @override protected void doinbackground(void... arg0){ try { log.d("start connection","

cocoa - Resize NSImage in custom NSTextFieldCell -

Image
i created drag , drop app using apple's example: https://developer.apple.com/library/mac/samplecode/sourceview/introduction/intro.html i load actual image of dragged file. when drag example image file nsoutlineview , see resized in way: i used without modifications apple's imageandtextcell class custom nstextfieldcell. how can resize image fit proportionally cell rect? works perfect. @implementation nsimage (proportionalscaling) - (nsimage*)imagebyscalingproportionallytosize:(nssize)targetsize { nsimage* sourceimage = self; nsimage* newimage = nil; if ([sourceimage isvalid]) { nssize imagesize = [sourceimage size]; float width = imagesize.width; float height = imagesize.height; float targetwidth = targetsize.width; float targetheight = targetsize.height; float scalefactor = 0.0; float scaledwidth = targetwidth; float scaledheight = targetheight; nspoint thumbnailpoint = nszeropoint; if ( nsequ

ruby - linux webrick rails server could not start -- some errors -

i've installed ruby, rails , mysql2 on linux (ubuntu 14.04). issue when run rails server following errors /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs/runtimes.rb:48:in `autodetect': not find javascript runtime. see https://github.com/rails/execjs list of available runtimes. (execjs::runtimeunavailable) /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:5:in `<module:execjs>' /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/execjs-2.5.2/lib/execjs.rb:4:in `<top (required)>' /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `require' /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/uglifier-2.7.1/lib/uglifier.rb:3:in `<top (required)>' /home/sharif/.rbenv/versions/2.2.2/lib/ruby/gems/2.2.0/gems/bundler-1.9.4/lib/bundler/runtime.rb:76:in `require' /home/sharif/.rbenv/vers

backup - How do I restore deleted documents from shared Google Drive folders? -

a non-privileged google drive user has accidentally removed large number of files folders shared across organisation. not have permission delete files entirely, because not owner. however, users edit permissions able remove file shared folder. returns user owner, seems leave file orphaned without parent folder. the files owned various different users. how restore these files correct folders? google drive audit log not contain enough information restore folders correctly - parent folder id not included "remove folder" event. google drive included in reports api of google apps admin sdk. provides similar information google drive audit log, additional metadata. includes parent folder id of files removed. to restore files should first query reports api files removed user in question on relevant time period, using activities:list method. then you'll need setup google apps service account (which little confusing), allow impersonate owners of documents re

java - spark hive and datanucleus -

in java spark (&spring) project, used sparkhivecontext , got initial error classnotfoundexception: org.datanucleus.api.jdo.jdopersistencemanagerfactory when doing: // sparkhivecontext = new javahivecontext(sparkcontext); // javardd<myclass> myrdd = ... javaschemardd schema = sparkhivecontext.applyschema(myrdd, myclass.class); schema.registertemptable("temptable"); sparkhivecontext.sql("create table mytable select * temptable"); so added ̀ datanucleus-core datanucleus-api-jdo , datanucleus-rdbms maven dependencies, version 3.2.1. but error ...nosuchmethoderror: org.datanucleus.flushordered . the strange thing find class in datanucleus-core-3.2.1.jar in generated war web-inf/lib. , in no other jar of war. does have idea how happen? details: maven project spark 1.1.1 (with provided scope) include $spark_home/lib/spark-assembly-1.1.1-hadoop2.4.0.jar servlet container use maven jetty plugin run (i.e. servlet container) it worked befo