Dear Friends, I have a string with structure $selectedTime = "2017-02-10 07:00,2017-02-10 08:00,2017-02-11 09:00"; I need to convert it as   {"2017-02-10":[{"start":"07:00"},{"start":"08:00"}],"2017-02-11":[{"start":"09:00"}]} any idea ? please advise asap Thanks Anes

Member Avatar
Member Avatar
+0 forum 1

Hi, I am facing an issue in string to const char pointer conversion. I am doing stuff in the fun() but here i am just giving my example. Here it the code: // Helper function string fun() { string abc = "Daniweb"; // print here #1 return abc; } // main function int main() { const char * returnValue = fun().c_str(); // print here #2 string returnValue2 = fun().c_str(); // print here #3 } When I print the value in fun() function before returning it, it is printing fine. (#1) When I print the value after const char (#2), it …

Member Avatar
Member Avatar
+0 forum 13

Dear all I am trying to send request to client device in Hex format and receive data into decimal format. By seeing forum and tutorial class. I could able to send and receive data from client device.Now I wanted to check the data i received valid or not. In order to test it i wanted to convert the data from hex to dec. I am also confused How client data being received here. My code: import socket TCP_IP = '192.168.1.3' TCP_PORT = 8899 BUFFER_SIZE = 1000 s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect((TCP_IP, TCP_PORT)) s.send('01030000001d85c3'.decode('hex')) Decode_hex='01030000001d85c3'.decode('hex') print Decode_hex print "decode hex:",Decode_hex data …

Member Avatar
Member Avatar
+0 forum 4

This will convert a decimal number into Gray code .

Member Avatar
Member Avatar
+1 forum 5

I work with images...a *lot*. Often this involves image processing of various types such as resizing, resampling, and various cleanup operations. However, a common issue is that people like to conflate Adobe PDF with images. As such, any application that works with images should also work with PDF. However, since PDF isn't in reality an image type (even though it can store images), to do any kind of editing or cleanup a PDF must be converted to an actual image type. Anyone who has worked with PDF in more than a consumption capacity will know that Adobe products cost money. …

Member Avatar
Member Avatar
+2 forum 6

This language is built with python to give me a dynamic backend to make this possible. The language is based off ASM opcodes but generalizes them into basic coding practices. More info here: http://tcll5850.proboards.com/thread/271/umcsl note: WIP the language is meant to make it possible to convert between ASM and other languages: PPC >> UMCSL >> C Intel x86 >> UMCSL >> PPC C++ >> UMCSL >> Python note: Python isn't as simple as put... actually none of those languages are that simple... to actually convert between languages, complex libraries are required to map things to and from UMCSL. if you …

Member Avatar
+0 forum 0

My code has me stumped, My method is right...I think but the output begs to differ. Basically this code is supposed to convert seconds to minutes but the output is somewhat off..here's what I have don so far. String input = JOptionPane.showInputDialog(null, "Enter a value for seconds (positive whole number): "); int second = Integer.parseInt(input); int minutes = second/60; // number of minutes int seconds = second/60; // number of seconds JOptionPane.showMessageDialog(null, "Numbber of Seconds is " + second + " is converted to: " + minutes + " minutes and " + seconds + " seconds."); Any pointers / …

Member Avatar
Member Avatar
+0 forum 1

I you ever would have the need to do this conversion you probably would use `string myStr = Convert.ToString(myInt,2);` which does the job. Here is presented another way to do this with some simple formatting included. Some highlights for newbies and not so newbies: Line 9: Custom enum type Line 37: const calculation Line 42: Reversed for loop from up to down (to avoid having to reverse the array of bits afterwards) Line 45: Use of left shift operator Line 48: Use of ternary operator as a parameter to a method Line 68: Use of LINQ (explained in the code) …

Member Avatar
+1 forum 0

Hello, I hope someone is more knowledgeable in Java than me while still knowing PHP! The following Java code makes a hash from a string, and I need a PHP equivalent that makes the exact same hashes. Simply md5() does not do the trick, and I looked at some PHP libraries for *BigInteger* but maybe it is over-kill to include all sorts of third party libraries? public static String encrypt( String source ){ String md5=null; try{ MessageDigest mdEnc = MessageDigest.getInstance("MD5"); // Encryption algorithm mdEnc.update(source.getBytes(), 0, source.length()); md5 = new BigInteger(1, mdEnc.digest()).toString(16); // Encrypted string } catch(Exception ex){ return null; } …

Member Avatar
Member Avatar
+0 forum 4

I have created a C# code where I'll input a code to it and it returns me an encrypted entry pass code. Its all working perfectly. Now the question is that, I want to apply this code to every application I create so that only after getting the pass code, the application should run. As far as I know, I now insert that C# code file to that application and everytime am linking that code files. For a C# application its fine, but when I create application using VB.NET, I am forced to convert the code file written in C# …

Member Avatar
Member Avatar
+0 forum 3

## Background ## Hi All, I 've been playing around with colour (color!) formats and needed to create a class for converting different formats, so I thought I'd share it. It seems to work quite well and accepts a number of different convenient formats. The class allows the conversion between HSL, HSV, RGB, CMYK, HEX (base16), Integer (base10) and 'HTML color names'. I found the formulae for conversion from pseudocode in the following locations: http://www.rapidtables.com/convert/color/ (great colour references!) http://stackoverflow.com/questions/15202079/convert-hex-color (for the sscanf method) It should be noted that conversions involving CMYK can only be approximate as there is no absolute …

Member Avatar
Member Avatar
+5 forum 4

Hello all, I am working through Beginning Microsoft Visual C# 2008 I was asked to create a console application that multiplies 4 input values. I decided to take all 4 values at once and multiply them. Here is my code: string inputNumbers; string userName; Console.WriteLine("Enter your name:"); userName = Console.ReadLine(); Console.WriteLine("Welcome {0}!", userName); Console.WriteLine("Now give me 4 numbers seperated by a space:"); inputNumbers = Console.ReadLine(); string[] numbers = inputNumbers.Split(' '); Console.WriteLine("The product of {0} * {1} * {2} * {3} is {4}.", numbers[0], numbers[1], numbers[2], numbers[3], Convert.ToDouble(numbers[0]) * Convert.ToDouble(numbers[1]) * Convert.ToDouble(numbers[2]) * Convert.ToDouble(numbers[3]) ); Is there an easier way to …

Member Avatar
Member Avatar
+0 forum 4

Hello again good people, i have done some coding on lexical analyzer phase of compiler but it is giving me some error that i am unable to understand.. Fair Warning: Code is a little longer. Here is the code: # include <iostream> # include <fstream> # include <string.h> # include <stdlib.h> # include <stdio.h> # include <conio.h> # include <ctype.h> using namespace std; const int Rows = 34; const int Cols = 15; int iTT[Rows][Cols] = {0}; void loadTransitionTable( ) { fstream File("tt.txt"); if (!File) { cout << "\n Cannot open the input file." << endl; cout << "\n Press …

Member Avatar
Member Avatar
+0 forum 5

my [previous question](http://www.daniweb.com/web-development/javascript-dhtml-ajax/threads/477450/convert-str-to-var) about this dealt with global vars but unfortunatley the `window` of opportunitys doesn't work with this next example because it alerts 4 times instead of only 1 test("a","b","c"); function test(var0,var1,var2,var3) { for(var i=0; i<4; i++) { if(window["var"+i]===undefined) {alert("test");} } } this may not be very clear so I will try again this time I want it to alert all three vars test("a","b","c"); function test(var0,var1,var2) { for(var i=0; i<3; i++) { alert(window["var"+i]); } } how can I achieve the identical results as with the `window["str"+var]` from within a function?

Member Avatar
Member Avatar
+0 forum 1

this is my attempt var test=["a","b","c"]; var var0="a"; for(var i=0; i<1; i++) { test.splice(test.indexOf(test[window["var"+i.toString()]]),1); } alert(test); it alerts "a,b" but I want it to alert "b,c" ref:http://stackoverflow.com/questions/5613834/convert-string-to-variable-name-in-javascript

Member Avatar
Member Avatar
+0 forum 2

dear friends, I am a beginner in c programming and I have learned the c++, java as well, In C I have been asked for a question about how to convert lower case string like any name into uppercase, and i have read a program for it by pointers and I wanna do it by using typecasting and ascii values for characters so if anyone can help me on that.

Member Avatar
Member Avatar
+0 forum 4

Hello every one . I have a piece code in VB.net which work perfectly. but now i convert that code to C# Which give me the follwing error. "No suitable Method found to override" my VB.Net Code is Here Protected Overrides Sub onload(ByVal e As EventArgs) startPosX = Screen.PrimaryScreen.WorkingArea.Width - 330 startPosY = Screen.PrimaryScreen.WorkingArea.Height SetDesktopLocation(startPosX, startPosY) MyBase.OnLoad(e) Timer1.Start() End Sub and here is converted code protected override void onload(EventArgs e) { startPosX = Screen.PrimaryScreen.WorkingArea.Width - 330; startPosY = Screen.PrimaryScreen.WorkingArea.Height; SetDesktopLocation(startPosX, startPosY); base.OnLoad(e); Timer1.Start(); } The `onload` give the error.

Member Avatar
Member Avatar
+0 forum 5

I'm trying to convert a number from any base between 2-36 to any base between 2-36. I have the conversion to base 10, but I'm having trouble getting it from base 10 to the desired base. Any ideas? I know part of this idea will work, I just can't get it all together syntatically. And don't worry about the checks (user inputs number 13, base 2), I'll add that at the end. Thanks! #include <iostream> using std::cout; using std::cin; using std::endl; int ToTen ( char number[15], int base, int newbase ); void ToNewBase (); int main() { char number[15]; int …

Member Avatar
Member Avatar
+0 forum 4

I want to know how a microprocessor converts the binary digits into decimal equivalent. The processor only has the ability of manipulating 0's and 1's but, how these numbers are converted back into their decimal equivalent? Are they converted by another circuit? If so, then how and what it is called? Or If they are converted by the software?

Member Avatar
Member Avatar
+0 forum 2

Hi everyone, I am new here and I hope all of you are doing well. I have spent the whole day searching around on the almighty Google for code that can help me with my problem. In the following code there may be quite a few n00b mistakes, and for these I apologize, since I have not done coding in C in ages. So, firstly I will try and explain what I need to do as best I can, before dumping eye-watering code: My Objective: I need to convert a String, ie: "Hello World!" (<- why did this ever became …

Member Avatar
Member Avatar
+0 forum 3

//I am writing a program that converts from one unit like mm to another e.g cm. The program should prompt invalid unit when something other than mm, cm, m or km is entered as the unit to be converted from or unit to be converted to. The problem is how I initialize the units. When debugging, input ends the program. What do I do? //Program to shows conversion of units #include <iostream> // for cin, cout #include <string> #include <cmath> using namespace std; int main() { char init_unit[2], sec_unit[2]; //declaration of the conversion units double conv_val; //declaration of the number …

Member Avatar
Member Avatar
+0 forum 20

Hi frns Am asha ! just looking and searching for a while how to convert php output as pdf file. I mean the localhost output of php file will be save as pdf file. If anybody knows pl help me. Thanks in advance asha

Member Avatar
Member Avatar
+0 forum 8

I am trying to make a program that generates source code for a much larger program for simple reversal encryption. I don't know what I am doing wrong. Here is my code so far: #include<stdio.h> int main() { FILE *fp; fp=fopen("d:\\crypt.h", "w"); fprintf(fp, "char out[8];char cur[8]; char con[255,255,255,255,255,255,255,255];/n if cur==con out==0,0,0,0,0,0,0,0;/n while(cur <= con) /n con=con-1/n if cur>=con out=out+1; "); return 0; } please help, thank you

Member Avatar
Member Avatar
+0 forum 2

Hi - I am having an issue and can't seem to get my head around it. I am trying to calculate GBP from EUR - which should be easy but for some reason my returned value is always a few GBP more than it should be, yet I do the same calculation on my calculator or Google and it's right. Can anyone see what I am doing wrong? I have this: $rate = 1.20881; //var_dump shows float, tried different combos too $euro = 74; //var_dump shows float $gbp = ($euro / $rate); //should give me 61.21 but it keeps giving …

Member Avatar
Member Avatar
+0 forum 2

help someone

Member Avatar
Member Avatar
+0 forum 2

Hello everybody. I recently started a python temperature conversion program and seem to be stuck. Im fairly new so I tried several things such as a fuction to convert temperature and and if and else statement and both combined. My code lets me input a temperature but then doesn't convert it. My code is below, any help would be great!Thanks! #Clesisus and Farenheit converter import math print('Hello.What is your name?') myName=input() print('Ok,+ myName +, Would you like to convert to celsisus or farenheit?') answer=input() if answer=='Celsius' or answer=='celsius': print('Please enter the degree in farenheit in which you wish to convert.') …

Member Avatar
Member Avatar
+0 forum 15

[CODE]//To convert postfix expression into an expression tree #include"stdio.h" #include"conio.h" #include"process.h" #include"string.h" #include"stdlib.h" struct node{ char item; struct node *lnode; struct node *rnode; }*stc[30],*temp,*root; typedef struct node *NODEPTR; char expression[50]; char c; int top=0; NODEPTR pop(); void push(NODEPTR); void getinput(); void inorder(NODEPTR p); int main (){ getinput(); int i,j; for(i=0;i<strlen(expression);i++) { printf("\nstrlength=%d--------for i=%d\n",strlen(expression),i); c=expression[i]; switch(c) { case '+': case '-': case '*': case '/': case '^': { temp=(NODEPTR)malloc(sizeof(struct node)); temp->item=c; temp->rnode=pop(); temp->lnode=pop(); push(root); } default : { temp=(NODEPTR)malloc(sizeof(struct node)); temp->item=c; temp->lnode=NULL; temp->rnode=NULL; push(temp); } void free(void *ptr); break; } } root=pop(); inorder(root); getch(); } NODEPTR pop(NODEPTR p) { if(top==0) printf("Underflow …

Member Avatar
Member Avatar
+0 forum 5

Hi all! I have a user interface where I want to filter a datagridview.. I 've achieved to create filters but I 've failed to filter tha data by date.. I have a sql db and the column of date is of datetime type. When I try to filter the data by choosing a date in a datetimepicker I use this query: [CODE] If TodayToolStripMenuItem.Checked = True Then query = "Select * from INCIDENTS where DateReported='" & dtpEqualTo.Value.Date & "'"[/CODE] The problem is that when I run the project I take the message "The conversion of a varchar type to …

Member Avatar
Member Avatar
+0 forum 6

Hey guys, this is my solution to a simple problem and I was looking for some feedback on my code. Please post any criticism you may have about it. //Test project for string to binary conversion// #include <iostream> #include <string> using namespace std; void binConvert(string ConvertMe){ int ArraySize = ConvertMe.length(); int* asciiArray = new int [ArraySize]; int binValues[8]; int decValues[8] = {128,64,32,16,8,4,2,1}; // Convert each char of ConvertMe into its ascii value for(int i = 0; i < ArraySize; i++){ asciiArray[i] = ConvertMe[i]; } // Convert asciiArray values from decimal to binary and output to screen for(int i = 0; …

Member Avatar
Member Avatar
+0 forum 4

I am working on a Java to C# conversion project. In this project, my custom java library uses `java.net` packages [`DatagramPacket`](http://docs.oracle.com/javase/1.4.2/docs/api/java/net/DatagramPacket.html) and [`DatagramSocket`](http://docs.oracle.com/javase/1.4.2/docs/api/java/net/DatagramSocket.html) classes. Are there similar classes in .NET C# with similar functionalities?

Member Avatar
Member Avatar
+0 forum 3

The End.