Posts

Showing posts from April, 2012

c - Error compiling with GLib -

i'm pretty new c programming, , trying work through exercises in '21st century c' second edition. i'm stuck on page 202, example 9-7, unicode.c. example starts with: #include <glib.h> #include <locale.h> //setlocale #include "string_utilities.h" #include "stopif.h" //frees instring you--we can't use else. char *localstring_to_utf8(char *instring){ gerror *e=null; setlocale(lc_all, ""); //get os's locale. char *out = g_locale_to_utf8(instring, -1, null, null, &e); free(instring); //done original stopif(!out, return null, "trouble converting locale utf-8."); stopif(!g_utf8_validate(out, -1, null), free(out); return null, "trouble: couldn't convert file valid utf-8 string."); return out; } when try compile with: c99 -i/usr/include/glib-2.0 -i/usr/lib/x86_64-linux-gnu/glib-2.0/include -g -wall -o3 -lglib-2.0 unicode.c string_utilities.o -o unico

mysql - In what format should I store data of a large php form with few dynamic fields -

i have large php form dynamic fields , there can additional fields added after releasing production. how store large data mysql database using php can handle dynamic fields , additional fields. example of form can seen in link below. http://form.jotform.me/form/50655815937465 the above link doesn't contain dynamic fields may contain later. the main form huge divided different sections. need handle well. need save draft concept user can save data , load later when gets chance complete it. there's lot of different ways handle this, i'll make simple recommendation for static fields create column in table each static field save each static field submission in corresponding column for dynamic fields create array of dynamic values , call serialize on it store serialized value in single long text column in database to read values, have call unserialize on it pros easy implement ability filter data based on static inputs only uses 1 colu

debugging - C++ Function not working as expected -

so know broad topic, i'm not sure how describe , i'm not sure bug is. i'm making game in console window, roguelike-rpg, (i haven't done random dungeon yet, i've done in other languages.) , i'm having problems dealing walls. i have function called placemeeting(real x, real y) use check collisions, appears returning bad values , couldn't tell why. have couple of macros defined: #define , && , #define real double . here function: bool globalclass::placemeeting(real x, real y) { //the return value -- false until proven otherwise bool collision = false; //loop through walls check collision for(int = 0; < wallcount; i++) { //if there collision, 'say' if (x == wallx[ ] , y == wally[ ]) { //set 'collision' true collision = true; } } return collision; } but strange catch doesn't work when displaying screen. player collides them same thoug

php - send email from xampp? mercury mail server? relay mail server? -

i have been researching topic have been having difficulties send email using php script. when execute contactform.php executes send_form_email.php , says email has been sent. there nothing wrong scripts since had friend code test on server able submit form , generate email. so went through steps of configuring sendmail.ini , php.ini believe configuring right according online tutorials. have tested on aws server on internet , has disabled firewall ports open , still unable send email through php scripts. post example of using configure .ini files. so left creating mail server. not sure of options are. thinking relay mail server take on work load , not need go through hassle of deploying mail server. have mercury on xampp configure cannot find decent tutorial out there can me. here asking professional advice how should tackle issue. in gmail have enabled traffic using pop3, imap, , smtp can send , receive not sure can do. have never deployed email server looking easy use. small p

Grails : Generate text file for GSP -

i working grails 2.3.6 application. i tried many different things generate pdf, of them failed. is possible generate text file of contents of gsp file? have button called export , when user clicks on that, text file download there system. will possible passing url of gsp file? this quite straightforward. need specify response type (text/plain) in render method controller. can have plain text in gsp file , use tags needed. def textfile = { response.setheader('content-disposition', 'attachment;filename="textfile.txt"') render view: 'textfile', contenttype: 'text/plain' } textfile.gsp: dear ${name}, text file. as pdf, recommend amazingly grails rendering plugin .

visual studio - NuGet Automatic Package Restore when using git submodules -

i trying understand if there way rely on nuget automatic package restore when referencing libraries hosted on github. problem when add library submodule, has it's own /packages/ directory. but, when add csproj library solution since there no dlls in /packages/ directory of submodule, build fails. obviously, easy fix on machine open .sln file submodule i've referenced, build. now, building main solution work since /packages/ folder in submodule populated. but, not can on build server. any way of solving problem without messing submodule? don't want change submodule .csproj because put out of sync origin. ideally love if instruct nuget pull packages referenced submodule .csproj in it's own /packages/ directory. there 2 types of automatic package restore. 1 triggered when build solution within visual studio, , 1 msbuild based , requires modifying project run nuget.exe restore part of build. msbuild based restore enabled selecting enable nuget package resto

java - Is it possible to persist a security configuration and dynamically change it? -

i'm using spring security 3 . i'm trying solve following problem. need persist security configuration intercepted urls , provide ability dynamically change it. instance: <security:intercept-url pattern="/secure/super/**" access="role_we_dont_have"/> i need change access page, satisfying url pattern store new rules. issue specifying rules via xml-config cannot changed in runtime dynamically. possible implement @ all?

gps - Android best practice for tracking route -

i need able track route user walk. is log location database in onlocationchanged or there better practice doing this? hope can help regards jakob taking in consideration possibility of lost of internet connection, yes logging location database better practice me. opengpstracker doing same thing. refer project , try learn it. in side note, biggest challenge trying manage life of battery. can read article better practice.

javascript - How to Store PHP Session Values from Multiple Click Events in jQuery? -

i trying use jquery pass values session variables when buttons clicked on. each button has unique values , need display values both buttons when both clicked. the problem having 1 set of values (from recent button clicked) translated session variable - if click first button, first values passed session backend fine, clicking second button afterwards results in second values being passed. my jquery looks this: $button_one.click(function(e) { e.preventdefault(); var var_one = "value1"; var var_two = "value2"; $.post("sessions.php", { 'session_var_one': var_one, 'session_var_two': var_two }); }); $button_two.click(function(e) { e.preventdefault(); var var_three = "value3"; var var_four = "value4"; $.post("sessions.php", { 'session_var_three': var_three, 'session_var_four': var_four }); }); the sessions.php simple: <?php session_start(); $_session['value_one&

passing python list to javascript -

i trying pass python list javascript function, doesn't work... think javascript function see 1 long string. do: @webiopi.macro def calcsunrisesunsetoneyear(): o=ephem.observer() o.lat='51.21828' o.long='3.94958' s=ephem.sun() d=datetime.date.today() t=timedelta(days=1) d=d+t o.date=d risetime=[] settime=[] s.compute() x in range (0,365): o.date=o.date+1 risetime.append(str(ephem.localtime(o.next_rising(s)))) settime.append(str(ephem.localtime(o.next_setting(s)))) return(json.dumps(risetime)) this python data: ["2015-03-22 06:43:02.000006", "2015-03-23 06:40:46", "2015-03-24 06:38:31.000001", "2015-03-25 06:36:15.000002", "2015-03-26 06:33:59.000003", "2015-03-27 06:31:44.000004", "2015-03-28 06:29:28.000005", "2015-03-29 07:27:13.000006", "2015-03-30 07:24:57", "2015-03-31 07:22:42.0000

php - FTP with AWS elastic Beanstalk -

i quite newbie , trying figure out how configure sftp or ftp aws elastic beanstalk. using filezila, , wondering grab proper credentials set up. thanks don't. elastic beanstalk not designed ftp. key idea behind elastic beanstalk can pull out instance @ anytime , replace another. if use ftp, you'll lose work. if want ftp, use raw ec2 server.

javascript - Instant image loading using jquery -

well searching on internet way load images instantly using jquery, didn't found anything. use: <select> <option>image 1</option> <option>image 2</option> <option>image 3</option> </select> so want load image instantly after clicking on 1 of option. how can it? thank you. edit after clicking on 1 of option load image, without refreshing page here simple example: // when option selected $('#imageselect').on('change',function(){ // change image's src selected value $('#myimage').attr('src', $(this).val()); // once on page load if necessary }).change(); img{display:block;max-width: 50%;} /* demo */ <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <select id="imageselect"> <option value="http://i62.tinypic.com/2088l0l.jpg">image 1</o

javascript - Uncaught ReferenceError: bedCostOutput is not defined -

//bedcostoutput has been defined below i'm getting error function has not been defined. program should pull data outside file , process// function processbedcostclass() { this.calculatedeliverycredit = calculatedeliverycredit; this.calculatetradecredit = calculatetradecredit; this.calculatebeddiscount = calculatebeddiscount; this.calculatefinalbedcost = calculatefinalbedcost; } function drivermodule_click() { openbedcostfile(); processbedcostfile(); closebedcostfile(); } function processbedcostfile() { { bedcostinput(); processbedcost1.calculatedeliverycredit(); processbedcost1.calculatetradecredit(); processbedcost1.calculatebeddiscount(); processbedcost1.calculatefinalbedcost(); bedcostoutput(); } while (!feof(infile)); } function bedcostinput() { processbedcost1 = new processbedcostclass(); inline = readline(infile); if (inline) { params = inline.split(",")

Python appending list -

trying change list can generate password passwordlength=int(input('enter how long password')) # user input x in range(0,passwordlength): password=''.join(characters) print(password) that working now. characters using list. giving me input list repeated input number. every time try , use append list end going backwards any appreciated i think random.sample may want: from random import sample passwordlength = int(input('enter how long password')) # user input password = ''.join(sample(characters,passwordlength)) or else take slice passwordlength : password = ''.join(characters[:passwordlength]) to validate user input can use try/except , while loop: from random import sample while true: try: password_length = int(input('enter password length between 1-{}'.format(len(characters)))) # user input if password_length > len(characters):

php - html code when updated by jquery has some issues -

well, developing web page view images in grid image gallery. images categorized, , there's left pane select category view. also, 1 of links in left pane "my categories" views categories folder images in grid. have jquery script change images in gallery when 1 of categories clicked, when "my categories" clicked changes images images of folders categories have. till works fine. problem when have "my categories" selected , gallery containing images of folders categories have, want use same jquery script when click 1 of "images of folders" refer 1 of categories, images in category viewed, it's not working! code adding categories left pane: <ul class="nav nav-sidebar"> <li class="active"><a href="#"><b>your folders</b><span class="sr-only">(current)</span></a></li> <?php $db = mysql_connect("localhost", "

perl - Why does this attempt to customize a type constraint error message fail? -

the following construct creates type constraint functions expected (checks "roles::thing" role when attribute set) when attribute rejected due not passing constraint expect custom error message "not thing" appear; default error message still being given. doing wrong? role_type 'doesthing', { role => 'roles::thing', message => sub { "not thing." } }; update: did not provide enough context in original post. way trying use new type is: has things => ( isa => 'arrayref[doesthing]' ); the type validation work expected; still default error message. custom "not thing" error message not propagated have expected be. the error message arrayref type, regardless of you're expecting inside it. to custom error message you'll need incorporate arrayref type declaration: subtype 'arrayofthings', 'arrayref[roles::thing]', message { 'not array of things&

ios - How to set UIBarButtonItem tintcolor to non default UIColor -

i've looked through typical navigation bar tintcolor tutorials , questions. have set tint navigation bar, have mail icon needs change custom color when there mail. (like reddit orange mail icon) i can set tint when using system uicolors. self.leftnavigationbarbutton = [[uibarbuttonitem alloc] initwithimage:someimage style:uibarbuttonitemstyleplain target:self action:@selector(foo:)]; self.navigationitem.leftbarbuttonitem = self.leftnavigationbarbutton; self.leftnavigationbarbutton.tintcolor = [uicolor redcolor]; however if use custom color. self.leftnavigationbarbutton.tintcolor = [uicolor colorwithred:100 green:40 blue:20 alpha:1.0]; it makes icon white. know what's going on or how can use custom color? i figured out answer https://stackoverflow.com/a/5642229/1732711 . short answer divide rgb values 255.0. self.leftnavigationbarbutton.tintcolor = [uicolor colorwithred:100/255.0 green:40/255.0 blue:20/255.0 alpha:1.0];

python - Finding GUI elements with pywinauto -

i trying first things pywinauto. want make use of print_control_identifiers() errors, write code - cant information gui objects. tried generate code via swapy - had lot of generated code, no success. this code far: import getpass, fnmatch pywinauto import application currentuser = getpass.getuser() if fnmatch.fnmatch(currentuser, "axe"): pwa_app = application.application() w_handle = application.findwindows.find_windows(title=u'login - 0.9.347', class_name='windowsforms10.window.8.app.0.141b42a_r11_ad1')[0] window = pwa_app.window_(handle=w_handle) window.setfocus() ctrl = window['log in'] ctrl.click() else: print "you need admin rights action" can tell me, need use print_control_identifiers() ? have other gui automation frameworks more up-to-date? printcontrolidentifiers() useful top level window. if window top level window specification, call window.printcontrolidentifiers() or p

dimple.js - Dimple Stacked Bar Chart - adding label for aggregate total -

i'm trying add label aggregate total stacked bar chart above each bar. used example ( http://dimplejs.org/advanced_examples_viewer.html?id=advanced_bar_labels ) add totals each section of bar, i'm not sure how add total above. i've been able add total labels above each bar single series (not stacked). can't work stacked bar chart. my current workaround plotting additional null series line, making line , markers transparent can still see total value in tooltip. however, i'd have totals displayed above each bar. here's code: var svg = dimple.newsvg("#chartcontainer", 590, 400); var mychart = new dimple.chart(svg, data); mychart.setbounds(80, 30, 510, 305); var x = mychart.addcategoryaxis("x", "month"); x.addorderrule(date); var y = mychart.addmeasureaxis("y", "calls"); y.showgridlines = true; y.tickformat = ',6g'; y.overridemin = 0; y.overridemax = 800000; var s = mychart.addseries("metric&q

What is a "bot account" on github? -

i reading docs discuss how authenticate on github particular repo. "you'll want use bot account this." (docs written github employee). bot account? how one? look @ section, " user accounts / what's difference between user , organization accounts? " user accounts intended humans, can give 1 robot, such continuous integration bot, if necessary. in other words, "user account" can "person" (the normal case), can used automated process (a "bot"). which precisely how benbalter using github in change agent project cited above. q: how one? a: "bot account" github user account. create other github user account.

html - How to vertically align (justify) multiple elements -

i not quite sure how want going try. want vertically align 3 different elements, 3 wrapped in individual divs. code: .service_info { margin-top: 45px; clear: both; background-color: #ffffff; font-family: "source-sans-pro", sans-serif; } .title_text_serviceinfo { margin-top: 85px; margin-left: 60px; padding-bottom: 20px; color: #333132; font-size: 24px; font-family: "source-sans-pro", sans-serif; } .service_info_times { margin-top: -110px; margin-left: 200px; font-size: 18px; line-height: 175%; border-left: 5px solid #0b496f; padding-left: 20px; color: #333132; } .service_info_events { postion: fixed; left: 300px; top: 20px; font-size: 18px; line-height: 175%; color: #333132; } <!--service information--> <section class="service_info"> <h2 class="secondary_header"> when gather </h2> <h3 class="title_text_serviceinfo&quo

canvas text not showing? - javascript -

i using ctx.filltext function draw text onto screen , dosent seem appearing. overlay("rgb(50, 50, 200)", "this beginning screen", 48, "black", "center", centerx, centery) var overlay = function(colour, text, font, size, fontcolour, oreintation, x, y){ ctx.font = size + "px " + font + " " + fontcolour ctx.textalign = oreintation ctx.fillstyle = colour ctx.fillrect(0, 0, ctx.canvas.width, ctx.canvas.height) ctx.filltext(text, x, y) } still learning javascript dont downvote because noob :( you must define function var overlay before call `overlay(...); centerx & centery undefined the font face font missing overlay(...) the background fill same color text fill text not show working demo: var canvas=document.getelementbyid("canvas"); var ctx=canvas.getcontext("2d"); var cw=canvas.width; var ch=canvas.height; var overlay = function(colour, text, fo

vim - How do I get Intellij to follow the cursor right when I move off the screen? -

if press l go off screen right, ideavim doesn't scroll window it. result, can't see cursor is. tested regular vim , doesn't act way: brings window if move off window. how can make ideavim act way? i using intellij 14.0.3 , latest ideavim on mac.

java - AspectJ with JUnit tests by inpathing the main project -

Image
i have downloaded large project (whiley) , wanting trace every method executed during projects junit tests. there 6 modules , rely on each other mostly. i trying single module working using eclipse aspectj plugin. my aspectj inpath settings aspectj weaves code , produces compiled version of wyc in /bin folder. however, when try , run junit test's .class file through cli. with following statement: java -cp "c:\users\name\git\whileycompiler\lib\junit-4.11.jar";"c:\users\name\git\whileycompiler\lib\*.jar";"c:\users\name\git\whileycompiler\lib\hamcrest-all-1.3.jar" org.junit.runner.junitcore "c:\users\name\git\test\bin\wyc\testing\allvalidtests.class" i following: my aspect file pointcut tracemethods() : (execution(* *(..))&& !cflow(within(trace))); before(): tracemethods(){ signature sig = thisjoinpointstaticpart.getsignature(); string line =""+ thisjoinpointstaticpart.getsourcelocation(

node.js - Ionic build not reflecting changes when running or deploying to app -

i using standard ionic template project generated webstorm. when make simple changes (like adding test alert(...)) in app.run(...) in app.js , run following set of commands, changes not reflected when app runs or deployed phone. the following commands ran root of project. gulp ionic build android ionic run|emulate android is there missing not reflect changes making? recently experienced issue. helped me removing android platform: ionic platform rm android then, re-adding it. ionic platform add android make sure delete app device before running/installing again, run: ionic run android hope helps

Deleting an android ListView row on LongClick -

i have code data database , display in listview list<contact> contacts = db2.getallcontacts(); arraylist<string> my_list = new arraylist<>(); (contact cn : contacts) { string outputt = "id: " + cn.getid() + ", message: " + cn.getmessage() + ", time: " + cn.getdate(); my_list.add(outputt); } arrayadapter<string> adapter = new arrayadapter<string> (this, android.r.layout.simple_list_item_1, my_list); listview listview = (listview) findviewbyid(r.id.listview); listview.setadapter(adapter); i want delete particular item/row on listview on swipe. how can achieve ? you can use enhancedlistview . copy the enhancedlistview class linked repo in project. instead of listview , use , enhancedlistview in code. i.e.: enhancedlistview listview = (enhancedlistview) findviewbyid(r.id.listview); // set enhanced

javascript - Have a variable select from an array -

this question has answer here: how access object property using variable 2 answers i trying use variable select array: this works: var myarray = {bricks:3000, studs:500, shingles:400, tiles:700}; function one() { alert(myarray.bricks); } but not work: var myarray = {bricks:3000, studs:500, shingles:400, tiles:700}; var myvalue = "bricks" function two() { alert(myarray.myvalue); } how do properly? here fiddle show trying accomplish: https://jsfiddle.net/chrislascelles/xhmx7hgc/2/ use [] notation. var myarray = {bricks:3000, studs:500, shingles:400, tiles:700}; function one() { alert(myarray.bricks); } var myvalue = "bricks" //supplied here make example work function two() { alert(myarray[myvalue]); } demo

c++ - Covariant clone function misunderstanding -

this question related recent 1 polymorphism not working function return values of same data type (base , inherited class) consider code: #include <iostream> #include <typeinfo> class base { public: virtual base * clone() { base * bp = new base ; return bp ; } }; class derived: public base { public: derived * clone() override { derived * dp = new derived ; return dp ; } }; int main() { base * bp = new derived; auto funky = bp->clone(); std::cout << typeid(funky).name() << std::endl; } the output p4base (i.e. pointer-to-base). why this? bp->clone() should invoke covariant virtual derived* derived::clone via base* pointer, type of bp->clone() should derived* , not base* . the declaration auto funky = bp->clone(); is equivalent to base* funky = bp->clone(); since base::clone returns base* . checking type of pointer yields base* . checking typ

c++ - string compare failing after reading line from txt file -

i trying read file line line , compare string in code. somehow following code not giving expected result. not follow missing during comparison: code int main(int argc, char** argv) { std::string filepath="e:\\data\\stopfile.txt"; std::string line; std::ifstream myfile; std::string test="ball"; myfile.open(filepath.c_str()); if(myfile.is_open()){ while(getline(myfile,line)){ std::cout<<line<<std::endl; if(!line.compare(test)){ std::cout<<"success"<<std::endl; } else{ std::cout<<"fail"<<std::endl; } } } myfile.close(); if(!test.compare("ball")){ std::cout<<"success"<<std::endl; } } output apple fail ball fail cat fail success i expect program print success after line of "ball". comparison not seem succes

Working example of implementing 'Token Based Authentication' using 'JSON Web Token (i.e. JWT)' in PHP and MySQL? -

i've developed few web apis using slim framework. i want implement 'token based authentication' these apis. since first time work on 'token based authentication', new me. so, googled lot solution , came know 'json web token (i.e. jwt)'. i visited url git repo url jwt couldn't understand how implement jwt using php , mysql system. i searched working example of implementation of 'token based authentication' using 'json web token (i.e. jwt)' in php , mysql. if provide me complete code along mysql database table, database connectivity php, generation of security token, saving token respective database table, sending security token calling php file, sending security token in request, validating security token 1 stored in database, etc. helpful me. if possible, please provide entire code proper step-by-step description in form of comments.

how to send text(command) via Bluetooth to handle robot from android device? -

my actual req controlling of robot android device. voice text conversion n send commonds matches text. start -1 ,here 1 command need send robot.....so can u please tell me procedure followed. is possible send text instead of file?? there 3 parts have described: hotword detection , bluetooth server , , bluetooth client . follows short description of envolves. for hotword detection, require registering service hotword. when hotword recognized android call service. for bluetooth server, depending on how set either side server. create listening bluetooth server socket, use bluetoothadapter.listenusingrfcommwithservicerecord() , call accept() . blocking meaning don't use in main thread. for bluetooth client, once again depending on how set either side client. connect listening bluetooth server socket, can use bluetoothdevice.createrfcommsockettoservicerecord() , call connect() . once bluetooth connection established can send , retrive data (for example string) u

javascript - Creating multiple elements with different class names or IDs using jQuery -

i'm trying create multiple sliders different class names or ids using http://refreshless.com/nouislider/ individual value can used backend functionality. write new function different inputs each slider repeating myself. think might appropriate situation $(this) i'm not sure how use it. if done in handlebars.js make day. noob question know, can seem find appropriate answer or tutorial through searches, due not knowing appropriate terminology. here's create slider function: this.prefslider = function () { $(".prefslider").nouislider({ start: [50], range: { 'min': 0, 'max': 100 } }); $('.prefslider').link('lower').to($('.preflower'), 'text', wnumb ({ decimals: 0 })); } and here's html rendering it: <div class="sliderbox"> <div class="prefslider">

Excel macro CSV issue -

Image
im using excel macro generates csv file data upload gmail contacts. when file uploaded gmail contacts, mobile number , work number come correctly persons name comes in notes box "first name: yash". im attaching sample csv file generated macro. download sample csv here im using following macro generate csv's: sub getcsv() application.screenupdating = false csvnewsheet dim myrange range dim numrows integer set myrange = activesheet.range("a:a") numrows = application.worksheetfunction.counta(myrange) range("e1").select activecell.formular1c1 = "first name" range("e2").select activecell.formular1c1 = "=concatenate(reports!r[5]c2,"" "",reports!r[5]c1)" range("e2").select selection.autofill destination:=range("e2:e" & numrows + 1) range("e2:e3").select columns("e:e").entirecolumn.autofit hide_format exporttocsv

vb.net - This code is supposed to output the number of times a word starts with a letter from the alphabet, but just displays zero for each one -

this code supposed output number of times word starts letter alphabet, displays 0 each 1 no errors, text file of letters , 0 each one. when pressing debug button, appears nothing. here's code imports system.io module module1 sub main() dim myarray new list(of string) using myreader streamreader = new streamreader(".\myfile.txt") 'telling vb we're using streamreader, read line @ time dim myline string myline = myreader.readline 'assigns line string variable myline while (not myline nothing) myarray.add(myline) 'adding list of words in array console.writeline(myline) myline = myreader.readline loop end using sortmyarray(myarray) 'calls new subroutine => sortmyarray, passing through parameter myarray, 'created on line 7 stores of lines read text file. 'console.readline() wordcount(myarray) end sub sub sortmyarray(byval mysort lis

Installing Numpy on 64bit Windows 8.1 with Python 2.7 -

i trying install numpy on python 2.7 , using windows 8.1. when run numpy link says, "python 2.7 required, not found in registry ". how can resolve issue, installed python 2.7? you should use pip install numpy , other librarys check this how install pip after installing, go command line , enter pip install numpy

What does the linux scheduler return when there are no tasks left in the queue -

the linux scheduler calls scheduler algorithm finds next task in task list. what scheduling algorithm return if there no tasks left? below piece of code struct rt_info* sched_something(struct list_head *head, int flags) { /* logic */ return some_task; // task's value if there no tasks left. } there special "idle" task pid=0, called swapper ( why need swapper task in linux? ). task scheduled cpu core when there no other task ready run. there several idle tasks - 1 each cpu core source kernel/sched/core.c http://lxr.free-electrons.com/source/kernel/sched/core.c?v=3.16#l3160 3160 /** 3161 * idle_task - return idle task given cpu. 3162 * @cpu: processor in question. 3163 * 3164 * return: idle task cpu @cpu. 3165 */ 3166 struct task_struct *idle_task(int cpu) 3167 { 3168 return cpu_rq(cpu)->idle; 3169 } 3170 so, pointer task stored in runqueue ( struct rq ) kernel/sched/sched.h : 502 * main, per-cpu runqueue data structur

c++ - DICOM C_MOVE with gdcm's "CompositeNetworkFunctions" -

i trying dicoms server using gdcm's compositenetworkfunctions . test server set using "orthanc". when run move request, get: terminate called after throwing instance of 'gdcm::exception' what(): /home/myname/builds/gdcm/source/source/common/gdcmexception.h:74 (): when catch exception, find "unhandled exception", no more info. instead of catching it, run program using gdb. here's get: 0x00007ffff3e4dcc9 in __gi_raise (sig=sig@entry=6) @ ../nptl/sysdeps/unix/sysv/linux/raise.c:56 56 ../nptl/sysdeps/unix/sysv/linux/raise.c: no such file or directory. (gdb) bt #0 0x00007ffff3e4dcc9 in __gi_raise (sig=sig@entry=6) @ ../nptl/sysdeps/unix/sysv/linux/raise.c:56 #1 0x00007ffff3e510d8 in __gi_abort () @ abort.c:89 #2 0x00007ffff44526b5 in __gnu_cxx::__verbose_terminate_handler() () /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #3 0x00007ffff4450836 in ?? () /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #4 0x00007ffff4450863 in std::terminate() () /u

Add data to access table in vb.net -

i have created form in visual studio 2010 & following code using private sub button1_click(byval sender system.object, byval e system.eventargs) handles button1.click dim dbprovider = "provider=microsoft.ace.oledb.12.0;" dim dbsource = "data source=|datadirectory|\membership.accdb" dim con new oledb.oledbconnection con.connectionstring = dbprovider & dbsource con.open() dim sql = "insert memberdetail (membername, memberadd, membercontact, memberphone1, memberphone2, membersince) values (?, ?, ?, ?, ?, ?)" using cmd = new oledb.oledbcommand(sql, con) cmd.parameters.addwithvalue("@p1", me.memname.text) cmd.parameters.addwithvalue("@p2", me.memadd.text) cmd.parameters.addwithvalue("@p3", me.memcontact.text) cmd.parameters.addwithvalue("@p4", me.memphone1.text) cmd.parameters.addwithvalue(&q

ios - Replace enum's rawValue property with a custom operator -

well, honest, don't calling rawvalue when accessing enum value. use enum time , think calling .rawvalue makes code less "readable": enum fontsize: cgfloat { case small = 12 case normal = 15 case large = 18 } enum example: string { case first = "first" case second = "second" } so, i'm trying define generic operator enum "override" .rawvalue . i can non-generically. postfix operator .. { } postfix func .. (lhs: example) -> string { return lhs.rawvalue } postfix func .. (lhs: fontsize) -> cgfloat { return lhs.rawvalue } however, i'm lazy want universal solution. writes one, works all. can me ? thank you. update : people interested in question, if want increase/decrease functions enum fontsize above. use these: postfix func ++ <t: rawrepresentable, v: floatingpointtype>(lhs: t) -> v { return (lhs.rawvalue as! v) + 1 } postfix func -- <t: rawrepresentable, v:

sql server - Return difference of comparing percentage value of a column -

i have colum 10,000 finincial records. values are: id pk, owingvalue example data id owingvalue 1 123.2 2 123.4 3 123.5 4 123.6 5 123.7 6 140.2 7 140.3 for giving column more 0.7% difference previous record, return records high difference. in case result column 7 because (column 6 owingvalue - column 5 owingvalue) multiply 100 give 1.650 percent higher our threshold of 0.7% need sql while loop or curso me solve problem. thanks in advance try this: declare @t table ( id int, v money ) insert @t values ( 1, 123.2 ), ( 2, 123.4 ), ( 3, 123.5 ), ( 4, 123.6 ), ( 5, 123.7 ), ( 6, 140.2 ), ( 7, 140.3 ) select t1.id @t t1 join @t t2 on t1.id = t2.id + 1 join @t t3 on t2.id = t3.id + 1 ( t2.v - t3.v ) / t3.v * 100 > 0.7 output: id 7 if ids have gaps then: declare @t table ( id int, v money ) insert @t values ( 1, 123.2 ), ( 2, 123.4 ), ( 3, 123

javascript - Three.js .obj shadows not working -

i trying learn thee.js. , pretty straight forward. reason unable shadows working. i've set castshadows, recieveshadows, shadowmapenabled true on places found set them not show shadows (anywhere). what want imported model casts shadows on can make out model is. this current code: var container; var camera, scene, renderer; var mousex = 0, mousey = 0; init(); animate(); function init(){ container = document.createelement( "div" ); document.body.appendchild( container ); camera = new three.perspectivecamera( 45, window.innerwidth / window.innerheight, 1, 2000 ); camera.position.z = 100; controls = new three.trackballcontrols( camera ); controls.rotatespeed = 5.0; controls.zoomspeed = 5; controls.panspeed = 0; controls.nozoom = false; controls.nopan = true; controls.staticmoving = true; controls.dynamicdampingfactor = 0.3; scene = new three.scene(); var ambient = new three.ambientlight( 0xffffff ); sc

How to merge objects using javascript? -

Image
i have below $scope.marketing = [{ 'productid':1, 'productname':'product 1', 'productdescription':'product description 1' }, { 'productid':2, 'productname':'product 2', 'productdescription':'product description 2' }]; $scope.finance=[{ 'productid':1, 'price':'$200.00' }, { 'productid':2, 'price':'$100.00' }]; $scope.inventory=[{ 'productid':1, 'stockinhand:':26 }, { 'productid':2, 'stockinhand':40 }]; i want output my merge function here $scope.tempresult=merge($scope.marketing,$scope.finance); $scope.result=merge($scope.tempresult,$scope.inventory); function merge(obj1,obj2){ // our merge function var result = {}; // return result for(var in obj1){ // every property in obj1 if((i in obj2) && (typeof obj1[i] === &

javascript - How to respond to an event after loading a hyperlink page? -

i wonder possible respond event after client click hyperlink , hyperlink loaded? event can use properties in hyperlink(i.e. id, class...etc)? for example, page_a have hyperlink <a href="page_b" onclick="some_func">link</a> but since some_func need use properties in page_b, let page_b have line <p id="a">hello world</p> and some_func want it(e.g. document.getelementbyid("a") ), how can first load hyperlink(page_b) run some_func? you use localstorage save name of function want execute on second page, , call once loads. the code this: js // sample function called function myfunc() { alert("called previous page!"); } // save name of function in local storage function saveforlater(func) { localstorage.setitem("func", func); } // if function exists if (localstorage.func) { // call (not using evil eval) window[localstorage.func](); // remove storage next page

database - About query written in Domain Relational Calculus -

Image
i trying learn domain relational calculus. considering below relations , queries, why can't write for {<c>|< b, l, c, a> ∈ borrow ∧ a>1200} second question? have feeling has whether query safe, how come answer question 1 works? don't know wrong. please explain? many thanks! source http://www.cs.sfu.ca/coursecentral/354/zaiane/material/notes/chapter3/node18.html#section00142000000000000000 , relations refers here http://www.cs.sfu.ca/coursecentral/354/zaiane/material/notes/chapter3/node8.html#section00121000000000000000 remember, definition of query in domain relational calculus {<x1, ..., xn> | p(<x1, ..., xn>)} says variables x1, ..., xn appear left of ‘|’ must free variables in formula p(...) . in example, variables b,l,a not bound , remain free. in correct answer, existence quantifier binds them.