Posts

Showing posts from March, 2013

multithreading - Use threads on a RESTful Web Service in Java -

everyone. have problem restful web service, have client in php call restful service in java. in restful service have post method, executes update query modify rows in table 10000 records . want use threads this. possible that?. please me i'm kind of new in java. thanks. ok i'm doing in service layer: for(int = 0; < 10; i++) { startrow = i*1000; finalrow = i*1000 + 1000; runnable process = new processrecords(startrow , finalrow); executor.execute(process); } // wait until threads finish while (!executor.isterminated()) { } system.out.println("\n threads finished"); and i'm calling class (processrecords) execute update: public processrecords (int start, int final) { startrow = start; finalrow = final; } @override public void run(){ try { consultuniversity consult = new consultuniversity (); consult.averangegrade(startrow, finalrow); } catch (exception ex) { logger.ge...

c# - text not wrapping in table cell using iText5 for .NET -

i have function generates text report. list of document text database , create pdf report. pdf report format should follows logo(top left).........some static text company (top right) [header information is...................................... .........................different each document in list] [.....................document text.............................] date(bottom left) page count(bottom right) the document text may run more 1 page , in case header information document repeats. and, if document text runs second page , terminates in mid page start next document on new page. here attempt: public static void printdocument(list<pdfdata> lst, ref memorystream memorystream) { itextsharp.text.font basefontbig = new itextsharp.text.font(itextsharp.text.font.fontfamily.helvetica, 12f, itextsharp.text.font.bold, itextsharp.text.basecolor.black); itextsharp.text.document document = new itextsharp.text.document(pagesize.letter, ...

python - What's the round robin schedulers used in practice -

as part of project, need work on round robin thread scheduler , should better practical , useful scheduler, not toy. find difficult find one. i know ghc has user-level threading support round-robin scheduler. i'm not haskell :( google told me both jvm , python vm use host os's scheduler, means technically don't support user-space threading. am right jvm , python here? guys have proposal such kind of scheduler?

oop - Perl how to create a two-way mapping with Moose object -

below object attributes forumid, title, childforum bless( { 'title' => 'usa', 'childforum' => [ bless( { 'forumid' => '163399', 'title' => 'washington' }, 'lib::main' ) ], 'forumid' => '162903', }, 'lib::main' ) now want convert above object other attribute names same values below ('forum_name' in place of 'title', 'forum_id' in place of 'forumid', 'child' in place of 'childforum'): bless( { 'forum_name' => 'usa', 'child...

symfony - HWIOAuthBundle get birthday, gender after Facebook Login -

as per documentation able configure , store facebook id fosuserbundle entity user i want store birthday , gender also. app/config/config.yml hwi_oauth: firewall_name: secured_area resource_owners: facebook: type: facebook client_id: <client_id> client_secret: <client_secret> scope: "email,user_birthday" in documentation there description here unable work. beginner here documentation isn't helpful me. where can facebook response contains local data. i need store data along other fosuserbundle fields. your config this: facebook: type: facebook client_id: %client_id% client_secret: %client_secret% scope: "email, basic_info, user_birthday" infos_url: "https://graph.facebook.com/me?fields=id,email,first_name,last_name,gender,birthday" then on accountconnector service / or how han...

Javascript in SVG -

i created svg file contains 5 polygons, need embed javascript 4 of polygons' color changes red when mouseover, , when mouseout, color changes green. tried write code didn't work, problem? , tips! <!doctype svg public "-//w3c//dtd svg 1.1//en" "http://www.w3.org/graphics/svg/1.1/dtd/svg11.dtd"> <svg width="26cm" height="24cm" viewbox="0 0 2600 2400" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink= "http://www.w3.org/1999/xlink"> <script type="text/javascript"> <![cdata[ document.getelementbyid("test").onmouseover = function(){changecolor()}; function changecolor() { document.getelementbyid("test").style.color = "red"; } document.getelementbyid("test").onmouseout = function(){changecolor()}; function changecolor() { document.getelementbyid("test").style.color = "green"; } ]]> ...

c# - Regular expression for replacing extra characters between markers -

suppose have sample text below: ;&nbsp; </span>&lt;year&gt;<o:p></o:p> </span>&lt;</span><span style=3d'font-size:9.0pt;mso-bidi-font-family:arial'>manufacturer&gt;</span><span style=3d'mso-bidi-font-family:arial'> </span>&lt;model&gt;<o:p> </span>&lt;<span class=3dspelle>serial_number</span>&gt;<o:p> </span>&lt;<span class=3dspelle>accessories_value</span>&gt;<o:p></o:p></span> </span>&lt;<span class=3dspelle>accessories_list</span>&gt; p;&nbsp; </span>&lt;<span class=3dspelle>worldwide_yn</span>&gt; </span>&lt;</b><span class=3dspelle><span style=3d'mso-no-proof:yes'>pet_name</span></span><span style=3d'mso- no-proof:yes'>&gt;</span><o:p></o:p>...

php - Using get_class in try - catch block -

questions is possible instantiate class get_class method in php? is possible use get_class catch() block catch exception type of error? my own try whenever using get_class , returns class name string. when tried instantiate this: $classwhereexceptionobjectisstored = new classwhereexceptionobjectisstored(); try { //some code } catch(get_class($classwhereexceptionobjectisstored->getexceptionobject $e)) { //do stuff exception } it didnt work. the class: class classwhereexceptionobjectisstored { public function getexceptionobject($message) { return new logicexception($message); //for example } } second try $class = get_class($classwhereexceptionobjectisstored->getexceptioninstance('hi!')); try { //some code } catch($class $e)) { //do stuff exception } get_class returns name of class, that's use of function. can instantiate class dynamically doing: new $class(); which in case have result in like: ...

MySQL and FOREIGN KEY. Disallow NULL on allowed NULL value column -

example of tables t1: __________ |id | val| |---+----| | 1 | | |---+----| | 2 | b | |---+----| | 3 | c | |---+----| t2: __________ |id | val| |---+----| | 1 | d | |---+----| | 2 | e | |---+----| | 3 | f | |---+----| t: ________________________________ |id | val| fk_t1_id | fk_t2_id | |---+----|----------+----------| | 1 | g | 1 | null | |---+----|----------+----------| | 2 | h | nul | 1 | |---+----|----------+----------| | 3 | | 3 | null | |---+----|----------+----------| both 'fk_t1_id' , 'fk_t2_id' foreign keys fileds , both null allowed. possible make additional constraint allows 1 fk on 1 field , null on another? (to impossible insert row both 'fk_t1_id' , 'fk_t2_id' null or both of not null) create check constraint on t table having condition: check( (fk_t1_id not null , fk_t2_id null) or (fk_t1_id null , fk_t2_id not null))

android - Sticky broadcasts rebroadcast -

i want change extras of sticky broadcast, call sendstickybroadcast same intent creates new sticky broadcast or replaces previous one? also, use sticky broadcast maintain state of property , share state whoever wants (services , activities), there better approach share state of property between android classes? does call sendstickybroadcast same intent creates new sticky broadcast or replaces previous one? it replaces current 1 in case intent filter equal previous 1 been broadcast i not use sticky broadcast because it been deprecated security reasons android 5 . also, experience - using sticky broadcast reason describes can cause easy tons of bugs , unexpected behaviors if not considering every case onreceive() can called... is there better approach share state of property between android classes? yes. there better ways save state across different application components, depends on specific use case: save state field (or object) within singleton c...

paypal - Will payments with intent Authorize be displayed in end users billing statement -

i using paypals restful api. when creating new payment object if set intent authorize , payment_method credit card able see pending authorization on credit card billing statement? or have collect payment before viewable on statements? we trying implement verification system make 2 trial authorizations on card can confirm cancel authorization. thanks. yes buyer should able see authorization on credit card statement . did testing transaction type authorization own card , able see authorization on card statement .

Animation not working in CSS -

i using codepen , 1 of elements fade in , out. can't find errors in code still not working. help! the item little logo box press open new window text. changes on mouseover make fade in , out people know need click it. thanks danko, got working now! can't believe issue simple haha :) .mainlink a:link, a:visited { display: block; background: url(http://i.imgur.com/e3eqrwv.jpg?2); background-size:cover; width: 50px; height: 50px; border-radius: 50%; position: relative; margin-left: auto; margin-right: auto; border: 2px solid black; animation: fadin 3s infinite alternate; -webkit-animation: fadin 3s infinite alternate; -moz-animation: fadin 3s infinite alternate; -o-animation: fadin 3s infinite alternate;} @keyframes fadin { 0% {opacity: 100%;} 50% {opacity: 50%;} 100% {opacity: 0%;}} @-webkit-keyframes fadin{ 0% {opacity: 100%;} 50% {opacity: 50%;} 100% {opacity: 0%;}} @-moz-keyframes fadin{ 0%...

c# - PropertyChangedEventHandler does not work -

i have following label , slider in usercontrol xaml <label x:name="labelvalx" content="{binding path=xvalue}" horizontalalignment="left" width="88" height="44"/> <slider x:name="sliderspeed" value="{binding slidevalue, mode=twoway}" horizontalalignment="left" margin="10,35,0,0" verticalalignment="top" width="173" height="53" minimum="10" maximum="100" /> and specific setgetaccvalues.cs class: public class setgetaccvalues : usercontrol, inotifypropertychanged { public event propertychangedeventhandler propertychanged; private string _xval; public string xvalue { { return _xval; } set { if (value != _xval) { _xval = value; onpropertychanged("xvalue"); } } } public byte _slidevalue; pub...

android - Where is the gsm command for emulating calls? -

the emulator guide says calls can emulated using gsm command ( http://developer.android.com/tools/devices/emulator.html ). but command unrecognized when try use it, presumably don't have path set it. it? couldn't find located. (also emulator guide says" "you can use gsm command access emulator's telephony functions after connecting console.' mean "connecting console"?) the connecting console section of same document states how use console: each running emulator instance provides console lets query , control emulated device environment. example, can use console manage port redirection, network characteristics, , telephony events while application running on emulator. access console , enter commands, use telnet connect console's port number. to connect console of running emulator instance @ time, use command: telnet localhost <console-port> where can port number using adb devices while emulator running. ...

ruby - Rails - Select, join, and order -

Image
i trying order assets appearing in descending order based off of number of users. code works in postgres, doesn't seem working in ruby. not sure wrong. appreciated. thank in advance. def order_assets @asset = asset.select("assets.id, count(assets_users.asset_id) the_count") .joins("left outer join assets_users on assets.id = assets_users.asset_id") .group("assets.id") .having("count(*) > 0") .order("the_count") end i want of yellow'd assets on top, when ones users filled in below. postgres code: select assets.id, count(assets_users.asset_id) the_count assets left outer join assets_users on assets.id = assets_users.asset_id group assets.id having count(*) > 0 order the_count; this how postgres comes out: ended moving on asset model. post code under answer's code, if needs/wants it. i first switched assets.id a...

c++ - Qt 5.2 cannot get qWait function to work -

i've got header file following include: #include <qttest/qttest> i trying use following line generate non-blocking wait in main window: qtest::qwait(1000 - ui->speeddial->value()); i receive following error: mainwindow.obj:-1: error: lnk2019: unresolved external symbol "__declspec(dllimport) void __cdecl qtest::qsleep(int)" (__imp_?qsleep@qtest@@yaxh@z) referenced in function "void __cdecl qtest::qwait(int)" (?qwait@qtest@@yaxh@z) can me understand doing wrong, or provide alternative method? these lines independent of other code. it works fine me. check example modified version of qt test official documentation example : tutorial1.pro: sources = testqstring.cpp config += qtestlib # install target.path = $$[qt_install_examples]/qtestlib/tutorial1 sources.files = $$sources *.pro sources.path = $$[qt_install_examples]/qtestlib/tutorial1 installs += target sources symbian { target.uid3 = 0xa000c60b include($$qt...

Codecademy help, Javascript -

despite best efforts, can't seem question correct , keep getting errors. seeing codecademy forums bit slow, figured post here. this question i'm working on: http://www.codecademy.com/courses/javascript-beginner-en-6lzgd/2/4?curriculum_id=506324b3a7dffd00020bf661 here code have input: // write function below. // don't forget call function! var sleepcheck = function(numhours) { if (sleepcheck >= 8); { return "you're getting plenty of sleep! maybe much!"; } else { return "get more shut eye!"; } }; console.log(sleepcheck(10)); console.log(sleepcheck(5)); console.log(sleepcheck(8)); thank answered input, issue has been taken care of. if (sleepcheck >= 8); { change to if (numhours >= 8) {

r - Error in eval(expr, envir, enclos) (from unknown!7788Kmk#8) -

error in eval(expr, envir, enclos) (from unknown!7788kmk#8) im getting error: error in eval(expr, envir, enclos) (from unknown!7788kmk#8) : object 'nickname' not found. code | | nickname | d7li | x | |----------------------------+----------+--------+-----| | dd\_ol\_dhofar132b111@5012 | ol1a | 24.2 | 48 | | dd\_ol\_dhofar132b111@5013 | ol1a | 22.5 | 91 | # dataset d7li.ol1a <- subset(tbl,subset=(nickname=="ol1a"))$d7li x.ol1a <- subset(tbl,subset=(nickname=="ol1a"))$x xlim <- c(0, 750) ylim <- c(-30, 30) legend <- c( "dhofar132" ) col <- c("red") pch <- c(16,17) par(mar=c(2,2,0,0)) plot(1,0,type="n",xlim=xlim,ylim=ylim,log="x") lines(d7li.ol1a , x.ol1a ,pch=pch[1],col=col[1]) legend("topleft",legend,pch=15,col=col) the column "nickname...

string - Reading in numbers and names using getline in C++? -

so i've been working on problem hours , help. have program due tomorrow. basically, have input file has first , last name , 4 float numbers following. looks this: john w. smith 78.8 56.5 34.5 23.3 jane doe 34.5 23.4 35.7 87.0 no more i need read first , last names array of pointers. far trying read in each line variable "name" , i'm outputting text file see if have been reading in data correctly. unfortunately, stops after reads in floats, doesn't read in next names. char *newptr; char *namelist[50] = {0}; char name[15]; int = 0; infile.getline(name, 15); while (strcmp (name, "no") != 0) { newptr = new char[15]; strcpy(newptr, name); namelist[i] = newptr; infile.getline(name, 15); outfile << name << endl; i++; } so far, output has been: john w. smith 78.8 56.5 34.5 23.3 edit: loop infinite, output, know haven't processed second names yet, stop @ first numbers. if help, g...

cookies - IIS 7.5 + PHP + httpOnlyCookies + requireSSL -

how enable httponlycookies , requiressl cookie in iis 7.5 ? i have tried adding <httpcookies httponlycookies="true" requiressl="true" /> within the <system.webserver> but show 500 internal error. edit php.ini , find line: session.cookie_httponly = set value true (e.g. 1 have had issues true reason) , restart iis once you're done editing php.ini.

factory bot - Rails Engines: How to write tests that depend upon main app models? -

the rails engines documentation quite understanding how write engines. however, left me question i've been unable answer. say i'm writing engine discussed in documentation (a blog). post model doesn't need know author, , engine doesn't need deal accounts in way, makes sense posts have author, make class author configurable , post model belongs_to it. engine make use of whatever account scheme in use in main application. how write tests post model if engine doesn't contain model author? i'm using factorygirl , tried putting factory user, doesn't work without corresponding table. suppose create basic author class within generated test/dummy application, tests have put in there well, feels little nasty me (i want tests in obvious place, guess). the answer quite simple: use test/dummy application. generate author class within test/dummy , write factory in test/factories , use else. don't have write tests within dummy application. m...

ios - Xcode creates wrong IPA folder structure -

we have ' payload ' folder root once unarchive ipa files. however, xcode has started creating ipas ' applications ' folder root. hence mdm failing locate files. has has faced similar issue? running xcode version 6.1. make sure key "lsrequiresiphoneos" in info.plist has value "yes", , make sure key has correct case, i.e., iphone versus iphone. earlier versions of xcode not picky that.

javascript - Show live data in browser without refresh -

i have looked around web including stack overflow's 'question , answer' history, can't find related answer mine; maybe because don't understand posts published in english beginner in programming, need explanation , think should clear , easy understand. my question is, there easy way make php , javascript answer question: i have 2 computers online, 1 computer opens 'my website' there scrolling news @ top of website. other computer in hand, here inside admin area. now, add new data in 'news table db' in admin area, type it, , push click. then @ other computer, want new data there without touching part of keyboard. that's all, simple question maybe. it's easy facebook's developers, not me. need detailed explanation know this. know little of pdo, less js. method 1: create log table records inserted, have javascript make requests script implements long polling: $time=(isset($_get['timestamp']) ? $_get['time...

node.js - Https two-way authentication with server using a public signed cert, but client using a private CA -

i'm node-js guy think certificate/ca only. i want set https server using certificate signed public ca, browsers can visit website without certificate error. @ same time, want server provide two-way https authentication, server can recognize clients if clients using certificate. client certificate signed ca created myself. when let client connect server, gets error called error: cert_untrusted . have set "ca" & "agent" option both server , client, can't figure out mistake. i have installed self-signed ca in windows 8 root certificates, altough don't think it's needed. my code: server var options = { key:keyforcertificate, cert:certfrompublicca, ca:[publicca, self-signedca], requestcert: true, rejectunauthorized: false }; var server = require('https').server(options, require('express')()); server.listen(443); client require('https').request({ host: "www.publicwebsite.com" ...

fortran pointer array to multiple targets -

is there way have in fortran pointer array pointing different targets? the following code shows trying do, not work want since second association overwrites first implicit none integer, parameter :: n = 3 integer, target :: a(n), b(n) integer, pointer :: c(:) => null() = 4 b = 5 c(1:n) => a(1:n) c(n+1:2*n) => b(1:n) c(1:2*n) = 1 print*, print*, b output (ifort) 4 1 1 1 1 1 output (gfortran) 4 4 4 1 1 1 and, idea why ifort , gfortran behaves different in case? no, there no simple way this, @ least far can see. maybe if why trying might come suitable answer, instance in mind derived types and/or array constructors might way go without context difficult say. as why different answers accessed array out of bounds can happen: ian@ian-pc:~/test/stack$ cat point.f90 program point implicit none integer, parameter :: n = 3 integer, targ...

ios - Resizing and re-positioning UILabel inside custom UICollectionViewCell -

i'm trying reposition uilabel inside custom uicollectionviewcell nib. problem iss , @ start, first item's subviews looks should (positioned code), , other items subviews positioned nib. if scroll , forth few times, loads other items ok well. i tried , without autolayout stated in answers here , tried setting / removing constrains told here loosing mind, great! in feedcell did this: -(void)layoutsubviews{ [super layoutsubviews]; [self sortviews]; } - (void) sortviews{ [_fromlable sizetofit]; [_tolable sizetofit]; [_fromyearlabel sizetofit]; [_dashlabel sizetofit]; [_dashlabel centerhorizontalinparent]; // rotate year labels [_fromyearlabel settransform:cgaffinetransformmakerotation(m_pi / 2)]; [_tolable setx:[_dashlabel x] + [_dashlabel width] + 15 ]; [_fromyearlabel setx:[_dashlabel x] - [_fromyearlabel width] - 15 ]; } i tried calling [cell setneedsdisplay] in cellf...

Char 'apex' C++ -

i building simple program use dynamic array in c++, program read file , after find word , when find change lower case upper case. find word control if after , before there 1 space or punctuation char. when control if there ' (apex) have problem: s[i+j-1] == ''' this because second close first, , third open char. it run if use ascii code: s[i+j-1] == 39 . how can write program without using ascii code? ' needs escaped in character literal: s[i+j-1] == '\''

cocoa - NSOperation wait until asynchronous block executes -

i need put asynchronous operations operation queue, however, need execute on after other self.operationqueue = [nsoperationqueue new]; self.operationqueue.maxconcurrentoperationcount = 1; [self.operationqueue addoperationwithblock:^{ // asynchronous [peripheral1 connectwithcompletion:^(nserror *error) { }]; }]; [self.operationqueue addoperationwithblock:^{ // asynchronous [peripheral2 connectwithcompletion:^(nserror *error) { }]; }]; the problem is, since peripheraln connectwithcompletion asynchronous, operation in queue ended , next executed, need simulate, peripheraln connectwithcompletion synchronous , wait end of operation, till asynchronous block executes so need behaviour this, using operation queue [peripheral1 connectwithcompletion:^(nserror *error) { [peripheral2 connectwithcompletion:^(nserror *error) { }]; }]; nsblockoperation can't handle asynchronous operations, it's not hard c...

java - why does my numbers no show up when I run my codes -

you’re going automate famous song “99 bottles of xxx on wall”. print lyrics of 99 verses of song. use loop! if don’t know lyrics, them google. the program should: ask user age if user 21 or older, ask them if prefer beer or soda a. if under 21 or prefer soda, lyrics “99 bottles of soda on wall” b. if on 21, “99 bottles of beer” you must use while loop , counter variable must part of print statement! so first verse be: 99 bottles of soda on wall 99 bottles of soda if 1 of bottles should fall off wall …..98 bottles of soda on wall the last verse: 1 bottle of soda on wall 1 bottle of soda if lone bottle of soda should fall off wall no bottles of soda on wall! so think, need add loop print last verse different lyrics? // here code. when run number of bottles start 12, not 99 how fix this?? scanner user = new scanner(system.in); int age, beverage; system.out.println("please type in age"); age = user.nextin...

python - pip error "ValueError: ('Missing distribution spec', '==')" when installing pandas on ubuntu server -

hi started playing servers , supposed run simple script in python. script however, has dependencies, ie packages, pandas. so decided pip install pandas == 0.14.0 kept getting error message: exception: traceback (most recent call last): file "/root/.virtualenvs/occupy/local/lib/python2.7/site-packages/pip/basecomm status = self.run(options, args) file "/root/.virtualenvs/occupy/local/lib/python2.7/site-packages/pip/commands installrequirement.from_line(name, none)) file "/root/.virtualenvs/occupy/local/lib/python2.7/site-packages/pip/req.py", return cls(req, comes_from, url=url, prereleases=prereleases) file "/root/.virtualenvs/occupy/local/lib/python2.7/site-packages/pip/req.py", req = pkg_resources.requirement.parse(req) file "/root/.virtualenvs/occupy/local/lib/python2.7/site-packages/pip/_vendor/ reqs = list(parse_requirements(s)) file "/root/.virtualenvs/occupy/local/lib/python2.7/site-packages/pip/_ve...

rails, jquery, javascript, jqvmap can't load multiple countries -

i trying implement jqvmap , have multiple regions selected , colored. how pass variable rails javascript 'selectedregions' variable work? i've tried endlessly can't seem make js read variable correctly. js code: <script type="text/javascript"> jquery(document).ready(function() { var areas1=['ca','us']; jquery('#vmap').vectormap({ map: 'world_en', selectedcolor: '#ffc864', selectedregions: areas1 }); }); </script> the selectedregions variable needs take in format: ['ca', 'us'], when pass in format rails helper method, not work. js experts out there thoughts appreciated! assuming controller looks this: def show # set instance variable in controller @areas1 = [ 'ca', 'us' ] # render code.... end in view selectedregions (assuming it's in erb page) be <script type="text/javascript"> j...

ruby on rails 3 - Activerecord adds additional conditions in query -

for example doing this: platforminformer.where(1) and result query via platforminformer.where(1).to_sql is select `platform_informers`.* `platform_informers` `platform_informers`.`platform` = 'android' , `platform_informers`.`email` = 'voldemar@klops.ru' , (1) i didn't ask add email , platform fields in clause! this problem causes when executing code inside platforinformer model methods. default scope doesn't set. root of evil? rails 3.2.13 update : class platforminformer < activerecord::base include hasuniquegenerator attr_accessible :email, :platform,:secret_code,:activated,:invitation_sent before_create :init_secret_code platforms = %w(windows macos android ios) def self.platforms platforms end validates :platform, :presence => true,:inclusion => { :in =>platforms } validates :email, :presence => true, :email => true validates_uniqueness_of :email, scope: :platform scope :confirmed, pro...

python - Install dependencies from setup.py -

i wonder if .deb packages example, possible in setup.py configure dependencies package, , run: $ sudo python setup.py install they installed automatically. researched internet found out leaving me confused, things "requires", "install_requires" , "requirements.txt"

html - .toggle jQuery issue, while switching the library Version of jQuery -

this code working fine when use : <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script> $(document).ready(function(){ $('.mailing-form').toggle( function(){ $('#mailing-list-box').animate({ right: "0", }, 500); }, function(){ $('#mailing-list-box').animate({ right: "-256" }, 500); }); }); but when chose switch version of jquery : <script src="http://code.jquery.com/jquery-1.11.0.min.js"></script> toggle stops working. then tried wrap toggle inside click event, mailing-list-box div keeps coming , forth multiple times. ('.menu-btn').click(function(e) { $('.menu-btn').toggle( function(){ $('.timeline-box2').animate({ left: "0", }, 500); }, function(){ $('.timeline-box2').animate({ left: ...

php - convert coordinates to json for upload to database -

i trying convert user's location json before can insert mysql database php, can help? new @ this, code below: project detail: trying create code will: on first launch create user id collect location of device convert user id , longitude/latitude json print json in label "label1" then send json mysql database right now, no coordinates or user id appearing on label, help? this viewcontroller.m #import "viewcontroller.h" @interface viewcontroller () { cllocationmanager *locationmanager; } @end @implementation viewcontroller - (void)viewdidload { [super viewdidload]; self.mapview.delegate = self; locationmanager = [[cllocationmanager alloc] init]; [locationmanager setdelegate:self]; [locationmanager setdistancefilter:kcldistancefilternone]; [locationmanager setdesiredaccuracy:kcllocationaccuracybest]; [locationmanager startupdatinglocation]; nslog(@" lat: %f",locationmanager.location.coordinate.latitude); nslog(@" lon: %f...

LightStreamer data adapter best practice -

we chose lightstreamer our push server , must write data adapter it. our technology stack java based (activemq, java, spring). use node.js our data adapter of these technologies (java or node.js) best practice based on our technology stack? if technology stack based on java, should stick java lightstreamer adapter too. way, have java everywhere , complexity reduced. node adapters make sense when have business/data logic in node server , want connect lightstreamer server easily.

delphi - How to modify the default text settings style in Rad Studio -

i'm developing , aplication delphi xe7, , need modify components (labels, buttons, memos) text family font determined value , bold. know how 1 per one, have many components. it's possible modify default rad studio text setting once, , applied project?

javascript - Bootstrap video tabs, load videos only when click tab -

i using bootstrap , have section on website using nav-tabs bootstrap, problem tabs contain videos. , have total of 14 video tabs. working, problem i'm dealing slow loading of website, , think might caused loading videos (even videos in hidden tab). how possibly tell browser load video when tab .active ? my html (i display 3 tabs here, there total of 14): <ul class="nav nav-tabs" id="videos"> <li class="active"><a data-toggle="tab" href="#one">1 &nbsp;<span class="glyphicon glyphicon-ok" style="color:green;"></span></a> </li> <li><a data-toggle="tab" href="#two">2 &nbsp;<span class="glyphicon glyphicon-ok" style="color:green;"></span></a> </li> <li><a data-toggle="tab" href="#three">3 &nbsp;<span class...

kindly explain me about 'interactive_timeout' variable in MySQL? -

if connection last longer 'interactive_timeout' limit value, connection dropped automatically. connections drop. mean sleep connections or active connections well? wait_timeout variable ... ?? please explain. interactive_timeout - number of seconds server waits activity on interactive connection before closing it. wait_timeout - number of seconds server waits activity on noninteractive connection before closing it. timeout applies tcp/ip , unix socket file connections, not connections made using named pipes, or shared memory. on thread startup, session wait_timeout value initialized global wait_timeout value or global interactive_timeout value, depending on type of client (as defined client_interactive connect option mysql_real_connect()). sleep connections , waiting connections dropped. for differences refer here.

c++ - Static object in struct -

this question has answer here: what undefined reference/unresolved external symbol error , how fix it? 27 answers i have class a method display() . create struct b static variable of type object a : class a{ public : void display() { cout << "in " << endl; } }; typedef struct b{ static a; } bb; //b::a.display(); int main() { bb b; bb::a.display(); return 0; } now error when try access a . how can define static object in case? you declared static a; did not define it. add following line before int main() , it'll link successfully: a b::a;

C++ deleting pointers from vector causes heap error -

i have vector of pointers objects of base class , store objects derived class in it. way add pointers quite obvious std::vector<element*> mvgates; ... mvgates.push_back(new node(x, y)); and when program closed pointers freed in 'for' loop (int i=0; i<mvgates.size(); ++i) { delete mvgates[i]; } at line debugger (i'm using qt creator) showing few lines that: heap block @ 14e50f50 modified @ 14e50f84 past requested size of 2c invalid address specified rtlfreeheap( 00030000, 14e50f58 ) what can cause, doing wrong? know haven't showed full code, since it's quite long, maybe enough tell me mistake. recommend me using smart pointers. think doesn't answer question - can wrong code. edit: simple mistake, couldn't have noticed here. in node class i've declared some_type array[0]; and i've been using 2 elements array. don't know why didn't cause sigsegv thing caused heap error. your std::vector contains poin...

javascript - AngularJS Access $scope in function -

i execute following function when page executed: $scope.displaytags = function(id) { $scope.toogleselectionblocs = function selectionb(b) { // have checkbox check... } $scope.showhello() { console.log("hello world!"); } } then have other checkbox: (same controller other function) $scope.checkclick = function(){ if($scope.mycheckbox == true){ $scope.showhello(); } } i have following error: typeerror: undefined not function @ scope.$scope.checkclick (....) how can fix it? thanks help! you have mistake in function thats should be: $scope.showhello = function() { console.log("hello world!"); } and thing why write function inside function, should move $scope.showhello outside of $scope.displaytags

javascript - MongoDB: query Array for 'true' value at index n -

so have collection containing field "weekdays" representing weekdays monday-sunday (checked or not checked): var collection = [ // work week (monday friday) { weekdays: [true, true, true, true, true, false, false] }, // weekend { weekdays: [false, false, false, false, false, true, true] }, // ... ]; now, how can query collection find items has true specified weekday? my first attempt use this: // $elemmatch... 'weekdays[0]': true // monday but did not seem work. i'm out of ideas atm , appreciate help! you can use code db.collectin.find({'weekdays.0' : true}) and if want check 2 days: db.collectin.find({$and : [ {'weekdays.0' : true}, {'weekdays.1' : true} ] })

How do you select 2 rows from the same table in MySQL, with different conditions for each? -

i have table using referrals. table has 3 columns: id, friendcode, , referred . want select referred row id = currentuser id row friendcode = refereefriendcode , i want one query . id | referred | friendcod 1 | 1 | 100 2 | 0 | 200 i want select 1 referred column , 2 id column, , have id of 1(current user) , friendcode 200. how go this? thanks in advance! is: select id tablename id=1 union select id tablename friendcode=100 what want?

xcode - custom title bar for NSWindow -

i have been trying create custom title bar nswindow, following of creating custom title bar on standard nswindow . nsview *themeframe = [[window contentview] superview]; nsview *firstsubview = [[themeframe subviews] objectatindex:0]; [titlebarview setautoresizingmask:(nsviewminymargin | nsviewwidthsizable)]; [themeframe addsubview:titlebarview positioned:nswindowbelow relativeto:firstsubview]; it works osx 10.9, in osx 10.10, xcode posts waring: nswindow warning: adding unknown subview:xxx 0 appkit 0x00007fff88f80b3c -[nsthemeframe addsubview:] + 107 1 appkit 0x00007fff8896fb8f -[nsview addsubview:positioned:relativeto:] + 208 the app can run , show customised title, , warning shows in xcode console. osx 10.10 make changes here? , new methods add custom title bar? yes, os x yosemite uses new nstitlebaraccessoryviewcontroller api adding custom subviews titlebar: nswindow has never supported clients a...

php - What's the difference between term_id, term_taxonomy_id and cat_ID? -

i'm working on plugin , there need cat_id . used function, get_the_terms( $id,'category' ); , getting array this: array ( [10] => stdclass object ( [term_id] => 10 [name] => personal [slug] => personal [term_group] => 0 [term_taxonomy_id] => 10 [taxonomy] => category [description] => [parent] => 0 [count] => 3 [object_id] => 1 [filter] => raw ) ) there should cat_id can't find any. it seems term_taxonomy_id , term_id showing i'd expect see in cat_id , somehow came know term_id different term_taxonomy_id . for example, if delete category , create another, term_id not equal cat_id , it? is safe use term_taxonomy_id cat_id ? what's difference between them all? term_id , cat_id have same value. aren't seeing category specific properties...

javascript - Cannot detect json_encode result from mysql in ajax success -

i trying json response in success ajax mysql. error getting in console -> uncaught syntaxerror: unexpected token < my ajax code. function getmessage(siteid) { document.getelementbyid("add").disabled = true; $.ajax({ type: "post", url: "checksite.php", data: { siteid : siteid }, //6 digit number success: function(data) { alert(data); var obj = jquery.parsejson(data); if(objdata.status == "not available"){ alert("not available"); document.getelementbyid("add").disabled = false; } if(objdata.status == "available"){ alert("available"); document.getelementbyid("add").disabled = false; } }, error: function(result){ alert("error"); } }); ...

c# - Select cells (buttons) on diagonals of a square matrix -

Image
i'm writing wpf music pad application, have 16 button (here example of real music pad https://www.youtube.com/watch?v=3vc5tssynju ). each button plays different music sample. works well. when user in idle, want create simple animation shown in image below. animation starts button 1 (animates it's background color white, goes original color). here steps of animation: step 1: animate buttons: 1 step 2: animate buttons: 2, q step 3: animate buttons: 3, w, step 4: animate buttons: 4, e, s, z step 5: animate buttons: r, d, x step 6: animate buttons: f, c step 7: animate buttons: v i created function animatepad takes button , starts background color animation after specified time. function works expected. to implement steps described above, i'm calling animatepad function each button. here code i'm using , want improve. have hard coded steps. if buttons count changes, must go , change code, bad idea. double beginms = 0; var spd ...