Posts

Showing posts from January, 2014

php - Twig block calling with parameters -

i kinda new symfony , twig. trying override default twig form template in vendor\symfony\symfony\src\symfony\bridge\twig\resources\views\form\form_div_layout.html.twig (symfony 3.2.6) as far know, block can defined , used in other part of template {% block fooblock %} // block body {% endblock %} when parameters passed into, macro should rather used {% macro barmarco(param1, param2, param3) %} // macro body using param1, param2, param3 etc, {% endmacro %} in mentioned above file found like. definition of block: {%- block form_errors -%} {%- if errors|length > 0 -%} <ul> {%- error in errors -%} <li>{{ error.message }}</li> {%- endfor -%} </ul> {%- endif -%} {%- endblock form_errors -%} and usage: {%- block form_row -%} <div> {{- form_label(form) -}} {{- form_errors(form) -}} {{- form_widget(form) -}} </div> {%- endblock form_row -%} and here's que

ruby on rails - replace tags in text with images -

i have text ##imageset## tags replace actual imageset images (image_tag). this is, view code looks like: <% @topictext = topic.text.gsub!(/##imageset##/).with_index { |iset,i| if topic.topic_imagesets.includes(:imageset).order(:position)[i] topic.topic_imagesets.includes(:imageset).order(:position)[i].imageset.imageset_pictures.order(:position).each |pic| '<span>'+image_tag(pic.picture.image.thumb)+'</span>’ end end } %> <%= @topictext.html_safe if @topictext %> the result is, tags replaced |pic| records of imagesetpictures , not span actual imageset_pictures.picture image_tag: ...takimata sanctus est lorem ipsum dolor sit amet. [#<imagesetpicture id: 269, imageset_id: 46, picture_id: 280,...>, #<imagesetpicture id: 268, imageset_id: 46, picture_id: 236,...>] lorem ipsum dolor sit amet, consetetur ... here solution came with: <% @topictext = topi

xaml - Flickering when updating the datacontext in background -

i'm studying uwp windows 10 development absolute beginners, , meet problems. reflash observablecollection<> data cause screen flash. how fix it? program details in uwp beginner //cs file code public sealed partial class financialpage : page { observablecollection<newsitem> newsitems; public financialpage() { newsitems = new observablecollection<newsitem>(); this.initializecomponent(); getnewsitemmanager.getnewitemsbycategory(newsitems, "financial"); } } // xaml file code <gridview itemssource="{x:bind newsitems}" background="lightgray"> <gridview.itemtemplate> <datatemplate x:datatype="data:newsitem"> <local:newscontentcontrol horizontalalignment="stretch" verticalalignment="stretch"/> </datatemplate> </gridview.itemt

android - AppCompatActivity onDestroy calls Fragment's onCreateView? -

in app have mainactivity containing 2 fragments tabbed. somehow exception evolving mainactivity's ondestroy calling fragment's oncreateview. i aware in fragment's lifecycle oncreateview should called after ondestroyview not after ondestroy. i don't know how reproduce issue attached stack trace: fatal exception: java.lang.runtimeexception: unable destroy activity {com.myapp.myapp/com.myapp.activities.mainactivity}: java.lang.nullpointerexception: attempt read field 'com.myapp.model.team com.myapp.model.user.team' on null object reference @ android.app.activitythread.performdestroyactivity(activitythread.java:4203) @ android.app.activitythread.handledestroyactivity(activitythread.java:4221) @ android.app.activitythread.-wrap6(activitythread.java) @ android.app.activitythread$h.handlemessage(activitythread.java:1538) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:154)

javascript - 400 error - The request sent by the client was syntactically incorrect -

i'm trying send ajax request spring controller, request doesn't reach controller. instead 400 error following description: request sent client syntactically incorrect. javascript function sends request looks this: function rzdeleteevent() { saveuncheckedeventgroups(); $.ajax({ url: '${param.removeeventurl}&starttime=' + activestarttime + "&endtime=" + activeendtime, type: 'post', datatype: 'json', data: json.stringify(activeevent), contenttype: 'application/json', success: function(result) { hideuncheckedeventgroups(result); ical.hidepreview(); ical.render(result); sortgroupfilters(); }, error: function(jqxhr, textstatus, errorthrown) { ajaxerrormsg(); } }); } the controller is: @controller @requestmapping("/resourcereservationcalendar/") @sessionattributes(selected_resources_list) public class resourcereservationcalendarcontroller extends calendarbasecontroller { priv

sql - string must be exactly one character long issue -

string sqlselectquery = " select * kts staffname =" + convert.tochar(textbox1.text); sqlcommand cmd = new sqlcommand(sqlselectquery, con); sqldatareader dr = cmd.executereader(); if (dr.read()) textbox2.text = (dr["job title"].tostring()); textbox3.text = (dr["extn"].tostring()); textbox4.text = (dr["direct no."].tostring()); textbox5.text = (dr["mobile (office)"].tostring()); textbox6.text = (dr["sno"].tostring()); i want load data sql server visual studio entering name of first name employee , he's job title mobile ext ....blla blla blla appear in textboxes , error string must 1 character long you should use convert.tostring(textbox1.text); instead of convert.tochar(textbox1.text); because can't fit string char, , textbox content longer 1 character as per @rupeshpandey answer, you're missing quote delimit

java - How to Insert List with JPA -

i'm doing web service gets json app, uncapsules , inserts database. can decode normally, problem occurs @ time of inserting data database. i have list inside object , @ time of inserting it inserts several instead of object , seize key insert data list. for example, inside json commanded user, has list of rooms of property, when inserting these rooms, repeats else. json received: {"email":"teste@email.com","enderecolist":[{"bairrosetor":"centro","cep":"877777770","cidade":"palmas","complemento":"sn","estado":"to","imovellist":[{"comodoslist":[{"nome":"garagem - demoliçao de muro"},{"nome":"garagem - construção de muro"},{"nome":"garagem - regularização de contrapiso"},{"nome":"Área externa - demoliçao de muro"},{"nome":"Área exte

google chrome extension - Event handler when site doesn't match manifest.json 'matches' -

my manifest.json contains block: "content_scripts": [ { "all_frames": true, "matches": [ "*://www.google.com/*", "*://www.cnn.com/*", "*://*.foxnews.com/*" ], "js": ["js/main.js"] } ], i need event fire (either in content js or background.js, doesn't matter) whenever user visits website not match 1 of sites in matches setting. how done? in background.js add listener tab load. in fetch url of current tab , match list. chrome.tabs.onupdated.addlistener(function(tabid, info, tab) { if (info.status == "complete") { var url = tab.url.replace(/.*?:\/\//g, "").replace(/\/$/, ""); //removes protocol var allowedurls = ["www.google.com", "www.cnn.com", "foxnews.com"]; for(var in allowedurls) { if(allowedurl

javascript - Apk Crashes Every Time -

i trying modify app , following error came out when have done robo test firebase console java.lang.noclassdeffounderror: com.google.android.gms.ads.adrequest$builder fatal exception: main process: com.vasu.vfb, pid: 8929 java.lang.noclassdeffounderror: com.google.android.gms.ads.adrequest$builder @ com.vasu.vfb.mainactivity.oncreate(mainactivity.java:176) @ android.app.activity.performcreate(activity.java:5451) @ android.app.instrumentation.callactivityoncreate(instrumentation.java:1093) @ android.app.activitythread.performlaunchactivity(activitythread.java:2377) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2471) @ android.app.activitythread.access$900(activitythread.java:175) @ android.app.activitythread$h.handlemessage(activitythread.java:1308) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.java:146) @ android.app.activitythread.main(activitythread.java:5602) @ jav

Angular 2: Route to default on refresh -

i wonder if possible tell angular 2 app redirect default route ( localhost:8080/ ) on page refresh. see example: localhost:8080/#/home ---refresh action---> localhost:8080/ one way turn off initialnavigation , import router module: routermodule.forroot(app_routes, {initialnavigation: false}) and in constructor of root service or wherever inject router , navigate / .

javascript - Get a random url from chrome.bookmarks and load it in newTab -

this question has answer here: how return response asynchronous call? 21 answers why variable unaltered after modify inside of function? - asynchronous code reference 6 answers i building chrome extension load random url bookmarks bar when open new tab. my app.js has following code: var bookmarksarray = []; // function traverse bookmarks tree , save urls in bookmarksarray function process_bookmark(bookmarks) { (var =0; < bookmarks.length; i++) { var bookmark = bookmarks[i]; if (bookmark.url) { bookmarksarray.push(bookmark.url); } if (bookmark.children) { process_bookmark(bookmark.children); } } } // process bookmarks of user function createbookmarksarray(){ chrome.bookmarks.gettree(process_bookmark); } // random bookmark u

php - Change filename when uploading array -

i uploading files folder, there uploading path of files database, executed using array using php. before upload how can change uploaded file name random/unique? php: <?php if(isset($_files['file_array'])){ $name_array = $_files['file_array']['name']; $tmp_name_array = $_files['file_array']['tmp_name']; $type_array = $_files['file_array']['type']; $size_array = $_files['file_array']['size']; $error_array = $_files['file_array']['error']; $conn_info = "host= port= dbname= user= password="; $dbconn = pg_connect($conn_info) or die('could not connect:' . pg_last_error()); echo"<br/>sucessful connection"; for($i = 0; $i < count($tmp_name_array); $i++){ if(move_uploaded_file($tmp_name_array[$i], "uploads/".$name_array[$i])){ // path $path = "uploads/"

php - htaccess redirect based on specific keyword -

i need redirect below url based on "index/1992" keyword. http://www.goldcoasttouristparks.com.au/burleighbeach-parkhome/obookings3/search/index/1992/1?a=&d=&ad=adults&c=children&i=infants to redirect http://www.goldcoasttouristparks.com.au/burleighbeach-parkhome/ put below htaccess rule @ below of .htaccess file if else create new .htacees file rewriterule (index/1992) /burleighbeach-parkhome/ [r,301,l]

c# - The model item passed into the dictionary is of type 'System.Data.Entity.DynamicProxies.Survey_D8 -

i have error. is the model item passed dictionary of type 'system.data.entity.dynamicproxies.survey_d8226c5f5e348399740ede08fdf0a956bdad893915272c075af983b0c50da25e', dictionary requires model item of type 'surveyspaceproject.models.user'. i taking survey database need user. tried solutions stackoverflow there no way. can me please? not homework. project , started asp.net 1 week ago. my view public actionresult fillsurvey(int id) { var s = sspentity.getdb().surveys.firstordefault(x => x.id == id); return view(s); } my fillsurvey page : @model surveyspaceproject.models.survey @{ viewbag.title = "fillsurvey"; } <h2>fillsurvey</h2> <div> <h4>survey</h4> <hr /> <dl class="dl-horizontal"> <dt> @html.displaynamefor(model => model.user.username) </dt>

excel - How to assign a range to SeriesCollection.Value in VBA? -

i'm new programming excel macros, bear me , don't expect code efficient. have chart in want assign different ranges different seriescollections. have dataset in sheet "c". x-values(xvalues) same every graph, y-values(values) in different columns. since don't want assign every graph 1 @ time, thought of code: sub mycode() dim mychart chartobject, irow integer dim rng range set mychart = activesheet.chartobjects(1) mychart.chart irow = 1 15 set rng = sheets("c").range(sheets("c").cells(26, irow + 2), sheets("c").cells(51, irow + 2)) .seriescollection(irow).values = range(rng) .seriescollection(irow).xvalues = "'c'!$a$26:$a$51" next irow end end sub the problem in .seriescollection(irow).values = range(rng) i having error 1004 "application-defined or object-defined error". i tried different approaches including not limited to .seriescol

python - Ansible callbacks: get the name of the playbook being executed -

i playing ansible callbacks , use name (for example "ansible-test") of playbook being executed within v2_playbook_on_start(self, playbook) method. so far, here how code custom callback class callbackmodule(callbackbase): callback_version = 2.0 callback_type = 'notification' callback_name = 'xxxx' callback_needs_whitelist = true def __init__(self, display=none): super(callbackmodule, self).__init__(display=display) def v2_playbook_on_start(self, playbook): # how playbook name? def v2_playbook_on_stats(self, stats): # ... i tried several things, nothing works far: playbook._load_playbook_data , playbook.__module__ and can't find in docs . how can name? note: in case, can't use playbook._basedir edit some more details clarify point. so far, structure following: - ansible-deploy-apache - defaults - main.yml - tasks - main.yml - vars - ... he

c# - Chart control width with many series -

Image
i have chart series in legend , chart docking fill in panel. legend has these properties: chart1.legends.add(seriesname); chart1.legends[0].docking = docking.bottom; chart1.legends[0].tablestyle = legendtablestyle.wide; chart1.legends[0].bordercolor = color.cornflowerblue; chart1.legends[0].borderdashstyle = chartdashstyle.dash; chart1.legends[0].borderwidth = 1; chart few series: with more series same interval date have result: the issue not scale of data reduced size of chartarea itself.. - how can fix this? the reason in line: chart1.legends.add(seriesname); what adding 1 totally empty legend , for each of series add. placed @ default position, right. , if enough of them push chartarea left.. simply remove line, series added default legend anyway. default legend next lines style , position docked bottom. to demostrate effect can add legenditem each: legend l = chart1.legends.add(chart1.legends.count + "")); l.customitems.add(color

visual studio 2015 - Creating an APK using MSBuild command line error (PackageForAndroid or SignAndroidPackage) -

so have been trying create apk in release mode using msbuild command line executable. here contents of batch file created: echo building dsdmobile solution... >con cd "c:\ross\development\handheld\android\dsd mobile materialdesign" "c:\program files (x86)\msbuild\14.0\bin\msbuild.exe" dsdmobile.sln /p:configuration=release /v:quiet /t:clean /nologo "c:\program files (x86)\msbuild\14.0\bin\msbuild.exe" dsdmobile.sln /p:configuration=release /v:quiet /t:rebuild,packageforandroid /nologo the first line change directory solution location. next, clean last, rebuild , packageforandroid (which expecting ...apk file in bin release folder. apk never created , error. the build successful, error: "c:ross\development\handheld\android\dsd mobile materialdesign\dsdmobile.sln.metaproj : error msb4057: target "packageforandroid" not exists in project. [c:\ross\development\handheld\android\dsd mobile materialdesign\dsdmobile.sln] i h

Putting xml as a value of a json object in php -

i try json output below send api { "payload": "<?xml version=\"1.0\" encoding=\"utf-8\"?>\r\n<ns0:bulkmessage xmlns:xsi=\"http://www.w3.org/2001/xmlschema-instance\"\r\nxmlns:ns0=\"http://www.econet.co.zw/bulkmessageschema\"\r\nxsi:schemalocation=\"http://www.econet.co.zw/bulkmessageschema bulkmessageschema.xsd\">\r\n<ns0:bulktype>single</ns0:bulktype>\r\n<ns0:singlemessage>\r\n<ns0:message>sample single bulk message</ns0:message>\r\n<ns0:reference>hfhdjfdkljfjdlkfjkd</ns0:reference>\r\n<ns0:mobilenumbers>0773562319</ns0:mobilenumbers>\r\n<ns0:mobilenumbers>0774705932</ns0:mobilenumbers>\r\n<ns0:category>promotional</ns0:category>\r\n</ns0:singlemessage>\r\n</ns0:bulkmessage>", } but somehow when xml inserted json ignores characters , end having output below: { "payload": "single<\/ns0:

express - Nuxt.js routes returning 404 in IIS with IISNODE -

just trying host nuxt.js , express.js demo in iis iisnode. getting 404's nuxt page routes, express api routes working fine. all nuxt express handle routes. not sure why not working. i have set web.config iisnode handler , have included url rewrite config route server.prod.js 'use strict'; var nuxt = require('nuxt'); var app = require('express')(); var host = process.env.host || '127.0.0.1'; var port = process.env.port || 3000; app.set('port', port); // import api routes app.use('/api', require('./api/index')); // import , set nuxt.js options var config = require('./nuxt.config.js'); config.dev = !(process.env.node_env === 'production'); // init nuxt.js var nuxt = new nuxt(config); app.use(nuxt.render); // build in dev mode if (config.dev) { nuxt.build().catch(function (error) { console.error(error); // eslint-disable-line no-console process.exit(1); }); } // listen server app.liste

Laravel/PHP/HHVM error log showing line number -1 -

i'm using laravel 5.4, php 5.5.9 , hhvm 3.15.3 i'm getting error logs, showing line number -1, like: fatal error: class undefined: app\http\controllers\xxxx in xxxx/xxxxcontroller.php on line -1 hoping on this. thanks. your trying use class forgot import @ top. hard tell no code though.

leiningen - clojure.test throws? not working in the repl -

following docstring in source of clojure.test , issue following in repl: (use 'clojure.test) (is (thrown? arithmeticexception (/ 1 0))) and other variations substituting arithmeticexception java.lang.arithmeticexception . yet exception never captured clojure.test rather bubbles way top: > #error { :cause "divide zero" :via [{:type java.lang.arithmeticexception :message "divide zero" :at > [clojure.lang.numbers divide "numbers.java" 158]}] :trace > [[clojure.lang.numbers divide "numbers.java" 158] > [clojure.lang.numbers divide "numbers.java" 3808] [api.core$eval1305 > invokestatic "form-init8750388124499546857.clj" 1] > [api.core$eval1305 invoke "form-init8750388124499546857.clj" 1] > [clojure.lang.compiler eval "compiler.java" 6927] > [clojure.lang.compiler eval "compiler.java" 6890] [clojure.core$eval > invokestatic "core.clj&

c - Printing numbers in zigzag order in 2 D array -

#include <stdio.h> int main(){ int i,j; int flag = 0; int x [3][3] = {{1,2,3},{4,5,6},{7,8,9}}; (i = 0;i<3;i++){ if (flag ==1){ (j=2;j<0;j--){ printf(" %d",x[i][j]); } flag =0; } else { (j=0;j<3;j++) { printf(" %d ",x[i][j]); } flag =1; } } return 0; } i'm trying print numbers in array in zigzag form expected output should 123654789 got 123789 reason dont enter loop in flag condition want know reason.. in advance instead of (j=2;j<0;j--){ use (j=2;j>-1;j--){ and (only nice formatting) instead of printf(" %d ",x[i][j]); (near end, space after %d ) use printf(" %d",x[i][j]); (without space).

python - Why is pylint unable to find this package's module(s)? -

i'm working pylint, , i'm getting error when lint single file (repro below). i'm using azure sdk, package i'm referencing, shouldn't significant here. repro $ mkdir pylinttesting && cd pylinttesting $ python3 -m venv venv $ . venv/bin/activate $ pip3 install azure==2.0.0rc6 $ echo 'from azure import mgmt' > app.py running script file causes no issues ( python3 app.py ) pylint output even though totally valid , runs/imports without error, pylint still complains it. relevant output below (cut down brevity)... e: 1, 0: no name 'mgmt' in module 'azure' (no-name-in-module) external dependencies --------------------- :: azure (app) but! if run little snippet (in same virtual environment)... import os import pkgutil import azure package_path = os.path.dirname(azure.__file__) [print(name) _, name, _ in pkgutil.iter_modules([package_path])] ... following output... batch common mgmt servicebus servicemanagemen

Stop Karaf from generating new SSH keys on startup -

i've noticed karaf keeps generating new ssh keys on each startup. makes automatic scripts connecting via ssh useless, because new key must manually accepted each time. is possible stop behaviour , generate new keys once per new installation? more debug info: i've noticed, 'etc/host.key' has not changed. however, after stopping , starting karaf message: ssh -p 8101 localhost -ohostkeyalgorithms=+ssh-dss offending dsa key in ~/.ssh/known_hosts:5 remove with: ssh-keygen -f "~/.ssh/known_hosts" -r [localhost]:8101 dsa host key [localhost]:8101 has changed , have requested strict checking. host key verification failed. the fact dsa keys generated doesn't match log message karaf.log well: info | sshd-sshserver[20056f77]-nio2-thread-2 | simplegeneratorhostkeyprovider | 48 - org.apache.sshd.core - 1.2.0 | generatekeypair(rsa) generating host key - size=4096 my etc/org.apache.karaf.shell.cfg : sshport=8101 sshhost=0.0.0.0 sshr

python - How can I enable Run terminal Output on PyCharm 2017.1 -

since upgraded pycharm 2016.3.3 latest 2017.1 run terminal output not displaying scrip runs beginning end. instead output on terminal shown @ end once test script completes running. can adjust run terminal display text/output script running instead of having displayed @ end in latest version of pycharm? known issue in pycharm, see link view bug: https://youtrack.jetbrains.com/issue/py-22505

java - List interface not working on my servlet -

i working on login page i'll needing check if user's input valid comparing every item in arraylist input. here how implemented in servlet public class userlogin extends httpservlet { protected void processrequest(httpservletrequest request, httpservletresponse response) throws servletexception, ioexception { response.setcontenttype("text/html;charset=utf-8"); try (printwriter out = response.getwriter()) { string un = request.getparameter("username"); string pw = request.getparameter("password"); userinitializer user = new userinitializer(); user.initializeset(); string status = user.compare(un,pw); system.out.println(status); //only used check if desired output returned. } } and here implementation of model class public class userinitializer { public static list<user> users = new arraylist<user>(); public void initializeset() { users.add(new user

sql server - SQL: How to get the actual shift values -

i´ve created report in ssrs in display machines volume last hour: where intervalstartdatetime >= dateadd(hour, -2, getdate()) , intervalstartdatetime <= dateadd(hour, -1, getdate()) from last 4 hours: where intervalstartdatetime >= dateadd(hour, -4, getdate()) , intervalstartdatetime <= dateadd(hour, -3, getdate()) and last 8 hours: where intervalstartdatetime >= dateadd(hour, -8, getdate()) , intervalstartdatetime <= dateadd(hour, -7, getdate()) and additionaly display row actual shift --> here have problems. there 3 shifts. night shift: from: 05:45 - 13:45 shift: from: 13:45 - 21:45 late shift: : 21:45 - 05:45 table: intervalstartdatetime 2017-03-28 15:30:00.000 2017-03-28 15:30:00.000 2017-03-28 15:30:00.000 2017-03-28 15:30:00.000 2017-03-28 15:30:00.000 how can actual shift value? using microsoft sql server management studio please try - where ( intervalstarttime >= case when

return and print in python -

how can return output of function print () in python? have following function def read_image(raw_image_path): raw_image_path = get_one_track() open (raw_image_path) raw_image_file: content = raw_image_file.readlines() content in itertools.islice(content,1,len(content)): image_id = content.split()[0] driver_id = content.split()[2] camera_spec = content.split()[1] + content.split()[2] image_spec = [image_id,driver_id,camera_spec] image_folder_file = read_img_folders_file()[0] cam_spec=read_img_folders_file()[1] nb = read_img_folders_file()[2] image_path='' in range(nb-1): if cam_spec[i]== image_spec[2]: image_path=image_folder_file[i]+'/' raw_image= image_path+str(image_id).zfill(10)+'.png' #print (raw_image) return (raw image) the problem when use print (ra

php - Not able to set multiple connections in laravel -

i want set multiple connections in laravel application. i tried using database.php is: 'default' => env('db_connection', 'mysql'), 'connections' => [ 'mysql' => [ 'driver' => 'mysql', 'host' => env('db_host', 'localhost'), 'port' => env('db_port', '3306'), 'database' => env('db_database', 'reports_db'), 'username' => env('db_username', 'root'), 'password' => env('db_password', 'pass'), 'charset' => 'utf8', 'collation' => 'utf8_unicode_ci', 'prefix' => '', 'strict' => false, 'engine' => null, ], 'mysql1' => [ 'driver' => 'mysql', 'host' => env(&#

mvvm - android - using dataBinding, on Activity instead of layout -

i working in mvvm design pattern. want use databinding or rxjava in order notify view when model has changed. databinding can inside xml . want notify activity on change in model , more complicated. let's assume want textview change color when text in not empty. can me via databinding or rxjava ? here code: xml <?xml version="1.0" encoding="utf-8"?> <data> <variable name="viewmodel" type="edi.com.mydatabindingsimple.myviewmodel" /> </data> <linearlayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <edittext android:id="@+id/edittext" android:layout_width="wrap_content" android:layout_height="wrap_content" android:ems="10" android:inputtype="textpersonname" android:text=&q

scipy - Python Error! Import? -

this question has answer here: importerror in importing sklearn: cannot import name check_build 8 answers >>> sklearn.datasets import fetch_olivetti_faces that code entered. traceback (most recent call last): file "<pyshell#4>", line 1, in <module> sklearn.datasets import fetch_olivetti_faces file "c:\python27\lib\site-packages\sklearn\__init__.py", line 56, in <module> . import __check_build importerror: cannot import name __check_build and error received. i tried doing /pip install scipy error still not resolved. doing wrong? it looks sklearn trying import called __check_build make sure have file called , in same directory

Save PDF as a blob in a database using PHP? -

i have pdf file on server want select , transform blob insertion database (using insert into command). first problem getting hold of pdf using php. know done file_get_contents() function, not understand parameters needs. $fp = fopen($filelocation, 'r'); $content = fread($fp, filesize($filelocation)); $content = addslashes($content); fclose($fp); you can save $content blob field in mysql

pyspark - Spark Accumulator confusion -

i'm writing spark job takes in data multiple sources, filters bad input rows, , outputs modified version of input. job has 2 additional requirements: i must keep track of number of bad inputs rows per source notify upstream providers. i must support output limit per source. the job seemed straightforward , approached problem using accumulators keep track of number of filtered rows per source. however, when implemented final .limit(n) , accumulator behavior changed. here's striped down sample code triggers behavior on single source: from pyspark.sql import row, sparksession pyspark.sql.types import * random import randint def filter_and_transform_parts(rows, filter_int, accum): r in rows: if r[0] == filter_int: accum.add(1) continue yield r[0], r[1] + 1, r[2] + 1 def main(): spark= sparksession \ .builder \ .appname("test") \ .getorcreate() sc = spark.sparkcontext

xml - button is invisible on the android.support.v7.widget.Toolbar -

i have placed button in front of toolbar , problem is, not visible users. want button visible in toolbar, or should placed on toolbar. here code <?xml version="1.0" encoding="utf-8"?> <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/hello" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/holo_blue_dark" tools:context="com.hackerinside.jaisonjoseph.radioplanet.intro"> <imageview android:id="@+id/imageview" android:layout_width="match_parent" android:layout_height="match_parent" android:foregroundgravity="center" android:src="@drawable/ione" /> <android.support.v7.widget.toolbar androi

xml - Thymeleaf-How to pass variable -

<th:block th:with="reference=${op.jptext('$.u_reference')}"> <incident id="reference">enter code here <incident> i have created 1 reference value , per requirement needed passed dynamically output incident id="abcd" when running code getting output incident id="reference" seems system not able pass variable refernce value to have thymeleaf evaluate something, must begin th: . code should like <incident th:id="${reference}">enter code here

c++ - Default Constructor when creating an Array of Objects within an Object -

i attempting create array of objects within object (specifically array of check within checkbook . not allowed use vector in place of dynamic array store objects, maddening, rules have been stipulated me. the issue i'm struggling need provide several variables check constructor because needs construct money object within check object. so i'm receiving error claiming check* checkarray = new check[]; has no default constructor. i have since added default constructor check::check() {}; , how can dynamically fill array without arguments being passed constructor upon creation? new oop , struggling manage classes within classes. note: money class predefined , implemented the data these relevants checks stored in .txt file in form of int(check number) '\t' double(check amount) '\t' int(bool cashed represented in 0 or 1) , temporarily storing data in struct datatransferstruct , storing structs in vector test, can't use vector in final implementat

mysql - Ruby Mysql2 via proxy (QuotaGuard) -

i need connect mysql database using mysql2 gem . works in local on heroku need static ip address have installed quotaguard provide me proxy username , password. the proxy working fine (tested curl) i'm not able connect mysql using it, saw on post can specify mysql socket file while connecting have absolutely no idea put in it, can't find anywhere. client = mysql2::client.new(:host => host, :database => database, :username => username, :password => password, :port => port, :socket => "my_path/to/mysql.sock") i randomly tried in my_path/to/mysql.sock doesn't affect anything, ignored route { proxy: xxxx:xxxxx@xxxxxx.quotaguard.com port: 9293 proxyprotocol: socks_v5 method: username command: connect } thanks

rust - How do I initialize a static with calls to non-static functions? -

this question has answer here: how can make safe static singleton in rust? 2 answers how create global, mutable singleton? 1 answer what proper way initialize such field, if there 1 @ all? static args: hashmap<&str, vec<u8>> = ["nonce", "gas_price", "gas_limit", "to", "value", "data"] .iter() .map(|i| (*i, get_random())) .collect(); i error: error[e0015]: calls in statics limited constant functions, struct , enum constructors --> src/main.rs:3:39 | 3 | static args: hashmap<&str, vec<u8>> = ["nonce", "gas_price", "gas_limit", "to", "value", "data"] | _______________________________________^ starting h

Elixir binary pattern matching of Integer or Convert Integer to binary -

i started learning today elixir , stuck in pattern matching of integer. i know how match binary , can't find how match integer i.e. extract high byte simple integer. must either convert integer binary or write function takes high byte integer , found nothing close in library. <<y1::size(8), y2::size(8), y3::size(8), y4::size(8) >> = t where t integer may guess gives ** (matcherror) no match of right hand side value: 3232235521 you can convert integer binary using <<x::32>> (which short <<x::size(32)>> ). convert using big endian byte order. little endian, need add -little , <<x::little-32>> . can extract using pattern mentioned (again shortened remove size() it's not required): iex(1)> <<y1::8, y2::8, y3::8, y4::8>> = <<3232235521::32>> <<192, 168, 0, 1>> iex(2)> {y1, y2, y3, y4} {192, 168, 0, 1} iex(3)> <<y1::8, y2::8, y3::8, y4::8>> = <<32

javascript - Dialog API Office Add-in not works in Outlook 2016 -

i working on outlook web add-in, display sign-in page in dialog. used dialog api , works fine in owa(outlook web) not in outlook 2016 desktop (version - 1702). office.context.ui.displaydialogasync('https://www.google.lk/', {height: 30, width: 20});