Posts

Showing posts from August, 2013

(iphone) is it ok to define @property for a c++ class/struct? -

i mixing c++ , objectc. in particular, i'm adding c++ class/struct variable object-c header, , if legit? for example, @interface myview : uiview { mycppclass cppvariable; } @property (nonatomic, assign) mycppclass cppvariable; @end and @ implementation file, @synthesize cppvariable; well. as described in this official document on objective-c++ , can have non-pointer c++ objects inside objective-c classes. correctly constructed , destructed, if use option -fobjc-call-cxx-cdtors in gcc / clang. the situation @sythesiz ing non-pointer c++ @property not clear, because documentation lacking. behavior depends on compiler used, discussed e.g. in this question . clang team trying implement right thing, don't think it's available now. so, stick using pointer c++ classes if want @synthesize . otherwise, implement own setter , getter.

visual studio 2010 - Make "Go to definition" navigate to the .NET reference source -

in resharper, there's option navigate sources symbol files. if enable downloading, navigation works - can step code of console.writeline , forth. however, have downloaded entire reference source - there way direct resharper source, doesn't download unnecessarily? i've configured reference source according instructions on site it's not possible @ moment. please vote/watch http://youtrack.jetbrains.net/issue/rsrp-126489

image - iphone post multipart -

i trying upload image , other details using multipart post method. went through following link http://lists.apple.com/archives/web-dev/2007/dec/msg00017.html but not able tweak how want not able under stand content-disposition , things that. code sending other details here below. poststring = [nsstring stringwithformat:@"u=username&p=pass&color=red&date=12]; i need send image gallery. using alasset access image. please help. new bee in iphone you can use asihttprequest upload file multipart. it's pretty easy.

unix - How do i change the following input line using SED? -

how change following input line using sed ? input - bus_ln in ('abc'); required o/p - bus_ln in ('def','xyz'); give try: sed "s/\([^(]*\)('[^']*')/\1('def','xyz')/" inputfile it replace whatever between parentheses. input: bus_ln in ('abc'); foo('bar'); baz aaa bbb ('ccc ddd') more text output: bus_ln in ('def','xyz'); foo('def','xyz'); baz aaa bbb ('def','xyz') more text

c# - Task/Method scheduling from within a timer -

from within windows service cast method once hour. polling timer exists use rather adding "windows task". in timer callback, checking whether call method or not following code, _config.pollinginterval interval of timer. if (datetime.now.subtract(new datetime(datetime.now.year, datetime.now.month, datetime.now.day, datetime.now.hour, 0, 0)) < timespan.frommilliseconds(_config.pollinginterval)) { sendreport(); } for reason, condition met twice within same minute (e.g. 08:00). guess there logical error somewhere, since it's assured there one timer. any hints working or different/more elegant approach? maybe this: class reporter { int _hourlastrun; public reporter() { _hourlastrun = -1; } public void sendifneeded() { var currenthour = datetime.now.hour; if(currenthour != _hourlastrun) { _hourlastrun = currenthour; sendreport(); } } } then instantiat

WPF how to restore Button background color -

Image
this question felt simple can't find answer: how change button default? vs2010 start giving me button strange color , have manually set button default self. i tried: btn.background = null; // make transparent, not default background anyone? use clearvalue -method restore default. btn.clearvalue(button.backgroundproperty); or btn.clearvalue(control.backgroundproperty); this sets background-property of button. if have changed buttons template, not help. in case, explicit declarations of button.template -property or style sets button.template-property. in app.xaml if there <style targettype="button"> ... </style> or <style targettype="{x:type button}"> ... </style>

iphone - How I can make SQLite Database Central on App Store? -

hi, new iphone app development. suppose develop app have central database have in .net web application. sqlite provide such feature , if yes, have put database different users can access same database apps. in advance no sqlite store things on each individual phone. use central server web-service interface (and favorite sql or nosql server backing store) accessed iphone application. also sqlite not scale when many users performing concurrent inserts - not kind of database. use mysql, sql server, oracle or whatever designed purpose.

django - create a model that lets you insert multiple values for the same field? -

ok i'm trying should simple in mind missing sql or django admin knowledge it. have simple model such class book(models.model): title = models.charfield(max_length = 50) review = models.textfield() and want 'review' field in admin site have little plus sign add more reviews same model instance template iterate through them. i know create m2m field reviews , give me that, rather reviews filled same page without popups (for helpless users keep wsiwyg possible, since textfields tinymce powered), , wonder if it's necessary create model textfield create review model holds review text , has foreignkey book ... class book(models.model): title = models.charfield() class review(models.model): book = models.foreignkey(book, related_name='reviews') review = models.textfield() ...then register appropriate type of inlinemodeladmin edit related reviews on book's page in admin. i'd suggest using stackedinline in case: clas

How to draw lofargram graph in java -

how draw lofargram [low frequency analysis , recording (lofar) generic term used describe techniques of frequency analysis ] graph using java, library available draw lofargram graph. data read sensor using serial ports.http://www.maritime-acoustics.co.uk/examin1.gif

Prefix match in MATLAB -

hey guys, have simple problem in matlab: i have strings this: pic001 pic002 pic003 004 not every string starts prefix "pic". how can cut off part "pic" numbers @ end shall remain have equal format strings? greets, poeschlorn if 'pic' ever occurs prefix in strings , else within strings use strrep remove this: >> x = {'pic001'; 'pic002'; 'pic003'; '004'} x = 'pic001' 'pic002' 'pic003' '004' >> x = strrep(x, 'pic', '') x = '001' '002' '003' '004' if 'pic' can occur elsewhere in strings , want remove when occurs prefix use strncmp compare first 3 characters of strings: >> x = {'pic001'; 'pic002'; 'pic003'; '004'} x = 'pic001' 'pic002' 'pic003' '004' >> ii = find(strncmp

How do I get Timestamp minus 6 weeks in MySQL? -

i have field named timestamp . last time member logged in. looking include clause in query like where timestamp > todays date - 6 weeks how this? trying include users have logged in in last 6 weeks. thanks i find syntax more readable date_sub , either way works. where timestamp >= now() - interval 6 week if want go "today" (midnight) instead "now" (current time), use this where timestamp >= date(now()) - interval 6 week

java - which spring jar file is required jstl tags -

in have xml file with <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> which spring jar file required it none, can download manually jstl.java.net or download.java.net/maven . alternatively if you're using build system such apache maven can using: <dependency> <groupid>javax.servlet</groupid> <artifactid>jstl</artifactid> <version>1.2</version> </dependency>

Convert WSDL to XML Tool? -

does know of tool / program convert wsdl xml? basically want empty xml template. can populate nodes data after template. you can extract xml request/response templates wsdl using soapui . soapui useful @ lot of things web service mocking, unit testing etc. great tool. here generates operation in 1 of examples at: http://www.webservicex.net/currencyconvertor.asmx?wsdl <soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://www.webservicex.net/"> <soapenv:header/> <soapenv:body> <web:conversionrate> <web:fromcurrency>?</web:fromcurrency> <web:tocurrency>?</web:tocurrency> </web:conversionrate> </soapenv:body> </soapenv:envelope> and <soap:envelope xmlns:soap="http://www.w3.org/2003/05/soap-envelope" xmlns:web="http://www.webservicex.net/"> <soap:header/> <soap:bo

c# - Data in Array from N Textboes using For loop -

there "n" number of textboxes on form, i want values in textboxes in array. using "for" loop, can me out this. you can controls on form calling this.controls , loop through comparing control textbox, when textbox add value array mentioning. i'd use this: list<string> values = new list<string>(); foreach(control c in this.controls) { if(c textbox) { /*i didnt need cast in intellisense, in case!*/ textbox tb = (textbox)c; values.add(tb.text); } } string[] array = values.toarray();

sql - Merge two SELECT queries into one -

i have 2 queries need count of total records difference in queries 1 field value. example; select count(*) group_a tbl category = 'value_a' select count(*) group_b tbl category = 'value_b' how can this: (pseudo) select count(*) group_a, count(*) group_b tbl category in ('value_a', 'value_b') but results this group_a , group_b 56, 101 i thinking case statement in query filter 2 how implement it? or there better way? i'm doing union right wanted know if return 1 record 2 results select sum(case when category = 'value_a' 1 else 0 end) group_a, sum(case when category = 'value_b' 1 else 0 end) group_b tbl category in ('value_a', 'value_b')

Android Apps Storage -

if 1 develops app android or , apps being designed in such way stores data in it.but needs db store na , if no db integrated , there possible soln data user enter can store in apps itself take here . android supports sqlite.

java - Ant with Hudson -

i have problem in running job in hudson. have configured hudson ant_home path of ant , jdk relative path. , created new job, setup svn path , rest of things. build.xml of project in project root folder/build/build.xml and them have added build.xml in linux. this. <project name="test job" default="build"> <target name="clean"> <delete dir="${basedir}/svn/_build"/> <delete dir="${basedir}/build"/> </target> <target name="prepare"> <mkdir dir="${basedir}/svn/_build/logs"/> <mkdir dir="${basedir}/build/logs"/> <mkdir dir="${basedir}/build/docs"/> </target> <target name="build" depends="clean,prepare"/> </project> note : set job name usercentral. then tried build on hudson. giving me below error. fatal: command execution fail

geometry - Using Python, how do I tell if a rectangle and a shape overlap? -

i'm writing program in python. have series of shapes (polygons, defined sequence of coordinate pairs) , need tell if overlap particular rectangle. is there easy algorithm handling this? or, better, there pure python library can handle these calculations me? presuming "arbitrary shapes" indeed polygons (given they're described coordinate pairs), determining if overlap (in language) relatively trivial calculation. merely need compute if side of polygon intersects other side of polygon b. if need example, there's rather thorough walkthrough @ the drexel math forum . there number of python modules can assist in pursuit, such sympy , numpy , pygame , etc., of them rather heavy if geometric calculation need make.

uml - Import StarUML XMI to Eclipse -

good day, colleagues! i want convert uml file generated in staruml owl. i'm trying use eclipse odm implementation purpose. problem can't import uml file eclipse begin transformation. create new emf project , trying import xmi file staruml , error: org.eclipse.emf.ecore.xmi.packagenotfoundexception: package uri 'null' not found. (file:/c:/users/senya/desktop/test_test_test.xmi, 3, 13) @ org.eclipse.emf.ecore.xmi.impl.xmlhandler.createobjectbytype(xmlhandler.java:1307) does know how correctly import staruml files eclipse? if possible export uml 1.4 model xmi staruml import model enterprise architect . enterprise architect has very integration eclipse , having said sure there other tools out there use similar approach.

internet explorer - Is there a way to prevent users from enlarging the browser display? -

i built site client appears fine @ normal display appears break apart if change font size larger or largest in ie7/8. is there way prevent users changing view? in webkit there option: textarea { resize: none; } is there work in ie? thanks. no, why you? site should as accessible possible . if have poor eyesight , need increase font size see site?

c# - How to apply customizable skins to an ASP.NET web site? -

i'm writing saas application web front end written in asp.net. i'm not of designer, , asp.net knowledge not yet @ expert level - focus on server side stuff - have basic master page , style sheets, trick. now want offer customers ability customize web site own style sheets, colors, background pictures etc. customers log onto portal @ mycustomer.mydomain.com , see skin "mycustomer" has chosen. haven't faintest clue how this. how? if allowing customer specify own css (either file or in textbox in page). can save .css file in virtual directory , during page_load or page_init event add page. need push link tag header of page like this: // define htmllink control. htmllink myhtmllink = new htmllink(); myhtmllink.href = "~/customerscustomstylesheet.css"; myhtmllink.attributes.add("rel", "stylesheet"); myhtmllink.attributes.add("type", "text/css"); // add htmllink head section of page. page.head

apache - Can AJAX submit credentials for Basic Authentication? -

this might little bit of stretch, let's assume need work way: i have index.html file in web root of server. javascript in file needs make ajax request /secure/ajax.php everything in /secure/ directory protected using basic authentication i don't want bother user logging in /secure/ section can submit credentials basic authentication ajax request? xmlhttprequest.setrequestheader friend. xhr.setrequestheader("authentication", "username:password in base64") you need convert username:password base64

Spring, Hibernate - many-to-many - update error -

i'm trying use many-to-many relation in hibernate framework, have troubles. i have 2 models. user: @entity public class user implements serializable { long id; string name; list<car> cars; public user() { } public long getid() { return id; } public void setid(long id) { this.id = id; } public string getname() { return name; } public void setname(string name) { this.name = name; } public list<car> getcars() { return cars; } public void setcars(list<car> cars) { this.cars = cars; } } car: @entity public class car implements serializable { long id; string mark; public car() { } public long getid() { return id; } public void setid(long id) { this.id = id; } public string getmark() { return mark; } public void setmark(string mark) { this.mark = mark; } } i followed clues on page , configuration files looks this: user: <hibernate-mapping> <class name="com.bontade.phone_book.mvc.spring.models.use

c# - Why to use events somewhere where method is enough? -

i read events tutorial , not benefit in simple code this..method should used same way: class bulb { public delegate void handler(); public event handler glowing; ... glowing+=somemethod; private void turnon { glowing(); } private void somemethod { } } simply events allow others using code perform custom implementation want when event occurs (when bulb glowing). simply calling method won't tell anybody has happened. events basic element of event driven programming if program doesn't need tell event don't need implement such functionality. having such functionality has benefits. for example when using list class dont know when item got added (if @ point other code that) in observablecollection notifications when items added or removed. an event message sent object signal occurrence of action. action caused user interaction, such mouse click, or triggered other program logic.

javascript - How to get opacity value as an int for alpha filter? -

for internet explorer opacity set in inline css this: style="filter: alpha(opacity=50);" what i'd opacity value in integer in javascript. ok guess can whole string , parse out int, there faster/better way? thanks the javascript pretty simple: var opacity = this.filters.alpha.opacity; or if have id... var opacity = getelementbyid('myelement').filters.alpha.opacity;

io - What is the best way to transfer data (Real and Integer arrays) between two runnings fortran programs on the same machine? -

we using file i/o need better/faster way. sample code appreciated. by using files transfer, you're implementing form of message passing, , think natural fit sort of program. now, write uses shared memory when available , tcp/ip when not - or use library that, mpi, available, works, take advantage of shared memory if running on same machine, extend letting run them on different machines entirely without changing code. so simple example of 1 program sending data second , waiting data back, we'd have 2 programs follows; first.f90 program first use protocol use mpi implicit none real, dimension(n,m) :: inputdata real, dimension(n,m) :: processeddata integer :: rank, comsize, ierr, otherrank integer :: rstatus(mpi_status_size) call mpi_init(ierr) call mpi_comm_rank(mpi_comm_world, rank, ierr) call mpi_comm_size(mpi_comm_world, comsize, ierr) if (comsize /= 2) print *,'error: assumes n=2!' call

iphone - Determine where is the first zero in a float number -

in app have few random float numbers. have determine, period of zero's start cut number , display in uilabel. so, example, if have number 3.05 displayed 3.0500000 while want displayed '3.05'. the easiest way use length limitation @"%.2f". think if want rim zeroes should use this: nsstring* string = [[nsstring stringwithformat: @"%f", 3.05000000] stringbytrimmingcharactersinset: [nscharacterset charactersetwithcharactersinstring: @"0"]]; will return 3.05 nsstring* string = [[nsstring stringwithformat: @"%f", 3.0500100000] stringbytrimmingcharactersinset: [nscharacterset charactersetwithcharactersinstring: @"0"]]; will return 3.05001 while @"%.2f" return 3.05 you should notice rounding errors, number 3.0500000010000 string 3.05 returned.

Marshal C++ float to C# float accuracy problem -

i have dbase iv database. each row has memo field ascii encoded string holds 2 serialized borland c++ structures. able pull data using oledb, re-encode ascii using asciiencoding class, convert bytes using binaryreader, , cast c# struct using marshal.ptrtostructure. data correct float big in database wrong when cast c#. example, value of 1149.00 cast 764.9844 value 64.00 cast fine. can post of code , structures figured tried keep short @ first. know floats precise 7 digits i'm confused why i'm seeing because values under limit. edit: struct cplusplusstruct // c++ code { int number; float p; float zp; float hours; int month; int day; int year; int hour; int minute; int second; ulong upctime; int b; char name[21]; float l; float h; float s; } [structlayout(layoutkind.sequential, pack = 1)] public struct csharpstruct //the c# struct created { public int number; public float pr; public float zp; pu

c++ - all combinations of k elements out of n -

can provide me link or pseudocode of function finding combinations of k elements out of n? possibly in stl. don't need compute n choose k, need list vectors of numbers of size k. thanks in c++ given following routine: template <typename iterator> inline bool next_combination(const iterator first, iterator k, const iterator last) { /* credits: thomas draper */ if ((first == last) || (first == k) || (last == k)) return false; iterator itr1 = first; iterator itr2 = last; ++itr1; if (last == itr1) return false; itr1 = last; --itr1; itr1 = k; --itr2; while (first != itr1) { if (*--itr1 < *itr2) { iterator j = k; while (!(*itr1 < *j)) ++j; std::iter_swap(itr1,j); ++itr1; ++j; itr2 = k; std::rotate(itr1,j,last); while (last != j) { ++j; ++itr2; } std::rotate(k,itr2,last);

php - How to display only rows that are not empty -

i have small php mysql query looking @ table in database. it's pulling rows , echoing out record. problem have few empty rows in table weird looking record. this got: <?php $con = mysql_connect("localhost","username","password"); if (!$con){ die('could not connect: ' . mysql_error()); } mysql_select_db("username", $con); $result = mysql_query("select * wallnames2011 firstname not null"); while($row = mysql_fetch_array($result)){ echo $row['firstname'] . " - " . $row['city'] . ", " .$row['state'] . " &nbsp;|&nbsp; "; } ?> i want keep empty rows out. try select column_name table_name trim(column_name) not null

Access db jet sql if else in query -

i using microsoft access jet sql. i have table col1 , col2 i want have if else check in select query follows select col1, if(col2 <10) 'less 10' else if(col2 < =20) 'less 20') any quick help iif([col2]<10, "less 10", iif([col2]<=20, "less then20", "something else"))

count decimal places with Access query -

please give me sql count decimal places in unit_price in access 2007 query thank much select sysadm_part.id, sysadm_part.unit_price sysadm_part; i think might (but haven't tried it): select sysadm_part.id, sysadm_part.unit_price, (len([sysadm_part.unit_price]) - instrrev(str([sysadm_part.unit_price]), ".")) decimal_places sysadm_part this educated guess. assumed unit_price number, thats why have converted string. apologies, if wrong. let me know if works, don't have anyway try it!

date format - How to show Persian numbers on ASP.NET MVC page? -

i'm building site needs support both english , persian language. site built asp.net mvc 3 , .net 4 (c#). controllers inherit basecontroller, sets culture "fa-ir" (during test): thread.currentthread.currentculture = new cultureinfo("fa-ir"); thread.currentthread.currentuiculture = new cultureinfo("fa-ir"); in views, i'm using static helper classes convert right timezone , format date. like: dateformatter.tolocaldateandtime(model.createdonutc) i'm doing same money moneyformatter. money, currency prints correctly in persian (or, @ least think don't know persian. verified later on though our translators). same goes dates, month printed correctly. displays currently: for money: قیمت: ريال 1,000 for dates: 21:01 ديسمبر 3 in these examples, want numbers print in persian. how accomplish that? i have tried adding: <meta http-equiv="content-type" content="text/html; charset=windows-1256" /> in he

architecture - What are some architectural best practices to consider when designing a point-based permissions system like uses?

stack overflow has points-based permissions system determines lot of things on site, such can edit , ability add new tags system. what advice, regards architectural implementation, give designing such system? store permissions? how use these permissions determine fields appear editable in view? there open-source code examples study from? with regards ownership or sharing of object model such question or document, pros/cons of storing reference owner on object's model versus storing reference object in account model? e.g. document = { id: 21234, owner_id: 4d3ca9f1c067, shared_with: [a50d1e000138, 4d3ca9f1c067a, 50d1e000138] } vs. user = { id: 4d3ca9f1c067, documents_owned: [21234, 31452, 12312], collaborates_on: [23432, 43642, 12314, 23453] } store permission in separate model permission-required points pairs. in view, determine whether logged-in user has sufficient permissions per item dis

git reports - get changed files -

due bureaucracy, need list of changed files in repository(i started existing source code). what should run list? for files changed between given sha , current commit: git diff --name-only <starting sha> head or if want include changed-but-not-yet-committed files: git diff --name-only <starting sha> more generally, following syntax tell files changed between 2 commits (specified shas or other names): git diff --name-only <commit1> <commit2>

c# - XP cant access Active Directory (System.Runtime.InteropServices.COMException (0x8007203A): The server is not operational at ) -

i have problem cannot access active directory windows xp sp3 machine. server windows server 2008 r2. access ad windows 7 , other machines, xp won't work. i exception... system.runtime.interopservices.comexception (0x8007203a): server not operational @ system.directoryservices.directoryentry.bind(boolean throwiffail) @ system.directoryservices.directoryentry.bind() @ system.directoryservices.directoryentry.get_adsobject() @ system.directoryservices.directorysearcher.findall(boolean findmorethanone) @ system.directoryservices.directorysearcher.findone() i've tried http://www.codeproject.com/kb/ip/storeractivedirectory.aspx other solutions not work. please me. regards denis pointing dns of tcp/ip v4 active directory server solves problem.

Performance ideas (in-memory C# hashset and contains too slow) -

i have following code private void loadintomemory() { //init large hashset hashset<document> hsalldocuments = new hashset<document>(); //get first rows database list<document> docslist = document.getallabovedocid(0, 500000); //load objects dictionary foreach (document d in docslist) { hsalldocuments.add(d); } application["dicalldocuments"] = hsalldocuments; } private hashset<document> documenthits(hashset<document> hsrawhit, hashset<document> hsalldocuments, string query, string[] queryarray) { int counter = 0; const int maxcount = 1000; foreach (document d in hsalldocuments) { //headline if (d.headline.contains(query)) { if (counter >= maxcount) break; hsrawhit.add(d); counter++; } //description if (d.description.contains(query)) { if (counter >

Need Help With Implementing Simple Stuff with PHP and MYSQL -

here code - <?php $u = $_session['username']; while($fetchy = mysqli_fetch_array($allusers)) { mysqli_select_db($connect,"button"); $select = "select * button sessionusername='$u' , response = 'approve'"; $query = mysqli_query($connect,$select) or die('oops, not connect'); $result= mysqli_fetch_array($query); $email = mysqli_real_escape_string($connect,trim($result['onuser'])); echo $email; if($email){ mysqli_select_db($connect,"users"); $select_name = "select name, icon profile email = '$email'"; $query_2 = mysqli_query($connect,$select_name) or die('oops, not connect. sorry.'); $results= mysqli_fetch_array($query_2); $name = mysqli_real_escape_string($connect,trim($results['name'])); $icon = mysqli_real_escape_string($connect,trim($results['icon'])); echo $name; } } now, there 2 reponses in db. so, 2 names getting echoed, both same. why so? eg db

c# - Getting total for a column in ListView -

i need sum items in column within listview. put in following code in itemdatabound event, realized after testing it getting bound, oops. so looking little converting show total column items bound listview. thanks. if (e.item.itemtype == listviewitemtype.dataitem) { listviewdataitem item = (listviewdataitem)e.item; label lblqty = (label)e.item.findcontrol("lblquantity"); if (lblqty == null) { return; } if (lblqty.text.length == 0 || lblqty.text == "") { return; } else { listviewtotal += int.parse(lblqty.text); } } the best method have found implement ondatabinding method control binding. example: <asp:listview id="listview1" runat="server"> <itemtemplate> <asp:literal id="yourliteral" runat=&quo

ios - What is the definition of Convenience Method in regards to Objective C? -

in languages have dealt with, 1 called convenience method, means method small task gets done frequently, , therefore more convenient use said method. in objective-c definition hold true? or used describe class methods return prebuilt object? ex. [nsstring stringwithcontentsoffile:...] is preference thing, or there hard , fast definition these terms? cheers, stefan what talking more "convenience constructor" in objective c. (note it's not constructor in c++/java/c# sense, it's object initializer/factory method, seems convention call "convenience constructors"). "convenience constructors" in obj c convention or pattern creating constructor/initializer/factory method class takes specific parameters. pattern has special conventions should follow (such autoreleasing new object within constructor), custom classes fit in built-in types. see page (a little way down) more info: http://macdevcenter.com/pub/a/mac/2001/07/27/cocoa.ht

How to tell if an Android app is actually leaking memory? -

whilst developing application, noticed crashed because jvm not allocate more memory. using the adb shell dumpsys meminfo command, see allocated native heap grew whilst switching activities until approached 16m, when crashed. believe i've corrected code stop happening, notice figures returned ..meminfo vary bit , in general seem rise now. basically i'm not sure whether should return same values when start , stop application. have these figures , i'm not sure whether signify have memory leak or not: at home screen, application in memory (pid seen in ddms), not running adb shell dumpsys meminfo (relevant pid) gives: native dalvik other total size: 5248 4039 n/a 9287 allocated: 5227 3297 n/a 8524 free: 12 742 n/a 754 (pss): 2183 3534 1726 7443 (shared dirty): 1976 4640 876 7492 (priv dirty): 2040

java - JFrame: get size without borders? -

in java, possible width , height of jframe without title , other borders? frame.getwidth() , frame.getheight()1 seems return width including border. thanks. frame.getcontentpane().getsize();

.net - Reversible string diff (history) algorithms for C#? -

here's interesting question don't know in terms of existing solutions or research in field, though imagine relates field of compression. given 2 potentially large strings of text, 1 represents later version of former, possible (well know it's possible, i'm asking there existing solutions) compare 2 strings , reduce them set of differences later used deterministically reconstruct original strings? in case, i'm interested in storing latest version of string, keeping "compressed" (diffed) historical backups can restored needed, without having store of duplicated information. i don't know tag this, please me out. there no built in classes in clr support diffing. related questions seem have have useful information (i.e. creating delta diff patches of large binary files in c# ). can search on "delta encoding" start (i.e. http://en.wikipedia.org/wiki/delta_encoding ).

R `summary` when not all cells have data -

is there argument in summary (or command) force r calculate values when there "no data" in every cell? in questionnaire subjects did not provide information; , cells entered -nodata- . cells answer not applicable (based on previous question in q.) entered -1 . summary looks this: > summary(qs$esc) -1 -nodata- 0.5 1 12 15 3 49 3 1 1 1 1 1 what want calculated summary. there way tell r disregard -nodata- , -1 ? i don't understand kind of summary want compute. if use na instead of "-nodata-" , "-1" codes, automatically taken account when using summary function : for example : r> v <- c(na, na, 0.5, 1, 12, 15, 3) r> summary(v) min. 1st qu. median mean 3rd qu. max. na's 0.5 1.0 3.0 6.3 12.0 15.0 2.0 r> table(v) v 0.5 1 3 12 15 1 1 1 1 1 you can see here v consi

Is there any way to alias commands in WPF? -

is there way "alias" commands in wpf ? situation : i've created application uses applicationcommands.delete in context of graphical editor has number of customized canvases. of controls on these canvases use textboxes, here's problem : textbox doesn't respond applicationcommands.delete, responds editorcommands.delete. there way cleanly textbox respond applicationcommands.delete without subclassing or manually setting bindings on every textbox instance ? to answer specific question, know of no way cause 2 separate routed commands treated same command. because applicationcommands.delete routed command, after delivered target, textbox , there no command binding, begin bubbling up. simplest solution meets requirements install command binding applicationcommands.delete somewhere inbetween textbox way , possibly including window , implements behavior desire. here's example installs handler on parent grid sends "right" command the fo

SQL REPLICATE - weird results -

perhaps i've been @ few many hours, there odd results of statement. the result of statement (1) datalength(rtrim([last name])) last_name_length is 10. the result of next statement, want use padding last_name column spaces, (2) datalength(replicate(' ', (30 - datalength(rtrim([last name]))))) is 20. you think result of statement, (3) datalength(rtrim([last name]) + replicate(' ', 30 - datalength(rtrim([last name])))) would 30. it isn't. it's 50. result of statement (3) consistently greater of statement (2) 30. it's if i'm using + operator in replicate statement instead of -. i've googled again , again , don't see what's wrong syntax. appreciated. it looks want pad 30 chars, use str select str([last name], 30) original answer below can replicate issue declare @last_name nvarchar(30) set @last_name = '12345' select datalength(rtrim(@last_name)) last_name_length,

c# - How can I get the title of a page on another site? -

pretty long question; how can following in c#: open web page (preferably not visible) check whether page redirects different page (site down, 404, etc.) check if title not equal said string then separately, (they need click confirm button) open browser, , go address of first (it'll one) hyperlink on site. i literally have been looking on google ages , haven't found similar need. whether give me link site tutorial on area of programming or actual source code doesn't make difference me. you use webrequest or httpwebrequest, if want browser ui need use webbrowser control: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.aspx you need handle completion event navigate call load page you: webbrowser mywebbrowser = new webbrowser(); webbrowser1.navigating += new webbrowsernavigatingeventhandler(webbrowser1_idontknow); mywebbrowser.navigate("http://myurl.com/mypage.htm"); you can implement handler follows, , interact

asp.net mvc - Why did my custom HtmlHelpers stop working after I upgraded to MVC3? -

i finished going through checklist upgrade asp.net mvc2 site mvc3: http://www.asp.net/learn/whitepapers/mvc3-release-notes#upgrading everything compiling, when run application errors in views. example view: <%@ page title="" language="c#" masterpagefile="~/views/shared/site.master" inherits="system.web.mvc.viewpage<genesis.domain.entities.streamentry>" %> <asp:content id="content1" contentplaceholderid="titlecontent" runat="server"> <%: model.setitle %> </asp:content> <asp:content id="content3" contentplaceholderid="metacontent" runat="server"> <%: html.getmetatag("description", model.sedescription )%> <%: html.getmetatag("keywords", model.sekeywords )%> </asp:content> <asp:content id="content4" contentplaceholderid="headlinecontent" runat="server"> &

c# - Excel Interop: Quitting the Excel application instance makes my tests fail? -

i want encapsulate use of excel interop make easier use somehow in reuseable library. so far, have written tests work altogether, except between each test, force excel quite have handle on test file no more in order able delete. once quit application instance between after each of tests, excel seems no longer responding, causing windows display "excel has stopped working , looking solution" message. message lasts few seconds, meanwhile excel closing, causing hang on file occur , tests throw exception "cannot access file because being used process..." message. otherwise, each of tests run individually fine! any clue on how solve issue? do overuse applicationclass.quit() method? quitting excel once testing through tests causes files created tests purpose not deleteable. thanks! =) if you've made changes workbook "do wish save changes?" dialog holding things up. try setting _workbook.saved property true prior q

android - How to combine two opaque bitmaps into one with alpha channel? -

i have png file transparency i'm using opengl texture. load in bitmap bitmapfactory.decoderesource , upload gpu. the png file quite big , in order cut down on apk size, i'm trying use 2 jpgs instead--one rgb data, , other alpha channel (grayscale). how combine 2 jpgs in 1 bitmap object alpha channel? tried loading alpha channel bitmap.config.alpha_8 , drawing them on top of each other using canvas no luck far. have @ kevin dion's answer this related question . explains how combine 4 separate images (r, g, b , channels) should able adapt work 2 images.

html - positioning and glitchy navigation button issue -

i working on website , want have navigation bar set bottom right hand corner of div. have gotten in place, however, every time hover on button weird glitch occurs places hover'ed buttom right position. can't seem figure out solution issue (whatever needs ie friendly). tested in chrome, ff, , safari. same. <!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <title>untitled document</title> <style> #head { width: 80%; height: 80px; position:relative; margin-left:auto; margin-right:auto; background: #56a0d3; background-image:url(/image/bubblestall.gif); z-index: 5000; padding-top:5px; color: #ffffff; } .menu { float:right; width:80%; positio

c# - WCF Security License Scenario -

we trying build best security scenario our case. one company can install our software in multiple computers. 1 company can buy multiple licenses can shared between employees. every time 1 employee wants use our software, he/she able see popup screen licenses company has bought shown. then, if license being used, employee able see using it. no password has entered in order see company licenses. there need distinguish licenses company has bought. when user wants use license (use application), have enter own password. the connection between wpf application , server done using wcf service. there must kind of token check if connection server still possible every 5 minutes otherwise application close. what have thought here deploy 1 certificate every company. whenever company authenticated using certificate, able show company licenses whenever application launched. then, when user wants open application, select 1 license, , password box prompted. authentication done using sq

c# - Why doesn't/couldn't IDictionary<TKey,TValue> implement ILookup<TKey,TValue>? -

i suppose doesn't matter, i'm curious. if difference between dictionary , lookup 1 one-to-one , other one-to-many, wouldn't dictionary more specific/derived version of other? a lookup collection of key/value pairs key can repeated. dictionary collection of key/value pairs key cannot repeated. why couldn't idictionary implement ilookup? i suspect because intention different. ilookup<t,u> designed work collection of values. idictionary<t,u> intended work single value (that could, of course, collection). while could, of course, have idictionary<t,u> implementations implement via returning ienumerable<u> single value, confusing, if "u" collection (ie: list<int> ). in case, ilookup<t,u>.item return ienumerable<list<int>> , or should type of check ienumerable<t> value type, , "flatten" it? either way, it'd confusing, , add questionable value.

How to call a CGI function on HTML button click -

i have html form. have submit button calls cgi script(function), defined , declared in c file. similarly, want call "save function"(cgi script) on save button click. so, question how can call cgi script on button click on html form. i newbie html , cgi, need implement this. you need send data of html form cgi file via or post request. example; <form action="cgi-bin/save.cgi" method="post"> when click save button, it'll call save.cgi

hash - Diff of hashes with a correction factor in Ruby for dynamic hashes -

similar question how create diff of hashes correction factor? want compare hashes inside array hashes can dynamic. h_array = [ {:roll => "1", :name => "saroj", :class => "mscit"}, {:name => "saroj", :class => "mscit", :roll => "12", :attendance => "p"}, {:class => "mscit", :roll => "12", :name => "saroj", :attendance => "f", :remarks => "something"} ] get_diff(h_array, correct_factor = 2) # should return # matched :: {:class=>"mscit", :roll=>"12", :name=>"saroj"}, # unmatched :: {:attendance=>"f", :remarks=>"something"} get_diff(h_array, correct_factor = 3) # should return # matched :: {:name=>"saroj"}, # unmatched :: {:class=>"mscit", :roll=>"12", :attendance=>"f", :remarks=>"something&q

swing - How can I get mouse location out of my java application? -

i've used class mouseinfor,but can location on interface of app. how can mouse location out of app? , read similar questions on site. somebody said use jni or api interact o.s. so,is there api available or how use jni? thanks helping. i think answer looking this . hope correct, apologise if not.

installer - How can I have different properties and such in a vs 2010 setup project for the for two different release versions? -

what want have 1 setup project in solution, , want able install 'release1' , 'release2' versions (as in versions debug/release1/release2) simultaneously on 1 machine. so, release1 version needs own program folder, product code , shortcuts , such, , release2 version needs own unique versions of these things too. it seems setup project doesn't store seperate properties 2 different release versions. seems thats different output path, , of course use different generated exes. am going have move wix solve problem? or there simple i'm missing here? seems kind of stupid can't configure installer different things 2 different release versions. far looking i'll have make setup project, going annoying because don't having maintain 1 setup project let alone 2. thanks in advance help. isaac creating 2 different setup projects, 1 called production setup , 1 called test setup might cleanest way, since makes os believe delivering 2 different p