Posts

Showing posts from February, 2010

php - How to auto increment a number in mailbody? -

i want send mail customer, , in body want value multiplied 2 after 60 minutes. suppose @ 3.00 pm. saw '10' in mail body, @ 4.00 pm. seeing '20 in mail body i using php script send mail. i want $result of line multiplied 2 after 60 minute so if open shop 24*7 aprroximated revenue $result thank !! here code: <?php /* subject , email varialbles*/ session_start(); $emailsbuject = 'new client details'; $webmaster = 'vivek@h.com'; $emailsbuject2 = 'thank calculating revenue'; $client = ' $emailfeild\r\n'; /*gathering data variables*/ $namefeild = $_post['name']; $phonefeild = $_post['phone']; $emailfeild = $_post['email']; $dayfeild = $_post['day']; $timefeild = $_post['time']; $revenuefeild = $_post['revenue']; $result = (($revenuefeild*7*24)/($dayfeild*$timefeild)); // admin message body $body= <<<eod contact form details of $namefeild name: $namefeild \n email: $ema

java - how to make a point-to-point VoIP call in android -

i searching way develop android app make point-to-point voip call between 2 android devices without having intermediate server (sip server).devices have access internet. possible? we know ip address of devices should create local sip account ? if yes how ? is there android library creating local sip account ? - making p2p call not relevant platform. there protocols implement language want. there several protocols that. ice protocol best option available. also note 100% p2p not possible. scenario call established through relay server. this answer explains how make p2p connection.

excel - Compare 2 columns using wildcards -

Image
i have 2 columns column 1: long hairs hai hello hairs long neck column 2: long hair i'm using following formula, doesn't work: =countif(a1;"*"&$p$1:$p$2&"*") what have able select somehow cells column 1 (it has phrases in each cell) contain value range (using wildcards). cannot use somthing {" hair "," long "} - need range. please advice, have searched here lot, nothing seemed work. if relevant - i'm using cyrllic words , phrases in these columns. the countif formula, using range criteria, return array of values. need sum results. e.g: =sum(countif(a1,"*" & p1:p2 & "*")) confirmed holding down ctrl+shift while hitting enter . or, entered normally: =sumproduct(countif(a1,"*" & p1:p2 & "*")) with data in column a, criteria in column c, , formula in column b, using variation: =sumproduct(countif(a1,"*"&$c$1:$c$2&"

java - Incomplete HTTP Response from Tomcat -

tomcat 8.0.17, residing on localhost. linux mint 17.1 oracle java 8.0.1.40-b25 i have jsp long: contains drop-down list country codes , countries (named in hebrew). when try load jsp address, in return partial response. cutting off @ around portugal (can anywhere else, depending on amount of code in page). the page address example.com/he/index2.jsp i think related size of page because when remove lines, response correctly. i don't exceptions or errors, , response returns status 200. i have tried setting buffer size 8kb, 32kb, 128kb , 2048kb. when 8kb did buffer overflow error, @ 32 , above didn't error , response still partial. i tried set auto flush false. i have tried setting both maxswallowsize , socketbuffer 32768 in connector node in server.xml . narrowing down code minimum, have example evil page. have removed unnecessary java code, includes, etc. remarked includes essential because need these css files. inspection commented them out, still p

android - problems with objectanimator and the end listener -

i'm writing code make circle fall. problem when call method puts piece random, well, in second turn puts 2 pieces , in 3 turn 3 pieces. know problem appears when put line : game.juegamaquina(); inside end listener. the code : public boolean ontouchevent(motionevent event) { final int fila; final int columna; pixel_x = (int) event.getx(); pixel_y = (int) event.gety(); fila = getfila(pixel_y); columna = getcolumna(pixel_x); if (game.tablerolleno()) { toast.maketext(getapplicationcontext(), r.string.fin_del_juego, toast.length_long).show(); return true; } if (game.sepuedecolocarficha(fila, columna) != true) { toast.maketext(getapplicationcontext(), r.string.nosepuedecolocarficha, toast.length_short).show(); return true; } if(event.getaction() == motionevent.action_down) { if(pixel_y >

java - IBM Maximo Taking Client IP -

i working on project used maximo asset management program. our customer wants know client ip when person create new service request. have searched on internet can't find topics that. 'm working java on businessobjects , have took ip ip server's ip , know maximo run on server therefore shows server ip , want take user/client create new service request. in maximo go to->security->users select action -> manage sessions click on arrow expand info on logged in user here can see name , client host (ip address of user) click on client host field , hold down alt+i see database table , field this. result maxsession.clienthost table maxsession , field clienthost.

sql server - Django - OneToOneField can be Null? -

i'm trying fetch messages 365 api , save them on initialmessage model. when ever try so, keep getting message: django.db.utils.integrityerror: ('23000', "[23000] [microsoft][sql server native client 11.0][sql server]violation of unique key constraint 'uq__assignme__f9cc0897dc370444'. cannot insert duplicate key in object 'dbo.assignment_initialmessage'. duplicate key value (). (2627) (sqlparamdata)") unique key constraint refering relationship model claim (claim = models.onetoonefield(claim, null=true, blank=true, default=none) this model: class initialmessage(models.model): json = models.textfield() att_url = models.charfield(max_length = 254, default='https://outlook.office365.com/api/v1.0/me/messages/{0}/attachments') send_url = models.charfield(max_length = 254, default='https://outlook.office365.com/api/v1.0/me/sendmail') update_url = models.charfield(max_length = 254, default='https://outlook.office365.com/api/

ajax - Display a JSON object made in java in jsp using javascript -

hello trying make json object in java , want display same json object in jsp using javascript. basically, want add 2 more options in select box using ajax. ajax getting called , in response cans see following o/p not able add vales in dropdown. please help... want javascript only. {"value1":"label1","value2":"label2"} java code: map<string, string> options = new linkedhashmap<string, string>(); options.put("value1", "label1"); options.put("value2", "label2"); string json = new gson().tojson(options); // json = "dataobject: [" +json+ "]"; system.out.println(json); response.setcontenttype("application/json"); response.setcharacterencoding("utf-8"); response.setheader( "pragma", "no-cache" ); response.setheader( "cache-control", "no-cache" ); response.setdateheader( "expires", 0 ); response.getwri

node.js - Passing a function as parameter in javascript, undefined error -

i have function part of object called server , i.e server.log function use log data. there other properties of server not want pass other functions, though want server.log available functions in other files. function test() { testingthis(server.log); } function testingthis(logf) { logf("test123"); } i error saying cannot read property 'emit' of undefined i using happy console module log (server.log works fine in test function). presumably server.log expects this refer server . however, way call function, this refers global object or undefined (in strict mode). bind function server : testingthis(server.log.bind(server)); see how access correct `this` context inside callback? .

c++ - Classes overloading operators function -

in code below i'm having trouble function named normalize. in program, input fraction 2 integers. normalize function supposed make denominator positive if input negative, , make numerator & denominator positive if both input negative. , supposed convert fraction lowest terms form. works inputs not others , don't understand why. also in main function, near end of end of try test normalize function , don't know how use oop principles this. did referring member variables directly. how can oop way? here's code class: class rational { public: rational(int numer, int denom);//initialize object 1 arguement numerator , 1 denominator rational(int wholenumber);//initialize object 1 argument numerator. sets denominator 1. rational();//initialize object 0 numerator , 1 denominator friend ostream& operator <<(ostream& outputstream, const rational& number);//overloading of insertion operator friend istream& operator >>(ist

c# - How To Save A Single SQL Entry As A Variable? -

lets have following database table name: users id | name | surname | 1 | peter | parker | 2 | hulk | hogan | using (sqlconnection connection = new sqlconnection("...")) using (sqlcommand command = connection.createcommand()) { command.commandtext = "select users id='2'"; //...... } the following command select hulk hogan entry. if wanted save surname/name string, how have it? string surname = ....; surnametextbox.text = surname; // displays - hogan thank in advance. if want multi column use sqldatareader this: string name=""; string surname=""; using (sqlconnection connection = new sqlconnection("...")) { connection.open();//don't forget line else "invalidoperationexception" using (sqlcommand command = connection.createcommand()) { command.commandtext = "select name,surname users i

javascript - Can't $push a new array to document in Meteor Collection -

i've been learning meteor 3 weeks, , still trying wrap head around updating/querying collections. i'm trying build slack clone, , created following collection 1 set of fixture documents: conversations.insert({ channel: "#defaultchannel", createdby: "coffeemeup", timestamp: new date(), followers: ["username1", "username2"], entries: [ { message: "this message #1", postedtime: new date(), author: "coffeemeup" }] }); i'm trying insert document entries array using code below. not not work, throws " mutating [[prototype]] of object cause code run slowly... " error. i'd appreciate help! conversations.update({ channel: "#defaultchannel" }, { $push: { entries: { message: newmessage, postedtime: new date(), author: "coffeemeup" } } }); also, love hear suggestions on how

nginx - IOS / Swift2 - List all files in remote directory -

i have server running nginx. have directory in server have several audio files. replaced real url "url". how can list files in directory in table. when print wecontent get: 403 forbidden override func viewdidload() { super.viewdidload() let url = nsurl(string: "url")! //self.webview.loadrequest(nsurlrequest(url: url)) let task = nsurlsession.sharedsession().datataskwithurl(url) { (data, response, error) -> void in // happen when task completes if let urlcontent = data { let webcontent = nsstring(data: urlcontent, encoding: nsutf8stringencoding) print(webcontent) dispatch_async(dispatch_get_main_queue(), { () -> void in self.webview.loadhtmlstring(string(webcontent!), baseurl: nil) }) } else { // show error message } } task.resume() } thank you a 403 error means user or group doesn't have permission acc

r - Variable definition with mutate that depends on its value in the previous row -

i have data in following format: time click interaction 1 407 false true 2 408 true true 3 409 false false 4 410 false false 5 411 false false 6 412 false false 7 413 false false 8 414 false false 9 415 false false 10 416 false false 11 417 false false 12 418 false false 13 419 false false 14 420 false false 15 421 false false 16 422 false false 17 423 false false 18 424 false false 19 425 false false 20 426 false false 21 427 false false 22 428 false false 23 429 false false 24 430 false false 25 431 false false 26 432 false false 27 433 false false 28 434 false false 29 435 false true 3

Polymer's iron-list won't show -

i'm playing google's polymer library , have trouble iron-list component. not rendered , no error thrown. here html: <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="description" content="odtimetracker - ui test polymer"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1, user-scalable=yes"> <title>odtimetracker</title> <script src="bower_components/webcomponentsjs/webcomponents-lite.min.js"></script> <link rel="import" href="bower_components/font-roboto/roboto.html"> <link rel="import" href="bower_components/iron-icons/iron-icons.html"> <link rel="import" href="bower_components/paper-styles/classes/

regex - positive look ahead and replace -

recently i'm writing/testing regexps on https://regex101.com/ . my question is: possible positive look-ahead , replacement in same "replacement"? or limited kind of replacement possible. input several lines phone numbers. let's correct phone number number of "numbers" 11. no matter how numbers divided/group - / characters, no matter if starts + 00 or omitted. example lines: +48301234567 +48/30/1234567 +48-30-12-345-67 +483011223344556677 0048301234567 +(48)30/1234567 positive look-ahead able check if beginning until end of line there 11 digits, regardless how many other, above specified character separating them. works perfectly. where positive look-ahead check fine, delete every character numbers. replacement works fine until i'm not involving look-ahead. checking regexp working ("gm" modes): ^(?:\+|00)?(?:[\-\/\(\)]?\d){11}$ checking replace part works (replace nothing): [^\d\n] put look-ahead, after deletion of non n

android - How to animate both top and bottom Toolbars(or any other view) enter/exit screen on scroll in CoordinatorLayout? -

my activity contains 2 appbarlayouts in coordinatorlayout, 1 on top of screen, , other bottom. want make both of 2 appbarlayouts hide on scroll of recyclerview. when there top one, it's easy make hide on scroll adding app:layout_scrollflags="scroll|enteralways" toolbar, , app:layout_behavior="@string/appbar_scrolling_view_behavior" container of recyclerview. when there bottom appbarlayout hide on scroll, realized making custom behavior bottomappbarlayoutbehavior extends appbarlayout.behavior . however, when both of them made hide on scroll, succeed hide recyclerview shakes on scroll. , area of top toolbar leaves empty white space after hiding. below xml: <android.support.design.widget.coordinatorlayout android:layout_width="match_parent" android:layout_height="match_parent" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:android="http://schemas.android.com/apk/res/android"> &l

Issues with passing a variable with jQuery to PHP -

i have following code: <?php $id = $_get['id']; ?> <html> <head> <script src="//code.jquery.com/jquery-1.11.3.min.js"></script> </head> <body> <script> var id = $.urlparam('id'); var id = <?php echo $id; ?>; $.post("api.php", { id: id }); $.ajax({ url: 'api.php', data: "", datatype: 'json', success: function(data) { var path = data[0]; alert(path); } }); </script> </body> </html> i have variable in url called id (for example http://www.url.com?id=1 ) , i'm trying send page called api.php have database query. i'm trying corresponding value of id (in case path) , return it. seems variable id not being p

apache - Issue when playing DashCast live stream -

i'm trying capture desktop , stream live in apache server using dashcast. captures , plays correctly when on demand, when live , play mp4client shows black screen, not getting error message while capturing it. commands i’m using are: dashcast -vf x11grab -vres 1280x720 -v :0.0 -npts -live -out /public_html/ and play with: mp4client http://localhost/vitor/dashcast.mpd which results in following output: mp4client http://localhost/vitor/dashcast/dashcast.mpd using config file in /home/vitor directory system info: 11948 mb ram - 8 cores modules found : 36 loading gpac terminal [thread mediamanager] couldn't set priority(2) thread id 0x9b55a700 [thread mediamanager] couldn't set priority(2) thread id 0x9b55a700 terminal loaded in 35 ms opening url localhost/vitor/dashcast/dashcast.mpd [dash] slight drift in utc clock @ time 2015-08-05t12:38:45z: diff ast - 3563501 ms service connected so doing wrong? client apparently connects correctly server, open player does

r - Plot time series graph based on readings taken every half hour -

Image
i trying plot time series graph based on data looks following. data contains values recorded every 30 minutes entire day. example data logged 3 hours data frame looks this: the column names time values shown in half-hours 00:00, 00:30, 01:00, 01:30, 02:00, 02:30, 03:00, 03:30, 04:00, 04:30, 05:00 and respective data values this 0.2, 0.4, 0.3, 0.6, 0.7, 0.6, 0.8, 0.10, 0.2, 0.5, 0.7 the data frame has many rows of data values given respective time columns. need plot time series graph based on these values @ given time. able plot time series have problems depicting x-axis (time value) imagine a vector taken row of data frame, then: a<-c(0.2, 0.4, 0.3, 0.6, 0.7, 0.6, 0.8, 0.10, 0.2, 0.5, 0.7) a.ts <- ts(a, start=0, frequency=24) plot(a.ts) i getting time series graph below, need have respective hour values (i.e, 00:00, 00:30, , on..) in x-axis instead of start = 0 , on. i've read documentation ts() allows specify year , month start values. need hour

java - Wss4jSecurityInterceptor Class not found error -

i want use org.springframework.ws.soap.security.wss4j.wss4jsecurityinterceptor in web application. in pom.xml have added <dependency> <groupid>org.springframework.ws</groupid> <artifactid>spring-ws-core</artifactid> <version>2.2.1.release</version> </dependency> dependency property. in spring configuration says 'org.springframework.ws.soap.security.wss4j.wss4jsecurityinterceptor' not found. idea? looking org.springframework.ws.soap.security.wss4j.wss4jsecurityinterceptor @ http://www.findjar.com/ see present on maven location: http://mirrors.ibiblio.org/pub/mirrors/maven2/org/springframework/ws/spring-ws-security/1.5.6/spring-ws-security-1.5.6.jar that should <groupid>org.springframework.ws</groupid> <artifactid>spring-ws-security</artifactid> <version>1.5.6</version> there other versions to, totally different artifact. sure, if missing class present in jar

php - Which method faster/better - multiple equal or IN? SQL -

i want know - method faster/better? $string = ''; $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); for($i = 0; $i < 10; $i++){ if(!empty($string)){ $string .= ' or '; } $string .= ' `id` = '.$array[$id]; } or: $array = array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10); $string = implode(', ', $array); $string = '`id` in ('.$string.')'; in sql: 'select * `table` '.$string in databases, 2 identical. mysql, however, sorts in list , uses binary search. hence, in should faster multiple equals in mysql. here reference: returns 1 if expr equal of values in in list, else returns 0. if values constants, evaluated according type of expr , sorted. search item done using binary search.

java - Painting multiple JComponent on JPanel not working -

i don't this. want add highlight extends jcomponent objects pdfpage extends jpanel highlight components simple not painted. can see paint() , paintcomponent() methods getting called in correct order not show. thing fixes problem add: for(component component : this.getcomponents()) { component.paint(g); } into pdfpanel.paint() method not how want that. want pdfpage extends jpanel render jcomponent i'm adding not override paint() if possible. this how add highlight components pdfpage panels: for (datasheeterror datasheeterror : datasheeterrorlist) { int pagenumber = datasheeterror.getpagenumber(); highlight highlight = createerrorhighlight(datasheeterror); pdfpage pdfpage = pdfpages[pagenumber]; pdfpage.add(highlight); } this how pdfpage looks like. note not using layoutmanager calling super(null); : public class pdfpage extends jpanel { private static final long serialversionuid = 77561370548775820

html - Starting a JAR/Java file over Custom URI Scheme -

i have managed create batch file can executed using <a href="testbatch: -username admin -password pass123 openform?id=111">open batch file</a> here testing handling switches important part testbatch: have registry set correctly batch file runs. can call jar file within batch file no problems, unless in new edge browser, jar file not found(no idea why). so modify registry , link jar file executed. reg file looks like. windows registry editor version 5.00 [hkey_classes_root\testjava] @="url: test java" "url protocol"="" [hkey_classes_root\testjava\shell] [hkey_classes_root\testjava\shell\open] [hkey_classes_root\testjava\shell\open\command] @="\"java.exe\" -jar \"c:\\users\\public\\testapp.jar\" %1" when make uri call of testjava: usual prompt run jar file on local machine suggests accessing fine. allow , command prompt flashes doesn't run jar. all jar file create .txt file. , have t

c# - An expression of non-boolean type specified in a context where a condition is expected, near 'no' -

private void button1_click(object sender, eventargs e) { cn.open(); st = "select * info roll_no=" + textbox1.text; cmd = new sqlcommand(st,cn); dr = cmd.executereader(); if(dr.read() == true) { textbox2.text = dr.getstring(1); textbox3.text = dr.getstring(2).tostring(); textbox4.text = dr.getstring(3).tostring(); textbox5.text = dr.getstring(4).tostring(); textbox6.text = dr.getstring(5); textbox1.focus(); button3.enabled = true; button4.enabled = true; } else { messagebox.show("no such record exists"); textbox1.clear(); textbox1.focus(); button3.enabled = false; button4.enabled = false; } dr.close(); cn.close(); } type query like: "select * info roll_no = '" + textbox1.text+'

amazon web services - How to assign an elastic ip to aws load bouncer? -

i have issue current registrar allow aname reference, have elastic ip web settings. assign load balancer , load balancer decide going handle it. i cannot find way create route 53. cannot add route 53 domains registrar , appreciate advice. thank you. change aname record record has eip of load balancer. can set high ttl, because "your" eip won't change. don't need web servers in dns. load balancer should have list of ips. it this: 1) client dns lookup foo.com 2) client gets record has (e)ip of lb 3) send request lb's ip 4) lb distributes traffic web servers if lb dies, spin new 1 , move eip it.

metaprogramming - c++ compile-time for loop over integer constant -

i working on porting windows c++ code linux, involves template specialization , boost::mpl. problem (1) cannot class template partial specialization compile (due argument dependence), (2) or if template can away from, meta programming technique needed loop on sequence of compile-time constant integers. hope code snippet clearer description. #include <vector> #include <boost/mpl/at.hpp> #include <boost/mpl/size.hpp> #include <boost/mpl/vector.hpp> class state_idle{}; class state_waitingtoturnon{}; class state_waitingtoturnoff{}; typedef boost::mpl::vector < state_idle, state_waitingtoturnon, state_waitingtoturnoff > ::type statelistx; #ifdef __linux__ template <class statelist>class mosstatemachine; typedef std::vector<void *> statetable; #if 0 // failed attempt no.1 // of course fails, there no partial specialization of function template template <class statelist, int n> static void filltable(statetable& table

javascript - Umbraco Macro Referenced Root But is now Broken After Relocation -

i followed following steps in umbraco add folder structure in content nodes. step 1 create new document type called content folder. go settings > document types > click on 3 dots > create. give name content folder. icon select folder icon add new property redirect alias umbracoredirect type content picker save changes built-in property umbracoredirect used redirect 1 node using id. each folder set property first child page. step 2 allow child node types in folder. go structure tab of content folder property check child types want allow under folder save changes step 3 allow folder under root home node. go structure tab of home root property check contentfoldertype allow child save changes step 4 add folder structure , add pages. go content add new folder under root node of type content folder give name hq add new page called that's allowed under folder in hq set redirect property

ios - PDF from UIScrollView is blank -

i have uiscrollview want export pdf file. scroll view contains view (content view) contains visible content: scrollview : uiscrollview -> contentview : uiview -> view1 : uiview ... -> view2 : uiview ... ... the code pdf export is: func generatepdfdata() -> nsdata { // first tried use scroll view result same let bounds = contentview.bounds let pdfdata = nsmutabledata() uigraphicsbeginpdfcontexttodata(pdfdata, bounds, nil) let pdfcontext = uigraphicsgetcurrentcontext() cgcontextsetinterpolationquality(pdfcontext, kcginterpolationmedium) cgcontextsetrenderingintent(pdfcontext, kcgrenderingintentdefault) cgpdfcontextbeginpage(pdfcontext, nil) // without following 2 settings, result remains same cgcontextscalectm(pdfcontext,1.0,-1.0) cgcontexttranslatectm(pdfcontext,0.0,-bounds.size.height) contentview.layer.renderincontext(pdfcontext) uigraphicsendpdfcontext() return pdfdata } i use

javascript - JS: Slideshow inaccurate result -

hi write simple javascript slideshow cause want write own slideshow in javascript. automatically change images set time interval. when try click backward , forward function result not accurate or images in order. var images = ["http://i1214.photobucket.com/albums/cc487/myelstery/1.jpg","http://i1214.photobucket.com/albums/cc487/myelstery/2.jpg","http://i1214.photobucket.com/albums/cc487/myelstery/3.jpg"]; var = 0; var count = images.length; function slidingimages() { i = % count; document.banner.src = images[i]; i++; } function forward() { = (i + 1) % count; document.banner.src=images[i]; } function backward() { if (i <= 0) { i = count - 1; } else { i--; } document.banner.src=images[i]; } window.onload = function() { slidingimages(),setinterval(slidingimages, 3000) }; <center> <p> <img src="images/1.jpg" name