Posts

Showing posts from August, 2014

node.js - How to correctly create 'charge' in Stripe nodejs library? -

Image
client i'm using stripe checkout custom integration - https://stripe.com/docs/checkout#integration-custom - in following way: var handler = stripecheckout.configure({ key: 'your_key_here', image: 'images/logo-48px.png', token: function(token, args) { $.post("http://localhost:3000/charge", {token: token}, function(res) { console.log("response charge: " + res); }) } }) using custom contrary simple - how can modify stripe checkout instead send ajax request? - because simple not allow me make ajax call. server https://stripe.com/docs/tutorials/charges you've got token user's credit card details, what? charge them money. app.post('/charge', function(req, res) { console.log(json.stringify(req.body, null, 2)); var stripetoken = req.body.token; var charge = stripe.charges.create({ amount: 0005, // amount in cents, again currency: "

eclipse - How to retrieve IProblem instances from current editor? -

i'm writing eclipse plugin, , i'd retrieve instances of iproblem associated open text editor. i've tried following: iworkbenchwindow window = platformui.getworkbench().getactiveworkbenchwindow(); ieditorpart editor = window.getactivepage().getactiveeditor(); if (!(editor instanceof abstracttexteditor)) { return null; } itexteditor texteditor = (itexteditor)editor; idocumentprovider docprov = texteditor.getdocumentprovider(); idocument doc = docprov.getdocument(editor.geteditorinput()); astparser parser = astparser.newparser(ast.jls4); parser.setsource(doc.get().tochararray()); compilationunit cu = (compilationunit) parser.createast(null); return cu.getproblems(); however, when run against following code in editor: import java.io.serializable; public class testclass implements serializable { /** * */ } it doesn't find problems. expect @ least finds missingserialversion problem. perhaps i'm parsing file incorrectly, might cause issue

How to put multiple websites on a localhost port 80 using nginx.conf file? -

i used nginx setup virtual server , have nginx.conf file below, works fine 2 different websites on http://localhost , http://localhost:100 : user nobody; worker_processes 1; error_log /usr/local/cellar/nginx/1.4.6/logs/error.log; pid /usr/local/cellar/nginx/1.4.6/logs/nginx.pid; events { worker_connections 1024; } http { include /usr/local/etc/nginx/mime.types; include /usr/local/etc/nginx/fastcgi.conf; default_type application/octet-stream; access_log /usr/local/var/log/nginx/access.log; sendfile on; tcp_nopush on; keepalive_timeout 65; gzip on; server { listen 80; server_name localhost; access_log /usr/local/cellar/nginx/1.4.6/logs/localhost.access.log combined; location / { root /users/apiah/websites/greenapple; index index.html index.htm index.php; } location ~ \.php$ { root /users/apiah/w

sql server - Using CASE with Else in SQL view -

i have view in have figure out correct value of ferpa column using case statement. value should 'y' or 'n' depending on addresstype. however, have addresstypes values our customer not agree want me using following logic: if addresstype = permanent use value cmn_personsferpa table (this table created) , choose ispermaddressferpa flag. if addresstype = local use value cmn_personsferpa table , choose islocaladdressferpa flag. if addresstype = outside source or international, etc. check see if user has value = 'y' in columns in cmn_personsferpa table (look @ view below). the issue can customer asking if can use @cmn_personsid parameter. however, these view being used many applications need figure out way without using @cmn_personsid parameter. how can this? select per.cmn_personsid, per.fullname name, isferpa = case pal.addresstype when 'permanent' perferpa.ispermaddressferpa when 'local' perferpa.islocaladdressfer

esprima - Javascript Object from External file, program -

i confused javascript's object system. know considered object in javascript in code of esprima, don't see statement declare project accessed esrpima following line: ( https://github.com/ariya/esprima/blob/master/esprima.js ) var syntax = esprima.parse(text); my question how , define esprima.parse(text) in javascript can exported external package , accessed object name. know how define object object = {a: "b"}; can't find way figure out. please me! (function (root, factory) { 'use strict'; // universal module definition (umd) support amd, commonjs/node.js, // rhino, , plain browser loading. if (typeof define === 'function' && define.amd) { define(['exports'], factory); } else if (typeof exports !== 'undefined') { factory(exports); } else { factory((root.esprima = {})); } }(this, function (exports) { 'use strict'; var token, tokenname, ..

C go to start of linked list in loop -

hi have linked list defined struct process { int a; struct process *next; }; typedef struct process node; i have 2 nodes, 4 , 5 lets say. i want loop goes through linked list , decrements each node 1 until 0. any suggestions? code have: { if (arrivaltime->next == null) { // printf("a is: %d \n", arrivaltime->a); printf("-- "); break; } else { // printf("a is: %d \n", arrivaltime->a); printf("-- "); arrivaltime->a--; arrivaltime = arrivaltime->next; } //arrivaltime = start; } while(1); i can loop run once. arrivaltime = start; while(arrivaltime == null) { arrivaltime->a--; printf("a is: %d \n", arrivaltime->a); arrivaltime = arrivaltime->next; }

amazon web services - hue installation error on AWS EC2 -

hello trying install hue on aws ec2 instance. following below link. https://github.com/cloudera/hue while doing step make apps getting below error. [warning] rule 1: org.apache.maven.plugins.enforcer.requirejavaversion failed message: detected jdk version: 1.6.0-30 not in allowed range [1.7.0,1.7.1000]. [info] ------------------------------------------------------------------------ [info] build failure [info] ------------------------------------------------------------------------ [info] total time: 14.717s [info] finished at: sun mar 09 13:18:59 edt 2014 [info] final memory: 5m/25m [info] ------------------------------------------------------------------------ [error] failed execute goal org.apache.maven.plugins:maven-enforcer-plugin:1.0:enforce (default) on project hue-parent: enforcer rules have failed. above specific messages explaining why rule failed. -> [help 1] [error] [error] see full stack trace of errors, re-run maven -e switch. [error] re-run maven using -x

algorithm - select the most fitting road by sketching lines on the map -

Image
i have 2d road net data, contains lot of road points , lines link them. want select road(or several road) drawing lines on map, , lines can inaccurate, want find fitting road. there way achieve this? thanks. ======================================================================== update : it's not route searching problem, setting start point , end point , finding best route. what want is, when user want select route on map, draw sketch line on map this: and fitting route can found , highlighted this: 1) find roads link together 2) assign cost 1 road road link (only ones touching) 3) pick ones lowest cost - recursively

delphi - SendInput for Non Unicode, Non Ascii characters -

i writing global hook procedure. using sendinput send ascii ( < 255 ) , unicode characters. far working well. in language, tamil there characters combination characters not have unicode code points. in fonts there glyphs defined above 255. how send virtual key codes them? though glyphs not have code points have glyph names u0baf_u0bbf. first , second part defined in unicode. these names referred named sequence , approved unicode. code: procedure genukey(const vk: integer; const bunicode: bool); var kb: tkeybdinput; input: tinput; begin {keydown} { zeromemory(@kb,sizeof(kb));} { zeromemory(@input,sizeof(input));} {keydown} if bunicode begin kb.wvk:= 0; kb.wscan:= vk; ; kb.dwflags:= $4; { keyeventf_unicode=4} end else begin kb.wvk:= vk; kb.wscan:= 0; ; kb.dwflags:= 0; end; input.itype:= input_keyboard; input.ki:= kb; sendinput(1, input,sizeof(input)); {keyup} if bunicode begin kb.wvk:= 0; kb.wscan:= vk ; kb.

Magento add price and color in meta description -

i add product price in meta description of products. don't write meta desc in product options, magento gets product desc. (it's ok me) $description = $product->getmetadescription(); if ($description) { $headblock->setdescription( ($description) ); } else { $headblock->setdescription(mage::helper('core/string')->substr($product->getdescription(), 0, 255)); how make meta desc looks that= productdesc color finalprice ? pleas copyfile view.php app\code\core\mage\catalog\block\product app\code\local\mage\catalog\block\product here find protected function _preparelayout() find code , comment this $description = $product->getmetadescription(); if ($description) { $headblock->setdescription( ($description) ); } else { $headblock->setdescription(mage::helper('core/string')->substr($product->getdescripti

app store - Robovm iOS App verification failed -

i have created ios app latest version of libgdx (java) , when upload app store, receive error. using correct version of xcode , ios 7 sdk. apple's web service operation not successful unable authenticate package: 836379195.itmsp error itms-9000: "this bundle invalid. new apps , app updates submitted app store must built public (gm) versions of xcode 5 , ios 7 sdk. <br>do not submit apps built beta software." @ softwareassets/softwareasset (mzitmspsoftwareassetpackage) robovm uses xcode installation pointed xcode-select . use xcode-select -p to view path of used xcode. make sure prints out path xcode 5 installation , not old beta xcode. use xcode-select -s /path/to/proper/xcode to switch xcode path. have restart eclipse after in order robovm pick new path.

c - Is there a more efficient way to do this? -

first of all, yes laboratory activity in class, have submitted , defended exercise. know if there way, more efficient way write code. what tasked write code creates process, creates child, in turn creates child , creates child. *edit: separated , numbered requirements better readability :) the last child show current processes running in system. its parent ask word create file using input user. its parent ask word or phrase, find within libraries in machine (let's typed hi, should find , list files containing hi & directory. position of word hi should not matter) lastly, main parent print parent id. here complete code matter: int main(void){ char filename[30]; char phrase[30]; int pid = fork(); int fd[2]; pipe(fd); if(pid==0){ printf ("child1: 1st child\n"); printf ("child1: id %d \n", getpid()); printf ("child1: parent id %d \n", getppid()); int pid2 = fork(); if(p

batch file - Need a script to do a couple simple things -

i'm not @ coding, learn - it's thing don't make money doing this!. i computer repair (mostly malware , virus repairs) , use new program on usb stick leaves reports @ root of customer's system drive regardless of letter drive occupies. (this part automated program , isn't part of batch script) i want copy own icon folder, , copy folder customer's desktop , change folder icon own icon copied in step 1. have done years manually, since i've been using new utility, see possibility of automating process , saving me minute of work. (every minute counts!) i 2 reasons: so customer can see kinds of viruses/malware found , amount of work done in hopes customer go through logs , see things downloaded or accidentally installed , more aware in future. (this never works, @ least i've made effort educate!) this i've got far: (sorry rems, they're there can keep things straight in head) have icon in same directory script run from. rem cop

android create zip file with txt files -

i want create zip file txt files. each txt file string. here code file f = new file("test.zip"); f.mkdirs(); try { zipoutputstream out = new zipoutputstream(new fileoutputstream(f)); out.putnextentry(new zipentry("testfolder/mytext.txt")); byte[] data = stringintxt.tostring().getbytes(); out.write(data, 0, data.length); out.closeentry(); out.close(); } catch (ioexception e) { system.out.println(e.tostring()); } i filenotfoundexception on zipoutputstream out = new zipoutputstream(new fileoutputstream(f)); is proper way create zip file txt files? if so, how fix exception? you must type entire path, including drive letter , filename extension , @ new file("test.zip");

php - Display Image in Laravel 4 -

i trying display image retrieved mysql databases, received image how display on bowser i image in eloquent, show me name of photo in database not real data, go blade , set {{form::open($file, array('files'=> true))}} but show me "ca not display image because contains errors" in controller file write function: public function showimage($id){ $pr = db::table('products')->where('id', $id)->first(); $response['img'] =$pr->img;//blob file $response['type']=$pr->image_type; return view::make('products.show', compact('response')); } and in view file type this: @extends('layouts.default') @section('content') <h1>show</h1> <img src="data:{{$response['type']}};base64,{{$response['img']}}" /> @stop

c++ - Segmentation fault raised from stl_list.h : 731 -

i've got weird segmentation fault code. actually, when run executable, aborts. when run gdb, aborts. when run valgrind, terminates , gives me correct result. that's introduction. here's description of algorithm. want extracting subsurface of mesh looks similar one, given threshold, r . key idea of algorithm looping on each point of mesh (let's say, p ). if find point of reference mesh included in sphere of center p , radius r , don't , go next point. otherwise, delete point , every element of mesh including (which means, edges, , triangles of mesh point belongs). now jump short description of classes. have 4 classes represent elements of mesh : vertex. class includes 2 attributes (i don't mention getters , setters) : position , list, belongsto, contains pointers of edges vertex belongs. edge. class includes 3 attributes : 2 vertices delimiting edge, , list, called belongsto, wichi contains pointers of triangles edge belongs. triangle. class include

I'm trying to import a daily filename_YYYYMMDD from a directory, but cannot get the VBA codes to import the file as a text file into Excel -

sub macro1() dim fs, f object dim strpath string strpath = "filename_" + format(date, "yyyymmdd") set fs = createobject("scripting.filesystemobject") set f = fs.opentextfile(strpath, 1, 0) activesheet.querytables.add(connection:= _ "text;strpath", destination:= _ range("a1")) end sub '-----i'm not sure i'm missing above in vba, obviously, works when point filename manually in macro set-up----------------------------- sub macro1() activesheet.querytables.add(connection:= _ "text;c:\desktop\filename_20140101.txt", destination:= _ range("a1")) end sub ' thanks!!!! it looks though aren't passing strpath connection , missing file extension (.txt), need as: with activesheet.querytables.add(connection:= _ "text;" & strpath, destination:= _ range("a1")) with strpath set full path including extension:

Facebook graph api Topics and Interests -

i know if topics same interests? also whats difference between https://graph.facebook.com/search?type=adtargetingcategory&class=interests&access_token=abcd and https://graph.facebook.com/search?type=adinterest&q=blahblah&class=demographics&access_token=abcd i knwo second 1 gives topics/interests related given keyword. whats first one? thanks regarding second question, first api call returns interests (tipically used build 'browse interests' feature), , second 1 search keyword.

c - Alsa device repeating sound -

when not providing new data buffer playback device, repeats given data buffer. how overcome this? tried snd_pcm_drop , snd_pcm_prepare . didn't helped. in sw params have used, snd_pcm_sw_params_set_start_threshold() - start playback when available frames >= threshold value. , same snd_pcm_sw_params_set_stop_threshold() . any appriciated. i have seen snd_pcm_sw_params_set_silence_threshold() api, dont know helpful in case or not. thanks fantastic post. fixed issue. http://www.spinics.net/linux/fedora/alsa-user/msg09906.html

c# - Export to excel from Gridview with color codes -

Image
i'm using color code based on percentage logic in gridview . while exporting excel dont know how maintain color code in excel . please guide below code rowdatabound protected void grd_qadetails_rowdatabound(object sender, gridviewroweventargs e) { if (e.row.rowtype == datacontrolrowtype.datarow) { var datarowview = e.row.dataitem datarowview; datarow row = datarowview.row; var current = (row["current month percentage"] double?) ?? null; double? yellow = (double?)convert.todouble(row["yellow"]); double? green = (double?)convert.todouble(row["green"]); if (current != null) { if (current >= green) e.row.cells[6].backcolor = color.green; if (current >= yellow && current < green) e.row.cells[6].backcolor = color.yellow; if (current < y

python - How to concatenate the output of several processes into the input of another? -

i'm writing script executes list of processes , concatenates of output input of process. i've condensed script test case using echo , cat stand-ins actual processes. #!/usr/bin/python import os,subprocess (pipeout, pipein) = os.pipe() catprocess = subprocess.popen("/bin/cat", stdin = pipeout) line in ["first line", "last line"]: subprocess.call(["/bin/echo",line], stdout = pipein) os.close(pipein) os.close(pipeout) catprocess.wait() the program works expected, except call catprocess.wait() hangs (presumably because it's still waiting more input). passing close_fds=true popen or call doesn't seem help, either. is there way close catprocesses 's stdin exits gracefully? or there way write program? passing close_fds=true catprocess helps on system. you don't need create pipe explicitly: #!/usr/bin/python subprocess import popen, pipe, call cat = popen("cat", stdin=pipe) line in

visual studio 2013 - Alter properties of specific event "sender" in C++/CLI Windoes Form without switching through them all -

so, have form lot of numeric , down fields, each associated label describes "unity system" of field (like, m/s, ft, hp, , on). made labels clickable, unity system of each field can changed user, appropriate numeric value. ok, cast clicked label data determine witch 1 clicked , calculations have done. done, need change label text, 1 clicked, , anyone.... the ideal case, this: string^ labelname = ... cast ... sender ... -> name (or other property identify sender, tabindex) this ok, can cast sender, identify it, , right thing it. then, have change sender in form, don't know it, need (ideally): this -> labelname -> text = ..... obviously, doesn't work this. can me? there must magical breaking head around problem, , take sleep , think else. after manage solve problem considerably easy. to more specific, in form there many sets of: clikable label containing unity system, numericupdown control value, , hidden textbox multiplier, used conv

c++ - When Checking if( ! node->next ), node->next =0x4 should be NULL -

so writing ternary tree , seg faults after maybe 20 insertions. when isolate problem in gdb odd error have never seen before. on statement of code below, greater node , node should null (or node) when in gdb , check value *tempnode->0x4 causes code attempt set greater (0x4) current node , results in seg fault. if( ! tempnode->greater ) else { tempnode = tempnode->greater; } here gdb output: (gdb) p *tempnode->greater cannot access memory @ address 0x4 been stuck hours, ideas?

javascript - unterminated string literal error in jquery -

the following code inside script tag in php while loop. <?php //while loop starts here { ?> <script type="text/javascript"> $(document).ready(function(){ var url = "<?php echo $cfile;?>"; var mycircleplayer = new circleplayer( '#jquery_jplayer_<?php echo $row_data['id'];?>', { '<?php echo $extension;?>' : url }, { cssselectorancestor: '#cp_container_<?php echo $row_data['id'];?>', swfpath: 'js', wmode: 'window', supplied: '<?php echo $extension;?>' }); }); </script> <?php } // while loop ends here ?> so facing problem in line - var url = "<?php echo $cfile;?>"; where $cfile url. , value this. (but in loop, vary every time.) $cfile= "http://www.domainname.com/foldername/wp-content/uploads/mp3 file name"; so error showing-

javascript - How to increase the background size automatically -

Image
how increase background size automatically when new item added page dynamically. #container1 { background-image: url(wallpapers.jpg); height: auto; } #mid { background-image: url(scripts/white.png); width: 950px; margin-left: 210px; height: 1700px; } html <div id="container1"> <div id="mid">content goes here</div> </div> i unable increase background size beyond height defines if define auto not able increase size automatically when new item added. please in need of college project. thanks in advance waiting replies. the div #container takes height of child element, i.e, #mid, in case has height of 1700px. content overflowing div element(#mid). can either remove height property #mid, or have overflow-y: scroll; .

php - Laravel .htaccess not working -

laravel's default .htaccess file gives error on php cloud server. error: option multiviews not allowed here when remove section below .htaccess home page work other routes gives 404 error. <ifmodule mod_negotiation.c> options -multiviews </ifmodule> original .htaccess file <ifmodule mod_rewrite.c> <ifmodule mod_negotiation.c> options -multiviews </ifmodule> rewriteengine on # redirect trailing slashes... rewriterule ^(.*)/$ /$1 [l,r=301] # handle front controller... rewritecond %{request_filename} !-d rewritecond %{request_filename} !-f rewriterule ^ index.php [l] </ifmodule> based on these google results here , here , think need append/edit: rewritebase / rewriterule ^.*$ - [nc,l] rewriterule ^.*$ index.php [nc,l] so in total: <ifmodule mod_rewrite.c> rewriteengine on rewritebase / # redirect trailing slashes... rewriterule ^(.*)/$ /$1

ruby - Rails html_safe not escaping html -

i have model stores text formatted tinymce. show view calls so <%= @resource.content.html_safe %> and until worked fine (although hear it's better store characters escaped in database, how do that?), stopped working , rendering html. h, raw , html_safe don't work. any idea what's going on? i've looked @ recent changes nothing seems fix it. try this: (cgi::unescapehtml @resource.content).html_safe

python - How to run a script from GEANY (win 7)? -

please me sort out. i have run following script idle (win7): import requests import lxml.html def get_doc(url): try: req = requests.get(url) except requests.exceptions.connectionerror exc: print('a connection error occurred. _____ ', exc) else: return req if __name__ == "__main__": baseurl = 'http://en.modagram.com/' #baseurl = 'http://forum.saransk.ru/' req = get_doc(baseurl) doc_html = req.text print(doc_html) doc_obj = lxml.html.document_fromstring(doc_html) as result, script writes html page. i have run script same geany (win7). result following error message traceback (most recent call last): file "index.py", line 19, in print(doc_html) file "c:\python33\lib\encodings\cp866.py", l return codecs.charmap_encode(input,self.er unicodeencodeerror: 'charmap' codec can't enco 92: character maps please tell me how run scri

jquery - Javascript summarize duplicate and unique enteries of table -

Image
i have table 1 has following data right can up-to 50-100 rows. want summarize information in on summarize button click , want show in other table created on fly according summarized information. don't know how it. i want if code exists more once in output table of sq-in should added up. in above table a1 repeated 3 times sqin added , gives a1 81. right id's of code's textbox #code_0, #code_1,#code_2 , on. sqin #sqin_0, #sqin_1, #sqin_2 , on... <table id="mytable"> <thead> <tr> <th>codes</th> <th>room</th> <th>sqin</th> </tr> </thead> <tbody> <tr> <td><input type="text" value="a1" /></td> <td><input type="text" value="1" /></td> <td><input type="text" value="25"/>

sql - How to use FULL JOIN and compare variance in Ms.Access? -

table_actual +----------+--------+ | product | actual | +----------+--------+ | aaa | 100 | | bbb | 200 | +----------+--------+ table_plan +----------+--------+ | product | plan | +----------+--------+ | aaa | 150 | | ccc | 250 | +----------+--------+ i need following result: +----------+--------+--------+----------+ | product | actual | plan | variance | +----------+--------+--------+----------+ | aaa | 100 | 150 | 50 | | bbb | 200 | 0 | -200 | | ccc | 0 | 250 | 250 | +----------+--------+--------+----------+ my query below: select table_actual.product product, actual, plan, plan - actual variance table_actual left join table_plan on table_actual.product = table_plan.product union select table_plan.product product, actual, plan, plan - actual variance table_actual right join table_plan on table_actual.product = table_plan.product; result: variance value of

multithreading - Reading the results from an infinite loop using threads in python -

i working python v.2.7 on windows 8. my programme using threads. threads execute method named getdata() infinite time following: makes current thread sleep time calls comparevalues() retrieve information comparevalues () , adds them list called mylist the comparevalues() following: generates random number checks if less 5 or if greater or equal 5 , yields result along current thread's name i save results of these threads list named mylist , print mylist . problem : getdata() looping infinite time. how can access mylist retrieving results? approach in case. if remove while true: programm works fine. code : import time random import randrange import threading mylist = [] def getdata(i): while true: print "sleep %d"%i time.sleep(i) data = comparevalues() d in list(data): mylist.append(d) def comparevalues(): number = randrange(10) name = threading.current_thread().name i

visual c++ - Run time of code in open cv? -

i working on open cv.the code written in c++.i want find out time taken program execute.its basic question. there lots of ways (see easily measure elapsed time ). simple approach following: #include <time> void main() { clock_t start_time = clock(); // clock_t end_time = clock(); float time_in_seconds = (end_time-start_time)/(float)clocks_per_sec; }

c# - Windows phone refresh/update listbox items -

i have problem rss feed app. when app launches, listbox gets feeds , show them in listbox, when press refresh button listbox never updates, show same items again, if close app, , relaunch it, show latest feeds. hope there can help. thanks. mainwindow.xaml: <listbox grid.row="1" name="feedlistbox" scrollviewer.verticalscrollbarvisibility="auto" selectionchanged="feedlistbox_selectionchanged"> <listbox.itemtemplate> <datatemplate> ... ... </datatemplate> </listbox.itemtemplate> </listbox> mainwindow.cs: private void appbarrefresh_click(object sender, eventargs e) { feedlistbox.itemssource = null; getfeed(isolatedstoragesettings.applicationsettings["key"].tostring()); } private void getfeed(string rss) { webclient webclient = new webclient(); w

sql - Implementing NULLS FIRST in Amazon Redshift -

i using sum window function row number, similar query - select field_a, sum(1) on (partition field_b order field_c asc rows unbounded preceding) row_number test_table order row_number; the problem if field_c null value, appears @ end. want @ beginning, null value treated smaller other values. in oracle, done providing nulls first argument, not supported in redshift. how implement in redshift ? i want [null] @ beginning, null value treated smaller other values. use expression field_c not null as first order by item. evaluates ... false .. if null true .. if not null. and false (0) sorts before true (1). works data type , possible distribution of values. select field_a, row_number() on (partition field_b order field_c not null, field_c) row_number test_table order row_number;

java - How to delete a file on google drive using Google Drive Android API -

i'm new google drive android api, , i'm learning it. encountered problem cannot delete file using google drive android api, there isn't example of it. can anybood me question? alot. update (april 2015) gdaa has it's own ' trash ' functionality rendering answer below irrelevant. original answer: cheryl mentioned above, can combine these 2 apis. the following code snippet, taken here , shows how can done: first, gain access both googleapiclient , , ...services.drive.drive googleapiclient _gac; com.google.api.services.drive.drive _drvsvc; public void init(mainactivity ctx, string email){ // build gdaa googleapiclient _gac = new googleapiclient.builder(ctx).addapi(com.google.android.gms.drive.drive.api) .addscope(com.google.android.gms.drive.drive.scope_file).setaccountname(email) .addconnectioncallbacks(ctx).addonconnectionfailedlistener(ctx).build(); // build restful (drivesdkv2) service fall delete com.google.api.

c - Producer consumer multiple mutex needed to access critical section? -

there 3 tools. consumer needs 2 tools modify buffer. if consumer takes 2 tools , consumer b takes 1, consumer b have wait tool released. i not sure if i'm thinking problem in right way. way interpret need 3 mutex , consumer has lock 2 out 3, right idea? i don't think should using semaphores because don't want multiple threads accessing shared resource @ same time. in normal producer consumer problem there 1 mutex lock here need 2 of 3 how approach this? yes, can use 3 mutexes, must careful avoid deadlock. so, must establish known order acquire locks: example, acquire lock tool lowest identifier first. in situations these, avoiding deadlock matter of acquiring locks in same order. some pseudo-code: pthread_mutex_t locks[3]; // 1 lock each tool critical_function() { /* acquire 2 tools, t1 , t2 */ first = min(t1, t2); second = max(t1, t2); locks[first].lock(); locks[second].lock(); /* work... */ locks[first].unlock(); locks

sql - Get current week from Access Date/Time Field in QT? -

i need access database items dates during current week. first day of week monday. can't write datepart query. last attempt was: qmodel->setquery("select * timetable (datepart(\"ww\",[playdate])=datepart(\"ww\",date()));"); qt returns -3010 mistake:"[microsoft][driver odbc microsoft access] few parameters. expected 1." know other similar queries year() or #somedate# working. so how can current week items? use single quotes instead of double quotes in sql statement. qmodel->setquery("select * timetable datepart('ww',[playdate])=datepart('ww',date());"); assuming change eliminated error, next add option indicate first day of weeks. qmodel->setquery("select * timetable datepart('ww',[playdate],2)=datepart('ww',date(),2);");

android - Navigation drawer default fragment -

i novice developer , i´m integrating navigation drawer in app android-support v7 , have 1 question. when start app main layout this: <?xml version="1.0" encoding="utf-8"?> <!-- main content view --> <framelayout android:id="@+id/content_frame" android:layout_width="match_parent" android:layout_height="match_parent" /> <!-- navigation drawer --> <listview android:id="@+id/left_drawer" android:layout_width="240dp" android:layout_height="match_parent" android:layout_gravity="start" android:background="@android:color/white" android:choicemode="singlechoice" android:divider="@android:color/transparent" android:dividerheight="0dp" /> and main activity: drawerlist.setonitemclicklistener(new onitemclicklistener() { @override public void onitemclick(adaptervi

product - contao isotope image size etc -

i've got problem regarding image size in productoverview in isotope, when upload image product , watch on page image covering whole page. tried make smaller going : store configuration > galleries thing gets smaller watermark, ignoring productimage... i upload screenshots can't because of whole reputation thingy on stackoverflow. i hope answer soon.

linux - Hadoop's dfshealth page won't show up -

i installed hadoop on linux 10.4 64bit in virtual machine. set configurations , worked fine. dfshealth page showed properly. shut down vm , now, when try open dfshealth page, firefox flashes page, trying show information throws error connection can't stablished. i tried start-all.sh wont work. tried re-running scripts won't work either.

sql - AND clause not working in hive -

i have table idsfortime: epochtime id 1392951600 0 1392952500 15 1392953400 30 1392954300 45 1392955200 60 there table following columns : 15916b 5.1815954385269 1392977820 15965a 7.16797368783744 1392977880 16272b 10.6633890639568 1392977865 16707a 37.6028010736386 1392977785 16730a 9.42097617868767 1392977866 the last column in above table denotes epoch time. i trying find out speeds (column 2 in above table) lie between epochtime of table idsfortime , below table . i using below query : select t.speed idsfortime t1 join staging t t1.epochtime >= t.time , t1.epochtime <= t.time; but, doesnt work. please suggest check out post. merging 2 columns in hive , use between operator i hope resolve issue. keep in mind while trying use between operator on date, format should match dd-mm-yyyy , time should match hh:mm:ss .

jquery - In javascript get the value of dropdown -

i populating values in drop down database. every text have values. want select values using javascript.. my code <%= html.dropdownlist("role", viewdata["role"] selectlist,"select" , new {onchange = "javascript:ddlrolechanged();", id="ddlroles", @class = "dropdownstyle2"})%> javascript code: <script type="text/jscript"> $(document).ready(function () { var tempddval = '<%= session["function"] %>'; $("#ddlroles option:contains(" + tempddval + ")").attr('selected', 'selected'); }); function ddlrolechanged() { debugger; var selectvalue = document.getelementbyid('#ddlroles'); var selectedvalue = $('#ddlroles').val(); window.location = '/home?func=' + selectedvalue.valueof(); }; </script> but selectedvalue showing text values.. how t

layout inflater - How to set and reuse source code on android -

i'm having trouble on developing android apps. want reuse section many other activities. , found "layout inflater". can use that. <relativelayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity" > <!-- header start --> <relativelayout android:id="@+id/header" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_alignparenttop="true" android:padding="5dp" android:background="#fff8f8ff"> <!-- menu button --> <button android:id="@+id/menubtn" android:layout_width="40dp" android:layout_height="

Marker Listener on Map in android -

i developing 1 application in displaying locations current location database location in map using markers, trying add listener current location marker,here listener applied current location other database markers effected listener,it raised exception while clicked on database markers in map,my requirement listener applied current location please verify made mistake in code public class showmapwhenloginactivity extends fragmentactivity implements locationlistener, onmarkerclicklistener{ googlemap _googlemap; latlng myposition; locationmanager locationmanger; private marker mcustomermarker; private double latitude; private double langitude; private string titile = "start"; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_show_map_when_login); _googlemap = ((supportmapfragment) getsupportfragmentmanager().findfragmentbyid(