Posts

Showing posts from August, 2015

Add to end of a single linked list Segmentation fault C -

i'm trying make c application adds elements @ end of single linked list segmentation fault after read last element. i use function addatendsll() add element @ end. //program add elements @ end of single linked list #include <stdio.h> #include <stdlib.h> //basic declaration of sll struct singlelist{ int data; struct singlelist *next; }; //add element @ end of sll int addatendsll(struct singlelist **startptr, int value){ struct singlelist *newnode; newnode = (struct singlelist *)malloc(sizeof(struct singlelist)); if(newnode == null){ printf("\nfailed allocate memory"); return; } newnode->data = value; newnode->next = null; if(*startptr == null){ *startptr = newnode; } else { struct singlelist *temp = null; temp = *startptr; while(temp->next != null){ temp = temp->next; } temp->next = newnode; } } int main() { int

c# - Sendgrid System.ArgumentException: Unknown element: html -

i've update following packages latest version: a) sendgrid.smtpapi updated 1.3.1 b) sendgrid update 6.0 and webtransport.deliver method not there anymore - no problem, i've switched deliverasync method strange error, it's supposed fixed since 2 years ago: system.argumentexception: unknown element: html this part of stack trace can of interest: system.argumentexception: unknown element: html at sendgrid.errorchecker.checkforerrors(httpresponsemessage response, stream stream) at sendgrid.errorchecker.d__0.movenext() --- end of stack trace previous location exception thrown --- at system.runtime.compilerservices.taskawaiter.throwfornonsuccess(task task) at system.runtime.compilerservices.taskawaiter.handlenonsuccessanddebuggernotification(task task) at sendgrid.web.d__0.movenext() --- end of stack trace previous location exception thrown --- @ system.runtime.compilerservices.taskawaiter.throwfornonsucce

php - preg_match: All characters must match -

i have user input gets checked if chars on whitelist. my regular expression: [a-za-z0-9_~\-!@#\s\$%\^&\*\(\)\=\:\;\+\°\´\[\]\{\}\§\"\'\ß\ä\ö\ü\%\.\,\>\<\|\€]+$ my code part: $check = preg_match($pattern, trim($input)); now, when $input variable has example value abc²³ , input gets blocked. when has value abc²³def , content won't blocked. how can check every character of string? you forgot start of string anchor: ^ ^[\p{l}\d_~\-!@#\s$%^&*()=:;+°´\[\]{}§"'%.,><|€]+$ i simplified regex. note replaced a-za-zßäöü \p{l} accept letters language.

c# - Read jpg, edit pixel and save without loss -

i writing program can load jpg file, , edit pixel 0,0 color red , save jpg without loss. it's possible? my program exception on line propertyitem propitem = image1.getpropertyitem(20624); , don't know why. error is: an unhandled exception of type 'system.argumentexception' occurred in system.drawing.dll code image image1 = image.fromfile("1789594.jpg"); bitmap bitmap1 = new bitmap(image1); bitmap1.getpixel(0, 0); color pixelcolor = bitmap1.getpixel(0, 0); console.writeline(pixelcolor.r + " - " + pixelcolor.g + " - " + pixelcolor.b); console.readline(); color redcolor = color.fromargb(255, 0, 0); bitmap1.setpixel(0, 0, redcolor); image1 = (image)bitmap1; // propertyitem image1. because propertyitem not // have public constructor, first need existing propertyitem propertyitem propitem = image1.getpropertyitem(20624); // change id of propertyitem. propitem.id = 20625; // set new propertyitem image1. image1.setpropertyit

php - Simulating a right join in Eloquent -

i have model person belongstomany review objects. this working great, , can query thing successfully. what i'd query person there isn't review associated them. i've tried things like person::with('reviews')->wherenull('reviews.id')->get(); and person::wherehas('reviews', function($q) { $q->wherenull('id'); })->get(); but no success - need person objects have no review objects? this easy normal sql, have lots of other code uses eloquent models, i'd keep using eloquent here. try wheredoesnthave : person::wheredoesnthave('reviews')->get(); from api (4.2) add relationship count condition query. the method illuminate/database/eloquent/builder.php (see code here ): public function wheredoesnthave($relation, closure $callback = null) { return $this->doesnthave($relation, 'and', $callback); } which calls: /** * add relat

scala - How to call a method in a catch clause on an object defined in a try clause? -

i creating redis pubsub client in try-catch block. in try block, client initialised callback forward messages client. if there's problem sending message client, exception thrown, in case need stop redis client. here's code: try { val redisclient = redispubsub( channels = seq(currentuserid.tostring), patterns = seq(), onmessage = (pubsubmessage: pubsubmessage) => { responseobserver.onvalue(pubsubmessage.data) } ) } catch { case e: runtimeexception => // redisclient isn't defined here... redisclient.unsubscribe(currentuserid.tostring) redisclient.stop() messagestreamresult.complete(try(true)) responseobserver.oncompleted() } the problem redis client val isn't defined in catch block because there may have been exception creating it. can't move try-catch block callback because there's no way (that can find) of referring redisclient object within callback ( this doesn't resolve). to solve i'm

python - Defining a custom pandas aggregation function using Cython -

i have big dataframe in pandas 3 columns: 'col1' string, 'col2' , 'col3' numpy.int64 . need groupby , apply custom aggregation function using apply , follows: pd = pandas.read_csv(...) groups = pd.groupby('col1').apply(my_custom_function) each group can seen numpy array 2 integers columns 'col2' , 'col3' . understand doing, can think of each row ('col2','col3') time interval; checking whether there no intervals intersecting. first sort array first column, test whether second column value @ index i smaller first column value @ index + 1 . first question : idea use cython define custom aggregate function. idea? i tried following definition in .pyx file: cimport nump c_np def c_my_custom_function(my_group_df): cdef py_ssize_t l = len(my_group_df.index) if l < 2: return false cdef c_np.int64_t[:, :] temp_array temp_array = my_group_df[['col2','col3']].sort(colu

node.js - Cannot read property 'socket's of undefined when exporting socket.io -

i'm trying modularize application , emit different event client on different js file. sample code below shows event 'onlinestatus' fired led.js. keep on getting message 'type error: cannot read property 'sockets' of undefined' whenever try emit event led.js. suspect wrong when i"m trying export io /bin/www. /bin/www var server = http.createserver(app); var io = require('socket.io').listen(server); var connectedclientsnum = 0; io.sockets.on('connection', function(socket) { console.log("client connected!"); socket.on('disconnect', function() { console.log("client disconnected..."); console.log("total clients connected: " + --connectedclientsnum); }) }); ... module.exports = server; module.exports.io = io; led.js var io = require('../bin/www').io; ... function toggleled(leds, err, callback) { /* toggle led value */ if (leds[0].value == 0) { led

javascript - Text in the shape unconventional -

please sample . i want text "is best team?" within div , align central. nothing comes out of main div. any idea might missing out please? try this: html: <div class="badge"><div id='anotherdiv'>is best team?</div></div> css: .badge { height: 100px; width: 100px; display: table-cell; text-align: center; vertical-align: middle; border-top-right-radius: 100%; background: red; } #anotherdiv { font-size:12px; padding-right:20%; padding-top:15%; }

java - Store the taken picture from ImageView to the phone storage -

Image
after take picture store picture imageview, if has idea or suggestion in how store picture after shown on imageview phone stage without user interaction in advance public class mainactivity extends activity { imageview viewpict; @override protected void oncreate(bundle savedinstancestate) { super.oncreate(savedinstancestate); setcontentview(r.layout.activity_main); viewpict=(imageview) findviewbyid(r.id.pict_result); button btn= (button)findviewbyid(r.id.camera); btn.setonclicklistener(new onclicklistener(){ @override public void onclick(view arg0) { intent intent = new intent (android.provider.mediastore.action_image_capture); // intent intent = new intent (getapplicationcontext(),mainactivity2.class); //startactivity(intent); startactivityforresult(intent,0); } }); } protected void onactivityresult( int requestco

asp.net mvc - Loop through html table using jquery -

how can loop through dynamically created table in mvc using jquery excluding header row. requirement:- have table 2 columns "id" , " name" clicking new can add new rows , type data. when clicking submit need check row contain data typed or not. if filled form submit else alert user fill form. the problem facing is not reading value typed on texbox of table. tried both .text() , .val() edited code <table id="newservice" style="display:none"> <tr> <td><input id="start-%" class="datepicker" style="width:75px" type="text" name="provider_service_dtls[#].activity_start_date" value /></td> <td><input id="type-%" style="width:100px" class="act_type" type="text" name="provider_service_dtls[#].activity_type" readonly value /></td> <td><input id="code-%" class="

java - JFrame doesn't conform JPanel's setMinimunSize() -

Image
i expect jpanel 's setminimumsize() confine resizing of jframe too, doesn't. the following example code: import java.awt.borderlayout; import java.awt.color; import java.awt.dimension; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jsplitpane; public class autoresize{ public static void main(string[] args) { jpanel leftpanel = new jpanel(); jpanel rightpanel = new jpanel(); leftpanel.setbackground(color.red); rightpanel.setbackground(color.blue); leftpanel.setsize(500,400); rightpanel.setsize(500,400); dimension d = new dimension(450,300); leftpanel.setminimumsize(d); rightpanel.setminimumsize(d); jsplitpane split; split = new jsplitpane(jsplitpane.horizontal_split, leftpanel, rightpanel); split.setdividerlocation(400); jframe frame = new jframe(); frame.getcontentpane().setlayout(new borderlayout()); frame.getconte

ide - IntelliJ "Java EE: RESTful Web Services (JAX-RS)" plugin is not available -

i'm trying add restful support intellij idea 14.1.2. according idea's documentation, "java ee: restful web services (jax-rs)" plugin should work, not available in plugins list. i used these instructions: https://www.jetbrains.com/idea/help/preparing-for-rest-development.html does have idea idea? thank you. as found @ intellij website, java ee supported ultimate edition only. used community edition :( now switch project eclipse...

mysql - Python - peewee - Debugging statements - where are the errors logged -

i have started use peewee in python. saving table data using .save() function. there error in line. , control not go next line. just wanted know how can know error is. although have narrowed down line below try: database.transaction(): driver = driver() driver.person = person driver.qualification = form.getvalue('qualification') driver.number = form.getvalue('phone') driver.license = form.getvalue('issu') driver.audited_by = 0 print "this line prints" driver.save() print "this 1 not print" print "success" except: print "error" i have used print statements able figure out error in in line driver.save(). how check error? this specified in peewee documentation here .

unicode - Which Japanese sorting / collation orders are supported by ICU / CLDR / UCA? -

the japanese language, believe, has more 1 sort order equivalent alphabetical order in english. i believe there's @ least 1 based on pronunciation (i think kana have used 2 orders historically) , 1 based on radical + stroke count. chinese has multiple orders 1 based on radical/stroke due unicode han unification same character can have different stroke count chinese , japanese. since believe standard sort order in unicode cldr data uca algorithm, , reference implementation icu . implementations lag behind standards , information proving hard track down canonical sources. if set collator language specifier ja , sort order should expect used? if several available japanese, or planned available @ point, specifiers should used those? example specifier traditional alphabetical order of spanish es-u-co-trad . the basic japanese sort order provided cldr (and therefore icu) based on sort order specified in jis x 4061-1996 : kana sorted gojuuon (五十音) order (with

java - error: cannot find symbol for CompatibilityAssertions -

am trying build project, receives next error. can't deal why. seems written without spell errors. d:\projects\iqpdct\iqpdct-domain\src\test\java\de\iq2dev\domain\datatype\octetst ringdatatypetest.java:5: error: cannot find symbol import org.assertj.core.api.compatibilityassertions; you missing jar on java buildpath. according thrown exception should able find jar here . link points maven repository of assertj-core. after opening link please select proper version of aspectj project.

javascript - Hide unrelated parent nodes but child node in D3.js -

Image
i'm trying thing in d3.js unable find way it. what want is, when person clicks on root node (level 0), should show child elements (level 1). when person clicks on 1 of child nodes (level 1) should show childrens (level 2) , parent , parent-of-parent (level 1, user clicked), hide unrelated parents (from level 1). let me explain pictures. you http://bl.ocks.org/benlyall/4fea200ebebb273aa4df i forked http://bl.ocks.org/mbostock/4339083 , made few changes: added new property each node .all_children keeps track of children. need this, or similar since .children contains child nodes displayed, , ._children used existing code determine if node contains children or not (and sets style accordingly). also added .hidden property helps determine whether or not node should displayed. these added after loading data: d3.json("flare.json", function(error, flare) { root = flare; root.x0 = height / 2; root.y0 = 0; function collapse(d) {

database - Combinations of attributes that can form a key for a relation with functional dependencies? -

i have homework problem supposed do. issue is, tutorials i've read or watched can't seem prepare me solve problem: consider relation r(a,b,c,d,e,f) fd's: cde -> b acd -> f bef -> c b -> d combination of attributes can form key r? i don't know how start. tutorial, told me make table this: left | middle | right ---------------------- ae | bcdf | where "left" refers appearing on left hand side of dependency, , "middle" refers appearing on both left , right hand side. from there supposed find closure of a , e , or ae see closure me abcdef . however, find no such closure. does have tips use on problem, or have better ideas on how approach solving it? "left" attributes should in key. however, since point out closure of ae ae itself, need add more attributes extend ae , make key. let start adding b , i.e., considering abe . closure of abe abde due b -> d . since there still attributes not cove

c++ - Sorting a C-style array -

i'm stuck on 1 part of assignment. i'm not sure c-style array is. when sort normal array, sort function works. however, red squiggly in code try sort c-style array. there i'm doing wrong? appreciate help. in advance. // goal: populate c-style array of 40 million elements random values between // 1 , 4 billion , sort via sort() algorithm. note should use new // operator allocate array. // note: array created/initialized with 40 million elements using new operator. start_time = time(null); // record start time { size_t *a1 = new size_t[forty_million]; (int = 0; < forty_million; ++i) { a1[i] = randomint(engine); } sort(a1.begin(), a1.end()); } end_time = time(null); // record end time total_time = end_time - start_time; // calculate time compute cout << "it took " << static_cast<long>(total_time) << " seconds comput

validation - java parseInt exceptions not being caught -

i'm trying catch exceptions parseint request same response, if string not parse int, performs code under catch. make simple validation loop, asking them try again each time try leave field without having entered valid int. right throw exceptions in system console not return pre-configured error message , run associated code. public static void main(string[] args){ //draw , show gui jframe gui = new jframe(); gui.settitle("new provider interface"); gui.setdefaultcloseoperation(jframe.exit_on_close); final jtextfield textid = new jtextfield("providerid ", 20); final jtextfield textname = new jtextfield("provider name ", 20); focusgrabber fgid = new focusgrabber(textid); gui.add(textid); gui.add(textname); gui.pack(); gui.setvisible(true); } textid.addfocuslistener(new focuslistener(){ @override public void focusgained(focusevent e) {/* */} @override public void focuslost(focusev

apache - Cannot enable GD support for ffmpeg-php extension -

this phpinfo() ffmpeg ffmpeg-php version 0.6.0-svn ffmpeg-php built on apr 25 2015 20:01:27 ffmpeg-php gd support disabled ffmpeg libavcodec version lavc52.72.2 ffmpeg libavformat version lavf52.64.2 ffmpeg swscaler version sws0.11.0 directive local value master value ffmpeg.allow_persistent 0 0 ffmpeg.show_warnings 0 0 gd gd support enabled gd version bundled (2.1.0 compatible) freetype support enabled freetype linkage freetype freetype version 2.3.11 gif read support enabled gif create support enabled jpeg support enabled libjpeg version 6b png support enabled libpng version 1.2.49 wbmp support enabled xpm support enabled libxpm version 30411 xbm support enabled directive local value master value gd.jpeg_ignore_warning 0 0 i need enable gd support ffmpeg. i've tried using ./configure --enable-skip-gd-check , nothing has worked. i've scoured google last 12 hours , tried every "solution" advice appreciated. than

Laravel changing function/text of a button depending on value -

i'm using laravel 5 , have button "enable" once pressed sets flag in db 1. works fine code below: blade view {!! form::open(['url' => '/cms/user/' . $user->id . '/flag', 'method' => 'put']) !!} {!! form::hidden('flagged', !$user->flagged) !!} {!! form::submit('flag', ['class' => 'btn btn-success'])!!} {!! form::close() !!} controller /** * update specified resource in storage. * * @middleware({"auth"}) * * @param int $id * @put ("cms/user/{user}/flag",as="cms.users.update.flag") * @return response */ public function updateflag($id) { $user = user::find($id); //dd(input::get('flagged')); $user->flagged = input::get('flagged'); $user->save(); session

php - How can I limit the amount of array items -

i've got following portion of code: private function get_shortcodes() { $shortcodes = array(); $shortcodes += array_fill_keys( array( 'wpbusdirmanaddlisting', 'businessdirectory-submitlisting' ), array( &$this->controller, 'submit_listing' ) ); $shortcodes += array_fill_keys( array( 'wpbusdirmanmanagelisting', 'businessdirectory-managelistings', 'businessdirectory-manage_listings' ), array( &$this->controller, 'manage_listings' ) ); $shortcodes += array_fill_keys( array( 'wpbusdirmanviewlistings', 'wpbusdirmanmviewlistings', 'businessdirectory-vie

C pipes write/read priority -

i trying understand pipes , use of fork in c. below example of code calls fork() , then: child process: reads pipe , prints content console. parent process: writes in pipe "hello world". int main(void) { pid_t pid; int mypipe[2]; /* create pipe. */ if (pipe(mypipe)) { fprintf(stderr, "pipe failed.\n"); return exit_failure; } /* create child process. */ pid = fork(); if (pid == (pid_t)0) { /* child process. close other end first. */ close(mypipe[1]); read_from_pipe(mypipe[0]);//read pipe , print result console return exit_success; } else if (pid < (pid_t)0) { /* fork failed. */ fprintf(stderr, "fork failed.\n"); return exit_failure; } else { /* parent process. close other end first. */ close(mypipe[0]); write_to_pipe(mypipe[1]);//write "hello world" pipe return exit_success; } } my understanding use pipes , treated files, child process , parent process can communicate.

ruby on rails - How to make sure images uploaded with paperclip have unique names? -

i using paperclip save images. have created image model save them public director class image < activerecord::base has_attached_file :file, :url => "assets/projects_description_images/:style/:basename.:extension", :path => ":rails_root/public/assets/projects_description_images/:style/:basename.:extension" validates_attachment :file, :presence => true, content_type: {content_type: ["image/jpg", "image/jpeg", "image/png", "image/gif"]}, :size => {:in => 0..50.megabytes} end however if add make image name "main.jpg" , create name "main.jpg" when displaying 1 created first shows second one. have no way of knowing exact name used can there duplicates. great if have file name saved like main_(unique_string).jpg any clue how this? the answer provided andrey turki

c# - Unable to reference one class library from another -

i have assignment oop in c# involves me creating base class (in form of class library) , derived class (as class library). realize 2 function need reference base class' .dll in derived class. however, unable generate .dll file base class, error "a project output type of class library cannot started directly". textbook says fix click "build solution" in vs 2013, should make runnable. i've done so, , yet mien still not function. going wrong? "a project output type of class library cannot started directly" this means trying run project marked library, not build it. compile project without trying run it, , create project runnable (e.g. console app, win forms app, etc) , reference current solution new project. alternatively, change type of current project 1 runnable.

html - How to get an image to fit along side my JavaScript application? -

i need getting running way want to, i'm new javascript , webdev in general. want image display next javascript application written turn.js. here html code believe right: <div class="container-fluid"> <div class="row"> <div class="col-md-8"> <img class="img-responsive" src="http://www.bandanaworld.com/20108.jpg" alt="img"></img> </div> <div class="col-md-4"> <div class="t"> <div class="tc rel"> <div class="book" id="book"> <div class="page"><img src="https://raw.github.com/blasten/turn.js/master/demos/magazine/pages/01.jpg" alt="" /></div> <div class="page"><img src="https://raw.github.com/blasten/turn.j

unity3d - Accessing Color Frames with Unity and Tango 'Leibniz' -

i'm starting tinker tango , unity. unfortunately there doesn't seem documentation or examples on how access color data in unity latest release. i've been using motion tracking example github ( https://github.com/googlesamples/tango-examples-unity ) starting point, trying read incoming color frames same way pose , depth data read. i'm assuming best way go through "itangovideooverlay" interface , "ontangoimageavailableeventhandler" callback. all trying right "ontangoimageavailableeventhandler" callback working , can't quite figure out. have "enable video overlay" checked on tango manager , following script connected gui text object debugging. using system.collections; using unityengine; using unityengine.ui; using tango; using system; public class videocontroller : monobehaviour, itangovideooverlay { private tangoapplication m_tangoapplication; private bool debugb = false; public text debugtext; //

apache - .htaccess Too Many Redirects (Combining 404 With Remove www) -

using .htaccess, i'm able remove www site url or i'm able handle 404 redirects nonexistent page on site. however, if try have both, error saying "too many redirects" , site won't load anymore. how can fix can both remove www , have 404 redirects without problems? edit: original post not duplicate. .htaccess code: rewriteengine on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule ^(.*)$ http://%1/$1 [r=301,l] rewritecond %{http_host} ^([a-z.]+)?example\.com$ [nc] rewritecond %{http_host} !^www\. [nc] rewriterule .? http://www.%1example.com%{request_uri} [r=301,l] give following set of rules try: rewriteengine on rewritecond %{http_host} ^www\.(.+)$ [nc] rewriterule . http://%1%{request_uri} [r=301,l] rewritecond %{http_host} ^((?!www\.)[a-z.]+)example\.com$ [nc] rewriterule . http://www.%1example.com%{request_uri} [r=301,l] the redirect loop happens because you're redirecting urls http://www.%1example domain irrespective of whether

php - Wordpress single post not showing content -

my single-posts pages not displaying content. have restored original single.php theme nothing changed. contents of single.php http://pastebin.com/ri6c96ax random post page http://www.crossfitawac.com/onramp-6/ these posts auto-published wodify. i've setup blog-grid page in wod section showing contents of each post, if want see single post website/blog page, contents not showing. looks you've got few issues in single.php file. remove do_shortcode() title- using shortcodes outside of content editor . instead page title displayed using: <?php the_title(); ?> inside while loops, it's looking separate content template file. i'd recommend starting , after working consider moving it's own template. <?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?> <article id="post-<?php the_id(); ?>" <?php post_class(); ?>> <h1 class="entry-title"><?php the_title(); ?></h1>

core data - IOS/Xcode/CoreData: In Modal Controller how to Reference Presenting Controller -

i have modal controller controller2 edits view, created modally controller1. modal controller2 configured in storyboard launched controller1 in following code in viewdidload follows. uibarbuttonitem *editbutton = [[uibarbuttonitem alloc] initwithtitle:@"edit" style:uibarbuttonitemstyleplain target:self action: //next line calls method editview @selector(editview:)]; self.navigationitem.rightbarbuttonitem = editbutton; when dismiss controller2 after saving changes, want change in managedobjectcontext carried on controller1. some examples on suggest using following: [controllertarget setmanagedobjectcontext:[self managedobjectcontext]]; which go in controller2 right before dismissing it. however, trying gives error "no known class method" su

java - Performance difference between arrays, stacks and queues -

what search performance of arrays, stacks , queues? i think arrays quickest , straightforward, because can access element calling using index. correct? performance of stacks , queues? how compare? it depends how search (or search algorithm) implemented. stack or queue may helpful searching application - bfs , dfs . in normal case when using linear search can consider array or arraylist .

php - Array isn't sorting when writing to file -

i wrote script: <?php $file_handle = fopen("info.txt", "rb"); while (!feof($file_handle) ) { $line_of_text = fgets($file_handle); $parts[] = explode('|', $line_of_text); } fclose($file_handle); $a = $parts; function cmp($a,$b){ return strtotime($a[8])<strtotime($b[8])?1:-1; }; uasort($a, 'cmp'); $failas = "dinfo.txt"; $fh = fopen($failas, 'w'); for($i=0; $i<count($a); $i++){ $txt=implode('|', $a[$i]); fwrite($fh, $txt); } fclose($fh); ?> when use: print_r($a); after uasort($a, 'cmp'); then can see sorted array. when write file using these commands: $fh=fopen($failas, 'w'); for($i=0; $i<count($a); $i++){ $txt=implode('|', $a[$i]); fwrite($fh, $txt); } fclose($fh); it shows not sorted information, doing wrong? this should work you: here first file array file() every line 1 array element. there ignore empty lines , new line ch

How does pointer to pointer to function (**ppf)() differ from pointer to function (*pf)() in C? -

i wondering if there difference between int (**ppf)(int) , int (*pf)(int) in c. c has wierd way of treating function pointers function automatically transforms pointer function. allows programmers write wierd stuff. double (*pf)(double) = ***&*&***&*sin; (******&*&*puts)("hello, world!"); this strange , not see how useful. here question(s) pointer pointer function in c. does int (**ppf)(void) have more levels of indirection int (*pf)(void) ? is there case using (**ppf)() superior (*pf)() ? are there differences between them @ all? is possible pointer pointer function in c? yes there difference in between (**ppf)() , (*pf)() . , pointer pointer function exist in c. void f(); void (*pf)() = f // or &f void (**ppf)(e) = &pf; any 1 of following function call can used call function f : using f : f(); ( &f)(); (*f)(); (**f)(); (***f)(); using pf : pf(); (*&pf)(); (*pf)(); (**pf)(); (***pf)(); using pp

javascript - webpack-dev-middleware doesn't hot replace modules -

i tried using webpack-dev-middleware middleware. bundles in memory should , serves js output file, doesn't hot reload when save. any ideas? you'll want use https://www.npmjs.com/package/webpack-hot-middleware or similar.

javascript - Dynamically adding and updating style block -

currently doing this: function newfont(newsizea, newsizeb) { var elem = document.getelementbyid('style-1'); if (typeof(elem) != 'undefined' && elem != null) { removechildnodes(elem); // function removes child nodesremovenode(elem); } var styletext = ".a { font-size:" + newsizea + "px; } .b { font-size:" + newsizeb + "px; }"; var x = document.createelement('style'); x.setattribute("type", "text/css"); x.setattribute("id", "style-1"); if (x.stylesheet) { // ie x.stylesheet.csstext = styletext; } else { // others var textnode = document.createtextnode(styletext); x.appendchild(textnode); } } the point of there loop happening , function measuring size of menu make sure fits in spot when changing font size. i wondering, there better way create , manipulate elements? need change padding ,

multithreading - Visual C++ vectors with class type -

i not know why expected ';' error. here code; made vector pthreadcodes static, still did not work out. idea pls? vector<printstuff*> pthreadcodes; (int = 0; < (unsigned)strlen(str);i++){ printchar pstuff_char(str[i], random_delay_params::min_to_wait, random_delay_params::max_to_wait); pthreadcodes{ &pstuff_char };// here gives expected ';' }

android - my app needs to be shown in list of share with option -

this question has answer here: how make android app appear in share list of specific app 4 answers what need in order app shown in list when user click on share option in of tweeter apps. example, official tweeter app, if user clicks on share tweet option want app shown, can share app. thanks. you need add intent filter manifest file registering app able handle sharing action intent: <activity android:name=".yourawesomeactivity"> <intent-filter android:label="lorem ipsum"> <action android:name="android.intent.action.send" /> <category android:name="android.intent.category.default" /> <data android:mimetype="text/plain" /> </intent-filter> </activity>

java - How do I make a 1D shadow map from an Occlusion Map? Mine becomes white -

i'v been working time in gpu post processing effects game, i'v come issue seems unsolvable, trying achieve top-down directional light. i have generated occlude map scene, , trying create height map shader inspired pixel perfect shadows tutorial libgdx: varying vec2 vtexcoord0; uniform sampler2d u_texture; uniform vec2 ts; // occlusion texture size void main(void) { float dst = 1.0; (float y=0.0; y<ts.y; y+=1.0) { float d = y/ts.y; vec2 coord = vec2(vtexcoord0.x, dst); vec4 data = texture2d(u_texture, coord); if (data.r > 0.0) { dst = min(dst, d); } } gl_fragcolor = vec4(dst); } the input texture sinus wave minimum of 0 , maximum of 100% of texture. (i cannot post pic yet, need more reputation) texture opaque on sine wave(if not flipped after fbo rendered)and transparent there air. the java render code one: public void makeshadowmap() { cam2.settoortho(false, shadowmapfbo.getwidth

android - How to take google maps snapshot without actually displaying the map -

i want able take screenshot of location in google maps without loading google map onto screen, if there way google map can take screenshot in background great. there lite mode : the google maps android api can serve static image 'lite mode' map. a lite mode map bitmap image of map @ specified location , zoom level. lite mode supports of map types (normal, hybrid, satellite, terrain) , subset of functionality supplied full api. lite mode useful when want provide number of maps in stream, or map small support meaningful interaction. example: as xml attribute mapview or mapfragment <fragment xmlns:android="http://schemas.android.com/apk/res/android" xmlns:map="http://schemas.android.com/apk/res-auto" android:name="com.google.android.gms.maps.mapfragment" android:id="@+id/map" android:layout_width="match_parent" android:layout_height="match_parent" map:camerazoom=

amazon web services - Only allow specific user access to s3 folder. make private to everyone else -

i have tried deny overall access, , give specific access provided user happens application. executing put , requests using aws service api. i have tried following, since have deny on users, not let allowed user request though stated in policy. ideally allow access specific group. tried using following , bucket policy wouldn't save stating 'invalid principal in policy - ' arn:aws:iam::222222222222:group/admin i rather server private content on cloudfront , make s3 buckets private. option #2 http://docs.aws.amazon.com/amazoncloudfront/latest/developerguide/privatecontent.html is there better way deny access except specified users? { "sid": "force deny access private folder", "effect": "deny", "principal": { "aws": "*" }, "action": "s3:getobject", "resource": "arn:aws:s3:::bucket/apptest/*" }, { "sid": "allow s3 uplaod , conversi

postgresql - Using Heroku, Rails sort is incorrect on updated_at timestamp column -

Image
i have rails 4.0 app using postgresql on heroku. trying display table xlog or transaction log, showing last 5 entries in reverse order updated_at timestamp. works correctly on local system. when push heroku, sorts incorrectly. i have checked heroku database definitions , column correctly listed timestamp. have cloned heroku code machine , verified same pushed. @ point, don't know why doesn't work on heroku when works locally. , advice appreciated. fwiw, remote database , local database not have same data. the code is: (last line of log_sort added act breakpoint still pass correct result.) def self.last_objects object, count logs = xlog.where(object: object).last(count) log_sort = logs.sort_by{|log| log.updated_at}.reverse log_sort end during execution breakpoint, can see variables passed: this local result correct sort: this heroku result incorrect sort: this heroku postgresql table definition updated_at: edit: view: <%

java - Unable to display nodes of the list properly starting from the tail to head -

my insert method explanation: assigned "next variable" of tail hold address of old node. assigned tail new node inserted list. i tried display list starting tail , going through list until reached head. problem: input displayed c not wanted. display method supposed display c, b, a. i debug code on paper. don't know why display not retrieving last address of nodes linked in linked list. retrieved last node in list , display last node in list. public static void main(string[] args) { linkedlist list = new linkedlist(); list.insert("a"); list.insert("b"); list.insert("c"); list.display(); } public void insert(string data) { link link = new link(data); // code executes first time when list has // no node if(head == null) { head = link; tail= link; } // code execute when linked list has 1 or more node

android - Parse.com - Logging Caught Exceptions -

can send caught errors parse.com bugs dashboard example crashlytics try { mymethodthatthrows(); } catch (exception e) { crashlytics.logexception(e); // handle exception here! } are looking parse crash reporting ?

cassandra - Query all rows with first item of compound partition key only -

i have following column family: create table test."data" ( "itemid" uuid, "dataid" uuid, primary key (("itemid", "dataid")) ) i want rows having "itemsourceid" = someuuid . before, had following schema, , working great obviously: create table test."data" ( "itemid" uuid, "dataid" uuid, primary key (itemid, "dataid") but had lot of performance issues because there many rows specific itemid (several millions). i wondering if following requests allow me results specific itemid or if not possible: select * "data" token("itemid", "dataid") > token(e9e9ebfd-c9aa-11e4-b1a1-b8e85641b1e0, 00000000-0000-0000-0000-000000000000) limit 1000; and replacing 00000000-0000-0000-0000-000000000000 last uuid until there's no result itemid anymore. basic paginating. i results right don't know if i'll of them since i

actionscript 3 - Writing in txt file on AS3 - 1120: Access of undefined property FileMode -

i trying write in .txt file using as3, unfortunately can't compile code. followed several tutorials , couldn't fix problem. if it's possible me. import flash.events.mouseevent; import flash.net.urlloader; import flash.filesystem.file; import flash.net.urlrequest; import flash.filesystem.filestream; stop(); mybutton.addeventlistener(mouseevent.click, loadcomplete); function loadcomplete(event:mouseevent):void { var file:file = file("test.txt") var stream:filestream = new filestream(); //stream.open(file, filemode.write); stream.open(file,filemode.write); stream.writeutfbytes("this text file."); stream.close(); } the error receiving " 1120: access of undefined property filemode. ". sorry bad english. the error shown because doesn't import filemode class. import flash.filesystem.filemode; note : adobe air version supports `file, in knowledge. if want write test.txt file without prompt