Posts

Showing posts from January, 2010

R-how to add columns to a data frame in a for loop? -

R-how to add columns to a data frame in a for loop? - i have info looks , 1000 files same info format. r_338 4 r_341 1 r_471 1 r_491 4 r_494 1 r_642 0 m_218 5 m_222 5 m_292 0 p_185 5 p_187 5 a_308 0 a_473 1 i appreciate if can direct me how can write r script can merge 1000 files keeping first column 1 time , rest 0f 1000 columns appended: example output: r_338 4 5 6 7 8 9 10 11 r_341 1 1 1 1 1 1 1 1 r_471 1 1 0 1 1 1 2 1 r_491 4 4 4 4 4 4 2 0 r_494 1 1 1 1 1 1 1 1 r_642 0 1 0 9 1 1 2 1 m_218 5 5 5 9 5 5 5 9 m_222 5 5 5 5 5 5 5 5 m_292 0 5 1 1 1 1 1 1 p_185 5 5 5 6 5 5 5 5 p_187 5 9 5 5 5 5 3 5 a_308 0 4 4 4 2 4 4 4 a_473 1 1 1 1 0 1 1 0 suppose have character vector containing file names. think l <- lapply(file.names,re...

asp.net - Jquery Ajax and Iframe -

asp.net - Jquery Ajax and Iframe - i have page on calling ajax function processing on server, during processing page displays loading icon. have iframe on same page, purpose of iframe info server , display in iframe using jquery ajax. the problem having is, iframe not updating until first function phone call completed... browser blocking multiple ajax calls or there missing? here code: the phone call made on main page: done on document.ready. calling same file new querystring $.ajax({ url: window.location.href + '&process=1', context: document.body, success : function(response){ window.location.href = response; } }); the page in iframe: calls function after every 2 seconds fetch info server window.settimeout(fetchstatus,1000); function fetchstatus(){ $.ajax({ url: 'webform1.aspx?act=status', context: document.body, ...

c - Packed Structs in (gcc)go -

c - Packed Structs in (gcc)go - i have old c code makes heavy utilize of packed structures. i'm looking using go wrapper code, having difficulty finding way pass or write definitions these structures. example: import "unsafe"; type aligntest struct { c byte; y int16; z int16; q int32; } func main() { vr := new(aligntest); fmt.println(unsafe.sizeof(*vr), "\n"); } returns 12 rather 1+2+2+4 = 9 want packed/unaligned struct. i know create byte array , parsing manually, seems brittle , error prone... you may want rethink architecture- seek passing binary input downwards c layer , utilize existing structures (you won't break don't change). i'm assuming construction packing looks this: #ifdef windows #pragma pack(push) #endif #pragma pack(bytealignment) // e.g. "#pragma pack(1)" or "#pragma pack(8)" //--- packed structs #ifdef windows #pragma pack(pop) #endif #ifdef posix #pra...

PHP timestamp/membership system not expiring on the exact date -

PHP timestamp/membership system not expiring on the exact date - i'm having few problems while creating little membership scheme timestamps. when show timestamp in date, tell me when active membership expires. however, on time/date, not expire, , script resets membership, , counts -numberhere. i don't think i'm doing wrong? i'm doing (time() - $timestamp) work out. here's script(s); $membership = mysql_query("select * `members` `membership` > 0 , `membertype` > 0") or die(mysql_error()); while($mm = mysql_fetch_array($membership)){ if((time() - $mm["membership"]) > $mm["membertype"]){ mysql_query("update `members` set `membership` = 0, `membertype` = 0 `username` = '" . $mm[username] . "'"); } else { echo (time() - $mm["membership"]); } } $membership_date = date("d-m-y h:i:s", $user["membership"]); echo "your membership expiry date...

What is the life time of a C++ data structure object? -

What is the life time of a C++ data structure object? - suppose have have car.h define class called auto , , have implementation car.cpp implement class car , illustration car.cpp can : struct helper { ... }; helper helpers[] = { /* init code */ }; car::car() {} char *car::getname() { .....} what life time of helpers array ? need static helper helpers[]; ? if have done bad practices, please allow me know. any variable declared/defined in global / namespace scope has finish life time until code ends. if want helper helpers[]; accessible within car.cpp should declare static ; otherwise allow global. in other words, helper helpers[]; // accessible everywhere if `extern`ed file static helper helpers[]; // accessible in `car.cpp` edit: as, @andrewdski suggested in comment below; should create helpers[] static variable since using within file; though helper not visible outside. in c++, if 2 exclusively different unit has same named global var...

Python - using subprocess to call sed? -

Python - using subprocess to call sed? - i wish phone call sed python using subprocess. script tried using below. however, pipes sed output standard terminal. seems '>' operator not recognised within subprocess.call statement. suggestions? import sys import os import subprocess files = os.listdir(sys.argv[1]) count = 0 f in files: count += 1 inp = sys.argv[1] + f outp = '../' + str(count) + '.txt' sub = subprocess.call(['sed', 's/\"//g', inp, '>', outp]) also - file names have spaces in them, i.e., " file1 .txt". issue? sed command works fine when phone call sed terminal, not script. thanks. use out_file = open(outp, "w") sub = subprocess.call(['sed', 's/\"//g', inp], stdout=out_file ) python sed subprocess

Run ant from Java -

Run ant from Java - is there tutorial on how run ant java? got code here: setting java_home when running ant java but haven't been able create work. i've been trying find illustration or tutorial on how utilize it. here's have far: project p = new project(); p.setuserproperty("ant.file", buildfile.getabsolutepath()); p.firebuildstarted(); p.init(); p.executetarget("default"); but guess error: exception in thread "main" target "default" not exist in project "null". @ org.apache.tools.ant.project.tsort(project.java:1912) @ org.apache.tools.ant.project.toposort(project.java:1820) @ org.apache.tools.ant.project.toposort(project.java:1783) @ org.apache.tools.ant.project.executetarget(project.java:1368) @ com.arthrocare.vss2svn.vss2svn.newprocess(vss2svn.java:128) @ com.arthrocare.vss2svn.vss2svn.main(vss2svn.java:52) java result: 1 i tried ...

iOS Audio Units : When is usage of AUGraph's necessary? -

iOS Audio Units : When is usage of AUGraph's necessary? - i'm totally new ios programing (i'm more android guy..) , have build application dealing sound dsp. (i know it's not easiest way approach ios dev ;) ) the app needs able take inputs both : 1- built-in microphone 2- ipod library then filters may applied input sound , resulting outputed : 1- speaker 2- record file my question next : augraph necessary in order able illustration apply multiple filters input or can these different effects applied processing samples different render callbacks ? if go augraph need : 1 sound unit each input, 1 sound unit output , 1 sound input each effect/filter ? and if don't may have 1 sound unit , reconfigure in order select source/destination ? many answers ! i'm getting lost stuff... you may indeed utilize render callbacks if wished built in sound units great (and there things coming can't here yet under nda etc., i've said much,...

android - how to perfom smooth scrolling to a position without actually having to see the scrolling taking place in a listview? -

android - how to perfom smooth scrolling to a position without actually having to see the scrolling taking place in a listview? - i have made android application in have listview , when list view loads wish show middle portion of adapter, hence using smoothscrollto method in listview . the problem above method can see scrolling take place, don't want. i have tried putting progressdialog when scrolling taking place , guess due load on ui thread, never shows up. hence hiding scrolling taking place behind progressdialog out of question. i cannot set smoothscrolling code in thread because ui thread can touch ui elements. how avoid user seeing scrolling take place? thank in advance. you can utilize scrollto(x,y) method of listview instead of smoothscroll android

ruby on rails - Cloning assosiations with attached file -

ruby on rails - Cloning assosiations with attached file - i have got object wich using pattern. objects has got number of associations. 1 of association attach. object has many attaches. can clone all, know, db data, how should files, attached object. i can imagine solutions, of them little hacky , don't native. for illustration can add together virtual attribute temprorary store ids of attaches while cloning object. what's solution have manage attachments? if paperclip, has callback handles remove/cloning real files on filesystem level. ruby-on-rails ruby clone attachment

php - How convert and save date as mysql format? -

php - How convert and save date as mysql format? - have form , consist of 10 date fields, , user can pick upto 10 dates. picking in format 'd, d m, y'. how can convert format mysql date format , save database.... <input type='text' name='day1' id='datepicker1' value='' maxlength="50" style="color:#999999" readonly="readonly"/> <input type='text' name='day2' id='datepicker2' value='' maxlength="50" style="color:#999999" readonly="readonly"/> if utilize strtotime , can convert date timestamp, , reformat mysql using date . example: $day1 = strtotime($_request['day1']); $day1sql = date('y-m-d h:i:s', $day1); you want utilize $day1sql insert mysql. repeat other dates. more information, have @ this. php jquery mysql

xml - XSLT task: replicate a list of element for each element of a different list with exceptions -

xml - XSLT task: replicate a list of element for each element of a different list with exceptions - i have problem trying setup template solve address situation: my xml looks like: <root> <recordset name="companies"> <record> <id>1</id> <description>company 1</description> </record> <record><id>2</id><description>company 2</description></record> ... <record><id>n</id><description>company n</description></record> </recordset> <gruppi> <supplier> <agreement>1</agreement> <company> <id>3</id> <description>compoany 3</description> </company> <compa...

c# - castle windsor service overrides for overriding default -

c# - castle windsor service overrides for overriding default - i wondering there pattern in windsor next scenario. basically have service (defaultservice) registered, , have plugin in want replace service (defaultservice) (pluginbasedservice) instances. i'm using hack - kernel.removecomponent(), re-adding plugin-based service. seems hacky. ihandleselector seems hacky scenario well. the autofac approach of resolving "last registered" service work me. cheers, chris public class vm { public vm(iservice) { } } public interface iservice {} public class defaultservice : iservice {} public class pluginbasedservice : iservice {} container.register( component.for<iservice>().implementedby<defaultservice>(), component.for<vm>() ); // called in dynamically loaded assembly, after default service has been registered container.register( component.for<pluginbasedservice>() .serviceoverrides(serviceoverride.forkey...

ruby - CSS not showing up with ERB -

ruby - CSS not showing up with ERB - i've hosted on heroku, , whenever opened app worked fine css beingness linked such: <link rel="stylesheet" href="/css/style.css"/> the problem came when added custom domain, css no longer worked. when view source , click on href, response "not found". nil has changed, css folder still in public folder in apps directory. have tried different paths href , like href="../css/style.css" or href="css/style.css" css ruby dns sinatra erb

CodeIgniter nested controllers? -

CodeIgniter nested controllers? - i'm new codeigniter , hope question have simple answer. i have website couple of menu items (menua,menub , menuc). have modeled 1 main controller, index(), menua(), menub() , menuc() in controller. called function sets session value currentmenu , includes header, x, footer. x depends on function called. header high lights choosen menu. within menuc (account settings in webapp) have different controller controls subviews of accountsettings/notloggedin. logically menuc() include header , footer forwards phone call subcontroller managed login or sub pages. am using framwork wrong or there straight forwards way accomplish this? i think sounds you're not understanding how apply mvc structure. image way: controllers represent facet of application users can interact with. example, have items controller allows users create, read, update, or delete items . logic interacting items handled controller (meaning calls items mod...

How to validate multiple functions with one IF statement - Javascript, jQuery -

How to validate multiple functions with one IF statement - Javascript, jQuery - i want validate multiple functions, , each 1 returning false, animations. here's code: function validarchido(){ var dedo = $('#dedo_pick'); if(dedo.children().size() < 2){ dedo.animate({'background-color' : 'red'},200); dedo.animate({'background-color' : '#eee'},200); homecoming false; } else{return true;} } function validarex(){ var valex = $('#rate1'); if(valex.children().size() < 2){ valex.animate({'background-color' : 'red'},200); valex.animate({'background-color' : '#eee'},200); home...

apache - Django serving 500 errors for every view except root -

apache - Django serving 500 errors for every view except root - so trying deploy production environment , getting 500 errors every view except root url: http://5buckchuck.com/ the errors appear apache errors, not fancy django ones: internal server error the server encountered internal error or misconfiguration , unable finish request. please contact server administrator, webmaster@5buckchuck.com , inform them of time error occurred, , might have done may have caused error. more info error may available in server error log. per server error logs: [thu jul 07 22:04:53 2011] [error] [client ip] request exceeded limit of 10 internal redirects due probable configuration error. utilize 'limitinternalrecursion' increment limit if necessary. utilize 'loglevel debug' backtrace. info: debugging set true i have tried syncdb, date i have connected db , looks there urls.py seems reflect urls in dev i no...

c# - "No value given for one or more required parameters" Accessing Excel Spreadsheet -

c# - "No value given for one or more required parameters" Accessing Excel Spreadsheet - its first time access , read excel file (xlsx) c#.. having problem , error was: no value given 1 or more required parameters below code: private void button5_click(object sender, eventargs e) { string connectionstring = @"provider=microsoft.ace.oledb.12.0;data source=c:\class schedules.xlsx;extended properties=""excel 12.0;hdr=no;"""; string excelquery; excelquery = "select a1 [sheet1$]"; oledbconnection excelconnection = new oledbconnection(connectionstring); excelconnection.open(); oledbcommand excelcommand = new oledbcommand(excelquery, excelconnection); oledbdatareader excelreader; excelreader = excelcommand.executereader(); //error happens here while (excelreader.read()) { messagebox.show((excelreader.getvalue(0)).tostring()); ...

cannot invoke tomcat manager:network unreachable -

cannot invoke tomcat manager:network unreachable - i using maven deploy in tomcat 6 url http://localhst:8080/manager error shown below ma usisng eclipse failed execute goal org.codehaus.mojo:tomcat-maven-plugin:1.1:deploy (default-cli) on project strutsandhibernte: cannot invoke tomcat manager: network unreachable: connect -> [help 1] [error] [error] see total stack trace of errors, re-run maven -e switch. [error] re-run maven using -x switch enable total debug logging. [error] [error] more info errors , possible solutions, please read next articles: [error] [help 1] http://cwiki.apache.org/confluence/display/maven/mojoexecutionexception try http://localhost:8080/manager/html maven-tomcat-plugin

android - how to get a camera's screen size -

android - how to get a camera's screen size - i've app places effect on bitmap photographic camera shot. works fine on galaxy portal when trying app on htc want jpeg image small. how can set image size displayed total size of screen? on galaxy i've used bitmapfacory.options sample size=1, makes image same size 1 captured, on different phones doesn't work. thanks. there difference between capture size , preview size (the screen size never changes that's device specific) assuming talking capture size. you can select capture size supported photographic camera selecting supported image sizes suppose select highest size photographic camera supports, if want normalize size (make same on each camera) have scale resulting image or downwards dependent. but wondering if after, or trying place image in specific location (like center of captured image) , perchance scaling overlaid image percentage of captured image? android image-processing bitmap...

'At least one of these fields must be filled' - Can I enforce this requirement in Django models? -

'At least one of these fields must be filled' - Can I enforce this requirement in Django models? - here's utilize case: class tweet(models.model): url_1 = models.charfield(max_length=140) url_2 = models.charfield(max_length=140) url_3 = models.charfield(max_length=140) i'd user specify @ to the lowest degree 1 url each tweet instance. i know how enforce status in views.py, i'm wondering if there's way configure django model such user required fill in @ to the lowest degree 1 out of given set of model fields before instance can saved. think solution cleaner. thanks! it can't done @ model level, may possible add together constraint @ database level can enforce this. django django-models

c# - Unable to move file: The process cannot access the file because it is being used by another process -

c# - Unable to move file: The process cannot access the file because it is being used by another process - scenario: i've written application open list of .msg files (which have been dumped file system), grab info them (subject, cc) , move them. problem: however, when comes moving file next error: the process cannot access file because beingness used process. running handle against file shows tool i've written , no other handles. i assume, therefore, i'm not releasing files when i've finished using them redemption messageitem objects. but can't wrap them in using statement, because don't implement idisposable. , don't expose public close or dispose or named methods. in short, i'm trying ask: a) how can forcefulness c# application close given handle, knowing path file handle? or b) there way forcefulness redemption objects close? var util = new mapiutilsclass(); messageitem item = util.getitemfrommsgfile(emailpath,...

erlang - Which is more expensive to the RAM, A query list comprehension, or a mnesia index_read? -

erlang - Which is more expensive to the RAM, A query list comprehension, or a mnesia index_read? - i trying read fragmented mnesia table hold big number of records in near future. these reads may other keys other primary key of table. which of 2 options more efficient? query list comprehension, or mnesia index read? well, indices require more disk space. each table fragment, mnesia create separate index file. however, index reads more efficient experience. qlc consume more memory @ run time when results of query many. require utilize query cursors. advise utilize index read. index read not expensive @ ram because normal read though mnesia has consult index file first. qlc when comes doing complex table relationships , evaluations of homecoming values in batch. however, introduces processing costs , memory when results many. note qlc uses mnesia:select/1,2 , 4 (which specific one, not sure) know select operation makes mnesia traverse whole table in serach records. ...

c - Reading in data from a file, using fscanf (following a sepecific pattern) -

c - Reading in data from a file, using fscanf (following a sepecific pattern) - i trying read in file, , can't pattern of right. can tell me can working? int main() { char name[20]; int age; float highbp, lowbp, risk; file *fp; fp = fopen("data.dat", "r"); if(fp == null){ printf("cannot open file\n\n"); } while(fscanf(fp, "name:%s\nage:%d\nbp:%f\nrisk:%f", name, &age, &highbp, &risk) != eof){ } printf("name: %s\n", name); printf("%d\n", age); printf("%f\n", highbp); printf("%f\n", risk); } data.dat: name:tom age:32 bp:43.00 risk:0.0 if can't open file prints message, continues. instead should homecoming main. if (fp == null) { printf("cannot open file\n\n"); homecoming 1; } fscanf homecoming number of items parsed, it's safer stop reading when number returned < 4 (not items read). presumably "data.dat" contai...

regex - Ruby Regexp: How do I replace doubly escaped characters such as \\n with \n -

regex - Ruby Regexp: How do I replace doubly escaped characters such as \\n with \n - so, have puts "test\\nstring".gsub(/\\n/, "\n") and works. but how write 1 statement replaces \n, \r, , \t correctly escaped counterparts? those aren't escaped characters, literal characters represented beingness escaped they're human readable. need this: escapes = { 'n' => "\n", 'r' => "\r", 't' => "\t" } "test\\nstring".gsub(/\\([nrt])/) { escapes[$1] } # => "test\nstring" you have add together other escape characters required, , still won't accommodate of more obscure ones if need interpret them all. potentially unsafe simple solution eval it: eval("test\\nstring") so long can assured input stream doesn't contain things #{ ... } allow injecting arbitrary ruby, possible if 1 shot repair prepare damaged encoding, fine. update...

symfony1 - How can I find where actually is the theme file? -

symfony1 - How can I find where actually is the theme file? - i new symfony , need work big project many themes modify them. how can find theme file in module, looking @ html browser output? or need somewhere else, routing example? what want utilize web debug toolbar. once have running on page, using appname_dev.php, simple click view link , show templates have been used. if need know layout utilize use logs link, click none sfphpview. symfony1 symfony-1.4

c# - MS Chart Control: Drawing and Labeling Line Series Across the Chart Area -

c# - MS Chart Control: Drawing and Labeling Line Series Across the Chart Area - i have questions ms asp.net chart control. how can line series set on bar series extends y-axis of chart? is possible place name of line series, i.e. "goal", right of chart replacement including series in legend? as can see in screenshot below, have line series presenting on top of bar series doesn't extend y-axis of chart. the code follows: var data1 = new dictionary<string, float> { { "w1", 80}, { "w2", 60}, { "w3", 40}, { "w4", 20}, { "w5", 10} }; var data2 = new dictionary<string, float> { { "w1", 10}, { "w2", 10}, { "w3", 0}, { "w4", 10}, { "w5", 10} }; var data3 = new dictionary<string, float> { { "w1", 10}, { "w2", 30}, { "w3", 50}, { "w4", 70}, { "w5...

php - Difference between # and / in preg_replace function for pattern parameter? -

php - Difference between # and / in preg_replace function for pattern parameter? - what # sign differently /? $output = preg_replace('#[^a-za-z0-9]#i', '', $input); $output = preg_replace('/[^a-za-z0-9]/i', '', $input); and letter after /[^a-za-z0-9]/? also ^ mean? in languages, not matter type of character starts or ends pattern portion of regular expression, long same @ origin , end (i believe holdover perl, arguably first great regex language). since php follows line of thought, # , / equivalent. i = "make search case insensitive" [^...] = exclude between square brackets (^ means "exclusion" in context). you can larn lot regular expressions here. php preg-replace

c++ - mouse move event on listview of a dialog box in MFC -

c++ - mouse move event on listview of a dialog box in MFC - i have created dialogbox. on have created 2 list views. have created sub class list view. wanted know mouse, mean on list view. after find index of list view using clistctrl::hittest(). now getting index using hittest mouse move mutual both list view. how can distinguish list view in mouse move event. finally going create tooltip according list view , index of list view. clistctrl inherits form cwnd. can mouse pointers coordinates implementing cwnd::onmousemove. have 2 options: either subclass clistctrl , implement onmousemove want in derived class either implement onmousemove in parent window (dialog window) , test coordinates of mouse against coordinates of 2 list controls. whatever solution pick maintain in mind onmousemove called , implementation of function must lite otherwise load computers resources , application lag. hth, jp. c++ mfc

php - Call or Instantiate? -

php - Call or Instantiate? - i building website in php i'll have create user, case & task classes, each of going have couple of methods. in index.php i'll need crud operation i've wrote in classes. improve phone call method , send parameters case::update(2) or improve instantiate class first phone call method like $case = new case(); $case->update(2); well, kingcrunch mentioned in comments, totally depends on whole architecture. furthermore, depends on preferences. if read through next links may have improve overview , can take yourself: singleton pattern php patterns static versus non static in php the singleton design pattern php static phone call versus singleton phone call in php why singletons have no utilize in php difference between static class , singleton pattern php class methods

c# - Unity Interception: How to pass parameter into ICallHandler implementation? -

c# - Unity Interception: How to pass parameter into ICallHandler implementation? - can pass message parameter icallhandler implementation this: var logic = container.resolve<ibussinesslogic>(message); and utilize this: imethodreturn icallhandler.invoke(imethodinvocation input, getnexthandlerdelegate getnext) { console.writeline( string.format( "begin {0} param {1}", input.methodbase.name, message // parameter need passed ) ); var result = getnext.invoke()(input, getnext); console.writeline("end " + input.methodbase.name); homecoming result; } ? the message you're passing resolve method named instance name unity construct. value used unity select implementation of ibusinesslogic use; after construction of implementing object lost. this value hence within unity during object's construction; icallhandle...

qt - Problem with linking -

qt - Problem with linking - i made custom library , compiled dll (qustom.dll). now want compile project using dll. what did import header files in project , add together line in .pro file libs += -lqustom but "error: cannot find -lqustom" also tried libs += qustom.dll and libs += -libqustom.a qustom.dll in project directory also tried other_files += \ qextserialport1.dll but didn't work either am missing here? missing path perhaps? -l/path/to/dlls -ldllname qt plays nicely cmake. utilize , never dependency/path headaches more. qt qt4

string - Can I read any readable valid memory location via a (unsigned) char* in C++? -

string - Can I read any readable valid memory location via a (unsigned) char* in C++? - my search foo seems lacking today. i know if legal according std c++ inspect "any" memory location via (unsigned(?)) char*. any location mean valid address of object or array (or within array) within program. by way of example: void passanyobjectorarrayorsomethingelsevalid(void* pobj) { unsigned char* pmemory = static_cast<unsigned char*>(pobj) mytypeidentifyier x = trytofigureoutwhatthisis(pmemory); } disclaimer: question purely academical. not intend set production code! legal mean if it's legal according standard, if work on 100% of implementations. (not on x86 or mutual hardware.) sub-question: static_cast right tool void* address char* pointer? c++ assumes strict aliasing, means 2 pointers of fundamentally different type not alias same value. however, correctly pointed out bdonlan, standard makes exception char , unsigned char pointers....

css - having an issue with a sticky footer on my beer site -

css - having an issue with a sticky footer on my beer site - my upcoming site, http://beerwhich.com/tester/loggedin.html using sticky footer explained here: http://ryanfait.com/sticky-footer/ for reason @ bottom there little gap, big beer bottle not bleed off footer border should. any thought why? i'm using .container wrapper, has negative margin equal height of .footer #loggedin .footer, .push (line 889), instead of height:195px !important - height:200px !important . difference of 5px. that's all. css sticky-footer

c# - how to change code to retrieve particular column in datagridview? -

c# - how to change code to retrieve particular column in datagridview? - i have list of info in datagridview. example, 1 column named class (each row has different value, see below), possble have combo box, contains of possible record class values in combo box? *it should have list of 6a, 6b, 6c if more classes added database later (example 6d), these should in combobox.* a view of datagridview class name 6a jane,14 may 1980;mary,4 june 1980; 6b leen, 31 may 1980; peter 6 jan 1980; 6c eillen, 19 aug 1980; yvwon, 28 mar 1980; 6d evan, 24 dec 1980; ivan, 20 nov 1980; here code found, how alter want? var input = convert.tostring(datagridview1.currentrow.cells[0].value); var resultlist = regex.matches(input, **@".*?,(.*?),.*?;")** .cast<match>() .select(arg => arg.groups[1].value) .tolist(); // bind combobox combobox1.datasource = resultlist; if wi...

stored procedures - Oracle - Handle empty resulset on IF THEN ELSE statement -

stored procedures - Oracle - Handle empty resulset on IF THEN ELSE statement - which should if status when variable assignation results empty resultset? example: create or replace function get_values ( chv_input in varchar2 ) homecoming varchar2 chv_output varchar2(100); begin select 'value' chv_output dual 1=2; if chv_output null --this status not working chv_output := 'null'; else chv_output := 'not null'; end if; homecoming chv_output; end; --select 1, get_values('112') dual try instead: exception when no_data_found chv_output := 'null'; stored-procedures plsql oracle10g

Java/Android - Search ArrayList<HashMap> for matching key -> value -

Java/Android - Search ArrayList<HashMap<String, String>> for matching key -> value - i have arraylist of hashmaps, , have key , value of 1 hashmap i'd utilize match value of hashmap found @ different position.. for example: 1- [<key1, val1>, <key2, "some value">, <key3, val3>] 2- [<key1, val1>, <key2, val2>, <key3, val3>] 3- [<key1, "some value">, <key2, val2>, <key3, val3>] and know array.get(1).get(key2) == "some value" how can utilize match key1 @ array.position(2), , homecoming value of key3? or in other words, how can find position of arraylist given value of 1 of it's containing key/value hashmaps? something array.where("key1" == "some value"). thanks you have brute-force way. for(hashmap hm:hashmaparraylist) if(hm.get(key1).equal(yourdesirevalue) { //hm 1 need find out. } java android

WordPress subtle theme Search is broken -

WordPress subtle theme Search is broken - i know isn't programming related, i'm building website on famous subtle theme , realized on it's demo search page broken if reply mean lot me , other's using theme. i have website on aadress http://work.askonomm.com/rs, please utilize search , if can figure out why appreciate it. the search class in css has float:right , width:170px; set. this causing @ to the lowest degree part of problem you're seeing. removing these items brings page in view , positioned centrally. wordpress

php - how to show data from 3 combinational table using codeIgniter -

php - how to show data from 3 combinational table using codeIgniter - i have 3 database tables, question_set, question , answer. question_set contains set_name , set_id question contains question , question_set_id answer contains answer , question_id i can not work out way show info in 1 view file, tried joins question info repeating prints because every question has 3 or 4 answer. just thought point out. your database design horrible. it not scale well, , infact not think actually. work. the way is three tables sets => id, name questions => id, set_id, question answers => id, set_id, question_id, answer, points note in above illustration taking 1 step further, rather each reply beingness true or false, can have assigned point value. hence, reply deemed half right given 5 points, right reply given 10 points, works boolean true, have right reply 1 point, , wrong reply 0 points anyway. with above table design in mind. you do $...

I've a sql database file I want to use asp_regsql.exe tool to put asp.net membership provider -

I've a sql database file I want to use asp_regsql.exe tool to put asp.net membership provider - i've sql database file want utilize asp_regsql.exe tool set asp.net membership provider the main problem can't utilize asp_regsql.exe add together tables need , tried various of connections , if 1 got create sql file contains membership table construction help , thank in advance check out this tip have written in code project. simply, can phone call next once: system.web.management.sqlservices.install("your_database", sqlfeatures.all, "your_connection_string"); asp.net sql database visual-studio

oop - How to pass variables between classes in PHP without extending -

oop - How to pass variables between classes in PHP without extending - so, i've got setup this: class scheme extends mysqli{ function __construct(){ //user variables such $this->username returned here } } $sys = new system(); class design{ function setting(){ echo $sys->username; } } $design = new design(); yet design class doesn't echo username. can echo username outside of design class, not within design class. how can go this? everyone else's reply fine, can inject dependency on scheme nicely: class design{ private $sys; public function __construct(system $sys) { $this->sys = $sys; } function setting(){ echo $this->sys->username; } } $sys = new system; $design = new design($sys); php oop class variables extend

.net - Editing A WCF service after I have it on a server -

.net - Editing A WCF service after I have it on a server - i have uploaded web service onto iis 7 , realized going need alter of functionality work. figured compile dll onto machine , re-create on server... question need refresh service reference in client application using create sure latest functionality? well depends on changing in service. if not changing service method names or changing arguments of service methods not need refresh client. but if create these kinds of changes have refresh client .net wcf

deployment - Publishing my asp.net mvc application via script and not Visual Studio -

deployment - Publishing my asp.net mvc application via script and not Visual Studio - i dont know much honest you... i have managed download mscommunity build , have managed utilize script below compile , build application, want asp.net mvc application "published" want same files when clicking "publish" within visual studio. current build file looks this: <?xml version="1.0" encoding="utf-8"?> <project defaulttargets="build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <!-- import msbuild tasks --> <import project="$(msbuildextensionspath)\msbuildcommunitytasks\msbuild.community.tasks.targets" /> <propertygroup> <configuration condition=" '$(configuration)' == '' ">release</configuration> <classlibraryoutputdirectory>c:\publish\</classlibraryoutputdirectory> <projectdir>..\petproject\...

java - Including CDATA wrapper while Marshalling -

java - Including CDATA wrapper while Marshalling - i generating xml using xmlbeans . there way include cdata wrapper automatically required elements in output xml document . illustration , output xml should : <employee> <name><![cdata[name]]></name> <address><![cdata[address]]></address> </employee> 1) can write xsd in such way , whenever set value <name> element in programme using xmlbeans , output xml should contain name element : <name><![cdata[name]]></name> instead of <name>name</name> 2) there way in xmlbeans produce cdata wrapper specific elements . any help appreciated. see this thread. in short: node.setfoo("abcde12345"); xmlcursor c = node.xgetfoo().newcursor(); c.tofirstcontenttoken(); c.setbookmark(cdatabookmark.cdata_bookmark); and when go "save" document sure pass in xmloptions like: xmloptions opts = new xmloptions().setusecdatabo...

javascript - How to hide and show things in jQuery based on the existence of other elements? -

javascript - How to hide and show things in jQuery based on the existence of other elements? - i have form jquery validation plugin generate div tags class "error" if there validation error on form submission. if such divs exist want display additional error message above form. message stored so: <p class="toperror">oops errors found!</p> <form id="myform"> // blah blah </form> if error divs weren't generated plugin, like: if (('#myform div.error').length() > 0 ) { $('p.toperror').show(); } in situation how can solve , need top error vanish moment there isn't error divs in form. if ($('#myform div.error').length > 0 ) { $('p.toperror').show(); } else { $('p.toperror').hide(); } javascript jquery

javascript - Event to know when a form in an iFrame has been submitted -

javascript - Event to know when a form in an iFrame has been submitted - ok have iframe on contact page of website. the src of iframe points file containing google docs form. once google docs form submitted, page redirected google page saying "your response has been recorded". i have form within iframe doesn't redirect viewers away entire site, instead iframe document redirected. this works fine, want show own message instead of google "your response has been recorded". to this, want know when iframe has been redirected and/or (preferably) form has been submitted. things i've tried... onhaschange="" within iframe element onsubmit="" within form element (which in iframe src file) any other ideas? look @ answer: iframe src alter event detection? create function check if loaded content google , react properly. javascript html html5

iphone - Convert int to CFString without CFStringCreateWithFormat -

iphone - Convert int to CFString without CFStringCreateWithFormat - the next extremely slow need. cfstringcreatewithformat(null, null, cfstr("%d"), i); currently takes 20,000ns in tests execute on 3gs. perhaps sounds fast, can create , release 2 nsmutabledictionaries in time executes. c weak, there must equivalent itoa can utilize on ios. this faster can get: cfstringref tecfstringcreatewithinteger(nsinteger integer) { size_t size = 21; // long plenty 64 bits integer char buffer[size]; char *characters = buffer + size; *(--characters) = 0; // null-terminated string int sign = integer < 0 ? -1 : 1; { *(--characters) = '0' + (integer % 10) * sign; integer /= 10; } while ( integer ); if ( sign == -1 ) *(--characters) = '-'; homecoming cfstringcreatewithcstring(null, characters, kcfstringencodingascii); } iphone objective-c

Cant change memory usage in R -

Cant change memory usage in R - i trying alter memory usage r on windows 7 machine. go desktop shortcut > properties , seek alter target "c:\program files\r\r-2.13.0\bin\i386\rgui.exe" "c:\program files\r\r-2.13.0\bin\i386\rgui.exe" --max-mem-size=500m per post https://stat.ethz.ch/pipermail/r-help/2010-june/241154.html but error message "the name '"c:\program files\r\r-2.13.0\bin\i386\rgui.exe" --max-mem-size=500m' specified in target box not valid, create sure path , file name valid." any suggestions on how prepare this? i tried it. works fine on machine. maybe entered --max.. in "execute-in"-field instead of "target"-field. if not problem seek this: create .bat file , come in yourpath\rgui.exe --max-... , create shortcut .bat. r memory

java - f:ValueChangeListener nullifying EJB injection -

java - f:ValueChangeListener nullifying EJB injection - it loads statelist fine, when alter value of state, calls backbean addressbo null. how can prepare it? other way it? thanks in advance. <h:selectonemenu id="statelist" value="#{newusercontroller.address.stateid}"> <f:selectitems value="#{addresscontroller.statelist}" /> <f:valuechangelistener type="controller.address.addresscontroller"/> <f:ajax event="change" render="cidadelist"/> </h:selectonemenu> <h:selectonemenu id="citylist" value="#{newusercontroller.address.cityid}"> <f:selectitems value="#{addresscontroller.citylist}" /> </h:selectonemenu> backbean package controller.address; @managedbean @requestscoped public class addresscontroller implements valuechangelistener { @ejb private addressbo addressbo; @postconstruct public void firstthingtodo() { statelist ...

stored procedures - Removing empty tables from TSQL sproc output data sets? -

stored procedures - Removing empty tables from TSQL sproc output data sets? - i have tsql sproc 3 loops in order find relevant data. if first loop renders no results, sec 1 does. append table has multiple values can utilize later on. so @ should have 2 tables returned in dataset sproc. the issue if first loop blank, end 3 info tables in info set. in c# code, can remove empty table, rather not have returned @ sproc. is there way remove empty table within sproc, given following: exec (@sqltop + @sqlbody + @sqlbottom) set @numberofresultsreturned = @@rowcount; . . . if @numberofresultsreturned = 0 begin set @searchloopcount = @searchloopcount + 1 end else begin -- have data, no need run 1 time again break end the process goes follows: on first loop there no results. rowcount 0 because exec executes dynamically created sql query. that's 1 table. in next iteration, results returned, making 2 info tables in data...

asp.net - Why am I getting this weird artifact when I display the ASP NET page in the web browser? -

asp.net - Why am I getting this weird artifact when I display the ASP NET page in the web browser? - the best way display see giving couple of screenshots: http://i150.photobucket.com/albums/s99/dc2000_bucket/scr1.jpg http://i150.photobucket.com/albums/s99/dc2000_bucket/scr2.jpg the link above shows html/asp code. the question why getting white line when render content in web browser???? ps. i'm using vs2010 (that ready nail hammer...) images inline elements. inline elements rendered characters. characters sit down on line. there space below line descenders (which find on letters g, j , y not a, b, , c.) that space seeing. you twiddle vertical-alignment of images or stop using layout tables asp.net html visual-studio-2010

android - Drawing over an Image and recording the coordinates of the drawing -

android - Drawing over an Image and recording the coordinates of the drawing - i have image user can place points on , record exact location in relation image can shown 1 time again user placed marks on image in future. i apologize find hard explain example: suppose there square divided 4 quadrants. user can place dot in quadrant 1 , want save coordinate relates quadrant 1 somewhere can 1)reproduce same image if user loads in future , 2)record in software somewhere placed in quadrant/coordinate. thank much time , help. when grab event, coordinates of tap by event.getx(); event.gety(); android

sql server 2005 - Is there a way to include go in dymanic SQL? -

sql server 2005 - Is there a way to include go in dymanic SQL? - declare @sql varchar(100) declare @dbname varchar(100)-- set @dbname = 'somedbname'-- set @sql = 'use [' + @dbname + ']' + char(13) + char(10) set @sql = @sql + 'go' + char(13) + char(10)-- print command exec (@sql) when run gives error wrong syntax near 'go' has found workaround this? requirement : need include stored procedure creation in switched database. go not sql statement - a command recognized sql server utilities (e.g. sqlcmd, osql, sql server management studio code editor). however, can change database without go command. sql sql-server-2005

c++ - Boost 1.46.1, Property Tree: How to iterate through ptree receiving sub ptrees? -

c++ - Boost 1.46.1, Property Tree: How to iterate through ptree receiving sub ptrees? - first of shall think got how should done code not compile way try. based assumption on this official illustration of empty ptree trick. there can find next line: const ptree &settings = pt.get_child("settings", empty_ptree<ptree>()); which shows (or should be) possible subptree out ptree. so assumed iterate thru ptree boost_foreach in such manner: boost_foreach(const boost::property_tree::ptree &v, config.get_child("servecies")) { } but next error: error 1 error c2440: 'initializing' : cannot convert 'std::pair<_ty1,_ty2>' 'const boost::property_tree::ptree &' or if seek boost_foreach(boost::property_tree::ptree &v, config.get_child("servecies", boost::property_tree::empty_ptree<boost::property_tree::ptree>())) { } i get: error 1 error c2039: 'empty_ptr...

jQuery hover doesn't seem to be perfect -

jQuery hover doesn't seem to be perfect - i have sidebar flyout menu. made using jquery hover. however, having couple of problems. if hovering on element, , move off screen , onto browser, onmouseleave never fires , element stays there. on other hand, if hovering on element , refresh page (while leaving mouse there), onmouseenter doesn't fire until leave element , come in again. i know can utilize css hover animation flyouts (like fading in, delays etc.) thanks! you can utilize css3 transitions animations. example: http://css3.bradshawenterprises.com/cfimg1/ jquery

actionscript 3 - Migration of a stand alone Flex Application / WindowedApplication into Box or Group -

actionscript 3 - Migration of a stand alone Flex Application / WindowedApplication into Box or Group - in order integrate several air applications one. i tried way migration old <s:windowedapplication> / <s:application> <s:group> or <mx:box> . by doing found out initialization order of mxml components nested in new grouping / box differs 1 in application. in consequence got null pointer exceptions when instantiate new grouping / box. any ideas? comments? flex actionscript-3 flash-builder

Routing in Ajax petition in Rails 2 -

Routing in Ajax petition in Rails 2 - i have next in view: $('#anid tr').click(function () { $.ajax({ type: 'get', url: '/tickets/extended_info', datatype: 'script', data: { id: $(this).find('td:first').html() } }); }); and in tickets controller: def extended_info(id) puts ">>>>>>>>>>>>>>> " + id.to_s end but 404 not found ajax request. i think i'm missing in routes file... tried several things, nothing. any ideas? >>>>>>>>>>>>>>>>>>>>> resolved <<<<<<<<<<<<<<<<<<<<<<<<< i had add: map.extendedinfo '/extended_info/:id', :controller => 'tickets', :action => 'extended_info' to routes file. also, using "get" in...

smalltalk - What object to hold a large amount of text in? -

smalltalk - What object to hold a large amount of text in? - i planning seaside app hold text, single instance may to, say, 5mb. kind of object best this? i iterations on text. thanks, vince edit: replies far. file csv file takes ~40 minutes generate legacy finance system, must pre-generated , stored. each line client record , need pull each 1 out , utilize values , when client logs in. client access not predictable , interfacing legacy scheme generate each line on fly lastly resort. given file takes long generate , need more-or-less random access file later on, opt parsing file , keeping structured info in memory afterwards. there csv parser project on squeaksource can use. create structured object tree of csv records can use. smalltalk pharo seaside

pdf - iTextSharp acroFields.SetField method and multiple form fields with same name -

pdf - iTextSharp acroFields.SetField method and multiple form fields with same name - in case of multiple fields same name itextsharp acrofields.setfield(name, value) sets value first field only. how set value rest of fields? when looping thru acrofields.fields field names reported as form1[0].#subform[0].textfield1[0] - textfield form1[0].#subform[0].textfield2[0] - textfield form1[0].#subform[0].textfield2[1] - textfield form1[0].#subform[0].textfield2[2] - textfield when using acrofields.setfield("textfield1", value); the value of text field named textfield1 set. there 1 field named textfield1 fine. when using acrofields.setfield("textfield2", value); the value of first text field named textfield2 set. rest 2 fields named textfield2 left unset. the pdf created adobe livecycle , saved static pdf i.e. not dynamic xfa. can utilize total field name? acrofields.setfield("form1[0].#subform[0].textfield2[0]", value); ...

asp.net - SQL - Stored Proc to Update table from Table Variable -

asp.net - SQL - Stored Proc to Update table from Table Variable - i have stored procedure inserts records table using values table variable. (the table variable sent sql asp.net) works perfect , looks this... create procedure sp_saveresponses ( @tablevariable saveresponsestabletype readonly ) begin insert tbl_responses ( assessmentid, questionid, answerid ) select assessmentid, questionid, answerid @tablevariable end the above inserts 1 record tbl_responses every row in @tablevariable. the problem instead of insert, perform update, can't syntax right. thanks help...! update helpful hints, able resolve below... you seek (i haven't tested it) - create procedure sp_saveresponses ( @tablevariable saveresponsestabletype readonly ) begin update tbl_responses set questionid = @tablevariable.questionid @tablevariable @tablevariable.assessmentid = tbl_response.assessmentid end asp.net sql

sql - Is converting database string enums to integers worth it? -

sql - Is converting database string enums to integers worth it? - there 2 ways store enum types in database: string or integer. saving enumeration ( sex = {male,female} , account_type = {regular,pro,admin} , etc. ) strings makes things more readable requires more space integers. on other hand, integers require mapping enums in , out of database. benefit, case-sensitivity handled outside of database integers. assuming both indexed, doing integer conversion worth it? how much faster lookup integers? example perhaps concrete illustration help visualize things. lets take above account_type database of 100,000 users. string enum assuming 8-bit fixed length char type 7*100000*8/8 = 700000 bytes integer enum assuming 8-bit tinyint integers 100000*8/8 = 400000 bytes seems size half integer enums. need concider indexes. the reply is, expect, depends. the larger database more important space savings - not on disk in network io , computation. persona...

algorithm - Graph Theory: Calculating Clustering Coefficient -

algorithm - Graph Theory: Calculating Clustering Coefficient - i'm doing research , i've come point have calculate clustering coefficient of graph. according this paper straight related research: the clustering coefficient c(p) defined follows. suppose vertex v has kv neighbours; @ (kv * (kv-1)) / 2 edges can exist between them (this occurs when every neighbour of v connected every other neighbour of v). allow cv denote fraction of these allowable edges exist. define c average of cv on v but this wikipedia article on subject says differently: c = (number of closed triplets) / (number of connected triples) it seems me latter more computationally expensive. so question is: equivalent? it should noted paper cited wikipedia article. thanks time. i think they're equivalent. wiki page link gives proof triples formulation equivalent fraction of possible edges formulation when calculating local clustering coefficient, i.e. calcul...

c++ - Next_permutation and efficiency -

c++ - Next_permutation and efficiency - is more efficient begin perchance random ordering of objects in range, using next_permutation step through greater permutations, followed stepping down, origin 1 time again original ordering, using prev_permutation reach last. or, sort range before permuting, utilize next_permutation step through of them? next_permutation step through all permutations, not through greater permutations. no need revert , utilize prev_permutation , , no need sort. you need take care of fact next_permutation homecoming false 1 time “rolls over” lexicographically lowest permutation need maintain track of number of current permutation know when stop. that is, next iterate through possible permutations of range, no matter how starting range looks like. size_t const num_permutations = multinomial_coefficient(range); (size_t = 0; < num_permutations; ++i) { next_permutation(range.begin(), range.end()); // utilize permutation. ...

Android Gallery display selected image -

Android Gallery display selected image - i next code trying display image selected in gallery.but default android image , not image saved.what doing wrong how resolve this.. package hgallery.com; import hgallery.com.r; import hgallery.com.hgalleryactivity.imageadapter; import android.app.activity; import android.os.bundle; import android.content.context; import android.content.res.typedarray; import android.graphics.drawable.drawable; import android.view.view; import android.view.viewgroup; import android.widget.adapterview; import android.widget.adapterview.onitemclicklistener; import android.widget.adapterview.onitemselectedlistener; import android.widget.baseadapter; import android.widget.gallery; import android.widget.imageview; import android.widget.toast; public class hgalleryactivity extends activity { /** called when activity first created. */ @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.la...