Posts

Showing posts from June, 2012

tabbar - android setting default tab in tab-activity -

android tabactivity launches fragmentactivity associated first tab added in sequence before setting tabhost.setcurretntab(4); @override public void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.tab_main); try { datasource.objcontext = this.getapplicationcontext(); datasource.objtabbaractivity = this; datasource.objsharedpreferences = this.getsharedpreferences("com.example", context.mode_private); if(networkstat) { new locationupdates(this); this.settabs(); } else { log.d("in tabbaractivity", "network failure"); toast.maketext(this.getapplicationcontext(), "network failure", toast.length_short).show(); } } catch(exception ex) { } } private void settabs() { addtab("clubs", r.drawable.tab_clubs, fragmentstackclubsactivity

c# - Pass an integer to a timer in WinForms application -

i have winforms built in timer: system.windows.forms.timer timerloop; when timer started, want (if possible) pass timer integer value. timerloop.start(); till now, created general variable timer can read , update variable before starting timer. you can 2 ways (maybe more): extend base timer creating new 1 inherit it: private class timerexnteded : timer { public int value { get; set; } public timerexnteded(int value) { value = value; } } and use value in tick event. use tag property of timer timer t = new timer(); t.tag = 5; t.start(); //event private void t_tick(object sender, eventargs e) { var timer = sender timer; var value = (timer.tag int?) ?? 0; value++; timer.tag = value; } second approach uses boxing/unboxing of value.

What is the inverse of date.toordinal() in python? -

in python, date object can converted in proleptic gregorian ordinal way: d=datetime.date(year=2010, month=3, day=1) d.toordinal() but reverse operation? the opposite date.fromordinal classmethod date.fromordinal(ordinal)     return date corresponding proleptic gregorian ordinal, january 1 of year 1 has ordinal 1. valueerror raised unless 1 <= ordinal <= date.max.toordinal(). date d, date.fromordinal(d.toordinal()) == d.

.htaccess - htaccess lang prefix and query string -

i have htaccess add lang prefix on specific folder on files htaccess rules rewriterule ^fr/folder/(.*)$ /folder/$1?lang=1 [l] rewriterule ^en/folder/(.*)$ /folder/$1?lang=2 [l] with above rules can redirect /en/folder/myscript.php /folder/myscript.php?lang=1 and working fine. now trying find way add query string if for example /en/folder/myscript.php?id=100 /folder/myscript.php?lang=1&id=100 i have try use code below no luck rewritecond %{query_string} !^lang=1 rewriterule ^el/folder/(.*)$ /folder/$1?lang=1&%1 [l] any appreciated. have @ qsa flag . if use rewriterule ^fr/folder/(.*)$ /folder/$1?lang=1 [l, qsa] rewriterule ^en/folder/(.*)$ /folder/$1?lang=2 [l, qsa] the query string shouldn't overwritten.

.net - Dividing entity framework connection string into 2 parts -

i'm trying set continuous integration legacy project. in web.config, there's entity framework connection string: <add name="stuffcontext" connectionstring=" metadata=res://*/stuff.csdl|res://*/stuff.ssdl|res://*/stuff.msl; provider=system.data.sqlclient; provider connection string=&quot; data source=mydbserver; initial catalog=mydb; persist security info=true; user id=loki2302; password=qwerty; multipleactiveresultsets=true; app=entityframework&quot;" providername="system.data.entityclient" /> is there way somehow extract provider connection string , have referenced name in stuffcontext connection string? trying achieve this: ... <add name="stuffcontext" connectionstring="metadata=...;name=stuffdb" /> <add name="stuffdb" connectionstring=" data source=mydbserver;

shell - Git integration -

so trying experiment console applications , managed connect tfs, checkout or checkin files. wanted able collect information files, , store them in notepad (in future store in database). anyway, wanted work using shell scripts , instead of tfs, wanted use git (gitorious now) pull , push contents. however, seems real difficult. public/private keys problem , i'm unsure how work out. suggested me access content ssh, have never tried out. can point me way started , should @ or do? ssh way it, need generate public , private keys. https://help.github.com/articles/generating-ssh-keys explain how generate keys. after that's done, need clone repository ssh url. sort of this: git@github.com:username/repo.git. can run git clone git@github.com:username/repo.git and git clone repository directory of same name. if stuck, github helpful , not specific github in cases.

.net - Print XpsDocument scaled to fit page -

we using telerik's wpf charting controls in our application. charting controls have built-in support exporting graphics xps file. want utilize wpf's support printing xps documents print chart. part, works great, i'm having trouble scaling chart fit 1 page. chart graphic cut off on right , bottom. chart coming out large page. ideas? here code i'm using: const string packageuristring = "pack://inmemorychart.xps"; using (var memorystream = new memorystream()) { //utilize telerik chartview method export xps... _chart.exporttoxps(memorystream); using (var package = package.open(memorystream)) { var packageuri = new uri(packageuristring); packagestore.addpackage(packageuri, package); var xpsdocument = new xpsdocument(package, compressionoption.maximum, packageuristring); var printdialog = new printdialog(); var result = printdialog.showdialog(); if (!result.getvalueordefault())

extjs4.2 - EXTJS 4.2.0.663 : Buffered store with editor grid -

buffered store editor grid. we have been using version 4.1.1 , migrating 4.2.0.663. have editor grids buffered stores contain large volume of data. editor grids similar row-editing example(except uses buffered store). add functionality grid has stopped after migration , raises error ext.error: insert operation not supported buffered store. var rowediting = ext.create('ext.grid.plugin.rowediting', { clickstomoveeditor: 1, autocancel: false }); // create grid , specify field want // use editor @ each column. var grid = ext.create('ext.grid.panel', { store: store, columns: [{ header: 'name', dataindex: 'name', flex: 1, editor: { // defaults textfield if no xtype supplied allowblank: false } }, { header: 'email', dataindex: 'email', width: 160, editor: { allowblank: false, vtype:

jquery drag item to canvas and drag it back to list -

i'm using jquery drag <li> item canvas , work fine. when try drag item list, not work. can me please? here source : $("#group1").sortable({ revert: true }); $('li[id^="item"]').draggable({ // connecttosortable: "#group1", helper: function(){ $copy = $(this).clone(); return $copy; }, start: function(event, ui) { dropped = false; $(this).addclass("hide"); }, stop: function(event, ui) { if (dropped==true) { $(this).remove(); } else { dropped=false $(this).removeclass("hide"); } $('#'+$(this).attr('id')).draggable({ connecttosortable: "#group1", //helper: "clone", revert: "invalid" }); } }); var dropped = false; $( "#canvas" ).droppable({ drop: functio

java - Adding a image to the JPanel -

i'm trying add hangman image jpanel . have labeled image 1-10 , increment value each time user gets wrong answer (this working). of yet haven't been able image work. how insert image? if(!found){ numerror++; string usererror = integer.tostring(numerror); string jpg = usererror.concat(".jpg"); try{ bufferedimage myimg = imageio.read(new file(jpg)); jlabel hangman = new jlabel(new imageicon(myimg)); hangman.setsize(200,100); hangman.setlocation(300, 20); add(hangman); }catch(ioexception ex){ ex.printstacktrace(); } } javax.imageio.iioexception: can't read input file! @ javax.imageio.imageio.read(imageio.java:1301) @ hangmanpanel$1.actionperformed(hangmanpanel.java:73) @ javax.swing.abstractbutton.fireactionperformed(abstractbutton.java:2018) @ javax.swing.abstractbutton$handler.actionperformed(abstractbutton.java:2341) @ javax.swing.defaultbuttonmodel.fireactionperformed(defaultbuttonmodel.java:402) @ javax.swing.defaultbu

Integrate Google Wallet with Google Apps Script? -

i have been developing event registration form google apps script. form required add data entries google spreadsheet , process orders google wallet. have tried using htmlservices, did not work. there way integrate google wallet dynamically in google apps script service? if not, need use app engine? , language best? you'll need server component handle callbacks google after wallet transactions. server handler must able process xml or json depending on api used. if you're using google checkout api, have at: https://developers.google.com/checkout/developer/google_checkout_xml_api_notification_api https://developers.google.com/checkout/samplecode if you're using wallet digital goods api, have at: https://developers.google.com/commerce/wallet/digital/docs/postback

c# - Fixed header sort columns -

i have gridview need have headers fixed , each column sortable. using asp.net , c#. i found code can't columns sort @ all. have stepped thru code , calling sort functions in aspx file. when clicked sort buttons on column headings, display in grid not change (ascending/descending) sort order. thinking has binding of gridview data. here original code. my version below: default.aspx is: header copied original code. <head runat="server"> <title>create xml files</title> <script src="/scripts/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="/scripts/jquery.tablesorter.min.js" type="text/javascript"></script> <script type = "text/javascript"> $(document).ready(function() { $("#<%=gridview1.clientid%>").tablesorter(); setdefaultsortorder(); }); function sort(cell, sortorder) { var sorting = [[cell.cell

html5 - Inputfield over a Video -

i have input field want put on video. i thought easy sadly isn't. the problem want videos drag & dropable later , cannot use position absolute because of that. the inputfield @ right of video. i've used div able layer videos & inputs, works fine position absolute need tells input box (the div) show -33px current position on x axis. i can't find this. <style type="text/css"> img (z-index:1;) input {width:33px; height:13px; position:absolute:left:50px;} #div1 { position: absolute; left: 100px; top: 100px; z-index: 1; } #div2 { position: relative; left: -33px; z-index: 2; } </style>

vba that search for a value if it matches find closest date -

i wrote code workbook have 2 worksheet´s, in proximopedido (sheet) in column "a" there range of values (integer number) , in colunm "b" there date associated, , in chekinglist (sheet) there colunm "a" values (wich must match "a" of proximopedido) , colunm "e" dates. if value of cell of checkinglist matches value of "a" of proximopedido search in "e" of chekinglist next ( or closest higher) date of "b" proximopedido. sheet: checkinglist a-----------------------------------------e 1----------------------------------2009-10-30 12:00 3 ---------------------------------2009-10-29 13:00 2---------------------------------2009-10-29 12:20 50--------------------------------2009-10-19 10:20 24--------------------------------2009-10-28 10:20 3----------------------------------2009-10-28 10:20 <-------- ( match!) sheet: proximo pedido a----------------------------------------b 4-----

sml - Error implementing the unzip function -

i want implement function gets 1 list of tuples (in size of 2) , yielding tuple of 2 separate lists. i tried code: fun unzip [] = ([],[]) | unzip [(a,b)] = ([a],[b]) | unzip (a,b)::ps = (a::(#1(unzip(ps))),(b::(#2(unzip(ps)))); but doesn't compile, sml gives me in prompt = need on additional ) @ end close tubple. need ( (a,b)::ps ) . somehow sml thought pattern unzip (a, b) , treating :: different describing pattern. still not know when or why sml needs of parentheses needs, adding more in right place seems solve lot of errors. your version, syntax fixes. (note, fixed syntax, did not make other improvements code possible.) fun unzip [] = ([],[]) | unzip [(a,b)] = ([a],[b]) | unzip ((a,b)::ps) = (a::(#1(unzip(ps))),(b::(#2(unzip(ps)))))

android - Java - Date Pattern matching -

i new java. please me. have problem json response below: {"getresult":"{ \"isdate\": [ { \"code\": \"200\" }, { \"message\": \"fetched successfully\" }, { \"id\": \"722c8190c\", \"name\": \"recruitment\", \"path\": \"url\", \"date\": \"14 may, 2013\" }, ]}"} its malformed json object. so, using matching pattern data of name , path , date , getting name , path below: matcher matchername = pattern.compile("\\\\\"name\\\\\":\\s\\\\\"[^,}\\]]+\\\\\"").matcher(name); matcher matcherpath = pattern.compile("\\\\\"path\\\\\":\\s\\\\\"^[^,}\\]]+\\\\\"").matcher(path); so, above lines, able path , name . so, please how date well. format of date 14 may, 2013 . please me. matcher same in question: matcher mat

Using OR in Python for a yes/no? -

i'm wanting have "y/n" in python, i've done, want user able input "y" or "y" , accepts both. here's short if statement if yn == "y": break i'm wanting make this if yn == "y" || "y": break but "||" or operator in java. don't know or operator in python or if use this. help? you're looking for if yn in ("y", "y"): or better: if yn.lower() == 'y':

php - I have an error in your SQL syntax -

the following message displayed after search performed php code below. tried check mistake didn't find of useful. how do? what's problem? thanks you have error in sql syntax; check manual corresponds mysql server version right syntax use near 'field4 '%aaa%' order filed1, field2, field3, field4' @ line 1 the php code is: <?php //get variables config.php connect mysql server require 'config.php'; // connect mysql database server. mysql_connect ($dbhost, $dbusername, $dbuserpass); //select database mysql_select_db($dbname) or die('cannot select database'); //search variable = data in search box or url if(isset($_get['search'])) { $search = $_get['search']; } //trim whitespace variable $search = trim($search); $search = preg_replace('/\s+/', ' ', $search); //seperate multiple keywords array space delimited $keywords = explode(" ", $search); //clean empty arrays don't every r

c# - How can I prevent auto-select in ComboBox on drop-down except for exact matches? -

i have combobox part of detail display related data grid containing rows database. no binding combobox exists, doing manually. combobox allows manual entry, if text field, while still providing drop-down of choices. my issue if have manually entered text in field, , drop-down clicked, combobox apparently wants seek out match. also, appears search simple, kg matches kg/day . must avoid , force exact match. but further, think need able govern entire process myself, because further complicate matter, drop-down item read kg/day - kilograms/day . database field data fetched, however, storing portion prior hyphen, kg/day . so, need intercept drop-down action in way allows me 2 things: 1) perform own search find whether or not have ad-hoc text, or "real" match. in selected drop-down; in other words, have kg/day , not kg . 2) eliminate auto-search behavior combobox wants do. i have tried getting in front of these things using method handlers in form, such

php - Same layout different content html -

quite new creating websites not sure on everything, i've been looking while on how minimize amount of html pages in 1 website. taking space. every page has same layout different content, know there way of changing content without making many html pages i've been looking , cant seem find kind of code this. know there has got loads of answers question must wording wrong when searching cant seem find anything. want know if there way can make 1 page layout , 1 page content , when links pressed right content displayed? sorry if stupid question, getting irritating not finding need. to create layouts, can use include function add redudant parts of page(header, footer, menu or sidebar). for more informations, here , here

android - Google Play Services for Cloud based apps? -

i want avoid using webviews oauth tokens google. (asking user share contacts, profile info etc). used google play services apis that. since app cloud based (logic happens in cloud), have save these tokens in cloud. have let user sign in multiple devices (without asking him google permissions every time logs in new device) i tried implement technique mentioned in google blog . i tried hands on method mentioned in blog. did not work wished. checked +tim bray's google code project (favcolor-accountchooser) , had following code. try { // if works, token guaranteed usable token = googleauthutil.gettoken(favcolormain.this, memail, scope); } catch (userrecoverableauthexception userauthex) { startactivityforresult(userauthex.getintent(), authutil_request_code); token = null; } it conflicts concept mentioned in blog. 'token string' obtained not sent server , in exception block, further permissio

ruby on rails 3 - how to test for existing htm5shiv in source code using rspec? -

how can test rails3 application existing htm5shiv code using rspec? <!--[if lt ie 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> this demoapp: rails new renderdemo cd renderdemo/ rails g controller staticpages home --no-test-framework in config/routes.rb root to: "static_pages#home" removed public/index.html rm -f public/index.html created partial html5shiv app/views/layouts/_html5shiv.html.erb <!--[if lt ie 9]> <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> i rendered in app/views/layouts/application.html.erb <head> . . . <%= render 'layouts/html5shiv' %> </head> now when visit demoapp's source code see partial has been added. how can verify rspec, rendering successful? or may check source code html5shiv existing on each page?

javascript - get latitude and longitude using ajax jasonp -

i try latitude , longitude using ajax jasonp. this:- <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js"></script> <script> $(document).ready(function(){ var region = "rajkot,jamnagar"; var cn ="in"; var lat; var lng; var array = region.split(','); var lat = new array(), lng = new array(); var totallength = array.length; var count = 0; for(var item in array) { $.ajax({ url: "http://services.gisgraphy.com//geocoding/geocode?address="+array[item]+"&country="+cn+"&format=json", async: false, datatype:'jsonp', success: function(data){ count++; lat.push(data.result[0].lat);

How JavaScript core methods are implemented? -

is there reference or online site in can see how javascript core library methods push(), join(), split() etc implemented other language ( glib c) it varies implementation (within reason, implementation has fundamentally follow the spec ). can see details of how v8 (chrome's engine) , spidermonkey (mozilla's) work, they're both open source: v8 source spidermonkey source for example, how v8 implements array#push (the line number in link rot) : function arraypush() { if (is_null_or_undefined(this) && !is_undetectable(this)) { throw maketypeerror("called_on_null_or_undefined", ["array.prototype.push"]); } var n = to_uint32(this.length); var m = %_argumentslength(); (var = 0; < m; i++) { this[i+n] = %_arguments(i); } this.length = n + m; return this.length; }

windows ce - How to ignore 1st touch event when screensaver is enabled -

on our win ce 6.0 device (x86 platform), screensaving enabled using powermanager useridle timeout: [hkey_local_machine\system\currentcontrolset\control\power\timeouts] "acuseridle"=dword:3c my assumption is, graphics driver (intel iegd) listens event , turns on/off backlight accordingly. the problem is, when screensaving enabled (backlight off), 1st touch event utilized windows system. in other words, user touches touch screen while backlight off, , accidentally/blindly triggers action on running application (eg press buttons...). we don't have sources touch driver (tsharc usb), changes can't made here. are there other ways discard 1st touch event while backlight off? place at? thanks in advance / suggestions. regards, timm

Output escaped xml in an attribute in an xslt -

input xml: <parent> <child attr="thing">stuff</child> </parent> xslt: <xsl:stylesheet version="2.0" xmlns:xsl="http://www.w3.org/1999/xsl/transform"> <xsl:template match="child"> <newchild chars="{..}" /> </xsl:template> </xsl:stylesheet> desired otuput: <newchild chars="&lt;child attr=&quot;thing&quot;&gt;stuff&lt;/child&gt;" /> note value of 'chars' attribute escaped version of 'child' tag. problem: how matched element in attribute? though .. it, seems not when talking attributes, random xml entities followed value of child tag e.g. <newchild chars="&#xa; stuff&#xa;"/> . i'm expecting there might need escaping stuff make valid. any suggestions appreciated. (and before asks why i'd want this, i'm constrained api of application i'm connecting t

windows phone 8 emulator - wcf rest service not working in wp8 -

while trying consume rest service in windows phone 8 app , getting "the remote server returned error: notfound."exception. all trying creating simple wcf rest service , trying consume in wp8 application. have tried possible solutions mentioned in several articles digging problem couldn't escape exception. have tried article http://msdn.microsoft.com/en-us/library/windowsphone/develop/jj684580(v=vs.105).aspx but no enough lucky. have disabled firewall. one important thing mention here connected corporate network, affect in way? yes does. windows phone 8 emulator has separate ip of own, different ip of host computer. needs internet connection shared internet of host system. if host system in corporate network, means, probably, having restricted internet policy. running rest service on emulator, need have unrestricted internet connection in emulator.

Python ADO + ODBC function -

i writing small module transfer m$-access sqlite (database needs portable), i'm struggling in interpreting error message follows code (and of course work). import pyodbc import win32com.client def ado(db, sqlstring='select * table', user='admin', password=''): conn = win32com.client.dispatch(r'adodb.connection') dsn = ('provider = microsoft.jet.oledb.4.0;data source = ' + db + ';') conn.open(dsn) rs = win32com.client.dispatch(r'adodb.recordset') rs.open(strsql, conn, 1, 3) data = rs.getrows() conn.close() return data def odbc(db, sqlstring='select * table', user= 'admin', password=''): """create function connecting access databases.""" odbc_conn_str = 'driver={microsoft access driver (*.mdb)};dbq=%s;uid=%s;pwd=%s' % (db, user, password) conn = pyodbc.connect(odbc_conn_str) cur = conn.cursor() cur.execute(s

c# - Adding 0.5 to counter in result of a draw? -

i'm making game , need change code below in order add 0.5 running "playerscore++;" , "computerscore++;" respectively, when result happens come out in draw. instead of rolling again, demonstrated below, continue play. can't figure out! be: playerscore += 0.5; computerscore += 0.5; instead of message box popping up? i hope makes sense, sorry! thanks! private void button5_click_1(object sender, eventargs e) { playerdice = new dice(); int playerdiceno = playerdice.faceofdie; messagebox.show("your roll: " + playerdiceno); compdice = new dice(); int compdiceno = compdice.faceofdie; messagebox.show("computers roll: " + compdiceno); if (compdiceno == playerdiceno) { messagebox.show("draw - click roll or chance"); button5.enabled = true; button1.enabled = true; }

sql - Loop Mysql to insert data in table using PhpMyadmin -

hi im trying insert data in database asign id each number table numbers id | number 1 | 2560 2 | 2561 and go on 100 numbers. found pl/sql begin v_loopcounter in 2560..2660 loop insert numbers (number) values (v_loopcounter); end loop; end; also tried like begin v_loopcounter in 2560.2660 loop; insert numbers (number); values (v_loopcounter); end loop; end; how can in sql using phpmyadmin, thats can use. thanks! i have tried run sql in phpmyadmin, got syntax error there seems error in sql query. mysql server error output below, if there any, may in diagnosing problem i have tried now select * table_name begin v_loopcounter in 2560..2660 loop insert numbers (number) values (v_loopcounter); end loop; end; try : delimiter // begin v_loopcounter in 2560..2660 loop insert numbers (number) values (v_loopcounter); end loop; end //

ruby on rails - Nil object when didn't expect it -

legacy ruby on rails 2.3 project here. getting following error: you have nil object when didn't expect it! might have expected instance of activerecord::base. error occurred while evaluating nil.[] extracted source (around line #122): 119: <%= link_to 'printable', { :action => 'print', :id => @incident.id }, { :target => '_blank', :class => "button" } %> 120: <% if isviewable?(@incident) %> 121: 122: <%= link_to "pictures (#{@incident.pictures.count})", incident_pictures_path(@incident), :class => "button" %> 123: <%= link_to "suspects (#{@incident.suspects.count})", incident_suspects_path(@incident), :class => "button" %> 124: <%= link_to "notes (#{@incident.notes.count})", incident_notes_path(@incident), :class => "button"%> 125: <%= link_to "cars (#{@incident.cars.count})", incident_cars_path(@incident),

ruby on rails - Two pages for the same resource - ActiveAdmin -

currently have user model, registered in user.rb new resource activeadmin. generated page displays users scopes ( all / journalists / startup_employees ). want create page same resource, , same scopes, there should records waiting field set true (and previous page should displays :waiting => false ). how that? know filters, need 2 separate pages, 2 links in menu. // solution it easier advices (thanks guys!): activeadmin.register user, :as => 'waitlist user' menu :label => "waitlist" controller def scoped_collection user.where(:waitlist => true) end end # code scope :all scope :journalists scope :startup_employees end activeadmin.register user controller def scoped_collection user.where(:waitlist => false) end end # code scope :all scope :journalists scope :startup_employees end sti ( single table inheritance ) can used create multiple "sub-resources" of same

networking - Cisco iOS - Two SSID's , 1 blocking specific URL -

the routers here broadcast 2 ssid. 1 guest, other company users. our users attempting access specific url unable through company wifi. able access url through guest network , when directly connect via ethernet. led me believe acl issue on company wifi blocking it. not use web gui our routers , new cisco ios how permit specific url? access-list belong to? here info specific ssid / interface: interface dot11radio1.1 encapsulation dot1q 1 native no ip route-cache bridge-group 1 bridge-group 1 subscriber-loop-control bridge-group 1 input-address-list 700 bridge-group 1 block-unknown-source no bridge-group 1 source-learning no bridge-group 1 unicast-flooding bridge-group 1 spanning-disabled as can see imports address-list 700 mac addresses each user , blocks - unknown-source. have edit bridge-group or have create access-list specific url's , import bridge-group well? or on complicating things? the control on url access not happen there. should configuration blo

javascript - json object directly from my view HTML -

i'm using phonegap in order make application, i'm using codeigniter api. data, i'm using simple $.post jquery rest url in codeigniter. $.post(dir+trad+"/format/json", function(data){ traducciones = jquery.parsejson(data); }, json); based upon this, got 2 questions, because don't know if should in different post methods. the first question is, how data in json format? second question is, there way call json object directly view (html) ? or need using jquery or javascript? how data in json format? searching codeigniter+json gives me output class has example: $this->output ->set_content_type('application/json') ->set_output(json_encode(array('foo' => 'bar'))); is there way call json object directly view (html)? generally speaking, if generating json , want use in html, skip generating json , use data directly. generating json view becomes useful if want make raw data available

tree - BTree Complexity based on M and L and based on order of insertion and deletion -

what big oh btree depends on m = number of keys , l = number of leaves? how btree deal deleting in order , in reverse order? i doing analysis on how m , l , way things inserted , deleted in btree determines runtime. b-trees remain balanced @ times, deleting in reverse order same deleting in-order, , start @ same level (the deepest level). depending on b-tree implementation, operations occur in o(log(m) * log(l)) time or o(m * log(l)) time. latter known small m values, because binary searching inside array of 5 or elements not worth it.

asp.net web api - Webapi put parameter from body requires xml to contain xmlns -

i'm hoping easy question. haven't made public api using webapi or restful service before. have noticed when creating put or post method use complex object parameter xml sent in body required contain namespace info. example. public httpresponsemessage put(guid vendortoken, [frombody] actionmessage message) { if (message == null) return request.createerrorresponse(httpstatuscode.expectationfailed, "actionmessage must provided in request body."); return request.createresponse(httpstatuscode.ok); } for message come not null request has this. <actionmessage xmlns:i="http://www.w3.org/2001/xmlschema-instance" xmlns="http://schemas.datacontract.org/2004/07/integrationmodels"> <message i:type="newagreement"> <agreementguid>3133b145-0571-477e-a87d-32f165187783</agreementguid> <paymentmethod&

Qt, C++ - Reading control characters from a file -

this first time asking question please have patience me. i'm trying read content of text file meant sent printer. in middle of characters define how label printed there control characters, stx, soh, cr, lf. in example, read contents of file , pass them data structure(array) in memory, append data , later send printer directly, erasing data in structure. the function following: void clientthread::readfile2structure(bool goodorbad) { int = 0; int j = 0; // clean structure // here clean structure // according name comes arguments. if(goodorbad == 1) { labelfile.setfilename(labelpathgood); //qdebug() << "fez o set filepath" << labelpathgood; } else if(goodorbad == 0) { labelfile.setfilename(labelpathbad); //qdebug() << "fez o set filepath" << labelpathbad; } if (!labelfile.open(qiodevice::readonly)) { qdebug() << "unable open

ios - MapKit with UISearchBar -

so if understand correctly can no longer use google apis ios (ex. google places). how can use ios mapkit uisearchbar search locations? map on iphone has searchbar if i, example, type coffeshops pins in area of local coffesshops. if apple not using google apis using find data? how can developers tap search data? thanks, mapkit contains search request replace outgoing google apis. https://developer.apple.com/library/ios/#documentation/mapkit/reference/mklocalsearchrequest_class/reference/reference.html#//apple_ref/doc/uid/tp40012892

string - Google Apps Script - remove spaces using .replace method does not work for me -

i using google apps script create apps. encounter issue when try remove whitespaces spreadsheet value. have referred alot of posts & comments in stackoverflow , other forum too. talking using .replace method. however, .replace method not work me. var itemarray = <<getvalue google spreadsheet>> var tvalue = itemarray[0][2].tostring(); (var row = 0; row<itemarray.length; row++) { var trimmedstra = itemarray[row][2].tostring().replace(' ', ''); var trimmedstrb = tvalue.replace(' ', ''); if (trimmedstra == trimmedstrb) { <<other code>> } //end if } //end of loop a simple regexp object should used in replace() method. \s simple solution find whitespace. 'g' provides global match instances of whitespace. t.value.replace(/\s/g, "") this pretty close without knowing data looks like. .replace() documentation here.

scala - Call to == does not opt to equals -

i have following class: abstract class irdmessage extends ordered[irdmessage] { val messagetype: messagetype.type val timestamp: datetime val content: anyref def compare(that: irdmessage): int = { val res = timestamp compareto that.timestamp res } override def equals(obj: any): boolean = obj match{ case message: irdmessage => compareto(message) == 0 case _ => false } } i have couple of concrete implementations well. however, when try a == b of subtype of irdmessage equals method not called , compares references (default equals implementation). ideas might causing this? the subclasses simple case classes btw. this work given following simplified example: object messagetest { def main(args: array[string]) { val m1 = messageimpl("foo") val m2 = messageimpl("bar") m1 == m2 } } abstract class irdmessage extends ordered[irdmessage] { val content: anyref override def equals(obj: any): boolea

mvvm - Why is there no suggested "model" folder in a Durandal app? -

i'm working on durandal spa, , i've setup views , viewmodels. however, thought mvvm architecture involve "model" segment ( model , view, viewmodel--right?). however, durandal getting started page says under "organization" section: if expand app folder, find source entire spa sample. here's high level organization find: app durandal/ viewmodels/ views/ main.js absent structure "models" folder. supposed put models in durandal app? i've looked @ other sample apps, , can't find "models" folder (or anywhere models residing) of sample apps i've reviewed. the "models" folder (which isn't there) seems me critical part of durandal app. however, it's not there--and therefore, questioning understanding of how durandal (and mvvm apps) designed. there surely not understanding... can fill me in on intended structure of durandal app, , put model objects? the

java - Use boolean to search duplicate -

i want use boolean search duplicate when need print out list of names. need write program read names in text file , print out console. compiler doesn't work in case. don't know why? can guys me? import java.io.*; import java.util.*; public class namesorter { public static void main(string[] args) throws exception { bufferedreader cin, fin; cin = new bufferedreader(new inputstreamreader(system.in)); //description system.out.println("programmer: minh nguyen"); system.out.println("description: program sort names stored in file."); system.out.println(); //get input string filename; system.out.print("enter file's name: "); filename = cin.readline(); fin = new bufferedreader(new filereader(filename)); int nnames = 0; string[] name = new string[8]; //initialize array elements for(int i=0; i<name.length;i++) { name[i]=" "; } // read text file

c# - How to set up UVs for Texture borders -

Image
i'm generating plane able scale without edges of texture being affected pixel wise. plane needs able keep border proportion able stretch size. mesh has 8 vertices , 10 triangles make border. anyway here get. ignore numbers on mesh geometry. is possible edit uvs desired result? here's code: mesh mesh = new mesh(); var renderer = mesh.addrenderer(); //create verticies mesh.vertices = new vector3[] { //vertices in order convienience manager.gui.screentoworldpoint(new vector3(0f,0f,0f)), //0 manager.gui.screentoworldpoint(new vector3(padding,padding,0)), //1 manager.gui.screentoworldpoint(new vector3(width - padding, padding,0f)), //2 manager.gui.screentoworldpoint(new vector3(width,0f,0f)), //3 manager.gui.screentoworldpoint(new vector3(width - padding, height - padding,0f)),//4 manager.gui.screentoworldpoint(new vector3(wi

javascript - Object doesn't support this property or method in < I.E. 9 -

i'm js noobie , i'm stumped bug that's coming in < i.e 9. in other browsers app works fine. user plugs in values on form , gets title insurance quote returned. can see page @ http://dailyspiro.com/ the following "var amount..." line returns error: "object doesn't support property or method" var quantity = $('#amount').val(); var amount = quantity.replace(/\,/g,''); // removes commas in numeric string the #amount div dropdown numeric values. since there many values on dropdown (hundreds) put code in js file rather html doc. here's tiny excerpt of looks like: var getamount = function() { $('#amount').html('<option value=""></option><option value="0">$0 $30,000</option><option value="30,001">$30,001 $35,000</option> <option value="35,001">$35,001 $40,000</option> <option value="40,001">$40,001 $45,000<

file - About resolve method of the java.nio.Path -

i thoroughly understand use of resolve(path) , relativize(path). in following snippet though there not clear me: public filevisitresult previsitdirectory(path dir, basicfileattributes attr) throws ioexception { destinationfolder = destinationfolder.resolve(source.relativize(dir)); files.copy(dir, destinationfolder,standardcopyoption.replace_existing); return filevisitresult.continue; } this snippet has been taken here (previsitdirectory method). have modified changing name of target destinationfolder . if destinationfolder /home/user/desktop/destination , source , dir (at least first recursive call) /home/user/desktop/tobecopied . the result of destinationfolder /home/user/desktop/destination . works fine , supercool cannot see why gives outcome since source.relativize(dir) ; returns ../tobecopied , destinationfolder.resolve(../tobecopied) should return (without normalizing it) /home/user/desktop/destination/../tobecopied hen

ios - set UIPickerView relative to screen -

Image
i have uipickerview in view hidden offscreen, , when button pressed, pickerview animates in (from bottom, animates up). when user done pickerview, click "done" button in view, , view animates offscreen. works flawlessly, except when screen in landscape orientation. coordinates different when device in portrait. there way make work either orientation? pictures of situation: pickerview: pickerview on rotate: as can see when rotated, pickerview isn't visible. you use percentage rather fixed pixels. eg self.view.frame.size.height * 0.5 opposed hardcoding 384 either or use modal view?

java - Tracking Completed Tasks in ExecutorService -

i'm writing application in java uses executorservice running multiple threads. i wish submit multiple tasks (thousands @ time) executor callables , when done, retrieve result. way i'm approaching each time call submit() function, future store in arraylist. later pass list thread keeps iterating on it, calling future.get() function timeout see if task completed. right approach or inefficient? edit --- more info --- problem each callable takes different amount of processing time. if take first element out of list , call get() on it, block while results of others may become available , program not know. why need keep iterating timeouts. thanks in advance note call future.get block until answer available. don't need thread iterate on array list. see here https://blogs.oracle.com/corejavatechtips/entry/get_netbeans_6

java - JColorChooser get components -

Image
i'm trying implement custom jcolorchooser . colorpanel.setlayout(new gridlayout(1,2)); jcolorchooser tcc = new jcolorchooser(); abstractcolorchooserpanel [] panels = tcc.getchooserpanels(); for(abstractcolorchooserpanel p : panels){ if(p.getdisplayname().equals("rvb")){ colorpanel.add(p); } } final jdialog j = new jdialog(jframe, true); j.setsize(800, 300); j.setlayout(new borderlayout(1,2)); createlistcolor(); j.add(colorpanel); this works , show me following : no i'm stuck on how can listeners widgets because problem panel isn't created me. how can components ( textfield , etc.) of abstractcolorchooserpanel p ? how can catch events on widgets , how can value of textfields in component? i don't think there api individual components. you can use darryls' swingutils access components on panel.

oracle sql to get all possible combinations in a table -

hello guys have small predicatement has me bit stumped. have table following.(this sample of real table. use explain since original table has sensitive data.) create table test01( tuid varchar2(50), fund varchar2(50), org varchar2(50)); insert test01 (tuid,fund,org) values ('9102416ab','1xxxxx','6xxxxx'); insert test01 (tuid,fund,org) values ('9102416cc','100000','67130'); insert test01 (tuid,fund,org) values ('955542224','1500xx','67150'); insert test01 (tuid,fund,org) values ('915522211','1000xx','67xxx'); insert test01 (tuid,fund,org) values ('566653456','xxxxxx','xxxxx'); insert test01 (tuid,fund,org) values ('9148859fff','1xxxxxx','x6xxx'); table data after insert "tuid" "fund" "org" "9102416ab" "