Posts

Showing posts from March, 2011

winforms - Avoid duplicate form loading in c# -

i have 2 windows forms.both form1 , form2 have button. when click button in form1 shows form2 , vice versa. create duplicate form when click button on each time. how avoid it. please tell me. code given below. form1: private void button1_click(object sender, eventargs e) { form2 f2 = new form2(); f2.show(); } form2: private void button1_click(object sender, eventargs e) { form1 f1 = new form1(); f1.show(); } just use method common , pass parameter 'this' when button click public bool formisexist(form frmopen) { formcollection fc = application.openforms; foreach (form frm in fc) { if (frm.name == frmopen.name) { return true; } } return false; }

javascript - How to apply an accordion to submenu -

Image
i developing wordpress site using underscores theme , @ moment, navbar works on big screens picture shows: but find problem in small screens when click on menu item has submenu. not have accordion. how can apply accordion submenu when click on example, sub-menu drop down accordion in way can still see rest of menu? here current css: @media(max-width: 600px){ ul#primary-menu li { width: 100%; } } .menu-main-menu-container { max-width: 1280px; margin: auto; } li#menu-item-65 > a:after { font-family: fontawesome; content: '\f107'; padding-left: 10px; color: #99c71b; } li#menu-item-66 > a:after { font-family: fontawesome; content: '\f107'; padding-left: 10px; color: #99c71b; } .main-navigation { clear: both; display: block; float: left; width: 100%; background-color: #353535; border-bottom: 5px solid #99c71b; } .main-navigation ul { display: none; list-style: none; m

ruby on rails - Why my data won't save to SQL? -

i'm quite new ruby on rails. i'll playing around it. actually, i'm trying create form title , daterangepick (bootstrap). so, works fine until now. have 1 problem: data don't save in database. everytime submit form creates new record, inserts automatically "created_at" etc. 2 fields "title" , "date" empty every time... don't know fault is. may of can me? pls give me answer explication, cause i'm trying understand whats going on. here code (i'm using simple_form gem) new.html.erb: <%= simple_form_for @event |f| %> <%= f.input_field :title, required: false %> <%= f.input :date, input_html: { class: "daterange" }, required: false %> <%= f.button :submit %> <% end %> <script type="text/javascript"> $(document).ready(function() { $('input[class="string optional daterange"]').daterangepicker( { locale: {

jasper reports - How to align total fields in column footer? -

Image
i have created report in jasper ireport. alignment of fields in not appropriate want. i have added date , sms count in detail band , total sms count in column band . when have total sms count in detail band iterate , show multiple time. sms count report image: xml code ... <?xml version="1.0" encoding="utf-8"?> <jasperreport xmlns="http://jasperreports.sourceforge.net/jasperreports" xmlns:xsi="http://www.w3.org/2001/xmlschema-instance" xsi:schemalocation="http://jasperreports.sourceforge.net/jasperreports http://jasperreports.sourceforge.net/xsd/jasperreport.xsd" name="smscount" pagewidth="595" pageheight="842" columnwidth="555" leftmargin="20" rightmargin="20" topmargin="20" bottommargin="20"> <property name="ireport.zoom" value="1.0"/> <property name="ireport.x" value="0"/>

sugarcrm - How to add condition for a field in the layout of SuiteCRM.? -

Image
in in studio have created fields in 1 module , add fields in layout. want display fields according selection, example: if user select option-1 dropdown field has display 3 field, , if user select option-2 dropdown field has display 6 fields. need add condition in layout field. can't find option there.. please me find out. attached example image below. you need modify view definitions add script edit view of module. example: $viewdefs ['<module name>'] = array( '<view name>view' => array( 'templatemeta' => array( ... 'includes' => array( 0 => array( 'file' => 'path/to/your/script.js', ), 1 =&g

osx - Packet filter syntax and loopback -

i have tun adapter (os x) looks this: tun11: flags=8851<up,pointopoint,running,simplex,multicast> mtu 1500 inet 10.12.0.2 --> 10.12.0.1 netmask 0xff000000 open (pid 4004) i send udp packet it: echo "lol" | nc -4u 10.12.0.1 8000 and able see tcpdump : ➜ build git:(master) ✗ sudo tcpdump -i tun11 -vv tcpdump: listening on tun11, link-type null (bsd loopback), capture size 262144 bytes 14:39:16.669055 ip (tos 0x0, ttl 64, id 21714, offset 0, flags [none], proto udp (17), length 32) 10.12.0.2.55707 > 10.12.0.1.irdmi: [udp sum ok] udp, length 4 however not see when use capture filter: ➜ build git:(master) ✗ sudo tcpdump -i tun11 udp -vv tcpdump: listening on tun11, link-type null (bsd loopback), capture size 262144 bytes same syntax works fine ethernet adapter: ➜ build git:(master) ✗ sudo tcpdump -i en0 udp -vv tcpdump: listening on en0, link-type en10mb (ethernet), capture size 262144 bytes 14:42:15.010329 ip (tos 0x0, tt

pyinstaller - Executable file not working (Ubuntu-Python-PyQt-QGIS) -

for can help... issue this: have created python application wish turn cross platform executable 1 file. however, though pyinstaller executed without problem, executable not working. says "failed execute script". have tried both onefile , onedir options. python application's imports these (yes, lot necessary): import os import sqlite3 import sys import easygui sys.path.append("/usr/bin/qgis") sys.path.append("~\.qgis2\python\plugins") pyqt4 import qtcore, qtgui pyqt4.qtcore import * pyqt4.qtgui import * geopy.exc import geocoderserviceerror geopy.geocoders import nominatim sklearn.decomposition import * sklearn.metrics import homogeneity_score, adjusted_rand_score #from pyqt4.qtcore import qt, qfileinfo, qsize pyqt4.qtnetwork import * pyqt4.qsci import * qgis.core import * qgis.gui import * qgis.utils import * pyqt4.qtxml import qdomdocument itertools import product # creating reports reportlab.lib import colors reportlab.lib.enums import ta_cen

Tizen native app IDE -

Image
i not able open native perspective in tizen studio. downloaded tizen studio ide https://developer.tizen.org/development/tizen-studio/download . after installation shows option web app, doesn't show native. windows->perspective->open perspective->other shows 2 options - a) debug , b) web (default) please on how change perspective native ? open "package-manager" "tizen-sdk" folder. find folder in tizen installation directory. in “main sdk” check “native app. development (ide)". see if "native app. development (ide)" installed. if not installed, install it. close "package-manager" , reopen tizen studio ide. hope find native perspective now.

javascript - How to perform Add, Edit and Delete operations for JSON data using AngularJS? -

i have json file: test.json: { "mytest": [{ "main": { "static": { "name": "testname1" }, "dynamic": { "testkey01": "testkey01data", "testkey02": 40, "testkey03vals": [1, 1, 1] }} }, { "main": { "static": { "name": "testname2" },"dynamic": { "testkey01": "test01value", "testkey03": 10, "testflags": ["test"] }} }, { "main": { "static": { "name": "testname3" },"dynamic": { "testkey01": "testkey01value testname3", "testnumber": 30

hash - Ruby and Chef difference in hashes -

i've been programming in ruby little while , have heard using symbols accessing values in hashes "better practice" using strings, e.g. default[:key] = value on default['key'] = value i've been working on chef project , noticed chef cookbooks use second way access hash values (via strings). accessing via symbol alternative not work! so guess question 2 part, should stop using symbols , use string accessors everywhere? , why use of symbols not work? t.l;d.r. accessing attributes symbol discouraged in favor of strings, despite still in use. quoting lamont granquist chef in foodcritic (linter) issue here chef implementation of mashes converts symbols internally strings the official recommendation in docs use strings. to complete overview of chef attributes can access them instance method, i.e. node.key.subkey method deprecated , removed in short mid term.

objective c - Fetch batch of iOS pictures -

i fetch fixed batches of pictures located on ios device. using new photos framework , , found workaround: phfetchoptions *allphotosoptions = [phfetchoptions new]; allphotosoptions.sortdescriptors = @[[nssortdescriptor sortdescriptorwithkey:@"creationdate" ascending:no]]; // fetches photos -> fetch of them phfetchresult *allphotosresult = [phasset fetchassetswithmediatype:phassetmediatypeimage options:allphotosoptions]; nsindexset *indexset = [nsindexset indexsetwithindexesinrange:nsmakerange(currentindex, batch_size)]; // iterates on subset of fetched photos [allphotosresult enumerateobjectsatindexes:indexset options:0 usingblock:^(phasset *asset, nsuinteger idx, bool *stop) { // stuff } it works fine, first fetch photos fetchassetswithmediatype , select subset of result app load, seems quite heavy... i wanted know if there way directly fetch photos batch batch, , not fetch them iterate. furthermore, perfect if keep indexes of last fetched batch, kno

css - svg animation browser support -

i want dive wonderful world of .svg animation website i'm working for. i'm looking icon animates on hover. have found multiple tutorials can me out, however, noticed there lot of different ways achieve svg animation. i can find little info on supported way animate svg. js library? animate tag? css animation? a js library seems best me, idea of using css well. can tell me more browser support of these methods? there lots plugins available animate svg.few listed here snapsvg gsap segmentjs you can checkout crossbrowser compatibility here .

How can I delete a leased blob in Microsoft Azure storage -

Image
i created virtual machine in azure , deleted it. however, associated storage account still exists. can't delete storage account because contains container blob in has indefinite lease. nothing else using storage account. how can delete blob? you need delete disk objects associated abandoned vhd's. can in either classic or new portal. once dispose of these (along associated leases), should able rid of storage account in classic portal ( manage.windowsazure.com ), visit virtual machines, disks. select disk delete, , click trash can @ bottom of screen. in new portal ( portal.azure.com ) you'll find disks under os disks (classic) : from there, can select , delete disks vm's deleted.

java - AudioInputStream to base64 -

i'm using code read audio files http get requests , mixing them up. end audioinputstream . if write file ( ais audioinputstream ) code bellow file created success , if try read javascript can base64 of file no problems. audiosystem.write( ais ,audiofileformat.type.wave ,new file("test.wav")); but need audioinputstream extract byte array (and convert base64 send other part of code. can't save file disk, need application memory managed writing bytearrayoutputstream instead , converting byte array base64 baos = new bytearrayoutputstream(); audiosystem.write( ais ,audiofileformat.type.wave ,baos); audioinbytearray = baos.tobytearray();

javascript - Does any testing frameworks support inline tests in TypeScript? -

i find karma js tests cumbersome set , write , find myself ignoring writing tests because of this, wanted know if there exist better alternatives. since use typescript dream scenario if write this: module adder { export function add(a, b){ return + b; } } [tests] assert.equal(4, adder.add(2, 2)); my tests inline , run directly in editor when changes in current file occur. since typescript remove tests final output put tests in same file code (the closer better in opinion). testing framework support , if not needed support scenario. just pedantic note - karma test runner, not test framework. however, can use jasmine, mocha, qunit or roll-your-own test framework. you might able use decorator syntax accomplish type of behaviour. like: @testsuite class addertests { @test test1() { assert.equal(4, adder.add(2,2)); } @test test2() { assert.equal(0, adder.add(2,-2)); } } having said this, though, structure of

javascript - Private static variable? -

this question has answer here: how create private variables within namespace? 2 answers static variables in javascript 35 answers is possible create "private static" variables in javascript similar java? my scenario need retrieve data point server , save in static variable, function uses need not make server call every time called. i need data once fetched , copied variable not read outside class need secure, want have private. have read achieve private variable use scope functionality in javascript need static. can achieved?

.net - How to disable PLINQ partitioning/batching -

plinq internally batches items takes in order reduce overhead. since items memory intensive i'd minimize buffering exists in plinq query pipeline. how can disable partitioning/batching entirely? the code looks this: var myitems = enumerable.range(0, 10000000).select(_ => new byte[1 << 30]); var results = myitems .asparallel() .withmaxdegreeofparallelism(4) .select(f) .tolist(); in code i'd expect maximum number of (big) items ineligible garbage collection 4. what want create paritioner on source, specifies nobuffering , , use in plinq query: var myitems = enumerable.range(0, 1000).select(_ => new byte[1 << 30]); var mypartitioner = partitioner.create(myitems, enumerablepartitioneroptions.nobuffering); var results = mypartitioner .asparallel() .withdegreeofparallelism(4) .select(f) .tolist(); this query works me, throws outofmemoryexception if skip partitioner (just original query).

Get rid of quality issues when modifying a PDF with ImageMagick -

Image
our goal take user uploaded pdf , put "stamp" (a box background color + text) on top left corner. "stamp" part works well, pass pdf through imagemagick quality problems - when original pdf had kind of artefacts. this screenshot source pdf (black areas added privacy reasons). https://dl.dropboxusercontent.com/u/6271307/screen%20shot%202016-09-22%20at%2015.18.49.png can see quality isn't because scanned copy machine. after being processed imagemagick result looks this: https://dl.dropboxusercontent.com/u/6271307/screen%20shot%202016-09-22%20at%2015.19.15.png this call being made: '/usr/bin/convert' +profile '*' -compress jpeg -quality 90 -density 180 -pointsize 10 -fill 'rgba(220, 220, 220, 0.75)' -stroke 'rgba(220, 220, 220, 0.75)' -draw 'rectangle 40,20,491,100' -stroke '#000000' -font courier -draw "text 48,47 'vermittlernummer gesellschaft'" -draw "text 48,81 '70_202_3297&#

To compare 2 integer arrays using Java 8 Features -

this question has answer here: how intersection between 2 arrays new array? 22 answers is possible without external foreach iterate b. need identify common values in 2 arays using java 8 integer a[]={1,2,3,4}; integer b[]={9,8,2,3}; for(integer b1:b) { stream.of(a).filter(a1 -> (a1.compareto(b1) ==0)).foreach(system.out::println); } output: 2 3 i suggest using sets if want common values (i.e. not taking duplicates account) integer a[]={1,2,3,4}; integer b[]={9,8,2,3}; set<integer> aset = new hashset<>(arrays.aslist(a)); set<integer> bset = new hashset<>(arrays.aslist(b)); aset.retainall(bset);

regex - JavaScript RegExp - find all prefixes up to a certain character -

i have string composed of terms separated slashes ( '/' ), example: ab/c/def i want find prefixes of string occurrence of slash or end of string, i.e. above example expect get: ab ab/c ab/c/def i've tried regex this: /^(.*)[\/$]/ , returns single match - ab/c/ parenthesized result ab/c , accordingly. edit : i know can done quite using split , looking solution using regexp . no, can't pure regex. why? because need substrings starting @ 1 , same location in string, while regex matches non-overlapping chunks of text , advances index search match. ok, capturing groups? helpful if know how many / -separated chunks have in input string. use var s = 'ab/c/def'; // there exact 3 parts console.log(/^(([^\/]+)\/[^\/]+)\/[^\/]+$/.exec(s)); // => [ "ab/c/def", "ab/c", "ab" ] however , unlikely know many details input string. you may use following code rather regex: var s = 'ab/c/d

javascript - TypeError: cognitiveServices.face is not a constructor -

i using microsoft cognitive services api nodejs. have following code const cognitiveservices = require('cognitive-services'); const face = new cognitiveservices.face({ api_key: yourapikey }) const parameters = { returnfaceid: "true" returnfacelandmarks: "false" }; const body = { "url": "url of input image" }; face.detect({ parameters, body }) .then((response) => { console.log('got response', response); }) .catch((err) => { console.error('encountered error making request:', err); }); however, when execute code following error const face = new cognitiveservices.face({ ^ typeerror: cognitiveservices.face not constructor @ object.<anonymous> (/users/..../face.js:3:14) @ module._compile (module.js:556:32) @ object.module._extensions..js (module.js:565:10)

amazon swf - AWS Simple Workflow Service - run long running processes reliably -

situation: i want use aws swf coordinate long running manual activities. when activity being scheduled in aws transfer db show on ui tasks pending. tasks can take weeks complete, have huge timeouts in swf. problem: in case application fails populate db (hangs or dies without reporting error), task not seen person , retry can happen after weeks, when activity times out (which unacceptable). question: so want have ability "start" task (say having timeout of 30 seconds) , when application sure activity started set timeout weeks. possible elegantly using swf? (i've read through doc , several examples , still don't understand envisioned way of running manual tasks) unfortunately swf service doesn't support "start activity task" api call. workaround used use activity short timeout insert record db. upon manual task completion signal workflow it. separate timer needed deal manual task timeout. logic can encapsulated in separate class re

qt - Crash when delete QGraphicsItem -

Image
i want remove items in qgraphicsscene , delete them. this, qgraphicsitem * item = null; foreach(item, scene->items()) { scene->removeitem(item); delete item; } however, crashed segmentation fault after running block of codes , getting out loop. , in debug mode, debugger jumped assembly file: what's going wrong? if deleting items scene, why dont "clear" shown below. have scene object right. scene-> clear(); as per documentation: void qgraphicsscene::clear() removes , deletes items scene, otherwise leaves state of scene unchanged. this function introduced in qt 4.4.

date - Concantenate two string and convert to datetime pandas python -

i using latest version of pandas , python 3.5 i have csv file 2 columns date , time both string date: 07jan2015 time: 0:00:00 i need concatenate date , time , convert result datetime or timestamp date must in following format date format: 01/07/2015 so result should this: 01/07/2015 0:00:00 i using pandas import csv your appreciated. i think can use to_datetime dt.strftime : print (df) date time 0 07jan2015 0:00:00 1 08jan2015 1:00:00 df['new'] = pd.to_datetime(df.date + df.time, format='%d%b%y%h:%m:%s') df['new'] = df.new.dt.strftime('%m/%d/%y %h:%m:%s') print (df) date time new 0 07jan2015 0:00:00 01/07/2015 00:00:00 1 08jan2015 1:00:00 01/08/2015 01:00:00 python's strftime directives .

android - Converting a MPAndroidChart view to a Bitmap gives ArrayIndexOutOfBoundsException -

i trying convert mpandroidchart linechart view bitmap object when user taps on button, save chart image. however, arrayindexoutofboundsexception. using mpandroidchart v. 3.0.0-beta. code following: public static bitmap getbitmapfromview(view graph) { bitmap returnedbitmap = bitmap.createbitmap(graph.getwidth(), graph.getheight(), bitmap.config.argb_8888); canvas canvas = new canvas(returnedbitmap); drawable bgdrawable = graph.getbackground(); if (bgdrawable != null) bgdrawable.draw(canvas); else canvas.drawcolor(color.white); view.draw(canvas); return returnedbitmap; } the exception following , line 1409 of constantsandutils.java view.draw(canvas) above. java.lang.arrayindexoutofboundsexception: length=1; index=1 @ com.github.mikephil.charting.renderer.linechartrenderer.drawcircles(linechartrenderer.java:689) @ com.github.mikephil.charting.renderer.linechartrenderer.drawextras(linechartrenderer.java:595)

what's wrong with my R code? -

i struggling parse contents html using htmltreeparse , xpath. below web link need extract information of "most valuable brands" , create data frame out of it. http://www.forbes.com/powerful-brands/list/#tab:rank as first step towards building table, trying extract list of brands (apple, google, microsoft etc. ). trying through below code: library(xml) htmlcontent <- geturl("http://www.forbes.com/powerful-brands/list/#tab:rank", ssl.verifypeer=false) htmlparsed <- htmltreeparse(htmlcontent, useinternal = true) output <- xpathsapply(htmlparsed, "/html/body/div/div/div/table[@id='the_list']/tbody/tr/td[@class='name']", xmlvalue) but returning null. not able find mistake. "/html/body/div/div/div/table[@id='the_list']/thead/tr/th" works correctly, returning ("", "rank", "brand" etc.) means path upto table correct. not able understand what's wrong thereafter.

Why can't PHP have a constant object? -

i have key-value database table, store settings. i have these settings in php constant object, since shouldn't editable. in php7 can this: define('mysettings', array( 'title' => 'my title' // etc )); // , call echo mysettings['title']; and works great. but why can't do: define('mysettings', (object) array('title' => 'my title')); so call instead: echo mysettings->title; // or echo mysettings::title; this because think it's quicker , prettier type object property/constant ( $obj->key , $obj::key ), array ( $array['key'] ) is there reason not possible? for php, objects mutable. since constants should never change @ runtime objects can, object-constants not supported. in phpdoc constants , stated that: when using const keyword, scalar data (boolean, integer, float , string) can contained in constants prior php 5.6. php 5.6 onwards, possible define co

Excel VBA - Function to show inputs needed and inputs used for a functioncall in a cell -

Image
i want user-defined vba function better overview of inputs used bunch of different functions. example image have following function public function simplefunction(firstnumber integer, secondnumber integer) integer simplefunction = firstnumber + secondnumber end function imagine have worksheet a1 equal 1 , a2 equal =simplefunction(a1, 2) . goal i want develop function debugfunction public function debugfunction(incell range) variant ' return matrix debug information end function letting b1:d3 contain ={debugfunction(a2)} i'd return this | input name | input type | input used | ----------------------------------------- | firstnumber | integer | 1 | | secondnumber | integer | 2 | what have tried far? not since i'm not sure how proberly , figure might come not clever solution compared possible. think parsing incell.formula way go. edit my ultimate goal showed in function arguments window seen here. re

BizTalk EDIFACT sub document splitting -

our partner sends edifact has custom segments. have updated 1 of existing edifact schemas have these custom segments. happy day scenarios working. trying implement negative scenarios. business wants biztalk process successful message within interchange , raise error failed ones. not using partner agreement. in edifact fallback settings, have set inbound batch processing option split interchange transaction sets - suspend transaction set on error. issue: partner send multiple data (in our case, multiple s01loop) within same transaction set i.e. within unh-unt. if apply above logic, entire interchange failing. requirement: want particular loop data fail , remaining positive ones should pass. what have tried: hipaa based edifact file, there concept called subdocument_break. applied annotations in xsd. unfortunately didnt work. if there no out of box solution, planning write edi splitter pipeline component custom flat file disassembler component split multiple data separate in

.net - C# wait for external PID to exit -

this question has answer here: wait process finish , display message (c#) 3 answers how wait until pid (not started program itself) doesn't exist longer? want program pid external program via commandline parameter , wait exit , something. i searched it, find examples process has been startet c# program itself. that's easy manage .. i going this, doesn't work .. process[] pname = process.getprocessbyid(7860); if (pname.length == 0) console.writeline("nothing"); else console.writeline("run"); how can accomplished? you can writing: var p = process.getprocessbyid(7860); p.waitforexit();

xamarin.android - Visual Studio Android Emulator Is Not Running the Application -

when deploy/run xamarin.android app in visual studio (either pressing ctrl+f5 or play-button in toolbar), visual studio launches emulator android (note: "visual studio emulator android", not sdk or other emulator) without difficulty , within reasonable amount of time works fine. problem not automatically run app. neither show icon run it. i have not had success emulator built in vs. however, need switch output "verbose" , monitor output window while attempting deploy. give wealth of information during deploy. likely, deploy failing, figure ouy why. as side note, free genymotion faster android emulator have had great success with.

spring - Java send email through gmail, sometimes works sometimes hang -

i sending email gmail through web app. however, working fine stop without message. does know how solve this? in spring appconfig.java @bean public javamailsender getmailsender(){ javamailsenderimpl mailsender = new javamailsenderimpl(); mailsender.sethost("smtp.gmail.com"); mailsender.setport(587); mailsender.setusername("my email from"); mailsender.setpassword("my email password"); properties javamailproperties = new properties(); javamailproperties.put("mail.smtp.starttls.enable", "true"); javamailproperties.put("mail.smtp.auth", "true"); //javamailproperties.put("mail.transport.protocol", "smtps"); javamailproperties.put("mail.transport.protocol", "smtp"); javamailproperties.put("mail.debug", "true"); mailsender.setjavamailproperties(javamailp

Setting up Laravel Homestead with existing project - Laravel commands not recognized -

i setting homestead on mac. i have made sure settings right on storage folder. have installed composer on vagrant box. if navigate /home/vagrant/code code there. here yaml file: folders: - map: ~/sites/myapp/ to: /home/vagrant/code sites: - map: my.app to: /home/vagrant/code/public the output standard "something went wrong" the console log shows 500 error failure load resource. am doing wrong? i want see errors, .env file turn on? do need touch homestead.yaml file on vagrant? what level of structure "folders" portion of yaml file need set to? folder level houses entire laravel application? public folder? is there full explanation somewhere of parameters involved in setting up? - postgres database? update : echoing out "here" in index.php function worked, using dd() produced error - call undefined function dd(). it appears vagrant machine not recognizing laravel commands. suggestions? second update: well, got working.

c - I am getting "pointer being freed was not allocated" -

i reading stdin. since not know length of read, have use malloc. i getting pointer being freed not allocated sometimes, happens before free(final), before free(tmp). i check both pointers correctly non null after creating them , before making free. can pin point doing wrong ? total_size = 0; final = (char *)malloc(sizeof(char) * 1); if (!final) { printf("error allocating memory final\n"); return (null); } while ((ret = read(0, buf, buf_size)) > 0) { tmp = (char *)malloc(sizeof(char) * ft_strlen(final)); if (!tmp) { printf("error allocating memory tmp\n"); return (null); } strcpy(tmp, final); if (final) free(final); buf[ret] = '\0'; total_size = total_size + ret; final = (char *)malloc(sizeof(char) * total_size); if (!final) { printf("error allocating memory final\n"); return (null); } final = strcat(tmp, buf); if (tmp) fre

css - Google maps Prints incorrectly in Chrome -

Image
i unable print map through chrome browser. if try print ie, map shows , prints correctly. below image print chrome. #map-canvas { width: 850px; height: 1400px; margin: 5px; } @media print { #filterarea { display: none; } #note { display: none; } #map-canvas { visibility: visible; position: absolute; top: 5px; left: 5px; } } <div id="mapbody"> <div id="filterarea"> … <button id="map-print" onclick="printview()">print</button> … </div> <div id="map-canvas"></div> </div> you can see in forum others experienced printing problem chrome. here workarounds can solve problem: in address bar type about:flags . there find print preview enables in-tab preview of print operation. enable/disable you can try uninstall chrome download newest version , install i

turbo c - How is the output 47? -

#include<stdio.h> #include<conio.h> #define first_part 7 #define last_part 5 #define all_parts first_part+last_part int main() { printf ("the square root of parts %d", all_parts * all_parts) ; getch(); return(0); } in above code first_part defined 7 last_part defined 5 and all_parts initialized first_part+last_part (which ideally 12) but when printing all_parts * all_parts giving me 47 output!(but thought answer 144) please can explain me how ? the answer should 47 first_part + last_part * first_part + last_part multiplication has more precedence 7 + 5 * 7 + 5 7 + 35 + 5 47

android - Night Mode specific Mipmaps -

i using daynight theme in app. know of values can modified support using "-night" tag ( like, drawables-night , colors-night). tried same mipmap (mipmap-night) , did not work. there different way handle app icons daynight theme? trying make app icon change app theme changes.

javascript - jQuery onclick can't reach a function -

i have code: cs = new object(); cs.show = function() { $.getjson('script.php', function(rd) { var result = '<button id="sellbutton">place trade offer</button>'; $('#somedom').html(result); $('#sellbutton').click(function() { cs.dosomething(); }) }) } cs.dosomething = function() { // doing } when click button , i'm getting: uncaught typeerror: cs.dosomething not function(…) where problem? in code there again set "cs" variable. after cs.dosomething called. good solving prevent situation while development including functions inside , using var set variable name reference in actual scope. var globalvars = {}; globalvars.cs = new object(); globalvars.cs.show = function() { $.getjson('script.php', function(rd) { var result = '<butto

How to extend gradle war task with dofirst/dolast -

i need extend gradle war task dofirst , dolast commands compile sencha frontend in production state. i know extend task need add task.dofirst {} not working war. did tests using other tasks like clean { dofirst { println "test" } } this working ... war isn't war { dofirst { println "test" } } my main idea remove src/main/webapp from list , execute sencha-cmd sencha app build -c --destination $war/ production you should create separate task sencha compilation it's own inputs/outputs gradle can perform up-to-date checking (so can skipped if not necessary). can wire task gradle dag via task.dependson(...) task compilesencha(type:exec) { inputs.dir 'src/main/sencha' outputs.dir "$builddir/sencha" commandline 'sencha', 'app', 'build', file('src/main/sencha').absolutepath, file("$builddir/sencha").absolutepath } war { "$build

Version conflict updating to play-services 9.4.0 Android studio 2.2 -

i error saying error:execution failed task ':app:processdebuggoogleservices'. > please fix version conflict either updating version of google-services plugin (information latest version available @ https://bintray.com/android/android-tools/com.google.gms.google-services/) or updating version of com.google.android.gms 9.0.0. i tried looking @ https://bintray.com/android/android-tools/com.google.gms.google-services/ , com.google.gms:google-services:3.0.0 seems latest. project gradle dependencies { classpath 'com.android.tools.build:gradle:2.1.2' classpath 'com.google.gms:google-services:3.0.0' // note: not place application dependencies here; belong // in individual module build.gradle files } and how app gradle looks like buildscript { repositories { maven { url 'https://maven.fabric.io/public' } } dependencies { classpath 'i

entity framework - ASPNET Core/EF Core App on Top of Net46 -

i have mvc6 website has run on top of full net framework because relies on various libraries have not been updated support net core. i think may misconfiguring project.json file. here's have: { "dependencies": { "microsoft.aspnetcore.authentication.cookies": "1.0.0", "microsoft.aspnetcore.diagnostics": "1.0.0", "microsoft.aspnetcore.diagnostics.entityframeworkcore": "1.0.0", "microsoft.aspnetcore.identity.entityframeworkcore": "1.0.0", "microsoft.aspnetcore.mvc": "1.0.1", "microsoft.aspnetcore.razor.tools": { "version": "1.0.0-preview2-final", "type": "build" }, "microsoft.aspnetcore.server.iisintegration": "1.0.0", "microsoft.aspnetcore.server.kestrel": "1.0.1", "microsoft.aspnetcore.staticfiles": "1.0.0"