Posts

Showing posts from January, 2014

uibutton - cocos2d scene retaining issue -

there scene in application has 2 labels , menu item. when load scene using replacescene method stays 3-4 seconds , gets disappeared or released. want keep until cancel button pressed. how can it? code is: @implementation mylayer + (id)myscene { ccscene *ascene = [ccscene node]; mylayer *mylayer = [mylayer node]; [ascene addchild:mylayer]; return ascene; } - (id) init { if (self = [super init]) { //labels , menu here } return self; } and calling scene this: [[ccdirector shareddirector] replacescene: [mylayer myscene]]; maybe problem it's first scene. should use runwithscene method of ccdirector .

Accidentally pushed commit: change git commit message -

in local repo have 1 commit incorrect commit message. i've published incorrect commit message git push . now remote repo (which github-hosted) has incorrect commit message, too. i've tried git commit --amend , found not work me in situation because i've made additional commits since incorrect one. how fix situation? easiest solution ( but please read whole answer before doing this ): git rebase -i <hash-of-commit-preceding-the-incorrect-one> in editor opens, change pick reword on line incorrect commit. save file , close editor. the editor open again incorrect commit message. fix it. save file , close editor. git push --force update github. this mean publishing modified version of published repository. if pulled or fetched repo between when made mistake incorrect commit message, , when fixed it, experience difficulties later. sure can accept consequence before trying this.

c++ - std::string capacity size -

is capacity size of string multiple value of 15? for example: in cases capacity 15 string s1 = "hello"; string s2 = "hi"; string s3 = "hey"; or random? is capacity size of string multiple value of 15? no; guarantee capacity of std::string s.capacity() >= s.size() . a implementation grow capacity exponentially doubles in size each time reallocation of underlying array required. required std::vector push_back can have amortized constant time complexity, there no such requirement std::string . in addition, std::string implementation can perform small string optimizations strings smaller number of characters stored in std::string object itself, not in dynamically allocated array. useful because many strings short , dynamic allocation can expensive. small string optimization performed if number of bytes required store string smaller number of bytes required store pointers dynamically allocated buffer. whether or not ...

build - How can I prevent submitting an empty Perforce changelist from being an error? -

attempting submit changelist no files considered perforce error ( p4 submit ... returns exit code 1). causes periodic integration build fail on our build server (we're using zutubi's pulse system ); in case rather have build succeed , possibly warning. pulse has exit code remapping functionality, perforce not appear disambiguate between failure submit empty changelist , other submit failure (such validation trigger failure, do want fail build). the obvious (but, in mind, inelegant) solution comes mind wrap execution of p4 submit in batch file first checks see if target changelist empty counting lines of output p4 opened -- or parsing output of p4 submit "no files" message , returning batch file. are there better techniques handling i'm not seeing? there no techniques perforce, if understanding problem correctly. issue, have seen, return codes perforce command line runs are, well, ambiguous. submission of empty changelist error? maybe, ma...

java - How to use getMethod() with primitive types? -

this class: class foo { public void bar(int a, object b) { } } now i'm trying "reflect" method class: class c = foo.class; class[] types = { ... }; // should here? method m = c.getmethod("bar", types); there's int.class . class[] types = { int.class, object.class }; an alternative integer.type . class[] types = { integer.type, object.class }; the same applies on other primitives.

namespaces - Ruby: what does :: prefix do? -

i reading through source of artifice , saw: module artifice net_http = ::net::http # ... end line: https://github.com/wycats/artifice/blob/master/lib/artifice.rb#l6 why not net::http instead of ::net::http , i.e., mean when use :: prefix? the :: scope resolution operator. determines scope module can found under. example: module music module record # perhaps copy of abbey road beatles? end module eighttrack # gloria gaynor, survive! end end module record # adding item database end to access music::record outside of music use music::record . to reference music::record music::eighttrack use record because it's defined in same scope (that of music ). however, access record module responsible interfacing database music::eighttrack can't use record because ruby thinks want music::record . that's when use scope resolution operator prefix, specifying global/main scope: ::record .

advertising - how to Show two creatives simultaneously with DFP Google admanager -

i want show 2 creatives simultaneously on 2 placements on page using google admanager. solutions ? i able find solution issue, , no 1 has answered yet think should answer own question then. you can show 2 creatives every time using admanager setting display creatives property many possible , making sure no other line item in way of higher priority one, in case creatives shown together. a detailed solution can found here display-two-creatives-simultaneously-dfp-admanager

javascript - How to have multiple input boxes of the same name on a page? -

i making web page. has input fields grouped 1 section, , below section "add another" button. button add identical section page using javascript; same form fields. then later down page there "calculate" button. runs other javascript needs have access these input fields via jquery. what recommended way have multiple duplicate input elements on page? aware there shouldn't 2 elements same id, happens 2 elements of same name? can accessed individually? or should name these input elements differently javascript, e.g. adding "1", "2", etc. end of name, , use loops? (that seems messy) how should identify , access these identical groups of input fields? you can use document.getelementsbyname('name') , loop on result each value.

f# - Overriding Exception.Message / exception pattern matching -

i'm trying pattern match on exception within definition. following possible using f#'s exception syntax, or must subclass exception ? this expected work: exception coorderr of int * int override this.message = let coorderr(x, y) = sprintf "(%i %i)" x y //error but yields errors: the value or constructor 'x' not defined value or constructor 'y' not defined edit i tried adding parens: let (coorderr(x, y)) = but gives error: this expression expected have type exn here has type coorderr update the following works, isn't ideal: exception coorderr of int * int override this.message = sprintf "(%i %i)" this.data0 this.data1 is there way this? update 2 taking cue kvb's answer, suppose following swallow incomplete matches warning: exception coorderr of int * int override this.message = match :> exn ...

java - servlet not available error in eclipse spring mvc projects -

i running project using eclipse. in 1 project following error 18/02/2011 12:23:41 org.apache.catalina.core.aprlifecyclelistener init info: apr based apache tomcat native library allows optimal performance in production environments not found on java.library.path: c:\java\bin;.;c:\windows\sun\java\bin;c:\windows\system32;c:\windows;c:\java\bin;c:\program files (x86)\mysql\mysql server 5.1\bin;c:\program files (x86)\idm computer solutions\ultraedit\;c:\java\bin 18/02/2011 12:23:42 org.apache.tomcat.util.digester.setpropertiesrule begin warning: [setpropertiesrule]{server/service/engine/host/context} setting property 'source' 'org.eclipse.jst.jee.server:test' did not find matching property. 18/02/2011 12:23:42 org.apache.coyote.abstractprotocolhandler init info: initializing protocolhandler ["http-bio-8085"] 18/02/2011 12:23:42 org.apache.coyote.abstractprotocolhandler init info: initializing protocolhand...

java - Using varargs in a Tag Library Descriptor -

is possible have tld map following function: public static <t> t[] toarray(t... stuff) { return stuff; } so can do: <c:foreach items="${my:toarray('a', 'b', 'c')}"... i tried following <function-signature> s java.lang.object toarray( java.lang.object... ) java.lang.object[] toarray( java.lang.object[] ) and others nothing seems work. unfortunately that's not possible. el resolver interprets commas in function separate arguments without checking if there methods taking varargs. best bet using jstl fn:split() instead. <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %> ... <c:foreach items="${fn:split('a,b,c', ',')}" var="item"> ${item}<br/> </c:foreach> it have been nice feature in el however, although implementing pretty complex.

iphone - <AppName>.pch file usage -

what importance of .pch file , significance of"#ifdef objc "? also, define parameters "#ifdef is_production" checked in .pch file. .pch pre-compile header. in c , c++ programming languages, header file file text may automatically included in source file c preprocessor, specified use of compiler directives in source file. #ifdef objc lets compiler know code objective-c. #ifdef is_production have defined on own, directive telling compiler if defined, most-likely production build.

Sql Query for inserting data from 2 tables into one based on name -

hello 2 tables of data different sources, need combine of them 1 main table. database layout : table a -name -ranking -score table b -name -ranking -score table new -name -ranking a -score a -ranking b -score b i want take data table , b , insert table new based on name. not sure how in sql, appreciated assuming every record in tablea has corresponding record in tableb: insert tablenew (name, rankinga, scorea, rankingb, scoreb) select a.name, a.ranking, a.score, b.ranking, b.score tablea inner join tableb b on a.name = b.name if assumption invalid, then: insert tablenew (name, rankinga, scorea, rankingb, scoreb) select a.name, a.ranking, a.score, b.ranking, b.score tablea left join tableb b on a.name = b.name union select b.name, a.ranking, a.score, b.ranking, b.score tableb b left join tablea on b.name = a.name ...

VBScript remove newline -

i have html page 1 or more newlines after </html> . vbscript file able find replace newlines emptiness. but, looks opentextfile putting newline @ end again. help! 'pulled interwebs const forreading = 1 const forwriting = 2 set objfso = createobject("scripting.filesystemobject") set objfile = objfso.opentextfile("a.html", forreading) strtext = objfile.readall 'wscript.echo strtext objfile.close strnewtext = replace(strtext, "</html>" & vbcrlf, "</html>") set objfile = objfso.opentextfile("a.txt", forwriting) objfile.writeline strnewtext objfile.close instead of objfile.writeline strnewtext use objfile.write strnewtext . write file without newline @ end. btw, way of removing newline(s) after </html> tag strnewtext = trim(strtext) instead of using replace()

Code for sharing buttons to facebook, twitter and buzz with counter -

Image
i looking code implement share buttons twitter, buzz , facebook counter youtube have in share option, please see screen shot. i’ve been looking on codes none of them want, either bit square or “like count” facebook. i hope 1 of me this. sincere - mestika for facebook, here: facebook developers for twitter api, here: twitter developers and, google buzz: buzz counter

java - Sorting problem using TreeMap -

i'm trying put key values in hashmap , trying sort out using treemap below. problem if there similar values in map, after sorting considering 1 of them. import java.util.*; public class hashmapexample { public static void main(string[] args) { hashmap<string,integer> map = new hashmap<string,integer>(); valuecomparator bvc = new valuecomparator(map); treemap<string,integer> sorted_map = new treemap(bvc); map.put("a",99); map.put("b",67); map.put("c",123); map.put("g",67); map.put("f",67); map.put("h",67); map.put("d",6); system.out.println("unsorted map"); (string key : map.keyset()) { system.out.println("key/value: " + key + "/"+map.get(key)); } sorted_map....

.net - Sorting not happening for Datagrid in silverlight 4 for all pages -

when doing sorting silverlight datagrid happening 1 page only. missing? try this. silverlight 4 – datagrid (sorting, grouping, filtering , paging) – tip of day

actionscript 3 - AS3 how to manipulate different instances of a class from the timeline -

i trying create menu using as3 , cant seem find way finish it. this got far so wrote class attached movieclip , put several instances of on stage. package { import flash.events.event; import flash.events.mouseevent; import fl.transitions.tween; import fl.transitions.tweenevent; import fl.transitions.easing.*; import flash.display.*; public class servicesbuttons extends movieclip { public function servicesbuttons() { shapemc.width = 0; this.addeventlistener(mouseevent.roll_over, mouseon); this.addeventlistener(mouseevent.roll_out, mouseoff); this.addeventlistener(mouseevent.click, clicked); function mouseon(e:event) { var shapegrow:tween = new tween(shapemc, "width", strong.easeout, 0, 200, .3, true); } function mouseoff(e:event) { var shapeshrink:tween = new tween(shapemc, "width", strong.easeout, shapemc.width, 0, .3, true); } function clicked(e:even...

oop - How should I write classes? C++ -

hey.. don't them. read tutorial classes in c++, , don't few things: in every example , tutorial i've seen, functions never written inside class! example, why write class this: #include <iostream> using namespace std; class test { private: int x, y; public: test (int, int); int tester () {return x + y; } }; test::test (int a, int b) { x = a; y = b; } int main() { test atest (3, 2); test atest2 (2, 6); cout << "test1: " << atest.tester() << endl; cout << "test2: " << atest2.tester() << endl; return 0; } or this: #include <iostream> using namespace std; class test { private: int x, y; public: void set_values (int,int); int testfunc () {return x + y; } }; void test::set_values (int a, int b) { x = a; y = b; } int main() { test tester; tester.set_values (3, 2); cout << ...

c# - Scanning DLLs for .NET assemblies with a particular interface - some DLLs throw R6034! -

i have program needs discover plugin dlls on host. it enumerating dlls within (fairly large) path. path includes lots of things, including native dlls. foreach (var f in directory.enumeratefiles(@"c:\program files", "*.dll", searchoption.alldirectories)) { try { var assembly = assembly.loadfile(f); var types = assembly.gettypes(); foreach (var type in types) { if (type.getinterface("my.iinterface") != null) { plugins.add(f); break; } } assembly = null; } catch (exception e) { } } if scanner hits ms runtime dll (for example, msvcm80.dll) uncatchable runtime error r6034: "an application has made attempt load c runtime library incorrectly." window blocks execution of program. don't want dll (obviously); there way graceful error out of situation? [related q: there efficient (e.g. non-exception...

php - form textfield title in Drupal does not accept special caracters -

i'm trying give element of drupal form using form_alter hook title contains special characters (é,è,à ...) $form['title'] = array( '#type' => 'textfield', '#title' => 'this title é à test', '#required' => true ); that gives me blank output on form page using check_plain() function title not affect output :s ,still blank though it's encoding problem checked enc settings (database,server,theme template) set utf-8 please note when entering value contain special characters goes normal . think problem here drupal core doesn't accept special characters in #title field ? well, first, should use english in code , translate it. check encoding of file... if try outside of drupal, plain php fail prints these characters, work?

entity framework - Mocking or faking DbEntityEntry or creating a new DbEntityEntry -

following on heels of other question mocking dbcontext.set i've got question mocking ef code first. i have method update looks like: if (entity == null) throw new argumentnullexception("entity"); context.getidbset<t>().attach(entity); context.entry(entity).state = entitystate.modified; context.commitchanges(); return entity; context interface of own dbcontext. the problem i'm running in is, how handle the context.entry(entity).state . i've stepped through code , works when have real live dbcontext implementation of context interface. when put fake context there, don't know how handle it. there no constructor dbentityentry class, can't create new 1 in fake context. has had success either mocking or faking dbentityentry in codefirst solutions? or there better way handle state changes? just other case, need add additional level of indirection: interface isalescontext { idbset<t> getidbset<t>(); ...

Java RegEx with lookahead failing -

in java, unable regex behave way wanted, , wrote little junit test demonstrate problem: public void testlookahead() throws exception { pattern p = pattern.compile("abc(?!!)"); asserttrue(p.matcher("abc").find()); asserttrue(p.matcher("abcx").find()); assertfalse(p.matcher("abc!").find()); assertfalse(p.matcher("abc!x").find()); assertfalse(p.matcher("blah/abc!/blah").find()); p = pattern.compile("[a-z]{3}(?!!)"); asserttrue(p.matcher("abc").find()); asserttrue(p.matcher("abcx").find()); assertfalse(p.matcher("abc!").find()); assertfalse(p.matcher("abc!x").find()); assertfalse(p.matcher("blah/abc!/blah").find()); p = pattern.compile("[a-z]{3}(?!!)", pattern.case_insensitive); asserttrue(p.matcher("abc").find()); asserttrue(p.matcher("abcx").find()); assertfalse(p.match...

php - Sorting SQL results from two tables -

i have 2 tables, tags , coupon_tags . tags contains tagname , tagid . each unique name has unique id. perhaps tag foo may have tagid 1 , example. then coupon_tags has bunch of couponid 's , bunch of tagid 's. there 1 row per coupon per tag. coupon may, of course, have more 1 tag. table may this: tagid | couponid 5 3 4 3 9 3 5 6 what i'm trying top 10 most-used tags. i've no experience in sorting algos or heavy sql i'm not sure @ how begin. help? do this: select tagid, count(*) totaloccurrences coupon_tags group tagid order totaloccurrences desc limit 10 this give used tags ids.

xml - Obtain Java Class name from QName -

suppose have qname represents type in .xsd document. how can find out name of class unmarshal into? for example, i've got qname: {http://www.domain.com/service/things.xsd}customer this gets unmarshalled com.domain.service.things.customer . is there way can without parsing qname string representation? edit: i've got .xsd's defined being used create java classes. want select 1 of these java classes dynamically based on qname being passed in string on html form. edit2: since these classes' names being automatically generated, somewhere there must method generates names qname. you leverage jaxbinstropector , following: package example; import java.util.hashmap; import java.util.map; import javax.xml.bind.jaxbcontext; import javax.xml.bind.jaxbintrospector; import javax.xml.namespace.qname; public class demo { public static void main(string[] args) throws exception { class[] classes = new class[3]; classes[0] = a.class; ...

c# - Array sorting efficiency... Beginner need advice -

i'll start saying beginner programmer, first real project outside of using learning material. i've been making 'simon says' style game (the game repeat pattern generated computer) using c# , xna, actual game complete , working fine while creating it, wanted create 'top 10' scoreboard. scoreboard record player name, level (how many 'rounds' they've completed) , combo (how many buttons presses got correct), scoreboard sorted combo score. led me xml, first time using it, , got point of having xml file recorded top 10 scores. xml file managed within scoreboard class, responsible adding new scores , sorting scores. gets me point... i'd feedback on way i've gone sorting score list , how have done better, have no other way gain feedback =(. know .net features array.sort() wasn't sure of how use it's not single array needs sorted. when new score needs entered scoreboard, player name , level have added. these stored within 'array of ar...

Optionally testing caching in Rails 3 functional tests -

generally, want functional tests not perform action caching. rails seems on side, defaulting config.action_controller.perform_caching = false in environment/test.rb . leads normal functional tests not testing caching. so how test caching in rails 3. the solutions proposed in thread seem rather hacky or taylored towards rails 2: how enable page caching in functional test in rails? i want like: test "caching of index method" with_caching :index assert_template 'index' :index assert_template '' end end maybe there better way of testing cache hit? you're liable end tests stomping on each other. should wrap ensure , reset old values appropriately. example: module actioncontroller::testing::caching def with_caching(on = true) caching = actioncontroller::base.perform_caching actioncontroller::base.perform_caching = on yield ensure actioncontroller::base.perform_caching = caching end def withou...

objective j - How to center a CPWindow in Cappuccino -

i'm interested in having cpwindow (specifically cppanel) centered , auto-sized might same cpview follows: [view setautoresizingmask:cpviewminxmargin | cpviewmaxxmargin | cpviewminymargin | cpviewmaxymargin]; [view setcenter:[contentview center]]; however cpwindows seem not have these same methods. and while we're @ it, how prevent cppanel being dragged around? such thing possible? thanks. cpwindow (and cppanel) have center method. [awindow center];

python - numpy and pil reshape arrays -

pil numpy conversion leads arrays like: a = array([ [[r,g,b],[r,g,b].....[r,g,b],[r,g,b]] , [[r,g,b],[r,g,b.....]] , int8) triplets of rgb values; within rows : a[0] = [[r,g,b],[r,g,b].....[r,g,b],[r,g,b]] = first row is there quick way convert such triplets numpy arrays , ford (well especialy back..) a = [[rrrr],[rrrrr],[rrrrr],.... [bbbbb],[bbbbbb],[bbbbbb]...,[ggggg],[ggg],[ggg]] or like a=[[rrr],[rrrrr],[.... ...]] **or** aa = [rrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrr..] b=[[bbb],[bbbbb],[.... ...]]**or** bb = [bbbbbbbbbbbbbbbbbbbbbbbbbb..] c=[[ggg],[ggggg],[.... .]] **or** cc = [ggggggggggggggggggggggggg..] my problem have format aa bb cc , know image size 640x480 how fast pill format below a = array([ [[r,g,b],[r,g,b].....[r,g,b],[r,g,b]] , [[r,g,b],[r,g,b.....]] , int8) does a.t give want? i'm assuming you've created array using numpy's asarray function. import image, numpy im = image.open('test.png') = numpy...

Sorting with data from another table using sort_by ruby on rails -

i have 2 models: todo , duedate. duedate has_many todos, , likewise todo belongs_to duedate. duedates table holds id , 'date' data type entry. every todo object has duedate_id column corresponds duedate id. todo has other values in priority , completed, sort by: @todos = @todos.sort_by(&:priority) i want sort @todos date, i'm not sure how tell sort_by use date associated duedate_id in duedate table. can't do @todos = @todos.sort_by(&:duedate_id) because sort @todos date entered duedate table, not date entry corresponds to. can help? thanks, ross you're using symbol_to_proc sugar method. can use plain-old block argument sort_by: @todos = @todos.sort_by{ |todo| todo.duedate.date }

c# - How to use the final {project}.exe.config file when creating a setup project -

i have created console application (blah.exe) specific app.config's dev , prod. these named dev_app.config , prod_app.config . have hooked afterbuild target in csproj file * copies correct config file bin directory blah.exe.config . i have created setup project console app have run slight issue. seems setup project uses actual app.config project directory opposed final blah.exe.config (located in bin directory). |--bin | |--debug | |--blah.exe.config <--- want setup project use file |--app.config <--- setup project uses file @ moment |--dev_app.config |--prod_app.config how can force setup project use final config file generated in bin folder , not actual app.config file? additional information: my current solution involves adding afterbuild command overwrites actual app.config file. don't approach since forces me have additional file don't need. also, having file has caused me grief since made changes app.config file got overwritten when...

c# - How to bind grid in ASP.NET? -

i cant bind grid. dont know doing wrong, grid appears empty when run program. here code :: protected void page_load(object sender, eventargs e) { if (!ispostback) this.bindgrid(this.gridview1); } private void bindgrid(gridview grid) { sqlcommand cmd = new sqlcommand("select * person", cn); sqldataadapter da = new sqldataadapter(cmd); datatable dt = new datatable(); da.fill(dt); grid.datasource = dt; grid.databind(); } <body> <form id="form1" runat="server"> <div style="margin-left: 240px"> <asp:gridview id="gridview1" runat="server" cellpadding="4" forecolor="#333333" gridlines="none" width="856px" autogeneratecolumns = "false" showfooter = "true" showheader="true" borderstyle="groove" captio...

android - How to stop the handler? -

i have doubt .. having hander in activity in application. though activity destroyed handler still functioning. running on different process other application process ? 1 plz explain why working ? possible stop handler while ondestroy of activity ? thanks in advance. as described in documentation http://developer.android.com/reference/android/os/handler.html "each handler instance associated single thread , thread's message queue." when finish activity, e.g. in ondestroy() need cancel callback runnable started for: mhandler.removecallbacks(previouslystartedrunnable); you can without checking if runnable fired while activity active. update: there 2 additional cases considered: 1.) have implemented handler in way created new class runnable, e.g. private class handleupdateind implements runnable... usually need if have start delayed runnable current set of parameters (which may change until runnable fires). cancel need use mhandler.remove...

objective c - NSOutlineView Changing disclosure Image -

i outline view, adding custom cell, drawing custom cell, referring example code , present in cocoa documentation http://www.martinkahr.com/2007/05/04/nscell-image-and-text-sample/ i want change disclosure image of cell custom image, have tried following things - (void)outlineview:(nsoutlineview *)outlineview willdisplaycell:(id)cell fortablecolumn:(nstablecolumn *)tablecolumn item:(id)item { if([item iskindofclass:[nsvalue class]]) { mydata *pdt = (mydata *)[item pointervalue]; if(pdt->isgroupelement()) { [cell setimage:pgroupimage]; } } } but not working, there other way change disclosure image, how can find out in willdisplaycell whether item expand or collapse, can set image accordingly, is place change disclosure image ? you've got basic idea need draw image yourself. here's code use: - (void)outlineview:(nsoutlineview *)outlineview willdisplayoutlinecell...

CSS styling html table columns using <col />, cascade help -

Image
how style 1 column on table not have borders? i've been using <col/> tag id can style css. example of css: #table td, th { vertical-align:middle; text-align:center; font-size:11px; border:1px solid #e0e0e0; } #col { width:300px; border:none !important; } the above should make every cell in #table have borders, while !important declaration should override cascade above. doing wrong here? i made below making every <td id="col"> , changing col selector td#col . felt messy way things, wanted better control on table not inserting id tag every td column. see http://www.w3.org/tr/css21/tables.html#columns you not setting border-collapse property: the various border properties apply columns if 'border-collapse' set 'collapse' on table element. then, given: in case, borders set on columns , column groups input conflict resolution algorithm selects border styles @ every cell edge. the bo...

installer - small problem with optional section in NSIS with HM NSIS editor -

i have simple little problem: according docs here should have optional section should allow user check off right? i have section this: section "sayhello" detailprint "blah blah" messagebox mb_ok "hello" sectionend i've tried sorts of combinations , tweaks never shows optional check, message box executes every time no matter what. except of course if add /o throw message box @ all, no option check on/off. its eating me little , cannot seem figure wrong? also, sections executed in order defined? note: whole code, generated hm nis editor ran wizard basic installer , saved script, then, added section. used modern ui . thanks if want ability toggle sections, need insert components page before instfiles page. yes, sections execute in order defined in script.

javascript - Filling in a textbox with values from checkboxes -

here code have far <head> <script type="text/javascript"> function list(c,n,z) { s=document.form.marktext.value; if (c.checked) { if (s.indexof(n)<0) s+=', '+n; } else { s=document.form.marktext.value.replace(', '+n,''); } z=", "; if (s.substring(2) == z) s=s.substring(2); document.form.marktext.value=s;} function getchecked() { var newtxt = ''; var chkbx = document.getelementsbytagname('input'); for(var = 0; < chkbx.length; ++) { if(chkbx[i].type == 'checkbox' && chkbx[i].checked === true) { if(newtxt.length !== 0) { newtxt += ','; } newtxt += chkbx.innerhtml; } } document.form.marktext.value = newtxt; } </script> </head> <body> <form name="form"> <input type="text" value="" name...

ruby on rails - start mongrel server in terminal -

if start mongrel error come. can do? tell me way start mongrel please... $script/server mongrel => booting mongrel (use 'script/server webrick' force webrick) => rails 2.2.2 application starting on http://0.0.0.0:3000 => call -d detach => ctrl-c shutdown server ** starting mongrel listening @ 0.0.0.0:3000 exiting /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize_without_backlog': address in use - bind(2) (errno::eaddrinuse) /usr/lib/ruby/1.8/mongrel/tcphack.rb:12:in `initialize' /usr/lib/ruby/1.8/mongrel.rb:93:in `new' /usr/lib/ruby/1.8/mongrel.rb:93:in `initialize' /usr/lib/ruby/1.8/mongrel/configurator.rb:139:in `new' /usr/lib/ruby/1.8/mongrel/configurator.rb:139:in `listener' /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:99:in `cloaker_' /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `call' /usr/lib/ruby/1.8/mongrel/configurator.rb:50:in `initialize' ... 19 levels...

c# - Datatable Addition to Dataset exception -

dataset ds = dal.getdata(); dataset dsinvitee = null; datatable dt = ds.tables[0].copy(); ienumerable<datarow> q1 = dt.asenumerable().skip(5).take(10); dsinvitee = new dataset(); datatable dtnew = new datatable(); dtnew.tablename = "dtinv"; dtnew = q1.copytodatatable<datarow>(); dsinvitee.tables.add(dtnew.copy()); dsinvitee.acceptchanges(); dtnew = null; dtnew = new datatable(); dtnew.tablename = "dttags"; dtnew = ds.tables[1].copy(); dsinvitee.tables.add(dtnew.copy()); i getting error in last line "a datatable named 'table1' belongs dataset."... please help. your issue because of line dtnew = q1.copytodatatable<datarow>(); , because copytodatatable extension method: returns datatable contains copies of datarow objects, given input ienumerable object generic parameter t datarow. this means table name of "dtinv" gets blown away after call copytodatatable, dtnew no longer refers same datatable ...

graphics - Does anything special need to be done to linear-intensity images before displaying them on a DICOM calibrated display? -

i have code renders rgb images physical simulation. images have linear intensity scale, must gamma corrected before display on normal pc monitor , it's easy enough application apply necessary power law @ point in display pipeline (generally use 1.6 2.2 on ad-hoc basis; whatever think looks best). now in future application may run users dicom calibrated displays. it's entirely unclear me in way these differ normal pc monitor (other in way being "more accurate"). there particular gamma value should used, or different response function needed, in order reproduce original linear-intensity image reasonably accurately on display ? the definitive reference on topic here .

c# - What event is raised when a .Net Sockets Keep Alive does not receive an ackowledgement? -

i have configured c# .net socket using m_clientsocket.setsocketoption(socketoptionlevel.socket, socketoptionname.keepalive, convert.toint32(true)) m_clientsocket.iocontrol(iocontrolcode.keepalivevalues, sio_keepalive_vals, result) my settings send every 30 seconds , send every 10 seconds when first acknowledgement not received. i can see keep alive , keep alive ack flags being sent , received server when connection up. when connection broken can see keep alive being sent , no acknowledgement being received. can see keep alives being sent have changed behaviour in line settings, i.e. being sent every 10 seconds opposed every 30 seconds. i expecting sort of event fire can respond break (i.e. shutdown socket , start trying recycle it). can tell me how pick on fact keep alives have noticed connection broken ? thanks ady sockets not raise events regarding connectivity state (or else matter). detect failure, need either send or receive operation. you should in...

ios - UIView and UIViewController -

i know basic stuff need understand whether understanding of correct. so want this. want view label on when double tapped flips , loads view. on second view want uipickerview , above have button saying back. both views of same size uipickerview 320px x 216px. what thinking of create 2 uiview classes named labelview , pickerview. create viewcontroller on loadview loads labelview when user double taps labelview event in labelview class sent viewcontroller can unload loadview , load pickerview . does sound best way ? there simpler way ? unsure how route event labelview class viewcontroller class. i dont know efficient way it(as language),but sure have solved ur problem. made simple program that.three classes involved here in eg baseviewcontroller (which show 2 views),labelview , pickerview (according ur requirement). in labelview.h @protocol labelviewdelegate -(void)didtaptwicelabelview; @end @interface labelview : uiview { id <labelviewdelegate> de...

c# - windows mobile 6.5 .net CF HttpWebRequest to same URL from 2 different threads - errors -

i have strange situation in .net cf 3.5 windows mobile 6.5 application. have 2 threads. in 1st thread following: try { string url = "http://myserverurl"; httpwebrequest request = (httpwebrequest)webrequest.create(url); _currentrequest = request; request.timeout = 10000; response = (httpwebresponse)request.getresponse(); connectionstatus connstatus = response.statuscode == httpstatuscode.ok; response.close(); } catch (exception e) { //log e } { } in 2n thread call webservice through soaphttpclientprotocol based class generated webservice reference. soapclient.url = "http://myserverurl"; soapclient.methodonwebservice(); in both cases url same. 1st thread used connection checking purpose. webrequest periodically check whetrher server available , displays connection status (not shown in code). 2nd thread calls webservice on same server (url). observed, when 1 thread executing webrequest 2nd 1 gets blocked or event timeouted while executi...

cordova - Phonegap, iphone - applicationDidFinishLaunching not invoking -

i'm trying started phonegap. i have added code applicationdidfinishlaunching doesn't seem getting called. i've added breakpoints (log, continue) each of init , applicationdidfinishlaunching methods. confirms latter indeed isn't getting invoked. xcode, objective-c , phonegap foreign me , im bit lost how resolve this. thanks edit: i've tried creating brand new blank unmodified phonegap project, , same thing happens. init breakpoint fires, applicationdidfinishlaunching not. i new iphone development. have done 1 small app using phonegap framework. yes when use phonegap framework our project's applicationdidfinishlaunching not work , other methods webviewdidfinishload , webviewdidstartload in app delegate not work.. instead of applicationdidfinishlaunchinwithoptions of phonegaplib.xcodeproj included in our project of phonegap gets excute. try write nslog(); there. u output on consol..

cocoa - drawLayer not called when subclassing CALayer -

i have simple calayer subclass (boxlayer) drawlayer method: - (void)drawlayer:(calayer *)layer incontext:(cgcontextref)ctx { nslog(@"drawlayer"); nsgraphicscontext *nsgraphicscontext; nsgraphicscontext = [nsgraphicscontext graphicscontextwithgraphicsport:ctx flipped:no]; [nsgraphicscontext savegraphicsstate]; [nsgraphicscontext setcurrentcontext:nsgraphicscontext]; // ...draw content using ns apis... nspoint origin = { 21,21 }; nsrect rect; rect.origin = origin; rect.size.width = 128; rect.size.height = 128; nsbezierpath * path; path = [nsbezierpath bezierpathwithrect:rect]; [path setlinewidth:4]; [[nscolor whitecolor] set]; [path fill]; [[nscolor graycolor] set]; [path stroke]; [nsgraphicscontext restoregraphicsstate]; } i have awakefromnib in nsview subclass: - (void)awakefromnib { calayer* rootlayer = [calayer...

Android: How to use a Android Pad as a customer information Terminal -

i want android-powered pad information terminal customers. the thing has to show html5 webpage. therefore, 1. should not posiible show website (only local one), should no problem it should possible leave app password (how?) and buttons should disabled (that´s hard). i found out how set target home button, maybe there existing solution. thanks christian i assume understand easiest way develop android native application show webpage. done using webview , support of html5 depends on platform, if use video or audio, may need hooks. trhough webview, can filter urls can opened or not. and well, don't think there many problems on exiting when password entered. regarding number 2, afaik, can let activity ("window" of application) handle of keys, can't map power key. but have confess, when develop application, find issues... not easy wrote in these lines... luck!

replace - Replacing a word in a file, using C -

how replace word in file word using c ? for example, have file contains: my friend name sajid i want replace word friend grandfather , such file changed to: my grandfather name sajid (i developing on ubuntu linux.) update: i doing filing in c. have created .txt file , write data it, program progresses have search text , replace other words. problem facing suppose in file wrote "i bought apple market" if replace apple pineapples apple has 5 char , pineapple has 9 char write as "i bought pineapple m market" it has affected words written after apple. i have using c, not command line script. how using exiting linux sed program? sed -i 's/friend/grandfather/' filename that replace friend grandfather in existing file. make copy first if want keep original! edit: alternatively, load file stl string, replace 'friend' 'grandfather' using technique such this , , save new string file.

how to create procedure in mysql for selecting record? -

how write procedure in mysql select record particular table in , out parameter? delimiter // create procedure sample (in id int, out mycount int) begin select count(*) mycount yourtable yourkey = id; end//

javascript - Making referrer and querystring available to a frame under a different domain -

i need deal website page big frame loads website content. can't change this. <html> <!-- page lives under mydomain.com --> <head> <title>my beautiful website</title> </head> <frameset rows="100%" border="0" frameborder="0"> <!-- website actual content loaded subdir of different domain --> <frame src="http://mydifferentdomain.com/subdir" name="my-ugly-frame"> </frameset> </html> i need make referrer , query string informations of mydomain.com, available javascript code runs inside frame, can understand how people reach website. is there way circumvent cross domain restrictions? thanks. is there way circumvent cross domain restrictions? no. data has passed explicitly. the frameset page include data in query string of uri used load embedded page … i'm guessing domain hosting dns server deprived...

How can I tell if an entity is disabled in Dynamics CRM 4.0? -

in microsoft dynamics crm 4.0, want able check if record of entity type disabled. think can check statecode. information have seen, value of 0 means entity enabled (editable in crm) , other value means disabled (for editing in crm). is assumption correct entities? edit if assumption correct, possible create queryexpression dynamic entities such comparison, rather using text, "active", incorrect quotes? from i've read, statecode not same every entity. varies per entity. i'm not aware of way disable entity. double checked our install, don't see option disable. google yields no results end. do mean perhaps individual entity records? if so, you'll have check statecode entity you're looking at. think most entities use statecode describe, entities, such activities, seems vary little. here sql found pull statecode/statuscode details of particular entity: select attributename, attributevalue, value dbo.stringmap (dbo.st...

android - Best way to load my Sqlite Tables after creating tables on startup -

i have 2 static tables 500 records each provide lookup material listviews in app. when app first starts , tables created run process populate tables takes less minute i've been looking run process in background using async task progress dialog letting user know happening. concern while process running , data being added , user tilts phone process cancel. state of database then? async task best solution or should use threading? so when rotate or change orientation of phone, activity thing destroyed. don't have rid of async task. in fact live on. don't let task come in , work on ad-hocly. so if want have activity act if upon rotating can start right up, left off, there method called onretainnonconfigurationinstance(). it's method stashes objects can't parceled in saveinstancestate() so idea being: public void oncreate(bundle a) { ... asynctask mytask = getnonconfigurationinstance(); if (mytask == null) { mytask = new asynctask(); ...

jquery - How to check for number of events on agendaDay and basicDay views -

i want disable calendar if there no events day (i'm using on sidebar in basicday view). know how can check number of events can disable calendar if there none? help appreciated! in advance. you can use following callbacks find out if there data in view: var numevents = 0; $("#calendar").fullcalendar({ loading: function(isloading, view) { if(isloading) { // starting fetch events numevents = 0; } else { // done fetching events if(numevents == 0) { // disable calendar } else { // ensure calendar enabled } } }, eventafterrender: function(event, element, view) { numevents++; } }); since fullcalendar loads events current view, figure out view has new data (unless store them on client side), you'll want implement code on server side can return next date event. can use gotodate on calendar go date once server.

math - Fastest algorithm of getting precise answer (not approximated) when square-rooting -

sorry unclear title, don't know how state (feel free edit), give example: sqrt(108) ~ 10.39... want sqrt(108)=6*sqrt(3) means expanding 2 numbers so that's algorithm i = floor(sqrt(number)) //just in case, floor returns lowest integer value :) while (i > 0) //in given example number 108 if (number mod (i*i) == 0) first = //in given example first 6 second = number / (i*i) //in given example second 3 = 0 i-- maybe know better algorithm? if matters use php , of course use appropriate syntax there no fast algorithm this. requires find square factors. requires @ least factorizing. but can speed approach quite bit. start, need find prime factors cube root of n, , test whether n perfect square using advice fastest way determine if integer's square root integer . next speed up, work bottom factors up. every time find prime factor, divide n repeatedly...

php - convert pdf to transparent png -

i'm using imagemagick convert pdf file png (thumbnail) image, , works well. i'm wondering whether it's possible convert pdf, has white background, png file transparent background (i.e. set white pixels transparent). this php code i'm using (which results in png file white background): /* open first page of pdf file */ $im = new imagick($pdf_filepath . '[0]'); /* scale */ $im->thumbnailimage($width, $height); /* convert png */ $im->setimageformat('png'); /* save file */ $result = $im->writeimage($thumbnail_filepath); check out: http://imagemagick.org/usage/channels/#mask_creation i think have create gif first , png if wish.

javascript - Vertical Scrolling Div -

i have div 400px x 400px contains text need scroll. control on couple of arrow images (up , down). can done jquery? dont want scroller off side of div. couple , down arrows under div control scrolling of content. any thoughts? thanks in advance. these helpful: http://www.codingforums.com/showthread.php?t=93997 http://radio.javaranch.com/pascarello/2005/12/14/1134573598403.html scroll position of div "overflow: auto" could have searched those... don't need use jquery.

hosting - PHP: mkdir() not working -

any ideas of why mkdir returning true it's not creating folder? way blocked? how can @ this? have full cpanel access , root. thank you! from this comment : i failed take account existing umask when did mkdir(dirname, 0755) . ended creating directory (function returned true), didn't have rights inside folder, nor view existed via ftp.

c# - .net - get all records from table and loop through -

i'm trying records table , loop through it. pseudo code: database.dbdatacontext db = new database.dbdatacontext(); protected void page_load(object sender, eventargs e) { list<database.user> data = db.users.tolist(); // rows (int = 0; < data.count; i++) { // columns (int j = 0; j < data[i].count; j++) { } } } i'm unsure syntax. anyone know how that? thanks in advance! why not that: database.dbdatacontext db = new database.dbdatacontext(); protected void page_load(object sender, eventargs e) { foreach(database.user user in db.users) { // whatever need `user` object here..... // here, have instance of `user` object - access properties // , methods on `user` object.... } }