Posts

Showing posts from January, 2010

C# LINQ - sort and group a Dictionary<string,DateTime> by date with maximum group size -

i looking created batches dictionary<string, datetime> following constraints: all items in batch share same date there can no more x items in single batch. if there more items same date, batch must created. i have worked out following logic, wondering if there other more succinct way of doing linq. using system; using system.collections.generic; using system.linq; using system.text; namespace dictionary_sort_by_value_test { class program { static void main(string[] args) { int maxbatchsize = 3; dictionary<string, datetime> secs = new dictionary<string, datetime>(); secs.add("6571 jt", new datetime(2011, 1, 10)); secs.add("6572 jt", new datetime(2011, 1, 12)); secs.add("6573 jt", new datetime(2011, 1, 12)); secs.add("6574 jt", new datetime(2011, 1, 12)); secs.add("6575 jt", new datetime(2011, 1, 10

asp.net - adding signature in a pdf file -

possible duplicate: adding digital signature pdf file 1). user upload pdf file 2). , upload signatures 3). embed signature in pdf file you going need pdf editing library. i've used pdfsharp in past , works well. http://pdfsharp.com/pdfsharp/

Print defined content using Javascript -

Image
i used the solution question shows url on document. there no way remove url within html page. you'll need change in printing settings of browser - if browser allows to.

Which is the maximum selectables rows in mysql with c#? -

hello developening c# app selecting , comparing data on db, on table has more 500'000 records. using mysql connector, , going : select * table from table. question is: recommended use select * without limit? can process gives problem if select 500000 records @ once, or should user limit selecting records in groups? asking beacause in vb got problems kind of select, makes stops program. thanks all. edit : select function: public object[] queryselect(string query) { idbcommand dbcmd = dbcon.createcommand(); dbcmd.commandtext = query; idatareader reader= dbcmd.executereader(); arraylist result = new arraylist(); while (reader.read()) { hashtable ht = new hashtable(); int fieldcount = reader.fieldcount; (int = 0; < fieldcount; i++) ht.add(reader.getname(i), reader[i]); result.add(ht); } reader.close(); return result.toarray(); } i suppose use sqlcommand.executereader , sqld

c# - How to encrpyt / decrypt data in chunks? -

i'm quite new c# , encryption please have patience me. want save binary data ("objects" - in fact parts of objects, can't / don't use serialization, binarywriter , similar) , want encrypt in memory , write using filestream. @ first wanted use sort of xor didn't know easy break, changed code use aes. the thing have relatively large files , quite need change or read 32 bytes of data. must capable of encrypting 1 chunk of data , capable of decrypting desired chunks of data. came following solution. when saving data loop through data , inside loop encrypt chunk of data , write file. while reading, have loop reads chunks of data , inside loop have declare decryptor, find inefficient. here's code encryption & saving: //setup file stream saving data filestream fstream = new filestream(filename, filemode.openorcreate, fileaccess.write, fileshare.read, 1024, false); //setup encryption (aes) symmetricalgorithm aes = a

performance - c# program very slow and hangs mstsc -

i'm building c# program company. when test program company's laptop runs smooth , stable. when run program on microsoft terminal client, on listview can have around 1000 rows , 5 or 6 columns starts slow way down until nothing responds , terminal client unusable. code form 1000 lines. what can improve performance? code inefficent or there limitations on mstsc have take in considiration? you need tune down mstsc experience settings: run mstsc, click on options>> button. goto experience tab. either change connection speed or turn off of options (particularly "menu , window animation") you can save these settings default or save rdp file particular connection don't need tweak these every time.

php - Symfony sfGuardPlugin password recovery -

i supporting site built on symfony. there problems regarding kind of "admin page". while not knowing whole thing reading logs , comparing recent backups think able fix issue (some developer removed route, did not fix template). i not have admin password site, have root access server , super access database (in case postgres). can me how create myself account without knowing current passwords? disclaimer: not have knowledge php's oop interface not programmer, sysadmin. edit : symfony version 1.0.16 try logging server , changing symfony project's root directory. there's "symfony" script/link there (the details depend on os , how symfony's set up; might able run ./symfony rather needing php symfony ). run see whether basics working: php symfony if works, should list of possible tasks can do. if you're using sfguardplugin, should see tasks guard:create-user . to more information on task, try like: php symfony guard:c

python - Simplest way to switch the linux users through the web (django) without sudo? -

aim: create user friendly web interface linux program without ssh (console) terrible stuff. have chosen python + django + apache. problem: user should login through browser linux user , user`s requests should served on behalf of linux user. now, server run root , when user login through browser, server root can switch required user using django user name: uid = pwd.getpwnam(username)[2] os.setuid(uid) and can execute django stuff on behalf of appropriate user. the problem server must run root! how provide possibility run server usual apache user rights providing login linux user through browser? (just user name , pwd http post request , login appropriate user using python)? update: need map user via web specific linux user give him home directory execute specific linux program specific user! guess realized in webmin? possible solution: execute "su username" doesn't work without terminal: p = subprocess.popen(["su", "test"], std

c++ - Thread notification when boost::interprocess::mapped_region is changed -

how can notified when bytes in boost::interprocess::mapped_region changed using interprocess_condition. i have opened file, , have mapped specific region correctly. when poll , print memory, update has been successful. want notified of change rather continuously polling. how use interprocess_condition notify thread memory has been changed?

android - Pinch zoom not working in landscape mode when webview is not full screen -

i have webview in local html page show. works fine , in landscape mode can use zoom controls pinch zoom cannot done please help i had suggested create in xml file layout-land, instance i have myuserinterface.xml file, in file, had created webview component, pls create same file in layout-land, landscape mode, , check problem exists if had worte device compatibility such layout-hdpi, layout-mdpi,layout-ldpi layout-hdpi-land, layout-mdpi-land,layout-ldpi-land

iphone - iOS Navigation Bar in tab bar controller doesn't rotate properly -

i have tab bar controller 2 tabs both contain views navigation bar controllers. when display app in portrait fine, when display first tab in portrait, rotate device , display second tab in landscape, navigation bar of second view stretches while first stays in 'portrait size'. have been able replicate in basic project i've uploaded rapid share i guessing easy fix. thanks in advance! found answer. had view each tab navigation controller within view. changing tab view navigation controller instead, resolved error. basically, original setup tab navigator -> view -> navigation controller this changed tab navigator -> navigation controller it works correctly now.

WCF architecture: using callbacks, events, 2x service-client? -

i have main application installed ( serverapp ) on lan server (which behind firewall, server can access internet cannot accessed internet directly (no static ip)), , monitoring application ( monitorapp ) on pc outside lan , directly connects internet. serverapp should send notification events (basically statistics) monitorapp in timely manner (every 1-2 seconds). performance critical factor in app, have possible reduce traffic. how can make connection between these 2 applications? able use wcf callbacks in scenario? (considering cannot see server directly monitorapp ). is there performance preference in using using wcf service , client on 1 side , wcf service , client on other side opposed wcf callback contract. 1 thing guess have to use 2x client-services in both sides because have use basic httpbinding pass firewall. any general guidelines on how implement it? if plan write application monitorapp , able send commands serverapp (for clarification, let's name

tsql - How to count detail rows on nested categories? -

let consider have categories (with pk categoryid) , products (with pk productid). also, assume every category can relate parent category (using parentcategoryid column in categories). how can category wise product count? parent category should include count of products of of sub-categories well. any easier way do? sounds asking use rollup select cola, colb, sum(colc) sumc table group cola, colb rollup this give sum colb , rollup sum cola. example result below. hope formatting works. null values rollup sums group. cola colb sumc 1 1 1 b 4 1 null 5 2 c 2 2 d 3 2 null 5 null null 10 give go , let me know if has worked. --edit ok think ive got working on small test set using. ive started see place need myself asking question. admit bit messy should work number of levels , return sum @ highest level. i made assumption there number field in products. with x ( select c.category

Android browser code -

how can @ browser's code , see how plays videos embedded using tag? please help the page android source code here: http://source.android.com/source/index.html you need dig git repository...

How to release selection in Photoshop? -

i selected space using "quick selection tool" in photoshop, did wanted , want release selection , else. how can release selection? press ctrl+d or click somewhere on canvas.

c# - DataTrigger on a specific Type -

i have scenario need specify functions like void somefunction(int value) for i'm using 2 datagrid s. the left datagrid holds functions the right datagrid holds parameters selected function i want parameter datagrid enabled when valid function selected in function datagrid . if newitemplaceholder (the last row when canuseraddrows="true" datagrid ) selected or if selection empty want disabled. experimentet datatrigger couldn't work <style targettype="datagrid"> <setter property="isenabled" value="false"/> <style.triggers> <datatrigger binding="{binding elementname=functiondatagrid, path=selecteditem}" value="{x:type systemdata:datarowview}"> <setter property="isenabled" value="true"/> </datatrigger> </style.triggers> </style> is po

wordpress - Why does WP auto-complete the a-tag? -

if write post or page containitg: <a href="#something"> bla </a> wp autocompletes with <a href="http://www.thewholedamnpath.com/?page_id=291#something">bla</a> i sincerely don't need feature, so, way bypass it? found solution: http://wordpress.org/extend/plugins/raw-html/ using plugin chunk of code can wrapped inside [raw]...[/raw] tags, , code remain untouched wordpress.

jquery - Getting dropdown to back back to normal when an item is clicked -

i have following script works will: http://jsfiddle.net/oshirowanen/uuaqe/ i need make change the .navigation , .dropdown go normal when .items clicked. right .navigation , .dropdown back normal when .navigation clicked again. i add code below: $('.items').click(function() { $(this).parent().toggle(); $('.navigation.active').removeclass('active'); }); you need add toggle drop down related current item, , remove class 'active' current navigation item.

Looking for a .NET COMET server solution available for use with non-browser-based clients -

i have been asked implement comet server app able communicate our customer's java client app using standard comet server "push" messaging (the client app send http request our server , our server app need hold connection open in order "push" data client app). customer has requested data received formatted in specific manner (not using json). need able convert data being sent client big endian byte order prior being sent. i implement server app in .net, having difficulty finding .net comet server/library solution work our needs. i've looked @ of suggested .net comet solutions, of these either appear developed browser-based clients (using javascript) or else appear limited in format of data server can push client (websync). are suggestions? . the ws-i group published called "reliable secure profile" has glass fish , .net implementation apparently inter-operate well. with luck there javascript implementation out there well. th

ruby on rails - How to use different rails_env with nginx, passenger and redmine -

i need have redmine running in combination nginx, phusion passenger , mysql. because of project requires several instances of redmine, should realized using different rails_env, tried set them in different server vhosts nginx. example of 1 vhost: server { listen xxxx; server_name redmine.xxxxx; root /xxxxx/redmine/public; passenger_enabled on; rails_env production; } same goes other server vhost, there server_name matched other domain , rails_env set internal. the problem is, nginx uses 1 of both rails_env both redmine instances, not 1 each. advice how use different rails_env same application, nginx , phusion passenger? thanks i think you're having same problem had. want use same physical directory host application instances want interact app under different environments (development/production) using different dns entries (redmine.development / redmine.production)??? the problem passenger recognizes incoming request using rails app foun

symfony1 - Symfony Embedded Relation Many2Many - linking unique fields or creating new fields -

i'm using embedded relation allow user edit/add books library , in same form add/remove n authors wrote book within auto generated admin. here problem: authors name unique, when enter author exists sfvalidatordoctrineunique produces error. an object same "name" exist. what want catch error , tell form not try add exisiting author anew. do use event system that, or modify validators or how can that? thank hoodie ps: after searching found might solution haven't made work yet http://symfonyguide.wordpress.com/2009/09/28/symfony-forms-saving-process/ i opinion should not add new author if exists. sfdoctrineactastaggableplugin same way. searches existing tags , merge them current (added user form) tags. but here 1 issue: 2 authors - aleksander pushkin , alexander pushkin, same authors us, different machine.

oracle - Working with Multi-Select Drop Downs -

i have multi-select drop down list in user can select multiple options, how can pass multi-select options select query. code select number table(get_number(('('1','2','3','4','5')','7','8'))); where 1, 2, 3, 4 , 5 multi-select options selected multiselect dropdown box. in get_number function passing count_number, role_number , test_id. count_number represents multi-select options user select. question how can consume multi-select values user entered in get_number function, not sure if possible need define count_number array in get_number function ? it not clear you're trying achieve. below example of function uses arrays parameter , output. sql> create or replace type tab_number table of number; 2 / type created sql> create or replace function get_number (p_array tab_number) 2 return tab_number 3 4 l_result tab_number := tab_number(); 5 begin 6 in 1..p_array.cou

flash as3 - how do I find an object's index in an array -

how find object's index / position within array in flash actionscript 3? trying set conditional in loop where, if object's id equal current_item variable, can return position within array. something might - example returns position of value 7: private var _testarray:array = new array(5, 6, 7, 8, 9, 8, 7, 6); public function arraytest() { trace (_testarray.indexof(7)); //should output 2 } so needs: item variabletolookfor = 9 // variable here private var _testarray:array = new array(5, 6, 7, 8, 9, 8, 7, 6); public function arraytest() { trace (_testarray.indexof(variabletolookfor)); //should output 4 } this return -1 if item doesn't exist, otherwise output position in array. if need more information can check here article on as3 arrays.

c++ - Good Practice: To Modify Only Function Parameters? -

say, develop complex application: within object member functions, should modify objects, passed member functions parameters, or can access , modify other objects have access to(say public or static objects)? technically, know possible modify have access to. asking good practices . sometimes, bothering pass argument everythying access , modify, if know object member function not used else, me. thanks. global state never idea (though simpler, example logging), because introduces dependencies not documented in interface , increase coupling between components. therefore, modifying global state ( static variables example) should avoided @ costs. note: global constants okay in c++, have const keyword, document (and have compiler enforce) can modified , cannot. a const method guarantee visible state of object untouched, argument passed const reference, or value, not touched either. as long documented, fine... , should strive having few non- const methods in class i

ios4 - uilabel with outline or stroke -

Image
this question has answer here: how make uilabel display outlined text? 11 answers i wondering how can create text stroke uilabel ? there possible way ? thank , #import <foundation/foundation.h> @interface customlabel : uilabel { } @end #import "customlabel.h" @implementation customlabel - (void)drawtextinrect:(cgrect)rect { cgsize shadowoffset = self.shadowoffset; uicolor *textcolor = self.textcolor; cgcontextref c = uigraphicsgetcurrentcontext(); cgcontextsetlinewidth(c, 22); cgcontextsettextdrawingmode(c, kcgtextstroke); self.textcolor = [uicolor whitecolor]; [super drawtextinrect:rect]; cgcontextsettextdrawingmode(c, kcgtextfill); self.textcolor = textcolor; self.shadowoffset = cgsizemake(0, 0); [super drawtextinrect:rect]; self.shadowoffset = shadowoffset; //works fine no warni

c# - How to Create a Class That Can Have Parent and Child Relationship -

i have seen quite few articles on here question none answer asking. creating class of branch objects can envision treenode objects of treeview control. each branch can have number of branch children below (and therefore above) it. here rather simple class: public class branch { public string name { get; set; } public string link { get; set; } public branch parent { get; private set; } public list<branch> children { get; set; } internal branch(string name, string link) { this.name = name; this.link = link; this.children = new list<branch>(); } // branch - constructor - overload internal branch(string name, string link, list<branch> children) { this.name = name; this.link = link; this.children = children; this.children.foreach(delegate(branch branch) { branch.parent = this; }); } // branch - constructor - overload public bool haschildren {

emulation - Synchronization failed: access denied to azure compute emulator -

it seems azure compute emulator not inherit permissions visual studio process. how can correct ? are running visual studio administrator? if not ,you won't able connect emulator.

php - How can I identify the currency symbol in a string that has both symbol and value in? -

i'm getting data script via xml (not important)... part of data value amount includes currency symbol , amount, example: ["price"]=> string(6) "$65.00" ["price"]=> string(8) "€14.20" now, i'm looking way automatically work out bit currency symbol , bit value. can't guarrantee quality of data coming in, example amount £14,000.22 or symbol may not single letter - ie swiss francs - chf. can point me in right direction? tried code worked dollar symbol not euro symbol: if (preg_match('/\p{sc}/',trim($price),$matches)) { var_dump($matches); } output array(1) { [0]=> string(1) "$" } for reference looked @ http://www.xe.com/symbols.php list of worlds currency symbols. i not sure exact source data dealing with. however, in accounting, there different formats different currencies. example currencies prefix currency symbol. others suffix symbol. depending on language of c

iphone - Core Data with parallel operations -

i new core data world , using ios 4 base framework , using core data perform operation against local sqlight db, designing offline application @ point when user come online need pull updated data server , push same local db, plus @ same time user might performing inserts , updated same db through ui well. so there 2 sets of operations happening on same db on same time 1) user doing inserts or updates through ui views 2) synchronization engine running in background might pulling data , pushing local db in such situation there might issue shared managed context being saved [with [context save:&error];], because there possibility context might end saving wrong data. i think of having 2 solutions same 1) creating persistent store pointing same db, doing lead high memory consumption on device 2) creating different thread synchronization engine, not sure how deal it. can guys please shade light on this, or thinking in wrong direction? thanks ajay sawant per

wpf - How do I use the correct Windows system colors? -

Image
i want use xaml style wpf button "mixer" , "change date , time settings..." text of these windows 7 notification area flyouts. does property of systemcolors define color? which? <setter property="foreground" value="{dynamicresource {x:static systemcolors.????}}" /> the best method i've found experimentation , guessing. i created little utility visualize these colors. interface xaml <window x:class="systemcolors1.mainwindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" title="system.windows.systemcolors" height="350" width="525"> <window.resources> <datatemplate x:key="cellcolor"> <dockpanel> <textblock> <textblock.background>

git - GitHub - prevent collaborators from using push -f -

is there way prevent force push branch or repository? i want stop important branches having history rewritten either accidentally or intentionally. how people deal in larger development teams? ideally, in view, possible lock few branches per repository, , prevent everyone, other repository owner doing force push them. this easy git pre-receive hook. of course, requires able install hooks, , obvious reasons, github doesn't allow upload arbitrary executable files run on servers :-) in general, workflow git or distributed version control system, don't allow other people push repository. instead, pull theirs. requires lower level of trust. so, workaround number 1: don't let them push, have them fork , pull them. way, can control goes repository. another workaround set own staging repository on server own, can install own git hooks. can configure pre-receive hook denies pushing if it's not fast-forward , post-receive hook automatically forwards pu

jquery - Printing next Page Javascript -

is there way print page gets openned using target="_blank" javascript (or jquery) instead of printing current one? no. window opened using target="_blank" has no programmatic connection page opened from. if opened window.open return value of call reference window, use print method (subject same origin policy). that said, can't think of reason not better served print media style sheet.

javascript - scrape parent page html from iframe -

i have iframe used generate pdf parent page. pdf maker (abcpdf) requires html file converts. what @ present scrape parent's html using: var temp; temp=parent.document.body.parentnode.innerhtml; then use form in iframe submit server massaged remove things iframe sections before being saved temporary html file pdf maker. however resulting html code mangled, <body> instead of <body> etc , quotes around ids removed etc. is there better way grab html? the reason don't regenerate page html parent page complex report. contains various controls allow user show/hide sections or sort rows in tables. html has reflect user customisations. thanks as david mentioned, using innerhtml , you're pretty @ browser's mercy. if want have control on serialization, walk dom of parent document yourself, appending string representation of nodes buffer. take longer , involve more code, result in full control on output. something (pseudocode): function

Just starting to use Java which IDE is better for me to start out? -

i learning java (yay) in spare time , have started several different tutorials. tutorials use netbeans, use eclipse. android development because getting smart phone @ end of year. fyi: earned commentator badge. update::::::::i have earned "notable question" , "editor" badges respectively 2nd update::::soon after earning 2 badges noted in previous update, earned scholar badge. if first programming language, it's matter of best. try netbeans; if it, keep using forever, or until start hating or doesn't need. if don't it, try eclipse. rinse, repeat. away using simple text editor , javac in command line. it comes down preferences , needs @ time. if, example, starting learn php first language, i'd tell use notepad++. you're going want support debugging, version control, phpdoc, etc. you'll outgrow notepad++ , graduate zend studio or similar; now, don't need bells , whistles. personally, i've used netbeans (for java

java - Asking the db engine to suggest index creation/deletion -

is there way query db suggest index creation/index deletion improve performance of db system? we understand dba can manually view trace files create/drop indices can write java program queries db engine suggest same automatically. or open source tools can check out perform same automatically. thx. well there's no standard jdbc way this. there may specific driver implementations specific dbs allow explain query (trace use of indexes), etc. there's no one-size fits answer here. in general lean saying no.

.net - Axis2/Rampart and WCF -

i'm trying setup client using axis2/rampart create ws-security call wcf .net service hosted client. my client receiving error: 'the message received on transport security has unsigned 'to' header.' does have ideas problem? needed specify e.g. <signatureparts>{element}{http://schemas.xmlsoap.org/soap/envelope/}to</signatureparts>

objective c - Determine if a float number is irrational of a fraction -

i have random float number , have determine if irrational number √2 or fraction 123/321. both of them represented endless set of numbers anywhere there way whether number fraction or it's irrational? thank you! all floating point numbers rational because mantissa has fixed length. irrational numbers stored in floating point truncated rational numbers. if have specific list of numbers need match, can compare random number numbers on list @ set floating point precision, keep in mind false positives due truncation or rounding.

iphone - Core data: any way to fetch multiple entities? -

i'm getting started core data, , learning exercise i'm building app need display different types of objects in single table view. as example, have entity "cheese" , unrelated entity "pirate". on main screen of app, user should able create either "cheese" or "pirate" instance add table view. so, using core data editor i've created entities cheese , pirate... however, nsfetchrequest seems allow retrieve 1 type of entity @ time with: nsfetchrequest *fetchrequest = [[nsfetchrequest alloc] init]; nsentitydescription *entity = [nsentitydescription entityforname:@"cheese" inmanagedobjectcontext:_context]; [fetchrequest setentity:entity]; is there way perform fetch retrieves "cheese" , "pirate" objects? thanks. what you're trying accomplished defining entity inheritance in model, "displayableobject" abstract class defined parent of "cheese" , "pirate". th

ruby on rails - Problems with tiny_mce skins -

i having controller blogs , im using tiny_mce there. my app consists of clans, belongs_to clandesigns, clandesigns have column clandesign.tinymce_skin blogs belong_to clan http://pastie.org/1599354 my problem is, use setting in controller: current_user.nick, get: //<![cdata[ tinymce.init({ editor_selector : 'mceeditor', language : 'en', mode : 'textareas', plugins : "spellchecker,pagebreak,layer,table,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template", skin : '{current_user.nick}', spellchecker_rpc_url : '/blogs/spellchecker', theme : 'advanced', theme_advanced_buttons1 : "bold,italic,underline,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,formatselect,fontselect,fontsizeselect", theme_advanced_buttons2 : "search,replace,bullist,nu

java - Replace text inside Wicket AjaxLink -

i have created new ajaxlink in .java file add(new ajaxlink("link"){ private static final long serialversionuid = 1l; @override public void onclick(ajaxrequesttarget target) { target.appendjavascript("window.open('http://www.cnn.com/2011/world/africa/02/23/libya.protests/index.html?hpt="+t1+"')"); }

Ajax Broken in Browsers works in Android -

i can run code in android app (using phonegap adn jquery mobile) not on desktop browsers. gives me syntax error in firebug line = var ticketlist = eval("(" + ajax.responsetext + ")"); here code // jscript source code // ran on body load function dojsstuff() { var ajax = ajax(); ajax.onreadystatechange = function () { if (ajax.readystate == 4) { var ticketlist = eval("(" + ajax.responsetext + ")"); if (ticketlist.listcount > 0) { document.getelementbyid("opencount").innerhtml = ticketlist.listcount +" open tickets"; (ticket in ticketlist.tickets) { // add stuff dom //addtickettolist(ticketlist.tickets[ticket]); } } else { document.getelementbyid("opencount").innerhtml = "all tickets reviewed"; displaynoresults();

android - How to use prepopulated database in listview -

i'm trying put app uses prepopulated sqlite database when loaded, populate list view. i'm new android , have been using guides online me through. using examples site: http://www.reigndesign.com/blog/using-your-own-sqlite-database-in-android-applications/ i unsure how set start populating data list view. pointers or examples helpful. public class databasehelper extends sqliteopenhelper{ //the android's default system path of application database. private static string db_path = "/data/data/com.example.testsqllite/databases/"; private static string db_name = "testdatabase"; private sqlitedatabase mydatabase; private final context mycontext; public databasehelper(context context) { super(context, db_name, null, 1); this.mycontext = context; } public void createdatabase() throws ioexception{ boolean dbexist = checkdatabase(); if(dbexist){ //do nothing - database exist }else{ //by calling method , emp

postgresql - Two different group by clauses in one query? -

first time posting here, newbie sql, , i'm not sure how word i'll try best. i have query: select report_month, employee_id, split_bonus,sum(salary) empsal report_month in('2010-12-01','2010-11-01','2010-07-01','2010-04-01','2010-09-01','2010-10-01','2010-08-01') , employee_id in('100','101','102','103','104','105','106','107') group report_month, employee_id, split_bonus; now, result of query, want add new column split_bonus_cumulative equivalent adding sum(split_bonus) in select clause case, group buy should have report_month , employee_id. can show me how single query? in advance. assuming you're using postgres, might find window functions useful: http://www.postgresql.org/docs/9.0/static/tutorial-window.html unless i'm mistaking, want resembles following: select report_month, employee_id, salary, split_bonus, sum

Sum of each column opencv -

in matlab, if matrix, sum(a) treats columns of vectors, returning row vector of sums of each column. sum(image); how done opencv? for 8 bit greyscale image, following should work (i think). shouldn't hard expand different image types. int imgstep = image->widthstep; uchar* imagedata = (uchar*)image->imagedata; uint result[image->width]; memset(result, 0, sizeof(uchar) * image->width); (int col = 0; col < image->width; col++) { (int row = 0; row < image->height; row++) { result[col] += imagedata[row * imgstep + col]; } } // desired vector in result

c# - Identifier for a Windows GUI element (AutomationElement HashCode and RuntimeID) -

i looking way identify instances of gui element (for example "copy" entry in context menu of windows explorer). i tried both .gethashcode , .getruntimeid method on automationelement , both change each time open context menu. what difference/purpose between runtimeid , hashcode anyway? any ideas how identfy gui element without comparing label/name string? there various ways, under automationelement class able inspect "current" element , use combination of ways determine element. following example taken solution see here using system.window.automation; private automationelement element; system.drawing.point mouse = system.windows.forms.cursor.position; this.element = automationelement.frompoint(new system.windows.point(mouse.x, mouse.y)); from here able access element.current , extract things such name, processid. although may have figured out, following code should class name of current ui item, not part of automationelement class , w

flex - Calling one MXML from AS code -

i creating air application, mainapp.mxml has button , vbox. when clicked on button, child.mxml should displayed in vbox. would appreciate if code in flex , easy me modify tags. can me how please! in advance add click handler button, in handler create instance of child , add vbox: <mx:button id="mybutton" label="my button" click="mybutton_clickhandler(event)"/> and handler: function mybutton_clickhandler(event:event):void { var child:child = new child(); myvbox.addchild(child); }

file get contents - Error using file_get_contents in PHP -

has seen before. if go page ( http://thamessailingclub.co.uk/news.php?type=news&source=google%20boating%20news ) , @ page source, there no errors. however, if retrieve url in php using: file_get_contents($url) ; ...there (sql) errors on page! weird how can sql return errors in 1 case , not other? breaking test suite. 90% of probabilty it's issue related http headers. file_get_contents doesn't send headers browser , broke query.

eclipse - 2 set of android API since last R10 update -

i installed new r10 tools , when create new project, have 2 choices each api level. example: api level 8 have following choices: taget: android 2.2 vendor: android open source project platform: 2.2 api level: 8 taget: google apis vendor: google inc. platform: 2.2 api level: 8 any idea why ? answering own question. it looks google inc add-ons got installed. uninstaled them. here related question: what google add-ons ???

.net - WPF - How to clear selection from ListView? -

this seems should simple, can't seem work. i'd programatically clear selection of selected item in listview. i've tried setting selectedvalue null, setting selecteditem null, setting selectedindex -1, , tried calling unselectall method. in each , every case, selecteditems.count still equal one... any ideas? you must put empty collection listview.unselectall(); i have read question again. if not work, problem may binding. listview bound??

java - What is the difference between a += b and a =+ b , also a++ and ++a? -

as mentioned in title, what difference between += b , =+ b , a++ , ++a ? i'm little confused a += b equivalent a = + b a = +b equivalent a = b a++ , ++a both increment a 1. difference a++ returns value of a before increment whereas ++a returns value after increment. that is: a = 10; b = ++a; //a = 11, b = 11 = 10; b = a++; //a = 11, b = 10

colors - How do I make a lighter version of a colour using PHP? -

hello fellow earthlings. quesion rgb color , usefulness in simple tiny php code: imagine have variable $colora containning valid 6 char color. b1b100 , greenish natural color. if make new color that, is, say, ten steps lighter thatn original color, roughly. $colora = b1b100 // original color php code little color engine lightening stuff goes here $colorb = ?????? // original color lightened is there php ready function knows rgb colors like php function rgb ( input color, do, output color) +/- 255 values of brightness etc etc. is possible or day dreaming? rgb-hsl($colora, +10, $colorb); if not exist, shortest code doing this? suggestions, code or ideas answers me. thanks. this question has full-blown php script can convert rgb hsl colour, , increase h component of hsl colour - should trivial change increase l instead.

javascript - Does Ajax - cross domain request return the request header? -

i know ajax-cross domain call not return data server. however, return http header, 200, 404..etc? it doesn't fire request. if did, csrf impossible stop... you can read more here , here but, if want fetch content different source, check out jsonp

Embedding a Low Performance Scripting Language in Python -

i have web-application. part of this, need users of app able write (or copy , paste) simple scripts run against data. the scripts can simple, , performance minor issue. , example of sophistication of script mean like: ratio = 1.2345678 minimum = 10 def convert(money) return money * ratio end if price < minimum cost = convert(minimum) else cost = convert(price) end where price , cost global variables (something can feed environment , access after computation). i do, however, need guarantee stuff. any scripts run cannot access environment of python. cannot import stuff, call methods don't explicitly expose them, read or write files, spawn threads, etc. need total lockdown. i need able put hard-limit on number of 'cycles' script runs for. cycles general term here. vm instructions if language byte-compiled. apply-calls eval/apply loop. or iterations through central processing loop runs script. details aren't important ability stop running af

Run ruby IRB for Ruby on rails from Aptana studio and/or radrails? -

i happy ruby on netbeans (6.9) user until learned nb (oracle) no longer supporting ruby, in future releases. so, i'm trying out aptana w radrails plugin. far trasition has been little tricky, seems okay. but, haven't figgured out how run ruby irb ruby on rails aptana studio and/or radrails. i've been using version 2.05 of aptana. appreciated as lead developer of radrails, i'd suggest upgrading studio 3 , using irb inside embedded terminal. if you'd prefer stay on radrails 2, suggest use os terminal/command line , run irb there. there's nothing special add on top, , we're moving towards pushing users use command line more rails in studio 3. if need interact rails app in irb session, you'll want run "ruby script/console" rails 2.x , lower, , "rails console" rails 3.x.

Can't enter keystore second password when exporting Android app in eclipse -

i'm running strange error - i'm exporting android application in eclipse using keystore had created , used. when try export different application using existing keystore, i'm unable enter second password. idea why? you mean, key password (as opposed keystore)? you've mistyped keystore password. if mean second password box on keystore password screen greyed out, that's design. same screen used create new keystore password , open existing 1 (providing password). need 2 copies in password creation scenario.

java - Problems extending a circular array deque -

greetings, i'm trying implement deque using circular array extends when array gets full. problem seems array refuses extend. either computing size() incorrectly or there problem how update front , rear indices. i've looked on many times , seem figure out. can help? public class arraydeque { public static final int init_capacity = 8; // initial array capacity protected int capacity; // current capacity of array protected int front; // index of front element protected int rear; // index of rear element protected int[] a; // array deque public arraydeque( ) // constructor method { = new int[ init_capacity ]; capacity = init_capacity; front = rear = 0; } /** * display content of deque */ public void printdeque( ) { ( int = front; != rear; = (i+1) % capacity ) system.out.print( a[i] + " &