Posts

Showing posts from March, 2013

uml - Visual Studio 2010 Sequence Diagrams Cannot load -

i editing vs 2010 sequence diagram , after saving , closing it, can no longer open it. following error. know how resolve this? "cannot load '{diagram path , name}': value cannot null. parameter name: roleplayer" the title of dialog "microsoft visual studio" this question answered on msdn visualization & modeling tools forum .

java - Efficient way to divide a list into lists of n size -

i have array, want divide smaller arrays of n size, , perform operation on each. current method of doing is implemented arraylists in java (any pseudocode do) (int = 1; <= math.floor((a.size() / n)); i++) { arraylist temp = subarray(a, ((i * n) - n), (i * n) - 1); // stuff temp } private arraylist<comparable> subarray(arraylist a, int start, int end) { arraylist toreturn = new arraylist(); (int = start; <= end; i++) { toreturn.add(a.get(i)); } return toreturn; } where list, n size of desired lists i believe way taking time when working considerably large lists (of 1 million in size) i'm trying figure out more efficient. you'll want makes use of list.sublist(int, int) views rather copying each sublist. easily, use guava 's lists.partition(list, int) method: list<foo> foos = ... (list...

java - How does this code for delaunay triangulation work? -

i have java code set of point in input return set of graph's edge represent delaunay triangulation. i know strategy used this, if exist, name of algorithm used. in code graphedge contains 2 awt point , represent edge in triangulation, graphpoint extends awt point, , edges of final triangulation returned in treeset object. my purpose understand how method works: public treeset getedges(int n, int[] x, int[] y, int[] z) below complete source code of triangulation : import java.awt.point; import java.util.iterator; import java.util.treeset; public class delaunaytriangulation { int[][] adjmatrix; delaunaytriangulation(int size) { this.adjmatrix = new int[size][size]; } public int[][] getadj() { return this.adjmatrix; } public treeset getedges(int n, int[] x, int[] y, int[] z) { treeset result = new treeset(); if (n == 2) { this.adjmatrix[0][1] = 1; this.adjmatrix[1][0] = 1; result.add(new graphedg...

java - JPanel Preferred Size Not Being Set -

when preferred size of jpanel set if don't set explicitly? i have following code: private static class scrollablejpanel extends jpanel implements scrollable { @override public dimension getpreferredscrollableviewportsize() { return getpreferredsize(); } . . . } and code: mypanel = new scrollablejpanel(); // add bunch of controls panel. final jscrollpane scroll = new jscrollpane(mypanel); scroll.setautoscrolls(true); scroll.sethorizontalscrollbarpolicy( scrollpaneconstants.horizontal_scrollbar_never); however, preferred size of mypanel @ time getpreferredscrollableviewportsize() being called seems arbitrary value, (4225, 34), , prefsizeset = false. according java documentation , reasonable way define method. however, actual size of mypanel higher 34 pixels, view port way small. what doing wrong here? should set preferred size of mypanel explicitly? tried that, w...

Ruby on Rails - Test Unit -

i have test : test "should not allow access" :new assert_redirected_to new_user_session_url end i use devise authentication. i have 2 views each of actions: 1 normal, , 1 mobile devices, before i've used usual default view (sign_in.html.erb) - test pass, when i've added mobile view (sign_in.mobile.erb) i've got next fail message. expected response redirect http://test.host/users/sign_in redirect http://test.host/users/sign_in.mobile so client testing point of view - logic working fine, e.g. in case if user not authenticated redirected session new path (new_user_session_url). works mobile devices (mobile client redirected mobile view of sign in page), test fail reasons if client mobile device , controller redirect mobile view. my question how fix test ? i've tried : assert_redirected_to new_user_session_path assert_redirected_to :controller => "devise/session", :action => "new" but no success , same fai...

c# - Converting code using generics -

i've following code uses passed object , acts on after determining type. question if convert use generics, performance advantage since i'd still have determine type of t before act upon it? save ticks on boxing/unboxing? private void bindoptionfields(object obj, string selectedvalue, int datalanguageid) { string typ = obj.gettype().name; switch(typ.tolower()) { case "ratingscaleitem": setratingscale((common.ratingscaleitem)obj, datalanguageid, selectedvalue); break; case "taskstatus": text = ((taskstatus)obj).taskname; optionvalue = ((taskstatus)obj).stateid.tostring(); break; case "planlite": text = ((xyz.abc.planlite)obj).planname; optionvalue = ((xyz.abc.planlite)obj).id.tostring(); break; case "datarow": tex...

c++ - OpenGLESv2 Shader glGetAttribLocation returns -1 -

hey, try code opengl es 2 engine @ shader creation function glgetattriblocation returns -1 means the named attribute variable not active attribute in specified program object or name starts reserved prefix "gl_". but defined in shader , doesnt start gl_. whats wrong code? c++ code: glprogram = glcreateprogram(); glvertshader = glcreateshader(gl_vertex_shader); glfragshader = glcreateshader(gl_fragment_shader); glshadersource(glvertshader, 1, vertsrc, null); glshadersource(glfragshader, 1, fragsrc, null); glint ret; glcompileshader(glvertshader); glgetshaderiv(glvertshader, gl_compile_status, &ret); if(!ret) { ///error handling - stripped internet } glcompileshader(glfragshader); glgetshaderiv(glfragshader, gl_compile_status, &ret); if(!ret) { ///error handling - stripped internet } glattachshader(glprogram, glvertshader); glattachshader(glprogram, glfragshader); gllinkprogram(glprogram); glgetprogramiv(glprogram, gl_link_stat...

jquery - IE7 change event not being triggered -

am doing wrong? why isn't click event registering on first keydown? http://jsfiddle.net/vol7ron/vj5cx/ in example, click "menu" make sure has focus use arrow keys (up/down) highlight option use spacebar select option notice how change() event not being called. use spacebar again select same option , notice working should. i've tried: using blur/focus according this question , haven't had luck setting checked attribute false, make sure change event triggered interesting findings: there isn't problem when using mouse (it triggers change event on first time, expected) the problem still occurs keydown, after selecting mouse (run, click option, hover option , use keyboard). expected results: using keyboard navigation (up/down arrows) , selecting spacebar, should trigger both "keydown" , "click" log. doesn't work on initial keydown, every subsequent time. (check firefox working example) i usi...

php - saving values from an input field -

hi iam trying create wordpress plugin option page.i need create form input fields having default values in , when change value , save it, changed value should reflected in input filed , in variable assigned store value. let me more precise when change value of input field , save it should stored in assiged variable value( permanently till again change myself). iam bit poor in form validation , php.help me out guys. if you're ok working in newer browsers, use placeholder attribute on text field, supply placeholder disappear when focus , reappear when blur. <input type="text" name="txtfield" value="" placeholder="input text" /> if want work in older browsers, in javascript: <input type="text" name="txtfield" onfocus="if(this.value=='enter email')this.value=''" onblur="if(this.value=='')this.value='enter email'" > then can use <?php ...

scala - How to use members with default (package) or private access level in REPL? -

i trying add interactivity test/debug cycle, tried playing around classes scala repl. works great has disadvantage cannot access package- , private-level members, can tested unit test (if test in same package). can "set" package "context" of scala repl? i guess use reflection access members, that's typing defeat purpose of using repl in first place. i assume class testing written in java have go out of way create package member in scala. in short, it's not possible. each line in repl wrapped it's own package, won't allowed access package-only member other package. though there undocumented system property change default package name prefix used wrapping, package name still generated automatically incrementing number: $ scala -xprint:parser -dscala.repl.naming.line=foo.line scala> val x = 1 [[syntax trees @ end of parser]]// scala source: <console> package foo.line1 { object $read extends scala.scalaobject { // snip...

css - How to automatically center a div element that is inside another div element -

let's suppose following use case: working example plese @ link the html code: <div class="container"> <div class="centerelem"> width of div variable </div> </div> the css style: .container { width: 500px; /*this can change */ } .container .centerelem{ margin-right: auto /*unfortunately, works if set width*/ margin-left: auto /*unfortunately, works if set width*/ } right works this: ||the width of div variable| | and make working this, without knowing width of inner div element: | |the width of div variable| | it's bit annoying because code in question doesn't match code in jsfiddle,. use display: inline-block on .subcon , combined text-align: center on .container , have. like so: http://jsfiddle.net/thirtydot/euytq/66/ or code in question: http://jsfiddle.net/thirtydot/euytq/67/

c++ - Avoid waiting on SwapBuffers -

i have discovered swapbuffers in opengl busy-wait long graphics card isn't done rendering or if it's waiting on v-sync. this problem me because don't want waste 100% of cpu core while waiting card finished. i'm not writing game, can not use cpu cycles more productive, want yield them other process in operating system. i've found callback-functions such gluttimerfunc , glutidlefunc work me, don't want use glut. still, glut must in way use normal gl functions this, right? is there function such "glreadytoswap" or similar? in case check every millisecond or , determine if should wait while longer or swap. imagine perhaps skip swapbuffers , write own similar function doesn't busy-wait if point me in right direction. swapbuffers not busy waiting , blocks thread in driver context, makes windows calculating cpu usage wrongly: windows calculates cpu usage determining how cpu time idle process gets + how time programs don't spend in d...

javascript - jquery, simple-inheritance and 'this' -

so i'm trying use javascript 'simple inheritance' (as per http://ejohn.org/blog/simple-javascript-inheritance/ ). "simplify" things, idea create objects , attach them elements can operate on them; var pane = class.extend({ init: function( el ) { this.el = el; this.$el = $(el); return this; }, do_something: function() { this.$el.html('doing something!'); $.getjson( '/somewhere.js', function(data){ // write $el }); } }); and have html like <div id="my_div"></div> <script> var p = new pane( $('#my_div') ) p.do_something() </script> unfortunately, within ajax call, 'this' becomes jquery object, rather pane object can't update $el / my_div (and making idea pointless). ideas how can access object within getjson call? just use closure (copy this other variable outside) ... do_something: function...

500 internal server error php/javascript/ajax -

i uploaded project hosting provider. doing has lead error in javascrript file. javascript needed, because render alert shows data javascript fetches, not sending response file tracker.php insert database. response sending via ajax. m getting 500 internal server error. visible errors in code causing this: function getxmlhttpobject() { var xmlhttp; try { xmlhttp=new xmlhttprequest(); } catch (e) { try { xmlhttp=new activexobject("msxml2.xmlhttp"); } catch (e) { try { xmlhttp=new activexobject("microsoft.xmlhttp"); } catch (e) { // alert("your browser not support ajax!"); return false; } } } return xmlhttp; } function trackme() { var xmlhttp = getxmlhttpobject(); xmlhttp.onreadystatechange=function() { if(xmlhttp.readystate==4) { var response=xmlhttp.res...

excel - Is there any way I can speed up this VBA algorithm? -

i looking implement vba trie -building algorithm able process substantial english lexicon (~50,000 words) in relatively short amount of time (less 15-20 seconds). since c++ programmer practice (and first time doing substantial vba work), built quick proof-of-concept program able complete task on computer in half second. when came time test vba port however, took 2 minutes same -- unacceptably long amount of time purposes. vba code below: node class module: public letter string public next_nodes new collection public is_word boolean main module: dim tree node sub build_trie() set tree = new node dim file, a, b, c integer dim current node dim wordlist collection set wordlist = new collection file = freefile open "c:\corncob_caps.txt" input file while not eof(file) dim line string line input #file, line wordlist.add line loop = 1 wordlist.count set current = tree b = 1 len(wordlist.item...

Static pages and assets in Rails 3.1.1 -

currently working on project need drop in various static html pages + static assets time time "just work." cannot have editing html directly place paths in assets. need work such html + asset folders placed directly /public , content served generated. when testing behavior in production, it's no go errors such as: actioncontroller::routingerror (no route matches [get] "/some_folder/some-image.png"): i assume result i'm reading 3.1.x's asset pipeline. how alter routes such these served directly? or there preferred way keep precise behavior? (ultimately deployed on heroku.) adding more details current remarks have not yet pushed issue on edge in terms of solution: in present scenario i'm running straight on webrick rails s -e production test out. in development mode work properly; exception in production . i running prior running server: bundle exec rake rails_env=production rails_groups=assets assets:precompile --trace when ...

How to append Ajax.ActionLink using jQuery? -

i'm busy asp.net mvc 3 site. there should view list of links. list populated (or constructed, rather) using jquery. now, worked saying in javascript function (in seperate javascript file): $(ul#items).append(<li><a href=...>...</a></li>); for each item in array. but change system makes necessary utilize functionality provided ajax.actionlink. if try append <%: ajax.actionlink ... %> above, appends text , not html (i.e. on page displays list of <%: ajax.actionlink... <%> any suggestions why happening , how make work? thanks d isn't following working: $('ul#items').append('<li><%= ajax.actionlink("hello", "foo", new ajaxoptions { }) %></li>'); of course if using razor view engine: $('ul#items').append('<li>@ajax.actionlink("hello", "foo", new ajaxoptions { })</li>'); and don't forget in asp.net mvc 3 d...

character encoding - charsets problems with php -

we aproblems codification in php, web site www.toroalbala.com , select rusian lenguage , imposible read caracter, use comun.php web, codification, when change tf8, can read corect caracter in spanish-french toro albalá <meta http-equiv="content-type" content="text/html;charset=iso-8859-1"> <?php if ((($_request["seccion"] == "distribuidores") || ($_request["seccion"] == "admin")) && (isset($_request["salir"]))) { echo "<meta http-equiv='refresh' content='3;url=comun.php?seccion=inicio&amp;idioma=".$_session["idioma"]."'>"; } ?> <link rel="stylesheet" type="text/css" href="estilo/estilo.css"> <script type="text/javascript" src="js/js_comun.js"></script> <script type="text/javascript" src="js/errores.js"...

c - Trace all calls from a program? -

a program installed on 2 computers. library working correctly in 1 computer not working @ in other. wonder if library missing. i'm using strace can see libraries being called program @ runtime. libraries mentioned strace correct strace detect if 1 library calls library or file ? way detect scenario ? yes strace detect calls loaded libraries. if want trace library calls (not system ones), use ltrace

php - How to install APC XAMPP -

i tried find in google how install "apc" , didn't found way. know how to? by way, have mac sudo /applications/xampp/xamppfiles/bin/pecl install apc or cold follow these instructions here . but booth need developer tools.

jquery - Datatables: Selecting their items -

how can select datatables items? have tried stuff like: $("select").change(function () { alert('changed!'); }); but see no results. tried name cannot interact these elements. interact directly select , search box. thank you! try wraping in $(document).ready function, $(document).ready(function(){ $("select").live('change',function () { alert('changed!'); }); });

restlet - Web Server on Android phone -

i'm trying set web server using restlet framework on android phone. idea build game 1 phone creates markers on map can transferred directly other phones using rest. @ first (and simplicity) want transfer list of objects . running server on computer seems work fine, when transfer code android application, won't start server. here code: component servercomponent = new component(); servercomponent.getservers().add(protocol.http, 80); final router router = new router(servercomponent.getcontext().createchildcontext()); router.attach("/gamedata", gamedataresourceserver.class); servercomponent.getdefaulthost().attach(router); servercomponent.start(); when line servercomponent.start(); executed, exception thrown: java.net.bindexception: permission denied (maybe missing internet permission) , although internet permission in manifest file. searching tutorials didn't either. result either client applications or complicated scenarios. give example sim...

objective c - Problem renaming xcode classes -

i'm trying rename classes in ios project in xcode cant. if try rename file in navigator, or if make refactor -> rename on class name in .h file, replace except .h , .m file, me: "unable rename oldname newname, oldname couldn't moved appname" how can solve this? thanks. type in name of project in finder, , locate class files , header files inside that. try renaming through that

flash - what exactly does setting the AIR namespace do? -

so when setting air namespace in application-descriptor of air application, tells minimum air runtime app compatible with, right? but more disallowing installation if lower runtime version installed? for example, if air runtime 3.0 installed, may application perform in way different if namespace set either 2.0 or 3.0 in application descriptor? the air namespace 3 things: distinguishes sdk of air other possible environments (flex) compiler imports air specific packages runtime environment deprecates air packages have been deprecated based on version number, , introduces new packages based on version number for example: you must update application descriptor file 16 namespace in order access new air 16 apis , behavior. if application not require new air 16 apis , behavior, not required update namespace. however, recommend users start using air 16 namespace if not yet taking advantage of new 16 capabilities. update namespace, change xmlns attribute in applica...

delphi - Get average color of an image -

i trying average color of image. tried various methods , use following code, not correct result. can explain wrong code? //load bitmap curimg img1.picture.bitmap := curimg ; //testing previous line //my image greater 25x25 need 25x25 box := 0 25 begin y := 0 25 begin r := r + getrvalue(curimg.canvas.pixels[y, i]); g := g + getgvalue(curimg.canvas.pixels[y, i]); b := b + getbvalue(curimg.canvas.pixels[y, i]); end; end; r := r div (25 * 25); g := g div (25 * 25); b := b div (25 * 25); rgbk := rgb(r, g, b); result = rgbk; end; img1 , image1 of type timagebox on form. the local variables r,g,b: integer should initialized 0 first.

silverlight - Facebook Chat client in c# Windows Phone 7 -

how create client facebook chat windows 7? know have use jabber / xmpp, sockets not compatible wp7, how can do? thanks you wait mango release (some) socket support. other option have wp7 app talk server own, brokers jabber/ xmpp calls facebook you.

drop down menu - Issue with dropdownlist in asp.net -

i have problem selectedindexchanged event of dropdownlist, on page load checking id , make item selected in dropdownlist. on selectedindexchanged of dropdownlist, when try print, dropdownlist.selectedvalue , returns me blank value, guess thing on page load dropdownlist defautl selected value messing me up, still required. below page load code:- if (!ispostback) { listitem item = ddlslideslist.items.findbyvalue(bl.slideshowid.tostring()); if (item != null) item.selected = true; } and below code under selectedindexchanged event. response.write(ddlslideslist.selectedvalue);

asp.net - Unable to call .ashx file from repeater control -

i facing problem while calling .ashx file repeater control in .aspx page. put break point in .ashx file, process execution not going line. page placed in sub folder , @ first having membership authentication later changed forms authentication. make sure path ashx correct - example, it's relative path, make sure when considered relative page, whether points correct location. use / instead of \ . you can use tool such fiddler or firebug on firefox inspect requests/responses from/to browser. example, can see if request path ashx correct or not , if it's incorrect, notice 404 response server.

serialization - Converting any object to a byte array in java -

i have object of type x want convert byte array before sending store in s3. can tell me how this? appreciate help. what want called " serialization ". there several ways of doing it, if don't need fancy think using standard java object serialization fine. perhaps use this? package com.example; import java.io.bytearrayinputstream; import java.io.bytearrayoutputstream; import java.io.ioexception; import java.io.objectinputstream; import java.io.objectoutputstream; public class serializer { public static byte[] serialize(object obj) throws ioexception { try(bytearrayoutputstream b = new bytearrayoutputstream()){ try(objectoutputstream o = new objectoutputstream(b)){ o.writeobject(obj); } return b.tobytearray(); } } public static object deserialize(byte[] bytes) throws ioexception, classnotfoundexception { try(bytearrayinputstream b = new bytearrayinputstream(bytes)){...

Testing a custom ContentProvider in Android -

i have written content provider supposed wrap access 2 tables in sqllite database. i'd write test cases have never done it. after reading section on developer guide, must did not manage tested. below code far. class in test project corresponds main project. when execute in eclipse, emulator starts correctly, packages installed not run test: test run failed: test run incomplete. expected 1 tests, received 0 here test class: public class articleprovidertest extends providertestcase2<articleprovider> { static final uri[] validuris = new uri[] { articles.content_uri, pictures.content_uri, pictures.getcontenturiforarticleid(1) }; public articleprovidertest(class<articleprovider> providerclass, string providerauthority) { super(providerclass, providerauthority); } @override protected void setup() throws exception { super.setup(); } public void testquery() { contentprovider provider = getp...

google app engine - How to find entries which has not empty StringListProperty? -

i have following model in google appengine app. class testmodel(db.model): names = db.stringlistproperty(required=false) so, want entries has not empty in names property. tried this. testmodel.all().filter('names !=', []) but raises exception: badvalueerror: filtering on lists not supported how can filter it? or should check 1 one following? for entry in testmodel.all(): if len(entry.names) > 0: result.append(entry) try this: testmodel.all().filter('names >=', none) this give every entity @ least 1 value set names, i.e. every value in index.

string - Java - Need Parse Help for dollar amounts -

i'm trying figure out way parse "$" , "," out of dollar amount. for example, have string $5,600. need parse have left 5600. great appreciated. thank you, kevin you use numberformat numberformat format = numberformat.getcurrencyinstance(); number number = format.parse("$5,600"); number 5600 you can specify locale if want target special countries.

neural network - How can I modify my code to show training and testing graphs in MATLAB? -

i have code neural networks. how can modify code can show training , testing graphs? %~~~~~~~~~~~[l1 l2 1];first hidden layer,second & output layer~~~~~ layer = [11 15 1]; myepochs = 30; attemption = 1; %i; mytfn = {'tansig' 'tansig' 'purelin'}; %~~~~~~load data~~~~~~~~~~~~~~~~~~~~~~~ m = xlsread('c:\documents , settings\winxp\my documents\matlab\matlab_data\datatrain.csv'); %~~~~~~convert data in matrix form~~~~ [row,col] = size(m); p = m(1:row,1:10)'; t1 = m(1:row, col)'; % target data training...last column net = newff([minmax(p)],layer,mytfn,'trainlm'); %nnet net.trainparam.epochs = myepochs; % how many time newff repeat training net.trainparam.showwindow = true; net.trainparam.showcommandline = true; net = train(net,p,t1); % start training newff input p , target t1 y = sim(net,p); % training save 'net114' net; also, code correct? want calculate area , perimeter of image. calculated val...

c# - how to check if sqldatareader return any value -

here code came with:: reader = cmd.executereader(); reader.read(); if (reader.read()) intq = int.parse(reader[0].tostring()); else intq = 0; txtblck.text = intq.tostring(); reader.close(); but causes execute else, , if this: reader = cmd.executereader(); if (reader.read()) intq = int.parse(reader[0].tostring()); else intq = 0; txtblck.text = intq.tostring(); reader.close(); the if return true, how should this? reader.read() advances reader next record, reader set before first record. if calling reader.read() returns false means unable advance next record (i.e. current record last record). this means if wish read first record need call reader.read() once, , if reader.read() returns false means there no records - so: using (var reader = cmd.executereader()) { if (reader.read()) { intq = int.parse(reader[0].tostring()); } else { intq = 0; } } txtblck.text = intq.tostring(); fyi int.parse throw excep...

Regex for PHP. Search for words and return data after the words -

i'm trying make regex work i've been asked i'm having no luck making efficient enough. objective make following efficient can be. objective number 1. separate text using sentence endings (dot, 3 dots, exclamation point...). objective number 2 numbers appear after string 'em' here's example of possible small string , regex it. (the real 1 can hudge) regex: old: (?:[^.!?:]|...)(?:(?:[^.!?:]|...)*?em (\d+))* new: (?:[.!?]|[.][.][.])(?:(?:[^.!?]|[.][.][.])*?\bem\b (\d+))* works string (i made up) (i insert . in begining) .foi visto que batalha em 1939 foi. claro que data que digo ser em 1939 é uma farsa. em 1938 já (insert em 1910) não havia reis. what wanted make regex not backtrack not need backtrack. making think save processing requires like... reducing 30 seconds 20s or 10s! this1, takes 1s complete. add: thnx answers have 1 not fail. still backtracks much. solutions? add (to answer 1 deleted question): unfortunately have no sample da...

javascript - dynamically created flowplayer scrollable addItem scrolls out of the container -

i creating horizontal scrollable list editable. size of container of list dynamic based on width of visible area of browser. when have list of items has filled screen, , add new item, container scrolls way past newly added element, blank screen. if scroll using "prev" button, see it. i've attached code used dynamically add new item. i tried use .move , .seekto functions correct location, "prev" button gets randomly disabled can't scroll back. any pointers anyone? var speed = 200; var parent = $("#main-container").data("scrollable"); parent.end(speed); var clone = $("#thumbnail-clone").clone(true, true); var input = clone.find(".text-input"); clone.attr("id", newid); parent.additem(clone); input.show(); clone.show(); input.focus();

c++ - Parse C header file to generate files -

i'm working on porting gtk+ node.js, 1 difficulty converting gtk+ functions corresponding c++ call. example, void gtk_window_set_title (gtkwindow *window, const gchar *title); g_const_return gchar *gtk_window_get_title (gtkwindow *window); void gtk_window_set_role (gtkwindow *window, const gchar *role); void gtk_window_set_startup_id (gtkwindow *window, const gchar *startup_id); g_const_return gchar *gtk_window_get_role (gtkwindow *window); will converted to: setter_method (window , "settitle" , gtk_window_set_title , const gchar*) ; getter_method (window , "gettitle" , gtk_window_get_title , const gchar*) ; setter_method (window , "setrole" , gtk_window_set_r...

html - How to force the horizontal scroll bar to appear? -

consider following code : html: <div id="wrapper"> <div class='a'></div> <div class='a'></div> <div class='a'></div> <div class='a'></div> <div class='a'></div> </div> css: #wrapper { width: 300px; border: 1px solid black; overflow: auto; } .a { width: 70px; height: 70px; border: 1px solid red; float: left; } how force horizontal scroll bar appear rather displaying red div's in second line ? try this: #wrapper { width: 300px; border: 1px solid black; overflow: auto; white-space: nowrap; } .a { width: 70px; height: 70px; border: 1px solid red; display: inline-block; } it give spacing between inner divs - put them in 1 line remove those.

sql - What characters are allowed in Oracle bind param placeholders? -

could please point me characters allowed bind variable name listed? i've spent several hours digging through oracle sql docs no avail. i mean ":id" in following: select * mytable id = :id e.g. can dot used there ":some.id"? function version without dot? these pages both state bind variables must "legal oracle identifiers" documentation found doesn't dot can part of legal identifer. able use dot in both table name , bind variable name, looks not recommended. pages have bind variable naming conventions (these pages state bind variable must legal identifier): http://www.utoug.org/i/doc/concept_bind_var.htm http://docs.oracle.com/cd/e23903_01/doc/doc.41/e21674/concept_ses_val.htm#beiegccc page describes legal identifiers: http://docs.oracle.com/cd/b19306_01/server.102/b14200/sql_elements008.htm i not find on page says dot legal part of identifier (e.g. table or bind variable name) except in db link. though $ , # legal, not...

Python scripts in HTML -

is possible write python scripts in html code write php between <?php ... ?> tags? i'd achieve python application run in browser. thank help php doesn't run in browser, server side language. try skulpt try run python in browser.

.net - C# Generics: Can I use them in this example? -

how can generics? in current code, writing each feature on vehicle. foreach (var vaudiosystem in vehicleaudiosystem) { var acml = (vovehiclefeaturelist) frameworkfactoryapi.createvo(typeof (vovehiclefeaturelist)); acml.isinitialized = false; acml.initialize(true); acml.vehiclefeaturelisttype = globalenums.vehiclefeaturelisttype.audiosystem; acml.valueid = vaudiosystem; vehiclespec.vehiclefeaturelists.add(acml); } foreach(var axle in vehicleaxles) { var acml = (vovehiclefeaturelist)frameworkfactoryapi.createvo(typeof(vovehiclefeaturelist)); acml.isinitialized = false; acml.initialize(true); acml.vehiclefeaturelisttype = globalenums.vehiclefeaturelisttype.axles; acml.valueid = axle; vehiclespec.vehiclefeaturelists.add(acml); } foreach(var nav in vehiclenavsystem) ...

performance - ANSI C #define VS functions -

i have question performance of code. let's have struct in c point: typedef struct _cpoint { float x, y; } cpoint; and function use struct. float distance(cpoint p1, cpoint p2) { return sqrt(pow((p2.x-p1.x),2)+pow((p2.y-p1.y),2)); } i wondering if smart idea replace function #define, #define distance(p1, p2)(sqrt(pow((p2.x-p1.x),2)+pow((p2.y-p1.y),2))); i think faster because there no function overhead, , i'm wondering if should use approach other functions in program increase performance. question is: should replace functions #define increase performance of code? no. should never make decision between macro , function based on perceived performance difference. should evaluate soley based on merits of functions on macros. in general choose functions. macros have lot of hidden downsides can bite you. case in point, translation macro here incorrect (or @ least not semantics preserving original function). argument macro distance gets eva...

Arrays. Histograms, dividing array into subset and counting number of elements in each group. Java -

hi im confused abt method have create. have create histogram array num division categories i.e selecting reasonable integer range , step size numdivisons cover whole range of elements in array. @return array histogram in position contains * number of observations in division */ example: {1,3,4,5,10,15,17}. if numdivisions=2 need divide range (1 17) 2 divisions. example, range 0 10 (not included) , 10 20. in case there 4 values in range 0 <10 , 3 values between 10 , 20. histogram numdivisions=2 array {4,3}. public int[] histogram(int numdivisions) can tell me best method of doing it? thanks simple: get minimum , maximum elements of array take difference , divide num, obtaining "step" now iterate through array, placing number n in slot such * step <= n - min < (i+1) * step

simple jqgrid with php script return json data from php -

where sample of jqgrid php script. php return json data there example on jqgrid web site. http://www.trirand.net/demophp.aspx if use firebug can see json response sent plugin php.

In Lisp how can I check stream to see if it's empty without modifying it? -

how can check if stream empty without modifying it? @ moment i'm using peek-char see if there character, appears wait user enter if nothing new in stream. also, don't know how compare eof character... #\space won't work. please? (loop while (equal (peek-char) '#\space) (print 'testword)) you need read manual: listen checks if there input available. peek-char can either signal error @ eof or return eof value. can tell eof value return.

perl script to search all files in folder -

i have 1 folder contains more number of xml files , extract specific information form xml files. used libxml extract wanted information 1 xml , succeded how can extract folder , each xml file using perl script. tried 1 xml file: use warnings; use strict; use xml::libxml::reader; $file; open( $file, 'formal.xml'); $reader = xml::libxml::reader->new( io => $file ) or die ("unable open file"); %hash; while ($reader->nextelement( 'nuber' ) ) { $number = $reader->readinnerxml(); $reader->nextelement( 'data' ); $information = $reader->readouterxml(); $nums{$number}= $information; print( " number:$number\n" ); print( " information:$information\n" ); } print $num=keys%hash; close($file); above code working , extracted want. need script search files in folder , extract same information files. use file::find . your code cannot working is. here untested script might want. ...

android - what is the purpose of registering the hashkey on facebokk app page -

sorry if stupid question want know purpose of registering hashkey on facebokk app page. use in application(if have use please let me know where). the question how app authenticated using hashkey?? , how sign app using hash key??? help!!! facebook requires additional layer of security mobile apps in form of application signature. need put android application signature facebook application settings. can generate signature running keytool comes android sdk. following shows how export key app using debug defaults specified android sdk , eclipse. also check hash key single sign-on also if put key hash not generated me you invalid key error if use wrong key hash . check login failed invalid key

asp.net mvc - Generate UML diagram from C# class -

Image
i have nhibernate-generated classes functioning bo mvc project persisting sql db. i'd render existing code uml diagrams can start playing around code gen utilities. similar what's asked here sql/nhibernate - suggests tools generating uml class diagram c# source or dll , that's close - except last answer there of 2 years old. surely body of knowledge has expanded since. no tool required: right-click project name, select view class diagram , automatically generate list of classes. after that, i'd delete classes don't care about, , expand ones care about. i'm assuming you're using visual studio 2010 .

javascript - Passing data from php to Jquery -

i have javascript/jquery code in file , include page. without having apache process js files php best way pass data php js script? right have hidden div on page echo out value using jquery text content , split variables. way of doing it? or there better way? update as mentioned prior, js code in .js file include webpage. way use php in scenario tell apache treat .js files php recongize php code inside .js file. dont want this. html <div id="pagedata" style="display:none;">data1<>data2</div> js var pagedata = $('#pagedata').text(); var break_data = pagedata.split('<>'); best practice matt mentions in comment above: use json. if you're going use jquery, can have php script call using either $.get() or $.getjson() . can find manual php json here: http://php.net/manual/en/book.json.php , , api reference jquery method $.getjson() here: http://api.jquery.com/jquery.getjson/ hth.

internet explorer 9 - IE 9 - BHO, not loaded after enabled by the user -

i have c++ bho works in ie 8. in ie 9 (first launch), disable until users clicks on 'enable' button. however, after 'enable' click, bho loaded after ie restart. debugged issue putting logs in constructor of bho. not called after user clicks on 'enable'. have experienced such issue? thanks i believe after user enables it, it's enabled in new windows/tabs only, not existing ones.

php - What is the name of the :: operator? -

i new php, , practicing online tutorials. encounter sign :: while going through books, online tutorial or blogs. if check php demo applications see operator. tried put sign in google, got unexpected results. tried search in other forums well, didn't got right answer. call bubble colon, technical name? :: scope resolution operator (you may find references paamayim nekudotayim , hebrew "double colon" ). used call static functions of class, in class myclass { public static function hi() { echo "hello, world"; } } myclass::hi(); for more details on classes , objects, refer official documentation .

javascript - Drawing a graph using Canvas -

i making graphs using html canvas want draw line multiple colors, @ every point should change new random color, ctx.moveto(ximg+46,yimg+200); for(i=0;i<num;i++){ if(js_array[i]=="900"){ctx.strokestyle = "grey";} else{ctx.lineto(ximg+50+i*mul,(yimg+200)-(js_array[i]*(height/max)));} } am gonna change grey random problem colors previous path(line) grey,i want each piece of line in different color,is possible in javascript? in opengl there command used write take last given color or not,is there similar 1 in javascript? with context, strokestyle property can take rgba, rgb, , hexadecimal colors name of color. i suggest along lines of: ctx.strokestyle = "rgba(" + (math.random()*255) + "," + (math.random()*255) + "," + (math.random()*255) + ", 1)"; or perhaps new function returns color, or assigns it. if wasn't looking for, supply values undeclared variables can te...

Xcode and / or OSX, how can I setup SHIFT + INSERT as shortcut key for paste? -

i'm use windows development , use shift + insert day job, day, it's old short cut available since windows versions. can setup short cut using in xcode , / or osx ? i had in system preference keyboard wouldn't accept it. any ideas ? open preferences in xcode , select "key bindings".

arrays - Simple General Questions about C++ -

ive moved autoit , learning c++ , problems keep coming up. the first 1 storing character input. problem have no idea how many characters in line of file (if reading file) or how many letters user going type (in console application). what best way approach problem?? have heard string class, want avoid becuase dont know how works , leads vunerabilities etc. secondly... in c can load shellcode memory, create function pointer, , execute code. there mechanism in c++??? thirdly... how interpreter iterate through char arrays string output??? (char array[3];) compiler keep track of size of array, or keep reading memory until hits \0 thing??? lastly... if char * pointers data in memory, why does: char * title = "program title"; this work??? string literal stored in memory?? how referenced??? thankyou much. appreciate help. -hyperzap investing time in learning std::string worth effort, takes care of lot of hassle you. if don't want take advanta...

lxml - Error With AlchemyAPI Python SDK -

i trying use alchemyapi python 0.7 sdk. when ever run method within e.g. urlgettext(url); i error: nodes = etree.fromstring(result).xpath(xpathquery) file "lxml.etree.pyx", line 2743, in lxml.etree.fromstring (src/lxml/lxml.etree.c:52665) file "parser.pxi", line 1573, in lxml.etree._parsememorydocument (src/lxml/lxml.etree.c:79932) file "parser.pxi", line 1452, in lxml.etree._parsedoc (src/lxml/lxml.etree.c:78774) file "parser.pxi", line 960, in lxml.etree._baseparser._parsedoc (src/lxml/lxml.etree.c:75389) file "parser.pxi", line 564, in lxml.etree._parsercontext._handleparseresultdoc (src/lxml/lxml.etree.c:71739) file "parser.pxi", line 645, in lxml.etree._handleparseresult (src/lxml/lxml.etree.c:72614) file "parser.pxi", line 585, in lxml.etree._raiseparseerror (src/lxml/lxml.etree.c:71955) lxml.etree.xmlsyntaxerror: attvalue: " or ' expected, line 19, column 11 this come area ...

Does ScraperWiki rate limit sites it is scraping? -

does scraperwiki somehow automatically rate limit scraping, or should add sleep(1 * random.random()) loop? there no automatic rate limiting. can add sleep command written in language add rate limiting. very few servers check rate limiting, , servers containing public data don't. it is, however, practice make sure don't overrun remote server. default, scrapers run in 1 thread, there built in limit load can produce.

c - Empty element causing libxml segfault -

i have xml file goes this: <root> <children> <child /> </children> <otherchildren> </otherchildren> <morechildren> <child /> </morechildren> </root> and here's c parses it: doc = xmldocptr; doc = xmlparsefile(file); cur = xmlnodeptr; cur = xmldocgetrootelement(doc); cur = cur->xmlchildrennode; while (cur != null){ // loop through children of root // thing cur = cur->next; } when xmlnodeptr comes otherchildren, because there no contents, next node (the text node) null this gives me problem, messes loop, , causes segfault somehow. how fix other obvious if statement? there more xml below otherchildren , can't if loop exits. using .xml, get: ./sotrials ../untitled1.xml ../untitled1.xml:10: parser error : expected '>' </root> ^ error: not parse file ../untitled1.xml speicherzugriffsfehler (speicherzugriffsfehler = memory fault) changing ....

iphone - Dynamic UITextView within Dynamic UITableViewCell height? -

i not finding solution issue. have uitextview subclassed in uitableviewcell. right have textview dynamically resizing, cell not. because heightforrowatindexpath being called on load. how can have called without calling cellforrowwithindexpath (i.e. reloaddata)... any great! thanks! its pretty simple, use inside uitableviewcell [tableview beginupdates]; self.frame = cgrectmake(0,0,width,new height); [tableview endupdates]; can't remember, superview of uitableviewcell should uitableview.

sql - Search in huge table -

i got table on 1 millions rows. table represents user information, e.g username, email, gender, marrial status etc. i'm going write search on rows in table, when conditions applied. in simples case, when search perfomed on username, takes on 4-7 seconds find result. select u u.name ilike " ... " yes, got indexes on fileds. checked applied using explain analyse command. how search can boost ? i heart lucene, can ? i'm wondering how facebook search working, got billions users , search works faster. there great difference between these 3 queries: a) select * u u.name "george%" b) select * u u.name "%george" c) select * u u.name "%george%" a) first use index on u.name (if there one) , fast. b) second not able use index on u.name there ways circumvent rather easily. for example, add field namereversed in table reverse(name) stored. index on field, query rewritten (and fast first one): b2) select * u...