Posts

Showing posts from March, 2013

Python: txt into dictionary. Split() TypeError: unhashable type: 'list' -

i started python , i'm having troubles 1 exercise. sorry if question "basic stuff" i've done research on google , can't find short , not complicated answer. , exercise: "write program reads words in words.txt , stores them keys in dictionary. doesn't matter values are. can use in operator fast way check whether string in dictionary." i tried this: import os os.chdir("/users/missogra/documents") fname = input("file name: ") if len(fname) < 1 : fname = "words.txt" fh= open(fname) counter = 0 dictionairy = dict() line in fh: word = line.rstrip() dictionairy[word] = counter counter += 1 print(dictionairy) however, don't words, sentences. thought use split() this: import os os.chdir("/users/missogra/documents") fname = input("file name: ") if len(fname) < 1 : fname = "words.txt" fh= open(fname) counter = 0 dictionairy = dict() line in fh: word = line.r

javascript - Datepicker set the selected date -

this code, page called cal.html: <html lang="en"> <head> <meta charset="utf-8"> <title>jquery ui datepicker - default functionality</title> <link rel="stylesheet" href="http://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css"> <script src="http://code.jquery.com/jquery-1.10.2.js"></script> <script src="http://code.jquery.com/ui/1.11.4/jquery-ui.js"></script> <link rel="stylesheet" href="http://code.jquery.com/resources/demos/style.css"> <script> $(function() { $.datepicker.setdefaults($.datepicker.regional['it']); $('#datepicker').datepicker({ inline: true, altfield: '#datascelta', onselect: function(){ $('#formscelta').submit(); } }); }); </script> <div id="datepicker"></div>

ruby on rails - Active Model Serializer not working with json_api adapter -

i trying use custom serializers relationships in serializer , json_api adapter enabled. relationships not serialized correctly (or, better, not @ displayed/serialized). postcontroller.rb def index render json: post.all, each_serializer: serializers::postserializer end serializer module api module v1 module serializers class postserializer < activemodel::serializer attributes :title, :id belongs_to :author, serializer: userserializer has_many :post_sections, serializer: postsectionserializer end end end end json output: { "data": [ { "attributes": { "title": "test title" }, "id": "1", "relationships": { "author": { "data": { "id": "1", "type"

css - CSS3 NOT and Sibling selector not working in chrome -

from reason code below working ok in firefox, in chrome not (in chrome can see inspect element condition met): .hiddenfields:not([style*="display:none"]):not([style*="display: none"]) ~ p.form-helper-t23 { opacity: 0; }

java - How to pass checkbox values to an ACTION_SEND -

i'm trying first app, i'm self-taught in java , started 2 month ago please forgive errors. want pass checkboxes values email text think need refresh "something" before sending email because values false..and don't know how can do. here code: public class appuntamento extends activity{ string paziente; @override protected void oncreate (bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.appuntamento); //riceviamo id e lo mettiamo come nome utente final edittext nomepaziente = (edittext)findviewbyid(r.id.nomepaziente); bundle dati = this.getintent().getextras(); nomepaziente.settext(dati.getstring("id")); final string id = dati.getstring("id"); edittext noteappuntamento = (edittext)findviewbyid(r.id.noteappuntamento); final string note = noteappuntamento.gettext().tostring(); final checkbox lunedi = (checkbox)

c++ - Request JSON in Qt -

firstly before start post, whant tell read topic correct format http post using qnetworkrequest i using idea me not working. read few other topic time not have solve. may therefore because somethig missed (for sure). now show request work html file <html> <body> <form method="post" action="http://192.168.1.108/acces.cgi"> <input type="text" name="json" value='{"method":{"ok":"get","number":1}}' size="100"> <input type="submit"> </form> </body> </html> after send request answer in browser. request json correct sure. now whant try send same request using qt have written below code warring qt.network.ssl: qsslsocket: cannot resolve sslv2_client_method qt.network.ssl: qsslsocket: cannot resolve sslv2_server_method and code qurl url("http://192.168.1.108/acces.cgi"); // request local host qnetworkrequest

node.js - Encode to alphanumeric in JavaScript -

if have random string , want encode string contains alphanumeric characters, efficient way in javascript / nodejs? obviously must possible convert output string original input string when needed. thanks! to encode alphanumeric string should use alphanumeric encoding. popular ones include hexadecimal (base16), base32, base 36, base58 , base62. alternatives hexadecimal used because larger alphabet results in shorter encoded string. here's info: hexadecimal popular because common. base32 , base36 useful case-insensitive encodings. base32 more human readable because removes easy-to-misread letters. base32 used in gaming , license keys. base58 , base62 useful case-sensitive encodings. base58 designed more human readable removing easy-to-misread letters. base58 used flickr, bitcoin , others. in nodejs hexadecimal encoding natively supported , , can done follows: // encode var hex = new buffer(string).tostring('hex'); // decode var string = new buffer(h

c# - Gameobject instantiated in canvas shows up behind other canvas items -

in game, if first time player has ever played game have image displayed. instantiate in canvas so: if (playerprefs.getint("first time", 1) == 1) { introenabled = true; //pause activity pause.pauseorresume(); intro = instantiate (resources.load ("intro"), transform.position, quaternion.identity) gameobject; canvas canvas = gameobject.find("canvas").getcomponent<canvas>(); intro.transform.setparent(canvas.transform, false); //robot = instantiate (resources.load ("robot"), transform.position, quaternion.identity) gameobject; playerprefs.setint("first time", 0); playerprefs.save(); } i can see in inspector when game running when object created, show in canvas. have no idea why won't show on top of of other objects in canvas. the canvas rendering mode set "screen space - overlay" , set 0 in sort order. game object being instan

c - ESC/POS printer Java -

i have datecs mp55 cashregister. want develop code in java print. documentation poor , use help.i've read somewhere need send command it's port, don't know command , way sending it, how port uses. found far : 1.1. prnopen opens serial port , performs initalization of printer syntax int __stdcall prnopen(int port, int speed, bool hardware); parameters port com port number speed com port speed hardware if true, turns on rts/cts handshaking, false goes xon/off return value err_ok - printer ready err_timeout - communication error so c code. i've created sample code test c doesn't have bool type ... : #include <stdio.h> #include <stdlib.h> void hellofromc(){ printf("hello c!"); } int __stdcall prnopen(int port, int speed, bool hardware); int main(){ hellofromc(); return 0; } so without int __stdcall prnopen(int port, int speed, bool hardware); able run code in java. also, way calling c code in java : import java.io.buffere

GitHub Mac Desktop clone same repository multiple times missing repository name from list -

how can make multiple clones of same repository on local computer github mac desktop? after make first clone, repository name disappears github desktop clone choice list. related this, cloned github repository onto local machine, decided didn't want in location. deleted (trashed) old repository , tried clone again, not, because repository name not listed. turned out because repository still in trash, github desktop didn't recognize gone. emptied trash , saw gone , asked if wanted remove repository. answered yes , repository name appeared in clone choice list. you can't clone same repo twice gui so, instead use command line git clone , can use file->add local repository item select path , show up. the annoying thing having multiple clones of repo in repository list cause them have same name, because github mac desktop doesn't show paths. fortunately order doesn't change , can (right click->open in terminal) see which. if want delete rep

twitter - TwitterCredentials.SetCredentials from tweetinvi not found -

i installed tweetinvi twittercredentials.setcredentials not found. install-package tweetinviapi how can solve this. you're using old tweetinvi code. tweetinvi break compatibility since version 0.9.9.5. instead of "twittercredentials.setcredentials" should use "auth.setusercredentials" plaese note parameters order has been changed! try this: auth.setusercredentials("consumer_key", "consumer_secret", "access_token", "access_token_secret"); for more options, see https://github.com/linvi/tweetinvi/wiki/credentials

Beautifly / Tidy (Javascript) in Visual Studio Code -

i'm giving visual studio code try. overall user experience can't find of things i'm used to, in sublime (with of extensions.) one of them beautifly code (or tidy up) - there wy javascript in visual studio code? any appreciated. if want beautify code can press ctrl+shift+p , type format code or press alt+shift+f it correctly indents code seems looking for, if not might want give example.

javascript - Return value from a asyncronous request using a callback function -

this question has answer here: how return response asynchronous call? 25 answers i have httprequest returns value. i'm capturing such value callback function. the code executes , alert if username duplicate in db. "return false" not working , form submitted (savenewuser) duplicated username anyway. examples i've seen far stop @ callback alert have in code. how accomplish return false stop execution in other cases: first, last name , password checks? thank much. function checkusername(callbackusername){ var username = document.getelementbyid('username_id').value; var ajaxrequest = getxmlhttp(); ajaxrequest.onreadystatechange = function() { if(ajaxrequest.readystate == 4 && ajaxrequest.status==200){ var response = trim(ajaxrequest.responsetext); callbackuser

EADDRINUSE Node.js MongoDB Callbacks issue -

the problem: (node.js application + mongodb native driver) have json file more 60000 json documents.the documents creation date , unique id called vid. , need insert in mongodb collection. need insert new vid or update ones existing document more recent. what did: https://github.com/telmoivo/pfc/blob/master/cfginit.js what happening: after inserting/updating 500 times , getting 287 documents in collection error: assertionerror: null == { [mongoerror: connect eaddrinuse] name : 'mongoerror', message: 'connect eaddrinuse' } @ line assert.equal (null, err); from read, it's saying have connection db in use. close after insert/update everytime. any advice? i wouldn't calling mongoclient.connect every time. that's causing ton of connections open , close time overloading mongo. should let mongoclient manage connection pool. change store db object mongoclient.connect maybe in init file add like //store outside init accessible other funct

sql server - SQL Insert Query With Condition -

i trying insert values 1 column of table when condition satisfied. note: table contains data columns 1 empty. insert value 1 column depending on clause. i have query: insert <table_name> (column_name) (value) <condition> i getting exception: incorrect syntax near keyword i able using update: update <table_name> set <col_name> <condition> but wondering why insert query failing. advise appreciated. as understand problem, have data in 1 row, , 1 column in row not have value, want add value in column. this scenario update existing row, not insert new row. have use update clause when data present , want modify record(s). choose insert when want insert new row in table. so in current scenario, update clause friend clause want modify subset of records not all. update <table_name> set <col_name> <condition> insert clause not have clause per rdbms syntax(i think). insert condition less sql query, while sel

php - codeigniter: one controller several actions -

i'm using codeigniter. i'm working on routes , controller. last week, explored symfony2 , liked something: class defaultcontroller extends controller { public function indexaction() { return $this->render('lvindexbundle:default:index.html.twig'); } public function servicesaction() { return $this->render('lvindexbundle:default:services.html.twig'); } public function shoppingaction() { return $this->render('lvindexbundle:default:services.html.twig'); } in controller, each action renders view. i same in codeigniter -> several functions / actions leading distinct views. i'm new codeigniter. far, understood 1 controller = 1 view. i'd 1 controller = several functions several pages. otherwise, lot of pages. thanks help! based on experience(s): in ci, controller can has more 1 view php file ex (function indexaction controller function): public funct

android - custom notification button click -

in application have notification show. let's when notification show want press 'yes' go activity , hide notification, press 'no' nothing hide notification. i tried code instead of onclick onclckpendingintent , can't want. notificationmanager mnotificationmanager = (notificationmanager) this.getsystemservice(context.notification_service); remoteviews remoteviews = new remoteviews(getpackagename(), r.layout.custom_push_layout); notificationcompat.builder mbuilder = new notificationcompat.builder(this) .setsmallicon(r.drawable.ic_launcher) .setcontent(remoteviews) .setautocancel(true); intent intent = new intent(this,gpstrackingactivity.class); final intent yesintent = new intent(intent); final intent nointent = new intent(this, gpstrackingactivity.class); taskstackbuilder yesstackbuilder = taskstackbuilder.create(this); yesstackbuilder.addparentstack

Python MemoryError when appending a list -

i've small python (2.7.10) script, can see below. def numbers_calc(max_num, num_step): """returns every number 0 max_num num_step step.""" n = 0 l = [] while n < max_num + 1: l.append(n) n += n * num_step return l n_l = [] n_l.append(numbers_calc(25, 1)) print "here numbers." print n_l the function numbers_calc meant take given args, form list, , populate numbers (with num_step step when calculating) before reaches max_num + 1 . script return it's local list named l . however, every time run script, encounter memoryerror . here's python returned when ran script: traceback (most recent call last): file "num.py", line 13, in <module> n_l.append(numbers_calc(25, 1)) file "ex33.py", line 7, in numbers_calc l.extend(i) memoryerror i tried looking up, saw nothing helpful. hope can me! the issue in line - n += n * num_step here, initi

java - onPostExecute is not working in fragment activity -

i want load data website using jsoup in fragment activity , show output in textview. using asynctask load data website using jsoup after getting data website onpostexecute method in asynctask not displaying data. have tried debug , seems there problem in onpostexecute , don't know why. here code.. mainactivity2.java package com.example.ebad.bustudentprofile; import android.os.bundle; import android.support.v4.app.fragmentactivity; import android.support.v4.view.viewpager; import com.example.ebad.bustudentprofile.tabs.slidingtablayout; public class mainactivity2 extends fragmentactivity { @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main2); // layout manager allows user flip through pages viewpager viewpager = (viewpager) findviewbyid(r.id.viewpager); // getsupportfragmentmanager allows use interact fragments // myfragmen

Java lwjgl rotating a model around its center -

i have been making project in light weight java graphics library have loaded model , rendered color per triangle fine. next step rotate model around center. reading articles , source code have general understanding of need don't understand gltranslatef() method. under standing want to glpushmatrix() gltranslatef(0,0,0); glrotatef(roation values); gltranslatef(original coords); render model then glpopmatrix(); my main problem manually doing math in glvertex() method calls instead of translating them believe making translation 0,0,0 it's original spot difficult. time , help. package render; import static org.lwjgl.opengl.gl11.glbegin; import static org.lwjgl.opengl.gl11.glrotatef; import static org.lwjgl.opengl.gl11.glpushmatrix; import static org.lwjgl.opengl.gl11.gltranslatef; import static org.lwjgl.opengl.gl11.glpopmatrix; import static org.lwjgl.opengl.gl11.glend; import static org.lwjgl.opengl.gl11.gl_triangles; import static org.lwjgl.opengl.gl11.glcol

wordpress - How to add shortcode to custom text on first page block -

i add shortcode homepage test.healthclubone.nl. in dashboard 'custom text first page' available. shortcode needs between header , widget. however, shortcode seen text , not html. there possibility change this? played around do_shortcode not working. help. wobin the thing if calling slider in home page template, should use do_shortcode right after slider. as see there empty carousel right before widgets, means shortcode not function well, it's better check shortocde functionality/options.

ios - Making a String into an SKNode -

i have correct sknode in string format. want transform string name "a2square" node called a2square. is possible? is there anyway take string "a2square" , somehow transform sknode same name.... although not entirely clear me trying do, looking sklabelnode . special node can rendered text (a label). some sample code: sklabelnode *winner = [sklabelnode labelnodewithfontnamed:@"chalkduster"]; winner.text = @"a2square"; winner.position = cgpointmake(cgrectgetmidx(self.bounds), cgrectgetmidy(self.bounds)); [self addchild:winner];

Android Two Libraries with Sync Adapters only one called -

i'm puzzled one. think issue stems library applications manifests merging. i have 2 sync adapters, 2 different libraries. keep playing code, can either first or second sync adapter work. case one, template files named same, libone's sync adapter launched. rename xml file referenced in android:resource="@xml/filenamehere" both files unique , not default. result, libtwo's sync activated? that's odd. my solution make third sync adapter in actual application , handle both of these adapters in 1 file, hate not understanding why happened. note changed package names libone libtwo. these libraries same university, part of same project same author. difference path names, adapters name, authority , account type. literal copy , paste mirror images. have tried making these items same, no change. thing thats made difference cant seem control renaming files. tried changing allow parallel flag. i'm guessing os doesn't launching of dual adapters. i look

ruby on rails - Filter elements from related table -

Image
i'm displaying on homepage current bets ( current option of status attribute) members. here code: <% @bets.where(status: "current").each |bet| %> <%= bet.match_name %> <%= bet.bet_choice %> <% end %> (where @bets = bet.all in page controller) what display on homepage current bets members in "team" (team boolean in user). how can that? assuming that, have proper associations defined in user , bet models. try this: user.where(team: true).joins(:bets).where('bets.status' => 'current') update_1: i see have column id_user in bets table, should user_id instead, assuming associations like: user has_many bets , bet belongs_to user . update_2: if want such bets , loop through bets collection, have modify above query little bit this: bet.where(status: "current").joins(:user).where('users.team' => 'true')

html - Place two objects at THE SAME spot in css -

let's assume have 2 objects, em , button <button class="navigatebutton" wicket:id="rw">test1</button> <em class="logoutbutton"><a wicket:id="rw2">test</a></em> is there way place 2 of objects @ same spot without using position:fixed? in code handle 1 should shown, since different functions. want show @ 1 specific spot, regardless 1 hidden. there never 2 of displayed @ same time. put them both container <div> , give them position: absolute; top: 0; left: 0;

scala - Returning an immutable map containing a single modified entry from another one -

i have immutable map wish change single element , return immutable map. stuck copying elements twice? val inmap = map('a'->1,'b'->2) import collection.mutable val mmap = mutable.map(inmap.tolist:_*) mmap('b')= 3 val mmap2 = map(mmap.tolist:_*) mmap2: scala.collection.immutable.map[char,int] = map(b -> 3, -> 1) just wondering if 'required' price immutability on 'frontiers' of our methods. you use updated method: scala> val inmap = map('a' -> 1, 'b' -> 2) inmap: scala.collection.immutable.map[char,int] = map(a -> 1, b -> 2) scala> val updated = inmap.updated('b', 3) updated: scala.collection.immutable.map[char,int] = map(a -> 1, b -> 3) api doc map : updated method.

c - segmentation fault when writing to a char to a char array -

i writing code processing 2-d char array. char *board[] = {"aa"}; i pass array function search(board, row, col); .......... bool search(char** boards, int row, int col) { // inside function, want modify boards[x][y] // board within x , y, x < row, y < col // segmentation fault here because boards // allocated static memory , cannot changed. boards[x][y] = 'c'; } in c++, can use vector< vector<char> boards to change elements in specific location. in c, there no vector. is has advice how modify boards 2-d array? thanks. the problem making array of pointers, , set pointers ppint string constants. memory of string constants not modifiable, writing causes segmentation fault. changing array of pointers 2d array of characters fix problem char board[][10] = {"aa", "bb"};

css - SVG path filled with image doesn't show up on html page -

Image
i have filled svg path image using little trick: fill svg path element background-image however, when load svg file in html page using background: url(), doesn't show up. here svg image opened in browser: and here same svg image on html page: does know might going on here? thanks. svg files loaded <img> or background-image have self-contained. cannot refer external files (as in image loading pattern). what can work around embed pattern image data uri". <image xlink:href="data:image/jpeg;base64,..." .../>

algorithm - Movement in Java games without pathfinding -

let's want have object move along set path between points a, b, , c repeatedly throughout game, based on variable. now, program in full a* pathfinding, take lot of time , require lot of code wouldn't used full worth. there easier way this? @ moment, idea have have object move set number of pixels in 1 direction, another, another, easy object several pixels off after while. should add none of points directly accessible 1 another, in object have go around walls. appreciated, feel i'm missing obvious here. i should clarify walls not changing position. remain entire game. define sequence of points p such that: there no obstacle between 2 consecutive points p[i] , p[i + 1] . traveling along sequence of points take b , c. in other words, you're taking path b c , breaking straight segments. points fixed, won't stray path due floating-point precision. now can accomplish objective moving object point point in sequence p . move in reverse, iterate on

c++ - Winsock program getting 400 bad request, your browser sent a request this server couldn't understand -

i made program in c++ using winsock2 , connected godaddy. http/1.1 400 bad request date: mon, 17 aug 2015 01:53:38 gmt server: apache content-length: 300 connection: close content-type: text/html; charset=iso-8859-1 <!doctype html public "-//ietf//dtd html 2.0//en"> <html><head> <title>400 bad request</title> </head><body> <h1>bad request</h1> <p>your browser sent request server not understand.<br /> </p> <hr> <address>apache server @ default.secureserver.net port 80</address> </body></html> here's code: #include <windows.h> #include <winsock2.h> #include <conio.h> #include <stdio.h> #include <iostream> using namespace std; #define sck_version2 0x0202 #define default_buflen 2000 #define default_port 27015 namespace globals{ extern string input = ""; } using namespace globals; int whole() { //username(); //p

python - GNU Radio - osmocom_fft issue with SDR -

after recompiling twice, tried pybomb , install repo can't sdr working using hackrf. after experiencing -5 , -1000 errors hackrf_info command, can start grc without errors doesn't plot spectrum. by clicking on plot seems python fault of installation. traceback (most recent call last): file "/usr/local/lib/python2.7/dist-packages/gnuradi/wxgui/plotter/common.py", line 122, in <lambda> self._plotter.bind(wx.evt_left_down, lambda evt: plotter.call_freq_callback(evt.getposition())) file "/usr/local/lib/python2.7/dist-packages/gnuradio/wxgui/plotter/grid_plotter_base.py", line 96, in call_freq_callback if x < self.padding_left or x > self.width-self.padding_right: return attributeerror: 'channel_plotter' object has no attribute 'padding_left'

javascript - Same-origin policy is for what -

i not able understand why need rule. if such import, why can many workaround address it? jsonp, cors etc.? is there example can demostrate damage without rule? if @ mdn article , you'll see this: cross-origin writes typically allowed. examples links, redirects , form submissions. used http requests require preflight. cross-origin embedding typically allowed. examples listed below. cross-origin reads typically not allowed, read access leaked embedding. example can read width , height of embedded image, actions of embedded script, or availability of embedded resource. here's post on security stackexchange : assume logged facebook , visit malicious website in browser tab. without same origin policy javascript on website facebook account allowed do. example read private messages, post status updates, analyse html dom-tree after entered password before submitting form. regarding question why there cors, jsonp, etc. (i.e., ways around same-o

How to add push notification for Android app which uses Amazon DynamoDB? -

my android app uses data amazon dynamodb. want add "push notification" app. means when new data added dynamodb, our app receive notification. didn't find tutorial push notification dynamodb. please me! you can accomplished task in 3 different ways store notification token in dynamodb table on inserting item in table send notification server side as suggested in comment can use service of sns send notification user configure lambda function can integrated dynamodb table easily, on insert item can write code send notification edit: have choose 2 options (node.js, java) while using lambda. when configure lambda function ask dynamodb table , event want(in case adding row/item). in lambda function have write custom code send notification.

maven - How to avoid putting a specific version of Spring Boot in a library -

i developing library based on spring boot, used in multiple spring boot applications. library supposed work spring boot 1.3.0.m1 onwards. i thinking how avoid putting specific version of spring jars in it, , instead let application specify exact version. have come out solution, seems work except combinations: in library, have spring boot version 1.3.0.m1 , , have scope of dependencies provided . this: ... <parent> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-parent</artifactid> <version>1.3.0.m1</version> <relativepath/> </parent> <dependencies> <dependency> <groupid>org.springframework.boot</groupid> <artifactid>spring-boot-starter-actuator</artifactid> <scope>provided</scope> </dependency> <dependency> <groupid>org.springframework.boot</groupid> <

performance - Most efficient Javascript way to check if an object within an unknown object exists -

this question has answer here: javascript test existence of nested object key 41 answers this come against quite in javascript. let's have object this: var acquaintances = { types: { friends: { billy: 6, jascinta: 44, john: 91 others: ["matt", "phil", "jenny", "anna"] }, coworkers: { matt: 1 } } } in theoretical program, know sure acquaintances object; have no idea whether acquaintances.types has been set, or whether friends has been set within it. how can efficiently check whether acquaintances.types.friends.others exists? what is: if(acquaintances.types){ if(aquaintances.types.friends){ if(acquaintances.types.friends.others){ // stuff "others" array here } } } aside being laborious, these nested if sta

google apps script - JavaScript: If statement not working inside Loop -

i'm writing following code (a test of now) using google scripts pass data 1 spreadsheet another. passing of code working fine, second loop – intend use detect duplicate values , avoid passing rows on – not working. checking logs see though "i" , "j" values correctly being passed inside if block, "if(sheetsidhome[i] == sheetsidtarget[j])" statement never triggering, when confirm both values same. appreciated, thank in advance! function move(){ var homebook = spreadsheetapp.getactivespreadsheet(); var sheet = homebook.getsheets()[0];//sheet home data stored var limit = sheet.getlastrow(); //number of rows content in them var evento = sheet.getrange(2, 1, limit-1).getvalues(); //even titles array var descript = sheet.getrange(2,2,limit-1).getvalues(); //event descriptions array var tags = sheet.getrange(2,3,limit-1).getvalues(); //tags array var sheetsidhome = sheet.getrange(2,4,limit-1).getvalues(); //id's array var targetbo

json - With Go (golang) how can I Unmarshal data into a struct, and then call specific fields from the struct? -

i'm trying api request information steams public api (this learning go , learning how deal json / api requests) have gotten code far: package main import ( "encoding/json" "fmt" "io/ioutil" "net/http" "strconv" ) type steamapi struct { apikey string } type getappnews struct { appnews struct { appid int `json:"appid"` newsitems []struct { gid int `json:"gid"` title string `json:"title"` url string `json:"url"` isexternalurl bool `json:"is_external_url"` author string `json:"author"` contents string `json:"contents"` feedlabel string `json:"feedlabel"` date int `json:"date"` } `json:"newsitems"` } `json:"appne

ios - sorting entity in coredata to textView? -

i @ loss, i'm using core data record guests @ event; working fine guest entity, , 3 attributes, lastname, name , zipcode. in order show user guests displaying guests in non editable textview, want display guests in alphabetical order in textview since listed order of time entered app. here code pausing problem : - (void)viewdidload { [self drawtext]; [super viewdidload]; appdelegate *appdelegate = (appdelegate*)[[uiapplication sharedapplication] delegate]; nsfetchrequest *request = [[nsfetchrequest alloc]init]; nsentitydescription *entity = [nsentitydescription entityforname:@"guest" inmanagedobjectcontext:appdelegate.managedobjectcontext]; [request setentity:entity]; nsmanagedobjectcontext *context = [appdelegate managedobjectcontext]; nserror *error; nsarray *fetchedobjects = [context executefetchrequest:request error:&error]; nsstring*gueststring =@""; for(nsmanagedobject *obj in fetchedobjects) { gueststring =[gueststring stringbyappending