Posts

Showing posts from May, 2011

python - Requirement already satisfied but ImportError: No module named "pkg" -

i using mac , pycharm & python 2.7.11 , import psutil import os i have installed pkg importerror: no module named "pkg" shows @ ide and terminal shows: requirement satisfied: psutil in /library/python/2.7/site-packages thanks in advance. still, facing issue. @ cases, things have been solved had 2 python 2.7.10 & 2.7.11 installed.from mac terminal, used pkg 2.7.11 @ project settings python interpreter selected 2.7.10.

cobol - Replace values with nothing / null -

i have text file delimiters (like #rt#, #lt#, #bc# etc) need removed. for example:- original: taxes owed:#rt#$3000 fixed version: taxes owed:$3000 replacing spaces doesnt work obviously, puts in spaces - computer read file - needs exact - nothing/null do. any ideas? the above representative sample of data... random paragraphs of data #rt# , #lt# in it. currently, replacing spaces used. need removed entirely in example above. cant post code till tomorrow im on road. the inspect yourtext replacing spaces leaves spaces. inspect yourtext replacing "" not allowed (both need same length or replacing identifier figurative constant: space[s], zero[s|es], or quote[s]) - compiler output understandable message if try this. this leaves 3 options: don't use cobol (would #1 option if don't want else text file) system call, example sed -e 's/#rt#//g' yourfile > yourtarget , depending on cobol runtime use (it idea add information in question

angular - Ionic2 - ion-select element at RTL issue -

i use angular2 , ionic 2. app support multy-languages. when user click "change hebrew" following code computed: this.platform.setdir('rtl', true); this.translate.use('he'); however, app move rtl well. ion-select element have not look. can see @ picture. radio-buttons overflow box, labels , title align left instead of right. solution? here link picture: http://jmp.sh/tox6hot1

javascript - redirect login page to welcome page from angularjs -

i creating s web app in need redirect login welcome page if user id , password validated <script> var app = angular.module('myapp', []); app.controller('customersctrl', function ($scope, $http, $interval) { //login $scope.loginbutton = function () { $http.get('/login.asmx/loginuser', { params: { log: $scope.log, pm: $scope.pm, password: $scope.password } }) .then(function (response) { { //here want redirect page } }) } }); </script> this script of angularjs how redirect page page? add $window in controller app.controller('customersctrl', function ($scope, $http, $interval, $location, $window) { then add following line in response .then(function (response) { {

java - Eclipse suddenly searches for main class "Default" on all projects -

when run eclipse project error: "error: not find or load main class default". @ first thought wrong project setup, have error of projects worked fine before. makes me think problem solely comes eclipse. what have done already i've cleaned projects rebuild maven projects restarted eclipse multiple times in "run configuration" correct main class displayed also: commandline not have problem. my main question is: mean, eclipse searching main class "default" though should find correct class? edit: eclipse version is: luna service release 2 (4.4.2)

iphone - How to create widgets showing on home screen in iOS 10 -

Image
i need create custom widgets on home screen in iphone. have attach sample image. please give me idea extension helpful in creating this. swift3 & xcode8 for above need create extension main app which extension need create achieve above one? ans:today extension how create extension? xcode -> file -> new -> target ->today extension after creating extension, if want pass data main app extension need know appgroups appgroups nothing share data between main app extensions how achieve? just simple 👇 go xcode -> capabilities -> appgroups enable -> click + -> add new container format group.* for example: group.com.yourcompany.projectname go main app initialise defaults suite var appgroupdefaults = userdefaults.standard appgroupdefaults = userdefaults(suitename:"group.com.yourcompany.projectname")! after initialising defaults suite , set arraydata or string data whatever need pass extension appgroupdefa

php - Creating relations using Laravel model factories -

i trying create user using model factories having error relationships. in user model, have created belongsto relationship levels model joblevel . in modelfactory.php have following code. use app\user; use app\joblevel; $factory->define(joblevel::class, function (faker\generator $faker) { return [ 'name' => $faker->word, 'rank' => $faker->randomdigit, ]; }); $factory->define(user::class, function (faker\generator $faker) { return [ 'firstname' => $faker->name, 'middlename' => $faker->name, 'lastname' => $faker->name, 'email' => $faker->email, 'job_level_id' => factory(joblevel::class)->create()->id, 'password' => bcrypt(str_random(10)), 'remember_token' => str_random(10), ]; }); then in test class use factory follows. /** @test */ public funct

java - I need help to write a program that takes input from user and reverses using a stack? -

i’m trying build program (java) take string input user puts stack , reverses stack using push , pop. when user inputs “end-line” program stop pushing stack , print strings entered user in reverse order ? public class stackreversal{ private class node{ private string item; private node next; } private node first = null; public boolean isempty(){ return(first == null); } public void push(string s){ node node = new node(); node.item = s; node.next = first; first = node; } public string pop(){ if(first == null) throw new runtimeexception("stack empty!"); string result = first.item; first = first.next; return result; } public string popstring(){ string result=""; node current = first; while(current != null){ result += current.item; current = current.next; } return result; } public static void main(string [] args) { stackreversal s = new stackreversal(); s.push("

python - String/dict manipulation ' to " -

{'coolstring': {'stepone': {'x': '44', 'y': '66'}}} this string/dictionary create input(), however, need change ' or apostrophes " or quotation marks. reasoning need passed json string further down pipeline. my idea using .replace() i'm not quite sure how format swaps ' " tips? if input dictionary, there's json module need: import json dic = {'coolstring': {'stepone': {'x': '44', 'y': '66'}}} json_string = json.dumps(dic) print(json_string) the output be: {"coolstring": {"stepone": {"x": "44", "y": "66"}}} however if data string, can use proposed solution other comment using replace()

mysql - Deleting a data in Database using php -

i need delete data on database using php code, have written code there error message. here php code(del.php):- <!doctype html> <html> <body> <?php $conn = mysql_connect('localhost', 'root',''); if ($conn->connect_error) { die("connection failed: " . $conn->connect_error); } $sql = "delete register name='' "; if ($conn->query($sql) === true) { echo "record deleted successfully"; } else { echo "error deleting record: " . $conn->error; } $conn->close(); ?> </body> </html> the database name 'selva' , table name 'register', in database file names "name,email,contact,address", need delete name or email or contact . how delete!! //this delete whole row: <!doctype html> <html> <body> <?php $servername = "localhost"; $username = "root"; $password = "your_password&quo

.htaccess - laravel 5.2 - from domain to subdomain -

i transfert laravel installation subdomain, application not work, domain 'server not found' .htaccess is: rewritebase / rewritecond %{http_host} !^subdomain rewritecond %{request_uri} !^public rewriterule ^(.*)$ public/$1 [l] rewritecond %{http_host} ^subdomain rewritecond %{request_uri} !^public rewriterule ^(.*)$ public/ [l] my structure is: - css/ - error_log - favicon.ico - favicon.png - icon/ - index.php - local/ - resources/ - robots.txt - uploads/ - web.conf any idea?

wordpress - WooCommerce permalink setup for product and attribute -

i'm using woocommerce free wordpress plugin. have created products , assigned attributes. i need display specific category products, done it. when try display products specific category, not working. if have attribute "rashi" value "kumbam", how can display products have attribute value? when try set base value products, /shop/%product_cat%/ not working. how can set this?

scala - MaxSubArray using dynamic style -

i have been trying create code counts max substring array , returns sum , starting , ending point. have error in there cannot spot because example when use array(-2, 1, -3, 4, -1, 2, 1, -5, 4) source return (7, 5,8) . however, correct answer should (6, 3, 6) . code below. def solve(a: array[int]): (int, int, int) = { require(a.nonempty) val n = a.length val temp = array.fill(n)(0, 0, 0) var max = (0,0,0) // sum, start, end (i <- 0 n-1) { temp(i) = (a(i), i, i) } (i <- 0 n-1) { (j <- 0 i) { if (a(i) > a(j) && temp(i)._1 < temp (j)._1 + a(i)) { temp(i) = (temp(j)._1 + a(i), j, i) } } } (i <- 0 n-1){ if (max._1 < temp(i)._1){ max = temp(i) } } return max } how more scala/functional approach? def solve(a: array[int]): (int, int, int) = { a.tails.zipwithindex.flatmap{ case (arr, ti) =>

c++ - In gtest, can you try/catch a function that calls "exit(1)"? -

there's function calls exit(1) specific cases, , i'm trying run unit tests gtest on function. i thought i'd able use try/catch case function calls exit(1) , doesn't catch me. is normal behavior? if so, how else should detect exit(1) called? unlike in, say, python, exit() function of c , c++ doesn't work throwing exception. once has done c runtime cleanup (e.g. calling registered atexit() handlers), directly calls kernel terminate process, , control never returns program. the news that google test support testing program exit : assert_exit(statement, predicate, regex); , expect_exit(statement, predicate, regex); statement exits given error , exit code matches predicate i haven't checked, guess implemented fork() ing test, , waiting child terminate.

python - How to manage data batches for big neural network? -

i preparing learn quite big neural network (fc, conv, pool, etc.) millions of small images ( ~~100x100 px, 3 channels each) in keras. files around ~~800 gb , there question. how should perpare data? i know keras handles batches better learn network either 100 files 8 gb each or create ~~300k files (in each merged 32 or 64 images)? think better have bigger files , faster read them 8 times (8 big files) 300k times not sure. i have got less 100 gb ram can not load whole data @ once sure. thanks! you can use keras.preprocessing.image.imagedatagenerator provided keras instead of loading files memory. allows set batch size. imagedatagenerator can augment data in real-time "for free" if need. since takes time train network using batch of images, reading files hard drive doesn't slow down performance. main bottleneck computational power. the interface , examples of keras.preprocessing.image.imagedatagenerator can found @ imagedatagenerator

unity3d - Instead of LoadLevel, how do i use SceneManager -

Image
i super new in coding , couldn't find right answer on web. want change scene in game. i've had buttons etc. can't choose "menu" script on click function menus. all answer welcome! using unityengine; using unityengine.scenemanagement; using system.collections; public class menu : monobehaviour { public void changescene(string scenename) { scenemanager.loadscene("scenename"); } } you can't plug in menu script left slot. you have attache menu gameobject plug gameobject left slot.you able chose script , function send event on right. the image below shows wrong way this(this how doing it) : the correct way it : you can code: public class menu : monobehaviour { public button playbutton; void start() { //add button event playbutton.onclick.addlistener(() => buttoncallback(playbutton)); } public void changescene(string scenename) { scenemanager.loadsce

php - posting data to cross server in angular 2 and wordpress -

i trying post data php page angular2 . generate correct url when use ajax call same url not hit php page. let url = 'http://localhost/deals//wp-admin/admin-ajax.php?action=create&deal='+deal+'&price='+price; console.log(url); // url web api var headers = new headers(); headers.append("content-type", "application/jsonp"); return this._http.get(url, headers ) .map(res => res.json() );

GNUPLOT - Two columns histogram with values on top of bars -

Image
yesteraday made similar question ( this one ). not display value on top of bar in gnuplot histogram. lost many time because couldn't find documentation it, , can find similar issues on differents websites. i lost many time fortunately give me solution. having similar issue histogram 2 bars, in have put on top of both bars value. quite near, or think, can't make work properly. changing script , regenerating graph many times not sure of doing. script.sh #!/usr/bin/gnuplot set term postscript set terminal pngcairo nocrop enhanced size 600,400 font "siemens sans,8" set termoption dash set output salida set boxwidth 0.8 absolute set border 1 set style fill solid 1.00 border lt -1 set key off set style histogram clustered gap 1 title textcolor lt -1 set datafile missing '-' set style data histograms set xtics border in scale 0,0 nomirror autojustify set xtics norangelimit set xtics () unset ytics set title titulo font 'siemens sans-bold,20' set yr

javascript - Phantomjs merge PDF's -

i using phantomjs generate pdf's url's. works fine, every url get's transferred seperate pdf. want bunch of url's transferred 1 pdf several page. ideas how done (preferable in javacsript)? thnx, henk code used now: phantomjs pdf_export_urls.js pdf_export_urls.js: "use strict"; var renderurlstofile, arrayofurls, system; var file_format = 'pdf'; var base_url = 'http://'; system = require("system"); /* render given urls @param array of urls render @param callbackperurl function called after finishing each url, including last url @param callbackfinal function called after finishing */ renderurlstofile = function(urls, callbackperurl, callbackfinal) { var getfilename, next, page, retrieve, urlindex, webpage; urlindex = 0; webpage = require("webpage"); page = null; getfilename = function(url) { var filename = ""; filename = url // remove http/https prefi

java - Initialization of an object via @Query request -

i have statearchivedto class field collection<statepropertyentity> stateproperties . now i'm trying create page of objects statearchivedto mysql database. can't deal collection. public interface statearchiverepository extends jparepository<statearchiveentity,long>{ @query(value = "select new com.myproject.endpoints.dto.statearchivedto(statearchive.id, statearchive.type, statearchive.created, statearchive.updated, statearchive.version, statearchive.stateproperties) " + "from statearchiveentity statearchive " ) page<statearchivedto> getstatearchive(pageable pageable); } response controller: { "timestamp": 1478599659554, "status": 500, "error": "internal server error", "exception": "org.springframework.dao.invaliddataaccessresourceusageexception", "message": "could not extract resultset; sql [n/a]; nested exception org.hi

Find and replace text in Excel using C# -

i find , replace group of text in excel using c#, want replace happen text in first row only. i have used google , found few paid resource aspose api,spire.xls,etc, looking open source resource or other efficient way achieve this. please suggest. try this: public static void replacetextinexcelfile(string filename, string replace, string replacement) { object m = type.missing; // open excel. application app = new applicationclass(); // open workbook. workbook wb = app.workbooks.open( filename, m, false, m, m, m, m, m, m, m, m, m, m, m, m); // active worksheet. (replace if need to.) worksheet ws = (worksheet)wb.activesheet; // used range. range r = (range)ws.usedrange; // call replace method replace instances. bool success = (bool)r.replace( replace, replacement, xllookat.xlwhole, xlsearchorder.xlbyrows, true, m, m, m); // save , close. wb.save(); ap

Error inflating class android.support.design.widget.FloatingActionButton - android -

i want run activity got error : android.view.inflateexception: binary xml file line #21: error inflating class android.support.design.widget.floatingactionbutton @ android.app.activitythread.performlaunchactivity(activitythread.java:2693) @ android.app.activitythread.handlelaunchactivity(activitythread.java:2758) @ android.app.activitythread.access$900(activitythread.java:177) @ android.app.activitythread$h.handlemessage(activitythread.java:1448) @ android.os.handler.dispatchmessage(handler.java:102) @ android.os.looper.loop(looper.

Will a "git-pull develop" fetch all the commits reacheable from develop? -

i have question regarding how git pull changes form remote, , how many history. i'm considering follow gitflow workflow project. 80 developers, , integrating our changes feature branches develop branch - means of pull requests perform code review first. we need (locally) rebase our feature branches on (top of) develop, have latest develop changes integrated. hence, pulling develop often. here, don´t want fetch other teammates' feature branches - nor commit history. now, if pull develop, operation bring commit history happen under other feature branches if reachable (through merge commit) develop? thanks in advance :-) edit : might not have been clear enough: we use rebase locally, pull request on develop branch mergeable. don't use merge might "pollute" feature branches when performing code-review. if pulll request accepted then, merge non fast forward commit. i know can "git fetch origin develop". here question: git pull origin devel

c# - Is it possible to generate Satellite Assemblies from within code? -

i'm elaborate solution simplifying translator tool. therefore try automatically compile satellite assembly within code. so want achive replace manual run of following command: al.exe /culture:de /out:de\testresource.resources.dll /embed:testresource.de.resources so far i've tested generating .dll file, worked. embedding/linking ressource shown below doesn't has effect, expanding dll's size. it's there not usable if resulting dll satellite assembly. static void main(string[] args) { csharpcodeprovider codeprovider = new csharpcodeprovider(); compilerparameters parameters = new compilerparameters(); parameters.generateexecutable = false; parameters.outputassembly = "./output/satellite_test.dll"; parameters.embeddedresources.add(@"./testresource.en.resources"); parameters.linkedresources.add(@"./testresource.de.resources"); compilerresults results = codeprovider.

javascript - Turning random cube to random sphere in three js -

so issue trying create random star chart within three.js when zoomed out becomes planet(sphere) created stars. currently code im using randomly generates stars yet when zoom out cube, not sphere. (var = 0;i<2000;i++){ var mesh = new three.mesh( geometry, material); mesh.position.x = ( math.random() - 0.5) * 4000 * math.random(); mesh.position.y = ( math.random() - 0.5) * 4000* math.random() ; mesh.position.z = ( math.random() - 0.5) * 4000* math.random() ; mesh.rotation.x = math.random(); mesh.rotation.y = math.random(); mesh.rotation.z = math.random(); scene.add(mesh); objects.push(mesh); } this loop in spawn stars , line 3-6 determines way stars spawn have been able multiply positioning again math random create less defined cube instead of desired sphere. instead of setting mesh's x,y,z position do

java - Visual Studio 2013 hangs when build a Android Project -

i'm trying xamarin , made few projects play around , it's being experience far, flawless. , when start build project, android, visual studio hangs. noticed, if kill java.exe vs normal , able rebuild again. thoughts on that? setup windows 10 pro , visual studio 2013 ultimate update 5. i'm using microsoft android emulator. in case interested, found out xamarin instead build app downloading m2repository in zip file. size varies 60mb 250mb in particular case. once file downloaded build happens flawlessly. if delete these files, xamarin download again. the folder c:\users\myusername\appdata\local\xamarin\zips

ajax - Does Spring Form Backing support takes null as a value of an entity -

i have entity user[userid, name , age] now jsp hitting ajax this: $.ajax({ type: "post", url: "/user/saveuser.htm", data: "userid=" + userid+ "&name=" + name + "&age=" + age, success: function (response) { alert("success"); } and controller is: @responsebody @requestmapping(value = {"saveuser"}, method = {requestmethod.post}) public string submitproblem(httpservletrequest req, user user) { //backend codes } my question when sending name="abc" , age="24" , id=32; fine. " the request sent client syntactically incorrect. " response comes if sending id=null . please me know issue. try use json data in ajax request first can use $.ajax({ type: "post", url: "/user/saveuser.htm", data: {'userid': userid, 'name': name, 'age' : age

ios - Xcode 7.3 Upload to iTunesConnect (TestFlight build) failed -

Image
previously submitted app using xcode 7.3 fail "itunes store operation failed" error xcode 7.3 past 10 days. we made build xcode 7.3 , uploaded using application loader 3.0 got "missing beta entitlement" , build not available testing. i had similar problem too, seems xcode 7 build can sent using application loader of xcode 8. suggestion build app using xcode 7 export app store build , upload using application loader of xcode 8. application loader inside xcode menu->open developer tool

java - While ResultSet is not executing? -

i trying call 2 sets of data 2 different tables display in jtextarea ( jtadisplay ). first table ( emp_db ) employee number, name , surname. second table ( sec_clearance ) employee security clearance level. the method placed in constructor execute when frame starts up, whenever run frame not display data. no error messages come , stack trace doesn't display error messages. i placed joptionpane in various places inside method see problem lies , found while(rs.next()) statement not executing joptionpane displays outside while statement not inside it. here code have: try { string user = txtemptitle.gettext(); string encuser = encrypt(user); //encrypting employee number aes read in database string getempnum = "select * emp_db emp_num = '" + encuser + "'"; string getseclevel = "select seclevel sec_clearance emp_num = '" + encuser + "'"; class.forname(

How to disable opening records from Odoo pivot table -

in odoo pivot view, when clicking on value in table, opens correspondig record(s) in tree view. possible disable reaching records view. if so, how proceed? thank you. i found answer question. in xml view file <pivot string="report" disable_linking="true">

Updating Android Studio breaks Google Maps -

updating android studio 2.2.1 2.2.2 has broken project, since unable access related google maps. project worked fine before update, nothing works now. making entirely new project based in google maps activity doesn't work either , gives me exact same crash report , results. what have tried: - updating of sdk's, google related ones. - generated new google api key - creating entirely new project scratch - changed supportmapfragment mapfragment error getting when try run project , entirely new maps project on phone (same error(all other gmaps apps work on phone, don't think that's issue)): caused by: android.view.inflateexception: binary xml file line #1: binary xml file line #1: error inflating class fragment my build.gradle(new project scratch): apply plugin: 'com.android.application' android { compilesdkversion 24 buildtoolsversion "24.0.2" defaultconfig { applicationid "com.example.simon.afinal" minsdkversion 19 ta

javascript - create global socket object in angular js? -

i new angular js , have requirement need create single instance of socket object can accessed controller. for created factory private socket variable connects socket-io server automatically when application started. created public method return socket object. i want know whether approach fine or can have better solution this.also imply create singleton object or not? below factory code wrote purpose. socketioservice.js (function() { 'use strict'; angular .module('app.core') /* @nginject */ .factory('ncsocketfactory', function(socketfactory, call_url, $rootscope) { var socket = io.connect(call_url, { transports: ["websocket"] }); socket.on('connect', function () { console.log('socket io connected...'); $rootscope.$broadcast('socket:connected'); });

scala - How to set multi-dex in Intellij -

i have scala sbt android project have imported intellij. builds fine using sbt when compile intellij following error: error:android pre dex: [scala-compiler-2.11.7.jar] trouble writing output: many method references: 69269; max 65536. error:android pre dex: [scala-compiler-2.11.7.jar] may try using --multi-dex option. ... i can't find way of setting 'multi-dex' option however. in modules under project structure have clicked 'enable multi-dex support' no avail. tried adding below build.scala still no success: dexmulti := true, dexadditionalparams := seq("--multi-dex"), how can pass --multi-dex option pre-dex?

switching between two redux-saga flows -

in scenario user can redeem vouchers. while not logged in can still test redeem feature understand how works. i have 2 flows, notloggedinredeemflow case when not logged in , loggedinredeemflow in case logged in. i have on root saga, should start 1 flow , stop other based on users login state. i came using race between 1 flow , cancellation action flow. on app startup notloggedinredeemflow active , should end when user logs in. then loggedinredeemflow starts , runs until user logs out. function* redeemflows() { while (true) { const result = yield race({ fake: call(notloggedinredeemflow), gotaccesstoken: take([accountactions.login_success, accountactions.start_signup_success]), }) yield race({ run: call(loggedinredeemflow, result.gotaccesstoken.payload.access_token), logout: take(accountactions.logout_success), }) } } my questions if best way handle such scenario in redux-sagas? if i'm understanding use case

EXCEL: Copy data according to cell colour -

Image
i have created calendar in excel. want export important events separated table. process following: check colour of cells within concrete row if colour of cell (for example) yellow --> copy description of below cell , date of event table repeat process cells within selected row desired output: thanks lot!

c - What is a good way to stop all pthreads without using mutex or global variables? -

say hypothetically not know mutex_locks , not allowed use global variables in program, can in order stop running pthreads if 1 returns successful variable? for example have data structure pass pthread contains : typedef struct { char * string1; //info argv[1] char * string2; //info argv[2] int id; //thread id } datastruct; and while creating pthreads in main.c create them such : datastruct datastr[nbthread]; //array of datastructs each thread pthread_t tabthread[nbthread]; //pointers thread 1 (int = 0; < nbthread; ++i) { //initiation of threads... datastr[i].string1 = argv[1]; pthread_create(&tabthread[i], null, thread, (void *)&datastr[i]); //create pthreads , } (int = 0; < nbthread; ++i) { pthread_join(tabthread[i], (void**)&(ptr[i])); //join threads //printf("\n return value thread[%d] [%d]\n",i, *ptr[i]); } now 1 of threads find