Posts

Showing posts from May, 2011

php - Extract heading and paragraphs of a docx-file -

i need read docx-file i.e. headings , content of document in variables. i'm reading file this: function read_file_docx($filename){ if(!$filename || !file_exists($filename)) return false; $zip = zip_open($filename); if (!$zip || is_numeric($zip)) return false; while ($zip_entry = zip_read($zip)) { if (zip_entry_open($zip, $zip_entry) == false) continue; if (zip_entry_name($zip_entry) != "word/document.xml") continue; $content .= zip_entry_read($zip_entry, zip_entry_filesize($zip_entry)); zip_entry_close($zip_entry); } zip_close($zip); //$striped_content = strip_tags($content); return $striped_content; } my problem how i.e. heading1, heading2 , heading 3 , content of parts in array further processing.

How to access nested array JSON file in blackberry 10 using qml -

i have following json file trying access time, percent, amount above nested array json file using qml. not able these data. want data fill in table has 3 columns. please tell me how it. sample.json: { "rates": [ { "time": "3 months", "interest": [ { "percent": "0.01", "amount": "2500" }, { "percent": "0.02", "amount": "5000" }, { "percent": "0.09", "amount": "10000" } ] }, { "time": "6 months", "interest": [ { "percent": "0.10", "amount": "2500" }, { "percent": "0.11", "amount": &qu

sql - Count non empty fields in MYSQL -

i have simple mysql table1: id 1 2 3 and table2: id | question | answer 1 | how | 2 | | fine 3 | | ok and simple query: select table1.id,count(answer not null) table1 left join table2 on table1.id = table2.id i want count non empty answer fields. tried not null it's not working answer column not null , not applicable lead main query return nothing you try this, capture blank: select count(id) table answer not null or answer <>'' that should grab , count row has value in "answer". or, if there join: select table1.count(id), table2.question table1 left outer join tabel1 on table1.id = table2.id group table1.id,table2.question having (table2.answer <> '') or (table2.answer not null)

c# - .net Cookie dissapears after session Timeout -

i have bit of problem handling cookies/session timeout, need persistent cookie expire not @ session timeout, after. problem is, when .net session dissapears after timeout, cookie value not being found, here's code use set cookie , retrieve it. code sets cookie: httpcookie cookiecontext = new httpcookie("cookiecontext"); datetime = datetime.now; cookiecontext["context"] = "mb"; cookiecontext.expires = now.addhours(5); httpcontext.current.response.cookies.add(cookiecontext); code gets cookie @ errorout page when timeout happens (verifycookie() function clears cookie after using it): if (httpcontext.current.request.cookies["cookiecontext"] != null ) { if (httpcontext.current.request.cookies["cookiecontext"]["context"] == "mb") {

javascript - Custom numerical search in Adobe Acrobat -

i haven been trying figure out how write greater / less custom search in adobe acrobat, can't seem figure out. i have consulted this , seems apply text search. i wrote this, didn't work: search.query(> "1000","activedoc"); i'm not sure i'm doing wrong. can please provide guidance? thanks. i able working, though i'd rather able search through numbers (using normal search function) versus having open javascript console answers. for (var p=0; p<this.numpages; p++) { (var n=0; n<this.getpagenumwords(p); n++) { var w = this.getpagenthword(p, n); if (w >= 10000) { console.println(w); } else if (w <= -10000) { console.println(w); } } }

objective c - IOS: Is it possible preserve the State of UIViewController in Background -

am developing ios app. need make images upload server. using nsurlsession , uploadtaskwithrequest this. every thing working fine in normal way. requirement user wants store post more 10 images in app using database sqllite. , later show stored posts in uitableview button each uitableviewcell . when user tap on each button should start uploading each post server. thought should persist uiviewcontroller in appdelegate process of uploading should not killed when user go view controllers. my problem: when user close app process in uiviewcontroller post uploading stoping. know how keep uiviewcontroller live in app go close or go background. is there better way fulfill requirement. here better ways! use singleton. in apps, i'll create class called "datahandler" handles of nsurlsession/coredata/etc stuff have is [datahandler uploadimages:images]; and when need information i'll call self.tabledata = [datahandler lastuploadedimages]; thi

c# - wcf router doesn't expose metadata -

there 30 wcf services , use wcf router distribute requests client. wcf services hosted windows service. when put client , service in same computer, client , service can contact each other. however, when in different machines, client can't contact service. used wcftestclient test service , can't add service, or can't add service if use added client project test it. individual service use net.pipe , router uses net.tcp if service in different machine client. have been working on couple of weeks , problem still there. can point out possibly wrong it? lot! we have setting configuration file end users input name of service server address. port number in setting file also. if (!this._issinglecomputer) { // add protocol conversion router uri routerbaseaddress = new uri(publicbaseaddress, "router"); _routingsvchost = new servicehost(typeof(routingservice), routerbaseaddress); _routingsvchostmex = new ser

javascript - Mimic Django's "add" button for related fields in admin -

Image
django has admin feature related fields when press "+" button, , can add new data , attaches via jquery, i'm assuming. i've looked @ code, , not find anywhere. how mimic in php? so, once add new 'category', id attaches onto 'category' field in window behind it. submit form , wala. how work? this nice feature of django admin, sonataadminbundle symfony didn't implement (yet). browsed source code , found javascript function: django/contrib/admin/static/admin/js/admin/relatedobjectlookups.js function showaddanotherpopup(triggeringlink) { var name = triggeringlink.id.replace(/^add_/, ''); name = id_to_windowname(name); href = triggeringlink.href if (href.indexof('?') == -1) { href += '?_popup=1'; } else { href += '&_popup=1'; } var win = window.open(href, name, 'height=500,width=800,resizable=yes,scrollbars=yes'); win.focus(); return f

ios - Frequently Accessed Objects/Classes -

within swift application, there 2 classes interact in 75% of app. 1 set of settings called usersettings, , other called job. these both stored in sqllite. most of time it's reading values set, , on 1 areas writes. seems strange have keep reinstantiating settings , job services communicate database me same object i'm accessing across board. in case this, options me see either constantly reading/writing database, or do sort of singleton accessed throughout entire app. i'm not sure how swift changes in terms of arriving @ answer question, wanted seek of stack overflow. how set object can access throughout entire app? or not ideal , instead need db every time? thanks much. i recommend read how core data works, know managing own store, architecture works fine. summary can create "context object"(this singleton) interacts store (sqlite) creating managed objects, work objects associated "context object", , when ever need save changes,

c++11 - c++ std::make_shared with new macro -

i use macro in place of new information in debug mode: #if defined(_debug) #define sage_new new(__function__, __file__, __line__) #else #define sage_new new #endif i have found quite useful in custom memory profiling , memory leak detection. started using shared pointers, making heap objects like: auto mythingy = std::shared_ptr<thingy>(sage_new thingy(args) ); i have learned std::make_shared preferred because uses fewer memory allocations. there way can include sage_new in make_shared ? realize won't matter leak detection still memory usage statistics. seems allocate_shared somehow holds answer haven't figured out. thanks! :) edit : asking new - overload custom new . compiler option sage_mem_info turns on leak detection , memory usage stats, otherwise skips logging , goes directly memory pool allocation. have new[] , delete[] variants i'm omitting brevity: #ifdef sage_mem_info void* operator new (size_t size){ ++appallocs; return myalloc(size);

jquery - Get text from custom tag -

this question has answer here: jquery : select element custom attribute [duplicate] 2 answers how can address code jquery ? <span property="v:street-address">2 macdonald street</span> thanks. $("span[property='v:street-address']").text()

Google App Engine (Python SDK) - How to catch db exceptions -

i'm using google app engine python , encountering errors this: raise badvalueerror('property %s not multi-line' % self.name) badvalueerror: property title not multi-line error 2014-09-20 16:01:23,969 wsgi.py:278] traceback (most recent call last): i've imported db module: from google.appengine.ext import db and attempting silently (for now) catch error code this: try: r.put() except db.error: pass yet error continues break program execution. doing wrong? (or not doing?) thanks... here full traceback: traceback (most recent call last): file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/lib/webapp2-2.3/webapp2.py", line 1511, in __call__ rv = self.handle_exception(request, response, e) file "/applications/googleappenginelauncher.app/contents/resources/googleappengine-default.bundle/contents/resources/google_appengine/lib/webapp2-2.3/web

javascript - Detect and flag unused JS variables -

i'm using jshint , jscs (javascript code style checker) none of them can detect kind of unused variables: describe('xx', function () { var xxunused; beforeeach(inject(function ($injector) { xxunused = $injector.get('xxunused'); })); // xxunused (as name says) not used in other way in block. }); someone knows tool can flag automatically these variables? there analytics tools called esprima. please take @ following links: http://tobyho.com/2013/12/02/fun-with-esprima/ https://gist.github.com/benvie/4657032 http://ariya.ofilabs.com/2012/11/polluting-and-unused-javascript-variables.html you should familiar nodejs. easier use esprima in nodejs.

Trying to change output for a timer in a form in c# -

i need make form in c# have timer , have label have display of timer. label need generic label @ first saying counter, when timer starts needs display count. have display number down but, needs control can tweak count, does. can't sole counter. here assignment: create windows application. in main form, create label named “ltickcount”. create timer named “tperiodic”, , numerical control of own choosing. each time timer “ticks” increment integer, display integer value string in ltickcount. use numerical control change update rate of timer interactively. i think have done correctly except bold part. finish tried make string in both label , counter. know shouldn't have in both, wanted show 2 things i've tried better feedback: namespace windowsformsapplication3 { public partial class form1 : form { public form1() { initializecomponent(); this.text = "aaaaaaaa aaaaaaaa ########"; } private v

ios - How can I get number of objects in section, NSFetchedResultsController Swift -

how can number of objects in section of nsfetchedresultccontroller in swift? if let s = self.fetchedresultscontroller?.sections as? nsfetchedresultssectioninfo { } is giving me cannot downcast '[anyobject]' non-@objc protocol type nsfetchedresultssectioninfo var d = self.fetchedresultscontroller?.sections[section].numberofobjects gives me does not have member named 'subscript' you need cast self.fetchedresultscontroller?.sections array of nsfetchedresultssectioninfo objects: if let s = self.fetchedresultscontroller?.sections as? [nsfetchedresultssectioninfo] then can pass section subscript , number of objects: if let s = self.fetchedresultscontroller?.sections as? [nsfetchedresultssectioninfo] { d = s[section].numberofobjects }

how to Link/Merge/Combine two contacts in android? -

how can link 2 contacts example email address , a phone number application? thanks, the answer contactscontract.aggregationexceptions for more information, go click http://developer.android.com/reference/android/provider/contactscontract.aggregationexceptions.html ?

python - When using a scrolled canvas in Tkinter, columns of contained frame are cut off -

i'm trying make tkinter widget contains number of tables, frames entries filled using .grid method, can switched between pressing buttons. current attempt @ solution uses following code: from tkinter import * def dot(root, num): root.subframe.destroy() root.subframe = tframe(root, num) root = tk() vscrollbar = scrollbar(root,orient='vertical') vscrollbar.grid(row=1,column=2,sticky=n+e+w+s) root.defaultframe = mainframe(root) root.canvas = canvas(root, yscrollcommand=vscrollbar.set) root.subframe = frame(root.canvas) vscrollbar.config(command=root.canvas.yview) root.canvas.grid(row=1,column=0) root.subframe.grid(row=0,column=0) where mainframe has following structure: class mainframe(frame): def __init__(self, root): frame.__init__(self, root) self.grid(row=0,column=0) b1 = button(self, text='table 1', command=lambda: dot(root, 0)) b2 = button(self, text='table 2', command=lambda: dot(root, 1))

sql - using two inner join in mysql query -

Image
i have 2 tables below pictures : users table : offer_comments offer_comments table stores comments , answer comments. using below function can comments , answer comments depending on $id . function getcommentsanitem($id){ mysql_query("set character set utf8"); $result_comments = mysql_query("select e.comment comment,m.comment answer_to_comment offer_comments e inner join offer_comments m on e.id = m.quet e.offer_id=$id , e.confirm=1"); $comments = array(); while($a_comment=mysql_fetch_object($result_comments)){ $comment = array( 'comment'=>$a_comment->comment, 'answer'=>$a_comment->answer_to_comment ); array_push($comments,$comment); } return $comments ; } now,i use inner join instead of offer_comments , how can ? use below sql instead of offer_comments : select offer.*,u.id,u.name,u.family offer_comments offer inner join users

Using resolve on url with query params in django -

using resolve on url without query params result in resolve('/tracking/url/') resolvermatch(func=<function tracking_url_url @ 0x028d62b0>, args=(), kwargs={}, url_name='tracking-url-url', app_name='none', namespace='') using resolve on url query params (the url works in browser) results in resolver404 error resolve('/tracking/url/?url=home') traceback (most recent call last): file "<console>", line 1, in <module> file "c:\python27\lib\site-packages\django\core\urlresolvers.py", line 476, in resolve return get_resolver(urlconf).resolve(path) file "c:\python27\lib\site-packages\django\core\urlresolvers.py", line 352, in resolve raise resolver404({'tried': tried, 'path': new_path}) the url entry url(r'^tracking/url/$', 'myauth.views.tracking_url_url', name='tracking-url-url'), what best way resolve url query params , dict of qs same

javascript - Bold is too Bold in Chrome/Firefox -

i've testing in in safari , works fine, when using chrome or firefox bold way bold. here sample chunk of code i'm using: html: <ul> <font face="times new roman" size="2"> <li> <span> cooly guy </span> - <span class="i"> human </span> <br> robot, alien, adi, <br> yolo, fa <br> youtube.com/yt.id </font> </li> </ul> css: #users span { font-weight: bold; } #users2 span { font-weight: bold; } #users ul span.i { font-style: italic; } safari on left, chrome in center , firefox on right: http://gyazo.com/219ff996619292b089d2b0866bb4a553 as can see chrome's , firefox's bold text looks 'fuzzy' compared safari. try giving numeric values instead of bold #users span{ font-weight: 600; } #users2 span{ font-weight: 500; } #users u

javascript - Make form buttons disappear after clicking them (game) -

i had developer work on game me (so i'm not coder - rookie!), i'd add quick mod myself..... is there simple way make each form button disappear once selected, buttons reload/display again once new round loads up? http://www.slinkyproductions.co.uk/games/movie-hangman/ many thanks. scott change buttons to <input name="letterz" onclick="letter('z')" type="button" value="z" class="letter" id="btnz"> and add line letter() function $("btn"+param).hide();

html - how to search date field using php - mysqli -

i'm having trouble searching date field of mysql database.. have html form..that allows user choose 3 different ways search database.. field 1 student_id, field 2 lastname, field 3 date. when run program , choose student id, proper result back, when same using last name proper result back, when use date..i not return. happen know result should because see in database..and besides same data record student id, , last name. think might have format, can't figure out.. i not know ajax please don't suggest ajax code right now. here html code. [code] -- start javascript --> <script type="text/javascript"> /*<![cdata[ */ function check(){ if(document.lastname.last.value == "" || document.lastname.last.value == null) { alert("no last name entered"); return false; } } function checkdate() { var date_regex = /^(0[1-9]|1[0-2])\/(0[1-9]|1\d|2\d|3[01])\/(19|20)\d{2}$/ ; if(!(date_regex.test(testdate))) {

Submit a Form to Custom URL in Laravel 4 -

i have simple form allows user enter from_date , to_date .lets user enters 2014-09-01 , 2014-09-10 respectively. how can form submit url ../from_date/2014-09-01/to_date/2014-09-10 you cannot if need this, need submit standard class controller , resubmit using redirection: public function resubmit() { redirect::to('/from_date/'.input::get('from_date').'/to_date/'.input::get('to_date'))->withinput(); } but honest don't know why try that. post data static url , display content using dynamic urls pretty urls.

python - How do CPython and PyPy decide when to resize a set? -

when adding elements sets on cpython , pypy, when resized, , sizes of underlying container? this question similar in principle max_load_factor , as c++ describes unordered_map . cpython uses this check decide when resize: if (!(so->used > n_used && so->fill*3 >= (so->mask+1)*2)) this means when 2/3 full, container resize. the resizing doubles amount of space large sets , quadruples small ones: return set_table_resize(so, so->used>50000 ? so->used*2 : so->used*4); armin rigo points out in comments pypy implements sets dictionaries, relevant resizing code is: jit.conditional_call(d.resize_counter <= x * 3, _ll_dict_resize_to, d, num_extra) this same strategy, resize_counter empty space left in dictionary. before pointed out, resorted benchmarking. can detect resizes looking small pauses. random small sizes, have careful remove noise. here's script that: from collections import counter imp

DatePicker does not exist in the namespace in windows phone 8.0 -

when run application works fine design page giving error "invalid markup" , name "datepicker" not exist in namespace "clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.controls.toolkit". i think spelling mistake assembly xmlns:toolkit="clr-namespace:microsoft.phone.controls;assembly=microsoft.phone.controls.toolkit"

android - How to update progress bar in Async Task -

i'm building simple backup app android , code reads , stores messages in phone memory csv file,initially displaying indeterminate progress bar,but user of app might impatient (if messages many) wanted add determinate horizontal progress bar show them actual progress,i've been trying sometime can't right,i know i'm supposed use onprogressupdate method in async task class, don't know how implement i'm getting lot of exceptions,so tried doing in different without method , code below package daniel.idea.backup; import java.io.file; import java.io.fileinputstream; import java.io.fileoutputstream; import java.io.filewriter; import java.io.ioexception; import java.util.arraylist; import android.app.activity; import android.app.progressdialog; import android.content.context; import android.content.res.assetfiledescriptor; import android.database.cursor; import android.net.uri; import android.os.asynctask; import android.os.bundle; import android.os.environment;

How to calculate logarithms in java? -

i'm trying write java program can take values , put them formula involving log 1/3. how can calculate log 1/3 in java? you can use math.log(value) log of specific value value considered in double .you can use math.log10(value) base 10 log. so can use math.log(1/3.0)

docker - mount a host volume to a container created through Dockerfile -

new docker, , per documentation dockerfile , due portability, not allowed specify host volume mapping. fine, there way map host volume (i in mac, say, home dir /users/bsr /data of ubuntu image) linux container. documentation of docker volume talking docker run , not sure how add volume after creating it. http://docs.docker.com/userguide/dockervolumes/ on linux can mount directory of host system docker container passing -v /path/to/host/directory:/path/to/container/directory to docker run command. you can see here in documentation: https://docs.docker.com/userguide/dockervolumes/#mount-a-host-directory-as-a-data-volume if using boot2docker things more complicated. problem ist boot2docker runs little linux vm start docker. if mount volume described above mount directory of little linux vm. a workaround described in readme of boot2docker github page using samba share: https://github.com/boot2docker/boot2docker#folder-sharing

unity3d - Texture from Blender doesn't appear in Unity 3D -

i've searched endlessly answer question. however, have created model in blender , export .fbx directly unity. textures have applied in blender not render in unity (even in preview screen). have uv unwrapped model, , created custom texture pattern suit. i've inserted textures unity, loads them how unity feels, not how i'd look. i've attempted add .blend file, blender crashes, , fails convert .fbx file in unity. model of wall, 3 doorways, , 3 doors. wall has own texture, , doors have same texture. (i'd upload images haven't earnt enough rep). there simple solution? or on looking whole process , missing important out? after uv unwrapped model save uv in file in blender should apply file texture model in unity , done,tell me if have done that. here useful tutorials.

ruby - rails relationship. Rails 4 -

i'm new in world of rails developers. please, me understand. i've 3 tables: calls, questions, results calls is: id, name, date questions is: id, question results is: id, call_id, question_id, result i've read rails manual, understand i've created 3 models. in model call.rb i've done next relationship: has_many :results has_many :question, through: :results my result.rb belongs_to :call belongs_to :question my question.rb has_many :result so, there can many records in table "results" 1 call_id , , it's can 1 relation question through results table if if try launch code this: @calls = call.all than on view: <% @calls.each |call| %> <%= call.result.result %> <% end %> i've error "result undefined method". it's must property. what wrong? thanks! according schema, associations should this class call < activerecord::base has_many :questions has_many :results en

javascript - ACE Editor "end of parsing" event -

i function called when ace editor ends parsing new source code able, example, add click event listener on every subsequent .ace_identifier dom node. far, not find right ace event use , simple following code not anything: editor = ace.edit $('#editor') editor.setreadonly true // editor change event - never triggered in case editor.getsession().on 'change', (e) -> console.log e // changing language makes ace parse source code , generates // new dom... editor.getsession().setmode "ace/mode/javascript" // ... point, $('.ace_identifier') returns empty array // instead of expected list of ace_identifiers created console.log $('.ace_identifier') there no event "end of parsing", use afterrender event on editor.renderer , ace uses dom canvas, creating nodes visible part of text, , discarding , redrawing whole thing, adding event listeners dom nodes inside ace editor bad idea.

jquery - Remove duplicated table column incl. table head to new table -

i've tried different workarounds , modified scripts can't in way i'd to i've table , duplicated columns (inclusive additional table th) should moved table 2 ... different columns should stay in table 1 <table width="200" border="1"> <tbody> <tr> <th scope="col">colour</th> <th scope="col">weight</th> <th scope="col">width</th> <th scope="col">size</th> <th scope="col">price</th> </tr> <tr> <td>black</td> <td>20kg</td> <td>10cm</td> <td>xl</td> <td>20,90€</td> </tr> <tr> <td>green</td> <td>20kg</td> <td>8cm</td> <td>xl</td> <td>20,90€</td> </tr> <tr> <td>red</td> <td>20kg</td> <td>5cm</td> &l

How to pass session value in webdriver switchTo().window method -

i need pass session value 1 window other window. sing switchto() method in webdriver, if need new window's findelement(by.linktext). click() event, session value not sending link becoming invalid. please provide example handles passing session values. thanks in advance. venkat this script helps switch on parent window child window , cntrl parent window string parentwindow = driver.getwindowhandle(); set<string> handles = driver.getwindowhandles(); for(string windowhandle : handles) { if(!windowhandle.equals(parentwindow)) { driver.switchto().window(windowhandle); //perform operation here new window driver.close(); //closing child window driver.switchto().window(parentwindow); //cntrl parent window } }

vhdl - How to deal with signed numbers correctly and still use "+" -

library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; entity alu_16 port ( : in std_logic_vector(15 downto 0); b : in std_logic_vector(15 downto 0); sel : in std_logic_vector (1 downto 0); gt : out std_logic; lt : out std_logic; eq : out std_logic; result : out signed(15 downto 0); overflow : out std_logic; cout : in std_logic); end alu_16; architecture behavioral of alu_16 signal inter_res : signed(16 downto 0); signal subtraction : signed(16 downto 0); signal addition : signed (16 downto 0); signal carry_in : std_logic; signal carry_out : std_logic; signal msb_bit_add : std_logic; begin gt <= '1' when > b else '0'; lt <= '1' when < b else '0'; eq <= '1' when = b else '0'; subtraction <= signed(a) - signed(b); addition <= signed(a) + signed(b); sel se

Modeling a approval process in a graph database? -

i have approval process need model graph , wondering how best it. itself, approval process not make sense model graph, connected bunch of other data does, goal put data in same place. here in megacorp have bunch of reports need out door in 5 weeks , each need approved boss a, boss b, boss c , big boss. each boss should have report 1 week. i need able answer questions like: which reports in approval process now? which reports late now? which boss caused delay last year? how many reports got out door in allotted time last quarter? if helps, never particularly large dataset. how should model such approval process in graph database? graph database should used if have highly connected data particularly large datasets. for problem graph databases can used overkill if not hoping use recommendation engine or other highly active graph traversing. i think problem can modelled in traditional rdbms database , easy maintain.

bash - Replacing VCG1 or VCG2 with VCG* in perl script -

with of jaypal in previous question ( https://stackoverflow.com/a/25735444/3767980 ) able format restraints both ambigous , unambigous cases. let's consider ambiguous here more difficult. i have restraints like g6n-d5c-?: (116.663, 177.052, 29.149) k87cd/e85cb/e94cb/h32cb/q21cb l12n-t11c-?: (128.977, 175.109, 174.412) k158c/h60c/a152c/n127c/y159c(noth60c) k14n-e13c-?: (117.377, 176.474, 29.823) i187cg1/v78cg2 a75n-q74c-?: (123.129, 177.253, 23.513) v131cg1/v135cg1/v78cg1 and subjected following perl script: #!/usr/bin/perl use strict; use warnings; use autodie; # open $fh, '<', $argv[0]; while (<$fh>) { @values = map { /.(\d+)(\w+)/; $1, $2 } split '/', (split)[-1]; ( $resid, $name ) = /^[^-]+-.(\d+)(\w+)-/; print "assign (resid $resid , name $name ) ("; print join ( " or ", map { "resid $values[$_] , name $values[$_ + 1]" } grep { not $_ % 2 } 0 .. $#values ); print

sequence - Pybrain creating a time-series input -

i have snippet of code goes this ds = sequentialdataset(1,1) ds.newsequence() ds.appendlinked([a],[b]) ds.appendlinked([b],[c]) ds.appendlinked([c],[d]) this creates sequential data set 1 sequence, , here, can feed data network 1 input node , 1 output node. my question is, reckon data being fed network 1 one @ different time steps creates time-series input? thanks!

ios - Afnetworking late response -

i new afnetworking, want array after running function crash loads data array late, there way stop till loads data array? -(void) getmodeldetails :(nsstring*)brandname completionhandler:(void (^)(id array))success { nsstring *brand = [brandname stringbyaddingpercentescapesusingencoding:nsutf8stringencoding]; [mbprogresshud showhudaddedto:self.view animated:yes]; afhttprequestoperationmanager *manager = [afhttprequestoperationmanager manager]; nsstring *link = [nsstring stringwithformat:@"http://phablet-fix.com/mob/get-model-details.php?model=%@",brand]; nslog(@"%@",link); manager.responseserializer.acceptablecontenttypes = [manager.responseserializer.acceptablecontenttypes setbyaddingobject:@"text/html"]; [manager get:link parameters:nil success:^(afhttprequestoperation *operation, id responseobject) { nslog(@"json: %@", responseobject); nsmutablearray *dataarray = [[nsmutablearray alloc] init

python - TextCtrl widget crashing in linux -

i using below code snippet, working correctly in windows operating system, when comes linux, closing segmentation fault. self.textmessage = wx.textctrl(self, -1, '', style=wx.te_multiline|wx.te_readonly) self.hsizer2.add(item=self.textmessage, proportion=1, flag=wx.expand|wx.all, border=3) self.vsizer.add(item=self.hsizer2, proportion=1, flag=wx.expand|wx.all, border=0) self.textmessage.appendtext(message+" \n") i using redhat enterprise linux. possible replace textctrl widget other widgets , there custom widgets textctrl? also let me know if miss in above code avoid crash problem thanks in advance. i tested code in actual runnable example on kubuntu 14.04 box wxpython 2.8.12 , python 2.7.6 , worked fine. see following example: import wx ######################################################################## class mypanel(wx.panel): """""" #-----------------------------------------------------------------

javascript - Alert the id name -

if have following code: <input type="text" id="messagebox" /> how id value? notice not $("#messagebox"); want. want alert id name of control. should alert word "messagebox", cus name of id there couple of ways it. you can use prop() it: var id = $("input:text").prop("id"); or way: var id = $("input:text")[0].id; or use get() : var id = $("input:text").get(0).id; or can use attr() : var id = $("input:text").attr('id')

javascript - Google charts mouseover for two charts -

this question concerns working google charts. i have dataset consisting of categories contribution amounts, bucketed days of month. represent entire month in pie chart, , represent data individual days in stacked bar chart. both charts based on same information. if give both charts information in right order, colors coordinated between 2 (i.e. each category in 1 has same color same category in other). when hover mouse on pie slice, highlighted. have corresponding data in stacked bar chart highlighted @ same time, , vica versa. what best way accomplish google visualization api? use <chart type>#setselection method highlight data points. if understand data structure correctly, should work: google.visualization.events.addlistener(piechart, 'select', function () { var selection = piechart.getselection(); if (selection.length) { // assumes row in piechart's data corresponds data series in columnchart, nth + 1 column columnchar

xaml - wpf custom checkbox with text inside icon -

i'm new in xaml. create custom checkbox text instead of default checkmark. kind of [yes] accept value (checked state) [no] accept value (unchecked state) i don't want use images "static" text. can please forward me sample or article, cover following scope. for need modify default control template. here simple example of how might it: <!--x:key="phonecheckbox"--> <style targettype="checkbox" x:key="yesnocheckbox"> <setter property="content" value="accept value" /> <setter property="template"> <setter.value> <controltemplate targettype="checkbox"> <grid background="transparent"> <visualstatemanager.visualstategroups> <visualstategroup x:name="commonstates"> <visualstate x:name="normal"/> <visualstate x:name=&quo

c - Execute a function for x seconds every y seconds on Arduino -

i execute function x seconds every y seconds on arduino. i'm trying control resistance heat water in constant rate (1o celsius per minute), thought was: i'll measure rate when it's running whole minute , i'll adjust desired rate. let's heats 5o celsius per minute, activate resistance 60/5 seconds, not @ once, thinking activating resistance 1 second every 12 seconds keep rate constant no matter (if day cold, hot, if change equipment etc.) do guys think possible? if not, ideas how can make work? saw timer.h library doesn't seems solve problem =/ thanks in advance, please let me know if information can useful! i think easiest approach use millis() function. here's 1 example, depend on how control operating. const int ontime=1000; // in ms const int offtime=12000; // in ms const int resistorpin=7; // change necessary boolean currentlyon=false; unsigned long starttime; void setup(){ pinmode(resistorpin,output); digitalwrite(resistorpin