Posts

Showing posts from September, 2013

windows - Python Qt Designer Button that creates subsequent text entries -

i'm trying make gui in qt designer has 1 text entry box , button off side inserts text entry box below first. potentially need dozen times or more. this example code qt designer: from pyside import qtcore, qtgui class ui_dialog(object): def setupui(self, dialog): dialog.setobjectname("dialog") dialog.resize(247, 300) self.pushbutton = qtgui.qpushbutton(dialog) self.pushbutton.setgeometry(qtcore.qrect(110, 10, 75, 23)) self.pushbutton.setobjectname("pushbutton") self.lineedit1 = qtgui.qlineedit(dialog) self.lineedit1.setgeometry(qtcore.qrect(20, 10, 31, 20)) self.lineedit1.setobjectname("lineedit1") self.lineedit2 = qtgui.qlineedit(dialog) self.lineedit2.setgeometry(qtcore.qrect(60, 10, 31, 20)) self.lineedit2.setobjectname("lineedit2") self.retranslateui(dialog) # qtcore.qobject.connect(self.pushbutton, qtcore.signal("cli...

objective c - UIImagePickerController to show only videos -

is possible have uiimagepickercontroller show videos on phone , not both videos , photos? thanks. set mediatype property of uiimagepickercontroller . //example documentation myimagepickercontroller.mediatypes = [[nsarray alloc] initwithobjects: (nsstring *) kuttypemovie, nil]; or simplify documentation's example newer syntax: myimagepickercontroller.mediatypes = @[kuttypemovie]; more information , guidance available in documentation .

libraries - Exposing a library via zeromq -

i wanting know best way expose library via zeromq. say, install machine learning library (mll) on 1 machine, , have zeromq broker running on another. now, if have zeromq client needs call functions within mll, how can via broker. i wanting know steps need take make work libraries in generic way. basically need have "listener" picks data zmq , feeds machine-learning backend code, transmits results requestor. there lot of design choices made, such format use serialize data between client , server (json? yaml? pickle? thrift? ...) , , how encode requests , request options. things considered, pretty straightforward zmq usage. the problem comes when want more feature-rich, complete, robust, etc. design--things multi-threaded or multi-process servers, multi-machine scalability, secure user / request authentication , authorization, job reporting , dashboard, or job checkpointing. "extras" common "network job scheduler" or "(enterprise) mes...

mysql - SQL Query involving aggregate functions -

i having issues writing query. dont know if should use count because returns actual count , want return people havent done review. anyway here query trying write. find users haven’t reviewed businesses. the tables using are reviews; +-------------+---------+------+-----+---------+-------+ | field | type | null | key | default | | +-------------+---------+------+-----+---------+-------+ | business_id | int(11) | no | pri | null | | | user_id | int(11) | no | pri | null | | | review_id | int(11) | no | pri | null | | | review_date | date | yes | | null | | | star_rating | int(1) | yes | | 1 | businesses +--------------+--------------+------+-----+---------+-------+ | field | type | null | key | default | | +--------------+--------------+------+-----+---------+-------+ | business_id | int(11) | no | pri | null | | | name | varchar(50) | yes | | null ...

ruby - Capybara no method error with sub class -

require 'rubygems' require 'capybara' require 'capybara/dsl' capybara.run_server = false capybara.current_driver = :selenium capybara.app_host = 'http://www.domain.com' module test include capybara::dsl class bot include capybara::dsl def login(username,password) #step 1 uri = "https://www.domain.com" visit(uri) # log in form find('#username').set(username) find('#password').set(password) find('#submitbutton').click end def goto_page2 #step 2 uri_cert = 'https://www.domain.com/page1' visit(uri_cert) find('#submitbutton').click end def form(answers) # step 3 formedit.q1(answers['q1']) end ##################################### # questions form class formedit include capybara::dsl #step 3 # true yes # false no def self.q1(ye...

Chrome: this extension loaded itself too frequently -

i’m building custom chrome extension. sporadically extension shows message. this extension loaded frequently what mean? maybe i’m exceeding threshold disables extension? you've called chrome.runtime.reload often. chrome considers reload "fast reload" when call chrome.runtime.reload within ten seconds after loading extension. when extension triggers more 5 "fast reloads", following warning shown in ui: this extension reloaded frequently.

PHP Insert data into mysql on duplicate key update - add suffix -

want insert duplicate entry mysql suffix. here example: +-------+--------------+-------+ | id | title | url | +-------+--------------+-------+ +-------+--------------+-------+ | 1 | test | test1 | +-------+--------------+-------+ | 2 | test | test2 | +-------+--------------+-------+ | 3 | test | test3 | +-------+--------------+-------+ means, want add auto number suffix end of each url have duplicate title. titles duplicated url kinda unique. here query: $i = 0; $i++; $sql = "insert `content` (title, text, cat, url, tag) values ('".$_post["title"]."', '".$_post["text"]."', '".$_post["category"]."', '".$_post["url"]."', '".$_post["tag"]."') on duplicate key update url=".$_post["url"]."+". $i .""; note: url made dynamically based on ti...

ios - UIPicker as input for UITextfield keyboard -

initially wanted implement picker upon selecting uitableviewcell or uilabel. the best approach 1. subclass uitextfield , set inputview picker. 2. make textfield becomefirstresponder in didselectrowatindexpath answer below the inputview attribute assign picker view textfield's first responder. won't display pickerview. therefore, warmuptextfield.inputview = picker should moved viewdidload() . what expect in didselectrowatindexpath set textfield first responder. code below function should work expect. override func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { if indexpath.section == 0 { nametexfield.becomefirstresponder() } else if indexpath.section == 1 { warmuptextfield.becomefirstresponder() } }

Pure CSS/HTML Dropdown With Anchors -

i want user able click on part of div, , div expand information. yet not want use php or javascript this. found interesting link: pure css collapse/expand div , , link: http://jsfiddle.net/ejx8z/ . want same thing (as jsfiddle). yet problem not seem work! my html: <a href="#hidemore" class="hidemore col-xs-12" id="hidemore">more</a> <a href="#showmore" class="showmore col-xs-12" id="showmore">less</a> <div class="col-xs-2 itemtoshow"> <img src="image.png" id="holderspecs"> </div> <div class="col-xs-2 itemtoshow"> <img src="image.png" id="holderspecs"> </div> <div class="col-xs-2 itemtoshow"> <img src="image.png" id="holderspecs"> </div> my css: .itemtoshow { display:none; height:auto; mar...

Slider in fullscreen columns bootstrap 3 -

good afternoon everyone. i using bootstrap 3 , facing problem not able deal more 1 week. have layout has 1 column menu , other 11 fullscreen slider. i've tried using various techniques nothing work. has me? i trying this, used other without success follow link example of layout , simple code. http://i.imgur.com/laewawz.jpg-http://www.bootply.com/gqxmfew4de -> sample layout sample code using thank all. few problems. first columns meant wrapped in .row, can add 'row' 'content-fluid' class that's parent div. secondly, you're using background images (by default, works normal img tags), no specific height on parent divs. (height: 100% isn't specific height) simple quick fix defining height .item class. http://www.bootply.com/7zjxwmetxq

php - How to configure rewrite rules for small api using nginx? -

i'm new nginx , have question in regards rewrite rules. i'm trying configure rewrite rules small api, there in way more suitable way of doing have come with? i have php running behind it, using kind mvc workflow controller, method , argument taken uri, first param represent api key. php concept: controller->method( arguments ) configuration: location /api/ { # passing api key rewrite ^/api/([0-9\-]+)/?$ /api/index.php?apikey=$1 last; # passing api key , controller rewrite ^/api/([0-9\-]+)/([0-9a-za-z\-]+)/?$ /api/index.php?apikey=$1&controller=$2 last; # passing api key, controller , method rewrite ^/api/([0-9\-]+)/([0-9a-za-z\-]+)/((select|insert|delete)+)/?$ /api/index.php?apikey=$1&controller=$2&method=$3 last; # passing api key, controller, method , arguments rewrite ^/api/([0-9\-]+)/([0-9a-za-z\-]+)/((select|insert|delete)+)/([0-9\-]+)/?$ /api/index.php?apikey=$1&controller=$2&method=$3&argument=$4 l...

c# - Is Linq data context automatically enlisted in TransactionScope Transaction? -

i have code this: using (datacontext dc = new datacontext(connstring)) { using (transactionscope t = new transactionscope()) { //make changes. //dc.submitchanges(); // t.complete(); // datacontext automatically enlisted in transaction scope?? } } is datacontext automatically enlisted in transaction scope??

ios - getting camera horizontal view angle in Swift -

i want hva , vva (horizontal view angle , vertical view angle) of camera of ios device. (using swift) how do this? in android can use following functions this: public double gethva() { return camera.getparameters().gethorizontalviewangle(); } public double getvva() { return camera.getparameters().getverticalviewangle(); } is there similar swift? it amazes me there's no solution this. have been able hva programmatically, seems there no way vva (if knows otherwise, please correct me). here how did it: let devices = avcapturedevice.devices() var capturedevice : avcapturedevice? device in devices { if (device.hasmediatype(avmediatypevideo)) { if(device.position == avcapturedeviceposition.back) { capturedevice = device as? avcapturedevice } } } if let retrieveddevice = capturedevice { println("hfov \(retrieveddevice.activeformat.videofieldofview)") } for more...

javascript - Can't get jQuery to execute code in the correct order -

i having ordering issues. have code following: on page load, loop through 3 tables , grab content server , populate table said content make table responsive i having issues making work. can achieve fine through inspect element (calling functions) that's not user friendly. want know if there's way can choose ordering on function being executed. have far is: $(document).ready(function() { if (datecounter == null){ //start calendar today's date var current = new date(); datechange(current, "", 0); //function 1 grab contents //make table responsive var switched = false; var updatetables = function() { if (($(window).width() < 992) && !switched ){ console.log("window width < 992px"); switched = true; $("table.responsive").each(function(i, element) { console.log("splitting table up...

java - Javadoc cannot find classes written in scala -

i working on project mixed java , scala code. using maven dependency management , intellij idea development. have added maven-javadoc plugin generating java documentation. however, cannot find scala classes. keeps on throwing errors follows: warning] javadoc warnings [warning] /users/mshinde/myproject-code/mlhighway/src/main/java/com/myproject/analytics/model/project.java:12: cannot find symbol [warning] symbol : class sparkjoiner [warning] location: package com.myproject.analytics.jobdriver [warning] import com.myproject.analytics.jobdriver.sparkjoiner; [warning] ^ [warning] /users/mshinde/myproject-code/mlhighway/src/main/java/com/myproject/analytics/model/dataset.java:12: cannot find symbol [warning] symbol : class transformer [warning] location: package com.myproject.analytics.jobdriver [warning] import com.myproject.analytics.jobdriver.transformer; [warning] ^ [warning] /users/mshinde/myproject-code/mlhighway/src/main/java/com/myproject/analytics/dataview/impalaview.java...

Subtract the aggregation of two sums in a view in Django -

im trying create profit field, im taking 2 aggregations of sums , subtracting them. unfortunately, can't seem way. there way of accomplishing this? i'd use model, im not calling in template def view(request): result_list = result.objects.order_by('-entryid')[:5] django.db.models import sum winnings = result.objects.all().aggregate(sum('winnings'), sum('entry')) >>>>>>>>> profit = winnings.winnings__sum - winnings.entry__sum <<<<<<<<<<< template = loader.get_template('result.html') context = requestcontext(request, { 'result_list': result_list, 'winnings': winnings, 'profit': profit, }) return httpresponse(template.render(context)) aggregate returns dictionary: profit = winnings["winnings__sum"] - winnings["entry__sum"] that's why winnings.winnings__sum works in te...

java - My conditional isn't working, i'm a beginner programmer -

double = 10;// 10 dollars spend double b = 0;// cost of food double c;// final total double d;// amount of sandwiches c = a-b; string order; scanner sc = new scanner(system.in); and here i'm trying objective number of sandwiches , multiply it; while number 2 or lower says 1 thing 3 or higher another. problem it's asking me initialize variable 0 d*0 still zero. system.out.println("that'll 1.06 how many like?"); b = 1.06*d; d = sc.nextdouble(); system.out.println(d <= 2 ?"ok! coming right sir!":"...ok.... thinks you're fatso now."); system.out.println("she hands "+(a-b)+" change"); break; the problem here: system.out.println("that'll 1.06 how many like?"); b = 1.06*d; d = sc.nextdouble(); you haven't initialized d , when multiplication multiplying nothing. need load scanner's value d before multiply b . system.out.println("that'll 1.06 how many like?"); d ...

OSX: which type of Daemon/Background Process should I use? -

i have program want run on startup , wakeup sleep. however, found resource on number of different kinds of services of use me. need answer on kind of daemon/background service suits purposes best. here outline of details program: 1) launch automatically, in background (aka without user being aware of it) when computer either woken sleep, restarted, or started shutdown-state. 2) program operate separately each user. files created result of program's operation need separate each user. i found resource @ https://developer.apple.com/library/mac/documentation/macosx/conceptual/bpsystemstartup/chapters/designingdaemons.html#//apple_ref/doc/uid/10000172i-sw4-bbcbhbfb unsure use: login item, xpc service, launch daemon, or launch agent. 2) program operate separately each user. files created result of program's operation need separate each user. this suggests using launchagent, since per-user (and run user). the page you'll want launchd.plist man page. ...

java - Regex to mask a PhoneNumber -

i need mask phonenumber result is (***)-(***)-xxxx xxxx being last 4 digits of number. right code string mask = phonenumber.replaceall("(?<=.).(?=[^-()]*?.-)", "*"); result (***)***x-xxxx. string mask1 = phonenumber.replaceall("(?:[^()-])", "*"); result (***)-***-**** i not able know mistake making. $string =~ s{([0-9]{3})([0-9]{3})([0-9]{4})}{($1)-($2)-$3}g; try replace.

javascript - How to Add Sitemap Automatically from Wordpress to Blogger -

how make sitemap / list ordered category http://goo.gl/xnfism (wordpress version) on blogspot? i want add sitemap automatically wordpress blogger. wordpress use php, blogger use html. they different feed formats. blogger doesn't allow such sitemaps. blogger creates sitemap in xml format automatically. following url have been added example. for blogspot blogs http://example.blogspot.com/sitemap.xml if have custom domain . http://www.example.com/sitemap.xml

start neo4j server in a specific folder? -

i coming mongodb world can start mongo server in specific folder : $ mongod --dbpath ./myfolder how do same thing neo4j ? in conf/neo4j-server.properties there's setting you're looking for: org.neo4j.server.database.location=data/graph.db

osx - Having problems with php artisan serve using laravel -

when try executing php artisan serve command in terminal on laravel 5.0 i'm getting error. failed listen on localhost:8000 (reason: php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known) i'm on mac using mamp, /etc/hosts file contains: 127.0.0.1 localhost 255.255.255.255 broadcasthost ::1 localhost fe80::1%lo0 localhost

php - Token Mismatch exception when ajax Delete request sent in Laravel 5 when I change project folder -

i used dropzone.js upload images. when want delete image, sent ajax delete request image controller. mydropzone.on("removedfile", function(file) { console.log(file.name); console.log(uploadedimages[file.name]); var csrf = $('input[name=_token]').val(); // var csrf = $('meta[name="_token"]').attr('content'); console.log(csrf); var request = $.ajax({ url: "/cms/image/"+uploadedimages[file.name], headers: { 'x-csrf-token': csrf , "accept": "application/json" }, type: "delete", data: { "id": uploadedimages[file.name] }, error: function(jqxhr, textstatus, errorthrown) { // alert('http error: '+errorthrown+' | error message: '+text...

PHP Form Not working - Solution Required -

i have 2 form on contact page 1 working , not working.. here code of 2nd form. on contact page have codes <form action="mailhandler1.php" id="contactform" method="post"> <div class="success"> contact form submitted!<br> <strong>we in touch soon.</strong> </div> <fieldset> <div class="wrapper"> <span>owners first & last name</span> <label class="name"> <span class="bg"><input type="text" id="ownername" class="input"></span> <span class="error">*this not...

c - Printing Integer array in reverse -

this simple problem print integer array in reverse order. although whenever try printing, ends displaying garbage value. below program. #include <stdio.h> #include <conio.h> int main() { int temp = { '\0' }; int num[9]; int i; int j = 8; printf("enter 8 numbers\n"); (i = 0; < 8; i++) { scanf_s("%d", &num[i], 1); } (i = 0; <= j; i++, j--) { temp = num[i]; num[i] = num[j]; num[j] = temp; } printf("\nthe numbers in reverse are\n"); (i = 0; <=8; i++) { printf("%d\n", num[i]); } _getch(); return 0; } let input numbers 1 8, print number in reverse first value prints garbage value. know can use , if statement counter situation there way counter problem without using if? there several logical inconsistences in program, you defined array having 9 elements int num[9]; but enter 8 elements ...

objective c - How to restrict recognition of particular target in each particular iOS device? -

we working in cloud recognition. in this, have restrict recognition of particular image target not more 2 recognitions in each device. we know, have use vws api that. our question how can restrict recognition of image target in particular device, has recognize in other devices not exceeding 2 recognitions. how can achieve this? i thought impossible, after updating vuforia 4, noticed in prefab scripts have function requirecomponent has lot of interesting applications deal with. vuforia uses make sure device has camera, can notice in prefab scripts can see requirecomponent(typeof(camera)) with respect problem requirecomponent(iphone) because while playing it, noticed option gave me brackets. check out , let know. haven't been able try out, can't confirm same.

mongoid - NoMethodError - undefined method `empty?' for #<ActionDispatch::Http::UploadedFile:0x007f985c1f4298> -

i have user model, have defined include mongoid::paperclip has_mongoid_attached_file :profile_pic in users controller apis have defined upload method def upload_profile_pic @user = user.where(uuid: params[:id]).first if @user.update_attributes(params[:profile_pic]) upload_status = {status: 'successfully uploaded'} else upload_status = {status: 'error'} end respond_with upload_status end when tried calling method using route, give me error i calling method using post method, using rest-client using ruby script require 'rest_client' jsondata = { profile_pic: file.new('test.png'), version: '1' } response = restclient.post("http://localhost:3000/api/v2/users/my_user_id/upload_profile_pic", jsondata) puts response nomethoderror - undefined method `empty?' #<actiondispatch::http::uploadedfile:0x007f985c1f4298> i have installed imagemagick in machine using apt-get ...

java - I have been working on this code and I called my method replaceLessThan(x,e), and I can't properly write this method -

public class arrayexamples { public static void main(string[] args) { int c = 3; int d =2; system.out.println("c " + c + " d " + d); swapints(3,2); int [] = {1,2,3}; int [] b = {2,2,3}; int [] x = {3,45,17,2,-1,44,9,23,67,2,-6,-23,-100,12,5,1212}; int e = 12; system.out.println(); ( int z: a){ system.out.print( z + " "); } system.out.println(); ( int y: b){ system.out.print( y + " "); } swapintarrays (a,b); system.out.println(); ( int z: x){ system.out.print( z + " "); } replacelessthan(x,e); } public static void replacelessthan(int[] x, int e) { system.out.println(); (int counter = 0 ; counter<x.length; counter++){ if ( x[counter] < e){ system.out.print (x[counter] + " "); ...

jquery - Target all Divs with Certain Style -

how can target divs in page have margin-left: -15px; margin-right: -15px; , assign margin: 0, without knowing name of class? i thinking div[style="margin-left: -15px;"][style="margin-right: -15px;"] doesn't work since styles not applied inline. the option iterate through elements, margin , compare values. var allelements = $("*"); for(var e=allelements.length-1; e>=0; e--){ var elem = allelements.eq(e); if(elem.css("margin-left") == "-15px"){ //do } }

python - Set Tkinter label texts as elements of list -

i building gui takes query user , runs lefunction.afunction(query) return list called result . when user presses enter, want text on each label set element of result . attempt, shown below, prints out last element of result on last label...(bear me, beginner tkinter.) thank you. import tkinter import os import lefunction class simpleapp_tk(tkinter.tk): def __init__(self,parent): tkinter.tk.__init__(self,parent) self.parent = parent self.initialize() def initialize(self): self.grid() self.entryvariable = tkinter.stringvar() self.entry = tkinter.entry(self,textvariable=self.entryvariable) self.entry.grid(column=0,row=0,sticky='ew') self.entry.bind("<return>", self.onpressenter) self.entryvariable.set(u"") j in range (1,10): self.labelvariable = tkinter.stringvar() label = tkinter.label(self,textvariable=self.labelvariable, ...

node.js - Heroku Node App Resources Not Loading -

Image
i have express node app runs fine locally, when deploy heroku files under /public , /bower_components not found. this post seemed have similar problem, solution did not work me. here relevant part of app.js: app.use(express.static(path.join(__dirname, 'public'))); app.use('/bower_components', express.static(__dirname + '/bower_components')); here package.json file: { "name": "myapp", "version": "0.0.0", "private": true, "scripts": { "start": "node ./bin/www", "postinstall": "bower install" }, "dependencies": { "express": "~4.9.0", "body-parser": "~1.8.1", "cookie-parser": "~1.3.3", "consolidate": "~0.10.0", "morgan": "~1.3.0", "serve-favicon": "~2.1.3", "debug...

datetime - Get Date difference and add to new date php -

i have 2 dates , want difference.i can strtotime this $ts1 = strtotime($date1); $ts2 = strtotime($date2); $seconds_diff = $ts2 - $ts1; i want add result today date.like if result 1 year , 20 days .my new date next year , 20 days.how can add result new date.thanks issue not difference how add new date. you must use date_diff , date_add function: $result = date_add(new datetime(), date_diff($ts2-$ts1))

regex - OCaml parse large text -

ocaml, how disassemble large multiline text data using page module. ignoring symbol of beginning of new line. let get_info content = let re = str.regexp "\\(.+?\\)" in match str.string_match re content 0 | true -> print_endline("-->"^(str.matched_group 1 content)^"<--") | false -> print_endline("not found");; this example returns first line, need text in multiple lines. according http://pleac.sourceforge.net/pleac_ocaml/patternmatching.html : str's regexps lack whitespace-matching pattern. so, here workaround suggested on page: #load "str.cma";; ... let whitespace_chars = string.concat "" (list.map (string.make 1) [ char.chr 9; (* ht *) char.chr 10; (* lf *) char.chr 11; (* vt *) char.chr 12; (* ff *) char.chr 13; (* cr *) char.chr 32; (* space *) ]) and then let re = str.regexp "\\((...

How we can get List of urls after crawling website from scrapy in costom python script? -

i working script need crawl websites, need crawl base_url site. has pretty idea how can launch scarpy in custom python scripts , urls link in list? you can add scrapy commands external library adding scrapy.commands section entry_points in setup.py. from setuptools import setup, find_packages setup(name='scrapy-mymodule', entry_points={ 'scrapy.commands': [ 'my_command=my_scrapy_module.commands:mycommand', ], }, ) http://doc.scrapy.org/en/latest/experimental/index.html?highlight=library#add-commands-using-external-libraries also see scrapy basic example .

Whenever I enter a value in rate column I want to multiply that value with quantity column and display result in amount column immediately in c# -

i want enter value in datagridview rate column @ run time , multiply value quantity column value , display result in amount column immediately public void calculategrid() { foreach (datagridviewrow row in datagvlist.rows) { double qty = convert.todouble(row.cells["quantity"].value); amt = (qty * (convert.todouble(row.cells["rate"].value))); row.cells["amount"].value = amt.tostring(); } } public void calamt() { (int x = 0; x < datagvlist.rows.count; x++) { tot_amt += convert.todouble(datagvlist.rows[x].cells["amount"].value); } txtboxtotal.text = tot_amt.tostring(); } when execute code error input string not in correct format. i called method in datagvlist_cellvaluechanged() event.

javascript - Need to inject model into services, Ember JS -

need help, i'm new ember , trying auth service working login/out in cli... can't seem able call of handy orm helpers without getting undefined error... i did working straight old jquery ajax, want working rest adapter. services/authentication.js import ember 'ember'; import ds 'ember-data'; import app '../app.js'; import user '../models/user.js'; import apikey '../models/api-key.js'; export default ember.object.extend({ //load current user if cookies exist , valid init: function() { this._super(); var accesstoken = ember.$.cookie('access_token'); var authuserid = ember.$.cookie('auth_user'); if (!ember.isempty(accesstoken) && !ember.isempty(authuserid)) { this.authenticate(accesstoken, authuserid); } }, //determine if user authenticated isauthenticated: function() { return !ember.isempty(this.get('apikey.accesstoken')) && !ember.isempty(this.get(...

javascript - Filtering on a page where line items are displayed as tiles -

i have requirement. in page user details displayed table , has filtering option, if user type character table filtered name filtered character typed. has redesigned display customers using tiles, each customer details displayed in rectangle details in it. far good. question is, can implement filtering function on tiles page, same way fileting has been done in table. there solutions available ?. any suggestions highly appreciated. yes pretty same way. it's different way presenting information. possible have filtered tiles pop @ top, or make ones not in query disappear. cant offer code this, i'm sure practically have it. possible link example or actual site?

c - Why am I getting a value of 0 for my min and max? -

#include <stdio.h> #include <stdlib.h> #include <time.h> /* initialize random generator */ #define buff_size 10 #define 5 five #define ten 10 #define 0 0 #define 1 one float min=0; float max=0; float average=0; float input_buffer[buff_size+2] = {0}; float output_buffer[five] = {0}; float local_buffer[ten]; int no_of_data_pts=0; int function_id=0; // function generating data size, function id , // data, , putting of input_buffer void generate_data() { /* initialize random seed: */ srand ( time(null) ); /* generate random number: */ input_buffer[0] = floor(1 + 10*(float)rand()/rand_max); input_buffer[1] = floor(1 + 4*(float)rand()/rand_max); int i; (i=0; < (int)input_buffer[0]; i++ ){ input_buffer[i+2]=(float)rand()/rand_max; } } // function copying content of input_buffer // local buffer (called here my_buffer) void reading() { no_of_data_pts= (int)input_buffer[0]; function_id= (int)input_buffer[1]; int i; ...

java - Should I start a new thread to get HTTP response on my server? -

i have glassfish server , expect rather loaded. example, have restful services , want make request google api in 1 of methods. should create new thread such work? no, should avoid managing threads manually inside java ee world. work should provided container (glassfish in case), http response. inside of ejbs prohibited: the enterprise bean must not attempt manage threads. enterprise bean must not attempt start, stop, suspend, or resume thread, or change thread’s priority or name. enterprise bean must not attempt manage thread groups. (ejb 3.1 spec, page 599) there exceptions may need manually in web application, in general should avoided. see also: thread creation in javaee ejb/web containers java ee specification , multi threading

websocket - WebRTC Serverless DataChannel -

it lot's of fun if possible make text chat, room/channel url, domain.com/myroom. awesome if p2p , encrypted. though - webrtc datachannels, yeay! it seem require server controls connections though, correct? there workarounds? backwards compability not concern here. wonder if problem multiple participant. webrtc seems 2 person thing. sorry if seems should google answer, i've tried. there info, i'm confused... lots of outdated info , misunderstandings. for initiate webrtc call, first client have send second 1 sdp (offer). includes mandatory informations communication ( https://webrtchacks.com/sdp-anatomy/ ). second client have same (sdp answer). moreover, have exchange ice candidates (ip address, port, , transport protocol). after that, clients should able communicate in p2p encrypted media (datachannel). but relaying info browser other, easiest way it, server. afaik, there isn't simple solutions browsers without server. note that, sometimes, p2p wont wo...

python - Resolving enum34 metaclass conflict? -

is there way custom metaclass play nice enum34 package (pre python 3)? import enum import 6 class mymeta(type): def __new__(cls, class_name, bases, class_dict): print("does useful.") return super(mymeta, cls).__new__(cls, class_name, bases, class_dict) @six.add_metaclass(mymeta) class myclass(object): def __init__(self, *args, **kwargs): pass myenum = enum.enum('myenum', [('one', 1), ('two', 2), ('three', 3)], type=myclass) the above raises error in enum34 @ enum_class = super(enummeta, metacls).__new__(metacls, cls, bases, classdict) : typeerror: metaclass conflict: metaclass of derived class must (non-strict) subclass of metaclasses of bases you should derive mymeta enum.enum 's metaclass: class mymeta(type(enum.enum)): ...

php - Set session value in foreach loop -

in project, working on @ moment. users can upload pictures in different parts of site. either upload pictures in post posted or upload pictures show off pet (which has profile page already). came images table, looks this: table `images` ( `image_id` int(11) unsigned not null auto_increment, `user_id` int(11) unsigned not null comment 'foreign key referencing user_id of user, uploaded images', `image_name` varchar(64) not null, `dog_pet_id` int(11) null comment 'foreign key referencing pet's, image belongs to', `post_id` int(11) null comment 'foreign key referencing post's, image belongs to', primary key (`image_id`), foreign key (`user_id`) references users(user_id) on delete cascade on update cascade ) engine=innodb default charset=utf8 collate=utf8_unicode_ci; if user user_id = 1, have pet dog_pet_id = 2 , upload picture pet output this: +------------------------------------------------------------+ | | image_id | user_id | image_name...

c# - Background Worker loading screen in Winforms -

i have form 1 can sign in , take while till data gets loaded form. wanted create seperate form (loadscreen.cs) progress bar when form loading. tried in loadscreen.cs form: private void form1_load(object sender, eventargs e) { worker = new backgroundworker(); worker.workerreportsprogress = true; worker.workersupportscancellation = true; worker.dowork += new doworkeventhandler(worker_dowork); worker.progresschanged += new progresschangedeventhandler(worker_progresschanged); worker.runworkercompleted += new runworkercompletedeventhandler(worker_runworkercompleted); } void worker_dowork(object sender, doworkeventargs e) { int percentfinished = (int)e.argument; while (!worker.cancellationpending && percentfinished < 100) { percentfinished++; worker.reportprogress(percentfinished); system.threading.thread.sleep(50); } e.result = percentfinished; } void worker_progresschanged(object sender, progresschangedeve...