w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories
Replace existing content = local storage + existing content. Javascript, WebStorage, LocalStorage
The original script did not provide the means to load the logs from localStorage, and stored new input under the "logs" key, while the intent was to prepend. The solution is quite simple: load from localStorage on page load, and overwrite localStorage['logs'] with the contents of logContents as displayed on the page. .... window.onload = function(){ existing_log = localStorage.getItem("logs"); console.log(existing_log); if (existing_log){document.getElementById("logContent").innerHTML = existing_log;} } function enterPressed() { if (textBox.value == "") { return; } else { var logText = today + ":" + " " + document.getElementById("textBox").value + '<br> '; $("#logContent").prepend(logText); // Prepend textBox's content to the top of

Categories : Javascript

Using Powershell to edit/modify a GPO
UPDATE: I found a way to directly modify the GPO's ini file on the DC. As this solution does NOT use any API, I consider this a HACK; however, thus far it's the only solution I've encountered. From what I've been able to glean (from my limited workings in that world) about AD Architecture & DC Replication, The SYSVOL section of the DC will be replicated to other DC's in the Forrest, same as if the changes were made via MMC. Can anyone confirm this? Note: As far as I can tell, this script must be run locally from a DC in the same org as the GPO being affected. $GPO = copy-gpo -SourceName "$GPOTemplateName" -TargetName "$NewGPOName" -CopyACL #Found post referencing how to Manually Edit GPO's: http://blogg.husbanken.no/it/2013/04/13/manually-edit-gpo-settings/ $adGPO=[ADSI]"LDAP://

Categories : Powershell

How to edit existing rrule?
I am not aware of public interface for this, but if you really need to then setting _until property directly seems to work. I should warn you that it is a bad practice to use it and this code could be broken by future releases of dateutil. >>> r = rrule(DAILY,dtstart=datetime(2013,7,15,0,0,0), until=datetime.now()) >>> list(r) [datetime.datetime(2013, 7, 15, 0, 0), datetime.datetime(2013, 7, 16, 0, 0), datetime.datetime(2013, 7, 17, 0, 0), datetime.datetime(2013, 7, 18, 0, 0), datetime.datetime(2013, 7, 19, 0, 0), datetime.datetime(2013, 7, 20, 0, 0), datetime.datetime(2013, 7, 21, 0, 0), datetime.datetime(2013, 7, 22, 0, 0), datetime.datetime(2013, 7, 23, 0, 0)] >>> r._until = datetime(2013, 7, 20, 0, 0) >>> list(r) [datetime.datetime(2013, 7,

Categories : Python

Edit existing pdf file using pdflib
$pdf = pdf_new(); pdf_begin_document($pdf, "", ""); //////////////// // OPEN PDF DOC // infilename : input pdf's full path doc = pdf_open_pdi_document($pdf,$infilename, ""); if (doc == -1) throw new Exception("Error: " + pdf_get_errmsg()); // OPEN PDF PAGE FROM DOC // pageno : page no i.e 1 page = pdf_open_pdi_page($doc, $pageno, ""); if (page == -1) throw new Exception("Error: " + pdf_get_errmsg()); /////////////// pdf_begin_page($pdf, $bleedw,$bleedh); ////////////// // out put pdf page pdf_fit_pdi_page(page, 0, 0, "adjustpage"); pdf_close_pdi_page(page); ///////////// pdf_arc($pdf,2.63*72,1.13*72,(2*72/2),270,90); pdf_arc($pdf,.25*72,$bleedh-.25*72,(.25*72/2),90,180); pdf_arc($pdf,.25*72,.25*72,(.25*72/2),180,270); pdf_lineto($pdf,2*72/2,$bottom); pdf_closepath_stroke($p

Categories : Misc

Using PowerShell in nuget package to edit Global.asax
from what I can see, there is some problem with this line since it will return nothing: $customGlobalAsax = $project.ProjectItems | ForEach-Object { $_.ProjectItems } | where { $_.Name -eq "Global.asax.cs" } The following is my test: $directory = dir * $directory | foreach {$_.name} The above run successfully. But the following returns nothing: $directory = dir * $directory.name | foreach {$_.name} I believe in the latter case $_.name represents $directory.name.name which doesn't exist. So it seems like this line in your script $customGlobalAsax = $project.ProjectItems | ForEach-Object { $_.ProjectItems } | where { $_.Name -eq "Global.asax.cs" } should be changed to: $customGlobalAsax = $project | ForEach-Object { $_.ProjectItems } | where { $_.Name -eq "Global.asax.cs

Categories : C#

How to edit existing place with Google Places API
The Places Photo service is a read-only API that allows you to easily add high quality photographic content to your application. https://developers.google.com/places/documentation/photos Did you not understand the 'read-only' part?

Categories : Api

poi read existing excel and edit with large data
There are a few options available, but none that are a "silver bullet" simple answer. Unfortunately, the Excel file formats do require a fair bit of memory to work with. Increase the heap size given to Java, so it can hold more in memory at a time Buy some more memory for your server, then increase the heap size. Memory is pretty cheap these days, and it doesn't take very many hours wage of a decent programmer to cover the cost Use a different file format - CSV for example is very lightweight on the memory footprint Use the low level SAX API to read in the .xlsx file, then use SXSSF to write it out again without much buffering. Needs quite a lot of custom coding though, much more work for you than just using HSSF/XSSF Contribute / sponsor the contribution of memory improvements to Apache

Categories : Performance

ASP.NET MVC Jasny How to check existing file in edit operation
Add a hidden field to your view which exposes a property of your viewmodel indicating the existence of your image. View @Html.HiddenFor(model => model.HasImage) ViewModel public bool HasImage { get { return !string.IsNullOrEmpty(this.ImagePath); } } Now in your controller if (file != null) { // Save your Image } else if (!model.HasImage) { articleToUpdate.ImagePath = null; } You may need to add a button/javascript to your view so the user can delete and change the value of the hidden field HasImage.

Categories : Asp Net Mvc

How to edit an existing pdf document in an iOS application using any third party libraries.
you can try with fastpdfkit. Download the sample code form github and make use of it.

Categories : Iphone

Drupal 7 - Hide certain form fields of a content edit form depending on the content data
function your_module_form_alter(&$form, &$form_state, $form_id){ switch($form_id) { case 'nameOfTheNode_node_form': //your code here. check the value from from_state. break; } }

Categories : Forms

How do I disconnect form an existing connection to a network location in PowerShell?
Use Test-Path cmdlet. It will return $false if the path is not valid. That is, the path is non-existing or insufficient user rights prevent access. Like so, PS C:> test-path k: # There is no k: drive False PS C:> test-path \ServerWithoutPermissionsc$ False PS C:> test-path \NonExistingHostshare False

Categories : Dotnet

all the fields are not showing to already existing customers on edit page in nested form on rails
At the time your old users where created these associations didn't exist. So if an old user now wants to edit its profile stuff like: <%= f.fields_for :user_nickname_live do |user_nickname_live| %> can't disply anything because the association hasn't been built in your DB. You could create a migration, or a rake task, or a background task or fix it in irb to addthe associations for the old users users I didn't tried it, but it should work. create a migration call it e.g: build_user_nickname_live_associations and put inside: def up users = User.find(:all) users.each do |u| unless u.nick_name_live.present? u.build_nick_name_live u.save end end end

Categories : Ruby On Rails

Add Content in Powershell
There are two common ways for inserting text into a text file: Process the input file(s) line-by-line, write the output to a temporary file and replace the input file(s) with them temp file afterwards. for ($file in $files) { $filename = $file.FullName Get-Content $filename | % { if ( $_ -match 'seach pattern' ) { $_ "new line" } } | Out-File $tempfile MoveItem $tempfile $filename -Force } Read the entire content of the file(s), insert the text by using a regular expression replacement, and write the modified content back to the file(s). for ($file in $files) { $text = [System.IO.File]::ReadAllText($file.FullName) $text -replace '.*search pattern.*', "`$0`nnew line" | Out-File $file.FullName }

Categories : Powershell

Powershell. Get-content for every file
Your question isn't very clear, if you want to go though every file in the old directory and replace in the contents 'TEST-4' with a random number then output to a new directory then try this: Get-Childitem -Path .old -Filter *.edifact | % { Get-Content $_.FullName | % { $_ -Replace ('TEST-4', (Get-Random).ToString()) } | out-file (Join-Path '. ew' $_.Name) }

Categories : Powershell

How to edit content in uploaed war file in AWS
you can ssh to the instance which is generated by the Elastic Beanstalk application But you need to have .pem file to ssh to the ec2 instances, I am not sure you have access to .pem file. usually it will be in /var/lib/tomcat dir. But you can use find command to file the war file. Also its not suggested to edit your files in the server itself. Better make use of the version control management like github or bit bucket

Categories : Amazon

Jquery Edit Div Content After Resizing The Div
Try this with destroy instead of disable and see if it works as you expect it to: $("#edit").click(function(){ $(".draggable").draggable("destroy"); $(".draggable").resizable("destroy"); $("div").get(0).contentEditable = "true"; });

Categories : Jquery

Determine if webpage has content using PowerShell
1) Scrape Page You're off to a good start. The DownloadString method will download the HTML. 2) If content exists -> send email Depends on the content you are looking for. You can use the comparison operators -match or -like or string methods Contains() to test. Then put into an if/else block e.g. $string = $web.DownloadString("http://somewebsite") if ($string -match "regex_here") { Send-MailMessage -SmtpServer your_server -To to.address@domain -From from.address@domain -Subject foo -Body bar } else { # not necessary unless there is something you want to execute here. } Notice I used the Send-MailMessage cmdlet to send the email. 3) ELSE -> close. See above.

Categories : Powershell

Get ID-specific div from a remote page, then edit its content
use dom document to loadhtmnl content. $dom = new DOMDocument(); $dom->loadHTML($html); $path = new DOMXPath($dom); $divContent = $xpath->query('//div[id="MDiv"]');

Categories : PHP

Edit specific parts of generated content
I would not want to use jQuery for something like this because you can't really assume that the user has JavaScript enabled. Regarding the images, it looks like you can use the image_send_to_editor filter (see http://wordpress.stackexchange.com/questions/20998/automatically-wrap-post-image-in-div for details).

Categories : PHP

In WiX using edit control, How do I make sure the content is not empty
I figured out myself. <Dialog Id="MyDlg_Error" Width="260" Height="85" NoMinimize="yes" Title="!(loc.InvalidTextTile)"> <Control Id="MyDlgSkipDesc" Type="Text" Width="194" X="48" Y="15" Height="30" Text="!(loc.InvalidTextDesc)" /> <Control Id="warningIcon" Type="Icon" X="15" Y="15" Width="24" Height="24" ToolTip="Information icon" FixedSize="yes" IconSize="32" Text="warning.ico" /> <Control Id="Ok" Type="PushButton" X="97" Y="57" Width="66" Height="17" Text="!(loc.InvalidTextOK)" /> </Dialog> <Publish Dialog="MyInstallDirDlg" Control="Next" Event="SpawnDialog" Value="MyDlg_Error" Order="5"><![CDATA[Not (WIXUI_SQLAGENTIP <> "" AND WIXUI_SQLAGENTPORT <> "")]]></Publish&

Categories : Wix

Powershell - Replace XML content with an environment variable
You need to put the environment variable inside double quotes so it can be expanded. Single quoted strings are not expandable: ... -replace '<Password>(.*?)</Password>', "<Password>$env:HIS_PWD</Password>"

Categories : Xml

String replace file content with PowerShell
Use (V3 version): (Get-Content c: emp est.txt).replace('[MYID]', 'MyValue') | Set-Content c: emp est.txt Or for V2: (Get-Content c: emp est.txt) -replace '[MYID]', 'MyValue' | Set-Content c: emp est.txt

Categories : Powershell

How can I align a div element in existing content
Try out below css to position the image with out modifying the html content: .myimg { margin-top: 100px; } div.myimg + p { position: absolute; top: 0px; left: 0px; } Have a look at the working demo here: Demo

Categories : CSS

adding div to existing 100% height content
When you set <div id="outfit-area"> to height:100%, it takes on 100% of the height of the parent element - in this case <div id="outfit-wrapper">. When you add the header, outfit-area is STILL taking 100% of outfit wrapper which now includes the header. You need to either: A. Give <div id="header"> a percentage height and then subtract that height from 100% and use this value as the percentage height for <div id="outfit-area">, like this: #header { height: 10%; } #outfit-area { height: 90%; } Edit: Here's a fiddle demonstrating: http://jsfiddle.net/CVwCr/ -OR- B. Nest the header inside of <div id="outfit-area"> so that it's height isn't being added to ` like so: <div class="ui-droppable" id="outfit-area"> <!-- drop to this area -->

Categories : HTML

Edit email content with a plugin on a quick campaign
Found the solution which is to simply use the plugin on Create Email Pre-Operation instead of Pre-Validation like I was doing. For some reasons, the Pre-Validation doesn't trigger when emails are created in the background.

Categories : Email

Dynamically reading select XML content into Hashtable using Powershell
The issue is that you're calling the following: $securities.add=($i,$CUSIP,$Int_Rate,$Issue_Date,$Maturity_Date) The problem is with the equals sign there. What that actually does is insert a record with a key "add" with the rest of the values as the value. What you really want is to add a record with the key $i and a value of everything else. Try creating a [pscustomobject] of the rest of the values, and adding them to the hashtable, like so: $securities.add($i, [pscustomobject]@{'CUSIP'=$CUSIP;'Int Rate'=$Int_Rate;'Issue Date'=$Issue_Date';'Maturity Date'=$Maturity_Date}) EDIT: Try doing either of the following: ($securities.Jul_2012.xml).CUSIP or $securities['Jul_2012.xml'].CUSIP

Categories : Xml

Get-Content with wait parameter doesn't update in Powershell
Not allowed to comment (don't have a 50 reputation), so have to give an Answer.... Less for Windows (http://gnuwin32.sourceforge.net/packages/less.htm) with the +F or Shift-F option (http://www.commandlinefu.com/commands/view/1024/make-less-behave-like-tail-f.) showed updated file content where PowerShell "get-content $path -wait" did not.

Categories : Powershell

PowerShell Get-Content and replace object in a specific line
Check if a line is starting with a 'Static Text ' followed by a sequence of word characters and return your string in case there a match: Get-Content $OptionsFile | foreach { if($_ -match '^Static Texts+(w+s)+') { 'Static Text MachineX MachineY' } else { $_ } }

Categories : Regex

Powershell to output folder based on content lastwritetime
I am not completely sure, if I got your question right, but my little script shows all items, who have been changed in the last day and the time of change + the directory: $directories = (Get-ChildItem -Path C: est -Directory).FullName $directories | foreach {if (($_.lastwritetime -gt (get-date).adddays(-1)) -or ((get-childitem -path $_ -Recurse).lastwritetime -gt (get-date).adddays(-1))) { $itemname = (Get-ChildItem -Path $_ -Recurse | where {$_.LastWriteTime -gt (get-date).AddDays(-1)}).BaseName $itemtime = (Get-ChildItem -Path $_ -Recurse | where {$_.LastWriteTime -gt (get-date).AddDays(-1)}).LastWriteTime $_ >> C: imestamp.txt; $itemname >> C: imestamp.txt; $itemtime >> C: imestamp.txt;

Categories : Powershell

Error when trying to edit Content Query Web Part in SharePoint 2013
Going through your logs, the error you are getting is System.ArgumentNullException: Key cannot be null. Parameter name: key at System.Collections.SortedList.IndexOfKey(Object key) at System.Collections.SortedList.ContainsKey(Object key) at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryToolPart.AppendListTypes(SortedList sortedListItems, SPListTemplateCollection listTypes) at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryToolPart.populateListTypeDropDown() at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryToolPart.populateCBQControls() at Microsoft.SharePoint.Publishing.WebControls.ContentByQueryToolPart.OnPreRender(EventArgs e) at System.Web.UI.Control.PreRenderRecursiveInternal() at System.Web.UI.Control.PreRe

Categories : Sharepoint

Xcode/iOS-Cannot edit content of Table View Cell...I'm using the storyboard editor
![enter image description here][1]Got it, the cell you used is auto layout, do not check the auto layout in the xib or storyboard! Interface Builder Document->Use Auto Layout Don't check it!

Categories : IOS

How do I perform Core Data Migration to an existing app, if all I'm changing is the SQL Db's content?
Don't work on the SQLite-Database directly. Change all your Data through NSManagedObjectContext! To find a good strategy look up examples from Batch-Importing. Update: You could actually have two PersistentStores (one with just static data (readonly) and the other one with user-generated data). You could interchange the readonly which you prefilled with a commandline util and downloaded from a server. You cannot have direct relationships between those two store though. I would say that it depends on the amount of data in this prefilled store wether you should go this way or just use a plist and reference some string constants in your user data store. Try to do it with a plist as this is the simpler approach.

Categories : IOS

Powershell add newest file in directory to existing file
I will assume you are attempting to get the contents of "C:lah.txt" and add that to "C:lah2.txt"? At the moment you currently get 1 item ("C:Blah.txt") then sort it by last write time, then select 1 (there is only ever one), then add the output to "C:lah2.txt". This will write whatever the regular output is to the file. If you want to write the contents of blah into blah2 you're missing a vital step: Get-ChildItem "C:lah.txt" | sort LastWriteTime | select -last 1 | Get-Content | add-content "C:lah2.txt" After removing redundant calls: Get-ChildItem "C:lah.txt" | Get-Content | add-content "C:lah2.txt" Hope this helps.

Categories : Powershell

How can I programmatically add content to new/existing executable using c# and possibly make the solution work on a mac?
I think that it's true for most binary file formats (including the executables), appending data to a well-formed file will not affect the usage of the file, the way it is typically interpreted by most programs. You could, maybe, take advantage of this. To embed, you'll need to take your (existing) target executable and simply append some binary data to it. That data will have two parts: A magic word (to denote the presence of an appended resource) The resource itself. So, this: [target executable data] Becomes this: [target executable data] [magic word] [resource] To read the resource from the target executable, simply have that executable open itself, search for the magic word and, if it's present, start reading the resource appended after it. This is what WinRAR does (or at l

Categories : C#

Change the Query String Content edit or split from web config file (QUERY_STRING server variable)
Use the UriBuilder and HttpUtility to do this. First drop the URL into the UriBuilder: var uri = new UriBuilder(url); uri.Port = -1; now work with the query string: var query = HttpUtility.ParseQueryString(uri.Query); then remove the ones you don't want: query.Remove("parmName"); and then put it back together: uri.Query = query.ToString(); var newUrl = uri.ToString();

Categories : C#

Magento Admin section - Rewrite custom options in products edit displays blank content
Found out the issue It was the space between the <catalog_product_edit_tab_options> tag which was creating the problem. I changed <catalog_product_edit_tab_options> Mymodule_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option </catalog_product_edit_tab_options> to <catalog_product_edit_tab_options>Mymodule_Adminhtml_Block_Catalog_Product_Edit_Tab_Options_Option</catalog_product_edit_tab_options> in the config.xml. An error if displayed would have saved me lots of time.

Categories : PHP

Click event for edit/delete button when tableview is in edit mode
If you are using your custom button as a subview then you can addTarget to your button like this: [button addTarget:self action:@selector(yourMethod) forControlEvents:UIControlEventTouchUpInside]; Please be specific or show some screenshots. So that I can figure it out.

Categories : Iphone

How to save, delete, edit data to PHP / Mysql with inline edit in CKEditorsaving?
Below is a example on how to pass data from the Ckeditor. By pressing the button you can save the content via ajax. <div id="editable" contenteditable="true"> <h1>Inline Editing in Action!</h1> <p>The div element that contains this text is now editable. </div> <button type='button' id='save'><span>Save</span></button> <script> $(document).ready(function (e) { $("#save").click(function (e) { var data = CKEDITOR.instances.editable.getData(); var options = { url: "/path/to/php", type: "post", data: { "editor" : encodeUriComponent(data) }, success: function (e) { //code to do when success } };

Categories : PHP

how to configure or edit wp-filebase plugin edit to show author of files
yes we can configure the plugin without touching the code. However, following link was very helpful to me. documentation for the templates

Categories : PHP

How to show data in tabular format in asp.net mvc & perform edit operation without providing edit button in each row?
You are looking for an "inline edit" then I believe. You are probably going to need some Javascript to get a nice effect for this. I like JQuery, so I'd use JEditable. I'd suggest you have a read of this article: http://www.codeproject.com/Articles/265211/Using-JEditable-plugin-as-ASP-NET-MVC3-jQuery-inli Scroll to the section called "Integration with DataTables"

Categories : Asp Net Mvc



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.