Posts

Showing posts from May, 2011

asp.net - Telerik Radcalender inside Repeater - Events not working -

i using telerik rad controls in project. have radcalendar inside repeater. <asp:repeater id="resultrpt" runat="server"> <itemtemplate> <telerik:radcalendar style="width: 191px; height: 123px" id="radcalendar1" runat="server" enablemonthyearfastnavigation="false" autopostback="true" multiviewcolumns="1" multiviewrows="1" enablemultiselect="true"> </telerik:radcalendar> <telerik:radtooltipmanager width="270px" height="135px" style="font-size: 11px" relativeto="element" id="radtooltipmanager1" runat="server" offsetx="7" position="middleright" onajaxupdate="radtooltipmanager1_ajaxupdate" skin="telerik" autoclosedelay="90000" </telerik:radtooltipmanager> </itemtemplate> </asp:repeater> this radajaxmanager <telerik:radajaxma...

iphone - Core data refactoring -

hi methods like '- (nsfetchedresultscontroller *)fetchedresultscontroller ' are placed in code of view controllers. find bit messy write data fetching code along lifecycle methods or table delegate methods. point should refactor coredata methods other helper class dataloader , call them in view controllers? wrong thing or going loose coding benefits of core data methods. i moving fetchedresultscontroller helper class idea. problem encounter spelling of attributes right. for example predicate , want filter on attribute called @"isselected" . there no check compiler nor linker check string isselected . have double check each line string has been used. a search&replace won't work on misspellings because don't know bugs have been introduced. when predicate wrong no results fetched. problem don't know if there no matching rows or if have filtered wrong. need check @ runtime , consumes time. for predicates saved templates exist, p...

php - Use the default route with Zend Router by default -

how can configure zend_controller_router use default route default? whatever reason unknown, uses current route. this causing annoying routing issues, , don't feel editing hundreds of links explicitly use default route reasonable solution add 1 custom route. your question isn't obvious , confusing, try though. i going assume not mean zend_controller_route in fact talking links generated in views. you can use baseurl() this <a href="<?=$this->baseurl("about-us")?>">about us</a> you can set baseurl in bootstrap this zend_controller_front::getinstance()->setbaseurl("/"); if working locally may want set this zend_controller_front::getinstance()->setbaseurl("/my-app/public"); using baseurl() in views use path base urls on. remember must wrap links in baseurl() work. the url() helper not useful this, used doing things pagination want current parameters of request object maintaine...

version control - Mercurial: Create a branch without having to make a change first -

i heard way create branch in mercurial repository make changes in working copy, commit them new branch. in subversion, can create branch without having make changes (by copying trunk path under tags ) - possible in mercurial well? i've seen tortoisehg, it's possible can done via command-line tool , don't know it. my workflow is: create feature branch. do work in feature branch. create release candidate branch. merge feature(s) release candidate branch. deploy, test, fix deploy, test, fix release candidate branch. merge release candidate branch trunk. many in advance. it depends on mean branch. a named branch can created giving name , committing, it'll end new changeset in history, don't need explicitly change of files in working folder allowed commit. hg branch newname hg commit -m "created branch newname" you can using tortoisehg dialog. however, if want create unnamed branch, ie. head, yes, need change something. , ...

java - Hibernate get object with linked objects -

i have problem hibernate mapping , queries. have object have relation b , c. the fetch mode lazy ( @manytoone(fetch = fetchtype.lazy) ) , can't change it. problem next: when object method ( hibernatedao.get ), object whitout relation b , c. if create criteria, force relation criteria.setfetchmode(...) query. have read on web it's not thing make criteria object primary key. how method ? thanks. you can use fetch profiles have fetch mode set lazy default, , eager specific query: http://docs.jboss.org/hibernate/stable/annotations/reference/en/html_single/#d0e3524 and if using hibernate version doesn't supports fetch profiles, can hql query retrieves tree need, using joins. but have read on web it's not thing make criteria object primary key. i careful before ruling out solution because read somewhere it's "bad". may bad thing in end, if don't understand why bad, may ruling out solution made specific case ;-)

java - Can I convert array of integer to List<int> or List<Integer> by Arrays.asList(array)? -

possible duplicates: arrays.aslist() not working should? how convert int[] list<integer> in java? or must refactor int[] integer[] ? you can't have list<int> arrays.aslist(array); return list type t of (passed array) you can have like integer[] = new integer[]{1,2,3}; list<integer> lst = arrays.aslist(a);

flex - Adobe air: Navigate between .html pages? -

Image
i thought of myself being quite @ learning basic things of google , cup of coffee, when trying head around basic adobe air development, have totally failed. apparently there's plenty of tutorials loading data local storage remote places (ajax), have yet not seen clear instruction on how navigate between .html pages in applications directory. obviously <a href="" /> isn't going cut it, guess need dom javascript magic it, yet not have seen. how can navigate between .html pages in applications directory properly? thanks ok, understand doing. hand't realized air app can embedded html document javascript hooks air framework. pretty cool! more information can found here: http://help.adobe.com/en_us/air/1.5/devappshtml/ws5b3ccc516d4fbf351e63e3d118666ade46-7ecc.html anyways, since html, of html rules apply. have little "hello world" app uses both anchor navigation javascript navigation: <html> <head> <t...

entity framework 4 - How to make a nullable property in EF Codefirst? -

i have 2 pocos in "bookshelf" test application: /// <summary> /// represents book /// </summary> public class book { public int id { get; set; } public string title { get; set; } public string author { get; set; } public string isbn { get; set; } public virtual loaner loanedto { get; set; } } /// <summary> /// represents loaner /// </summary> public class loaner { public int id { get; set; } public string name { get; set; } public virtual icollection<book> loans { get; set; } } is there way loanedto nullable? mean book isn't loaned, right! tried public virtual loaner? loanedto { get; set; } but get: type 'rebteltests.models.loaner' must non-nullable value type in order use parameter 't' in generic type or method 'system.nullable' so must thinking wrong somewhere, can't figure out. easy squeeze guys. you don't need special. classes nullable. i tried (with...

uitabbarcontroller - iPhone : Hiding the tab bar on the current view -

is there way hide , show tab bar on current view on. not sethidesbottombarwhenpushed because works view pushed. you can navigation controller [view.navigationcontroller setnavigationbarhidden:yes animated:yes]; but surely there way tab bar. add code applicationdidfinishlaunching method: [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(toggletabbarhidden) name:@"toggletabbarhidden" object:nil]; make method in appdelegate so: -(void)toggletabbarhidden{ for(uiview *view in self.window.subviews) { if([view iskindofclass:[uitabbar class]]) { if(view.hidden){ view.hidden = no; break; } view.hidden = yes; } } } now, whenever want show/hide uitabbar, fire notification: [[nsnotificationcenter d...

Validating DICOM File -

i have pick valid dicom files folder. can recursively pick files folder have *.dcm extension. file *.dcm picked , such file not valid dicom file. what best way. i thought of reading few byte of file , validating. or any other method or other exes have validates. thank you, harsha edit: solution problem: used dcmftest.exe verification. hope on right track. -harsha validating dicom file not easy task considering different mandatory , optional tags present in different iods. think better use existing solution this. can take @ dcmcheck dcmtk this.

command line - About packages in java -

suppose there 1 folder 'product' in have product.java without main function file , outside product folder , there source.java file having main function have declared object of product.java make use of packages call source.java now tell me way call file : except using 1.classpath in cmd prompt 2.without setting environment variable you have set classpath, may set jar's manifest.mf . http://java.sun.com/developer/books/javaprogramming/jar/basics/manifest.html if want youse manifest have package generated classes inside jar-archive.

vbscript - Script timesout in the middle of execution -

i wrote small script re-organize .mp3 collection. when run script, process several thousand files till hit error condition (normally move of file had special character in name/path hadn't counted for), exit script text script execution time exceeded on script "c:\devspace\mp3move.vbs". script execution terminated. im not sure why happening. in effort figure out occured added several msgbox lines, , found msgbox popup, auto-close quickly. here code - appoligize not getting formatting correctly in forum 'takes .mp3 files in source dir, reads artist tag associated file 'checks dir named after artist in destination dir 'if folder artist/album not exists, create 'then move .mp3 file dest dir dim oappshell, ofso, ofolder, ofolderitems dim strpath, dim sinfo idebug=0 sinfo = "item description" strpath = "k:\_preprocess" sdestination = "k:\music" set oappshell = createobject("shell.application")...

multithreading - How to implement two UI threads LWUIT in Blackberry? -

i writing application blackberry using lwuit. want display popup window while process carried out in window opened up. how can this? thanks in advance, sajith weerakoon. you can't have 2 ui threads, can background processing on separate thread created using new thread(x).start(); synchronize ui thread can use callserially/callseriallyandwait e.g.: new thread() { public void run() { // whatever lwuit calls display.getinstance().callseriallyandwait(new runnable() { public void run() { // happen on lwuit thread, can whatever } }); // continue doing whatever } }.start();

jquery - PHP JSON response contains HTML headers -

i've got strange problem i'm trying write php page returns json jquery ajax call. problems despite setting content type application/json, response seems include html header. here's php code: // code generates array header("content-type: application/json"); echo json_encode($return); then in javascript: $.ajax({ url: '/vaphp/services/datatable.php', datatype: 'json', data: { type: 'invoices' }, success: function(data) { // show message saying it's been sent! alert('success!'); }, error: function(xmlhttprequest, textstatus, errorthrown) { alert('error!'); } }); the response seems this: <!doctype html public "-//w3c//dtd html 3.2//en"> <html> <head> <title></title> </head> <body> {"aadata":[["2007-...

iphone - How to compare a NSNumber in an if -

how to: if (mynsnumber == 1) { ... } this doesn't seem build the object: if mynsnumber nsnumber , code should read, if ([mynsnumber intvalue] == 1) { ... } if nsinteger , can directly compare integer literal. because nsinteger primitive data type. if (mynsnumber == 1) { ... } note: make sure don't have * in declaration. nsinteger declarations should read, nsinteger mynsnumber; // right nsinteger *mynsnumber; // wrong, nsinteger not struct, primitive data type. the following based on @boltclock's answer, posted here however if need use pointer nsinteger (that is, nsinteger *) reason, need dereference pointer value: if (*mynsnumber == 11) { }

android: sqlite database empty after phone restart or kill per taskmanager -

i have created database in android app: context context = this.getapplicationcontext(); sqlitedatabase db; string path = "cultura.db"; db = context.openorcreatedatabase(path, context.mode_world_writeable, null); ok if app killed task manager or phone restarted database empty. have solution???? the code create database follows : sqlitedatabase sampledb = null; sampledb = this.openorcreatedatabase(constants.db_name, mode_private, null); the database shouldn't empty if phone restarted. did created tables & inserted values ?

database - how to reset auto increment field in ms access -

possible duplicate: how start counting 1 after erase table in access ? hi all what query reset auti_increment field in ms access database? you can find information using google, here's link ms support article describes process: how reset autonumber field value in access i haven't reproduced info here it's lengthy. there not appear magic, single, command reset counter.

c - Implement Windows CryptoAPI CryptDeriveKey Using OpenSSL APIs -

i have cryptoapi code encrypt\ decrypt given data using aes-128 , key derived password using sha-256. how can write openssl equivalent implementation able encrypt data it, decrypt cryptoapi , vice versa? trying use evp_bytestokey evp_aes_128_cbc() , evp_sha256() didn’t work “as is”. (by "doesn't work" mean - can't decrypt cryptoapi's generated encrypted data , vice versa. work decrypt openssl's encrypted data). any idea or reference? thank in advance. here windows cryptoapi code: // handle default provider. if(cryptacquirecontext( &hcryptprov, null, ms_enh_rsa_aes_prov, prov_rsa_aes, crypt_verifycontext)) { _tprintf( text("a cryptographic provider has been acquired. \n")); } else { goto exit_preparecapi; } ...

asp.net - Connectionstring from web.config-Crystal Reports -

i having following function create crystal report. want change function uses connection info web.config myrepository _myrepository = new myrepository(); system.data.sqlclient.sqlconnection myconnection = new system.data.sqlclient.sqlconnection(); myconnection.connectionstring = "data source=mysrv;initial catalog=mydb;persist security info=true;user id=sa;password=mypass"; system.data.sqlclient.sqlcommand mycommand = new system.data.sqlclient.sqlcommand("dbo.spmysp"); mycommand.connection = myconnection; mycommand.parameters.add("@positionid", sqldbtype.int).value = (cmbpositions.selectedvalue == "" ? 0 : convert.toint32(cmbpositions.selectedvalue)); mycommand.commandtype = system.data.commandtype.storedprocedure; system.data.sqlclient.sqldataadapter myda = new system.data.sqlclient.sqldataadapter(); myda.selectcommand = mycommand; asale _ds = new asale(); myda.fill(_ds, "dbo.spmysp"); rptsale orpt = new rptsale(); orpt...

java - How to determine if URL is an image? -

i check if url given user image (jpg, png, gif). first idea: check file extension in url. second idea: resource server (by http get) , load java picture library info if image (seriously disadvantage: slow). or maybe yet solution? you should use http head, not full get. should include content-type known server. of course test extension first , , expensive/slow http roundtrip if it's inconclusive.

ruby on rails - How can I get a Twitter screenname/username with the twitter_oauth gem using their id? -

how can twitter screenname/username twitter_oauth gem using id? here go, sample in irb: require 'rubygems' require 'twitter_oauth' client = twitteroauth::client.new id = '5452272' temp = client.show(id) puts "screenname: #{temp['screen_name']}, username: #{temp['name']}"

vb.net - Nhibernate partial eager load of child collection -

if have parent object (parent) has list(of child) objects many-one relationship. possible return parent subset of it's child objects (eagerly loaded)? using vb , criteria. e.g. if parent 1 has 50 children (20 type x 30 type y) , want return parent collection containing type x. i want collection size of 20 it's eagerly loaded children? thanks hql query. fetch keyword initialize children along parent. from parent left join fetch parent.children child child.type = x

c# - How can I use the WinFax Pro COM objects from a .NET app? -

i know, winfax pro 1998. (note: not winfax.dll, apparently part of windows. winfax pro, separate commercial add-on app delrina, , later acquired symantec). i'm working in office still uses winfax pro operational system. have customer fax numbers stored in winfax pro "phonebook", , use notify customers of service visits. way works is, looks @ (printed) schedule, generated mac calendar, clicks on appropriate entries in winfax phonebook, send notification fax. this used call "swivel chair" integration, referred 2 screens. isn't 2 screens - it's 1 sheet of paper , 1 screen. anyway i'm trying automate , having trouble. the news: - winfax pro exposes functions com objects: winfax.sdksend fax sxending engine; winfax.sdkphonebook address book, , on. - winfax pro ships type library, wfxctl32.tlb, describes these various com objects. - able use winfax.sdksend object .net (c#), via wrappers generated tlbimport. (i'm using .net 3.5, ca...

how to ask for more permission after initial authentication in Facebook -

i've facebook app @ i've asked users give email, work info etc. users have granted permission retrieve these information. now want retrieve phone numbers i've not asked previously. so how ask authenticated users give access phone numbers?? code can add , next time logged in, prompted authenticate info?? you can call fb.login again specify permissions want request time scope. example below, requesting publish_stream: fb.login(function(response) { if (response.authresponse) { // user gave permission } else { // user did not give permission } }, {scope:'publish_stream'}); you can use fb.ui method set 'permissions.request' see http://fbdevwiki.com/wiki/fb.ui#method:_.27permissions.request.27

optimization - Java: How to check for null pointers efficiently -

there patterns checking whether parameter method has been given null value. first, classic one. common in self-made code , obvious understand. public void method1(string arg) { if (arg == null) { throw new nullpointerexception("arg"); } } second, can use existing framework. code looks little nicer because occupies single line. downside potentially calls method, might make code run little slower, depending on compiler. public void method2(string arg) { assert.notnull(arg, "arg"); } third, can try call method without side effects on object. may odd @ first, has fewer tokens above versions. public void method3(string arg) { arg.getclass(); } i haven't seen third pattern in wide use, , feels if had invented myself. shortness, , because compiler has chance of optimizing away or converting single machine instruction. compile code line number information, if nullpointerexception thrown, can trace exact variable, since have 1 such check ...

c# - Stop Visual Studio 2005 adding references to System.Data and System.XML -

does know how can stop visual studio 2005 adding references system.data , system.xml assemblies every time add class c# project? not use of them , need remove them everytime notice. thanks. that's because class template contains such. edit it, open: c:\program files (x86)\microsoft visual studio 10.0\common7\ide\itemtemplatescache\csharp\code\1033\class.zip \class.vstemplate and remove unnecessary references. to remove unnecessary namespaces, edit: c:\program files (x86)\microsoft visual studio 10.0\common7\ide\itemtemplatescache\csharp\code\1033\class.zip \class.cs

synchronization code smell? -

i analyzing lot of multi-threaded code , i'm seeing many locks. methods have 2 locks in row this: classa::foo() { locka.lock(); lockb.lock(); ...//do stuff lockb.unlock(); locka.unlock(); } my question general (and can't provide actual code). code smell? bad practice? can't prove code can simplified, seems if coded correctly there wouldn't need locking 2 things. lock should manage set of resources need synchronization, right? if there 2 locks overlap management of resources, there deadlocking issues? please let me know if have insight. thanks, jbu it might smell, might not, depending on context , project scope. if find juggling 5 locks syncronize queued list, maybe doing wrong. want have nice 1-1 ratio between shared resources , locks. sometimes can tempting lock on finer-grind levels (ie. use lock on each item of list rather lock entire list). rezist urge until profiler tells lock heavily-contented. othertimes should able...

wcf - IIS7.5 AppFabric - no Deploy option -

i trying deploy wcf service appfabric there no deploy option when right click on default web site in iis manager. yes new install. anybody got ideas on how activate this actually found had reinstall (did complete install) msdeploy , worked fine.

ruby on rails - devise password update -

devise after updating password redirects /secret, instead of user_root_path... how can fix this? ...mmmh.... have set root? #routes.rb root :to => 'home' # or wherever want...

flex - How to read from AIR manifest file within AS / MXML code -

flash builder generated appname-app.xml descriptor every air project. there number of settings, values there, including below. possible read these in code without explicitly loading xml @ runtime (even don't know if it's possible)? maybe loader.info or similar? <!-- name displayed in air application installer. may have multiple values each language. see samples or xsd schema file. optional. --> <name>ffff</name> <!-- string value of format <0-999>.<0-999>.<0-999> represents application version can used check application upgrade. values can 1-part or 2-part. not necessary have 3-part value. updated version of application must have versionnumber value higher previous version. required namespace >= 2.5 . --> <versionnumber>1</versionnumber> <!-- description, displayed in air application installer. may have multiple values each language. see samples or xsd schema file. o...

silverlight - Can you specify different font size for each fallback font? -

when specifying fallback font in silverlight, possible pair font size? the problem different fonts take different amount of space @ given font size. i'd able provide font size each fallback font make them more compatible in terms of space consumption. as of silverlight 4, answer no. great idea, , should push it! (go here request it) fallbackfontfamilyname value helps silverlight find font, not use it. here docs fontfamily , fontsource . xaml allows specify pt, or px measurement every fontsize . however, silverlight doesn't care, , defaults font sizes px. nice if give specific size each use of font. +1 wpf, -1 consistency

ms access - Deleting a row in a Subform -

i have subform within form in access 03. need macro delete row in subform. tried below code deletes fields in form. private sub command104_click() on error goto err_cmddeletecustomer_click docmd.domenuitem acformbar, aceditmenu, 8, , acmenuver70 docmd.domenuitem acformbar, aceditmenu, 6, , acmenuver70 exit_cmddeletecustomer_click: exit sub err_cmddeletecustomer_click: msgbox err.description resume exit_cmddeletecustomer_click end sub you using wizard code. bad , has been deprecated sometime. newer version docmd.runcommand. subform, easier run little sql command button, example: dim db database dim ssql string set db = currentdb ssql = "delete mytable id =" & me.mynumericidcontrolname db.execute ssql, dbfailonerror msgbox "deleted " & db.recordsaffected

javascript - Script issue in PHP -

<?php echo "<script type='text/javascript'>$('#tnxerror_captcha').html('test');</script>"; ?> <div class="tnxerror" id="tnxerror_captcha"></div> the above code not working. try this: trying access tnxerror_captcha' before available in dom <?php echo "<script type='text/javascript'>$(function(){$('#tnxerror_captcha').html('test');});</script>"; ?> a better way embed javascript rahter echo since there noy dynamic html generation need: <?php if(some_condition){?> <script type='text/javascript'> $(function(){ $('#tnxerror_captcha').html('test'); }); </script> <?php } ?>

Transfer large amount of data from DB2 to Oracle? -

i need every day transfer large amounts of data (about several millions records) db2 oracle database. u suggest best perfoming method that? db2 allow select oracle replication target. efficient , easiest way every day, removes "intermediate container" objection have. see this introduction (and more documentation online) more.

Android : Static variable null on low memory -

i have application has static variables. these variables stored in independent class named datacontext. these variables initialized raw files @ application start (a method named datacontext.initconstant() called in oncreate() of myapplication extends application). (edit : initconstant method use asynctask load data files). when application comes background time or when application used memory, these static variables become null. how can prevented? if not should static variables? i have other data stored in static variables used across different activities, clear them or pass them null in onlowmemory() of myapplication. what best way keep data accessible between activities if these data big serialized in intent, database can't used (for whatever reason), , can't stored in files through serialization either? most issue application being killed while in background, , recreated when come it. check out activity lifecycle documentation on when might occur ...

serial port - Arduino programming using USB download fails on Windows 2000 -

i have number of windows 2000 systems trying use program new arduino uno , mega devices. these boards come usb connection, upgrade prior ftdi . i'm not able download arduino code board windows 2000 system the supplied drivers *.inf files modify standard usb driver comes windows (in case windows 2000). i go through process of setting port, setting device , doing download. download fails, , apparent error pc can not communicate board. i've checked port, adjusted baud rates, etc. i've moved port number high port number (ie com12) lower port (com2) without success. see activity on rec/xmt lights on arduino board, type of data being sent , received. i'm looking for: someone has been able download files windows 2000 arduino or a way shim inside usb driver able watch traffic going , down board can continue debug this. or some general tips things @ in .inf file need set/not set make work on windows 2000. i know boards work i've used them on diffe...

Mercurial - view diff of all files in all changesets listed in hg out? -

we have repositories proj & proj_v1. when this: cd c:\proj hg fetch ..\proj_v1 hg out we see list of changesets proj_v1 pulled proj along "auto merge" changeset requisite merge. what mercurial command can use see diff of files in changesets listed in output of hg out ? we'd review changes pushed proj when hg push . would hg out -p work you?

Save objects in a JTree but change the displayed name (java swing)? -

i have made jtree , filled objects fron arraylist. when display contents of jtree gui, dont want see memory address wherethe object stored, customized string. for example: add object tree: defaultmutabletreenode tempnode = new defaultmutabletreenode(workspaces.get(i)); and see on gui is: package.workspace@1df38f3 i want alternative text instead of package.workspace@1df38f3 to displayed. how can fix code support this? jtree going call tostring function on items add , display that. if can write tostring workspace object fix problem. if can't modify workspace object should create wrapper object has tostring want.

.net - Verifying that a DataTable is sorted -

i working on creating custom database test condition in visual studio, , trying verify sort order. i have no problem verifying rows in datatable sorted, want verify each sort column has @ least 1 grouping more 1 distinct value. i maintaining list of integers define sorted columns (negative integers indicate descending sort order - , absolute value of integer column number). let me clarify. i writing unit test condition verifies sorted datatable. can verify row in correct sorted order, want verify result set contains data tests sort. in order words, result set 1 row or number of duplicate rows indeed sorted, doesn't test sort. i need verify each level of sort contains @ least 2 distinct values in @ least 1 grouping. in past used combination of sql , .net code , used following set of queries make sure there enough data test sort. select top 1 count(distinct column1) table having count(distinct column1) > 1 select top 1 column1, count(distinct column2) tab...

c++ - Is a letter compare slower than number compare? -

bear me here. a couple months ago remember algorithms teacher discussing implementation of bucket sort (named distribution sort in algorithms book) , how works. basically, instead of taking number @ face value, start comparing binary representation so: // 32 bit integers. input: 9 4 4: 00000000 00000000 00000000 00000110 9: 00000000 00000000 00000000 00001001 // etc. and start comparing right left. // first step. 4: 0 9: 1 output: 9 4 // second step 4: 1 9: 0 output: 4 9 // technically stable algorithm, cannot observe here. // third step 4: 1 9: 0 output: 4 9 // fourth step 4: 0 9: 1 output: 9 4 and that's it; other 28 iterations zeroes, output won't change anymore. now, comparing whole bunch of strings go // strings input: "christian" "denis" christian: c h r s t n denis: d e n s // first step. christian: n denis: s output: christian, denis // second step christian: denis: output: denis, christian // ... and f...

flex - AS3 adding 1 (+1) not working on string cast to Number? -

just learning as3 flex. trying this: var somenumber:string = "10150125903517628"; //this actual number noticed issue var result:string = string(number(somenumber) + 1); i've tried different ways of putting expression , no matter seem result equal 10150125903517628 rather 10150125903517629 anyone have ideas??! thanks! all numbers in javascript/actionscript double-precision ieee-754 floats. these use 64-bit binary number represent decimal, , have precision of 16 or 17 decimal digits. you've run against limit of format 17-digit number. internal binary representation of 10150125903517628 no different of 10150125903517629 why you're not seeing difference when add 1. if, however, add 2 (should?) see result 10150125903517630 because that's enough of "step" internal binary representation change.

Where to find java class files created by GWT deferred binding? -

if understand these explanations http://code.google.com/intl/de-de/webtoolkit/doc/latest/devguidecodingbasicsdeferred.html right gwt compiler creates *.java file every class generated via gwt deferred binding. these files in memory or stored in kind of temporary work directory? there way have @ generated source code? well, can give path generated files gwt compiler "-gen " option. also can give same option com.google.gwt.dev.devmode class. gwt compiler options

asp.net mvc 3 - MVC 3 specifying validation trigger for Remote validation -

this question has answer here: asp.net mvc 3 jquery validation; disable unobtrusive onkeyup? 6 answers i have implemented remote validation using mvc 3 unobtrusive validation follows the model public class myviewmodel { [remote("validateaction", "validation")] public string text { get; set; } } the controller public partial class validationcontroller : controller { public virtual jsonresult validationaction(string atexttovalidate) { if(atexttovalidate == /* condition */) return json(true, jsonrequestbehavior.allowget); return json("this not valid, try again !", jsonrequestbehavior.allowget); } } the view @using (html.beginform() { @html.textboxfor(m => m.text) @html.validationmessagefor(m => m.text) } and that's it, works, validationaction fired on every key ...

php - How to get specific content from wikipedia? -

i'm trying make personal tv guide display title , airdate of last available episode of h.i.m.y.m , tbbt. as resource information decided use wikipedia. know wikipedia has it's own api , i've been looking through documentation quite while it's extensive , don't know start. far i've got point i'm querying url: http://en.wikipedia.org/w/api.php?action=query&title=list_of_how_i_met_your_mother_episodes&prop=info&format=dbg and receiving following array: array ( 'query' => array ( 'pages' => array ( 6048517 => array ( 'pageid' => 6048517, 'ns' => 0, 'title' => 'list of how met mother episodes', 'touched' => '2011-01-25t15:33:45z', 'lastrevid' => 409077359, 'counter' => 0, 'length' => 4417, ), ), ), ) the problem have no idea how...

Rails 3: ":method => :post" doesn't work... seems to be 'GET' when it should 'POST' -

i'm trying implement "friendship" in rails 3 app described in railscast 163:self referential assosication i have set described. using basic user model logis in authlogic works fine. when try add friend using following link: <% user in @users %> <%=h user.username %> <%= link_to "add friend", friendships_path(:friend_id => user), :method => :post %> <% end %> i redirect http://localhost:3000/friendships?friend_id=2 , unknown action action 'index' not found friendshipscontroller error no further explanation. expecially strange since have hard coded redirect "user#show" method current user (i.e. redirect profile after adding friend). if helps, here "friendships#create" method: def create @friendship = current_user.friendships.build(:friend_id => params[:friend_id]) if @friendship.save flash[:notice] = "added friend." redirect_to :controller => ...

asp.net mvc - Best technique to track web page hit count and catch some abuse -

i have asp.net mvc web site database of songs. i'd track how many page views each song getting, don't want double count if people hitting multiple times day. if user goes song 10 times day, want count incremented once day. at first, thinking of using sessions or else on server track won't work if deploy farm (since session per server , user might hit different servers). thinking of using cookies, want know if there other suggestions? (and if i'm use cookies, what's best way store info) if these anonymous users, cookies best bet. have make sure they're not session cookies, expire once user closes browser.

sql - Proper field orders for covering index - MySQL -

is there standard order create covering index table in mysql? meaning if have query has clause, order , fields in select statement, in order have fields index create covering index? a covering index takes list of columns in comma separated list. list traversed/reviewed starting @ left side. if left column not used, index not used. meaning, having column list like: col_a, col_b, col_c if query not contain reference col_a , won't used. if order changed to: col_c, col_b, col_a ...then col_c needs referenced in query. continuing use second covering index column example, col_b or col_a don't have in in query evaluation moves column column, left right. column references index use can in following clauses: select where group by having order by reference: multiple-column indexes, mysql documentation

c# - Need design advice for custom list control in .NET Windows Forms -

first of all, here's concept art how custom list control must look: http://img816.imageshack.us/img816/1088/customlistctrl.png each list item complex , turns "edit interface" when mouse hovers on it. have png image files every skinning detail of thing, including scroll bar. what best approach started implementing this? create custom control , render of in gdi ? could make list control transparent clip region scroll bar? individual list items, use textured panel backdrop each item , place existing .net forms (like combo boxes, buttons, edit fields, etc) children of that? i've never had create detailed before. if want control exactly given picture (which nice), end drawing of it, if not of it, yourself. 1 possibility subclass each control being used , override onpaint method custom drawing. assumes design in picture individual control. i myself might make each row separate usercontrol -derived class, perhaps internal constructor users of contr...

WPF: Detect Image click only on non-transparent portion -

i have image control in wpf contains image lots of transparent pixels. right now, mousedown event on image fires whenever click within full rectangular region of image control. way detect if mouse click occurred on nontransparent portion of image. what best way of doing this? using technique in this answer can derive image create opaqueclickableimage responds hit-testing in sufficiently non-transparent areas of image: public class opaqueclickableimage : image { protected override hittestresult hittestcore(pointhittestparameters hittestparameters) { var source = (bitmapsource)source; // pixel of source hit var x = (int)(hittestparameters.hitpoint.x / actualwidth * source.pixelwidth); var y = (int)(hittestparameters.hitpoint.y / actualheight * source.pixelheight); // copy single pixel new byte array representing rgba var pixel = new byte[4]; source.copypixels(new int32rect(x, y, 1, 1), pixel, 4, 0);...

language agnostic - Algorithm for computing timetable given restrictions -

i'm considering hypothetical problem, , looking guidance on how approach solving problem, algorithmic point of view. the problem: consider university. have following objects: teaching staff. each staff member teaches 1 or more papers. students. each student takes 1 or more papers. rooms. rooms hold number of students, , contain types of equipment. papers. require type of equipment, , amount of time each week. given information enrollments (i.e.- how many students enrolled in each paper, , staff allocated teach each paper), how can compute timetable obeys following restrictions: staff can teach 1 thing @ once. students can attend 1 paper @ once. rooms can hold number of students. papers require type of equipment can held in in room provides type of equipment. hours of operation monday friday, 8-12 , 1-5. discussion: in reality i'm not concerned situation outlined above - it's general class of problem i'm curious about. @ first glance seems me...

Sql syntax to Trim alphanumeric data in mysql phpmyAdmin -

is there syntax query in mysql phpmyadmin trim alphanumeric(varchar) data? here's how want happen: in table have 2 fields id(int) , promocode(varchar)(25), inside promocode column have sample data befkr679gkqtx46afkp14vy composed of (25) ...and want trim first 12 alphanumeric only, making these befkr679gkqt .. , don't know how change existing 1,000 inputted data in table.. 12 not 25. back tables. if can't this, don't continue. test command on test table , make sure understand it: update my_table set promocode = substring(promocode,1,12); when works satisfaction on test tables, , complete, real table. more info on mysql string functions here: http://dev.mysql.com/doc/refman/5.0/en/string-functions.html running sql phpmyadmin here: http://community.mybb.com/thread-4720.html

oracle10g - Backup Time reduction question -

i told full db backup of db size 65gb takes between 4-5hrs in oracle 10g. normal ? we have separate program activity take 1.5 hrs. need perform full backup , program activity in single session means 5 + 1.5 = 6.5 hrs needed perform whole session. given maximum of 5-hr activity change window. question 1) there way in oracle 10g backup delta change occurred db (but dont know tables updated in db backup specifically) between 2 days ? if so, how ? 2) easy import delta-changed tables in db in order reduce backup time ? if so, how ? thanks actually have seen 65g database take 10 hrs. backups highly tunable medium. backup rate depends on many factors including medium being backed . setup i.e rman vs non rman . disk vs tape . if can add little more facts questions. answer can possible . oracle 10g introduced plethora of optimizations in backup area block change tracking file , recover as. details can found in oracle 10.2 backup & recover guide @ incremental stra...

open source .NET libraries available for writing ANSI 837 files in EDI? -

we have data stored in database , need create ansi 837 file data. there open source frameworks available in .net? oopfactory x12 parser open source c# implementation of x12 parser. edi notepad (free version) may this.

android - Determining the duration and format of an audio file -

given path (on sd card) audio file, best way of determining length of audio in milliseconds , file format (or internet media type)? (for duration 1 use mediaplayer 's getduration -method, seems slow/clumsy.) for length of audio file: file yourfile; mediaplayer mp = new mediaplayer(); fileinputstream fs; filedescriptor fd; fs = new fileinputstream(yourfile); fd = fs.getfd(); mp.setdatasource(fd); mp.prepare(); int length = mp.getduration(); mp.release(); check mimetype: https://stackoverflow.com/a/8591230/3937699

Android how to pass google account to webview -

i using webview show google canlender want pass google account programmatic-ally,so sethttpauthusernamepassword() function should need doesn't work @ all. here code: webview webview = (webview) findviewbyid(r.id.webview); webview.getsettings().setjavascriptenabled(true); webview.sethttpauthusernamepassword("www.google.com", "", "email", "password"); webview.setwebviewclient(new webviewclient() { @override public void onreceivedhttpauthrequest (webview view, httpauthhandler handler, string host,string realm){ handler.proceed("email","password"); } } public void onreceivederror(webview view, int errorcode, string description, string failingurl) { toast.maketext(activity, description, toast.length_short).show(); } }); webview.loadurl("http://www.google.com/calendar/"); if have idea make worked, please let me know. ...

windows 7 - Qt app, minimized to tray, on Win7 there's a problem with focus stealing prevention -

i have qt app which, skype, minimized tray. when user clicks tray icon, app window shown. this works fine on linux , winxp. on win7 however, app window shown stays below other windows - unless active window qt creator, or app (before minimized tray). must have focus stealing prevention. i know skype written in qt, , don't have problem, must fixable. here's code: void mainwindow::togglevisible(qsystemtrayicon::activationreason reason) { if (qsystemtrayicon::trigger == reason) setvisible(!isvisible()); } [edit] turns out had call activatewindow. changed code to: void mainwindow::togglevisible(qsystemtrayicon::activationreason reason) { if (qsystemtrayicon::trigger == reason) { if (isvisible()) { hide(); } else { show(); raise(); activatewindow(); } } } it works on win7 now. i use following code make application visible when clicked ...

windows 7 - UAC and remote control -

if you've developed remote control application i've done, must know screen capture doesn't capture uac dialog when dialog pop up, , result control can't continued. anybody know solution this? from understand, believe you're asking possible. in addition remote control software, test automation software , accessibility apps disabilities need way interact protected ui , secure desktop. regarding issues uac presents remote control software, see: http://www.uvnc.com/vista/ http://groups.google.com/group/microsoft.public.platformsdk.security/browse_thread/thread/acb3a0ccb7682506/d05b0a3026366423 those links contain info on how ultravnc project works around uac. ultravnc open source, code might resource well. i think solution type of problem involves delegating high-integrity tasks service. don't think there's other way around (besides disabling various uac settings). and needless say, writing app has unusually high level of control o...

VBScript Regex expression help in Excel VBA -

i need global changes number of spreadsheets , think best way use regular expressions have added reference microsoft vbscript regular expression type library , can process regular expressions. using function following signature: regexpsubstitute ( target string, searchregex string, replaceregex string) string i have number of cells contents this: 'alberts1:xlri_chem_chemical_1' * 'albert_chemicals_sg_lime' * 'albert_chemicals_conc_lime' * 'albert_lime_price' / 1000 all stuff starting "'albert_" need changed "'alberts1-" , other underscores in symbol need changed dashes. first part can with: new = regexpsubstitute(old, "(')([^-:_ ]+)(_)([^']*)(')", "$1" & scadaprefix & "-$4$5") but replaces first '_' '-' , need others in symbol. first symbol, starting "'alberts1:" should not changed. at moment, thinking best thing split string symb...

.net - In C#, Is Expression API better than Reflection -

nowadays, i'm exploring c# expression apis. use understanding how works, including difference between expression , reflection. want understand if expressions merely syntactic sugar, or indeed better reflection performance-wise ? good examples links articles appreciated. :-) regarding calling 1 method : direct call can't beaten speed-wise. using expression api globally similar using reflection.emit or delegate.createdelegate speed-wise (small differences measured; optimizing speed without measurements , goals useless). they generate il , framework compile native code @ point. still pay cost of 1 indirection level calling delegate , 1 method call inside delegate. the expression api more limited, order of magnitude simpler use, doesn't require learn il. the dynamic language runtime either used directly or via dynamic keyword of c# 4 add little overhead stay near emitting code cache checks related parameter types, access , rest. when used via dynami...