can i pass a hash as a function parameter. ive seen it been used
before but i can't figure out how to do it.
i would like to call a function like this for example
doSomething({va riable1:"blabla ",variable2:"bl abla"});
how would function doSomething be written for this to work.
I would also like the hash to be optional and the variables in the
hash to be optional.
meaning i should also be able to call doSomething(); with no variables
in it. 3 3375
On Aug 13, 5:09 pm, giloosh <giloos...@gmai l.comwrote:
can i pass a hash as a function parameter. ive seen it been used
before but i can't figure out how to do it.
i would like to call a function like this for example
doSomething({va riable1:"blabla ",variable2:"bl abla"});
how would function doSomething be written for this to work.
I would also like the hash to be optional and the variables in the
hash to be optional.
meaning i should also be able to call doSomething(); with no variables
in it.
If by "hash" you mean "object literal" and not "a reproducible method
of turning some kind of data into a (relatively) small number that may
serve as a digital "fingerprin t" of the data", then your function just
treats its first argument as an object. What's your question,
exactly? Could you provide more parameters as to what you're trying
to accomplish here?
giloosh said:
> can i pass a hash as a function parameter. ive seen it been used before but i can't figure out how to do it.
i would like to call a function like this for example
doSomething({v ariable1:"blabl a",variable2:"b labla"});
how would function doSomething be written for this to work.
I would also like the hash to be optional and the variables in the hash to be optional. meaning i should also be able to call doSomething(); with no variables in it.
Judging by the fact that you have an example of the calling
syntax but don't know what to do with it, and that you also
don't know how to use the SHIFT key, I'm betting that you're
a particularly slow student and that this is a class assignment.
--
ok forget the word "hash" i dont know why i called it that. for some
reason i thought you call something like this a hash:
{name:"mike",ag e:"12",gender:" male"}
it's stores data like an array, with key names and values. name would
be the key name and "mike" would be the value.
what do you call it? JSON? i just thought JSON was a pretty new term,
and there was a name for it before JSON.
what ever its called... how would i pass something like that as a
function parameter.
how would the function have to be written?
On Aug 13, 9:22 pm, Lee <REM0VElbspamt. ..@cox.netwrote :
giloosh said:
can i pass a hash as a function parameter. ive seen it been used
before but i can't figure out how to do it.
i would like to call a function like this for example
doSomething({va riable1:"blabla ",variable2:"bl abla"});
how would function doSomething be written for this to work.
I would also like the hash to be optional and the variables in the
hash to be optional.
meaning i should also be able to call doSomething(); with no variables
in it.
Judging by the fact that you have an example of the calling
syntax but don't know what to do with it, and that you also
don't know how to use the SHIFT key, I'm betting that you're
a particularly slow student and that this is a class assignment.
--
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: pembed2003 |
last post by:
Hi All,
Does C++/STL have hashtable where I can do stuff like:
Hashtable h<int>;
h.store("one",1);
h.store("two",2);
and then later retrieve them like:
|
by: Yarik |
last post by:
Hello there!
I am working with MS SQL Server 2000.
I have a table function that takes an integer parameter and returns a
table, and I can successfully use it like this (passing a literal
as a parameter):
SELECT * FROM MyTableFunction(1)
|
by: T.S.Negi |
last post by:
Dear Techies,
I making one stored procedure, which does some operation based on an
interface hash (#) table ---- name #mydata.
This stored has two section of code (seperated by parameter value 0
and 1)
But hash table #mydata (same name) number/name of columns changes as
per call 0 or 1.
|
by: Zlatko Matić |
last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL
Server) and that we want to execute some parameterized query as a
pass.through query. How can we pass parameters to the server ?
Is it possible to use parameters in pass-through queries ?
An additional question: Is it possible to connect to a database on MySQL or
PostgreSQL using ADO ?
Is it possible to execute pass-through queries with parameters, using ADO...
|
by: deko |
last post by:
This is a basic program flow question.
I'm trying to refractor an AC2000 app and split sections of code into
separate modules. But there are a number of collections I create in one big
module - containing file paths, Excel worksheet names, etc - I'm not sure
how to pass these around, or if I'd be better off saving things to a table
and using a recordset. My guess is a recordset would be slower.
For example, should I do something like...
| |
by: Zlatko Matić |
last post by:
Hi everybody!
Recently I was struggling with client/server issues in MS Access/PostgreSQL
combination.
Although Access is intuitive and easy to use desktop database solution, many
problems appear when someone is trying to use it as front-end for real
server database systems such as PostgreSQL or MySQL.
One of these problems is regarding pass-through queries and parameters.
I wanted to have all the code on client, while executing it on...
|
by: Alan Silver |
last post by:
Hello,
I'm a bit surprised at the amount of boilerplate code required to do
standard data access in .NET and was looking for a way to improve
matters. In Classic ASP, I used to have a common function that was
included in all pages that took an SQL query and returned a disconnected
recordset. This meant that data access could be achieved in a single
line. I would like to do something similar in ASP.NET.
I know I could just duplicate...
|
by: _Mario.lat |
last post by:
Hallo,
I have a little question:
In the function session_set_save_handler I can pass the name of function
which deal with session.
In Xoops code I see the use of this function like that:
session_set_save_handler(array(&$sess_handler, 'open'),
array(&$sess_handler, 'close'), array(&$sess_handler, 'read'),
array(&$sess_handler, 'write'), array(&$sess_handler, 'destroy'),
array(&$sess_handler, 'gc'));
|
by: TheCite |
last post by:
I am trying to make a function to hash passwords with. Here is the
code:
Option Compare Database
Option Explicit
'function declarations
Private Declare Function CryptAcquireContext Lib "advapi32.dll" Alias
"CryptAcquireContextA" (ByRef phProv As Long, ByVal pszContainer As
Any, ByVal pszProvider As Any, ByVal dwProvType As Long, ByVal dwFlags
As Long) As Long
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |