Posts

Showing posts from February, 2012

python - regex, how to exlude search in match -

might bit messy title, question simple. got in python: string = "start;some;text;goes;here;end" the start; , end; word @ same position in string. want second word some in case. did: import re string = "start;some;text;goes;here;end" word = re.findall("start;.+?;" string) in example, there might few things modify make more appropriate, in actual code, best way. however, string start;some; , search characters included in output. index both ; , , extract middle part, there have way actual word, , not junk too? no need regex in opinion, need capture group here. word = re.findall("start;(.+?);", string) another improvement i'd suggest not using . . rather more specific, , looking else ; , delimiter. so i'd this: word = re.findall("start;([^;]+);", string)

Which version of the Bower package name should be used when installing with bower-rails -

some package names, e.g. fitvids use camelcased spelling github repository, yet when search bower repository them, e.g http://bower.io/search/?q=fitvids , returns lower case name. it has been experience if install wrong name, can end subtle bugs, e.g. fitvids loads in development not precompile on heroku which name should use when installing bower-rails? i think correct way use registered name component, lower cased fitvids example. also, see related thread on github

How to generate kernel dump by using Windbg? -

how generate kernel dump using windbg? if i'm using command, can generate kernel dump? .dump /f or have use .crash kernel dump? yes, .dump /f generates kernel dump when you're in kernel debugging mode. it'll not create kernel dump when you're debugging in user mode. .crash however, crash system, i.e. cause bsod (blue screen of death), not guaranteed generate kernel dump, not full memory kernel dump. there conditions .crash work: bsod crash dumps must configured, if want full ram the system must have page file the page file must large enough keep ram + bit of overhead the page file must on system partiion there must enough free disk space copy dump page file disk during next startup a similar effect can achieved sysinternals notmyfault /crash , suffers under same conditions. so, more reliable way .dump . as mentioned sean cline before, can use sysinternals livekd -o , perhaps -m switch generate kernel dump. there other options

javascript - Ajax function stops automatically working after a "Failed to load resources" error -

i'm using ajax update info in page. used $.when $.then functions identify when call on , should activate timer. the issue here when call gets "failed load resources" error (no matter 1 of them), stop working @ middle of execution, , without resetting timer. this code: function updatecodgw() { if(codgw_running == false && session_ended == false) { codgw_running = true; $.when($.ajax({ url: 'the_url', data: {ajax: 'gwonline'}, type: 'post', datatype:'json', success: function(sinfo) { if(sinfo.session !== false) { session_id = sinfo.session; var gwstatus = $(codgwid); sinfo.isonline ? codgw_offline = 0 : ++codgw_offline; if(!sinfo.error && sinfo.isonlinestr !== codgw_old && (sinfo.isonline || codgw_offline >= 3))

css - I can't seem to get my static files to load using Django -

i can't seem life of me static files work... i've been reading documentation here: https://docs.djangoproject.com/en/1.8/ref/settings/#static-root and i've come conclusion need following settings static_root static_url staticfiles_dir i believe static_root if want use ./manage.py collectstatic , have them in 1 folder deployment, don't need that currently static_url static_url = '/static/' and i'm not sure staticfiles_dirs should set to. i've literally tried every single combination can think of. staticfiles_dirs = ( "e:\pyprojects\elsablog\static" ) i have hardcoded , still doesn't work! elsablog blog static blog elsablog static*** i'd put files static*** folder not static folder in blog app. (my bootstrap, js, css, want able access globally) here index.html {% extends "base.html" %} {% block content %} <script src=/static/js/test.js"%

How to get the fields of Abstract class in sub class (CORE JAVA) -

this abstract class i can't print fields inside abstract class display method in subclass public abstract class account { private int cusid; private int cusaccountid; private string cusname; account(int cusid, int cusaccountid,string cusname){ this.cusid=cusid; this.cusname=cusname; this.cusaccountid=cusaccountid; } public int getcusid() { return cusid; } public int getcusaccountid() { return cusaccountid; } public string getcusname() { return cusname; } abstract public void display(); } i extend abstract class(account) (savings class) public class savings extends account{ private int savid; private string savbranch; savings(int cusid, int cusaccountid,string cusname,int savid, string savbranch) { super(cusid,cusaccountid,cusname); this.savid= savid; this.savbranch=savbranch; } @override public v

Does ArangoDB "know" what attributes exist in a collection? (shapes data) -

there's recipe how sample documents , determine structure: https://docs.arangodb.com/cookbook/accessingshapesdata.html it stated, can't query internal shapes data. examining documents approximate attribute keys used, or entire collection must scanned. so question is: database store attributes exist somewhere internally? @ least common attributes? if yes, why isn't possible query data? far more efficient user-defined function outputs same information. it great if 1 discover schemes "for free": http://som-research.uoc.edu/tools/jsondiscoverer/#/ whenever attribute used first in collection, arangodb store somewhere internally. means keep track of attributes used in collection. there few issues however: the attribute names stored globally, nested attribute names stored separately (ex: user.name stored user , name ). looking @ purely separate attribute name parts, arangodb not know in combinations used in data attribute names stored wheneve

oracle - SQL Tree Structure -

Image
i new topic (i.e tree structure) in sql. have gone through different sources still not clear. here in case, have table have attached herewith. now here first, have retrieve full tree “office”. also have find leaf nodes (those no children) in attached hierarchical data. please provide answers detail explanation. in advance. you didn't specify dbms standard sql (supported modern dbms ) can recursive query full tree: with recursive full_tree ( select id, name, parent, 1 level departments parent null union select c.id, c.name, c.parent, p.level + 1 departments c join full_tree p on c.parent = p.id ) select * full_tree; if need sub-tree, change starting condition in common table expression. e.g. "categories": with recursive all_categories ( select id, name, parent, 1 level departments id = 2 --- << start different node union select c.id, c.name, c.parent, p.level + 1 departments c join all_categories p on c

python - Control Matplotlib legend box width for wrapping -

Image
i trying fix width of legend box in matplotlib (python 2.7). here simple example of code using: import numpy np import pylab plt fig = plt.figure(figsize=(8.5, 8.5)) ax = fig.add_axes([0.0882, 0.0588, 0.8882, 0.9118]) x = np.array([0,1,2,33]) y = np.array([0.1,2,4,8]) z = np.array([0,1,3.7,7]) t = np.array([0.5,1,12,41]) v = np.array([0.9,7,24,54]) = np.array([0.2,11,17,61]) q = np.array([0.4,17,15,80]) r = np.array([0.9,3.7,18,44]) s = np.array([0.2,10,19,31]) y1 = y+1 z1 = z+1 t1 = t+1 v1 = v+1 a1 = a+1 q1 = q+1 r1 = r+1 s1 = s+1 ax.plot(x,y,label='y') ax.plot(x,z,label='z') ax.plot(x,t,label='t') ax.plot(x,v,label='v') ax.plot(x,a,label='a') ax.plot(x,y1,label='y1') ax.plot(x,z1,label='z1') ax.plot(x,t1,label='t1') ax.plot(x,v1,label='v1') ax.plot(x,a1,label='a1') ax.plot(x,q1,label='q1') ax.plot(x,r1,label='r1') ax.plot(x,s1,label='s1') lg = ax.legend(loc='upper cen

Android Studio layout management problems -

i'm new android studio... i've been trying make simple app. when want put 2 linear layouts in one, 1 of them goes out of frame! don't know if i'm doing right or not. here pictures (the second 1 problem): 1) http://i.imgur.com/2h1hoxk.jpg 2) http://i.imgur.com/5iezhsc.jpg thanks from pictures, parent linear layout contains other 2 linear layouts has orientation set "horizontal". must set "vertical" above each other... in parent linear layout, find this: android:orientation="horizontal" change to: android:orientation="vertical"

Dropping columns/variables based on count of missing in Stata -

i have large dataset looks 1 below. drop variables (not observations/rows) have less 3 observations in rows. in case variable x1 needs dropped. i apologise if asking obvious, however, @ point not have clue on how proceed this. +-----+-----+-----+-----+-----+ | id | x1 | x2 | x3 | x4 | +-----+-----+-----+-----+-----+ | 1 | . | 1 | 1 | 2 | | 2 | . | 2 | 2 | 3 | | 3 | . | 3 | 1 | . | | 4 | 1 | . | 3 | 1 | | 5 | . | 2 | 4 | 3 | | 6 | 2 | 3 | . | . | |total| 2 | 5 | 5 | 4 | +-----+-----+-----+-----+-----+ my interpretation want drop variables have @ least 3 missing values. you can use nmissing , ssc ( ssc install nmissing ): clear set more off input /// x y z . . 5 . 6 8 4 . 9 . . 1 5 . . end list nmissing, min(3) drop `r(varlist)' if interpretation incorrect, check help nmissing , npresent . syntax flexible enough. edit a re-interpretation. want drop variabl

eclipse - Deploy Java EE application as root context on WildFly -

i'm using eclipse mars ide + jboss (wildfly 9.0.1). launch server , ok. know how set applicatioin root context?. run application have do: http://localhost:8080/demoapp , wanna do: http://localhost:8080/ below have fragment of code of file: standalone.xml . modified can see below get: 403 - forbidden when going to: http://localhost:8080/ . remember wildfly server launched eclipse debugger because i'm on development mode. ... <subsystem xmlns="urn:jboss:domain:undertow:2.0"> <buffer-cache name="default" /> <server name="default-server"> <http-listener name="default" socket-binding="http" redirect-socket="https" /> <host name="default-host" alias="localhost"> <location name="/" handler="demoapp" /> <filter-ref name="server-header" /> <filter-ref nam

java - check number of maximum and minimum element in a array -

i trying check whether given array has equal number of maximum , minimum array element. if number equal should return 1 else return 0. instead of return zero. could please me? public class maxminequal { public static void main(string[] args) { system.out.println(maxminequal.ismaxminequal(new int[]{11, 4, 9, 11, 8, 5, 4, 10})); system.out.println(maxminequal.ismaxminequal(new int[]{11, 11, 4, 9, 11, 8, 5, 4, 10})); } public static int ismaxminequal(int[] a) { int maxcount = 0; int mincount = 0; int largest = a[0]; (int = 0; < a.length; i++) { if (a[i] > largest) { largest = a[i]; } if (a[i] == largest) { maxcount = maxcount + 1; } } int smallest = a[0]; (int j = 0; j < a.length; j++) { if (a[j] < smallest) { smallest = a[j]; } if (a[j] == smallest) { mincount = mincount + 1; } } if (maxcount == mincount)

c++ - Unable to have different icons for taskbar and window bar? -

Image
i have 2 icons (.ico files). big 32x32 1 , small 16x16. i'm trying set hicon of wndclassex big one, , hiconsm smaller one. yet cannot life of me figure out how that! first tried loadicon : wndclass.hicon = loadicon(instance, makeintresource(idi_skeleton)); wndclass.hiconsm = loadicon(instance, makeintresource(idi_skeleton_sm)); it loads same icon both top window bar , taskbar. same thing loadimage . here's codes: resource.h #define idi_skeleton 1000 #define idi_skeleton_sm 1001 skeleton.rc #include "resource.h" idi_skeleton icon "skeleton.ico" idi_skeleton_sm icon "skeleton_sm.ico" winmain.cpp #include <windows.h> #include "resource.h" lresult callback handleevent(hwnd window, uint message, wparam wparam, lparam lparam) { switch(message) { case wm_paint: { paintstruct ps; hdc dc; rect rect;

module - Surprising behavior of transparent signature ascription -

i want define own abstract type 'a foo , that, 'a ref , eqtype if 'a isn't. example: lolcathost% poly poly/ml 5.5.2 release > signature foo = # sig # eqtype 'a foo # val bar : real foo # val qux : real foo # end; signature foo = sig val bar : real foo type 'a foo val qux : real foo end > structure foo : foo = # struct # datatype 'a wat = wat of 'a # type 'a foo = 'a wat ref # val bar = ref (wat 0.0) # val qux = ref (wat 0.0) # end; structure foo : foo > foo.bar = foo.qux; val = false: bool so far, good! now: > !foo.bar; val = wat 0.0: real wat > !foo.qux; val = wat 0.0: real wat wait. isn't wat supposed hidden? why seeing values of type real wat ? isn't wat supposed hidden? it's "hidden" in sense code cannot refer it; since human aware of it, there's no reason repl evasive it. why seeing values of type real wat ? why not? identifier wat not in scope, ty

database - django not nullable error on model field containing null-True -

so have user can post comments on effects, im linking models , keep getting non-nullable error no matter ive tried. says needs have null=true. isn't working lol. not seeing here? this official error: django.db.utils.integrityerror: not null constraint failed: effect_modules_comment__new.author_id and models: class effect_module(models.model): created_at = models.datetimefield(auto_now_add=true) title = models.charfield(max_length=255) description = models.textfield() html = models.textfield(default='') css = models.textfield(default='') js = models.textfield(default='') up_votes = models.integerfield() down_votes = models.integerfield() effect_author = models.manytomanyfield('userprofile') class userprofile(models.model): user = models.onetoonefield(user) effects = models.manytomanyfield(effect_module) class comment(models.model): comment_author = models.foreignkey(user, null=true)

Scala: Get value of child from parent? -

trying values of fields of child parent class this: (field <- this.getclass.getdeclaredfields) { logger.debug(field.getname) field.get(this) } and got error exception: class models.model$$anonfun$4 can not access member of class models.good modifiers "private" @ line field.get(this) in class don't have private fields: class good(id: option[string]) extends model[realgood](id){ lazy val title: string = this.load[string](realobject.get.title) lazy val cost: double = this.load[double](realobject.get.cost) } what's wrong code? as hinted in comments, scala's conversion java bytecode isn't straightforward (though it's pretty predictable, once hang of it). in particular, public fields in scala compile private field public getter in java bytecode: fukaeri:~ dlwh$ cat zzz.scala class good(id: option[string]) { lazy val title: string = ??? lazy val cost: double = ??? } fukaeri:~ dlw

asp.net mvc - One to many with applicationuser -

if dupp, means direct me answer. asp.net, mvc5, ef6 each application user can have many tfsaccountcredentials identitymodel.cs has following: public class applicationuser : identityuser { public virtual icollection<tfsaccountcredentials> tfsaccountcredentials { get; set; } } tfsaccountcredentials.cs has following: public class tfsaccountcredentials { public int id { get; set; } //other properties [foreignkey("applicationuserid")] public virtual applicationuser applicationuser { get; set; } public string applicationuserid { get; set; } } tfsaccountcredentialsdb has following: public class tfsaccountcredentialsdb : dbcontext { public tfsaccountcredentialsdb() : base("defaultconnection") { } public dbset<tfsaccountcredentials> tfsaccountcredentials { get; set; } protected override void onmodelcreating(dbmodelbuilder modelbuilder) { base.onmodelcreating(modelbuilder);

c++ - Xcode hangs on "linking" only on release mode -

i building c++ project created juce iphone, using xcode 6.4. for reason hangs on linking stage when trying run on device. device jailbroken iphone 3 running ios 7.1. debug builds run fine on device need test release builds (debug builds run slow). i using ad hoc code signing. i followed tutorial here: https://angelxwind.net/?page/how2asu

android - How to set onclicklistener to Drawable on canvas? -

i not have imageview,i have drwable , draw on canvas this: drawable.draw(canvas); how can set onclicklistener drawable ? use project : https://code.google.com/p/android-multitouch-controller/ (i want use on click listener because want remove drawable on canvas) in advance. a drawable not have facility receive events or otherwise interact user. it's visual response far android os concerned , used fetched resource. you might better off creating view . override ondraw(android.graphics.canvas) but if must, consider getbounds in endeavours.

Why am I getting this error in Python using the requests and json modules? -

i've been trying process couple thousand requests in python , write them json file. reason whenever run code, following error: file "c:\program files (x86)\wing ide 101 5.1\src\debug\tserver\_sandbox.py", line 133, in <module> file "c:\program files (x86)\wing ide 101 5.1\src\debug\tserver\_sandbox.py", line 44, in main file "e:\python programs\api challenge aug 2015\api challenge files\execute requests files\riotapi.py", line 112, in get_match_by_matchid return self._request(api_url, region) file "e:\python programs\api challenge aug 2015\api challenge files\execute requests files\riotapi.py", line 58, in _request return response.json() file "c:\python\lib\site-packages\requests\models.py", line 819, in json return json.loads(self.text, **kwargs) file "c:\python\lib\json\__init__.py", line 318, in loads return _default_decoder.decode(s) file "c:\python\lib\json\decoder.py", line 343, in decode o

layout - Code completion not working in Android Studio -

i have updated android studio , code completion (which working earlier in previous version) not working. when shortkey ctrl+space pressed shows: https://goo.gl/tkpy50 (image link) i have tried invalidating cache , restarting android studio, mentioned in post. can point missing here? thanks in advance. check if power save mode on file menu enabled accidentally. also check in file > settings > editor > inspections : android android lint in file > settings > editor > general > code completion : autopopup code completion should checked

ios - Duplicate interface definition error for class 'AppDelegate' and Property has a previous declaration error when using swiftvalidator -

im trying implement uitextfield validation in swift app using cocoapods framework swiftvalidator , im getting odd errors 1 of swiftvalidator delegate methods i added swift validator podfile podfile looks follows platform :ios, '8.0' use_frameworks! pod 'fbsdkcorekit' pod 'fbsdkloginkit' pod 'swiftvalidator', '2.1.1' i imported swiftvalidator loginviewcontroller (which subclass of uiviewcontroller) declaring import swiftvalidator my class declared as class loginviewcontroller: uiviewcontroller, uialertviewdelegate, uitextfielddelegate, validationdelegate { i initialised let validator = validator() @ top level of class i added validator.registerfield(emailfield, errorlabel: emailerrorlabel, rules: [requiredrule(), emailrule()]) viewdidload i added skeleton of validationsuccessful delegate method follows func validationsuccessful() { // submit form println("validation success") } but when add other delegate method i

mysqli - Unable to insert into Mysql db from PHP -

the following code generating integer value in variable $insertstatement, insert statement failing have tried long time couldn't figure out reason issue appreciated :) <?php $con=mysqli_connect("localhost","root","","loadtest"); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } if( $_get["value"] != null || $_get["value"]!="" ) { $rand=uniqid(); $insertstatement=""; date("m-d-y"); for($i=0;$i<$_get["value"];$i++){ $insertstatement +="insert test values('"+$date+"','"+$rand+"','column1','column2','column3','column4','column5','column6','column7','column8','column9','column10');"; } echo $insertstatement; mysqli_query($con,$insertstatement)or die("cann

jquery - Is there a way to get the Spectrum Color Picker to out put HEX and not RGB? -

i using bgrins jquery spectrum color picker in vs 2013 project. color picker's out when reading submitted form rgb in project required store color chosen hex string. there way color picker output hex string? try this: var t = $('#colorpickerid').spectrum("get"); console.log(t.tohexstring());

android - JSoup Elements removes duplicates automatically -

this weird problem don't understand why occur. but, doing following: elements fullcoursespaces = fullcourses.select("span[class=note-red]"); //get course times removes duplicates. returns 2 unique elements, since rest of elements duplicates of these unique elements, removed. when instead, should fill elements list duplicates regardless. there reason why happening? edit: side note, doing document.queryselectorall("span[class=note-red]"); on webpage gives me elements regardless if duplicates or not.

javascript - Bootstrap affix-top div overlapping footer -

i have basic bootstrap webpage fixed-top navbar, banner, standard layout body content , footer height of 502px. with data-offset-top="350" attribute added, sidebar overlaps footer when reach end of page. so in order prevent that, added offset-bottom attribute specify fixing div 502px bottom once page reaches footer. for sidebar, added proper affix attributes follows: <div class="sidebar" data-spy="affix" data-offset-top="350" data-offset-bottom="502"> <--sidebar content--> </div> and css, added this: .affix-bottom { position:absolute; } .sidebar.affix { position: fixed; top:52px; } but moment scrolled past banner, sidebar disappear screen leaving white gap on side. this first time i'm using both affix-top , affix-bottom on same element think might going @ wrong way. can please me out this? link demo page i'm working on: http://demo.shillongtitude.c

xcode - iOS/Swift/Storyboard: Add PageViewController using only *part* of screen? -

Image
new swift. i've seen many tutorials on using pageviewcontroller, have page view taking whole screen. i'm trying implement page view functionality in part of app, not entire screen, other "static" elements (e.g. toolbar) can remain. kinda this... https://imgur.com/9wm1vll --- (need more rep. before embedding images) ...where swiping cause different images appear seen in various pageviewcontroller tutorials (e.g. http://www.appcoda.com/uipageviewcontroller-storyboard-tutorial/ ). when start single view application, go storyboard , try drag "page view controller" object library viewcontroller frame, "bounces back", i.e. won't let me add page view controller. now, if add page view controller white space around other view controller, gets tutorials pageviewcontroller takes entire screen , don't want that. how 1 achieve this? thanks. sorry if dupe have tried & failed find answers question directly. closest implemen

c - Holtek Semiconductor's HT67F50 segment display driver interrupt definition -

i'm trying write interrupt routine ht-ide3000 when write code inside routine linker giving error ram bank0 overflow. i'm using holtek c compiler v3 , user guide says interrupt vector definition must void __attribute((interrupt(0x24))) tim0_isr(){} instead of old version #pragma vector tim_isr @0x24 says "the variables can accessed both interrupt service routine , other functions defined volatile" @ page 34 of holtek c compiler v3 user's guide, code is; #include "ht67f50.h" typedef struct { /*volatile*/ uint8_t time2msflag:1; /*volatile*/ uint8_t t500msflag:1; /*volatile*/ uint8_t t1sflag:1; /*volatile*/ uint8_t poweronflag:1; const /*volatile*/ uint8_t reserved:4; }flag_t; volatile uint8_t time2ms; volatile uint8_t t500ms; volatile uint8_t t1s; volatile uint16_t time1s_dis; volatile flag_t flag; void __attribute((interrupt(0x24))) tim_isr(void) { //_t0af = 0; //if (++time2ms >= 2) //{ //time2ms = 0;

java - Accessing variables in MainActivity from AsynTask job -

my app fetching data api , adding arraylist<string> parse , show user in ui. made arraylist static access mainactivity.arraylist.add(link); told static variables evil , should not use them, if used setter , getter has static access class. thinking if sending need modify asynctask return doinbackground onpostexecute results think it's not best way it. there way that? the best practice , preferred way access activity's variables asynctask is, accessing them @ onprogressupdate , onpostexecute methods. because activities, onprogressupdate , onpostexecute runs on ui thread doinbackground method runs on separate thread. , accessing variable separate thread can painful. static variable definition must designed because instances of class, uses same static variable instance. you should better add callback interface asynctask handle result. let me give example; i've copied below asynctask google's site . , modified adding interface: private stat

javascript - Implementing merge sort iteratively -

i'm trying implement merge sort in order better understanding of how works. in following code attempting sort array of numbers. code have buggy , runs in infinite loop. i'm trying solve non-recursively now: function mergesort(arr) { var mid = math.floor(arr.length/2); var left = arr.slice(0, mid); var right = arr.slice(mid, arr.length); if (arr.length === 1) {return arr}; var sorted = []; var = 0; while (left.length || right.length) { if (left.length && right.length) { if (left[0] < right[0]) { sorted.push(left.shift()) } else { sorted.push(right.shift()) } } else if (left) { sorted.push(left.shift()) } else { sorted.push(right.shift()) } i++; } return sorted; } so if have array var nums = [1, 4, 10, 2, 9, 3]; calling mergesort(nums) should return [1, 2, 3, 4, 9, 10] . you've written code splits array in 2 , merges halves. doesn't result in sorted array because

c++ - How to Send Cap'n Proto Message over ZMQ -

the example way send messages using cap'n proto needs file descriptor write to: ::capnp::writemessagetofd(fd, message); but in zmq message needs passed zmq function: zmq_send(requester, "hello", 5, 0); http://zguide.zeromq.org/page:all how can incompatibility resolved? two possibilities: use capnp::messagetoflatarray() message single flat array. note requires making copy of message contents. send message zeromq multi-part message, parts being message's segments. capnp::messagebuilder::getsegmentsforoutput() returns array of arrays pointing raw message segments. capnp::segmentarraymessagereader takes such array of arrays input. if can send array of arrays multipart message, can skip using capnp/serialize.h @ all, since purpose combine segments single message segment table. in case, zeromq in charge of remembering each segment starts , ends. i recommend #2, more complicated.

ios - call back methods with closure? -

this specific question got treehouse part one: we're writing app fetch recent blog posts treehouse blog. requires making network request using asynchronous methods execute in background. need closure. create method called fetchtreehouseblogposts, has single parameter - completion handler. closure has 3 parameters: data object containing results of request type nsdata!, http response object our request type nsurlresponse!, error object type nserror!, , return type of void. /////////////i part , code correct following: typealias blogpostcompletion = ((nsdata!, nsurlresponse!, nserror!) -> void) func fetchtreehouseblogposts(completion: blogpostcompletion){} ///////////this part cant right. please copy paste following code inside body of method: let blogurl = nsurl(string: "http://blog.teamtreehouse.com/api/") let requesturl = nsurl(string: "get_recent_summary/?count=20", relativetourl: blogurl) let request = nsurlrequest(url: requesturl!) let

android - Store encrypted data in Ionic/Cordova app -

i wanted know of way can store encrypted data cordova apps?(common solution both android , ios if possible) it's mentioned on official cordova documentation there nothing encrypted storage feature right now. options have right now? i have looked pouchdb , couchdb options. yet figure out encryption part these databases. have taken @ crypto-pouch ?

linux - How to insert a column with serial number in shell? -

i have file 4 colums. ifile.txt 2 3 4 2 2 3 4 1 4 3 4 3 4 5 3 5 . . . . i need insert column serial number like: ofile.txt 1 2 3 4 2 2 2 3 4 1 3 4 3 4 3 4 4 5 3 5 5 . . . . . . . . . i trying using awk , unsuccessful awk '{print i, $1, $2, $3, $4}' ifile.txt > ofile.txt you can use built-in nr 1-based record counter. awk '{print nr, $1, $2, $3, $4}' ifile.txt > ofile.txt the general-purpose form is: awk '{print nr, $0}' that print out entire record (prefixed sequence number), regardless of how many fields there are.

php - LIKE statement passes wrong character in excel -

my idea search query after click image button redirect query excel code here code image button $expquery = select * reginformation name '%da%' , deleted = 0; //this example query <a id="exportbutton" style="margin-left:5px;" href="reglisttoexcel.php?query=<?php echo $expquery ?> " ><img src="images/export_to_excel.png" style="margin-left:0px; width:5%" title='download list'></a> the code reglisttoexcel.php <?php header('content-type: application/excel'); header('content-disposition: attachment; filename="eventregistrationlogs('.date("y-m-d").').xls"'); ?> <html> <table border=2> <tr> <th>registration id</th><th>name</th><th>gender</th><th>age</th><th>birthdate</th><th>address</th> <th>email address</th>

html - How to apply box-shadow on select tag on UIWebView? -

Image
i want apply shadow-box on select tag on uiwebview. it's not attached shadow-box on uiwebview, though use shadow-box tag. if use '-webkit-appearance: none' css, can attached shadow-box on uiwebview. shape of select tag removed. in image, left on uiwebview , right on chrome. both use shadow-box css below. when don't use '-webkit-appearance:none', shadow-box not shown on uiwebview. -webkit-box-shadow: 0px 0px 3px 3px rgba(255,0,0,0.8); -moz-box-shadow: 0px 0px 3px 3px rgba(255,0,0,0.8); box-shadow: 0px 0px 3px 3px rgba(255,0,0,0.8); i want use select tag chrome on uiwebview.

is it possible to make an Excel drop down list with word used as a term by Excel.? -

i make drop down list based on cell contains true or false what if cell value true (cell t1) show list , if cell value false show cell value i'm pretty aware true , false cannot used cell name cannot apply indirect function how can approach issue ? thank a solution suggest use condition on validation range - , not on cell in question. for example if had true/false in a1 use: =if($a$1=true,"a","b") for each of intended conditions. if didn't want different list value, use #n/a or blank, or point cell reference then point data validation list function @ range. change condition changes

Sample code for list/detail Android Activities -

my understanding best practices simple app list , detail activities startactivityforresult() . let's have app model product (id, name, price) , productlistactivity , productdetailactivity . i having hard time understanding of activities contain startactivityforresult() , have setresult() , result be. my understanding best practices simple app list , detail >activities startactivityforresult(). i not agree statement. in opinion, best way set [onlistitemclicklistener]( http://developer.android.com/reference/android/app/listactivity.html#onlistitemclick(android.widget.listview , android.view.view, int, long)) in productlistactivity. when item in list clicked, onlistitemclick() method called, arguments you'll able figure out item in list clicked (for example using second argument - position , position of clicked item in list, starting zero). once figure out item clicked, you'll create intent , put required extras in there (for example position

php - Reroute with extra parameter for multi language sites in Codeigniter -

This summary is not available. Please click here to view the post.

html - Bootstrap container too wide -

quite simple problem; bootstrap container inside navbar wide, causing horizontal scrollbar expands body. the page in question can found here , theme it's built on this one. what baffles me css both seems equal , computed values chrome dev tools return same. awesome if able find issue. found answer: .row no .container around caused it

dnx is not recognize to run asp.net 5 application -

try run asp.net 5 application through command prompt using command c:\asp.net5app\src\asp.net5>dnx .web error message getting. 'dnx' not recognized internal or external command, operable program or batch file. run dnvm upgrade . if dnvm not recognized, follow instructions on home repo install it, previous step.

mysql - SQL query to compare tables and only return differnces -

so have 2 tables. first table "raw" table, , houses original record when submitted (so never changes, gets additional records). have table has "updated" data (so has same number of records, same columns, values may different). i want run sql query compare 2 tables. output, want new table lists pk of row had changed value. want return new value. my end goal able "within column a, had x amount of changes. of changes column a, value updated fill_in_the_blank." if use basic query: (select * [test database].dbo.[raw data] except select * [test database second].dbo.[clean data] union select * [test database second].dbo.[clean data] except select * [test database].dbo.[raw data]) i rows have different fields, don't know value/column changed. any thoughts? thanks!

ios - Making UITextfield accessible in a Customised UITableViewCell -

Image
i have uitextfield subview of uitableviewcell. have customised uitableviewcell, define uitextfield property. in customised class, override uiaccessibilitycontainer protocol methods. however unable set textfields in test script. may because uiatablecell recognises its' children uiaelements , not uiatextfields. unable perform use element receiver method setvalue. it seems trait setting modulates how uiatablecell recognises its' children. apple docs, uitextfield best described having either uiaccessibilitytraitallowsdirectinteraction or uiaccessibilitytraitadjustable. neither of these help. as far can tell, have set visibility hierachy correctly. [self.contentview addsubview:self.atextfield]; (uiview *eachview in self.subviews) { [eachview setisaccessibilityelement:no]; } [ self.atextfield setisaccessibilityelement:yes]; [ self.atextfield setaccessibilitylabel:@"textfieldoncell"]; [self.contentview setaccessibilityelements

random - How to randomly select 7 letters(a to z ) in java -

i want select 7 random letters z so far have found ways select single letter https://stackoverflow.com/a/5202888/3209901 random r = new random(); char c = (char) (r.nextint(26) + 'a'); why 7 letters because , need apply conditions 7 letters - check words formed 7 letters , word length should minimum of 4 letters ...... here's java-8 solution: new random().ints('a', 'z'+1).distinct() .limit(7).foreach(ch -> system.out.println((char)ch));

highcharts - Rails and High Charts - can't render the maps at all -

Image
i having problems getting off ground highcharts maps. i followed rails installation. gemfile gem "highcharts-rails", "~> 3.0.0" application.js //= require highcharts //= require highcharts/highcharts-more //= require highcharts/modules/data //= require highcharts/modules/map in page <div id="container" style="height: 500px; min-width: 310px; max-width: 600px; margin: 0 auto"></div> <script> $(function () { // prepare demo data var data = [{ 'hc-key': 'us', value: 3 }, { 'hc-key': 'ca', value: 5 }, { 'hc-key': 'mx', value: 20 }]; // initiate chart $('#container').highcharts('map', { title: { text: 'showing non-null areas' }, subtitle: { text: 'the <em>allareas</em> option fals

java - RecyclerView with ToolBar -

i'm new material design , every time try use recyclerview every thing gose wrong.. can 1 know problem ? main activity class import android.support.v7.app.actionbaractivity; import android.os.bundle; import android.support.v7.widget.toolbar; import android.view.menu; import android.view.menuitem; public class mainactivity extends actionbaractivity { toolbar toolbar; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); toolbar= (toolbar) findviewbyid(r.id.toool); setsupportactionbar(toolbar); } @override public boolean oncreateoptionsmenu(menu menu) { // inflate menu; adds items action bar if present. getmenuinflater().inflate(r.menu.menu_main, menu); return true; } @override public boolean onoptionsitemselected(menuitem item) { // handle action bar item clicks here. action bar

Why does PHP need the use operator for closures? -

i know what use operator doing in function($x,$y) use ($z) { ... what don't understand why php uses construction when other languages don't? javascript has rather loose variable scoping (you don't need declare variables global). php has tighter variable scoping (if variable isn't defined within scope it's used, , isn't brought in global , doesn't exist). the use declaration tells php make variables available within closure (and tells garbage collector not clean them until after closure gets cleaned up).

How to do a JOIN in Oracle SQL? -

i have 2 tables users , user_org . users ( user_id,first name,last name, active_ind, email) user_org (user_id, org_id) i have write oracle sql query, should return users active_ind 1 , org_id of associated user in user_org match given org_id. i have tried below, not working select * users u join user_org org org.organization_id = 12345 , active_ind != 0; you missing on clause of join . other that, if want users active_ind of 1 , i'd state directly equality check ( = ) instead of dancing around inequality check. select u.* users u join user_org org on u.user_id = org.user_id org.org_id = 12345 , active_ind = 1

java - Why session.refresh(Object, LockMode.UPGRADE) is deprecated in hibernate? -

my requirement: i using quartz cron triggering purpose, many triggers running on same row base on different column. when trigger need update related column. trigger first refresh( session.refresh(object) ) object belong it(object selected @ starting of trigger) database , take upgrade lock @ row level. if success on getting lock update column , use session.update(object) update in db. , release lock. what alternative of session.refresh(object, lockmode.upgrade) , efficient way avoid dirty update using hibernate ? why deprecated in hibernate ? what alternative of session.refresh(object, lockmode.upgrade) , efficient way avoid dirty update using hibernate ? right there in the documentation : deprecated . lockmode parameter should replaced lockoptions e.g., use refresh(object,lockoptions) . it doesn't why , it's clear instead. (and there lockoptions.update .)