Posts

Showing posts from February, 2014

how to sync windows time from a ntp time server in command -

i working on windows 7. can sync time of win7 ntp linux server manually. how can in command prompt. can run on windows startup. , windows task plan not work me. time should this: linux server --> windows 7. any 1 knows that? thank you. can read msdn. use net time net time \\timesrv /set /yes after comment try 1 in evelated prompt : w32tm /config /update /manualpeerlist:yourtimerserver

android - XYZ to LLA returns latitude in range -180 - 180 instead of -90 - 90 -

i'm working on 3d globe country picking. represented sphere radius equals 1. when user tap screen i'm getting point using ray object picking technique , i'm trying conwert lat, long nex way: double alt = 1; double lat = math.todegrees(math.atan2(y, x)); double lon = math.todegrees(math.acos(z/alt)); this code returns latitude in range -180 - 180 degrees google geocoder says should in range -90 - 90 degrees. how can fix ? use atan2 longitude , asin latitude. double alt = math.sqrt(x*x+y*y+z*z); double lon = math.todegrees(math.atan2(y, x)); double lat = math.todegrees(math.asin(z/alt));

c - Sorting an array of pointers -

am right in thinking fine treat pointer int purposes of sorting array of pointers, e.g. qsort(ptrs, n, sizeof(void*), int_cmp); i want sort ptrs ascertain whether there duplicates, irrespective of type of thing pointer pointing to, qsort precursor doing that. my int_cmp() pretty standard, e.g. int int_cmp(const void *a, const void *b) { const int *ia = (const int *)a; // casting pointer types const int *ib = (const int *)b; /* integer comparison: returns negative if b > , positive if > b */ return *ia - *ib; } it seems work in unit-tests there reason why considering ptr int may cause problems such scenario may have overlooked? no, you're not right @ all, unless want sort pointers address. actual address has meaning though, that's unlikely. for detecting duplicate pointers, should compare pointers such, that's well-defined. i go solution using uintptr_t : static int order_pointers(const void *pa, const void *pb) { ...

How to implement a decision matrix/table in Clojure -

there requirement implement decision table below: membertype amount => discount "guest" > 2000 => 3% "silver" => 5% "silver" > 1000 => 10% "gold" => 15% "gold" > 500 => 20% i imagine, if implemented in clojure, can define rule table below: (defrule calc-discount [member-type amount] "guest" (greater-than 2000) => 0.03 "silver" (anything) => 0.05 "silver" (greater-than 1000) => 0.1 "gold" (anything) => 0.15 "gold" (greater-than 500) => 0.2 ) of course, there should better way in writing/defining such rule set. yet key thing think how define "defrule" make happen? for example, can express business logic rather concisely condp . (defn discount [member-type am...

javascript - How to pass variable to named function with angular $on? -

i have created following listener: scope.$on('location', updatemap) this worked great, updatemap needs take variable: function updatemap(request){ ... } i need pass variable request: var request = { origin: origin, destination: new_destination, travelmode: google.maps.directionstravelmode[attrs.type], }; how pass variable request named function? it's job of broadcast/emit event send arguments listeners, so: scope.$broadcast('location', request); scope.$emit('location', request); or if want call updatemap parameter need call within listener function: scope.$on('location', function() { updatemap(request); });

java - Is this a convenient way of running code in a background thread and return a result via a callback executed in the calling thread? -

in last days have found myself using approach asynchronously performing long operation (several seconds), , return value via callback must execute on caller thread, typically but not necessarily ui thread. public abstract class dosomethingcallback { public abstract void done(object result); } public void dosomething(final object param, final dosomethingcallback dosomethingcallback) { // instantiate handler calling thread final handler handler = new handler(); // start running long operation in thread new thread(new runnable() { @override public void run() { // long operation using "param" input... object result = longoperation(param); // return result via callback, run in caller thread handler.post(new runnable() { @override public void run() { dosomethingcallback.done(clearbytes); } }); } })....

javascript - Change button colour -

my idea show image on map press button. change colour of button after has been clicked , should stay colour until deselect button. colour of button should change original colour. here code button: <button type="button" class="button" id="tram7" class="deselected"> tramlinie 7 </button> and here function inserts image map: $('#tram7')[0].onclick = function() { if (overlaytram7.getmap() == map) { $('#tram7').addclass('deselected'); overlaytram7.setmap(null); } else { $('#tram7').removeclass('deselected'); overlaytram7.setmap(map); } }; the style change worked hover, don't know how change style of clicked button. .button { font-family: calibri, sans-serif; font-size:13px; font-weight: bold; width: 160px; height: 25px; background:grey; color: white } .button:hover { color: white; background:green } thanks in advance. ...

c++ - std::map iterate and delete valgrind errors -

i have simple program deletes items in std::map while iterating on map. if not wrong forward iterators not invalidated erase in map. valgrind throws invalid read errors. can explain why. #include <map> #include <iostream> typedef std::map<std::string, int> sourcemap; int main(int argc, char *argv[]) { sourcemap sourcemap; sourcemap["item1"] = 1; sourcemap["item2"] = 2; sourcemap["item3"] = 3; sourcemap["item4"] = 4; for(sourcemap::const_iterator it=sourcemap.begin(); != sourcemap.end(); ++it) { sourcemap.erase(it->first); } } valgrind errors: ==31703== invalid read of size 8 ==31703== @ 0x3851069e60: std::_rb_tree_increment(std::_rb_tree_node_base*) (in /usr/lib64/libstdc++.so.6.0.13) ==31703== 0x4013d6: std::_rb_tree_const_iterator<std::pair<std::string const, int> >::operator++() (stl_tree.h:259) ==31703== 0x40106b: main (map_iterator.cpp:14) ==31703=...

c# - Stuck in MVC4 while following MVC3 tutorial for MVCmusicstore -

i following mvc 3 music store tutorial mvc in mvc4 , have gotten stuck . went until came in stage used sampledata.cs mvcmusicstore-assets , made changes in global.ascx.cs instructed in tutorial. error appears in sampledata.cs says: "cannot implicitly convert type 'string' 'int' "and "operator '==' cannot applied operands of type 'int' , 'string'" with lack of experience in mvc, not figure out made simple , blunder mistake or there taken care of while doing mvc3 projects tutorial in mvc4. i forward reply.

ios - 301 redirect works great, Except on iPad? -

doing 301-redirect using php redirect homepage , html refresh other pages: example of html redirect page: <meta http-equiv="refresh" content="0; url=http://northernarchitecturalsystems.com/projects_product.html"> and using php homepage: <?php header( "http/1.1 301 moved permanently" ); header( "location: http://www.northernarchitecturalsystems.com" ); exit(0); ?> i'm permanently moving http://northernbuildingproducts.com/ http://northernarchitecturalsystems.com like said in title, looks , works great. except when use ipad. testing other tablets stumped. i've tried use htaccess, php, & html refresh. work on desktop , phone images break when using ipad. not clue? help appreciated.

JSON insert error, Sqlite3, Python -

i trying insert raw json strings sqlite database using sqlite3 module in python. when following: rows = [["a", "<json value>"]....["n", "<json_value>"]] cursor.executemany("""insert or ignore features(uid, json) values(?, ?)""", rows) i following error: sqlite3.programmingerror: incorrect number of bindings supplied. current statement uses 2, , there 48 supplied. how can insert raw json table? assume it's commas in json string. how can around this? second argument passed executemany() has list of touples, not list of lists: [tuple(l) l in rows] from sqlite3 module documentation: put ? placeholder wherever want use value, , provide tuple of values second argument cursor’s execute() method. the same applies executemany() .

java - JSF - update component by ApplicationScoped Bean? (Communication between clients) -

i have application-scoped bean hashmap of view-scoped (or session-scoped) beans in it. so when application bean 'decides' change specific value in specific view or session bean thats not problem... but dont know how can automatically update involved html-components. i cant use facescontext or requestcontext because command comes client ... of cause use second thread each client check if value has been changed. im pretty sure thats quite dirty. there implemented interfaces, listeners or something? whats best way solve problem? or there better way let useres communicate each other or send global commands

sitecore - Perform logic when specific template is published -

i have template set need perform logic on when it's published. when item based on template published want me perform basic crud operations on table in external database in sync. that's kind of beside point. what have set right new processor in publishitem pipeline. i've found can access publishitemcontext.publishoptions.rootitem access template, can compare on , perform logic necessary. problem called deep publishes. i'm seeing processor firing root item, not of sub items. so, questions if there way access every item that's being published, not root item? a co-worker suggested grab timestamps @ beginning of pipeline , end, , use historymanager check on has changed... seems pretty heavy-handed me. can't feel there ought property or setting nested in here somewhere can access that's being published. i'd appreciate assistance folks can offer. oh, we're on version 6.5 project, i'm sure that'll relevant. looks you'll wan...

ios - UISearchBar results not acting right -

i'm having weird issue after implemented uisearchbar tableview . after performing search, results displayed no problem below search bar. when try , select item, item stays highlighted, , doesn't shift screens. if hit cancel results vanish, , table view empty. weird. but if select item list, hit cancel, searchbar disappears , results present , can select them , see additional information... whats going on?? i've looked on , can't find solution. i'm not sure code may acting up, if need example, let me know. thanks - (nsinteger)numberofsectionsintableview:(uitableview *)tableview { // return number of sections. return 1; } - (nsinteger)tableview:(uitableview *)tableview numberofrowsinsection:(nsinteger)section { // return number of rows in section. return [gamesearcharray count]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { //static nsstring *cellidentifier = @"cell"; //uita...

ruby on rails - Mongoid Model.find fails in spec, but works in app -

next line: user.find(session[:user_id]) in session[:user_id] defined: session[:user_id] = user.id in spec works fine , returns user model, in real app (development mode) fails: moped: 127.0.0.1:27017 query database=rails_api_development collection=users selector={"_id"=>{"$oid"=>bson::objectid('533c3958616c641142010000')}} flags=[] limit=0 skip=0 batch_size=nil fields=nil runtime: 1.0680ms completed 500 internal server error in 15ms moped::errors::queryfailure - operation: #<moped::protocol::query @length=89 @request_id=2 @response_to=0 @op_code=2004 @flags=[] @full_collection_name="rails_api_development.users" @skip=0 @limit=0 @selector={"_id"=>{"$oid"=>bson::objectid('533c3958616c641142010000')}} @fields=nil> failed error 10068: "invalid operator: $oid" see https://github.com/mongodb/mongo/blob/master/docs/errors.md details error.: moped (2.0.0.rc1) lib/...

c# - How to find out what keyword has been used for local variable declaration? -

how find out keyword has been used declaring local variable? how differentiate between following: var hi = "asdf"; string hi = "asdf"; also, there comprehensive api documentation available writing roslyn diagnostics? has written book on yet? look @ type property of localvariabledeclarationsyntax . in 1 case predefinedtypesyntax , , in other namedtypesyntax name happens "var". remember, "var" contextual keyword, , isn't known special in syntax layer. note: highly recommend installing syntaxvisualizer extension in roslyn sdk zip see parser various bits of text.

Android child activity on Back Pressed Restart Parent activity -

android child activity on pressed restart parent activity. have 1 tab project.it has 3 tab contact,home , menu. in menu activity has child activity subcategory , product. want update menu activity text view pressed subcategory. please can't updated text view text after click button on pressed. please thankyou animatedactivity pactivity = (animatedactivity) this.getparent(); intent intent = new intent(this,menuactivity.class); pactivity.finishchildactivity(intent);

sql server - T-SQL - Do more conditions help the query proceed faster? -

lets consider simple table 2 relevant columns: bit isdownloaded not null datetime datedownloaded null i know isdownloaded 1 when datedownloaded has value (this example understand isdownloaded not neccessary then). is there performance difference between: select * files isdownloaded = 1 , datedownloaded not null , datedownloaded > '2010-01-01' and select * files datedownloaded not null , datedownloaded > '2010-01-01' therefore to: add "easier evaluate" conditions (such conditions on boolean datetypes) add mode conditions in general consider there no indexes applied on columns. tl;dr indexes, , selectivity of query. in case above, ensuring there index on datedownloaded drive performance of query - is not null , isdownloaded checks won't (if flag correlated date). explanation no indexes @ all, there no alternative sql other iterate through rows in table evaluating predicate (full scan). with index ...

javafx - Default label in FlowPane -

i have flowpane many borderpanes windows. display water mark or label <empty> when flowpane empty. is there solution? have tried this: flowpane flowpane = ... ; stackpane container = new stackpane(); label placeholder = new label("no content in flow pane"); placeholder.visibleproperty().bind(bindings.isempty(flowpane.getchildren())); container.getchildren().addall(flowpane, placeholder); then, obviously, add container ui added flow pane.

c# - Thread - safe singelton -

i have class has 3 static members. each of static member not thread-safe singleton. need provide thread safe implementation use.is ok?or need provide thread-safe wrapper each of them? if should - how can using lazy<t> ? additional question : measure() , do() of singeltonclass1/2/3 not thread-safe func1() thread-safe? public class mylazysingleton { // static holder instance, need use lambda construct since constructor private private static readonly lazy<mylazysingleton> _instance = new lazy<mylazysingleton>(() => new mylazysingleton()); // private prevent direct instantiation. private mylazysingleton() { s_c1 = singletonclass1.instance(); s_c2 = singletonclass2.instance(); s_c3 = singletonclass3.instance(); } // accessor instance public static mylazysingletoninstance { { return _instance.value; } } public void func1() ...

r - Extracting the numerical values of a xts object -

i want extract numerical values of xts object. let's @ example data <- new.env() starting.date <- as.date("2006-01-01") nlookback <- 20 getsymbols("ubs", env = data, src = "yahoo", = starting.date) reg.curve <- rollapply(cl(data$ubs), nlookback, mean, align="right") the reg.cuve still xts object i'm interested in running means. how can modify reg.curve numerical vector? use coredata : reg.curve.num <- coredata(reg.curve) # or, if want vector: reg.curve.num <- drop(coredata(reg.curve))

php - Sending MMS messages based on user interaction? -

i trying build app loosely based on code given in link: https://www.twilio.com/help/faq/sms/how-do-i-build-a-sms-keyword-response-application question how can make sends mms messages sender instead of sms? want able send .gifs , .jpegs url link, without having go link. i'm writing in php if helps. i've found lot of resources sms, material mms seems sparse. appreciated. twilio evangelist here. i'd start checking out sending messages docs in our rest api documentation. new message endpoint single resource in our api lets send either sms or mms without having care is. if have media attached, send mms, otherwise , sms. specifically, this example shows using php helper library how send message includes both text body , image. hope helps.

How to model Go bindings to C structs that use unions? -

i'm writing go wrapper libfreefare . api of libfreefare contains following function: struct mifare_desfire_file_settings { uint8_t file_type; uint8_t communication_settings; uint16_t access_rights; union { struct { uint32_t file_size; } standard_file; struct { int32_t lower_limit; int32_t upper_limit; int32_t limited_credit_value; uint8_t limited_credit_enabled; } value_file; struct { uint32_t record_size; uint32_t max_number_of_records; uint32_t current_number_of_records; } linear_record_file; } settings; }; int mifare_desfire_get_file_settings (mifaretag tag, uint8_t file_no, struct mifare_desfire_file_settings *settings); what ideomatic solution wrapping such function? if struct mifare_desfire_file_settings wouldn't contain unions, wrapper this: type desfirefilesettings struct { // fields exported, no methods } func (t desfiretag) filesettings(fi...

c++ - Reverse Collatz sequence code not computing -

using c++, writing program take first n numbers starting @ 1 , output respective "path count", call number of iterations of collatz sequence takes number 0 (see wikipedia article on collatz conjecture). example, path number of 8 3, because takes 3 steps 1 (8 : 2 = 4; 4 : 2 = 2; 2 : 2 = 1). thus have simple function: int pathnumber(int n){ int pathcount = 0; while(n > 1){ if(n % 2 == 0){ n /= 2; }else{ n *= 3; n ++; } pathcount ++; } return pathcount; } i decided write inverse function of (called firstinstanceof(n)), compute first instance of given pathnumber in ascending order 1. example, firstinstanceof(3) 8, because 8 first number in ascending order 1 pathcount 3. function wrote follows: int firstinstanceof(int s){ int = 0; while(pathnumber(i) != s){ ++; } return i; } where s input value , variable increments 1 each time. simple seems, code compiles ...

d3.js - why does one chart not filter another in dc.js? -

i not able understand how dc groups chart. change in 1 filter reflects in others. have simple code 2 series charts. when draw brush on one, not filter other. not sure why ? can please have quick @ small code , suggest. d3.csv("data/comparedata.txt", function(data) { ndx = crossfilter(data); rundimension = ndx.dimension(function(d) {return [+d3.time.format.iso.parse(d.timestamp), +d.meterid]; }); frequencygroup = rundimension.group().reducesum(function(d) { return +d.frequency; }); magnitudegroup = rundimension.group().reducesum(function(d) { return +d.magnitude; }); frequencychart .width(768) .height(480) .chart(function(c) { return dc.linechart(c).interpolate('basis'); }) .x(d3.time.scale().domain([1366621166000, 1366621179983])) .y(d3.scale.linear().domain([90, 100])) .brushon(true) .yaxislabel("measured speed km/s") .xaxislabel("run") .elasticy(true) .dimension(rundimension) .group(f...

How to convert a xml symfony services file into yaml -

i'm trying adapt bundle : https://github.com/astepanov/redactorbundle because need make imperavi image upload work not updated anymore... right i'm trying adapt services file yaml because can't import xml yaml file. <parameters> <parameter key="redactor.service.class">stp\redactorbundle\model\redactorservice</parameter> </parameters> <services> <service id="redactor.service" class="%redactor.service.class%"> <call method="setcontainer"> <argument type="service" id="service_container" /> </call> </service> <service id="form.type.redactor" class="stp\redactorbundle\form\type\redactortype"> <argument type="service" id="redactor.service" /> <tag name="form.type" alias="redactor" /> </service> </ser...

vector - C++ push_back method -

i don't understand why error in definition of methode "add". here code: enum colour {empty = 0, red, yellow}; class game{ public: void add(size_t, colour const&); private: vector<vector<colour>> tab; }; void game:: add(size_t column, colour const& colour) { tab[0][column].push_back(colour); } if tab uninitialized cannot access index in tab[0][column].push_back(colour); .

stored procedures - Subquery returned more than 1 value. This is not permitted when the subquery follows =, !=, <, <= , >, >= or when the subquery -

declare @productdetails table(productname nvarchar(200),productdescription nvarchar(200), brand nvarchar(200), categry nvarchar(200), grop nvarchar(200), mrp decimal,salesrate decimal,currentquantity decimal,availableqty decimal) declare @availableqty table(prcode nvarchar(100),aqty decimal) declare @closestock table(pcode nvarchar(100), cqty decimal) insert @closestock select pcode , 0.0 producttable insert @availableqty select pcode , 0.0 producttable --current qty --openqty update @closestock set cqty=((ooqty+qty+srrqty+pyqty)-(stqty+prrqty)) ( select pc.pcode productcode, --opening (select case when sum(pu.quantity)is null 0 else sum(pu.quantity) end q productopeningyearend pu pc.pcode=pu.productname) ooqty, --purchase (select case when sum(pu.quantity)is null 0 else sum(pu.quantity) end q purchase pu pc.pcode=pu.prdcode ) qty, --sales (select case when sum(st.quantity)is null 0 else sum(st.quantity)end q2 salestable st pc.pcode=st.productcode , st.status!='cancel...

javascript - chrome extension: saving data attribute in background from popup -

background.js function getframe() { // popup.js can access background's frame function return $('iframe')[0]; } function updatestatus(status) { // popup.js should call function update frame's status var frame = $('iframe')[0]; $(frame).data('status', status); } popup.js ..dom ready var bg = chrome.extension.getbackgroundpage(); ('.hello').click(function () { bg.updatestatus('ready') } // <assume above event has been triggered here> var frame = bg.getframe(); console.log($(frame).data('status')) // undefined <- however, result i trying store status in background's frame retrieve when popup re-opens. however, above result. explain why happening? missing data attributes? i figured out solution. instead of retrieving frame element popup , had following: background.js function getstatus() { // popup.js must retrieve current status way // $(bg.getframe()).data('status') ba...

c - How to improve speed of saving serial data to file in Python -

i'm trying implement ramdump pc program can of ram data smart phone. code works, slow because of file writing. how can improve file-writing speed in python? this part of code receive serial data: while recv_num < tot_num: remain_num = tot_num - recv_num in range(512): data = receive_qword() # result=ser.read(size=8) f.write(data) recv_num = recv_num + 512 i have ramdump program written in c, , working on converting python. in c code function f_write(fil, ptr, size * count, &bwrite) works rapidly , seems operate bulk steam. is there mechanism in python equivalent c mechanism? try this import array while recv_num<tot_num: remain_num=tot_num-recv_num buffer = bytearray() in range(512): buffer.extend(receive_qword()) # result=ser.read(size=8) f.write(buffer) #yep, after loop. recv_num = recv_num + 512 and sure need read in 8-packs? why not ser.read(512) ?

Parametrise where clause in SQL Server 2008 R2 -

i want pass parameter of stored procedure where clause c#. have declared parameter @whereclause nvarchar(max) , in query have given this select distinct clfiik.adid ,clfiik.adgivername ,clfiik.adgiveremail ,clfiik.title ,left(clfiik.descripton,200) +'...' descripton -- select 200 caharacter , after 200 char add ... , case when clfiik.type = 1 -- wanted events 'wanted event' when clfiik.type = 1 -- offering events 'offering event' else -- neither wanted no offering events 'no event yet' end type ,case when datediff(hour, publisheddate, getdate()) < 24 case datediff(hour, publisheddate, getdate()) when 1 convert(varchar, datediff(hour, publisheddate, getdate())) + ' hour ago' else convert(varchar, datediff(hour, pub...

Python Identation error -

i cant figure out wrong code..it showing error: "unindent doesnt match outer indentation level have checked using python -m tabnanny paint.py...it showing this: "identation error: unident not match outer level((tokensize>,line26>" can't understand what say..please me. #paint.py import sys,pygame import os pygame.locals import * pygame.init() screen = pygame.display.set_mode((1000,600)) screen.fill((255,255,255)) brush = pygame.image.load(os.path.join('c:\python27','brush.png')) brush = pygame.transform.scale(brush,(128,128)) pygame.display.update() clock = pygame.time.clock() z = 0 while 1: clock.tick(60) x,y = pygame.mouse.get_pos() event in pygame.event.get(): if event.type==pygame.quit: sys.exit() elif event.type == mousebuttondown: z=1 elif event.type == mousebuttonup: z=0 if z==1: screen.blit(brush,(x-64,y-64)) pygame.display.update() there several places missin...

When would you use .git/info/exclude instead of .gitignore to exclude files? -

i bit confused pros , cons of using .git/info/exclude , .gitignore exclude files. both of them @ level of repository/project, how differ , when should use .git/info/exclude ? the advantage of .gitignore can checked repository itself, unlike .git/info/exclude . advantage can have multiple .gitignore files, 1 inside each directory/subdirectory directory specific ignore rules, unlike .git/info/exclude . so, .gitignore available across clones of repository. therefore, in large teams people ignoring same kind of files example *.db , *.log . , can have more specific ignore rules because of multiple .gitignore . .git/info/exclude available individual clones only, hence 1 person ignores in clone not available in other person's clone. example, if uses eclipse development may make sense developer add .build folder .git/info/exclude because other devs may not using eclipse. in general, files/ignore rules have universally ignored should go in .gitignore , , othe...

.net - The HTML references my CSS differently based upon deployment machine -

my mvc 4 site adds css files using bundle.config class bundles.add(new stylebundle("~/content/styles").include( "~/content/css/website.css", "~/content/css/banner.css")); on localhost, when view source code, html files render as <link href="/content/css/website.css" rel="stylesheet"/> <link href="/content/css/banner.css" rel="stylesheet"/> i have deployed site live, source code renders 1 line <link href="/content/styles?v=fxcdhaogpdvcroxkmfewgqggo9ucfzckn3pan8boizi1" rel="stylesheet"/> oddly, of css still displays (but images not). i assume issue isn't web.config file since both local , live share same file. my question is, how remove behavior , have live server render html in same way local host? bundling minifies css 1 file, make images work need set bundle ~/content/styles relative actual css set ~/content/css/styles have @ this post i...

java - How to implement JProgressbar for SimpleFileVisitor Class -

i have simple file visitor class scans drives within pc find specific extensions .txt . want display progress of operation jprogressbar . each scan, number of total matched files may change. prevents me calculating percentage of process display on jprogressbar . my code based on this: recursive pattern matching how can calculate , display percentage when total number of files changing? the problem is, not know in advance how many files have. generelly, have option run through file system twice: first time, enter directories , count files. based on number, can calculate percentage on second run, have @ files itself. this enlongates process , again not have progress on first scan. what can do, starting first scan in different thread. assuming pattern matching needs more time counting files, counting faster , can adjust jprogressbar dynamically. start unreliable , become more accurate on time. i guess aproach similar 1 implemented in windows copy mechanism. scan f...

Laravel files refuse to update -

i've run across error have no idea with. thing have view file delete confirmation page working, , tried adding code resulted in regular error. i've tried remove changes did, error saying have class not found (which can assume referring eloquent model, have, , working no more 5 minutes ago). however: "works" of output want detelete. whenever changes in view files, refresh not reflect these changes, @ all. i wondering if has ran similar problems google search did not find helped. (running wamp server) try running php artisan clear-compiled

c++ - Show dialog form not in modal mode -

i have dialog form. call application use code: bool cpointmfc2app::initinstance() { cwinapp::initinstance(); dialog dlg1; dlg1.txt= "notificationtext"; int r= dlg.domodal(); return r; } and don't wont have modal mode - let program go without waiting user input. how make dlg1 show in non modal mode? dialog form: #include "stdafx.h" #include "pointmfc2.h" #include "dialog.h" #include "afxdialogex.h" // dialog dialog implement_dynamic(dialog, cdialogex) dialog::dialog(cwnd* pparent /*=null*/) : cdialogex(dialog::idd, pparent) { } dialog::~dialog() { } void dialog::dodataexchange(cdataexchange* pdx) { cdialogex::dodataexchange(pdx); } begin_message_map(dialog, cdialogex) on_bn_clicked(idok, &dialog::onbnclickedok) end_message_map() // dialog message handlers bool dialog::oninitdialog() { cdialogex::oninitdialog(); setwindowtext(txt); return true; } ...

c programming beginner (arrays) -

the question asks input sentence (up 20 characters). if part of input there contains word bad, replaced ---. example, input bad dog output: --- dog, example input: bade , output: ---e. i able set array. #include <stdio.h> main() { int c, i; int counts[20]; (i = 0; <= 19; i=i+1) { counts[i] = 0; } c = getchar(); while (c!= '\n') { if () } } #include <stdio.h> #include <string.h> int main(){ char sentence[20+1]; char *p; scanf("%20[^\n]", sentence); if(null!=(p = strstr(sentence, "bad"))){//only once!,, memcpy(p, "---", 3); } printf("%s\n", sentence); return 0; }

java - How to prevent P2 to overwrite eclipse.ini -

i'm using eclipse 3.72 (indigo) rcp application. , works fine. i've implemented p2 automated updates. after using p2 updating features eclipse.ini gets overwritten! how can disable that? my customer able change language-settings prog using , -data-param storing specific data "@user.home ...". can't tell him modify eclipse.ini after update placed. advice customer introduce additional program arguments in separate batch file, execute youreclipseproduct.exe: #!/bin/bash youreclipseproduct.exe -data <path> these program arguments have precedence on in youreclipseproduct.ini i not recommend messing p2, since installed ius may need customize .ini file.

Tag Errors Configuring AllJoyn Java Environment on Ubuntu -

i have been able build alljoyn c++ base no issues on ubuntu. however, when attempt configure java environment, receiving following errors: error: no summary or caption table error: element not closed: ul error: tag not allowed here: <a> error: tag not allowed here: <li> when attempting build, receive occasional warning, code appears fine. i take don't have package generating documentation, of necessary pre-requisites appear working correctly. 32-bit ubuntu 13.04 running oracle jdk 1.8.0 alljoyn 14.02.00. does know i'm missing? this version of alljoyn officially supports jdk 1.6. reverting officially supported jdk has corrected issue. answer via georgen here .

networking - Android: SSDP stuck on MulticastSocket.receive() -

tl;dr: ssdp library not receiving datagram. wireshark shows expected(?) traffic. i using android-dlna library support ssdp in android app. goal discover custom ssdp-enabled device, ip address, make restful api calls it. works on ios, having trouble receiving datagram on android. using wireshark , can determine ssdp search goes out, , device returns status ok, loop never gets past receive() method: ssdpsearchmsg search = new ssdpsearchmsg(ssdp.st_contentdirectory); log.e("ssdp", search.tostring()); ssdpsocket sock = null; try { sock = new ssdpsocket(); sock.send(search.tostring()); while (true) { log.e("ssdp", "receive...");//only called once (stuck here) datagrampacket dp = sock.receive(); log.e("ssdp", "datagram received data " + new string(dp.getdata())); } } catch (ioexception e) { e.printstacktrace(); } { log.e("ssdp", "closing socket"); if (so...

python - Remove from list after correct twice and stopwatch -

i'm creating quiz , i'm new python please go easy on me! trying create stopwatch display time taken after quiz has ended , not while still ongoing. tried implementing code using import time import os s=0 m=0 h=0 while s<=60: os.system('cls') print (h, 'hours', m, 'minutes', s, 'seconds' time.sleep(1) if s ==60: m+=1 s=0 elif m == 60: h+=1 m=0 s=o and worked continuously telling time , quiz wouldn't start. want display total time @ end. tips? furthermore, have no idea start this. want implement piece of code when user matches random word correct definition twice, want word disappear (i'd keep definition 3 random definitions listed.) here extract words - h=0 h in range (len(words)): if randomkey == words [x]: position = x word = definitions[position] thanks suggestions given! instead of trying keep track of time passing, record tim...

date - how to popup window using angularjs -

i want dialog comes on button click , ask 2 dates enter , give me days difference on page on label using angularjs. can me on this? i tried using @user3360944 example , works me, how can select multiple items popup , add table on parent page? here code parent template : mainpage.html <div ng-controller="itemctrl" class="modal-body"> <button class="btn btn-default" ng-click="open();">open dialog</button> <div ng-show="selected">{{ selected.name}}</div> </div> popup template : itemselectdlg.html <table class="table table-hover grid"> <thead class="tableheader"> <tr> <th>name</th> <th>type</th> <th>payment</th> </tr> </thead> <tbody> <tr ng-repeat="item in it...

Playback of Streams Are Taking Longer with Android KitKat (AudioTrack + MediaCodec Solution) -

i using mediacodec + audiotrack solution stream mp3 music. working fine until recent kitkat update. kitkat, playback begins after approximately 14-15 seconds, whereas on jellybean taking no more few seconds. has been changed kitkat regarding mediacodec and/or audiotrack? here's log output: 04-07 23:49:33.582: v/chromiumhttpdatasource(8055): chromiumhttpdatasource jni::getjavavm() 04-07 23:49:34.742: i/nucachedsource2(8055): mdisconnectathighwatermark = 0, cacheconfig null(1) 04-07 23:49:34.747: i/nucachedsource2(8055): readat: mismetadataretriever == 0 04-07 23:49:36.477: d/httpbase(8055): [1] network bandwidth = 0 kbps 04-07 23:49:36.477: d/nucachedsource2(8055): remaining (64k), highwaterthreshold (20480) 04-07 23:49:36.477: i/nucachedsource2(8055): readat: waiting end ( player case ) 04-07 23:49:36.477: v/chromiumhttpdatasource(8055): mcontentsize undefined or network might disconnected 04-07 23:49:36.477: v/chromiumhttpdatasource(8055): mcontentsize undefined or network...

asp.net mvc - How to load kendo observable data array from MVC controller? -

i have following kendo observable object: var observable = kendo.observable({ people: [ { name: "john doe" }, { name: "jane doe" }, { name: "jimmy doe" } ], products: [ { name: "table" }, { name: "chair" }, { name: "tomato" } ], animals: [ { name: "dog" }, { name: "cat" }, { name: "monkey" } ] }); can make inner collections load json data directly seperate controllers? yes. need create controller returns json result. make ajax call controllers route , stuff response variable. refer in observable. might on front end: $.ajax("mysite/getstuff").done( function(data){ var observable = kendo.observable(data); }); in case getstuff method on controller needs return json object containing of properties , arrays need this: { people: [array of people], produc...

Show all Elasticsearch aggregation results/buckets and not just 10 -

i'm trying list buckets on aggregation, seems showing first 10. my search: curl -xpost "http://localhost:9200/imoveis/_search?pretty=1" -d' { "size": 0, "aggregations": { "bairro_count": { "terms": { "field": "bairro.raw" } } } }' returns: { "took" : 2, "timed_out" : false, "_shards" : { "total" : 5, "successful" : 5, "failed" : 0 }, "hits" : { "total" : 16920, "max_score" : 0.0, "hits" : [ ] }, "aggregations" : { "bairro_count" : { "buckets" : [ { "key" : "barra da tijuca", "doc_count" : 5812 }, { "key" : "centro", "doc_count" : 1757 }, { "key" : ...

mysql - Restore a database dump in ubuntu server -

my problem backup on desktop of windows , have restore on ubuntu server.so please suggest me command restoring. used mysql -u xxxx -pxxxx database < x.sql cant found file. you need go ubuntu terminal. then type cd /home/{username}/desktop/ here username username machine u can see inside home now u on desktop then type mysql -u xxx -pxxxx database < x.sql

Specifying font for a row in pdf table C# -

itextsharp.text.font font5 = itextsharp.text.fontfactory.getfont(fontfactory.helvetica, 8); itextsharp.text.font redfont = itextsharp.text.fontfactory.getfont(fontfactory.helvetica, 8, itextsharp.text.color.red); //here adding font values in pdf table foreach (datarow r in dt.rows) { if (dt.rows.count > 0) { table.addcell(new phrase(r[0].tostring(), font5)); table.addcell(new phrase(r[1].tostring(), font5)); table.addcell(new phrase(r[2].tostring(), font5)); if((r[3])=="0")------------------------------------------// table.addcell(new phrase(r[3].tostring(), font5)); else table.addcell(new phrase(r[3].tostring(), redfont)); table.addcell(new phrase(r[4].tostring(), font5)); } } document.add(table); when writing condition of if((r[3])=="0") , giving redfont if value of r[3]...

c++ - How to make sure nanosleep working in my system in linux -

i have checked system supporting microsec precision how make system support nanosec precision using boost timer able print current time in microsec precision print current time in microsec now when check whether nanosleep / usleep working or not, run program . here program1 print current time in microsec usleep(1); // sleep 1 microsec print current time in microsec here output 01:43:38.799150 01:43:38.799393 when run program2 struct timespec delay; delay.tv_sec = 0; delay.tv_nsec = 1000; print current time in microsec nanosleep(&delay, null); print current time in microsec i got output 01:48:25.919269 01:48:25.919838 i expecting 1 microsec difference in current time whereas getting more 100 microsec difference. what's reason? i doubt whether system execute usleep/nanosleep although usleep(1) call indirectly nanosleep(1000) i using g++, linux. or insight great , in advance .

mysql - Query on a relation table -

i have relation table data. want query returns a_id every connected status equals 1. so in case, 6 value returned. a_id b_id status 4 757 0 4 758 0 4 761 0 5 757 1 5 758 0 5 761 1 6 757 1 6 761 1 6 758 1 mysql 5.5 select distinct a_id relation_table a_id not in (select a_id relation_table status != 1);

android - how to synchronize file rename/deletion with the file system -

while working android file system, notice issue can't explain myself. changing image using file.renameto() or file.delete() (no matter if image has exif data) results in following (the methods mentioned above return true ): file.renameto() : gallery still shows old name going details , method posted below returns empty thumbnail (sure, because path points file supposed deleted) file.delete() : image gone file system (none of many tested file explorers shows anymore , new file(pathtodeletedimage).exists() returns false ) gallery still shows image incl. details the question: need somehow notify gallery changes performed image file? the method use thumbnail: private bitmap getthumbnail(contentresolver cr, string path) throws exception { cursor ca = cr.query(mediastore.images.media.external_content_uri, new string[] { mediastore.mediacolumns._id }, mediastore.mediacolumns.data + "=?", new string[] { path }, ...

javascript - SVG hover with multiple elements -

i've 2 svg elements on i've applied mouseover / mouseout event. goal increase radius of mask on mouseover size specified variable ( maxmaskradius ) , decrease on mouseout initial state ( initialmaskradius ). i works 1 element. when i've 2 elements , hover 1 element another, animation previous elements aborts immediately. i'd have animate initial state. current code that's unfortunately not possible. any suggestions on how proper? demo css: .dday.highlight .overlay { fill: rgba(247,99,62,0.8); } .dday.normal { width: 288px; height: 288px; } html: <svg class="dday highlight normal" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" data-image="car.jpg"> <image height="196" width="250" /> <a class="overlay" xlink:href="/svg/index.html" target="_top"> <rect x="0" y="0...