Posts

Showing posts from May, 2014

sharedpreferences - how can i store my player's Playlist in Android programmatically -

i building music player , want store playlist after app closed , retrieve when app started. able playlist in array list. please help.. to save when app closed override onpause method inside activity or fragment save playlist arraylist maybe in sqlite database, file or sharedpreference. retrieve write code in oncreate method can retrieve saved data. i didn't deal sqlite here sharedpreference code if wanna class playlist { private final string filename = "myplaylist"; private sharedpreferences myplaylist; private sharedpreferences.editor myeditor; playlist() { myplaylist = getsharedpreferences(filename, 0); myeditor = myplaylist.edit(); } public void save(arraylist<string> mysongs){ // save size can retrieve whole list later myeditor.putint("listsize", mysongs.size()); for(int = 0; < mysongs.size(); i++){ // save each song index in list key myeditor

python - Unable to scrape news headings from Hacker news -

i want scrape top news article's headline , link hacker news. here code: import scrapy scrapy.contrib.linkextractors.sgml import sgmllinkextractor class hnitem(scrapy.item): title=scrapy.field() link=scrapy.field() class hnspider(scrapy.spider): name="hn" allowed_domains=["https://news.ycombinator.com"] start_urls=["https://news.ycombinator.com/"] def parse(self,response): item=hnitem() item['title'] = response.xpath('//*[@id="hnmain"]/tbody/tr[3]/td/table/tbody/tr[1]/td[3]/a/text()').extract() item['link'] = response.xpath('//*[@id="hnmain"]/tbody/tr[3]/td/table/tbody/tr[1]/td[3]/a/@href').extract() print item['title'] print item['link'] but returns empty list. p.s. beginner in python , in scrapy. here ended when tried creating spider: import scrapy class hnitem(scrapy.item): title = scrapy.f

javascript - Rails: Submit html table content in form to controller -

i have trouble rails formular. i have form create "projects". project form <%= bootstrap_form_for(@project) |f| %> ... <div class="container-fluid"> <%= f.static_control label:"vordefinierte aufgaben" %> <div class="actions form-group nopadding"> <div class="center-block"> <%=link_to "", data: {toggle:"modal", target:".newtask-modal"} , class: "btn btn-success center-block btn-sidebar-ok", id: "singlebutton" do%> <i> <span class="glyphicon glyphicon-plus pull-left btn-sidebar-icon"></span>neue aufgabe hinzufügen </i> <% end %> </div> </div> <div class="task-table"> <%=render 'tasks/table'%> </div> <% end %> </div> ... <!-- task modal create new task --> <

asp.net mvc 4 - Update Database command not working in package manager console -

i have made changes in model classes like--- added few new property , drop requirement changes...my old city class have following columns public class city() { public int cityid { get; set;} public string cityname { get; set;} public decimal longitude { get; set;} public decimal latitude { get; set;} } now, have made changes in city class.now contain 2 fields--- public class city() { public int id { get; set;} public string name { get; set;} } now, run simple add-migration command in package manager console--- pm> add-migration ccccxxxx runs then tried update-database command in package manager gave me following error--- pm> update-database multiple identity columns specified table 'cities'. 1 identity column per

rpc call to R function is not responding in case of OpenCPU cloud server, although it is working fine in single user server -

i using opencpu r project web interface. project working fine , i'm able results expected on local machine (single user server). then deployed project on vm , didn't work. on vms r functions working r prompt. single user working , i'm able query using curl. public server hangs-up , time-out after 90 secs other points note: sample projects tvscore , gitstats working fine on cloud server well my project based on rjava. have had trouble setting worked on single user server. i have tried aws ec2 t2.micro. have tried google n1 (1-cpu 3.75 gb) , n2 (2-cpu 7.5 gb) instances. i didn't change in /etc/opencpu/server.conf the error i'm getting on failure: r call did not return within 90 seconds. terminating process. my server.conf { "enable.api.library": true, "enable.api.apps": true, "enable.api.bioc": true, "enable.api.cran": true, "enable.api.gist": true, "enable.api.github

php - Inserting values to another table -

i have check if namesfroma tablea exist in namesfromb tableb using code. select * tablea inner join tableb on(namefroma = namefromb) and able output names exist. want store names exist in both table table named "existed" , column "name". should this. simply use insert ... select statement. insert existed (existed.name) select a.name tablea inner join tableb on(namefroma = namefromb) see official mysql documentatio n more details.

java - A ThreadLocal Supplier? -

if need threadlocal of variable, there need use supplier (also thread-safe)? for example, isn't supplier unnecessary accomplish thread-safety here? private threadlocal<supplier<myclass>> myobject = new threadlocal<supplier<myclass>>(); thanks. your question doesn't show typical way use supplier threadlocal. if want threadlocal of myclass, old (pre-1.8) way typically: threadlocal<myclass> local = new threadlocal<myclass>(); // later if (local.get() == null) { local.put(new myclass()); } myclass myclass = local.get(); the alternative delcare subclass of threadlocal overrode initialvalue method. in 1.8, can instead use supplier handle initialization: threadlocal<myclass> local = threadlocal.withinitial(() -> new myclass()); functionally, these 2 identical, supplier version lot less code write.

actionscript 3 - Time taken by creating objects with JSON values in AS3 -

i have sentence in main.as file: mytweet = new tweet(jsonarray[servicioelegido].url_json); trace(mytweet.lasttweet); this sentence pass string contrusctor url json, showed bellow: package { import flash.display.movieclip; import flash.events.mouseevent; import flash.display.sprite; import flash.events.event; import flash.events.ioerrorevent; import flash.net.urlloader; import flash.net.urlrequest; import flash.display.stagedisplaystate; import com.adobe.serialization.json.json; public class tweet { public var urlmytweet:string; //url ak servicio de los tweets public var numfollowers:int; //num de seguidores public var numfollowed:int; //num de seguidos public var numtweets:int; //num total de tweets public var lasttweet:string; //ultimo tweet. texto public var lasttweetret:int; //retweets del último tweet public var lasttweetfav:int; //favs del último tweet public var las

python - Abstract inheritance from models in third party Django packages -

to abstract model inheritance in django, put class meta: abstract = true in parent model. mean impossible abstractly inherit model not have meta statement? specifically, not possible abstractly inherit model in existing model in third party package (unless change model)? here example clarify asking. let's there django package called djangofoo i've installed in project's installed_apps . in djangofoo.models , let's have from django.db import models class person(models.model): first_name = models.charfield(max_length=10) last_name = models.charfield(max_length=25) i sub-class person in 1 own apps follows from djangofoo.models import person class myperson(person): middle_initial = models.charfield(max_length=1) however, concrete inheritance. possible abstract inheritance? here's fictitious example of kind of magic looking for: from djangofoo.models import person abstractperson = abstractify(person) class myperson(abstractpers

vb.net - Convert c# code to VB -

i using math function. code below.it c# code .please convert vb using ctype(variable,type). tried end in vain itmpwidth = (integer)(math.floor((double)((double)gridcol.width / (double)itotalwidth * (double)itotalwidth * ((double)e.marginbounds.width / (double)itotalwidth)))) please . try one: itmpwidth = directcast(math.floor(cdbl(cdbl(gridcol.width) / cdbl(itotalwidth) * cdbl(itotalwidth) * (cdbl(e.marginbounds.width) / cdbl(itotalwidth)))), [integer]);

Specifying http-proxy when using the boxsdk for Python? -

when running behind firewall, error "getaddrinfo failed" on last line of sample python program. there way specify proxy server client() connection being made through boxsdk? # coding: utf-8 boxsdk import client, oauth2 boxsdk.network.default_network import defaultnetwork # code here set ids , tokens, used in oauth2, below oauth2 = oauth2(client_id, client_secret, access_token=access_token) client = client(oauth2) = client.user(user_id='me').get()

batch file - Calling bteq from Powershell -

i generate bat file contains multiple bteq calls execute .btq script against teradata box, below example cmd call: bteq <bteq\"file_1.btq" >>bteq_output.txt 2>&1 the syntax far understand is: > specifies input file & >> specifies output file i trying convert bat implementation powershell version stuck following issue: ps c:\...\deploy.ps1:21 char:81 + ... -object { bteq < (join-path $deploydir $_) >> bteq_log.txt } + ~ '<' operator reserved future use. + categoryinfo : parsererror: (:) [],parentcontainserrorrecordexception + fullyqualifiederrorid : redirectionnotsupported which result of call in powershell script: (get-content -path $configfile) | select-object -skip 1 | foreach-object { bteq.exe < (join-path $deploydir $_) >> bteq_output.txt } it seems bteq command line syntax directly conflicts < operator in powershell. edit if try escape < ` instead present

javascript - Is touchstart and touchend required to develop a game for a ios, android ect.? -

i in middle of developing html5 game. have been using mousedown , mouseup event handlers touch events . have been trying migrate phone emulator see how preforms on device . wondering if needed rewrite of events use mousedown , touchstart , touchend ect. events. mousedown , mouseup listeners seem working fine while play game while " emulate touch screen " setting on. in terms of performance there reason use 1 on other? yes, should change touch events. although mouse events work on mobile browser, there well-known 300ms click delay on mobile device. considering developing html5 game, it's worthy improve performance. there third party library such jquery mobile may mask event easier development.

getattribute - Which Python special methods bypass the object's `__getattribute__` on lookup? -

which python special methods bypass object's __getattribute__ on lookup? see special method lookup . as poke says, answer methods.

android - Why is BitmapFactory.decodeResource() slower when I put the images in the drawable folder? -

i've noticed while checking decoding times of resource images, bitmapfactory.decoderesource() function 3-6 times slower, when move resource image drawable folder. question: does know why happens? images scaled if in drawable folder? possible prevent without storing copy of image in each folder? details: i used following code check decoding times of image. for(int = 0; < 5; i++){ long time = system.currenttimemillis(); bitmapfactory.decoderesource(getresources(),r.drawable.welcome_01); log.i(tag, "time: " + (system.currenttimemillis() - time)); } bitmap size: 774 x 1280 device: nexus 6 (which uses drawable-xxxhdpi folder if resource available) test results: if image in drawable folder these decoding times: 08-03 09:18:01.072: i/mainactivity(26242): time: 298 08-03 09:18:01.352: i/mainactivity(26242): time: 280 08-03 09:18:01.656: i/mainactivity(26242): time: 304 08-03 09:18:01.929: i/mainactivity(26242): time: 272 08-03 09:18:0

angularjs - Protractor - click causing angular to freeze -

i'm having trouble protractor test. overview of test click button show form fill out form click button save form - should call function in 1 of controllers makes http call , reloads models on page. when clicking final "save" button, seems freeze , attached ng-click function never seems called. don't see errors in console when use browser.pause . can see button in fact clicked, @ point, nothing seems happen. final button definition: this.addconfigfilterlinebutton = element(by.css('[ng-click="cflctrl.create();"]')); function fills out form: this.addnewconfigfilterline = function (cb) { var self = this; var deferred = protractor.promise.defer(); browser.executescript('window.scrollto(0,10000);') .then(function(){ self.newconfigfilterlinebutton.click(); // code fills out form self.addconfigfilterlinebutton.click(); browser.waitforangular() .then(function(){ deferred.fulfill(); });

architecture - What are the characteristics of a framework? -

is there reference design , implement framework? characteristics of framework? , features should be? requisites must covered? orm associated framework? thanks your question indeed bit vague, it's kinda interesting in terms of "coding philosophy". don't claim answer way such things, without specifics problem. it's set of guidelines i'd use , helpful you. so, first of all, have understand what's problem trying solve . not consider "i educational purposes" option here. try asking questions these: do need solve singular problem? a simplistic example: if application needs sort array or, bit closer field, calculate mean or deviation - of singular problems. shouldn't include complete set of known sorting algorightms in application sort array, same way don't need deep statistical analysis system calculate mean. i'd consider developing library specific problem. what's wrong current solution? such generic notions

python - Change static file serving to nginx from flask? -

i running flask project in nginx. conf file server { listen 80; server_name site.in; root /root/site-demo/; access_log /var/log/site/access_log; error_log /var/log/site/error_log; location / { proxy_pass http://127.0.0.1:4000/; proxy_redirect http://127.0.0.1:4000 http://site.in; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; proxy_set_header x-forwarded-proto $scheme; } } when tried put expires part static files conf failed. read may due fact static files served flask rather nginx. if changes should bring above conf file static file serving can done nginx project. as per answer changed conf below. static file shows 403 error. server { listen 80; server_name site.in; root /root/site-demo/; access_log /var/log/site/access_log; error_log /var/log/site/error_log; location /

sql - I have NULL results for thousands of rows. How do I exclude those from populating when they don't exist? -

i have code @ sales employee of mine. hired create growth on extinct customers. on 1,000+ customers have in dbase, effect 100. there have been lot of rows generated value null . want report exclude rows of customers more efficient in understanding management. how accomplish this? select t1.cardcode 'bp code', t1.cardname 'bp name', count(case when t1.slpcode<>'37' t0.docnum end) '# of orders', sum(case when t1.slpcode<>'37' t0.doctotal end) 'total orders amt', sum(case when t1.slpcode<>'37' t0.doctotal end)/ count(case when t1.slpcode<>'37' t0.docnum end) 'avg order size', count(case when t1.slpcode='37' t0.docnum end) '# of orders', sum(case when t1.slpcode='37' t0.doctotal end) 'total orders amt', sum(case when t1.slpcode='37' t0.doctotal end)/ count(case when t1.

csv - Spark RDD External Storage -

i have written python code sum.py on summing numbers each csv file in directory data . going use apache-spark on amazon web service (aws), parallelize summation process each csv file. have done following steps: i've created 1 master , 2 slave nodes on aws. i used bash command $ scp -r -i my-key-pair.pem my_dir root@host_name upload directory my_dir onto aws cluster master node. folder my_dir contains 2 sub-directories: code , data , in which, code contains python code sum.py , , data contains csv files. i've login aws master node, , there used bash command $ ./spark/copy-dir /my_dir/code/ send code directory code contains sum.py slave nodes. on aws master node, i've put directory data containing csv files hdfs using $ ./ephemeral-hdfs/bin/hadoop fs -put /root/my_dir/data/ . now when submit application on aws master node: $ ./spark-submit ~/my_dir/code/sum.py , shows error worker node cannot find csv files. however, after send data directory data sla

javascript - Access inner text using $(this) with jQuery -

i have button , want log inner text using jquery when button clicked. know how use id text of buttton ( $("#testid").text() ), that's not option me. use $(this) keyword instead of id, i'm not sure how that. the html: <button id="testid" onclick="getbuttontext()">button text</button> the javascript: function getbuttontext() { console.log("this text = " + $(this).text()); //not working } pass in this the html: <button id="testid" onclick="getbuttontext(this)">button text</button> the javascript: function getbuttontext(self) { console.log("this text = " + $(self).text()); //not working } otherwise, this window object

Want to use a scrollspy with pagination in Bootstrap -

like title says want use scrollspy pagination in bootstrap, activate.bs.scrollspy does't seems work. here html code <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="x-ua-compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>starter template bootstrap</title> <!-- bootstrap core css --> <link href="../bootstrap-3.3.5-dist/css/bootstrap.min.css" rel="stylesheet"> <style> body { position: relative; } #section1 {padding-top:50px;height:500px;color: #fff; background-color: #1e88e5;} #section2 {padding-top:50px;height:500px;color: #fff; background-color: #673ab7;} #section3 {padding-top:50px;height:500px;color: #fff; background-color: #ff9800;} </style> </head> <body data-spy="

sql - Merging 2 simple queries to one query -

i have simple senario executind 2 queries first id table and using id access information second table. select id test_1 name = 'example 1' select * test_2 parent_id = %id retrived above query% use in (if subquery returns more 1 id) or = (if subquery returns 1 id): select * test_2 parent_id = (select id test_1 name = 'example 1')

Android Invite friends to App (open play store link) using Facebook Sdk 3.1 -

i trying send invitation facebook friends using facebook sdk 3.1. here code: bundle params = new bundle(); params.putstring("message", "come join me in guesswhat!"); params.putstring("to", textutils.join(",", invitabletokens)); webdialog dialog = new webdialog.builder(context, session.getactivesession(), action, params).setoncompletelistener( new webdialog.oncompletelistener() { @override public void oncomplete(bundle values, facebookexception error) { if(error!=null) log.i(getclass().getsimplename(), "invitation error :" + error.getmessage()); else utils.showtoast_msg(context, getstring(r.string.invite_sent)); } }).build(); // hide notification bar , resize full screen window dialog_window = dialog.getwindow(); dialog_window.setflags(windowmanager.layoutpa

c# - Is there any way to make a class name a parameter and use this as a class -

i need requirement need change 'homepage' class dynamically class having these same fields resources.homepage.resourcemanager.getresourceset(ci, true, true); is there way class name in variable , execute dynamically. dont need repeat code every classes.

c# - Which Reference should I use to resolve the Image class? -

Image
i adapted code here try add image pdf file, generate using itextsharp. here's code: string imagepath = server.mappath("pictures"); image gif = image.getinstance(imagepath + "/officeuseonlyimg.png"); doc.add(gif); the "image" class unrecognized, right-clicked resolve it; taken aback embarassment of riches - 4 references of picturelypse offered services: so 1 should choose? reckon 1 of itextsharp references, 1 preferred? the itextsharp.tool.* stuff part of xml worker, not of itextsharp core. need itextsharp.text.image . the itextsharp.tool.xml.html.image class class maps <img> tag itextsharp.text.image object. shouldn't use unless want tweak xml worker.

php - Performance topic: If with multiple || or switch case? -

this question has answer here: which faster , better, switch case or if else if? 7 answers i have small script format prices depending on origin of user. question better performance wise? function formatprice($price) { $locale = $this->locale; switch ($locale) { case "en-gb": case "en-ie": case "he-il": case "mt-mt": case "zh-cn": return number_format($price, 2, '.', ','); default: return number_format($price, 2, ',', '.'); } } or function formatprice($price) { $locale = $this->locale; if ($locale === "en-gb" || $locale === "en-ie" || $locale === "he-il" || $locale === "mt-mt" || $locale === "zh-cn") {

laravel - Statically retrieving rules out of Laracasts\Validation classes -

i have following form validation class: class edititemsform extends laracasts\validation\formvalidator { protected $rules = [ 'name' => 'required|alpha' ]; } i need use value in $rules populate former::withrules() can it's thing. i try adding static getrules method such can former::withrules(edititemsform::getrules()) protected value, requires creating new instance of edititemsform parent fromvalidator requires laracasts\validation\factoryinterface first constructor argument. example: public static function getrules() { return with(new self(null))->rules; } call me spoiled, have never had deal before. used laravel doing it's magical dependency injection in background when input values passed controller. how can value of $rules in case without having have instance of factoryinterface , or how dynamically create instance pass in getrules ? have tried ioc container of laravel instantiate edititemsform c

Retrieving data from SQL Server with a stored procedure with ASP.net and c# -

i have form , want retrieve data sql table , show in form's fields depending on ?id enter in url, error: procedure or function 'getappform' expects parameter '@id', not supplied. note: getappform stored procedure. here's code, please me: try { if (string.isnullorempty(request.querystring["id"])) { sqlconn.open(); using (sqlcommand cmd = new sqlcommand("getappform", sqlconn)) { cmd.commandtype = commandtype.storedprocedure; sqlparameter id = cmd.parameters.add("@id", sqldbtype.int); id.direction = parameterdirection.input; id.value = request.querystring["id"]; sqldatareader datareader = cmd.executereader(commandbehavior.closeconnection); while (datareader.read()) { ownerfield.text = datareader["owner"].tostring(); odbooknofie

ios - How do you send data between viewcontrollers that are in different storyboards -

here code in first viewcontroller.m file: riskviewcontroller *riskvc = [[riskviewcontroller alloc] initwithnibname:nil bundle:[nsbundle mainbundle]]; riskvc.address1 = @"this data im trying send!"; uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle: [nsbundle mainbundle]]; [self.navigationcontroller pushviewcontroller:[storyboard instantiateviewcontrollerwithidentifier:@"risk"] animated:yes]; here code in second viewcontroller.h file: @interface riskviewcontroller : uiviewcontroller <uitextfielddelegate> @property (nonatomic, strong) nsstring * address1; here code in second viewcontroller.m file. nsloging self.address1 null: - (void)viewdidload { [super viewdidload]; nslog(@"addy1%@", self.address1); } why self.address1 string null, should contain string sent, how fix data gets sent? uistoryboard *storyboard = [uistoryboard storyboardwithname:@"main" bundle: [nsbundle mainbundle]];

java - @WebServlet don't work. getting null value in getAttribute in jsp -

i'm trying set list request attribute print in jsp file. getattrubute in showmentors.jsp giving null value. problem controller or web.xml? please? think controller dose not working. controller.java @webservlet("/controller") public class controller extends httpservlet { private static final long serialversionuid = 1l; private static sessionfactory factory = null; //set managers mentors mentorsmanager = mentors.getinstance(); public static sessionfactory getsessionfactroy() { try{ if(factory == null) factory = new annotationconfiguration().configure().buildsessionfactory(); } catch(hibernateexception e){ system.err.println(e.getmessage()); } finally{ return factory; } } /** * @see httpservlet#httpservlet() */ public controller() { super(); // todo auto-generated constructor stub } protected void d

python - No module named -

i have python project structure: (this not real project, testing) importtest importpersonstest\ importperson\ importperson.py runimportpersontest.py runimporttests.py i want tests call each other. e.g : runimporttests.py calls method in runimportpersontest.py, , runimportpersontest.py calls method importperson.py runimportpersontest: import os import sys sys.path.insert(0, os.getcwd() + "../../../") importperson import importperson runimporttests import os import sys sys.path.insert(0, os.getcwd() + "../../") importpersonstest import runimportspersontest i have success when run importperson.py , runimportpersontest.py, when try run runimporttests error : traceback (most recent call last): file "xxx\liclipse workspace\systemtest\importtest\runimporttests.py", line 4, in <module> importpersonstest import runimportspersontest file "xxx\liclipse workspace\systemtest\importtest\impor

java - How to store multi parameters in a list? -

i want know how can save different parameters related 1 key in single list. for example imagine have list of people have name , family name , salary , key find unique person in list. what can use store these information in single list? what structures can use? list , array list , hash map , map , set etc. do have define new class? you should define person class having properties mentioned. can store people in map<integer,person> or map<string,person> , depending on whether unique identifier of person integer or string . if use hashmap implementation of map , you'll able locate person identifier key in expected constant time.

python - Web2py databases: How do I select a subset of rows from selected rows? And how do I pass it to JavaScript? -

i have table , want web2py action pass contents view. view selects subset , manifests them 1 @ time in iteration. here's sample table in db.py: db.define_table('block', field('location'), field('propertya'), field('propertyb') ) a sample action in controller default.py: def demo(): return dict(blocks=db(db.block).select()) so far good. compiles, doesn't crash , after running few tests did wanted. but view. in example, want select "propertya" is, say, 5. , want run loop, prints them in table, exists. table has 100 cells , id's 1-100. want print values of propertyb table cells, id matches blocks' location. a sample view default/demo.html: {{extend 'layout.html'}} <style> table#map, td { border: 1px solid black; border-collapse: collapse; } td { background-color: gray; width: 50px; height:50px; text-align: center;

Not getting correct input form either scanf or printf in Nasm assembly program with menu -

in following, i'm trying make user enters n , prompte enter integer. got part working. i've spent few hours trying next part working. after enter integer, goes menu. debugging purposes, if enter f should display number entered. however, when entering n, 3, f, displays 21505. ;nasm -f elf64 fib.asm -o fib.o ;gcc -s -masm=intel fib.c -o fib.s ;./fib bits 64 global main extern puts extern printf extern scanf extern get_kb section.data errormsg: db 'invalid input. enter n,f, or x',0x0d,0x0a,0 numequalsmsg: db 'number equals: ' lc2: db "%d",0 menuprompt: db 0x0d,0x0a,'enter n enter integer 0 20',0x0d,0x0a,'enter f display first n+1 numbers (beginning zero) on console',0x0d,0x0a,'enter x quit program',0x0d,0x0a,0 choicemsg: db "your choice: ",0 lc5: db "%d",0 enterintmsg: db "enter , integer 0-20: ",0 enternummsg: db 'en

javascript - How to create private variables and methods inside a class ES6? -

this question has answer here: private properties in javascript es6 classes 24 answers how create private variables , methods using es6 class should access public methods of same class. class myclass { constructor() { this.publicvar = "i public"; //some private variable e.g privtevar1 = "i private1"; privatevar2 = "i private2"; this.publicmethod = () => { //it should have accesses private variables , methods console.log(privatevar1, privatevar2) }; //similarly need create privatemethod } render() { //it should have access private variables } } as noticed @yibuyisheng can use symbols create unaccessible references properties. can create private method well. var privatemethod = symbol('private'); class someclass { c

java - Scheduling a block of code to run every few seconds inside Akka actor in Play 2.4.2 -

i have actor class, manager extends untypedactor contains list of messages: listofmessages , list of client websocket connections: clientconnections , , method sendmessagestoclient sends every message in listofmessages every client, , resets listofmessages empty list. want method sendmessagestoclient executed every 2 seconds. is there way schedule method run on interval within actor? docs show how schedule task different actor, shown here: system.scheduler().schedule( duration.create(0, timeunit.milliseconds), //initial delay 0 milliseconds duration.create(30, timeunit.minutes), //frequency 30 minutes testactor, "tick", system.dispatcher(), null ); but want inside manager class: system.scheduler().schedule( duration.create(0, milliseconds), durant.create(2, "seconds"), sendmessagestoclient() ); is possible? yes possible. method prefer have actor send message itself, , within receive, call method wa

How to reset IDENTITY column in oracle to a new value -

i using identity feature of oracle 12 c increment record id of table. as part of initial setup have migrate records system table. these records non sequential records(partial records deleted). how make identity create highest value + 1 based on table records. after googling different options found keyword of restart with value option. need create new store procedure , alter tables highest possible values restart with. is there direct keyword can used along identity can force regenerate higher values. ? no direct keyword , have alter table (right words start with). there's way change highwatermark identity column. common sequences (by way identity built on system sequence) use old trick increment shifting mark in directions. alter table t modify (id number generated identity increment 50 nocache); that is, if next value 100 , need make 1000, trick 2 times: "increment 900", add record , "increment 1" (if identity step 1).

flex3 - Implementation of colorpicker in flex -

i new flex , don't know classes , all. taking " http://help.adobe.com/en_us/flex/using/ws2db454920e96a9e51e63e3d11c0bf63b33-7fa7.html ". colopicker not appearing on screen when run code. please find below code of .mxml file. in advance. <?xml version="1.0" encoding="utf-8"?> <mx:box xmlns:mx="http://www.adobe.com/2006/mxml"> <mx:script> <![cdata[ import mx.controls.colorpicker; import mx.events.colorpickerevent; private var scribbletoolsbutton:button; private var scribbleflyout:slideouttoolbar; //slideouttoolbar extends sprite //creating slide out toolbar private function createscribbletoolsmenu():void { scribbletoolsbutton = button(); scribbletoolsbutton.popupposition = button.popup_position_right; scribbletoolsbutton.popupverticalalignment = button.vertical_align_middle;

python - Post images through yampy -

i can post message in yammer when itry post image import yampy access_token = 'access_token_id' attachment = 'c:\\users\\userdir\\desktop\\picture.png' yammer = yampy.yammer(access_token=access_token) yammer.client.post('/messages', body="testing_please_ignore", group_id=123233, broadcast=true, attachment1=attachment) i got following error traceback (most recent call last): file "c:\users\userdir\workspace_new\challenges\yammer.py", line 30, in <module> attachment1='c:\\users\\userdir\\desktop\\desktop\\logo.png') file "c:\python27\lib\site-packages\yampy\client.py", line 51, in post return self._request("post", path, **kwargs) file "c:\python27\lib\site-packages\yampy\client.py", line 77, in _request return self._parse_response(response) file "c:\python27\lib\site-packages\yampy\client.py", line 94, in _parse_response raise self._exception_for_response(re

php - location: add ID to URL after update -

the following updates database record, once completed direct page view updated record. header('location:view_resource.php?resource_id=$id'); i can't seem add records id url, comes as: view_resource.php?resource_id=$id full code below: <?php include('conn.php'); if(isset($_get['resource_id'])) { $id=$_get['resource_id']; if(isset($_post['submit'])) { $name=$_post['name']; $description=$_post['description']; $query3=mysql_query("update z_resource set name='$name', description='$description' resource_id='$id'"); if($query3) { header('location:view_resource.php?resource_id=$id'); } } $query1=mysql_query("select * z_resource resource_id='$id'"); $query2=mysql_fetch_array($query1); ?> <

php - How to return model rows where id is equal to id on other table with relations in laravel? -

for example have: // returns projects $projects = projects::all(); to return categories, belonging project, use relationships , can like: foreach($projects $project) { ...show $project->categories... } i need specific projects, followed specific user. on projects_followers table have user_id , project_id . to retrieve projects followed have peace of code: $projects = project::rightjoin(db::raw('(select * projects_followers group project_id) projects_followers'),'projects_followers.project_id','=','projects.id')->get(); // note: code doesn't include specifuc user_id. it retrieve specific rows, problem code laravel relationhips dont work on them. example $project->categories return empty. // relationship public function categories() { return $this->belongstomany('app\category'); } how retrieve model specific rows , make relationships work? actually question is: how projects liked/followed a

jquery - html range slider that shows text instead of value -

the code below shows numerical readout. is possible have text based readout? if how go achieving this? <label for=fader>volume</label> <input type=range min=0 max=100 value=50 id=fader step=1 oninput="outputupdate(value)"> <output for=fader id=volume>50</output> <script> function outputupdate(vol) { document.queryselector('#volume').value = vol; } </script> well, not sure whether possible html slider might need code convert each number word , found here , applying same can below work you var th = ['', 'thousand', 'million', 'billion', 'trillion']; var dg = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; var tn = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'si