Posts

Showing posts from March, 2011

ASP.NET MVC3 vs Silverlight4 -

why these 2 tecnologies? key decisions choosing 1 of them? guidelines , scenarios? asp.net mvc3 provides several capabilities silverlight4 not: ... silverlight4 provides several capabilities asp.net mvc 3 not: ... more: html5? , asp.net web app? can explain? thx. your question extensive , can in opinion not answered without knowing want or scenario be. basically there's 1 important difference between mentioned technologies: asp.net , asp.net mvc server side technologies while silverlight , html5 applications running on client system. that means have decide if server application better because e.g. handle lots of server data calculated simple result transfered client or if want use client application can have more complex ui user can use without need of data transfer ajax, postbacks etc. of course have think security, too. more code runs on client side, more ways exist attack code. of course there examples of server site application designed unsafe that

c# - Making a generic TypeEditor -

say have property foo of type sometype in class of type someclass edited custom editor sometypeeditor : [editorattribute(typeof(sometypeeditor), ...)] public sometype foo { { return buildfoofrominternalrepresenation(); } set { updateinternalrepresentation(value); } } the sometypeeditor.editvalue function looks this: public override object editvalue(system.componentmodel.itypedescriptorcontext context, system.iserviceprovider provider, object value) { iwindowsformseditorservice edsvc = (iwindowsformseditorservice)provider.getservice(typeof(iwindowsformseditorservice)); if (null == edsvc) { return null; } var form = new sometypeeditorform(value sometype); if (dialogresult.ok == edsvc.showdialog(form)) { var someclass = context.instance someclass; someclass.foo = form.result; return someclass.foo; } else { return value; } } i add property baz , of typ

select - MySQL Join on two rows -

i'd able rows "articles" table based on 2 "categories" i'm having trouble joins. here's tables like: `articles` ( `article_id` smallint(5) unsigned not null auto_increment, `article_name` varchar(255) not null primary key (`article_id`) ) `article_categories` ( `article_id` smallint(5) unsigned not null, `category_id` smallint(5) unsigned not null unique key `article_category_id` (`article_id`,`category_id`), key `article_id` (`article_id`), key `category_id` (`category_id`) ) now i'd able articles in both categories 3 , 5 (or unlimited number of categories). thought this: select * articles inner join article_categories ac on ac.article_id = a.article_id (ac.category_id = 3 , ac.category_id = 5) just clarify don't want articles in either 3 or 5, both 3 , 5. i'm thinking 1 of simple things i've somehow missed due tiredness or something. either or literally have join every category want include e.g: s

sql - Using distinct keyword with join -

my professor has given me assignment. write query produce snum values of salespeople (suppress duplicates) orders in orders table. salespeople snum number(4) sname varchar2(10) city varchar2(10) comm number(3,2) customer cnum number(4) cname varchar2(10) city varchar2(10) rating number(4) snum number(4) orders onum number(4) amt number(7,2) odate date cnum number(4) snum number(4) i not sure if have understood question completely. i have written query using join. select distinct s.snum,onum salespeople s, ordrs o s.snum = o.snum order snum; and output is snum onum ---------- ---------- 1001 3003 1001 3008 1001 3011 1002 3005 1002 3007 1002 3010 1004 3002 1007 3001 1007 3006 but don't want snum repeated. can point me in right direction ? thanks. the question asks "write query produce snum va

cmdlets - VBscript Public Property Set/Get equivalent in PowerShell -

i'm trying add elements powershell variable add-member. have no problem adding static properties noteproperty, , methods scriptmethod, : $variable = new-object psobject $variable | add-member noteproperty key "value" $variable | add-member scriptmethod dosomething { // code } now i'm stuck on : i want add property has getter , setter , bunch of things via code block. the vbscript equivalent : class myclass public property item(name) // code return value of item "name" end property public property let item(name,value) // code set value of item "name" value "value" end property end class note code sections need write more set/get value, they're more complex (set other related variables, access external data, etc...). i failed find easy in powershell , ended adding instead 2 scriptmethods, getitem , setitem. what best way implement get/let functionnality in member of psobject in powershell ? thanks i

asp.net - how to deploy Visual Studio Development Server with web applications -

i want know how deploy asp.net web applications on client machines runs visual studio development server rather configure in iis on client machine? know possible , telerik uses approach. appreciated in advance deploy asp.net application webserver

javascript - Switch between two images in html with css -

i'm working on wordpress theme , want switch between 2 thumbnail images on hover. the code have looks : <a class="thumb" href="posturl"> <img src="img1.jpg" class="image1" /> <img src="img2.jpg" class="image2" /> </a> so need css change between image1 , image2 on hover. and if knows how can fade effect javascript appreciated. first, want rid of img tags , use css: a:link { background: url("img1.jpg"); } a:hover { background: url("img2.jpg"); } you use javascript complicated, css3 have fade effects ready soon: a:link { background: url("img1.jpg"); -webkit-transition:background 1s ease-in; -moz-transition:background 1s ease-in; -o-transition:background 1s ease-in; transition:background 1s ease-in; } a:hover { background: url("img2.jpg"); }

ruby on rails - How to upload vimeo videos using Media plugin (and not HTML option) -

i'm working on ruby on rails 2.3.8 , last version of rails tinymce plugin. i users have ability of adding kind of videos text editor. it's now, can add youtube videos, , can upload them computer. the problem vimeo videos don't create common html <object> code, create iframe them, , if try import 1 of them using media plugin, i'll have paste video example: http://vimeo.com/16430948 , , generate following html (which won't work): <object width="100" height="100" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"> <param value="http://vimeo.com/16430948" name="src"><embed width="100" height="100" type="application/x-shockwave-flash" src="http://vimeo.com/16430948"> </object> while vimeo videos need following html being displayed:

java - Scala Lift Servlets within WebServer compilation -

i want learn scala , on real project. project needs logic wrapped within web server. made tests embedded jetty , it. time making next step scala. interesting combination below you'll recommend me? 1) embedded jetty + java servlets + scala; in combination can bake "main" web server within java code , use servlets web requests/responses; , core project's logic can written on scala , can imported "main" web server logic java package; 2) embedded jetty + lift + scala; do not write java code, write "main" web server logic on scala lift framework; core project's logic can still written on scala; what advantages of each combination see? thank advice!!!;) this old post, , might have decided way go, here few things can point out. today's web applications have many things such database access, session management, integration client side program using ajax , on. in sense, #1 doesn't much. need write lot of code scratch.

sql - joining more tables makes me get less data from the query -

i have 1 problem 1 sp, when joining specific tables, getting less data sp getting when not included in sp. not getting data them yet, joining them , makes sp send me less data. idea problem can be? thanks it sounds there no matching rows in tables you're joining to. if change join left outer join , should rows expecting (but, obviously, check output make sure do!)

asp.net mvc - Where to put validation for changing an object's children? -

i using asp.net mvc 2 nhibernate. have sales class. sales has many payments . sales' payments should not modified once sales' status becomes confirmed . need suggestions on how enforce this. i'm stumped on several things when trying put validations: for adding , deleting payments: i can create addpayment , deletepayment methods in sales, must remember use these instead of adding , deleting payments collection directly i don't want hide payments collection because nhibernate needs it, collection used in other parts of software for modifying existing payments: i don't think should put validation in payments setters because nhibernate needs access setters. should throw exception? there's discussion disadvantages of throwing exception prevent object entering invalid state. in case object state after modification may still valid, want block modification. throwing exception reasonable in case? alternatives? should enforce in controller actions

asp.net mvc - Most secured way to persist data in ASP MVC -

i'm using asp mvc application + wcf service custom session behavior implementation. clients receive, store , use (for authorization) session tokens. i'm searching secured way store session token @ client side in asp mvc. i see few ways: hidden field. drawback: user can open page source code , token. route value. drawback: token open. user can address bar. session. i've read lot articles 1 conclusion: using session in mvc application bad practice. session have lot advantages well: can configured, can store token @ server side, etc. i'm sure there best practices solving problem. appreciated. require https connections, encrypt secure data, place in cookie. you pass token around site, encrypted of course via hidden field or scenario cookies made do. my bank sets cookie, should enough doing.

php - How to find the % of a value on a Y axis of a LOG graph? -

wow, 1 though! i'm trying find in php % of value relative y axis. if refer graph : http://en.wikipedia.org/wiki/semi-log_graph (2009 outbreak of influenza a), let's want find % value "256" on chart. visually, it's easy : it's bit more 1/3 or 33%. if @ 1024 value, it's around 50% of height of y axis. 131072 100%. so how calculate php? let's take graph , take x = day 0 , y = 256. 256 % of y ? thanks lot can compute baby :) percent = 100 * ( log(y) - log(y1) ) / ( log(y2) - log(y1) ) where y = value y1 = smallest value in y-axis y2 = largest value in y-axis. when y1 = 1.0 can simplify other answers given here (since log(1)=0 definition) percent = 100 * log(y)/log(y2) note not log charts have 1.0 lowest value.

java - EasyMock: Expect Number of Elements in a Set -

how verify number of elements in set in easymock? class i'm testing should call method, passing in set n elements. right now, i'm matching object list: mockfoosetreceiver.savefooset(eq(name), (list<ifooset>) anyobject()); replay(mockfoosetreceiver); what i'd specify number of elements in set: mockfoosetreceiver.savefooset(eq(name), setofnobject(100)); replay(mockfoosetreceiver); or better yet, match elements in set: mockfoosetreceiver.savefooset(eq(name), seteq(ecpectedset)); replay(mockfoosetreceiver); do have roll own matcher, of there 1 built in? or have setofnobject or seteq matcher they'd share? as sets must implement equals(..) according contract: compares specified object set equality. returns true if specified object set, 2 sets have same size, , every member of specified set contained in set (or equivalently, every member of set contained in specifi

c# - Signalling to a parent process that a child process is fully initialised -

i'm launching child process exposes wcf endpoint. how can signal child process parent process child initialised , can access endpoint? i'd thought using semaphores purpose can't quite figure out how achieve required signal. string pipeuri = "net.pipe://localhost/node0"; processstartinfo startinfo = new processstartinfo("node.exe", "-uri=" + pipeuri); process p = process.start(startinfo); netnamedpipebinding binding = new netnamedpipebinding(); var channelfactory = new channelfactory<inodecontroller>(binding); inodecontroller controller = channelfactory.createchannel(new endpointaddress(pipeuri)); // need form of signal here avoid.. controller.ping() // endpointnotfoundexception!! i use system-wide eventwaithandle this. parent application can wait child process signal event. both processes create named event , 1 waits signalled. // i'd use guid syst

c# - Same web service project, different configuration, can't debug -

i have created c# web service, web client, , debugged service asp.net development server (that thingy gets activated when press f5). fine. need web service same previous, differs in few lines of code. purpose created 2 new configurations, debugnew , releasenew, , set output directory binnew (instead of default "bin"). problem original web service executed in debugger, instead of new web service. debugger unaware of binnew folder. how set environment start new web service if debugnew configuration active? as far know, web applications run out of bin folder. if knows how change that, happy call myself wrong in order learn trick myself. assuming correct once there, write post compile script checks build configuration active. if it's either debugnew or releasenew, copy contents binnew bin. if there's few lines of code different though, question whether or not putting configuration setting in , adjusting code accordingly isn't better way go. but, d

api - how to create full functionality of calendar in android? -

it seems android calendar api not available. can please give me tips , tricks creating similar thing.just creating events,meeting, birthday etc.. , notification when event occurs. , layout should similar to-our in-built calendar give me ideas or hint , logic? to send notifications, read creating status bar notifications . to create layouts, read declaring layout , common layout objects , , hello gridview . there equivalent introductory tutorial each layout type. you can access calendar events through data api . however, android specific calendar apis not part of public android sdk. thus, could access them, highly recommended not since change in future versions of os.

asp.net - multi-level accordion menu -

i looking multi-level accordion menu (drill down few levels deeper) (expand , collapsible) website. there sample anywhere can use? in advance. it nice if can dock left clicking on icon , slide when click on icon again. something this: menu1 menu2 menu3 menu4 menu5 menu6 menu7 menu8 do mean tree? if so, there few links here : http://wiki.jqueryui.com/w/page/12138128/tree eg. http://www.jstree.com/ or http://jquery.bassistance.de/treeview/demo/ also, check out these questions: how create menu tree using html turning html select element tree submenus

geolocation - Geo Fix Not Setting Browser Location in Android Emulator -

using the geo fix command set virtual device's location in android emulator works maps application. however, when attempt view current location in google maps in virtual device's browser, receive "your location not determined" error. geo fix command not support w3c geolocation standard or missing something? (1) first, open emulator, run cmd, type telnet localhost 5554 appear android console: type 'help' list of commands ok. (2) geo fix latitude longitude (3) location loc = locationmanager.getlastknownlocation("gps"); if doesn't help,try this: open eclipse, windows -> open perspective -> ddms -> emulator control -> manual manually set latitude , longitude, , press send button. good luck~

objective c - initialization makes pointer from integer without a cast -

okay, having hard time this. i've searched past hour on , don't doing wrong. i'm trying take currenttitle of sender, convert integer can use in call list. nsstring *str = [sender currenttitle]; nsinteger *nt = [str integervalue]; // error appears // nsstring *nextscreen = [nsstring stringwithformat:@"screen_%@.jpg", [screenlist objectatindex:nt]]; i assume it's [str integervalue] bit not being used, can't find example works. thanks! let's analyze error message: initialization ( nsinteger nt ) makes pointer ( * ) integer ( [str integervalue] ) without cast. this means trying assign variable of non-pointer type ( [str integervalue] , returns nsinteger ) variable of pointer type. ( nsinteger * ). get rid of * after nsinteger , should okay: nsstring *str = [sender currenttitle]; nsinteger nt = [str integervalue]; // error appears // nsstring *nextscreen = [nsstring stringwithformat:@"screen_%@.jpg", [screenlist o

sitecore - How to add image titles to sc:image extension elements -

i able add "title" variable images created using xslt. specifically, working file called "teasers.xslt" part of sitecore6 starter kit. text each title "teaser abstract" maintained in sitecore content editor. my understanding can add new variable "showteaser" xsl template, can made query teaser abstract follows: <xsl:variable name="title" select="sc:item(sc:fld('teaser abstract',.),.)" /> if correct, possible add new title variable property of images? below complete xsl template "showteaser" (from teasers.xslt) insert new title property: <xsl:template name="showteaser"> <xsl:param name="teaser_item" /> <xsl:variable name="teaser" select="sc:item($teaser_item,.)" /> <xsl:variable name="teaser_link" select="sc:item(sc:fld('teaser link',.),.)" /> <sc:link field="teaser link" s

xaml - WPF Binding a Dynamically Added Control -

i adding "company" ribbonapplicationmenuitem in ribbonwindow following code: var reset = datacontext icompanies; if (reset != null) { // todo: create interface populate mymenutems var mymenuitems = new list<string>(); foreach (var item in mymenuitems) { var newbutton = new button { margin = new thickness(2), content = item }; menuitem_company.items.add(newbutton); } } my xaml looks this: <ribbon:ribbonapplicationmenu tooltiptitle="application menu"> <ribbon:ribbonapplicationmenuitem header="company" x:name="menuitem_company" imagesource="images\largeicon.png"> </ribbon:ribbonapplicationmenuitem> </ribbon:ribbonapplicationmenu> how bind new button in code when add menuitem_company? need bind property in datacontext. thanks, eroc var newbutton = new button { margin = new thickness(2), content

c# - Windows Phone 7: Establishing which page is being activated during the Application_Activated event -

i following general best practice principles of restoring persistent , none persistent state , objects when tombstoned app re-activated. can found in microsoft article here the samples show simple re-activation of main page of app. application has multiple pages (any of tombstoned , therfore re-activated) , each 1 binding different viewmodel object. know how ascertain page going activated can selectivly deserialize , recover correct viewmodel object page. or best practice restore viewmodels or there design pattern this? i have implemented simple pattern best described - in application's activated , deactivated event, send message subscribing pages. the pages subscribe message serialization/deserialization of data. i using laurent bugnion's excellent mvvmlight library windows phone 7 . here sample code illustrating message broadcast - // ensure application state restored appropriately private void application_activated(object sender, activatedeventar

c# - Memory Heap Security: String garbage collection -

i have been doing security code review company , using tool called fortify360. identify many issues code , describe problems. interesting issue has raised have not found other info on following: "sensitive data (such passwords) stored in memory can leaked if stored in managed string object. string objects not pinned, garbage collector can relocate these objects @ , leave several copies in memory. these objects not encrypted default, can read process' memory able see contents. furthermore, if process' memory gets swapped out disk, unencrypted contents of string written swap file. lastly, since string objects immutable, removing value of string memory can done clr garbage collector. garbage collector not required run unless clr low on memory, there no guarantee when garbage collection take place. in event of application crash, memory dump of application might reveal sensitive data." all of understand make sense , in research of issue pretty standard. the qu

c# - Calculating direction of rotation -

if have 4 points in 2d space, rotated m degrees, best/ efficient way determine direction(clockwise/counter clockwise) of rotation. i know point before , after rotation. i have tried taking account lowest point , highest point (based on y value) , comparing x difference e.g. (+ve or -ve) not seem reliable , doubt efficient solution. any point if have both before , after coordinates. take cross product of before after. sign of resultant vector tell clockwise (-) or counterclockwise(+).

ruby on rails - MongoDB help (relationships) -

i have class foo embedded object bar. every time foo created, want bar created. bar initiated passing variables foo. how can accomplish this? thanks use before_create hook auto create bar. like class foo include mongo.... attr_reader :new_bar before_create :create_bar def create_bar self.bars << new_bar end end that way can still validate bar (using new_bar or whatever want). both mongomapper , mongoid have before_create hook, should fine in either.

In Entity Framework how do I map a composite key through the XML in EDMX file? -

i see posts on programmatically mapping table composite key haven't found examples within xml of edmx file. how do this? in edmx of entity type have key section multiple propertyref's pointing composite key. however, when go save changes errors , states there no update function. it seems me, if mark 1 key primary key , can manage should able use composite key well. please not reply , state shouldn't using composite keys because don't care , have no ability change it. didn't develop database third-party erp application i'm interfacing with. from can tell may have create stored procedure save it? isn't there better way? thank you.

YouTube PHP API Besides Zend -

i'm using zend framework youtube php api under high load zend doesn't perform well. when implementing caching each youtube video object 23kb compressed. i'd rather switch implementation of api. there other maintained implementations? i've searched it's little difficult find. i ported codeigniter youtube api implementation regular php. can find here: https://github.com/jimdoescode/zendless-php-youtube-api

Django QuerySet access foreign key field directly, without forcing a join -

suppose have model entry, field "author" pointing model author. suppose field can null. if run following queryset: entry.objects.filter(author=x) where x value. suppose in mysql have setup compound index on entry other column , author_id, ideally i'd sql use "author_id" on entry model, can use compound index. it turns out entry.objects.filter(author=5) work, no join done. but, if author=none, django join author, add clause author.id null. in case, can't use compound index. is there way tell django check pk, , not follow link? the way know add additional .extra(where=['author_id null']) queryset, hoping magic in .filter() work. thanks. (sorry not clearer earlier this, , answers lazerscience , josh). does not work expected? entry.objects.filter(author=x.id) you can either use model or model id in foreign key filter. can't check right yet if executes separate query, though i'd hope wouldn't.

load asp.net page partially -

i working asp.net , have 2 gridvew controls , link buttons. now, bind these gridviews, have call web services , data access. since pulling large amount of data, page loads slow. wondering if there way partial page load, meaning show link buttons first show rest of gridview data available (to bind gridivews). is there way can accomplish this? (preferably, without ajax). thanks. if want ajax-less method, go ol' trusty iframe tags , have gridviews stand alone pages. believe page render around iframes while iframes load. note: not advocating best solution, may meet intent of scenario.

php - Possible to limit results returned, yet leave 'pagination' to table? -

i building php site using jquery , datatables plugin. page laid out needs pagination working in dealing large datasets, have noticed server pulling returned rows opposed 10 row (can more) limit stated within each 'page'. is possible limit results of query , yet keep id numbers of results in memory when page 2 hit (or result number changed) new data sought after? does make sense way? i dont want query db 2000 rows returned have 'front-end-plugin' make other results hidden when truthfully on page start. the limit clause in sql has 2 parts -- limit , offset. to first 10 rows: select ... limit 0,10 to next 10 rows: select ... limit 10,10 to next 10 rows: select ... limit 20,10 as long order result set same each time, absolutely don't have (and don't want to) first ask database send 2000 rows. to display paging in conjunction this, still need know how many total rows match query. there 2 ways handle -- 1) ask row count separate qu

gcc - SSE2 instructions not working in inline assembly with C++ -

i have function uses sse2 add values it's supposed add lhs , rhs , store result lhs: template<typename t> void simdadd(t *lhs,t *rhs) { asm volatile("movups %0,%%xmm0"::"m"(lhs)); asm volatile("movups %0,%%xmm1"::"m"(rhs)); switch(sizeof(t)) { case sizeof(uint8_t): asm volatile("paddb %%xmm0,%%xmm1":); break; case sizeof(uint16_t): asm volatile("paddw %%xmm0,%%xmm1":); break; case sizeof(float): asm volatile("addps %%xmm0,%%xmm1":); break; case sizeof(double): asm volatile("addpd %%xmm0,%%xmm1":); break; default: std::cout<<"error"<<std::endl; break; } asm volatile("movups %%xmm0,%0":"=m"(lhs)); } and code uses function this: float *values=new float[4]; float *values2=new float[4]; values[0]=1.0f;

android - Some help understanding columnIndex in ViewBInder -

skip bottom if want see question without context the android app i'm building has simple table 3 columns: _id integer primary key..., name text, color int this table called categories . load categories database , feed them simplecursoradapter use spinner so: string[] = new string[] { listdbadapter.key_category_name, listdbadapter.key_category_color }; int[] = new int[] { r.id.categoryspinneritem }; mcategoryspinneradapter = new simplecursoradapter(this, r.layout.category_spinner_item, categorycursor, from, to); mcategoryspinneradapter .setviewbinder(new categoryspinnerviewbinder()); mcategoryspinner.setadapter(mcategoryspinneradapter); i set custom viewbinder because want category name text of spinner item, , color background color. viewbinder looks this: private static final int name_column = 1; private static final int color_column = 2; @override public boolean setviewvalue(view view, cursor cursor, int columnindex) { t

regex - How can I remove the string "\n" from within a Ruby string? -

i have string: "some text\nandsomemore" i need remove "\n" it. i've tried "some text\nandsomemore".gsub('\n','') but doesn't work. how do it? reading. you need use "\n" not '\n' in gsub. different quote marks behave differently. double quotes " allow character expansion , expression interpolation ie. let use escaped control chars \n represent true value, in case, newline , , allow use of #{expression} can weave variables and, well, pretty ruby expression text. while on other hand, single quotes ' treat string literally, there's no expansion, replacement, interpolation or have you. in particular case, it's better use either .delete or .tr string method delete newlines . see here more info

sql - Can't Create Database Diagrams -

in sql 2008, way grant permission developer view , create database diagrams without giving them dbo permission? from books online: to use database diagram designer, must first set member of db_owner role control access diagrams. and any user access database can create diagram in other words, user db_owner permissions must first enable diagrams in database (to create sysdiagrams table) , can create them. see books online more information.

javascript - jQuery: How can I loop over a set of elements finding only those matching the values within another array? -

i've got little function called finditem() supposed finding elements i'm looking based on custom data- attributes on element. in case these purely numerical eg. data-slide=1 . i'm bit clueless how match value of each item's data-slide 1 contained within other array. here more concrete example: function finditem(count) { var collection = []; $.each(allmyliitems, function(i, item) { if ( $(item).data('slide') == count ) { collection.push(item); } }); return $(collection); } finditem([1,3]) which not work because count inside if statement not seem match anything. the page contain 4 <li data-slide="{number}">… elements 1,3 should return first , third of elements. what doing wrong here? use jquery.grep , jquery.inarray : function finditem(items) { return jquery.grep($('li'), function(element, index) { return jquery.inarray($(element).data('slide&

Java: MS Access and JDBC connectivity -

i want connect ms access java code. how this? i have written following code: import java.sql.*; public class test { public static void main(string[] args) { string datasourcename = "test"; string dburl = "jdbc:odbc:" + datasourcename; try { class.forname("sun.jdbc.odbc.jdbcodbcdriver"); connection con = drivermanager.getconnection(dburl, "ify","ify123"); statement statement = con.createstatement(); resultset rs = statement.executequery("select * emp"); system.out.println("hi"); while ( rs.next() ){ system.out.println(rs.getstring(2)); } } catch (exception err) { system.out.println( "error: " + err ); } } } the problem i'm still not able coneect database. might doing wrong? this might driver manager registration problem. you can use alternate statements as: drivermanager.registerdriver(new sun.jdbc.odbc.jdbco

google translate - Android TextToSpeech is not working on android 1.5 -

i developing android texttospeech app. application not working in android 1.5 , works fine in android 1.6 . i using google-api-translate.jar . the text-to-speech feature available in android 1.6 (api level 4) , newer! see texttospeech class details!

How to use C# to display Registry results on Rich Text Box? -

i have program able retrieve various registry values using c# codes compiled , created using vs 2010. however problem arises when tried display results retrieved windows registry rich text box within form. the form shows 1 line last value in array contains results. please give advice on codes. thanks! using system; using system.collections.generic; using system.componentmodel; using system.data; using system.drawing; using system.linq; using system.text; using system.windows.forms; using microsoft.win32; namespace syscrawl { public partial class ftk_menu_browsing_history : form { public ftk_menu_browsing_history() { initializecomponent(); } private void buttonfilehistory_click(object sender, eventargs e) { this.hide(); ftk_menu_file_history mfh = new ftk_menu_file_history(); mfh.showdialog(); this.close(); } private void buttonencryptedfiles_click(object sender, eventargs e) { this.hide();

git - __git_ps1 extremely slow in kernel tree -

$ time __git_ps1 ((v2.6.33.4)) real 0m1.467s user 0m0.864s sys 0m0.564s it's making prompt unusable; on other hand, though, it's useful feature give lightly. idea why runs slow , can it? setup details: $ uname -a linux martin-laptop 2.6.35-22-generic #35-ubuntu smp sat oct 16 20:36:48 utc 2010 i686 gnu/linux $ git --version git version 1.7.1 $ du -sh . 876m . i suspect machine since on coworker's box, in kernel tree cloned from, same command returns instantly $ time __git_ps1 ((v2.6.33.4)) real 0m0.039s user 0m0.008s sys 0m0.016s adding hdparm output: mine $ sudo hdparm -tt /dev/sda4 /dev/sda4: timing cached reads: 1542 mb in 2.00 seconds = 772.35 mb/sec timing buffered disk reads: 110 mb in 3.02 seconds = 36.42 mb/sec coworker's $ sudo hdparm -tt /dev/sda6 /dev/sda6: timing cached reads: 1850 mb in 2.00 seconds = 926.03 mb/sec timing buffered disk reads: 210 mb in 3.02 seconds = 69.53 mb/sec other differ

regex - Need help with Perl reg ex? -

here text file forms. s1,f2 title including several white spaces (abbr) single,here<->there,reply s1,f2 title including several white spaces (abbr) single,here<->there s1,f2 title including several white spaces (abbr) single,here<->there,[reply] how change reg ex work on 3 forms above? /^s(\d),f(\d)\s+(.*?)\((.*?)\)\s+(.*?),(.*?)[,](.*?)$/ i tried replace (.*?)$/ [.*?]$/ . doesn't work. guess shouldn't use [] (square brackets) match possible word of [reply] (including [] ). actually, general question should how match possible characters better in reg exp using perl? looked online perldoc webpages. hard me find out useful information based on perl knowledge level. that's why asked stupid questions. appreciated comments , suggestions. what using negated character classes: /^s(\d),f(\d)\s+([^()]*?)\s+\(([^()]+)\)\s+([^,]*),([^,]*)(?:,(.*?))?$/ when incorporated script: #!/bin/perl use strict; use warnings; while (<&g

mpmovieplayercontroller - What's the best choice for streaming audio only to iPhone iOS 3.1.3 using Apple's Http Live Streaming Protocol? -

i'm building app deals streaming music server that's using http live streaming protocol send information. i'm using avplayer (with avplayeritem) decode m3u8 files server sending class referenced in ios 4. there's option of using mpmovieplayercontroller's initwithcontenturl: method prior 3.2 there's no way resize frame, plays in fullscreen. want create custom player , class not suited purpose. know matt gallagher's audiostreamer class, seems work mp3. there way make class work http live streaming? there way stream audio using http live streaming in ios 3.1.3? thanks

java - my app crashes before it starts.This is a simple app in which i am making the use of intent to call another class from a previous class -

intenttest.java: package intenttest.xyz.com; import android.app.activity; import android.content.intent; import android.os.bundle; import android.view.view; import android.widget.button; public class intenttest extends activity { button b; /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.main); b = (button) findviewbyid(r.id.b); b.setonclicklistener( new view.onclicklistener() { public void onclick(view view) { intent intent = new intent(intenttest.this,seond.class ); startactivity(intent); } }); } } main.xml: <?xml version="1.0" encoding="utf-8"?> <linearlayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:lay

java - Cannot Find method error -

below code star constructor, i'm passing correct values keep getting cannot find symbol error star constructor private star[] star; st = db.readlinefromdb(); st = new stringtokenizer(st , ","); star[count] = star.star(double.valueof(st.nexttoken()),double.valueof(st.nexttoken()),st.nexttoken(),integer.valueof(st.nexttoken()),st.nexttoken()); count++; public star(double logdist, double vmag, string sp_class, int id, string name) { this.logdist = logdist; this.vmag = vmag; this.sp_class = sp_class; this.id = id; this.name = name; } thanks guys ans... give up... star[count] = new star(...); you invoke constructors new keyword, not class.class(...) .

iphone - ipad databinding -

is there way data bind data view's controls in ipad app? thanks if talking cocoa bindings not available on ios platform. perhaps @ this question starting point.

sqlplus - Equivalent of MySQL's \G in Oracle's SQL*Plus -

in oracle's sql*plus, results of select displayed in tabular manner. there way display row in key-value manner (like mysql's \g option )? the database working on (the schema not defined me) has bunch of columns named e.g. yn_enabled (yn = yes no) char(1) . when query result like id_mytable y y y ------------ - - - 3445 y n y so it's not clear columns have values (without having schema open in window). not built in sql plus, tom kyte has provided procedure called print_table this. run this: sql> exec print_table ('select * mytable id_mytable=123'); , see results like: id_mytable : 123 yn_enabled : y yn_something : n ...

java - How to obtain the current bitmap of a canvas? -

i want current bitmap associated canvas can perform operations on it. can't see how though. i've seen examples create bitmap , set canvas use bitmap, can access later, i'm using canvas returned surfaceholder there's no constructor. for instance, examples show kind of thing: bitmap bmp = bitmap.createbitmap(xxx, yyy, bitmap.config.argb_8888); canvas c = new canvas(bmp); so @ point can see bmp. in case, canvas obtained by: final surfaceholder holder = getsurfaceholder(); canvas c = null; try { c = holder.lockcanvas(); so how can bitmap c? edit @reuben - may right, did wonder this. in short, aim capture current canvas contents have drawn "stuff", , make copy of it, reversed, put underneath. reflection. example of found performed via bitmaps, assumed needed somehow capture current canvas bitmap use it. if there better way can this, i'm ears! better late never :) bitmapdrawable bitdrawable = new bitmapdrawable(

How to save string into text files in Delphi? -

what easiest way create , save string .txt files? use tstringlist . uses classes, dialogs; // classes tstrings, dialogs showmessage var lines: tstrings; line: string; filename: string; begin filename := 'test.txt'; lines := tstringlist.create; try lines.add('first line'); lines.add('second line'); lines.savetofile(filename); lines.loadfromfile(filename); line in lines showmessage(line); lines.free; end; end; also savetofile , loadfromfile can take additional encoding in delphi 2009 , newer set text encoding (ansi, utf-8, utf-16, utf-16 big endian).

mysql userid password change -

am using wamp server,where in project need change userid , password of mysql.i want change username:-"root" password:-"root123".how possible? you need... $ mysqladmin -u root -p'oldpassword' password newpass

c++ - How To register a Windows Class and Find the Window using registered class -

i creating mfc application launched on click on explorer context (rightclick) menu. but need launch single instance of application. have use findwindow , afxregisterclass i tried register class in mfc app below: bool cndsclientdlg::initinstance() { //register window updated on 16th nov 2010, @subhen // register our unique class name wish use wndclass wndcls; memset(&wndcls, 0, sizeof(wndclass)); //class name using findwindow later wndcls.lpszclassname = _t("ndsapp"); // register new class , exit if fails if(!afxregisterclass(&wndcls)) // [c] { return false; } } and called method in constructor of mfc class. verified class being registered while starting application. now in shell extension trying find class registered in mfc below: cwnd *pwndprev = null; pwndprev = cwnd::findwindow(_t("ndsapp"),null); if(pwndprev != null) pwndprev->bringwindowtotop(); but not able c

interface builder - How to create a cocoa app windows like tweetie -

i'm new cocoa app dev, , i'm searching solution create windows tweetie main windows left tool bar , panel point selected icon. like screenshot : http://i.stack.imgur.com/qvxwu.jpg could me? it's lot of tweetie ui implemented using custom controls. you'll want subclassing nsview , how handle drawing , mouse events. there's nothing built cocoa framework this. the nsview documentation has info on view programming , drawing , , event handling . if you're new cocoa, may want start off built in, though, lot of work (and requires pretty understanding of how framework works).

c++ - How can one avoid duplicating class template specification for each member function? -

if have template class specification so, template <typename t> class myclass { public: void fun1(); // ... void funn(); }; template <typename t> void myclass<t>::fun1() { // definition } // ... template <typename t> void myclass<t>::funn() { // definition } if change class template else, add parameter: template <typename t, typename u> class myclass { // ... }; then have change each function definition (fun1, ..., funn) agree class template specification: template <typename t, typename u> void myclass<t,u>::fun1() { //... } are there strategies avoiding this? use macros e.g. #define dflt_template template<typename t, typename u> #define dflt_class class<t,u> dflt_template void dflt_class::fun1() { // ... } or considered bad practice? to me, benefits of using macro here far overshadowed drawbacks. yes, if use macro if ever need add additional template parameter, you'

Android platform, can I meet those requirements? -

folks, i'm trying see if plan realistic @ all. i'm ne android platform not new software development. first post here :) we want (in our company) create android software compliment our truck management software. basically, couple specific tasks. a. send gps updates server. b. receive trip information. c. send pickup/delivery confirmation server. after evaluationg i. platform , windows phone 7 platform came conclusion android has multitasking works us. so, android have specific questions. data plan want use limited. 5m/mo , no voice/text. figured 5x1024x1024 = 5242280 bytes give me 1k per transmission every 15 minutes (3000 transmissions per mo). leave 2m other stuff happens every couple of days. math ok or there lot of "waste" traffic? our server going xml soap , messages sent lon/lat in xml package. 1k ok? if calculate bytes less wonder if there "minimum" packet size, etc. insight on data limitation appreciated. because of #1 need "lock&qu

jquery - Escape dangerous code when allowing user MySQL filter creation -

i can display of release years of films in database. user can pick year , see of films released in year. or can show of genres of movie. user can choose genre , see of movies match criteria. built form in user can dynamically choose own criteria. instance "release date" "is after" "2000" return filtered list. i wrote unprotected jquery/django code pass filters database. through combination of drop down boxes , user input boxes (exactly see in itunes), using jquery construct filter. as example, let's user selects in first drop down: "year". second drop down: "is". last input box user enters "2005." criteria put array: dictionary: [ {"includes": [["year__iexact", "2005"]], "excludes": []}, "all" ] "includes"/"excludes" separates criteria "is", "is before" things "is not" "all" desig

Problem with image path [C#, WPF] -

i need use images in 2 .net assemblies. 1 wpf app {myapp.exe} , second *.dll {mydll.dll}. file located in file structure: **appfolder** consist these files , 1 subfolder(avatars): -myapp.exe -mydll.dll -avatars {folder} consist: -manimages.jpg -womanimages.jpg i try user uri in format new uri(@"c:\users\avatars\manimages.jpg", urikind.relativeorabsolute); but format not work, images empty. i expect new uri(@"avatars\manimages.jpg", urikind.relativeorabsolute); to work? you try: new uri(environment.currentdirectory + @"\avatars\manimages.jpg", urikind.relativeorabsolute);

SVN tree conflict totally wrecked my code in eclipse -

i working in eclipse using subclipse (svn client) , have been working on project while, in process changed java package name. when tried svn commit told me had tree conflict. opened conflicts , sure enough there conflict new package name, left selection default said merging , pressed ok. now code has things this <<<<<<< .working getproviders(); ======= >>>>>>> .merge-right.r44 this shown multiple times , have compile errors everywhere. cannot revert project because have made many changes locally already. in addition, have these new files named constants.java.merge-right.r43 'constants.java' real file , 'constants.java.merge-right.r43' new file. what can undo tree conflict problem? find merge conflicts indicated the <<<<<<< .working <your code> ======= <their code> >>>>>>> .merge-right parts , check code correct code (or combination

c++ - To use shared_ptr, is it safe ? -

i have got confused shared_ptr. say, have classes: class foo { int _f; }; typedef std::shared_ptr<foo> fooptr; class bar { int _b; }; typedef std::shared_ptr<bar> barptr; class foobar : public foo, public bar { int _fb; }; int main () { foobar *fb1 = new foobar(); foobar *fb2 = new foobar(); fooptr f((foo *)fb1); barptr b((bar *)fb2); return 0; } because b.get() != fb2, should crash when program exit? or safe ? a shared_ptr<base> can safely take ownership of derived* , if base not have virtual destructor. however, works if shared_ptr knows derived type of object when takes ownership of it. if remove casts fooptr f(fb1); fooptr b(fb2); then you'd okay. casts, shared_ptr cannot know most-derived type of object when takes ownership of it, behavior undefined, if had said: foo* f = new foobar(); delete f; the best thing follow rule "a base class destructor should either public , virtual, or

c# - Why is exported report empty? -

i have empty exported report , don't know why happening this. i have following code in 1 of methods: reportdocument report = new reportdocument(); report.load(pathtoreport); after loading successfully, set parameters using next method: public static void setparametervalue(reportdocument document,string parname,object value) { parameterfielddefinition f = document.datadefinition.parameterfields[parname]; parameterdiscretevalue v = new parameterdiscretevalue(); v.value = value; f.currentvalues.add(v); f.defaultvalues.add(v); f.applydefaultvalues(f.defaultvalues); f.applycurrentvalues(f.currentvalues); } and after above call, call: private void applynewserver(reportdocument report) { //initialize subreports connection first foreach (reportdocument subreport in report.subreports) { foreach (table crtable in subreport.database.tables) {

java - Offline Javadoc Server -

as not our development machines have internet access, want cache api docs of various libraries in our local network. thinking of webapp handles caching , listing available javadocs after uploads them (in jar format). ideally, source jars automatically pulled our maven repository (artifactory). i have not been successful in finding on google, i'm trying luck here. edit i have found site looking for: http://www.jarvana.com problem site not fulfill #1 requirement - offline availability. rephrase question to: there webapp works jarvana can deployed local server? it seems i'm looking doesn't exist, i've rolled own simple webapp serves javadocs local maven repository (transparently extracting jar files). it's far perfect, works requirements. if interested, shared on github: https://github.com/planbnet/javadoc-browser

Sql incorrect syntax -

select max(qtd) (select count(int_re_usu) qtd tb_questionario_voar_resposta) why query dont work? want retrieve max value count it says incorrect syntax near')' any ideias? you need alias on derived table: select max(qtd) ( select count(int_re_usu) qtd tb_questionario_voar_resposta ) but vincent pointed out, returns 1 row, , think missing group by. can do: select max(count(int_re_usu)) qtd tb_questionario_voar_resposta group somecolumn

php - Select statement MySql -

i'm trying simple select statement on mysql database. in mssql works fine, can't work in mysql. what want following: lets have table (named testtable) this: id | domain | nrofvisitors -------------------------------------------- 1 | something.com | 435 -------------------------------------------- 2 | blabla.com | 231 and have string, http://bla.ttt.something.com/blabla now want pass in string, , select rows domain in string. in mssql can following: select * testtable "http://bla.ttt.something.com/blabla" "%" domain "%" but in mysql returns 0 rows. doing wrong? thanks in advance! select * testtable "http://bla.ttt.something.com/blabla" concat("%",domain,"%")

c# - @OutputCache problem in a UserControl -

i have user control outputcache: <%@ outputcache duration="86400" varybycontrol="lnkbtntopvanzari" %> where varybycontrol id of link button use switch active view of multiview contained in updatepanel . the problem when press link button, page full post back , view not switched. if remove outputcache directive, works great (pressing link button correct view shown via ajax). do know wrong? thanks. the varybycontrol parameter used vary depending on value of control specify. value of link button same, cache not varied. i believe intended used controls such dropdown lists, feasible output different based on selected value in list. you may want try using varybyparam , changing link button hyperlink, specifying view query parameter, or trying out varybycustom. otherwise possibly possibly split content of views separate user controls output cached, leaving multiview , link button outside caching.

Selenium href blank New Window test -

so, using selenium, want test links on page , see if open new window. not javascript links, basic href "target=_blank". want make sure newly opened window loaded page. can scripting link clicked, when test page title, page i'm testing on, not new window on top. how target new window , check see if page loaded? thanks the following worked me form attribute target="_blank" sends post request on new window: // open action in new empty window selenium.geteval("this.page().findelement(\"//form[@id='myform']\").target='my_window'"); selenium.geteval("selenium.browserbot.getcurrentwindow().open('', 'my_window')"); //the contents load in opened window selenium.click("//form[@id='myform']//input[@value='submit']"); thread.sleep(2000); //focus in new window selenium.selectwindow("my_window"); selenium.windowfocus(); /* .. - i.e.: asserttrue(.........); */

How do I overwrite the ESC key pressed behavior for jQuery dialog -

i have form submit when pressed in showing small jquery dialog spinning wheel. when press escape, dialog closes interrupting form submission. how overcome user when press esc key. how prevent user exiting when esc key pressed jquery dialog? i suppose you're looking http://docs.jquery.com/ui/dialog#option-closeonescape

emacs, do a search, copy some text, and then return to the point of search originally? -

i doing search backwards in text in emacs, move point around , modification or copy, can return point of search before or still have search text around spot? best, try m-x pop-to-mark-command and can functionality c-u spc or c-u c-@ (i.e. using prefix argument set-mark-command ). for more information on mark ring, read about mark ring . there global mark ring , list of marks across buffers, can navigate via c-x c-spc .