Posts

Showing posts from May, 2013

Golang: run all .go files within current directory through the command line (multi file package) -

i'm newcomer go. extremely language, realised needed start dividing files due increase in program size. go run main.go (with main.go having been file main() function) didn't work , hit barrier while, because had no clue how program working. some quick searching lead me answer of go run main.go other.go .. where typing files package main consists of, programming running. however, utterly cumbersome , frustrating each time. i write following self-answered question in order prevent others myself may again hit barrier. as nate finch notes: go run ... meant used on small programs, need single file. even on unix, go run *.go not correct. in project unit tests (and every project should have unit tests), give error: go run: cannot run *_test.go files (something_test.go) it ignore build restrictions, _windows.go files compiled (or attempted compiled) on unix, not want. there has been bit of discussion of making go run work rest of go comma...

python - writing greek letters with subscripts with matplotlib -

i have use greek letter subscript axes label, thought use latex symbols. using following code: from matplotlib import rc rc('font',**{'family':'sans-serif','sans-serif':['helvetica']}) rc('text', usetex=true) and in plot have, example: ylabel(r'$\boldsymbol{\delta_y}$') it works fine, slow (it take 5 sec. make plot), guess bacause python has call external package. any chances can make faster? i using python 2.6 try using rc('text', usetex=false) . with matplotlib use internal mathtext instead of os's latex installation render math symbols. see docs .

c# - Load an object with values with reflection -

with code below trying save , load player class , xml document. have write portion working having trouble repopulating player object data stored in playerelement. prefer not use xml serializer classes. public class player { public string name { get; set; } public int hitpoint { get; set; } public int manapoint { get; set; } } public player loadplayer(xelement playerelement) { player player = new player(); propertyinfo[] properties = typeof(player).getproperties(); foreach (xattribute attribute in playerelement.attributes()) { propertyinfo property = typeof(player).getproperty(attribute.name.tostring()); if (property != null) { object datavalue = convert.changetype(attribute.value, property.propertytype); property.setvalue(player, datavalue); } } return player; } public override void write(p...

Parsing JSON multidimensional array with C# -

Image
i'm trying parsing data json file i'm getting problems. this sample data json file and code: foreach (jsonvalue groupvalue in jsonarray) { jsonobject groupobject = groupvalue.getobject(); dadoslocaisinteresse group = new dadoslocaisinteresse( groupobject["uniqueid"].getstring(), groupobject["title"].getstring(), groupobject["subtitle"].getstring(), groupobject["imagepath"].getstring(), groupobject["description"].getstring(), groupobject["latitude"].getnumber(), groupobject["longitude"].getnumber() ); foreach (jsonvalue itemvalue in groupobject["items"].getarray()) { jsonobject itemobject = itemvalue.getobject(); group.items.add( new dadoslocaisinteressepontos( itemobject["uniqueid"].getstring(), itemobject[...

c# - Async action in asp.net mvc controller -

i working on asp.net mvc project created controller action method return jsonresult. action goes db , based on table name passed action should dynamic linq query , return rows desired table. my action method looks this: public async task<jsonresult> fieldvalues(string table) { using (dbentities ctx = new dbentities()) { type type = system.reflection.assembly.getexecutingassembly().gettype("mywebapp.models." + table); var query = ctx.set(type).sqlquery(string.format("select * {0}", table)); var data = await query.tolistasync(); return json(data, jsonrequestbehavior.allowget); } } this action invoked using jquery ($.get(...)) view... tried debug action, table passed properly, query seems ok, return statement never reached! it's first time using async action method , firs...

How to capture queries run by a specific user in SQL Server -

messed sql sentry, guess done trace well. recommended ways watch/log queries of particular user? logging anytime run it. i.e. if ran @ night? try use sql server system functions: execution related dynamic management views , functions (transact-sql) http://msdn.microsoft.com/en-us/library/ms188068.aspx for example: get sessionid user: exec sp_who; use this: select a.session_id, st.text querytext sys.dm_exec_connections cross apply sys.dm_exec_sql_text(a.most_recent_sql_handle) st a.session_id = sessionid;

excel vba - Keeping variables between calls to a DLL -

i writing add-in excel use in vba. there way keep variable values in dll between calls dll. made them global in dll, values don't remain between calls. for example, during 'testing', assign (within dll) excel sheet variable 'hp'. when run 'test2' give 'zz' value of "home page" using zz=hp.name, says object not variable or block variable not set. hp variable seems not assigned sheet anymore. public tester finance.root sub testing() dim tester finance.root set tester = new finance.root set aa = sheets(1).range("a1") bb = tester.startup(aa) end sub sub test2() call tester.trial(zz) end sub and in dll sub test2(tt) tt = hp.name end sub thanks. you've created new local variable called tester in testing() delete dim tester finance.root

wordpress - Simple REGEX for blog page VS website page not working -

this regex working fine send url finishing / nopage.php file. #www.abc.com/aaa/bbb/ rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewriterule ^((?!blog)[a-za-z0-9/-]+)/?$ /controller.php?action=nopage [qsa,l,r=301] but see beginning of regex might exclude url blog .abc.com/aaa/bbb/ because use wordpresse blog on url blog.abc.com it's not working page goes blank, instead of delivering wordpress page. blog.abc.com working fine not found the requested url /aaa/bbb/ not found on server. any idea why ?

javascript - Using cookies to retain stylesheet preference across website -

i've got simple javascript function allows me swap between different stylesheets in each page of website. @ moment don't have cookies being implemented on site whenever go new page default stylesheet loaded , if user wanted use alternate stylesheet forced swap again. want make using cookies, whatever stylesheet user chooses remain when going different page. below i've got following code method of swapping stylesheets. <script type="text/javascript"> var i=1; function stylesheet(){ if(i%2==0){ swapper('css/main.css'); } else{ swapper('css/stylesheetalternate.css'); } i++; } </script> <script> function swapper(select_sheet){ document.getelementbyid('swapper').setattribute('href', select_sheet); } </script> so far haven't been able webpage remember user chose stylesheet theme , when...

C++ type conversion precedence in a return -

i have code being changed compile in 64-bit mode being compiled in win32 various reasons. has caused cleanup work address warnings, i'm picking through code , found looks this: class foo { public: int foo() { return data_.size()-1; } private: std::vector<int> data_; }; the size() method on stl containers returns unsigned values. return value being cast signed integer value there's conversion occur @ point. i'm not sure precedence here though. value size() returning cast int , have 1 subtracted, result in return value being -1 if size zero? or subtract 1 unsigned int, possibly doing bad things if container empty when gets called? thanks! it unsigned = unsigned - 1; return signed(unsigned) unsigned(0) - 1 == unsigned(max) from 4.7 integral conversions a prvalue of integer type can converted prvalue of integer type. prvalue of unscoped enumeration type can converted prvalue of integer type. if destination type unsigned, ...

twitter bootstrap - Boostrap Carousel with Knockout bindings - can't make nested bindings work -

i'm trying put knockout content in bootstrap carousel. i need code within comments 'this code i'm having trouble with' (via fiddle link below) repeat match number of pages in 'pagecount' not, i'm presuming becuase of data bindings in slide content. can't work out need or add in view model. number of pages vary, can't make static slides. plain text context no bindings repeats match number contained in 'pagecount' desired. sorry can not show database content in fiddle . html <div class="container"> <div class="feature-bg-image" id="content"> <script> $('.carousel').carousel({ }) </script> <p> need code within comments 'this code i'm having troublw with' below repeat match number of pages in 'pagecount' not because of data bindings. can't work out need or add in view model. </p> ...

TypeError with json data in python -

i have simple python code using put ask price exchange, typeerror: unhashable type: 'dict' when trying run following code. not sure under how handle json data in python. import requests response = requests.get('https://bittrex.com/api/v1/public/getticker?market=btc-shibe') jdata = response.json() assert response.status_code == 200 print jdata[{u'result':{u'ask'}}] you accessing resulting dictionary incorrectly. if wanted access asking price, use: print jdata['result']['ask'] where 'result' gives nested dictionary, access value associated 'ask' on. instead of using assertion, can ask response raise exception when there error response: import requests response = requests.get('https://bittrex.com/api/v1/public/getticker?market=btc-shibe') response.raise_for_status() # raises exception if not 2xx or 3xx response jdata = response.json() print jdata['result']['ask'] you...

Paypal php Rest API, "Got Http response code 404" error on redirect -

i'm using laravel, here code: create payment method public function create() { $payer = paypalpayment::payer(); $payer->setpayment_method("paypal"); $amount = paypalpayment:: amount(); $amount->setcurrency("usd"); $amount->settotal("1.00"); $transaction = paypalpayment:: transaction(); $transaction->setamount($amount); $transaction->setdescription("this payment description."); $redirecturls = paypalpayment::redirecturls(); $redirecturls->setreturnurl("http://mysite/prova/public/payment/execute") ->setcancelurl("http://mysite/prova/public/payment/problema"); $payment = paypalpayment:: payment(); $payment->setintent("sale"); $payment->setpayer($payer); $payment->setredirecturls($redirecturls); $payment->settransactions(array($transaction)); try { $payment->create($this->_apicontex...

java - what exactly happens when new operator is called for array and object? -

i may wrong understand when creating object in java by: class object = new class; the new class create new object of class type applied "object" reference so when u create array of objects by: class[] objects = new class[10]; does mean new class[10] creates 10 objects of class type wich applied objects reference or memory size of 10 objects of class type reserved , need create objects later later correct new class[10] create placeholder 10 objects in memory , need put objects explicitly in them.

jsf - Dynamic rendering of page using p:layout -

i trying dynamically load page based on selected action in p:layout - action driven managed bean - using code below see managed bean getting called , correct page gets passed not rendered. wondering missing, hoping can point out. thanks layout page <!doctype html> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui"> <f:view contenttype="text/html" locale="en"> <h:head title="title"> <ui:insert name="head" /> </h:head> <h:body> <p:layout fullpage="true"> <p:layoutunit position="north" size="100" header="top" resizable="true" closable="true...

Why boost uniform_int_distribution takes a closed range (instead of a half-open range, following common C++ usage)? -

Image
the title says all. there's warning in documentation pages: why this, when common practice in c++ use open ranges [begin, end) ? only closed ranges, can create uniform_int_distribution , produces integer: uniform_int_distribution<int> dist(std::numeric_limits<int>::min(), std::numeric_limits<int>::max()); if half-open range, never reach std::numeric_limits<int>::max() , std::numeric_limits<int>::max() - 1 . it's same situation std::uniform_int_distribution in c++11 standard library. half-open ranges iterators common, because 1 can express empty ranges (by setting begin == end ). doesn't make sense distributions. reference: stephan t. lavavej mentions exact reason in talk "rand() considered harmful" @ going native 2013 (around minute 14). talk c++11 <random> , of course same reasoning applies boost well.

php - Keep form data inside input fields after form error checking -

i have small form, im doing simple error checking php , looks notice when users submit form, after error checking happens data removed fields. here have <?php if($show=="true"):?> <input name="fname" type="text" value="<?php if(isset($_post['name']){echo $_post['name';]})?>"><?php echo $errorname; ?> <input name="email" type="text" value="<?php if(isset($_post['name']){echo $_post['name';]})?>"><?php echo $erroremail; ?> <input type="submit" value="submit"> <?php else: ?> <h2>your message sent</h2> <?php endif;?> <?php if(empty($_post['name'])){ $show="true"; $errorname="please enter name"; } elseif(empty($_post['email'])){ $show=true; $erroremail="please end email"; }else $sh...

Python: IF filename in list -

i'm trying figure out how go through folder , move files in list. have script creating list of file names, need able take files in folder , move them if in list. import os, shutil filelist = [] root, dirs, files in os.walk(r'k:\users\user1\desktop\python\new folder'): file in files: if file.endswith('.txt'): filelist.append(file) print filelist source = "k:\\users\\user1\\desktop\\python\\new folder" destination = "k:\\users\\user1\\desktop\\python\\new folder (2)" root, dirs, files in os.walk(r'k:\users\user1\desktop\python\new folder'): file in files: if fname in filelist: shutil.move(source, destination) i've used other snippets i've found online list created, haven't been able understand how file name variable check if it's in list. appreciated. if understand question correctly, move text files in 1 folder folder? or want pass name of file on comman...

ruby on rails - rails4 ajax returning the text inside my .js.erb file -

i trying set ajax dropdown replace contents of 2 charts/graphs based on dropdown. problem instead of replacing partial, ends rendering in js.erb file. in view have: <h3 class="att">index markets <%= form_tag(chart_path(:format=>:js), {:method=>"get", :remote=> true}) %> <%= hidden_field_tag :id, params[:id]%> <%= select_tag(:sector, options_for_select([['all sectors',3], ['equities',4], ['fixed income',5], ['currencies',6], ['commodities',7]]), onchange: 'this.form.submit()')%> <% end %> </h3> <div id="chart_partial"> <%= render partial: "chart", locals: {risk:@mkt_risk, ret: @mkt_ret}%> </div> in controller: def update_chart num = params[:sector].to_i = ['sp','nq','dj','nk','sx','dx','se','tu',...

How can this be done with MySQL or do I need to write a php script -

i have mysql database news under there's table called links. 1 of colum called link_title , have content without quotes "neil-degrasse-tyson-why-you-will-levitate". there 40,000 rows in table. i have txt file called topurls.txt google analytics shows top visited 1500 urls on site. 1 line, 1 url. , urls have been cleaned match content of link_title in db. can guide me on mysql script clean links table of rows not have link_title matches 1 of 1500 urls in text file. or need program in php or something? load topurls.txt table. let's call topurls , call single column of table url. match link_title topurls , delete on mis-match delete links link_title not in ( select url topurls) this works if content of google file exactly matches existing database rows. otherwise have had further where clause sub-select withsome string manipulation in it.

java - Android SQlite application crashes when I try to run it -

i have attempted create viewable sqlite database view keeps crashing when try open it. have tried opening multiple times , changed few things try , fix it, seeing have not fixed made worse. can't anywhere when open , crashes straight away. sorry wall of code thought may aswell give info rather little. input appreciated. dbhelper.java package com.example.listviewfromsqlitedb; import android.content.context; import android.database.sqlite.sqlitedatabase; import android.database.sqlite.sqliteexception; import android.database.sqlite.sqliteopenhelper; public class dbhelper extends sqliteopenhelper{ public sqlitedatabase db; public string dbpath; public static string dbname = "sample"; public static final int version = '1'; public static context currentcontext; public static string tablename = "resource"; public dbhelper(context context) { super(context, dbname, null, version); currentcontext = conte...

mysql - Fuse ide how to define database table end point -

Image
i have heard alot of success integration story when comes apache camel fuse. hence. here im starting explore fuse ide, simple task on top of head, achieve: read fix length file parse fix length file persist mysql database table i able far as: read fix length file (with endpoint "file:src/data/japan?noop=true") define marshal bindy , define pojo package model @fixedlengthrecord annotation then stuck ... how persist pojo mysql database table? can see jdbc, ibatis , jpa end point, how accomplish in fuse ide? my pojo package: package com.mbww.model; import org.apache.camel.dataformat.bindy.annotation.datafield; import org.apache.camel.dataformat.bindy.annotation.fixedlengthrecord; @fixedlengthrecord(length=91) public class japan { @datafield(pos=1, length=10) private string tnr; @datafield(pos=11, length=10) private string atr; @datafield(pos=21, length=70) private string str; } well can use of following components read , write database: ...

java - LWJGL/OpenGL How do I resize my image in order to fit my sphere? -

i working on project , tried wrap image around shape, sphere. problem image cover of sphere, parts. how can resize image fits whole sphere perfectly? import java.io.ioexception; import org.lwjgl.*; import org.lwjgl.input.keyboard; import org.lwjgl.opengl.*; import static org.lwjgl.opengl.extframebufferobject.glgeneratemipmapext; import static org.lwjgl.opengl.gl11.*; import static org.lwjgl.util.glu.glu.gluperspective; import org.lwjgl.util.glu.sphere; import org.newdawn.slick.opengl.*; import org.newdawn.slick.util.resourceloader; private void render() { glclear(gl_color_buffer_bit | gl_depth_buffer_bit); glloadidentity(); gltranslatef(0, 0, -8); glrotatef(rotateangle, 0, 1, 0); sphere s = new sphere(); s.setnormals(gl_smooth); s.settextureflag(true); glenable(gl_texture_2d); glgeneratemipmapext(gl_texture_2d); gltexparameteri(gl_texture_2d, gl_texture_min_filter, gl_linear_mipmap_linear); gltexparameteri(gl_texture_2d, gl_texture_ma...

Mutiple command in java processbuilder -

i trying create xml file of .smv file using multiple commands in process builder.how can give command process builder in such way output of first command , next command generate next output process p = null; processbuilder pb = new processbuilder("nusmv","-int", "d:/files/bitshift.smv"); p = pb.start(); inputstream in = null; outputstream outs = null; stringbuffer commandresult = new stringbuffer(); string line = null; int readint; int returnval = p.waitfor(); in = p.getinputstream(); while ((readint = in.read()) != -1) {commandresult.append((char)readint); outs = (bufferedoutputstream) p.getoutputstream(); outs.write("process_model".getbytes()); outs.write("show_traces -p 4 -o d:/output.xml".getbytes());} outs.close(); system.out.println(...

c# - How to change datatable column name -

hi change data table column name upper case (first latter) tried below code e.g i need convert below name name code foreach (datacolumn column in obj_dt.columns) column.columnname = column.columnname.toupper(); but converting full name upper case need convert first latter ... how can it... thanks... in cultureinfo.textinfo class have many methods deal culture specific casing rules. method looking is: totitlecase textinfo ti = cultureinfo.currentculture.textinfo; foreach (datacolumn column in obj_dt.columns) column.columnname = ti.totitlecase(column.columnname); you need add using system.globalization;

PHP & MySQL: Query from 2 tables -

i have following tables: jobs: +--------+------------+------------------+ | job_id | company_id | job_title | +--------+------------+------------------+ | 123456 | 342186 | mysql dev needed | | 549201 | 175123 | php dev needed | | 784930 | 823491 | ui designer pls | +--------+------------+------------------+ companies: +------------+--------------+---------------------+ | company_id | company_name | company_email | +------------+--------------+---------------------+ | 342186 | microsoft | microsoft@email.com | | 823491 | quora | quora@email.com | | 784930 | facebook | facebook@email.com | +------------+--------------+---------------------+ this current query getting jobs jobs table: // jobs jobs table $result = mysql_query("select * jobs") or die(mysql_error()); // check empty result if (mysql_num_rows($result) > 0) { // looping through results // jobs node $response["jobs"] =...

javascript - Phonegap navigator.camera.getPicture memory warning -

each time use phonegap api function create image on ios, after click on use photo warning. (the memory usage spikes 60mb) my code: navigator.camera.getpicture(onsuccess, onfail, { quality: 20 }); function onsuccess(imagedata) { console.log('succ'); } function onfail(message) { alert('failed because: ' + message); } warning: 2014-05-17 10:56:35.122 cityfe[1845:60b] received memory warning. 2014-05-17 10:56:35.195 cityfe[1845:60b] succ is worried about? try one function getphoto(source) { // retrieve image file location specified source navigator.camera.getpicture(onsuccess, onfail, { quality: 30, targetwidth: 600, targetheight: 600, destinationtype: navigator.camera.destinationtype.file_uri, correctorientation: true, sourcetype: source }); } function onsuccess(imagedata) { console.log('succ'); } function onfail(message) { alert('failed because: ' + me...

c# - Explanation needed: virtual, override and base -

why doesn't ", second id: " string in o.w2() printed out? know d2 property empty. using system; public class o { public string f { get; set; } public string l { get; set; } public string d { get; set; } public virtual string w() { return this.w2(); } public virtual string w2() { return string.format("first name : {0}, last name: {1}, id: {2}", f, l, d); } } public class s : o { public string d2 { get; set; } public override string w() { return base.w2(); } public override string w2() { return base.w2() + string.format(", second id: {0}", this.d2); } } class program { static void main(string[] args) { o o = new s(); o.d = "12345678"; o.f = "john"; o.l = "jones"; console.writeline(o.w()); // output: first name : john, last name: jones, id: 12345678 } } ...

How to find amicable pairs in scheme? -

i new in scheme. how find "amicable pais"? (define (sumcd n) (define s 1 ) (set! m (quotient n 2)) (while (<= m) (if (=(modulo n i) 0) (set! s (+ s i))) (set! (+ 1)) ) ) and in main program want check (if (m=sumcd n) , (n=sumcd m)) m , n amicable pair. how can this? excessive use of set! indicates imperative style of programming, discouraged in scheme. here's racket-specific implementation of sum-of-divisors not use set! @ all. (define (sum-of-divisors n) (define-values (q r) (integer-sqrt/remainder n)) (for/fold ((sum (if (and (zero? r) (> q 1)) (add1 q) 1))) ((i (in-range 2 q)) #:when (zero? (modulo n i))) (+ sum (quotient n i)))) equivalent version in standard r6rs/r7rs scheme, if you're not using racket: (define (sum-of-divisors n) (define-values (q r) (exact-integer-sqrt n)) (let loop ((sum (if (and (zero? r) (> q 1)) (+ q 1) 1)) (i 2)) ...

javascript - Dropdown sign in menu -

i'm using jquery animate dropdown sign in div. sign form uses php check if user exists in database. however, if echo dropdown menu goes away , have click again see error message. here's how login looks: <form method="post"> <input type="text" name="username" placeholder="username" required> <input type="password" name="password" placeholder="password" required> <input type="submit" name="button" value="sign in"> </form> <?php session_start(); $username = $_post["username"]; $password = $_post["password"]; include("connect.php"); if($username && $password){ $password = md5($password); $getquery = mysql_query("select * users username='$username' , password = '$password'"); $numrows = mysql_num_rows($getquery); ...

How to streaming JSON (chunked transfer encoding) parsing using AFNetworking on ios -

i new ios development. want use afnetworking receive data streaming json api in our server. when send request server, connection kept until wrong network. our server use comet method push messages ios client. there 2 types of messages:heart-beat message reachability monitoring , application message display. messages chunked transfer encoding , json data few bytes. server sends heart-beat messages client if there no application data related user of application. i find there question similar mine. streaming json afnetworking on ios but author of afnetworking said "afnetworking not have built-in streaming sax-style json operation..." . since question asked 2 years ago, checked api of new version of afnetworking, couldn't find examples of streaming json. wonder whether new version of afnetworking(such 2.0 or 2.2) has support streaming json? if no support, there exist other kinds of library parse chunked encoding json data? give me demo code? thanks forward. ...

javascript - Getting the sum after multiple AJAX request -

i've created fiddle . i've used .when().done() method values of facebook likes , github followers problem when sum these 2 values i'm getting [object object],success,[object object][object object],success,[object object] jquery $(function () { $.when( $.ajax({ type: "get", datatype: "json", url: "https://api.github.com/users/bloggerever", success: function (data) { var githubfollowercount =data.followers; $(".githubfollowercount").html(githubfollowercount); } }), $.ajax({ type: "get", datatype: "json", url: "http://graph.facebook.com/bloggerever", success: function (data) { var facebookfollowcount = data.likes; $(".facebookfollowercount").html(facebookfollowcount); } })).done(function (githubfollowercount, facebookfollowcount) { var total=...

Java: creating a specific class -

i have class constructed that: public class creature { protected final ai ai; // ...about 10 other objects public creature (creaturetype type, int x, int y) { ai = new ai (); // other code } // ... many methods } my class ai artificial intelligence of creature. have full access creature object if inside. how achieve that? tricky way inherit it? making ai inner class of creature give ai access creature's instance variables. see: http://docs.oracle.com/javase/tutorial/java/javaoo/nested.html

ruby on rails - Translation for nested_attributes in polymorphic relationship -

i'm trying translate label of nested form attribute of polymorphic model. i'm using rails 4. object relationship: class question < activerecord::base has_many :attachments, as: :attachable, dependent: :destroy accepts_nested_attributes_for :attachments end class attachment < activerecord::base belongs_to :attachable, polymorphic: true end my form: = form_for @question |f| .form-group =f.text_area :body = fields_for :attachments |a| .form-group = a.label :file = a.file_field :file = f.submit my ru.yml: activerecord: attributes: question: attachment: file: Файл attachments: file: Файл attachment: file: Файл doesn't work. should locale structure? according to: http://api.rubyonrails.org/classes/actionview/helpers/formhelper.html#method-i-label you should try with: helpers: label: yourmodelname: yourmodelattr: "write entire text here" this ...

java - Iterating a List of Hashmap which is also a list of hashmap Using jstl -

consider iteration below: requestscope.scriptdataset of type list<hashmap<string, list<hashmap<string, object>>>> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@page contenttype="text/html" pageencoding="utf-8"%> <c:foreach var="objdatatable" items="${requestscope.scriptdataset}"> <c:if test="${not empty objdatatable['vwcmstreevwdata']}"> <c:foreach var="objrecord" items="${objdatatable['vwcmstreevwdata']}"> <c:foreach var="record" items="${objrecord}"> <c:out value="${record['childname']}"/> </c:foreach> </c:foreach> </c:if> </c:foreach> i want value of innermost hashmap key failing shown below. may 17, 2014 8:51:16 pm org.apache.catalina.core.applicationdispatcher invoke severe: servlet.service() servlet js...

java - gwt maven compile doesn't generates entry point html file -

i have been working on gwt , maven. have created maven project without archetype , have configured gwt-maven-plugin successfully. when compile or run project, without errors or warnings. however, on gwt:compile can't generate entrypointfilename.html file. so, 404 error occurs in browser. are there suggestions or solutions fixing this? gwt (and gwt-maven-plugin) doesn't generate html host page; that's you have provide. you're experiencing expected behavior.

python - most pythonic way to interate a finite but arbitrary number of time through list values -

i trying optimize outcome genetic algorithm-style. i provide seed value input function, transformations , returns "goodness value". pick best seed values, , repeat process until i've got winner. the challenge i've run want run finite number of trials each step (say, 100 max) , number of seed values changes run run. using loop through list of seed values won't work me. here solution came deal list not being infinite iterator: iterations = 100 rlist = list(d.keys()) lt in (itertools.repeat(rlist)): d = gatherseedvalues(directory) seed = random.choice(lt) goodness = goodnessgracious(seed) goodnessdict[seed] = goodness if len(goodnessdict) > iterations: break is there more pythonic way of doing - both in terms of getting around iterator restriction , looping strategy? also, using len(goodnessdict) methodology appropriate or there more pythonic way break loop? based on comment: r...

ios - Offset UITableView Content When Keyboard Appears -

hi i'm getting error: property 'editingindexpath' not found on object of type 'viewcontroller *' line: [self.tableview scrolltorowatindexpath:self.editingindexpath atscrollposition:uitableviewscrollpositiontop animated:yes]; the error has call: self.editingindexpath how fix error? - (void)viewdidload { [super viewdidload]; // additional setup after loading view, typically nib. [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillshow:) name:uikeyboardwillshownotification object:nil]; [[nsnotificationcenter defaultcenter] addobserver:self selector:@selector(keyboardwillhide:) name:uikeyboardwillhidenotification object:nil]; } -...

c# - Looping as an expression -

i come across things useful rather often, , if exists want know it. i'm not sure how explain search it, it's 1 line loop statement- similar lambada. isn't best example (it's simple solution without this), it's on mind when decided ask question. kind of thing i'm talking about. (the following i'm thinking of looks like. i'm asking if similar exists) in current situation, converting string byte array write stream. want able create byte array: byte[] data = string ==> (int i; convert.tobyte(string[i])) where number in string based on it's length, , next line output item. you should read linq. your code can written as: var string = "some string"; byte[] data = string.select(x => convert.tobyte(x)).toarray(); or method group: byte[] data = string.select(convert.tobyte).toarray();

c++ - How to change LinkedList head pointer globally and not locally -

i have 2 implementations of this. why particular implementation not work? have pointer pointer , im changing inside point doesn't retain change in main function #include <iostream> using namespace std; struct node { int value = 4; node* next; }; void insertfront(node*, node**); int main(){ node head; head.value = 32; head.next = nullptr; node** headptr = new node*; (*headptr) = new node; *(*headptr) = head; (*headptr)->value = 32;//redundant, know (*headptr)->next = nullptr;//redundant, know cout << head.value << endl; insertfront(new node, headptr); cout << head.value << endl; system("pause"); return 0; } void insertfront(node* newhead, node** head2){ cout << "inside before swap " << (*head2)->value << endl; newhead->next = *head2; *head2 = newhead; cout << "inside after swap " << (*head2)-...