Posts

Showing posts from June, 2013

storage - Services or system to store project credentials / passwords / users / information -

i'm trying find service or system can store information of project, (for example web site project), users of cms, ftp, db giving examples. i tried google, different keywords, since english isn't main language haven't been able find something. there several different options storing files , data projects. if want collaborative type environment can share projects (or keep them private) popular option github ( https://github.com ). service has nice set of features pantheon ( https://www.getpantheon.com/ ). hope helps.

eclipse - Java jar creation without configuration files in jar -

i crating runnable jar file eclipse, requirement jar don't have properties file log4j.properties , config.properties when creating jar bellow code jar contains both properties file, so, how can create jar file without properties file? public class hadoopfilecreation1 { public final static logger logger = logger.getlogger(hadoopfilecreation1.class); public string filename = null; static properties prop = new properties(); public static void main(string[] args) { try { system.out.println("---------start------------"); propertyconfigurator.configure("properties/log4j.properties"); hadoopfilecreation1 hfc = new hadoopfilecreation1(); hfc.readproperty(); hfc.writedatfileforhadoop("port", getpropvalues("start_time")); hfc.writedatfileforhadoop("vlan", getpropvalues("start_time")); system.out.println("---

getting choice values from django model -

i have model: class shipclass (models.model): allegience_choices = ( ('fed', 'federation'), ('kge', 'klingon empire'), ('rse', 'romulan star empire') ) origin = models.charfield(max_length=3, choices=allegience_choices, default='fed') classname = models.charfield(max_length=20) numberofcrew = models.integerfield() def __str__(self): return self.classname class meta: unique_together = ("origin", "classname") right now, have in view: def shipclasses(request): qs = models.shipclass.objects.order_by("origin", "numberofcrew") return render_to_response('fleet/templates/ship_classes.html', {'qs' : qs}) origin three-letter code. there way can full text of "origin" field allegience_choices in view instead can show on template? thanks def shipclasses(request): qs = models.shipclass.o

Searching the text in a column using PostgreSQL -

i having table column names no_of_pole , pol_st_typ datatypes integer , character respectively. want check if no_of_pole 2 pol_st_type starts keyword 'double' , if no_of_pole 3 pol_st_type starts keyword 'tripole'. how accomplish using postgresql? select "no_of_pole","pol_st_typ" network."pole_structure" (no_of_pole = '2' , pol_st_typ 'double%') or (no_of_pole = '3' , pol_st_typ 'tri pole%')

python 2.7 - django custom field to_python not called when using .values() -

i have simple, custom pctfield multiplies value 100 or else sets 0.0 if it's null. works fine in code like: class pctfield(models.floatfield): __metaclass__ = models.subfieldbase def __init__(self, *args, **kwargs): kwargs['blank'] = true kwargs['null'] = true super(pctfield, self).__init__(*args, **kwargs) def to_python(self, value): if value none: return 0. return value * 100 class testmodel(models.model): id = models.integerfield(primary_key=true) non_pct = models.floatfield(blank=true, null=true) pct = pctfield() test = testmodel.objects.get(id=18328) print test.non_pct, test.pct # prints 0.900227, 90.0227 test1 = testmodel.objects.filter(id=18328) print test1[0].non_pct, test1[0].pct # prints 0.900227, 90.0227 later on in code trying limit data returned decided start using .values() on result , passing in dynamic list of fields needed. when did this, to_python functi

java - Add button at the bottom of layout and scrollview -

Image
i have activity layout has 2 edittext , 3 buttons. want apply scrollview whole layout. last button should @ bottom of layout; should belong same scrollview other edittext , buttons. this visual description: what have done not allowing third button @ bottom of layout. have keep in mind screen sizes differ, positioning of third button should dynamic enough @ bottom of screen size , belong scrollview well. my layout code: <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" android:layout_alignparentbottom="false" android:layout_centerhorizontal="true" android:layout_centerinparent="false" android:layout_centervertical="true" android:orientation="vertical" android:paddingbottom="@dimen/activity_vertical

java - Call a subclass method from superclass which is not available in another sub class -

i have superclass person , 2 subclasses author , member follows public class author extends person { public author(string fname, string lname, int noofpublications){ ----// set } public string getnoofpub(){ return noofpublications; } } public class member extends person { public member(string fname, string lname, int memberno){ ----// set } public string getmembno(){ return memberno; } } i want access non common methods main class or how can access getnoofpub , getmembno methods superclass person? you can gain access non-common methods checking type of object , casting type of relevant sub-class, that's not you'd want in code of base class. in method of person, can write : public void somemethod () { string id = null; if (this instanceof member) { member member = (member) this; id = member.getmembno (); } } while valid syntax, it's bad practice, since base class shouldn

c# - Storing and retrieving downloaded files -

i have created local folder downloading files using followling code storagefile destinationfile; storagefolder local = windows.storage.applicationdata.current.localfolder; var datafolder = await local.createfolderasync("appdownloads", creationcollisionoption.openifexists); destinationfile = await datafolder.createfileasync(destination, creationcollisionoption.generateuniquename); now need access downloaded files sub folder created. i have tried using: storagefolder local = windows.storage.applicationdata.current.localfolder; istoragefolder datafolder1 = await local.getfolderasync("appdownloads"); ienumerable<istoragefile> files = await local.getfilesasync(); but not working.how downloaded files folder ? thank you.

How to solve PHP array with Json and Javascript -

can me problem ? trying display array retrieve php in html / java form. <?php header("content-type: application/json; charset=utf-8"); require('routeros_api.class.php'); $api = new routeros_api(); $api->debug = true; $api->connect('1.1.1.1', 'admin', '123'); $api->write('/ip/firewall/filter/print'); $read = $api->read(false); $array = $api->parse_response($read); echo json_encode ($array); $api->disconnect(); ?> output [{ ".id":"*6", "chain":"unused-hs-chain", "action":"passthrough", "log":"false", "disabled":"true"}, { ".id":"*5", "chain":"input", "action":"accept", "log":"false", "disabled":"true"}, { ".id":"*2a", "chain":&q

mysql - Should I add the Primary Key to a Secondary index with InnoDB? -

for example have table: | id | name | age | id primary key; this query: select id table age > 12 order id desc is necessary append id index, as: key idx (age, id) or index enough? key idx (age) ps: i'm using innodb storage engine. from docs in innodb, each record in secondary index contains primary key columns row, columns specified secondary index. so no, assuming id primary key table , present on secondary (non-clustered) indexes well, i.e. add age index.

Debugging Java in eclipse error -

i trying debug simple program in eclipse. when run it, program runs expected. when try debug it, program output expected there error error: jdwp unable jni 1.2 environment, jvm->getenv() return code = -2 jdwp exit error agent_error_no_jni_env(183): [util.c:838] i use advantage of debugging mode. want know how tweak error. use system.exit(0); at end of main() method

javascript - Ajax submit after parsley.js validation -

i have form submits through ajax. works fine. however, trying work out how submit if parsley verifies form. the issue form submits if parsley displays issue. how can allow this? <script> $(document).ready(function(){ $('#newslettersubscribe').on('submit',function(e) { $.ajax({ url:'scripts/newsletter.php', data:$(this).serialize(), type:'post', success:function(data){ console.log(data); $("#success").show().fadeout(20000); //=== show success message== }, error:function(data){ $("#error").show().fadeout(20000); //===show error message==== } }); e.preventdefault(); //=== avoid page refresh , fire event "click"=== }); }); </script> you need add parsley validation condition, following: <script> $(document).ready(function(){ $('#newslettersubscribe').on('submit',function(e) { e.preventdefault(); //=== avoid page ref

java - Cannot make a fullscreen Android Presentation on the second screen -

my question android facility utilizing secondary screen of device, i.e. android.app.presentation i'm using wrapper: https://github.com/commonsguy/cwac-presentation unfortunately cannot force second screen layout in fullscreen mode: although width matches screen, height restricted stripe in center of screen, approximately 1/4 of screen height correspondingly, content displayed within narrow boundary, while remaining parts of screen keep staying black , useless for don't have idea api, android.app.presentation special type of dialog shown on secondary screen of device, wrapper i've mentioned above, based on presentationfragment extends dialogfragment . user creates class extending presentationfragment , , in overridden oncreateview() creates layout wishes displayed on second screen. example: public class custompresentationfragment extends presentationfragment { public static custompresentationfragment newinstance(context ctxt,

perl - why can't shift the second value? -

i feel confused little perl script. have passed 2 values routin, however, first 1 works in subroutin. #!usr/bin/perl sub even_number_printer_gen { ( $input1, $input2 ) = @_; #my $input1=shift; #my $input2=shift; print "after shifting, input1 $input1 , input2 $input2\n"; if ( $input1 % 2 ) { $input1++ } if ( $input2 % 2 ) { $input2++ } $rs = sub { #subroutin 1, everytime add 2 in $input1 print "$input1 "; $input1 += 2; }; $rs2 = sub { #subroutin 2, everytime add 3 in $input2 print "$input2 "; $ipnut2 += 3; }; @rs3 = ( $rs, $rs2 ); return @rs3; #return 2 subroutins array } @iterator = &even_number_printer_gen( 31, 20 ); ( $i = 0; $i < 10; $i++ ) { &{ $iterator[0] }; #refer subroutin 1 &{ $iterator[1] }; #refer subroutin 2 print "\n"; } print "done!\n"; the output after shifting, input1 31 , input2

osx - Android emulator timeout error at titanium -

i working on mac , using titanium studio. every time run android emulator following error [error] application installer abnormal process termination. process exit value 1 [error] : emulator failed start in timely manner current timeout set 120000 ms can increase timeout running: titanium config android.emulatorstarttimeout can help? open terminal window use following command: titanium config android.emulatorstarttimeout 0 you let emulator start , unlock screen, when ready launch app.

left join - Oracle Endeca Commerce:- Duplicate properties after joining -

i have 2 data sources 1) atg_data (data source 1) , 2) text record. after joining both sources output not coming desired. for example, there 2 records (present in both sources). both records have these 3 properties definalty have other properties well. item id vendor id ranking(p_commptp) record 1 703595 2560 10 record 2 703595 5638 11 but final record after joining (left join) item id vendor id ranking(p_commptp) record 1 703595 2560 10 record 2 703595 5638 11 record 3 703595 2560 10 11 record 4 703595 5638 10 11 two more records getting created, ranking merged. in pipeline, caching data based on following index. atg data - 1) item number 2) vendor id text file - 1) item number we using left join. i not able understand why 2 more records getting created. doing indexing @ sku level. , these 3 properties doesn't signify

java - How to create a loop which will check if Jtree contains a value from Set <string> and reselects them automatically after a button press? -

how create loop check if jtree contains elements set <string> , reselect them automatically after press of button. i store info this: testnos = (currenttestlabel.gettext() + classlabel.gettext()); myset1.add(testnos); i've been struggling days, , wasn't able find info on or how achieve that. great. you can create method return matching nodes. can iterating on nodes in tree , check if there names matches 1 in set. public java.util.list<treepath> find(defaultmutabletreenode root, set<string> s) { java.util.list<treepath> paths = new arraylist<>(); @suppresswarnings("unchecked") enumeration<defaultmutabletreenode> e = root.depthfirstenumeration(); while (e.hasmoreelements()) { defaultmutabletreenode node = e.nextelement(); if (s.contains(node.tostring())) { paths.add(new treepath(node.getpath())); } } return pa

java - Csv file is empty when I writing content -

i trying write csv file. after execution of code bellow csv file still empty. file in folder .../webapp/resources/ . this dao class: public class userdaoimpl implements userdao { private resource cvsfile; public void setcvsfile(resource cvsfile) { this.cvsfile = cvsfile; } @override public void createuser(user user) { string userpropertiesasstring = user.getid() + "," + user.getname() + "," + user.getsurname() +"\n";; system.out.println(cvsfile.getfilename()); filewriter outputstream = null; try { outputstream = new filewriter(cvsfile.getfile()); outputstream.append(userpropertiesasstring); } catch (ioexception e) { e.printstacktrace(); } { try { outputstream.close(); } catch (ioexception e) { e.printstacktrace(); } } } @override public list<user> getall() { return null; } } this part of beans.xml . <bean id=&q

symfony - Symfony2 deployement with Heroku : Dumping assets -

i'm using heroku deploy symfony2 app default configuration assets not dumped. i have added composer.json : ... "scripts": { "post-install-cmd": [ "incenteev\\parameterhandler\\scripthandler::buildparameters", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::buildbootstrap", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::clearcache", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installassets", "sensio\\bundle\\distributionbundle\\composer\\scripthandler::installrequirementsfile", "php app/console --env=prod assetic:dump" ] }, ... is right way ? in procfile, doesn't work. , : heroku run php app/console --env=prod assetic:dump also doesn't work. thank you, ref : https://devcenter.heroku.com/articles/getting-started-with-symfony2 this works me: "scripts": {

c# - EF ObjectContext updating entity closed context -

i have problems updating entities objectcontext. context closed when update takes place need attach new context , save it. context.attachto(navigation, item); takes 10 seconds works. in generic repository: using (var context = new model(this._connectionstring)) { (int = 0; < objects.count(); i++) { var item = objects[i]; context.attachto(navigation, item); context.objectstatemanager.changeobjectstate(item, system.data.entitystate.modified); } context.savechanges(); } i insert 1 item on specific update. i wonder if there else can make go faster. this: var previous = context.createobjectset<entitymodel>() .where(s => s.id == updateditem.id).firstordefault<entitymodel>(); and save it. if know how gladly accept :) thanks!

python - db model - fields or dictionary of fields -

i'm working on project in django. in models have class object , want add settings object ( object stored in database). i consider 2 options: add every settings attributes class object class members add dictionary settings attributes class object 1 class member how think option better? or maybe have one. you can add model obj new class, , add there thing like. (look @ django class meta) class yourmodel(model): field_one = models.charfield(max_length=50, null=false, blank=false, default="") field_two = models.charfield(max_length=50, null=false, blank=false, default="") class yourmeta: settings_field_one = 'any value..' settings_field_two = 'any value..' and can access like: yourmodel.yourmeta.settings_field_one

Android generic loading animation showing on top of screen -

so have created loading animation view. i'm able show loading view in activity. but want general loading animation can shown on top of screen in app. can call myloadingview.show(); , myloadingview.hide(); control it.. i wonder how can achieve that? currently, it's inside 1 of activity layout: <imageview android:id="@+id/registration_spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_margin="50dp" android:layout_alignparenttop="true" android:layout_centerhorizontal="true" android:background="@drawable/yalo_spinner"/> this spinner drawable: <?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"> <item android:drawable="@drawable/spinner1" a

converter - Can gnuplot convert my temperature data on the fly? -

i have column of numeric data temperature in fahrenheit. how can gnuplot display on y axis celsius? can gnuplot recalculate values me? can plot display temperature nicely in fahrenheit. instead of plot 'temps.dat' using 1:2 i entered plot 'temps.dat' using 1:(($2-32)*.55) and y -axis , values in celsius.

perl csv append column issue -

how should append column @ end of csv file using perl? can't use text::csv i'm using version 5.8.8 , package not installed here. can't upgrade newer perl version. i'm first combining several smaller csv files 1 , need add column final file. have declared handle of final file sub. here's code snippet: my $file = "/tmp/sub_test_".$row.".csv"; # $row in loop..so comes 1,2 etc. open $fh, "<", $file; <$fh> unless $file eq "/tmp/sub_test_1.csv"; print sub while <$fh>; i need add column header "count" , value should $row . is row count want add? this appends ,count first line , ,$. (which line number) rest. then try $ perl -e 'while (<>){chomp;if ($. ==1){print "$_,count\n"} else {print "$_,".($.-1)."\n"}}' your.csv tmp.csv one,two,three 4,5,6 2,3,4 6,7,1 $ perl -e 'while (<>){chomp;if ($. ==1)

c - How to use osmocom tcap-map for parsing the ss7-Map data -

requirement: need parse buffer contains ss7-map data , return required structure basis on type of input data(need parsers ss7-map in c/c++). actions: have installed required modules of osmocom( http://cgit.osmocom.org/libosmo-asn1-map/ ) uses asn files generate parsers ss7-map. stuck: there no usage of using module. don't know how use modules parse buffer. kindly me out... thanks in advance.

jquery - Embedding javascript in <script id="template-download" type="text/x-tmpl"> -

i have following code <script id="template-download" type="text/x-tmpl"> {% (var i=0, file; file=o.files[i]; i++) { %} <tr class="template-download fade <?php if ($userexpired) echo 'restricted' ?> " search-name="{%=file.name%}" search-id="{%=file.id%}"> {% if (file.error) { %} <td class="name"> <span class="delete"><input type="checkbox" name="delete" value="1" class="nomargin"></span> <span >{%=file.name%}</span> </td> <td class="size right"><span>{%=o

javascript - jquery.min.js conflicting with 1.6.2 jquery.min.js from googleapis -

i'm using <script src="js/jquery.min.js"></script> for slider , many other functionalities. i'm using <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script> gallery. everything seems work when add 1.6.2 jquery.min.js googleapis stops everything, including sliders , smooth scrolling. thing working gallery. here's code: <link href="css/bootstrap.css" rel='stylesheet' type='text/css' /> <link rel="stylesheet" type="text/css" href="css/jquery.jscrollpane.css" media="all" /> <script src="js/jquery.min.js"></script> <link href="css/style.css" rel='stylesheet' type='text/css' /> <script type="text/javascript" src="js/move-top.js"></script> <script type="text/javascript" src="js/easi

how to get cell value when row and column index is available in slickgrid -

i trying edit cell value in slickgrid should automatically update row sum column sum forms last row , last column of grid. here using approach index of edited row , column.also know index of row , column of cell row2 & column2, has updated. unable value row2 & column2. in short, how can value of cell row index column index known. grid.getcellnode() , datacontext = grid.getdataitem(row); not working. can me resolve issue plz. thank in advance. you'll need lookup row using grid.getdataitem(row); . given know column index, you'll need access either columns object used initialize grid or access grid instance retrieve columns via getcolumns . together 2 functions provide access data value providing access field property within column definition. field value should correspond individual properties within data object. so should able retrieve data value using: var row = grid.getdataitem(rowindex); var field = grid.getcolumns()[columnindex].field val

visual studio 2010 - WPF Toolkit and Publishing WPF application -

i having problems publishing wpf application references wpftoolkit library. when publish app using clickonce using visual studio 2010 express , run app on remote machine, giving errors "cannot start application". works fine on development environment though. when remove reference wpftoolkit in project, can run on remote machine project needs library run. suggestions? thanks. solution found <grid.background> <imagebrush imagesource="c:\users\server\documents\visual studio 2010\projects\wpfapplicationtest\wpfapplication\images\cool-light-background-vector_edit.jpg" stretch="fill" /> </grid.background> **should be** <grid.background> <imagebrush imagesource="images\cool-light-background-vector_edit.jpg" stretch="fill" /> </grid.background> edited error in log error summary below summary of errors, details of these errors listed later in log. * activation of c:\documents ,

tf idf - Can tfidf be weighed to improve classification of sparse data in a corpus? -

i using tfidf prior performing classification on number of websites based on content. unfortunately, training data not uniform: 70% of pre-labeled websites news sites, while rest (tech, arts, entertainment, etc.) each vast minority. my questions following: is possible adjust tfidf weighs different labels differently , make behave if data uniform? should perhaps using different approach in case? using gaussian naive bayes classifier after tfidf analysis, else better suited in specific case? is possible have tfidf give me list of possible labels when probability given label below threshold? example, if vector entries close enough (< 1-2%) more probable 1 class rather another, can print both?

javascript - Unknown Response Status on Backup Extension Magento -

i getting error(the code) when try backup backup extension mageplace. i setting evertything right is there way address prototype.js file extension ? is error associated js file ? because never changed file since downloaded official prototype website. backup errors unknown response status backup errors [exception... "failure" nsresult: "0x80004005 (ns_error_failure)" location: "js frame :: http://bengar.de/js/prototype/prototype1.6.js :: ajax.request<.request :: line 1421" data: no] backup errors [exception... "failure" nsresult: "0x80004005 (ns_error_failure)" location: "js frame :: http://bengar.de/js/prototype/prototype1.6.js :: ajax.request<.request :: line 1421" data: no] [exception... "failure" nsresult: "0x80004005 (ns_error_failure)" location: "js frame :: http://bengar.de/js/prototype/prototype1.6.js :: ajax.request<.request :: line 1421" data: no] [exce

c# - MVC web api: No 'Access-Control-Allow-Origin' header is present on the requested resource -

i tried written in article: http://www.asp.net/web-api/overview/security/enabling-cross-origin-requests-in-web-api , nothing works. i'm trying data webapi2 (mvc5) use in domain using angularjs. my controller looks this: namespace tapuzwebapi.controllers { [enablecors(origins: "http://local.tapuz.co.il", headers: "*", methods: "*", supportscredentials = true)] [routeprefix("api/homepage")] public class homepagecontroller : apicontroller { [httpget] [route("getmainitems")] //[responsetype(typeof(product))] public list<usp_mobileselecttopsecondaryitemsbycategoryresult> getmainitems() { homepagedalcs dal = new homepagedalcs(); //three product added display data //homepagepromoteditems.value.add(new homepagepromoteditem.value.firstordefault((p) => p.id == id)); list<usp_mobileselecttopsecondaryitemsbycategoryre

PHP & MySQL: fetch images from database -

i have uploaded multiple images , path of images have been stored together. using explode have separated them , wish echo them in carousel code using is: <?php $con=mysqli_connect("localhost","root","","db"); // check connection if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $idd = $_get['id']; echo "<header id='mycarousel' class='carousel slide'>"; /* indicators */ echo"<ol class='carousel-indicators'>"; echo"<li data-target='#mycarousel' data-slide-to='0' ></li>"; echo"<li data-target='#mycarousel' data-slide-to='1'></li>"; echo"<li data-target='#mycarousel' data-slide-to='2'></li>"; echo"</ol>";

c++ - How Do I Use a Variable in new[]'s Value Initialization -

so when new ing array of char s can value initialize: const char* foo = new char[4]{'j', 'o', 'n', '\0'}; what want know how use variable in initializer_list : const string initializer{"jon"}; const char* foo = new char[4]{initializer.c_str()}; // doesn't work, can make work? you can use variable, can't use string , expect compiler magically split up. const char* ip = initializer.c_str(); const char* foo = new char[4]{ip[0], ip[1], ip[2], ip[3]}; once have variable length, though, doesn't work @ all. have allocate , use string::copy fill array in separate step.

Cut string from end to specific char in php -

i know how can cut string in php starting last character -> specific character. lets have following link: www.whatever.com/url/otherurl/2535834 and want 2535834 important note: number can have different length, why want cut out / no matter how many numbers there are. thanks in special case, url, use basename() : echo basename('www.whatever.com/url/otherurl/2535834'); a more general solution preg_replace() , this: <----- delimiter separates search string remaining part of string echo preg_replace('#.*/#', '', $url); the pattern '#.*/#' makes usage of default greediness of pcre regex engine - meaning match many chars possible , therefore consume /abc/123/xyz/ instead of /abc/ when matching pattern.

java - Compare two times in Android -

i know quite discussed topic think have specific problem. i'm storing opening , closing time of stores on database gps coordinates. i'd able show stores on map green marker if store open , red if close (wrt current time). my problem i'm using method string.compareto(string) know if store closed or open. let's on monday, store close @ 02:00 in morning (tuesday morning), current time 23:00. how can tell store still open since 02:00 < 23:00 ? thank answer, arnaud edit: i'm editing answer give better idea of meant. also, try second , re-think way store data structure. important part of programming , in cases can difference between bad design , design implementation. storing time string not idea, in case should (i think) this: (this code assumes hours store opening , closing time refer same day now ) // current time. calendar = calendar.getinstance(); // create opening time. calendar openingtime = calendar.getinstance(); // set opening hou

c - How does Redis Makefile include header file prerequisites -

i teaching myself gnu make , thought @ redis makefile teach me thing or 2 tool. the rule compiles source file object file here : %.o: %.c .make-prerequisites $(redis_cc) -c $< notice suffix rule mentions c source file (with %.c) prerequisite. but if add echo in middle , run make: %.o: %.c .make-prerequisites echo $^ $(redis_cc) -c $< then first few lines of output make below: cd src && make make[1]: entering directory `/home/cltpadmin/code/redis/src' echo adlist.c .make-prerequisites adlist.h zmalloc.h adlist.c .make-prerequisites adlist.h zmalloc.h cc adlist.o how did make know adlist.c depends on adlist.h , zmalloc.h ? the prerequisites in question come line 1 of makefile.dep included makefile (included on line 134). the dep target on line 136 generates file. this common (though entirely avoidable) step using compiler generate necessary header file includes. static method has issues conditional header includes believe. t

java - ListView OnItemClickListener doesn't get fired -

i have set android project navigation drawer , i'm working fragments and activity_main.xml contains following: <android.support.v4.widget.drawerlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/drawer_layout" android:layout_width="match_parent" android:layout_height="match_parent" tools:context=".mainactivity"> <framelayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/fragment_container" android:layout_width="match_parent" android:layout_height="match_parent" android:focusable="false"/> <fragment android:id="@+id/navigation_drawer" android:layout_width="@dimen/navigation_drawer_width" android:layout_height="match_parent" android:layout_gravity="start" android:name="com.wal

c++ - Writing a Default Constructor Forces Zero-Initialization? -

these class definitions: class foo{ int _ent; public: void printent() const{cout << _ent << ' ';} }; class bar{ foo _foo; public: void printent() const{_foo.printent();} }; and test code: char* buf = new char[sizeof(foo) + sizeof(foo) + sizeof(bar)]; fill(buf, buf + sizeof(foo) + sizeof(foo) + sizeof(bar), 'j'); cout << ((int*)buf)[0] << ' ' << ((int*)buf)[1] << ' ' << ((int*)buf)[2] << endl; foo* first = new (buf) foo; foo* second = new (buf + sizeof(foo)) foo(); bar* third = new (buf + sizeof(foo) * 2) bar; first->printent(); second->printent(); third->printent(); my output is: 1246382666 1246382666 1246382666 1246382666 0 1246382666 but if add public default ctor foo : foo() : _ent(0) {} my output becomes: 1246382666 1246382666 1246382666 0 0 0 is correct behavior? should adding own default ctor remove possibility of default initializatio

linux - C++ SFML 2.1 undefined reference to GLEW -

i trying compile this: #include < sfml/graphics.hpp> int main() { sf::renderwindow window(sf::videomode(200, 200), "sfml works!"); sf::circleshape shape(100.f); shape.setfillcolor(sf::color::green); while (window.isopen()) { sf::event event; while (window.pollevent(event)) { if (event.type == sf::event::closed) window.close(); } window.clear(); window.draw(shape); window.display(); } return 0; } clang ++ -c main.cpp works!! clang++ main.o -o sfml-app -lsfml-graphics -lsfml-window -lsfml-system gives me fallowing error: /usr/bin/ld: warning: libglew.so.1.5, needed /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../libsfml-graphics.so, not found (try using -rpath or -rpath-link) /usr/bin/ld: warning: libjpeg.so.62, needed /usr/bin/../lib/gcc/x86_64-linux-gnu/4.8/../../../libsfml-graphics.so, not found (try using -rpath or -rpath-link) /usr/bin

service - Registering Silex Providers Throwing Errors -

creating app in silex , trying take first few steps, 1 of setting services/providers. i loading these using yaml file. have tried registering each individual docs e.g. $this->register( new twigserviceprovider(),array() ); here current bootstrap file(loading services file): <?php namespace app; use igorw\silex\configserviceprovider; use silex\application silex; use symfony\component\routing\route; use symfony\component\routing\routecollection; use symfony\component\httpfoundation\request; class bootstrap extends silex { public function __construct() { $this['debug'] = true; $this->registerdefaultparameters(); $this->registerdefaultservices(); $this->registerroutes(); } protected function registerdefaultparameters() { $paths = isset($this['base_path']) ? $this['base_path'] : array(); if (!isset($paths['base'])) { $paths['base'] = realpa

post value through ajax of uploaded file in php -

we trying post 1 data string through ajax here how looks // if captcha correctly entered! if ($resp->is_valid) { echo $tmpname; ?> <script type="text/javascript"> $(document).ready(function(){ alert("in ready"); var name = "<?php echo $_post['name']; ?>"; var email = "<?php echo $_post['email']; ?>"; var state = "<?php echo $_post['state']; ?>"; var contact = "<?php echo $_post['phone']; ?>"; var message = "<?php echo strtr($_post['message'], array("\r\n" => '<br />', "\r" => '<br />', "\n" => '<br />')); ?>"; // returns successful data submission message when entered information stored in database. var datastring = 'name1='+ na