Posts

How to set 1d array to 2d array element in C -

i need this: char font[128][8] = {{0}}; font[0][] = {0, 0b00000000, 0b11111100, 0b00010010, 0b00010010, 0b11111100, 0b00000000, 0}; font[1][] = {...} but in c99 "expected expression before '{' token". please help. you can use initialiser list ( {...} ) when declaring array, that's why you're getting error. can't assign value array, font[0] (a char[] ). you have 3 options: char font[128][8] = { {0, 0b00000000, 0b11111100, 0b00010010, 0b00010010, 0b11111100, 0b00000000, 0}; {...} } assign each value element in array individually: font[0][0] = x , ..., font[127][7] = y (ie. using loop). memcpy blocks @ time uint64_t ( sizeof(font[0]) = 8 ) or wherever else can neatly/efficiently store data. it's worth noting binary constants c extension, and char signed , if you're working unsigned data should explicitly use unsigned char .

java - Spring servlet configuration file throws exception -

i following exception: build path incomplete. cannot find class file com/hexgen/core/ihexgendictionarybased this line above exception: <context:component-scan base-package="com.hexgen.api.facade" /> this complete xml file: <?xml version="1.0" encoding="utf-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xmlns:context="http://www.springframework.org/schema/context" xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:sec="http://www.springframework.org/schema/security" xsi:schemalocation=" http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd http://www.springframe...

jquery - Hide textarea if user clicks outside it, but keep it visible on mouse leave outside it after selecting the text -

i have textarea should hidden if user clicks outside it, , remains visible if clicks inside textarea. the problem when user selects text of textarea , leaves mouse outside it, textarea gets hidden , cannot copy text anymore. how can fix this? live jsfiddle html: <span>show textarea</span> <div> <textarea>text in textarea</textarea> </div> jquery: $("span").on("click", function () { $("textarea").show(); }); $(document).mouseup(function (e) { var container = $("div"); if (container.has(e.target).length === 0) { $("textarea").hide(); } }); css: textarea { position:absolute; right:10px; bottom:10px; display:none; } just use mousedown() event instead fiddle

objective c - Check which camera is currently in use in iOS Application -

i'm writing app has custom made view taking photos camera, similar apple's avcam. in it, want make button disappear , re-appear flash icon every time camera switched. ie when using front camera, flash button shouldn't there , when using should! my code @ moment is: avcapturedeviceposition position = [[videoinput device] position]; if (position == avcapturedevicepositionback) { self.flashbutton.hidden == yes; } but comes error on videoinput , i'm not sure why... documentation direct me or ideas changes in code appreciated! edit just why come error of 'use of undeclared identifier' code: avcapturedeviceposition position = [[videoinput device] position]; the below code might : avcapturedeviceinput *newvideoinput; avcapturedeviceposition currentcameraposition = [[videoinput device] position]; if (currentcameraposition == avcapturedevicepositionback) { currentcameraposition = avcapturedevicepositionfront; } else { currentc...

javascript - Is path animation possible with SVG.js -

there many examples of svg path animation, both natively http://jsfiddle.net/fvqdq/ and raphael.js http://jsfiddle.net/d7d3z/1/ p.animate({path:"m140 100 l190 60"}, 2000, function() { r.animate({path:"m190 60 l 210 90"}, 2000); }); how possible svg.js library ? no, not yet possible svg.js . have been looking , rather large implementation. try keep library small never part of library itself, might write plugin. although @ moment not have time on hands appreciated.

how to get only the specific content from a file using PHP. -

how specific content file using php. i have file content: reference 1.pdb mobile 4r_1.pdb ignore fit mobile 4r_10.pdb ignore fit mobile 4r_22220.pdb ignore fit now, want take names i.e. (output) 4r_1 4r_10 4r_22220 in array , print it. the program have written in php doesn't work properly, can have look $data = file_get_contents('file.txt'); // read file $convert = explode("\n", $data); // take in array $output4 = preg_grep("/mobile/i",$convert); //take line starts mobile , put in array if ($output4 !="/mobile/i") { print $output4; print "\n"; } please help! extract names try this: $convert = explode("\n", $data); // take in array $filenames = array(); foreach ($convert $item) { if(strstr($item,'mobile')) { array_push($filenames,preg_replace('/mobile[\s]?([a-za-z0-9_]*).pdb/','${1}',$item)); } } now file names (assuming file names) in array $filenam...

How to specify the position in txt file to delete record in C programming -

void deleterecord() { file *fp, *fdel; struct person obj; char number[20]; printf("\n============================"); printf("\n delete"); printf("\n============================\n\n"); fflush(stdin); printf("enter student number delete :"); scanf("%s", number); fp=fopen("d:\\data.txt","r"); fdel=fopen("d:\\del.txt","w"); while(fscanf(fp,"\n%s\n%s %s\n%s\n%s\n%s\n%s\n%s\n%s\n", obj.stdnumb, obj.firstname, obj.lastname, obj.icpass, obj.nationality, obj.gender, obj.dateofbirth, obj.contact, obj.address)==1) if(stricmp(number, obj.stdnumb)!=0) fprintf(fdel, "\n%s\n%s %s\n%s\n%s\n%s\n%s\n%s\n%s\n", obj.stdnumb, obj.firstname, obj.lastname, obj.icpass, obj.nationality, obj.gender, obj.dateofbirth, obj.contact, obj.address); fclose(fp); fclose(fdel); remove("d:\\data...