Posts

Showing posts from June, 2014

vim - Move to start and end of search lookup -

in vim/gvim able move front , end of current search lookup. possible? for example, file: a dog , cat hat , bat i able perform search, example /dog\sand , able move beginning of 'dog and' expression end , cursor starts on column 3, under letter 'd' of word 'dog' , moves column 9 under letter 'd' or word 'and'. the reason want able can search expression , use change command, c , combined movement command replace particular search expression. don't want use substitue , replace here, want perform operation using change command , movement key. you can change end of match c//e<cr> . , //<cr> take beginning of next match. work out kind of bindings make sense. instance tried following, , seems work nicely: :onoremap <silent>m //e<cr> so can cm change match. i'm not sure map //<cr> to, though. tried mapping n , , seemed work fine. don't know if problem you. :nnoremap <silent>n

postgresql - Postgres databases with different encoding -

i tried create databases different encoding in postgres (i'm using pgadmin database manager), when try create database non utf8 encoding, pgadmin shows me error saying can't create database because not match current locale "portuguese_brazil_1252" , lc_ctype configuration requires encoding "win1252". how configure in postgres? i'm running under locale test server windows xp (not choice). possible create databases different encoding or behavior postgres limitation? here had success managing that? thanks from docs : the character set encoding specified new database must compatible chosen locale settings (lc_collate , lc_ctype). if locale c (or equivalently posix), encodings allowed, other locale settings there 1 encoding work properly. [...] the encoding , locale settings must match of template database, except when template0 used template. you should able use create database either (or both): specify

php - Recursively linking records -

i have table timeslots users can sign for. on administrative end, admin-user can choose 'link' 2 timeslots together, says end-user, 'if sign 1 of these timeslots, must sign other timeslots linked it.' these links stored in table has 2 columns, 1 being id of timeslot requiring link, , other being id of timeslot being linked to. how can make such when linking 1 timeslot another, both depend on other being selected. needs recursive other linked timeslots well, following example: admin says: #1 linked #2 #3 linked #2 therefore: #1 linked #2 #2 linked #1 #3 linked #2 #2 linked #3 #3 linked #1 #1 linked #3 what best way accomplish this? right i'm trying put information link table, if there's way can more php , less sql work also. provide code sample, don't think helpful. edit: conceptual answers fine. don't need code written me unless demonstrative purposes. one approach may table of 2 columns in form of: node_id, , link_id. in case,

php - Replace objects by other objects in-place -

suppose i'd build database abstraction layer, uses lazy loading mechanism. if ask layer load root object, loads external representation , constructs itself. it somehow identifies linked objects exist. since might costly load up-front, established proxies related objects. such proxies should able passed around. if first message called on such proxy, loads external representation , constructs itself. since references proxy may have been passed around, created object needs replace existing proxy-object in-place. can in-place replace object object in php? i don't believe it's possible object replace references object. instead, have proxy objects forward property access , method invocation using overloading . implement proxying on base proxy object (named e.g. ooproxy ), extend lazyproxy class lazily loads proxied object. long don't need examine type of object, has reference proxy won't able distinguish proxied.

iphone - Dynamic UIButtons with vertical spacing on a UIScrollView -

Image
i need space uibuttons out on uiscrollview. code have works, depending on amount of dataitems have, spacing not even. snippet in question cgrectmake(10, ((120 / (count + 1)) * (i + 1) * 3) ,300,50) specifically ((120 / (count + 1)) * (i + 1) * 3) working code int count = [dataitems count]; /* not specific value, can grow */ (int = 0; < count; i++) { uibutton* abutton = [uibutton buttonwithtype:uibuttontyperoundedrect]; [abutton settag:i]; [abutton setframe: cgrectmake(10,((120 / (count + 1)) * (i + 1) * 3) ,300,50) ]; [abutton settitle:[[dataitems objectatindex:i] objectforkey:@"feed"] forstate:uicontrolstatenormal]; [abutton addtarget:self action:@selector(viewcategories:) forcontrolevents:uicontroleventtouchupinside]; [scroller addsubview:abutton]; } screenshot the example on right should example on left far spacing goes. uibuttons sitting on uiscrollview , uiscrollview 's contentsize should grow if there more dataite

mongoid - Creating short, unique object id's in MongoDB -

i'm making app similar instagram using rails/mongoid. want unique id can use in url http://instagr.am/p/djmu8/ what's easiest way that? can derive such id default bson objectid mongo creates? you may try use first 4 bytes of objectid (they represent timestamp). but, 100% safe, it's better produce unique short id, implementing counter. can use separate collection maintain current value of counter. more details on mongo's objectid structure can found here: http://www.mongodb.org/display/docs/object+ids as alternative can convert convert hex string id representation representation based on 36 symbols (26 latin letters + 10 digits). shorter. it seems, there ruby library, can such conversions http://rubyworks.github.com/radix/

DataForm doesn't work in Silverlight 5 -

reproduction: create silverlight project turn version 5 add references silverlight toolkit (using nuget or direct) add dataform page this exception dataform constructor throws: {system.io.filenotfoundexception: not load file or assembly 'system.windows.controls.data.input, version=2.0.5.0, culture=neutral, publickeytoken=31bf3856ad364e35' or 1 of dependencies. system cannot find file specified. [io.filename_name] arguments: system.windows.controls.data.input, version=2.0.5.0, culture=neutral, publickeytoken=31bf3856ad364e35 debugging resource strings unavailable. key , arguments provide sufficient information diagnose problem. see http://go.microsoft.com/fwlink/?linkid=106663&version=5.0.60401.00&file=mscorlib.dll&key=io.filename _name @ system.windows.controls.dataform..ctor()} turn silverlight 4 now cool again weird note: work in vs/exp. blend 5 designers any ideas?? workaround??? found strange workaround: after returned sl version 4

help with java problem -

this question school work dont want complete answer how should go doing each part or clarifying question asking for in following method, call getcreditcardnumber() may throw invalidlengthexception , nonnumericexception or invalidcardnumberexception . modify method following: a. catch invalidlengthexception , print message “card number must 16 digits.” b. catch nonnumericexception , print message “card number must numbers only.” c. pass invalidcardnumberexception on calling method. in other words, don’t catch it, let calling method uses method know may throw invalidcardnumberexception . public void getorderinformation() { getcreditcardnumber(); } without providing exact code, per request, you'll need wrap call getcreditcardnumber() in try / catch block using mutliple catch statements. this how java, , other languages, perform exception handling. read quick tutorial , give shot.

delphi - How to get the highlighted item from the desktop or Windows Explorer with syslistview32? -

how might i, using delphi , syslistview32, highlighted item desktop or windows explorer? i'm not sure mean item, posted here how focused item text. it's more complicated task because list view messages can't fill buffer between processes, need pass through virtual memory pages allocated in foreign process. principle same kind of manipulation foreign items directly. i'm not familiar process memory allocation; useful edit appreciated. note: code below has been tested on 32 bit windows xp function getfocuseditemtext(const lvhandle: hwnd): string; var size: cardinal; process: thandle; processid: dword; memlocal: pointer; memremote: pointer; numbytes: cardinal; itemindex: integer; begin result := ''; itemindex := sendmessage(lvhandle, lvm_getnextitem, -1, lvni_selected); getwindowthreadprocessid(lvhandle, @processid); process := openprocess(process_vm_operation or process_vm_read or process_vm_write, false, processi

Xcode 4 fonts default to Helvetica -

i have xcode 4 running on brand-new macbook pro. problem this: when choosing fonts mac os font picker, handful displayed properly; rest appear helvetica. don't have problem in other applications, apple or otherwise. here fonts displayed correctly: arial, arial rounded, baskerville, cochin, courier, courier new, futura, georgia, helvetica, helvetica neue, marker felt, palatino, times new roman, trebuchet ms, verdana, zapfino thanks in advance. mine xcode 4.2 , every thing works fine. if doesn't work easy way call font code. //am using font called "ethiopic washra bold //copy resource folder , cell.textlabel.font = [uifont fontwithname:@"ethiopic washra bold" size:14]; cell.textlabel.text = [object objectforkey:@"title"]; cell.detailtextlabel.font = [uifont fontwithname:@"ethiopic washra bold" size:10]; cell.detailtextlabel.text = [object objectforkey:@"group"]; if question different please let me know can underst

java - Need to use Enum -

i clear advanced use of enum in java. many of points differentiate them regular classes , tells need clear me. can give practical example sample code advanced enum? can elaborate where should avoid classes , should use enum instead . please dont confused. not asking how use enum or use of enum. there many questions , answers on this. looking real time/ live / practical example should avoid other data type or classes. try this example : public enum day { sunday, monday, tuesday, wednesday, thursday, friday, saturday } usage: public class enumtest { day day; public enumtest(day day) { this.day = day; } public void tellitlikeitis() { switch (day) { case monday: system.out.println("mondays bad."); break; case friday: system.out.println("fridays better."); break; case saturday: case sunday: system

struct - How to covert a structure to a byte array in C? -

possible duplicates: how convert struct char array in c portable way of writing c struct file (serialisation c) i looking converting structure byte array in c , confused in doing that.please show me right way in achieving that. in advance. a structure byte array. starts @ &mystruct , has length of sizeof(mystruct_type) bytes. if binaries long or contain gaps, check #pragma pack settings. hth maro

objective c - Calling same ViewController Again and Again -

i having uitableview class.i loading again , again loading different contents ever time on click of cell. class testviewcontroller , calling again in dedselectrowatindexpath allocating , calling pushviewcontroller..it working fine..i want ask right way ? problem don't how many subcategory main category has.and further subcategory has.i have dig deep till last subcategory....i can't fix limit of view's as long you're releasing every new view push onto navigation stack should fine. there's nothing wrong instantiating multiple copies of same object.

c - How to read local variables with gdb? -

i know can find parameters looking @ positive offset $ebp using gdb: (gdb) x/4wx $ebp then, @ 3rd , 4th addresses using x/s because first , second parameter. local variables? how @ values @ negative offset $ebp? also, there anyway @ value of $eax? whenever try print value of $eax using x/s $eax , address out of bound or value 0, sure not because put constant value in register. i tried info locals message "no symbol table info available". first need compile debugging symbols binary. use -g option on gcc current command this. if you're using different compiler need consult documentation. after this, 'info locals' , print command work. to @ local variable need use 'print' command. example @ local variable 'i' it's easy 'print i'. you should able handle $eax in same way $ebp. suspect have problems because you're using x/s. x/s try , print out string, , continue until hits null character. if doesn't h

jqgrid - JQ Grid sorting integers -

can please tell me how sort integers/numbers in jq grid. regular sorting gives distorted order. hi got done when use loadonce=true , sorttype = 'int'. cant use loadonce, since need reload grid several times purpose. can how without using loadonce?? thanks, devan if use datatype:'json' or datatype:'xml' , the server responsible data sorting. sidx , sord parameters send part of request server describes sorting should use server. if want implement client side sorting , paging of data can use loadonce:true jqgrid parameter. in case should define sorttype property (having default value 'text') describes data type column. after first data loading datatype of jqgrid automatically changed 'local' , sorting, paging , filtering/searching of data implemented locally jqgrid itself.

sql - fetch data from multi tables with out relation ship between these tables -

for every week have excel sheet converted sql database excel sheet gave me 30 deference table same structure , field definition there no relationship between these tables. so want merge data these 30 table in 1 table i'm trying write t-sql fail using information_schema.tables or sys.tables table names , proceed fetch data these tables in 1 query. to combine tables exact same schema: select * table1 union select * table2 if entire db made of these tables should able use sp_msforeachtable procedure. create table #temptable (col1 int, col2 nvarchar(50)) sp_msforeachtable 'insert #temptable (col1 , col2) select col1 , col2 ?' select * #temptable drop table #temptable

c++ how to serialize/deserialize an object? -

possible duplicate: how save c++ object xml file , restore back? hi, can tell me best way seralialize , deserialize (of course) object? have class a lot of string, int values. west way create xml , after (when have xml) open , obtain values? can give me please code examples? to serialize/deserialize object, have this: ofstream f( "output.bin", ios::binary ); f.write( (char *) &myobject, sizeof( myobject ) ); f.close(); // later... ifstream f( "output.bin", ios::binary ); myclass myobject; f.read( (char *) &myobject, sizeof( myobject ) ); f.close(); however, has lot of drawbacks. example, application won't work object serialized in computer of different architectures. big problem objects cannot have relationship other objects, i.e., must simple objects. that's why people use format more understandable among different architectures. text structure, xml . can use number of xml libraries, such xerces . there variou

php - How do I surround all text pieces with paragraph tags? -

i want put paragraph tags around text items. should therefore avoid tables , other elements. how do that? guess somehow can made preg_replace? here couple of functions should want do: // nl2p // function convert newlines html paragraphs // without paying attention html tags. feed raw string , // return string sectioned html paragraphs function nl2p($str) { $arr=explode("\n",$str); $out=''; for($i=0;$i<count($arr);$i++) { if(strlen(trim($arr[$i]))>0) $out.='<p>'.trim($arr[$i]).'</p>'; } return $out; } // nl2p_html // function add paragraph tags around textual content of html file, leaving // html intact // function assumes html syntax correct , '<' , '>' characters // not used in of values tag attributes. if these assumptions not met, // mass paragraph chaos may ensue. safe. function nl2p_html($str) { // if find end of html header, assume part of st

error: expected identifier or '(' before 'public' - objective C -

i getting error when declare instance variable @interface foo : nsobject { @public int a; } @public -(id)init; -(void)dealloc; @end error: expected identifier or '(' before 'public' you not use @public or other access keywords outside interface definition, don't declare public or private methods in objective-c. as long expose method in header/interface it's automatically publicly accessible outside class. if add implementation, don't expose in header/interface (or expose in class extension ), it's private. @interface foo : nsobject { @public int a; } - (id)init; - (void)dealloc; @end now why want declare public int a instance variable (instead of using property) or explicitly declare 2 methods nsobject has beyond me.

objective c - Loading time in iphone application -

in application make avtivity download file of 500 kb, parsing xml file 1900 nodes. think it's better print on screen loading indicator, think? these long operations on iphone? practice insert loading indicator? yeah must show loading indicator other wise app looks hanged one. apple's hig suggest same.

iPhone - UIScrollView with Interface Builder -

i have set objects uilabel , uiimageview in scroll view interface builder. but, how can do?? know can done code, multilanguage app annoying :) edit: solve problem! explain again , better problem : had "draw" view uiscrollview interface builder because easiest way manage multilanguage view. first, have add uiscrollview in our view. in case don't able insert objects in point have height > 460. so, i've added scroll view, not in view , i've modified height , add objects everywhere want. try more specific. problems did encounter? need drag&drop outlets in scroll view (and optionally bind them iboutlet fields may have in controller class, according need do).

database - Dataset retrieving data from another dataset -

i work application switching filebased datastorage database based. has large amount of code written towards filebased system. make switch implementing functionality work old system, plan making more optimal use of database in new code. one problem filebased system reading single records, , read them repeatedly reports. have become alot of queries database, slow. the idea have been trying flesh out using 2 datasets. 1 dataset retrieve entire table, , dataset query against first, thereby decreasing communication overhead database server. i've tried @ datasource property of tadodataset dataset still seems require connection, , asks database directly if connection assigned. the reason prefer result in dataset, rather navigating first one, there implemented amount of logic emulating old system. logic based on having dataset containing results queried old interface. the functionality have support reading data, not writing back. how can use 1 dataset supply values datas

regex - How to uncomment an xml node from the command line? -

the regex select desired node like: <!--\s*<env-entry>(.*\s*)*</env-entry>\s*--> where xml file contains: <!-- <env-entry> <env-entry-name>solr/home</env-entry-name> <env-entry-value>/put/your/solr/home/here</env-entry-value> <env-entry-type>java.lang.string</env-entry-type> </env-entry> --> <!-- <other-entry> </other-entry> --> how uncomment selected node (probably sed/awk)? here crude solution, might have bugs @ corner cases, test out carefully: /<!--/ { comment = $0 getline if ($0 !~ /<env-entry>/) print comment } /-->/ { if (last_line ~ /<\/env-entry>/) next } { last_line = $0 print } update: forgot mention solution in awk, in case.

objective c - NSTimer crashing my application -

so have application uses nstimer. problem when nstimer runs, application crash exc_bad_access . started objective-c don't know how debug it. if thought call -(void)login{} [self login]; application work. code: .h @interface dj_wappdelegate : nsobject { nstimer *logintimer; } -(void)login; @end .m - (void)applicationdidfinishlaunching:(nsnotification *)anotification { [self login]; // works logintimer = [nstimer scheduledtimerwithtimeinterval:5.0 target:self selector:@selector(login) userinfo:nil repeats:yes]; // fails } - (void)login { nslog(@"logging in..."); // if comment out these 2 lines works nstimer!?... (i've have more code below) nsurl *loginconn = [nsurl urlwithstring:[nsstring stringwithformat:@"some-website.com"]]; nsinteger loginreturn = [[nsstring stringwithcontentsofurl:loginconn encoding:nsasciistringencoding error:nil] intvalue]; // when "loginreturn" return "

iphone - scrollView with pagecontrol programmatically? -

i want create scrollview pagecontrol programmatically. how can that? #pragma mark - #pragma mark loadgalleryview -(void) loadgalleryview{ galleryarr = [memberdic objectforkey:@"arrkey"]; if ([galleryarr count]%5 != 0) { noofpages = ([galleryarr count]/5)+1; } else { noofpages = [galleryarr count]/5; } viewcontrollers = [[nsmutablearray alloc] init]; (int i=0; i<noofpages; i++) { [viewcontrollers addobject:[nsnull null]]; } [galleryscrollview setpagingenabled:true]; [galleryscrollview setcontentsize:cgsizemake(self.view.frame.size.width* noofpages,69.0f)]; [galleryscrollview setshowshorizontalscrollindicator:false]; [galleryscrollview setshowsverticalscrollindicator:false]; [galleryscrollview setscrollstotop:false]; [galleryscrollview setdelegate:self]; [pagecontrol setnumberofpages:noofpages]; [pagecontrol setcurrentpage:0]; [self loadscrollviewwi

design - Asking user to create a direct account after registering from Facebook Connect / Twitter OAuth -

we're planning have sign-up page allows users use facebook connect or twitter sign in. after validate account , fetch information parent site, acceptable thing ask them create direct login/password our site? i've not seen sites this, havent used fb-connect well... acceptable? depends on users , expectations wonder why site using tactic wouldn't ask me create local account in first place. generally, industry seems moving towards trusted third party user authentication, facebook, twitter or openid. the value user of allowing sign-in application using third-party service (in has account) reduce number of accounts must keep track of, requiring create yet account seem make such benefit moot. of course, there nothing stopping creating local user model hold custom user data authentication handled either via passwords or third party, in: create table user ( user_id int primary key name varchar, validated_by enum('password','facebook',&#

actionscript 3 - How can i grayout a DataGrid? -

i working on flex, need grayout datagrid. not find direct control it. pls help. thanks in advance. maybe need disable datagrid using: mydg.enabled = false; ? as far question isn't clear can suggest thing use mx.printing.printdatagrid (more details here ).

Using MySQL to fetch data from two 'items' tables (both with different values), using a third 'itemlist' table -

first of all, long post. thank taking time read thoroughly! :) i have 3 tables follows (sorry long post, it's better clear...) -- table structure table itemdata create table if not exists `itemdata` ( `itemid` int(10) unsigned not null auto_increment, `brand` enum('dnc','fbiz','jbs','wspirit','aspirit','grace','legend','stencil','gfl','bocini','beseen','ljapp','lwreid') not null, `category` enum('shirts','headwear','winter','sports','bags','misc') not null, `name` varchar(255) not null, `code` varchar(20) not null, `colourway` varchar(255) not null default 'black', `gender` enum('mens','ladies','kids','unisex') not null, `sizerange` varchar(255) not null default 's|m|l|2xl|3xl|4xl|5xl', `discontinued` tinyint(1) unsigned not null default '0', pri

objective c - Problem parsing Google weather data only for Paris -

i have created app weather reports using http://www.google.com/ig/api?weather=paris . works cities except paris. in app have text field; if type "sydney", show weather in sydney, if type "paris", gives error: nsxmlparsererrordomain error:9 . don't know means. error? idea? according apple's documentation has encountered illegal character: nsxmlparserinvalidcharactererror = 9, make sure correctly parse utf-8

iphone - iOS UIScrollView with 2 finger pan for paging and one finger pan for "fingerpointer" -

i spend quite time figure out how achieve want didn't find proper solution it, yet. have uiscrollview changed pangesturerecognizer 1 2 finger recognition paging works when 2 fingers used. want add additional pangesturerecognizer shows courser if i'm panning 1 finger. tried adding additional pangesturerecognizer uiscrollview app crashes immediately. thought of adding subview transparent , positioned above uiscrollview , delegate 2 finger gestures uiscrollview resgin firstresponder. thought of overwriting pangesturerecognizer of uiscrollview , let add subview "fingerpointer"(a little point centered i'm touching screen right now) located. i'm totally clueless way should go , how implement it. appreciated! lot! timo ok, second time editing response. might trick you. if extend uiscrollview can override these methods in way: //in h file bool cursorshown; //in m file -(void)touchesbegan:(nsset *)touches withevent:(uievent *)event { if([touch

windows mobile - standard dialable number format (c++ tapi) -

i want programatically make calls on windows mobile device using standard c++ tapi linemakecall function. phone number (null-terminated) must in "standard dialable number format". there function linetranslateaddress should make conversion dialable format. i testing application , if use nonformated string (ex: 0728000000, valid country), number dialed not recognized (the dialing screen shows: dialing: unknown). i cannot find information standard format. know format, how should look, or secret? help please, thanks, here msdn documentation page describing format: dialable addresses

java - How to parse a String into multiple arrays -

good day! i making mini bookstore program , required read file based customer buys on specified counter follows: counter 4,book1 2,book2 2,book3 2,tender 100.00 counter 1,book1 2,book2 1,book3 3, book4 5,tender 200.00 counter 1,book3 1,tender 50.00 in short format is: counter -> items bought -> tender i tried doing not efficient: public list<string> getorder(int i) { list <string> tempqty = new arraylist<string>(); string[] orders = orderlist.get(0).split(","); (string order : orders) { string[] fields = order.split(" "); tempqty.add(fields[i]); } return tempqty; } how can read file , @ same time, ensures put on correct array? besides counter , tender, need know name of book , qty price , computer total price. need multiple arrays store each values? suggestions/ codes highly appreciated. thank you. map<string, integer> itemsbought = new hashm

html - How can I set a fixed height for my entire webpage? -

i thought simple fix: body { height: 1054px; } html { height: 1054px; } wouldn't set max height of page 1054px ? have tried these workarounds didn't work wanted: html { overflow: hidden; } <body><table id = "mytable"><tr><td> ..... </tr></td></body> #mytable { height: 100%; } how set absolute height webpage? more interested in why body , html height calls wouldn't work. lot of position: relative calls, have effect on it? width , height set absolute widths , heights of element respectively. max-width , max-height , min-width , min-height seperate properties. example of page 1054px square content , full background: html { min-width: 100%; min-height: 100%; background-image: url(http://www.example.com/somelargeimage.jpg); background-position: top center; background-color: #000; } body { width: 1054px; height: 1054px; background-color: #fff; } however, sinc

ajax - Why some time jquery click event fails? -

my page divided 2 parts vertically . left part menu section. clicking on menu brings proper data related menu in right part of page. doing using ajax call , div on right part refreshed. using jquery click event .. say: $("#left_part").click(function() { // ajax call here }); now have more jquery action on right part . (say show hide div work on click event. ) when new div reloads on right part click event on right part not working. when bind click event works. say: $("#some_right_part").click(function() {/ hide show here )}; not working $("#some_right_part").bind('click', function(event){ // hide show here )}; works fine important: when on fresh page (no ajax call yet bring right part) $("#some_right_part").click(function() {/ hide show here )}; works fine. but know is: $().click(function) calls $().bind('click',function) so, reason behind this? or perfect way solve such problem thanks w

vba - Easiest Way to Find and Remove Duplicates? -

i have 2 columns filled data in excel spreadsheet: column 1: b c d column 2: c d e f g desired data: a,b,c,d,e,f,g (not a,b,c,d,c,d,e,f,g) i want combine 2 columns, , remove duplicates. i'm coming c# word, understanding of vba limited. know create array dimension of dimension(column1)+dimension(column2), duplicate removal (is there 1 built in?), or that. any guidance appreciated, thanks! use following processing...and call other function or subroutine. sub removedupes() 'add column, "a" becomes "b" columns(1).entirecolumn.insert 'filter out duplicates , copy unique list "a" range("b1", range("b65536").end(xlup)).advancedfilter _ action:=xlfiltercopy, copytorange:=range("a1"), unique:=true 'add column, "b" becomes "a" columns(2).entirecolumn.delete end sub then join , sort results each column :)

oracle - How to handle to_date exceptions in a SELECT statment to ignore those rows? -

i have following query attempting use command in crystal report working on. select * mytable to_date(mytable.sdate, 'mm/dd/yyyy') <= {?enddate} this works fine, concern date may not in correct format (due user error). know when to_date function fails throws exception.. possible handle exception in such way ignores corresponding row in select statement? because otherwise report break if 1 date in entire database incorrectly formatted. i looked see if oracle offers isdate function, seems supposed handle exception. appreciated. thanks!! echoing tony's comment, you'd far better off storing dates in date columns rather forcing front-end query tool find , handle these exceptions. if you're stuck incorrect data model, however, simplest option create function conversion , handles error, create or replace function my_to_date( p_date_str in varchar2, p_format_mask in varchar2 ) return date l_date date; begin l_date

cocoa - NSCollectionView get selected item on button click -

i have nscollectionview bound nsarraycontroller has nsmutablearray content. items in nsmutablearray displayed should. i have windowcontroller class holds reference nsmutablearray . there button causes buttonclicked message sent windowcontroller. now inside buttonclicked want know item selected in nscollectionview . how do this? have no reference nsarraycontroller otherwise have asked sending selection . i've studied sample code no avail. how can reference selected item in nsarraycontroller ? if nscollectionview getting content nsarraycontroller , there binding set in ib on content or have programmatically bound these, there binding available on collectionview's selectionindexes , when bound arraycontroller give 'a reference selected item' in arraycontroller , collectionview. nscollectionview's itematindex, handed selected item's index, actual item selected. is actual item selected looking obtain reference to?

c++ - Ipod Synchronization with PC (moving files to and from an ipod touch) -

i'm building pc application in c++, , need synchronize txt data pc ipod touch , vice-versa. how it? have no idea. can synchronize usb port, or network? without paying (very expensive) license apple program not able talk ipod. however, if ipod jailbroken there number of ways can it. if wanting talk jailbroken ipods may still able if want stock out of price range single person afford. please update question if willing jailbroken ipods. correction : there things can do. if have cutom app app store installed on ipod, tunes allow syncing app programs ebook readers, may able sync. connect server while app running , latest txt file way. but there no way grab file or put file on ipod, , app running on phone trapped in it's own sandbox , not able see or touch other files on ipod.

Rails scaffold without the css file? -

is there way generate scaffold in rails 3.0 scaffold.css not created? @ command line can enter skip step? thanks there --no-stylesheets flag can use: rails g scaffold mymodel --no-stylesheets

python - PyQt tableview and edits to multiple selected cells -

ive been working on simple tableview model, ive hit stumbling block when want edit multiple cells. need able change checkstate on cells checkboxes. when select more 1 cell , toggle check boxes clicked cell updates checkboxes. great. thanks i guess have variable store selected cells. selected cells force checking calling setcheckedstate() method. let me know if i'm mistaken.

.net - Explicit loading of grandchild collections in EF 4.1 -

given following model ... public class parent { public int id { get; set; } public icollection<child> children { get; set; } } public class child { public int id { get; set; } public icollection<grandchild> grandchildren { get; set; } } public class grandchild { public int id { get; set; } } ... can eager load include parent children , grandchildren in 1 step so: context.parents.include(p => p.children.select(c => c.grandchildren)) is similar possible explicit loading ? the child collection can explicitely loaded way: parent parent = context.parents.find(parentid); context.entry(parent).collection(p => p.children).load(); but trying load children in similar way include ... context.entry(parent) .collection(p => p.children.select(c => c.grandchildren)).load(); ... doesn't compile und string overload of collection ... context.entry(parent).collection("children.grandchildren").load(); ... t

bluetooth - BlueCove library bluecove not available - Error using Bluecove/Java -

how install bluecove in ubuntu 11/eclipse ide? as far aware, had add bluecove.jar , bluecove-gpl.jar build-path of project within eclipse. i'm using sample bluecove code found here: http://bluecove.sourceforge.net/bluecove/apidocs/overview-summary.html#devicediscovery when compile it, i'm getting error: native library bluecove_x64 not available exception in thread "main" javax.bluetooth.bluetoothstateexception: bluecove library bluecove not available obviously, bluetooth usb dongle plugged in when this... have bluez protocol stack installed. what doing wrong? bluecove supported 64-bit linux? i've been trying installed on centos 5.5 machine well, no luck. any appreciated. thank-you i found solutution problem. for ubuntu version sudo apt-get install libbluetooth-dev for fedora version yum install bluez-libs-devel should trick source: http://bluecove.org/bluecove-gpl/ source: http://yasir03.online.fr/?p=267 the package has di

c# - SQL based storage vs SVN -

my team developing new application (c#, .net 4) involves repository shared users content. need decide store it. requirements follows: share files among users. support versions. enable search tags , support further queries such "all files created people group x" different views different people (team x sees own content , nobody else can see theirs). i'm not sure what's best, so: can search on svn using tags (not svn tags of course, more stackoverflow's tags)? is there sense in thinking of duplication - both svn , sql - content? any other suggestions? edit application enables users write validation tests later execute. tests shared among many groups on different sites. need versioning regular reasons - undo changes, sudden deletions etc. calls svn. thing is, want add option find tests tagged "urgent" , executed now, tracking purposes. i hope made myself more clear :) edit ii ran svnquery , looks good, have api can use? i

what is the earliest point in a wordpress page load where I can detect the post that is being requested? -

what earliest wordpress action post shown can detected reliably ? (either using global $post or detecting wp_query object or other way) eg. plugin needs detect incoming request plugin on different site, @ moment checks $_post var possible using add_action('plugins_loaded' , callback function uses $post = get_page_by_path($_server['request_uri'],'','post') $post object , uses post data other information used process response gets sent before headers or other standard wp processing happens intention of lessening load on blog receiving request. is there better way?, know there isn't earlier way because 'plugins_loaded' action gets called right after , well, plugins loaded there more reliable way using get_page_by_path ? i’d try filter 'the_posts' . find in wp-includes/query.php function get_posts() . passes found posts array reference, can use action. here plugin use inspect hooks: <?php /* plugin name: hook c

forms - WCF service not accessible in Windows Server 2008 -

i built wcf service, , i'm deploying windows server 2008. right now, don't have secure protocol turned on. will. i'd working either way. in site, i've had anonymous authentication enabled forms authentication. reason did prevent authentication popup on ipad, android , internet explorer. login screen. oh , did activate wcf in windows features. if you're knowledgeable making https ready, i'd figure out. thanks!! i'm getting error when try pasting in *.svc path url. system.servicemodel.serviceactivationexception: service '/wcfservices/accessioning/quickdataentryservice.svc' cannot activated due exception during compilation here web.config configuration far. <system.servicemodel> <servicehostingenvironment aspnetcompatibilityenabled="true"> <!--<baseaddressprefixfilters> <add prefix="http://localhost/" /> </baseaddressprefixfilters>--> <

android - API11 (and now12) and Spannable causing runtime NPE -

Image
update 14th may it's mix of text sizes breaks it, if replace <item name = "android:textsize">16sp</item> with change of colour like <item name="android:textcolor">#00ff00</item> then runs ok. the references textline,measure in logcat should have given me clue. i'd still fix though, i'm sure others have requirement mix of sizes in single text line. udpdated 12 may - minimal code example shown @ end of post code works fine under sdk 2.everything, throws null pointer exception when run in 3.0 emulator. i've narrowed down occurrence of spannablestring in code. i'm using put text of differing font sizes in banner area @ top of screen. logcat is: fatal exception: main java.lang.nullpointerexception @ android.text.style.textappearancespan.updatedrawstate(textappearancespan.java:209) @ android.text.textline.handlerun(textline.java:848) @ android.text.textline.measurerun(textline.java:399)

How to find if an IP address falls in a range specified using a pattern? - ASP.NET -

if have ip address: 192.100.100.2 , need ensure falls within range specified using wildcard patterns. the patterns can either: 1. 192. *. *. * 2. *. *. *. * 3. 192.1**. *.2 so essentially, asterisk or 3 asterisks specify valid range. there built in in asp.net can use validate ip address or more of custom validation? as @atomerz said, convert patterns regular expressions: ''//patterns search dim patterns() string = {"192.*.*.*", "*.*.*.*", "192.1**.*.2"} ''//test ip dim testip = "192.100.100.2" ''//loop through each pattern each p in patterns ''//swap 2 asterisk 2 regex digits (\d\d) , 1 asterisk 1 or more digits. escape period trace.writeline(system.text.regularexpressions.regex.ismatch(testip, p.replace("**", "\d\d").replace("*", "\d+").replace(".", "\."))) next

rspec2 - Rails 3 Testing: How To Open The Browser When Testing? -

what name of gem lets open browser result in request specs? thanks it called selenium :) https://github.com/ryanb/selenium-on-rails

bash - Get everything in a file after a grep'd string -

yesterday situation came needed me separate out tail end of file, specified being after particular string (for sake of argument, "foo"). needed went option knew work , disregarded right way or best way, , went following: grep -n foo file.txt | cut -f1 -d":" | xargs -i{} tail -n +{} file.txt > newfile.txt the thing bugged me use of xargs singleton value. thought go flex google-fu on interested see sort of things people out in so-land came situation sed -n '/re/,$p' file is occurs me right off.

php and xps files -

i want import content text im getting binary values, tried doesnt work: $data = file_get_contents("input.xps"); theres lib can use? thank you you need tool can convert .xps files. there ghostscript variant called gxps that. http://ghostscript.com/ghostxps.html conversion text 2 step process it, still simple: exec("gxps -sdevice=pdfwrite -soutputfile=input.pdf -dnopause input.xps"); $text = exec("pdftotext input.pdf");

Problems adding HTML .before .after an img with JQuery - JQuery closing tags -

alright, trying close img within (i know, know... not template) using jquery. happening - jquery closing tag adding .before... don't want closed until .after adding... struggling this. appreciated. i've tried .prepend/.append, , .wrap... here code... $(document).ready(function(){ $("img.bottomshadow").each(function(){ var imagewidth = $(this).attr("width"); var width = imagewidth + 10; $(this).before("<span class='image_shadow_container'>"); $(this).after("<img class='noimgbg' alt='' src='images/image_shadow.png' width='" + width + "'></span>"); }); }); what want is this: <span class="image_shadow_container"> <img src="images/fwidth_img_3.jpg" class="image_shadow" alt="" /> <img src="images/imag

xpath - XSLT: Test if node exists regardless if it's a child or grandchild of current node -

i'm working on xslt transformations , i've found out there might or might not node between current parent , it's clildren, depending on external factors. have change xslt code in order deal both of these scenarios: scenario 1: <parent> <child/> <child/> <parent> scenario 2: <parent> <nuisance> <child/> <child/> </nuisance> <parent> i have situations in test="parent/child" or otherwise use format of accessing parent/node. i need test="parent/magic(* or none)/child" they way know of can solve problem use: <xsl:choose> <xsl:when test="parent/child"> <!-- select="parent/child"--> </xsl:when> <xsl:otherwise> <!-- select="parent/*/child"--> </xsl:otherwise> </xsl:choose> but triple code in size , lot of manual labour... help app

java - How to convert 1D array to 2D by column major -

say have 1d array int[] x = {1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16} . conver 2d looks like: 1 5 9 13 2 6 10 14 3 7 11 15 4 8 12 16 currently, have for (int = 0; < 4; i++) { (int j = 0; j < nb; j++) s[i][j] = x[i + j]; } however, doesnt work. how this? try for (int = 0, k=0; < 4; i++) (int j = 0; j < nb; j++) s[j][i] = x[k++]; // may want s[i][j]

android - Using methods from an activity in another activity -

i have few "main" activities game , have created class include methods going used in various main activities. one method this: public void printmessage(string message, int time) { toast toastmessage = toast.maketext(this, "", toast.length_short); toastmessage.settext(message); toastmessage.setduration(time); toastmessage.show(); } obviously, method requires class extend activity, i'm guessing problem. i read using intents , putextra, getextra... overkill in case. know printmessage doesn't justify new class, have more methods , require activity well. i have mention i'm extremely new android , new java. right i'm used java's way of creating object , method call object. how tried here, works "regular classes", not activity classes. thank you. the class doesn't need extend activity, pass context of calling activity printmessage method adding parameter this... public void

c# - What is a .qst file? -

i java developer training , , got vary small c# university project make small changes in. inside there .qst file holds data. .qst file, , why when looked bit in google says called "quest file" edit: not graphic file, text file. in config file of project there following: <setting name="questfile" serializeas="string"> <value>quest.qst</value> </setting> from mr. google . seems sort of graphing file

c# 4.0 - WebBrowser Control C# -

hi im using webbrowser control login url https://direct.gov.mb.ca/ppr/jsps/login/login.jsp after entering correct username & password redirected non member page, (im still not logged in), used fiddler , did steps in browser , logged in , diff saw in fidler between program , regular browser, in browser when type same url , 2 cookies in header strange ,dont know gets cookies, program obviousely there no cookie in header, after login regular browser there 5 cookies in response program there 2 cookies i want mention there nothing wrong code , because logged in other https website , http websites , there unique site, how on come issue, been 3 days , not figure out edit: code htmldocument doc = webbrowser1.document; htmlelementcollection elemsname = doc.all.getelementsbyname("username"); int count = elemsname.count; htmlelement elmname = elemsname[0]; elmname.setattribute("value", "xxxxx"); htmlelementcollection elemspass = doc.all.getelemen