Is there any equivalent to Response.End
in PHP?
mercredi 7 septembre 2016
How do I model a database for an e-commerce website usin MySQL?
How do I model a database for an e-commerce website usin MySQL?
How to convert an ascii character into an int in C
How can I convert an ascii character into an int in C?
How to redirect from one URL to another URL?
How can I redirect to another URL in a web page using JavaScript?
Copying from my variable to a Microsoft Word using javascript in Google Chrome
i try using ActiveXObject, but in Google Chrome had error: ActiveXObject is not defined
How do you strip whitespace from an array using PHP?
I was wondering how can I strip white space from an array using PHP?
Detect if mbstring is enabled or not from PHP script
How can I check if the mbstring extension is loaded in a php script?
Secure mp3 file uploads scripts with database connectivity
Secure mp3 file uploads scripts with database connectivity where users can uploads only mp3 file
Is there a portable C compiler for windows?
I want to carry one in my flash drive and run it.
Thanks
Using boolean values in C
C doesn't have any built-in boolean types. What's the best way to use them in C?
Is there any I can use libhdfs api to read a file line by line?
As question said, Is there any I can use libhdfs api to read a file line by line?
mardi 6 septembre 2016
GoCardless Gateway OAuth method in php
I want to use Gocardless OAuth method in php but there is no any library available for it.
How to open a new tab using Selenium webdriver using PHP
Can someone point me to examples for opening a new tab using Selenium with PHP (without using Facebook php web driver)
How to stop displaying printf of a particular "c" daemon in linux
How can be stop displaying printf of a particular daemon on desire . By disabling a particular attribute can i ignore printf .
Can someone help me with Javascript comparisons?
I am looking to hire someone for help? Hoping to get someone who knows what they are doing.
Skype is ELOsharks.
What can be considered as advanced Php programming? [on hold]
As an Php intern I want to know which area in Php development is considered as acomplished or advanced? Just my curiosity, thanks!
Time series forecast using recurrent net libraries
I want to use recurrent neural network for multivariate time series forecast. Can anyone provide reference to some good C/C++ libraries for this.
Replace string without buildin function in php
How to replace string without existing function like str_replace()
in PHP.
Eg: $str = " Hello word";
$needle = "llo";
Wakaama (Lwm2m implementation in c)on Arduino Uno
i would like to use wakaama (Lwm2m implementation in c) on Arduino Uno. Please can somebody help me ? Thanks in advance.
Hezou
PDO with PHP7 and Microsoft SQL Server?
Is there a stable driver to use PDO with sqlserver 2014 and php7? If not, then what is the best way to access sqlsever 2014 with php7?
Any way to get JavaScript numbers without Euler's number
I try to get
Math.pow(2,1000);
The result is " 1.2676506002282294e+30 "
I need the number without Euler's number "e+30"
Having the tan(x), how can I get a tan(x/2)? In C
I know I can do this:
//With A = tax(x);
return tan(arctan(A)/2);
but I wanted something more efficient.
Compiling C/C++ for different platforms [on hold]
Is it possible to compile C/C++ into a Linux executable from Windows (gcc/g++.exe test -o test.linux-executable)? Or are they the same things?
How to stop php all execution using php single code [on hold]
How can we stop php code that execute from different areas of web. By placing only one code i don`t know how to do this
What is the difference between array and enum in C ?
I find enum to be similar to an array,with the elements in it being numbered from 0. So what is the difference between an array and enum?
How can i generate code coverage for native shared library(.so files) or for Native Code(C/C++) in android Studio?
The JNI library is already linked to android studio.Is there any plugins which can generate code coverage report for native shared libraries or for native codes??
Javascript equivalent of php's strtotime()?
In PHP, you can easily convert an English textual datetime description into a proper date with strtotime()
.
Is there anything similar in Javascript?
what are ( Angular, Node.js, AJAX, JQuery)?
I really have a hard time to distinguish between all those frameworks, libraries or API I don't know, and how they related to each if they do.
Specific letters and digit in a string in c programming
How to check for user input if I want to start with a character follow by 7 digit and end with a letter in c programming? Example; S1234567A
Is Caching data in browser same as using local storage or cookies?
I am a bit confused between caching and using browser's local storage to store data. Are they both same? If not, can you please tell me the difference?
How do I store a 3 byte char as 6 hexadecimal characters in c
I have the following variable
char cArray[3]
How would I store cArray
as 6 hexadecimal characters in another char array variable?
What is the meaning of a number in brackets after a struct declaration?
I recently encountered text of the form
struct {
double a, b, c;
}[123];
What exactly does this do? Is this even proper C?
How to pause in C?
I am a beginner of C. I run the C program, but the window closes too fast before I can see anything. How can I pause the window?
lundi 5 septembre 2016
Symfony 3 - Last logged date
Trying to put the database date of the last login user, but completely do not know how to do it.
Please help and thank you in Advance.
What is the difference between *a=b and a=&b?
Given:
int **a; // (double pointer)
int *b; // (pointer)
Is there any difference between *a=b
and a=&b
?
Difference between *arr[] and **arr
Is the same
char* s1[size];
To
char** s2 = malloc(size * sizeof(char*));
They have any difference?
free() not deallocating memory?
free(str);
printf("%dn", str->listeners);
The call to printf succeeds (as do any other calls to str's members). How is this possible?
Any way to stop my laptop battery from charging while plugged in?
Is there any way to programmatically stop my battery on my laptop from charging while plugged in, when it gets to 100% but start charging again when it gets too 10%?
Symfony1.4 web configuration on server
I upload my Symfony1.4 into my server. Url like test.domainname.com/web will access the application but i want test.domainname.com/. Where exactly change please help me.
Publish events to Facebook with API V2
With Facebook API V1 it was possible to publish event. With API V2 this is not possible anymore. But Eventbrite still has this function. How do they do it?
JavaScript - Get minutes between two dates
If I have two dates, how can I use JavaScript to get the difference between the two dates in minutes?
How can I test if a sound is playing in SoundManager2?
I'm looking for a simple way to check if SoundManager2 is currently playing a sound. I was hoping for a function like "SoundManager.isSoundPlaying" but I don't see this functionality.
image cannot be displayed because its conain error in php [on hold]
$result = mysql_query("select profilepic from `profile` where id = '$pid' ");
if ($result) {
if ($row = mysql_fetch_array($result)) {
$img = $row["profilepic"];
}
}
header("Content-type: image/jpeg");
echo $img;
How to parse plain text in php
Title: fsf
Length: 125
Link: http://www.example.com/
How to parse plain text in php?? I want to get the link mentioned in the file using php
How to Make Save Button for Save Image on Video HTML5
in HTML5 Video, we can right click video and choose "Save image as..."
i want to make a button to automaticly save the image
please help, thanks
What is the difference between casting to `float` and adding `f` as a suffix when initializing a `float`?
What is the difference between
float f = (float) 99.32 ;
and
float f = 99.32f ;
Both of them compiled and ran successfully.
How to check how much from heap and from stack my program is using?
I'm using Visual Studio 2013 on Windows 7 - 64 bit machine.
I'm writing a program on C.
How can I check how much heap and stack storage my program is using?
Google Charts tooltip flickering
When using Google Charts, sometimes the tooltip appears behind the mouse pointer, causing a flickering when the mouse is moved, even a little bit.
Is this a known issue?
How can I add a BCC to my code
Mail::send(['html' => 'emailtemplate'], $dataCustomer, function ($m) use ($input)
{
$m->from('quotes@email.net', 'Mr. Foot');
$m->to($_POST['email'])->subject('Mr Foot Thanks You');
Error handling/checking in the kernel realm
What is the equivalent to errno
in the kernel realm? More precisely, how do I check what error has happened for example when using a function like kmalloc()
?
XBee ZigBee Library for visual studio c++
I'm sending frame using XCTU (Windows side) to mbed CPU, That process I need to do it using visual studio (windows side). Any API that compatible with visual c++? Any help is appreciated.
Creating a PHP Generator in a C PHP Extension
Does anybody know how to write a simple php generator that does something like, addition, written in c
I'm trying to find examples of this, but I'm coming up with nothing.
Easy way to password-protect php page
I have a page I want to password-protect. I've tried doing HTTP authentication, but for some reason it doesn't work on my hosting. Any other quick (and easy) way to do this? Thanks!
Video views in android app
I am trying to get a count of who have watch or is currently watching the video in my application . Kind of like youtube would anybody know how to approach it by any chance.
Looking for a stacked bar plugin
I am looking for a single lined stacked bar plugin (can be either Jquery or JS).
It should look like this:
Antiword binary /usr/local/bin/antiword does not exist
I am downloading cats open source ats software.When I ran installtest.php this error occurred:
Antiword binary /usr/local/bin/antiword does not exist.
Please suggest a solution.
dimanche 4 septembre 2016
Meaningful C/C++ algorithm with bad cpu cache utilization characteristics, but have room to be improved significantly [on hold]
What are some suggestion for meaningful programs which initially have slow performance due to bad CPU cache utilization patterns, but have significant room for improvement in performance?
Target CPU: Intel Core i7 4xxx
How to search a video in C?
I would ask if it's possible search a video with C and socket? Is there a function to do that? If yes, is possible view info video like views, comment, like, time video etc.
Header with memory size definitions
Is there standard C/C++ header with definitions of byte, kilobyte, megabyte, ... ? I dont want to make own defines. It's dirty in my opinion.
Example:
if (size > MEGABYTE)
{ ... }
Wordpress theme development issue
I'm trying to convert my static theme into WordPress theme, but face this error. how can i resolve this?
How can a Laravel 4 class detect that it is running in an Artisan task vs. a browser request?
I have some application boot code that needs to know if it is currently running in an artisan task vs. being called in a browser request.
How do I detect this in Laravel 4?
Hi , I got a error when I try to access to service web ... php_network_getaddresses: getaddrinfo failed: Name or service not known
php_network_getaddresses: getaddrinfo failed: Name or service not known.
I don't have idea what is wrong this.! error image
How can I connect to database from C program [on hold]
I am new in developing the applications in C language. Can anybody give me the code how to connect to database from C application? Thanks in advance.
PS: I using IDE codeblock, database mysql
returning char** from C DLL to VB
Please, I am developing a VB app to call a C DLL function and I need to pass from VB to C DLL a char** to receive the reply. How can I do that? Thanks everybody!
PHP array compare and if statement
$x1 = 'xxx';
$y1 = 'yyy';
$a=['xxx', 'xxx', 'xxx'];
$b=['yyy' => 1, 'yyy' => 2, 'yyy' => 3]; ;
if($x1== $a){ if($y1== $b['yyy']){ $cat= $b['1']; } }
I need help with this logic.
How can I emulate right-click in the node.js selenium-webdriver?
I am using selenium-webdriver for nodejs.
How can I emulate a right-click with this driver? I can't find this in the official documentation.
preg_replace produces unexpected duplicate with a very simple RegEx
var_dump(
preg_replace('/.?$/s', "x", 'abc'),
preg_replace('/.$/s', "x", 'abc')
);
Outputs:
string(4) "abxx" <-- strange, isn't it?
string(3) "abx"
How's that possible?
How do l write mysql_result ($query_run, 0, "user_id") using mysqli
l want to write the following code in mysqli
return(mysql_result($query_run,0,"user_id"));
Please how do l do this..have been knocking my head for days about it. thanks ahead
Freeing all malloc()-created pointers with one command?
Is there a one-liner that will free the memory that is being taken by all pointers you created using malloc
s? Or can this only be done manually by free
ing every pointer separately?
C prototype of a function with define name_fn in a body
Could you help me understand what the following piece of code means? Specifically, I do not understand what the effect of name_fn
is.
#define name_fn
void name_fn Function(void);
How can I detect when an RTMP live stream comes online, either through ActionScript or JavaScript?
I want to find out when an rtmp://
live stream URL is sending over data (if the user is streaming or not).
How can I do this using either ActionScript (3.0) or in JavaScript/PHP?
Unable to Install Phalcon
While Installing Phalcon for PHP7, I am getting error:
Cannot find build files at '/Applications/MAMP/bin/php/php7.0.0/lib/php/build'. Please check your PHP installation.
I am using MAMP.
How to use buttons to open up a html app in a new window?
Code here!: https://ghostbin.com/paste/xmxg8
How do I make a button open up my calendar program in a new window on the same screen?
wordpress get the title in javascript
in a PHP file is possible get the title of a post with
the_title();
is it possible, in a JS file, get the title of a post?
many thanks
How to get window position from vanilla JS and/or jQuery
How does one get the window position, cross-browser, in JavaScript?
Also, if calling .position
on $(window)
in jQuery, I get an error. Is there another way to get $(window).position()
?
WordPress top download counter plugin or php codes
I'm working on a project where in a section users will see the top 10 downloads. Do anyone know how to do this. The project is on WordPress. Any plugin suggestions or raw php codes both will be okay.
how I decide the masking whether I have to use 0x0F,0xF1 [on hold]
Although this might be a silly question but I don't know why 0x0F is chosen for masking,generally ? eg. in Java
byte b = (byte)0xF1;
(b>>4)& 0x0F
Modify article on the fly in Joomla
I can change a title by placing the next line into my template:
$doc->setTitle('my new title');
But is any method to modify an article's 'fulltext' in the same way?
If Input is 6 what will be the output and why?
#include<stdio.h>
#include<math.h>
void main(main)
{
printf("%d",main=getche(printf("%d",main+=pow(++main,++main))));
}
If Input is 6 what will be the output and why? I got 3 0 48
Selecting all messages from individual ips that has 20 or more messages
I'm trying to select all the messages from individual ips that has 20 or more messages, but I'm having trouble selecting it. Here's my query:
SELECT messages
FROM currentChat
HAVING count(id) >= 20
GROUP by ip
samedi 3 septembre 2016
Eclipse Jelly script plugin
is there any Jelly script plug-in for Eclipse IDE.I want to debug one of the Jelly scripts I'm using inside Eclipse editor ? Is there any support for Jelly debugging ? an advice please...
Thank you
maximum of 3 numbers in c lang [on hold]
I want to give 3 numbers which will give output something like this: It could be array or direct numbers:
Input: 2 3 6
Output: 6 > 3 > 2
Input: 4 1 8
Output: 8 > 4 > 1
Input: 1 1 1
Output: 1 = 1 = 1
Input: 1 1 5
Output: 5 > 1 = 1
Input: 5 5 3
Output: 5 = 5 > 3
Link id's between two mysql tables
Well, I have two tables, onde for the posts of a blog and another for the images of the posts, wich only stores the name of the images. How can I link a post id to a photo id?
How can I convert string to datetime with format specification in JavaScript?
How can I convert a string to a date time object in javascript by specifying a format string?
I am looking for something like:
var dateTime = convertToDateTime("23.11.2009 12:34:56", "dd.MM.yyyy HH:mm:ss");
How to display a readable array - Laravel
After I write:
Route::get('/', function()
{
dd(User::all());
});
And after I refresh the browser I get an unreadable array. Is there a way to get that array in a readable format?
How to add SKU coloum at Products Bestsellers Report tools in Magento?
I want to add SKU new column at products bestsellers report in Magento 1.9.2.
Admin->reports->product->bestsellers report
I dont know how to add it.
Please suggest.
How to debug Pro*C code?
We have a legacy code written in Pro*C which now needs to refactored. is there any debugger which supports debugging pro c code.
is it possible to debug using .c/.cpp produced after proc*C pre compilation
regular expression for sequential numbers like 12345 or 456789 javascript
I need to prevent entering 5 degit sequential numbers like 12345,45678 etc. in a text box.
I have tried with the following regular expression,but it is not working
var regex = /^(?[0-9]{3}(-|)) ?[0-9]{3}-[0-9]{4}$/;
C++ / C #define macro calculation
Suppose I have
#define DETUNE1 sqrt(7)-sqrt(5)
#define DETUNE2 sqrt(11)-sqrt(7)
And I call these multiple times in my program.
Are DETUNE1 and DETUNE2 calculated every time it is called?
How to convert ISO 8601 with timezone to C# Datetime?
How can i convert ISO 8601 with timezone to c# actual (local) datetime format.
my ISO 8601 date is like "2016-06-19T19:30:43+04:30
"
and I need something like this "2016-06-19 16:00:43
"
Can we assign a value to a given memory location?
I want to assign some value (say 2345) to a memory location(say 0X12AED567). Can this be done?
In other words, how can I implement the following function?
void AssignValToPointer(uint32_t pointer, int value)
{
}
Javascript show div after a few clicks
I'm new in Javascript and I can't find the answer for my question. Is it possible that my javascript views a div after if you clicked 5 times? If this is the case, how can I make this possible?
Thanks!
CSS - width and height size depending on backgroun-image?
Is there a way to set up my div size with the background-image default size?
like having an img tag inside a div, the div is set up to width: 100%; and height: auto; so my img will its default size
sharing posts in different website at the same time
I want to make a php script to post posts in different webistes, like facebook,twitter and instgram
once the user enter the link of the page and his post . the post will be displayed in different social media websites
Rename propel.php configuration file
Is it possible to rename the default naming of propel.php
and propel.php.dist
and pass the arbitrary value to propel model:build
? For example
propel model:build --input-file="./MyPropelFile.php"
Why use #define for registers instead of constants?
If you declare it as a constant you can also specify the type (size) of the register and let the compiler provide its assistance.
Why is it a common practice to use #define
for register name-value declaration instead of constants?
js lib or lib in any language for providing social locker functionality? (e.g. you get a free trial by sharing on twitter)
I've been spending a fair amount of time googling for this. There is a social locker for wordpress and of course many companies offer this type of thing for a fee, shouldn't there be a simple free plugin that does this too?
About Bitwise operator
if((x & 1) == 0)
printf("EVEN!n");
else
printf("ODD!n");
why X&1
will always gives 1
when number is odd.. I mean what is happening in memory during this operation can any one explain it ?
link 4 video element to one source
Help me link one video source to 4 elements. The force src assignation is very CPU expensive as 4 network streams and 4 video encodes produces
//very very CPU expensive
video1.src= sameSource
video2.src= sameSource
video3.src= sameSource
video4.src= sameSource
Semaphores and Mutex behaviour doubts
Do semaphores and mutexes synchronize both threads and processes, or only threads, or only processes?
Edit: my mistake it's C, not shell. Since I programmed through the shell I mistook it. And one more thing: are communication and synchronization the same?
How to draw a button using winAPI
I have successfully created an owner drawn button.
But how do I now draw/color the darn thing, to make it look like a Button using the Windows API? Currently, it just looks like a colored label?
Any C examples?
catch php commands while executing
Are there any methods to catch the php commands instead of executing them? There's a backdoor which is encoded in my server, I was able to get declared classes and methods names, of the backdoor, but I need to find out the real code.
Will a child process send SIGCHLD on abort()?
If an application does a fork()
and the child dies with an abort()
(due to failing an assert()
), will the parent process receive a SIGCHLD
?
If it's relevant this is on Debian 4 (gcc version 4.1.2).
Mysql help for selecting two table using array
I have an array with values inside array("tblone","tbletwo") Where tbleone and tbletwo are table name and both table have different data inside them I want to query both data sametime using array Can I use UNION with fetching table name from array?
vendredi 2 septembre 2016
MAGENTO: Clean Exeption.log and System.log
Exception.log and System.log under /var/log folder in Magento are over 2gb each.
Is it safe to clean them? If yes, what is the proper way of cleaning such logs?
Really appreciate all suggestions!
How to add static .js files to Meteor project?
Sorry for my english. I have a functions.js file, where I put all my js code. The functions.js doesn't refer to Meteor. Where do I place the functions.js file so that it is attached to the template?
Thanks in advance.
How do I get the count of all the HTML event attributes used in a page?
Using jQuery, how can I get the count of all HTML event attributes (http://www.w3schools.com/tags/ref_eventattributes.asp) used in any webpage where I embed my script?
What's wrong with my code? Changing colour to a div slowly
Does anyone know why my code doesn't work? I want to change the color of a div slowly.
function fadein() {
change = document.getElementsByClassName("load_1")[0]
setInterval(function(){
change.style.color = "rgb("+x+","+x+","+x+")";
x=x+1
}, 200)
};
function animate(){
var x=0;
fadein()
};
animate()
Malloc in If Statement in C
i am new in c, and i can not understand following piece of code. If anyone can explain it, i am really happy. Thanks in advance.
if( ! ( st_cur = (struct ST_info *) malloc(sizeof( struct ST_info ) ) ) )
{
perror( "malloc failed" );
return( 1 );
}
How to convert RGB to NV12 color format in C or C++? [on hold]
NV12 format is YUV 4:2:0 format ordered in memory with a Y plane first, then the subsampled chroma data in an interleaved UV plane.
Example:
YYYYYY
YYYYYY
UVUVUV
Using malloc to communicate between parent and child
If I ask for memory size of an int from malloc and I create 'n' child processes from one parent. Is it posible for each child to update(add one) the value inside that memory, so by the end the parent process reads the value?
Cassandra Database Use Cases
Different articles i saw that cassandra database can use for
1) User activity tracking and monitoring
2) Social media analytics and recommendation engines
Anyone having idea about this use cases. How can achieve theses Or any tutorials available in the market?
How to change the css color code permanent using php
I'm trying to make theme in user part, so i can select the color for the website. what i need is - when i selected the color it should change the color code in style.css and save. Files : index.php and style.css or php
How to filter MySQL table data using multiple options
For example if I have a table products in this name brand and price are columns i want my website user can filter from name and or brand and or price . From dropdown or checkbox or any method. Plz help me soon I am totally beginner .....
How to get php timestamp to the speciefied format with timezone? [duplicate]
This question already has an answer here:
- format mysql timestamp using php 4 answers
i want curerent timestamp in this format 2012-04-23 18:25:43.511000+00:00 .Please help
How to create an option where client can upload a mysql database to the server through php code?
Iam making a website where people can upload their works... s,o if the client has a mysql database how can I make an option where he can upload that database to my server through a php code ?
As always, any help is appreciated :)
retrieving data from apache web server to arduino using ESP module 8266
I have posted the LDR sensor data to apache web server using NODE MCU v1.0 ESP12E with the help of php script.Now, i want to retrieve the data back into arduino using using ESP 8266 module.can any one help me with the arduino code.....??
How to translate C code to COQ [on hold]
I want to model a cryptographic library in COQ which is written in C language.
For that I need methods to translate the C code to COQ Gallina code.
Are there COQ libaries/tools which can help translate code form C to COQ's functional language?
Google AdWords Scripts Get Views
Good day
I have a question about Scripts in Google AdWords.
I know you can't modify frequency cap in a video ad, but I want to check impressions and views. Impressions is in the Stats Object, but where I can find views?
receiving an array of objects in client side from c#
I need receive the following array of objects in my client side from c#: [Object, Object, Object, Object]
0:Object
1:Object
id:"myID1"
category:"Software Practices..."
title:"Writing Code..."
2:Object
3:Object
I'm using this array in my JavaScript code. Thank you.
php code to push conditional values in to array
I have variables with values:
$abc = 'Y';
$xyz = 'N';
$pqr = 'Y';
$lmn = 'Y';
I want to create all the variables with value 'Y'
in to an array, similar to as below:
$result = ( abc, pqr, lmn)
Is there a printf converter to print in binary format?
I can print with printf as a hex or octal number. Is there a format tag to print as binary, or arbitrary base?
I am running gcc.
printf("%d %x %on", 10, 10, 10); //prints "10 A 12n"
print("%bn", 10); // prints "%bn"
How to produce beep sound using "a" escape character?
If I write the following program, then there is no beep sound on running the code.
#include <stdio.h>
int main()
{
printf("a");
return 0;
}
Can you tell me how to use a for producing beep sound using C program ?
C Programming, Logical Operators [on hold]
I am having problem with two of my homework questions about C programming.
x = 0x66
y = 0x39
What are the values for:
x & !y
x && y
Thank you in advance for your help!
Jump to Reset Vector
I am trying to jump back to the reset vector and re run my program from main. This is my code but it does not work. Is there anything wrong with this?
typedef void (*reset_vector_jump)(void);
((reset_vector_jump)RESET_VECTOR_ADDRESS)();
The mbstring extension is missing. Please check your PHP configuration
phpMyAdmin Error: The mbstring extension is missing. Please check your PHP configuration
I have already tried all of the solutions on this and none of them have worked for me. I am not sure what else to do.
Check two location(latitude, longlatitude) near in 2000 meters
I have two location latitude, long-latitude. I need to check 2nd location available within 2000 meters with first 1st location.
Also i have location array an i want to check with 1st location. I need result how many available in 2000 meters
Thanks,
Bharat Bhola
How to protect Python source code?
Is it possible to distribute only the bytecode version (.pyc file) of a Python script instead of the original .py file? My app embeds the Python interpreter and calls PyImport_Import to load a script. How can I tell it to look for a .pyc file and import that?
jeudi 1 septembre 2016
PHP loop two messages every 4 days
I have been looking everywhere for a piece of code using php to echo a message every 4 days, so the first 4 days would display one message then the next 4 will display a second message, then for the code to loop its self indefinitely, any help would be greatly accepted.
how to compare ipv6 address in c without using memcmp
I have two ipv6 address stored in structure struct in6_addr
. I would like to find which one is smaller without using memcmp
. Is there a better way to compare ipv6 addresses?
struct in6_addr {
unsigned char s6_addr[16]; /* IPv6 address */
};
Jscript error - Why? - Uncaught TypeError: Cannot read property 'remove' of undefined
I have a script to remove uploaded files after Add to succes, but i get this error on site when it loads. "Uncaught TypeError: Cannot read property 'remove' of undefined" Whats missing?
<script>
onload=function() {
document.querySelectorAll("li[id^='uploadNameSpan']")[0].remove();
}
</script>
Alter behaviour of jQuery UI Dialog
I have a dialog defined with jQuery UI in this way:
this.dialog = $.dialog({
title: 'Title',
open: function () {
//do something
},
close: function () {
//do something else
}
});
How can I at a later point in my code override the behaviour of the close
method?
How to get users time based on location in wordpress or in php and they will see the time base on location in the website
I am developing a online radio station with wordpress.so i want that when a user browsing this site from usa he will see the program schedule based on his time.means i want user can see program schedule based on their time.so how can i do it in wordpress.
How do I retrieve an HTML element's actual width and height?
Suppose that I have a <div>
that I wish to center in the browser's display (viewport). To do so, I need to calculate the width and height of the <div>
element.
What should I use? Please include information on browser compatibility.
Laravel : how to check if a specific value was selected
I have a very newbie question in Laravel.
In the controller I want to create something like :
if ($Q_type = "specific Value selected by the end user in a radio button")
{
do an action
}
what is the syntax to check this specific value ?
Assign array of object content to a new array
I'm trying to assign an array of objects to another array but when I created the new array and in others functions I change its value, the original array changes as well (which is not ok). Could I use another way? This is an example: http ://codepen.io/Xiwi/pen/rLMbYp
Why this program wont break out of the loop and ask for input?
I have following code:
badinput:
scanf("%d", choice);
switch (choice){
case 1:
...
case 2:
...
case 3:
...
default: {print("try again");goto badinput;}
}
When I put 1 2 or 3 its ok when i input text, for example "a" program wont stop at next scanf
. What is the problem here
How to update just the metadata of the google drive file
I want to update the metadata of a google drive file. Just the description of the file. I referred this, but it is showing how to update the content of the file along with metadata. However I just want to update the metadata of the file. Any help will be appreciated.
why no overflow when using double variable?
i'm trying to understand why in the following situation i don't get an overflow:
double x = 1.7976931348623157E+308; //this is the max value of double
x = x + 0.5;
When checking the value of x after adding 0.5 i still get the same result
.
Anyone?
How I can determine which key is pressed on keyboard? C++
How I can determine which key is pressed on keyboard in C++ using WINAPI?
I try to use GetAsyncKeyState
, but it work just for exactly one key, and I need to choose which one, but I need to get keyсode to it be send over tcp.
Diffrence between Simple Router like (CodeIgniter) and Restful Router (Slim Php)
I am a novice PHP coder. Have basic knowledge in php [Self taught]. Presently learning CodeIgniter. But recently checked Slim Php Framework. It has Restful Router.
Can any one please tell, what is difference between CodeIgniter Router and Slim Router. And which one is better?
Thanks in advance.
exchange data between application
I am writing two applications on windows, one using Eclipse and MinGW and the second one with Visual Basic (visual studio); the two applications should exchange data (just few numbers and text, but frequently, bi-directional) I am very basic developer! anyone could give me very very simple advice? Thank you very much
Preprocessor output on Qt Creator
I am compiling C code in Qt Creator and I need to look at the preprocessor output.
I added the -E flag to the make, but I don't see the *.i files:
mingw32-make.exe -e -w in qtqt-build-desktop
Please help.
setTimout with Javascript for automation
I'm new in Javascript and JXA and I have tried to use a window.setTimeout but I get an error at runtime:
"Error on line 182: TypeError: window.setTimeout is not a function.
(In 'window.setTimeout(function(){
}, 3000)', 'window.setTimeout' is undefined) (-2700)"
can someone help me ?
Turbo c++ stopped working on windows 10 [on hold]
I have a dual booted PC windows 10 along with Ubuntu 15.10,i have been using turbo c++ for a quite long time but today it showed the following error: Windows cannot find 'C:TurboC4Techapple.netDOSBox.exe'. Make sure you typed the name correctly and try again. How to fix this issue?
what is this error in my code?
$db->query("update `state` set `om-id` = '".$statR['om-id']."' where `userid` = '".$_SESSION['userid']."'");
Error:
Query was:
update `state` set `om-id` = '21' where `userid` = '5'
Query Error:
Unknown error 1054
How to check which coupon is applied to which product in WooCommerce?
Since we can apply different coupons to each product in an order,
Is there any method to know which coupon is applied to which product?
I've used $order->get_used_coupons()
function but it just returns the used coupon codes only.
Please help with a solution. Thanks.
How to merge element in looped array if some of the element is in another array?
I have an array like this:
var arr = [
[11, 12, 13, 14],
[1, 2, 3, 4],
[3, 4, 5],
[5, 6, 7, 8],
[6, 7, 8 , 9]
];
I would like to concatenate array that has value in another array and remove its duplicates so in this case it should output:
var arr = [
[11, 12, 13, 14],
[1, 2, 3, 4, 5, 6, 7, 8, 9]
];
Any help would be appreciated. Thank you!
jQuery parsing RSS and namespaced element like <content:encoded>
I am using jQuery to parse an RSS feed. Within each <item>
is a namespaced element like <content:encoded>
I want to select. How do I select it in jQuery?
$(xml).find('item') works but $(xml).find('item content') does not.
while loop with two conditions in c
I have been trying to run this code, but it only works when I use one condition, and leave out the other condition, but I need both conditions to be met simultaneously.
int n;
do
{
printf("numbern");
scanf("%i", &n);
}
while (n < 0 && n > 3)
Set breakpoint in C or C++ code programmatically for gdb on Linux
How can I set a breakpoint in C or C++ code programatically that will work for gdb on Linux?
I.e.:
int main(int argc, char** argv)
{
/* set breakpoint here! */
int a = 3;
a++; /* In gdb> print a; expect result to be 3 */
return 0;
}
jQuery could not get the scroll height of a div element
I was trying to get the height of an element with jQuery but it was returning undefined
Code:
alert($('.forIndex').scrollHeight())
Please any help will be greatly appreciated at: http://www.tulzmasterz.com/tutorials/
mercredi 31 août 2016
Aalto C Course Module 1.08
Every time when i submit the same code for Third exercise: function draw_ball(), i get different output mistakes for different tasks. https://tmc.mooc.fi/mooc/paste/jh_mdp54v1QFJ8McJdb4qQ#stdout
How do I stop scanf loop after user enters specific amount of integers?
#include <stdio.h>
int main(void) {
double numbersEntered, sum = 0;
do
{
printf("Enter a number: ");
scanf("%lf", &numbersEntered);
sum += numbersEntered;
}
while (/* ??? */);
printf("Sum = %.2lf", sum);
return 0;
}
What should I do in the while
statement to stop the loop after the user enters 4
integers?
File can't open due to permission
I could not get the permission to communicate with com port 7 and received this error:
Warning: fopen(.COM7:): failed to open stream: Permission denied in C:xampphtdocssmstest4.php on line 3
Uh-oh. Port not opened. Please help me to get permission in Windows 7?
About if else staetment
here is the code!
code1 :
if(false) {
//1000 lines of code
}
else {
//1 line of code
}
code2 :
if(false) {
//1 line of code
}
else {
//1 line of code
}
what will be the process time of above two codes? Also please try to explain...
How can I scale an image using tcpdf?
I've got an image of size 490 x 630 that was drawn in corel. It's supposed to have 41.3 mm (wide) and 52.3 mm .
The unit I'm using in my TCPDF class is "mm".
I'm having trouble trying to acomplish this.
What value should I put on setImageScale() ?
Thanks !
strange occures when cmake freeDiameter1.2
I'm making install freediamete1.2 and got a strange error and I'm stuck for a couple of days.
The error is showed as below:
What's the time complexity of this while loop?
while(n>x)
x*=x;
The correct answer is log(log(n)), I can see the log(n) since x^k>=n is when the while loop will stop. so I got to log(n), what am I missing?
P.S: it is given that x=2.
C Standard - Comma Operator Syntax
according to the C Standard (and K&R) the syntax of the Comma-Operator is as follows:
expression:
assignment-expression
expression, assignment-expression
But why does this statement work?
5+5, 1+1;
5+5 and 1+1 are not assignment-expressions, but the C Standard requires assignment-expressions as operands for the Comma-Operator.
How do I programatically force an onchange event on an input?
How do I programatically force an onchange event on an input?
I've tried something like this:
var code = ele.getAttribute('onchange');
eval(code);
But my end goal is to fire any listener functions, and that doesn't seem to work. Neither does just updating the 'value' attribute.
Is it ok to save order ID on clients' side as cookie?
Can someone abuse this order id to hack someone's detail? I am saving this for a notification feature. I just want to identify unique order made by customers. I've figured out order ID is the most unique data that I can think of. Please let me know if there's any security issue with this.
Disable automatic upload in mini-ajax-file-upload-form/
I use Mini ajax upload (http://tutorialzine.com/2013/05/mini-ajax-file-upload-form/) to upload images.
I want to disable the automatic upload and do it with a submit button.
The autoUpload: false,
in jQuery.fileupload.js doesn't work.
Any idea ?
how to change invoice and delivery order number in virtuemart
how to change invoice number and delivery number in virtuemart like this the starting invoice number will be 9546900001 & delivery order number will be DO953700001....... Invoice number 95469 will be fixed and only 00001 will increase, once reach 99999 will move to 100000.Delivery order number DO9537 will be fixed and only 00001 will increase. Please help me! Thks!
Swift - How to find <img> tag and its attribute 'src' in HTML string
enter image description hereI have an HTML string which I extracted from url. I need somehow find first <img>
tag. In a nutshell I need to implement querySelector('img').getAttribute('src')
in swift. Any suggestions?
Writing a portable C program - which things to consider?
For a project at university I need to extend an existing C application, which shall in the end run on a wide variety of commercial and non-commercial unix systems (FreeBSD, Solaris, AIX, etc.).
Which things do I have to consider when I want to write a C program which is most portable?
security risk of disclosing php files name
I am developing a web application using a laptop server wamp. when I inspect my page using DevTools on chrome, i can still see the name of the php files (with their extensions). is disclosing the php files name of my application risky? if yes how can I hide them?
thanks.
Call Javascript Specific Function from external file with same name that other
I have a custom function named tooltip() for another issue but I need to use the tooltip() function of bootstrap.
How could I call those specific tooltip() function of bootstrap?
Executing this I am calling mi local function tooltip():
$('[data-toggle="tooltip"]').tooltip();
Thanks
How do I record JSON data to file using PHP?
This is the code I've figured out.
<?php
$username = $_POST['username'];
$email = $_POST['email'];
$json = '{"username":"'.$username.'",'.'"email":"'.$email.'"}';
$file = fopen('token_data.json','w+');
fwrite($file, $json);
fclose($file);
?>
But this is absolutely not the right way.
How to pass LIST to view as JSON in MVC asp.net
Laravel 5 - Call to undefined method IlluminateDatabaseEloquentCollection::Paginate()
I'm having an error
Call to undefined method IlluminateDatabaseEloquentCollection::Paginate()
I've been doing this:
public function index ()
{
$articles = Article::latest('published_at')->published()->get()->paginate(5);
$articlesLink = $articles->render();
return view('articles.index', compact('articles', 'articlesLink'));
}
How do I switch this script from INSERT to UPDATE
I would like to change this to UPDATE... Can someone please write the script for me... I've tried for a couple of days with no success. Thank you for your help!
$query_upload="INSERT into images_tbl (images_id, `images_path`) VALUES ('".$_SESSION['user_id']."', '".$target_path."')";
Underscore JS, find object which contains value in array
Im looking for a solution to find json object which contains a value in b. example: find objects which contain "jinx" in b.
sample data. [{ id:1 a:"karma", b:["jinx","caitlyn","tristana"] }, {....}, {....}]
I understand underscore works better for key/value pairs but this would be of great help.
Thanks.
issue with mysqli function
My page displays this error "mysqli_query() expects at least two parameters, one given on line $result=mysqli_query($connect);"
Here is my code:
mysqli_query($connect,"SELECT
*FROM $tbl_name WHERE phone
='$phone' and
password= '$password'");
$result=mysqli_query($connect);
$count=mysqli_num_rows
($result);
if($count==1){
....}
PhpStorm Access to Database
I am trying to change values in my database, but I am always getting this error :
This table is read-only. Cell editor changes cannot be applied.
But it´s not set to this value, I can access it freely with any other php script. Any ideas that might help?
Declare variable let in javascript ECMAScript6
Why is it possible to declare variable named let when I can't declare const or var. I know I will never do that , but I am just curious if there is reasonable explanation. So I can do:
var let = 5;
let x = 3;
x + let -> 8
Why is this even possible?
mardi 30 août 2016
lstat doesn't detect symbolic link
I'm trying to check if a file is a symbolic link, my test doesn't seem to work. How can I check for symbolic links?
if (lstat(file->full_path, &file_info) == 0)
printf((file_info.st_mode & S_IFDIR) ? "l" : "");
else
printf((S_ISDIR(file_info.st_mode)) ? "d" : "-");
PHP get yesterdays date unless weekend
I need to get yesterday's date to show the market close date. This only applies to Monday through Friday as the markets are not open on the weekend. Using this format how would I do that?
<?php
$yesterday = date("Y-m-d", mktime(0, 0, 0, date("m") , date("d")-1,date("Y")));
echo $yesterday;
?>
PHP reg ex allow all letters in all alphabets
I want to create a reg expression in PHP to allow all letters in all alphabet including Cyrillic, Greek Chinese etc and also allow numbers, dot and underscore. First three characters must be letters (all alphabets).
This will be used to validate a username so no spaces.
$regex = p{L};
Initializing a char with an int in C
I am new to C programming and would like to create a char that puts text before an int.
char charPin[] = ("PIN%d",pin);
I want it so I can pass charPin
to an external function. I am receiving an invalid initializer on the beginning of the line.
How to set height and width of an image object in js
I have this array of image objects and I want to set the height and width if possible inside the array, because I have tons of images which I put in a table and I want them all to be the same size. Any ideas?
function myFunction(){
var imagelist = [{"image":"image3.jpg"}];
}
How do I set an image as a background in React?
I have a <div style={styles.background}></div>
Is it possible to do something like this?
import image from 'img/image.jpg';
const styles = {
background: {
background: `url(${image})`
}
};
export default styles;
I know that won't work, but is there something similar to that?
AJAX JQuery delete data
Help, I have a big problem with ajax, I deleted records using ajax, using confirmation window bootstrap, very well when I press the button to delete it runs correctly and the table refreshes without any problem, the problem is that when I want to remove another record, opens the modal window bootstrap, but do not run anything
Stack smashing detected
I am executing my a.out file. After execution the program runs for some time then exits with the message:
**** stack smashing detected ***: ./a.out terminated*
*======= Backtrace: =========*
*/lib/tls/i686/cmov/libc.so.6(__fortify_fail+0x48)Aborted*
What could be the possible reasons for this and how do I rectify it?
Javascript REGEX matching two brackets [[something]]
trying to match anything width and including two brackets e.g. [[match this]]
so I can replace without brackets.
here is what I have as far var regex = /([[|]])w+/g;
However this matches the above like this [match
Any help would be appreciated
Case Insensitive String comp in C
I have two postcodes char*
that I want to compare, ignoring case.
Is there a function to do this?
Or do I have to loop through each use the tolower function and then do the comparison?
Any idea how this function will react with numbers in the string
Thanks
Socket communication in char device driver
Is it feasible to open socket from kernel module of a char device driver in linux? I am trying to emulate the output / input stream of char devices over network. But as far as I searched opening a socket from char device is not possible? Any other option to access udp / tcp ports from char device drivers?
how to only use created_at in laravel
everyone.
I am new to laravel.
this is my questions:
this can custom timestamps name
const CREATED_AT = 'created';
const UPDATED_AT = 'updated';
this can disable timestamps
public $timestamps = false;
I want only use created_at , how to do it ?
Counting number of code points in a LPTSTR
What is the recommended way to count the number of code points (not code units) in a LPTSTR
in C? wcslen()
isn't helpful here because it returns the number of code units, but I need the number of code points in the LPTSTR
, i.e. the number of characters in the string.
I am getting an unexpected error that does not make sense to me
line 3: syntax error near unexpected token '('
line 3: 'int main () {'
#include <stdio.h>
int main () {
int x;
char c;
printf("1. Shape Printern");
printf("2. Circular Charsn");
printf("3. Factorsn");
printf("4. Exitn");
printf("What would you Like to do? n");
scanf("%d %c" , &x, &c);
return 0;
}
How to prepare a .exe file of a php gtk application
<?php
$window = new GtkWindow();
$button = new GtkButton('Hello word!'); //$button->connect('clicked','olamundo');
$window->add($button);
$window->show_all(); Gtk::main();
?>
Codes are here. I run it and see result of hello.php but i want to find exe file of hello.php. How to find this file ?
how to use INNER JOIN and IN Clause in same query
i have three tables and want to run INNER JOIN and IN clause on them. can anyone tell me where i am doing wrong
SELECT `tblinvoices`.id,`tblinvoices`.userid,`firstname`,`lastname`
FROM `tblinvoices`
WHERE `paymentmethod`IN
(SELECT `gateway` FROM `tblpaymentgateways` WHERE `setting`='type' AND `value` = 'CC')
INNER JOIN `tblclients` ON `tblinvoices`.userid=`tblclients`.id"
Why write() to STDIN worked?
I have the following code:
int main()
{
char str[] = "Hellon";
write(0, str, 6); // write() to STDIN
return 0;
}
When I compiled and executed this program, "Hello"
was printed in the Terminal.
Why did it work, did write()
replaced my 0
(STDIN) argument with 1
(STDOUT)?
&char and char pointer is incompatible pointer type?
char filename[100];
char *file;
fgets(filename,100,stdin);
file =&filename;
give this warning:
warning: assignment from incompatible pointer type [enabled by default]
file =&filename;
Isn't &filename and file have the same type as address of character since i use & to get address of the variable?
Why string assinging pointer is not conceder as dangling pointer?
Why we mention string assigning character pointer as a dangling pointer in below code ?
void func()
{
char *ptr;
*ptr = "dog";
char *p1 = malloc(sizeof(char));
char *p2;
*p1 = 'a';
*p2 = 'b';
}
Here p2
is called 'Dangling pointer' but *ptr
is not calling dangling pointer. Why is it so ?
How to get notified whenever anything happens to an x window? [on hold]
I'm looking for a way in c or c++ to get notified whenever a new window opens, a window closes or when a window gets mapped or unmapped. I'm guessing you'd have to use Xlib but I'm not sure. If anyone can tell me about what libraries and functions I need for that, I would really appreciate it.
How to register JavaScript helpers with Handlebars.net
How would we register these two JavaScript helpers in Handlebars.Net?
For Moment.js:
Handlebars.registerHelper("formatDate", function (datetime, format) {
return moment(datetime).format(format);
});
For a java script calculation:
Handlebars.registerHelper("formatPercent", function (val1, limit) {
return Math.ceil(100 * val1 / limit);
});m
Difference between linefeed and newline
This sentence from k&r:
A text stream consists of a sequence of lines; each line ends with a newline character....For instance, the library might convert carriage return and linefeed to newline on input and back again on ouput.
How can you convert linefeed to newline and why is it done?
Reference .css and .js files in google chrome
Is there any problem if I reference .css and .js with "~/file.ext" for chrome? Because I get some layout errors when I do it this way. Does chrome want it like "../" instead of "~/"? I am developing with Asp.Net Core and I just drag and drop the files from the Solution to the Html to create the references.
FIle search in C language [on hold]
Hello I just wanted to know how can you scan for a particular number in a file, for example a #ID in an employee file record?also, I just wanted to add that #ID is part of a struct Employee and I'm using a sequential file and well one final thing is that I'm using the C languaje Thanks!!!
lundi 29 août 2016
Why break cannot be used with ternary operator?
while(*p!='�' && *q!='�')
{
if(*p==*q)
{
p++;
q++;
c++;
}
else
break;
}
I have written this using ternary operator but why its giving error for break statement?
*p==*q?p++,q++,c++:break;
gcc compiler gives this error: expected expression before ‘break’
How to get the size of memory pointed by a pointer?
I am currently working on a NUMA machine. I am using numa_free
to free my allocated memory. However, unlike free
, numa_free
needs to know how many bytes are to be freed. Is there any way to know that how many bytes are pointed to by a pointer without tracing it out?
ELF Header Size Greater than 52 bytes
According to the given Elf32_Ehdr structure (page9) in the link elf-format elf header size should be 52 bytes and fixed. But there is also field e_ehsize and can be greater than 52 bytes. In where defined those extra bytes until first section header starts ?
Write a 2D array into a file without changing it's previous content
I need to write the contents of a matrix into a file.
The 2 dimensional matrix is:
char encodedInst1[20][20]
I want to pass the updated matrix to a function which writes it to the output file without altering the previous content.Moreover each string should be written in a a new line.
Get IP input from user and validate WINAPI
How can I get the IP that a user inserts in a IP Control box in Winapi, in a way that I can validate it after?
Already tried GetDlgItem() but it doesn't seem to store the IP in the correct format, maybe I'm doing it wrong. I was storing it as a DWORD.
Any tips?
select with update in one query
I have a query like:
SELECT id, name, surname, fromId, toId, msg_text, readed FROM messages WHERE toId = 2;
So I want to update all selected rows.readed = 1
. And Query must return all selected rows.
These action must do in one query if possibe.
Sorry for my english
Can website visitors see server-side source code?
I want to make sure visitors to my site can't see the PHP code that's generating the page. Here is a reference: http://may.edu.np/tmp/
Can anyone explain to me how server-side scripts are interpreted and how the result is delivered to the end user?
Detect the MSS size of TCP session in php
When a HTTP request is made by clients behind VPN, the initial TCP handshake would have a MSS much less than the standard one (1460). Wonder if it's possible for a php script to get this information and process the request differently.
If possible, some hackers may program it to distinguish requests from security researcher or some security products.
How to compare socket address in C?
I mean, which fields of struct sockaddr
should I compare when I check whether two struct sockaddr
's have the same ip address and port number? And what about sockaddr_in
?
Can I just cast sockaddr_in
to sockaddr
, and compare it to a real sockaddr
?
Cakephp read and write json files.
I am new to cakephp. I am trying to save json output as a file in webroot. I would also like read the file into a array.
I know we could output array as json object using json_encode($array). But I am stuck creating and reading json files into an array.
I appreciate any help.
PhpStorm warning - Cannot resolve directory - a href without file extension
I have PHP files and a href links that lead to these files but without the file extension. PhpStorm outputs the messages "Can not resolve directory. This inspection checks unresolved file references". Example:
File path: /account.php
<a href="/account/">...</a>
Is in PhpStorm any setting to resolve this problem?
PHP json_decode returns int(1)
I'm having some trouble accessing a json string - Demo Link
//PHP CODE
$json = curl_exec($ch);
$json = json_decode($json, true);
var_dump($json);
// RESULTS
@{"error":"Bank account validation failed.","error_type":null,"code":400}
int(1)
Any help would be highly appreciated!
Counting contractions as 2 words instead of 1 in str_word_count()
I'm trying to get the word counts of a string, but I want to count contractions as 2 words instead of 1. Is there a way to do this with str_word_count()?
$string = "i'm not";
$count = str_word_count($string);
echo $count;
Result:
2
Want Result:
3
Which is better to use in Laravel 5.2 redirection?
I am newbie in Laravel and I am using Version 5.2, and I wanna know what is better to use in return value on redirecting routes in my Controller.
return Redirect::route('home');
or
return redirect()->route('home');
Please indicate your source(s) in there are any.
Set console background color in node.js
I'm re-coding a c# program in node.js but I don't found a func to set the background color in node.js docs.
Sorry for my bad english, I'm brazilian
Adding a custom library to c programs
I am using Ubuntu Linux I have made a custom static library Mylib.a, I can include it to only those c files which are in the same directory as the static library.
I want to make it a general library so that I can include the library file to any c file I want irrespective of its location
Why should the system() function be avoided in C and C++?
I have seen a lot of people on forums telling to avoid the system()
function, like system("cls")
. I don't understand why.
Please tell me why I should avoid this function. And also, as clrscr()
doesn't work with CodeBlocks, what are other ways to clear screen without using the system()
function?
How to place "Enter Coupon Code" in sidebar Cart?
I'm using the sidebar cart as a SlideIn Cart on the Productpage. From this Cart, the customers goes directly to the one page Checkout. Now I want the Customer to be able to enter a Coupon Code on that Page.
In the Sidebarcart on the Productdetailpage.
Does anyone have a hint for me or realized something similar?
Is there one include file that covers all file operations?
OK, maybe not, but which ones do you need in order read, write and delete files and directories? I've got stdio.h and stat.h and now I find I need unistd.h in order to use unlink. I've never heard of unistd.h. Maybe I should be using something else besides unlink? Right now I'm using C on Linux Mint.
Disable key ESC ALERT Javascript
Hello I have the next code:
$(function () {
var int = self.setInterval(function () {
alert("Session expired.");
location.reload(true);
}, 60000);
});
I want to disable the Esc key and thus prevent the alert out of execution. Also if anyone knows how to assign a CSS without using jquery alert Please tell me they are greatly appreciate.
Serial Number Detection with openCV
I have a video with a serial number. Like in the picture. How I can with openCV detect the position of this patron. The only thing that I need is detect the location of this patron. Always this patron will have 12 numbers and will be white.
Reparsing project in Nebeans
Is there any way to auto re-parse project in netbeans while practicing c or c ++ ? I am new to c program in netbeans. It says unable to resolve identifier while wrinting ststements and lines in C program. So, it would to nice to know if there is an way for auto reparse mode to prevent reparse in every second line. Thank you
Position:fixed toolbar in a div next to a dynamic width side nav
I have a side nav that can be collapsed. I want my toolbar div to be fixed to the top and fill the rest of the width. 100% causes it to go off the page. I can't do a calc() because of the dynamic width of the sidenav.
How can I set a position: fixed div to fill the remaining width?
My program doesn't compile
#include <stdio.h>
#include <math.h>
#include <cs50.h>
int main (void);
{
int x=0;
x=GetInt();
for (x<10)
{
printf("Hellon");
i++;
}
return 0;
}
It says an error:
expected identifier or '('.
It seems to not allow me to compile. I'm probably doing an error.
Convert image with mogrify and output it to variable
I am trying to convert a bmp
to jpg
with mogrify.The jpg should then be store in a variable.
Here is my attempt thus far
$jpg_content = shell_exec("gm mogrify -format jpg ". escapeshellarg($image) . " && cat " . escapeshellarg($image)."2>&1");
However $jpg_content
is null
dimanche 28 août 2016
Find a string from group of string and take the value using php
we have a group of string like white-1,black-2,blue-4
etc . This is the string format .
ie : name1-name1 value , name2-name2 value
etc .
From this string i need to take the associated value . For example value of white is 1 , value of blue is 4 etc .
How can i do this ?
php yii framework :: $content is not found
<div class="content">
<?php echo $content; ?>
</div>
<?php echo $this->renderPartial("/site/_footer",null,true,false); ?>
this is my code.
there is variable in code $contant.but i cant able to find the variable anywhere.
pls help me
How to use substring() when the string has a space in it
I have a string containing a person's first and last name such as John Doe
. I would like to convert this string to John D.
Normally, I would just use substring(0,1)
on the last name variable, but how can I achieve this when the first and last name are one string with a space in between?
How does .waypoint work?
If a have a code like this
var waypoint = new Waypoint({
element:document.getElementsByClassName ('waypoint'),
handler: function(direction) {
console.log('Scrolled to waypoint!')
}
})
And I have 10 elements that have 'waypoint' class,how does waypoint plugin control if those elements are visible in viewport?Does it control all div's offsets every time onscroll event is triggered?
change the inverse scrolling behavior in ipad
I have implemented css scrollbar for ipad, as normally the scrollbar does not appear in ios. But now the scrolling behavior is different than that of windows, ie., we cannot hold the scrollbar and pull down ( as we do in windows ) so that the list goes down. Instead we swipe up on the scrollbar to do this. Any solution is highly appreated
Will the data in fwrite() buffer be cleared when a program exists abnormally?
fwrite() is a library call that firstly buffers the data into a user space buffer, and then call the write() system call later to actually carry out the write operations. If a program invokes fwrite() to write some data to a file but then exists abnormally, will the buffer of fwrite() be cleared, or the buffered data will be left over in memory?
Javascript string sorting functions
Hello I'm new to javascript and I'd like to know whether there are some sorting functions for working with strings since I haven't found any. Perhaps for alphabetical sorting like
var str = sort("bca");//str contains "abc"
If there aren't any do I have to just make my own or is there any other solution like importing them somehow?
x86 or amd64 Architecture?
I have compiled my application to using the x86 instruction set but I need to know programatically whether the machine the executable is running on supports the amd64 instruction set or not. Is there a simple way to find this out (possibly using CPUID)?
The application needs to be able to run on multiple OSes so non-OS based methods are preferred.
Adding ng-init code from json object
I'm trying to bind value of ng-init to a input from an json object.
However I get "Syntax Error: Token" where am I going wrong ?
$scope.obj = { init: 'obj.value = obj.value || 20' };
send textbox input on ng-click
I have an input and a button
<input type="text" name="search_tags" id="search_tags" placeholder="Search by Tags" class="form-control" >
<button type="submit" class="btn btn-primary btn-lg" ng-click="searchTags()">Search</button>
How do I pass the text present in the input textbox to the searchTags() function after button ng-click?
hide element press Esc
This code doesn't hide the box div
which was supposed to be hidden when I press the Esc key.
function Boxup(elementN, event){
$("#"+elementN).css({
"display":"block",
"top":event.pageY+"px" ,
"left":event.pageX+"px"
})
}
function hideCurrentPopup(ele){
$(ele).parent().hide();
}
$(this).keyup(function(event) {
if (event.which == 27) {
disablePopup();
}
});
Am I missing something?
How to create chain of processes in C?
I need to create 5 processes one being father of the second, grandpa of the third etc. All of them have to wait for each other to finish. I tried the approach with:
switch (pid = fork()) {
case 0:
printf("Child PID = %dn", getpid());
printf("parent: =%dn", getppid());
return 0;
default:
break;
But I always get the same parent.
AjaxForm success message from Php as json
Hi am new in using ajaxform plugin and I am passing a success or error message from Php as json and I can't access the messages. Please assist me on how to do it. Here is a sample of my code.
<?Php
$results['status'] = "error";
$results['status'] = "user not added";
header('Content-type: application/json');
echo json_encode($results);
?>
Learning PHP and web-programming for intermediate programmers [closed]
I would like to know some good resources (book or website) on learning PHP for those who are already familiar with programming.
Many of the tutorials I've been finding are for people who never programmed before and take way to long to go through to even learn basic language constructs.
The optimal resource would not assume previous web-development background however.
How to compile .c .h .so file?
Another company gives me three files(demo.c,api.h,libapi.so). they told me that't enough for develop. I'm confuse how to build these thing together. I use gcc demo.c -o demo -l libapi.so . But's it's said "ld: library not found". I use Mac OS system. Some websites said i should use Linux to use .so file. what should I do?
Set websocket origin to localhost javascript
I have server with doamin example.com. When user loads page on this server, it uses websocket client on javascrip to connect another websocket server. Another server uses CORS. So user can't connect to another server with websocket, becouse header Origin: example.com. But with Origin:localhost it can connect. Is it possible to set Origin: localhost when use javascript to connect with websocket?
How to generate a random number from within a range
This is a follow on from a previously posted question:
How to generate a random number in C?
I wish to be able to generate a random number from within a particular range, such as 1 to 6 to mimic the sides of a dice.
How would I go about doing this?
How to receive text from <div> tag?
I have a tag <div class="text9">
with text. I need to add this text in the title. For example: <div> for sale
. How can I do that?
I tried this, but it did not work:
preg_match('#<div class="text9">(.*?)</div>#isU'$text, $out);
Detect overlapping periods php
can you help me with overlapping periods. I have array
["1-9","11-15","14-20","8-11"]
Each element in array its period. Min - 1 period, max - 10 periods in array. I need to detect if they are overlapping.
I find this cases from another question
How many times does a number/character occurs in a string literal?
No tokenization should be necessary. Consider the following string literal:
char* string = "12, 789, 1234";
The output for this specific string would be:
0, 2, 2, 1, 1, 0, 0, 1, 1, 1
This means that there were 0 zeros, 2 ones, 2 twos, 1 three, etc.
I understand that I could use the ASCII table but I was wondering if there was an easier way of doing it.
How to put a final summary message in a yacc program?
When I redirect input to my yacc program from an input file, after it finishes parsing the file I want the yacc parser to print a summary of what it did. I want it to do the same thing if I am entering input through the keyboard and then I press Ctrl+D. Is there a way to do that?
Variable assignment in C vs scanf
I am new to C and I have a small problem in understanding this scanf()
line:
printf("Enter a message to add to message queue : ");
scanf("%[^n]",sbuf.mtext);
How do I write this statement if I am getting the value from the command line? I think I would have to declare the variable as a string?
Creating JSON-like data in Typescript
So in normal Javascript you can execute this block of code fine:
var myObj = {};
myObj['one'] = {};
console.log(myObj);
console.log(myObj.one);
But you get this error in TypeScript Property 'one' does not exist on type '{}'
Is this just by design? (e.g. I'm expected to make my own classes for this)
Should I reuse variables?
Let's say that i need a counter (I program in C), only once. Should I just reuse a variable that is no longer needed, instead of declaring a counter?
For instance:
int main() {
int in;
//code goes here
for(in=0; in<10; in++) //do something
//instead of using i, I reuse in and use it as a counter
return 0;
}
samedi 27 août 2016
How to delete multiple Ext components at the same time.-EXTJS
I'm trying to remove multiple elements from an array using EXTjs using id of the comp.
Ext.getCmp('id1').destroy();
However how can I do if i have to delete multiple comp ids, like:
Ext.getCmp('id3').destroy()
Ext.getCmp('id4').destroy()
Ext.getCmp('id5').destroy()
Any ideas?thx
Remove Number with Regex
i want to remove number at beginning and the end of word in one sentence for example:
"123helo helo123"
then it will return
"helo helo"
I've tried this pattern:
/^[0-9]|[0-9]$/
but it just recognized them as one string but not in words. Can you help me?
Set timezone for New Zealand
I'm currently developing a website using Laravel. I would like to change the timezone to New Zealand since it will be used there.
'timezone' => 'NZ',
I currently have that in my config/app.php and it returns the correct time but wrong am/pm. E.g time returned is 3:03 am, but correct time in new zealand is 3:03 pm.
How to dynamically allocate memory for JNI object array
I am working on JNI with C language. Here I have created an object array of size 4000. According to my requirements the array size has to grow dynamically. How can I allocate memory dynamically? I have tried using malloc
. But I cannot achieve this.
Here's what I have tried:
OriginalArray = (*env)->NewObjectArray(env, 4000, tradeObject, NULL);
default value of __PTRDIFF_TYPE__
I see it is legal to use the variable __PTRDIFF_TYPE__
with no header inclusion.
I tried to look for this variable name in ISO/IEC 9899
but it does not appear. I expected to see its definition in the 7th part, C library.
Why is it legal ?
I am using the gcc under Linux/GNU.
Valid json check in C language
I have searched a lot in google, I want to programatically check if the string below is valid json in C.How to do that? I am currently using json-c library.
char * string = "{
number1 : 100,
number2 : 10,
files : [ c , c++, java,PHP,java,PHP ],
random: [123567876523333,908,988]
}";
the library has no function to check if the string is valid json. Thanks in Advance.
how to get column names in PDO error?
when I use PDO errorInfo
I get this :
Array (
[0] => 23000
[1] => 1062
[2] => Duplicate entry 'zzz@zzz.net' for key 'email'
)
but I wanna get only column name > 'email' and 1062 for error code to echo :
this email zzz@zzz.net already registered
because I use email or phone or username for registration
A form's "action" and "onsubmit": Which executes first?
I'm trying to debug a webpage and I see a form element whose opening is
<form name="aspnetForm" method="post" action="default.aspx" onsubmit="javascript:return WebForm_OnSubmit();" id="aspnetForm">
Having only a base knowledge of web form
s, I'm wondering what the order of execution is for the action
and onsubmit
.
HTML - Calling Javascript Function with variable? [on hold]
So I am trying to do a button and if you click on it then it calls a function called order()
. So, If I'm trying to do something like this order("+<script>blablabla</script>+")
then it shows me a error if I type into something between the "+HERE+"
Why that? Is there any way around it?
C Abstract Data Type in Rust
I have this code in my header file:
typedef struct _game* Game;
Right now to FFI from Rust I'm doing:
extern "C" {
pub type Game = usize;
}
Is there a safer way to do this than to treat it like a pointer-sized numeric type? Would this work:
pub struct Game(usize);
How to get input of the 4th child of an element using class?
<tr class='abc'>
<td></td>
<td></td>
<td></td>
<td>
<input></input>
</td>
<td></td>
</tr>
I want to when i click input of the 4th child of tr , alert something, what can i do?
Tell if HTTP request is Keep-Alive
How to tell if a HTTP request is a Keep-Alive connection?
Is it possible to detect via PHP if a HTTP request is Keep-Alive?
If a connection is not Keep-Alive I want to return an error as a part of the API protocol to reduce the use of resources at each SSL handshake and to speed up the communication between server and client
Why isn't my React code working?
I am getting this error on console, but I think the code is correct. https://s31.postimg.org/kyd70ejej/whats.png I have written the same code as told in this tutorial: https://egghead.io/lessons/react-introduction-to-properties. Can someone help? Thanks in advance :)
Radio Button with value to be <input type="text">
Is this possible to have input type="text" as a value to radio button ?
I have 3 options on the input type radio button.
[ o Option 1, o Option 2, o Others ]
But instead of adding Others, I wanted it to be an <input type="text">
wherein people can add in a specific value if they click this.
Value of each element in a form on the same page
we need help with listing names on one html page. So you as a user can submit more then one value in a form. The exact case is a form in which you type your names. Then the name has to be saved and listed underneath the form. So the users all can write there names and then all names will be listed underneath the form. Thanks.
cache with different url parameter
I'm reading that a url is cached based on the file AND parameter. I have a html file with some javascript that processes parameters that are passed in. I want to cache the file but if the parameter changes, then it has to load the entire file each time which defeats having a cache. How do I cache the file when the parameter changes all the time?
Where is the C auto keyword used?
In my college days I read about the auto
keyword and in the course of time I actually forgot what it is. It is defined as:
defines a local variable as having a local lifetime
I never found it is being used anywhere, is it really used and if so then where is it used and in which cases?
AngularJs creating dynamic form to generate JSON schema
I need to create a form, so that i can create custom JSON schema and save the schema into db using a service.
JSON schema will be like : {"id":"schema_id","name":"schema_name","data":[{"id":"id","type":"text","attribute":"abc"}, {"id":"id","type":"text","attribute":"xyz"}]}
Also i need to have conditions in the form if type is list or some other value.
Insert Into 3 Table Relational
how to input data through a table by using the checkbox, I have searched google and I have not found a way to it, I beg the help of the form as shown below to QUERY process. thanks
How to dispaly the three biggest numbers of one of the columns of a database table?
I have to write a php
script to find the three biggest numbers of a column in a database table. This is my code so far, but it doesn't work .
<?php
$con=mysql_connect("localhost","root","");
$db=mysql_select_db("pool");
$res1=mysql_query("SELECT * FROM buy ORDER BY value LIMIT 3 ");
while($r1=mysql_fetch_array($res1)){
echo $r1['value'];
}
?>
warning: format ‘%s’ expects argument of type ‘char *’, but argument 2 has type ‘int’ using argv
I don't even know what is happening, I just started a new project and setup a basic cat just to make sure everything was working, and this happened.
#include "stdlib.h"
#include "stdio.h"
int main(int argc, char *argv) {
printf("%s",argv[0]);
return 0;
}
That's it, I reinstalled gcc, g++, and both multilibs. I really have no clue what to even think.
In C, can you do this? int i; i = get_long() % 20;
unsigned long get_long(); //returns some crazy large unsigned long
int i;
i = get_long() % 20;
The value of the right hand side should ALWAYS be big enough to fit into an integer because the possible values are only {0, 1, 2 .... 18, 19}.
Can I assume that the compiler can convert that unsigned long
right hand side to an integer on the left hand side?
how to parallelize this for-loop using reduction?
I am trying to make this for-loop parallelized by using Openmp, i recognized that there reduction in this loop so i added "#pragma omp parallel for reduction(+,ftab)",but it did not work and it gave me this error : error: user defined reduction not found for ‘ftab’.
#pragma omp parallel for reduction(+:ftab)
for (i = 1; i <= 65536; i++) ftab[i] += ftab[i-1];
change Linux users run time, from a c/c++ code
I want to change Linux users run time, from a c/c++ code. How could I do the same?
Lets say, I am running a c/c++ binary from a Linux user "abc" which is a non root user. Inside the c/c++ code I want to switch over to user a "xyz" to perform a specific task, and then regain the privileges of "abc" back.
vendredi 26 août 2016
Pass a trigger function to two components
Here is what i want to do:
render() {
return (
<div>
<Child onTrigger={xxx} />
<button onClick={xxx} />
</div>
)
}
When button
is clicked, I want something to happen in Child
. How do I do this? It cannot just be a boolean because it should be a trigger and be called multiple times.
multiple conditions for JavaScript .includes() method
just wondering, is there a way to add multiple conditions to a .includes method, for example:
var value = str.includes("hello", "hi", "howdy");
imagine the comma states "or" (it's asking now if the string contains hello hi or howdy. so only if one, and only one of the conditions is true.
is there a method of doing that?
Site got SQLi injected while using bind_param
Today I discovered my site got hacked through SQLi injection. Even though I am using bind_param I thought this was impossible.
if($_GET['api'] == 'info')
{
$status = 'Test';
$stmt = $mysqli->prepare("INSERT INTO information(one, two, status) VALUES (?,?,?)");
$stmt->bind_param('sss', $_GET['1'], $_POST['2'], $status);
$stmt->execute();
$stmt->close();
}
What am I doing wrong?
Chrome Dev Tools very slow to respond in large web app
I have a large, javascript heavy web app that I am working on. I am experiencing very slow response times from Chrome Dev Tools for XHR responses and console loggging (3-5 secs). The actual app is running fast and responsive, only dev tools looks like it is suffering.
Does anyone have any idea why Chrome Dev Tools is becoming sluggish as my app grows?
Script to Download Images From Multiple Web Pages
I would like to write a script that downloads images from a website. The website has a gallery of thumbnail images which link to a html page where the full resolution image is displayed.
How can I write a script that follows the link of the thumbnail, downloads the full resolution image, and repeats this process until all images are downloaded?
Thanks in advance!
put method doesn't update model in database nodejs
Have code without error in console, but field 'check' doesn't change on true state...why?
apiRoutes.put('/intake/:id', function(req, res) {
var id = req.params.id;
Intake.findById({id, function(err, intake) {
if (err)res.send(err);
check: true;
intake.save(function(err) {
if (err) {return res.json({success: false, msg: 'Error'});}
res.json({success: true, msg: 'Successful update check state.'});
});
}})
});
How to know the called program path in C/C++ in Linux?
I am having a compiled C program say test in /usr/bin and a python program say pgm.py is in /opt/python/ . In pgm.py , I am calling the C program like os.system("test arg1 arg2") . Is it possible for the C program to know that it is being called by /opt/python/pgm.py ?
Cannot read property 'childNodes' of null in a slider
I have created a simple Javascript slider with Slice and Box effects. It runs and no problem. But when i look up console, I see that after two cycles it throws an error. Browser says that document.getElementById('smth') cannot get specified element. What may be the problem? Below is codepen URL. Slider
script
ERROR: "Parsing WSDL: Couldn't load from" then do something
PHP preg_replace three times with three different patterns? right or wrong?
hey guys, simple question... Is this the best way to do it?
$pattern1 = "regexp1";
$pattern2 = "regexp2";
$pattern3 = "regexp3";
$content = preg_replace($pattern1, '', $content);
$content = preg_replace($pattern2, '', $content);
$content = preg_replace($pattern3, '', $content);
I have three search-patterns I want to filter out! Is my code above appropriate or is there a better way?
Thank you for the info
In Extjs, is it possible to whitelist allowed html tags for HtmlEditor?
As title states, I'm looking for a way to whitelist allowed HTML tags to be used in HtmlEditor in Ext.js. Looking at the document, nothing seems to pop up..
http://dev.sencha.com/deploy/ext-1.1.1/docs/output/Ext.form.HtmlEditor.html
Any ideas? Is it not supported?
Does gcc include some header files automatically?
I have the following code:
int main()
{
printf("Hellon");
return 0;
}
I compiled it using the following command:
gcc -o myprogram myfile.c
And it compiled without any error even though I did not #include <stdio.h>
. So did gcc include this header file automatically?
My gcc version is 4.3.3
Javascript prompt and submit
i want to get a value from JavaScript prompt and pass it to input for finally submit it
<form id="createdirForm"><input type="text" name="" id="createdir"/><form>
<script type="text/javascript">
function createdir(){
var newdirname;
newdirname = prompt('Please input the directory name:', '');
if (!newdirname) return;
$('createdir').newdirname.value = newdirname;
$('createdirForm').submit();
}
</script>
Need a regex for float values
I have a number field in the form and am validating that number field for float values. But I need to restrict the float number to only one period (.
)
For example:
122.00
But now its taking input like this also: 123.00.
.
I dont want allow another period (.
) in the end again.
Is there any regex for this?
How to know whether a pointer is in physical memory or it will trigger a Page Fault?
If I have a pointer and I care about memory access performance I may check whether the next operation on it will trigger a page fault. If it will, an algorithm could be designed so that it reorders loop operations to minimize page faults.
Is there any portable (or linux/windows non-portable) way to check for a particular memory address whether access will trigger a page fault?
undefined reference to 'xcb_event_get_label'
I have #included <xcb/xcb.h>
and <xcb/xcb_util.h>
and linked with -lxcb
but I still get an
undefined reference to 'xcb_event_get_label'
I can see the function exists in the header file, and the error indicates a linker error, but what other libraries do I need to link against?
for Repetition Statement in c
When for statement is executed the value of counter variable has to be increased by one because I use pre-increment operator.
#include <stdio.h>
int main (void)
{
unsigned int counter ;
for ( counter = 1; counter <= 10; ++counter /*here is problem*/) {
printf( "%un", counter );
}
}
Problem -
When the program is executed, the value of counter variable initially is 1 instead of 2.
Increment- Decrement Operator in c [duplicate]
This question already has an answer here:
#include<stdio.h>
int main()
{
int s=4;
int x=++s+++s;
printf("%d",x);
}
value of x?? Answer should be 12 but i am getting 11. Anyone please explain the concept.
how to pass values into array in javascript
I get values from php. In label values are like: a,b,c,d
and in amount = 10,20,30,40
var label= <?php echo json_encode($label ); ?>;
var amount= <?php echo json_encode($Amount ); ?>;
Now I want to combine these values like
{ x: "label", y: amount }
in javascript
how I can do this ?
Velocity.js fires off fadeOut but not fadeIn
I have the following code It should
if($(window).scrollTop()!=0){
console.log('doout');
$("#topbottom").velocity("fadeOut", { delay: 500, duration: 1500 });
}else{
console.log('doin');
$("#topbottom").velocity("fadeIn", { delay: 500, duration: 1500 });
}
}
It fires off the fadeOut on scroll however it won't fire off the fade in. It does write doin to the console when I get back to scroll zero...
A bit confused.
Thanks
Search a query that matches multiple table fields
How to retrieve / output values that match multiple table fields.
SELECT name FROM table WHERE name IN ( 'Value1', 'Value2' );
My search query should take the following parameters : first_name and roll_number in user_table.
e.g. Retrieving a query on the following lines : Roy whose roll number is 5
I need to query this using a single query.
Run a Batch File OnClick of Button from DOM in Node-Webkit App
I cannot seam to figure this out please help me run "run.cmd" onclick of button from my nwjs application.
<button onclick="runHelperProcess()">Run Process</button>
.
<script type="text/javascript">
function runHelperProcess() {
gui.Shell.openItem('run.cmd');
}
</script>
run.cmd is located in the root dir of the nw application.
IntelliJ 2016 how to create separate project to test PHP application
I have a project that is written in PHP with IntelliJ. I need to create a new IntelliJ project that contains only tests for the PHP application. I can't use classes from the application in the tests project. How can I add other project as a dependency for my project that contains the tests?
I have tried using IntelliJ module settings but I don't see the dependencies tab.
Trying to understand a program in C
I'm trying to understand this kind of program in C, but I can't. Exactly, I can't figure out how *s is changed, and why the compiler shows 210012.
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void WhatIamDoing(char *s) {
char ch;
if (*s) {
ch = *s;
s++;
WhatIamDoing(s);
putchar(ch);
}
}
int main() {
char s[20] = "012" ;
WhatIamDoing(s) ;
printf( "%s", s ) ;
}
jeudi 25 août 2016
types and pointers address
Suppose the first element of double u[100]
has address 0x1000
, and sizeof(double)
is 8
. What does
printf("%p %pn", &u[3] - 1, &u[20] - 5)
output?
The homework answer is
echo '0x1010 0x1078'
How did they do the second part &u[20] - 5
?
How select data with given condition
I have following data.
{
"name" : "Maria",
"facebook" : [
{
"data" : "fb.com",
"privacy" : true
}
],
"twitter" : [
{
"data" : "twitter.com",
"privacy" : false
}
],
"google" : [
{
"data" : "google.com",
"privacy" : true
}
],
"phno" : [
{
"data" : "+1-1289741824124",
"privacy" : true
}
]
}
I want to return only data having privacy is equal to true. How do I do it ?
I tried but it returns all data having privacy is equal to false.
Thanks!
A web service for NFL schedules and scores (not api - json or xml)
I have been all over looking for a web service that supplies for free, of course, the NFL schedules/scores for 2016. Lots of answers; packages/fees/api's, but all I want is the service. Some suggested sites have disappeared or appear abandoned. What's being used out there in 2016? I prefer a json port but can deal with xml. I don't want to scrape.
Thank you for your help.
Mouse hover effect for owner drawn button without subclassing
As the title suggests, is there a way to receive in the parent window a notification of mouse hovering a button (which has been owner drawn) without the need of subclassing it? I use plain C on Windows.
I don't use custom drawing or any other types than owner draw (already tried).
I would like to change the appearance of the button when the mouse hovers it.
database creation using c programming
I want to create database using C programming.
I want to create the employee database system and want to update it dynamically. please guide me how can I go ahead.
I have to do it for embedded system which as flash memory. the database is need to be stored on that flash and I need to be able to update it dynamically. Document and suggestions are valuable.
Class 't3lib_cache_backend_FileBackend' not found
After updating TYPO3 from 4.5 to 7.6 and a PHP update from 5.3 to 5.5 I get this error in the install tool:
Detected Fatal Error
Class 't3lib_cache_backend_FileBackend' not found in /var/www/htdocs/typo3src/typo3_src-7.6.9/typo3/sysext/core/Classes/Cache/CacheFactory.php on line 76
PHP-Version is 5.5.36. A new download of the TYPO3 src did not solve it.
JavaScript library for offline maps?
I want a JavaScript offline library for world maps that allows me to provide a city name and then locate it on the map(using lat and long that is stored in it).
I've come across amchart maps, leaflet and jVectorMap but none of them has this offline support I want. Google Maps also doesn't provide this offline support.
Can you name some JS libraries for this ?
JavaScript ES6 - ERROR: You can only use decorators on an export when exporting a class
I am trying to export a function in ES6 so I can import it and use it in other files to have a DRY code. However I receive the following error:
You can only use decorators on an export when exporting a class (16:0) while parsing file:
export function totalItems() {
this.cart.items.forEach((dish) => total += item.qty);
return total;
}
Any ideas?
Javascript Send Enter Key after alert
I want to send Enter key with javascript after alert.I try this code:
setTimeOut(function(){
$(document).trigger(13);
},3000);
But this is not working. How do I do this?
image:
http://i.stack.imgur.com/VNYKo.png
I want to send Enter key on alert
How To Display Color Swatches In Product Page Magento
I want to display the color swatches on the magento product page . I have tried from magento admin panel by changing the configuration settings in the system but it is not working
any help would be appreciated !
Portable AES CFB Mode in C
I'm searching for a portable Version of AES 128bit CFB in C to include into my programm without a needed libary. It is used to crypt and encrypt strings sent over sockets so its just needed for plain text. It would be nice if there is a implementation with a little tutorial out there (Searched already for about 4 hours without success) Kindest regards John
Custom PHP Error Page for NGINX Not Responding To '?=_'
I've recently created a custom error page with configuration such as:
error_page 404 /error.php?code=404
But it seems to show up only error.php
instead of error.php?code=404
.
I've cheked the php file by accessing /error.php?code=404
in my browser and it works fine. I am using $Get
Please help. Thanks a lot.
find elements which id contains two substrings
I have an HTML table and I need to change the CSS style to all de <td>
whose "id"
contains the substring "_A_189"
and the substring "_B_V_852"
using jquery. The substrings could be in any position of the string.
I use this, but it doen't work:
$('id:contains("_A_189"):contains("_B_V_852")').css(style);
How can i check if shape:[] is null in json with php
I have a json object like this :
{"Techne":{"@Version":"2.2","Author":"ZeuX","Name":"","PreviewImage":"","ProjectName":"","ProjectType":"","Description":"","DateCreated":"","Models":[{"Model":{"GlScale":"1,1,1","Name":"","TextureSize":"1,1","@texture":"texture.png","BaseClass":"ModelBase","Geometry":{"Folder":[],"Shape":[],"Piece":[],"Null":[]}}}]}}
How can I check if the array Shape:[] is empty with PHP I only know how to do it with JavaScript but this matter needs PHP to be used how can I do it?
using float data type inC [duplicate]
This question already has an answer here:
- Is floating point math broken? 26 answers
include
int main(void)
{
float x=0.1;
if( x == 0.1)
printf("truen");
else
printf("falsen");
}
//I expect an output "true" but getting output "false", can anyone explain what's happening and give a solution
What is mysql password
i was trying to import a large database (only 6.26MB) into phpmyadmin using cmd. After writing the syntax of importing the database, i've been asked to enter the password. My phpmyadmin or mysql has no password from what i know.Screenshot of the syntax attached
Can you help me to tell me which password i'm asked to enter ?
Search value "in_array"
I have this array
Array
(
[result] => Array
(
[status] => nok
[reason] => Character not found.
)
[code] => 404
[content_type] => application/json;charset=utf-8
)
I want to check the [status], if it is "nok" it should appear "Match found".
My code:
$info = $r['result']['status'];
if (in_array("nok", $info))
{
echo "Match found";
}
else
{
echo "Match not found";
}
?>
preg_replace_callback(): Requires argument 2 to be a valid callback in
$ent_check = empty($modSettings['disableEntityCheck']) ? array('preg_replace_callback('~(&#(d{1,7}|x[0-9a-fA-F]{1,6});)~e', '$func[\'entity_fix\'](\'\2\')', ', ')') : array('', '');
Warning: preg_replace_callback(): Requires argument 2, '$func['entity_fix']('2')', to be a valid callback in
I'm not quite sure what to do here. Any help from someone smarter than I would be greatly appreciated...
Cannot access outside of domian folder using __DIR__
while I was using __DIR__ . '/../folder/outside_of_domain_folder/file.inc.php
to access a file outside of my domain folder, an error was returned (no such file or directory)
but the file does exist. But when I used it access a include file within my domain folder, __DIR__
works again. Any reasons why this happened? Or did I made some mistake in my code?
Check whether an array exists in an array of arrays?
I'm using JavaScript, and would like to check whether an array exists in an array of arrays.
Here is my code, along with the return values:
var myArr = [1,3];
var prizes = [[1,3],[1,4]];
prizes.indexOf(myArr);
-1
Why?
It's the same in jQuery:
$.inArray(myArr, prizes);
-1
Why is this returning -1 when the element is present in the array?
Primality test using Fermat little theorm
code:
void prime()
{
int i,N;
scanf("%d",&N);
for(i=2;i<N;i++)
{
if (((i^(N-1))%N )==1);
else{
printf("not prime");
return;
}
}
printf("prime");
return;
}
This program is based on Fermat's Theorem on prime numbers. N is number to be tested as prime. This program is not showing correct result for '11'. Maybe due to some mistake which is not identified by me.
Spaces inserted by the C preprocessor
Suppose we are given this input C code:
#define Y 20
#define A(x) (10+x+Y)
A(A(40))
gcc -E
outputs like that (10+(10+40 +20)+20)
.
gcc -E -traditional-cpp
outputs like that (10+(10+40+20)+20)
.
Why the default cpp inserts the space after 40
?
Where can I find the most detailed specification of the cpp that covers that logic ?
Undefined index: email in C:xampphtdocsweb-exploit-examples-masterevil-orgevil01.php on line 2 [duplicate]
This question already has an answer here:
$email = $_GET["email"];
$password = $_GET["password"];
if ($password) {
$db = mysqli_connect("localhost:3306","root","","");
$query = "INSERT INTO stolen_accounts (`email`, `password`)
VALUES ('{$email}', '{$password}')";
mysqli_query($db, $query);
}
Fetching status code description with jquery
I'm attempting to fetch status code description I send from asp.net mvc app via jquery and ajax, but can't seem to find where it's hidden.
This is backend:
return new HttpStatusCodeResult(403, "someDescription");
and this is jquery:
$.ajax({
url: someUrl,
method: "POST",
data: "teamMemberId=" + id,
statusCode: {
404: function (obj, textStatus, errorThrown) {
cancel();
},
403: function (obj, textStatus, errorThrown) {
alert(
//statusCodeDescription
);
},
200: cancel
}
});
Thanks!
mercredi 24 août 2016
Javascript - removing undefined fields from an object
Is there a clean way to remove undefined fields from an object?
i.e.
> var obj = { a: 1, b: undefined, c: 3 }
> removeUndefined(obj)
{ a: 1, c: 3 }
I came across two solutions:
_.each(query, function removeUndefined(value, key) {
if (_.isUndefined(value)) {
delete query[key];
}
});
or:
_.omit(obj, _.filter(_.keys(obj), function(key) { return _.isUndefined(obj[key]) }))
Where is the Trash directory?
The trash spec tells me that the Trash directory is here: $XDG_DATA_HOME/Trash
Looking at my environment variables on my Linux Mint system, I find a bunch of XDG stuff, but no XDG_DATA_HOME
I've done some looking, but so far I have not been able to locate the Trash directory. Where is it?
How to change the default action of the index controller zend
I have just created a new Zend project. I want to use the setDefaultAction
to change the default action of the Index controller to any other action of the Index controller. I know that I need to code something like :
$front = Zend_Controller_Front::getInstance();
$front->setDefaultAction("about");
but in what function I need to code this? Do I need to do something else?
JavaScript: requestAnimateFrame get faster
I have an animation with requesetAnimationFrame And when I replay it, it gets faster and faster until it gets invisible.
function tirer(){
var missile=document.getElementById("missile");
var currt= missile.currentStyle ||window.getComputedStyle(missile);
if ( parseInt(currt.bottom)<700)
missile.style.bottom=parseInt(missile.style.bottom)+20+"px";
else
alert ( "in top");
}
function animation (){
tirer();
requestAnimationFrame(animation);
}
How can I get it to be a stable, constant speed?