Posts

Showing posts from April, 2012

ios - how to get a new JSON response without closing and reloading the app -

i started building app uses rest api, testing json response in console. i have 2 uitextfields jobkeyword & location user enter, json shows in console upon clicking "search" button. but can't new search without closing re-running app. how update field , new response without leaving app? i'm new in ios development. here viewcontroller.swift: import uikit import alamofire class viewcontroller: uiviewcontroller { let headers = ["host":"data.usajobs.gov", "user-agent":"dezbill@icloud.com", "authorization-key":"********************" ] @iboutlet weak var jobkeywordtxt: uitextfield! @iboutlet var locationtxt: uitextfield! @iboutlet weak var locationstate: uitextfield! override func viewdidload() { super.viewdidload() } override func viewdidappear(animated: bool) { super.viewdidappear(true) } @ibaction func searchbtn(sender: uibutton) {

google app engine - Objectify async: at what point RPC call is made? -

quite want make 2 or more independent queries fetch entities datastore. i'm not sure if parallel. example: loadresult1 = ofy().load().key(key.create(foo.class, 1)); loadresult2 = ofy().load().key(key.create(bar.class, 1)); loadresult1.now(); loadresult2.now(); is there benefit of arranging code this? same goes search queries iterable1 = ofy().load().type(foo.class).iterable(); iterable2 = ofy().load().type(bar.class).iterable(); iterable1.hasnext(); iterable2.hasnext(); will iterable2 load in parallel iterable1? side question: .iterable() in regard different .list() ? i tried debug code, doesn't call made until call .now() , or first call .next()/.hasnext() in. so? yes - until materialize result, queries proceed asynchronously in parallel.

javascript - Ajax within a loop -

i have troubles using ajax within loop. loop , ajax work fine on own, combining them trouble starts. below test script wrote see if script works before make rest. idea java script gets $numbers database , performs loop amount got (so in example 7 times). each time ajax has send $numbers php search in database %color corresponding value of $numbers, since test took "check" instead. used target specific div corresponds value of $numbers en $color (in case $number , check). @ moment i've tested while loop , ajax separately , work perfect, combining them goes wrong. while ajax script nothing freeze browser. i've tried loop nothing except giving me uncaught typeerror: cannot set property 'innerhtml' of undefined. this test script. <?php $number = 7; ?><?php if(isset($_post["number"])){ echo 'check'; exit(); } ?> <!doctype html> <html> <head> <meta charset="utf-8"> <title>test

math - Proof big omega of 1^k+2^k+..+n^k -

question: 1^k + 2^k + ... + n^k big omega of n^(k+1) 1^k + 2^k + ... + n^k => cn^(k+1) hi, need figure out how can prove this. trying avoid induction , proving simple possible. use integrals. sum larger the integral of x^k 0 n and smaller integral of x^k 1 n+1. thus theta class. , c=1/(k+1).

c - How to append a character onto a string? -

the examples i've seen on stack overflow come close problem none of them seem match, have ask myself: how can append character string in c? aware strcat() not job, nor using array values work properly. here code: char* buildword(int posx, int posy, int nextx, int nexty, int gridx, int gridy, char** grid, char* str, int length){ int len2; char* word = malloc(sizeof(char) * 20); if(posx+nextx < 0 || posx+nextx > gridx) return null; if(posy+nexty < 0 || posy+nexty > gridx) return null; strcpy(word, str); len2 = strlen(word); word[len2 + 1] = grid[posx + nextx][posy + nexty]; //grid[x][y] represents word[len2 + 2] = '\0'; //single character printf("%s", word); length++; if(length < 4) word = buildword(posx+nextx, posy+nexty, nextx, nexty, gridx, gridy, grid, word, length); return word; } as might guess, purpose of code build string gr

r - Accessing arbitrary list of symbols returned by getSymbols()? -

short version: how symbolically access objects returned getsymbols()? (i learning r , first 'real life' script/function. have used better part of day searching , still bewildered). i want take arbitrary set of symbols , percentage return each symbol high within last year until now. (or more generally, want manipulation on each symbol individually). i have tried several approaches; storing them new.env() , trying parse them there, , putting them list(), still cannot access $high. have still not learned lapply , eapply. this have far: library(quantmod) symbols<-(c("^dji", "^gdaxi", "^spc","^rut", "xom", "k")) t1<-as.posixlt(as.date(sys.date())) t1$year<-t1$year-1 #one year ago start_date<-t1 for(i in symbols) { x<-getsymbols(i, from=start_date, auto.assign=false) print(serieshi(x)) #used test # high value # last value # print symbol name: # print last/high } i brute force, looking e

java - 404 on j_spring_security_check -

i trying use spring security create simple login system. when post login form, 404 on j_spring_security_check. here's spring security: <beans:beans xmlns="http://www.springframework.org/schema/security" xmlns:beans="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-4.0.xsd"> <http use-expressions="true"> <intercept-url pattern="/dashboard/**" access="hasrole('role_user')" /> <form-login login-page="/login" default-target-url="/dashboard/home" authentication-failure-url="/login?error"

java - NullpointerException while accessing Spring Bean factory + tomcat 8 startup -

we migrated java 7 java 8 , tomcat 6 tomcat 8. before migration , getting below issue during deployment of our services , deployment fails , tomcat not start. what crazy that, not happen , intermittent (occurs once in 3 or 4 deployments). below stack trace see during deployment. caused by: java.lang.nullpointerexception @ com.async.classb.createclassc(classb.java) @ com.async.classa.afterpropertiesset(classa.java) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.invokeinitmethods(abstractautowirecapablebeanfactory.java:1573) @ org.springframework.beans.factory.support.abstractautowirecapablebeanfactory.initializebean(abstractautowirecapablebeanfactory.java:1511) existing code: in our code have singleton classa, injected singleton classb. , prototype classc used in classb. in classa, have afterpropertiesset(), where-in getting instance of classb using applicationcontext. in classb trying instance of classc using beanfactory.

c++ - Taylor Series Resulting in nan after sin(90) and cos(120) -

doing school project. not understand why sin comes out -nan when after sin(90) , cos(120) . can me understand this? also, when put in online c++ editor totally works, when compiled in linux not. // nick garver // taylorseries // taylorseries.cpp #include <iostream> #include <cmath> #include <iomanip> using namespace std; const double pi = atan(1.0)*4.0; double angle_in_degrees = 0; double radians = 0; double degreestoradians(double d); double factorial(double factorial); double mysine(double x); double mycosine(double x); int main() { cout << "\033[2j\033[1;1h"; cout.width(4); cout << left << "deg"; cout.width(9); cout << left << "radians"; cout.width(11); cout << left << "realsine"; cout.width(11); cout << left << "mysin"; cout.width(12); cout << left << "realcos"; cout.width(11); cout << left

iphone - get free ram on iOS 9? -

i trying free ram on ios device code below gives me 34mb on ios 9, iphone 5s device when there 1 app running using 98mb ram. there bug in below code ? natural_t get_free_memory () { mach_port_t host_port; mach_msg_type_number_t host_size; vm_size_t pagesize; host_port = mach_host_self(); host_size = sizeof(vm_statistics_data_t) / sizeof(integer_t); host_page_size(host_port, &pagesize); vm_statistics_data_t vm_stat; if (host_statistics(host_port, host_vm_info, (host_info_t)&vm_stat, &host_size) != kern_success) { nslog(@"failed fetch vm statistics"); } natural_t mem_free = vm_stat.free_count * pagesize; return mem_free; } ios unix system (derived bsd), features both multi-tasking , complex memory management. there little chance there's single process running on phone. if no apps running (i.e. actively terminated other apps "sliding them up" in task switcher), there's gazillion daemons still running perform various t

java - Iterating through only some members of an array -

(full disclosure: coming form ruby guy who's been away java while) entity[] space; class planet extends entity ... class star extends entity ... the space[] array contains mixture of nulls, planets , stars. want access stars in array (which might none.) what's elegant java way of doing it, without using instanceof in java try avoid using arrays (because they’re pain in butt work with). so, first step collection api represent array. list comes mind! list<entity> entities = arrays.aslist(space); now, java 8 has introduced stream api. entities.stream() .filter(e -> e != null) .filter(e -> e instanceof star) .foreach(e -> dosomethingwithstar((star) e)); if want avoid using instanceof need give entity class way differentiate between stars , other objects. boolean isstar() method might achieve that: entities.stream() .filter(e -> e != null) .filter(e -> e.isstar()) .foreach(e -> dosomethingwithstar(

javascript - Form's embedded jQuery Validate link creates an issue sending email, but if creates other issues if moved within file -

i using form validated jquery validate , general validation. currently, having 2 issues: the hierarchy of files have been embedded on page follows: (1) php (2) jquery-1.11.3.js (3) jquery.validate.js (4) jquery validation scripts issue (a) although fields correctly validated , 'red' class added incorrect input fields, email sends success message doesn't appear. if change hierarchy of embedded files to: (1) php (2) jquery-1.11.3.js (4) jquery validation scripts (3) jquery.validate.js issue (b) although fields correctly validated, 'red' class no longer gets added of input fields. also, success message appears form sends email has no inputted data. how around these issues form works way should (in issue a) sends email data in message? so clarify, want form work way in issue (a), problem email being sent blank. if change hierarchy of embedded files, email sends data success message doesn't appear. thanks. html <div id="

regex - Why am I still getting newlines? -

i have following code: open input, "input.txt"; $line = ""; while (<input>) { $line = $_; $line =~ s/\s+^//; print $line; } but output still includes newlines. have tried \v , \r . /\s+^/ means "one or more whitespace characters before start of string" — never match. if goal remove trailing whitespace characters, need $ rather ^ : $line =~ s/\s+$//; (and if goal remove trailing newline, should use the built-in chomp function .)

CloudKit server-to-server auth + security roles -

is possible use security roles server-to-server authentication in cloudkit? server code able create records in public database. you can use system role 'authenticated' , set permission "write/read" on record type want lock down. server server key still able create records of type.

Set a security rule firebase based on a users oauth email -

is there way securely email oauthed in in security rule. ideally wanted create rule like: { ".read": "auth.google.email.matches(/@example.com$/)" ".write": "auth.google.email.matches(/@example.com$/)" } so entire application, or section of application secured email address suffix. easier of way manage application because users given access based on company email have, or nothing. alternatively theres way save users email address database cant write believe achieve similar process. the auth. properties of oauth providers not available in security rules. per documentation on auth variable : the predefined auth variable null before authentication takes place. once user authenticated firebase login's auth method, contain following attributes: provider authentication method used ("password", "anonymous", "facebook", "github", "google", or "twitter&quo

javascript - How to read the value printing inside a jsp (as a custom HTML tag) onChange event in JS -

i using following read image local system , try converting same base64 using moxie. <a id="file-picker" href="javascript:;"></a> base 64 result printing inside code <code id="result"> result printing here</code> i need access result(base 64 value) in js: $("#file-picker").on('change',function(event){ var tmppath ; tmppath = $("#code").val(); how read base 64 value printed inside in js on change event? you can internal data <code></code> using .html() $("#file-picker").on('click',function(event){ var tmppath = $("#result").html(); } and should bind click event on anchors , not change event

YouTube Data API: add a subscription -

i'm using youtube's v3 data api add subscription channel. occurs on wordpress installation. i added google apis (for oauth) on wordpress theme functions: wp_enqueue_script( 'googleapi', 'https://apis.google.com/js/client.js?onload=googleapiclientready', array(), '1.0.0', true ); i added in same way oauth javascript file, first 1 here: https://developers.google.com/youtube/v3/code_samples/javascript . following guide( https://developers.google.com/youtube/v3/docs/subscriptions/insert (apps script)), extended oauth js addsubscription method. google client api seems loaded , working calls correctly googleapiclientready on oauth javascript. so, how subscription being inserted: oauth javascript ... ... ... // after api loads function handleapiloaded() { addsubscription(); } function addsubscription() { // replace channel id channel id want subscribe var channelid = 'this filled channel id'; var resource = { snippet: {

c - How to update an array in vectorized assembly(AVX)? -

inline void addition(double * x, const double * vx,uint32_t size){ /*for (uint32_t i=0;i<size;++i){ x[i] = x[i] + vx[i]; }*/ __asm__ __volatile__ ( "1: \n\t" "vmovupd -32(%0), %%ymm1\n\t" "vmovupd (%0), %%ymm0\n\t" "vaddpd -32(%1), %%ymm0, %%ymm0\n\t" "vaddpd (%1), %%ymm1, %%ymm1\n\t" "vmovupd %%ymm0, -32(%0)\n\t" "vmovupd %%ymm1, (%0)\n\t" "addq $128, %0\n\t" "addq $128, %1\n\t" "addl $-8, %2\n\t" "jne 1b" : : "r" (x),"r"(vx),"r"(size) : "ymm0", "ymm1" ); } i practicing assembly(avx instructions) right write above piece of code in inline assembly replace c code in original function(which commented out). compiling process successful when try run program, error happens: bus error: 10 thoughts bu

Ansible group_vars -

i'm trying automate deployment of sensu checks each role host plays. i have structure group_vars/ nginx in each group_vars file, have defined following: sensu_checks: - check_name - check_other_name so example, in group_vars/all i'd have: sensu_checks: - check_raid - check_load - check_disk in group_vars/nginx i'd have: sensu_checks: - check_pid - check_http what know if it's possible checks specific host should install, example with: - name: print host sensu checks command: echo {{item}} with_flattened: - {{ sensu_checks }} this doesn't work though, gives me group_vars of last group host name defined in. there way flattened list checks of groups host attached to? in previous example, i'd expect [ check_load, check_disk, check_raid, check_http, check_pid ] but instead i'm getting [ check_http, check_pid ] for nginx host (which part of both 'all' , and 'nginx' groups) with_f

transform navbar static to fixed when scroll bootstrap -

i have sample custom navbar , want make fixed on top when scroll sample demo here's mine. demo paste js code in js window in demo. $(document).ready(function() { $('.menu-x').affix({ offset: { top: 0px } }); });

oracle - Primary key using a predefined format in sql -

i trying create table generate primary key automatically using predefined format. this: customer_id name phone cust_1 abc 123 cust_2 def 456 here customer_id auto generated primary key. typically generate number , rest of fluff (cust_ in case) presentation. if it's important can have computed column adds on prefix - make sure put indexes , unique constraints need be.

c# - InvalidCastException in Mono when trying to GetValue() on an IEnumerable -

i'm in process of creating binding solution within mono enables developers have two-way binding. property types work except ienumerable , in reason mono throws invalidcastexception whenever event attempt try , use propertyinfo.getvalue() it. even though propertyinfo shows signs collection<> / ienumerable<> finding type correctly (ie if debug, shows property being passed in derives collection...but can't extract actual value? here's code: var src = source.gettype().getproperty("foo"); if (typeof (ienumerable).isassignablefrom(sourceproperty.propertytype)) { var obj = src.getvalue(source, null); } the error get: invalidcastexception: cannot cast source type destination type. system.reflection.monoproperty.getteradapterframe[vmcontroller,array] (system.reflection.getter`2 getter, system.object obj) (at /users/builduser/buildslave/mono-runtime-and-classlibs/build/mcs/class/corlib/system.reflection/monoproperty.cs:234) syst

javascript - HTML Alert usage issue -

hello having current problem of webpage not loading 2 alert dialog boxes, when comment out second box , line of code webpage works adding second box causes whole page not work. <!doctype html> <!--jason guerrier 2-7-16--> <html> <head> <title> jason guerrier </title> </head> <body> <script> var userage = 0; var value1 = 0; var value2 = 0; var add = 0; var sub = 0; var mul = 0; var div = 0; var mod = 0; var equ; var notequ; var gretha; var grethanequ; var lestha; var lesthaequ; var equequ; var

Prolog - Generate Unique Symbol -

in prolog, aware of gensym predicate: gensym(g, x). x = g1. gensym(g, x). x = g2. gensym(g, x). x = g3. but docs say: "note no guarantee atom unique in system." i looking predicate exactly, if gensymming new symbol, not match 1 used in same program.

java - Android app working in phones but not in tablets -

i've developed android app final project @ college. while developing used physical device testing, android phone 4.4 kitkat. used several smartphone emulators test ui different android versions , worked fine. problem appears when tried run app on tablet , throws java null pointer exception pointing @ button listener (setonclicklistener()). (all buttons belong fragment) have problems when run tablet emulator . didn't post code here because null pointer exception belongs first listener declare, , maybe has device. resume mention above, if it's tablet won't work (even emulator, null pointer exception thrown). if it's phone work. ideas? in advance. your question not clear. guess you've different layouts tab , phone. need post layouts in case. i had similar problem once, i'm guessing that, tab layout has button (which creating null pointer exception) android:onclick="onclick" attribute in declaration. if implicitly implement setonclic

php - Extract paragraph (>800 chars) from text files -

i need extract rather long excerpts text files. reason decided extract first encountered paragraph, >800 characters long, , cut 800 chars, adding "..." in end. if such paragraph not found – step down 700, 600, 500. please me improve php code. or, if know bash-solution – nice too. in advance. if ($text != false && $text != '') { preg_match('#^(.{50,100})(\s+)#s', $text, $asubject); preg_match('#([^\n]{400,800})(.*)#', $text, $aannotation); $text = preg_replace('#([\n\r\t\s]+)#s', " ", $text); // $text = preg_replace('#([\w|\s]+)#s', "\1", $text); $wordcount = count(explode(" ", $text)); // if (isset($aannotation[1]) && isset($asubject[1])) { if (isset($aannotation[1])) { $sannotation = preg_replace('#(\s{2,100})#', ' ', $aannotation[1]); $stmt = $hdb->prepare("insert {$_s['tabletext']} (filename, text) valu

swift - EXC_BAD_ACCESS on accessing NSButton subclass property from view controller -

i'm attempting access nsbutton subclass property view controller, receive following error @ hoverbutton's setimages method: exc_bad_access (code=1, adress=0x0) it seems i'm losing reference, i'm not sure how maintain reference. (still fresh swift & os x dev) in view controller: @iboutlet weak var newaccountbutton: hoverbutton! @iboutlet weak var joinaccountbutton: hoverbutton! ... let off = nsimage(named: "button-off")! let on = nsimage(named: "button-over")! newaccountbutton.setimages(imageoriginal: off, imagehover: over) joinaccountbutton.setimages(nscolor.clearcolor(), imageoriginal: off, imagehover: over) ... class hoverbutton: nsbutton { var trackingarea:nstrackingarea! var hoverbackgroundimage: nsimage! var originalbackgroundimage: nsimage! override init(frame framerect: nsrect) { super.init(frame: framerect) // set tracking area trackingarea = nstrackingarea(rect: bounds, opt

c# - Xamarin.IOS: UITableViewSource crashes on device -

i've simple app contains uitableview , uitableviewsource .. when using uitableview without linking uitableviewsource (the app works in simulator & device ) but when link uitableview uitableviewsource (the app works in simulator crashes on device ) ( device ipad running ios 9.2.1 ) it gives me long error: 2016-02-08 05:16:02.913 secondapp[4487:1711787] critical: stacktrace: 2016-02-08 05:16:02.913 secondapp[4487:1711787] critical: @ <unknown> <0xffffffff> 2016-02-08 05:16:02.915 secondapp[4487:1711787] critical: @ (wrapper managed-to-native) uikit.uiapplication.uiapplicationmain (int,string[],intptr,intptr) <0xffffffff> 2016-02-08 05:16:02.915 secondapp[4487:1711787] critical: @ uikit.uiapplication.main (string[],intptr,intptr) [0x00005] in /users/builder/data/lanes/2689/962a0506/source/maccore/src/uikit/uiapplication.cs:77 2016-02-08 05:16:02.916 secondapp[4487:1711787] critical: @ uikit.uiapplication.main (string[],string,string) [0x

java - Arrayadapter issue in android studio (android.R.layout.something did not work) -

i follow tutorial online , want write following line of code arrayadapter adapter=new arrayadapter(this,android.r.layout.select_dialog_item,countries); however, android.r.layout.select_dialog_item cannot recognized android studio, how can fix this? should import packages? here, reference built-in xml layout document part of android os , rather 1 of own xml layouts. there many more layout check documentation of layout the layouts in sdk installation path (according system sdk path or path have set while downloading sdk) : c:\program files\android\android-sdk\platforms\android-21\data\res\layout android.r.layout.select_dialog_item cannot recognized android studio, how can fix this? you may need change refresh or try changing location of android-sdk should import packages? no, need check whether layout files there in above path of android-sdk if they(layout) in path of sdk refresh(restart) android studio. hope helps.

Android - Locate IP of WAMP Server on a Local Netwiok -

can me? i'm doing android application project. but late me know mysql not entirely compatible android . i can't go now. title said using wamp server host mysql database on local netwok computer. and read ( correct me if i'm wrong ) need actual ip of computer grab data wamp server . if @ given moment ip of hosting computer changes, android application won't able connect mysql database . is there anyway ip of hosting computer programtically? i tried using current ip address of device network ip . example: device ip 192.168.1.2 , hosting computer ip 192.168.20 , know network ip 192.168.1.1 . loop 192.168.1.2 until 192.168.1.254 , loop break/stop if got response needed. saves ip string. public string isconnectedtoserver(string url, int index) { strictmode.threadpolicy policy = new strictmode.threadpolicy.builder() .permitall().build(); strictmode.setthreadpolicy(policy); string result = &qu

java - Else condition seemingly fails to execute -

i creating simple mathematics practice program, running serious issue else conditions. when conditions should trigger else block run, if statement runs instead, ie if program prompts user answer question 7+6, if input 5 still procede if had input proper answer. have combed through each iteration of if else series (this 1 of 5) last few hours, cannot figure occurring prevent else segment running. correctrange / correctrange2 random generated int values (currently 7 & 6 respectively d1 & d2 same values doubles human error parameter when input1 = q program supposed end edit: here updated version, error persists //addition boolean addition = false; while(input1 == 'a'|| input1 == 'a') { system.out.println("what solution problem " + correctrange + " + " + correctrange2 ); double input2 = userinput.nextdouble(); if(input2 <= (d1 + d2) + human || input2 >= (d1 + d2) - human) {system.o

ruby on rails - Globally accessible class that connects to the db during startup only -

i want create globally accessible class in rails project contain active record result sets also. @settings = settings.first @locales = locales.all $websitesettings = websitesettings.new(@settings, @locales) where should creating class, initializer best place? i want able access class inside controllers , views. i understand if data changes in database have restart rails application or update these global instances. put in initializer , set global constant : #config/initializers/settings.rb module settings @settings = settings.first @locales = locales.all website = websitesettings.new(@settings, @locales) end this allow access settings::website throughout app. this applicable if you're calling data through activerecord . if weren't accessing data through db, you'd better using 1 of many settings gems, or adding settings directly rails.config class : #config/application.rb config.settings.title = "test" #-> rails.conf

ios - SpriteKit - How do I handle multiple screen sizes? -

my new game finished , i'm testing on multiple real devices. came across multiple issues after testing. big issue how handle screen sizes. game how want on 6 plus/6s plus, not on 6s, 6, 5s, 5, 4s, 4, or ipad. i found these 2 answers don't know how implement them: how support multiple screen sizes in spritekit? , spritekit how correct screen size i type of help, because irritating me. i reminded of checking screen size , changing node sizes, found answer: how check screen size of iphone 4 , iphone 5 programmatically in swift all had add in gamescene , called in every .swift: extension uiscreen { enum sizetype: cgfloat { case unknown = 0.0 case iphone4 = 960.0 case iphone5 = 1136.0 case iphone6 = 1334.0 case iphone6plus = 1920.0 } var sizetype: sizetype { let height = nativebounds.height guard let sizetype = sizetype(rawvalue: height) else { return .unknown } return sizetype } } and this if uiscreen.mainscreen().sizetyp

Proxy Pass Subdirectory in Apache Passenger with Rails App -

i have rails app ( www.myapp.com ) using apache passenger. virtual host configured follows: <virtualhost *:80> documentroot "/var/www/myapp/current/public" railsenv production <directory "/var/www/myapp/current/public"> options followsymlinks allowoverride none order allow,deny allow </directory> railsbaseuri / </virtualhost> i have blog hosted externally on other domain, lets www.myapp-blog.com . want 301 redirect requests www.myapp.com/blog or www.myapp.com/blog/* relevant pages on www.myapp-blog.com . else should flow through rails app. how should modify above virtual host configuration achieve this? use apache port forwarding technique... <virtualhost *:80> proxypreservehost on proxyrequests off servername www.myapp-blog.com serveralias myapp-blog.com proxypass / http://www.myapp.com/blog/ proxypassreverse / http://www.myapp.com/blog </virt

php - Can't send an image ( on the fly) attachment with mail() -

i trying send attachment receive blank file. doing wrong? so $_post["screenshot"] it's image in da:image/png;base64,.... format , here seems ok, arrives without problem, happens than? why ireceive blank file? how send without saving before(commented area)? <?php header("content-type: application/json; charset=utf-8"); if(isset($_post["screenshot"]) && strlen($_post["screenshot"]) > 0){ $data = str_replace("data:image/png;base64,", "", $_post["screenshot"]); // $png = fopen("screenshot.png", "w"); // fwrite($png, base64_decode($data)); // fclose($png); */ /* ___________ e-mail _____________ */ $to = 'mymail@mail.com'; $subject = 'test email'; $attachment = chunk_split($data); // random hash necessary send mixed content $separator = md5(time()); // carriage return type (we use php end of line constant) $eol = php_eol; // main header (multipart mand

Unable to locate anchor element(href) with javascript in webpage in selenium webdriver(chrome) -

i pretty new selenium. have referred previous posts , found out how click element using javascriptexecutor. unfortunately, not working , can;t going wrong. below code snippet , screenshots: this how found out xpath in chrome: code : @test public void search(){ try{ webelement element = driver.findelement(by.xpath("//a[contains(@href,\"javascript:__dopostback('lbsearch','')\")]")); javascriptexecutor executor = (javascriptexecutor)driver; executor.executescript("arguments[0].click()", element); } catch(exception e){ system.out.println("search element not found."+ e.getstacktrace()); } result : thankx in advance! instead of javascriptexecuter can click selenium function library. your xpath //*[@id='lbsearch'] you can click using below code, @test public void search(){ webelement element = null; try{ element = driver.findeleme

while loop - Simple calculator in java - using boolean to ask if user wants to continue -

i writing basic calculator program in java using joptionpane. new , have received far appreciated! my program suppose ask users number, has them select operator use (+,-,*,/,%) , asks users second number. after this, calculation performed , result displayed. i have working code loops calculator once calculation done, users asked if use again. code works adjust when user asked if want continue , yes, instead of loop going , having input box "welcome calculator!\nplease enter first number:") i'd "please enter first number:" , keep going (since user not need welcomed again). public static void main(string[] args) { double numone; //first number float double numtwo; //second number float double result; //result of equation string num1; //first number string string num2; //second number string string input; //operator type (+,-,*,/,%) boolean usecalculator = false; //false quit, true use while (!usecalculator) { num1

When does MongoDB Fetch results in java driver -

mongoclient mc=new mongoclient(); mongodatabase mdb=mc.getdatabase("testdb"); mongocollection mcol=mdb.getcollection("testcol"); finditerable<document> fi=mcol.find(); mongocursor<document> mcur=fi.iterator(); mongocursor<document> mcur2=fi.iterator(); will mcur , mcur2 have same results time reference of finditerable fi. in step of above code mongodb results inside mongocursor or finditerable step? mcol.find() point results obtained, .find() pull documents collection "testcol" . you don't need use finditerable object ordinary list<basicdbobject> work. then can iterate through using: for(dbobject obj : objlist) { //perform operations string name = (string) obj.get("nameoffield"); } hope helps.

spell check in Google Chrome on windows -

Image
how enable automatic arabic spell check in google chrome ? couldn't editing chrome settings . there packages added externally or can edit in chrome settings. arabic spellcheck not available chrome @ moment, available firefox , can add mozilla add-ons: https://addons.mozilla.org/en-us/firefox/addon/arabic-spell-checking-dictiona/

opal - Freeswitch terminates with signal SIGSEGV, Segmentation fault -

while freeswitch running , call 1 client client client pick call code dumped , throwing following error. i trying allocate memory function nothing happens. core generated `./freeswitch'. program terminated signal sigsegv, segmentation fault. 0 0x00007fb18e95a771 in h245neglogicalchannels::findchannelbysession ( this=<optimized out>, rtpsessionid=rtpsessionid@entry=0, fromremote=fromremote@entry=false, anystate=anystate@entry=false) @ /root/opal/src/h323/h323neg.cxx:1097 warning: source file more recent executable. 1097 if (channel != null && (rtpsessionid == 0 || channel->getsessionid() == >rtpsessionid) && (gdb)