Posts

Showing posts from January, 2010

android - Making textView loop a growing and shrinking animation -

i trying make textview grow , shrink. process should repeated infinitely. how achieve that? scale.xml looks this: <?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <scale android:fromxscale="1.0" android:fromyscale="1.0" android:toxscale="2.0" android:toyscale="2.0" android:duration="1400" /> </set> here's animation method: public void runanimation() { animation = animationutils.loadanimation(this, r.anim.scale); a.setrepeatmode(animation.reverse); a.setrepeatcount(animation.infinite); a.reset(); textview.clearanimation(); textview.startanimation(a); } now problem textview grows, reverses starting appereance. why won't go reverse, shrink , repeat process? try : public void runanimation() { animation = animationutils.loadanimation(this, r.anim.scale);...

Speed up OpenCV video decoding and encoding -

how can speed video encoding (videowriter) , decoding (videocapture) in opencv? can use tbb (threading building blocks) library? i working 1280x720 (720p) video , developing real-time system video frame reading , writing alone consuming 35 ms per frame. please help.

Display image patches in python -

i'm using sliding window on image , want display patches of image each window "looks at". i first saved code here: http://www.johnvinyard.com/blog/?p=268 sliding_window.py , imported code: from itertools import izip import numpy np import sliding_window sw skimage.viewer import imageviewer skimage import data, io, filter, color, exposure pil import image scipy.misc import toimage io.use_plugin('matplotlib') image1 = color.rgb2gray(io.imread("path_to_my_image\\akaria1.jpg")) window_size = (100,100) windows = sw.sliding_window(image1, window_size) # make image out of these of these sliding window thingies w in windows: wi = image.fromarray(w) io.imshow(wi) but no images show up. there's no error either. program seems execute without doing anything. i've heard has bug on windows? what's fix? or there alternate way of displaying image patches? if print out w in for loop above, see number of arrays, know t...

Getting upload progress using Azure Storage in Android -

i'm uploading file in android application. code pretty simple: private boolean uploadfile(string filelocation) { try { if (textutils.isempty(filelocation)) { return false; } file fsrc = new file(filelocation); if (!fsrc.exists()) { return false; } boolean breturn = azuremanager.init(this); if (!breturn) { return false; } string blobname = fsrc.getname(); inputstream in = new bufferedinputstream(new fileinputstream(fsrc)); cloudblobcontainer container = azuremanager.getcloudblobclient().getcontainerreference(azuremanager.getcontainername()); cloudblockblob blob = container.getblockblobreference(blobname); blob.upload(in, fsrc.length()); in.close(); return true; } catch (exception e) { //handle exception } ...

python - pip installs package twice -

unfortunately can't reproduce it, have seen several times: pip installs 1 packages twice. if uninstall first, second gets visible , can uninstalled, too. my question: how can check python if package installed twice? background: want write test checks (devop) update packages installed in virtualenv. the 2 packages have different versions. this not duplicate of solutions solve hand. search solution detect python code. how resolve not part if question. update 2 the command pip freeze outputs package once: pip freeze | grep -i south south==0.8.1 but in virtual-env exists twice: find lib -name top_level.txt |xargs cat | grep -i south south south ls lib/python2.7/site-packages/| grep -i south south south-0.8.1-py2.7.egg south-0.8.4-py2.7.egg-info this should work: def count_installs(pkg_name): import imp, sys n = 0 location in sys.path: try: imp.find_module(pkg_name, [location]) except importerror: pa...

CSS/PHP include() re-sizing a page -

i have page graph.php creates graph using google charts. example <div id="chart_div" style="height:100%; width:100%"></div> i visit graph.php directly , graph correctly displayed @ 100% height , 100% width. problem i include("graph.php"); page in page graph appears smaller. there reason , how can 100% width etc.? code <div class="tab-pane" id="graphs" style="width:100%"><?php include("chart.php"); ?></div> your style="width:100%" applies div, contains graph div. something might work: style="position:absolute;width:100%"

What error trigger the Oops, couldn't load error in kik web app -

i trying integrate app kik, specific action fall in error page says: oops, couldn't load. please try again later. this panel looks kik panel app logo @ top but ok, if try app in chrome kik plugin works well. in fact app creates iframe , load use postmessage communicate between parent , iframe . put logs , seems ok. iframe loaded , send message parent postmessage. when in kik, 'couldn't load' message appears , stops app. does know cause panel appear? i had exact same problem. the problem combination of loading iframe after doing browser history manipulation. since there no button in kik can page updates without updating browser history , solve problem. i use line detect kik and, if detected, ignore browser history updates: if (!kik.enabled) { //we not running in kik can browser history manipulation here }

jquery - Changing cursor to a wait symbol while javascript function is running -

i know how change cursor wait symbol (hour glass/circle of death) doesn't register until after javascript done running. tried adding class html in js $("html").addclass("waiting"); in css html.waiting { cursor:wait; } and works said not until after js done running have code this $("html").addclass("waiting"); foobarfunctioncall(); $("html").removeclass("waiting"); is pretty worthless because turned off before turned on. i have tried directly doing $("html").css("cursor", "wait"); which works not until after js done running other method does. worthless use well. is there function call can have updates cursor property while js running register while js running? other important/relevant info -> js shown above runs when div clicked using jquery , function in nested call function $(document).ready(function () { $('.buttondiv').on('...

How to take average values of different excel files using matlab and also how to write them -

for example have filenames 12120100.xls 12120123.xls. need take average of data of these files , need write(xlswrite) these files separately different name. filename 12120100 represents 12=year,12=month,01=day,00=hour.here want give year ,month,day inputs , hour(00 23) used in loops in code since hour %% here code used clc; close all; clear all; d='12120722.xls'; % file want read ,avg , xlswrite dat=xlsread(d,'f3:ah3602'); size(dat) avg=zeros(1,29); i= 1:29 avg(i)=mean(dat(1:3600,i)); end avg newfname=strcat(d(1:8),'averaged values','.xls'); xlswrite(newfname,avg,' f1:ah1'); h=msgbox('averaged complete') close(h); the above code 1 file. ii want code 22 files operation @ time thanks in-advance ...

sql server - T-SQL Stored Procedure with Cursor Loop causing Errors -

could please explain me why have error message show when exec stored procedure. "a cursor name 'tname_cursor' exists" declare @tname varchar(100) declare @lsql varchar(8000) declare tname_cursor cursor select name sys.tables type = 'u' , name 'ppm_metric%' open tname_cursor; fetch next tname_cursor @tname; while @@fetch_status = 0 begin set @lsql = n' update [' +@tname+ '] set latestofall_flg = ''n'' [' +@tname+ '] t join d_custom_metrics_rule s on t.metric_id = s.custom_metric_rule_id , t.latestofall_flg = ''y''' execute sp_executesql @lsql fetch next tname_cursor @tname; end close tname_cursor; deallocate tname_cursor; declare tname_cursor_redo cursor select name sys.tables type = 'u' , name 'ppm_metric%' open tname_cursor_redo; fetch next tname_cursor_r...

c# - GetRequestStream() Timeout Really Wierd -

i wrote console application download files. this application works fine @ end throw timeout webexception on client's end. i tried debug program line line on client's end find line "using (var stream = myrequest.getresponse())" takes long time , timeout exception thrown. i tried solutions found online, using statement @ places can use , aborted requests. still cant solve problem any suggestions on problem? string logindata = "*******"; cookiecontainer cookiecontainer = new cookiecontainer(); uri target=new uri("https://www.ftwilliam.com"); cookiecontainer.add(new cookie("corem_state", "8~-1~-1~-1~-1~3~3~5~3~3~7~7~|~~|~~|~~|~||||||~|~~|~~|~~|~~|~~|~~|~~|~") { domain = target.host }); cookiecontainer.add(new cookie("corem_state_content", "6~|~f83b1d2bfcf9ce7a~a063aa2fde6ff059~28d0274b261787bd~|~0~1~2") { domain = target.host }); cooki...

c# - Microsoft Universal Apps and Unit Testing, trouble with AppModel version -

Image
i started new solution try universal apps. test code want add unit test project (windows phone 8.1), if error message when start unit test: error : dep0700 : registration of app failed. windows cannot install package 808f4bed-6f93-48b9-9b63-071d68456607 because package requires higher windows version. package requested windows version 6.3 appmodel version 1 , while current windows version 6.3 appmodel version 0 . (0x80073cfd) what appmodel version 1 , appmodel version 0 mean, , how can fix this? or there , way unit tests in context of microsoft universal apps? this project structure looks like update windows phone 8.1 project + windows phone 8.1 unit test = don't work windows phone 8 project + windows phone 8 unit test = works but still don't have clue how can windows phone 8.1 work. btw windows version (windows 8.1 update) ps c:\windows\system32> [system.environment]::osversion.version major minor build revision ----- ----- ----...

android - aChartEngine; getting SeriesSelection from within onTouchListener -

i'm creating line chart, using xyseries, etc. working great, except i'm finding impossible graphicalview.getcurrentseriesandpoint() within callbacks of ontouchllistener. have both , onclick , ontouch on chart, need handle other gestures data point onclicks. when use onclicklistener, works expected; calls chartview.getcurrentseries... returns seriesselection. however, once set ontouchelistener, breaks. i started standard means of mixing two, maintain touch state within ontouchlistener, , when resolves motionevent.action_up, if determine it's click, invoke performclick on passed in view, chart/graphicalview, results in null return getcurrentseriesandpoint call. here's code; nothing special going on here: case motionevent.action_up: if (onclick) { log.d(tag, "actionup onclick should clicking, " + "and mcurrentss: " + ...

Windows Authentication Working For Some But Not Others -

i have web application hosted via iis requires windows authentication. users able access applicaiton no problems. others dialog requesting credentials, when cancel request, application loads correctly. still others prompted credentials , when enter them, 401 error. using fiddler, i've found authentication header users works looks this: -[ntlm type3: authentication]------------------------------ provider: ntlmssp type: 3 os version: 6.1:7601 flags: 0xe2888215 unicode supported in security buffer. request server's authentication realm included in type2 reply. sign (integrity) ntlm authentication. negotiate sign. negotiate ntlm2 key. target information block provided use in calculation of ntlmv2 response. supports 56-bit encryption. supports 128-bit encryption. client provide master key in type 3 session key field. lmresp_offset: 136; lmresp_length: 24; lmresp_length2: 24 ntresp_offset: 160; ntresp_length: 24; ntresp_length2: 24 d...

python - Sqlalchemy query parameters are not inserted -

Image
i'm newbie in python, , have question. use sqlalchemy declarative work mysql. here simple code: # -*- coding: utf-8 -* sqlalchemy import * sqlalchemy.ext.declarative import declarative_base sqlalchemy.orm import relation, sessionmaker import datetime engine = create_engine('mysql+mysqldb://root:mypass@localhost/somedb') base = declarative_base() base.metadata.bind = engine dbsession = sessionmaker(bind=engine) session = dbsession() class item(base): __tablename__ = 'item' id = column(integer, primary_key=true) dt = column(datetime) title = column(unicodetext) base.metadata.create_all(engine) = item() i.dt = datetime.datetime.now() i.title = "hello world" session.add(i) session.commit() this code throws exception on session.commit() : sqlalchemy.exc.programmingerror: (programmingerror) (1064, "you have error in sql syntax; check manual corresponds mysql server version right syntax use near '%s, %s)' @ line 1...

NullPointerException in getView in ListView with multiple views in Android -

i know there lots , lots of questions 1 i'm going ask, however, none of them can give me solution. i've read blogs , questions here, no luck. have listview in android, , want display news 2 types of views/layouts: 1 news have pictures, , 1 news don't have (only text),so app can display this . everytime run app getting error: e/androidruntime(3973): fatal exception: main e/androidruntime(3973): process: com.example.test23, pid: 3973 e/androidruntime(3973): java.lang.nullpointerexception e/androidruntime(3973): @ com.example.test23.itemadapter.getview(itemadapter.java:80) e/androidruntime(3973): @ android.widget.abslistview.obtainview(abslistview.java:2263) e/androidruntime(3973): @ android.widget.listview.measureheightofchildren(listview.java:1263) i implementing methods getitemviewtype , getviewtypecount() . i've implemented famous viewholder no luck either. right adapter class (cause i've changed plenty of times): public class itemadapter extends basead...

sql - How can I update multiple MySQL tables based on LIMIT on one table only? -

imagine following 3 tables: table-a: | id | a-data | sort-data | table-b: | a-id | b-data | table-c: | a-id | c-data | table has less rows other 2 tables. have break table-a in 5 chunks using sorting & limits (20% each). know can update table-a's data based on limit easily. however, can't sort , limit other tables because don't have sort data - have ids table a. is there fast way can this? have collect ids , use in operator? have join tables using ids , update? what's best query use fast? update tablea join tableb b on a.id = b.aid join tablec c on a.id = c.aid join (select id tablea order sortdata limit 5) asorted on a.id = asorted.id set a.adata = x, b.bdata = y, c.cdata = z

ios - URL used to deploy ipa with Enterprise Certificate -

i have apple enterprise certificate , want deploy app wirelessly testers. of course, need specify url of ipa file. question is, url ok? currently put ipa in amazon s3 server, , made simple website link <a href="itms-services://?action=download-manifest&url=itms-services://?action=download-manifest&url=https://s3.amazonaws.com/test/test.plist" id="text"> when open website on iphone, can install app tap. however, concern is, since url public (you can download plist file, open text editor, , see url of ipa file), , have url can download it, there potential danger? from apple's support center: the ios developer enterprise program allows distribute apps employees or members of organization through ad hoc distribution as far understand enterprise license legal agreements, must care security yourself. link on ipa file intended employees , mustn't make public.

java ee - Keep getting the OgnlException: source is null for getProperty(null, "0") Warning -

ok. using below .jsp , java code access notmessagefieldlist . works fine; however, keep getting ognlexception: source null getproperty(null, "0" ) warning when leave page. seems struts 2 trying null values , triggers warning. there way rid of without adjusting tomcat settings? jsp: <s:iterator var="counter" begin="0" end="3"> <tr> <th style="font-size: 120%; font-weight: 900; color: red;">x</th> <td style="font-size: 80%;">new</td> </tr> <tr> <td><b>field name:</b>&nbsp; </td> <td style="float: left"> <s:textfield name="notmessagefieldlist[%{counter}].tag" size="47"> </s:textfield> </td> </tr>...

Jquery Update Function like Unity3D -

my variable nim not updating seconds call $( "#upbutton" ).click(function() { var nim = $("a").css("margin-top").replace("px", ""); nim+=70; $("#moved").css('margin-top',nim+'px'); }); nim = 70 , not change. var nim = $("a").css("margin-top").replace("px", ""); $( "#upbutton" ).click(function() { nim += 70; $("#moved").css( 'margin-top', nim + 'px' ); });

android - Enabling GPS programmatically, causes the GPS indicator to flash while the GPS button is disabled -

in app developing, trying enable gps implicitly/programmatically using below posted code. result strange me, below posted code causes gps indicator flash means searching signal ongoing task, however, when wipe down notification bar, find gps button gray, means not active, when wipe notification bar, gps indicator flashes. below code intended that? how implicitly/programmatically enable gps ? code: private void setgpsactive() { // todo auto-generated method stub intent activategpsintent = new intent("android.location.gps_enabled_change"); activategpsintent.putextra("enabled", true); sendbroadcast(activategpsintent); }

apache - GeoServer under https -

i using apache web server on localhost:80 , geoserver served tomcat on localhost:8080 i installed ssl certificate on apache , works fine except message says have insecure content thought geoserver layers. i'm trying enable ssl geoserver , have openlayers content htis https://example.org:8080/geoserver still not sure what's best approach that.

listview - WPF: How to make two controls (list views) share whole available space between them? -

i have 2 list views (vertically aligned) might have various number of items. i'd them share space proportionally when needed (this can achieve regular grid , *) when 1 list view doesn't have many items show other list view fill whole space. , vice versa. tried different things not achieve behavior. for instance grid can specify * , * (or other proportions) means half of space empty if 1 of list views not have items (and has tons of them). is there way achieve this? need implement own panel or there (simpler) way it? thank you! zaki ok, try code: class mypanel : panel { protected override size measureoverride(size constraint) { // first measuring desired size of children var availablesize = new size(constraint.width, double.positiveinfinity); foreach (uielement ui in internalchildren) ui.measure(availablesize); var totalheight = internalchildren.oftype<uielement>().sum(x => x.desiredsize.height)...

java - Error: Cannot find symbol class view -

i'm trying learn developing android apps , i'm following training on developer.android.com i've run quite bit of problem while trying open new activity when user clicks button. followed instructions precisely , still can't figure out problem i compiled code , got error: error:(39, 29) error: cannot find symbol class view the code on line 39 following: public void sendmessage (view view) { i'm using android studio 0.5.2. thanks! i ran same issue; sripathi's suggestion worked. import android.view.view; worked charm. thanks.

asp.net mvc 4 - How to upload container wav file to encoder for converstion to mp4? -

i have been using samples microsoft site doing conversion wav mp4 sample given below. iasset singlewmvasset = createassetanduploadsinglefile(assetcreationoptions.none, _singleinputwavpath); // encodetoh264 creates job 1 task // converts mezzanine file (in case interview1.wmv) // mp4 file (in case, "h264 broadband 720p"). iasset mp4asset = createencodingjob(singlewmvasset, "h264 broadband 720p"); // buildsasurlformp4file creates sas locator // , builds sas url can used // progressively download mp4 file. string fullsasurl = buildsasurlformp4file(mp4asset); however, here _singleinputwavpath expects file local path. works when take path local. however, wav file upload in azure container make encoding work stored container. is there possibility of using asp .net mvc code retrieve container , convert compatible format , pass , create encoding job? will need @ creating cloud...

c# - TCP File Transfer - Few bytes error -

i working on c# program allows user send file on network , reassemble @ other end. working fine apart few bytes being misplaced int destination leaving not quite same file started as. (corrupting images example). edit: @ least when it's on computer noticed error can solved having client wait 1 second before starting read stream, gives idea client gets end of stream , reads else instead. idea how fix in better way waiting second other computers don't know if that'll work. code server follows: tcplistener listener = new tcplistener(13); listener.start(); filestream inputstream = file.openread(loadlocation.text);//loadlocation being text box file path fileinfo f = new fileinfo(loadlocation.text); int size = unchecked((int)f.length);//get's file size in bytes int csize = size / 4096;//get's size in chunks of 4kb; statuslabel.text = "waiting connection..."; tcpclient client = listener.accept...

c - What is causing memory access error here? -

i not understand causing memory access error here. i made simple example shows problem: #include <stdlib.h> typedef struct mycanvas { void *pixels; } mycanvas; main() { void* testchunk; testchunk = (void*) calloc (1024 * 768 * 4,sizeof(char)); struct mycanvas* new_canvas; new_canvas->pixels=testchunk; //causes memory access error } what needs changed run? gcc on linux. #include <stdlib.h> typedef struct mycanvas { void *pixels; } mycanvas; int main() { void* testchunk; testchunk = (void*) calloc (1024 * 768 * 4,sizeof(char)); mycanvas *new_canvas = malloc(sizeof(struct mycanvas)); new_canvas->pixels=testchunk; //now ok return 0; }

sockets - c# tcp server browser sometimes send extra data into buffer in multipart file upload -

sometimes multipart section of webserver recieves additional data example add binary data in middle of file. code of part: string content = ""; content = sbuffer; int boundarycontentstart = content.indexof("boundary=") + "boundary=".length; string boundary = content.substring(boundarycontentstart, content.length - boundarycontentstart - "boundary=".length); string boundarseprator = boundary.remove(boundary.indexof("\r\n")); string temp = sbuffer; while (!content.contains(boundarseprator + "--")) { mysocket.receive(breceive, breceive.length, 0); temp = encoding.getencoding(1252).getstring(breceive); content += temp; temp = ""; } sbuffer string recieve buffer 1024 byte array why happens , browser sends information in middle of file part in multipart form post. whole content added conetent var...

php - CI Active Record Query not updating -

i trying update tenders table in db reasons updating table zeros. after getting last_query() string , running phpmyadmin window updates using active records not. other queries working apart this. what might problem code? here code $data=array( 'tender_type_type_id' => $this->input->post('tender_type_id'), 'description' => $this->input->post('tdescription'), 'obtaining_documents' => $this->input->post('obtaining_docs'), 'submission_process' => $this->input->post('submission_proc'), 'obtaining_documents' => $this->input->post('obtaining_docs'), 'applicationfee' => $this->input->post('applicationfee'), 'location' => $this->input->post('location'), ...

ios - text not showing in table view cell unless cell touched -

i have table view set in traditional master/detail way in iphone app. when click save on detail screen (after adding information want), switches master list, however, text that's supposed appear in cell in master list doesn't appear until touch cell finger, however, if touch cell finger segues detail screen , have click "back" master list cell has text it's supposed to. interestingly, table view image appearing upon save - don't have touch cell make image appear in same way have make text appear. clicking "save" button in detail screen runs code. mnemonicfield.text gets saved currenttopic , later set text appears in cell - (ibaction)save:(id)sender { [self.currenttopic settopic:topicfield.text]; [self.currenttopic setmnemonic:mnemonicfield.text]; //this should appear in cell on master [self.currenttopic setmood: self.mood]; [self.delegate addtopicviewcontrollerdidsave]; } the master table view controller delegate referred ...

c# - Cast with typeof -

i have type type sometype want cast in runtime for example want : var customers = getcustomers() sometype[] how this? you cannot use as cast type known @ runtime: expression invalid @ compile-time since you'd have use typeof(t) cannot used as . what can use though system.convert.changetype(object, type) . here second parameter can use typeof(t) , combined control statement can convert input @ runtime correct type. you should ask whether want though: types known @ runtime leave little use. msdn: system.convert.changetype

javascript - Search form: submit when a name is clicked -

in search box, when user presses 3 letters, list of potential hits shown. but when user selects name list, still has press enter. how can avoid when selects name, name should automatically submitted. update: , possible submit when user selects name list, , not when presses enter? this html code: <form action="10_miles.php" method="post"> <p><label>please enter last name , find name in list: </label><br><br> <input type='text' name='full_name' value='' class='auto'></p> </form> i making use of javascript: <script type="text/javascript"> $(function() { $(".auto").autocomplete({ source: "search_develop.php", minlength: 3 }); }); </script> you like; <script type="text/javascript"> $(func...

server and client in java -

i have problem client-server. when run server, after client, server write client connected server can write nothing in console. can check problem? because i'm new in java. try scanner doesn't work too. server: package ts_server; import java.io.bufferedreader; import java.io.ioexception; import java.io.inputstreamreader; import java.io.printwriter; import java.net.serversocket; import java.net.socket; public class server { private static final int port = 50000; static boolean flaga = true; private static serversocket serversocket; private static socket clientsocket; public static void main(string[] args) throws ioexception { serversocket = null; try { serversocket = new serversocket(port); } catch(ioexception e) { system.err.println("could not listen on port: "+port); system.exit(1); } s...

PHP array assigning multiple keys to same value -

$lang = array( 'thank you'=>'you welcome', 'thanks'=>'you welcome', 'thank ya'=>'you welcome' ); as can see going tiresome writing multiple keys same value there way can do. $lang['thanks']=>$lang['thank ya']=>$lang['thank you'] just trying save myself time here rewriting hundred times php class function: function fetch_key($key, $l,$bool){ $dynamic = new l18n; if($bool == true or is_null($bool)){ return addslashes( $dynamic->convert($key,$l) ); }else{ return $dynamic->convert($key,$l); } } ex $lang = array( 'thank you'=>'you welcome', 'thanks'=>'you welcome', 'thank ya'=>'you welcome', 'hello'=>'hello', 'goodbye'=>'goodbye' ); so i'd need make adds array , not fill ke...

timestamp - Xcode time difference in minutes fails -

quick question used following code retrieve difference between 2 timestamps. minutes given me in 0.5 hrs. how minutes (nsinteger format)? nsdateformatter* dateformatter = [[[nsdateformatter alloc] init] autorelease]; [dateformatter setlocale:[[[nslocale alloc] initwithlocaleidentifier:@"en_us_posix"] autorelease]]; [dateformatter setdateformat:@"mm:ss"]; nsdate* firstdate = [dateformatter datefromstring:@"06:00"]; nsdate* seconddate = [dateformatter datefromstring:@"17:30"]; nstimeinterval timedifference = [seconddate timeintervalsincedate:firstdate]; i'm using nsinteger full hours, can't figure out minutes... must late @ night me :-/ nsinteger hoursbetweendates = timedifference / 60; nsinteger minutesbetweendates = ??; nslog(@"raw: %f", timedifference); nslog(@"hours: %i", hoursbetweendates); nslog(@"minutes: %i", minutesbetweendates); thanks guys! :-d the nstimeinterval in seconds....

c - printing common characters in three strings -

q) write c program takes input 3 strings, each of maximum 30 characters, , prints common characters present in 3 strings. each string can have different number of characters. the code have written is: #include<stdio.h> int main() { int c1=0 , c2=0, c3=0 ,i,x; int count1[26]={0} , count2[26]={0} , count3[26]={0}; char st1[30],st2[30],st3[30]; printf("enter string1: "); gets(st1); printf("\n enter string2: "); gets(st2); printf("\n enter string3: "); gets(st3); while(st1[c1]!='\0') { count1[st1[c1]-'a']++; c1++; } while(st2[c2]!='\0') { count2[st2[c2]-'a']++; c2++; } while(st3[c3]!='\0') { count3[st3[c3]-'a']++; c3++; } for(i=0;i<26;i++) { if(count1[i]!=0 && count2[i]!=0 && count3[i]!=0) { if ...

mysql - How to write a sub query within another subquery? -

how go writing query for: each coral has @ least 2 samples during 1/1/2007 , 1/1/2008, list coral name , number of samples. i think needs sub query have tried putting things around other ways , it's no working me. able 'spell out' me can understand going on , attempting similar queries this. tables reef [reefname, latitude, longitude, 2006_bleachedarea, summer_maximum_monthly_mean_temperature] key: reefname reeftemp [reefname, dateofreading, temperaturereading] key: reefname, dateofreading coral [coralcode, coralname, thermalthreshold] key: coralcode coralsampling [sampleno, coralcode, reefname, dateofsampling, bleachpercent] key: sampleno this have far. doubt correct @ all. select coralcode, sampleno coralbleach__coralsampling dateofsampling between '2007/1/1' , '2008/1/1' group sampleno you should able simple join, like; select coral.name, count(coralsampling.sampleno) number_of_samples coral join coralsampling on co...

android - Incorrect date conversion by SimpleDateFormat -

i using simpledateformat convert date dd-mm-yyyy yyyy-mm-dd not display year properly.i trying convert 18-5-2014 2014-05-18 getting 3914-05-18. public void ondateset(datepicker view, int year,int monthofyear, int dayofmonth) { date selecteddate = new date(year,monthofyear, dayofmonth); string strdate = null; simpledateformat dateformatter = new simpledateformat("yyyy-mm-dd"); strdate = dateformatter.format(selecteddate); txtdeliverydate.settext(strdate); } i suspect didn't read documentation (deprecated) date constructor you're using: parameters: year - year minus 1900. month - month between 0-11. date - day of month between 1-31. avoid using date here. either use good date/time library joda time, or use calendar set year/month/day values - then, month 0-based. also, method accepting year/month/day values... if you're trying conversion, should accepting string , returning string, e.g. pub...

c# - decompressing compressed binary file -

i have compressed file (binary file/compressed string - i'm not sure is ), i'am trying decompress file c#/vb.net , tried decompress gzip: private shared function gzuncompress(byval data() byte) byte() dim input memorystream = new memorystream(data) dim gzip gzipstream = new gzipstream(input, compressionmode.decompress) dim output memorystream = new memorystream gzip.copyto(output) return output.toarray end function gzuncompress(new system.net.webclient().downloaddata("http://haxball.com/list3")) there exception (where : gzip.copyto(output)): the magic number in gzip header not correct when tried uncompress php it's worked :) . php header('content-type: text/html; charset=utf-8'); $list = file_get_contents('http://haxball.com/list3'); $list = gzuncompress($list); $len = implode('', unpack('n*', $list)); $bytes = unpack('c*', $list); $string = implode(...

gruntjs - Grunt-template-jasmine-istanbul missing dir error -

i install grunt plugins grunt-template-jasmine-istanbul npm install grunt-template-jasmine-istanbul --save-dev and add gruntfile.js following: coverage: { src: ['app/scripts/**/*.js'], options: { specs: ['test/**/*.js'], template: require('grunt-template-jasmine-istanbul'), templateoptions: { coverage: 'test/coverage/coverage.json', report: [ {type:'html',options: {dir: 'test/coverage/html'}}, {type:'text',options: {dir: 'test/coverage/text'}}, {type:'text'}, ], thresholds: { lines: 75, statements: 75, branches: 75, functions: 90 } } } }, but when running test shown following warning , no report in test/coverage folder: my@computer:/share/angularjs-gs$ grunt test:coverage running "cover...

c# - check if xmlReader is concrete end element -

i've got xmlreader set , can check elements, cant find way check closing element, lets want have case statement </perls> tag in addition opening one, how this? know sure such tag not self closing. using (xmlreader reader = xmlreader.create("perls.xml")) { while (reader.read()) { // detect start elements. if (reader.isstartelement()) { // element name , switch on it. switch (reader.name) { case "perls": // detect element. console.writeline("start <perls> element."); break; case "article": // detect article element. console.writeline("start <article> element."); // search attribute name on current node. string attribute = reader["name"]; if (attribute != null) { console.writeline(" has attribute name: " + attribu...

php - CodeIgniter URL suffix .html automatically for all URL -

i new in codeigniter. setup ci in localhost eg. localhost/myprojects/codeigniter/welcome/index i can able remove index.php url & completed .html suffix so, can able visit localhost/myprojects/codeigniter/welcome/index.html & working properly. so using tag this: <a href="<?php echo base_url(); ?>welcome/register.html">register</a> but, dont want use .html in link manually. have solution show visitor .html suffix automatically eg. localhost/myprojects/codeigniter/welcome/index.html or localhost/myprojects/codeigniter/welcome/about.html etc here htaccess http://pastebin.com/cxufjvbp just edit url_suffix in config.php ..... $config['url_suffix'] = '.html'; use site_url() <!-- no need .html --> <a href="<?php echo site_url('welcome/register'); ?>">register</a> <!-- <a href="http://domain/welcome/register.html">register</a> --> or ancho...