Posts

Showing posts from March, 2011

export - How to provide a function in a Racket environment on the Raspberry Pi? -

i want execute program (written in racket) on raspberry pi when doing so, doesn't know functions defined in file. the small example below gives rise following error on raspberry pi : default-load-handler: expected 'module' declaration "test", found: else in: ... file i'm executing on raspberry pi : (require "test.rkt") (display "2 + 2 = ") (display (plus 2 2)) the "test.rkt" file : (provide plus) (define (plus b) (+ b)) when executing file doesn't display gives rise error listed above. note files don't contain : "#lang racket". because if contain it, loading file nothing. so following file nothing when loaded on raspberry pi : #lang racket ; when omitting "hello world!" displayed, else not (display "hello world!")

testing - C# Web Service Unit Tests -

i have following entity: amount currency - string value - decimal i have wcf service uses entity , want make unit test class. my problem want test invalid values value in entity , if try assign in in c# amout m = new amout{currency = "eur", value = "aaaa"} gave error. how can test situation? for example can make following request in soapui: <itc1:amount> <itc2:currency>eur</itc2:currency> <itc2:value>aaaaaa</itc2:value> </itc1:amount> and error service. i want make same unit test. i hope can me. are looking : [testmethod()] [expectedexception(typeof(knownexceptiontype))] public void test() { //do throws knownexceptiontype }

c - Freeing an array within a struct -

for assignment have write circular queue (which imagine of familiar with). made structure , function initializes queue struct using dynamic memory. note have array arr within struct assign memory. for reason can't seem free array memory. struct queue { element_t *arr; // dynamic array containing data elements int current_size; // counts number of elements in queue int front, rear; // remark later: fields need added here make thread-safe queue needed assigment }; queue_t* queue_create(){ struct queue *queue = malloc(sizeof(struct queue)); if(queue == 0){ //check if memory available printf("out of memory\n"); return null; } queue -> current_size = 0; queue -> front = -1; queue -> rear = -1; queue -> arr = malloc(queue_size*sizeof(element_t)); return queue; } i'm trying free memory when i'm done using function queue_free. function takes in double pointer queue (part of assignment). void queue_free(que...

swift - Trying to start MapKit location updates without prompting for location authorization -

in app use mkmapkit , mkusertrackingbarbuttonitem locate user on tap. when tap button, output console returns error: trying start mapkit location updates without prompting location authorization. must call -[cllocationmanager requestwheninuseauthorization] or -[cllocationmanager requestalwaysauthorization] first. according me, error caused because requestwheninuseauthorization() not invoked yet. in fact, mkusertrackingbarbuttonitem tap calls func mapviewwillstartlocatinguser presupposes cllocationmanager requestwheninuseauthorization first: func mapviewwillstartlocatinguser(mapview: mkmapview!) { println("**** mapviewwillstartlocatinguser ****") // servizi di localizzazione sono abilitati? if (cllocationmanager.locationservicesenabled()) { // setto il locationmanager ed il delegate locationmanager = cllocationmanager() locationmanager.delegate = self // abbiamo l'autorizzazione ad accedere ai servizi d...

php - Wordpress: After transfer images to cdn featured images and thumbnails gone -

so confusing me, i transferred media amazon s3 , files amazon ec2, i'm holding mysql in amazon rds service. before transfer have changed notepad media path from: http://www.olddomain.com/wp-content/uploads/ to http://www.amaazons3serviceurl.com/wp-content/uploads/ and have uploaded it, first day ok, saw images amazons3, media section of wordpress admin menu amazons3 media url, after day when configurating wordpress, happened, , reverted thumbnails featured images gone, shows on thumbnails url http://www.olddomain.com/wp-content/uploads / but if go ppost shows insite amazon s3 photo displaying. i have tried: restore database several times (4 or 5) tried regenerate thumbnails plugins (3 different, waited several hours because have more 24k photos, didn't help) tried clean cache tried updating database sql query with: update wp_posts set guid = replace (guid, 'http://oldcomain.com/', 'http://mynewcdndomain.com/') post_type =...

javascript - Incorrect mouse event zooming in windows surface using easeljs / createjs -

i have website uses createjs , canvas. objects have associated click event. works in browsers , mobile devices, except in windows surface. if zoom in windows surface click event lost when screen moves. works when matched (0,0) screen. example: http://intelisen.com/apok/simple.html zooming , moving no longer works circle click event. any suggestions? thank you

Python issue when reading from a file -

hello doing school project , wrote out got working next task make read message file changed definition asked message usermessage() run code works prints out whats in text file when last bit gets final answer shows error traceback (most recent call last): file "c:\users\christian\desktop\python\2 keywor cypher code.py", line 138, in <module> restart() file "c:\users\christian\desktop\python\2 keywor cypher code.py", line 127, in restart text = translatemessage2(key2, message2, option) file "c:\users\christian\desktop\python\2 keywor cypher code.py", line 107, in translatemessage2 translated.append(symbol) # symbol not in letters, add translated is. nameerror: name 'translated' not defined import pyperclip valid_letters = 'zabcdefghijklmnopqrstuvwxy' # stores letters witch being used in program def linespacer(): print('================================================================') ...

java - Wicket AjaxLink isLinkEnabled() = false renders a clickable span -

i'm using wicket 6.11 , have come across strange error. have wicket ajaxlinks icons inside of them on large application, islinkenabled() can return false based on various circumstances. when does, renders link disabled expect (a span tag em tag inside it), when click on icon, event still fires! example code: ajaxlink<object> button = new ajaxlink<object>( "editlocationbutton" ) { private static final long serialversionuid = 1l; public void onclick( ajaxrequesttarget p_target ) { // things } /** * @see org.apache.wicket.markup.html.link.abstractlink#islinkenabled() */ @override protected boolean islinkenabled() { return super.islinkenabled() && getselectedlocation() != null; } }; html file: <td style="width:0%"> <a href="#" wicket:id="editlocationbutton" class="editbutton iconbutton"> <wicket:message key=...

java - Creating a class to record student grades -

i know there quite few errors in code, can't find them/don't understand them. doing wrong? update: thank help. have managed clear out errors except one. still errors on getgradescore. error: cannot find symbol error: illegal start of type public class studentrecord { /***declarations**/ private int quizscore1; private int quizscore2; private int quizscore3; private int midtermscore; private int finalscore; /***accessor methods**/ public int getquizscore1() { return quizscore1; } public int getquizscore2() { return quizscore2; } public int getquizscore3() { return quizscore3; } public int getmidtermscore() { return midtermscore; } public int getfinalscore() { return finalscore; } /***mutator methods**/ public void setquizscore(int quizscore1, int quizscore2, int quizscore3) { if (quizscore1 < 0 |...

javascript - Why angularJS loop rendering boxes in new row -

Image
i have products want display side side this. this hard coded code works fine. <div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> <div class="box"></div> but when trying achieve same thing angularjs loop. <div ng-repeat="product in products"> <div class="box"> //i fill details here. </div> </div> i got result. this css class. .box { padding : 5px; display : inline-block; min-width: 100px; min-height: 50px; background-color: red; } what changes need products can display side side , in next row if screen width full. fixing original problem your ng-repeat should on <div class="box"> <div> <div ng-repeat="product in products"...

c# - Convert color scan image to grayscale image for PDF417 decoder xzing -

i'm decoding pdf417 2d barcode in scanned image using zxing.net library. far, have found gray-scale scanned image(8bit depth) working fine , color scanned image(24 bit depth) not working. tried covert color scanned image gray-scale image using below method. private bitmapsource convertgray(bitmapsource bi) { formatconvertedbitmap newformatedbitmapsource = new formatconvertedbitmap(); newformatedbitmapsource.begininit(); newformatedbitmapsource.source = bi; newformatedbitmapsource.destinationformat = pixelformats.gray8; newformatedbitmapsource.endinit(); return newformatedbitmapsource; } but, zxing.net not detect pdf417 2d barcode in converted gray-scale image. how can convert color scanned image gray-scale image same format gray-scale scanned image.

php - Is it possible to include an image in a HTML email in Laravel -

i'm trying send html email via laravel's mail::send() . view in i'm using blade template, i'm not quite sure on how go including image in body of email. in template, have <h4>you have updated session!</h4> @if ( $old_date != $date) <p>you have changed {{ $old_date }} {{ $date }}</p> @endif <p>if have questions or concerns, please contact office of admissions</p> {{ html::image('/images/full-logo.png', 'logo') }} however, email comes out broken link icon in body of email. possible pass image parameter view? in controller sends email, have $data = array ( 'first_name' => $student->first_name, 'last_name' => $student->last_name, 'date' => $day, 'old_date' => $old_day, ); mail::send ( '/emails/create_student', $dat...

SAS - proc sql for table update in a macro -

i have code tries update table in macro block using macro variables in sub-query. challenge have @ times of macro variables null, making code fail. how can set ignore when macro varible produces null value? %macro update_bucket; %let macro_fudge = %nrstr(%mend); proc sql; %do i=1 %to &rows.; %do j=1 %to &max_comb.; %do k=1 %to &max_lgd_comb.; %do l=1 %to &max_pd_comb.; %let x = _&&k.lgd&i.; %let y = _&&l.pd&i.; %if &x. ^=ltv %then %do; update sbbook_rb_a set riskbucket = (select risk_bucket portfolio_split_d b a.businessgroup = b.portfolio , a.product2 = b._&j.subport , a.&&&x. >= b.min_lgd_driver_%left(&k.) /* @ times "a.&&&x." returns null value */ ...

java - Weird behaviour of compareTo(GregorianCalendar c) -

could tell me why fillowing code: int = new gregoriancalendar(2015,3,31,7,45).compareto( new gregoriancalendar(2015,4,1,7,45); system.out.println(a); prints out 0? is there way make work right? ps: need sort strings out date , use comparator: array.sort(new comparator<string>() { @override public int compare(string o1, string o2) { gregoriancalendar cal1 = new gregoriancalendar(integer.parseint(o1.replaceall(p, "$7")), integer.parseint(o1.replaceall(p, "$6")), integer.parseint(o1.replaceall(p, "$5")), integer.parseint(o1.replaceall(p, "$8")), integer.parseint(o1.replaceall(p, "$9"))); gregoriancalendar cal2 = new gregoriancalendar(integer.parseint(o2.replaceall(p, "$7")), integer.parseint(o2.replaceall(p, "$6")), integer.parseint(o2.replaceall(p, "$5")), integer.parseint(o2.replaceall(p, ...

sql - Inserting data into table variable -

i want know if it's possible insert data table variable select query. when using variable table before have inserted values , typed them myself. i have come following select query displays latest comment repair order. returns 37 records , wanted know if it's possible insert variable table. select a.ch_repref, a.ch_date, a.ch_crtime, b.[latest customer comment], a.ch_cruser, a.ch_ccommnt (select ch_repref, max(ch_repref1) [latest customer comment] dbo.v_csrpch ch_ccommnt not null , ch_ccommnt not 'x' group ch_repref) b, (select ch_repref, ch_date, ch_crtime, ch_repref1, ch_cruser, ch_ccommnt, ch_account dbo.v_csrpch) ch_repref1 = [latest customer comment] , ch_account = 'ddchc' i have started table variable following, stuck whether it's possible fill data returned select query: declare @tbl_last_customer_comment table (ch_rep...

shell - basic Unix command not found -

i've installed mysql on laptop. now when launch terminal window , unix command grep , message: -bash: grep: command not found -bash: cat: command not found ... what's happen ? have skills or ideas retrieve precious unix functions ? i'd put in comment, don't have enough reputation, sorry! basic unix commands grep or cat in folder: /usr/bin in order them work, need have correct set of path variable. might have changed unknowingly during installation of mysql. can fix temporarily trying like: export path=$path:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin this add whatever have on path @ moment, "normal" routes precious unix functions. try commands again after executing line in terminal, , let know :)

javascript - Object undefined when declared before setInterval function -

this question has answer here: how access correct `this` inside callback? 5 answers i'm new typescript, coming java , having knowledge of javascript. i'm learning ts making old snake game! i have class gui should draw canvas. in contructor start creating snake object. later on start game loop in snake should moved... but loop function not work, because of error. "uncaught type error: cannot read property 'move' of undefined." i suspect has setinterval function works 'asyncronously' or i'm not sure... seems kind of fundamental javascript problem. any highly appreciated! module gui { export class gui { snake:model.snake; loop:any; constructor() { // snake this.snake = new model.snake(); // attach key event document.addeventlistener("keydow...

apache - .htaccess Force Trailing Slash Rewrite -

apologies i'm new url rewrites. i've managed rewrite working in conventional sense cannot force have trailing slash. here code: rewriteengine on rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename}\.html -f rewriterule ^(.*)$ /$1.html [l,qsa] you can try: rewriteengine on rewritebase / # add trailing slash non-files rewritecond %{request_filename} !-f rewriterule [^/]$ %{request_uri}/ [l,r=301,ne] rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_filename}\.html -f rewriterule ^(.*)/?$ $1.html [l]

windows - Why is SetWindowsHookEx() returning NULL and LastError is ERROR_HOOK_NOT_INSTALLED -

i have code has been working without reported issues few years. sets low level keyboard hook user uses activate application. m_hkeyboardhook = setwindowshookex(wh_keyboard_ll, keybhookfn, getmodulehandle(null), 0); for 1 user of sudden (it worked him before years well), keyboard hook isn't working. upon investigation, can see setwindowshookex() returning null , getlasterror() returning 0x00000597 , error_hook_not_installed . i can't find documentation on means. what possibilities why might happen? system security settings? user account privileges? user using windows 7. i need specific answer how make error occur can solve user's problem looking @ http://blogs.msdn.com/b/alejacma/archive/2010/10/14/global-hooks-getting-lost-on-windows-7.aspx , seems might occur if cpu load high. another thought: did break when upgrading 64-bit windows? don't know if applies ll hooks, cannot inject 32-bit dll in 64-bit process. finally: ll hooks won't captu...

sql server 2008 r2 - How do I transpose multiple rows to columns in SQL -

my first time reading question on here. i working @ university , have table of student ids , supervisors, of students have 1 supervisor , have 2 or 3 depending on subject. the table looks this id supervisor 1 john doe 2 peter jones 2 sarah jones 3 peter jones 3 sarah jones 4 stephen davies 4 peter jones 4 sarah jones 5 john doe i want create view turns this: id supervisor 1 supervisor 2 supervisor 3 1 john doe 2 peter jones sarah jones 3 peter jones sarah jones 4 stephen davies peter jones sarah jones 5 john doe i have looked @ pivot functions, don't think matches needs. any appreciated. pivot right clue, needs little 'extra' :) declare @tt table (id int,supervisor varchar(128)); insert @tt(id,supervisor) values (1,'john doe'), (2,'peter jones'), (2,'sarah jones'), (3,'peter jones'), (3,'sarah jones'), (4,'stephen davies'), (4,...

unity3d - unity2D C# - player must press two switches to open door -

essentially have door trigger event if player presses switch door open. wish if door associated needs 2 switches open well... opens if 2 switches pressed. here code interactswitch public class interactswitch : monobehaviour { animator animator; public dooreventtrigger[] doortriggers; public bool pressed; private bool down; // use initialization void start () { animator = getcomponent <animator> (); } // update called once per frame void update () { } void oncollisionenter2d (collision2d target) { if (target.gameobject.tag == "player") { down = true; animator.setinteger ("switchtrig", 1); foreach (dooreventtrigger trigger in doortriggers) if (trigger != null) trigger.toggle (true); } } when triggered event checks player, shows switch has been pressed sends bool function called toggle handles o...

python - Combine two lists based on a column -

i trying combine 2 lists based on field (similar performing inner join) list : name, position, employee id sample entries 1) bob, admin, 32443 2) jack, security, 5464 list b: position, tasks sample entries 1) admin, check system files 2) admin, add users 3) admin, delete users 4) security, perform review 5) security, check settings i need final output this: bob, admin, 32443, check system files bob, admin, 32443, add users bob, admin, 32443, delete users jack, security, 5464, perform review jack, security, 5464, check settings please guide me how include such code in simple loops. new python thank in advance take cartesian product, skip items fail join condition: ((name, position, emp_id, tasks) name, position, emp_id in lista position2, tasks in listb if position == position2) if use itertools , can shorten avoid nested for loops: ((name, position, emp_id, tasks) (name, position, emp_id), (position2, tasks)...

bayesian - Normalizing constant for beta distribution with discrete prior : R code query -

i going through bayesian thinking r jim albert. have query code example beta likelihood , discrete prior. code calculating posterior is: pdisc <- function (p, prior, data) s = data[1] # successes f = data[2] # failures ############# p1 = p + 0.5 * (p == 0) - 0.5 * (p == 1) = s * log(p1) + f * log(1 - p1) = * (p > 0) * (p < 1) - 999 * ((p == 0) * (s > 0) + (p == 1) * (f > 0)) = exp(like - max(like)) ############# product = * prior post = product/sum(product) return(post) } my query highlighted bit of code calculating likelihood , logic behind (not explained in book). i'm aware of pdf beta distribution, , log likelihood proportional s * log(p1) + f * log(1 - p1) not clear following 2 lines doing - imagine it's normalizing constant, again there isn't explanation in book. the line like = * (p > 0) * (p < 1) - 999 * ((p == 0) * (s > 0) + (p == 1) * (f > 0)) takes care o...

api - Heroku subdomains redirect -

so, have domain api.suapraia.org config custom domain of heroku app. but when send request on new domain resource exposed on api(api.suapraia.org /some_resource ) heroku redirects suapraia-api.herokuapp.com //some_resource is there need on domain config? i've deleted godaddy's config , started out 0 following post on heroku's blog: https://blog.heroku.com/archives/2009/10/7/heroku_casts_setting_up_custom_domains it working now

C++ linker error combining c and cpp code: 'unsupported file format' -

i'm trying combine c , c++ code, when try link unexpected error: ld: warning: ignoring file edmonds.o, file built unsupported file format ( 0x43 0x50 0x43 0x48 0x01 0x0c 0x00 0x00 0x64 0x08 0x00 0x00 0x0b 0x02 0x68 0x42 ) not architecture being linked (x86_64) here's setup: dummy.c void edmonds(int n, double* weights, int* heads); int main() { int = 1; edmonds(1234,0,&a); return 0; } edmonds.hpp: extern "c" void edmonds(int n, double* weights, int* heads); void edmonds(int n, double* weights, int* heads) { heads[0]=n*4; return; } i compile manually using following sequence of commands: clang -c dummy.c -o dummy.o clang++ -c edmonds.hpp -o edmonds.o clang++ edmonds.o dummy.o -o main.o with above mentioned result ld: warning: ignoring file edmonds.o, file built unsupported file format ( 0x43 0x50 0x43 0x48 0x01 0x0c 0x00 0x00 0x64 0x08 0x00 0x00 0x0b 0x02 0x68 0x42 ) not architecture being linked (x86_64): edmonds.o ...

shell - What does `sort +0 -1` do? -

i have old script contains variant of sort +0 -1 , man sort in system not mention existence of these options. from another question , led the wikipedia page sort , says: in old versions of sort, +1 option made program sort using second column of data ( +2 third, etc.). deprecated, , instead -k option can used same thing. but not mention negative argument such -1 supposed do. note that, in "modern" sort (gnu coreutils 8.21), sort +0 -1 works, while of following fail: sort +0 +1 , sort -0 -1 , , sort -0 +1 . i can add pairs of numbers (e.g. sort +0 -1 +2 , sort +0 -1 +2 -3 ), short test case cannot precisely infer meaning. edit : completeness, nowadays invalid command such sort +0 +1 equivalent sort -k1 -k2 . as per gnu info page on sort : on older systems, ‘sort’ supports obsolete origin-zero syntax ‘+pos1 [-pos2]’ specifying sort keys. obsolete sequence ‘sort +a.x -b.y’ equivalent ‘sort -k a+1.x+1,b’ if y ‘0’ or absent, otherw...

haskell - What are the space complexities of inits and tails? -

tl; dr after reading passage persistence in okasaki's purely functional data structures , going on illustrative examples singly linked lists (which how haskell's lists implemented), left wondering space complexities of data.list 's inits , tails ... it seems me that the space complexity of tails linear in length of argument, and the space complexity of inits quadratic in length of argument, but simple benchmark indicates otherwise. rationale with tails , original list can shared. computing tails xs consists in walking along list xs , creating new pointer each element of list; no need recreate part of xs in memory. in contrast, because each element of inits xs "ends in different way", there can no such sharing, , possible prefixes of xs must recreated scratch in memory. benchmark the simple benchmark below shows there isn't of difference in memory allocation between 2 functions: -- main.hs import data.list (inits, tails) ...

performance - Web Api Owin Hosted - Throughput dropping -

we've copied api have being iis hosted console app (to hosted owin + topshelf service) , have been performance profiling 2 hosting options using jmeter. we throw 18 threads @ apis , differing results iis hosted vs console hosted, follows : response times through iis slower. isn't surprising pipeline in iis more involved. throughput through iis consistent, i.e. don't see significant increases/decreases in throughput (we achieve 5500 requests/responses per min) throughput when hosted in console app starts off high (20,000 per min) degrades approximately 4,500 per min on 10 minute period. we're trying determine cause of throughput drop when hosting console. why start 20,000 requests per min (presumably calculated on initial response times when hasn't run minute) degrade 4,500? other things of note, cpu isn't concern. it's fluctuates start settles below 30% available, , memory average 1.34gb on 4gb ram machine. why might throughput in iis stabl...

c - Redirecting execvp path -

i'm trying write simple code execute program subfolders input file , print thr result output file. my problem when execute program keeps failing on me. since execvp command trying exe named "a.out" on wrong location. in (desktop rather searching correct path address). here's code. please me out :) pid_t runner; char enter[] = "/home/demo/desktop/os/ex1/ex12/code/input.txt"; // input file char path[] = "/home/demo/desktop/os/ex1/ex12/ex1/ronen/"; correct path char *r [] = {"./a.out", null}; int savedfd = dup(0); int sever2fd=dup(1); int fdin = open(enter,o_rdonly); int fdout = open ("output.txt", o_creat | o_rdwr, 0466); dup2(fdin, 0); dup2(fdout, 1); if ((runner = fork()) < 0) {perror("could not make fork");} else if (runner == 0) { if (execvp(r[0],r) < 0 ) {printf("failed!\n");} } else if (runner != 0) { waitpid(runner,0,0); dup2(savedfd, 0); dup2(sever2fd, 1); printf(...

android - IOUtils writer error Java connect to GAE -

Image
i import writer apache. error occured when try using it. in url. i following on link: store image blobstore android client , retrieve blobkey , upload url store in datastore. - gae does know error? updated here full code: import android.os.bundle; import android.support.v7.app.actionbaractivity; import android.view.menu; import android.view.menuitem; import com.google.api.client.util.ioutils; import org.apache.http.httpentity; import org.apache.http.httpresponse; import org.apache.http.client.clientprotocolexception; import org.apache.http.client.httpclient; import org.apache.http.client.methods.httpget; import org.apache.http.client.methods.httppost; import org.apache.http.entity.contenttype; import org.apache.http.entity.mime.multipartentitybuilder; import org.apache.http.impl.client.defaulthttpclient; import org.apache.http.util.entityutils; import org.json.jsonexception; import org.json.jsonobject; import java.io.file; import java.io.ioexception; import java.io...

What's up with spacing and syntax errors in Shell Scripts? -

i'm pretty familiar , comfortable batch scripts on windows. i've started out on unix , i'm having hard time getting hang of spacing things properly. the script below works fine. let's call script1.sh !#/bin/sh now=$(date +"%s") echo "this file created on $now" this script pasted below throws error ,also i've pasted further below !#/bin/sh now=$(date + "%s") echo "this file created on $now" [root@localhost /]# sh postbackup.sh postbackup.sh: line 1: !#/bin/sh: no such file or directory date: operand `%s' try `date --help' more information. file created on why space between + , "%s" matter ? additional information on how might affect in other cases extremely helpful. you have 2 errors in script: postbackup.sh: line 1: !#/bin/sh: no such file or directory this because should use !# (wrong), , not #! (correct), , tries run !#/bin/sh command, doesn't exist. error otherw...

vb.net - How to get a list of excel cell 'name' references in vbnet? -

i'm trying copy data 1 excel workbook another. both workbooks have same cell 'name' reference, data contained in cell references identical hence why im trying list references (to later map values) . is there way can list cell references in workbook using vbnet? a loop perhaps?

regex - Get Value from string between ":" and "," -

here example of string "{"id":128,"order":128,"active":"1","name":"\" now need "128" - id parameter. first value between ":" , ",". i have tried preg_match , different regular expressions i'm not in regular expressions. maybe knew how make ? $id = preg_match('/:(,*?)\,/s', $content, $matches); here sample code number after first : using regex: $re = "/(?<=\\:)[0-9]+/"; $str = "\"{\"id\":128,\"order\":128,\"active\":\"1\",\"name\":\"\""; preg_match($re, $str, $matches); print $matches[0]; here sample program on tutorialspoint . just small detail regex (?<=\\:)[0-9]+ : uses fixed-width look-behind php supports , fortunately.

MySQL "Cannot add or update a child row: a foreign key constraint fails" -

i'm new mysql , databases in general. i've been tasked manually moving old database new 1 of different format. challenges include transferring columns table in 1 database database of similar format. made further difficult in source database myisam , destination innodb. so have 2 databases, source , b destination, , attempting copy 'most' of table similar table in destination database. here command run: insert b.article (id, ticket_id, article_type_id, article_sender_type_id, a_from, a_reply_to, a_to, a_cc, a_subject, a_message_id, a_in_reply_to, a_references, a_content_type, a_body, incoming_time, content_path, valid_id, create_time, create_by,change_time, change_by) select id, ticket_id, article_type_id, article_sender_type_id, a_from, a_reply_to, a_to, a_cc, a_subject, a_message_id, a_in_reply_to, a_references, a_content_type, a_body, incoming_time, content_path, valid_id, create_time, create_by, change_time, change_by a.article id not...

Jetty return 403 -

i use jetty in project , created p-to-p connections pc(nodes). , have problem in 1 of them. don't use xml , build jar file. if (apiresourcebase != null) { servletholder defaultservletholder = new servletholder(new defaultservlet()); defaultservletholder.setinitparameter("dirallowed", "false"); defaultservletholder.setinitparameter("resourcebase", apiresourcebase); defaultservletholder.setinitparameter("welcomeservlets", "true"); defaultservletholder.setinitparameter("redirectwelcome", "true"); defaultservletholder.setinitparameter("gzip", "true"); apihandler.addservlet(defaultservletholder, "/*"); apihandler.setwelcomefiles(new string[]{"index.html"}); } in pc works, in 1 pc, jetty return 403, if go / or 404 if go /index.html ...

Encode html entities in javascript -

i working in cms allows users enter content. problem when add symbols ® , may not display in browsers. set list of symbols must searched for, , converted corresponding html entity. example ® => &reg; & => &amp; © => &copy; ™ => &trade; after conversion, needs wrapped in <sup> tag, resulting in this: ® => <sup>&reg;</sup> because particular font size , padding style necessary: sup { font-size: 0.6em; padding-top: 0.2em; } would javascript this? var regs = document.queryselectorall('®'); ( var = 0, l = imgs.length; < l; ++i ) { var [?] = regs[i]; var [?] = document.createelement('sup'); img.parentnode.insertbefore([?]); div.appendchild([?]); } where "[?]" means there not sure about. additional details: i pure javascript, not requires library jquery, thanks. backend ruby using refinerycms built ruby on rails you can use regex replace character in gi...

python - How to maintain multiple versions of a library -

this question exact duplicate of: does python have versioned dependency management solution? 1 answer are there practical solutions maintaining multiple versions of library in python environment? for example, have 1 web framework using pluggable design. under framework, there can several applications registered (application , framework running in same python process). each application have business logic code , common code, common_httplib . problem how can ensure multiple versions of common_httplib don't conflict each other? each application expected use own copy of common_httplib different versions. absolute import, import hook, imp etc. don't work because common_httplib may import other third party libraries may have same version problems. following code structure of applications. under $framework_home/apps/ , there is: /app1 /common_htt...

dictionary - R fastest way to get values from list as vector -

this question has answer here: better way convert list vector? 2 answers in r, give list l1 <- list(a = "a", b = "b", c = "c") and vector v<- c("a", "c") how elements list in vector? example l1[v] returns list, while need vector as c("a", "c") looking fastest one-liner . you can try this, similar @colonelbeauvel identical(as.vector(unlist(l1[v])), c("a", "c")) [1] true

c# - Error : possible unintended reference comparison to get a value comparison cast the right hand -

i have following code gives warning "possible unintended reference comparison; value comparison, cast right hand side type string ": // ocontrol of type control if ((ocontrol.name == odatarowview["conname"].tostring())) { //do stuff } else { //do other stuff } i've tried fix using each of following still warning if ((ocontrol.name == convert.tostring(odatarowview["conname"]))) { //do stuff } else { //do other stuff } if ((ocontrol.name == (string)odatarowview["conname"])) { //do stuff } else { //do other stuff } please explain reason still warning , best practice way deal this? these options work: if (equals(ocontrol.name, odatarowview["conname"])) // best option if ((string)ocontrol.name == odatarowview["conname"].tostring()) // assuming neither item null if (ocontrol.name string == odatarowview["conname"] string) // assuming second item string

How can we post XML strings along with text strings in iOS -

nsstring *starcardstr=@"https://starcardsindia.com/test/api/userauthentication"; //nsstring *poststr=[nsstring stringwithformat:@"https://starcardsindia.com/api/otpverification"]; // nsurl *url=[nsurl urlwithstring:poststr]; nsurl *url=[nsurl urlwithstring:starcardstr]; nsmutableurlrequest *request=[[nsmutableurlrequest alloc]init]; [request seturl:[nsurl urlwithstring:starcardstr]]; [request sethttpmethod:@"post"]; nsstring *contenttype = [nsstring stringwithformat:@"text/xml"]; [request addvalue:contenttype forhttpheaderfield: @"content-type"]; nsmutabledata *pbody=[nsmutabledata data]; [pbody appenddata:[[nsstring stringwithformat:@"<xml>"] datausingencoding:nsutf8stringencoding]]; // create post [pbody appenddata: [[nsstring stringwithformat: @"<?xml version=\"1.0\" encoding=\"utf-8\" ?>"] datausingencoding: nsutf8stringencoding]]; //[pbody appenddata:[...

c# - With a UV layout, how can I best modify this function to access any part of my texture? -

i've been trying reduce code used in voxel / planar terrain generator, , wrote function in order call every time need add new set of uv's - representing 4 vertex in texture map: list<vector2> _uvs(list<vector2> uv, int x = 0, int y = 0) { list<vector2> uvreturn = new list<vector2>(); uvreturn = uv; uvreturn.add(new vector2 (0f, 0f) * x); uvreturn.add(new vector2 (0.125f, 0) * y); uvreturn.add(new vector2 (0.125f, 1)* y); uvreturn.add(new vector2 (0f, 1f) * x); return uvreturn; } however, can't seem identify exact spots write in modifiers, seem throw things off every time. have single row of 128x textures in 1024 file. uv layout moment seems exact, except multiplication. remove , shows first texture, perfectly. ways can improved on? goal used 4 vertex plane. you can't multiply that, that's different. uvreturn.add(new vector2 (x * 0.125f, 0f)); uvreturn.add(new vector2 ((x + 1) * 0.125f, 0)); uv...

android - cordova Update files and reload updated index.html? -

i working in plugin update of html files. the default location cordova fetches files assests directory directory read only, cannot update files in directory. so moved assests directory files(/data/data/packagename/files) directory, whenever there update occurred able download zip bundle server , extract bundle using zip extractor , able show updated index.html updated bundle. the problem how can set start page location programmatically updated bundle when app starts again likewise ios "startpage()" method. i not want achieved updating config.xml or loadurl() in default cordovaapp.java. thanks

ecm - Sitecore Email Campaign Manager and MTA Logs -

i'm using email campaign manager version v2.1 rev 140214 along sitecore v6.6 send email. instance configured send email via sitecore's mta service. everything works of time, intermittently email not sent though in sitecore logs message flagged processed , finished. managedpoolthread #3 16:02:50 info job started: sending message (82da24e91d714756ac0173b590bf0b27) managedpoolthread #3 16:02:50 info emailcampaign: dispatch message ( xxx ): started managedpoolthread #3 16:03:20 info emailcampaign: 'xxx': 86 recipients added queue. managedpoolthread #3 16:03:40 info emailcampaign: message 'xxx': recipients processed: 86. generate: min: 00:00:00.0312000; avg: 00:00:00.1382235; max: 00:00:00.3900007; total: 00:00:11.8872213. send: min: 00:00:00.8424014; avg: 00:00:00.9278388; max: 00:00:01.9344034; total: 00:01:19.7941399. process: min: 00:00:00.9048016; avg: 00:00:01.0660623; max: 00:00:02.3244041; total: 00:01:31.6813612. managedpoolthread #3 16:03:...

Animation for help overlay in Android Application -

Image
is possible create animations implement help layout android applications in figure : desired effect : hand image should move , point icon.then effect ripple created. how implement animations ? yes can using showcase view library github link, works pretty , customizable showcaseview

ubuntu server - mysql performance_schema missing tables -

using mysql 5.6.19 on ubuntu box, installed sudo apt-get install , missing few tables (got alert workbench when trying use performance reports). these tables have in performance_schema: +----------------------------------------------+ | tables_in_performance_schema | +----------------------------------------------+ | cond_instances | | events_waits_current | | events_waits_history | | events_waits_history_long | | events_waits_summary_by_instance | | events_waits_summary_by_thread_by_event_name | | events_waits_summary_global_by_event_name | | file_instances | | file_summary_by_event_name | | file_summary_by_instance | | mutex_instances | | performance_timers | | rwlock_instances | | session_connect_att...

javascript - How to print a hidden div content using jquery? -

i have anchor button , hidden div. write code print content of div. time shows content in print file , time blank. please me <div class="row-fluid printdiv" id="printdiv" style="display:none;"> <div class="col-md-8 indexleft"> <div class="blog"> <!-- blog details --> <div class="blogdetail row-fluid"> <div class="col-md-5"> <figure><img src="images/24hr-gym-logo-2014-698x198.jpg" alt="" /></figure> </div> <div class="col-md-7"> <div class="title"> <h2><a href="#">relief chronic pain 1</a></h2> </div> <div class="writer"> <label>writtern :- </label> bev matushewski</div> ...

eclipse - Selenium- WebButton need to be clicked only once in a loop -

i writing selenium script in eclipse adding user application fetching user values excel sheet. in scenarion button "add" exist @ first user addition, once clicked textbox "add_name" appear name need added. in loop second user addition selenium "add" webelement, does'nt exists throwing error. i have used below code elements existance i'm getting below error. please me in this. code used : //click on "add new button" if(browser.findelements(by.id("ext-gen72")).size()!=0){ browser.findelement(by.id("ext-gen72")).click(); } else{ continue rest of steps.... } error:exception in thread "main" org.openqa.selenium.elementnotvisibleexception: cannot click on element (warning: server did not provide stacktrace information)

Secondary y axis values not displayed in Google Charts -

i trying use secondary y axis google charts. i have code: arrdata.addrows([ [observationdatetime, observationvaluecd4, observationvalueviralload] ]); } // start of drawchart() var options2 = { title: 'cd4 && viralload v/s datetime', vaxes: [{ title: 'cd4', textstyle: { color: 'blue' } }, // axis 0 { title: 'viral load', textstyle: { color: 'red' } } // axis 1 ], haxis: { title: "date" }, series: { 0: { type: "bars", targetaxisindex: 0 }, 1: { type: "line", targetaxisindex: 1 } } }; however, bit confused rendered: renders blue straight vertical lines pointing , no red line.though secondary y axes in rendered. what expect: expect blue bars values on left y axis , red line values on...