Posts

Showing posts from August, 2014

c++ - Fast way to generate code functions from header functions in Visual Studio? -

this question has answer here: creating .cpp files .h files visual studio 4 answers this may minor question, solution save me lot of time , prevent mistakes. i working on c++ project in visual studio. if define function in class in header file, say void initbutton(int buttonnum); i copy , paste signature cpp file. then, insert class name, , replace semi-colon curly braces, so: void button::initbutton() { } however, i'll forget class name, or accidentally type before return type. happens static variables need define in code. seems small, piles since i'm @ beginning phase of project. there quicker way auto-generate these in visual studio c++? or best practice i'm missing out on? edit: appears has been asked before: auto-create implementation in visual studio c++ 2010 edit 2: best solution me appears here: http://www.radwin.org/michael/2011/05...

how to make a form independent application in vb6? -

actually ' m trying develop application pops message whenever removable media inserted system.but application form dependent i.e. whenever lost focus form code provided, application seems halt.please help. thanks to make application without form, create sub main in module this: sub main() 'your code run end sub and define startup form in project properties sub main. execution of program end after code in sub main has run.

io - Java nio connection is creating multiple socket level connections, Why? -

Image
i have written simple java nio program below public static void main(string[] args) throws ioexception, interruptedexception { inetsocketaddress address = new inetsocketaddress("127.0.0.1",1001); selector incomingmessageselector = selector.open(); socketchannel socketchannel = socketchannel.open(); socketchannel.configureblocking(false); // till here code creates top 2 connections port 52209 , 52210 socketchannel.connect(address); socketchannel.register(incomingmessageselector, selectionkey.op_connect); socketchannel.register(incomingmessageselector, selectionkey.op_write); socketchannel.register(incomingmessageselector, selectionkey.op_read); // creates 2 connections port 1001 thread.sleep(900000l); } i want understand why creates 4 connections, standard tcp blocking library tends create 2 connections. i use jdk 1.7 , windows 7. in image 4 highlighted connections of interest created client. one connection 1 ent...

ios - UIActivityViewController with Text and Mail only -

Image
i'd create uiactivityviewcontroller text , mail activities. how this? documentation seems sparse in substance. i'm using following code present uiactivityviewcontroller : nsarray *items = [nsarray arraywithobject:@"text"]; uiactivityviewcontroller *activityview = [[uiactivityviewcontroller alloc] initwithactivityitems:items applicationactivities:nil]; [self presentviewcontroller:activityview animated:yes completion:nil]; which produces this: you need set setexcludedactivitytypes this:- [activityview setexcludedactivitytypes:[nsarray arraywithobjects: uiactivitytypemail,uiactivitytypecopytopasteboard,nil]];

App.config transformation issue -

i have implemented app.config transformation 1 of class library projects, when trying read key value app.config debugging unit test project, reading key value app.debug.config instead of app.config. please me out in regard. thanks, well, stated, debugging application. i suppose xdt sees current configuration 'debug' , transforms proper app.debug.config app.config. so, if understand question fully, there 2 (mostly not helping) answers: - remove or disable xdt transformations on class library. - move proper keys app.config app.debug.config , use xdt's 'find-and-replace' technique: <add name="yourkeyhere"xdt:transform="setattributes" xdt:locator="match(name)" />

Issue with the debugging in php -

i running a php script have while loop , file writings make take time.the problem comes when doesn 't seems print errors @ run time prints them after complete execution of script, , error in loop repeat every time loop , cost me lot of time. using wamp server version 2.2 . here sample code <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="algorithm" content="text/html; charset=utf-8" /> <title>delta compression</title> </head> <body> <?php //db connection $dbuser = "root"; $dbpass = ""; $dbname = "delta_compression"; $dbhost = "localhost"; //database connection $con = mysql_connect($dbhost,$dbuser,$dbpass); if (!$con) { die('could not connect: ' . mysql_error()); } mysql_select_db($dbna...

apache - Deny Access from IP range on 1 file/api -

itried using mod_rewrite deny access 1 file on web server. didn't work. rewritecond %{remote_addr} =10\.0\.0\.145 rewriterule ^/mylog/_myapi - [f] try removing leading slash. in apache 2.*, it's removed before being applied rules in htaccess files: rewriterule ^mylog/_myapi - [f]

baseadapter - Android Custom listView Adapter Filter not going back to original list -

i have edited adapter class , extended filterable class. search functionality works unable go original content if backspace in search menu. here adapter class: public class menu_list_item_adapter extends baseadapter implements filterable { context context; list<foodmenurowitem> rowitems; public menu_list_item_adapter(context context, list<foodmenurowitem> items) { this.context = context; this.rowitems = items; } private class viewholder { imageview imageview; textview txttitle; textview txtdesc; } @override public view getview(int position, view convertview, viewgroup parent) { viewholder holder = null; layoutinflater minflater = (layoutinflater) context .getsystemservice(activity.layout_inflater_service); if (convertview == null) { convertview = minflater.inflate(r.layout.food_menu_item_list_row, null); holder = new viewholder(); holder.txtdesc = (textview) convertview.findvi...

php - voltDB on window -

i looking set voltdb on windows platform. has implemented previously? please share experience. if there issue installing on windows platform, please me understand how implement on linux platform. have read voltdb documentation, can't understand method install on linux. new in linux , voltdb also. i know old post. wanted update how voltdb can run on windows using docker. more information can found on our voltdb community page .

I want to remove question mark & .php extension from the url using .htaccess -

i have problem redirect url in .htaccess. want remove .php & question marks url. for example: www.example.com/test.php?id=12 www.example.com/test/12 need format. i tried using code in .htaccess options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / ## don't touch /forum uris rewriterule ^forums/ - [l,nc] ## hide .php extension snippet # externally redirect /dir/foo.php /dir/foo rewritecond %{the_request} ^[a-z]{3,}\s([^.]+)\.php [nc] rewriterule ^ %1 [r,l] # internally forward /dir/foo /dir/foo.php rewritecond %{request_filename} !-d rewritecond %{request_filename}.php -f rewriterule ^(.*?)/?$ $1.php [l] this code removes .php extension url. need remove question mark. that code appears 1 of answers :) replace code this: options +followsymlinks -multiviews # turn mod_rewrite on rewriteengine on rewritebase / ## don't touch /forum uris rewriterule ^forums/ - [l,nc] ## hide .php extension snippet # externall...

c# - How to fill a region with transparency in windows forms application -

i have developed .net windows forms application fill color on image (eg: map). have highlight each region in different color. facing problem fill region color transparent enough display name of region (state). able fill region color not in transparent way. please me fill region in transparent way background text visible. in advance…. sree you need semi-transparent brush, try this solution . basically if use: color.fromargb(0...255, r, g, b) the first parameter alpha component. valid values 0 through 255, 0 means transparent, 255 opaque.

html - Bootstrap Popover works after one click - JavaScript -

i have bootstrap-buttons, should show popover when button clicked. usernamel.onclick = function(e){ $("#" + e.currenttarget.id).popover({html : true}); } when website has loaded , click button first time, nothing happens. if click second time, popover opens , works normal. what can popover appear on first click? in code, first time click on button popover start init only, until second click, see effect, i'm not sure version popover used. resource have found, using jquery also. https://github.com/klaas4/jquery.popover/blob/master/demo.html you can init popover first, , trigger click button want first approach, bind popover directly button $(function(){ $("[name=usernamel]").popover({trigger: 'click'}); }); second appoach, bind popover content div, , show popup button click $("#divcontent").popover({trigger: 'click'}); $("[name=usernamel]").click(function(){$("#divcontent").trigger...

php - Jquery inserting twice to mysql -

i have been trying create web-based stopwatch in value of start time , stop time stored mysql. stopwatch created in javascript, , use jquery store mysql. problem whenever click 'stop'on stopwatch, value inserted twice in mysql while should inserted once. here's code snippet : function stoptimers() { clearinterval(_mytimer_ms); clearinterval(_mytimer_s); clearinterval(_mytimer_m); clearinterval(_mytimer_h); $(document).ready(function(){ //get input data using post method when push mysql clicked .. pull using id fields of id, name , email respectively... $("#stop").click(function(){ //get values of input fields , store variables. var cell=$("#cell").val(); var machine=$("#machine").val(); var hour=$("#hour").val(); var tmin=$("#tmin").val(); var sec=$("#sec").val(); var mssec=$("#mssec").val(); //use $.post() method call insert.ph...

ruby - How to extend ERB templating -

i extend erb every output tag - <%= %> - content pre-processed before result rendered. for example, <%= 'test' %> should render !test! instead of test how can ? something this? (untested) require 'erb' template = file.read(template_file) template.gsub!(/<%=(.*?)%>/, '!\1!') erb = erb.new(template) result = erb.result

java - Using request.getRemoteAddr() returns 0:0:0:0:0:0:0:1 -

i trying print ip adress of logged user in webapplication. if user connects pc (which under same network, web application running in pc) using ip address 192.168.10.120:8080/webapplication code request.getremoteaddr() or request.getlocaladdr()) returns ip address. when log in pc run web application, ip address 0:0:0:0:0:0:0:1. why that? , what's difference between these commands (which should use?).thank lot! in case, trying access on local machine,so return value. let 1 of friend access it, , receive expected result getremoteaddr from javadoc: getremoteaddr - returns ip address of client or last proxy sent request getlocaladdr - returns ip address of interface on request received.

html - Offline webpage javascript sleep() or wait() function -

i downloaded website , going work offline. want on server. mean load time. while working on offline items load quickly. want make on image . what can add html css javascript files. there sleep() or wait() function can use? do not that, require great effort questionable result. if want measure performance, correct way on server.

tcp - Delphi chat dont send message on some ip -

i want make simple delphi chat. use tcp/ip client , server socket. when try send message on computer getting error 10060. to simplify if computer "comp1" , other computer in network "comp2" on both computer set same port (9096 example) on comp1 set ip of "comp2" , on "comp2" set ip address of "comp1". ports open in firewall.. "comp1" personal , have dynamic ip address , router(maybe problem router?) "comp2" other computer don't have router , have static address. when try send message "comp1" "comp2" message on "comp2" , don't have problem, if try send message "comp2" "comp1" not message , few seconds message 10060 error. when try in local network local ip addresses program work. is problem router or else? thanks this isn't delphi issue, network configuration issue. problem router receives message comp2 doesn't know it. need e...

content management system - Creating a site in alfresco using open cmis extension -

i want create alfresco site using open cmis extension. researched , found object type 'f:st:sites' , properties 'st:sitevisibility' , 'st:sitepreset'. not sure using can create site in alfresco , not able find method creating site. like map<string, object> properties = new hashmap<string, object>(); properties.put(propertyids.name, "mysitename"); properties.put(propertyids.object_type_id, "f:st:sites"); properties.put("cmis:path", "/sites"); . . properties.put("cmis:createdby", date); properties.put("st:sitevisibility", scriptsiteservice.public_site); // todo: add method creating site session object please reply possible. also, if there other way create site other apache's http api, please share. thanks, smita as long don't post use case, yourfull code & explain in in detail tools you're using (apache chemistry/opencmis? apache...

matplotlib - IOError "Too many open files" while using savefig() in a loop -

i have little issue matplotlib. while trying save figures in loop hundred times savefig() , ends following error: ioerror: [errno 24] many open files: 'test_421.png' i have checked close every figure after saving it, doesn't seem efficient. here code sample illustrate how error: def displayfig(input, display, savepath): fig = plt.figure(figsize=(22, 5)) # add subplots, axis , colorbars... if display: plt.show() else: plt.savefig(savepath, dpi = 100) plt.close(fig) i, inp in enumerate(inparray): savepath = 'test_%d.png' % displayfig(inp, false, savepath) why error raised? multi-threading issue or memory leak? try upgrading version of matplotlib. believe matplotlib v1.2.0 addressed (by pr https://github.com/matplotlib/matplotlib/issues/1466/ ).

google maps api 3 - Restricting geocoding to a country -

i have seen possible "static" limit scope of search area (with components restrictions), have seen in release 3.exp (will 3.14) of javascript api, new class google.maps.geocodercomponentrestrictions has appeared. have not seen anywhere how class supposed used though. have more information this? it looks answered on @ google maps geocoding api, feature api missing in js api (?) , formatting like: geocoder.geocode( { 'address': address, 'componentrestrictions':{'country':'gb'}}, function(results, status){ ... }); the geocodercomponentrestrictions parameters passed componentrestrictions key.

swing - Java Logarithm Clock Gives Innacurate Answers -

Image
ok, building clock give out times in form of log 10 (hour) , minute , second in same format, keep getting strange outputs when runs. nans , infinity(or negative). have feeling wrong numbers using(like maybe large or that) note: currenttime long, calendar calendar, , hour, minute, , second doubles. clock variable jlabel. after program goes through 2 iterations switches on nans. this.timer.scheduleatfixedrate(new timertask() { @override public void run() { new swingworker<void, void>() { @override protected void doinbackground() throws exception { currenttime = system.currenttimemillis(); calendar.settime(new date(currenttime)); hour = math.log10(hour); minute = math.log10(minute); second = math.log10(second); system.out.println(hour + " " + minu...

Show loading option in angularjs while fetching content using $http -

i creating directive have reusable way show option labeled 'loading...' in select tag. problematic comes because i'd notified specified connection (as shown in fiddle) , because i'd directive know nothing model ($scope). the fiddle @ http://jsfiddle.net/5uhbn/8/ code, i'll show i'm trying @ moment. following handler called @ start of connection: var startrequesthandler = function() { ngmodelctrl.$setviewvalue(obj); selectctrl.addoption(msg); /** * above i'd want angular adding element combo. **/ console.log('started endrequesthandler'); }; the next handler called when connection done , resets value: var endrequesthandler = function() { selectctrl.removeoption(msg); ngmodelctrl.$setviewvalue(null); /** * above i'd want angular removing element combo. **/ console.log('ended endrequesthandler'); }; thank you!

localhost - How can I open port 127.0.0.1:8778 -

i running application uses screenscraper , following error message: no connection made because target machine actively refused 127.0.0.1:8778 i have tried opening port in windows firewall advanced setting - going to: inbound rules > new rule > port > specific local port : 8778 > allow connection but doesn't seem make difference. when use netstat -an can see 0.0.0.0:8778 not 127.0.0.1:8778 and ve tried http://www.canyouseeme.org/ , put in 8778 , says: error: not see service... reason: connection timed out. the server on windowsserver2008r2. have not opened port or issue? keep going round in circles this. any appreciated! this faq might help: http://community.screen-scraper.com/faq/serverrefusingconnections if not, might try posting 1 of our forums: http://community.screen-scraper.com/forum

python - Array of 1's in indexed positions -

i have array of indices of minimum values in array. it looks this: [[0], [1], [2], [1], [0]] (the maximum index 3) what want array looks this: [[1, 0, 0] [0, 1, 0] [0, 0, 1] [0, 1, 0] [1, 0, 0]] where 1 in column of minimum. is there easy way in numpy? use numpy's broadcasting of == : >>> minima = np.array([[0], [1], [2], [1], [0]]) >>> minima == arange(minima.max() + 1) array([[ true, false, false], [false, true, false], [false, false, true], [false, true, false], [ true, false, false]], dtype=bool) >>> (minima == arange(minima.max() + 1)).astype(int) array([[1, 0, 0], [0, 1, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0]])

java compiler not give all error at a time -

system.out.println("first eror :: without semicolon ") // first error system.out.println("this second error :: out object not used proper :: "); //second error class testcompilation { public static void main(string []args) { system.out.println("hello no semicolon::")//first error system.out.println("hello out spell not correctely::"); //second error } } whenever compile above code javac command in cmd gives first error means not give second error. in java language partially compiler , partially interpreter , in java first compilation happen compiler should list out errors gives me single error. why happening ? dont understand please me out problem.. i think clear question means compiler works totally ... for create simple example understand java compiler working . class testcompilation { public static void main(string []args) { syste.out.rintln("hello...

Facebook Dialog is not appeared when click on Facebook button in android -

i facing problem in integration of facebook in android app. have tried ways unfortunately not getting results want. tried 1) facebook login button. 2)custom button facebook integration. when try implement facebook login button , click on button facebook dialog not appeared , main screen.... here code . loginbutton authbutton = (loginbutton) findviewbyid(r.id.authbutton); authbutton.setonerrorlistener(new onerrorlistener() { @override public void onerror(facebookexception error) { log.i(tag, "error " + error.getmessage()); } }); // set permission list, don't foeget add email authbutton.setreadpermissions(arrays.aslist("basic_info","email")); // session state call event authbutton.setsessionstatuscallback(new session.statuscallback() { @override public void call(session session, sessionstate state, exception exception) ...

Formatting a parameter within an expression in SQL Server Reporting Services -

i working sql server reporting service. need change colour of parameter used in expression. don't want change colour of entire expression hence can please let me know best way this. ="population statistics for" + parameters!totalpatientcntinpractice.label i change colour of parameters!totalpatientcntinpractice.label assuming have ssrs 2008 or above, need set multiple placeholders in textbox. see formatting text , placeholders . right-click anywhere in text box , select insert placeholder. in placeholder properties dialog box, can specify expression value of placeholder. these allow have separate text sections in 1 textbox. once have these placeholders set in textbox, can apply different formatting each placeholder, including different colour placeholder holds parameter label expression. if using 2005 or below, option use 2 textboxes suggested @yakyb in comments.

usb - How do I control power output with a program -

i programmer , want experimentation electricity. need control voltage, amperage , frequency (possibly modulation) of electrical current. writing code on mac, perhaps script running in terminal. i envision device plugs power outlet , usb-connects laptop. api can install on machine , call script. on output produces current modified program. please suggest best way approach this. perhaps device name can search for? it's little bit old question maybe find helpful: for professional use link should help: http://www.toellner.de/html/pages/en-homepage-products-power-supplies.htm pay attention possible dynamic range. for use hobby maybe should try learn electronic. use pic18f [2 ] micro controller connect real world. avr [3 ] is job. connection between micro controller , pc can use usb-to-rs232 interface. analog voltage need digital-to-analog converter dac08 [4 ]. please don't think these done in few days. fantastic hobby, have ready learn lot. a other way on l...

python - elegant unpacking variable-length tuples -

a real, if silly problem: https://github.com/joshmarshall/tornadorpc/blob/master/tornadorpc/base.py def start_server(handlers, ...): ... (route, handler) in handlers: ... normally "handlers" list of 2-element tuples. particular solution (tornado) can pass third argument particular handler (kw args). tuple in "handlers" may have 2 elems or 3 elems other times. i need unpack in loop. sure, can smth length checking or try..except on unpacking. ugh. can think of smth better/more clever this: in [8]: handlers out[8]: [(1, 2), (3, 4, 5), (6, 7)] in [9]: new_handlers = [x + (none,) x in handlers] ? if handler takes keyword arguments, use dictionary third element: handlers = [(1, 2, {}), (3, 4, {'keyword': 5), (6, 7, {})] route, handler, kwargs in handlers: some_method(route, handler, **kwargs) or can apply arguments using *args syntax; in case catch all values in loop: for args in handlers: some_method(*...

mingw w64 - Obtaining current GCC exception model -

g++ built using either dwarf2 , sjlj or seh exception model. mingw-builds provide various builds of g++ have different exception models. able determine gcc toolchain exception model being used. there g++ argument dump default exception model of compiler? edit: originally, testing configuration flags described in g++ -v . jonathon wakely points out in comments, not thing do . an inspection way compile assembly: struct s { ~s(); }; void bar(); void foo() { s s; bar(); } the result of g++ -s <filename> -o output.s have following exception references in them: mingw-4.8.1-x86-posix-sjlj : .def ___gxx_personality_sj0; .scl 2; .type 32; .endef .def __unwind_sjlj_register; .scl 2; .type 32; .endef .def __unwind_sjlj_unregister; .scl 2; .type 32; .endef .def __unwind_sjlj_resume; .scl 2; .type 32; .endef mingw-4.8.1-x86-posix-dwarf : .def ___gxx_personality_v0; .scl 2; .type 32; .endef .def __...

Java Exception Handling via Catch Block -

this question has answer here: exception thrown in catch , clause 10 answers when executing following code 1. public class test { 2. public static void main(string[] args) { 3. try { 4. int = 10 / 0; 5. } catch (exception e) { 6. int j = 10 / 0; 7. } { 8. int k = 10 / 0; 9. } 10. } 11. } i getting error: exception in thread "main" java.lang.arithmeticexception: / 0 @ test.main(test.java:8) i not getting reason why jvm throwing exception main() , not catch block. if follow the step-by-step description of try-catch-finally in jls , see (in summary) if catch throws exception executed , (emphasis mine): if catch block completes abruptly reason r, block executed. if block completes abruptly for reason s , try statement completes abruptly for ...

java - Using try-catch -- Skipping try -

im trying write code can try json object , if wrong format inform user somehow. the code : public boolean sjekksporingsnummer (jsonobject object){ //object passed correct boolean riktigsporing = null; riktigsporing = true; //riktig sporing set true //if true json correct try { jsonarray consignmentset = object.getjsonarray("consignmentset"); jsonobject object1 = consignmentset.getjsonobject(0); riktigsporing = true; }catch (exception e){ //skips straigt here e.printstacktrace(); riktigsporing = false; } return riktigsporing; after if failes : 07-31 12:34:07.243 15479-15479/com.example.posten e/androidruntime: fatal exception: main java.lang.nullpointerexception what seems wierd me app skips try , goes straight return statement. i try , of failes set "riktigsporing" false. what doing wrong ? most exception...

php - Laravel Model::find() throws SQLSTATE error -

i'm trying fetch record database using eloquent crm. table's primary key field name "user_id" . weird thing everytime use user::find() , pass user_id number, sqlstate[42s22]: column not found: 1054 unknown column 'id' in 'where clause' (sql: select * `users` `id` = ? limit 1) (bindings: array ( 0 => 8, )) i'm assuming orm makes calls assuming table's id field name "id" instead of "user_id" . how can check correctly sees supposed see. tried change primary key field user_id "id" orm seem expect , worked i'm following naming convention in database schema stick "user_id" . any form of appreciated. thanks i have fixed problem. had read documentation properly. sorry rushing ask question simple. eloquent assumes primary key field table named "id" default. change that, override $primarykey field corresponding field name in database table.

Primefaces Mobile calendar looks like primefaces calendar component -

i m new @ primefaces mobile. made simple page , have few problem p:calendar. calendar primefaces calendar, not primefaces mobile. here code: <f:view xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:pm="http://primefaces.org/mobile" contenttype="text/html" renderkitid="primefaces_mobile"> <pm:page title="edms"> <f:facet name="postinit"> <link rel="stylesheet" href="#{request.contextpath}/javax.faces.resource/calendar/calendar.css.jsf?ln=primefaces-mobile" /> <h:outputstylesheet library="primefaces-mobile" name="calendar/calendar.css" /> <h:outputscript library=...

indexing - detecting jumps on pandas index dates -

i managed load historical data on data series on large set of financial instruments, indexed date. i plotting volume , price information without issue. what want achieve determine if there big jump in dates, see if missing large chunks of data. the idea had in mind somehow plot difference in between 2 consecutive dates in index , if number superior 3 or 4 ( bigger week end , bank holiday on friday or monday ) there issue. problem can figure out how compute df[next day]-df[day], df indexed day you can use shift series method (note datetimeindex method shifts freq): in [11]: rng = pd.datetimeindex(['20120101', '20120102', '20120106']) # datetimeindex df.index in [12]: s = pd.series(rng) # df.index instead of rng in [13]: s - s.shift() out[13]: 0 nat 1 1 days, 00:00:00 2 4 days, 00:00:00 dtype: timedelta64[ns] in [14]: s - s.shift() > pd.offsets.day(3).nanos out[14]: 0 false 1 false 2 true dtype: bool d...

javascript - Backbone.js Loss of focus during Ctrl+s event -

i have following issue: i'm building backbone application , when attempt save text ctrl + s , app textarea loses focus , strange behavior follows, ontextareakeydown: function(evt) { var key = evt.keycode; if(evt.ctrlkey) { switch(key){ case 83: evt.preventdefault(); this.savetext(); break; } } }, edit: strange behavior, yes. mainly, noticed when press ctrl + s inside loses focus on textarea, , when bring focus, loses focus every key pressed after that. do have model change events causing view rerender? guess dom being changed in response model events.

javascript - Calling a controller from another controller in AngularJS -

i have 2 controllers in angularjs app. like: controller("appctrl", function($scope){ //do stuff here }) and controller("chatctrl", function($scope, chat_service){ $scope.init = function(){ chat_service.identify(...nick , other data...); chat_service.on_users_update(function(){...do stuff here...}); } //some other methods $scope.init(); }) note appctrl main controller , gets executed when open app. problems want call chatctrl.init() appctrl , don't know how. obviously, $rootscope.$emit() , $rootscope.$on() won't work $on() part (which in chatctrl ) hasn't been executed yet @ time ``$emit```` happens. and don't want chat-related stuff in appctrl . is there way call init() appctrl ?

javascript - jQuery: Adding a class to <a> element -

i have wordpress site , add class links in main navigation using jquery. this how code looks: html <div class="nav-menu"> <ul> <li class="current_page_item"> <a title="home" href="www.example.com">home</a> </li> ... </ul> </div> and i'd achieve: html <div class="nav-menu"> <ul> <li class="current_page_item"> <a title="home" href="www.example.com" class="new-class-goes-here">home</a> </li> ... </ul> </div> does have clue how this? you can use jquery's .addclass() method , appropriate selector <a> tags: $(".nav-menu a").addclass("new-class-goes-here"); here jsfiddle demonstrate.

security - Deleted cacerts in Java 7, can I restore it? -

while playing certificates have deleted cacerts file jdk.(usr/lib/jvm/java-7-oracle/jre/lib/security) there anyway restore or have reinstall jdk? using ubuntu , oracle jdk 7. as long did not change file cacerts can restore simple reinstalling jdk or copying installation.

html - jQuery click on button will show the div and again click on any area of the page will hide the div? -

i have markup this. button click. <div class="logout-wrap"> <div class="account-info"> <a href="../profile.php">admin admin</a> </div><!--.account-info--> <div class="account-info-icon"> <ul> <li><a href="" class="account-sprited notice"><span>5</span></a></li> <li><a href="" class="account-sprited profile profiletest"></a></li> </ul> </div> </div> it area default hide , when click on button show div contents. <div class="account-info-box" style="display: block;"> <div class="top-info"> <div class="profile-img"> <img alt="" src="../images/profile.png"> </div><!--.profile-img--> <div class="profile-text"> <span class=...

Adding options in JavaScript functions that could use later -

i developing small javascript framework, need know how add options function, user can set own settings particular method. this sample function method have created $.prototype = { setcenter: function() { this.e.style.position = 'absolute'; this.e.style.top = '50%'; this.e.style.left = '50%'; this.e.style.marginleft = '-50px'; this.e.style.margintop = '-50px'; return this; } }; i expecting developed handle below options sets. *i not using jquery, need pure javascript solution this. example code, maybe not real thing , idea. $('samplediv').setcenter({ animate:true, fade:true }); help me solve problem, appreciate tries answer this. thank ! you implement main function way : this.dosomething = function() { var getdefault = function(args, property, otherwise) { return args[property] !== undefined ? args[property] : o...

android - How to highlight a button when is pressed? -

i'm making andorid quiz , want highlight button when it's clicked when user lets go of button turns in original colour. see i've set background of button buttons can rounded. i've set in drawable. <button android:id="@+id/btn1" android:background="@drawable/roundedbutton" android:textcolor="#ffffff" android:textstyle="italic" android:layout_width="225sp" android:layout_margintop="23sp" android:layout_height="38sp" android:layout_alignleft="@+id/btn2" android:layout_below="@+id/textview1" android:text="button" /> roundedbutton.xml <?xml version="1.0" encoding="utf-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" android:padding="10dp"> <solid android:color="#848482"/> <!-- 1 ths color o...

android - Updating Marker in google map -

i using google map in app. storing lat-long , test type in database. retrieving value database , showing marker on google map. using 2 different image test type. if test type manual using red image if test type auto using blue image. here code retrieve value , showing on google map public void setpinonmap(){ try{ cursor pinrecordcursor = mtestpinrecordhandler.getpinfromdatabase(); mpinmarkerlist = new arraylist<testpinmarker>(); if(pinrecordcursor != null && pinrecordcursor.movetofirst()) { {//string testname, string testtype, string latitude, string longitude testpinmarker markers = new testpinmarker(pinrecordcursor.getstring(1),pinrecordcursor.getstring(2), pinrecordcursor.getstring(3),pinrecordcursor.getstring(4)); mpinmarkerlist.add(markers); }while(pinrecordcursor.movetonext()); ...

javascript - Show data after query - Google Charts -

i have data-table (in google chart) , want send url connecting data-table , sending query , after show data in page web, javascript. how can it? here code. <!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <title> google visualization api sample </title> <script type="text/javascript" src="http://www.google.com/jsapi"></script> <script type="text/javascript"> google.load('visualization', '1.0', {packages: ['corechart']}); </script> <script type="text/javascript"> function sendquery(yyy) { var query = new google.visualization.query('http://localhost:8080/xxx-da...

sql - How to convert yyyymmdd to dd-mm-yyyy in Oracle? -

i have column contains dates in varchar2 varying formats such 19.02.2013, 29-03-2013, 30/12/2013 , on. annoying of 20130713 (which july 13, 2013) , want convert dd-mm-yyyy or dd-mon-yyyy. if column contains various formats, you'll need deal each one. assuming question includes all known formats, have couple of options. you can use to_char/to_date. dangerous because you'll sql error if source data not valid date (of course, getting error might preferable presenting bad data). or can rearrange characters in string based on format. little simpler implement, , doesn't care delimiters are. method 1: case when substr(tempdt,3,1)='.' to_char(to_date(tempdt,'dd.mm.yyyy'),'dd-mm-yyyy') when substr(tempdt,3,1)='-' tempdt when length(tempdt)=8 to_char(to_date(tempdt,'yyyymmdd'),'dd-mm-yyyy') when substr(tempdt,3,1)='/' to_char(to_date(tempdt,'...

unwanted navigation bar resizing issue (CSS and HTML) -

i have built navigation bar using html , css , functions perfectly. issue when either of 2 gallery pages selected, positioning of navigation bar moves upward. im not sure issue lies (it seems quite specific since cant find similar issue here nor on google). note: gallery html page has css content written in because if content included using php's include statment (as on other pages), gallery slideshow images distorted/streched reason. either way though, navigation bar issue present. html services page (a non-gallery pager): <?php //if browser ie, displays ie specific navbar if(strpos($_server['http_user_agent'], 'msie') !== false) {include('navbarie.php');} //if browser else, include original navbar file else include('navbar.php'); ?> <!doctype html public "-//w3c//dtd html 4.01 transitional//en" "http://www.w3.org/tr/html4/loose.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang=...