w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Save Properties.Settings.Default items to list, change the values and then save it to the file
You could access the settings by name, like so. Settings.Default["Item1"]; Since you have the naming convention Item + Incrementing Number in your for loop you could do this, for (int i = 0; i < list.Count; i++) { Settings.Default["Item" + i.ToString()] = listBox1.GetSelected(i); } Properties.Settings.Default.Save();

Categories : C#

How can I open, edit and save an MS-Word document programmatically?
Open Office can read and write MS-Word Documents, and their code is open. Probably hard to find the right passages, but better that reverse engineering the format yourself. The code is here: http://openoffice.apache.org/downloads.html

Categories : Objective C

Programmatically save OpenXml document as previous version (Word 2007)
One of the most common causes of this symptom is that the document contains elements/attributes in the Office 14 namespace. As an example, you might have markup like this: <w:rPr> <w:color w:val="5B9BD5" w:themeColor="accent1"/> <w14:shadow w14:blurRad="38100" w14:dist="25400" w14:dir="5400000" w14:sx="100000" w14:sy="100000" w14:kx="0" w14:ky="0" w14:algn="ctr"> <w14:srgbClr w14:val="6E747A"> <w14:alpha w14:val="57000"/> </w14:srgbClr> </w14:shadow> You probably have that w14 namespace declared, but there also needs to be an attribute in the root element

Categories : C#

Save an Image generated during runtime onto the Picture library using File Save picker C# Win 8 Metro App?
var response = await HttpWebRequest.Create(url).GetResponseAsync(); List<Byte> allBytes = new List<byte>(); using (Stream imageStream = response.GetResponseStream()) { byte[] buffer = new byte[4000]; int bytesRead = 0; while ((bytesRead = await imageStream.ReadAsync(buffer, 0, 4000)) > 0) { allBytes.AddRange(buffer.Take(bytesRead)); } } StorageFolder storageFolder = awai KnownFolders.PicturesLibrary.CreateFolderAsync("QR Codes Generator",CreationCollisionOption.OpenIfExists ); //var file = await ApplicationData.Current.LocalFolder.CreateFileAsync(

Categories : C#

Passing a programmatically generated value from a listitem to a jquery function
Try this way: myItem.Attributes.Add("onClick", "test(this);"); And: function test(item) { alert($(item).val()); } There are more options to check element' value: $(item).attr("value"); or without jQuery wrapping: item.value;

Categories : C#

Dynamically change action bar divider color (android:bottom for programmatically generated ShapeDrawable)?
If you can elaborate as to what reason you are changing the color programmatically? It seems a little pointless to do this if you are not also controlling the background color. If you are controlling the background color then you are probably using styles in which case I can think of several methods of doing this. Simon

Categories : Android

How to change the default program to open any Word documents, using C#?
This doesn't really have anything to do with WPF. You'll need to now where Word is installed or add the the folder in which it is located to the Path environment variable. Assuming your file name variable is called fileName and the full path of winword.exe is stored in wordPath (or winword.exe is in the Path), you would need to do something like this - ProcessStartInfo startInfo = new ProcessStartInfo { CreateNoWindow = false, Arguments = fileName, FileName = wordPath }; Process wordProcess = Process.Start(startInfo); Note 1 - your fileName is passed directly to Word. I

Categories : C#

Is it posible to change default search engine from Google.com to some other programmatically for Android browser
I am sorry, but I thing you will not be able to do so. Please go through this I think it might help you.

Categories : Android

How to write rich text to word document generated from htm file in C#
Actually the converting of HTML document to MS Word is a very complex task and there are a lot of cases besides of IMAGE tags which need to be solved. The difference between Open XML and HTML formats is absolutely decisive. If I were you I would look for 3rd party tools for that. It would be chiper to pay for them than spending weeks on investigation and learning of all aspects of the task, writing the code, and then fixing miltiple bugs. Personaly me used Aspose.Words library for that. It worked perfectly fine, but maybe you want to try another one.

Categories : C#

Save the generated file in readonly Zend Pdf
I assume you are trying to set restrictions in the document so that people can't manipulate the document using tools like Preview on OS X and Adobe Illustrator, etc. Unfortunately this is not possible, at least not in Zend_Pdf in ZF1.12. And even if it was, there are several ready-made, easily accessible tools to defeat it, so it doesn't take much determination on part of the user to remove the protection. http://www.wikihow.com/Unsecure-a-Secure-PDF-File

Categories : PHP

How can I run custom tool or save a file programmatically using EnvDTE?
You can use the FindProjectItem method of the EnvDTE.Solution type to find a file within the current solution by it´s name. The ExecuteCommand method is dependent on the current UI context; so the item must be selected, otherwise the call fails. private bool TryExecuteTextTemplate(string filename) { var dte = (DTE2)this.GetService(typeof(SDTE)); Solution solution = dte.Solution; if ((solution != null) && solution.IsOpen) { ProjectItem item = solution.FindProjectItem(filename); if (item != null) { // TODO: track the item in the Solution Explorer try { item.DTE.ExecuteCommand("Project.RunCustomTool"); return true; } catch (COMException) {

Categories : Misc

Spell check merge fields in MS Word programmatically in C# using word interop
In the end I modified the rtf document. I realised that there were oproof tags in the rtf document and after finding out what they meant I decided to remove them. I've also removed lang1024 and langfe1024 which seemed to appear before each oproof tag. Apparently they store information about the language of the formatted field/paragraph. The end result is that the text that comes from merge fields is now spell checked, which is what I wanted. I haven't been able to find any other solution. I hope this post helps someone else as well.

Categories : C#

Sed command won's save the substitutioned word in the file
To make file be updated, you need to add -i: sed -i 's/UNIX/linux/' sara Test $ cat a hello UNIX how are you? I am pretty fine, UNIX Great. Without -i the substitution is outputed but the file is not changed: $ sed 's/UNIX/Sara/' a hello Sara how are you? I am pretty fine, Sara Great. $ cat a hello UNIX how are you? I am pretty fine, UNIX Great. With -i it is the other way round, file replaced no output: $ sed -i 's/UNIX/Sara/' a $ cat a hello Sara how are you? I am pretty fine, Sara Great.

Categories : Unix

Change default save location of projects (or Workspace ) in Android Studio
It's simpler: if you create a project at, say /home/USER/Projects/AndroidStudio/MyApplication from there on all new projects will default to /home/USER/Projects/AndroidStudio. Android Studio: Default project directory

Categories : Android

The word "Array" Added to every file name when trying to save an image - PHP
$_FILES['uploaded'] is an array. Array ( [name] => Array ( [1] => Array ( [0] => ) ) [type] => Array ( [1] => Array ( [0] => ) ) [tmp_name] => Array ( [1] => Array ( [0] => ) ) [error] => Array ( [1] => Array ( [0] => 4 ) ) [size] => Array ( [1] => Array ( [0] => 0 ) ) ) You're probably looking for $_FILES['uploaded'

Categories : PHP

Find an specific word on a file, get the content of the row, and save it on a array
If you are just looking for the line that contains clientegen, then you could try: finalarray = list() with open("fichero_csv.csv") as f: for line in f: #loop through all the lines words = line.split(" ") #get a list of all the words if "clientegen" in words: #check to see if your word is in the list finalarray = words #if so, put the word list in your finalarray break #stop checking any further

Categories : Python

How can I programmatically change the argspec of a function *not* in a python decorator?
A decorator is simply a function that does something with another function. So, technically, you could put the required code directly underneath the foo method and then, technically, you would be changing foo without using a decorator, but it would be a horrible mess. The easiest way to do what you want is going to be to make a decorator that takes a second function (bar in this case) as an argument so it knows which signature to copy. The class code would then look something like: class Blah(object): @copy_argspec(bar) def foo(self, *args, **kwargs): """ a docstr """ result = bar(*args, **kwargs) result = result**2 # just so it's clear we're doing something extra here... return result You'll have to have bar defined before instead of after th

Categories : Python

Is there any way to change word to another word depends on the condition inside the word?
Not sure exactly what you are after, but here is something: var startvalue = 0; if(MINVALUE > 0) { startvalue = MINVALUE; } Else if(MINVALUE < 0) { startvalue = MAXVALUE; } var result = String.Format(@"CREATE SEQUENCE ""MY_TEST_SEQUENCE"" MINVALUE 8 MAXVALUE 999 INCREMENT BY 1 START WITH {0} CACHE 20 NOORDER NOCYCLE",startvalue) Some more clarification of your question would allow for more useful answers.

Categories : C#

Change PHP Generated File Link Into Downloadable Click
You should use the code of the mentioned SO answer in the following way: change the link you display to the following which direct the user to download.php and hands over the information which file to download: echo '<a class="files" href="download.php?file='.$file.'"> ... Then add an download.php with the content of the SO answer but using $filename = $_GET['file']; to get the given filename out of the url. Additionally you have to change header('Content-Type: application/pdf'); to whatever filetype you want to be downloaded.

Categories : PHP

Programmatically get report table type from a Crystal Reports .rpt file usng C#
I'm sure that you can adapt the code from RptToXml: VB version (original) C# version

Categories : C#

change a single word in a file with Bash
As long as new contains no / (slash) character, or any other special character that would confuse sed, this is the sort of pattern you need. for n in "1" "2" "3" "4.5" sed -i "m-th_row/old/$n/" ic.java done Of course, that snippet would just modify the same file repeatedly, which probably wouldn't be helpful, but you get the idea.

Categories : Bash

How do I change this code to use File I/O to Save a "High Score" File for my Game
I'd recommend you look into using the YAML data serializer. It creates a nicely formatted and readable file that is easily read by other languages. require 'pp' require 'yaml' hs = [["RANK", "PLAYER", "SCORE", "DATE"], ["1st", "-", 0, "-"], ["2nd", "-", 0, "-"], ["3rd", "-", 0, "-"], ["4th", "-", 0, "-"], ["5th", "-", 0, "-"], ["6th", "-", 0, "-"], ["7th", "-", 0, "-"], ["8th", "-", 0, "-"], ["9th", "-", 0, "-"], ["10th", "-", 0, "-"]] puts hs.to_yaml Which looks like: --- - - RANK - PLAYER - SCORE - DATE - - 1st - '-' - 0 - '-' - - 2nd - '-' - 0 - '-' - - 3rd - '-' - 0 - '-' - - 4th - '-' - 0 - '-' - - 5th - '-' - 0 - '-' - - 6th - '-' - 0 - '-' - - 7th - '-' - 0 - '-' - - 8th

Categories : Ruby

C++: Default initialize an integral type in a template function
What you need is termed value initialization, which has the effect of zero-initializing built-in types: T t{}; // C++11 T t = T(); // C++03 and C++11 The reason this doesn't work T t(); is that it is a declaration of a parameterless function called t, returning a T.

Categories : C++

I want to change default text on "no file chosen" when we use input="file"
I have used CSS to hide the default text and used a label to show the new text. Have a look- http://jsfiddle.net/ZDgRG/ Choose file input[type=file]{ width:90px; color:transparent; } window.pressed = function(){ var a = document.getElementById('aa'); if(a.value == "") { fileLabel.innerHTML = "Choose file"; } else { var theSplit = a.value.split('\'); fileLabel.innerHTML = theSplit[theSplit.length-1]; } };

Categories : Javascript

R: How to change the default FDR value imbedded in the nbinomTest() function?
nbinomTest merely adjusts for multiple comparisons, you then apply the cutoff yourself. counts(cds1)[which(res$padj < my.fdr),] If on the other hand, you wan't to control the cutoff (specifically, the α alpha) of the FDR procedure itself, then you might need this (have'nt used it tho) PS: BTW, while coding in R, please use consider using <- instead of =

Categories : R

web2py: change default controller and function
Just use this part: routers = dict( BASE = dict( default_application = "myapplication", default_controller = "mycontroller", default_function = "home", functions = ['other', 'functions', 'in', 'default', 'controller'], ) ) Note, you should list the other functions in the default controller so the router will still be able to remove the default function name even when there are other args in the URL.

Categories : Python

Is it possible to change a function's default parameters in Python?
Just use functools.partial multiplyNumbers = functools.partial(multiplyNumbers, y = 42) One problem here: you will not be able to call it as multiplyNumbers(5, 7, 9); you should manually say y=7 If you need to remove default arguments I see two ways: Store original function somewhere oldF = f f = functools.partial(f, y = 42) //work with changed f f = oldF //restore use partial.func f = f.func //go to previous version.

Categories : Python

Setting default value in Oracle Object Type Constructor Function
In your second code block, you aren't calling the constructor that only has two arguments. Passing a null argument doesn't mean you use the other constructor, you're calling the (default) constructor with four arguments, two of which just happen to be intentionally null. You're effectively doing: TYPE_MAIN(col1 => '1', col2 => NULL, col3 => NULL, col4 => NULL) not TYPE_MAIN(col3 => '1', col4 => NULL) So this works: INSERT INTO TAB_MAIN(PKEY,COLTEST,COLNEW) VALUES(1,'TESTCOL2',TYPE_MAIN('3','4')) / ... PKEY COLTEST COLNEW ---------- --------------- -------------------------------------------------- 1 1 TESTCOL TYPE_

Categories : Oracle

lambda closure type and default argument in function template
Can I suggest a workaround? Remove the default template argument for function3 (and function4): template<typename F> int function3(F f = [](int i){return 0;}) { return 0; } You can call it like this: function3<func1>(); but I guess you want to be able to call like this: function3(); Don't you? Then, create another overload of function3 which is a function and not a template function: int function3(func1 f = [](int i){return 0;}) { return function3<func1>(f); }

Categories : C++

How to get type of a function by its name/pointer at compile-time for a template parameter default value?
I guess you got pretty close to it: template <typename TreeNode, typename Visitor = decltype(default_visitor<TreeNode>)> void binary_tree_traverse(TreeNode* root, Visitor visitor = default_visitor<TreeNode>) { visitor(root); }

Categories : C++

How to change the word order of phrasal verbs in a POS-tagged corpus file
I wouldn't recommend using regular expressions here. It's definitely not as intuitive as just iterating over each line after being split on whitespace, possibly rearranging the list, and finally joining. You can try something like this, reordered_corpus = open('reordered_corpus.txt', 'w') with open('corpus.txt', 'r') as corpus: for phrase in corpus: phrase = phrase.split() # split on whitespace vb_index = rp_index = -1 # variables for the indices for i, word_pos in enumerate(phrase): pos = word_pos.split('_')[1] # POS at index 1 splitting on _ if pos == 'VB' or pos == 'VBZ': # can add more verb POS tags vb_index = i elif vb_index >= 0 and pos == 'RP': # or more part

Categories : Python

How to change the default size of a font file?
I've googled a way using fontforge.fontforge change font size After installation, open the font file you want to change. The detailed steps are as follow: go to: Edit>Select>SelectAll (all characters should be selected) go to: Element>Tansformations>Transform On the transform menu, I have chosen to increase by 20%...make sure all boxes below are checked. Click ok It should now render them 20% larger (or whatever you choose) go to: File>Generate Fonts make sure you change filename to keep the original clean and de-select validate - otherwise you will get about 200 warnings Click ok...there will be a couple of warnings that appear, but I have not found any visible font issues or errors-you can ignore them - hat is it. When you close Font Forge, it will ask you about saving changes...if y

Categories : Linux

how to change soup file to 'dict' save?
What you're asking is to find the table row data, mapped to the table header linked as the table's caption as a key. { table[0].caption: { th[n] : [ col[n][0], col[n][1], col[n][1]] } } So you need to break down the task into: Getting the caption for the table Getting the table headers Looping over each row of the table, saving each td's index as its respective column in the table. Instead of writing the code for you, I can point you in the direction for the documentation for doing searches in an HTML document. Please ask more specific questions and we can give you a more direct answer though, in the future.

Categories : Python

How to add a fragment to a programmatically generated layout?
At some point, I suppose you will add your programatically created LinearLayout to some root layout that you defined in .xml. This is just a suggestion of mine and probably one of many solutions, but it works: Simply set an ID for the programatically created layout, and add it to the root layout that you defined in .xml, and then use the set ID to add the Fragment. It could look like this: LinearLayout rowLayout = new LinearLayout(); FragmentManager fragMan = getFragmentManager(); FragmentTransaction fragTransaction = fragMan.beginTransaction(); rowLayout.setId(whateveryouwantasid); // add rowLayout to the root layout somewhere here Fragment myFrag = new ImageFragment(); fragTransaction.add(rowLayout.getId(), myFrag , "fragment" + fragCount); fragTransaction.commit(); Simply choose

Categories : Android

Emacs equivalent of Vim's word motion and change in-line word
You can use universal-argument. There are two ways to move 3 words forward: C-u3M-f C-3M-f But that's usually slower than doing M-f 3 times. You know you don't have release M, right? I do not know what vim's civ does, but to go to a word just search for it with C-s. If you like to jump around have a look at Ace Jump. It works like the follow links feature of browser plugins like vimperator. With it you can jump to lines, word or even chars. Ok, I don't think there is a built-in for that. Maybe this function helps: (defun delete-word-at-point () "Delete word at point." (interactive) (let* ((p (point)) (beg (+ p (skip-syntax-backward "w_"))) (end (+ beg (skip-syntax-forward "w_")))) (kill-region beg end))) Put it in your ~/.emacs and bind to where yo

Categories : Vim

Is it possible to get a default value for my image which has an input field of type 'file' in cakephp when I do an edit?
PHP's super global of $_FILES should give you enough information to automatically name your image based on the filename. Try adding if ($this->request->is('post') || $this->request->is('put')) { pr($_FILES); ... to your controller function to see what data is being passed through the $_FILES global and use the name that it provides. It would be something like $_FILES['image'][0]['name'];. There are also all kinds of information like the size of the file, dimensions, etc. for you to save to the database.

Categories : Jquery

How to change automatically the type of the excel file from Tab space separated Text to xls file?
mv file.{xls,csv} It's a csv file, stop treating it as an excel file and things will work a lot better. :) There are nice csv manipulation tools available in most languages. Do you really need the excel library?

Categories : Python

How to update programmatically generated UILabels using CADisplayLink?
Upon creation I would set the tag for each label, incrementing each tag value in parallel with the index of the array that you're creating them from. Then you can grab them in whatever selector you declare for your CADisplayLink object from their particular view using for (int i = 0; i < [arrayOfData count]; i++){ UILabel *label = (UILabel*)[self.view viewWithTag:i]; //update label } Hope I understood your question correctly

Categories : IOS

Closures in programmatically generated Eloquent OR queries
Try this: $thing_query->where(function($q) use($or_list) { ... http://blog.dubbelboer.com/2012/04/07/php-use-keyword.html

Categories : PHP

Streaming programmatically generated audio to browser
Just have look at Media source API( under implementation). this would be what you are required. window.MediaSource = window.MediaSource || window.WebKitMediaSource; var ms = new MediaSource(); var audio = document.querySelector('audio'); audio.src = window.URL.createObjectURL(ms); ms.addEventListener('webkitsourceopen', function(e) { ... var sourceBuffer = ms.addSourceBuffer('type; codecs="codecs"'); sourceBuffer.append(oneAudioChunk); //append chunks of data .... }, false);

Categories : Javascript



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