Posts

Showing posts from April, 2015

How to specify enum in osgi blueprint xml? -

i m trying use dependency injection osgi blueprint. want construct enum object/s specifying in xml dsl. in spring context xml - <bean id="mytestenum" class="com.foo.testenum" factory-method="valueof"> <constructor-arg> <value>typea</value> </constructor-arg> </bean> how achieve in osgi blueprint xml file? see schema validation error @ tag.. appreciate pointers! thanks. try replacing constructor-arg block with <argument value="typea"/>

ios - Several Questions about ScrollView with PageControl -

i pretty new ios development , stumbled upon several issues couldn't find answers yet: general setup: i'm using scrollview pagecontrol inside tabbarapplication is possible have pagecontrol within same area content of pages? me gets hidden srollview's views, due display space being rare need on same height actual content. i've fooled around in sandbox-project , whenever first started implement button view of scrollview-page pages of scrollview wouldn't show anymore, after first scroll attempt. i'd post code autogenerated ib. this general question possibilities again: main design of project should tabbarapplication navigationcontroller letting go deeper sub-menues pretty common. in 1 of tabs there should pagecontrol, in can again go sub-menues pushing views on navigationcontroller stack . possible? some code 2. - (void)viewwillappear:(bool)animated { [super viewwillappear:animated]; nsmutablearray *controllers = [[nsmutablearray alloc] init]; (uns...

opencv - cvCalcOpticalFlowHS not being recognised C++ -

i've installed opencv , far has been working, reason if include: cv.h, highgui.h error when want use function: cvcalcopticalflowhs: error c2065: 'cvcalcopticalflowhs' : undeclared identifier. i've tried header file needs included, i've had no succes far. do #include "opencv2/legacy/legacy.hpp"

ember.js - How can you tell if an Ember view's element is in the document? -

how can tell ember view's element has been inserted document? my current method do: if (this.$().length) { // ... } another solution checking dictionary of views. if have view like: var helloview = em.view.create({ elementid: 'hello' }); you can do: var myview = ember.view.views.hello; // check if in dom myview.get('state') === "indom"; // check if visible myview.get('isvisible');

ruby on rails 3 - Search by name in non latin characters -

i'm trying search using, product.order(:name).where("name ?", params[:term]) where :term in non latin characters (hebrew). both application , database set utf-8 application.rb config.encoding = "utf-8" database utf8_unicode_ci and specific name i'm searching in database, search comes out empty. any suggestions? i had add % of own in params[:term:] is product.order(:name).where("name ?", params[:term]+"%") i not sure if best way achieve wanted works nonetheless ...

apache - Tomcat without index.html show files in directory -

i wondering how make tomcat show files in directory when index.html not in root directory? gives me error page. description requested resource (/tutorials/ios/exercise-files/ex_files_ios4_web_apps/ch02/) not available. open tomcat's own /conf/web.xml file (or 1 in servers project if you're using eclipse), find <servlet> entry of defaultservlet , change listings initialization parameter false true . <init-param> <param-name>listings</param-name> <param-value>true</param-value> </init-param> see also: tomcat 7.0 documentation - default servlet

c# - free Graph Drawing SDK for ASP.NET -

i want draw mathematical graph in asp.net web application. there free control doing work? see http://www.yworks.com not free. following under microsoft public license (ms-pl) license , might want check out quickgraph . nodexl might of interest (visualization library). it's wpf, can use container host if need winforms. you can use check graphviz generate sort of graph. app generates .dot file can then passed graphviz. supports load of file formats, such bmp, jpg, png, pdf, svg etc etc. reference: open source tools list c# graph drawing library? drawing web graph you use quickgraph model graph programatically, export graphviz or glee , render png.

java - Can jmethodID initialized on one thread be used in another thread? -

can use jmethodid intialized on 1 thread in thread ? asked because jvm crashing when run jni program,in have initialized jmethodid on 1 thread , using in thread. thinking if reason. i have kept jmethodid global varibale declaring @ top. in 1 of call initialize , in subsequent calls attempt reuse it. quoting jni specification : a field or method id not prevent vm unloading class id has been derived. after class unloaded, method or field id becomes invalid. native code, therefore, must make sure to: keep live reference underlying class, or recompute method or field id if intends use method or field id extended period of time.

jquery - Persist ID throughout ASP.NET MVC Views -

basically have image upload controller, inserting in pages follows :- <div id='imagelist'> <h2>upload image(s)</h2> @{ if (model != null) { html.renderpartial("~/views/file/imageupload.cshtml", new mvccommons.viewmodels.imagemodel(model.project.projectid)); } else { html.renderpartial("~/views/file/imageupload.cshtml", new mvccommons.viewmodels.imagemodel(0)); } } </div> so passing id imageupload, in case projectid, can include in insert. now piece of code populating imagemodel(id), in case projectid :- public imagemodel(int projectid) { if (projectid > 0) { projectid = projectid; var imagelist = unitofwork.imagerepository.get(d => d.itemid == projectid && d.pageid == 2); this.addrange(imagelist); } } and in turn leads imageuploadview.cshtml :- ...

symfony - How to get doctrine2 table alias? -

i want create method in doctrine2 repository class takes querybuilder , adds clauses, 1 of inner join. how can find out table alias used instantiate querybuilder? discoverable or should convention across codebase (and therefore potential source of bugs)? my client code is: public function getpasswordaction($id) { $user = $this->get('security.context')->gettoken()->getuser(); $repository = $this->getdoctrine() ->getrepository('tenkpwlockerbundle:password'); $query = $repository->createquerybuilder('p') ->where('id = :id') ->setparameter('id', $id); $query = $repository->usercanreadrestriction($query, $user); ... and repository class contains: public function usercanreadrestriction(\doctrine\orm\querybuilder $builder, \tenk\userbundle\entity\user $user) { // can 'p' from? return $builder->innerjoin('p.shares', ...

Getting column values as array, Zend_Db, Mysql, php -

i have following database tables: table: person columns: id, first_name, age, city, state table: study columns: id, name, description, notes table: person_studies columns: person_id, study_id, notes i need study names particular person involved in: person.id, person.first_name, person.city, study.name this query wrote data person.id = 14 : select person.id, person.first_name, study.name person left join person_studies on person.id = person_studies.person_id left join study on person_studies.study_id = study.id person.id=14; since there multiple studies person involved in, getting more 1 row in result set. need implement using zend_db api's. the questions are: 1. there better way write query? 2. if want study.name values in separate array part of result set, possible in query such when run query in zend: `$result = $this->fetchall($select);` $select sql statement $result should of following format: [0] => array ( ...

android - my application not resume when reopen? -

my application not resuming previous state when reopen although working when call recieved or other application open , closed comes in front but when home_key pressed start first activity. it not happened on emulator happens on device it happens activity among many activities in app do reimplement onresume() method in activity? i'm not sure state need restore, perhaps saving android activity state using save instance state might (duplicate?)? you familiar activity lifecycle ?

objective c - Disabling scrolling when image is zoomed -

i have image inside uiscrollview. want happen if zoomed in particular position, want disable scrolling (both vertical , horizontal) remain on zoomed area. can give me ideas on how this? two things keep in mind: make sure want when need disable scroll. (you can use methods uiscrollviewdelegate accomplish that). make contentsize of uiscrollview same size of frame. way both horizontal , vertical scroll disable. cgrect myscrollviewrect = myscrollview.frame; cgsize myscrollviewframesize = cgsizemake(myscrollviewrect.frame.size.width, myscrollviewrect.frame.size.height); myscrollview.contentsize = myscrollviewframesize; for clarity putted more code need to.

How to import the images of products with a csv file via dataflow of Magento 1.6.2? -

hi have issue import of product images. i use magento 1.6.2 , want import products import dataflow of magento. have images in media/import - import dataflow rows. example: image 12345.jpg in media/import/1/2/12345.jpg in csv looks like: "/1/2/12345.jpg" but when want import csv says: "the image doesn't exist." why? help. thx it needs go in media/import folder csv says /image.jpg (where image.jpg actual filename of image you're using). there's another answer made details ... i'll see if can find , paste correct details in here. link has working csv samples successful import.

swing - Using GUI based java application for mobile application -

i have developed java application in netbeans 7.1.2 uses different swing controls combobox, jcalendar (for taking date input user) textfields (for inputs user), command button doing calculation in code etc. , display result in textfield. program uses derby data table while doing calculations. using sql statements executing queries based on user input. application works absolutely fine. now, want make standalone mobile application of project. considering controls using above appropriate source package , file should looking in mobile application project? don't mind building gui again , putting code in not of work if can use built application , good. after bit of google, have tried opening mobile application in java me , open java package (right click>new>java package), here tried (right click>new>) visual midlet, jframe form, gui xlet form etc. none of them seem have swing controls. pallette shows beans, java persistence , jcalendar only. am supposed add/load co...

java - Application no longer works in lower android versions after setting android:targetSdkVersion -

after set android:targetsdkversion 15, application doest work in 1.6 emulator. throws java.lang.verifyerror. edit: app crashing because i'm calling invalidateoptionsmenu, came in api 11. check before calling (if (version.sdk_int >= 11)). still throws same error. you forgot set project build version 4.0.3. right click project in project explorer. click properties . click android . click check box next 4.0.3 .

passing parameters to bat file as 1 string -

it seems simple. in bat file, call program takes command line parameters have parms 1 string, have tried "" around , not sees 1 parm (if guess hit space) so question how can pass string, parameter list actual string below , must formated such "" etc -u romeirj -p abc123 -f c:\inetpub\wwwroot\russ\crexport\russ.rpt -o c:\inetpub\wwwroot\russ\russ.pdf -a "startdate: 01-01-2010" -a "gender:m" -a "type:pendjud" would call bat file looks like batfile.bat parmstring bat file content program.exe %1 as long of batch parameters supposed passed program, can call batch parameters have specified them, , use following within batch script. program.exe %* the problem becomes more complicated if want pass of batch parameters called program. unfortunately there no method escape quotes within quoted string. impossible escape parameter delimiters. impossible simultaneously embed both spaces , quotes within single batch param...

LINQ iterate through results -

i trying read following text file: author { name xyz blog www.test.com rating 123 } author { name xyz blog www.test.com rating 123 } author { name xyz blog www.test.com rating 123 } author { name xyz blog www.test.com rating 123 } i using following snippet fetch author record: public static ienumerable<string> getauthors(string path, string startfrom, string endto) { return file.readlines(path) .skipwhile(line => line != startfrom) .takewhile(line => line != endto); } public static void dosomethingwithauthors(string filename) { var result = getauthors(filename, "author", "}").tolist(); } the above returns me 1 author details. kindly show me how fetch authors in 1 go popluate object. thank much!! i suggest that, if file structur...

javascript - On submit, after X seconds, if window blur -

i trying identify if window loses focus after 3 seconds of submit. currently have this: $("input").on("submit",function(){ $(window).blur(function(){ console.log(a); }) }); but this, no matter when press submit, if click outside window or minimize window console.log triggers a . this trying achieve: user submits form in period of 3 seconds, if window loses focus console.log(a); after 3 seconds, if window loses focus do nothing. if user submits again on same session, repeat step 1. try this: $("#form").on("submit",function(){ var blurfunc = function() { console.log(a); } $(window).blur(blurfunc); settimeout(function() { $(window).unbind('blur', blurfunc); }, 3000); }); the settimeout call unbind blur event after 3 seconds, causing event not fire. for more info on settimeout see here: http://www.elated.com/articles/javascript-timers-with-settimeout-and-setinterval/ alternativ...

io - Hadoop Custom Values for a key -

i tried implement custom writable instead of using intwritable. reason behind want have pair of values. in particular want achieve following: user_id;counter;length_of_messages; the input files of following sort: user_id;time_stamp;length_of_messages the output files should aggregate information user_id;counter;length_of_messages semantically, stats of user given periond (e.g. 1 week) aggregating number of times wrote message in week, , sum of lengths of messages in week. public class valueswritable implements writable { private int counter; private int durations; public void write (dataoutput out) throws ioexception{ out.writeint(counter); out.writeint(durations); } public void readfields(datainput in) throws ioexception{ counter = in.readint(); durations = in.readint(); } public valueswritable read(datainput in) throws ioexception{ valueswritable v = new valueswritable(); v.readfields(in); return v; } } i included class innerclass in mapreduce jo...

blackberry - Color a certain portion of horizontal manager -

i have horizontal manager having 3 label fields shown has "1:00 event1" in screen ,i want set background color hfm covering 1:00 ,how can ? horizontalfieldmanager horizontalfieldmanager_left15 = new horizontalfieldmanager( manager.horizontal_scroll); horizontalfieldmanager_left15.add(time15label); horizontalfieldmanager_left15.add(min15label); horizontalfieldmanager_left15.add(evetnlabel); thanks refer - horizontalfieldmanager horizontalfieldmanager_left15 = new horizontalfieldmanager( manager.horizontal_scroll); labelfield lb = new labelfield(time15label) { //setting backgroundcolor of text protected void paint(graphics graphics) { graphics.setcolor(color.lavendar); super.paint(graphics); } }; //setting backgroundcolor of textarea protected void paintbackground(graphics graphics) { graphics.setbackgroundcolor(color.goldenrod); graphics.cle...

javascript - how to properly unbind events in Jquery-Mobile using on/off when a page is kept in the DOM? -

as jquery mobile keeps pages in dom when navigating around, page may visited multiple times when going , forth. if i'm binding page below , inside binding perform page logic, includes "nested element bindings": // listener page show: $(document).on('pagebeforeshow.register', '#register', function() { // stuff // page event bindings: $(document).on('click.register', '.registersubmitter', function(e) { // }); }); going , forth causes nested binding attached multiple times. right trying work around (doesn't work...): $(document).on('click', '.registrysubmitter', function(e) { if ( $(this).attr('val') != true ) { $(this).attr('val') == true; // } }); so i'm allowing first binding pass , block every other binding attempt comes along. while works, it's far optimal. question : how , when should even...

php - Check if multiple strings are empty -

possible duplicate: more concise way check see if array contains numbers (integers) php checking if empty fields i have form submits 10 fields, , 7 of them should filled, here how chek in php: if (!$name || !$phone || !$email || !$mobile || !$email || !$state || !$street || ! $city) { echo '<div class="empty_p">you have empty fields!!!</div>';} else{ //process order or } my question is: there more simple way this? because have more strings check (12-15) <input type="text" name="required[first_name]" /> <input type="text" name="required[last_name]" /> ... $required = $_post['required']; foreach ($required $req) { $req = trim($req); if (empty($req)) echo 'gotcha!'; } /* update */ ok! guys, easy... you can make more secure, type casting programmers out coming data, $id = (int) $_get['id'] , $username = (string) addsl...

Rails 3.1 - Events Listings - How to handle events that span many dates? -

i'm building events listing site. each event entered specific date , displayed in order......simple! however, need consider how handle events such festivals , plays span more 1 date. entering event on , on again each date isn't best option. i've thought have start date , end date, i'm not sure how make event show in index dates in between start/end. simple, thought i'd seek guidance more experience before potentially set off down wrong path this. the event schema @ moment: create_table "events", :force => true |t| t.date "event_date" t.string "headline" t.text "info" t.integer "event_type_id" t.integer "venue_id" t.datetime "created_at" t.datetime "updated_at" t.string "event_image_file_name" t.string "event_image_content_type" t.integer "event_image_file_size" t.datetime "event_ima...

c++ - How to suppress this - qglobal.h:320:6: warning: #warning "This version of Mac OS X is unsupported"? -

i encountering following warning /path/qtsdk/desktop/qt/474/gcc/include/qtcore/qglobal.h:320:6: warning: #warning "this version of mac os x unsupported" here qglobal.h 301 #ifdef q_os_darwin 302 # ifdef mac_os_x_version_min_required 303 # undef mac_os_x_version_min_required 304 # endif 305 # define mac_os_x_version_min_required mac_os_x_version_10_4 306 # include <availabilitymacros.h> 307 # if !defined(mac_os_x_version_10_3) 308 # define mac_os_x_version_10_3 mac_os_x_version_10_2 + 1 309 # endif 310 # if !defined(mac_os_x_version_10_4) 311 # define mac_os_x_version_10_4 mac_os_x_version_10_3 + 1 312 # endif 313 # if !defined(mac_os_x_version_10_5) 314 # define mac_os_x_version_10_5 mac_os_x_version_10_4 + 1 315 # endif 316 # if !defined(mac_os_x_version_10_6) 317 # define mac_os_x_version_10_6 mac_os_x_version_10_5 + 1 318 # endif 319 # if (mac_os_x_version_max_allowed > mac_os_x_version_10_6) 320 ...

python - Is concurrency possible in tornado? -

i understand tornado single threaded , non-blocking server, hence requests handled sequentially (except when using event driven approach io operation). is there way process multiple requests parallel in tornado normal(non-io) execution. can't fork multiple process since need common memory space across requests. if not possible please suggest me other python servers can handle parallel request , supports wsgi. if going dealing multiple simultaneous requests compute-bound, , want in python, need multi-process server, not multi-threaded. cpython has global interpreter lock (gil) prevents more 1 thread executing python bytecode @ same time. most web applications little computation, , instead waiting i/o, either database, or disk, or services on other servers. sure need handle compute-bound requests before discarding tornado.

Sass compiler can't see Compass -

i have compass installed when try watch sass file get: line 1: file import not found or unreadable: compass/css3. is there way should reference compass? (using windows 7) if want use compass command line, should using own watcher instead of sass's. compass watch if you're within context of ruby app, you'll need make sure compass gem required.

sublimetext2 - Stop HTML Tidy in sublime from adding extra tags -

how prevent html tidy in sublime text adding tags such this this want <div class="row"> <aside class="span4"> <section> <%= render 'shared/user_info' %> </section> <section> <%= render 'shared/micropost_form' %> </section> </aside> </div> after using html tidy -- dont want <html> <head> <title></title> </head> <body> <div class="row"> <aside class="span4"> <section> <%= render 'shared/user_info' %> </section> <section> <%= render 'shared/micropost_form' %> </section> </aside> </div> </body> </html> ...

objective c - How to position progress spinner inside the title bar of a Mac application -

i trying place progress spinner @ right side of the title bar of window of mac os x application, can't interface builder, doesn't let me drag view inside it. so, tried put in title bar programmatically, following code inside applicationdidfinishlaunching method in appdelegate.m: loadingspinner = [[nsprogressindicator alloc] init]; [loadingspinner setframe:nsmakerect(485, 0, 17, 17)]; [loadingspinner setstyle:nsprogressindicatorspinningstyle]; nsview *titlebarview = [[_window standardwindowbutton:nswindowclosebutton] superview]; [titlebarview addsubview:loadingspinner]; however, putting progress spinner view @ bottom of window instead of title bar. appears nsmakerect() positioning relative bottom of window, not top. if change second parameter of nsmakerect (y position) 370, puts loading spinner in place want be, when resize window vertically, brings progress spinner bottom. i've never seen before. how can fix that? p.s.: also, don't know if there's ...

python - Can subprocess.call be invoked without waiting for process to finish? -

i'm using subprocess.call() invoke program, blocks executing thread until program finishes. there way launch program without waiting return? use subprocess.popen instead of subprocess.call : process = subprocess.popen(['foo', '-b', 'bar'])

relativelayout - Dynamically adding elements to android relative layout -

i having little problem relative layouts. i'm doing project in have read values .csv file , display them dynamically in relative layout. i'll put couple of code snippets , images , explain problem. first code snippet: package ekalavya.pratnala.quiz; import java.io.bufferedreader; import java.io.file; import java.io.filereader; import java.util.stringtokenizer; import android.app.activity; import android.os.bundle; import android.view.viewgroup.layoutparams; import android.widget.imageview; import android.widget.relativelayout; import android.widget.scrollview; public class quizactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); // beginning of variable declarations file quizspecs = new file("mnt/sdcard/teacher.csv"); // read file bufferedreader csvreader = null; string line = "";...

recursion - Node.js recursive function with super agent -

i'm developing simple function that, making use of superagent module, query api service retrieve information splitted in several pages. as finish each call have push information array , retrieved last page, start working on array. using normal way sure i'll have problem due async-ness, need callback or event emitter rid of this. atm used code, doesn't work: function getpage(page){ pages = new array() superagent.get('http://localhost/api.json') .end(function(r){ if(r[r.length-1] == 'value') getpage(page++) else pages.push(r); ); } take @ async.js, it's useful library can this.

ant - finding execution flow in a huge java code base -

i trying find execution flow in large java code base not written me. have searched tools make possible (jsonde, jtrace, java call tracert, javacalltracer), problem should used single java/jar/class file. code trying understand built ant , has hundreds of jars. so, runs using shell script. not know how use tools code. i appreciate help. i know, old question, found solution , put here if else searches same thing: http://findtheflow.io/#gettingstarted .

ruby on rails - After validation fails and a form redirects back to itself, why are instance variables empty? -

in rails 3.2 app, when form fails save (validation fails) , redirects form error: undefined method `map' nil:nilclass this form not display errors when navigating directly new or edit paths. the error coming select field custom options_from_collection_for_select method. <%= f.select(:user_ids, options_from_collection_for_select_with_attributes(@users, :id, :name, 'data-attributes', :attributes ), {include_blank:true}, {multiple:true}) %> if replace instance variable @users user.all don't error after redirect. i guess @users empty after redirect, hence error. why? @users defined in new , edit controllers. my controller is: def create --bunch of stuff if @model.save --bunch of stuff respond_to |format| format.html { render :text => model_url(@model) } format.html { redirect_to(@model, :notice => 'success!.') } format.xml { render :xml => @model, :status => :created, :location => @model } ...

printing - auto print using jquery -

Image
i have data in following format: (dummy entries)(id=posgridview) as process sale, small receipt print automatically selected columns, not columns. because data available in grid view, how can print dynamically format jquery? edited actually want print in format dynamically above grid view printing there's no need jquery printing page, need javascript function: window.print(); . if need print specific content, can hide rest (and format printed area) css: <style media="screen"> .noprint{ display: block; } .yesprint{ display: block !important; } </style> <style media="print"> .noprint{ display: none; } .yesprint{ display: block !important; } </style> as can see, setting media attribute of style tag, can set styles both normal view (screen) , printing view (print). full article here . dynamism you can add dynamism process, keep in mind can dinamically user, in code you'll have find , event...

reporting services - SSRS "Report Server Project" doesn't display in Visual Studio 2010 -

i have started working on ssrs , have installed sql server 2008 enterprise edition , installed visual studio 2010 . when opening vs2010 in case didn't seen business intelligence projects -> report server project whenever opening sql server business intelligence development studio under microsoft sql server 2008 shows in new project wizard. current project in 4.0 , have worked on project using vs2010. how can report server project show in vs2010? sql server 2008 uses vs2008 shell. pratik says, need use sql server setup , install business intelligence development studio feature install vs2008 shell. not able use vs2010 create report server project until upgrade sql server 2012.

ios - Upload video on twitter using ios5 + iphone sdk -

hiii, i have uploaded image , status message using twtweetcomposeviewcontroller .. not able find upload video using same class .. please suggest me if have link or guideline . thanks in advance .. abhishek twitter not host videos.go through support.twitter.com

ios - Conformance to UIImagePickerControllerDelegate protocol not being seen by the compiler -

i'm missing something. code functions fine, clear compiler warnings. sending 'gsbbuilderimagebutton *const __strong' parameter of incompatible type 'id<uinavigationcontrollerdelegate,uiimagepickercontrollerdelegate>' in past experiences warning message, never noticed two protocols being mentioned in warning -- , fair enough, in case have no idea why there reference uinavigationcontrollerdelegate. but here's interface first: #import <uikit/uikit.h> #import "gsbimagebuttondelegate.h" @interface gsbbuilderimagebutton : uibutton <uiimagepickercontrollerdelegate> { uipopovercontroller *popover; uiimage *imagedata; nsurl *mediaurl; id <gsbbuilderimagebuttondelegate> _delegate; } @property (strong, nonatomic) nsurl *mediaurl; @property (strong, nonatomic) uiimage *imagedata; @property (strong, nonatomic) id <gsbbuilderimagebuttondelegate> delegate; - (void)removepicture; - (void)setimagedata:(uiimage...

exception - IndexOutOfBoundsException when reading from a ZipInputStream Java -

i'm trying implement algorithm description previous question had here in stackoverflow: suppressing or not allowing access time modified java so implemented as byte[] digest = new byte[this.buffer]; messagedigest md5; try { md5 = messagedigest.getinstance("md5"); while(entry.getnextentry() != null){ zipentry current = entry.getnextentry(); if(current.isdirectory()){ digest = this.encodeutf8(current.getname()); md5.update(digest); } else{ entry.read(digest, 0, this.buffer); md5.update(digest); } } digest = md5.digest(); entry.close(); } catch (nosuchalgorithmexception e) { // todo auto-generated catch block e.printstacktrace(); } however, i'm getting exception in thread ...

c - Declaring a function number of times -

i came across c source function name declared multiple times in header file , in c files. know not wrong declaring functions numerous times question why should declare function many times? we shouldn't. bad coding. these declarations must matched, otherwise there's going compilation error.

android force camera to take photo in landscape mode -

i want force default android camera take photo in landscape mode only. have tried following: intent cameraintent=new intent("android.media.action.image_capture"); file photo = new file(environment.getexternalstoragedirectory().getabsolutepath(), "pic.jpg"); cameraintent.putextra(mediastore.extra_output, uri.fromfile(photo)); cameraintent.putextra(mediastore.extra_screen_orientation, activityinfo.screen_orientation_landscape); startactivity(cameraintent); but works in 2.1 not later. want have photo image saved in landscape mode. don't want use image processing such matrix or custom camera. note: calling intent activity has orientation fixed " portrait " in androidmanifest.xml <activity android:name="activity_name" android:screenorientation="landscape" /> this activity image capturing activity.

android - Image View change image after paticular time interval -

i using image view , want change image @ particular interval. i have 10 images. how this? you need timertask it. below snippet you it change image every 3 seconds. timer = new timer(); timer.schedule(new timertask() { @override public void run() { runonuithread(new runnable() { public void run() { if (flag > 1) { timer.cancel(); timer = null; } else imageview.setimageresource(images[flag++]); } }); } }, system.currenttimemillis(), 3000);

Jquery UI - Dynamically added resizable & draggable divs are going outside the containment -

pls go through demo link of fiddle. when user adds new text parentdiv, newly added layer going beyond size of parent layer. try click button 3 or 4 times, , notice new text layer outside parent layer.. can confine newly added layers inside layer ? there logic present jqueryui controls ? please help. jsfiddle demo link try this: .dragclass { display: inline-block; float: left } $(".dragclass") .draggable({ stack: "div", cursor : "move", delay : 100, scroll : false, containment : "parent", refreshpositions: true, scroll: true }) http://jsfiddle.net/e2yfc/18/

ios - Synchronizing two targets in Xcode 4 -

Image
is there quick way synchronize 2 (or more) targets in xcode? becomes issue when forget add new file unit test & integration target. have go hunting see forgot add. can duplicate "development" target , re-add "unit testing" configuration, that's pain. there easier way? edit: i john's answer below used answer here , involves manually editing project file. multiple missing files quickest way. your question focuses on case adding single file target, , forget check both boxes add target want. perhaps mean pain use identity inspector, think handy way add in 1 file didn't added second target. can identity inspector first clicking on file want inspect information, , using cmd-opt-1, , clicking rightmost tab. notice near bottom me, both targets checked. you, in case of file didn't added both targets, 1 unchecked. in case of not remembering files added target: if have project under source control, can perform "view" -...

objective c - How to respond to applicationWillResignActive differently from different View Controllers -

when application interrupted, such receiving phone call, screen locked, or switching applications, need respond differently depending on view/viewcontroller on screen @ time of interruption. in first view controller, we'll call vca, have this [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(dosomething) name:uiapplicationwillresignactivenotification object:null]; -(void)dosomething{ //code here }; in vcb have [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(dosomethingelse) name:uiapplicationwillresignactivenotification object:null]; -(void)dosomethingelse{ //code here }; but if vcb on screen, or subsequent view controller (vcc, vcd, vce), , screen locked, respond dosomething method defined in vca. if don't have uiapplicationwillresignactivenotification in 1 of view controllers comes after vca, still respond dosomethign method defined in vca. is there way can make app...

sql - Insert a row, based on a fields value -

my data looks supplier qty -------- --- abc 3 bcd 1 cde 2 def 1 i expect result be: supplier qty -------- --- abc 3 }---> add additional row based on number of qty abc 3 } abc 3 } bcd 1 cde 2 }---> add additional row here cde 2 } def 1 looking sql select statement performs expected result. using sql server 2008 declare @d table (supplier varchar(32), quantity int); insert @d select 'abc',3 union select 'bcd',1 union select 'cde',2 union select 'def',1; x ( select top (10) rn = row_number() --since op stated max = 10 on (order [object_id]) sys.all_columns order [object_id] ) select d.supplier, d.quantity x cross join @d d x.rn <= d.quantity order d.supplier;

jsf 2 - How to make JSF inputText field upper case on blur -

i make jsf inputtext field upper case when user moves focus away field. best using f:ajax tag , have blur event trigger call server uppercasing, or best in javascript? reason not in javascript? best these sorts of things using ajax call server side? there indeed 2 ways salvage this. using javascript. <h:inputtext ... onblur="value=value.touppercase()" /> using jsf. <h:inputtext ... converter="touppercaseconverter"> <f:ajax event="blur" render="@this" /> </h:inputtext> @facesconverter("touppercaseconverter") public class touppercaseconverter implements converter { @override public object getasobject(facescontext context, uicomponent component, string submittedvalue) { return (submittedvalue != null) ? submittedvalue.touppercase() : null; } @override public string getasstring(facescontext context, uicomponent component, object modelvalue) { retur...

javascript - UIAutomation, UITableView inside UITableViewCell -

Image
i have horribly coded set of controllers unable refactor @ time. need bring them under automated testing, have run issue uiautomation tool. these controllers dynamically generated. there many ways decided best if made tableview containing cells each contain more tableviews, containing cells user see , interact with. a simple example of 1 of these controllers follows: i need press 1 of table view cells automagically. after struggling view hierarchy issues, managed logelementtree see of cells, correct accessibility identifiers. here result: now test can press 1 of buttons script... nope. can't seem drill down elements though logtree shows exist , visible. any ideas welcome. i'm not experienced javascript missing obvious. thanks! to answer own question , helpful engineer @ wwdc: target.frontmostapp().mainwindow().tableviews()[0].cells()[0].tableviews()[0].cells()["open"].tap();

c - Retrieving a multidimensional array from an array -

i'm going crazy pointers in c @ moment. have following 2 multi-dimensional arrays: int num0[5][3] = { {0,1,0}, {1,0,1}, {0,1,0}, {1,0,1}, {0,1,0} }; int num1[5][3] = { {1,1,1}, {1,0,1}, {0,1,1}, {0,1,0}, {1,0,0} }; these packed array such: int (*numbers[])[3] = { num0, num1 }; if do: printf( "result: %d\n", numbers[0][2][2] ); i expected result, in case result: 1. however, i'd assign numbers[0] variable. in modern programming language, you'd simple as: int newvar[5][3] = numbers[0]; printf( "result: %d\n", newvar[2][2] ); even though pointer knowledge limited, know isn't going work (and of course doesn't). life of me can't figure out correct syntax make work (and more importantly, understand why works). if out there can me out here i'd appreciate it! thanks you cannot assign arrays in c, use memcpy copy arrays: memcpy(newvar, numbers[0], sizeof newvar);

c# - How can I export data from Excel to png? -

i have set of excel spreadsheets multiple tabs contains each 1 table need export pictures in automated process (i have dozens of such files process). while "manually" select table, copy , paste them image in software, need industrialize process save time. what best approach using .net or builtin excel feature? thanks check question. programmatically (c#) convert excel image it looks they're doing need?

Facebook timeline wallpost image cropped after like -

i have facebook button on website, half year now. used og tags visualize like. tested thoroughly, showed on 'basic' wall, 'timeline' wall in news feed. but al of sudden, when likes page, image being cropped on timeline wall. original image 200px x 200px, because facebook developer tool mentioned these dimensions. i don't think image dimension issue, because 96x96 image being cropped. cropped mean top , bottom part of logo cut-off. now have old post (march 2012) image not cropped , post (few days ago) image cropped. difference between 2 url of image: one original image ok: https://fbexternal-a.akamaihd.net/safe_image.php?d=aqcahhvmadrtku6h&w=155&h=114&url=http%3a%2f%2fwww.poobies.fr%2fsite%2fimg%2fsocialmedia%2fsocialmedia_logo_fr.png and 1 image cropped: https://fbexternal-a.akamaihd.net/safe_image.php?d=aqcahhvmadrtku6h&w=155&h=114&url=http%3a%2f%2fwww.poobies.fr%2fsite%2fimg%2fsocialmedia%2fsocialmedia_logo_fr.png&cfs=1 ...

How do you create in-line commenting in SQL (with SQL-Server)? -

what if want make comment within single line in sql? can like(to temporarily rid of "targetname": select sessionsid, targetid, /* targetname,*/ fedsurveyname, supplierid,clientlk_responsestatusid bi_sessions (nolock) entrydate between '05-15-2012' , '05-16-2012' , supplierid = 336 hcirt erom on does version of sql allow such commenting(preferably mssql)? yes, mssql allows you've formatted it. work, too: select sessionsid , targetid --, targetname , fedsurveyname , supplierid , clientlk_responsestatusid bi_sessions (nolock) entrydate between '05-15-2012' , '05-16-2012' , supplierid = 336

validation - Jquery - Need help using Captcha -

can anynone tell me how write custom validator below captcha code? new jquery , havent wrote custom validator. need use custom validator along default validators. tried writing didnt work. please help challengefield = $("input#recaptcha_challenge_field").val(); responsefield = $("input#recaptcha_response_field").val(); var html = $.ajax({ type: "post", url: "recaptcharesponse.jsp", data: "recaptcha_challenge_field=" + challengefield + "&recaptcha_response_field=" + responsefield, async: false }).responsetext; //console.log( html ); $("#prtcnt").html(""); return true; } else { $("#prtcnt").html("<font color='#d31145'>please try again.the characters entered didn't match word verification</font>"); recaptcha.reload(); return false; } thanks challengefield = $("input#recaptcha_challe...

iphone - sorted my nsmutabledictionary -

what code sorted dictionary : { "a) saudi arabia" = ( "2012/06/04 huge sandstorm", "2011/03/30 huge sandstorm" ); "b) niger" = ( "2012/05/27 huge sandstorm" ); "c) ****** quatre" = ( "2011/03/30 7huge sandstorm on niger", "2011/03/30 8huge sandstorm on niger", ); } for uitableview ? with code titles header section in order not content: - (nsstring *)tableview:(uitableview *)tableview titleforheaderinsection:(nsinteger)section { nsarray *allkeys = [[states allkeys] sortedarrayusingselector:@selector(compare:)]; return [allkeys objectatindex:section]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = (uitableviewcell *) ...

iphone - iOS App window is not getting initialised -

so, after spending last week designing , planning out app, request has come in change slightly. in order make change, have have part of navigation controller can change views (currently using subviews won't work correctly). i have modified appdelegate.h , appdelegate.m have references new windows , views , black screen on launch. after using debugger, noticed window pointer in appdelegate still pointing @ memory address 0, after should have been initialised window connected using interface builder. clearly doing wrong, , have no idea go here. don't know information should providing. on safe side here appdelegate.h: #import <uikit/uikit.h> #import "initialisationcontroller.h" @interface appdelegate : nsobject <uiapplicationdelegate> @property (strong, nonatomic) iboutlet uiwindow *window; @property (strong, nonatomic) iboutlet uinavigationcontroller *navigationcontroller; @property (strong, nonatomic) iboutlet initialisationcontroller *initia...

excel - Why can't I define my workbook as an object? -

why can't define workbook either of these ways? (i have range bit in there quick test.) how fix it? this produces "compile error: type mismatch" sub setwbk() dim wbk workbook set wbk = "f:\quarterly reports\2012 reports\new reports\ _ master benchmark data sheet.xlsx" range("a2") = wbk.name end sub and creates "runtime error '91': object variable or block variable not set" sub setwbk() dim wbk workbook wbk = "f:\quarterly reports\2012 reports\new reports\ _ master benchmark data sheet.xlsx" range("a2") = wbk.name end sub what missing here? i've been hammering away @ vba month, gotten pretty sophisticated, has me stumped. i'm missing elemental. want define workbook don't have type out! it's sensible question. here's answer excel 2010 help: "the workbook object member of workbooks collection. workbooks collect...