Posts

Showing posts from May, 2008

Add Heading On Export Using Fputcsv Php

Answer : This worked for me. function downloadCSV($data) { $filename = date("Y-m-d").".csv"; header('Content-type: application/csv'); header('Content-Disposition: attachment; filename=' . $filename); header("Content-Transfer-Encoding: UTF-8"); $f = fopen('php://output', 'a'); fputcsv($f, array_keys($data[0])); foreach ($data as $row) { fputcsv($f, $row); } fclose($f); } Try this after opening the file, you want to write in e.g. i want to write a file at below path: $fp = fopen('csvfiles/myfile.csv','w') You have to enter headers separately, so for this make an array of headers like: $csv_fields=array(); $csv_fields[] = 'Enquiry id'; $csv_fields[] = 'Date'; $csv_fields[] = 'Name'; $csv_fields[] = 'Email'; $csv_fields[] = 'Telephone'; $csv_fields[] = 'Customer Request'; $csv_fields[] = 'Special R

Hover None Css Code Example

Example 1: remove hover effect css .noHover { pointer-events : none ; } Example 2: css hover to disable .noHover { pointer-events : none ; } Example 3: remove hover effect css <a href= '' class= 'btn noHover' >You cant touch ME : P</a> Example 4: css disabled hover none button :hover :enabled { /*your styles*/ } button :active :enabled { /*your styles*/ } Example 5: display none after hover $ ( ' .info ' ) .hover ( function ( ) { $ ( this ) . fadeTo ( 1 , 1 ) ; } , function ( ) { $ ( this ) . fadeTo ( 1 , 0 ) ; } ) ;

Console/Terminal Widget For Qt?

Answer : QConsole used to do something like that. (Not sure the project is active anymore, but you might want to have a look). Found some decent source code here. Very basic functionality, but I've been adding to it some and I think it has promise to do what I need it to. NOTE: I have only tested this code in Win32. Here is a link to my new question concerning this code.

Protected Cpp Code Example

Example: protected in c++ # include <iostream> // Visibility is how visible certain members or methods of class are , who can see them ,who can call them and who can use them //Visibility has no effect on performance of your program it is ust for organizing code //Three basic visibility modifers are: //1 private //2 public //3 protected //default visibility of a struct is public //default visibility of class is private class Entity { protected : //means all sub classes and base class can access these functions and variables butcan't be accessed outside classes int P ; void InitP ( ) { P = 0 ; //initializes P to 0 } public : //Pubic methods and variables can be accessed inside and outside of the class int a , b ; void Init ( ) { a = 0 ; b = 0 ; } private : //only entity class can read and write the variables exeption is friend int X , Y ; void print ( ) { // Content // only this function can be acess

Can You Pause Terraria?

Image
Answer : You can Alt-Tab out of the window, or simply click out of it if playing in windowed mode, and it will pause gameplay. It's hackish, but it does pause (you can also do this during loading, and it will keep loading). As James has pointed out, this is single-player only. There is currently (and I doubt there ever will be) no multiplayer pause. Game pauses automatically if you ALT+TAB to another program. UPDATE : In Terraria 1.0.4 devs added the following option related to pausing: Added an option that will pause the game while talking to an NPC or opening your inventory in single player. It defaults to off.

Analogread Arduino Example

Example: arduino code analogwrite analogWrite(Pin number here,0 - 255 value here);

CSS Double Border With Outer Border Thicker Than Inner Border

Answer : Outlines are included in the CSS3 specification and allow both a border and an outline to be applied to a single element. The outline property is identical to the border command. The additional offset property however allows the border to be moved further inside or outside of the element. I used outlines to give borders 2 different colors, change the code to give your borders 2 different sizes. #box { border: 1px double #000; outline: 2px solid #699; outline-offset: -9px; } No, it's not possible. The CSS border width specifies the total thickness of the border, regardless of the border style. I don't see a better way than wrapping it in another DIV. Edit: You could hack it in using outline , but there is a subtle difference between outline and border . border: double 4px black; outline: solid 3px black; (this will produce a 1px inner and 4px outer "border", if you can call it that)

Android Resource Linking Failed

Answer : Please, provide some code. That will be very helpful. But, for now as the error shows: Daemon: AAPT2 aapt2-3.2.0-alpha17-4804415-windows Daemon #0 It means you must have some error in your XML files (layout files or drawable files), check your recent history of your XML file if you are working on Android Studio right click on xml file-> Local history-> show History or look for any error that XML file is showing. values.xml:352: error: resource android:attr/popupPromptView is private. And also refer to this error in values.xml file It happened to me twice, and both times it was an xml spelling error, and the error message was not very useful. The best way to identify a problem is to Analyze -> Inspect code -> search for clues in the "Syntax error" and find the xml with an error. I get this error while creating the legacy icons (Image asset) tool - I find that the Android studio does not close <Vector> tag in ic_launcher_

Convert Python ElementTree To String

Answer : Element objects have no .getroot() method. Drop that call, and the .tostring() call works: xmlstr = ElementTree.tostring(et, encoding='utf8', method='xml') You only need to use .getroot() if you have an ElementTree instance. Other notes: This produces a bytestring , which in Python 3 is the bytes type. If you must have a str object, you have two options: Decode the resulting bytes value, from UTF-8: xmlstr.decode("utf8") Use encoding='unicode' ; this avoids an encode / decode cycle: xmlstr = ElementTree.tostring(et, encoding='unicode', method='xml') If you wanted the UTF-8 encoded bytestring value or are using Python 2, take into account that ElementTree doesn't properly detect utf8 as the standard XML encoding, so it'll add a <?xml version='1.0' encoding='utf8'?> declaration. Use utf-8 or UTF-8 (with a dash) if you want to prevent this. When using encoding="unicode" no dec

3 Color Gradient Image Generator Code Example

Example 1: css gradient generator /* 5 Best CSS Gradient Generator Links */ https : //cssgradient.io/ https : //www.colorzilla.com/gradient-editor/ https : //www.css-gradient.com/ https : //mycolor.space/gradient https : //uigradients.com/#Orca Example 2: Gradient Color Code Generator background-image : linear-gradient ( 90 deg , #020024 0 % , #090979 35 % , #00d4ff 100 % ) ;

How To Change Name Of Heroku App Code Example

Example 1: rename heroku app $ heroku apps : rename newname Renaming oldname to newname . . . done http : //newname.herokuapp.com/ | git@herokuapp.com:newname.git Git remote heroku updated Example 2: heroku rename heroku apps : remane -- app < old - project - name > < new - project - name > Example 3: rename heroku app local First update the name for the heroku app on the heroku dashboard ( on the heroku website ) Then do this on terminal ( Make sure you're in the right repository ) $ git remote rm heroku ( Remove the remote from git ) $ heroku git : remote - a < new app name > ( Add it back with it's new name )

Create Backup Yubikey With Identical PGP Keys

Answer : found this blurb which says that theres a command you can run which will essentially tell your local gpg app to scan the new card and use that instead if things gel. so in the case of using a backup card, not the worst case to run an "init" to make it work. https://forum.yubico.com/viewtopic38a1.html?f=35&t=2400 Running gpg-connect-agent "scd serialno" "learn --force" /bye will update the secret key stubs for the PGP keys on the currently inserted key. So running that after key insertion will cause gpg to use the currently inserted key. After a lot trial and error, I finally found a way to achieve this. Here is an answer to my own question in case it helps someone : The trick was to not try to export the same subkeys to the two Yubikeys (gpg doesn't like that) but to generate different subkeys. In my keyring I have 6 subkeys : 3 for the main Yubikey (Sign, Encrypt, Auth) and 3 for the backup Yubikey. I exported the corresp

Margin 0 Auto Div Bootstrap Code Example

Example 1: bootstrap Margin and padding Use the margin and padding spacing utilities to control how elements and components are spaced and sized. Bootstrap 4 includes a five-level scale for spacing utilities , based on a 1 rem value default $spacer variable. Choose values for all viewports ( e.g. , .mr-3 for margin-right : 1 rem ) , or pick responsive variants to target specific viewports ( e.g. , .mr-md-3 for margin-right : 1 rem starting at the md breakpoint ) . <div class= "my-0 bg-warning" >Margin Y 0 </div> <div class= "my-1 bg-warning" >Margin Y 1 </div> <div class= "my-2 bg-warning" >Margin Y 2 </div> <div class= "my-3 bg-warning" >Margin Y 3 </div> <div class= "my-4 bg-warning" >Margin Y 4 </div> <div class= "my-5 bg-warning" >Margin Y 5 </div> <div class= "my-auto bg-warning" >Margin Y Auto</div> Examp

Circle Avatar Flutter Example Image Network With Loading

Example: how to make an image contained in circle avatar in flutter CircleAvatar ( radius : 30.0 , backgroundImage : NetworkImage ( "${snapshot.data.hitsList[index].previewUrl}" ) , backgroundColor : Colors . transparent , )

Android Studio ML Kit Cannot Load OCR Module

Answer : The solution was to update Google Play Services app. I did not consider this as an option at first as I would have expected an API 29 emulator to have an up-to-date Google Play Services installed. I signed into Google Play on the emulator, searched Google Play Services, uninstalled it (there was no "update" option), and installed it again. It still says that the installed version is 19.4.20 though the text recognition started working as expected. Here are some relevant logs: W/DynamiteModule: Local module descriptor class for com.google.android.gms.vision.dynamite.ocr not found. I/DynamiteModule: Considering local module com.google.android.gms.vision.dynamite.ocr:0 and remote module com.google.android.gms.vision.dynamite.ocr:0 D/TextNativeHandle: Cannot load feature, fall back to load dynamite module. I/DynamiteModule: Considering local module com.google.android.gms.vision.ocr:0 and remote module com.google.android.gms.vision.ocr:1 I/DynamiteModule: Selected re

And/or Synonym Code Example

Example: and synonyms This isn't really a coding answer, but it will help. And Synonyms: * Furthermore * Plus * Including * Along with * Moreover * In Addition to * Also * As well as

Among Us Minecraft Mod Code Example

Example: among us mods Please dm Fighter x Yt#6699 on discord for popular and awesome mods we have mods like mind ocntrol, thanos etc dm me now!