Posts

Showing posts from January, 2010

html - Making anchor tag 100% height of parent on resize -

i have navigation this: <ul> <li><a href="#">link</a></li> <li><a href="#">link</a></li> <li><a href="#">link</a></li> </ul> and css set as ul {display:table;} li {display:table-cell;} {display:block;} however when resize screen menu shrinks , text breaks on new line. link fine, links still occupy 1 line example padded : 10px 5px; , have parent element empty space. it looks ugly have :hover changes bg color of anchor ... thanks so think problem when first list item multiple lines long, not second list item not vertically aligned first one. way have css set up, list items same height, need add vertical align property centers up. so li css should like: li { display: table-cell; vertical-align: middle; } you can check out codepen here

python - User input with a timeout, in a loop -

i'm trying create looping python function performs task , prompts user response , if user not respond in given time sequence repeat. this loosely based off question: how set time limit on raw_input the task represented some_function() . timeout variable in seconds. have 2 problems following code: the raw_input prompt not timeout after specified time of 4 seconds regardless of whether user prompts or not. when raw_input of 'q' entered (without '' because know typed automatically entered string) function not exit loop. ` import thread import threading time import sleep def raw_input_with_timeout(): prompt = "hello me you're looking for?" timeout = 4 astring = none some_function() timer = threading.timer(timeout, thread.interrupt_main) try: timer.start() astring = raw_input(prompt) except keyboardinterrupt: pass timer.cancel() if astring.lower() != 'q': raw_input...

c++ - Load DLL exported data dynamically -

is there version of getprocaddress exported data? i like: mydll.cpp: mydatatype::mydatatype(long, wchar_t*) { //dummy code this->temp = 3; } __declspec(dllexport) mydatatype here(50, l"random text"); myclient.cpp: int main(void) { hinstance hdata = loadlibrary("mydll.dll"); reinterpret_cast<mydatatype*>(getdataaddress(hdata, "here"))->dosomething(); } that is, define exported data ("here") of udt ("mydatatype"), , them obtain address when dll dynamically loaded. possible? the msdn page says "retrieves address of exported function or variable specified dynamic-link library (dll)." - ie should work(tm)

javascript - Displaying letters and numbers in a grid while respecting a few (mostly sorting) criteria -

i displaying grid of products (items sell on site). the logics of grid item display is: 10 items maximum per row. rows must consist of either numbers or letters (no mix) items must in order (whether numbers or letters). letters @ end of grid. when rows consist of numbers, numbers within same "ten" allowed on same row. example if have numbers 3,1,2,23,15,11, code group these numbers like: [1,2,3], [11, 15], [23]. (then in code display items appropriately in grid, [1,2,3] goes on row 1, [11, 15] on row 2 etc. let's array (category.products, in code) looks like: [{ style_code: '1' },{ style_code: '12' },{ style_code: '2' },{ style_code: '11' },{ style_code: 'd' },{ style_code: 'a' },{ style_code: 'b' },{ style_code: 'cab' },{ style_code: 'caa' },{ style_code: 'f' },{ style_code: 'g' },{ style_code: 'h' },{ style...

ios - Present transparent UIView with opaque UIButton or UIImage -

i trying make transparent uiview when using presentviewcontroller . problem uibutton or uiimageview transparent, how can make them non-transparent? targetviewcontroller = [self.storyboard instantiateviewcontrollerwithidentifier:@"newviewcontroller"]; targetviewcontroller.modalpresentationstyle = uimodalpresentationovercurrentcontext; [self presentviewcontroller:targetviewcontroller animated:yes completion:nil]; result: http://i.stack.imgur.com/yjjbv.png i want uibutton or uiimageview opaque. how can it? instead of using uiview's alpha, using clear backgroundcolor targetviewcontroller.view.backgroundcolor = [uicolor clearcolor];

swift - How to set an action to a part of UILabel? -

Image
i'd set action "part" of uilabel not of uilabel, "term of service" of attached picture. using storyboard. now, i'm thinking cover uibutton on part of uilabel. however, troublesome adjust part of label button @ layout(iphone 5, 6 , 6 plus) autolayout. if know better way, please tell me. thank kindness. i'd recommend using uitextview nsattributedstring . range of text looking for, , add button subview view. nsrange termsofservicerange = [self.termsofusetextview.text rangeofstring:@"terms of service"]; self.termsofusetextview.selectedrange = termsofservicerange; uitextrange *termsofservicetextrange = [self.termsofusetextview selectedtextrange]; cgrect termsofserviceframe = [self.termsofusetextview firstrectforrange:termsofservicetextrange]; cgrect convertedframe = [self.view convertrect:termsofserviceframe fromview:self.termsofusetextview]; uibutton *termsofservicebutton = [[uibutton alloc]initwithframe:convertedframe]; [termsof...

javascript - Catching async errors from eval using domain -

i'm trying catch async errors npm eval module. it's similar normal eval, except utilizes node's vm module directly. i came across node's domain module. allows me catch async errors occur within _eval . however checked documentation , can't find done event domain. how supposed know when resolve promise? var code = [ "settimeout(function () {", " throw new error('async error sim')", "}, 1000)" ].join('\n') var domain = require('domain') var _eval = require('eval') var main = {} var evalasync = main.evalasync = function (code, file) { return new promise(function (resolve, reject) { var d = domain.create(); d.on('error', function (e) { return reject(e) }) var op = d.run(function () { return _eval(code, file, {}, true) }) // return resolve(op) }) } evalasync(code, 'hi.js', {}, true) .catch(function (e) { console.log(e) }) ...

javascript - npm tough-cookie: save a cookie and then dump it -

i want simple task: make http request ( npm install request ) http://google.com , save cookie cookiejar see list of cookies in cookiejar in console verify cookie indeed there dump cookies cookiejar , sort of confirmation it's done (like console.log('no errors') ) having gone through docs tough-cookie , i'm having trouble steps 2 , 3, in 2 shows empty array , 3 throws out typeerror: undefined not function my code below: //npm install request var request = require('request'); //special request puts cookies in cookiejar var cookierequest = request.defaults( { jar : cookiejar } ) //npm install tough-cookie var tough = require('tough-cookie'); //request store api var store = tough.store var cookie = tough.cookie; var cookiejar = new tough.cookiejar(); //load google.com, assume google set cookies in cookiejar cookierequest("http://google.com",function(error, response, body){ if (!error && response.statuscode==200...

normalization - How do i normalise this database? -

i learning database design , having problem grasping different steps of normalisation. can simple ones problem trying solve making me hit brickwall. i creating database records jobs created user initiating transfer of files 1 ftp host another. each ftp host can have multiple folders available shared. these attributes have come - job id date created source host id source folder id destination host id destination folder id frequency start date finish date status comments user id first name last name password user access level ftp host id location name status folder id folder location folder access level file id file name file size file date created file date modified i know @ least have job, ftp host, folders, files , users tables. cannot seem work out how normalise it, due having source , destination host id/folders being same host id/folders. show me in 1nf/2nf/3nf? appreciate it!

android - SQLite - add new itens to result -

i'm using cordova sqlite storage plugin in application android. need result 2 tables display in view, tables "posts" , "metas"... so can publish 'products' (posts table) , informations price , color save in metas table. problem when need show metas products, need list , after information table metas, need add metas in principal result (from first query). actually returned results.rows.item(i).id results.rows.item(i).title results.rows.item(i).date and want add others items this results.rows.item(i).id results.rows.item(i).title results.rows.item(i).date results.rows.item(i).price results.rows.item(i).color but don't know how this, can me? this functions... function query( sql, callback ){ db.transaction(function(transaction) { var executequery = sql; transaction.executesql(executequery, [ ], function(tx, result) { //success if( typeof( callback...

Sorting an array of structs in C -

we given assignment in class, sort array of structs. after assignment handed in discussed doing sorting using pointers of arrays sort more efficient way people had done it. i decided try , way well, i'm running issues haven't been able solve. http://pastebin.com/cs3y39yu #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <sys/stat.h> typedef struct stage2{//standard dec of struct field char need; double ring; char fight[8]; int32_t uncle; char game; double war; int8_t train; uint32_t beds; float crook; int32_t feast; int32_t rabbits; int32_t chin; int8_t ground; char veil; uint32_t flowers; int8_t adjustment; int16_t pets; } stage2; void usage(){//usage method handle areas fprintf(stderr,"file not found\n");//prints stderr exit(1);//exits program } int ...

Update a nested array objects in a different collection and position in MongoDB -

i have douments follows. how update skillcluster name. suppose other document has name :"c" in 4th position. { job: { post: { name:"x" } skill: { skillcluster: [ {name:"c++",id:"23"}, {name:"c",id:"898"} ] } } } { job: { post: { name:"x" } skill: { skillcluster: [ {name:"c++",id:"23"}, {name:"java"}, {name:"python"}, {name:"c",id:"898"} ] } } } you need query match "name" field @ embedded level of document using "dot notation" , , pass match positional $ operator within update: db.collection.update( { "job.skill.skillcluster.name": "c" }, { "$set": { "job.skill.skillcluster.$.name": "simple c"}}, { "multi": true } ) also use "multi" f...

c# - Token based authentication in web api -

i developing web api service consumed asp.net mvc web application , mobile apps (android , ios). database , web api hosted on same server. want implement authentication web api (token based). database has table storing user credentials. have use database validate credentials when user logs in. came across few articles suggest owin , identity server. confused on how proceed , need in understanding better approach. you can implement token base authentication when user login system send random token code cash in client side when client side making request server send token request header validate token , accept request or reject simple way :)

How to concatenate columns row wise in excel file? -

i trying concatenate content of 2 different columns row wise not getting way can single formula/condition. name surname b c d e f ............. and want display: b c d e f ..... i know formula concatenate =concatenate(a1," ",b1). know can individual rows. there way can rows simultaneously single formula dependoing on number of rows? i use macro that, macro works selected text, can change suit solution: sub append_text() 'add right text left text each c in selection if c.value <> "" c.offset(0,2).value = c.value & c.offset(0,1).value next end sub you select left side values , run macro, idea assign shortcut macro speed process. let me know if work you.

MAGENTO: Upgrade CONNECT ERROR -

i need help. how can solve issue, trying upgrade magento new version. connect error: package community/mage_core_adminhtml 1.9.2.1 conflicts with: community/mage_all_latest 1.9.0.1, community/mage_compiler 1.9.0.1 here few things in case of conflict during upgrade: empty /var folder , make sure writable , try upgrading again if fails, install fresh version of magento (later version) , copy custom files in newly created instance

sql - Oracle: ORA-00955: name is already used by an existing object -

i tried create table: create table departments ( departments_id number primary key, departments_name varchar2(30), departments_block_number number ); but got error: create table departments * error @ line 1: ora-00955: name used existing object this error occurs when try create new object name used other object in schema. select * all_objects object_name = upper('departments') , owner = upper('your_schema') now can see object created in schema name departments you can resolve issue renaming table or drop existing object if no more in use .

ios - Unable to add the SKNode image buttons inside a scrollable layout in Swift spritekit -

hi i'm totally new swift , spritekit , having trouble setting buttons sample below inside scrollable view or layout (if there such thing in spritekit). have experience in android development , want know if there way add sknode buttons inside scrollable android's scrollview? want add sknodes vertically in scrollable. example, how set sklabels or sknode images scollable ? sorry poor english. scorelabel.fontsize = 15 scorelabel.position = cgpoint(x: self.size.width * 0.5 , y: (self.size.height * 0.5) + 100) scorelabel.zposition = 2 scorelabel.fontcolor = uicolor.whitecolor() //titlelabel.color = uicolor.blackcolor() self.addchild(scorelabel) startlabel.name = "hard" startlabel.text = "hard" startlabel.fontsize = 30 startlabel.position = cgpoint(x: self.size.width * 0.5, y: 300) startlabel.zposition = 2 startlabel.fontcolor = uicolor.whitecolor() self.addchild(startlabel) startlabel2.name = "previousbutton" startlabel2.text = "...

css - can bootstrap tabs show code? -

Image
i want use bootstrap panels , tabs show image , on tab show code. how can this? writing in haml. proper way use pre , code tags? when code in html executes form, want show code use on how it. thanks .col-md-4 .panel.panel-default .panel-body .container %ul.nav.nav-tabs %li.active %a{:href => "#home"} preview %li %a{:href => "#menu1"} html %li %a{:href => "#menu2"} haml .tab-content #home.tab-pane.fade.in.active .col-md-3 %img{:alt => "forms", :src => image_path('form.png'), :style => 'width: 100%; height: auto;'} #menu1.tab-pane.fade %h3 html %pre %code %p <div class="section section-form"> ...

android - Read each of elements in XML file when clicking on an item in popup menu -

i have xml file below: <?xml version="1.0" encoding="utf-8"?> <engine> <engine1 engine1="engine1"> <cylinder cylinder="cylinder1" bp="0.01" p="0.02" t="0.04" ></cylinder> <cylinder cylinder="cylinder2" bp="0.01" p="0.02" t="0.04" ></cylinder> <cylinder cylinder="cylinder3" bp="0.01" p="0.02" t="0.04" ></cylinder> </engine1> <engine2 engine2="engine2"> <cylinder cylinder="cylinder1" bp="0.01" p="0.02" t="0.04" ></cylinder> <cylinder cylinder="cylinder2" bp="0.01" p="0.02" t="0.04" ></cylinder> <cylinder cylinder="cylinder3" bp="0.01" p="0.02" t="0.04" ></cylinder> </e...

java - Why does servletContext.getRealPath returns null on tomcat 8? -

Image
i have following code line: servletcontext.getrealpath("resources/images/video_icon.png") wen run application using jetty(using maven plugin) code line return corect value. when run application using tomcat 8(on tomcat 7 works) - application returns null. application structure: 1.how fix it? 2.why happen? after adding / in path beginning works in both: jetty , tomcat 8 servletcontext.getrealpath("/resources/images/video_icon.png")

javascript - jQuery: Accessing Elements after adding them with Append -

this question has answer here: event binding on dynamically created elements? 19 answers i append input in div: $("#menuitems").append("<input type='button' id='"+$("#category").val()+"' class='menuitemdelete' value="+$("#category :selected").text()+" ><br>"); then want access element class name not give responce. try this: $(".menuitemdelete").click(function(){ alert("abc"); }); and try this: $(".menuitemdelete").on("click", function(){ alert("abc"); }); how can access ? try : $("#menuitems").on("click",'.menuitemdelete', function(){ alert("abc"); }); consider read event delegation concept dynamic element created yours.

objective c - How to put UICollectionView and button in UIPageControl in ios? -

Image
this collectionview when swipe scrolls, i have putted uicollectionview , button in uipagecontrol, when swipe uicollectionview scrolling, , button view not scrolling smoothly works normal uipagecontrol i'm not sure think has catransitions try changing last piece of method use uiview animations instead of catransitions : if(pagecontrol.currentpage==pagecontrol.numberofpages-1) { [uiview animatewithduration:0.2 animations:^{ dayradialcollection.alpha = 0.0f; addweek.alpha = 1.0f; removeweek.alpha = 1.0f; } completion:^(bool finished) { }]; } else { [uiview animatewithduration:0.2 animations:^{ dayradialcollection.alpha = 1.0f; addweek.alpha = 0.0f; removeweek.alpha = 0.0f; } completion:^(bool finished) ...

iOS: Can a UIView know that the layout process for it has completed? -

when using auto layout , view's size unknown when initialised, brings problem me. when using uiimageview , wrote category can load image own cdn setting image url uiimageview , cdn stores 1 image different sizes difference devices can load size needs. i want make uiimageview able load url resolution needs, when uiimageview url, size of not yet determined auto layout . so there way uiview know layout process has finished first time? there method uiview.you override it. -(void)layoutsubviews { cgrect bounds =self.bounds; //build imageview's frame here self.imageview=imageviewframe. }

ios - Xcode 7 Beta 5, UITableViewCells subviews are clipped out of ContentView -

Image
i've been having issues uitableviewcells few others have been (from can see on stackoverflow), , i've followed fixes suggested in other threads, i've issue refuses rectified in similar questions. i've attached screenshot of issue below, subviews being resized , having coordinates located out of contentview of uitableviewcell , when view debugger can see being clipped out when turn on show clipped content . any ideas? i've tried redoing of constraints, i've tried rebuilding entire uiview nothing rectifies issue. views not shown labels (shown below clipped "l", "0" , "5"). screenshot of view hierarchy screenshot iphone i resolved replacing storyboard constraints programmatic constraints. seems did not want recognise storyboard ones reason.

php - laravel5 composer install error zend guar loader -

i try install laravel 5.1: php composer create-project laravel/laravel --prefer-dist and have got this: error output: zend guard loader requires zend engine api version 220090626. zend engine api version 220121212 installed, newer. contact zend technologies @ http://www.zend.com/ later version of ze nd guard loader. this issue due value set within php.ini file, searching wrong version number. check these values pointing right version of zend, or disable zend guard loader (the later not best).. hope fixes issue you.

jquery - bootstrap modal send multiple ajax request includes previous successfull ajax calls -

my code $("#lead-list .selectboxit").on("change", function() { var st = $( ).val(); var eid = $(this).attr("id"); var id_ar = eid.split("-"); if(st) { $(".modal-body").html("<p>are sure change status of records?</p>"); $('#modal-1').modal('show'); $("#modal-1 .confirm-continue").click(function(event){ $('#modal-1').modal('hide'); jquery.ajax({ type: "post", url: 'ajax-listing-lead-process.php', data: {val: st,id: id_ar[1], action:'update'}, datatype: 'html', success: function (data) { if(data) alert(data); } }); }); } }); i've many select dropdown id status-1, status-2, status-3,...etc . if ch...

(Lucene/SOLR) Can I annotate the results of a query based on grouping by subqueries? -

i group results of query in terms of "categories". "categories" keyword queries, cannot pre-defined @ index time, since evolve , change on time. more specifically: i have set of categories defined queries q1,q2,...qn . given user query ( q ), need return top resulting docs ( d1,...d10 ) usual, but need know if belong or not each of groups q1,...qn . as understand i use grouping queries , has 2 drawbacks: i change results, since instead of d1,...d10 top docs each query i loose original ordering of results the solution can think of right issue first q results , ordering, each of q , q1 , q , q2 , etc. grouping, parse results , group outside query... expensive! any ideas how can need? you can use normal way query, , add pseudo-fields in fl param matches clipping against categories using function queries. http://solr.pl/en/2011/11/22/solr-4-0-new-fl-parameter-functionalities-first-look/ https://cwiki.apache.org/confluence/display/s...

ruby on rails - Simple form_for in the root page -

i "simple form" in root page in order update field in table. <%= bootstrap_form_for @user |f| %> <%= f.text_field :trig, label: "your trigram", :required => true %> <%= f.submit :class => 'btn btn-primary btn-lg btn-block'%> <% end %> my route : root 'static_pages#cvpage' put '/' => 'users#update' in users controller : def update @user = user.find(current_user.id) @user.update_attributes(user_params) if @user.save redirect_to cvsindex_path end end def user_params params.require(:users).permit(:trig) end but doesn't work. app goes blank page /users/6 have idea? you need change <%= bootstrap_form_for @user |f| %> <%= bootstrap_form_for @user, :url => '/', :method => 'put' |f| %> your resources :users should come after put '/' => 'users#update' <%= form_for @user %> make pat...

Dropdown menu in Durandal 2.0 -

Image
i trying make multilevel menu. menu should contain both 1 level, in section 2 levels, , 3 levels. sections can not placed in row. example menu: i wrote google's group durandaljs, nobody explained doing wrong. found example not work. appeal people understand such things: 1. how should organize logic of menu. 2. how bind data view 3. need use childrouter this? i hope help. ok, answer modification of previous routing answer allowing time multiple levels (question 3 levels i'll provide general answer number of levels). model as in previous answer, i'll not use durandal child routers (reason stated in description of linked earlier answer). instead provide own way of defining "embedded" routes. let's assume having following model var model = [ { route: '', moduleid: 'viewmodels/home', title: 'validation test', nav: tr...

c# - IAsyncCursor v/s IAsyncCursorSource -

during working tolistasync() in mongodb driver 2.0.1, have observed 2 different documentations it. iasynccursorsourceextensions iasynccursorextensions what difference between these two. mongodriver using c# having iasynccursorsource.

httpclient - MultipartEntity Android always return server error -

i have 2 days facing problem sending multipart form request include data , images, , server give me error "unsupported media type" i have tried 3 version of apache httpclient (4.1, 4.3, 4.5) here code multipartentitybuilder multipartentity = multipartentitybuilder.create(); multipartentity.addtextbody("categoryid", string.valueof(categoryid), contenttype.text_plain); multipartentity.addbinarybody("primaryimage", primaryimage, contenttype.create("image/jpeg") , "test.jpg"); i have added following headers request.setheader("accept", "application/json"); request.setheader("content-disposition","form-data"); request.setheader("content-type","multipart/form-data"); request.setheader("enctype", "multipart/form-data"); i using post request digest authentication when print content of multipart form request found following data --2gj-9i6ivydt_6we0...

Is the 'Reveal transition' effect from Activity 1 to Activity 2 on Pre Lollipop possible? -

reveal transition this ques 1: possible have above kind of screen transition on pre lollipop versions? ques2: can me achieve animation through sample code or example?

laravel 4 - Querying entities with nested many to many relations -

i have problem since started using laravel. when want have entity doesn't have nested relation, life of me , countless hours, couldn't through eloquent has() method. through fluent , left joins. lets there 3 models 1 pivot (user_persona) carries ids of related models; example | user | | persona | | category | ----------- -------------- --------------- | user_id | -m-m- | persona_id | -o-m- | category_id | ----------- -------------- | persona_id | --------------- relationships user function personas() { return $this->belongstomany('persona', 'user_persona', 'user_id', 'persona_id'); } persona function categories() { return $this->hasmany('category', 'persona_id'); } problem now 1 can user persona category through: user::has('personas.categories', '>=', 1, 'and', function ($q) use ($...

openssl - PHP openssl_pkcs7_verify returns true on invalid certificate -

i'm trying verify s/mime message signature using openssl_pkcs7_verify(). with 'transport testing tool' http://transport-testing.nist.gov/ttt/ i'm sending sample s/mime messages address , after succesfull decoding, try verify it's signature. when certificate correct, success, success when certificate invalid. how can verify correctly php or openssl command? <?php # cert $bres = openssl_pkcs7_verify('decoded_1.txt', 0, 0, array('nist.gov.pem', 'sampleca.nist.gov.pem')); $berr = openssl_error_string(); var_dump($bres, $berr); # returns true, false # invalid cert $bres = openssl_pkcs7_verify('decoded_2.txt', 0, 0, array('nist.gov.pem', 'sampleca.nist.gov.pem')); $berr = openssl_error_string(); var_dump($bres, $berr); # returns true, false source files notice ccda_inpatient.xml in thers files same, smime.p7s differs.

ios - How to call a swift view controller in objective c? -

i have objective c controller, want call controller swift controller objc controller? apparently it's quite easy . you have first make sure you're prepending class declaration @objc it's available objective-c ones. for example: import foundation // belongs target 'testproject' @objc class swiftcontroller: uiviewcontroller { //... truncated } now have import name of target (that swift controller belongs to), appended '-swift.h' —exposing interface—like so: #import "testproject-swift.h"

jquery - cannot callback data from $.post -

this question has answer here: how return response asynchronous call? 24 answers i'm cannot return data $.post function() pls help refer url : data post request test = { getdata : function (callback){ $.post("getdata.php",{data: data},function(data){ callback(data); } } } var data = test.getdata(callback); console.log(data); ** typeerror : callback not function thank you the callback think not keyword or default argument. reference of function executed after ajax call performed. haven't declared what's callback . have like: function callback (data) { // data } you can define callback way: var callback = function (data) { // data }

kineticjs - Continuous hatch line needed in canvas with repeated pattern -

Image
i trying build hatch pattern using combination of canvas , kinetic , having issues trying continuous line. this jsfiddle shows have far, because repeat pattern sqaure corners affecting line, have tried using linejoin , linecap properties, cannot seem desired result. the main code in question this: var hatchpattern = document.getelementbyid("canvas") var context = hatchpattern.getcontext('2d'); context.strokestyle = "#ff0000"; context.beginpath(); context.moveto(0, 20); context.lineto(20, 0); context.linewidth = 5; context.stroke(); context.closepath(); can help? update: i have created jsfiddle although not perfect, me, still not sure why there slight gap though! to create diagonal lines covering canvas, can create pattern this: you must fill top-left & bottom-right corner triangle. when repeated in pattern, these triangles fill in beveled corners caused center line coming point @ top-right & bottom-left then createpat...

c preprocessor - Can #define be used to replace type declaration in c? -

i came across question #define used replace 'int' in program follows #define type int int main() { type *a,b; } is valid?although gave me error while tried print size of variable b saying b undeclared. want know specific reason behind this. please let me know. some users told me have hidden part of code. had not given printf statement in above code snippet. below code printf nd 1 gives error #define type int; int main() { type* a, b; printf("%d",sizeof(b)); } yes, can used, keep in mind, there significant difference between macro , type defintion. preprocessor replaces "mechanically" each occurence of token, while typedef defines true type synonym, latter considered recommended way. here simple example illustrate means in practice: #define type_int_ptr int* typedef int *int_ptr; int main(void) { type_int_ptr p1 = 0, p2 = 0; int_ptr p3, p4; p3 = p1; p4 = p2; // error: assignment makes pointer integer without cas...

timezone - How to convert date and time from one time zone to another in when GMT format is given in android -

i have particular date , time of +10:00 gmt (australia/melbourne)which coming google api in following format :- 2015-05-12t14:00:00.000+10:00 now, want convert above time according device current time zone. for example :- the above time in +5:30 gmt (india) should 2015-05-12 9:30:00 how can achieve ? my below code :- simpledateformat sourceformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); sourceformat.settimezone(timezone.gettimezone("gmt")); date parsed = null; try { parsed = sourceformat.parse("2015-05-12 14:00:00"); } catch (parseexception e1) { // todo auto-generated catch block e1.printstacktrace(); } // => date in utc timezone tz = timezone.gettimezone(timezone.getdefault().getid()); simpledateformat destformat = new simpledateformat("yyyy-mm-dd hh:mm:ss"); destformat.settimezone(tz); string result = destformat.format(parsed); system.out.println...

java - Keep image on image view place -

i have 1 fragment , 1 activity.. in layout have 1 image view , 1 button. wrote coding pick image galley cant place image on imageview.. dont konw how do. please 1 fix issue. my code here: profilefragment.java public class profilefragment extends fragment { private imageview imageview; private static final int select_photo = 1; button browseprofilepic; @override public view oncreateview(layoutinflater inflater, viewgroup container, bundle savedinstancestate) { sethasoptionsmenu(true);//for option menu view view = inflater.inflate(r.layout.fragment_layout_profilepic, container, false); imageview = (imageview)view.findviewbyid(r.id.profile_image); browseprofilepic = (button) view.findviewbyid(r.id.btn_pick); browseprofilepic.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { intent intent = n...

uiview - Swift colorWithAlphaComponent() not working -

hi using simple view draw path semi transparent yellow color not working. let tyellow = uicolor.yellowcolor().colorwithalphacomponent(0.5) hi there view has property called var opaque = true you must set false see transparency @ uiview

charts - Google barchart tooltip no tail -

im using google barchart , added tooltips html in it. problem tooltip not have tail arrow thing. saw charts has arrow while others dont? function drawfrequencycharts(response) { var data2 = new google.visualization.datatable(); data2.addcolumn('number', 'value'); data2.addcolumn('number', 'value'); data2.addcolumn({'type': 'string', 'role': 'tooltip', 'p': {'html': true}}); .... code var view = new google.visualization.dataview(data2); var chart2 = new google.visualization.combochart(document.getelementbyid('barchart')); var options2 = { height: 300, width: 500, series: { 0: { type: 'bars' }, 1: { type: 'line', color: 'grey', linewidth: 0, pointsize: 0, visibleinlegend: false } }, colors: ['#3394d1'], backgroundcolor: { ...

sql join with default parameter -

assume have table called t_employee has name column , company_id column. have stored procedure can list employees or company, create procedure p_listemployees( @companyid integer = null) in procedure, rather saying if @companyid null ..... rather have join deal fact may or may not filtering. sure time ago have seen done using coalesc. any thoughts? from t_employee e left join company c on coalesce(c.company_id,1) = coalesce(e.company_id,1)

c# - Consulo IDE + ASP.NET -

i have found consulo ide project here - https://github.com/consulo , fascinated amount of work done there. c# projects working fine both mono , .net core. unfortunately, cannot make web projects. have manually installed asp.net plugin https://github.com/consulo/consulo-aspnet (copied aspnet.jar plugins/aspnet/lib), yet not starts support .aspx extensions. does know how make asp.net work consulo? thanks.

java - Gradle compiling android.jar error -> It is recommended that the compiler be upgraded -

i'm compiling gradlew assemblerelease in linux server console (no visual interface available). when compiling error shown lot of times: err:it recommended compiler upgraded. err:warning: /users/mo/documents/android-sdk/platforms/android-22/android.jar(android/text/spannablestring.class): major version 51 newer 50, highest major version supported compiler. it means must update java installed on server? how can done command line in linux machine? thanks afaik major version means java version. java 7 51, java 6 50. code written java 7, guess? make error go away, suppose should following: update java 7 system package manager (you may wanna here , here idea how it). in general, need perform yum install java-1.7.*-openjdk newer version, in cases things bit more difficult. didn't tell linux using, so.. add build.gradle : compileoptions { sourcecompatibility javaversion.version_1_7 targetcompatibility javaversion.version_1_7 } and make sure $...

cocoa - applicationDidBecomeActive from dock vs open document? -

when receive applicationdidbecomeactive, there way tell if because document double clicked in finder (or drug app icon), vs having clicked on dock icon or selected app cmd-tab? i need know if applicationdidbecomeactive associated opendocument event.

android - How to differentiate value of array with two object with same key in java -

i implementing android app. have google spreadsheet 100 rows , 2 columns. fetching record of google spreadsheet in app. got json response : json response { "version": "0.6", "reqid": "0", "status": "ok", "sig": "862971983", "table": { "cols": [ { "id": "a", "label": "name", "type": "string" }, { "id": "b", "label": "phoneno", "type": "number", "pattern": "general" } ], "rows": [ { "c": [ { "v": "a anil c agrawal" }, { "v...

python 2.7 - Align control to bottom of panel in wxPython -

i'm trying align controls in wxpython app bottom of panel. here's sample of code: def __dolayout(self): vsizer = wx.boxsizer(wx.vertical) hsizer = wx.boxsizer(wx.horizontal) hsizer2 = wx.boxsizer(wx.horizontal) hsizer.add(self.prog, 0, wx.all|wx.expand, 5) hsizer2.add(self.text, 0, wx.all|wx.expand, 5) #hsizer.add(self.timer, 0, wx.expand|wx.align_right) vsizer.add(hsizer2, 0, wx.expand) vsizer.add(hsizer, 0, wx.align_bottom|wx.expand) self.setsizer(vsizer) i bottom horizontal sizer (hsizer) stretch bottom, or top 1 stretch placing bottom sizer on bottom (that better). [edit: proposed sulution description] the proportion parameter defines ratio of how widgets change in defined orientation. let's assume have 3 buttons proportions 0, 1, , 2. added horizontal wx.boxsizer. button proportion 0 not change @ all. button proportion 2 change twice more 1 proportion 1 in horizontal dimension. from zetcode solution proposed renae ...

excel - Take data from next HTML tag -

using html code example: <table class="table-grid"> <tr> <th>auto.model</th> <td> <pre>'toyota avensis wagon'</pre> </td> </tr> <tr> <th>auto.year</th> <td> <pre>2005</pre> </td> </tr> </table> if take parameter "auto.model" between <th></th> tags , want receive "toyota avensis wagon", i.e. next expression between <pre></pre> . ideally i'd have function it. thank @jeeped, code raise "type mismatch" error , points set el = param.previoussibling : sub extract_td_text() dim url string dim ie internetexplorer dim htmldoc htmldocument dim params ihtmlelementcollection dim param htmltablecell dim val htmltablecell dim r long dim el htmltablecell url = "my url" set ie = new internetexplorer ie .navigate url .visi...

java - Variable assignment operator -= -

this question has answer here: java's +=, -=, *=, /= compound assignment operators 11 answers i'm in need me explain fragment of code. graphics2d g2d = (graphics2d) g;//create graphics object g2d int x = 200; int y = 150; point2d.double start = new point2d.double(x, y); x -= 50; point2d.double end = new point2d.double(x, y); i know first 3 lines says x -=50 , don't understand doing there. could please explain me. x -= y syntactic sugar x = x - y . so x -= 50; subtract 50 x.

c# - Advanced Search using Lambda Expression -

i want implement advanced search in asp.net mvc application, user can select 1 or more criteria product search. let's have these criterias: color , size , price range . this far till now productsizelist = db.productsizes.where(productsize => (string.isnullorempty(productcolorid) || productsize.product.productcolors.where(a => a.colorid == intcolorid).any()) ).groupby(x => x.productid).select(grouped => grouped.firstordefault()).tolist(); i have many-to-many relationship between product , color tables, , productcolor 1 linking them. same thing product , productsize , size tables. the code working size , , price range . problem color , because .any() returns when finds first product . if there more 1 product , returns first one. so, want know if there method , or way able products specified color. i searched lot, , know can build clause dynamically, think work requirements. if there simple fix more happy. edit i removed working-as-want...

EXCEL VBA: Ignore word document errors and read content -

i writing vba code read word document content , paste them in excel sheets, fine, but while reading multiple word documents of word document shows error messages example "word not fire event", due program hangs up. can suggest vba code ignore these type of error , read word content. i have placed code below. dim odoc word.document set odoc = getobject("d:\176013(1).doc") str = odoc.content.text msgbox (str) odoc.close (0) based on answers dim wdapp word.application dim odoc word.document set wdapp = createobject("word.application") wdapp.displayalerts = **** 'unable give false here, shows 3 options wdalertsnone, wdalertsmessagebox, wdalertsall set odoc = wdapp.documents.open("d:\176013(1).doc") str = odoc.content.text odoc.close (0) wdapp.quit false try application.displayalerts = false if use other application objects, have set displayalerts = false on object. dim app word.applicat...

dom - If directive should not be loaded by some conditional? -

i have 1 directive dont want loaded. <div class="col-sm-12 panel panel-default" ng-if="displayname=='automatic'"> <div automatic-dir opt='opt'></div> </div> i tried ng-if , ng-show ok not showed, both of them directive loaded. if don't want change dom structure 1 of possible way this or in 1 of simplest way <ul ng-controller="listviewctrl" > <li ng-repeat="item in items"> <span>{{item.name}}</span> <div automatic-dir opt='opt' ng-if="item.hasmenu"></div> </li> </ul> if driving automatic-dir of class, should able this: <ul ng-controller="listviewctrl" > <li ng-class="{'hasmenu': item.hasmenu}" ng-repeat="item in items">{{item.name}} </li> </ul> could please tell exact problem facing done ng-if ? plunker added advantage resolved...