Posts

Showing posts from May, 2010

java - A superclass method is called instead of the subclass method -

let's take @ code: public class parentclass { public void foo(object o) { system.out.println("parent"); } } public class subclass extends parentclass { public void foo(string s) { system.out.println("child"); } public static void main(string args[]) { parentclass p = new subclass(); p.foo("hello"); } } i expected print out "child", result "parent". why java call super class instead, , do make call method in subclass? subclass#foo() not override parentclass#foo() because doesn't have same formal parameters. 1 takes object , other takes string . therefore polymorphism @ runtime not applied , not cause subclass method execute. java language specification : an instance method m c declared in or inherited class c, overrides c method m a declared in class a, iff of following true: a superclass of c. c not inherit m a . the signature of

UNIX - Shell get last access file -

how can timestamp on file ( last access ) tried this: stat -c %x filename <br /> but doesn't work stat -c %x filename correct gnu stat. if you're on non-gnu platform (such macos), no format-string functionality may available; in case, might consider using different tool. (for instance, if have gnu find , -printf can used print atime). find filename -printf '%a@' ...is gnu find equivalent (if install on os x using macports, may called gfind ). if don't have either, i'd suggest perl if want portable alternative. note, way, it's common mount filesystems noatime improved performance (reduced overhead updating metadata); thus, may access time unavailable.

ruby - How to get 10s, 100s, 1000s from an integer? -

is there method in ruby allows breaking integers 1s, 10s, 100s, 1000s, ...? i know can convert integer string , parse string values mentioned above, imagine there simple way ruby other things. far have this: 1234.to_s.chars.reverse.each_with_index .map{|character, index| character.to_i * 10**index } # => [4, 30, 200, 1000] but there specific in ruby? you follows: n = 1020304 math.log10(n).ceil.times.with_object([]) |i,a| n, d = n.divmod(10) << d * 10**i end #=> [4, 0, 300, 0, 20000, 0, 1000000] hmmm. looks bit odd. maybe better return hash: math.log10(n).ceil.times.with_object({}) |i,h| n, d = n.divmod(10) h[10**i] = d end #=> {1=>4, 10=>0, 100=>3, 1000=>0, 10000=>2, 100000=>0, 1000000=>1}

django - Implement web based desktop application with python -

i want make application run web application or desktop application, know how implement web server using django or flask, prefer django, there way port desktop application too? found nodewebkit maybe give me solution but, don`t have idea on how use it. import wx wx.lib.iewin import iehtmlwindow = wx.app(redirect=false) f = wx.frame(none,-1,"my desktop application") browser = iehtmlwindow(f) browser.navigate("http://google.com") f.show() a.mainloop() is pretty way remote web page pretend windows application ... assuming thats asking for.. (this uses wxpython of coarse need install it)

famous engine - Why does my box disappear? -

i trying track position of 'mybox,' @ time of click. works when attach event mybox, isn't want. want able click anywhere within window. thought since scene has .onreceive() function, able attach click event scene itself, whenever do, box not appear. 'use strict'; var famous = require('famous'); var camera = famous.components.camera; var math = famous.math; var physics = famous.physics; var physicsengine = famous.physics.physicsengine; var box = physics.box; var vec3 = math.vec3; var size = famous.components.size; var position = famous.components.position; var mountpoint = famous.components.mountpoint; var gravity1d = physics.gravity1d; var collision = physics.collision; var distance = physics.distance; var wall = physics.wall; var domelement = famous.domrenderables.domelement; var famousengine = famous.core.famousengine; //physics engine test function game() { //create scene graph this.scene = famousengine.createscene('body'); t

javascript - Duplicating Angular response data so changes to one don't affect the other -

i have angular controller connected node/express server. response data request called in $http.get can set response=$scope.x . x can interacted , changed. set $scope.y = $scope.x , , changes y result in x changing well. however, want clone response have original response data set different variables without them changing each other. consider response response.name = "joe" . $scope.x = response; $scope.y = response; in code or view/model change x.name such: $scope.x.name = "bob" however, $scope.y.name still equal "joe" . i use 2 separate requests retrieve same response, i'd pass response function dynamically change data , make new version of based on for loop. there clean, "angular" this? or simple javascript function? angular has built in utility angular.copy() $scope.x = response; $scope.y = angular.copy(response); can used clean out unwanted properties angular can create such hashkeys used in ng-repeat t

javascript - AngularJS - Form with Select element to get Id from another object -

i have 2 tables "category" , "publication" 1 many relationship. category: id, name, description publication: id, title, content, category_id and need category id through select element , put in category_id field. publication form: <form> <input type="text" ng-model="publication.title" placeholder="title" /> <input type="text" ng-model="publication.content" placeholder="content" /> <!-- here problem because can list categories can't category id , put in category_id field --> <div ng-init="categories()"> <select class="form-control" ng-model="category" ng-options="category.name category in categories"> <option value="">-- select category --</option> </select> </div> </form> this controller categories: $scope.categories = function() { $http(

asp.net mvc 4 - Web Deploy Package Isn't Zipped -

using vs 2013's publish profile can not package output zip part of publish. if give target of xx.zip folder named , files unzipped under folder. using publish wizard now, hoping create msbuild command line. <project toolsversion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <propertygroup> <webpublishmethod>filesystem</webpublishmethod> <lastusedbuildconfiguration>release</lastusedbuildconfiguration> <lastusedplatform>any cpu</lastusedplatform> <siteurltolaunchafterpublish /> <excludeapp_data>false</excludeapp_data> <publishurl>c:\dev\cloud_deploy_package\deployme.zip</publishurl> <deleteexistingfiles>true</deleteexistingfiles> </propertygroup> </project> i found answer (unfortunately, closed browser can't link). have create web deploy package , not filesystem package. right-click proje

entity framework - MVC5 + Autofac: DbContext is being reused -

i have context registered so: internal class dbcontextmodule : module { protected override void load(containerbuilder builder) { builder.register(ctx => new crtechentities()).instanceperlifetimescope(); } } controllers registered such: builder.registercontrollers(assembly.getexecutingassembly()).instanceperlifetimescope(); in 1 of repositories, ask in ctor, not new context.. if(_context.changetracker.entries().any()) _context.changetracker.entries().tolist().each(e => e.state = entitystate.detached); is causing sorts of issues, , don't understand why context not new one. missing here? if want create new instance on each request use instanceperdependency instead of instanceperlifetimescope instanceperlifetimescope creates 1 instance each scope, if don't create scope autofac creates default scope, , use everywhere also please note, if in asp.net project, better practice use 1 instance each request instanceperrequest

cordova - Meteor - Android white screen -

i have meteor app , want publish on google play once app installed , open white screen after splash page. when test app locally meteor run android-device --mobile-server=... app loads fine. it hard post code since there lot of code can identify problem here? thanks!

black lines around image using warpPerspective for stitching in opencv -

Image
im trying build mosaic panorama video. stitched every frame together, there problem in final image. used findhomography translation matrix, mask , warpperspective , copy new warped image final image panorama. i think problem of warpperspective.does know solution how fix these black lines? these black vertical lines corners of stitched image.how remove them? i solved it.i figured out corners of stitched image , tried manually edit mask.i draw black lines using code mask: line(mask, corner_trans[0], corner_trans[2], cv_rgb(0, 0, 0), 4, 8); line(mask, corner_trans[2], corner_trans[3], cv_rgb(0, 0, 0), 4, 8); line(mask, corner_trans[3], corner_trans[1], cv_rgb(0, 0, 0), 4, 8); line(mask, corner_trans[1], corner_trans[0], cv_rgb(0, 0, 0), 4, 8);

ios - How to convert the NSString of format (2015-04-30T21:53:11.0000) to NSDate? in Swift -

this question has answer here: converting nsstring nsdate (and again) 16 answers could please let me know how convert nsstring of format (2015-04-30t21:53:11.0000) nsdate? in swift. use datefromstring method in ios' date formatter class . there zillion examples , explanations google search away. in objective-c, that's easy convert swift. read this .

android - EditText Selection Anchors Missing -

Image
i've noticed edittext fields in app not show selection anchors correctly. example: however, expect correct anchors appear such as: a typical example of affected edittext in app: <edittext android:id="@+id/text_message" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_toleftof="@id/button_send" android:layout_marginleft="@dimen/activity_horizontal_margin" android:paddingtop="@dimen/activity_vertical_margin" android:paddingbottom="@dimen/activity_vertical_margin" android:inputtype="text|textshortmessage" android:layout_marginright="4dp" android:hint="@string/hint_chat_send" /> also notice "paste" hover view has strange white border around in app, in other apps transparent. i suspect kind of theme issue, since affects multiple screens in app, cannot find info on attributes

box api - User's last login time? -

i'd know when given user last logged in. seems user object doesn't include information (creation , modification only). should leverage events api (seems inefficient) or missing obvious? yes, events api this. specifically, you'll want use enterprise events api , query events of type login . requires access token administrative privileges. curl https://api.box.com/2.0/events?stream_type=admin_logs&event_type=login \ -h "authorization: bearer access_token" note that: the returned events paged, may need adjust page size or execute multiple queries find event(s) you're looking for. you can use created_after , created_before query parameters limit returned events specific time period. you can failed_login events: event_type=login,failed_login

Matlab Merge Array with Offset Values -

say have 2 arrays of double precision in matlab, how can merge them unknown offsets? for example: a = 1 1 2 2 3 3 4 4 5 5 b = 2 6 3 5 4 4 5 3 6 2 is there way create these 2 arrays single array 3 columns below when don't know offset/overlap between , b in terms of values in first column? c = 1 1 nan 2 2 6 3 3 5 4 4 4 5 5 3 6 nan 2 is there efficient way this? the solution i've come right piece first columns of , b, , proceed use loop iterate through. a combination of union unique elements ismember find corresponding locations trick. as note, allow a , b have number of columns 2 or greater. a = [1 1;2 2;3 3;4 4;5 5]; b = [2 6;3 5;4 4;5 3;6 2]; %get elements first columns of , b c = union(a(:,1), b(:, 1)); %prepopulate c correct size nan's c = [c, nan(size(c,1), size(a,2) + size(b,2) - 2)]; %find rows of c column 1 of ended [~, i] = ismember(a(:,1), c(:,1)); %stick rest of in rows in first set of free columns c(i, 2:size(a,2)) = a(:,2:end

c# - AES Key length not matching -

i'm sending encrypted data client through web service. the client had requested encrypt data using given key , iv. know should ideally use different random iv each time, , i've raised them. the iv have provided string of length 25. doesn't seem right me. as far aware iv length should match block size, either 128, 192 or 256 bytes (string lengths 16, 24 or 32). right, or missing here...? please note iv provided me, , therefore not trying pick it. the provided iv of form "ghpnhfg544judfjdr5bgvbj67", not believe correct. (the provided key string 16 characters long)

x86 - How do I use CMP in assembly to test a segment and offset address? -

i want leave loop if current address i'm looking @ at least 0xffff0. here portion of code wrote, not work: cmp ds:[bx], ffff0h jge leaveloop i'm new assembly , have not used cmp more simple number comparisons. this sounds xy problem, should have specified wanted achieve ultimately. anyway, ffff0h 20 bit address, can't compare directly if limited 16 bits. can use 2 16 bit registers calculate physical address, , 32 bit comparison using those. mov ax, ds mov dx, ds shl ax, 4 shr dx, 12 ; dx:ax has segment base add ax, bx ; add offset adc dx, 0 ; dx:ax has full address cmp dx, 0fh ; high word has @ least f jb false ja true ; if it's more ok cmp ax, fff0h ; low word has @ least fff0h jae true false: ... true: ...

javascript - Require and extend classes in Electron, how to? -

i have file global.js contains var global = (function () { function global() { this.greeting = 'test'; } global.prototype.getlist = function () { return "hello, " + this.greeting; }; return global; })(); and file 'main.js', contains var global= new global(); console.log(global.getlist); then require them in index.html ... <script> require('./npmmain.js'); require('./main.js'); </script> and global not defined how can make class available main.js? any ideas? edit: if console.log('test'); inside npmmain.js can see run, file getting required, class not available or welcome world of modules! first, inside of main.js file, add line @ top this: var global = require('./npmmain.js').global; then @ end of npmmain.js add line this: exports.global = global; then remove line index.html . should it. i guessing not familiar commonjs

g++ - Using "unsigned long long" as iteration-range in for-loop using OpenMP -

if works fine: #pragma omp parallel for (int = 1; <= 200; i++) { ... } this still works fine #pragma omp parallel for (unsigned long long = 1; <= 200; i++) { ... } but isnt working #pragma omp parallel for (unsigned long long = 1; <= llong_max; i++) { ... } -> compiler error: invalid controlling predicate llong_max coming from #include <limits.h> g++ --version -> g++ (tdm64-1) 5.1.0 it said openmp 3.0 can handle unsigned integer - types. i searched alot issue, without success. use int iteration-variable. knows solution? i changed program to: unsigned long long n = ullong_max; #pragma omp parallel for (unsigned long long = 1; < n; i++) { ... } it seems work now. thank jeff hint. i tried before with: for (auto = 1; < n; i++) { ... } -> no error, loop didnt produce output, strange.

python - heroku H14 error "No web processes running" for Django 1.82 -

hi i'm learning django through onemonth django. deploying web app heroku got error below. heroku[router]: at=error code=h14 desc="no web processes running" i tried fix heroku ps:scale web=1 resulted below. scaling dynos... failed ! no such process type web defined in procfile. could how fix this? use conda making virtual environment possibility of causing this? my procfile: web: gunicorn myapp.wsgi --log-file - git push heroku master was run. use osx yosemite/django 1.82. the project structure looks below. procfile requirements.txt core - views.py - __init__.py - admin.py - migrations - models.py - tests.py - urls.py - manage.py nomadscoffee - wsgi.py - __init__.py - settings.py - urls.py static - css - font-awesome - img - fonts - index.html - js - less - license - mail - readme.md templates - base - index.html log on heroku: -----> python app detected -----> installing runtime (python-2.7.10) -----> installing dependencies pip

vim - restore lost file from vim undo file -

i accidentally deleted .vimrc took me weeks config. still keep undofile , think that's way can restore it. unfortunately, vim not allow me undo (i guess because current vimrc version cannot "patched" last undo step). also, vim undo file encoded cant see content in human readable form. there step deleted vimrc ggvgc , if there way decode vimundo file, think can restore it. is there anyway can vimrc back? thank you. so, fdinoff suggested, patch here works me.

html - Issues with Fullscreen menu overlay over a fixed navigation -

i m having problem strange. here code pen created show talking about: http://codepen.io/buzzlightyear90/pen/nqyoyk?editors=110 here html <header> <div id="menu-button" role="button" title="sweet hamburger"> <div class="hamburger"> <div class="inner"></div> </div> </div> </header> <nav> <div id="box-container"> <div id="row1"> <div class="box" id="box1"> <p>about</p> </div> <div class="box" id="box2"> <p>work</p> </div> </div> <div id="row2"> <div class="box" id="box3"> <p>contact</p> </div> <div class="box" id="box4"> <p>blog</p> </div> </div

c++ - I am getting "Segmentation Fault" dereferencing certain indices. How to fix it? -

here code causing error: int *marks[4]; cout<<"\nplease enter marks of pf: "; cin>>*marks[0]; cout<<"\nplease enter marks of la: "; cin>>*marks[1]; cout<<"\nplease enter marks of cs: "; cin>>*marks[2]; cout<<"\nplease enter marks of phy: "; cin>>*marks[3]; cout<<"\nplease enter marks of prob: "; cin>>*marks[4]; i error after entering first 2 values marks[0] & marks[1]. if you're declaring int *marks[4]; that doesn't mean there's appropriate piece of memory allocated particular pointers in array. you have allocate memory, before write there using statement cin >> *marks[0]; allocate memory follows: for(size_t = 0; < 4; ++i) { marks[i] = new int(); } before calling cin << operation. , don't forget deallocate, after shouldn't used longer: for(size_t = 0; < 4; ++i) { delete ma

jquery - Accordion from template not working with AngularJS -

i'm new angularjs , i've been using in project has admin template i've downloaded. it's been working fine until added angularjs it. one of problems accordion on navbar no longer works. my accordion: <ul class="nav nav-pills nav-stacked main-menu"> <li class="accordion"> <a href="#"> <i class="fa fa-bullhorn"></i> <span> anouncements</span> <span class="accordion-arrow pull-right"> <i class='fa fa-chevron-right'></i> </span> </a> <ul class="nav nav-pills nav-stacked"> <li> <a href="#" data-toggle="tooltip" data-placement="right" title="browse announcements"> <i class="fa fa-angle-double-right"></i> browse

java - How to determine how to format an HTTP request to some server -

please bear me have been reading , trying understand http , different requests available in protocol there still few loose connections here , there. specifically, have been using apache's httpclient send requests, i'm unsure of few things. when make request uri, how can know before hand how format put request? might trying transmit data fill out form, or send image, etc. how know if server capable of receiving format of request? if try put without knowledge of server request "fail" (or not - depends on implementation e.g. can redirect main page). failure indicated server response code along headers. e.g. 405 method not allowed or 400 bad request etc. or redirect main page: 302 found you, client, must adapt server's api. moreover different requests same api may give different specs e.g. 1 response gzipped & etag & cached, other 1 not. or plain get / give html , get /?format=json give json.

c# - How to shrink image to disappear gradually in WPF DoubleAnimation -

so, i'm making application , want gradually (over course of few seconds) shrink image control until disappears. so, bound scaletransform doubleanimation, happens instantly. here code: doubleanimation anim = new doubleanimation(360, 0, (duration)timespan.fromseconds(1)); scaletransform st = new scaletransform(); st.scalex = 0; st.scaley = 0; pacscore.rendertransform = st; anim.completed += (s, _) => exit_pacs(); st.beginanimation(scaletransform.scaleyproperty, anim); this should trick: doubleanimation anim = new doubleanimation(1, 0,(duration)timespan.fromseconds(1)); scaletransform st = new scaletransform(); control.rendertransform = st; st.beginanimation(scaletransform.scalexproperty, anim); st.beginanimation(scaletransform.scaleyproperty, anim);

php - How to fix ? on the link instead of / -

i want link ' name ' other page ' /nameid '. for example: <a href='./2'>number 2</a> i have tried: @foreach($adverts $advert) {{link_to_route('adverts', $advert->name, array($advert->id))}} @endforeah it returns me: <a href="http://localhost:8000/?2"> , need <a href="http://localhost:8000/2"> . where wrong? more details: models/advert.php class advert extends eloquent { protected $table = 'adverts'; } routes.php route::get('/', array('as'=>'adverts', 'uses'=>'advertscontroller@index')); route::get('/{id}', array('as'=>'advert', 'uses'=>'advertscontroller@info')); controllers/advertscontroller.php public function index() { return view::make('adverts.index') ->with('adverts', advert::all()); } public function info($id) { return view

ember.js - Iterating Through a Tree of Ember-Data async Records -

i'm trying iterate through tree of ember-data async records. function crash of line 5 when children[i] has no children. how verify if children exist in children[i]? or provide better iterating function? traverse: function(scslink) { console.log(scslink.id); scslink.get('children').then(children => { for(var in children) { children[i].get('children').then(_children => { this.traverse(children[i]); }); } }); }, i able iterate through tree function: traverse: function(scslink) { console.log(scslink.id); this.get('scslinkarr').pushobject(scslink) scslink.get('children').then(children => { children.foreach((child,index) => { this.traverse(child); }); }); },

division - i386 Assembly floating exception on div instruction -

i have been playing assembly recently, , when trying use div instruction, coming across floating exception . have searched online past day or 2 , nothing working. saw this question , , because of answer, put in 3 xorq instructions 0 out registers (specifically rdx because high byte of dividend), still didn't help. when compiling c program modulus operation (and creates few variables compiler doesn't optimize away modulus) using gcc -s myprog.c , gcc creates assembly file has cltd (convert signed long signed long double) instruction right before idivl . tried in program well, change anything. have tried using different size values in rax ans rbx , still doesn't work. question: doing wrong, , weird quirks there using div instruction? this documentation have been using learning assembly. in code below, function print prints contents of rax . don't care gets printed, printed can see instruction crashes program. .cstring _format: .asciz "%d\n"

php - Method freezePane() for iPad not working -

i’m developing excel document freezepane. i’m using following code: $objxls->getactivesheet()->freezepane('x14'); although i’ve tried code too: $objxls->getactivesheet()->freezepanebycolumnandrow('x', 14); in both cases, when open created file excel version installed on mac computer (office 365 version. tried running pc under same version) works correctly. if try open created file same version of excel office 365 installed on ipad not work. the ipad version comes tool freeze panes , there can freeze panes way want , tool works correctly. need achieve have freeze pane tool automatically running on position programmed phpexcel when open ipad same way works on coputer versions. so tried few things: create excel document freezepane software installed on mac , not php. saved file , opened ipad , worked correctlty. another thing tried opening php created file excel installed on mac , without doing else saved once again software. when tried ope

linux - bash pactl suspend specific application -

i wrote following code suspend audio of specific application spotify > '/home/user/desktop/temp_spotify.txt' 2>&1 & # store terminal output text file while : # tail grabs updated last line in text file | awk searches specific word in text , signals exit tail tail -fn0 --pid=$(pidof awk) '/home/user/desktop/temp_spotify.txt' | awk '/spotify:ad/ { exit }' sleep 5 pactl suspend-sink 2 1 # supend audio applications grouped under sink 2 sleep 25 pactl suspend-sink 2 0 # resume audio applications grouped under sink 2 done however unable specify unique identifier pactl suspend spotify application. instead specified sink 2, encompasses many applications. how 1 suspend audio specific application? initial parameters in text file of application 01:06:27.735 [breakpad.cpp:110 ] registered breakpad product: spotify 01:06:27.738 [translate.cpp:152 ] reloading language file 01:06:27.749 [translate.cpp:152

Ruby hash exclude? -

i have check string in hash h = {'a'=>'firsthaha','b'=>'sjdh'} it's work: hash.select { |_,v| v.to_s.downcase.include? 'first' }.keys but how realize vice versa include? hash.select { |_,v| v.to_s.downcase.????? 'first' }.keys without using active-support exclude? hash.select { |_,v| !v.to_s.downcase.include? 'first' }.keys #or hash.reject { |_,v| v.to_s.downcase.include? 'first' }.keys

Ask too many Google Drive permissions when using https://www.googleapis.com/auth/drive -

my app required upload csv , convert google sheets. asking permission " https://www.googleapis.com/auth/drive " our user. of our users complain asking many permissions. there other settings can use avoid asking much? here permission list when user authorizes: upload, download, update, , delete files in google drive create, access, update, , delete native google documents in google drive manage files , documents in google drive (e.g., search, organize, , modify permissions , other metadata, such title) what scope or scopes app need? as general rule, choose restrictive scope possible, , avoid requesting scopes app not need. users more readily grant access limited, described scopes. conversely, users may hesitate grant broad access files unless trust app , understand why needs information. the scope https://www.googleapis.com/auth/drive.file strikes balance in practical way. presumably, users open or create file app trust, reasons understa

relationship - Yii2 relational data from 3rd level -

Image
a little bit connecting my previous question : i have following tables/models: i've managed join tables actionindex, implement same thing actionview, seems find() , findone() doesn't work same. joins don't work findmodel($id) i don't have clue, can please point me right direction? in fact need show related data of model in model bcd view, , i'm quite sure there simple way doing it, can't find anything, don't know for. becuse problem is, normal relationships can reach out table b, maximum 2 levels. i've tried create relationship reaches out 3rd level it's not working. thanks. you not have define multi levels relations. if have 1 record in bcd can access with $bcdmodel->bc->b->a->attribute of course use names of relations have defined. this work when showing info in table ... quite inefficient. every row show lot of queries should change query make more efficient. $query = bcd::find()->with(['bc', &

Add header html file with javascript -

thi javascript code show html file inside index.html <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script> $(function(){ $("#header").load("header.html"); $("#footer").load("footer.html"); }); </script> <div id="header"></div> <!--remaining section--> <div id="footer"></div> but how make when click example header show content of header.html or if click footer show footer.html <li><a href="header.html"><span>header</span></a></li> <li><a href="footer.html"><span>footer</span></a></li> here's example: html <ul id="nav"> <li> <a href="header.html" data-container="header"> <span>header</span> </a> </li> <

php - mysqli_connect() doesn't appear to be able to find the database -

ok here connection.php code: <?php $dbcon = mysqli_connect("localhost","root","aparadekto2059","spitiinc"); if (mysqli_connect_errno()) { echo "failed connect: " . mysqli_connect_error(); } ?> i have created database named " spitiinc " through phpmyadmin same error every time try connect it: failed connect: base(spitiinc) inconnue i guess have french version of program since means, base unknown pretty much. post 2 images of error screen , additionally of database existence. tried find answers in site 10 or saw, didn't have basic , that's troubles me. have made bare-bones basic thing, , doesn't work. appreciated , in advance here image: http://s12.postimg.org/w1bsinwwd/wtf.jpg

mysql - Getting output from a PHP shuffle and INSERT into new database table -

i have code below shuffles output of users in 'users' table. want able send shuffled results new db table in order shuffle sorted results. wanting each sorted result create new row in db. i'm not sure how can grab results of php shuffle , send it. added in new submit input, when results have been shown, user can submit results. results can not inserted during shuffling process, has after results have been outputted. how can results shuffle , insert them? want see how can current results. $con = mysqli_connect("localhost", "", "", "db"); $query = mysqli_query($con, "select * users `group` = 3"); echo 'normal results: <br>'; $array = array(); while ($row = mysqli_fetch_assoc($query)) { $array[] = $row; echo $row['firstname'] . ' ' . $row['lastname'] . '<br>'; } ?> <form method="post"> <input type="submit" value="shuf

javascript - Add a function to every element that gets clientX -

so i'm doing drag , drop thing. when user grabs element need add event listener dragenter every element. in listener function need , save clientx when mouse moves on element. issue i'm having gets mouse position of first element , keeps same 1 every other element. how can fix this? code: if(editor_children[i].nodetype != 3) { editor_children[i].addeventlistener("dragenter", function(event){ if(event.target.id !== e.target.id) event.target.classname= event.target.classname + " highlight"; position= event.clientx; last_over= event.target.id; console.log("mouse: " + e.clientx + " position: " + position + " last element: " + last_over); }) editor_children[i].addeventlistener("dragleave", function(event){ event.target.classname= event.target.classname.replace(' highlight', ''); }); } please no js li

c# - checking that a number is within range -

am trying make mastermind game using array of ints having user guess number sequence between 4-10 instead of colours. getavalidnumber suppose displays prompt user , number user in minimum/maximum range specified in parameters. if number entered outside minimum/maximum range, error message suppose displayed , user re-prompted number reason isn't validating properly. any guidance appreciated public static int getavalidnumber(string inputmessage) { // declare variables int validinteger; bool inputisvalid = false; int lowvalue = 1; int highvalue = 10; while (!int.tryparse(console.readline(), out validinteger)) { console.writeline("invalid entery - try again."); console.write(inputmessage, lowvalue, highvalue); { while (!int.tryparse(console.readline(), out validinteger)) { console.writeline("invalid en

css3 - CSS "fill-mode:forwards" not working in Safari -

for odd reason, -webkit-animation-fill-mode: forwards; not working in safari. i'm not sure why, because works in every other browser. here code: .fade { opacity: 0; -webkit-animation: fadein 2s; -moz-animation:fadein 2s; -ms-animation: fadein 2s; -webkit-animation-duration: 2s; -moz-animation-duration: 2s; -ms-animation-duration: 2s; -webkit-animation-delay: .9s; -moz-animation-delay: .9s; -ms-animation-delay: .9s; animation-fill-mode: forwards; -webkit-animation-fill-mode: forwards; -moz-animation-fill-mode: forwards; -ms-animation-fill-mode: forwards; } @keyframes fadein { { opacity: 0; } { opacity: 1; } } /* firefox < 16 */ @-moz-keyframes fadein { { opacity: 0; } { opacity: 1; } } /* safari, chrome , opera > 12.1 */ @-webkit-keyframes fadein { { opacity: 0; } { opacity: 1; } } /* internet explorer */ @-ms-keyframes fadei

php - Script Scope Access -

so, i've been working on small project, nothing extensive. i've been having trouble understand why function in anonymous object isn't accessible on main script. alright "initializer", or script loaded before crucial operations, instantiates anonymous object accessed across entire scope of project. <?php class t_empty { public function __call($method, $args) { if(isset($this->$method) && is_callable($this->$method)) { return call_user_func_array( $this->$method, $args ); } } } $scope = new t_empty; $scope->config = array( 'path' => $_server['document_root'], 'loct' => '*' ); set_include_path ( $scope->config['path'] ); $scope->controller = $scope->service = $scope->service->injector = new t_empty; // #

ruby on rails - Could not find the source association(s) :followed in model Relationship. -

i following michael hartl's rails book , getting following error message: activerecord::hasmanythroughsourceassociationnotfounderror: not find source association(s) :follower in model relationship. try 'has_many :following, :through => :active_relationships, :source => <name>'. 1 of ? when calling michael.follower (where michael user object). here associations: class user < activerecord::base has_many :active_relationships, class_name: "relationship", foreign_key: "follower_id", dependent: :destroy has_many :passive_relationships, class_name: "relationship", foreign_key: "followed_id", dependent: :destroy has_many :following, :through => :active_relationships, source: :follower has_many :followers, :through => :passive_relationships

Decimal Regex Constraint Matching (Four digits before optional decimal point and two after) -

i need figure out how make regex allow match correctly each time type number/decimal point. want limit number of digits before , after decimal point, isnt hard cant figure out how allow decimal point match well. 1 - match 12 - match 1234 - match 12345 - wrong 1234. - match 1234.1 - match 1234.12 - match 1234.123 - wrong other matched numbers 12.12 1.0 123.99 edit: so want max of 4 numbers before decimal place , 2 after. decimal place optional. the tricky part want fail if fifth character isn't decimal point. you need specify constraints better; i'm assuming want maximum of 4 before dot , 2 after: /^\d{1,4}(\.\d{0,2})?$/ edit: added beginning , end of string matchers. should work want now

How to make Git "forget" about a file that was tracked but is now in .gitignore? -

there file being tracked @ 1 time git , file on .gitignore list. however, file keeps showing in git status after it's edited. how force git forget it? .gitignore prevent untracked files being added (without add -f ) set of files tracked git, git continue track files being tracked. to stop tracking file need remove index. can achieved command. git rm --cached <file> the removal of file head revision happen on next commit.

how to add code component to android app at runtime -

let's app has 2 features - text messaging & video calling. published apk text messaging feature built , download button says "download video calling feature", on clicking button code video feature gets downloaded , installed changes current ui , displays new video calling feature. is runtime addition code possible or need build complete new apk both features , ask user update play store? wonder if can chrome extensions on android.

ios - Display random image with ImageView -

i able pull array of images parse.com after fiddling tutorials. from array want throw on image view via next random image swipe gesture: var query = pfquery(classname:"cats") query.findobjectsinbackgroundwithblock {(objects: [anyobject]?, error: nserror?) -> void in if error == nil { // find succeeded. object in objects! { // update - replaced as! self.imagefiles.append(object as! pfobject) println(self.imagefiles) self.view.addgesturerecognizer(rightswipe) } } else { // log details of failure println(error) } } } the println(self.imagefiles) shows array of files great, i'm having issues using random generator. still new syntax, trying imageview.image = imagefiles[0] or display 1 of images in array. not sure syntax though. i'm guessing once imageview.image = imagefiles[randomnumber] or equivalent. for swipe part think got u

cordova - Cannot load PouchDB in Adobe AIR -

i've gotten pouchdb working in chrome, firefox, , phone gap, can't seem load in adobe air sdk. i've tried versions 15 , 18 of adobe air sdk, versions 3.5 , 3.6 of pouchdb, , adl , adt, , doesn't seem instantiate database objects @ all, , doesn't connect cloudant. do need library? or not work in adobe air? here's code i'm using , alert creates. thanks! best, ben =============================== <!doctype html> <html class="ui-mobile"> <head><meta http-equiv="content-type" content="text/html; charset=utf-8"> <meta charset="utf-8"> <title>not working</title> <script src="cordova.js"></script> <script src="phoneincludes/jquery.js"></script> <script src="phoneincludes/es6-promise.min.js"></script> <script src="phoneincludes/es5-shim.min.js"></script> <script src="phonei

Python 3 - Can pickle handle byte objects larger than 4GB? -

based on comment , referenced documentation, pickle 4.0+ python 3.4+ should able pickle byte objects larger 4 gb. however, using python 3.4.3 or python 3.5.0b2 on mac os x 10.10.4, error when try pickle large byte array: >>> import pickle >>> x = bytearray(8 * 1000 * 1000 * 1000) >>> fp = open("x.dat", "wb") >>> pickle.dump(x, fp, protocol = 4) traceback (most recent call last): file "<stdin>", line 1, in <module> oserror: [errno 22] invalid argument is there bug in code or misunderstanding documentation? here simple workaround issue 24658 . use pickle.loads or pickle.dumps , break bytes object chunks of size 2**31 - 1 in or out of file. import pickle import os.path file_path = "pkl.pkl" n_bytes = 2**31 max_bytes = 2**31 - 1 data = bytearray(n_bytes) ## write bytes_out = pickle.dumps(data) open(file_path, 'wb') f_out: idx in range(0, n_bytes, max_bytes):

java - How to hide elements with in a JComboBox? -

say have jcombobox contains elements in vector... public class shade(){ //code creating panels etc , other components/containers jcheckbox primary = new jcheckbox("primary", false); vector<string> colours = new vector<string>(); } public shade(){ //settitle, look&feel, defaultcloseoperation, layouts etc etc... colours.add(0, "purple); colours.add(1, "red"); colours.add(2, "blue"); colours.add(3, "magenta"); jcombobox<string> colourselector = new jcombobox<string>(colours); } if jcheckbox primary selected want 'hide' colours purple , magneta jcombobox, once primary jcheckbox has been deselected reveal hidden elements, original list pertains. i tried doing this... public class eventhandler implements itemlistener(){ shade refobj; public eventhandler(shade rinsefm){ refobj = rinsefm; } #overriding abstract implemented method... public void itemstatec

dockerhub - How does mirror registry work in docker? -

i want deploy registry mirror in docker, , can avoid trip out internet refetch it. so, use command: docker pull ubuntu docker rmi ubuntu i guess there ubuntu image in local.so, closed internet, use command: docker pull ubuntu but,it didn't work. don't know happened. want know how mirror work. may need connect docker hub dependence? or may fail deploy mirror? by way, how know whether succeed in deploying mirror? you need make sure docker daemon started docker --registry-mirror=http://<my-docker-mirror-host> -d , or none of docker pull call go through mirror. and of course, make sure there 1 running mirror registry container ( docker ps -a ) the op v11 confirms in comments : i think fail start mirror. thanks! maybe don't started docker --registry-mirror=http:// -d the op did modify /var/lib/boot2docker/profile as advised here , might not have restart boot2docker before mirror tests.