on-internet

Why can't I pass a C-style multidimensional array to a function taking an array of int*?

#include<stdio.h> void print(int *arr[], int s1, int s2) { int i, j; for(i = 0; i<s1; i++) for(j = 0; j<s2; j++) printf("%d, ", *((arr+i)+j)); } int main() { int a[4][4] = {{0}}; print(a,4,4); } This works in C, but not in C++. error: cannot convert `int (*)[4]' to `int**' for argument `1' to `void print(int**, int, int)' Why does it not work in C++? What change is needed to be made?

Join the discussion →

How can I make a regular expression to be non-greedy?

I'm using jQuery. I have a string with a block of special characters (begin and end). I want get the text from that special characters block. I used a regular expression object for in-string finding. But how can I tell jQuery to find multiple results when have two special character or more? My HTML content: <div id="container"> <div id="textcontainer"> Cuộc chiến pháp lý giữa [|cơ thử|nghiệm|] thị trường [|test2|đây là test lần 2|] chứng khoán [|Mỹ|day la nuoc my|] và ngân hàng đầu tư quyền lực nhất Phố Wall mới chỉ bắt đầu. </div> </div> And my JavaScript code: $(document).ready(function() {

Join the discussion →

Cannot import the keyfile 'blah.pfx' - error 'The keyfile may be password protected'

We just upgraded our Visual Studio 2008 projects to Visual Studio 2010. All of our assemblies were strong signed using a Verisign code signing certificate. Since the upgrade we continuously get the following error: Cannot import the following key file: companyname.pfx. The key file may be password protected. To correct this, try to import the certificate again or manually install the certificate to the Strong Name CSP with the following key container name: VS_KEY_3E185446540E7F7A This happens on some developer machines and not others. Some methods used to fix this that worked some of the time

Join the discussion →

Reverse Engineer a .pyo python file

I have 2 .pyo python files that I can convert to .py source files, but they don't compile perfectly as hinted by decompyle's verify. Therefore looking at the source code, I can tell that config.pyo simply had variables in in an array: ADMIN_USERIDS = [116901, 141, 349244, 39, 1159488] I would like to take the original .pyo and disassembly or whatever I need to do inorder to change one of these IDs. Or.... in model.pyo the source indicates a if (productsDeveloperId != self.getUserId()): All I would want to do is hex edit the != to be a == .....Simple with a windows exe program but I can't find

Join the discussion →

Login failed for user 'DOMAIN\MACHINENAME$'

I know this is almost a duplicate of : The error "Login failed for user 'NT AUTHORITY\IUSR'" in ASP.NET and SQL Server 2008 and Login failed for user 'username' - System.Data.SqlClient.SqlException with LINQ in external project / class library but some things don't add up compared to other appliations on my server and I am not sure why. Boxes being used: Web Box SQL Box SQL Test Box My Application: I have an ASP.NET Web Application, which references a class library that uses LINQ-to-SQL. Connection string set up properly in the class library. As per Login failed for user 'username' - System.Da

Join the discussion →

How to get the Current Date & Time Automatically to a Date Time Field

I have created a date time field I made today's date as the default value, Then I added it to a page layout and created a page, But the current Date Time is not picking up from the system. I dont want to give the user to select a Date Time instead it should populated automatically Is there anyway to achieve this without writing code in code behind files?

Join the discussion →

Limiting the number of characters per line with CSS [duplicate]

I have a paragraph of text: <p>Lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum</p> How can I make sure that no more than 30 characters are shown on one line with CSS?

Join the discussion →

What are the elegant ways to do MixIns in Python?

I need to find an elegant way to do 2 kinds of MixIns. First: class A(object): def method1(self): do_something() Now, a MixInClass should make method1 do this: do_other() -> A.method1() -> do_smth_else() - i.e. basically "wrap" the older function. I'm pretty sure there must exist a good solution to this. Second: class B(object): def method1(self): do_something() do_more() In this case, I want MixInClass2 to be able to inject itself between do_something() and do_more(), i.e.: do_something() -> MixIn.method1 -> do_more(). I understand that probably this would require modifying class B - that's o

Join the discussion →

HTML Minification in C#

Tried searching around for a complete library for HTML Minification in C# but haven't been able to locate anything that is useful ? Does anyone here have such a library or know of one ?

Join the discussion →

How do I sign EXE files and DLL files with my code signing certificate?

I purchased a code signing certificate from Thawte and have been going out of my mind with frustration at the whole process. What I have from them are: .spc / .p7b file .pvk file (Note: I do not have a PFX file from them. God knows why, but I have been fighting with their technical support for a week) In any case, I find "help" links on their site and at Microsoft for signcode.exe, which is useless for me, because I can't find that EXE file on my machine. However, I do have signtool.exe. Unfortunately, i am mystified at the command line parameters listed on this Microsoft help site. Specifical

Join the discussion →

Rails - How can I detect if the content_for content was provided?

I want to detect if content was provided for content_for tag in my template, and if not fall back to default value: <title> <% if content_is_provided -%> <%= yield :title -%> <% else -%> 404 - Page Unknown <% end -%> </title> Any easy way to detect this? I tried <% if :title -%> but that didn't do much. thanks.

Join the discussion →

Fastest way to calculate an X-bit bitmask?

I have been trying to solve this problem for a while, but couldn't with just integer arithmetic and bitwise operators. However, I think its possible and it should be fairly easy. What am I missing? The problem: to get an integer value of arbitrary length (this is not relevant to the problem) with it's X least significant bits sets to 1 and the rest to 0. For example, given the number 31, I need to get an integer value which equals 0x7FFFFFFF (31 least significant bits are 1 and the rest zeros). Of course, using a loop OR-ing a shifted 1 to an integer X times will do the job. But that's not the

Join the discussion →

Sending email through proxy using gmail smtp

Trying to send some email in my C# app. I am behind a proxy - which is no doubt why the code isn't working. This is what I have so far: App.Config: <system.net> <defaultProxy enabled="false"> <proxy proxyaddress="xxx.xxx.xxx.xxx"/> </defaultProxy> <mailSettings> <smtp deliveryMethod="Network"> <network host="smtp.gmail.com" port="587"/> </smtp> </mailSettings> </system.net> Code: var username = "..."; var password = "..."; var fromEmail = "..."; var toEmail = "..."; var body = "Test email body"; var subject = "Test Subject Email"; var client = new SmtpClient("smtp.gmail.com", 587) { Credential

Join the discussion →

Connection Error:Oracle.DataAccess.Client.OracleException ORA-12170

This has taken many hours of mine. I have to get this .Net app to run on an XP system. Someone seems to have messed up some files so conn.Open() in the C# is causing this error: Connection Error:Oracle.DataAccess.Client.OracleException ORA-12170: TNS:Connect timeout occurred at Oracle.DataAccess.Client.OracleException.HandleErrorHelper(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, OpoSqlValCtx* pOpoSqlValCtx, Object src, String procedure) at Oracle.DataAccess.Client.OracleException.HandleError(Int32 errCode, OracleConnection conn, IntPtr opsErrCtx, Object src) at Oracle.DataAccess.Cl

Join the discussion →

What Are Collections Implemented As In VB6?

So a collection in VB6 keeps track of a key for each object, and you can look up the object by its key. Does that mean collections are implemented as some sort of hashtable under the hood? I realize you can have multiple items with the same key in a collection, hence the SOME SORT. Anybody know what type data structure a VB6 collection is supposed to represent?

Join the discussion →

WPF item container recycling

I want to implement a custom Canvas that recycles containers when used as an ItemsPanel. So I derived from VirtualizingPanel and override the ArrangeOverride and MeasureOverride. I am doing the generation in MeasureOverride like this: var children = base.InternalChildren; var itemsControl = ItemsControl.GetItemsOwner(this); var itemsCount = itemsControl.Items.Count; IItemContainerGenerator generator = itemsControl.ItemContainerGenerator; var startPos = generator.GeneratorPositionFromIndex(0); using (generator.StartAt(startPos, GeneratorDirection.Forward, true)) { for (int i = 0; i < itemsCount

Join the discussion →

SVN Question regarding branching and third party vendor branching

We are developing an application which consists of: a source code base given to us by a partner infrequently. This is a somewhat working code, "final" version of something (and we get it in a zip file). They have their own release cycle and version tracking. on the code base above we make our changes. These can be either bugfixes or development of new features. Till now, we managed to create some code mayhem, as a result we would like to put all this in a SVN repository. I would like to ask you what you think is the best practice for this to happen with the less pain. The followings are our th

Join the discussion →

Open Source Alternatives to Reflector? [closed]

Just to ask if anyone knows of an open source alternative to RedGate's Reflector? I'm interested in checking out how a tool similar to Reflector actually works. Note, if you know of a free but not open source alternative to Reflector, you can answer the following related question: Something Better than .NET Reflector? Summary - Updated 11th May 2011 A quick round-up of the various open source projects and tools that have been suggested: Common Compiler Infrastructure (CCI) Mono Cecil ILSpy dnSpy (fork of ILSpy, project appears more active than original) Dotnet IL Editor (DILE) IL.View Monoflec

Join the discussion →

How different programming languages handle division by 0?

Perhaps this is the wrong sort of question to ask here but I am curious. I know that many languages will simply explode and fail when asked to divide by 0, but are there any programming languages that can intelligently handle this impossible sum - and if so, what do they do? Do they keep processing, treating 350/0 as 350, or stop execution, or what?

Join the discussion →

Command-line svn for Windows?

Is there a command-line based version of svn for Windows? Note that I've already tried installing TortoiseSVN, but I still does not have the svn executable available.

Join the discussion →

How to implement Friendly URL in Liferay portal

I have to simplify the URL. I am using liferay portal. URL at present look like this: http://10.11.201.144:8080/web/guest/marketing?p_p_id=EXT_6&p_p_lifecycle=0&p_p_state=normal&p_p_mode=view&p_p_col_id=column-1&p_p_col_count=1&_EXT_6_pageName=aboutus I need to simplify it like: http://10.11.201.144:8080/web/guest/marketing/aboutus or some what easy. Life ray provides Friendly URL option i don't know how to use it.. Please help.

Join the discussion →
Older stories