Posts

Showing posts from June, 2013

How to implement 'To' field functionality present in Windows Phone 8 inbuild message application -

i need implement functionality similar 'to' field present in windows phone 8 in build message application. whenever user wants remove name 'to' field, needs tap on name 1 message pop displayed remove, open, copy , cancel user cannot place cursor in between of name, once name ended semicolon can suggest me approach implement feature? thanks in advance this custom control have write. not delivered along other windows phone controls. here scetch of how achieve this: custom control combination of textblock ("to:" field) followed gridview , followed textbox (input field). @ beginning, gridview has no entries , therefore not visible. if user selects email type ahead or closes input semicolon (listen keyup event of textbox), control logic creates instance of datamodel holds id, email address, name , whatever need. instance added observablecollection bound gridview . having observablecollection in place result in automatic display of entr

html - Table display issue, only in Chrome -

Image
i don't know how deal this, table works fine on firefox/ie see : on chrome : here actual css of table table { padding: 24px; margin: 0 auto; width: 550px; } td#tadmin td#tabmin { width: 30px; height: auto; float: left; font-family: "roboto","helvetica neue",helvetica,arial,sans-serif; font-size: 15px; } tried table-layout: fixed; do not work. as asked, display table in php using echo: echo "<table style='padding:24px;margin:0 auto;width:550px;'>". "<tr>". "<td id=tabmin >". "<div class=tabminscale style=text-align:center;>" .$row['min']."'"."</div>". "</td>". "<td id=tabcom >" . "<div id=commentaires>". $row['commentaire']."</br>". "</td>". "</tr>". </div>";

c# - VS2013- Japanese compilation broken? -

i'm sorry if sounds confused, see if has ideas :( i have built library use openbve train simulator- https://github.com/leezer3/bvec_ats i'm english, , have tested/ compiled under windows , ubuntu (12.04) i have had message japanese user, compiled using vs2013, , attempting run under ubuntu 12.04. my precompiled version works correctly, version throwing error (identical source): a critical error has occured: route , train loader encountered following critical error:default constructor not found type plugin.advanceddriving. please inspect error log file further information. this constructor advanceddriving window looks like: private advanceddriving() { //window show advanced driving debug information initializecomponent(); this.locationchanged += new eventhandler(advanceddriving_locationchanged); this.sizechanged += new eventhandler(advanceddriving_sizechanged); this.formclosed += new formclosed

java - Spring Batch: adjusting transaction properties in a fault tolerant step -

i have quite basic step in spring batch job (using java config): @bean public step step1() { return stepbuilders.get("stepname") .<object1, void>chunk(50) .reader(reader(inputresource(null)) .processor(processor()) .listener(steplogger()) .transactionattribute(transactiontimeoutattribute(null)) .build(); } ....... @bean @stepscope public stepexecutionlistener steplogger() { return new steplogger(); } @bean @stepscope public transactionattribute transactiontimeoutattribute( @value("#{jobparameters[transactiontimeout]}") integer timeout) { timeout = timeout != null ? timeout : default_transaction_timeout; rulebasedtransactionattribute transactionattribute = new rulebasedtransactionattribute(); transactionattribute.settimeout(timeout); return transactiontimeout; } as can see, it's requirement transaction timeout can given job parameter. works flawlessly, , if set tra

python - Export BigQuery Data to CSV without using Google Cloud Storage -

i writing software, export large amounts of bigquery data , store queried results locally csv files. used python 3 , client provided google. did configuration , authentification, problem is, can't store data locally. everytime execute, following error message : googleapiclient.errors.httperror: https://www.googleapis.com/bigquery/v2/projects/round-office-769/jobs?alt=json returned "invalid extract destination uri 'response/file-name-*.csv'. must valid google storage path."> this job configuration: def export_table(service, cloud_storage_path, projectid, datasetid, tableid, sqlquery, export_format="csv", num_retries=5): # generate unique job_id retries # don't accidentally duplicate export job_data = { 'jobreference': { 'projectid': projectid, 'jobid': str(uuid.uuid4()) }, 'configuration': { 'extract': { '

java - How to store object inside Iterator<object>? -

so have variable string , want store inside iterator of type string, keep getting error stating incompatible types. how can store string variable inside iterator? incompatible types: required: java.util.iterator <java.lang.string> found: java.lang.string this i've done far: iterator<?> perentry = entries.iterator(); iterator<string> ids; while (perentry.hasnext()) { ids = perentry.next().getid(); } any appreciated thank you! p.s. forgot include this, how return iterator? error stating found java.util.objecttype, , requires java.util.iterator. you misunderstood iterators. iterator not equivalent object in collection being iterated. instead, acts "pointer" such object. if have iterator<entity> , can entity out of calling next() . however, iterator remain iterator on entity . cannot converted iterator of string . however, can harvest strings iterator collection, this: list<string> idlist = new arraylist<>

Android MVVM with Programmatic UI Customization -

i'm trying nail down proper mvvm layering in app android data binding lib. simple layouts, in examples, abstract nicely xml layouts binding methods in view model event handling , model updates via observables. however, more not, there's ui customization needs done programmatically (findviewbyid()...) and/or through things injecting styling attributes string resources. should treat activity/fragment part of view , whatever can't handled between vm , layout via databinding, or better handle interface vm activity/fragment (while trying keep vm pojo)? -- edit: example1 -- rendering textview multiple colors in same string : how had implemented wrapping cdata , font tags in string resource , rendering findviewbyid().settext(html.fromhtml(getstring(..))). i've modified layout instead bind in vm android:text="@{viewmodel.text1}", calls interface method fragment returns html.fromhtml(text), , vm returns spanned layout. thinking strict mvvm, wouldn't def

qt - qmake adds /usr/lib absolute path when cross compiling -

i need cross compile qt app arm. do: export sdk_mxc_path="/path/to/sdk" export qmakespec="${sdk_mxc_path}/usr/mkspecs/devices/linux-imx6-g++/" export sdk_mxc_bin="${sdk_mxc_path}/toolchain/opt/freescale/usr/local/gcc-4.6.2-glibc-2.13-linaro-multilib-2011.12/fsl-linaro-toolchain/bin/" export qmake="${sdk_mxc_bin}/qmake" export path="${sdk_mxc_bin}:${path}" ${qmake} -spec ${qmakespec} make the mkspec file seems fine: include(../common/linux_device_pre.conf) eglfs_platform_hooks_sources = $$pwd/qeglfshooks_imx6.cpp qmake_incdir += $(sdk_mxc_path)/usr/include qmake_libdir += $(sdk_mxc_path)/usr/lib qmake_libs_egl += -legl -l$(sdk_mxc_path)/usr/lib qmake_libs_opengl_es2 += -lglesv2 -legl -lgal -l$(sdk_mxc_path)/usr/lib qmake_libs_openvg += -lopenvg -legl -lgal -l$(sdk_mxc_path)/usr/lib qmake_libdir_opengl_es2 = $(sdk_mxc_path)/usr/lib qmake_lflags += -wl,-rpath-link=$(sdk_mxc_path)/

breeze - How to use breezejs with existing web services? -

i need use breeze js , angular js spa project.that develop on existing web services. can use breezejs api these type of project ? you can creating breeze controller , call existing web service controller.

caching - How to convert to text the Chrome cache gzipped data? -

i overwrite css file, original in mobile's chrome cache. found file in cache, if opened link in cache list see this: http/1.1 200 ok date: sat, 25 jul 2015 16:58:50 gmt server: apache vary: host,accept-encoding last-modified: fri, 17 jul 2015 10:51:25 gmt etag: "14ff-51b0ff82ba5ad-gzip" accept-ranges: bytes content-encoding: gzip content-length: 1483 content-type: text/css 00000000: 48 01 00 00 03 08 04 00 87 ec 5a 51 4c 7a 2e 00 h.........zqlz.. 00000010: 18 97 5c 51 4c 7a 2e 00 04 01 00 00 48 54 54 50 ..\qlz......http 00000020: 2f 31 2e 31 20 32 30 30 20 4f 4b 00 44 61 74 65 /1.1 200 ok.date 00000030: 3a 20 53 61 74 2c 20 32 35 20 4a 75 6c 20 32 30 : sat, 25 jul 20 00000040: 31 35 20 31 36 3a 35 38 3a 35 30 20 47 4d 54 00 15 16:58:50 gmt. how can convert css text file?

sql server - Add current date to SQL query followed by number -

i have sql query returns transactions previous day, every morning query runs , exports transactions file previous day. have column called id , in here @ moment 0 , insert here date , number forms unique id each transaction in file.. example, first transaction id 27071500001 , last transaction id 27071511234 . date need previous day , not current 1 how this? here select id.. select id, paidat = case when not(l_pay.shortname null) l_pay.shortname else '' end, datein = case when not(tr.entrydate null) convert(varchar, tr.entrydate, 112) else '' end, timein = case when not(tr.entrytime null) replace(tr.entrytime, ':', '') else ''

sublimetext - Remove [] square brackets from DocBlockr comment -

Image
i plugin docblockr sublime text comments bit different. the normal appearence: and how them appear: so type , description without [] square brackets there anyway of doing this? i've googled , looked trought documentation couldn't find it. lower images directly taken documentation page. i hope me making comments become lot easier. yes, there way this, have individually each language. i'll show how php example. in order this, i'm going assume have packageresourceviewer installed (you can install through package control). follow these steps: open command palette ( ctrl + shift + p ) type packageresourceviewer: open resource , press enter type docblockr , press enter using arrow keys, find file named php.sublime-completions , , press enter . doing should open completions php files. can make whatever modifications want docblockr completions specific language.

javascript - Preserving Custom Object Types When Binding Using ng-model -

Image
i have series of custom javascript objects extend base array. these objects received , processed data factory use main form controller. when bound input type (checkbox, radio, select) initial binding fine on load, data shows , works fine. however, minute update value in view, custom object type overridden , replaced base array. when sending data data factory, need know type (there several) in order determine how format sharepoint list. there way preserve object type , still allow two-way binding? when input updates model via ngmodel updates value overwrites model's initial value, , may of type. sometimes can choose return value built in attributes, such ng-true-value , ng-false-value checkboxes or ng-options "label value in array". if can't or need more reusable solution, can use ngmodel formatters , parsers. some background - ngmodel contains 2 values: $modelvalue - actual data scope property used in ngmodel expression holds - examp

C# Windows Service timer ticks more than one -

i'm trying make service should execute codes every second after codes execution ends. when start service , debug it, timer ticks more one, mean, codes executed twice before first execution ends. here codes ; timer timer1 = new timer(1000); bool _service_working = false; protected override void onstart(string[] args) { timer1.elapsed += new elapsedeventhandler(runprocess); timer1.enabled = true; timer1.start(); _service_working = false; } protected override void onstop() { timer1.enabled = false; } private void runprocess(object sender, elapsedeventargs e) { try { if (_service_working == false) { timer1.enabled=false; _service_working = true; } #region mycodes } catch (exception ex) { _logservice.insert_log(1022, 2, ex.message, "path : runprocess");

CKAN Dataset Upload Page giving a Server -

when creating dataset required either upload csv or xml file containing data or link data file located on server. when attempt upload csv or xml file upload process starts page crash following message. server error internal server error occurred also see below error in /var/log/apache2/ckan_default.error.log [mon aug 10 19:08:18.934269 2015] [:error] [pid 1243] 2015-08-10 19:08:18,934 info [ckan.lib.base] / render time 0.169 seconds [mon aug 10 19:08:21.217534 2015] [:error] [pid 1243] 2015-08-10 19:08:21,217 info [ckan.lib.base] /api/i18n/en render time 0.002 seconds [mon aug 10 19:08:23.832089 2015] [:error] [pid 1244] 2015-08-10 19:08:23,831 info [ckan.lib.base] /user/admin render time 0.413 seconds [mon aug 10 19:08:24.430716 2015] [:error] [pid 1243] 2015-08-10 19:08:24,430 info [ckan.lib.base] /api/i18n/en render time 0.002 seconds [mon aug 10 19:08:26.858892 2015] [:error] [pid 1243] 2015-08-10 19:08:26,858 warni [ckan.lib.maintain] function get_action() in mod

logstash grok filter for logs with arbitrary attribute-value pairs -

(this related other question logstash grok filter custom logs ) i have logfile lines like: 14:46:16.603 [http-nio-8080-exec-4] info metering - msg=93e6dd5e-c009-46b3-b9eb-f753ee3b889a create_job job=a820018e-7ad7-481a-97b0-bd705c3280ad data=71b1652e-16c8-4b33-9a57-f5fcb3d5de92 14:46:17.378 [http-nio-8080-exec-3] info metering - msg=c1ddb068-e6a2-450a-9f8b-7cbc1dbc222a set_status job=a820018e-7ad7-481a-97b0-bd705c3280ad status=active final=false i built pattern matched first line: %{time:timestamp} %{notspace:http} %{word:loglevel}%{space}%{word:logtype} - msg=%{notspace:msg}%{space}%{word:action}%{space}job=%{notspace:job}%{space}data=%{notspace:data} but works lines have data= @ end, versus status= , final= @ end of second line, or other attribute-value pairs on other lines? how can set pattern says after point there arbitrary of foo=bar pairs want recognize , output attribute/value pairs in output? you can change grok pattern have key value pairs in 1 f

intentfilter - Intercepting links from browser to my android app not working on lollipop -

i have setup code in manifest intercept links links open in app. here code: <activity android:name="com.example.myactivity" android:launchmode="singleinstance"> <intent-filter> <action android:name="android.intent.action.view" /> <category android:name="android.intent.category.default" /> <category android:name="android.intent.category.browsable" /> <data android:host="example.com" android:path="/dosomething" android:scheme="https" /> </intent-filter> </activity> this code working fine on pre-lollipop devices , opening proper activity on lollipop devices, opening last opened activity. do need special lollipop devices? any appreciated.

url - Duplicate page from Google Webmaster Tools -

all of website page url contains non-english characters seo purpose, in browsers, characters encode , not looks good. for reason, wrote javascript code, when user click on link, non-english characters removed , add canonical link tag head of page google use link main addressing. change url: http://www.example.com/game/new/جدید to this, when user click: http://www.example.com/game/new and add canonical link tag in head of 2 page: <link rel="canonical" href="http://www.example.com/game/new/جدید" /> but after 2 month , 300 index google, in "html improvements" of google webmaster tools, write "duplicate title tags" pages. i can't remove non-english character url or redirect pages. how solve problem? i suggest think url rewriting in general: if have configured website serve ugly urls for seo purpose only, might think , remove them anyway. if need non-english characters may visitors understand

node.js - Using Socket.IO in MeteorJS Server -

i trying top socket.io working meteorjs server. using package https://github.com/joncursi/socket-io-client , unable work server , cant figure out why. i call "connecttoserver" method client, should contact remote server , initialise connection. when code executes, can see messages being logged, nothing inside "socket.on('connect',..." method. suggests isn't making connection. backed fact when run code client side (using the socket.io browser javascript code), able connect without issues. i have code on server, whever there attempt connect socket.io connection. logged, client side code not server side code. can see may doing wrong here? meteor.methods({ 'connecttoserver': function() { socketiocontroller(); } }); function socketiocontroller(){ var username = 'asd'; var password = 'asd'; console.log("trying login asd"); var socket = io('https://localhost:3001/'); co

ord() to catch Arrow Key press on Linux and Mac -- Python -

how use ord() catch arrow key press in mac , linux? know can use msvcrt in windows. don't have character associated them. are talking in console? i have hacky solution if want avoid msvcrt. value = raw_input("hit left arrow key enter: ") print ord(value[0]), ord(value[1]), ord(value[2]) if ord(value[0]) == 27 , ord(value[1]) == 91 , ord(value[2]) == 68: print "you hit left key!" elif ord(value[0]) == 27 , ord(value[1]) == 91 , ord(value[2]) == 67: print "you hit right key!" this written illustrate how it's done. can condense more consice system depending on need. can use ord -- need remember it's multi-character string need analyze character character.

sql - How to find the most and least used keys? -

i have data in table: insert videos values(20,'v1','kidnap','crime'); insert videos values(20,'v2','abuse','crime'); insert videos values(20,'v3','robbery','crime'); insert videos values(20,'v4','murder','crime'); insert videos values(20,'v5','political','political'); insert videos values(20,'v6','political','political'); insert videos values(20,'v7','political','political'); insert videos values(20,'v8','political','political'); insert videos values(20,'v9','social','social'); insert videos values(19,'v1','kidnap','crime'); insert videos values(19,'v2','abuse','crime'); insert videos values(19,'v3','robbery','crime'); insert videos values(19,'v4','murder','crime'); insert

jface - Rename eclipse viewpart on mouse click -

i know how programmatically rename eclipse rcp iviewpart. using setpartname() method. want know if in-place editing of view name on mouse-click on view tab (like excel spreadsheet tabs). there no support in-place editing of view name.

function - Where do I insert progress bar code in python? -

i'm having difficulty in getting progress bar working in python 2.7. have code like: import time import sys in range(101): time.sleep(0.1) sys.stdout.write("\r%d%%" % i) sys.stdout.flush() from source posted here earlier. however, difficulty in getting code calculate progress of function want run. example: def example(n): print n ** 10 my question is, how can progress bar to, well, progress, function? sometimes know how work needs done, not how take. example, have list of images need process, know total amount of work. don't know how time take process each image, because each image different in size example. so, show progress bar in terms of total amount of work , not percent of time done. in particular, progress bar, can this. import time import sys def progress(percent): floor = int(percent) sys.stdout.write('\r' * (floor + 9)) sys.stdout.write('[') sys.stdout.write('=' * floor)

sql - Format varchar type and convert it to date variable -

i have varchar value in format “yyyymm-ll” where: yyyy 4 digit year; mm 2 digit month.ll 2 digit length of reporting period. number of whole months included in calculations (from first last day of each month). my questions how use varchar value decide 2 variables:@first_date , @last_date. example: 201409-06 scenario 6 months ending in september of 2014. range of calendar dates in scenario 04/01/2014 through 09/30/2014. so how use t-sql find 2 dates @first_date : 04/01/2014 , @last_date: 09/30/2014. any appreciated! you can this: select @firstdate = dateadd(month, 1 - cast(right('201409-06', 2) int), convert(date, left('201409-06', 6) + '01') ), @lastdate = dateadd(day, -1, dateadd(month, 1, convert(date, left('201409-06', 6) + '01') ) )

r - Non-spreadsheet-esque Data Import and Organization -

basic problem i have data of form doc id 1 var1 var2 b ... varstar 453 varstar 3432 varstar 32 ... varn doc var1 var2 b (and on) where doc denoting beginning of each record/observation, vari denoting variable, , varstar denoting variable of interest that may have more 1 entry . i import data using r (or python, i'm bit rusty there). for each record retrieve id , instances of varstar . store them in manner later, easy manipulation/merger. example, list or binary (possibly sparse) matrix (for application varstar category overlap expected). it seems should easy familiar csv/spreadsheet data , perhaps don't know right words google. prefer not to, e.g., create entire sql database, etc. because don't need entire database. of course, may easier elaborate organization then pick out choice pieces. context - application i want retrieve u.s. patent classes via google/uspto bulk downloads . id patent number while varstar patent class fsc . then, want m

togglebutton - Android Switch button inside RecyclerView's every item -

i working recyclerview , using switch component in every item of it. <switch android:id="@+id/list_item_switch" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginleft="1dp" android:layout_marginright="2dp" android:layout_toleftof="@+id/list_item_price" android:textoff="@string/switch_save" android:texton="@string/switch_buy" android:layout_centervertical="true" /> i using setoncheckedchangelistener event listen state changes holder.msavebuyswitch.setoncheckedchangelistener(new compoundbutton.oncheckedchangelistener() { @override public void oncheckedchanged(compoundbutton buttonview, boolean ischecked) { if (buttonview.ispressed()) { moveitemdialog(pos, ischecked); } } }); use of buttonview.ispressed() identify whether setchecked on switch called user

Why does Python sometimes not create new objects for function arguments? -

i assumed whenever passed object function, automatically created separate copy you modify without changing original. however, following code terminates error every time. >>> testvar = ['a' in range(100000)] >>> def func(arg): while arg testvar: arg.pop() >>> func(testvar) traceback (most recent call last): file "<pyshell#47>", line 1, in <module> thing(m) file "<pyshell#43>", line 3, in thing obj.pop() indexerror: pop empty list from: https://docs.python.org/3.4/library/copy.html assignment statements in python not copy objects, create bindings between target , object. collections mutable or contain mutable items, copy needed 1 can change 1 copy without changing other. module provides generic shallow , deep copy operations (explained below). when calling function, doing following: func(arg=testvar) if want have actual copy of data modify function followin

powershell - Iterate & Search for a string in child items -

Image
i trying build powershell script iterates through list of files , searches , removes match, not having luck, here script $path = "d:\test\" $filter = "*.txt" $files = get-childitem -path $path -filter $filter foreach ($item in $files) { $search = get-content -path $path$item $search| select-string -pattern "t|" } at moment script returning whole content of file , not select string. basically each file in folder have trailer record @ end i.e. t|1410 need iterate through files , delete last line, of these files 200mb+ can guide me please. i've edited script , using following method. $path = "d:\test\" $filter = "*.txt" $files = get-childitem -path $path -filter $filter foreach ($item in $files) { $search = get-content $path$item ($search)| foreach-object { $_ -replace 't\|[0-9]*', '' } | set-content $path$item } i using powershell v.2 however, adding new empty lin

c# - Inserting to a link table without fetching first -

Image
i have task table (called task_task) , field table (called core_field). have task_field table links 2 in many many relationship: create table [dbo].[task_field]( [taskid] [uniqueidentifier] not null, [fieldid] [uniqueidentifier] not null, constraint [pk_task_field] primary key nonclustered ( [taskid] asc, [fieldid] asc )) i need insert number of records table. i'm doing this: dbtask.core_field.clear(); list<core_field> dbfields = _context.core_field .where(x => fields.contains(x.fieldid)).tolist(); foreach (var field in dbfields) { dbtask.core_field.add(field); } this leads following trace: in case had 5 guids in list<guid> fields . reason see insane value (that's time query took run), because rows in core_field table wide. have few binary fields lot of data. if don't retrieve these fields, instead: var tmp = _context.core_field .where(x =>fields.contains(x.field

python - Tkinter grid layout won't expand -

Image
i'm trying design sidebar should looke of google's sidebar menu (like in inbox or play music, browser version, example). i'm using grid layout won't expand. i've looked little bit , despite adding sticky = "nesw" , rowconfigure(0, weigth = 1) , frame on right won't expand , fill root. from tkinter import * tkinter import ttk buttons = ["button", "button", "button", "button", "button", "button", "button", "button", "button", "button"] # list of contacts root = tk() root.title('myapp v0.1') root.geometry('800x600') #root['bg'] = "white" # side menu frame = frame(root, background = "white") in range(len(buttons)): button(frame, background = "white", text = buttons[i], command = none).grid(row = i, column = 0) frame.rowconfigure(0, weight = 1) frame.grid(row = 0, column = 0, sticky = "

mysql - PHP Mysqli select value for multiple values and show the same for relection -

i trying fetch multiple values multiple data know how fetch single data new fetch multiple data say want select mobile number id 1,2,3 , show mobile number same with"," not able achive expected select data master_table id"1,2,3" show mobile_number of particular id(s) mention below . database master_table name id mobile_number abcd 1 123456789 ssss 2 123456722 sssd 3 123456733 rrrr 4 123453389 iiii 5 123444789 php $query="select mobile_number master_table id='1,2,3'" ; $data=mysqli_query($mysqli,$query)or die(mysqli_error()); while($row=mysqli_fetch_array($data)){ echo $row['mobile_number']; } expected result 123456789,123456722,123456733 you need use mysql in operator: corrected sql: $query = "select mobile_number master_table id in(1,2,3)"; explanation: select mobile_number table id either 1, 2 or 3 difference between = , in = can compare 1 value. with in ca

javascript - get subdomain and query database for results - Meteor -

i pretty new meteor now. i want to get sub-domain of url check if client exists matching sub-domain if client exists query database , results (say client settings) database. i sure piece of cake if use mongodb, however, have move existing application (built on php) has mysql backend. i have found package numtel:mysql meteor , have added project. here source code written far: if(!session.get('client_details')) { var hostnamearray = document.location.hostname.split('.'); if(hostnamearray[1] === "localhost" && hostnamearray[2] === "local") { var subdomain = hostnamearray[0]; } if(subdomain) { currentclientdetails = new mysqlsubscription('getclientdetailsfromurl', subdomain).reactive(); tracker.autorun(function() { if(currentclientdetails.ready()) { if(currentclientdetails.length > 0) { var clientdetails = currentclientdetails

MySQL calculation of cumulative sum with a reset condition -

is there way capture cummulative sum reset condition in mysql? use case simple cash register table id transactiontype value currentbalance 1 purchase 10 10 2 sale -10 0 3 reset 20 20 4 purchase 10 30 5 sale -10 20 6 sale 10 30 7 sale -20 10 the answer here starting point don't see how extend it: create cumulative sum column in mysql select t.id, t.count, @running_total := @running_total + t.value currentbalance table t join (select @running_total := 0) r order t.id note: idea reset cumulative sum each time reset hit. ideally trying have on update/insert trigger update entire currentbalance column taking account resets. small table don't mind updating whole table in exchange simple. all requires simple conditional logic: select t.id, t.co

Trouble with image upload {Ajax,php,Filereader} -

when upload image server return "empty". what need change server or client work? want upload 1 image , dont have form etc html: input id="imgupload" type="file" value="upload" client side: var reader = new filereader(); function readurl(input) { var filetypes = ['jpg', 'jpeg', 'png']; var extension = input.files[0].name.split('.').pop().tolowercase(), issuccess = filetypes.indexof(extension) > -1; if (issuccess) { reader.onload = function (e) { $('#img').attr('src', e.target.result); $('#imguploadinput').hide(); $('#imguploadm

ruby on rails - Synchronous update of form data -

this simple question, haven't found answer here or google. we have ruby on rails app form needs update section when user changes selected option in pulldown menu. complication update database - can't realistically store , hide possible data when loads. obvious solution ajax call, problem ajax asynchronous, , our update inherently synchronous. need ensure user gets updated info before submitting or doing other work on form. i know 1 can (but shouldn't) specify ajax call synchronous, there better approach this? hate separate post , reload every time user selects different option in 1 field, i'm not sure best practice situation this. update: tried switching using xmlhttprequest object in javascript, , may work (i'm figthing rails routing issues right now), gives me warning synchronous option object deprecated. there no accepted way synchronous communication between web page , server?

github - Git branching / workflow model like "nvie gitflow" but without release branches -

is there official documented git workflow nvie's "gitflow" workflow without release branches? http://nvie.com/posts/a-successful-git-branching-model/ https://www.atlassian.com/git/tutorials/comparing-workflows/gitflow-workflow i guess don't see purpose of release branches, why not tag release master? (maybe that's same thing). the concept of releases in nvie's branching model (and consequently in git-flow tool) related distinction between branches master , develop . in both, nvie's model , github's model, master supposed 'fit production'. how can ensure that? why not tag release master? github's branching model ... if there few concurrent feature branches, test (and review, other qa want or need) feature branches before merge them master . if significant changes have been merged master (or if changes have — in violation of branching model — been directly committed master ) since respective feature branch bra

r - Can plot interaction means for nlme fit, but not for lme4 -

using dummy dataset: dummy.data <- data.frame(vaccinated = factor(rep(c("yes", "no"), each = 64)), infected = factor(rep(c("yes", "no"), each = 32)), animal = factor(rep(1:16, each = 8)), tissue = factor(c("blood", "liver", "kidney", "brain")), value = runif(128) ) this works: library("nlme") nlme.model <- as.formula(value ~ vaccinated * infected * tissue) nlme.fit <- lme(fixed = nlme.model, random = ~1|animal, data = dummy.data) library("phia") int.nlme <- interactionmeans(nlme.fit) plot(int.nlme) but doesn't: library("lme4") lmer.model <- as.formula(value ~ vaccinated * infected * tissue + (1 | animal)) lmer.fit <- lmer(formula = lmer.model, data = dummy.data) library("phia") int.lmer <- interactionmeans(lmer.fit) plot(int.lmer) with latter, get error in t.default(m) : argument not matrix from plot command.

javascript - Angular : use filter on ng-options when using for(key,value) -

i have listbox want filter depending on user input, in order display "matches" posibility. unfortunatly, "filter" change value display or don't work @ all. expect it's because use (key,value) , have different behaviour ? <p>filter : <input type="text" ng-model="filterattr"/> {{filterattr}}</p> <select ng-options="value (value.attr+ ' : ' +value.otherattr) (key,value) in customlist | filter:{attr:filterattr}" size="4" ng-model="nevermind" ng-change="changesensor(tyredetails)"> </select> here jsffidle : http://jsfiddle.net/hlywvam7/2/ thank help. in angular filters can applied arrays, not objects. now either change "customlist" format array or convert "customlist" object array below $scope.filtercustomlist = function(items) { var result = []; angular.foreach(items, function(value, key) { result[ke

windows - Batch or CMD to convert multi-line txt file to single line -

so running batch file kinds of commands , outputs results output.txt it looks this: output.txt: aaaaa ,bbbbb ,ccccc ,ddddd is possible run command within same batch file use finished (output.txt) have move lines single line looks this: aaaaa,bbbbb,cccccc,ddddd for /f "usebackqdelims=" %%i in ("input.txt") @<nul set /p"=%%i">>"output.txt"

powershell - Integers are not adding / subtracting -

i reading data database , value in question date , time stamp. to keep things short data similar this. 7/24/2015 16:13:58 i extract date this. $scandate = $($row[3]).tostring() [string]$scan = $scandate.substring(0,10) i split $scandate array $scan.split('/') then change value integer each day, month , year [int]$scanmonth = $scan[0] [int]$scanday = $scan[1] [int]$scanyear = $scan[2] check integers.. $scanday.gettype() $scanyear.gettype() $scanmonth.gettype() returns.. ispublic isserial name basetype -------- -------- ---- -------- true true int32 system.valuetype true true int32 system.valuetype true true int32 system.valuetype the issue when try , add , subtract integers, getting wrong result? $total = [int]$scanday + [int]$scanmonth write-

android - Scrollview does not work on viewpager.pagetransformer -

i'm working viewpager fragments scrollview fade in- out animation.for purpose add function on viewpager.pagetransformer.when add feature scroll view not work properly(only first step data scroll ). declaration on viewpager: mviewpager = (viewpager) findviewbyid(r.id.pager); msectionspageradapter = new sectionspageradapter(getsupportfragmentmanager()); mviewpager.setpagetransformer(true, new crossfadepagetransformer()); mviewpager.setadapter(msectionspageradapter); sectionspageradapter class are: public class sectionspageradapter extends fragmentpageradapter { public sectionspageradapter(fragmentmanager fm) { super(fm); } @override public fragment getitem(int position) { // getitem called instantiate fragment given page. // return placeholderfragment (defined static inner class // below). return placeholderfragment.newinstance(position + 1); } @override public int getcount() {

bolt cms - Editing static content -

i'm impressed bolt , flexibility provides me creating contenttypes specific fields minutes. however, have template has common content across site make editable without allowing user edit .twig files directly. i've considered creating different contenttype each part of template seems inefficient. for example make address editable, , panel contains text , 3 images. wondering if there's sensible way achieving this. thanks create resource contenttypes type of stuff, can put inheritable twig files can {% include '' %} required.

mongodb - Geospatial filtering of documents with locations within a given radius from given point with LoopbackJS -

there requirement query documents within radius given point. if use mongodb database, can following: create geospatial 2dsphere index; save data in proper format; filter documents within distance of 10 miles given location do: db.location.find({loc: {$geowithin: {$centersphere: [[-110.111111, 30.333333], 10 / 3963.2]}}}) what proper way achieve same using loopback's geopoint , near , lt ? crossposted here well: https://groups.google.com/forum/#!topic/loopbackjs/ncg7ndj-eeq location.find({where: {loc: {near: [-110.111111, 30.333333], maxdistance: 10}}}) this 'location' model name. 'loc' location field. 'near' specifies center coordinates. , 'maxdistance' specifies area cover. also, 2d indexes.

angularjs - Inject service at runtime angular -

how inject service @ runtime? use case: url has variable 'object' can either customer/user/item. view same, controller same service changes based on url parameter value of 'object' so when access http://www.application.com/?object=user should load generic view+controller inject service @ runtime.

php - Wrong __DIR__ magic constant value -

i've been trying install web application built using laravel framework. application hosted git repository. here detailed description of problem clarify how i'm facing it. for first time cloned repository in following path: /var/www/app.example.com/script/ then created symbolic link it's public directory follow server's nginx routing convention: ln -s /var/www/app.example.com/script/public /var/www/app.example.com/public_html but decided move out of script directory 1 upper level , problem started. moved laravel installation /var/www/app.example.com/ , made nginx directly load public directory root path. now problem every time try load application it's trying read files previous location: warning: require(/var/www/app.example.com/script/public/../bootstrap/autoload.php): failed open stream: no such file or directory in /var/www/app.example.com/public/index.php on line 21 fatal error: require(): failed opening required &

request - Data fetch from url using urllib in python -

i trying fetch data url : " http://www.sears.com/search=refrigerators " this tried: >>> cookielib import cookiejar >>> import urllib >>> import urllib2 >>> bs4 import beautifulsoup >>> data = {} >>> data['search'] = 'refrigerators' >>> url_values = urllib.urlencode(data) >>> cj = cookiejar() >>> opener = urllib2.build_opener(urllib2.httpcookieprocessor(cj)) >>> url = 'http://www.sears.com' >>> full_url = url + '/' + url_values >>> f = opener.open(full_url).read() >>> soup = beautifulsoup(f, "html.parser") >>> print(soup.title) <title>shopping tourism: shop internationally @ sears</title> >>> f = opener.open(full_url).read() >>> soup = beautifulsoup(f, "html.parser") >>> print(soup.title) <title>refrigerators sears.com</title> i getting diffe

javascript - Getting started with Mock server and Grunt -

i've read documentation on http://www.mock-server.com/ . after few hours of effort spent on following getting started still cannot mockserver working. can please specify exact steps or point me on wrong? gruntfile: var configobj = { connect: { all: { options:{ port: 9000, hostname: "0.0.0.0" } } }, start_mockserver: { start: { options: { serverport: 8080, proxyport: 1090 } } }, stop_mockserver: { stop: { } } } in index.html <script type="text/javascript" src="https://cdn.rawgit.com/jamesdbloom/mockserver/6a2fb42cb7933d0d68e7d595785a9b0536450825/mockserver-client-javascript/src/main/javascript/mockserverclient.js"></script> <script> mockserverclient("localhost", 9000).mocksimpleresponse('/somepath', { name: 'value' }, 203); </scri

html5 - CSS3 transition glitch in Chrome -

i have simple modal, opens upon :checked input. in firefox , ie transition animation works fine, in chrome glitches (effect not smooth) when shows upon checking input. demo fiddle: jsfiddle when remove visibility: hidden works fine, modal blocks rest of page under neath - no text can selected, no buttons clicked etc. any ideas on how make transition smooth in chrome? answer you declared transform: none; on modal div . define rotationx instead, animation has starting , ending point. solves animation issue: input#switch:checked ~ #test > div { transform: rotatex(0deg); } http://jsfiddle.net/s8hts3v7/9/ code snippet #test { position: fixed; top: 0; right: 0; bottom: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.8); z-index: 9999999; visibility: hidden; } input#switch:checked ~ #test { visibility: visible; } #test > div { background: #fff; width: 300px; height: 100px; padding: 30