[Solved] What is wrong with this C program [closed]

The first problem is that you are not allocating memory for each char*. mem is a pointer to a pointer. This means this value will need allocation (as you do): mem = (char **)malloc(sizeof(char*) * 2048); You can remove the 512 from your code because this only needs memory for the pointers themselves not the … Read more

[Solved] Unexplainable bug in my code

There are several issues with your code (using legacy APIs, using bad parameters, missing logic, etc). Try something more like this instead: #include <iostream> #include <Windows.h> const DWORD transparenton = 0x00000001; const DWORD transparentoff = 0x00000000; using namespace std; void pause(); void act(HKEY key); bool getTransparency(HKEY key, DWORD &value); void setTransparency(HKEY key, DWORD value); int … Read more

[Solved] Why does the addition (plus) operator produce a string when the left operand is a number and the right one is a string? [duplicate]

Because the spec says so. See The Addition operator (+): If Type(lprim) is String or Type(rprim) is String, then Return the String that is the result of concatenating ToString(lprim) followed by ToString(rprim) Return the result of applying the addition operation to ToNumber(lprim) and ToNumber(rprim). So it only matters whether some operand is a string, but … Read more

[Solved] if window.location.href.indexOf(‘player=1’) add style [closed]

You need to set the style of the body element if the string you are checking for is present in the URL. if(window.location.href.indexOf(“player=1″)!=-1) document.body.style.backgroundColor=”#000”; Alternatively, to avoid setting inline styles, you can create a new class and apply it to the body if the string you are checking for is present. body.player1{ background:#000; } if(window.location.href.indexOf(“player=1”)!=-1) … Read more

[Solved] Bash script to download data from url

You have two bits here. One is to schedule a cron job and the other is to get the file & save it. Steps : Open the terminal & run crontab -e minute(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6) command In place of minute, hour, day, month & weekday. Also provide the command to run. The command … Read more

[Solved] Difference between new Class() { … } and new Class { … } [duplicate]

Nothing. When using the object initialiser syntax { }, the () for a parameterless constructor is optional. From the overview of C# 3.0, where this syntax was introduced: An object creation expression can omit the constructor argument list and enclosing parentheses, provided it includes an object or collection initializer. Omitting the constructor argument list and … Read more

[Solved] Delphi XE8 Load PDF File

You don’t need all of the jumping-through hoops you’re doing. Windows will find the application associated with PDF files for you. procedure TForm1.Button1Click(Sender: TObject); var s: String; Ret: DWord; begin s := ‘C:\MyFiles\MyFile.pdf’; Ret := ShellExecute(Handle, nil, PChar(s), nil, nil, SW_SHOW); if Ret < 32 then ShowMessage(SysErrorMessage(GetLastError)); end; Note: Normally you should never call a … Read more

[Solved] How to create custom circular progress view in android [closed]

You need to create two drawable files for this Create this two files in res > drawable 1. circle_shape.xml <?xml version=”1.0″ encoding=”utf-8″?> <shape xmlns:android=”http://schemas.android.com/apk/res/android” android:shape=”ring” android:innerRadiusRatio=”2.8″ android:thickness=”10dp” android:useLevel=”false”> <solid android:color=”#CCC” /> </shape> 2. circular_progress_bar.xml <?xml version=”1.0″ encoding=”utf-8″?> <rotate xmlns:android=”http://schemas.android.com/apk/res/android” android:fromDegrees=”270″ android:toDegrees=”270″> <shape android:innerRadiusRatio=”2.8″ android:shape=”ring” android:thickness=”10dp” android:useLevel=”true”><!– this line fixes the issue for lollipop api 21 … Read more

[Solved] Return all values from a PHP array for a given key

You can try making a 2d array so something like $newarray = [ “a” => [‘red’,’pink’,’maroon’], “b” => [‘green’], “c” => [‘blue’] ]; Then you can access the values like this: $newarray[‘a’] Which will return an array containing red pink and maroon 1 solved Return all values from a PHP array for a given key

[Solved] SQL Server constraint [closed]

As I wrote in my comment, I would not set the existing value to null. Instead, a computed column seems like a better option to me. Also, varchar(1) is the second worst data type you can choose (nvarchar(1) is even worst). First, if you know you only ever going to have a fixed length string, … Read more

[Solved] Add a new column with the list of values from all rows meeting a criterion

Something like this should work… df = pd.DataFrame({‘date’: [‘2017-01-01 01:01:01’, ‘2017-01-02 01:01:01’, ‘2017-01-03 01:01:01’, ‘2017-01-30 01:01:01’, ‘2017-01-31 01:01:01’], ‘value’: [99,98,97,95,94]}) df[‘date’] = pd.to_datetime(df[‘date’]) def get_list(row): subset = df[(row[‘date’] – df[‘date’] <= pd.to_timedelta(‘5 days’)) & (row[‘date’] – df[‘date’] >= pd.to_timedelta(‘0 days’))] return str(subset[‘value’].tolist()) df[‘list’] = df.apply(get_list, axis=1) Output: date value list 0 2017-01-01 01:01:01 99 [99] … Read more