Hi
I want to know that we always use Sorting algorithm like (Insertion Sort or Merge Sort,...) just for lists and arrays?? and we do not use these algorithms for stack or queue ???
thanks
OK, so we all saw the lists of "funny" or "bad" comments.
However, today, when maintaining an old stored proc, I stumbled upon a comment which I couldn't classify other than "refreshingly brutally honest", left by a previous maintainer around a really freakish (both performance and readability-wise) page-long query:
-- Feel free to optimize this if you can understand what it means
So, in the first (and hopefully only) poll type question in my history of Stack Overflow, I'd like to hear some other "refreshingly brutally honest" code comments you encountered or written.
I'm sure there's not just 1 answer to this but, do game engines actually change the vectors in memory, or use gltransformations? Because pushing and popping the matrix all the time seems inefficient, but if you keep modifying the verticies you cant make use of display lists. So I'm wondering how it's done in general. Thanks
I have a custom Dialog that contains only a TextView to display some text in my application. The documentation lists that only the b, i, u, tt, big, small, sup, sub, and strike tags are supported. I really need to add some newlines for readability. Do I need to change to a more complicated layout, or is there some way to encode newlines in the resource? I tried adding br tags, but that did not help.
consider the following python 'code'. it demonstrates the concept of a multi-list comprehension:
start = ['a', 'b', 'c']
middle = ['r', 'a', 'a']
finish = ['t', 'r', 't']
l = [s.upper() + m + f for s in start,
m in middle,
e in finish]
>>> print l
['Art', 'Bar', 'Cat']
Alas, the above code does not work in python.
What would be a good approximation of multi-list comprehension in python?
Please discuss what happens when the lists have different lengths.
I don't even know the proper terminology for this lisp syntax, so I don't know if the words I'm using to ask the question, make sense. But the question makes sense, I'm sure.
So let me just show you. cc-mode (cc-fonts.el) has things called "matchers" which are bits of code that run to decide how to fontify a region of code. That sounds simple enough, but the matcher code is in a form I don't completely understand, with babckticks and comma-atsign and just comma and so on, and furthermore it is embedded in a c-lang-defcost, which itself is a macro. And I want to run edebug on that code.
Look:
(c-lang-defconst c-basic-matchers-after
"Font lock matchers for various things that should be fontified after
generic casts and declarations are fontified. Used on level 2 and
higher."
t `(;; Fontify the identifiers inside enum lists. (The enum type
;; name is handled by `c-simple-decl-matchers' or
;; `c-complex-decl-matchers' below.
,@(when (c-lang-const c-brace-id-list-kwds)
`((,(c-make-font-lock-search-function
(concat
"\\<\\("
(c-make-keywords-re nil (c-lang-const c-brace-id-list-kwds))
"\\)\\>"
;; Disallow various common punctuation chars that can't come
;; before the '{' of the enum list, to avoid searching too far.
"[^\]\[{}();,/#=]*"
"{")
'((c-font-lock-declarators limit t nil)
(save-match-data
(goto-char (match-end 0))
(c-put-char-property (1- (point)) 'c-type
'c-decl-id-start)
(c-forward-syntactic-ws))
(goto-char (match-end 0)))))))
I am reading up on lisp syntax to figure out what those things are and what to call them, but aside from that, how can I run edebug on the code that follows the comment that reads ;; Fontify the identifiers inside enum lists. ?
I know how to run edebug on a defun - just invoke edebug-defun within the function's definition, and off I go. Is there a corresponding thing I need to do to edebug the cc-mode matcher code forms?
Does anyone know where I can get documentation on "Lists Web Service" for SharePoint. I tried this link, but it seems that every child link goes to a random page.
http://msdn.microsoft.com/en-us/library/dd587198(office.11).aspx
Hi
I have dragged a empty asp.net table onto my webform. I generate all the rows in the code behind those.
Now my table gets filled up and has dropdown lists. When the user hits save I go through all the rows and update the values from the dropdownlist in the db.
This works all great. However if 2 columns have each have "Present" then those 2 columns should be not be shown anymore and 2 new columns get put in its place with other dropdown lists.
This all works. However you have to refresh the entire page to for the 2 columns that should go away to go away.
So what I tried to do is at the end of the button click event. Clear the whole table and then regenerate it. However when I do this then my values are not saved to the database anymore for whatever reason.
if (IsPostBack == false)
{
// check if dummy variables exist in db- If true just generate tables with values in db. If not generate them.
}
else
{
// grab the values from the database
// generate tables with the values
}
btn click event
{
go through all rows in table(foreach loop)
update each column in the database with cells in each row. while in foreach loop.
//done
}
So this is how it goes and it works expect(all correct values are saved) the table is just not updated to the user.
Does not work
if (IsPostBack == false)
{
// same code as above
}
// if postback is true do nothing. By the time it gets to the click event it says there is zero rows in the table so nothing happens.
btn click event
{
// same code
}
Fails also.
if (IsPostBack == false)
{
// same code as above
}
else
{
// same code as above but moved into its own method.
gernerateTable();
}
btn click event
{
// update all rows
// once done clear the Tables rows
// call generateTable()
}
This last one does nothing as for some reason it does not update anything. I don't understand why.
So what am I doing wrong with this life cycle something in my process is wrong. The code works just not when I want the table to be updated right away.
This is more to satisfy my curiousity than anything else, but what languages have the best (or worst) documentation and support communities (including IRC, mailing lists, USENET groups, websites, forums, etc)?
If I do --strip-debug or --strip-unneeded, I have the .ko that lists all function names with nm, if I do just strip foo.ko I have a kernel module that refuses to load.
Does anyone know a quick shortcut how to remove all symbols that are not needed for module loading so that people cannot reverse engineer the API:s as easily?
PS: For all you open source bigots; this is something that general public will never be using in any case so no need to turn the question into a GPL flame war.
hey all,
i have a table which contains a bunch of dynamically created radio button lists, im trying to write code which will loop through each one of the radio button list and get the text value of the selected item. i have the following code
foreach ( Control ctrl in Table1.Controls)
{
if (ctrl is RadioButtonList)
{
//get the text value of the selected radio button
}
}
but i am stuck on how i can get the value of the selected item for that given control.
Just what the title says.
Given a build file (.csproj or msbuild.xml or whatever), I'd like to run a msbuild command that lists all the available, defined targets.
Does that function exist?
I know I could do an Xpath search or something, on the build file, but that wouldn't get included files.
I was wondering, since things like display lists are now deprecated, I'm thinking the GLU polygon tesselator is probably also deprecated. What is the new and correct way of creating concave or complex polygons and complying with the new GL 3 standard? Thanks.
I have some data like this:
ID Value
1 AAA
1 ABC
2 dasd
2 dsfdsf
2 dsfsd
3 df
3 dwqef
they are objects(not plain text).
and i want to get all objects with the ID = 2.
I can do a binary binary search and get the index 3,but how can i get (2 and 4) is there any efficient algorithm?
the real problem has lists with about one Million items.
any language except bf and lisp can help.
Hi, I have a groovy list of lists i.e.
list = [[2, 0, 1], [1, 5, 2], [1, 0, 3]]
I would like sort it by order of the first element, then second, then third.
Expected
assert list == [[1, 0, 3], [1, 5, 2], [2, 0, 1]]
I started with list = list.sort{ a,b -> a[0] <=> b[0] } but that only sorts the first element. How do you finish?
Thanks
Hey
I have a data layer which is returning lists of classes containing data. I want to display this data in my form in WPF. The data is just properties on the class such as Class.ID, Class.Name, Class.Description (for the sake of example)
How can i create a custom control or template an existing control so that it can be given one of these classes and display its data in a data-bound fashion.
Thanks :)
Hi
How to protect files (documents, images..) that r being sold over internet.
Is it possible to Deny access to all except a particular php file that lists those documents.
for instance www.mysite.com/list
I have a table created long ago in postgreSQL. Now i want to look at the sql statement used to create it but cannot figure it out.
Also when i do the \dS+ tablename it says table not found, but \dt+ tablename is working fine. The \dS+ lists all the table names owned by the root postgres user and doesn't show up tables that i created with my user account.
Any help is greatly appreciated.
Thanks
Hi guys,
Whats the easiest method of hiding all buttons but not all inputs (say drop down lists, text input boxes) in CSS that works with IE6. The purpose of this CSS file is for printing (using the media="Print" tag in the HTML).
Given a list of numbers how to find differences between every (i)-th and (i+1)-th of its elements? Should one better use lambda or maybe lists comprehension?
Is there any utility for deep cloning for java collections:
Arrays
Lists
Maps
NOTE: prefer some solution without usage of serialization, but with use of Object.clone() method. I can be sure that my custom object will implement clone() method and will use only java-standard classes that are cloneable...
I want to know why we always use Sorting algorithm like (Insertion Sort or Merge Sort,...) just for lists and arrays? And why we do not use these algorithms for stack or queue?
Suppose I have this program, I want to compare 2 input lists. Assume array A and array B. How do I determine the best case and worst case of the function?
Here is my code in [php]:
foreach($array_1 as $k){
if(!in_array($k, $array_2)){
array_push($array_2, $k);
}
}
What is the best case and worst case of the for loop? Please include some explaination, thank you :)