Posts

javascript - IE11 incompatibility with jQuery's 'readonly'? -

the code i'm running has no issues in firefox, or chrome. user typing 1 textbox, tabs next , can continue typing that. when run webpage on ie11, user tabs next textbox , can't type in. textbox has double-clicked before user can insert anything. i've googled , seems ie give problems when using older jquery (i.e. prefers 'prop' 'attr' ). in code below jquery's readonly keyword being used in way ie11 no longer recognise/accept? i assume issue readonly , removeclass('ignore') working expected. //when focus on textbox 1 $("#field1").focus(function() { //remove readonly property textbox 1 $('#field1').prop('readonly', false).removeclass('ignore'); //add readonly property other textboxes $('#field2, #field3, #field4') .prop('readonly', 'readonly').addclass('ignore').val(''); }); i'm using jquery 2.1.3 ...

php - Negate a $regex for mongodb in Yii2 -

i use $regex inside aggregation pipeline $match instruction in php. need find record "does not contain" string. i'v found out online $not operator used such cases, if try this: $regex = "/.*".$sometext.".*"; $use['$not'] = $regex; also 1 not work: new \mongoregex("/.*".$sometext.".*") $use['$not'] = $regex; in short need find text not contain string

c - Saving regex matched strings to an array of strings -

so im starting pick c end goal write function searches string regular expression , returns array of matches. the biggest problem i'm having saving strings memory can return or referenced in pointer passed in parameter. i'd way tell how many matches there c# equivalent; if(matches.count() > 0) { /* have match! */ } resulting string of each match group depending on pattern i'll pass in. i know isn't correct , has other errors in practice here code walked away trying figure out reading on pointers, structs, char arrays..etc typedef struct { char *match; } matches; int main() { regex_t regex; int reti; char msgbuf[100]; int max_matches = 10; regmatch_t m[max_matches]; char str[] = "hello world"; reti = regcomp(&regex, "(hello) (world)", reg_extended); if( reti ) { fprintf(stderr, "could not compile regex\n"); exit(1); } reti = regexec(&regex, str, (size_...

dart - Weird DartEditor behavior / bug? -

Image
i'm working on little website using dart. have 1 project server, , client app (see picture below) in server app serve client app client project this runserver() { var statichandler = createstatichandler(r"c:\users\lukasz\dart\linkshepherdclient\web\", defaultdocument: 'linkshepherd.html',servefilesoutsidepath: true); var handler = new cascade() .add(statichandler) .add(routes.handler) .handler; io.serve(handler, internetaddress.loopback_ip_v4, 8080).then((server) { print('listening on port 8080'); }).catcherror((error) => print(error)); } everything worked fine. changes in client project stopped affecting site served server (a site still loads, older version, different styling, importantly older .dart script file). when run client directly it's project date. opening , closing editor not help. dart editor creating sort of cache? the cache might dart:...

mysql - How to get last 3 data of last 3 week days from a table -

i have table consisting of stock market's daily data. consists of various number of rows each day.i have column named 'high' in table. need calculate max(high) last 3 week days. ex:- if today wednesday need calculate max of last week's friday , week's monday,tuesday. know can if know date manually using query this. select max(high) table_name date>='date' but don't want want automate program written in php. how can achieve in both either php or sql appreciable. table has 6 columns date,time,open,high,low,close say suppose if table this date time open high low close 2015-05-06 09:30:00 2012.50 2020.5 2016.5 2014.0 2015-05-06 09:31:00 2013.50 2021.5 2014.5 2016.0 2015-05-06 09:32:00 2014.50 2021.75 2017.5 2013.0 2015-05-07 09:30:00 2011.50 2019.5 2018.5 2014.0 2015-05-07 09:31:00 2014.50 2022.5 2016.5 2015.0 2015-05-07 09:32:00 2012.50 2026.5 2017.5 2016.0 2015-05-08 ...

unix - Calling python scripts from anywehre -

i have collection of python scripts import each other. if want use these in location scripts not physically present, how can this. tried adding path of dir scripts $path got no joy. appreciated, thanks. python doesn't share own path general $path , able you're looking for, must add scripts in $pythonpath instead.

java - archive for required library can not be read -

i created first maven project , java build path problem in it. description resource path location type archive required library: 'c:/users/simran/.m2/repository/org/glassfish/extras/glassfish-embedded-web/3.1.1/glassfish-embedded-web-3.1.1.jar' in project 'restfulmessenger' cannot read or not valid zip file restfulmessenger build path build path problem this jar present in location mentioned, tried deleteing there , cleaning project , updating maven nothing fixed error. what seems wrong? you should try doing maven -> update project , make sure check force update of snapshots/releases

java - Real Time Scenarios to use singleton class in android -

i know singleton class. want know real time scenarios use singleton class in android . can give me examples in android use , benefits of scenario.. two real scenarios extend application class , use it's instance access app context within class sql database idea singleton class here example of app usage import android.app.application; public class myapplication extends application { private static myapplication instance = null; public static myapplication getinstance() { return instance; } @override public void oncreate() { if (instance == null) { instance = this; } } } access string in r public class dummyclass { private void getappstring(){ string r = myapplication.getinstance().getstring(r.string.app_name); } }

javascript - Creating a slider between two numbers -

so i've been working on re-producing slider found here https://www.skylight.io/ ( scroll down find price slider ). far ive managed create similiar, numbers hard coded, making difficult change , not re-usable. i've been researching around , think need use math.log() , math.exp() achieve in link above i'm not sure. heres jsfiddle of have far https://jsfiddle.net/7wrvpb34/ . i feel maths part of problem halting me think, appreciated. javascript code below: var slider = document.getelementbyid("slider") var sliderfill = document.getelementbyid("slider-fill") var knob = document.getelementbyid("knob") var mousedown; var mousepos = {x:0}; var knobposition; var minprice = 20; var price = 0; var minrequests = 50; var requests = 50 + ",000"; var incrementspeed = 2; var incrementmodifier = 20; var incrementvalue = 1; var minmillioncount = 1; var millioncount = 1; var previousrequestamount = 0; document.getelementbyid("pr...

c# - Adding Dynamic Controls to Web Forms -

i trying add new dynamic controls on button click not adding multiple labels, want retain state of control after postback adding textbox typed in value should there. public partial class _default : system.web.ui.page { list<string> controlids = new list<string>(); static int count = 0; protected override void loadviewstate(object savedstate) { base.loadviewstate(savedstate); controlids = (list)viewstate["controlsid"]; foreach (string id in controlids) { count++; label dynamic_typeinerror = new label(); dynamic_typeinerror.id = id; tablerow tbl_rows = new tablerow(); tablecell tbl_cell = new tablecell(); tbl_cell.controls.add(dynamic_typeinerror); tbl_rows.cells.add(tbl_cell); plc.controls.add(tbl_rows); } } protected void bt_adddynamiccontrols_click(object sender, eventargs e) { count++; label dynamic_typeinerror = new label(); dynamic_typeinerror.id = "dynami...

javascript - Add a class On Click - JS Tab -

i have 3 tabs, class 'fetch_records' . when user clicks on other tab, clicked tab should activated adding new class 'years_active' , other should remain same , class 'years_active' removed if any. my code : $('.fetch_records').click(function (e) { $('.fetch_records').removeclass('years_active'); $(this).addclass('years_active'); e.preventdefault(); $('.ajax-loader').show(); var year = $(this).attr('data-year'); $.ajax({ ...do something... success: function (msg) { ...show success message... } }); }); html: <li><a data-year="2001" class="fetch_records years_active"> 2001 <a/> </li> <li><a data-year="2002" class="fetch_records"> 2002 <a/> </li> <li><a data-year="2003" class="fetch_records"> 2003 <a/> </li> ...

ios - Draw an Image stretched on x-dimension? -

Image
i have uiimage has frame of (0,0,100,100) now want draw image frame of size (0,0,120,100) i want image stretched. don't want stretch parts of image. want point involved. whole image should stretched proportionally. how can that? here options when comes setting contentmode of view. i shamelessly searched uiview contentmode on google images.

ios - Could not pre-launch appium and app doesn't get installed in iphone real device using appium -

Image
i using appium version 1.3.7. i have connected physical device via usb. i have launched appium server,after while appium crashed. i have pasted full log below. i have attached screen shot below. launching appium command: '/applications/appium.app/contents/resources/node/bin/node' lib/server/main.js --command-timeout "7200" --pre-launch --platform-version "8.1" --platform-name "ios" --app "/users/al/work/sample.app" --udid "f5de3fd5ccded92e40e86c652ce2a6f9414fe1a0" --device-name "iphone 4s" info: [debug] starting appium in pre-launch mode info: pre-launching app info: [debug] using local app command line: /users//al/work/sample.app info: [debug] creating new appium session 1cdc5dc0-36d2-40b9-922b-33601f28846b info: [debug] removing remaining instruments sockets info: [debug] cleaned instruments socket /tmp/instruments_sock info: [debug] setting xcode folder info: [debug] setting xcode version info:...

complicated join in spark: rdd elements have many key-value pairs -

i'm new spark , trying find way integrate information 1 rdd another, structures don't lend standard join function i have on rdd of format: [{a:a1, b:b1, c:[1,2,3,4], d:d1}, {a:a2, b:b2, c:[5,6,7,8], d:d2}] and of format: [{1:x1},{2,x2},{3,x3},{4,x4},{5,x5},{6,x6},{7,x7},{8,x8}] i want match values in second rdd keys in first rdd (which in list value in c key). know how manipulate them once they're there, i'm not concerned final output, i'd maybe see this: [{a:a1, b:b1, c:[1,2,3,4],c0: [x1,x2,x3,x4], d:d1}, {a:a2, b:b2, c:[5,6,7,8],c0: [x5,x6,x7,x8], d:d2}] or this: [{a:a1, b:b1, c:[(1,x1),(2,x2),(3,x3),(4,x4)], d:d1}, {a:a2, b:b2, c:[(5,x5),(6,x6),(7,x7),(8,x8)], d:d2}] or else can match keys in second rdd values in first. considered making second rdd dictionary, know how work with, think data large that. thank much, appreciate it. join after flatmap , or cartesian makes many shuffles. one of possible solutions use cartesian...

ios - How to set the same image for iPhone Retina Display and iPad non Retina -

i have developed universal app , import graphics stuff. came across following thought. if icon referred iphone retina display , file referred ipad non retina display has same size, there way not import same file different names (icon@2x.png & icon~ipad.png) twice? i not sure if there such icon size have same size iphone retina , ipad non retina device(pardon me if incorrect). if talking normal image want same iphone retina , ipad non retina, , want app automatically select same image both devices mentioned above then, no. can manually though, know.

apache - ajax not working showing forbidden error -

hi ajax code $("#ajax_login_form").on('submit',function(event){ var datastring = $("#ajax_login_form").serialize(); $.post('http://myshowcam.com//users/login', datastring, function(response){ }, 'json'); }); after submitting form below error in console. forbidden you don't have permission access /testsite/users/login on server. additionally, 404 not found error encountered while trying use errordocument handle request. apache/2.2.15 (centos) server @ myshowcam.com port 80 please help.thank in advance. ok. makes more difficult then. knowing how configure apache extremely crucial. assuming using cakephp 3, try following instructions here: http://book.cakephp.org/3.0/en/installation.html#apache . file located @ /etc/httpd/conf/http.conf . best approach use virtual_hosts location of file created here /etc/httpd/conf.d/ . example, have myshowcam.com.conf there. there plenty of virt...

How to upload an image from my iOS app to a PHP server? -

i don't know php , swift can me? have server: cs.hisarschool.k12.tr/ecs.php , code: <?php $firstname = $_post["firstname"]; $lastname = $_post["lastname"]; $userid = $_post["userid"]; $target_dir = "/var/www/html/uploads"; // $myfile = fopen($target_dir, "w"); if(!file_exists($target_dir)) { echo "creating directory"; mkdir($target_dir, 0555, true); } //$target_file = $target_dir . "/" . basename($_files["file"]["name"]); $target_file = $target_dir . "/sc.jpg"; if (move_uploaded_file($_files["file"]["tmp_name"], $target_file)) { echo json_encode([ "message" => "the file " . basename($_files["file"]["name"]) . " has been uploaded.", "status" => "ok", "userid" => $_request["userid"] ]); } else { echo json_encode([ ...

c# - What is a NullReferenceException, and how do I fix it? -

i have code , when executes, throws nullreferenceexception , saying: object reference not set instance of object. what mean, , can fix error? what cause? bottom line you trying use null (or nothing in vb.net). means either set null , or never set @ all. like else, null gets passed around. if null in method "a", method "b" passed null to method "a". the rest of article goes more detail , shows mistakes many programmers make can lead nullreferenceexception . more specifically the runtime throwing nullreferenceexception always means same thing: trying use reference, , reference not initialized (or once initialized, no longer initialized). this means reference null , , cannot access members (such methods) through null reference. simplest case: string foo = null; foo.toupper(); this throw nullreferenceexception @ second line because can't call instance method toupper() on string reference pointing null ....

linux - what's the best way to fast copy some big file from serval servers to hunderands servers? -

there big file on serval of servers, want copy servers fast possible. below current script, there faster way this, viral distribution, example: source a, targets b c d. a->b, after b done ,then b->c , a->d (at same time) . how can improve script, sugesstion, ! #!/bin/bash set -u source_pool=(seq -f 10.10.10.%g 10 20) host_ip_list=(seq -f 10.10.10.%g 21 200) ready_flag=/tmp/ready_flag lock_flag=/tmp/lock_flag do_lock(){ ip=$1;shift 1 ssh root@$ip "touch $lock_flag" } do_unlock(){ ip=$1;shift 1 ssh root@$ip "rm -f $lock_flag" } find_source(){ while true;do source_ip in ${source_pool[@]} ping $source_ip -c 1 1>/dev/null 2>/dev/null if [[ $? -ne 0 ]];then continue fi ssh root@$source_ip "ls $lock_flag" 1>/dev/null 2>/dev/null if [[ $? -eq 0 ]];then continue fi ss...

python - Untar a file and find the links(short/full) in the text -

i working on tar file, 100 mb file. need see links in text , find comments/likes/shares links. untar file , save json using python, on converting csv using import csv, json, sys input = open(input.json) data = json.load(input) input.close() output = csv.writer(output.csv) output.writerow(data[0].keys()) row in data: output.writerow(row.values()) i left 1kb file there way without converting json? or using r?