Posts

Showing posts from April, 2010

capistrano3 - How to pass arguments to Capistrano 3 tasks in deploy.rb -

here tutorial how pass parameters capistrano 3 task. namespace :task desc 'execute specific cmd task' task :invoke, :command |task, args| on roles(:app) execute :cmd, args[:command] end end end can executed with: $ cap staging "task:invoke[arg]" how can use in deploy.rb? following not work. before :started, "task:invoke[arg]" not sure before/after , capistrano 3 can use rake syntax , call task within task: rake::task["mynamespace:mytask"].invoke(arg)

eclipse - Running multiple run configurations -

i have 2 run configurations , run first, then, after done, run second. can in eclipse in single step? and, if so, can assign keyboard shortcut? there similar stack overflow question , though 1 different think can use same solution. looks like, according the eclipse page launch groups , can define sequence of launches in group. drawback must install cdt feature, it's not c/c++ applications.

c# - Re-populating checkboxlist in Edit Mode from SQL comma-separated string is not selecting checkboxes -

i not able pre-populate checkboxlist3 in app. have retrieved string data database , passed array routine fails with: nullreferenceexception:object not set instance of object error @ line: listitem currentcheckbox = cb3.items.findbyvalue(items[i].tostring()); readmystring() method uses sqldatareader read , split string column sql table pass values example: "a, b, c" string array identify of 6 checkboxes should selected. code reference: [ http://mikesdotnetting.com/article/53/saving-a-user 's-checkboxlist-selection-and-re-populating-the-checkboxlist-from-saved-data] html code: <asp:gridview id="gridview1" runat="server" autogeneratecolumns="false" cellpadding="4" datakeynames="myid" datasourceid="sdsmytable1" forecolor="#333333" gridlines="none" onrowdeleted="gridview1_rowdeleted" onrowdeleting="gridview

Python HTTP Error - 403 Forbidden -

i trying code run in python 3.3. here code: import urllib.request html = urllib.request.urlopen("https://www.google.com/") html_code = html.read() html_code = str(html_code) sind = html_code.index("<cite class=]\"vurls\">") + len("<cite class=\"vurls\">") eind = html_code.index("</cite>") ser1resurl = html_code[sind:eind] print(ser1resurl) it gives 403 forbidden error because of urllib.request.open(google)

Ruby: Hash - Sorting/Adjusting Duplicate Values and Storing Back with Key? -

so having bit of issue here deciding tools use solve problem. rather complex problem best describe it. at moment have relationship of values gathered , stored in hash. hash way of doing things can changed else think better. used hash keep relationship important. so like: key -> value 1456 -> 1 1532 -> 50 1892 -> 2 1092 -> 5 1487 -> 10 5641 -> 5 1234 -> 2 1687 -> 1 my goal here take values, , adjust them there no duplicates, , place adjusted values in appropriate relationship key. not want duplicate values deleted, want them changed in way there no duplicates anymore. (duplicates in example above are: 1 , 2) as side note here summary of few important things keep in mind situation: the relationship between key-value pairs (must know value key) not having duplicate values you cannot delete key-value pair, change value. the order of values lowest highest important normally have no trouble sorting array of integers, in case relationship o

c++ - Optimal way to choose less or greater operator before loop -

i have 2 arrays comprising x,y vales y=f(x). provide function finds value of x corresponds either min or max sampled value of y. what efficient way select proper comparison operator before looping on values in arrays? for example, following: double findextremum(const double* x, const double* y, const unsigned int n, const bool ismin) { static std::less<double> lt; static std::greater<double> gt; std::binary_function<double,double,bool>& isbeyond = ismin ? lt : gt; double xm(*x), ym(*y); (unsigned int i=0; i<n; ++i, ++x, ++y) { if (isbeyond()(*y,ym)) { ym = *y; xm = *x; } } } unfortunately, base class std::binary_function not define virtual operator(). will compiler g++ 4.8 able optimize straight forward implementation? double findextremum(const double* x, const double* y, const unsigned int n, const bool ismin) { double xm(*x), ym(*y); (unsigned int

row - R: extract maximum value in vector under certain conditions -

i'm trying large data set denotes person's career history in firm. want see maximum number of years person worked manager , under condition person in sales category prior becoming boss (regardless of how many years prior was). data looks following: job2 dummy variable indicating whether person manager , cumu_job2 denotes cumulative years person in manager position (only sequential cumulation considered). id name year job job2 cumu_job2 1 jane 1980 worker 0 0 1 jane 1981 manager 1 1 1 jane 1982 sales 0 0 1 jane 1983 sales 0 0 1 jane 1984 manager 1 1 1 jane 1985 manager 1 2 1 jane 1986 boss 0 0 2 bob 1985 worker 0 0 2 bob 1986 sales 0 0 2 bob 1987 manager 1 1 2 bob 1988 manager 1 2 2 bob 1989 boss 0 0 by extracting maximum years person worked, under condition person had

javascript - JQuery change image src on mouseover not working in IE7 and 8 -

i have set of images want source change on mouseover. code works fine in except ie 7 , 8 - when hover on image changes broken image link. my code is: $(".socialicon").each(function() { $(this).find("img") .mouseover(function() { var src = $(this).attr("src").match(/[^\.]+/) + "hover.png"; $(this).attr("src", src); }) .mouseout(function() { var src = $(this).attr("src").replace("hover.png", ".png"); $(this).attr("src", src); }); }); would know if there have change have work in ie 7 , 8? you should debug on ie7&8 - value of $(this).attr("src") , src attribute has element after enter mouse on element? suppose, ie maybe returns absolute path image, " http://example.com/image.png " - in case regex not work. why not calling var src = $(this).attr("src").replace(&

Python - Pandas: select first observation per group -

i want adapt former sas code python using dataframe framework. in sas use type of code (assume columns sorted group_id group_id takes values 1 10 there multiple observations each group_id): data want;set have; group_id; if first.group_id c=1; else c=0; run; so goes on here select first observations each id , create new variable c takes value 1 , 0 others. dataset looks this: group_id c 1 1 1 0 1 0 2 1 2 0 2 0 3 1 3 0 3 0 how can in python using dataframe ? assume start group_id vector only. if you're using 0.13+ can use cumcount groupby method: in [11]: df out[11]: group_id 0 1 1 1 2 1 3 2 4 2 5 2 6 3 7 3 8 3 in [12]: df.groupby('group_id').cumcount() == 0 out[12]: 0 true 1 false 2 false 3 true 4 false 5 false 6 true 7 false 8 false dtype: bool you can force dtype int rathe

ios - loading upcoming events by comparing their dates with the calendar date -

i have found below code online comparing 2 dates (the date of calendar , date) modifying code compares calendar date date of event date here key each event within nsarray (json file) .. how use later nspredicate can load events components (difference between 2 dates in days) @ least more 1 day since im going have uibutton called future events when user click on it, future events should loaded .. appreciate , code examples since im new objective c , xcode. thanks. @implementation homeviewcontroller { nsarray *_events; } - (bool)issameday:(nsdate*)date { nscalendar* calendar = [nscalendar currentcalendar]; nsdate *currdate = [nsdate date]; //date = [_events objectatindex:date]; unsigned unitflags = nsyearcalendarunit | nsmonthcalendarunit | nsdaycalendarunit; nsdatecomponents* comp1 = [calendar components:unitflags fromdate:date]; nsdatecomponents* comp2 = [calendar components:unitflags fromdate:currdate]; nsdatecomponents *components = [calendar

unit testing - How do I use TestNG SkipException? -

how use testng throw new skipexception() effectively? have example? i tried throwing exception @ start of test method blows teardown, setup, methods, etc. , , has collateral damage causing few (not all) of subsequent tests skipped also, , shows bunch of garbage on testng html report. i use testng run unit tests , know how use option @test annotation disable test. test show "existent" on report without counting in net result. in other words, nice if there @test annotation option "skip" test. can mark tests ignored sortof without having test disappear list of tests. is "skipexception" required thrown in @beforexxx before @test ran? might explain wierdness seeing. yes, suspicion correct. throwing exception within @test doesn't work, , neither did throwing in @beforetest, while using parallel classes. if that, exception break test setup , testng report show exceptions within of related @configuration methods , may cause su

ANDROID/JAVA Newbie having problems with classes in separate files -

i have create simple app shows listview in turn shows contents of listarray . have added button when clicked, adds item listview . here's problem: after reading other people's code have noticed mainactivity file tends default file , classes , created in separate files. trying put arrayadapter , button , listarray code separate file.. make nicer! have ideas why when run app (it compiles fine/ no errors) listview no longer populates or adds item on button click. time! here's code: mainactivity.java package com.example.shoppingapp; import android.app.activity; import android.os.bundle; import android.view.menu; public class mainactivity extends activity { @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenui

php - Array increment in session -

array $item= "stackoverflow"; $price = "30.00"; $total += ($sum * $price); $cs1_array = array(); $cs1_array[] = array( 'item'=>array('item'=>$item, 'price'=>$price, 'quantity' => $sum), 'total' => $total ); $_session['session_inputs'] = $cs1_array; foreach loop in other page $cs1_array = $_session['session_inputs']; echo "<table>"; foreach ($cs1_array $item){ echo "<tr>"; foreach ($item $item2){ echo "<td>{$item2['item']}</td><td>{$item2['price']}</td><td>{$item2['quantity']}</td>"; } echo "<td>{$item['total']}</td>"; echo "</tr>"; } echo "</table>"; above the codes used display items in array display out 1 row of output, stackoverflow 30.00 2 60 what want whenever submit html form, add new row new valu

javascript - Laravel: Pass Div contents to Form Autocomplete -

i have used http://complete-ly.appspot.com/ create autocomplete text field in laravel form <div class="form-group"> <div id='genre' style='border:1px solid #999;'></div> <script> var auto = completely(document.getelementbyid('genre'), { fontsize : '14px', fontfamily : 'arial', color:'#933', }); auto.options = ['action','biography','drama']; auto.repaint(); settimeout(function() { auto.input.focus(); },0); </script> {{ form::label('genre', trans('main.genre')) }} {{ form::textarea('genre', input::old('genre'), array('class' => 'form-control', 'rows' => 2)) }} i pass contents div id='genre' form::textarea('genre') may submitted when form gets submitted. unsure how this. thanks help. assuming have jquery here (question tagged jquery), can use submit handler on fo

ios - .mov files into an NSArray -

i have put in method creates thumbnail image of video me - (uiimage *)loadimage:(nsstring *)image { // getting frame of video thumbnail nsstring *videopath = [[nsbundle mainbundle] pathforresource:image oftype:nil]; nsurl *vidurl = [[nsurl alloc] initfileurlwithpath:videopath]; avurlasset *asset = [[avurlasset alloc ] initwithurl:vidurl options:nil]; avassetimagegenerator *generate = [[avassetimagegenerator alloc] initwithasset:asset]; nserror *err = null; cmtime time = cmtimemake(1, 30); cgimageref thumbimg = [generate copycgimageattime:time actualtime:null error:&err]; return [[uiimage alloc] initwithcgimage:thumbimg]; } now have list of .mov files wish place array , place thumbnail images of each cells once cell has been touched go detailedviewcontroller , .mov start play automatically. my question how put .mov files array, , if 1 of parameters in method above need (nsarray *) right ? yes/no , me on making file play in detailedviewc

sql server - Alter Column: option to specify conversion function? -

i have column of type float contains phone numbers - i'm aware bad, want convert column float nvarchar(max), converting data appropriately not lose data. the conversion can apparently handled correctly using str function (suggested here ), i'm not sure how go changing column type , performing conversion without creating temporary column. don't want use temporary column because doing automatically bunch of times in future , don't want encounter performance impact page splits (suggested here ) in postgres can add "using" option alter column statement specifies how convert existing data. can't find tsql. there way can in place? postgres example: ...alter column <column> type <type> using <func>(<column>); rather use temporary column in table, use (temporary) column in temporary table. in short: create temp table pk of table + column want change (in correct data type, of course) select data temp table using conv

android - Why ImageView in XML and Java measurement different? -

i have following xml imageview: <imageview android:id="@+id/iv" android:layout_width="12dp" android:layout_height="12dp" android:src="@drawable/crossy" android:scaletype="fitxy" /> when run following code: iv = (imageview) findviewbyid(r.id.iv); log.i("iv wxh", ""+iv.getwidth() + " " + iv.getheight()); logcat shows following: 02-05 23:56:04.116: i/iv wxh(10211): 24 24 how ensure height , width stays same in code in xml? the dp in xml file indicates measurement unit of "density independent pixels", while value logged java code telling measurement in actual pixels. px = dp * (dpi / 160) so in case, have 320 dpi screen, every 1 density independent pixels 2 physical pixels. if want measurement in physical pixels, replace dp px in xml file. however, realize on device lower dpi, imageview take larger portion of screen

spring batch - HibernateCursorItemReader with Hibernate Detached criteria -

how use hibernate detached criteria "hibernatecursoritemreader" of spring batch? a solution following: create custom hibernatedetachedcriteriaitemreader<> extends abstractitemcountingitemstreamitemreader<> add property criteria criteria , inject before use rewrite do*() functions manage resultset lifecycle or extends hibernatecursoritemreader , override doopen() let working in dual-mode (normal,with detached criteria)

date - Why my website landing page is not caching -

i have landing page http://www.example.com/abc.html whenever check caching date of landing page show home page http://www.example.com/ caching date, want landing page should cached also.

Lat-Long processing in mongoDB -

i using mongodb storing tweets of twitter using twitter apis , php code. how location of tweets stored in mongodb respect lattitude , longitude? according twitter's documentation on tweet fields , coordinates field nullable geojson object. obviously, not tweets have coordinate data, you'll have account possibility. conveniently, geojson format mongodb 2.4+ uses 2dsphere geospatial indexes . if you're storing tweet comes twitter, should able create such index on coordinates field , have mongodb track accordingly. if coordinates field null or not geojson object whatever reason, delete field document before storage, since mongodb complain if attempt index invalid geospatial value. in earlier versions of mongodb, 2d indexes used, values either tuple of longitude , latitude values (in order), or object longitude , latitude properties (in order). recommend using newer 2dsphere indexes if possible. a helpful chart of of mongodb's geospatial query opera

c# - Convert HTML5 chart to PDF -

in project have planned use charts . have gone through various number of resources https://google-developers.appspot.com/chart/interactive/docs/gallery/columnchart http://www.jchartfx.com/demo/27182674-0690-e211-84a5-0019b9e6b500 my problem have conver entire html page pdf ehen user click on 1 button @ bottom of page. i have tried itextsharp , few other.they using parser , saw few html tags not supported in itextsharp if case how svg tags . this case in of third party tool how can convert page content(html + charts + images) pdf.if did kindly show me link or path achieve this. note : charts planned go html5 it not free can try asppdf

How to add two colors in progress bar in android? -

Image
i trying add 2 colors in progress bar. in project there button called "increase". when press increase , holds progress bar increases yellow color, trying when release "increase" button progress bar should add small bar green color. my problem when release button whole progress bar getting filled green color instead of yellow color till hold button , small bar @ releasing button. i attaching screenshot. below code snippet if (i == 0) { progressbar1.setprogress(progressbar1.getprogress() + 10); progressbar1.setprogressdrawable(getresources().getdrawable( r.drawable.progress_layer)); = 1; } else { progressbar1.setprogress(progressbar1.getprogress() + 1); progressbar1.setprogressdrawable(getresources().getdrawable( r.drawable.progress_layer_normal)); } here 0 default when tap , holds button progress bar increase yellow color. when release button becomes 1 , green color bar should added progress bar. whole progress bar bec

sql - table primary key for concurrent users -

i making first website database. lets have table called "items". users may send items stored in database. however, don't know type of primary key items table should use. i thought using integer primary key. every time user enters item, find current maximum value in table, , increment 1 new value. method happens if 2 users enter items @ same time table? items possibly end using same maximum value , end having same primary key resulting in error? another way thought using character primary key based on userid , date entered in users table. create primary key out of "userid - entrydate". way seemed "unclean" me. i wondering there standard way of handling primary keys in databases of web applications may have multiple users entering information @ same time? sorry new web dev , databases. information, using node.js server, , postgresql databse. there's data type serial auto increment , used primary keys. serial data type document

AngularJS: remove/hide a parent but keep the child -

in angularjs, how hide/remove element without hiding/removing it's children. <div class="hide-or-remove-me"> <p>leave me here.</p> </div> is there built in angular directive? <div class="hide-or-remove-me" ng-click="show = show!" ng-show="show"> <p>leave me here.</p> </div> <p ng-click="show = show!" ng-show="!show">leave me here.</p> it's variant.

scheme - Returning number of times atoms in one list appear in another list -

i working through introduction scheme course , have been stuck on particular problem number of hours. requirement write function takes 2 lists of atoms, lat1 , lat2, , returns total number of times atoms in lat1 occur in lat2. for example (occurn '(d e f) '(a x b e d g h f e)) return 4 so far code have is (define occurn (lambda (lat1 lat2) (cond ((null? lat1) 0) ((null? lat2) 0) (else (cond ((eq? (car lat1) (car lat2)) (add1 (occurn lat1 (cdr lat2)))) (else (occurn lat1 (cdr lat2)))))))) this works going through first element of lat1, checking see if every element of lat2 equal , adding 1 count if are, otherwise moving on next element. problem i'm having getting code start on next value of lat1 , following values of lat1 while retaining count , going through list of lat2 , checking equivalence other values of lat1 other first, further adding

css - content with absolute position not showing in all browsers -

i'm building 1 site wordpress+gantry framework, responsive layout selected, , have in left side of screen 1 picture above background. left picture ( kind of vertical sidebar withouth other content) positioned absolutely next code: div.imgleft{ content: url('http://coszminart.ro/wp-content/uploads/2014/02/laterala.png'); position: absolute; margin-left: 0px; margin-top: -1px; max-height: 1020px; height: 100%; max-width: 570px; background-size: cover; z-index: 1000 !important; } the div.imgleft inserted above header, in template index.php problem: left image not showing in iexplore 10, 11, latest mozilla, in chrome , android phone. if verify chrome/firefox inspect tools, css code loaded ok. i've read absolute positioning cross browsers compatible, why not working, wrong code? ![enter image description here][1] thanks help, sorry bad english. the content property used :before , :after pseudo-elements, insert generated content. so use backgrou

How to substract Time in SQL Server 2008 R2 -

Image
i want select time range database time range. eg : if employee has starttime 12:00 range 11:45 12:15 need calculate able add not able subtract. my code select datediff(minute, 15, starttime) employees employeeid = 18 select dateadd(minute, 15, starttime) employees employeeid = 18 select employeeid, starttime, returntime employees employeeid = 18 result but want is: instead of -20868 - 11:57:12:0000000 like happens when add 12:12:12 = 12:27:12 is looking for? select dateadd(minute,-15,starttime) employees employeeid = 18

excel - Select range from multiple sheet and export to a single pdf -

i read solution combine sheets 1 pdf post: thisworkbook.sheets(array("sheet1", "sheet2")).select activesheet.exportasfixedformat type:=xltypepdf, filename:= _ "c:\tempo.pdf", quality:= xlqualitystandard, includedocproperties:=true, _ ignoreprintareas:=false, openafterpublish:=true however me prints out whole sheet. how select ranges print each sheet when combining multiple sheets. i can if export each sheet single pdf each not sure how if combine them. many in advance this possible creating sheets array , navigating through each sheet select desired ranges. once done use selection.exportasfixedformat type:=xltypepdf generate pdf sub test() sample code: sub test() sheets(array("a", "b")).select sheets("a").activate range("a1:j32").select sheets("b").activate range("a6:j37").select selection.exportasfixedformat type:=xltypepdf, _ filename:=activeworkbook.path &

Messaging System with PHP/MySQL -

hi i'm trying make messaging system php , mysql. the mysql table simple: id sender receiver text timestamp i'm trying make messaging facebook/twitter list in 'conversations' , last message in conversation viewed. this have atm: (select * messages receiver = 13 or sender = 13 group receiver,sender order id asc) order id asc select messages.* messages, (select max(id) lastid messages receiver = 13 or sender = 13 group concat(least(receiver,sender),'.',greatest(receiver,sender))) conversations id = conversations.lastid order timestamp desc what need unique conversation id between chat-partners. i've simulated subquery, hope helps

JavaScript not firing in C# MVC4 -

i have following code in view : <script type="text/javascript"> function oncancelclick(e) { var jobid = e; var flag = confirm('you cancel job : ' + jobid + '. sure want cancel job?'); if (flag) { $.ajax({ url: '/job/canceljob', type: 'post', data: { jobid: jobid }, datatype: 'html', success: function (result) { alert('job ' + jobid + ' cancelled.'); document.location = "@url.action("index", "job")"; }, error: function () { alert('something went wrong. check log more information.'); } }); } return false; } </script> in view have : <input type="submit" id="cancelbutton" value="cancel" onclick="javascript: return oncancelclick(@model.id);" /> in controller

android - How I receive sensors data in batching mode? -

i didn't program sensors apps yet, read batching (in kitkat) , wonder how should data. i found in sensors header file (line 1083): all events since previous batch recorded , returned all @ once but according api have 1 x, y, z receive data (and not list or array). from api: /** * sensor event data */ typedef struct { union { float v[3]; struct { float x; float y; float z; }; struct { float azimuth; float pitch; float roll; }; }; int8_t status; uint8_t reserved[3]; } sensors_vec_t; so didn't understand if should receive data @ once or it's refers hw layer , i, in sw layer should receive data 1 one (by way events) – if yes latency, , delay between events ? thanks after reading batch section again think hava answer: sensors data in batching mode saves in fw fifo. it's meaning sensors samples done. left transfer d

Mongoose populates field with null -

i have mongoose schema: mongoose.schema({ state: { type: { action: 'string' , user: {type: mongoose.schema.types.objectid, ref: 'user'}, at: 'date' }, default: {} }, log: [{ action: 'string' , user: {type: mongoose.schema.types.objectid, ref: 'user'}, at: 'date' }] }) trying populate it model.findbyid(id).populate('state.user').populate('log.user').exec(cb) in query result "user" field of log items populated correctly and "state.user" null . can problem? for simple embedded objects state , define structure without using type : mongoose.schema({ state: { action: 'string' , user: {type: mongoose.schema.types.objectid, ref: 'user'}, at: 'date' }, log: [{ action: 'string' ,

c# - Lidgren - InvalidOperationException was unhandled -

argh! i'm back, guys! hate having bother others issues, i've been working on 3 days now. using chat application example, molded game. client , server connect appropriately but... client having trouble. :/ public static void appendtext(richtextbox box, string line) { if (box == null || box.isdisposed) return; //try //{ box.appendtext(line + environment.newline); scrollrichtextbox(box); //} //catch //{ // program.debug.print("something went wrong."); //} } the appendtext line keeps throwing exception (invalidoperationexception). commented out try-catch, hoping compiler give me more advice on what's wrong , maybe how fix it, no help. in examples, can run code without getting error. don't know went wrong here. oh, appendtext called by... public static void gotmessage(object peer) { netincomingmessage im; while (

osx - Running prolog on a mac -

i having hardest trouble trying run swi-prolog on mac. when type: /opt/bin/local/swipl i error saying: /opt/local/bin/swipl: no such file or directory when type "swipl" get: swipl: command not found i've tried on both terminal , xquartz. i've gone into /applications/swi-prolog.app/contents/macos to see if anything, prolog "welcome" text never appears. quite possibly closest ever got work when typed "pl" when inside macos folder. left terminal doing nothing , had use crtl-d. is there i'm doing wrong? did install incorrectly? i'm running on mac os x 10.9.1 mavericks. placed swi-prolog application application folder , downloaded xquartz per recommendation website. if have homebrew installed, can run brew install swi-prolog from terminal, build source in 1 command. you can run interpreter using swipl .

angularjs - Catching access to $scope properties -

is possible catch following: if have template <div ng-controller="somecontroller"> {{notthere}} </div> and notthere not defined in controllers $scope , can have callback fired handle this? like: $scope.$catch(function(name) { // name === 'notthere' return 'someval'; } br, daniel well, can do <div ng-controller="somecontroller"> {{notthere || 'someval'}} </div> but i'm not sure if meets requirements

message queue - How can I Use RabbitMQ between two application while I can't change one of them? -

i have existing system consisting of 2 nodes, client/server model. want exchange messages between them using rabbitmq. i.e. client send requests rabbitmq , server listen queue indefinitely, consume messages arrives , act upon it. i can change server needed, problem is, cannot change client's behavior. how can send response client? the client node understands http request/response, shall after configure other application server rabbitmq instead of app directly. you can use rpc model or internal convention, storing result in database (or cache) known id , polling storage result in cycle

r - Extract sample data from VCF files -

i have large variant call format (vcf) file (> 4gb) has data several samples. i have browsed google, stackoverflow tried variantannotation package in r somehow extract data particular sample, have not found information on how in r. did try that, or maybe knows of package enable this? in variantannotation use scanvcfparam specify data you'd extract. using sample vcf file included package library(variantannotation) vcffile = system.file(package="variantannotation", "extdata", "chr22.vcf.gz") discover information file scanvcfheader(vcffile) ## class: vcfheader ## samples(5): hg00096 hg00097 hg00099 hg00100 hg00101 ## meta(1): fileformat ## fixed(0): ## info(22): ldaf avgpost ... vt snpsource ## geno(3): gt ds gl formulate request "ldaf", "avgpost" info fields, "gt" genotype field samples "hg00097", "hg00101" variants on chromosome 22 between coordinates 50300000, 50400000 p

c++ - gcc 4.7 fails to use pointer template parameter sometimes -

complete (not)working example: struct s { int i; }; template<const s* _arr> class struct_array { public: static constexpr auto arr = _arr[0]; // works template<int > struct inner // line 9, without struct, works { }; }; constexpr const s s_objs[] = {{ 42 }}; int main() { struct_array<s_objs> t_obj; return 0; } compiled this: g++ -std=c++11 -wall constexpr.cpp -o constexpr i running program ideone's gcc 4.8.1, 4.7.3 prints me: constexpr.cpp: in instantiation of ‘class struct_array<((const s*)(& s_objs))>’: constexpr.cpp:18:30: required here constexpr.cpp:9:16: error: lvalue required unary ‘&’ operand constexpr.cpp:9:16: error: not convert template argument ‘(const s*)(& s_objs)’ ‘const s*’ the last 2 lines repeated 3 times. what's reason, , there workaround use code on gcc 4.7.3? this seems compiler bug me. i tried example on gcc 4.1.2 ( codepad ), , have explicitely note variable

android - List all the apps in the view -

Image
i trying disable background data apps seen in settings->data usage through uiautomator able data usage page, bt not able figure out how apps , click 1 one. can go inside , disable background data? you can use 'uiautomatorviewer' tool , view text/description/resource id of apps being displayed there. to use uiautomatorviewer tool : [1] connect device. [2] open command prompt , type 'uiautomatorviewer'. [3] open particular screen of elements want view (in case - data usage page). [3] press green 'device screenshot' button next file open in top left.

java - Correct way of using CRUD in JSF -

i need advice on few design principles regarding crud operations in jsf project. a simple example: i have basic screen form submitted. in bean declare database connection in method , string object populate script. modify string data have been submitted in form. way taught it, i'm suspecting it's not based on solid principles. so decided start using prepared statements. seems bit better, still not perfect in mind. my question is: instead of writing new script each crud method, better perhaps create stored procedures instead, in mind looks neater code , perhaps has better readability. or there entirely different way of doing things? concerns have fragile oltp database. your jsf,s should redirect servlet calls service method, write business logic , call data access object execute required sql query. u should never use bean database connection... should use datasource data base connection. , yes simple preparedstatement enough do. should convert strings in se

php - Magento cannot upload category images -

i have installed magento 1.8.1 , runs smoothly using zonda magento theme. able upload kinds of images in kinds of places (products, favicons, placeholders etc). doesn't work category images, thumbnail , image. anyone has idea? seems have problem either no image upload works or uploads work. please me out! :)

jsf 2 - JSF inputText's value reappears after clearing it -

i have validate h:inputtext has value. there i'm using required="true" on component. job , works, strange happens. when leave blank, required="true" happens. when type text in inputtext, required="true" not happen. when i, after adding text, remove text required="true" happens, entered value reappears in inputtext. i don't have got idea be. note when i'm saying "required="true"" happens, mean border of inputtext gets red (see code). here code: <h:form id="generateletterform"> <h:panelgroup id="submitterpanel"> <h:panelgrid styleclass="rsplitpanel1" columns="1"> <e:inputtext entitybb="#{entitybb}" type="#{type}" property="submitterfirstname" /> <e:inputtext entitybb="#{entitybb}" type="#{type}" property="submitterlas

java - ConcurrentHashMap operations -

following lines java docs of concurrenthashmap this class obeys same functional specification hashtable, , includes versions of methods corresponding each method of hashtable. however, though operations thread-safe, retrieval operations not entail locking, , there not support locking entire table in way prevents access. what meaning of statement though operations thread-safe from above paragraph? can explain example of put() or get() methods? the concurrenthashmap allows concurrent modification of map several threads without need block them. collections.synchronizedmap(map) creates blocking map degrade performance, albeit ensure consistency (if used properly). use second option if need ensure data consistency, , each thread needs have up-to-date view of map. use first if performance critical, , each thread inserts data map, reads happening less frequently.

android - Close Activity using Fragment -

introduction i have activitya starts fragment when click button. using intent can't start fragment, i've created second activity, let's call activityb acts bridge between activitya , fragment . the structure : activitya --> activityb --> fragment functionality the functionality activitya , start fragment , request data, , bring data activitya . for use startactivityforresult() in activitya call activityb . in activityb start fragment way: fragment fragment = new fragment(); fragmenttransaction ft = getsupportfragmentmanager().begintransaction(); ft.add(android.r.id.content, fragment).commit(); when finish must on fragment , use setresult() send data activtya . problem the thing have started activityb initialize fragment , when returning data fragment activitya , activityb still 1 opened, , activitya remains on background. this makes me not able process requsted data, activitya continues on background. so, need know how close act

php - not able to post the form because of .htaccess -

note:this may possible duplicate question. but .htaccess bit different , problem unable post next page.... ie: form action="another.php" method="post"> or form action="another" method="post"> not working. can 1 kindly tell me change has made . .htaccess page shown below rewriteengine on #submydomain , folders rewritecond %{http_host} !^jobs\.mydomain.in [nc] rewriterule ^(.*)$ http://jobs.mydomain.in/$1 [r=301,l] #remove .php , ad slash rewritecond %{request_filename} !-d rewriterule ^([^/]+)/$ http://mydomain.in/jobs/$1 [r=301,l] # redirect external .php requests extensionless url rewritecond %{the_request} ^(.+)\.php([#?][^\ ]*)?\ http/ rewriterule ^(.+)\.php$ http://mydomain.in/jobs/$1 [r=301,l] # resolve .php file extensionless php urls rewriterule ^([^/.]+)$ $1.php [l] if you're hiding .php extension shouldn't keep in form action. have <form> this: form action="another" method=&

Qt application: Failed to load platform plugin “windows" on Windows 8 but no issues on Windows 7 -

a lot of similar questions has been posted, noone has worked me. on windows 7, able run program standalone appropriate dll's in executables folder. at windows 8.1, not able run project either qt creator nor standalone. getting error this application failed start because not find or load qt platform plugin "windows". available platform plugins are: minimal, offscreen. i put platform dll's in ./platforms , ./ suggested here , here amongst other places. still, application won't launch , gives me same error. i've included dll's c:\qt\qt5.2.0-mingw\5.2.0\mingw48_32\plugins\platforms directory. how can solve problem? for me, installed qt 5.2.0 , msvc 2012, following dll's needed execute app (release version) on windows 7 , 8.1 : -example.exe //my application -icudt51.dll -icuin51.dll -icuuc51.dll -libegl.dll -libglesv2.dll -qt5core.dll -qt5gui.dll -qt5widgets.dll -platforms // folder --qminimal.dll --qoffscreen.dll --q

android - Version 9 is not served to any device configuration: all devices that might receive version 9 would receive version 10 -

i published new version app version 8. published successfully. realized there fatal bug, corrected , tried publish version 9. however, saved draft , cannot publish it. tried delete draft, cannot done. deactivated version 8 (buggy one) , uploaded new one, saved draft. so, couldn't publish new 1 on version 8. people still downloading buggy version , not anything. can please help? here picture http://postimg.org/image/iokyc9js7/ did try searching error first? seems answered here: what google play apk publish error message mean?

javascript - GameDevelopment Best Practise: Scaling distances of actions and objects -

i started develope web-based game on canvas element in addition create http://www.createjs.com/ , user has actions jump on obstacles , collect goddies , on. i want publish on many devices smartphones, tablets, game-consoles , browsers-based. now wonder best solution make responsive possible regarding different screen-resolutions. my first intention define basic height 1000px , scale objects "your game character" , action-properties "jump-height" depending on screen-height. i feel little overload calculate , scale lot "just" screen-optimizing. what think now.. maybe set heights etc. , calculate in percent. don´t know if run in problems, maybe when going on colission-detection , on. does know best practises on topic or can give me advice? i'm perhaps little of mark here, writing lines. twiddling canvas bit myself these days. read in question depends on code. loosely take approach this: detect available space. pre-animati

javascript - Underscore.js : findWhere with nested property value -

how go filtering below: [{ "id": 100, "title": "tlt1", "tax": [{ "name": "tax1", "id": 15 }, { "name": "tax1", "id": 17 }] }, { "id": 101, "title": "tlt2", "tax": [{ "name": "tax2", "id": 16 }] }, { "id": 102, "title": "tlt3", "tax": [{ "name": "tax3", "id": 17 }, { "name": "tax3", "id": 18 }] }] to tax.id 17 , per below: [ { "id": 100, "title": "tlt1", "tax": [ { "name": "tax1", "id": 15 }, { &quo

javascript - How to emit event with Socket.io and Node.js? -

i find hard emit event because don't know creating event/emitting event socket io. here problem on case "/publish": var app = http.createserver(function (req, res) { if (req.method == "options") { res.header('access-control-allow-origin', '*:*'); res.send(200); } else { var u = url.parse(req.url,true), body = ''; req.on('data',function(chunk) { body += chunk; }); req.on('end',function() { if(body) { var data =json.parse(body); if(data._app_secret && data._app_secret == 'nonexistent') { switch(u.pathname) { case '/generateusersecret' : findtokenbyuser(req.headers.host+'_'+data.user_id,function(reply) { if(reply) { jsonresp

Google Spreadsheet / gscript: Chart with custom data -

is possible create chart in spreadsheet data not present in sheet (calculated data)? so instead of chartbuilder.addrange(sheet.getrange("a2:a5")) i want (pseudo code) chartbuilder.addrange({0,1,2,8,15,35}) i guess need create range custom data, couldn't find solution in documentation. i think way if used charts , ui , showed through spreadsheet so... var data = charts.newdatatable() .addcolumn(charts.columntype.string, "month") .addcolumn(charts.columntype.number, "in store") .addcolumn(charts.columntype.number, "online") .addrow(["january", 10, 1]) .addrow(["february", 12, 1]) .addrow(["march", 20, 2]) .addrow(["april", 25, 3]) .addrow(["may", 30, 4]) .build(); var chart = charts.newareachart() .setdatatable(data) .setstacked() .setrange(0, 40) .settitle("sales per month") .build(); var uiapp = uiapp.createapplicat

php - Google static map radius to zoom -

i'm developing web service in php gets latitude, longitude , radius in kilometers , generate google static map . also display points database in radius. my question how can covert radius in google's zoom parameter ensure points visible on map? something like: http://maps.googleapis.com/maps/api/staticmap?center=new+york,ny&[*this parameter*zoom=13]&size=600x300&markers....... as stated @ google maps documentation : because basic mercator google maps tile 256 x 256 pixels. note every zoom level, map has 2 n tiles. meaning @ zoomlevel 2, pixels in direction of map = 256 * 2² = 1024px. taking account earth has perimeter of ~40,000 kilometers, in zoom 0, every pixel ~= 40,000 km/256 = 156.25 km @ zoom 9, pixels 131072: 1px = 40,000 km / 131072 = 0.305 km ... , on. if image 640 x 640 px,and using zoom 9, means cover ~ 640 * 0.305 ~= 195km. radius approx 100km. everytime zoom++, radius half. if use zoom 15 (1px = 0.00478km) ima

ruby on rails - iteration E3 | The action 'destroy' could not be found for CartsController -

hello all i'm studying agile web development rails 4 currently. here's clean cart (iteration e3). 1.to add button_to in views/cart/show.html.erb <%= button_to 'empty cart', @cart, method: :delete, data: { confirm: 'are sure?' } %> 2.to add method destroy in controllers/carts_controller.rb def destroy @cart.destroy if @cart.id == session[:cart_id] session[:cart_id] = nil respond_to |format| format.html { redirect_to store_url, notice: 'your cart empty' } format.json { head :no_content } end end 3.when click on empty cart button, got error message "the action 'destroy' not found cartscontroller", have checked these code lot times. wondering if there wrong else. would please tell me how fix this? routes.rb depot::application.routes.draw resources :line_items resources :carts "store/index" resources :products root 'store#index', as: 'store' end 5 errors rake