Posts

Showing posts from July, 2013

Asp.net Mvc Redirecttoaction With Parameter Code Example

Example 1: redirecttoaction with parameters return RedirectToAction ( "Action" , new { id = 99 } ) ; Example 2: asp.net core redirecttoaction with parameters RedirectToAction ( "Action" , "Controller" , new { id } ) ;

Alter Table Add Column Query Code Example

Example 1: sql add column ALTER TABLE Customers ADD Email varchar ( 255 ) ; Example 2: alter table add column ALTER TABLE table_name ADD column_name datatype ;

Bootstrap Datepicker Latest Cdn Code Example

Example: bootstrap datepicker js cdn < link rel = " stylesheet " href = " https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/css/bootstrap-datetimepicker-standalone.min.css " integrity = " sha256-SMGbWcp5wJOVXYlZJyAXqoVWaE/vgFA5xfrH3i/jVw0= " crossorigin = " anonymous " /> < script src = " https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datetimepicker/4.17.47/js/bootstrap-datetimepicker.min.js " integrity = " sha256-5YmaxAwMjIpMrVlK84Y/+NjCpKnFYa8bWWBbUHSBGfU= " crossorigin = " anonymous " > </ script >

Better Foliage Mod Chrashinggame Code Example

Example: better foliage 1.12.2 crash Download the forgelin library for betterfoliage to work https://www.curseforge.com/minecraft/mc-mods/shadowfacts-forgelin

Angular Click Select Option In Component Test

Answer : The way to change the selected option of a dropdown is to set the dropdown value and then dispatch a change event. You can use this answer as reference: Angular unit test select onChange spy on empty value In your case, you should do something like this: const select: HTMLSelectElement = fixture.debugElement.query(By.css('#dropdown')).nativeElement; select.value = select.options[3].value; // <-- select a new value select.dispatchEvent(new Event('change')); fixture.detectChanges(); You don't have to dispatch a change event. First you need to click on the trigger for your dropdown, i'm assuming it's your selectEl selectEl = fixture.debugElement.query(By.css('#dropdown')) . selectEl.click(); fixture.detectChanges(); After detectChanges your dropdown should be opened. Only after this will you be able to get your options from fixture, because before they where not present in your fixture. The only way I have been a

Android Webrtc Record Video From The Stream Coming From The Other Peer

Answer : VideoFileRenderer class just demonstrates how you can access to decoded raw video frames for remote/local peer. This is not recording valid video file. You should implement manually the logic of encoding and muxing raw video frames into container, like mp4. The main flow looks like that: Switch to the latest webrtc version (v.1.0.25331 for now) Create video container. For example see MediaMuxer class from Android SDK Implement interface VideoSink for obtaining raw frames from certain video source. For example see apprtc/CallActivity.java class ProxyVideoSink Encode every frame using MediaCodec and write to video container Finalize muxer

Polymorphism In C++ Geeksforgeeks Code Example

Example: polymorphism-program.cpp # include <iostream> using namespace std ; class Person { public : virtual void introduce ( ) { cout << "hey from person" << endl ; } } ; class Student : public Person { public : void introduce ( ) { cout << "hey from student" << endl ; } } ; class Farmer : public Person { public : void introduce ( ) { cout << "hey from Farmer" << endl ; } } ; void whosThis ( Person & p ) { p . introduce ( ) ; } int main ( ) { Farmer anil ; Student alex ; whosThis ( anil ) ; whosThis ( alex ) ; return 0 ; }

Cape Editor For Minecraft Code Example

Example: minecraft cape editor Need Cool Shoes is a good one :P

Assign Command Output To Variable In Batch File

Answer : A method has already been devised, however this way you don't need a temp file. for /f "delims=" %%i in ('command') do set output=%%i However, I'm sure this has its own exceptions and limitations. This post has a method to achieve this from (zvrba) You can do it by redirecting the output to a file first. For example: echo zz > bla.txt set /p VV=<bla.txt echo %VV% You can't assign a process output directly into a var, you need to parse the output with a For /F loop: @Echo OFF FOR /F "Tokens=2,*" %%A IN ( 'Reg Query "HKEY_CURRENT_USER\Software\Macromedia\FlashPlayer" /v "CurrentVersion"' ) DO ( REM Set "Version=%%B" Echo Version: %%B ) Pause&Exit http://ss64.com/nt/for_f.html PS: Change the reg key used if needed.

Apache POI AutoSizeColumn Resizes Incorrectly

Answer : Just to make an answer out of my comment. The rows couldn't size properly because Java was unaware of the font you were trying to use this link should help if you want to install new fonts into Java so you could use something fancier. It also has the list of default fonts that Java knows. Glad this helped and you got your issue solved! This is probably related to this POI Bug which is related to Java Bug JDK-8013716: Renderer for Calibri and Cambria Fonts fails since update 45. In this case changing the Font or using JRE above 6u45 / 7u21 should fix the issue. You can also mtigitate the issue and avoid the columns from being totally collapsed by using a code like this: sheet.autoSizeColumn(x); if (sheet.getColumnWidth(x) == 0) { // autosize failed use MIN_WIDTH sheet.setColumnWidth(x, MIN_WIDTH); } I was also running into this issue and this was my solution. Steps: Create workbook Create spreadsheet Create row Create/Set font t

Append Html Code In Html In Javascript Code Example

Example: JavaScript append HTML let app = document . querySelector ( '#app' ) ; app . append ( 'append() Text Demo' ) ; console . log ( app . textContent ) ;

How To Run Assembly Code On Mac Code Example

Example: how to use assembly on mac global start section .text start: mov rax, 0x2000004 ; write mov rdi, 1 ; stdout mov rsi, msg mov rdx, msg.len syscall mov rax, 0x2000001 ; exit mov rdi, 0 syscall section .data msg: db "Hello, world!" , 10 .len: equ $ - msg

Arraylist Add Method Implementation In Java Code Example

Example 1: ArrayList add(int index, E element) method in java import java.util.ArrayList; public class ArrayListAddMethodExample { public static void main(String[] args) { // creating an empty ArrayList with initial capacity ArrayList al = new ArrayList (6); al.add(12); al.add(14); al.add(16); al.add(18); al.add(20); // adding element 15 at fourth position al.add(3, 15); for(Integer number : al) { System.out.println("Number: " + number); } } } Example 2: java arraylist add //create ArrayList ArrayList arrayList = new ArrayList (); //add item to ArrayList arrayList.add("item"); //check if ArrayList contains item (returns boolean) System.out.println(arrayList.contains("item")); //remove item from ArrayList arrayList.remove("item"); Example 3: arraylist insert at position //Insert a value by using arrayName.add(index, value) //Will not remove current

Ckeditor Cdn Tutorial Code Example

Example 1: cdn ckeditor < script src = " https://cdn.ckeditor.com/4.14.0/standard/ckeditor.js " > </ script > Example 2: ckeditor cdn < script src = " https://cdn.ckeditor.com/ckeditor5/23.1.0/classic/ckeditor.js " > </ script >

%lu In C Code Example

Example: double data type format in c % lf you can try

Android: Test Push Notification Online (Google Cloud Messaging)

Answer : Found a very easy way to do this. Open http://phpfiddle.org/ Paste following php script in box. In php script set API_ACCESS_KEY, set device ids separated by coma. Press F9 or click Run. Have fun ;) <?php // API access key from Google API's Console define( 'API_ACCESS_KEY', 'YOUR-API-ACCESS-KEY-GOES-HERE' ); $registrationIds = array("YOUR DEVICE IDS WILL GO HERE" ); // prep the bundle $msg = array ( 'message' => 'here is a message. message', 'title' => 'This is a title. title', 'subtitle' => 'This is a subtitle. subtitle', 'tickerText' => 'Ticker text here...Ticker text here...Ticker text here', 'vibrate' => 1, 'sound' => 1 ); $fields = array ( 'registration_ids' => $registrationIds, 'data' => $msg ); $headers = array ( 'Autho

Class Designer In Visual Studio - Is It Worth It?

Answer : As a visualization tool, or for exploratory purposes (drawing up multiple options to see what they look like) it's not bad, but generally I find the object browser does fine for most stuff I care about. As a code generation tool, it's a terrible idea. The whole idea that we will design all our code structure first, then fill in the blanks with small bits of implementation is fundamentally broken. The only time you actually know what the code structure should look like, is if you've done the exact same thing before - however then you can just use your previous code, and you don't need to draw up any new code in any kind of designer. If you decide ahead of time to use a particular class structure before you've actually tried to solve the problem, there is a 100% chance that you will pick the wrong design, and shoot yourself in the foot. Short answer: No. Longer answer: No, not at all. There's a reason it hasn't been updated. [EDIT]

Circle Avatar Asset Image Flutter Code Example

Example 1: circle avatar from image asset flutter CircleAvatar ( radius : 16.0 , child : ClipRRect ( child : Image . asset ( 'profile-generic.png' ) , borderRadius : BorderRadius . circular ( 50.0 ) , ) , ) , Example 2: 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 , )

Color In Git-log

Answer : As of git 1.8.3 (May 24, 2013), you can use %C(auto) to decorate %d in the format string of git log . From the release notes: * "git log --format" specifier learned %C(auto) token that tells Git to use color when interpolating %d (decoration), %h (short commit object name), etc. for terminal output.) The git log --decorate will put by default: the HEAD in cyan the remote branches in red the tag in green and can be changed through color.decorate config. But the git log --format don't offer a way to display specifically the HEAD or remotes or branch: all three are displayed through %d , with one color possible. Update May 2013, as mentioned below by Elad Shahar (upvoted), git 1.8.3 offers one more option: git log –format now sports a %C(auto) token that tells Git to use color when resolving %d (decoration), %h (short commit object name), etc. for terminal output. This Atlassian blog post comments that this feature i

C# In Vc Code Code Example

Example: how to run csharp in visual studio code /* You should have a application if you want to create a application go the folder which is your project now use the command in the dir use the command dotnet new console to intialize it as a console application. Now You will the a file called {You workspace}.csproj go to the file and run it */

Anaconda Conda Command Not Found Code Example

Example: conda not working in terminal export PATH=~/anaconda2/bin:$PATH or export PATH=~/anaconda3/bin:$PATH

Change Height Of Text Field Flutter Code Example

Example: how to decrease the height of textform feild in flutter Widget _buildTextField() { final maxLines = 5; return Container( margin: EdgeInsets.all(12), height: maxLines * 24.0, child: TextField( maxLines: maxLines, decoration: InputDecoration( hintText: "Enter a message", fillColor: Colors.grey[300], filled: true, ), ), ); }

Sharepoint - Cannot Delete Document, Error: The File Is Currently Checked Out Or Locked For Editing By Another User

Answer : If you examine the item using PowerShell you can get a better idea of what is going on. In all the cases where I have seen it the lock expires after short period(20 minutes) and has been caused by word setting a lock when a user has selected to edit the file: $web = Get-SpWeb http://somesite.net $item = $web.GetListItem("/relative/url/to/item.doc") $item.file.LockType $item.file.LockedByUser $item.file.LockExpires If you are facing this error while deleting empty folder "The file is currently checked out or locked for editing by another user.", Then it might be because of there are documents in the library that don't have a major version published. Yo can go into the Library Settings and take ownership of the files. Then delete the entries, and the folder can be deleted. Library Tools > Library > Library Settings > Permissions and Management > Manage files which have no checked in version

10 Digit Mobile Number Validation Pattern In Javascript Code Example

Example: 10 digit mobile number validation pattern in javascript \(?\d+\)?[-.\s]?\d+[-.\s]?\d+