Posts

Showing posts from June, 2013

ruby - Excluding one list of items from another -

i have yml file looks this: level 1: seattle: name: "rick" id: "95155" time: "2:00 pm" car: "hyundai" denver: name: "arnold" id: "82594" time: "2:00 pm" car: "mitsubishi" level 2: san antonio: name: "james" id: "96231" time: "2:00 pm" car: "honda" minneapolis: name: "ron" id: "73122" time: "2:00 pm" car: "dodge i need read id values array processing, remove them array. ways go this? you can read id values array processing in below way : require 'yaml' yml = <<-_end_ --- level1: seattle: name: "rick" id: "95155" time: "2:00 pm" car: "hyundai" denver: name: "arnold" id: "82594" time: "2:00 pm" car: "mitsubishi" level 2: san antoni

hash - Sorting two hashes into one in Python -

i have 2 hash fp['netc'] containing cells connected specific net example: 'net8': ['cell24', 'cell42'], 'net19': ['cell11', 'cell16', 'cell23', 'cell25', 'cell32', 'cell38'] and fp['celld_nm'] containing x1,x0 coordinate each cell example: {'cell4': {'y1': 2.164, 'y0': 1.492, 'x0': 2.296, 'x1': 2.576}, 'cell9': {'y1': 1.895, 'y0': 1.223, 'x0': 9.419, 'x1': 9.99} i need create new hash (or list) give x0 , x1 each cell in spesific net. instance: net8: cell24 {xo,x1} cell42 {xo,x1} net 18: cell11 {xo,x1} ... here code l1={} l0={} net in fp['netc']: cell in fp['netc'][net]: x1=fp['celld_nm'][cell]['x1'] x0=fp['celld_nm'][cell]['x0'] l1[net]=x1 l0[net]=x0 print l1 print l0

Is it possible to change Java syntax within a project? -

is there way define custom syntax given java project? for example, 1 thing able create short-hand syntax standard getters , setters (similar .net's "{ get; set; }"). i've been searching, i've come across writing dsl might able accomplish this, looking them, don't know suit need. so there way define syntactical elements this? since others have established changing syntax not possible, might interested in project lombok . from getting started guide: private boolean employed = true; private string name; public boolean isemployed() { return employed; } public void setemployed(final boolean employed) { this.employed = employed; } protected void setname(final string name) { this.name = name; } becomes @getter @setter private boolean employed = true; @setter(accesslevel.protected) private string name;

c# - Possible to automatically add elements to collection? -

i new @ entity framework (and stack overflow - first question!): right got following entities in db: blog: [key] [databasegeneratedattribute(databasegeneratedoption.identity)] public int id { get; set; } public virtual ilist<post> posts { get; set; } post: [key] [databasegeneratedattribute(databasegeneratedoption.identity)] public int id { get; set; } public int blogid { get; set; } [required] [foreignkey("blogid")] public virtual blog blog { get; set; } currently whenever add post manually add collection of corresponding blog. wonder if it's possible automatically add them collection add posts referencing corresponding blog? you use entity class create entity rather new , ie: posts.add(post.create()); instead of posts.add(new blog()); but if must pass arguments, need do post p = post.create(); p.blogid = 1234; p.somestring = "test"; p.somedate = datetme.now; posts.add(p); and always, call db.savechanges();

sed output blank in bash script -

i have file consists of following hundred lines in addition other data (abc-wxyz1/2222 1234) 1234 random number different 100 lines. want substitute lines with (abc-wxyz1/2222 *) i using following code it cat input.txt | \ sed -i -e 's/\(abc\-wxyz1\/2222\ [0-9]\+\)/\(abc\-wxyz1\/2222\ \*\)/g' > output.txt i output.txt blank have no clue why. doing correctly ? if you're going use flag -i, --in place , don't have redirect output. substitutions performed in place , expected. yet, can simplify expression, doing: sed -i -e 's/abc\-wxyz1\/2222\ \([0-9]\+\)/*/g' input.txt

jquery - Determine user location then redirect to different home page -

i want able change image depending on location user has viewed site from? or alternatively navigate them page. ideally pick using jquery, i'm not 100% sure if effective. for example, want swap in different image if user visiting site london. can region specific? thanks gillian just got work of beda0805 here's solution <!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>location</title> <script type='text/javascript' src='//code.jquery.com/jquery-1.9.1.js'></script> <script type='text/javascript'>//<![cdata[ $(window).load(function(){ $.get("http://ipinfo.io", function (response) { if(response.region == 'london'){ $("#address").append("<p>your in london</p>"); } if(response.region != 'london'){ $("#add

sql - Select tuple member from a list with condition in python/pyodbc -

i have list this a =[ ( 1, 10, 3), (1, 2, 3), (1, 11, 3), (2, 6, 4), (2, 5, 4) ] i need make list like b = [ ( 1, 2, 3), (2, 5, 4) ] the condition if first , third values of member of equal member select member having smallest 2nd value. in example member of 5 , of 2 group having first , third members equal. in case numbers might high. not figure out how python 2.7. its helpful if query ok pyodbc considering each member of record , member of each tuple column. an alternate: from sys import maxint =[ ( 1, 10, 3), (1, 2, 3), (1, 11, 3), (2, 6, 4), (2, 5, 4) ] results = {} x, y, z in a: key = (x, z) results[key] = min(y, results.get(key, maxint)) results = [(x, y, z) (x, z), y in results.items()] print results

sql - how to write a mysql trigger to log history -

i have never written trigger before , following tutorial http://net.tutsplus.com/tutorials/databases/introduction-to-mysql-triggers/ confused something. i trying write trigger pulls data table after insert , logs in history table. here's code far: delimiter $$ create trigger trackhistory after insert on test.inventory each row begin *** end; delimiter ; i need add insert history... query, don't understand how reference fields on correct row of 'inventory' table. answer same , update or delete? edit: have tried follow advice of answer below, didn't work got error 1363 - there no old row in on insert trigger. whats wrong? delimiter $$ create trigger trackinserthistory after insert on inventory each row begin insert history values (new.id, old.quantity, new.quantity, timestamp); end$$ create trigger trackstockhistory after update on inventory each row begin insert history values (new.id, old.quantity, new.quantity, timestamp); end$$

python - Subsequent tabs being closed in pyqt -

i trying close tab when users presses close tab button. code should that: self.tab_widget.addtab(text, tabname) self.tab_widget.settabsclosable(1) self.tab_widget.tabcloserequested.connect(self.tab_widget.removetab) it works, when close tab before other tab(s) closes out of them after it, , not sure why. help? oh... figured out why happening. had code removes tabs code creates them , guess doing multiple connects getting rid of more 1 tab.

javascript - I want to select the main div -

my , down arrows in div couple of divs down , image. need move div class name handle, when click arrows. if put handle in selector code works fine, don't want click handle want able click images can't seem selector go high enough. <script> $(document).ready(function(){ $('.moveup2').click(function(){ var diveitem = $(this).parent(); if (diveitem.prev().is('div')) { diveitem.insertbefore(diveitem.prev()) } }); $('.movedown2').click(function(){ var diveitem = $(this).parent(); if (diveitem.next().is('div')) { diveitem.insertafter(diveitem.next()) } }) }); </script> <div style="background-color: #dceaf4;" class="handle"> <div style="float:left;"><b class="order_interaction" id="interactionorder">{{order}}.</b>&#160;</div>

JSON not working in php script -

i'm not getting json_encode work in php file. instance, tried example got php.net <?php $arr = array('a' => 1, 'b' => 2, 'c' => 3, 'd' => 4, 'e' => 5); echo json_encode($arr); ?> but nothing works. if remove echo statement, php works, means php isn't recognizing json_encode code. i'm using php 5.4.16. sum up, i'm using xampp 1.8.2. help please? it sounds there fatal error somewhere else in script. make sure display_errors set on in php.ini.

C#: Close and Open two forms from a separate form -

i have 3 forms. how can make 1 form shown .show() , other hidden .hide() separate form? this part of code private void buttonyes_click(object sender, eventargs e) { loggedin loggedinform = new loggedin(); loggedinform.hide(); // hides form in background mainform mainform = new mainform(); mainform.show(); // show first form this.hide(); // hides current form } one problem, loggedin form not hide itself. looks of it skips , goes mainform.show(); is bug or need else? the line loggedin loggedinform = new loggedin() going create new instance of login window. might useful if, say, intended show 5 "login" windows onscreen @ once. think want retrieve reference login window showing, , hide that; so, avoid creating new one. properly passing references existing objects around program kind of structural problem, , 1 ran quite bit in programming days. quick, unclean, , not-recommended way declare instances of sin

FIX message rate monitoring -

i newby site, have limited scripting skills, able pick way through scripts without problem. write script monitor fix messages coming through number of log files in real time; segregated account & symbol. rate needs calculated on per-minute basis. @ moment not sure whether minute minute calculation or rolling 60 seconds calculation. haven't written yet, looking see if possible , if can give me pointers best scripting language employ. thanks here brutal solution in gawk. if there 35=d on line use regexes split interesting parts out, timestamp (without seconds entries fall equivalence classes on minute level), , 2 tags , dump 'multidimensional' array, meaning use these indices of array. once went through messages scan array, in no particular order, , dump counters. terribly ugly..the 3 'match' functions should written one, , perhaps output sorted, that's trivial in shell 'sort'. #!/usr/bin/awk -f #out_vec__pwkbvsp-le2__0 [ 601] : timesta

performance - Loading time Delphi XE2 application -

i have strange behavior loading time of application written in dephi xe2. compiled same source in debug mode , release mode. both .exe reside on same machine, same hard disk, same... everything, folder different. when run application in debug mode (45mb), takes around 6 seconds load , around 50 seconds load application compiled in release mode (15mb). how can ? recommend check in order improve performance in release mode ?

iphone - Popover segue option in storyboard segue style field is not showing -

Image
i want choose storyboard segue style popover dont see in segue style field. story board action segue presents push, modal , custom. have uibarbuttonitem want choose popover storyboard segue. any suggestions please. go simulated metrics , should find it. here image of is. note popover available in ipad not in iphone through simulator. edit: here sample code using button , action method create popover: you need declare popovercontroller property: @property (nonatomic, strong) uipopovercontroller* buttonpopovercontroller; then button action can this: - (void) buttontapped:(uibutton*) sender { contentviewcontroller* contentvc = [[contentviewcontroller alloc] init]; self.buttonpopovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:contentvc]; self.buttonpopovercontroller.delegate = self; //only required if using delegate methods [self.buttonpopovercontroller presentpopoverfromrec

How to format edittext (android) -

i need format edittext add dot. when input more 3 numbers put dot after first number (like this: 1.000) but when input have more 4 numbers put dot after second number (like this: 10.000) i tried addtextchangedlistener didn't work. this algorithm add numbers @ end , move dot, next example: you have @ begining 0.00 insert 1 , have 0.01 insert 5 , have 0.15 insert 9 , have 1.59 try modified code , adapt need. youtedittext.addtextchangedlistener( new textwatcher() { boolean mediting = false; public void ontextchanged(charsequence s, int start, int before, int count) { } public void beforetextchanged(charsequence s, int start, int count, int after) { } public void aftertextchanged(editable s) { if(!mediting) { mediting = true; string digits = s.tostring().replaceall("\\d", ""); numberformat nf = new decimalformat( &

jquery - display: inline-block doesn't work on ajax response -

when receive response script create new elements , attach them main container, these new elements doesn't respect "display: inline-block" property, tried embed style on html doesn't work either. here's code jquery.post('includes/script.php', {getmore: true}, function(data) { dato = jquery.parsejson(data); $.each(dato, function(i){ var html = '<div class="container_'+ dato[i][1] +'" data-img="'+dato[i][2]+'" data-order="'+dato[i][3]+'" style="display: inline-block">'+ '<img src="'+dato[i][0]+'" class="img_'+ dato[i][1] +'" />'+ '</div>'; $('div#main-container').append(html); }); }); when element set display inline-block then browser place 'white space' @ right side of element . when insert kind of elements ajax seems d

ios - Formatting an NSDate with Abbreviated Month/Day Names -

if have nsdate object, how can format nsstring output first 3 letters of day (like mon, tue, wed, thu, fri, sat, sun) , first 3 letters of month (jan, feb, mar, apr, may, jun, jul, aug, sep, oct, nov, dec)? currently i'm using nsdateformatter : nsdateformatter *dateformatter = [[nsdateformatter alloc]init]; dateformatter.dateformat = @"mmmm dd yyyy"; nsdate *date = ... nsstring *datestring = [dateformatter stringfromdate:date]; nslog(@"datestring: %@",datestring); // outputs august 09 2013 // output fri, august 9 edit i've tried using nsdatecomponent i'm wondering if there's shortcut getting abbreviations... nsdatecomponents *components = [[nscalendar currentcalendar] components:nsdaycalendarunit | nsmonthcalendarunit | nsyearcalendarunit fromdate:date]; as per link kindly provided rmaddy, @"eee, mmm d"; solution

Character in Java game not responding -

i have been following java game tutorials , go stuck on one, 1 here: http://www.youtube.com/watch?v=rolmrqekv3o&list=pl6e90696571998dc2 have issue character not respond arrow keys. if great. code: package thejavahubgame; import java.awt.color; import java.awt.font; import java.awt.graphics; import java.awt.image; import java.awt.event.keyadapter; import java.awt.event.keyevent; import javax.swing.imageicon; import javax.swing.jframe; public class main extends jframe implements runnable{ int x, y, xdirection = 10, ydirection = 10; private image dbimage; private graphics dbg; image face; public void run(){ try{ while(true){ move(); thread.sleep(5); } } catch(exception e){ system.out.println("error"); } } font font = new font("arial", font.bold | font.italic, 15); public void move(){ x += xdirection;

python - Merge fixed length multiple lists -

how merge fixed length multiple lists single list updated value in particular place. in example below, result [1,33,222,3333,11111] . l1 = [1, "", 111, "", 11111] l2 = ["", 22, 222, 2222, ""] l3 = ["", 33, "", 3333, ""] l4 = .... l5 = ... .... is there inbuilt function this. can using 2 loops there must other smart ways same you can use zip(l1, l2, l3) , or operator on tuples: [tup[2] or tup[1] or tup[0] tup in zip(l1, l2, l3)] or operator returns first true value. , since want last true value, need apply or operator on tuple elements in reverse. or can zip lists in reverse, , use or operator in order: [tup[0] or tup[1] or tup[2] tup in zip(l3, l2, l1)] update: instead of variable number of list, suggest have list of list instead. in case can result this: li = [[1, "", 111, "", 11111], ["", 22, 222, 2222, "

In a Visual Studio Add-In, how to disable menu items during a build? -

when write vs addin proffers menu items vs, calls querystatus implementation check whether menu items should visible, enabled, etc. my menu items not appropriate run during situations, e.g. when build happening. how detect whether there's build running? you're looking vsshellutilities.issolutionbuilding method. example of using can found managed package framework visual studio 2010 (mpfproj10) in projectnode class: protected internal virtual bool iscurrentstateasuppresscommandsmode() { if (vsshellutilities.issolutionbuilding(this.site)) { return true; } dbgmode dbgmode = vsshellutilities.getdebugmode(this.site) & ~dbgmode.dbgmode_encmask; if (dbgmode == dbgmode.dbgmode_run || dbgmode == dbgmode.dbgmode_break) { return true; } return false; }

Reshape error in R -

i have gone through example posted others regarding reshaping data frame wide long. my original dataframe has following columns country,trial_id,trial_name,seed.zone, prov_name,alt_min,alt_max,prov_id,replication, tree_id plot_id dbh_05, dbh_06, dbh_09, dbh_10, dbh_11, dbh_13, dbh_14, dbh_15, dbh_17, dbh_18, dbh_20, dbh_21, dbh_23, dbh_24, dbh_25, dbh_27, dbh_29, dbh_30, dbh_31, dbh_34, dbh_35, dbh_37 i want reshape dataframe following columns country,trial_id,trial_name,seed.zone, prov_name,alt_min,alt_max,prov_id , dbh, age library(reshape2) mydata <- reshape(database_final, idvar=c("trial_name","country", "trial_id", "trial_name","seed zone","prov_name", " alt_min", "alt_max","prov_id","replication","tree_id","plot_id"), varying = list( "dbh05","dbh06"

Handling File upload from html form in python -

i have simple html form , backend python handled cgi-bin. trying upload file through form , print contents of file in python script. html code: <form id = "upload" enctype="multipart/form-data" action="/var/www/cgi-bin/test.py" method="post"> <div id = "table"> <table class = "center" border="1" cellpadding="10"> <tr><td style="height: 131px">product details</td> <td style="height: 131px">product name*:&nbsp;<input type="text" name="product" id="product" size="35" ><br /><br /> platform*: &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <input type="text" name="platform" id="platform" size=&

asp.net - ASMX script service returns 401 basic when using forms authentication and bad auth ticket -

Image
i have asp.net 4.0 application contains web service used render data through ajax. have service attached scriptmanager through script reference. site protected forms authentication. <ajaxtoolkit:toolkitscriptmanager id="scriptmanager1" runat="server" enableviewstate="false" asyncpostbacktimeout="3600" scriptmode="auto" enablepagemethods="true" combinescripts="true" enablecdn="true" > <services> <asp:servicereference path="~/webservices/portalwebservice.asmx" /> </services> </ajaxtoolkit:toolkitscriptmanager> when try , call webservice method using javascript , auth ticket still valid hunky dory , response fine. if auth ticket expired when javascript call made server pops window asking me authenticate. the server responding 401 request basic authentication! when enter valid information absolutely not

java - JAR File not exececuting which is build by netbeans -

i beginner in java gui , using netbeans 7.3 use swing components, problem working fine, 1 day when clicked clean & build , tested jar file, not executing, ran in netbeans , working fine. thought problem of build properties compared build properties project working fine jar file cannot find difference, problem when double-click jar file, no error shown, tried many ways executing cmd did'nt worked. can me out missing, , 1 thing more tried build project on computer through netbeans no use. try open .jar winrar, , check if classes being added .jar, if not being added bug netbeans, advise install netbeans 7.2, , open project again, , regenerate jar file. having similar problem netbeans 7.3

Using alias in mysql is not working -

i confused usage of alias . example, query below works fine select * ( select row_number() on (partition prodid order quantity desc) 'rankin',prodid,quantity sales ) rankin=1 but when modify shown in snippet below error: "invalid column name 'rownumber'". select row_number() on (order quantity) 'rownumber' sales rownumber = 1 please explain difference. this because select executed after where , from executed before where cannot used in second query can used in first query.

c++ - Terminate DebugActiveProcess or other debugging routines -

i kinda want leave more thought experiment (i asked in chat directed here). can provide code if helpful. here scenario! process 1 running , debugging process 2, have injected dll process 2 , detoured 1 of windows functions relies on can execute own code. there way within process 2 can prevent process 1 continuing debug process 2? i dont know excatly mean "preventing debug". you avoid debbuger recive event related process, using ntsetinformationthread push 0 push 0 push 11h ;threadhidefromdebugger push -2 ;getcurrentthread() // can use on every thread call ntsetinformationthread reference: peter ferrie anti debug tricks http://pferrie.host22.com/papers/antidebug.pdf

ios - How to clone a CoreData SQLite backed persistent store to "in memory"? -

i'd create clone of coredata structure (not data) in memory. allow me write unit tests fresh coredata stack, , not have deal data stored in actual sqlite database. as side note i'm using magicalrecord, may or not help. what have in mind unit tests follow: during - (void)setup open app coredata store (sqlite) clone store memory close persistent sqlite store open in memory store created delete data in memory store run tests any idea? or better solution? thanks magicalrecord contains function called [magicalrecord setupcoredatastackwithinmemorystore] . create in-memory store based on data model. there no need copying or of stuff mentioned because type of store not persistent (you said delete anyway before use it). don't worry cloning sql version, set memory version , use it.

node.js - Nodeunit - JSCovrage -

there way use jscoverage have code coverage nodeunit? i know there nodeunit2 , code not in lib, , not want restructure project. sure... follow steps in this example . the key elements being: run jscoverage command on directory (or directories) house code provide mechanism (such environment variable) make choice when include module include correct version of code when want code coverage statistics, set environment variable accordingly

Dygraphs change series name dynamically? -

i have dygraphs chart has 115 or series plotted on it. works great. however, i'm trying figure out how retrieve series name of highlighted series, , how format number. example on dygraph fiddle page (though, use big php string data, won't shown). http://jsfiddle.net/em2mg/861/ i end highlighted label of "year: 1955 y73 portfolio: $1,000,000". want able retrieve 73 number, , edit says. can't find in dygraph js file specific label formatter series number ,or method retrieve it. don't want have label every series manually. ideas? great charting software. gr = new dygraph( // containing div document.getelementbyid("graphdiv2"), // csv or path csv file. <?php echo $chartdatastring2; ?>, { title: 'spending level', ylabel: 'spending ($)', xlabel: 'year', labelsdivstyles: { 'textalign': 'right' }, digitsafterdecimal: 0, yaxislabelwidth: 100, axes: { y: {

mysql - retrieve rows via join and datetime query where datetime is in past AND NOT in future -

i have 3 table structure follows (simplified): users ----- id purchases --------- id user_id events ------ id purchase_id starts_on (datetime) i want select users have event took place before date in past, not have event in future. can think of asking question, "which of users engaged company attending events, not longer?" this query being generated in rails , have cleaned follows: select distinct `users`.id `users` left outer join `events` on events.user_id = users.id left outer join `purchases` on `purchases`.id = `events`.purchase_id events.starts_on <= '2013-07-15' , not events.starts_on >= '2013-08-12' limit 0, 30; although query retrieves users have events prior first date parameter, still includes users have event starts in future, not want. appears "and not" portion of query not working expected. i suspected problem use of left outer join instead of inner join, changing made no difference. help appreciated.

regarding opencv loader in android -

i using async method load opencv in activity. i wanted know have every activity? or enough in main activity , normal things in other activities? it should enough in mainactivity. follow link below details , more clarification: http://docs.opencv.org/doc/tutorials/introduction/android_binary_package/dev_with_ocv_on_android.html

sql - Unique sort order for postgres pagination -

while trying implement pagination server side in postgres, came across point while using limit , offset keywords have provide order clause on unique column primary key. in case using uuid generation pkeys can't rely on sequential order of increasing keys. order pkey desc - might not result in newer rows on top always. resorted using created date column - timestamp column should unique. but question comes if ui client wants sort other column? in event might not unique column resort order user_column, created_dt desc maintain predictable results postgres pagination. is right approach? not sure if going right way. please advise. i talked exact problem on old blog post (in context of using orm): one last note using sorting , paging in conjunction. query implements paging can have odd results if order clause not include field represents empirical sequence in data; sort order not guaranteed beyond explicitly specified in order clause in (maybe all) databa

ruby - Printing elements of an array with a comma -

i have array arr = ["test", "test 1", "test 2"] . how print test, test 1, test 2. ? note "." , "," in expected output. i know how iterate on doing: arr.each |a| puts end but i'm not sure how expected output. puts arr.join(' , ')+'.' with trailing period.

html - ASP.NET Open popup and then redirect -

i have custom css/html popup lightbox , form button on it. my goal is, when press button: open popup then thread.sleep and after response.redirect page. is possible? in advanced. here html code: <a href="#test"><img src="images/smallimg.jpg"/></a> <div class="overlay" id="test"> <img src="images/bigimg.jpg"/> <a href="#page" class="close">x close</a> </div> if doing in javascript, first show popup , use settimeout(code,millisec,lang) function activate buttonclick event/function. in asp.net bind settimeout(code,millisec,lang) function through end.

android - Posting something to status on Facebook -

i using this tutorial learn how connect facebook via android app. particularly interested in section shows how post on wall / status of user. the tutorial straightforward requirement need let app append things along user posts. how can achieved ? you can this: private void publishtofacebook(string message) { long songid = musicutils.getcurrentaudioid(); long albumid = musicutils.getcurrentalbumid(); string albumarturl = musicutils.getartworkurlfromextrascache(getapplicationcontext(),albumid); bitmap bm = musicutils.getartworkfromextrascache(getapplicationcontext(),albumid,false,false); if(bm == null) bm = musicutils.getdefaultartwork(getapplicationcontext()); sharefacebookconnector = new shareconnector(mediaplaybackactivity.this, getapplicationcontext()); sharefacebookconnector.setcurrentalbum(musicutils.getcurrentalbumname()); sharefacebook

java - Images in gridview change their position while scrolling -

hi i'm having kind of problem, when scrolling imageviews change positions , background images. saw other answers on topic on site, non of them helped me. like once: grid view scrolling issue gridview scrolling problem on android gridview elements changes place dynamically when scroll screen and many others...but don't solve problem. important thing don't use custom layout gridview or gridview items(imageviews).i create them programmatically. important me if know answer pls me...thanks. public view getview(int position, view convertview, viewgroup parent) { if(convertview==null){ imageview = new imageview(ctx); } else { imageview = (imageview) convertview; } imageview.setlayoutparams(new gridview.layoutparams(85, 85)); imageview.setscaletype(imageview.scaletype.center_crop); imageview.setpadding(8, 8, 8, 8); imageview.setbackgroundresource(tmp[position]); imageview.setimageresource(blank);

Using wget to get an excel files with FOR loop syntax on batch/CMD (*.bat) programing -

refer question looping using in batch (*.bat) / cmd . i want use wget excel files. excel01.xls --> link : http://portal/excel01.xls excel02.xls --> link : http://portal/excel02.xls ... excel12.xls --> link : http://portal/excel12.xls my code : echo off set /p start= input start : %=% set /p end= input end : %=% /l %%i in (%start%,1,%end%) echo wget "http://portal/excel0%%i.xls" pause result : input start : 1 input end : 12 wget "http://portal/excel01.xls" wget "http://portal/excel02.xls" wget "http://portal/excel03.xls" wget "http://portal/excel04.xls" wget "http://portal/excel05.xls" wget "http://portal/excel06.xls" wget "http://portal/excel07.xls" wget "http://portal/excel08.xls" wget "http://portal/excel09.xls" wget "http://portal/excel010.xls" wget "http://portal/excel011.xls" wget "http://portal/excel012.xls" press key continue

css - 34grid : How to create a column with 2/3 width? -

using 34 responsive grid system , how create column two-third of full width ? the grid system has equal columns settings, how can colspan / merge 2 columns ? <div class="container"> <section class="row"> <div class="col_1">100%</div> </section> <section class="row"> <div class="col_2">50%</div> <div class="col_2">50%</div> </section> <section class="row"> <div class="col_3">33%</div> <div class="col_3">33%</div> <div class="col_3">33%</div> </section> </div> looks documented in homepage should thoroughly read. try this: <section class="row"> <div class="col_3c">66%</div> <div class="col_3">33%</div> </section

Django update already existing user information -

ok have registration working users enter username, email, first/last name. my question how give user ability edit email, first/last names? thanks! there nothing special default django user. in fact, django auth application normal django application has own models , views , urls , templates other app write. to update model instance - can use generic updateview , works this: you create template show form used update model. you can (optionally) create own form class used - not required. you pass model updated along instance view. the view takes care of rest of logic. here how implement in practice. in views.py : from django.views.generic.edit import updateview django.core.urlresolvers import reverse_lazy django.contrib.auth.models import user class profileupdate(updateview): model = user template_name = 'user_update.html' success_url = reverse_lazy('home') # user # redirected once form

asp.net mvc 4 - View not binding correcty with the model -

i can figure out why it's not binding. have form listbox in partial view reload everytime click on checkbox fill listbox. the code of modelview form : <div class="row-fluid"> <div class="span3"> <label>fonction(s):</label> </div> <div class="span9" id="listefonction"> @html.partial("listerfonction", model) </div> </div> <div class="row-fluid"> <div class="span5 offset3"> <div class="fonctions_container">

sql - Combining output of two or more select statement -

how combine output of 2 or more select statements, have multiple tables having data need fetch them write multiple select query. want combine result of queries need ? want output be: t1.qty,t2.qty,t3.qty one option be: select (select sum(qty) table1 ...), (select sum(qty) table2 ...), (select sum(qty) table3 ...) another joining, provided there link: select * (select id,sum(qty) table1 group id) t1 join (select id,sum(qty) table2 group id) t2 on t1.id = t2.id join (select id,sum(qty) table3 group id) t3 on t1.id = t3.id the above options display results in 1 row. you may need union combine rows: select qty table1 union select qty table2 union select qty table3 much more options if define more specific needs

ruby on rails - How to handle gemset -

i new rails. each time open new terminal in linux, tells gem missing. have installed gem in same folder in different terminal. please advise how can fix problem. rails gemsets can bit tricky. can global, rails-version specific or project specific. guess using global gemset. in project terminal can run gem list to see gems available in project. if don't find 1 in list, make sure have in gemfile. , again run bundle install

sql - what does DBCC DBREINDEX('?', ' ', 80) do? -

what following statement do? reindex tables named '?' fill factor of 80% ? exec sp_msforeachtable @command1="print '?' dbcc dbreindex ('?', ' ', 80)" it did improve query time 23 seconds instantly i'd understand why. not quite - when use sp_msforeachtable , question mark placeholder the table name (as loops through each table in turn). in reply second question comments, yes - according documentation on dbcc dbreindex second argument: if index_name specified, table_name must specified. if index_name not specified or " ", indexes table rebuilt.

Pictures in HTML files in iOS app -

i'm new ios development , i'm having issue displaying image inside html file. display html file in webview not images inside it. have added png files same folder retrieve html file neither the background-image: url(bg1.png); nor <img src="logo.png"/> seem work. i think i've worked out way add external files ios app because set pictures background webview, issue html file not display it. tested file in several browsers , there's no problem. am writing paths wrong or simpler rookie mistake? thanks in advance. using relative paths or file: paths refer images not work uiwebview. instead have load html view correct baseurl: nsstring *path = [[nsbundle mainbundle] bundlepath]; nsurl *baseurl = [nsurl fileurlwithpath:path]; [webview loadhtmlstring:htmlstring baseurl:baseurl]; you can refer images this: <img src="myimage.png"> or within css this: background-image: url(loading.gif) example : nsstring *path

bash - Formatting multiple USB sticks in Linux -

i'm trying write program in bash format 7 usb sticks @ once , create new partition each usb stick. problem usb sticks varying makes , models , sizes , need find size of available space on stick , create partition size. this 1 create filesystems still doesn't partition them before creating. save script script.sh #!/bin/bash command=("mkfs.ext4" "-option1" "-option2") ## change depending on formatting tool you'll use. dev; echo "creating filesystem $d." read -p "continue? " && [[ $reply == [yy] ]] || break ## remove line if don't want confirm. "${command[@]}" "$dev" done and run bash script.sh /dev/yourdevice1 [/dev/yourdevice2] example: bash script.sh /dev/sdc /dev/sdd1 be careful , check arguments before running script.

java - Multiple search from HTML table -

function dosearch() { var searchtext = document.getelementbyid('searchterm').value; var targettable = document.getelementbyid('datatable'); var targettablecolcount; // loop through table rows. (var rowindex = 0; rowindex < targettable.rows.length; rowindex++) { var rowdata = ''; // column count header row. if (rowindex == 0) { targettablecolcount = targettable.rows.item(rowindex).cells.length; continue; //do not execute further code header row. } // process data rows. (rowindex >= 1) (var colindex = 0; colindex < targettablecolcount; colindex++) { rowdata += targettable.rows.item(rowindex).cells.item(colindex).textcontent; } // if search term not found in row data hide row, else show. if (rowdata.indexof(searchtext) == -1) targettable.rows.item(rowindex).style.display = 'none'; else targettable.rows.item(rowindex).style

PHP array_filter with get_class filter -

i have array of objects, , want check if classname in it. tried: $all_classnames = array_filter($obj_array, 'get_class'); $found = in_array("classname_to_test", $all_classnames); only, $all_classnames still holds original object array instead of array of classnames (through get_class). missing here? you want use array_map (which transforms input array based on callback function) instead of array_filter : $all_classnames = array_map('get_class', $obj_array); note array_map takes arguments in reverse order other array functions use callback because php.

Error in creating TCP client in lua -

i trying create tcp client in lua local host, port = host, port local socket = require("socket") client = socket.tcp(); client:connect(host, port); client:send("hello user"); this works fine when add while true local s, status, partial = client:receive() print(s or partial) if status == "closed" break end end to read data socket block total execution of code. by default, luasocket i/o operations blocking. need use socket.settimeout(0) ( settimeout ) disable blocking. can check "timeout" value returned status , act accordingly. depending on how data being sent, this answer may relevant well.

html - css - overflow: hidden in div nested inside display: table-cell -

i've got problem overflow in div nested inside div has display: table-cell style. i'm not sure why content #left-wrapper not cropped (hidden) when exceeds height of #left-wrapper. in advance advices. fiddle link: http://jsfiddle.net/bpbhy/1/ here's markup: <div id="wrapper"> <div id="left"> <div id="left-wrapper"> <ul> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li> <li>menu item</li>

d3.js - d3 adding data attribute conditionally -

i'm creating table d3 used footable jquery plugin , requires having data- attributes in header row. not columns have data attributes , wondering if there way this. this approach sort of works, adding possible data attributes , leaving blank, i'm sure it's not practise. var th = d3.select(selection).select("thead").selectall("th") .data(colspec) .enter().append("th") .text(function(d) { return d["data-name"]; }) .attr("data-class", function(d) { if ("data-class" in d) { return d["data-class"]; } else { return ""; } }) .attr("data-hide", function(d) { if ("data-hide" in d) { return d["data-hide"]; } else { return "";

ios - Calabash: How to record touches on iPhone -

i've recorded aand played touches via irb on iphone simulator, couldn't find how record actual device. there documentation go through? on ios < 7 can use calabash-ios gem irb record touches , other gestures , playback later in steps. in ios 7, apple removed playback features of uiautomation. if found feature of calabash-ios useful, please file bug report apple. https://bugreport.apple.com/ ‎ the replacement recordings in ios 7 uia_* family of functions provide bridge uiautomation scripting language. if targeting ios < 7 launch app in simulator or device open calabash console (aka irb) $ calabash-ios console > record_begin #### perform gestures on simulator or device > record_end 'my_special_gesture' # test worked > playback 'my_special_gesture' you can use gesture in step then(/^i special gesture$/) playback 'my_special_gesture' end in calabash-android, record_begin , record_end methods not y

c# - What is the 'api_key' and how do I use it correctly -

i'm new restful services, , i've implemented test code servicestack restful service going swagger plugin working well, leads me question... inside swagger-ui/index.html there field 'api_key'. know variable name umm... variable, , can set whatever like, i'm confused it's used , whether should making use of it. also, if use it, how servicestack present value me on server side? here test service i've got , running documentation... [api("hello web services")] [route("/hello", summary = @"noel's servicestackswagger thingy", notes = "some more info in here cause these notes")] [route("/hello/{name}", summary = @"n031'5 servicestackswagger thingy", notes = "some more info in here cause these notes", verbs="get,post" )] public class hello { [apimember(name = "name", description = "this description", parametertype

osx - Animating and removing an NSImageView object failed? -

my app situation: having app displaying dynamic picture. , want capture current image , save disc. my goal: working on animated visual effect: add image view on top, , animates origin frame cgrecrzero. finally, remove image view vie hierarchy after animation done. now problem: first time triggerring action, seems work. when trigger @ second time, image view not animate , stay atop of subviews. codes of view controller (with arc): firstly, ibaction trigger snapshot: - (ibaction)actionsavesnapshot:(id)sender { ... // save image file. works everytime. nsthread *tempthread = [[nsthread alloc] initwithtarget:self selector:@selector(threadsimulatescreencapture:) object:nil]; if (tempthread) { [tempthread start]; tempthread = nil; // release } } and here thread: - (void)threadsimulatescreencapture:(id)arg {@autoreleasepo

c# - Memory fragmentation? -

Image
i'm not sure because don't have experience in analysing memory dumps, think may have problems memory fragmentation. during load tests see memory usage growing point application restarts. asp.net mvc 4 app on 64 bit machine. wasn't involved in writing it. asked try analyze memory dumps. so during last load test created 3 memory dumps (below sizes , total gc heap size output eeheap -gc): 1.70gb, 292mb 2.03gb, 337mb 2.55gb, 347mb so see managed heap isn't growing as dump files. when dumpheap -stat see space used free objects (below each dump file) 147mb 145mb 213mb fragmented blocks larger 0.5 mb: addr size followed 000000bcc668e0a8 0.7mb 000000bcc6738650 system.object[] 000000bcc6949f88 4.4mb 000000bcc6dab820 system.collections.specialized.nameobjectcollectionbase+nameobjectentry 000000bd4626c4b8 0.7mb 000000bd463165f8 system.byte[] 000000bd463fcc48 51.5mb 000000bd4977baf0 system.threading.threadstart 000000be463600

asp.net - Wifi in .Net application -

i developing web application in asp.net(3.5) . having thought of integrating applicaiton along wifi (i.e.) data mobile should able sent client system through wifi . possible ? if can done, tell me solution achieve this. in advance... your application wouldn't built specific wifi; you'd use network connections, , how network connection physically connected (or not) irrelevant application. typically you'd make use of web service calls on https (or maybe http if data isn't sensitive). os takes care of network connect itself, whether ethernet, wifi, or cellular.

android - Is there a point to uploading a feature graphic in the current Play Store? -

Image
the google play store used display large banner on app pages, known feature graphic , new layout no longer displays this. is there chance come @ point or feature graphic image used in different setting? or there no reason create 1 anymore? yes, there still @ least 3 reasons create feature graphic: 1) features the "editors' choice" area of play store app uses feature graphics: 2) play store widget the play store widget uses feature graphics users place widget on home screen. i've used widget lot, , trust me it's not angry birds on there. many of apps i've seen have ~1000 downloads, , earned placement on widget because had other apps same developer. if have low-budget app, it's still worth have feature graphic free promotion. 3) required make changes play store listing after august 31st, 2014.

rabbitmq - understanding how queues(celery etc.) work? -

i have been reading lot queues , have confused myself. jot down know, please let me know, if understand things correctly. a queue helps things out of request-response cycle. meaning, if client uploads image, , want save thumbnail version of image, not want keep client waiting time till image gets trimmed, , return him, out of request-response cycle, via queue. queue traditional data-structure queue, first in first out sort of. the popular solution providers these queues celery , pyres , & amazon sqs. how queue work? generally there daemon running, instance, if there celery there celery daemon runs, , keeps doing computation on whichever task @ top of queue. (hope right on this) another example, complicated, please correct me on this. now want automate following task: send mail friend of mine, on 25th dec. wish friend on birthday on 26th dec. wish friend on birthday on 26th dec. in case, following: create entry, , in database. once entry created, queue

SSRS Consuming WCF Service with Calling User Credentials Issue -

we have ssrs reports consume wcf service data needs use calling users credentials. on service side, use basic binding host service: <binding name="thebasichttpbinding" maxreceivedmessagesize="50000000" transfermode="streamed"> <readerquotas maxarraylength="50000000"/> <security mode="transportcredentialonly"> <transport clientcredentialtype="windows"/> </security> </binding> <service behaviorconfiguration="defaultservicebehavior" name="web.theservice"> <endpoint binding="basichttpbinding" bindingconfiguration="thebasichttpbinding" name="servicehttpbinding" contract="web.itheservice"/> </service> during report development setup shared data source used of our reports. data source of type "xml" , points service endpoing .svc file. within each of our datasets make reques