Posts

Showing posts from March, 2013

c# - Multiple push refresh button -

this code shows select query in listview. on second push of button "refresh", duplicates result, , on third enter in catch "error". i don't understand why second works (not because duplicate, works) , on third there error. public void button1_click(object sender, eventargs e) { sqlcommand cm = con.createcommand(); cm.commandtext = "select * h_facturi_clienti"; try { sqldatareader dr = cm.executereader(); while (dr.read()) { listviewitem item = new listviewitem(dr["h_id"].tostring()); item.subitems.add(dr["serie"].tostring()); item.subitems.add(dr["numar"].tostring()); item.subitems.add(dr["id_partener"].tostring()); item.subitems.add(dr["data"].tostring()); item.subitems.add(dr["valoare"].tostring()); listview1.items.add(item); ...

python - BeautifulSoup4 Get_Text() Removing Line Breaks? -

i'm having bit of issue get_text() compared able .net think it's removing line breaks makes impossible me parse data. i'm reading class site in kind of format: 4.1 £22 4 £27 3.9 £29 3.8 £106 3.75 £24 3.7 £24 it'll follow same format: decimal price decimal price decimal price etc... i've done in .net , element.innertext has returned string line break in between. i able like: dim spltexample string() = element.innertext.split(new string() {environment.newline}, stringsplitoptions.none) it put decimal , price each result. seeing: 4.1 £22\n 4 £27\n 3.9 £29\n 3.8 £106\n 3.75 £24\n 3.7 £24 my problem bs4 seems getting in different format - , i'm hoping can change. 4.1 £224 £273.9 £29 3.8 £1063.75 £243.7 £24 it's squashing decimal preceding price removing new line. the data can pretty awkward. numbers won't static , need know how many combinations of decimal , price there is. .net give me ...

string - java.lang.StackOverflowError exception for large inputs -

basically, i'm writing program simple division manually want decimal place upto 10^6 places. program works inputs <3000, when go higher, shows: exception in thread "main" java.lang.stackoverflowerror here's code: { .... .... int n=100000;//nth place after decimal point string res=obj.compute(n,103993.0,33102.0,ans); //division of 103993.0 33102.0 system.out.println(res); } public string compute (int n, double a, double b, string ans){ int x1=(int)a/(int)b; double x2=a-x1*b; double x3=x2*10; int c=0; if (n==0||n<0) return ("3."+ans.substring(1)); else if (x3>b){ ans+=""+x1; c=1; } else if(x3*10>b){ ans+=x1+"0"; c=10; } else if(x3*100>b){ ans+=x1+"00"; c=100; } else if(x3*1000>b){ ans+=x1+"000"; ...

jquery - Dynamically changing the color of an element li doesn't change the color of the bullet point -

in chrome (version 45.0.2454.101 m) if add class list element change color, bullet point color updated when window repainted (resized) $("#a").click(function() { $("#a").addclass('blue'); }); ul li { color: red; list-style-type: disc; margin-left: 2em; } .blue { color: blue; } <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script> <ul> <li id="a">a</li> <li id="b">b</li> <li id="c">c</li> </ul> is bug in chrome can solved code? (or bug @ all?) probably bug not rely on standard disc elements. you use css ::before pseudo-element instead. more configurable , under control. $("#a").click(function() { $("#a").addclass('blue'); }); ul li { color: red; list-style-type: none; margin-left: 2em; ...

ios - How do I know inside the program that the non-consumable IAP is in review? -

i have newsstand magazine app, , besides auto-renewable subscription, want provide non-consumable iap users doesn't subscribe buy each single issue. problem is, each time publish new issue, need set iap in itunes connect, , submit review. before iap approved, when users try download issue, report error "cannot connect itunes store", skpaymenttransaction's error. there anyway can detect inside program iap in review, can popup better alert "this issue being reviewed, please wait" other confusing error message skpaymenttransaction? example, can check nserror.domain or nserror.code find out if error means iap hasn't approved yet? thank in advance. suggestion or clue appreciated!

oracle10g - Enterprise Manager Errors on Oracle 10g2 on Linux -

i have installed instance of oracle enterprise manager database control 10g release 10.2.0.1.0 in centos 6.5 attempts launch enterprise manager agent command: emctl start dbconsole after few minutes, said failure. logs throw me: emagent.log 07/01/2016 11:16:22 thread-3086911712 agent 10.1.0.4.1 starting /u01/app/oracle/product/10.2.0 (00701) 07/01/2016 11:16:22 thread-3086911712 emagent started (00702) emagent.trc 07/01/2016 11:16:22 thread-3086911712 warn http: snmehl_connect: failed connect (myserver: 3600): connection refused (error = 111) thread-3086911712 07.01.2016 11:16:22 pingmanager error: nmepm_pingreposurl: can not connect http: // myserver: 3600 / em / upload /: retstatus = -32 07/01/2016 11:16:22 warn command thread-3086911712: subsystem job timeout set @ 600 seconds 07/01/2016 11:16:22 thread-3086911712 warn upload: upload manager has not failure script: disabled 07/01/2016 11:16:22 thread-3086911712 warn upload: recovering left ...

java - open through intent settings window Google TTS -

is possible of intent open settings window speech synthesizer google, namely, choice of male or female voices "english (uk)"? image settings tts i need right in settings select voice uk, not in general settings tts pro com.android.settings.tts_settings know not fit. at moment have following code: <preference android:summary="@string/pref_gender_voice_summary" android:title="@string/pref_gender_voice_title"> <intent android:action="com.android.settings.tts_settings"></intent> </preference> forgive me using google translator yes. intent intent = new intent(); intent.setaction("com.android.settings.tts_settings"); intent.setflags(intent.flag_activity_new_task); startactivity(intent);

c# - Using a Stopwatch based Func as loop control variable -

trying use func<bool> loop control variable follows seems upset resharper. given following stopwatch: var executiontimestopwatch = new stopwatch(); executiontimestopwatch.start(); this raises " loop control variable never updated inside loop " warning: func<bool> muststop = () => executiontimestopwatch.elapsedmilliseconds < timeout_milliseconds; while (!muststop()) // -> function call { // ... } however, doesn't: func<bool> muststop = () => executiontimestopwatch.elapsedmilliseconds < timeout_milliseconds; var k = false; // -> declaration while (!k) // -> used loop control { k = muststop(); // -> explicit update // ... } i don't understand how result of execution of these codes different; muststop() depends on stopwatch should evaluate differently each time called. am missing something? am missing something? no, both code blocks not different. in fact compiler optimi...

c# - How to stop MessageBox repetition when LinkLabel in DataGridView column is clicked -

Image
1.this form: 2.message pops-up when linklabel in datagridview clicked: private void button3_click(object sender, eventargs e) { datagridview1.columns.clear(); con.open(); sqldataadapter da = new sqldataadapter("select casetype, caseno, year cases casetype = '" + textbox2.text + "'", con); datatable dt = new datatable(); da.fill(dt); con.close(); datagridview1.datasource = dt; linklabel link = new linklabel(); link.text = "more information !"; datagridviewlinkcolumn col2 = new datagridviewlinkcolumn(); col2.name = "column2"; col2.headertext = "information"; datagridview1.columns.add(col2); datagridview1.cellcontentclick += new datagridviewcelleventhandler(datagridview1_cellcontentclick_1); (int = 0; < dt.rows.count; i++) { datagridview1.rows[i].cells[3].value = link.text; } } private void d...

html - Can we load different external links if the screen width is too small? -

i know if can load different external ressources (such jquery) depending on screen width, know can do <link rel="stylesheet" media="screen , (min-device-width: 800px)" href="mobile.css" /> but can <script media =" screen , (min-device-width: 800px)" src="https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js"></script> i not think works css. works follows: if (document.documentelement.clientwidth < 800) { $.getscript('https://ajax.googleapis.com/ajax/libs/jquerymobile/1.4.5/jquery.mobile.min.js'); }

javascript - How to plot a date range on X-axis in Flot Charts? -

i'm using flot charts display data period (to selected user, e.g. last 30 days, last 7 days, 1st jan 2013 3rd mar 2013 etc) so want display line chart x-axis date. e.g. if i've 2 days, startdate , enddate how make x-axis display like: 1 jan 2013 | 2 jan 2013........................3 mar 2013 my code follows: data (currently it's static). var mydata = [ [1, 2.4], [2, 3.4 ], [3, 4.5 ], [4, 5 ], [5, 5], [6, 5], [7, 2 ], [8, 1 ], [9, 1.5 ], [10, 2.5 ], [11, 3.5], [12, 4 ], [13, 4 ], [14, 2.4], [15, 3.4 ], [16, 4.5 ], [17, 5 ], [18, 5], [19, 5], [20, 2 ], [21, 1 ], [22, 1.5 ], [23, 2.5 ], ...

php - Cannot access empty property - Laravel -

i trying current week following mssql query in laravel 4: db::connection('db')->select("select datepart(week, '" . $today . "')"); however returns type: symfony\component\debug\exception\fatalerrorexception message: cannot access empty property file: c:\project\vendor\laravel\framework\src\illuminate\database\connection.php my guess doesn`t work if there no "from" statement, strange. suggestions on how can workaround appreciated.

uipickerview - Swift 2.1 - How do I change the uidatepicker so it only allows for time instead of date? -

the following code below allows user select date, want change 'time' via am/pm, user can select set time instead being date. want separate , not combined, appreciate if me here thanks. import foundation import uikit import quartzcore class datepickerdialog: uiview { typealias datepickercallback = (date: nsdate) -> void /* consts */ private let kdatepickerdialogdefaultbuttonheight: cgfloat = 50 private let kdatepickerdialogdefaultbuttonspacerheight: cgfloat = 1 private let kdatepickerdialogcornerradius: cgfloat = 7 private let kdatepickerdialogdonebuttontag: int = 1 /* views */ private var dialogview: uiview! private var titlelabel: uilabel! private var datepicker: uidatepicker! private var cancelbutton: uibutton! private var donebutton: uibutton! /* vars */ private var defaultdate: nsdate? private var datepickermode: uidatepickermode? private var callback:...

hbase - Connecting to Mapr-DB (M3) from a Java client -

i'm trying interact mapr-db table simple java application running within node of m3 mapr cluster. seems able connect cluster apparently not able connect table properly. snippet code: configuration configuration = new configuration(); configuration.set("hbase.zookeeper.quorum", "192.168.2.1,192.168.2.2,192.168.2.3"); configuration.set("hbase.zookeeper.property.clientport", "5181"); configuration.set("mapr.htable.impl", "com.mapr.fs.maprhtable"); configuration.set("hbase.table.namespace.mappings", "*:/user/mapr/"); configuration = hbaseconfiguration.create(configuration); hconnection connection = hconnectionmanager.createconnection(configuration); system.out.println("is master running? " + connection.ismasterrunning()); string tablename = args[0]; htable table = (htable) connection.gettable(tablename.getbytes()); (hcolumndescriptor columnfamily : table.gettabledescriptor().getcolumnf...

php - OpenSSL Errors SSL operation -

i have strange problem. before 2 days script work ok, today site stop working , show me message "ssl operation failed code 1. openssl error messages: error:140940e5:ssl routines:ssl3_read_bytes:ssl handshake failure". there no changes made these days. in advance. the host has disabled ssl3. if you're specifying curlopt_sslversion, comment out.

language agnostic - Is floating point math broken? -

0.1 + 0.2 == 0.3 -> false 0.1 + 0.2 -> 0.30000000000000004 why happen? binary floating point math this. in programming languages, based on ieee 754 standard . javascript uses 64-bit floating point representation, same java's double . crux of problem numbers represented in format whole number times power of two; rational numbers (such 0.1 , 1/10 ) denominator not power of 2 cannot represented. for 0.1 in standard binary64 format, representation can written as 0.1000000000000000055511151231257827021181583404541015625 in decimal, or 0x1.999999999999ap-4 in c99 hexfloat notation . in contrast, rational number 0.1 , 1/10 , can written as 0.1 in decimal, or 0x1.99999999999999...p-4 in analogue of c99 hexfloat notation, ... represents unending sequence of 9's. the constants 0.2 , 0.3 in program approximations true values. happens closest double 0.2 larger rational number 0.2 closest double 0.3 smaller rational number 0.3 . sum ...

playframework - Play 2.4 - using Ebean in eager singleton module -

i have got question. i using play framework ebean. trying port application play 2.4 , trying use dependency injection technique introduced in play. in previous version using globalsettings.onstart() initialize things after application starts (cron-like service). in 2.4 trying implement "onstart" process eagerly loaded singleton using dependency injection framework. generally speaking, working. however, sometimes, getting nullpointerexception while starting application. stack trace, can assume, exception happening while accessing database (ebeanserver null in time). assumed, ebean has not started because eager singletons initiliased before application starts. ok then, injected play`s application , database objects eager singleton constructor in order start in time. the results ... unstable. sometime application starts fine, sometime falls in same nullpointerexception. looks database not started in time or what? or maybe need inject other ebean object in order sta...

Building a C static library using recent Xcode? Including that in Swift? -

does have guide setting project produces static library under recent versions of xcode? there few older versions, use project setting called "c/c++ library" seems have been removed. i notice "external build system" still in there, , maybe that's solution? c code won't changing structure much, makefile solution - i've never used type before, i'd hear people have. ultimately c code consumed swift/cocoa application. correct in thinking include both projects in workspace, drag .a , bridging .h swift project, , go?

Use import-module with a PowerShell PSSnapin Dll -

we have legacy powershell pssnapin (c#). want avoid having use installutil . following imports module pssnapin cmdlets exported: import-module .\mysnapin.dll however, when run module cmdlets, fail due not being able find referenced assemblies (specifically, enterprise library dlls). is there neat way working? (the pssnapin dll , referenced assemblies in same build directory, , when use installutil, dependencies resolved correctly) snap-ins bit different modules. first need register snap-in, using installutil.exe : ps> $installutil = join-path $([system.runtime.interopservices.runtimeenvironment]::getruntimedirectory()) "installutil.exe" ps> & $installutil "c:\path\to\mysnapin.dll" after registering snapin assembly, can load powershell session add-pssnapin : ps> add-pssnapin mysnapin

Zend PDF: calculating coordinates after rotation -

Image
without getting many details - i'm getting parameters (x1,x2,y1,y2,a,b,α) web tool , need generate pdf document, using zend_pdf library contains green image rotated , positioned on exact coordinates. now, confuses me zend not allow elements rotated, instead rotates paper. so, assume rotation needs done this $page->rotate($x1 + ($x2 - $x1) / 2, $y1 + ($y2 - $y1) / 2, - deg2rad($rotation)); because want center of image rotation point, , rotate in reverse orientation resulting image proper rotation. the tricky part i'm having trouble drawing it. simple call $page->drawimage($image, $x1, $y1, $x2, $y2); i'm getting result displayed on diagram - resulting image needs translated well, since (x1,y1) , (x2,y2) not exact coordinates anymore, i'm not sure how calculate them? ideas? the op confirmed in comment used same values ( x1 , y1 ) , ( x2 , y2 ) in rotate , drawimage calls. pretty obvious sketches, though, coordinates latter call must dif...

ruby on rails - Calling Model name on it's model -

i have import feature excel. , put on model which: def self.import(file, employee_name) spreadsheet = open_spreadsheet(file) header = spreadsheet.row(1) (2..spreadsheet.last_row).each |i| row = hash[[header, spreadsheet.row(i)].transpose] category = category.where(:name => row["category"]).last if category.blank? category = category.create(:name => row["category"], :is_active => 1) end unit = unitofmeasure.where(:name => row["unit"]).last if unit.blank? unit = unitofmeasure.create(:name => row["unit"], :is_active => 1) end chart_of_account_id=0 stock_output_account=0 if row["can sold"]==1 income_account=1 else income_account=0 end if row["can purchased"]==1 expense_account=1 else expense_account=0 end product = product.create(:plu => row["plu"], :plu_night_disc => row["plu n...

java - Passing new data to a Job everytime it runs - Quartz -

i have 2 jobs running. first job polls data , updates queue. 1 reads queue , processes it. need pass fresh data second job every time runs. second jobs runs every 10 seconds. need pass fresh jobdatamap every time 2nd job runs. i read quartz documentation on one. not clear. should use 1 jobdatamap , pass , forth filling up? or there way create new jobdatamap , pass job every time job runs. any idea?

c# - How to make SQL Server Connection (not from file) appear in ADO.Net Connection Model Wizard? -

i trying add connection adventureworks on new development machine running vs 2010. have ssms running , able query adventureworks database. however, when click “new connection” (steps followed below after *) , not see sql server connection option. there way configure vs 2010 sees localhost connection sql server? second option: when try using option microsoft sql server database file, whenever browse mdf file adventureworks, see message 'file in use', though have 1 instance of vs 2010 open , ssms closed. steps followed new project class library right click solution explorer add new item ado.net entity data management new connection just type in localhost server name, test connection , click ok. saved, next time appear in list. the data source type set "microsoft sql server (sqlclient)" if doesn't pop in screen install sql server native client here: http://msdn.microsoft.com/en-us/sqlserver/ff658533.aspx

javascript - How to architect a cluster of streaming clients in node.js in case of one goes down? -

right now, we're writing streaming client using node.js listen twitter. wondering have prevent failure don't lose data. can have 2 boxes running mean duplicate data. deploy code amazon ec2. tool or pattern architect clusters of streaming client? so, if 1 box goes down next box intercept data. don't want have 2 boxes listening , filter out duplicate tweets. this example code, client.stream('statuses/filter', {track: 'javascript'}, function(stream) { stream.on('data', function(tweet) { console.log(tweet.text); }); stream.on('error', function(error) { throw error; }); });

How to check if user 'sa' (SQL Server) is enable with vb.net -

Image
i know if possible check if user 'sa' enable (sql server 2005), vb.net. i tried find query select * syslogins , here can´t find it. thanks advanced please take screenshot sa disable , hasaccess = 1 sa enable , hasaccess = 1 select * syslogins have "sa" in results. are sure "sql authentication" enabled sql-server(instance)? https://msdn.microsoft.com/en-us/library/ms188670%28v=sql.90%29.aspx if windows authentication mode selected during installation, sa login disabled. if later change authentication mode sql server , windows authentication mode, sa login remains disabled. enable sa login, use alter login statement.

How to convert a list consisting of vector of different lengths to a usable data frame in R? -

i have (fairly long) list of vectors. vectors consist of russian words got using strsplit() function on sentences. the following head() returns: [[1]] [1] "модно" "создавать" "резюме" "в" "виде" [[2]] [1] "ты" "начианешь" "работать" "с" "этими" [[3]] [1] "модно" "называть" "блогер-рилейшенз" "―" "начинается" "задолго" [[4]] [1] "видел" "по" "сыну," "что" "он" [[5]] [1] "четырнадцать," "я" "поселился" "на" "улице" [[6]] [1] "широко" "продолжали" "род." note vectors of different length. what want able read first words each sentence, second word, third...

C# Task Factory -

hi have code below in loop. in loop because number of times needs run can vary dependent on how many items user has added. var tasklist = new list<task<ienumerable<myobject>>>(); (int = 0; < numofbatches; i++) { var task = task.factory.startnew(() => mymethod(variablea, variableb)); tasklist.add(task); } //wait tasks complete task.waitall(tasklist.cast<task>().toarray()); return tasklist.selectmany(x => x.result); is there better way can run these tasks in parallel? thinking parallel each loop because number of iterations of loops isn't fixed don't think can use parallel each there isn't problem code. if have 10,000 items inputted takes 18 minutes , thinking if run tasks in parallel may return faster. if 10,000 items inputted number of batches 10,000/25 = 400 the actuall code in mymethod calls 3rd party external service return data based on data entered user processing list in parallel easiest of parallel...

sql server 2005 - Convert datetime to numeric -

i trying take date in varchar column in table, add 1 day it, , set value of datetime variable. part of process runs daily , need make sure day resets 1 @ end of month. or @ end of year doesn't increase 151231 151232. problem having converting @date numeric in form yymmdd. example virn_chk = '151231', @date written below 'jan 1 2016 12:00am'. need convert 160101 can save in column in table of type numeric(6,0). declare @date datetime set @date = convert(varchar,dateadd(d, 1,(select top(1) virn_chk stage_inst))) update cdcdatei set ot_date = @date this work rebuilding string format select right(year('2015-11-01'),2) + right('00' + cast(month('2015-11-01') varchar(2)),2) + right('00' + cast(day('2015-11-01') varchar(2)),2)

linux - HTTP XML data through SSH on port 8080 -

i have deployed web service should receive xml data on port 8080. other service pushing data remote host. server, has local ip-address. can access ssh outside. when asked administrator, said http-data pushing should done through ssh tunnel. question - how possbile do? how can configure local server receive xml data http through ssh? , common way that? try sender : ssh <ssh_username>@<yourserverip> -l 7070:localhost:8080 -n then, if send xml data "localhost:7070", data redirected port 8080 of 'yourserverip'. if server has ssh daemon running, there nothing on server side. more information : http://www.debianadmin.com/howto-use-ssh-local-and-remote-port-forwarding.html

node.js - Spawn a mysql process to import a database using node -

i'm trying write node script automatically import .sql file. think misunderstanding way pass arguments 'spawn'. here's have: var spawn = require('child_process').spawn; var mysqlimport = spawn('/usr/local/bin/mysql', [ '-u' + database.user, '-p' + database.password, '-h' + database.address, '--default-character-set=utf8', '--comments', '<"' + filename + '"' ]); mysqlimport .stdout .pipe(logfile) .on('data', function(data) { console.log(data); }) .on('finish', function() { console.log('finished') }) .on('error', function(err) { console.log(err) }); mysqlimport.stderr.on('data', function(data) { console.log('stdout: ' + data); }); mysqlimport.on('close', function(code) { console.log('closing c...

angularjs - Angular use $cacheFactory data in controller -

i hava prodcache service used cache products array. ... var products = prodcache.get('all'); if(typeof products == 'undefined'){ products = product.query(); prodcache.put('all',products); } if put products on scope products shown expected, need few products shown. try: $scope.related = (function(){ var res = []; if(products.length>0){ (var = 0, key; < 3; i++) { key = math.floor(math.random() * products.length); res.push(products[key]); } } return res; })(); that function wont work first time because xhr request being processed , returned data not reactive. the proper way use filters docs here , here . assuming filter wrote mock, , need complex filter, have create filter function @ $scope , reference @ ng-repeat expression: $scope.isrelated = function isrelatedfilter(item) { // if return true, item included. return item.someproperty === 'somecriteria'; }...

How to generate downloading link using custom option ID for various products that are available on website for Magento? -

i want fetch custom option id magento product generate different downloadable link in magento. i have 3 custom options in 1 product. option 1: free option 2: paid option 3: both if select option 1 allow me download free version of module. if select option 2 allow me download paid version of module. on.. thus, want add different download link different options, on click proceed checkout according specific custom option selected. i've implemented similar ( see here ) <div class="styled-select"> <select name="options[22]"> <option value="57">sa postal (free)</option> <option value="56">registered mail (+ r22 pm)</option> <option value="53">door door (+ r30 pm)</option> </select> </div> now go admin panel (back end) , select catalog -> manage product. select product making custom links for. go custom options. find if 'inspect ele...

c# - System.Argument Exception When Trying to Render -

i'm trying save snapshot of each slide in current project image file. part of this, want use rendertargetbitmap grid , content. here's xaml in usercontrol i'm using template each slide: <grid background="white" opacity="0.8" x:name="contentgrid"> <!-- inking area --> <inkcanvas x:name="inkcanvas"/> </grid> and i'm using try it: rendertargetbitmap b = new rendertargetbitmap(); await b.renderasync(contentgrid, 720, 480); i'm looping through collection of slides, calling method on each one. however, throws error on renderasync method. exception is: value not fall within expected range. i've used method before, , worked fine. thing different have inkcanvas in grid , don't see how affect anything. edit: interestingly, creating blank grid no properties set , trying render throws same exception. i work on .net native runtime , compiler team. suspect we...

Modulus Meteor Microservices Subscriptions not working -

we moving our app rackspace modulus. have 2 apps configured microservices using meteorhacks:cluster package. seems meteor methods (server1 server2) call working meteor subscription (client2 server1) not working. trying figure out if cross domain request issue. // https://github.com/meteorhacks/cluster#microservices //server2/app.js cluster.register(process.env.app_name,{endpoint:process.env.root_url}); mainapp = cluster.discoverconnection("server1"); cluster.allowpublicaccess("server1"); //client2/app.js mainapp = cluster.discoverconnection("server1"); contentlibrary= new meteor.collection('content_library', {connection:mainapp,idgeneration : 'mongo'}); //client2/home.js mainapp.subscribe('contentdocuments','all',function(e){ if(!e) dosomething();//never gets called }); //server1/publish.js meteor.publish("contentdocuments", function(){ return contentlibrary.find({}); } contentlibrary collec...

idea run scala console can't recognize package within project -

Image
my idea run scala console somehow can't check package today, can't recognize variable,class , object within project. but project use run scala console normal.what's matter of idea?

android - Load applications icons and getting OutOfMemory exception while resizing -

Image
here code : (all executed async while showing progress bar) list<resolveinfo> apps = pm.queryintentactivities(intent, packagemanager.get_meta_data); (resolveinfo app : apps) { string label = app.activityinfo.loadlabel(pm).tostring(); drawable icon = app.activityinfo.loadicon(pm); drawable resizedicon = null; if (icon instanceof bitmapdrawable) { resizedicon = graphics.resize(icon, res, iconw, iconh); } appinfo ai = new appinfo(app, label, resizedicon); items.add(ai); } here graphics.resize() : bitmap b = ((bitmapdrawable)image).getbitmap(); bitmap bitmapresized = bitmap.createscaledbitmap(b, widthpx, heightpx, false); b.recycle(); return new bitmapdrawable(res, bitmapresized); generally works fine, did report out of memory exception while calling bitmap.createscaledbitmap (i'm trying re-size 32dp) read handling , displaying bitmaps , here, want app icon displayed while user sees app name, , not start being loaded. (which can ...

amazon web services - How to specify method request path variables with aws apigateway CLI -

i have route defined in aws api gateway uses path variable, accessed so: /route/{variable} it configured , working expect, except cannot find how test route via cli. when use aws console's "test" function on method, prompts me enter desired value variable. this, , works expected, following appearing in execution logs: thu jan 07 16:30:06 utc 2016 : method request path: {variable=my specified value} thu jan 07 16:30:06 utc 2016 : method request headers: {} however when execute using cli command: $ aws apigateway test-invoke-method --rest-api-id {rest-api-id} --resource-id {resource-id} --http-method --path-with-query-string 'variable=my specified value' i 500 ise response, following in logs: thu jan 07 16:38:20 utc 2016 : method request path: {} thu jan 07 16:38:20 utc 2016 : method request headers: {} thu jan 07 16:38:20 utc 2016 : execution failed due configuration error: unable transform input i've tried many variations on theme, inclu...

neural network - How can I train my ANFIS dataset in MATLAB? -

Image
i have following dataset of 9 years represents people per infected of dengue 2007 2015 divide in 4 quadrant in each year. how can prepare dataset anfis. , train them predict previous year record ? for fis n inputs, training data has n+1 columns, first n columns contain input data , final column contains output data. here can choose have 2 inputs (the year , quadrant ) , 1 output (the value ). in way 9 years, number of rows becomes 36 . number of columns equal number of inputs + output ( 2+1 ). a = 1:4; b = (2007:2015)'; [a,b] = meshgrid(a,b); = a(:); b = b(:); c = ones(36,1); % should insert numbers here table traindata = [b c] now try use genfis generate fis: nummfs = 5; % number of membership function mftype = 'gbellmf'; % type of mf fis = genfis1(traindata,nummfs,mftype); the more compact way becomes: [a,b] = meshgrid(a,b); traindata = [a(:) b(:) c];

Starting Debugger doesn't rebuilt project in Visual Studio -

after make change in 1 of projects, project not built automatically after click "f5" or click button run debug. every time change made have first click build->build solution , run debugger. i have tried of solutions suggested here: why doesn't f5 rebuild project before execution in visual studio? of projects have "build" checkbox checked in solution propertys->configuration properties->configuration, , build , run setting in options-> projects , solutions set "always build". this project used build automatically, time ago has stopped. below link may solve problem regarding debugging.... http://blogs.msdn.com/b/sburke/archive/2008/01/16/configuring-visual-studio-to-debug-net-framework-source-code.aspx regards, sagar rupani

java - Logging arbitrary objects -

i'm working on logging framework enterprise system , have been looking @ both logback , log4j logging backends trying use slf4j keep backend implementation out of it. we want log messages out in json format , i've found layout class log4j , encoder logback that. however, have ability add arbitrary key/value pairs json output. i hoping layout/encoder able detect type of object being logged , in case of map add key/value pairs json else tostring() it. this doesn't seem possible since slf4j interface seems restricted logging string objects. i've read on markers, mdc , ndc none of seem fit needs enough. to clarify, here code snippet optimal: map m = new hashmap(); m.put("foo", "bar"); m.put("baz", "fluffbunny"); log.info(m); this output like: { "timestamp": "2013-03-04t13:33:40", "foo": "bar", "baz": "fluffbunny" } or { "timestamp": "201...

python - Django, adding multiple databases miscofigured my settings -

i had working test project used 1 database (django 1.8 + postgresql 9.1). then, asked add multiple databases. dropped 1 database using , created 3 new ones. modified settings.py this: databases = { 'default': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'core', 'user': 'chris', 'password': '***', 'host': 'localhost', 'port': '5432', }, 'db1': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'db1', 'user': 'chris', 'password': '***', 'host': 'localhost', 'port': '5432', }, 'db2': { 'engine': 'django.db.backends.postgresql_psycopg2', 'name': 'db2', 'user': ...

java - Special characters(Registered trademark, TM- trademark, smiley etc.) are not displayed correctly on the UI -

i developing webpage(.jsp) m fetching data in form of json object , parsing display on ui, display not correct.e.g.,blackberry� etc. have written business logic in java code. when have checked response in java, correct. to fix issue, put work-around change particular characters html form(e.g., registered trademark, replaced htmlcode , worked.but, data long, don't think practice. i have checked answers, found encodiong issue. but, when checked html file, there as <meta http-equiv="content-type" content="text/html; charset=utf-8"> could provide on this. thanks in advance!! when building json string, strings within must encoded in utf-8. requirement of json. seems you're failing this, , therefore receiving end of json cannot read character (since characters in 128-255 range invalid unless encoded properly) check encoding json being written fix issue.

php - Issue in Validation when updating the record : Laravel 5.2 -

my rule below. please check composite_unique in below code public function rules() { return [ 'subcategory' => 'required|max:25|min:5|composite_unique:tblsubcategory,categoryid', 'categoryid' => 'required|min:1' ]; } my update method below... public function update(subcategoryrequest $request) { $subcat = $this->cachecollection->getallsubcategories($request->input('categoryid')); $subcategory = $subcat->subcategories->where('subcategoryid', 1)->first(); $subcategory->subcategory = $request->input('subcategory'); $subcategory->categoryid = $request->input('categoryid'); $subcategory->save(); } my validator class below. please check composite_unique rule in below code. class validationserviceprovider extends serviceprovider { public function boot() { $this->app['validator']->extend('composite_unique...

xcode - How can I learn if 2 NSStrings are almost same to eachother? -

i take string user,and make iterations on it. for example user entered text @"the weather beautiful today."; i want make same iterations when user entered "the wether beatifullll tdy" or "th weather beatttiful tooodayy" or "the weatherrr iss beautiful toda" . here code: // (str user's text) if ([str rangeofstring:@"hello" options:nscaseinsensitivesearch].location != nsnotfound) { // when user entered helloo want make same iteration, // in case program goes else part. [array insertobject:@"hello" atindex:s]; } else if ([str rangeofstring:@"you beautiful" options:nscaseinsensitivesearch].location != nsnotfound ) { [dizi insertobject:@"i know, thanks" atindex:s]; } else if ([str rangeofstring:@"have lunch?" options:nscaseinsensitivesearch].location != nsnotfound) { [array insertobject:@"yes,i have" atindex:s]; } else { [array insertobject:@"p...

node.js - Detect mouse and keyboard events on TravisCI -

i've been working on native node.js module called robotjs allows user automate mouse , keyboard. i've been trying find way automate testing keyboard , mouse events. example, need able confirm robotjs sending correct keycodes, "a" , "!". , need able detect mouse clicks. i got working locally using terminal, here code detect mouse clicks: https://github.com/octalmage/robotjs/blob/keyboard-tests/test/detectmouse.js but doesn't work on travisci. imagine because don't open actual terminal window, though start xvfb , can detect mouse movement. i considered writing new application using electron open window detect events, i'd rather not if current tests work. thoughts? here's current .travis.yml: https://github.com/octalmage/robotjs/blob/master/.travis.yml and here's projects github: https://github.com/octalmage/robotjs

powershell - AzurePowershell Get-AzureSubscription one subscription is missing -

i made system every morning, csv files using azurepopwershell azure for example select-azuresubscription -subscriptionname "kazu pay-as-you-go" get-azurevm | export-csv -path "c:\users\kazu\desktop\azureproject\kazu-pay-as-you-go-vm.csv"-notypeinformation this morning, boss told me our company getting information of 2 of directories/accounts azure. company has 3 directories/accounts. so, clicked on "subscriptions" on left top on https://manage.windowsazure.com/--- >"filter directory:", there 3 directories/account, told me getting information directories/account "mycompany3" , "mycompany1" , wants me information "mycompany2". so clicked "directory3" , shows under "filter subscriptions:" select 3-month free trial kazu pay-as-you-go i clicked "directory1" , shows under "filter subscriptions:" select all pay-as-you-go i clicked "directory2...

android - Fly-out menu hovering above action bar, but not hiding it -

Image
i have created fly-out (sliding) menu example . in example author uses noactionbar attribute activity hide action bar. but in app want use actionbar's tabs (tabbed control, tab navigation) navigation (like in third picture). also in first , second pictures can see fly-out menu desired view (screens vk android app). theirs menu hovers above action bar , use tab control! last picture app. there menu under action bar. so, question is: how can make fly-out menu hover above action bar? not hiding action bar, have possibility use actionbar's tabs (it impossible noactionbar attribute). ] upd: found nice example here https://github.com/cheesebaron/slidingmenusharp i recommend looking example, has needed information: https://github.com/chrisbanes/cheesesquare your problem inflate navbar "under" main activity (i guess, in fragment).

css - Customize html output for a field's droplist options -

Image
i have field called icon, droplist sourced folder in content tree. list not show text value(shown in screen shot) utilize icon font , display actual icon like. customizing content editor's droplist field from: <option value="gears">gears</option> to <option value="gears">gears <span class="my-icon-font-gears"></span></option> is there documentation on how modify outputted html droplist, , modify content editor page load link, in case font-file. suggest use droplink field type instead of droplist, since value stored guid , lead less longer term problems if link item renamed or moved. in case need custom field, inherit sitecore.shell.applications.contenteditor.lookupex (which droplink field type) , override dorender() method custom markup require. it's not possible embed span tag since option tag cannot contain other tags invalid html. adding cause browser strip out. can set class on ...

javascript - firing js before submitting remote bootstrap modal rails form -

i have rails4 app. i'm trying remote submission inbuilt ajax mechanism (respond_to format.js , create.js.erb), before submit form want change code bit via js save proper utc time db. everything works fine till last line, default behavior pervented, time formatted momentjs, form doesn't submitted in end. wrong $('#new-task-modal-form').submit(); line? else miss here? form <%= form_for([current_user, @task], remote: true, id: "new-task-modal-form") |f| %> .... .... <%= f.submit "create task", class: 'btn btn-primary new-task-submit', "data-sid" => current_user.id, "data-rip" => :executor_id %> js var ready = function() { $('.new-task-submit').on('click', function (e){ e.preventdefault(); var localmoment = moment($('.new-task-deadline').val()); $('.new-task-deadline').val(localmoment.toisostring()); $('#new-task-modal-form').submit(); ...