Posts

Showing posts from August, 2011

simple form - Rendering rails output -

i trying set simple form outputs in rails 4 app. i have project model, scope model , participant model. participant belongs scope. scope belongs project. the participant model has 2 attributes - 1 'location_specific', boolean , 1 'location' string. if location_specific true, want output location required. in participants show partial, have: <div class="datasubtextq">location: <span class="datasubtext"> <% if @project.scope.participant.location_specific == true %> <%= @project.scope.participant.location %> <% else %> <%= render :text => "remote participation" %> <% end %> </span> </div> in form, have: <div class="row"> <div class="col-md-3 col-md-offset-1"> <%= f.label 'can participants participate remotely?', :class => 'ques

Elasticsearch crashes without error message -

i facing problem elastic-search. after minutes of starting elastic-search, crashes without error message. java version: jdk1.8.0_45 elastic-search version: 1.4.5 i'll attach java crash log ( http://pastebin.com/nn9phwu4 ). does has idea issue is, , how can fix it? thanks, marcel

css - How container width is calculated in bootstrap for different devices -

i starting bootstrap , going through docs. right now, seems confusing , have queries follows: in grid options table, why container width less device width, why not equal device width e.g.small devices tablets (≥768px). how width 750px determined, why not 743px or 755px or other size. how did determine 750px container width. as given, bootstrap scales 12 columns gutter between columns , each column width ~62px , gutter 30px (15px on each side) therefore (12(cols)*62px ) + (11(gutters) * 15(width)) equals 909px instead of given 750px container width. why ? this confusing me. plz show how container widths calculated different breakpoints , why container width not equal device width ? thanks dk the bootstrap .container used centered container, if want full-width on devices use .container-fluid the 62px 62.5px @ small breakpoint. 62.5 x 12 = 750px, , includes 15px padding around each column. gutter within column since padding used (as opposed margin gutter outsi

c++ - wxWidgets wxPen size changes unexpectedly -

Image
i've used following code draw on image using wxmemorydc. used wxpen , changed settings of pen in following code. code compiles , runs in windows environment. in ubuntu draws lines pen size stays correctly little time , pen size becomes low.(as shown in image) not error of m_pensize variable because prints correct value. why works strange in ubuntu when works correctly in windows?. (m_graphics memorydc here) if (x<m_backgroundimage.getwidth() && y< m_backgroundimage.getheight()){ m_graphics.selectobject(m_maskimage); wxpen* pen; if (m_isdrawing){ pen = wxthepenlist->findorcreatepen(*wxred, m_pensize); printf("pen size %d", m_pensize); } else{ pen = wxthepenlist->findorcreatepen(*wxblack, m_pensize); } if (m_pentype != circle){ pen->setcap(wx

c# - Entity Framework connection string - Error Locating Server/Instance Specified -

i'm facing issues trying connect sql server 2005 using entity framework. i've small windowsform application using system.data.sqlclient.sqlconnection : sqlconnection cnn = new sqlconnection("data source=servername\\sqlhotel;database=mydatabase;user id=myusername;password=mypassword"); try { cnn.open(); messagebox.show ("connection open "); cnn.close(); } catch (exception ex) { messagebox.show("can not open connection ! "); } this working fine on server (i'm getting "connection open" message), in asp.net web api application using entity framework 6 i'm getting error using above connection string: a network-related or instance-specific error occurred while establishing connection sql server. server not found or not accessible. verify instance name correct , sql server configured allow remote connections. (provider: sql network interfaces, error: 26 - error locating server/instance specifi

python - How does this code work to find the Minimum Depth of Binary Tree? -

i see code https://leetcode.com/discuss/37282/simple-python-recursive-solution-bfs-o-n-80ms and answer given binary tree, find minimum depth. the minimum depth number of nodes along shortest path root node down nearest leaf node. class solution: # @param {treenode} root # @return {integer} def mindepth(self, root): if not root: return 0 nodes = [(root, 1)] while nodes: node, curdepth = nodes.pop(0) if node.left none , node.right none: return curdepth if node.left: nodes.append((node.left, curdepth + 1)) if node.right: nodes.append((node.right, curdepth + 1)) so confusion is, if node 1 has node 2 , node 3 .left , .right children, stack [(node 2, somedepth), (node 3 somedepth)]. stack pop out last element of list, (node 3 somedepth) unpacked while node 2 ignor

node.js - How to emit event in mongoose middleware? -

i want emit event when new blog saved blog.post('save',function(blog){ this.emit('newblog',blog) }) and somewhere else in project app.js can listen event eventemitter = require('events').eventemitter; emitter = new eventemitter(); emitter.on('newblog',function(blog){ console.log(blog); }) how this? the way event emitter works have use same event emitter object listen on used emit. need this: to share among different parts of project should create module out of , require wherever needed. my-event.js: var eventemitter = new require('events').eventemitter(); module.exports = eventemitter; then require eventemitter wherever want use it blog.js: var myevent = require('../my-event'); blog.post('save',function(blog){ myevent.emit('newblog', blog); }); app.js: var myevent = require('./my-event'); myevent.on('newblog', console.log); if don't want go thro

php - Updating relation model laravel -

i'm new in laraval 5 @ tutorials "laravel 5 fundamentals" , have issue. article model public function category() { return $this->belongsto('app\category'); } category model public function article() { return $this->hasmany('app\article'); } articlecontroller public function create() { $categories = category::lists('name', 'id'); return view('admin.article.create', compact('categories')); } public function store(articlerequest $request) { $article = new article($request->all()); $category = category::find($request->input('categories')); $article->category()->associate($category); \auth::user()->article()->save($article); return \redirect::to('/admin/article'); } public function edit(article $article) { $categories = category::lists('name', 'id'); return view('admin.article.edit', compact('articl

java - Sonarqube 5.2 / Checkstyle plugin 2.3 : Enabling SummaryJavadocCheck makes the analysis failed -

i change sonarqube configuration: before: sonarqube 5.1 java plugin 3.0 pmd plugin 2.3 checkstyle plugin 2.2 findbugs plugin 3.2 issue assign plugin 1.6 after: sonarqube 5.1 java plugin 3.3 pmd plugin 2.4.1 checkstyle plugin 2.3 findbugs plugin 3.2 issue assign plugin 1.6 on new configuration have enabled new rules brought 3.1 3.2 java plugin version. the analysis batch fails @ issuetracking decorating stage of batch analysis: [info] [08:37:25.503] compare on 1 days (2015-05-31, analysis of fri may 29 21:49:21 bst 2015) [info] [08:37:25.504] compare on 7 days (2015-05-25, analysis of mon may 25 08:07:18 bst 2015) [info] [08:37:25.505] compare on 30 days (2015-05-02, analysis of sat may 02 00:19:16 bst 2015) [info] [08:37:25.506] compare date 2014-04-01 (analysis of 2014-06-06) [info] [08:37:25.741] execute decorators... [info] [08:37:25.744] issue 2c785d7e-3a5b-4282-9c5b-39bd4d645a81 won't auto-assigned. reason: not_new [info] [08:37:25.744] issu

jquery - How to make a div appear with JavaScript with keypresses -

this question has answer here: detect multiple keys on single keypress event in jquery 10 answers i want show/enable div whenever type key-combination in right order. for example: 'open console{enter}' now, there no input field, no nothing. open site, type text , div should pop up. such 'secret menu'. how can accomplish without actual inputfield? also, pros , cons? $(document).on("keypress", function (e) { if(e.which == 13) { $("#div").show(); } }); example: http://jsfiddle.net/ve6crpne/ e.which key. if key 13 (enter/return) show div id = div. if wish detect multiple keys in row, add each key map , check afterwards. duplicate question, can seen here: detect multiple keys on single keypress event in jquery - simple.

java - Hibernate Master Details Relation Table Delete Error -

my spring hibernate project having 2 tables listnote & listnotedetails. mapping given below.the data insertion , getting tables worked fine. when execute delete master data throw exception. @entity @table(name = "list_note") public class listnote implements serializable { @id @generatedvalue(strategy = generationtype.auto) @column(name = "id", nullable = false, length = 11) private long id; @column(name = "title", nullable = false) private string title; @manytoone @joincolumn(name = "folder_id") private folder folder; @column(name = "created_date", nullable = false) private date createddate; @onetomany(fetch = fetchtype.eager, orphanremoval = true, cascade = cascadetype.all) @fetch(value = fetchmode.subselect) @joincolumn(name = "list_note_id") private list<listnotedetails&g

java - JaxWS RI /JaxB - Shared Object between Handler and WebMethod -

does exist way share object between handler , webmethod? the reason why i'm asking want log raw request database, process request on storedprocedure (by id key) , log on same record raw response. to want share id key between handler , webmethod , demand log of request , response raw handler. tnx. update you must use setter method on ws implementation. if want set parameter in message context must set scope application parameter. the default scope handler not visible in ws implementation soaphandler public boolean handlemessage(soapmessagecontext smc) { smc.put("id_messaggio",message.getid()); smc.setscope("id_messaggio", messagecontext.scope.application); } ws implementation webservicecontext context; @resource public void setcontext(webservicecontext context) { this.context = context; } @override public createandstartrequestbyvalueresponse createandstartrequestbyvalue(createandstartrequestbyval

Get years between two dates in jQuery -

i need years between 2 dates in jquery example if have these 2 dates ("2014-5-1" , "2017-4-6"), need of years between them (2014, 2015, 2016, 2017) can 1 me please in advance something return array years function getyears(from, to) { var d1 = new date(from), d2 = new date(to), yr = []; (var i=d1.getfullyear(); i<=d2.getfullyear(); i++) { yr.push( ); } return yr; } fiddle

qt - Same style for QPushButton and QToolButton during mouse-over -

is possible make qpushbutton , qtoolbutton identical during mouse-over, i.e. , feel hover events? i don't use custom stylesheets, there global application setting: qtgui.qapplication.setstyle("plastique") i'm looking "propagate" current (system-default) mouse-over-stylesheet of qpushbutton qtoolbutton. default, qpushbutton highlighted during mouse-over, while qtoolbutton nothing @ all. environment: qt 4.8.6, running on linux centos 6 , windows 7 taking nicolas answer starting point, created own css style sheet: qpushbutton,qtoolbutton { background-color: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1, stop: 0 #fdfbf7, stop: 1 #cfccc7); border-width: 1px; border-color: #8f8f91; border-style: solid; border-radius: 3px; padding: 4px; padding-left: 5px; padding-right: 5px; } qtoolbutton[popupmode="1"] { padding-right: 18px; } qtoolbutton::menu-button { border-width: 1px; border-color: #8f8f91; border-styl

java - How to get full base path of spring application running on CentOS Wildfly server? -

i need full path of deployed spring application using java. tried following path getclass().getprotectiondomain().getcodesource().getlocation().getpath() which returned following: on wildfly running on centos : "/content/myproject.war/web-inf/classes" (partial path) on wildfly running on win7 : "/c:/wildfly-8.2.0.final/standalone/deployments/myproject.war/web-inf/classes" (returning full path) above worked on windows machine not working on wildfly running on centos . there no such concept full path of deployed web application - @ least not in java ee specs, far know. you seem assume tacitly deployed web application must located somewhere in file system , there absolute path of location. but not case, , if happens case, it's implementation detail of app server application should not rely on.

ios - Change app's name cause crash on launch -

Image
i change app's name abcxyz abc-xyz in info.plist -> bundle display name this cause crash on device when launch. message: diskcookiestorage changing policy 2 0, cookie file: file:///private/var/mobile/containers/data/application/7cb9b0ea-97a2-4d3e-a8aa-ceb419beb1f2/library/cookies/cookies.binarycookies the simulator works fine, real device crash. problem here? crash when update on appstore? edit 1: worked super fine before changed app name. i'll try change name see if problems gone. edit 2: no, didn't work after change name back. should now? edit 3: change app's display name, not project name or else. project name still abcxyz-ipad. think problem maybe because have imported external framework, sdk... , cause conflict somewhere? edit 4: these solutions i've tried far. no result yet. 0. rename old name, reinstall. 1. clean, build, reset xcode, clean, build. 2. delete app on device, reinstall. 3. re-download store, reinstall. 4. reset device, re

c# - json.Net save to file -

i have script saving file sorted, cant code save entry: below { "entry": [ { "name": "john" }, { "name": "anna" }, { "name": "peter" } ] } im using json.net, code below needs add entry: name string json = jsonconvert.serializeobject(results, formatting.indented); string path = @"c:\inetpub\wwwroot\json\json.net\results.json"; if (!file.exists(path)) { file.writealltext(path, json); } else { file.appendalltext(path, json); } i haven't been able find json code samples, cheers paul i managed so! userinfo results = new userinfo { name = request["name"], }; stringbuilder sb = new stringbuilder(); stringwriter sw = new stringwriter(sb); jsonwriter jsonwriter = new jsontextwriter(sw); jsonwriter.formatting = formatting.indented; jsonwriter.writestartobject(); jsonwriter.writepropertyn

c# - get the combobox values from the row of the table and match -

hello friends making 1 window base application have struck somewhere thats why need experts. want value form row , match combobox.please find wrong in code. please make crrect private void btnadd_click(object sender, eventargs e) { try { con = new sqlconnection("data source=.;initial catalog=dsiidc2;integrated security=true"); con.open(); string str = "select * addcaasedetails"; sqldataadapter da = new sqldataadapter(str, con); dataset ds = new dataset(); da.fill(ds); (int = 0; < ds.tables["addcaasedetails"].rows.count; i++) { if (ds.tables["addcaasedetails"].rows[i]["caseno"] == casedetails.valuemember) { datagridview1.visible = true; } } } catch (exception ex) { messagebox.show(ex.messag

mysql - Select rows from a table based on another row in the same table -

i have single table containing details multiple residential properties. there 4 columns in table named follows. id = unique identifier tmplvarid = kind of record type code. i.e. address, price, status, image etc.... (there 20 different record types) contentid = used group records belonging same property. value = actual details record. what need select fields records of properties have status of "sold" example. make sense me if join 2 tables related information information in 1 table. i can see data structure make easy add new field application out need change tables i'm stuck on how query table return related information. any pointers in right direction? thanks david. edit here example of records relating 1 property. there many properties different property id's. (example property id 183) as , example, want select street number (varid=34), street name (varid=39) , image name (varid=36) properties have been "sold&qu

php - Calculating working hours of employees using time stamps -

i have 4 columns in database includes employees name , time stamp of date , time combined shows time in , time out of employees. time out gets entered in next row after time in, each employee gets in , gets out many times in day, have consider first time in , last time out of each employee , find difference between time calculate total working hours of each employee. database given below. can please me on e name turnstile in turnstile out combine abhijit k t sp turnstile 03 in 2015-01-01 08:08:36 abhijit k t sp turnstile 03 in 2015-01-02 08:33:52 abhijit k t sp turnstile 01 out 2015-01-01 18:22:44 abhijit k t sp turnstile 03 in 2015-01-01 18:23:00 abhijit k t sp turnstile 01 out 2015-01-02 19:17:08 abhilash s m se turnstile 01 out 2

android - Decoding Base64 String to Bitmap -

i have image being sent me through json string. , want set in imageview. the json looks pgltzybzcmm9imh0dha6ly8xotiumty4ljeumta4l2jra19hbmryby9hc3nldc9pbwfnzxmvbg9rzxjfc21hbgwuanbnij4= and code decode string bitmap , show imageview string displayimagefromurl = c.getstring(imageurl); byte[]decodedstring = base64.decode(displayimagefromurl,base64.default); bitmap decodedbyte = bitmapfactory.decodebytearray(decodedstring, 0, decodedstring.length); imageview showimage = (imageview) findviewbyid(r.id.imageshow); showimage.setimagebitmap(decodedbyte); but when run in logcat shows "d/skia﹕ --- skimagedecoder::factory returned null" please me

Node.JS + MongoDB aggregation Find array in array from DataBase in MongoDB -

i have model in mongodb include array(category) has array(picture) inside it. shirt model looks this: { _id: 100, category: [ { name: 'catname', _id: 101, picture: [object] } ] } and picture array looks this: [ { path: 'p1', _id: 102 }, { path: 'p2', _id: 103 } ] } i pass 3 variables main array id 100 (var1) category name catname (var2) picture id 102 (var3) i want array looks like: { _id: 100, category: [ { name: 'catname', _id: 101, picture: [ { path: 'p1', _id: 102 }] } ] } what have tried this: shirt.find( {_id: var1} , {category: { $and:[ { name: var2 } , { picture: {$elemmatch: {_id: var3}}} ] }} ) .exec(function(err, product) { console.log('result ' + product ); res.jsonp(product); }); but result receive undefined first code second code tried: shirt.find( {_id: var1} , {category: {$elemmatch: { name: var2,pictur

actionscript 3 - Timer flash to show something at the right time -

i want make timer show text @ paneltext (dynamic text box) @ specific time, have video want have subtitles, , want use timer, video 3 minutes , 37 second long, , have script want show @ time, example @ 1 minute 0 seconds show text "hello, video learn solar system" in paneltext, , @ 2 minute want show text "there 8 planets in our solar system", that. information, i'm using flvplayback play video , load external video. an example code: var mytimer:timer = new timer(217000); var time = 0; mytimer.start() mytimer.addeventlistener(timerevent.timer,timerhandle); function timerhandle(event:timerevent){ if(mytimer == 120000) { paneltext.text="there's 8 planets in our solar system"; } and got error 1176: comparison between value static type flash.utils:timer , possibly unrelated type int. can me?, i'm sorry bad english you shoul

objective c - Generate Xcode Project from iOS App -

is there way create app generates xcode project developer can run in xcode. kind of code generator. i'm trying answers in web no avail. i'm not sure start. basically, app generate xcode compatible codes developer can use open xcode. appreciated. in advance! :) a sample application that's available in appstore offers same functionality interface ios. link: https://itunes.apple.com/en/app/interface/id360543182?mt=8 another example dapp app creator: https://itunes.apple.com/au/app/dapp-app-creator-make-learn/id370888555?mt=8 from app description: xcode export, turn mockup live codes our free cloud based xcode export service convert entire project xcode project in 1 single tap. dapp creates complete xcode project - including code, images, videos , xcode storyboards! update: thinking of including zip file of sample xcode project template file inside app generate codes used template project, edit or add them in template project, zip , export documents folder thru

java - Gson how to dynamically set serialized name -

here case // base class public abstract class pageresult<t> { @serializedname("success") public boolean success = false; @serializedname("next_page") public int nextpage = -1; public arraylist<t> datalist; } in datalist serializedname need dynamic i.e. public class stringpageresult extends pageresult<string>{ //for case @serializedname("stringresult") public arraylist<string> datalist } public class integerpageresult extends pageresult<integer>{ //for case @serializedname("integerresult") public arraylist<integer> datalist } so class extending pageresult, serializedname need different , must use datalist. meaning need use pageresult datalist various processing instead of sub class datalist .is possible? doing in following manner public abstract class pageresult<t> { public abstract arraylist<t> getdatalist(); @serializedname("success")

java - Executable jar file became jar file only? -

i made project , build executable jar file. problem executable jar file in computer when transfer computer became jar file only. problem here? i'm using netbeans 8.0.2 maybe don't have java installed on second computer, or installation not default, "jar" extension not registered? try in console: java -version #if have java, can start jar command line: java -jar youjarname.jar

Confused with Spark serilization -

i need read several csv files , convert several columns string double. the code like: def f(s:string):double = s.todouble def readonefile(path:string) = { val data = { line <- sc.textfile( path ) arr = line.split(",").map(_.trim) id = arr(33) } yield { val countings = ((9 14) map arr).tovector map f id -> countings.tovector } data } if write todouble explicitly (e.g. function f in code), spark throws error java.io.ioexception or java.lang.exceptionininitializererror . however if change countings val countings = ((9 14) map arr).tovector map (_.todouble) then works fine. is function f serializable? edit: some people says same task not serializable: java.io.notserializableexception when calling function outside closure on classes not objects why doesn't throw task not serializable exception? scala version 2.10 spark version 1.3.1 environment: yarn-client we can move

php - laravel5: Storing of checkboxes as tinyint(4) or boolean in mysql/DB -

looking better execution of below function, dealing checkboxes. /** * update specified resource in storage. * * @param int $id * @return response */ public function update(createuserrequest $request, $id) { $user = user::find($id); //todo should else where? $input = $request->all(); if(isset($input['status'])) $input['status'] = 1; else $input['status'] = 0; $user->fill($input)->save(); return redirect('admin/users'); } i think doing fine, can test value of status string 'yes'. unchecked checkboxes don't register anything, you're going doing same thing. assuming checkbox input has value="yes", then: $input = $request->all(); if($input['status'] === 'yes') $input['status'] = 1; else $input['status'] = 0; pretty no matter what, you're going have have 'else' define value unchecked case. it'

Want to make a list of words using python where the student received a 0 for the word in that column -

relatively new python, , programming in general, want take student assessment list , iterate through each row print list includes student name , each word (column name) student missed (recorded 0). table looks this: name - id - again - - - away - best - every student1 - 13 - 1 - 0 - 0 - 1 - 0 - 0 student2 - 14 - 1 - 1 - 1 - 0 - 0 - 1 student3 - 15 - 0 - 0 - 0 - 1 - 1 - 1 want write this: for row in dataframe: if row == 0: print student name +':' + column name output be: student 1: all, always, best, every student 2: away, best student 3: again, always, away i've got several hundred students , love have list showing words each student needs practice. appreciated. thanks! assuming table in pandas dataframe (you should able import using pd.read_csv or pd.read_csv : import pandas pd df = pd.dataframe([['student1',13,1,0,0,1,0,0], ['student2',14,1,1,1,0,0,1], ['student3',

Accessing 3-dimensional matrix by a 2-dimensional index in matlab/octave -

i have 3 dimensional matrix (3rd dimension represents multiple copies of m x n grayscale image). i'm taking max value of each pixel across images, giving me max_val , max_ix matrix (2x2). i want reference original test matrix max_ix values. example: my_max_val = test(max_ix,:) should equal: 5 1 1 1 obviously can use max_val in simplified example, not in real use case. i'm altering max_ix , need reference original 3-dimensional matrix new index values create (not depicted in simplified example). >> test test(:,:,1) = 1 1 1 1 test(:,:,2) = 1 1 1 1 test(:,:,3) = 5 1 1 1 test(:,:,4) = 1 1 1 1 >> [max_val, max_ix] = max(test, [], 3) max_val = 5 1 1 1 max_ix = 3 1 1 1 how recreate max_val test , max_ix ? one approach - %// size of 3d input array [m,n,~] = size(test); %// calculate 2d star

android - Create google GCM testing app in emulator and get registration id using PHP -

i'm trying create testing app run @ emulator , gcm server use php. i'm looking code how pushes message target device, following code downloaded somewhere: <?php $json = array(); $regid = $_get["regid"]; $msg = $_get["msg"]; if (isset($regid) && isset($msg)) { require_once("gcm.php"); $message = array("message" => $msg); $regid = explode(",", $regid); $result = gcm_push_notification($regid, $message); $success_code = json_decode($result,true)["success"]; if($success_code > 0){ //echo $result; // echo $success_code."/".count($regid); // }else{ echo "error"; } } else { echo "error"; } ?> the code every time need "registration id"s send message: i wondering how can registration ids every time before sending message? and if create simple app run @ emulator only, ge

c# - Why does Message Box appear twice when event is called. -

so i've been following visual studio tutorials microsoft has available (more math quiz 1 found @ https://msdn.microsoft.com/en-us/library/vstudio/dd492172.asp ) but deviated bit tutorial because wanted see if create event , call using eventhandler delegate though might not best solution. public event eventhandler quizstarted; here code creating event. now in method public form1() { this.quizstarted += new system.eventhandler(this.showthatthequizstarted); initializecomponent(); } i have initialized event instance of eventhanlder points showthatthequizstarted method. public void showthatthequizstarted(object sender, eventargs e) { messagebox.show("quiz has started"); } and when start button pressed call quizstarted event shown below. private void startbutton_click(object sender, eventargs e) { startbutton.enabled = false; quizstarted(this, new eventargs()); this.startthequiz();

java - How to set up content assist in Eclipse on Mac -

Image
when type code in sublime say, need start first few letters of variables , come list of possible existing variable names match typed. in eclipse, don't know how realize this. in preference-java-editor-content assist, found auto-activation pane , according other posts, i'm supposed change auto activation triggers java. how default setting looks like. don't understand dot on there. i'm not sure if that's right way approach problem? can me out? thanks!! the auto activation give suggestions fields , methods available. example if start typing in new object(). then ide (eclipse) give suggestions (after 200ms "auto activation delay") of tostring() , equals() , , other methods. if want use plain auto-complete, tend use shortcut ctrl + space (the spacebar key). if want eclipse auto-complete method name me (say method reallylongmethodnameidonotwanttotypeout() ) i'll type in reallyl press ctrl + space , eclipse fill in rest me.

python - Homogeneous children in ButtonBox -

i added few children buttonbox, , wanted them not homogeneous. called buttonbox.set_homogeneous(false) , worked. when resize window bellow minimum size, , vertical scrollbar appears, see there lot of empty space bellow buttonbox. able fix individually specifying each children non homogeneous calling buttonbox.set_child_non_homogeneous(child, true), while leaving in previous call buttonbox.set_homogeneous(false). my question then, why happen? set buttonbox's layout expand, space should taken. i made little test code illustrate i'm talking about. can try , without commented line see both cases mentioned. import sys gi.repository import gtk class application(gtk.application): def __init__(self): super().__init__(application_id='com.stackoverflow.xor') self.connect('activate', self.on_activate) self.connect('startup', self.on_startup) def on_startup(self, app): self.window = gtk.applicationwindow(applicat

javascript - Web Audio Api, setting the gain -

i have been looking @ web audio api , not able audio gain work. have fiddle set here, can understand application of function: http://jsfiddle.net/mnu70gy3/ i hoping dynamically create tone on click event, not able have tone fade out. below relevant code: var audioctx = new audiocontext(); var osc = {}; // set object oscillators var gainnodes = {}; // set object gains var now; function tone(id,freq) { // create osc / set gain / connect osc gainnodes.id = audioctx.creategain(); osc.id = audioctx.createoscillator(); osc.id.connect(audioctx.destination); // set frequency osc.id.frequency.value = freq; // set gain @ 1 , fade 0 in 1 second gainnodes.id.gain.value = 1.0; gainnodes.id.gain.setvalueattime(0, audioctx.currenttime + 1); // start , connect osc.id.start(0); osc.id.connect(audioctx.destination); } any thoughts on if can done? in code connect oscillator destination twice. instead of connecting oscillator ->

java - JTable column uneditable after adding JComboBox to a cell -

i have jtable component 2 columns, second column iwant add jcombobox 1 cell, following oracle documentation i've created own cell editor, , added jcombobox after of other cells column became uneditable. here example: before adding jcombobox: after adding jcombobox, not edit other cells after adding jcombobox: my code: defaulttablemodel model = new defaulttablemodel(textostabela, stubcolumnnames); tabela.setmodel(model); tabela.setborder(new lineborder(color.black)); tabela.setgridcolor(color.black); tabela.setshowgrid(true); tabela.setpreferredsize(new dimension(290, 132)); tabela.setrowheight(22); tabela.getcolumnmodel().getcolumn(0).setpreferredwidth(160); tabela.setautoresizemode(jtable.auto_resize_all_columns); tablecolumn tm = tabela.getcolumnmodel().getcolumn(0); tm.setcellrenderer(new colorcolumnrenderer(color.lightgray)); tablecolumn combocol1 = tabela.getcolumnmodel().getcolumn(1); jcombobox combobox = new jcombobox(valorescombobox); combobox.setselectedindex

Objective-c readonly copy properties and ivars -

i'm try grok properties declared both copy , readonly in objective-c, , specifically, whether have copy myself. in init methods. evidence suggests do: @interface : nsobject @property(nonatomic, copy, readonly) nsdata *test; - (instancetype)initwithdata:(nsdata *)data; @end @implementation - (instancetype)initwithdata:(nsdata *)data { if ((self = [super init]) != nil) { _test = data; } return self; } @end int main (void) { nsdata *d1 = [nsmutabledata datawithbytes:"1234" length:5]; *a = [[a alloc] initwithdata:d1]; nslog(@"%lx", (unsigned long)d1); nslog(@"%lx", (unsigned long)a.test); return 0; } i had thought self.test = data in init method, not permitted because it's readonly (not unexpectedly). of course, self.test = [data copy] ensures 2 different objects. so: there way create readonly property in objective-c copies incoming value, or sufficiently edge case combination pointless

copy paste - Copying lines from Wordpad into Excel using VBA -

i writing code import files under tmx (a form of xml). tried various options a) using open filename input, messes character encoding b) opening file , copying data using msodialog, return error if file large (which case) , put data in utterly messy manner. c) opening file using notepad, there same limitations in far copying entirety of file excel previous option. not trying use shell function calling onto wordpad. my issue right now, need copy file line line treat content according needs (hopefully without losing character encoding would know how copy every single line file opened in wordpad , paste post treatment (selection of relevant elements) excel? thank you for large files can use solution: public sub importtmxtoexcel() call application.filedialog(msofiledialogopen).filters.clear call application.filedialog(msofiledialogopen).filters.add("tmx files", "*.tmx") application.filedialog(msofiledialogopen).title = "select file import

php - Is there away to get folder names inside another folder? -

Image
i searching way folder names inside folder to clear want do: i have folder located in desktop named 'myfiles' under folder have tree folders 'home','school' , 'student' is possible names of tree folders inside 'myfiles' , echo them using php? 'myfiles' pure files = **c:\users\sullanob\desktop\myfiles** in way can monitor , organized folders using web based application thanks in advance.. you can use php's scandir function. function listsubfolders($path) { return array_diff(scandir($path), array('.','..')); } var_dump(listsubfolders('c:/users/sullanob/desktop/myfiles'));

parsing - Generate abstract syntax tree for Java source code? -

for project, need to: convert java source code ast. modify ast (e.g. add statements, modify expressions). convert ast source code compilation. i know antlr can parse java code, looks have tweak grammar file produce ast. there out-of-the-box solution me ast?

android - TBMP skeleton - How do I override notification events -

i following tbmp skeleton app create own turnbased multiplayer game. i tried using these methods handle notifications never called: @override public void oninvitationreceived(invitation invitation) { toast.maketext( this, "an invitation has arrived " + invitation.getinviter().getdisplayname(), toast_delay) .show(); } @override public void onturnbasedmatchreceived(turnbasedmatch match) { toast.maketext(this, "a match updated.", toast_delay).show(); } does know why these methods aren't called when player clicks on game notification? and alternatively, if these methods never being called, how google api handle receiving notifications? my notification messages instead: player1 invites match of skeleton tbmp , it's turn in match of tbmp skeleton player1 turns out missing these lines: games.invitations.registerinvitationlistener(getapiclient(), this); games.turnbasedmulti

javascript - Parse does not show all my file once I add a new file -

my web application allows users create , view files have created. when user logs in can see files created, when users creates new file, , clicks view files, newly created file not there. here code saving file in parse: router.post('/newfile', function(req, res) { var usercode = req.body.code; console.log(usercode); newname = req.body.name; console.log(newname); var bytes = []; var doc = {}; (var = 0; < usercode.length; i++) { bytes.push(usercode.charcodeat(i)); }; console.log("passed byetes"); var parsefile = new parse.file(newname, bytes); parsefile.save(); var fileclass = parse.object.extend("file"); var newfile = new fileclass(); newfile.save({ user: parse.user.current(), filename: newname, javafile: parsefile }); var newfileclass = parse.object.extend("file"); var query = new parse.query(newfileclass); query.find(function(results) { (var = 0; < results.length; i++)

rust - Preventing move semantics during pattern matching -

i have silly example here, demonstrate issue i'm running library , pattern matching. struct person { name: string, age: i32, choice: choices } #[derive(debug)] enum choices { good, neutral, evil } fn find(p: person) { match (p.choice, p.age) { (choices::good, a) if < 80 => { announce(p); } (_, a) if >= 80 => { println!("you're old care."); } _ => { println!("you're not nice!") } } } fn announce(p: person) { println!("your name {}. {:?}.", p.name, p.choice); } fn main() { let p = person { name: "bob".to_string(), age: 20, choice: choices::good }; find(p); } now issue seems during pattern matching, move semantics kick in , take ownership on inner struct (thing) in person. when go move person on next method, can't becaus