Posts

Showing posts from January, 2015

jquery - Modify a string in JavaScript -

i want modify color attribute returned in jquery. so, lets assume color returned , contained in var color color = 'rgb(148, 141, 124)' i want modify value of color be: color = 'rgb(148, 141, 124, .7)' (in other words, insert string ", .7") you below: color = color.replace(/\)/, ', 0.7)')

how to change all td numeric values into percentage values in jquery and PHP -

i want function when click toggle button numeric values should changed percentage value formula. <table class="table table-striped table-bordered scrollable"> <thead> <tr class="success"> <th>answer</th> <th>total</th> <th>pcp</th> <th>ob/gyn</th> <th>pain</th> </tr> </thead> <tbody><tr><td class="left-align">male</td> <td>123</td> <td>72</td> <td>18</td> <td>33</td> </tr><tr><td class="left-align">female</td> <td>78</td> <td>48</td> <td>22</td> <td>8</td> </tr><tr><td class="left-align">all respondent</td> <td>201</td> <td>120</td> <td>40</td> <td>41</td> </tr></tbody> </table>

python - Filling missing lines with "nan" with pandas reindex -

thanks jeff, find missing lines in file data structure , fill missing lines. however, filled missing lines in output show "2013-07-01 00:00:00,,,,,,,,,,,,,,,,,,", not nan. fill "nan" or "nan" inside of commas. my code is: filin = datapath + 'skp_aws_min_qc_10001_2013.07-09.dat' pd.set_option('max_rows',10) data=pd.read_csv(filin,sep='#',index_col=[1],parse_dates=[1]) print data index = pd.date_range('2013-07-01 00:00:00','2013-09-30 23:59:00',freq="t") df = data sk_f = df.reindex(index) print sk_f sk_f.to_csv("sample1.csv") as long know information reindex function, missing holes should filled (default "nan"). can't find reason why missing hole in result files not filled. any idea or comment appreciated. thank you, isaac it has nothing reindex() , when to_csv , provide string missing values if don't want them show blank spaces. df.to_csv('temp.csv'

sql - Count number of cases -

Image
i have table called leaves has employee id , leave type , date . example, if employee id = 1234 applies sick leave 1-june-2014 5-june-2014, stored in leave tables day day, means following records added: 1234 sick leave 1-june-2014 1234 sick leave 2-june-2014 1234 sick leave 3-june-2014 1234 sick leave 4-june-2014 1234 sick leave 5-june-2014 considered 1 case. clarify mean case: total cases how many leave request had been applied… example: need following information sql statement (i should determine period: 1-january-2014 30-december-2014, example): sick leave cases: 2 escort leave cases: 2 study leave cases: 1 i using postgresql 9.2. this design bit strange, because of these daily rows, if same person have several escort leaves, have figure out different cases. for case can use this select count(*), leavetype ( select leavetype leaves group employee_id, leavetype ) group leavetype; my suggestion use case_start , case_en

android - Google Maps v2 not loading -

google maps not load , gives blank screen tried few guides , tried google's guide none seem work have added, couldnt find problem :-/ logcat: 06-27 01:21:16.470: i/google maps android api(12628): google play services client version: 4452000 06-27 01:21:16.490: i/google maps android api(12628): google play services package version: 4452036 06-27 01:21:16.790: d/dalvikvm(12628): gc_for_alloc freed 3003k, 16% free 17823k/21008k, paused 32ms, total 33ms 06-27 01:21:16.800: i/fpp(12628): making creator dynamically 06-27 01:21:16.800: i/google maps android api(12628): google play services client version: 4452000 06-27 01:21:16.810: w/activitythread(12628): classloader.loadclass: class loader returned thread.getcontextclassloader() may fail processes host multiple applications. should explicitly specify context class loader. example: thread.setcontextclassloader(getclass().getclassloader()); 06-27 01:21:17.261: i/google maps android api(12628): failed contact google servers. attem

bash - sed match on first instance not working -

i want replace first instance of <tr> <tr class="active"> using shell (bash). however, sed has no affect: sed '0,/<tr>/s/<tr>/<tr class="active">/' file1 >> temp2.txt temp2.txt remains <tr> <th>set</th> <th>run</th> <th>continuum<br>filter</th> <th>narrow band<br>filter</th> </tr> <tr> <td><a href="#set1">1</a></td> <td>run09</td> <td>r_harris</td> <td>6605/32</td> </tr> whereas code changes both first , second instance of <tr> sed '1,/<tr>/s/<tr>/<tr class="active">/' file1 >> temp2.txt can explain what's going on? <tr class="active"> <th>set</th> <th>run</th> <th>continuum<br>filter</th> <th>narrow band

spring mvc - autowiring and injecting the properties using deployment by maven -

not able run , showing errors on console giving error when running on jetty cannot autowire autowiring done here org.springframework.beans.factory.beancreationexception: error creating bean name 'employeecontroller': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.dineshonjava.service.employeeservice com.dineshonjava.controller.employeecontroller.employeeservice; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'employeeservice': injection of autowired dependencies failed; nested exception org.springframework.beans.factory.beancreationexception: not autowire field: private com.dineshonjava.dao.employeedao com.dineshonjava.service.employeeserviceimpl.employeedao; nested exception org.springframework.beans.factory.beancreationexception: error creating bean name 'employeedao': injection of autowired dependenci

html - Displaying image in jsp from database -

this question has answer here: how retrieve , display images database in jsp page? 4 answers for code below, googled lots, somehow couldn't figure out error.. respect "img src" tag. there might silly mistake, great if me out. i have saved images inside image folder, placed inside project folder... database has image url under "image" attribute... trying retrieve url database through <%=rs.getstring("image") %> correct ? <html> <body> <%@ page import="java.io.*"%> <%@ page import="java.sql.*"%> <%@ page import="com.mysql.*"%> <%@ page import="java.util.*"%> <%@ page import="java.text.*"%> <%@ page import="javax.servlet.*"%> <%@ page import="javax.servlet.http.*"%> <%@ page

Spark Streaming not distributing task to nodes on cluster -

i have 2 node standalone cluster spark stream processing. below sample code demonstrate process executing. sparkconf.setmaster("spark://rsplws224:7077") val ssc=new streamingcontext() println(ssc.sparkcontext.master) val indstream = ssc.receiverstream //batch of 500 ms have 1 sec latency val filtereddstream = indstream.filter // filtering unwanted tuples val keydstream = filtereddstream.map // converting pair dstream val statestream = keydstream .updatestatebykey //updating state history statestream.checkpoint(milliseconds(2500)) // remove long lineage , meterilizing state stream statestream.count() val withhistory = keydstream.join(statestream) //joining state wit input stream further processing val alertstream = withhistory.filter // decision taken comparing history state , current tuple data alertstream.foreach // notification other system my problem spark not distributing state rdd multiple nodes or not distributing task other node , causing high l

swing - Java- add an editable row to a JTable -

i have java gui displays jtable , button. when button clicked, want add new editable row of cells table. trying using following actionlistener() , have assigned button: addbtn.addactionlistener(new actionlistener(){ public void actionperformed(actionevent e){ system.out.println("'add' button pressed. "); defaulttablemodel model = (defaulttablemodel)jentityfiltertable.getmodel(); model.addrow(new object[]{"site", "application", "entity"}); system.out.println("--- actionlistener added 'addbtn' ---"); } }); in console, when click button, see message stating "'add' button pressed. "... however, exception says: exception in thread "awt-eventqueue-0" java.lang.arrayindexoutofboundsexception: 0 >= 0 i assume occurring on model.addrow... line, since place i've used array, i'm not sure why i'm getting error- i'm creating empty

what is same c# code in javascript? -

httpcookie newcookie = request.cookies["cookie1"]; int count = (newcookie .values.keys.count) / 6; int keycount = (newcookie .values.keys.count); string val = httputility.urldecode(newcookie .values.getkey(i).tostring()); string str = newcookie .values.getkey(i).tostring(); // loop counter i want use javascript cookie, there way use same code in javascript above c# code? try like set cookie : document.cookie = "username=; expires=thu, 01 jan 1970 00:00:00 gmt"; cookie : vat x = document.cookie ;

sensor - TelosB configuration with GPS -

how can configure telosb gps? can direct me link can me programming telosb? telosb mote doesn't come gps. lately have found testbed ( http://pharos.ece.utexas.edu/wiki/index.php/how_to_analyze_the_telosb_signal_strength_vs._distance ) can configured telosb. need additional hardware that. also, try tutorial( http://www.ladyada.net/make/gpsshield/solder.html ) solder gps telosb did arduino.

symfony - Render template into Symfony2 with ajax -

i have action in controller index route routing.yml index: pattern: /index defaults: { _controller:acmedemobundle:default:index } controller path public function indexaction() { return $this->render('acmedemobundle:plugin:index.html.twig'); } and index.html.twig template {% extends'::base.html.twig' %} {% block stylesheets %} {% stylesheets filter='cssrewrite' output='css/*.css' 'bundles/acmedemo/css/*' %} <link href="{{ asset_url }}" type="text/css" rel="stylesheet" /> {% endstylesheets %} {% endblock stylesheets %} {% block body %} <br> <div class="container"> <div class="wp_attachment_holder"> <div class="imgedit-response" id="imgedit-response-8"></div> <div class="wp_attachment_image" id="media-head-8"> <p id="thumbnail-head-8"&

sql - oracle regexp_substr to fetch string -

i have sql query select count(distinct empno), count(distinct(deptno empname empid )) emp i want fetch first occurrence of count , content like: count(distinct empno) i have tried following sql statement not working, sql >select regexp_substr('select count(distinct empno), count(distinct(deptno)) emp', 'count *( distinct . )') dual ; regexp_substr('selectcount(distinctempno),coun ---------------------------------------------- count(distinct empno), count(distinct(deptno )) i want output return : regexp_substr('selectcount(distinctempno) count(distinct empno), regular expression should not match second ) closing bracket , should match 1st closing bracket. * in regex ates everything, need make regex engine match shortest possibility. count *\([^\)]\)(?=,)

Not able to display data in tree format using nested ng-repeat in AngularJS -

i have written html display data in tree format, not working expected. issue here. i know can use custom directive that, want show in basic format. writing directive tricky. <div data-ng-cloak data-ng-show="rootnode.children.totalavailable > 0"> <table border=1> <tr> <th>tree form</th> </tr> <tr data-ng-repeat="parent in rootnode.children.items"> <tr> <td> {{parent.displayname}} </td> </tr> <tr data-ng-repeat="firstchild in parent.children.items"> <tr> <td> {{firstchild.displayname}} </td> </tr> <tr data-ng-repeat="secondchild in firstchild.children.items"> <tr>

database - How to nested SQL Queries? -

select id, (select top 1 content id=id(in table a) b) content i want query data table base on id in each of a, , query other data id @ same time, transfer new column. anybody know how it? sounds want correlated query, can (example sql server, based on usage of top n): select a.id, (select top 1 content b b.id = a.id ) content

sql - Oracle Cursor has_value Used But Doesn't Exist -

i have giant query uses text in variables have no idea , can't figure out. aren't global or defined anywhere else in oracle package. in particular below variable(or whatever is) called "has_value" confusing because it's used in multiple cases queries across lot of tables. procedure assemble_default_where( i_search_id in search_table.search_id%type, o_where_clause out varchar2, o_from_clause out varchar2, o_error_number out error_message.error_number%type) l_base varchar2(30) := 'd'; cursor c_where_clause select decode (sl.parameter_name, 'track location', join_operator || ' ' || open_brackets || ' ' || not_operator || ' exists(select 1 track_locations loc ' || l_base || '.plan_number = loc.plan_number , ' || l_base || '.order_id = loc.order_id , loc.t_id = nvl(''' || track_

android - How to change some words of a string to BOLD? -

this string getting web using json api in code: string content = "<strong><em>india world’s hub child sex trafficking</em> </strong></p>\n<p style=\"text-align: center;\"><strong><em>nearly 40,000 children abducted every year… </em></strong></p>\n<p style=\"text-align: center;\"><strong<em> every8 minutes girl child goes missing in india!</em></strong></p>\n<p><strong>priti pathak</strong></p>\n<p>meet shivani shivaji roy, senior inspector, crime branch, mumbai police, sets out confront mastermind behind child trafficking mafia," in string whatever text in "<strong><em> text </em></strong>" i want display bold. above string <strong><em>india world’s hub child sex trafficking</em></strong> will displayed india world’s hub child sex trafficking . sh

Disable Chrome debugging for Cordova Release App -

Image
i tend debug cordova app using chrome , safari's "inspect on device" type features, i.e. in chrome bottom option in menu: for release version of app though i'd people dev mode devices not able inspect js source of app in cordova's web view. can't find documenting it, know if it's possible disable this? if cordova build --release inspect disabled update: since cordova 5.0.0 build system uses gradle. see thread more info: specify signing config gradle , cordova 5

claims based identity - When is the relyingpartytrustid set by ADFS? -

i had couple of "acceptance transform rules" defined ad stopped working.. looks relyingpartytrustid-claim ( http://schemas.microsoft.com/2012/01/requestcontext/claims/relyingpartytrustid ) don't exist in "acceptance transform rules"-step in adfs (2012 r2) pipeline anymore. strange thing there before, can't see until next step in adfs claimstransformation pipeline (issuance transform rules relying parties). does know when relyingpartytrustid-claim issued adfs? can't find information on how/when these claims issued. claim-rule worked before , stopped working: c:[type == "http://schemas.microsoft.com/2012/01/requestcontext/claims/relyingpartytrustid"] => add(store = "customattributestore", types = ("http://domain.no/context/fmapplicationid", "http://domain.no/context/adfsapplicationid", "http://domain.no/context/customproperty"), query = "getapplicationattributes#fmapplicationid,adfsappli

c# - Cannot implicitly convert type 'ArrayofString' to 'string[]' in Console Application -

in wcf project i'm using string[] function , calling string[] function console application adding service reference. shows error: cannot implicitly convert type 'arrayofstring' 'string[]' in console application. i can not solve problem times working fine if recreate service reference shows error said above. sample code given below public string[] set_prov_from_invoice(int type, int cust_id, int plan_id, string invoice_id, string in_parameter, string in_fld_action, string get_value, ref string rtn_value) // invoice_id = customer invoice table id , cust_id = customer id, type = 4 prov tagk { system.collections.arraylist prov_result = new system.collections.arraylist(); return prov_result.toarray(typeof(string)) string[]; } string[] ret_prov_tag = obj.set_prov_from_invoice(4, convert.toint32(cust_id), 0, in_fld_invoice_id, "", "create"

android - DialogActivity: java.lang.illegalStateException -

while creating dialogactivity getting error @ runtime.it shows java.lang.illegalstateexcepion. stacktrace: e/androidruntime(1685): fatal exception: main e/androidruntime(1685): process: com.steve.dialogactivity, pid: 1685 e/androidruntime(1685): java.lang.illegalstateexception: not find method onclick(view) in activity class com.steve.dialogactivity.mainactivity onclick handler on view class android.widget.button id 'btn_dislog' e/androidruntime(1685): @ android.view.view$1.onclick(view.java:3810) e/androidruntime(1685): @ android.view.view.performclick(view.java:4438) e/androidruntime(1685): @ android.view.view$performclick.run(view.java:18422) e/androidruntime(1685): @ android.os.handler.handlecallback(handler.java:733) e/androidruntime(1685): @ android.os.handler.dispatchmessage(handler.java:95) e/androidruntime(1685): @ android.os.looper.loop(looper.java:136) e/androidruntime(1685): @ android.app.activitythread.main(activitythread.java:501

javascript - Load and execute conditionally an external js file -

i'd load , execute external javascript file (google adwords's conversion script) if condition met. similar questions have been asked, i've tried solutions didn't work. i've following code : <script> $(function() { if ([condition]) { $.getscript('//www.googleadservices.com/pagead/conversion.js'); } }); </script> the script loaded isn't executed. how do execute ? i've tried change getscript() var script = document.createelement("script" ); script.setattribute("src", "//www.googleadservices.com/pagead/conversion.js" ); document.getelementsbytagname("head" )[0].appendchild(script); but didn't work well. thanks ! @vlas: oops pasted wrong thing, corrected @ejay_francisco: tried create script tag , append head doesn't work @barar: mean page downloads script file doesn't execute it. yes, if want full code :

php - delete if record exits otherwise exit in MySQL -

i want delete record if exist , don't if record doesn't exist think delete query alone not sufficient. because database throws error if doesn't find record. using mysql doing : delete tag exists(select * tag column='value') thanks in advance delete tablename columnname =' '; asked for. if record exists delete else nothing happens.

javascript - Get Id from HTML by means of Regular-Expression -

how can test, whether id of object (e.g. image , div or table ...) in html-code. id e.g. follows: id=my_img_id or id="my_img_id" or id = " my_img_id " or id = my_img_id var shtml = '... text abc < img src="path/myfile.jpg" id="my_img_id" style="..." > ... text'; var sid = 'my_img_id'; var sreg = '<.*? *id*\= *\"*['+sid+' *"*]$.*'; var sregexp = new regexp(sreg, "g"); var result = sregexp.test( shtml ); alert( result ); many in advance. first convert html string jquery object can use find element jquery object. use length property if more 0 element id exists in html string. live demo $(shtml).find('#' +sid ).length

c# - Can you change the value of the Name property of a Type at runtime? -

is possible change/override name property of type? given class definition: class sample {} can change value typeof(sample).name returns? i'm using custom serialization library, literally use typeof(t).name in source code: writer.writestartelement(typeof(t).name); writer.writevalue(item); writer.writeendelement(); no, cannot change .name of type @ runtime. however, serialization libraries allow have control of processing of names, either providing custom "binder" (etc), or annotating type attributes indicate preferred name use (note: libraries allow attributes also allow name provided via runtime configuration of serialization library). an important question, then, is: serialization library being used here? if serialization library doesn't support this, , cannot changed, alternative (short of renaming sample ) of create type (either hand, or via typebuilder @ runtime) looks original type, different code, , similarly: create code transl

How to attach file in mail using php .? -

i have enquiry form takes primary details of user such name,address,email , resume.i want send uploaded resume administration's mail id , have used phpmyadmin class.my codes follows. //codes// <?php require 'phpmailer/phpmailerautoload.php'; $allowedexts = array("docx", "pdf", "doc"); $temp = explode(".", $_files["upload"]["name"]); $extension = end($temp); if ((($_files["upload"]["type"] == "text/plain") || ($_files["upload"]["type"] == "application/doc") || ($_files["upload"]["type"] == "application/docx") || ($_files["upload"]["type"] == "application/pdf") )) { $file_to_attach= move_uploaded_file($_files["upload"][&quo

com.android.ide.eclipse.adt.DEPENDENCIES - where is this symbolic reference's value set? -

having updated latest sdk 4.4w, sdk tools 23.0 , eclipse plugin 23.0, along other ide bugs, find projects refuse build because of build path error: the container 'android dependencies' references non existing library c:\dev\tools\android-sdk-windows4.4\tools\support\annotations.jar' i know it's missing whole folder has gone , jar appears in folder: c:\dev\tools\android-sdk-windows4.4\extras\android\support\annotations my .classpath looks like: <?xml version="1.0" encoding="utf-8"?> <classpath> <classpathentry kind="src" path="src"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.android_framework"/> <classpathentry kind="src" path="gen"/> <classpathentry exported="true" kind="con" path="com.android.ide.eclipse.adt.libraries"/> <classpathentr

asp.net - Url redirects in Sitecore/uCommerce -

i developing e-commerce solution using sitecore , ucommerce. have found 2 modules sitecore url redirecting. https://marketplace.sitecore.net/en/modules/sitecore_redirect_manager.aspx https://marketplace.sitecore.net/en/modules/301_redirect_module.aspx both seem satisfy old url -> new url manual process of redirecting, although little removed actual content. there better solutions/packages? thinking more how umbraco's 301 url tracker works ( http://our.umbraco.org/projects/developer-tools/301-url-tracker ). more content item specific , tracks changes in page title , therefore url create redirect you. also know if ucommerce tracks changes in product name/sku might affect url requiring 301 updated location? it doesn't track them no, that's you'd have code yourself. you'd best hook saveproduct pipeline think , update table. hth

c# - Grouping a list of objects by parent using linq to output child elements -

i have silly problem linq groupby cant work on own. basically have list of items trying group parentid outing details var list = new list<groupitem>() { new groupitem() {id = 1, name = ".net"}, new groupitem() {id = 2, name = "asp.net", parentid = 1}, new groupitem(){id = 3,name = "c#",parentid = 1}, new groupitem(){id = 4,name = "php"}, new groupitem(){id = 5,name = "zend",parentid = 4} }; var group = g in list group g g.parentid ==null grouped select new { frameworkid = grouped.key, items = (from g in list g.parentid==g.parentid select g).tolist() }; foreach (var gi in group) { console.writeline(gi.frameworkid); foreach (var item in gi.items) { console.writeline(item.name); } } what doing wrong? you query seems complicate

asp.net - Trigger excel solver from vb.net web app -

using vb.net, visual studio 2013 , excel 2010. i have web page , when button clicked values passed page excel ( presaved formatted copy). want run solver add in (which have preconfigured). have been searching while , cannot find way of doing this. the below code use open excel application dim xlapp excel.application dim xlworkbook excel.workbook dim xlworksheet excel.worksheet xlapp = new excel.application xlapp.visible = true xlapp.displayalerts = false xlworkbook = xlapp.workbooks.open("c:\temp\rto.xlsx") xlworksheet = xlworkbook.sheets("optimiser") another curious problem may related when open excel web page solver addin enabled in excels options not appear in data ribbon tab. if disable , enable in options comes back. update i tried following code xlapp.run("c:\program files\microsoft office\office15\library\solver\solver.xlam!auto_open") but errors following additional information: cannot run macro 'c:\program file

ASP.NET Postback error under Reverse Proxy with IIS 8.5, URL Rewrite 2.0 and ARR 3.0 -

i setup reverse proxy in iis in configuration problems asp.net postbacks. when click on submit button of proxied website 404 error. url in browser address bar changed rewritten url. for example, website need proxy http://website.com/host . here http://website.com , http://website.com/host separate web applications. host running virtual folder under website.com. i want access host url: http://me.local/myhost . in iis me.local asp.net web application , myhost added application child of me.local. works fine long don't click on submit button anywhere on proxied website. once page http://me.local/host results in 404 error. when @ page's html source form's action url set correctly /myhost why error happen? possible fix in iis, or need make changes host application? my server running iis 8.5. host server old 1 iis 6, , web application can asp.net 1.1 or asp.net 2.0. the section rewrite rules web.config of "myhost" application is: <configuration>