Posts

Showing posts from January, 2014

c# - Linq issues, joining two tables and a collection -

ok, need suck @ linq! this collection contains x number of time slot dto's given day. list<timeslotdto> timeslots = new list<timeslotdto>(); the timeslotdto contains datetime slotstart property , bool isreserved . collection works, contains number of timeslots want. fine. now problem. want use collection in linq query. have 2 tables," staff " , " timeslots "(well three, if might able add last table query myself) the " timeslots " table contains: staffid(fk) timeslotid(pk) slotstart activityid(fk third table). the " staff " table contains: staffid(pk) navigation property timeslots based on this...i want produce result each staff member has list of timeslots , slots in collection has same date in timeslots table isreserved prop should set true. so timeslots collection contains possible slots given day. timeslots table contains reservations. want x-check collections find reservations each staff mem

c# - Dividing by 2 vs Multiplying by 0.5 -

consider following: void foo(int start, int end) { int mid = (start + end) / 2; } void bar(int start, int end) { int mid = (start + end) * 0.5; } why foo compiles while bar not? dividing 2 implicitly casts result int while multiplying 0.5 gives un-casted double : cannot implicitly convert type 'double int. explicit conversion exists(are missing cast?) what c# language designers' reasoning behind this? the / integer division ( 5/3 = 1 ). make float division 1 of operand must floating point ( float or double ). because there cases when application wants access quotient or remainder of division (for remainder use % ). also, integer division faster floating one. on other hand, multiplying float gives float. save integer type have type cast yourself. floating point values have different representation in memory , can lead loss of precision. it same thing in programming languages: of them have integer division , floating point division,

css - ie11 broken background image on rounded corners -

Image
jsfiddle example: http://jsfiddle.net/q5ajl/ screenshot jsfiddle in ie11, dev mode off: screen shot actual site: has seen before? in ie11 of borders have strange broken affect. it seems semi transparent image breaking around rounded corners. how on earth can fix this? sigh.. ie.. pain in side of web design life. .small-card{ border-radius: 5px; display: inline-block; width: 100%; max-width: 400px; margin-bottom: 25px; } .trans{ background-image: url(/png/transparent/white/40_percent.png); background-repeat: repeat; border: solid 1px #fff; } this ie11. when turn on devloper mode issue vanishes! confusing. i don't understand going on. , above, turn on developer mode issue disappears. occurs there rounded corner involved.

c++ - Swedish characters don't compare correctly -

for reason if/else statements isn't working correctly me in c++ the problem when variabel equal right (höger), won't output if statement, instead go on else statement. if replace letter 'ö' 'o' becomes 'hoger' instead, if statement work. whenever write word 'höger' won't go if statement, instead go else statement. if make variabel equal 'hoger', , write 'hoger', work. how can make possible writing 'höger' if statement recognizes instead? it's if swedish letters don't work. my code this: #include <iostream> #include <string> using namespace std; int main() { setlocale(lc_all,""); string test; // define variabel cout << " höger elle vänster"<<endl; // right or left cin >> test; if(test == "höger") { // if right, output this. cout <<"du valde höger"<<endl; } else if(test == &qu

c++ - Path Include in Make/options file -

i have simple problem, think, can't find solution. i've included "mathcalls.h" file 1 of projects since need use pow(double, double) method of it. therefore i've added filepath to... ... make/options file: -iusr/include/i386-linux-gnu/bits ... include file of ide (qt creator): /usr/include/i386-linux-gnu/bits for include tried #include "mathcalls.h" #include <mathcalls.h> but when building project error: /home/user/solvernew/multiphaseeulerfoamnew.c:46: error: mathcalls.h: no such file or directory when looking @ this, seems compiler searching in project directory although have added path file? please note in "usr/include/i386-linux-gnu/bits" root has full access, others authorised "access files". how can solve problem professionally? the professional way gain access double pow(double x, double y) is: #include <cmath> or, @ pinch: #include <math.h> then there no issues grov

machine learning - error tuning SVM in R -

i'm tuning svm in r , receive following error: #error in if (any(co)) { : missing value true/false needed i'm using caret package svmrtune <- train(x=datatrain[,predmodelcontinuous],y=datatrain[,outcome],method = "svmradial", tunelength = 14, trcontrol = trctrl) the training set structure is str(datatrain) 'data.frame': 40001 obs. of 42 variables: $ polnum : num 2e+08 2e+08 2e+08 2e+08 2e+08 ... $ sex : factor w/ 2 levels "male","female": 1 1 1 2 1 2 1 1 1 2 ... $ type : factor w/ 6 levels "a","b","c","d",..: 3 1 1 2 2 4 3 3 3 2 ... $ catgry : ord.factor w/ 3 levels "large"<"medium"<..: 2 2 2 3 3 3 3 2 2 2 ... $ occup : factor w/ 5 levels "employed","housewife",..: 2 1 1 1 5 4 1 1 4 2 ... $ age : num 48 23 23 39 24 39 28 43 45 38 ... $ group : factor w/ 20 levels "1","2"

c - too much specular light opengl -

these settings diffuse,ambient , specualar , position of light. scene looks extremly lit specualar light. have tried adjusting position of light doesn't anything. glfloat greendiffusematerial[] = {0.0, 1.0, 0.0,1.0}; glfloat whitespecularmaterial[] = {1.0, 1.0, 1.0,1.0}; glfloat greenambientmaterial[] = {0.0, 1.0, 0.2,1.0}; glfloat greenemissivematerial[] = {0.0, 1.0, 0.5,1.0}; glfloat lightposition[] = { 0.0,1.0,0.0, 0.0}; glfloat ambientlight[] = { 0.0, 0.0, 0.0, 1.0 }; glfloat diffuselight[] = { 1.0, 1.0, 1.0, 1.0 }; glfloat specularlight[] = { 1.0, 1.0, 1.0, 1.0 }; edit 1 (int g =0;g<6400;g++){ glbegin(gl_quads); if(mounttext %2 ==0){gltexcoord2f(islandvert[g][0] /xscale,islandvert[g][2] / zscale);} else{ glenable(gl_normalize); gldisable(gl_texture_2d); glshademodel(gl_smooth); glenable(gl_color_material); glenable(gl_depth_test); glmaterialfv(gl_front_and_

networking - Can Socat be used as a stand alone HTTP proxy -

i have heard socat can used proxy http requests. i attempted set socat such thing, hope of using simple standalone (i.e. being able proxy socat without use of squid instance) http proxy upon examining man page , scouring web seems can forward existing proxy server. is, seems socat incapable of receiving http proxy request , connecting http host specified in request. is case or missing here?

html - jquery on change event strange behaviour -

i m having form upload files using these tags <form id="uploadpic" action="../image_shout" enctype="multipart/form-data" method="post"> <input type="file" multiple="true" id="file1" class="choose-file" name="choose-file"/> </form> now want on choosing file new file upload input should inserted. i tried jquery using on change event handler using code - $('.choose-file').on("change", function(e) { $(this).after("<input type=\"file\" multiple=\"true\" id=\"file1\" class=\"choose-file\" name=\"choose-file\" />"); }); to dismay got bonded first element of input field. on choosing files on subsequent inputs generated not add new input fields. the fiddle here to work had complicated - $(document).ready(function() { function add_input($t

php - Rename while uploading -

i'm not familiar php, but... have 1 form 2 upload files filds, 1 arhive, , other thumbnail it. puts names mysql table. @ first, nice rename files if exists dirs, , can't that. , second, upload image, can't make make thumbnail specific proportions. my forms: <form method="post" action="up.php" enctype="multipart/form-data"> <p> firstname: </p> <input type="text" name="firstname"/> <p> lastname: </p> <input type="text" name="lastname"/> <p> please upload photo. </p> <p> photo: </p> <input type="hidden" name="size" value="350000"> <input type="file" name="photo"> <p> arhiv: </p> <input type=

java - Console shortcut to toolbar in Eclipse -

Image
is there way bring console icon appear in toolbar. each time i've either press shortcut alt+shift+q,c or select window -> show view. if present in toolbar other icons( save, android sdk manager,etc,....), easier access. having console window open, takes space. you can minimize it, console icon stay there need drag tab group , put want you can have simple keyboard short-cut opening same you can change going window->pregerances->general->keys can set whatever feel easy, in case space, c pfb snapshot

Get value of the highlighted item in a combobox dropdown list? Excel VBA -

the mouseover event of combobox on form triggers label become visible , show details of selected combobox value. when user clicks down arrow show combobox list items available selection, want label update details of highlighted item in dropdownlist without having select combobox value. in other words, user moves mouse on items , highlighted item changes, want details in label update highlighted value. so far, have found nothing on how this. excel knows item highlighted, how access information programmatically eludes me. any ideas? if combobox control use mousemove event current highlighted item. private sub combobox1_mousemove(byval button integer, byval shift integer, byval x single, byval y single) if combobox1.topindex > -1 dim curindex integer curindex = combobox1.topindex + application.worksheetfunction.rounddown(y / 13.5, 0) curvalue = combobox1.list(curindex) end if end sub then show tooltip. note: 13.5 is, tests, heigh

image - find the angle between two very similar pictures in matlab -

Image
hi find angle between 2 similar(but not same) pictures ? used hvideosrc = vision.videofilereader(filename, 'imagecolorspace', 'intensity'); imga = step(hvideosrc); % read first frame imga imgb = step(hvideosrc); % read second frame imgb figure; imshowpair(imga, imgb, 'montage'); title(['frame a', repmat(' ',[1 70]), 'frame b']); figure; imshowpair(imga,imgb,'colorchannels','red-cyan'); title('color composite (frame = red, frame b = cyan)'); from http://www.mathworks.com/help/vision/examples/video-stabilization-using-point-feature-matching.html not have idia i'd recommend doing sort of feature detection using find homography matrix. might overkill @ least you'll able not find rotation 1 image respect another, shearing or translation well. check feature detection module part of computer vision toolbox detecting keypoints: http://www.mathworks.com/help/vision/feature-detecti

perl - print only if value in field does not match previous line -

ok not sure gawk best tool here, if has easy way of doing using perl, sed, uniq glad use it. trying filter set of data looks this: "1" "ari201304010" "sln" 1 0 0 1 "2" "ari201304010" "sln" 1 0 1 1 "3" "ari201304010" "sln" 1 0 1 3 "4" "ari201304010" "sln" 1 0 1 0 "5" "ari201304010" "sln" 1 0 2 1 "6" "ari201304010" "sln" 1 1 0 1 "7" "ari201304010" "sln" 1 1 0 0 "8" "ari201304010" "sln" 1 1 1 0 "9" "ari201304010" "sln" 1 1 2 2 "10" "ari201304010" "sln" 2 0 0 0 the 5th element can 1 or 0 . print every last occurance of value on 5th field. print if 5th field not mach value in line before. i think awk right tool: awk '$5 != last; {last = $5}' last=-1 input note prin

java - Unit test SherlockFragmentActivity class leads to Could not find class X referenced from method Y -

i try unit test activity extends sherlockfragmentactivity without success in application. isolate problem reproduced in simple sandbox project can't figure out how fix it. my configuration i use latest version of eclipse sdk & adt 22.6.2 on linux debian. the project tested through emulator, in android 2.2 emulated device (api 8). the target api android 4.4.2 (api 19). jdk 1.6 (i tried jdk 1.7, see could not find class x referenced method y ). problem i cannot run unit test on class extends sherlockfragmentactivity. this output of console tab in eclipse: [2014-04-06 13:01:02 - sandboxtest] dx trouble writing output: prepared [2014-04-06 13:01:03 - sandboxtest] ------------------------------ [2014-04-06 13:01:03 - sandboxtest] android launch! [2014-04-06 13:01:03 - sandboxtest] adb running normally. [2014-04-06 13:01:03 - sandboxtest] performing android.test.instrumentationtestrunner junit launch [2014-04-06 13:01:03 - sandboxtest] automatic target mode:

dagger - How do I finish an Activity from within a mortar Presenter or a View? -

how finish activity within presenter or view in mortar sample app? the majority of time want avoid doing this. in dire circumstances follow same pattern actionbarowner[0] class implements. create injectable class exposes activity#finish via interface. item 3 in [1] related calling order inverted. (activity lifecycle methods presenters instead of presenters activity methods). hope helps! [0] https://github.com/square/mortar/blob/master/mortar-sample/src/main/java/com/example/mortar/android/actionbarowner.java [1] mortar + flow third party libraries hooked activity lifecycle

Java Cipher Program issue -

i posted program yesterday , i'm stuck. can't figure out why i'm getting errors getting, i've read bunch of stuff, frankly struggling java in general. appreciated...code , errors follow... /* jursekgregchapter12t.java greg jursek program encrypt entered text user input shift value , decrypt text in same manner. */ import java.lang.*; import java.util.*; public class jursekgregchapter12t { public static void main(string[] args) { scanner stdin = new scanner(system.in); string encrypttext; // text encrypted string decrypttext; // text decrypted int shiftvalue; // number of spaces shifted via user input // user enters plain text encryption system.out.print("please enter text encrypt"); encrypttext = stdin.next(); // user enters shift value system.out.println("please enter shift value"); shiftvalue = stdin.nextint(); // system prints encrypted text string encryptedtext = encrypt(encry

c - program.exe stops working after compiling? -

i trying write code obtain patch/sub_window of array. wrote following code: #include <stdio.h> int patch(int a[5][5],int b[2][2],int r,int s) { int i=0,j=0,k; if(r<=(5-2) && s<=(5-2)){ for(r;r<(r+2);r++){ for(s;s<(s+2);s++) { k = a[r][s]; b[i][j] = k; = i+1; j = j+1; } } } else {printf("error!");} return 0; } int main() { int i,j,p,q; int y[2][2] = {0}; int x[5][5] = {{95,155,200,200,232}, {100,155,232,95,150}, {200,45,200,135,123}, {232,150,85,69,180}, {95,95,200,123,45} }; for(i=0;i<5;i++){ for(j=0;j<5;j++){ patch(x,y,i,j); for(p=0;p<2;p++){ for(q=0;q<2;q++) { printf("y[%d][%d] = %d\n",p,q,y[p][q]); } } } } return 0; } however, once run , compile code error stating program.exe has stopped working. how can fix ? need use dynamic memory allocatio

html - How to pass data to php using <a> without updating the whole page -

how pass data php using tag such part of webpage update , url contains data passed? example: "<a href='./sample.php?data=".$row['some_data']."'>.$row['some_data']."</a>" yes i'm talking ajax. want url example www.site.com/sample.php?data=2 part of webpage change not whole. how do this? thing can think of add onclick event on tag , process ajax request there think whole page still update because of href.

osx - Develop ios app using phonegap without mac -

do have use apple mac in order develop hybrid app using phonegap , jquerymobile? i intend using phonegap build, , test , publish app in appstore. can create key phonegap ios app using windows, instead of mac? yes, need apple mac. phonegap creates individual projects each operating system make app for. xcode project made ios 1 , open archive , create ipa file , need mac os. there other ways run mac os in windows not legal , can have bugs wont support on.

html - Outlook web app systematically removes align="center" attributes -

i integrating e-mail , tearing hair out! e-mail has centered layout (i using ink's hero template ). problem layout not centered in outlook web app because client not support margin (so cannot center layout margin: 0 auto; ). here sample of code: <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"/> <meta name="viewport" content="width=device-width"/> </head> <body> <table width="100%" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="header" valign="top" align="center"> <table class="container" width="580" border="

c# - how to create a class to initialize culture for localization -

i trying localize asp.net pages. far have been localize master page. global.asax protected void application_beginrequest(object sender, eventargs e) { httpcookie cookie = request.cookies["cultureinfo"]; if (cookie != null && cookie.value != null) { thread.currentthread.currentuiculture = new cultureinfo(cookie.value); thread.currentthread.currentculture = new cultureinfo(cookie.value); } else { thread.currentthread.currentuiculture = new cultureinfo("en-ca"); thread.currentthread.currentculture = new cultureinfo("en-ca"); } } masterpage.master.cs protected void page_load(object sender, eventargs e) { //only on non-postback because otherwise //the selected value not reach event handler correctly if (!page.ispostback) { ddllanguage.selectedvalue = thread.currentthread.currentculture.name; } } protected void ddllanguage_selectedindexchanged(object se

html - css menu with hover that changes the entire frame picture -

i made css menu should replace other entire menu on hover. well should replace center image , hover on menu links. idea using entire center background images buttons, entire menu , center same image. when hovering top bottom menu works fine , replaces images should. but after hovering link can't go on menu links not active must hiding due top margin or that. you can see menu @ bottom of page (the blue buttons turn red @ bottom of page): http://www.israelijewel.com/1.html thank in advance! weird pattern that, why don't this: inside each "a" inside .home-gallery, put image want in center position: absolute;display:none; , position usings it's absolute position. can make appear @ center doing like: .mofet-link:hover { //set button red here } .mofet-link:hover .inside_image { display: block; } you should set .home-gallery position:relative; attribute too

right to left - How can I mix hebrew and latin text in a HTML document? -

Image
i have html document contains hebrew , latin text. encoded utf-8: <!doctype html> <html> <head> <title>title</title> <meta http-equiv='content-type' content='text/html; charset=utf-8'/> </head> <style type='text/css'> .h { color: green} </style> <body> <div> here words הנה כמה מילות (100, 200) </div> <div> here words <span class='h'>הנה כמה מילות</span> (100, 200) </div> <div> here words <span class='h'>הנה כמה מילות</span> <span>(100, 200)</span> </div> <div> here words <span class='h'>הנה כמה מילות</span> <b>word</b> <span>(100, 200)</span> </div> </body> </html> the first 3 lines not displayed think should. fourth (with additional <b>word</b> in front of paranth

objective c - iOS - Extract pictures from short video give me the same picture -

i'm working on ios project capture videos , extract images video (for example 10 pictures every 500 ms). problem short videos (few seconds). i'm extracting same pictures 2 or 3 times. don't have problem video lengths around 10 seconds , more. when discussing friend, told me problem key frame number in video. i'm using avcapturedeviceinput, avcapturesession , avcapturemoviefileoutput take video. so, questions : how can figure out why i'm extracting same pictures many times ? key-frame number problem , possible increase value (from capture session ? capture device ?). edit : here code picture extract : avurlasset *asset = [[avurlasset alloc] initwithurl:videourl options:nil]; avassetimagegenerator *generateimg = [[avassetimagegenerator alloc] initwithasset:asset]; nsmutablearray *pictlist = [nsmutablearray array]; (int = 0; < timelist.count; i++) { nserror *error = null; cmtime time = cmtimemake([[timelist objectatindex:i] intvalue], 1000);

web services - The HTTP request is unauthorized with client authentication scheme 'Basic'. The authentication header received from the server was 'Basic realm="" -

i trying access soap webservice (http) requires authentication.i using wcf consume service. getting error message "the http request unauthorized client authentication scheme 'basic'. authentication header received server 'basic realm="xxxxx"'." however when tried send authentication headers along each request. i'm getting 401 errors when attempt web service. any appreciated, thank you. this code looks like: var mybinding = new basichttpbinding("examplebinding"); mybinding.security.mode = basichttpsecuritymode.transportcredentialonly; mybinding.security.transport.clientcredentialtype = httpclientcredentialtype.basic; mybinding.security.transport.proxycredentialtype = httpproxycredentialtype.basic; endpointaddress ea = new endpointaddress("http://test.co.uk/webservices"); var serviceclient = new servicesclient(mybinding, ea); serviceclient.clientcredentials.username.username = "usernam

apache pig - Hadoop: Pig error -

i absolute beginner in hadoop, , doing simple testing, however, not find error messages informative. i have set hadoop environment in single-node mode on centos 6.4 vm 4gb of ram available. i trying run simple pig script on 500mb csv file. have 2 500mb files, on first one, script successful. on second one, same size, different data (a lot more rows), error when execution reaches 60%. this (very simple) pig script use: records = load 'trans2013.csv' using pigstorage(',') (podracun_v_breme,datum_transakcije,znesek_transakcije,oznaka_valute_transakcije,racun_v_dobro,naziv_prejemnika,maticna_stevilka,davcna_stevilka,sifra_pu,zr_sns_oe,namen); transaction_recs = group records all; tot_trans = foreach transaction_recs generate sum(records.znesek_transakcije); store tot_trans '/user/root/totaltransactions'; this error in terminal: 2014-04-06 10:28:29,147 [main] info org.apache.pig.backend.hadoop.executionengine.mapreducelayer.mapreducelauncher -

app store - Restore used to restore purchases for different accounts in ios app -

i had implemented restore button in our app causing issue if member created account our app , pays through appstore. if creates member in our app , restores purchase tapping restore button , putting in app id in fashion using 1 apple app id able have multiple platinum members buying once fo 1 single member , restoring multiple times diferent members. this upcoming website , app have free/basic plan registers , upgradable 1 time/lifetime platinum plan. in ios app have received message apple in resolution center "to restore purchased in-app purchase products, appropriate provide "restore" button , initiate restore process when "restore" button tapped user." now if member has upgraded 1 device , logging in ios device not basic member platinum member per our database , hence not see buy/upgrade platinum scene in our app. basically can avoid rejection removing restore button. solution the above case i have selected non-consumable purchase i

java - Usage of new Class<?>[]{} at getMethod -

is there difference between: method getidmethod = myinterface.class.getmethod("getid"); and method getidmethod = myinterface.class.getmethod("getid", new class<?>[]{}); myinterface follows: public interface myinterface { anotherinterface getid(); } no, there no difference. empty class[] generated implicitly in first case. the java language specification states invocations of variable arity method may contain more actual argument expressions formal parameters. actual argument expressions not correspond formal parameters preceding variable arity parameter evaluated , results stored array passed method invocation (§15.12.4.2). and invocation , evaluating arguments if m being invoked k ≠ n actual argument expressions, or, if m being invoked k = n actual argument expressions , type of k'th argument expression not assignment compatible t[] , argument list (e1, ..., en-1, en, ..., ek) is eval

call controller with ajax in rails -

in ruby on rails project, when create reporter successfully, page redirect action controller; , when page redirect, page reloaded. in project, have 2 controller: reporters_controller.rb: class reporterscontroller < applicationcontroller layout "reporter" def new @reporter = reporter.new @gomrokaddresses = gomrokaddress.find(:all) end def create @reporter = reporter.new(reporter_params) if @reporter.save #redirect_to new_reporter_path redirect_to new_problem_path(:id => @reporter.id) else @existreporter = reporter.find_by(params[:rep_user_name]) redirect_to new_problem_path(:id => @existreporter.id) end end problems_controller.rb def new @reporter = reporter.find(params[:id]) @problem = @reporter.problems.build end def create @reporter = reporter.find(params[:id]) @problem = @reporter.problems.build(problem_params) if @problem.save redirect_to new_problem_path(:id =

supercsv - CellProcessor for MapEntry -

i have simple pojo has map inside it. public class product { public map map; } then csv looks this: "mapentry1","mapentry2","mapentry3" so created custom cell processor parsing those: public class mapentrycellprocessor { public object execute(object val, csvcontext context) { return next.execute(new abstractmap.simpleentry<>("somekey", val), context); } } and add entry setter method in product: public void setname(entry<string, string> entry) { if (getname() == null) { name = new hashmap<>(); } name.put(entry.getkey(), entry.getvalue()); } unfortunately means have 2 setter methods: 1 accepts map , 1 accepts entry doesn't work me (i have no control on how pojos generated). there other way can parse such csv , have setter accepts map in product? it's possible write cell processor collects each column map. example, following processor allows specify k

c# vtable is only part of the type objects method table -

i'm learning aspects of clr in c# , read topic in "clr via c# 4th edition". it said each instance of type has pointer vtable , in book didn't differentiate between static, non-static , virtual methods. according methods declared in method table withing type object. think "vtable" name misleading, , virtual methods table part of normal method table in each type object. true? that make sense because when calling virtual method, object referenced , clr checks objects type , calls method associated objects class. or wrong? another question: static , non static methods in method table. understanding differentiated parameter. non-static methods object related, when calling methods, this-pointer passed in reveal object called it. static methods not need parameter. right? i know quite theoretically hope there people can me! really nobody?

cocos2d iphone - Updating a CCTexture2D from a BatchNode -

after completed testing, have moved images on spritesheet. i loaded batchnode appropriate files , images load fine. but running issue of swapping textures out. when images individual files, there no problem. seems cctexture2d doesn’t sprite sheet. i have objects stored in multidimensional array, can run through them , update image. here did when worked: cctexture2d* tex = [[cctexturecache sharedtexturecache] addimage:@"alt-image.png"]; [((myfunobject*)[[myfunobject2darr objectatindex:j]objectatindex:i])->img settexture: tex]; here doing now: cctexture2d* tex = [[cctexturecache sharedtexturecache] addimage:[ccsprite spritewithspriteframename:@"alt-image.png"]]; [((myfunobject*)[[myfunobject2darr objectatindex:j]objectatindex:i])->img settexture: tex]; myfunobject subclass of ccsprite , has ccsprite img property set. run through array , find objects , replace image new image “alt-image.png” . seems simple, outside of sprite sheet

windows phone 7 - Play sound while button is pressed -

morning all, i'm trying play sound while button pressed. not on 'click', play sound long button pressed upon , stop sound when button released. i mated sound button in blend don't see button option in blend allows sound play while button pressed on. see available in button options 'click'. any ideas on how can in code or blend? thanks much. edit - here code im trying no luck: <mediaelement name="mp1" source="assets/media/mysound.mp3" autoplay="false" /> private void button1_mouseleftbuttondown(object sender,system.windows.input.mousebuttoneventargs e) { mp1.play(); } private void button1_mouseleftbuttonup(object sender,system.windows.input.mousebuttoneventargs e) { mp1.stop(); } you can use keydown event, , start audio. and stop when keyup event fired. the events can done in blend, far know can make start in blend. , not stop. if , paste code 2 events , start music can rest you.

c# - Client-side generated charts for use in job for sending reports -

client asking replacement of telerik's radchart control new html5 version - radhtmlchart. problem of reporting emails stuff working on control because charts generated on server side , it's fine use them sending reports emails users. so after we'll replace radchart radhtmlchart lose possibility chart on server side. there way report? i have heard phantomjs job i'm not familiar idea i'm asking sure. exporting control rendered via js in browser difficult , may not possible in scenario. take here see if can employ approach: http://www.telerik.com/support/code-library/exporting-radhtmlchart-to-png-and-pdf . if cannot - think have keep using radchart actual images rendered.

sqlite - Listing Number one records in a Simple SQL Database. -

i have small database 4 tables arranged follows; table band_members columns: band_id(pk), name, dob, country, sex table bands columns : band_id(pk), band_name table cds columns : cd_id(pk), rdate, title, position, weeks table releases columns : cd_id, band_id what i'm trying display name of band , number of times they've had number 1 record. (i.e. position = '1') this code i've tried doesn't seem working: select band_name cds join releases on cds.cd_id = releases.cd_id join bands on releases.band_id = bands.band_id group (position='1') you should have bandmembers_band table, have deal band members part of multiple bands - happens these days. to answer: select band_name, count(cds.cd_id) (select cds.cd_id, cds.position cds cds.position = 1 group cds.cd_id) join releases on cds.cd_id = releases.cd_id join bands on releases.band_id = bands.band_id group band_name having count(cds.cd_id) > 0 (pseudo -

Using the python unicode function -

i'm working on project compares text. here relevant piece of code: def post(self): = unicode(flask.request.form['a']) b = unicode(flask.request.form['b']) i posted large pieces of text project gutenberg , errors this: unicodeencodeerror: 'ascii' codec can't encode character u'\xe9' in position 6: ordinal not in range(128) based on this page have tried errors ignore , errors replace , error: typeerror: decoding unicode not supported if possible want able take in robust set of characters possible. hoping there python library allow this. here more of code. think problem may occur when try turn input string. c = a.split() d = b.split() both = [] x in c: if x in d: both.append(x) x in range(len(both)): both[x]=str(both[x]) final = [] x in set(both): final.append(x) missinga = [] x in c: if x not in final , x not in missinga: miss

regex - Regular expression for extracting a series of hex numbers from a file -

i examining object dump of file , want figure out possible addresses. the approach using involves using perl , regex extract words the format of object file this 00000000000044444 <function> 44448: 48 ca add .... 4444c: 48 ca 55 call .... 44450: 48 ca 8d 55 jmp.. i trying extract 48 ca 48 ca 55 48 ca 8d 55 currently, thought regex /(\s[0-9a-f][0-9a-f]\s)/g however, extracts every other, i.e 48, 8d, 55 , parse 48 , cant parse ca because previous space character has been consumed (at least understanding) /(\s[0-9a-f][0-9a-f]\s)|([0-9a-f][0-9a-f]\s)/g parses things shouldnt add instruction dd any how can extract these pairs of numbers deliminated space? edit: updated more realistic format of file. thank you instead of \s , want word boundary \b . while (<data>) { @nums = m/\b([[:xdigit:]]{2})\b/g; print "@nums\n"; } __data__ 00000000000044444 <function> 44448: 48 ca 8d 55

c# - AI Health Decrement -

i developing game in unity, need enemy attack , objects health decrease. attack sequence is: - 1) play attack animation 2) decrease health 3) repeat until dead edited: sorry should have shown code, here is: // check if ai in attack range if (transform.position == targetpostion) { // if target has more 0 health if (targethealthscript.health > 0) { // play animation , decrement health animation.play("bite"); targethealthscript.decrementhealth(10.0f); } } the script written in c# currently have working extent however, health decrement function keeps getting called repeatedly, need way slow down. have tried use coroutines yield statement without success. if has suggestions grateful thanks try using update function if know how long animation take , use time.deltatime enter link description here figure out how time has passed. then decrease health based on them.

ruby on rails - Devise+OmniAuth for Facebook Sign Up on Remote Server -

i using devise + omniauth enable facebook signup in application. when developing it, encountered no problems. same deploying remote server. problem is, other people keep encountering same error: typeerror (no implicit conversion of symbol integer): app/models/user.rb:67:in `find_for_facebook_oauth' app/controllers/users/omniauth_callbacks_controller.rb:4:in `facebook' i have following code user model user.rb : def self.find_for_facebook_oauth( data, signed_in_resource=nil) user = user.where(:email => data.info.email).first unless user params = { :user => { :username => data.uid, :email => data.info.email, :password => devise.friendly_token[0,20], :user_profile_attributes => { :first_name => data.extra.raw_info.first_name, :last_name => data.extra.raw_info.last_name, :remote_image_url => data.extra.raw_info.image, }, :user_auth