text
stringlengths 20
1.01M
| url
stringlengths 14
1.25k
| dump
stringlengths 9
15
⌀ | lang
stringclasses 4
values | source
stringclasses 4
values |
---|---|---|---|---|
Estimating Quantiles
You can use the Summary Statistics routines to compute quantiles for a matrix of observations. The computation routine can calculate more than one quantile at a time. Quantile orders belonging to the interval (0,1) are packed and passed into the library as an array. You should allocate enough memory to hold results of the calculations. The size of the array should provide storage for at least d*p elements, where
p is the dimension of the task.
d is the number of the requested quantiles.
Quantiles in the array are packed component by component, starting from the first component of the random vector and following the quantile orders.
See the Mathematical Notation and Definitions chapter in the Summary Statistics section of [MKLMan] for additional information.
The example below illustrates quantile-related calculations:
#include "mkl_vsl.h" #include <stdio.h> #define DIM 3 /* dimension of the task */ #define N 1000 /* number of observations */ #define M 100 /* number of quantiles to compute */ int main() { int i, status; VSLSSTaskPtr task; float x[DIM][N]; /* matrix of observations */ float order_stats[N]; /* matrix to store order statistics */ float q_order[M], quants[M]; MKL_INT q_order_n; MKL_INT p, n, xstorage, ostatstorage; unsigned long long estimates; int indices[DIM]={1,0,0}; /* the first vector component is processed */ /* Parameters of the task and initialization */ p = DIM; n = N; q_order_n = M; xstorage = VSL_SS_MATRIX_STORAGE_ROWS; ostatstorage = VSL_SS_MATRIX_STORAGE_ROWS; /* Calculate percentiles */ for ( i = 0; i < M; i++ ) q_order[i] = (float)i / (float)M; /* Create a task */ status = vslsSSNewTask( &task, &p, &n, &xstorage, (float*)x, 0, indices ); /* Initialize the task parameters */ status = vslsSSEditQuantiles( task, &q_order_n, q_order, quants, order_stats, &ostatstorage ); /* Compute the percentiles and order statistics */ estimates = VSL_SS_QUANTS|VSL_SS_ORDER_STATS; status = vslsSSCompute( task, estimates, VSL_SS_METHOD_FAST ); /* Deallocate the task resources */ status = vslSSDeleteTask( &task ); return 0; } | https://software.intel.com/es-es/node/497935 | CC-MAIN-2015-32 | en | refinedweb |
: June 1, 2014).
This month sees new PowerShell documentation for Azure RMS custom templates. In addition to creating and managing custom templates in the Azure Management Portal, you can now do this from the command line, by using the latest version of the Azure RMS Windows PowerShell module (version 2.0.0.0). For installation instructions and the download link, see Installing Windows PowerShell for Azure Rights Management. The new version of the module ships with updated local help, and now also supports the online parameter so that you can easily get to the online version to check for the latest information.
For example, instead of typing "Get-Help Connect-AadrmService" to read the local help that ships with the module, type "Get-Help Connect-AadrmService -online" to automatically load your web browser and display the online version of the help. Unlike the local help, the online version supports web formatting, so it's much easier to read. It's often more up-to-date, and will automatically show localized versions for the standard 10 languages that TechNet and MSDN supports (Chinese-Simplified, Chinese-Traditional, French, German, Italian, Japanese, Korean, Portuguese-Brazilian, Russian, Spanish).
The new cmdlets to support custom templates are:
If you are interested in custom templates and missed the blog post announcement, you can read it here: Create custom templates in Azure RMS with the Azure Management Portal. To see what customers are asking about this new feature when they try it out, see Top 10 customer questions about Azure RMS custom templates. only significant documentation changes since the last update (May 2014) is to clarify that the RMS sharing application requires the Microsoft .NET Framework, version 4.0 as a minimum. This information is added to the Rights Management sharing application administration guide and the Rights Management sharing application user guide.
The following information lists the topics that contain significant changes since the last update (May 2014).
Requirements for Azure Rights Management
- Updated for the following:
Frequently Asked Questions for Azure Rights Management
- Updated for new entry "What do I do if my question isn't here?" for links to additional resources.
Planning and Implementing Your Azure Rights Management Tenant Key
- Minor update to note that to generate and transfer your tenant key over the Internet, you should be using version 2.0.0.0 of the Azure RMS Windows PowerShell module.
Activating Azure Rights Management
- Updated for a new section, "Rights Management status values and descriptions", which describes the various status values that you might see in the Azure Management Portal (Active, Inactive, Unavailable, and Unauthorized).
Configuring Custom Templates for Azure Rights Management
- Updated to clarify that the default templates cannot be deleted, only archived. And also updated with the best practice of copying and then editing a default template if you want a custom template to apply to all users. This technique is more efficient than creating a custom template from scratch and specifying multiple or large groups. There's also a new section, Windows PowerShell reference, for information and links to the cmdlets listed in the introduction of this post.
Deploying the Azure Rights Management Connector
- Updated the minimum supported version for Exchange Server 2010 from Service Pack 3 Rollup Update 2 to Service Pack 3 Rollup Update 6. Changing the minimal rollup update was necessary after customer reports that under some circumstances (including a failed Internet connection), an Exchange server would fail to get the RMS tenant configuration and fall back to defaults for key length values and other settings. If you ran Test-IRMConfiguration -Sender [email protected], you would see the failure message "Failed to acquire a Rights Account Certificate (RAC) and/or a Client Licensor Certificate (CLC)." Updating the Exchange server to Service Pack 3 Rollup Update 6 resolves the problem.
Administering Azure Rights Management by Using Windows PowerShell
- Updated the table to include the tasks related to creating and managing custom templates.
Add-AadrmKey
- Updated to correct the -KeyFile parameter, which the syntax previously reported to be optional rather than required. This correction is also in the updated module.
Get-AadrmConfiguration
- Updated the example output for a more typical response. | http://blogs.technet.com/b/rms/archive/2014/06/30/announcement-azure-rms-documentation-library-update-for-june-2014.aspx | CC-MAIN-2015-32 | en | refinedweb |
#include <hallo.h> Till Tippel wrote on Sat Jun 01, 2002 um 09:22:49 think, in the current situation it would be best to create a small repository with modified boot-floppies, needed to support particular software/hardware. Someone may cry "just as SuSE does". Well, it's better than force every user to patch and replace the kernel, causing lots of other trouble. I suggest: - SCSI optimised (i2o scsi drivers, more SCSI drivers built-in) - IDE optimised (patched to support >>160GB disks, HPT-372 controlers, etc.) - XFS filesystem (this does actually work, p.d.o/~blade/XFS-Install) - EVMS enabled (EMVS with LVM/md in the kernel, evms curses gui on the rescue disk) | https://lists.debian.org/debian-devel/2002/06/msg00008.html | CC-MAIN-2015-32 | en | refinedweb |
Intel To Make A Greener Microprocessor 229 229... (Score:5, Funny)
Haha, just kidding, I own an AMD.
In other news (Score:2)
Reduced lead? (Score:5, Insightful)
Next step: reduce power consumption.
Re:Reduced lead? (Score:5, Insightful)
This is definitely a necessity as the major ecological impact of modern consumer and IT products occurs during the utilization phase and not during the production or disposal phase.
Re:Reduced lead? (Score:2, Interesting)
Semicondoctor fabs have a truly collosal ecological footprint, good thing what they make is worth more than gold. They consume tremendous amounts of water, and energy, to say nothing of the photoresists, acid baths and slag from the parts of the ores that aren't used. There are no doubt a log of computers, but you want to make an impact invent a lightbulb that costs the same or less, can be adapted to all the same fixtures, lasts longer, uses half as mu
obfuscation nazi (Score:2)
Banias and Dothan (Score:5, Insightful) (Score:5, Insightful):Banias and Dothan (Score:2, Insightful)
"Right now, speeds are fast enough..."
"640Kb ought to be enough for everyone..."
Re:Banias and Dothan (Score:2)
"Right now, speeds are fast enough..."
Note the use of the qualifying term. He's not indicating that nobody will ever need a faster processor, but that for most everyday uses computers are fast enough, and he has a point. Sure, there are some folks out there for whom instantaneous won't be fast enough, but as it is until the next must-have push the envelope app is unleashed on the masses, current computer speeds are good enough f
Re:Reduced lead? (Score:2)
Re:Reduced lead? (Score:2, Insightful)
Indeed, just read the "unintended consequences" article:
A typical computer processor and monitor contain five to eight pounds of lead, and other heavy metals such as cadmium, mercury and arsenic.
Five to eight pounds; that's quite a lot of CPU's! And they aren't even made entirely out of lead.
Re:Reduced lead? (Score:2, Funny)
Re:Reduced lead? (Score:3)
from m [intel.com]
Good job (Score:2, Funny)
question (Score:5, Interesting)
Re:question (Score:5, Informative) (Score:5, Informative)
Actually, intel is moving away from measuring chip speed by GHZ. Wired just had this article [wired.com] about it.
Basically, Intel is a couple years behind AMD who is now using numbers like 2300+ to describe chip speed.
Re:question (Score:5, Interesting)
Re:question (Score:4, Informative) (Score:3, Interesting)
Apple got it right by using Benchmarks to sell their product, even if the benchmarks are strange and deceptive. Hey, lying, cheating, and stealing are what got Microsoft to the top, everyone's gotta play a little dirty.
And yes, buying a PC should be an
Re:question (Score:3, Informative)
Some smart advertiser found if they take all the channels of a 2 or 4 channel amplifier, ignore low distortion (square wave clipped output is ok) list the power del
Re:question (Score:2)
Re:question (Score:4, Insightful)
And therein lies the major problem with GHz-based speed comparisons. As long as you're dealing with the same core (which is not the same as processor name i.e. "Pentium 4",) the speed will scale rather linearily with core speed (ignoring bus speeds etc.)
But you simply can't compare an N-GHz processor with core X to an N-GHz processor with core Y. The problem is, there really is no objective measurement system, as of yet, anyway.
Re:question (Score:2)
Re:question (Score:5, Insightful) (Score:3, Insightful)
Anyways, if Intel can get away from clock-speed ratings, I hope it can get away from 100 watt processors. Where are the quiet and efficient Pentium M desktop systems? Some companies [radisys.com] are designing motherboards for them, but ther
Re:question (Score:3, Interesting)
Look at a typical HP or Dell (or even e-Machines) people buy these days. My cousin's HP Pavilion has a DVD+/-R, CD-RW, 80 GB disk, fast P4 etc -- yet is a very quiet and small machine. There's a shroud over the CPU leading to a case fan (there is also a separate CPU and PSU fan; some Gateways from a couple
Re:question (Score:2)
It is similar to the muscle car days of the 1960's and 70's - everyone was wanting more power, more speed. They got what they wanted, but there was a sacrifice of handling, fuel consumption, etc. Then we saw a shift in the 80's and 90's to the econoboxes. Now for many consumers, the look at
Re:question (Score:2)
Re:question (Score:2) seconda
Re:question (Score:4, Interesting)
Re:question (Score:3, Informative)
So... (Score:4, Funny)
Re:So... (True Story) (Score:2)
There not doing it out of the kindness of... (Score:3, Insightful)
Re:There not doing it out of the kindness of... (Score:2) cos
Re:There not doing it out of the kindness of... (Score:2)
Green friendly? (Score:3, Insightful)
Re:Green friendly? (Score:5, Insightful)? (Score:2, Funny)
I am confused: I thought StrongARM was an Intel processor [intel.com]
Re:Green friendly? (Score:4, Insightful)? (Score:2))
Re:Green friendly? (Score:5, Interesting)? (Score:2)
Re:Green friendly? (Score:2)
In addition, I am surprised at the lack of implementation of more speed-step like features. I leave my PC on all the time. even when im using it, im usually surfing the we
Green friendly? Yeah, right... (Score:3, Insightful)
AMD has the faster high-end processors, too. I just ordered a high-end workstation for modeling and simulation at work. I chose a 64-bit AMD CPU both for the speed it gives now as well as for the future grow
RTFA (Score:2)
Can't dispose of computer parts? (Score:2, Funny)
What are we supposed to do with our old computers, a beowulf cluster?
Reducing waste (Score:4, Insightful)
Re:Reducing waste (Score:2)
I see three problems with this. The more obvious is that the market doesn't want this; otherwise people would buy higher-quality products (at an appropriate and higher price). But many people (possibly most) buy cheaper equipment,
Re:Reducing waste (Score:2)
Markets, markets.... (Score:2)
Re:Reducing waste (Score:2)
First 6 months they have to proove the failure wasn't in the device at the transaction time, next 18 months you can proove it.
Anybody know how this is done? (Score:4, Insightful)? (Score:2, Funny)
Maybe some alloy with cadmium could replace it
Re:Anybody know how this is done? (Score:3, Informative)
All major solder manufacturers allready have lead free products in place, check out thier websites for exact formulations.
BTW, a lot of chip manufacturers have allready done thier lead free packaging. Intels move is late in the day, which is ironic because they are making hi end high cost chips were gold is often used for bonding and plating rather than the solder used to tin the pins of lowwer c
Re:Anybody know how this is done? (Score:2)
But the article mixes two separate issues, thus the answer is a bit longer:
If you look at a BGA package on an PCB, then there are two interconnects: first the silicon die is connected to an intermediate substrate, the interposer. The result is the BGA.
Then the BGA is connected to the board.
For the second level interconnect (interposer to board) eutectic or near-eutectic lead-tin solder is used right now- around 37% lead, melts at 187 deg C.
SnAgCu (~95% tin, ~3.5% silver, ~0.5% copper) is
hype (Score:5, Insightful)
Re:hype (Score:2)
I wouldn't say it is even
CPU's in desktops often get pulled and used in other systems. Pulling a CPU out of socket requires no burning or chemical reaction, hence nothing is released in the enviroment.
As most if not all Desktop
Re:hype (Score:2)
I'm not so sure that this is true these days. I have no sources here, but I believe the majority of solder used in consumer electronics (including PCs) is of the lead-free variety (mostly silver and nickel, I believe).
I do know that some cheaper consumer electronic devices have warnings in the manual about proper disposal because "this product contains lead...", but most things
Re:hype (Score:2)
This might take the place [fujitsu.com] of lead solder, rather than silver, as it can use similar temperatures as lead solder.
Lead free soldering represents a minority in manufacturing, with companies now only starting to switch over with pressure from Japan and eventually the EU.
Re:hype (Score:2)
I'm not sure why I was under the impression that companies had started doing this a while ago, but I guess it's good that something is being done now anyway. I don't really know what kind of dangers lead poses, though even if minor, and if it's not *that* difficult to start using something else, it probably should be phased out...
Alternative heating. (Score:2, Funny)
How much lead is present in a microprocessor? (Score:5, Insightful)? (Score:4, Informative)
A flip-chip package currently contains 0.4 grams of lead. A tiny amount compared to that in the solder in a motherboard, let alone a monitor.
Re:How much lead is present in a microprocessor? (Score:3, Interesting)
where's the 8 lbs of lead?? (Score:5, Insightful)?? (Score:5, Informative)
Seriously, look at the bigger monitor tubes (especially in the EU); they have a radio-dosage sticker certifying the level of beta radiation emitted, usually at the preset acceleration voltage.
Jon.
Re:where's the 8 lbs of lead?? (Score:5, Informative)
The amount of lead in a base unit is limited to solder and tiny amounts within the ICs.
What a Load of Twaddle (Score:5, Insightful).
Watch out for unwanted side-effects (Score:3, Insightful).
Lead is the least of our worries (Score:5, Interesting).
Re:Lead is the least of our worries (Score:2)
The secret life of your computer [calpoly.edu] illustrates what went in to make a computer.
Don't forget, this can be said for a lot of other things as well, like consumer electronics.
Trash and waste abounds at both ends of the equation.
It's just PR (Score:5, Interesting) (Score:2, Informative)
The main problem relates to the higher temperatures needed to melt lead free solder. These higher temperatures can stress components and are particuarly worrying in products that have to last 20 years.
Re:It's just PR (Score:2)
But this isn't anything unique to Intel, and it isn't done out of the goodness of their green little hearts.
I agree with you for the most part. However, lead-free solder isn't much more difficult to work with (at least as an elecronics hobbiest). I think the concern is more the cost of the solder, given that (I believe) it usually contains a lot of silver. Maybe it's harder to manufacture (or manufacture with), or perhaps there are other mechani
Pb Free - Not just Intel (Score:4, Informative) (Score:2, Funny)!
No deposit No return (Score:2)
If manufacturers actually took into account the cost of disposa
Re:No deposit No return (Score:2)
FWIW, I'd suggest you consider keeping your old gear. You may surprise yourself and discover a need you didn't think you had. Even in a home environment, extra gear could easily be used for a test sytem (new program installations, alternative distributions, major upgrades, etc.), or alternatively be put to use as a file server, backup storage, multi-boot replacement, a
Re:No deposit No return (Score:2)
I have a file server, I have a nat firewall, I have web server, I have my pc, that other pc, and some other PC ov
Eutectic alloys vs pure tin (Score:5, Interesting).
If it gets any greener... (Score:2, Funny)
Maybe someone will finally answer my question... (Score:2, Funny)
--------
WAP hosting [chiralsoftware.net]
Re:Maybe someone will finally answer my question.. (Score:3, Funny)
Problems with gold (Score:2, Interesting)
The problem with the pure gold was it was contaminated with about 0.9% of mix of platinum and iridium so it was much harder then normal soft pure gold. It
'burn' (Score:2) (Score:5, Interesting)
-David
Is lead worse than other heavy metals? (Score:2, Interesting)
The other popular alternative to silicon is Gallium Arsenide. Gosh, arsenic, another heavy metal with a place in the history of poisonings.
Lead, mercury, and arsenic are famous just because they're common on the earth and have been known since ancient times. All heavy metals accumulate int he body and cause problems, and I'm not sure that exoti
Sounds good (Score:2)
Intel following AMD again? (Score:5, Informative)
This is a good thing. (Score:2)
But now it won't get into OUR drinking water, and the lead in the water of the enemy means their babies will talk and walk slower, making them easier military targets when they grow up. This could be a nice long term strategy in our war on terrorism, and helps keep our streams and lakes lead free, too.
I fail to see the down side for us.
Soft error rate - alpha radiation (Score:2)
It already IS an industry trend, Intel following (Score:3, Insightful)
It's about time a company started this - good job - and let's hope other tech companies take the hint.
Hello, wake up call. This is a major industry trend. Intel is following along. They're definately not the ones starting this, in hopes the rest of the industry will catch on. It is a European Union Directive that deserves the "good job" credit... and it is Intel and every other major manufacturer in the electronics industry that is "taking the hint".
Most new electronic components are being made with little or no lead. Major companies and contract manufacturers (who solder boards for most smaller companies) are switching to lead-free soldering processes.
Already this forum is filled with +5 comments about power consumption and how the solder contains much more lead than the chips. Well, here's the news... the whole industry is migrating to lead-free solder.
Much of the conversion is driven by an EU directive that all electronic products sold in Europe be lead-free by 2008.
Here's an EE Times Article [eetimes.com] about the trend, and a possibility that the deadline may be moved up to 2006.
I am an electrical engineer, and even at the US-based company where I used to work, they're having to go through the painful process of switching the wave solder and reflow ovens (surface mount soldering) to lead-free fluxes and solder alloys.
So give credit where credit is due. It's the European Union, not Intel, that deserves "good job". The whole industry is taking the hint, as selling or being able to sell in the EU is important to almost everybody.
Re:Greener Chips? (Score:2, Interesting)
Re:Greener Chips? (Score:2)
Re:Greener Chips? (Score:2, Informative)
Re:Greener Chips? (Score:5, Insightful)
intel is meeting its upcoming legal requirements. the real win here (for intel), is turning something they are legally obligated to do into an "environmentally friendly" pr victory. the news media seems to be eating it up.
Re:Greener Chips? (Score:2) | http://hardware.slashdot.org/story/04/04/08/0619220/intel-to-make-a-greener-microprocessor?sdsrc=nextbtmnext | CC-MAIN-2015-32 | en | refinedweb |
Good news readers! I have been awarded with Microsoft Community Contributor [MCC] Award 2011 by Microsoft. Its truly said that credit should be given where its due.
Long live the community! :)
Last week, I needed to complete one task on which I am going to blog
about in this entry. The task is "Create a control panel like webpage to
control (Start/Stop) Window Services which are part of my solution
installed on computer where the main application is hosted". Here are the important points to accomplish:[1] You need to add System.ServiceProcess reference in your application. This namespace holds ServiceController Class to access the window service.[2] You need to check the status of the window services before you explicitly start or stop it.[3]
By default, IIS application runs under ASP.NET account which doesn't
have access rights permission to window service. So, Very Important part
of the solution is: Impersonation.
You need to impersonate the application/part of the code with the User
Credentials which is having proper rights and permission to access the
window service. If you try to access window service it will generate "access denied" error.The alternatives are: You can either impersonate whole application by adding Identity tag in web.cofig as: <identity impersonate="true" userName="" password=""/>This
tag will be under System.Web section. the "userName" and "password"
will be the credentials of the user which is having rights to access the
window service. But, this would not be a wise and good solution;
because you may not impersonate whole website like this just to have
access window service (which is going to be a small part of code).Second
alternative is: Only impersonate part of code where you need to access
the window service to start or stop it. I opted this one. But, to be
fair; I am really unaware of the code part for impersonation. So, I just
googled it and injected the code in my solution in a separate class
file named as "Impersonate" with required static methods. In Impersonate
class; impersonateValidUser() is the method to impersonate a part of
code and undoImpersonation() is the method to undo the impersonation.
Below is one example:
You
need to provide domain name (which is "." if you are working on your
home computer), username and password of appropriate user to
impersonate.[4] Here, it is very important to note that: You
need to have to store the Access Credentials (username and password)
which you are going to user for impersonation; to some secured and
encrypted format. I have used Machinekey Encryption to store the value
encrypted value inside database.[5] So now; The real part is to
start or stop a window service. You are almost done; because
ServiceController class has simple Start() and Stop() methods to start
or stop a window service. A ServiceController class has parametrized
constructor that takes name of the service as parameter.Code to Start the window service:
Code to Stop the window service:
Isn't that too easy! ServiceController made it easy :) I have attached a working example with this post here
to start/stop "SQLBrowser" service where you need to provide proper
credentials who have permission to access to window service.
hope it would helps./.
I found this something interesting while wandering over community
which I would like to share. The post is whole about: DBML is not
considering the table field's "Default value or Binding" setting which
is a NotNull. I mean the field which can not be null but having default
value set needs to be set IsDbGenerated = true in DBML file explicitly.Consider this situation: There is a simple tblEmployee table with below structure:
The
fields are simple. EmployeeID is a Primary Key with Identity
Specification = True with Identity Seed = 1 to autogenerate numeric
value for this field. EmployeeName and their EmailAddress to store in
rest of 2 fields. And the last one is "DateAdded" with DateTime datatype
which doesn't allow NULL but having Default Value/Binding with
"GetDate()". That means if we don't pass any value to this field then
SQL will insert current date in "DateAdded" field.So, I start
with a new website, add a DBML file and dropped the said table to
generate LINQ To SQL context class. Finally, I write a simple code
snippet to insert data into the tblEmployee table; BUT, I am not passing
any value to "DateAdded" field. Because I am considering SQL Server's
"Default Value or Binding (GetDate())" setting to this field and
understand that SQL will insert current date to this field. using (TestDatabaseDataContext context = new TestDatabaseDataContext()) { tblEmployee tblEmpObjet = new tblEmployee(); tblEmpObjet.EmployeeName = "KaushaL"; tblEmpObjet.EmployeeEmailAddress = "[email protected]"; context.tblEmployees.InsertOnSubmit(tblEmpObjet); context.SubmitChanges(); }Here comes the twist when application give me below error:
This
is something not expecting! From the error it clearly depicts that LINQ
is passing NULL value to "DateAdded" Field while according to my
understanding it should respect Sql Server's "Default value or Binding"
setting for this field. A bit googling and I found very interesting
related to this problem.When we set Primary Key to any field
with "Identity Specification" Property set to true; DBML set one
important property "IsDbGenerated=true" for this field.
BUT,
when we set "Default Value or Biding" property for some field; we need
to explicitly tell the DBML/LINQ to let it know that this field is
having default binding at DB side that needs to be respected if I don't
pass any value. So, the solution is: You need to explicitly set
"IsDbGenerated=true" for such field to tell the LINQ that the field is
having default value or binding at Sql Server side so, please don't
worry if i don't pass any value for it.You can select the field
and set this property from property window in DBML Designer file or
write the property in DBML.Designer.cs file directly.
I have attached a working example with required table script with this post here. I hope this would be helpful for someone hunting for the same. Happy Discovery!
I./.
This is something that might be annoying or irritating for end user.
Obviously, It's impossible to prevent end user from closing the/any
browser. Just think of this if it becomes possible!!!. That will be a
horrible web world where everytime you will be attacked by sites and
they will not allow to close your browser until you confirm your
shopping cart and do the payment. LOL:) You need to open the task
manager and might have to kill the running browser exe processes.Anyways;
Jokes apart, but I have one situation where I need to alert/confirm
from the user in any anyway when they try to close the browser or change
the url. Think of this: You are creating a single page intranet
asp.net application where your employee can enter/select their
TDS/Investment Declarations and you wish to at-least ALERT/CONFIRM them
if they are attempting to:[1] Close the Browser[2] Close the Browser Tab[3] Attempt to go some other site by Changing the urlwithout completing/freezing their declaration.So,
Finally requirement is clear. I need to alert/confirm the user what he
is going to do on above bulleted events. I am going to use
window.onbeforeunload event to set the javascript confirm alert box to
appear. ?"; } </script>See!
you are halfway done!. So, every time browser unloads the page, above
confirm alert causes to appear on front of user like below:By
saying here "every time browser unloads the page"; I mean to say that
whenever page loads or postback happens the browser onbeforeunload event
will be executed. So, event a button submit or a link submit which
causes page to postback would tend to execute the browser onbeforeunload
event to fire!So, now the hurdle is how can we prevent the
alert "Not to show when page is being postback" via any button/link
submit? Answer is JQuery :)Idea is, you just need to set the
script reference src to jQuery library and Set the window.onbeforeunload
event to null when any input/link causes a page to postback.Below will be the complete code:<head runat="server"> <title></title> <script src="jquery.min.js" type="text/javascript"></script> ?"; } $(function() { $("a").click(function() { window.onbeforeunload = null; }); $("input").click(function() { window.onbeforeunload = null; }); }); </script></head><body> <form id="form1" runat="server"> <div></div> </form></body></html>So,
By this post I have tried to set the confirm alert if user try to close
the browser/tab or try leave the site by changing the url. I have
attached a working example with this post here. I hope someone might find it helpful.
EDIT [26-February-2011]:
I would like to edit this post here. I missed out to write that any
control event that may cause a postback needs to be checked and set
window.onbeforeunload = null; like I have set for Button Click or
Hyperlink Click.
For Example, IF you have a Select/DropDownList
control which is causing a postback then you need to set
window.onbeforeunload = null; on click of "select" as below:
$("select").click(function() { window.onbeforeunload = null; });
In this post; I am going little offbeat this time. We all use skype for professional contacts. We create categories to manage our contacts. We create chat groups/Conversation for a group discussion/chat. Whenever a new instant message come, skype gives instant popup notification at the bottom right corner near taskbar. This just like any other messanger.
Sometimes, you would not like to get unwanted notification popup for the discussion on which you are not interested on. Don't worry! You don't need to leave the conversation becase the group/friends are important for you. :) There is one setting related to this in skype where you can set some words in which you are interested on which you want skype to give notification popup if any instant message by any group member contains any of those words.
Below Image shows the setting popup message where you need to enter the preferred words followed by space
So, finally :) I will only get popup notification if any of my friends write message which contains any of above words in it. Enjoy your conversation!
At end, I also want to conclude that the similar setting is available for single contact conversation window also.
In this blog entry, I am making a small note of ?? Operator. I think many of you may already have idea on this. Sometimes, it happens with me that I come across some basic things which I think I should be aware of from my academic or fresher level. ?? is one of them :)So, The scene how I came across to find for ?? operator is: I was thinking of modifying a field of a table design which was not nullable and I needed to make it nullable with -1 as default value in Sql Server. But, then what should be done for previous records which already have NULL stored in them. First, I thought to manually run an update query to make NULL values to -1. But, I somehow don't like the idea to be comfortable via hurting the existing data in the table. So? I thought like we have ISNULL() and COALESC() functions in Sql Server to manage and replace with NULL values. I googled to find any equivalent in C#. And There it is !!!!?? Operator is called null-coalescing operator and its is used to define a default value for NULL result or Nullable types that you may arise in your code.Here is one simple example in above case:Int64? NullableFieldInfoFromDb = //--some value which can be nullif((NullableFieldInfoFromDb ?? -1) == -1) //--some code to follow see here! I dont have to bother for previous NULL vlues which are already there in the database for this field because IF the code came across the NULL value then ?? Operator will replace it with -1 value. This way I didnt have to check/test it for both NULL and -1 values in if(...) condition.Second is one interesting situation when I needed it. I need to implement one validation check that user should not be able to enter/input duplicate family members via UI provided to them. Here only option/way to put such type of validation check in my situation is: Check for all these fields: Suffix + FirstName + MiddleName + LastName; against the user input. But, here Suffix and MiddleName fields are Nullable fields which can create problem/exception if I directly use them to match in where condition in a LINQ Query.So, below is the RIGHT Query which helped me to validate duplicate family members:bool isFamilyMemberExists = (from x in context.FamilyRecords where (x.Suffix ?? string.Empty).Trim().ToLower().Equals(txtSuffixField.Text.Trim().ToLower()) && x.FirstName.ToLower().Equals(txtFirstNameField.Text.Trim().ToLower()) && (x.MiddleName ?? string.Empty).Trim().ToLower().Equals(txtMiddleNameField.Text.Trim().ToLower()) && x.LastName.ToLower().Equals(txtLastNameField.Text.Trim().ToLower()) && (x.Relationship ?? string.Empty).Trim().ToLower().Equals(cmbRelationCodeField.SelectedValue.ToLower()) select x.FamilyRecordID).Any();if (isFamilyMemberExists) //-- Raise Error "The Member is already exists.";What I did in above Query is use ?? Operator to replace NULL values with "" empty string so even NULL values in the data for suffix and Relationship field would not cause any exception.So :) now I am aware of NULL-Coalescing C# Operator equivalent to ISNULL() and COALESC() functionalities in Sql Server. I still hope that many things will come that will feel to me similarly - "I should have already known about this thing earlier!!". But, anyways I am happy to know someting late then to unaware totally.
Here is the MSDN link for NULL-Coalesc Operator: ?? Operator (C# Reference) And here is another link on a good use of this operator while working with LINQ to SQL: The C# ?? null coalescing operator (and using it with LINQ)
by ScottGu. I came across this nice example while googling for ??/such functionality.hope it helps./.
This.
While my development with LINQ I got around some helps, links, small
tips and tricks which makes life much easier, improves query formulation
capabilities and speedup the program execute performance. Here I am
sharing some of the tips I found as a LINQ Developer.
[1] Use the var Keyword When Confused
Use var keyword as return type especially when you are capturing
sequence of anonymous classes. For example, joining of 2 tables and
retrieving a sequence of records containing (some/few) fields of both
the tables. I appreciate the developers who understand and know exactly
what data type is contained in the sequence they are retrieving. But,
anyhow you get stuck and don’t know the sequence IEnumerable<T>
holds what data type T; then var is the good choice.
[2] Use the Cast or OfType Operators for Legacy Collections
You notice that LINQ standard operators and methods always been
called only on the type of collections/sequence which are implementing
IEnumerable <T> interface. Something trivial to know that none of
the legacy Collection types which are inside System.Collection namespace
implements IEnumerable <T> interface. Then how would you use LINQ
operators and methods against them? The answer is: Cast and OfType LINQ
operators.
//--Cast Example://--create a legacy collection of type ArrayList.ArrayList nameList = new ArrayList();nameList.Add("Kaushal");nameList.Add("Pooja");nameList.Add("Naman");IEnumerable<string> firstnames = nameList.Cast<string>().Where(n => n.Length > 5);foreach (string name in firstnames) Response.Write(name);//--OfType Example://--create a legacy collection of type ArrayList.ArrayList nameList = new ArrayList();nameList.Add("Kaushal");nameList.Add("Pooja");nameList.Add("Naman");IEnumerable<string> firstnames = nameList.OfType<string>().Where(n => n.Length > 5);foreach (string name in names) Response.Write(name);
Both will result in “Kaushal” here.
[3] Don’t Assume a Query Is Bug-Free
var names = from fullname in person where fullname.EndsWith("Parik") select fullname;foreach (var name in names) Console.WriteLine(name);
By looking at the above example; it appears that query execution is
occurring just when names variable of type var is initialized, but that
is not the case. The reason is LINQ queries are often “deferred” and not
executed when it appears to be executing when you are calling them.
Because “Select” and “Where” statements are deferred operators, above
query will not be executed until you enumerate it. The query is merely
being declared, or defined, but not performed in the very first
statement of above example. Query execution will happen when foreach
statement is executed. So, finally we can say that above query that we
have written is “deferred”! So, keep twice watch on your queries, they
might be culprit for slow performance or internal exception.
[4] Take Advantage of Deferred Query
Now as we are families that Deferred Queries don’t execute until you
enumerate them. Ultimately Deferred Query returns an
IEnumerable<T> can be enumerated over, time and time again,
obtaining the latest data from the data source. You don’t need to
actually call or, as we earlier pointed out, declare the query again.
[5] Use the DataContext Log
This is something similar with using “Sql Server Profiler” tool we
are using when working with our database to debug the query execution.
You can always use “SQL Server Profiler” to view the Sql query generated
by LINQ, but there is a DataContext.Log Property that you can assign to
a TextWriter to view the generated Sql query. Remember that your LINQ
DataContext class inherits from System.Data.Linq.DataContext, which
means LINQ DataContext class is already having some pre-defined in-built
functionality like this Log property.
using (NorthwindDataContext context = new NorthwindDataContext()){ context.Log = new DebuggerWriter(); Customer customer = context.Customers.Single<Customer> (c => c.CustomerID.Equals("KPN1"));}
[6 ] Always Consume DataContext Class object inside using(…) statement
The DataContext dbml class implements IDisposable interface; so, its
always good practice to declare and use the DataContext class inside
using(…) scope sothat object will be disposed immediately after the
defined scope. This is something looks a minor thing but later on in a
heavy database operation related application you may end up with
“Maximum Connection Pooling reached” error if DataContext objects don’t
disposed correctly.
using (NWindDataContext context = new NWindDataContext()){ var fullnames = from names in context.Persons where names.FirstName.ToLower().EndsWith("parik") select names; //--further code}
[7] Use the LINQ Forum
Got stuck somewhere? Don’t forget that is a community forum dedicated
to LINQ at MSDN com (). This community forum is
monitored by Microsoft developers, and you will find a wealth of
knowledgeable resources and threads there.
[8 ] Use tool like LinqPad
The success behind a LINQ application that you develop lies behind
the performance of the query that you formulate. You can use any third
party tool like I prefer to use LINQPad (by Joseph Albahari) while my development with LINQ.
Actually, quick since a long time after I got to know about this tool
and I was impressed so much that I thought to why not I get aware
something about such nice and intelligent tool before. Life would have
become easier!
This is one of my posts based on LINQ subject on which I gratefully able to work a lot since last one and half year and I am hoping for myself to have some of good posts on EF & LINQ. In this post, I am going a bit theoretical here.As the name implies, LINQ is all about querying for the data and retrieving the resultant sequence of the same. Queries which return set of matching objects or subset of fields of matching an object or set of objects. The result or the return set of object by the LINQ is called “sequence”. This “sequence” generally be of type IEnumerable <T> where T is the data type of the object stored in the sequence. For example, if you have a sequence of integers, they would be stored in a variable of type IEnumerable<int>.
LINQ to ObjectsLINQ to Objects is the API dedicated to working with querying objects, arrays and in-memory data collections. Example is, querying a string Array.Example:string[] greetings = {"Hi Kaushal Parik", "Hi Pooja Parik", "Hi Naman Parik"};var items = from s in greetings where s.StartsWith("Naman") select s;foreach (var item in items) Console.WriteLine(item);Result will be: Hi Naman Parik
LINQ to DatasetLINQ to Dataset is the name given to the LINQ API for Datasets. LINQ to Dataset is the faster and easier way to query cached data in Datasets. This is specifically useful when we need to query on consolidated data from one of more data sources. LINQ to Dataset doesn’t mean to replace ADP.NET 2.0 but its build/extended upon ADO.NET 2.0 architecture. So, existing ADO.NET 2.0 code will continue to run functionally correct in a LINQ to Dataset application.Example:DataSet ds = new DataSet();var employees = from e in ds.Tables[0].AsEnumerable() select new { eid = e.Field<string>("EmployeeID"), ename = e.Field<string>("FullName"), esalary = e.Field<string>("Salary") };LINQ to SQLLINQ to SQL is the name given to the IQueryable<T> API that allows LINQ queries to work with Microsoft’s SQL Server database. This requires you to have reference of the System.Data.Linq dll assembly in your project.Example:var customers = from c in dbContext.Customers where c.City.Equals("Ahmedabad") select c;foreach (var cust in custs) Console.WriteLine("{0}", cust.CompanyName);LINQ to XMLLINQ to XML is the name given to the LINQ API dedicated to working with XML. This requires you to have reference of the System.Xml.Linq dll assembly in your projectExample:using System;using System.Linq;using System.Xml.Linq;XElement customers = XElement.Parse( @"<customers> <customer> <id>1</id> <name>kaushal parik</name> </customer> <customer> <id>2</id> <name>Pooja parik</name> </customer> <customer> <id>3</id> <name>Naman parik</name> </customer> </customers>");var names = from cust in customers.Elements("customer") where (string) book.Element("author") == "Joe Rattz" select cust.Element("name");foreach(var name in names) Console.WriteLine(name.Value);LINQ to EntitiesLINQ to Entities is the name given to the LINQ API that is used to interface with a database. LINQ to Entities separates physical database and the entity object model by injecting logical mapping in between them which simply results in greater flexibility.
hope this helps./.
more to come on EF & Linq.
Somasegar has announced on his blog entry that Visual Studio 2010 Service Pack 1 Beta is available and now ready for download! MVP Groups and MSDN subscribers can download the beta immediately with general availability on December 9,2010. It is even exciting to know that SP 1 Beta comes with a “go live” license which means you can start using the product for production related work (but I still wonder why they released it as "Beta" then!).The focus is on improving the overall experience in a few important areas, such as unit testing, support for GPU acceleration in C++ applications, and offline help. Some of the improvements that come with Service Pack Beta 1:
Detailed information about the subject as well as download links for subscribers and for general developers can be found at Jason zander blog.
Any issues if you may arise with it can be submitted at Microsoft Connect. Some minor issues found here and here regarding download and installation.
UPDATE [10-December-2010]: Scott Hanselman blogged on SP1 Beta Release yesterday which contains informative updates on "whats new" and "updation/bug fixes" details concentrated in this release. Check out here: Visual Studio Explosion! - VS2010 SP1 *BETA* Released and Context
Update: The article has been selected as "Article of the day" on 3rd Feb 2011 at official asp.net () site
Recently I came across a very interesting situation thru that I came to know that the order in which the codeSubDirectories defined is very important.
We define codeSubDirectories section inside <Compilation /> section of web.config file in any asp.net application specially when we are having Class files in different languagues (C# & VB.NET) at the same time inside App_Code folder. So, the practice is to create different language folders inside App_Code and put the appropriate language class files inside those folders and define those folder names in <codeSubDirectories /> section.
Another possible situation is- when you want to seperate App_Code class files according to Modules of your application; You separete class files in different folder and put them in appropriate namespaces.
Below is one example on how you define codeSubDirectories section; if suppose for example, you having 3 folder in your application's App_Code folder namely mySubDir1, mySubDir2 and mySubDir3 respectively.<compilation> <codeSubDirectories> <add directoryName="mySubDir1"/> <add directoryName="mySubDir2"/> <add directoryName="mySubDir3"/> </codeSubDirectories></compilation>
According to MSDN documentation: <codeSubDirectories /> Defines an ordered collection of subdirectories that contains.I think that what is documented above is somewhat misleading or may be I am mis-interpreting it because the documentation says "the build order is not significant".
Anyways, the problem that I was facing is: I was not able to access the namespace/class defined in some other folder in some fix pattern. A google search helped me to know: If we take above example. It's not just a list but its an "Ordered" list. That means if you try to acccess Namespaces which are defined inside mySubDir2,mySubDir3 in mySubDir1 then you won't able to do that. The reason is mySubDir1 is defined very first in the CodeSubDirectories list.
Finally, conclusion in above example is:[1] Classes inside mySubDir1: you won't be able to access class/namespaces which are defined inside mySubDir2 and mySubDir3. Reason: mySubDir1 is first in CodeSubDirectories order and won't recognize the other classes which are further defined in other directoires.[2] Classes inside mySubDir2: you will be able to access class/namespaces which are defined inside mySubDir1 and mySubDir2 but you wont be able to access class/namespaces which are defined inside mySubDir3. Reason is mySubDir3 is defined as last inm order.[3] Classes inside mysubDir3: you will be able to access ALL class/namespaces which are defined in mySuibdir1, mySuibdir2 and mySuibdir3. Reason is because mySubDir is very last in the codeSubDirectories order.
Isn't that strange! This was a new thing to know for me :) So, when you come around a situation when you need to use mySubDir3's Classes and namespaces inside mySubDir1 classes, then best solution to follow WAP model OR create separate dll class libraries.
Below is the graphical representation of what I am saying in this blog entry:
hope it helps./.
I prefer to use fiddler which is an awsome tool for tracing up the http trafic, to test the performance script result OR to generate the Visual Basic web test script for performance testing. While working on one of my live site it helped me a lot as a web debugger. BUT, unfortunately when I tried to test my localsite () then fiddler didn't show me http traffic/session of my local sites. Just after investing few minutes on google I came to know about the fix of adding a "dot" in front of localhost! and guess, it worked!! Now, fiddler was showing me localhost site's traffic result.
The idea is: instead of browsing your localhost site as:
Browse the site with a "dot" infront of localhost as: OR (notice the "dot" that I have written in there in the address)
That's It! and fiddler started crawling my localhost site's session. The small trick would help people who just consider this tool a junk on first trial for their localhost sites.The root cause of this problem is: Internet Explorer and the .NET Framework are bydefault set not to send requests for Localhost through any proxies, and as a proxy, Fiddler will not receive such traffic.
You can also try another work-a-round by checking off a checkbox which says "Bypass proxy server for local addresses" which can be found at Internet Exploerer > Tools menu > Internet Options > Connections > Lan Settings > "Bypass proxy server for local addresses" Checkbox.
The issue has been documeted here as a known issue if anybody interested.
Happy Hunting!
For those developers who are looking forward for Silverlight 5; there is one great new that: at the Silverlight FireStarter event MS unveiled the next release of Silverlight (that is version 5 beta); the next version of its rich Internet platform and previewed key features of the upcoming beta technology at its Silverlight Firestarter educational event for developers. The Sikverlight beta 5 version is having significantly added new features and other media capabilities, which make easier for developers to create premium media experiences and deliver RIA across browsers, desktops and devices.
For more information on Announcing Silverlight 5; Check out ScottGu's Blog entry here: Announcing Silverlight 5And here is the detailed list of new features and enhancements announced in this version: New Features Announced for Silverlight 5 Beta
friends, I didn't remember about the real source where i got it but I found one handy sheet for common operation in Linq To SQL.
I thought you guys will find it useful too. I have also attached PDF file with this blog entry which contains all the examples ni both C# and VB.NET.
Hope it helps./.
Link to us
All material is copyrighted by its respective authors. Site design and layout
is copyrighted by DotNetSlackers.
Advertising Software by Ban Man Pro | http://dotnetslackers.com/Community/blogs/kaushalparik/ | CC-MAIN-2015-32 | en | refinedweb |
Confused with file read
Gabriel White
Ranch Hand
Joined: Mar 02, 2003
Posts: 233
posted
Apr 25, 2003 19:44:00
0
Hey yall, my assignment this week is to Implement a class named Course with Data members:
String
name and students (array of 30 Student representing students in the course)
and int size, which represents the current number of students in the course
I am supposed to read data from a filename, create respective students then add to the array student. Each line of this file will start with a String (no spaces between first name and last name) then followed by 4 decimal numbers for the scores. Then I am supposed to write all of the students in the array, with their scores to a file. This is my first time with writing to a file, and we are supposed to use exceptions.
Anybody have any ideas on this one? I just can't figure out how to use the getname and setname methods in Student, and Course to establish this. Thanks in advance.
Here is my code so far, It is not complete....
public class Student { private String name; private double[] grades; public Student(String name1, double[] g) { name=name1; grades = new double[4]; grades=g; } public String getName() { return name; } public void setGrade(int n, double s)//set the nth test score to s { grades[n]=s; } public double getGrade(int n)//return the score of the nth test { return grades[n]; } public String toString() { String info="\n"; info += "Students name is: " + name + "\n"; info += "Students grades are: "; for (int i = 0; i < grades.length; i++) { System.out.print(grades[i]); } info += "\n"; return info; } } /////next class import java.io.*; import java.util.*; public class Course { private String name; private Student[] student; private int size; public Course() { student = new Student[30]; size = 0; } public void setName(String n) { name=n; } public String getName() { return name; } public String fromFile(String filename) { String line, name1, file = "students.dat"; StringTokenizer tokenizer; int count = 0; //Student st = new Student(name1); try { FileReader fr = new FileReader (file); BufferedReader inFile = new BufferedReader (fr); line = inFile.readLine(); while (line != null) { tokenizer = new StringTokenizer (line); name1 = tokenizer.nextToken(); try { student[count++] = new Student (name1); } catch (NumberFormatException exception) { System.out.println ("Error in input. Line ignored:"); System.out.println (line); } line = inFile.readLine(); } inFile.close(); for (int scan = 0; scan < count; scan++) System.out.println (student[scan]); } catch (FileNotFoundException exception) { System.out.println ("The file " + file + " was not found."); } catch (IOException exception) { System.out.println (exception); } return file; } }
[ April 26, 2003: Message edited by: Steve Wysocki ]
[ April 27, 2003: Message edited by: Steve Wysocki ]
Gabriel White
Ranch Hand
Joined: Mar 02, 2003
Posts: 233
posted
Apr 27, 2003 13:31:00
0
Ok, I got it to read from the file, but I cant seem to input the grades.
I added the code:
g[count] = Double.parseDouble(tokenizer.nextToken()); student[count++] = new Student(name1,g[count]);
but now, I am getting the error that "Course.java": Error #: 300 : constructor Student(
java.lang.String
, double) not found in class exercise7.Student
When it is. It says double and I know that I am supposed to pass an array into the Student constructor.
Any ideas would be appreciated
again my goal here is just to read the file of 30 students and add their grades into the array as well and print out the info and then dump that info to another file. I haven't started the last part yet, but nobody has posted on this thread so Im still chugging along.
Thanks
Steve
[ April 27, 2003: Message edited by: Steve Wysocki ]
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1873
posted
Apr 27, 2003 13:51:00
0
hi steve,
as u know the format of the student input file u 've which is,
STUDENTNAME GRADE1 GRADE2 GRADE3 GRADE4
u can do follwing in the while (line != null )...
//1. frist token is student name,
String tempName = stk.nextToken();
//2. create empty array of double that can hold 4 grades
double[] grades = new double[4];
//3. read each grade and parse for double format
grades[0] = Double.parseDouble(stk.nextToken());
grades[1] = Double.parseDouble(stk.nextToken());
grades[2] = Double.parseDouble(stk.nextToken());
grades[3] = Double.parseDouble(stk.nextToken());
// 4. create a student object and put in the array
students[count] = new Student(tempName, grades);
//5. increment student counter
count++;
// it is a good practice to put count++ outside the students[count] instead of writing students[count++]...makes debugging easier for us..
hth,
regards
maulin
Maulin Vasavada
Ranch Hand
Joined: Nov 04, 2001
Posts: 1873
posted
Apr 27, 2003 13:58:00
0
hi steve
as this is a simple assignment we dont have to consider OO things otherwise we would have some different design than the existing one..
we would have following objects,
1. Student - that represents a student
2. Course - that represents a course information
3. CourseCatalog - that represents a listing of courses for a particular semester (say fall, spring etc..) and will have listing of students enrolled in the course for that semester.
the reason of having the CourseCatalog is - in real world we have,
1. different semesters might be offering different courses,
2.across semesters we might have changed professors for the same coures (u know ..Prof A taking Course-1 in fall but in spring Prof B is taking the course...and all)
well, this is my 2cents about what i had first in mind...we dont have to worry about these things in simple assignments but certainly better to keep this in mind..
regards
maulin
Gabriel White
Ranch Hand
Joined: Mar 02, 2003
Posts: 233
posted
Apr 27, 2003 14:09:00
0
Thanks Maulin, that sure did help. But now my output is all messed up, here is an example of my first two students. Im just wondering why it prints out the grades and then the student name.
I'll have to check that out. I'm sure it has something to do with my toString method. Thanks again Maulin, you are the only one to help me on this project and I sincerely thank you for that.
76.055.099.677.4
Students name is: JohnSmith
Students grades are:
77.985.466.798.5
Students name is: HeideAdams
Students grades are:
Never mind, duh, the toString for loop didn't have my info string in it.
my bad.
[ April 27, 2003: Message edited by: Steve Wysocki ]
I agree. Here's the link:
subject: Confused with file read
Similar Threads
Maulin, problem with file write
Array returning last value entered
Arrays: Calling input from other methods and classes
Keep getting this error and not sure why
Im having an errror
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
JForum
|
Paul Wheaton | http://www.coderanch.com/t/393669/java/java/Confused-file-read | CC-MAIN-2015-32 | en | refinedweb |
#include <RT_Policy_i.h>
List of all members.
Stores Unix Domain Sockets (Local IPC) Protocol configuration properties.
Constructor.
Protected destructor to enforce proper memory management of this reference counted object.
This method writes the CDR encapsulation of an instance of UnixDomainProperties. This Protocol Property in TAO specific, so there is no order of encapsulation specified in the RT CORBA Spec. The current implementation encodes the field according to the order of declaration (i.e. first is encoded send_buffer_size and then recv_buffer_size). | http://www.dre.vanderbilt.edu/Doxygen/5.6.2/html/tao/rtcorba/a00054.html | CC-MAIN-2013-20 | en | refinedweb |
12 January 2009 12:20 [Source: ICIS news]
SINGAPORE (ICIS news)--Sellers were optimistic about the ethylene dichloride (EDC) market in Asia on an expected fall in imports from the US, traders and producers said on Monday.
“We are starting to see fewer deep-sea cargoes from the US Gulf Coast because chlor-alkali producers there have lowered their operating rates. This trend could continue until March or April,” a vinyls trader said.
According to the latest data released by the Chlorine Institute, ?xml:namespace>
Production was likely to remain reduced as caustic soda demand in the
Regulatory changes in
But market sentiment firmed after Chinese authorities installed temporary measures to help smooth trading, with traders reporting a sharp drop in deep-sea cargo arrivals, industry sources said.
Asia imports an average of 20,000 tonnes of EDC from the
The volume spiked to almost 80,000 tonnes in December. But this was due more to the desire of US producers to clear their inventories by year-end than an actual reflection of the monthly demand-and-supply fundamentals, traders said.
Another 40,000 tonnes of EDC imports are expected in January, but the volume could fall to as low as zero in February as chlor-alkali production rates in the
“We have already heard that there’s some difficulty in finding EDC cargoes for February loading. If the situation persists, the
The supply tightness would also come at a time when
Prices of downstream polyvinyl chloride (PVC) had been rising and EDC remained the most attractive feedstock to purchase and then convert to PVC, traders and producers said.
EDC is used to produce vinyl chloride monomer (VCM), which in turn is used to produce PVC. A more than $200/tonne-spread on EDC and VCM prices would make the former more attractive for PVC producers to purchase, traders and producers said.
The price of EDC in Asia was last Friday assessed at $130-140/tonne CFR (cost and freight) NE (northeast)
Other market players, however, said they were sceptical that the recent rise in PVC prices was sustainable, as demand destruction showed few signs of abating amid worsening economic woes.. | http://www.icis.com/Articles/2009/01/12/9183495/sellers+optimistic+about+asia+edc+market.html | CC-MAIN-2013-20 | en | refinedweb |
15 December 2011 15:37 [Source: ICIS news]
TORONTO (ICIS)--Capacity utilisation in ?xml:namespace>
“The chemical manufacturing industry saw its capacity utilisation increase from 77.7% [in the second quarter] to 82.1%, mainly as a result of the expanded production of pharmaceuticals and medicine,” Ottawa-based Statistics Canada said in a report.
Meanwhile, third quarter plant utilisation in
Overall capacity plant utilisation in Canada’s manufacturing sector rose by 1.6 percentage points to 81.1% in the third quarter, led by increased production in the motor vehicle and parts sector, which recovered from a decline in the second quarter because of Japan’s earthquake and tsunami disaster, the agency said.
Compared with the third quarter of 2010, capacity utilisation in Canada's chemical industry was up by 7.9 percentage points, while the plastics and rubber sector saw a 4.2 percentage point increase.
Overall Canadian manufacturing plant utilisation was up 4.3 percentage points year on year from the 2010 third quarter.. | http://www.icis.com/Articles/2011/12/15/9517005/canadas-chemical-plant-capacity-utilisation-rises-to-82.1-in-q3.html | CC-MAIN-2013-20 | en | refinedweb |
- Java Reference Guide
- Overview
- Table of Contents
- J2SE: Standard Java
- Java Windows NT Services
- Apache Velocity
- Advanced J2SE
- Bytecode Instrumentation
- Dynamic Languages and the JVM
- J2SE 1.5.0: "Tiger"
- Java SE 6
- Java 7
- Setup
- Try-With-Resources
- Project Coin
- Summary
-<<
Try-With-Resources
Last updated Jun 17, 2011.
One thing that has always been tedious for Java developers is cleaning up resources that are contained in a try block. Consider the standard example of executing a database query: it would be nice if we could write that code as follows:
try { Connection connection = ds.getConnection(); PreparedStatement ps = connection.prepareStatement( "SELECT * FROM TABLE" ); ResultSet rs = ps.executeQuery(); while( rs.next() ) { ... } rs.close(); ps.close(); connection.close(); } catch( Exception e ) { e.printStackTrace(); }
Of course, what is the big problem with this code? The problem is that if there is a problem with the connection, the prepared statement, or the result set then these resources do not get properly closed. We then find ourselves having to close these resources in a finally block to ensure that whether or not the code succeeds, the resources are closed. But to further complicate things, closing each of these resource can generate exceptions themselves. This turn this simple operation into the following "code overhead":
Connection connection = null; PreparedStatement ps = null; ResultSet rs = null; try { Connection connection = ds.getConnection(); PreparedStatement ps = connection.prepareStatement( "SELECT * FROM TABLE" ); ResultSet rs = ps.executeQuery(); while( rs.next() ) { ... } rs.close(); ps.close(); connection.close(); } catch( Exception e ) { e.printStackTrace(); } finally { try { if( rs != null ) { rs.close(); } } catch( Exception e ) { e.printStackTrace(); } try { if( ps != null ) { ps.close(); } } catch( Exception e ) { e.printStackTrace(); } try { if( connection != null ) { connection.close(); } } catch( Exception e ) { e.printStackTrace(); } }
While this works, it is incredibly messy: not only do you have to close your resources but you have to create them outside the try block, close them in their own try-catch blocks, but you also have to check their state before you do so.
Java 7 introduces what is referred to as try-with-resources, which allows you to define the resources that need to be closed within the try construct itself and then those resources will be automatically closed for you when the try block completes, regardless of whether or not an exception occurred.
The try-with-resources command works as follows:
try { Create objects that can be automatically closed here ) { //Do stuff ... } catch( Exception e ) { // Handle Exception }
Add parentheses to the end of the try statement and create objects that can be automatically closed within those parentheses. You can still handle exceptions and even have a finally block, but you do not need to close the resources that are automatically closed. You can create a single object or multiple objects, separating each by a semi-colon.
Looking back at our database connection challenge, here is that same code written using a try-with-resources:
try( Connection connection = ds.getConnection(); PreparedStatement ps = connection.prepareStatement( "SELECT * FROM TABLE" ); ResultSet rs = ps.executeQuery() ) { while( rs.next() ) { ... } } catch( Exception e ) { e.printStackTrace(); }
The connection, prepared statement, and result set are all created inside the try command and then the body of the try block iterates over the results. When the block completes, the JVM automatically closes them on your behalf.
The way that this is accomplished is through the java.lang.AutoClosable interface. Any class that implements this interface can be used inside a try-with-resources block and will be closed when the try block is complete when the JVM executes the class's close() method (the only method defined by the AutoCloseable interface.) In Java 7 there are several classes that implement the AutoCloseable interface (see the Javadoc link above), but the ones of note are:
- All of the InputStream, OutputStream, Reader, and Writer derivations
- The database classes: Connection, Statement, PreparedStatement, ResultSet, RowSet, JdbcRowSet
- Most of the socket related classes
- Most of the audio (Java Sound) classes
And of course if you want to create your own class that can be used in such a way, the answer is to implement the AutoCloseable interface and provide an implementation of the close() method.
If you want to follow along at home, listing 1 shows a sample class that uses the new try-with-resources command and listing 2 shows the Maven POM file that builds it. Note that you will need to setup Java 7 in your environment and add it to your PATH before your operating system finds your current Java version.
Listing 1. TryWithResourcesExample.java
package com.javasrc.informit.trywithresourcesexample; import java.sql.*; public class TryWithResourcesExample { public static void main( String[] args ) { try( Connection conn = DriverManager.getConnection( "jdbc:hsqldb:file:testdb", "SA", "" ); PreparedStatement ps = conn.prepareStatement( "SELECT * FROM MYTABLE" ); ResultSet rs = ps.executeQuery() ) { while( rs.next() ) { // ... } } catch( SQLException e ) { e.printStackTrace(); } } } Listing 2. pom.xml <project xmlns="" xmlns: <modelVersion>4.0.0</modelVersion> <groupId>com.javasrc.informit</groupId> <artifactId>TryWithResourcesExample</artifactId> <version>1.0-SNAPSHOT</version> <packaging>jar</packaging> <name>TryWithResourcesExample</name> <url></url> <build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.0.2</version> <configuration> <source>1.7</source> <target>1.7</target> </configuration> </plugin> </plugins> </build> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> </properties> <dependencies> <dependency> <groupId>org.hsqldb</groupId> <artifactId>hsqldb</artifactId> <version>2.1.0</version> </dependency> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.8.2</version> <scope>test</scope> </dependency> </dependencies> </project>
In terms of features that make your development life easier, even if just for convenience and clean code, the new try-with-resources has to be at the top of the list for Java 7. | http://www.informit.com/guides/content.aspx?g=java&seqNum=644 | CC-MAIN-2013-20 | en | refinedweb |
Java AWT Package Example
Java AWT Package Example
In this section you will learn about the AWT package of the Java. Many
running examples are provided that will help you master AWT package. Example
package
package Give two advantages of creating packages in java program... can allow types in one package to have unrestricted access to one another, still restricting the access for the types outside the package
Master java in a week
;
Class Declaration:
Class is the building block in Java...;
The main method is the entry point in the Java program
and java program can't run... is always first thing that is executed in a java program.
Here is the main method
Java package
Java package What restrictions are placed on the location of a package statement within a source code file
What is a package?
related to package in java. is a package? hi,
What is a package?
thanks
Hi,
The Package is a mechanism for organizing the group of related:/
Package Versioning - java tutorials
Package Versioning
2001-07-25 The Java Specialists' Newsletter [Issue 026...). In a project I worked
on previously, we added a class to each java package which... logger can use the standard Java(tm) API to get
package version information
Master Java In A Week
Master Java In A Week
...
categories in Java
Create
Your Own Package... Java Input/Output and is
a part of java.io package.
This package has a InputStream
sun.reflect.Reflection Package - Java Tutorials
sun.reflect.Reflection -
Package
2004-04-09 The Java Specialists... and Rick Ross from
Java Lobby
for the
nice
things they wrote about....
Welcome to the 87th edition of The Java(tm) Specialists' Newsletter. We have
Package in Java - Java Beginners
Package in Java Hi,
What is a package? Tell me how to create package?
Thanks
Hello,
packeage is nothing but you can say that folder of related java files.
ex,
if you write a jaava class like
add new package java
add new package java How to add new package in Java
Change Background of Master Slide Using Java
Change Background of Master Slide Using Java
... to create a slide then change background of the
master slide.
In this example we are creating a slide master for the slide show. To create
slide show we
Java package,Java Packages
Java Package
Introduction to Java Package
A Java package is a mechanism for organizing a group... similar functionality.
Java source files can include a package statement
java.util package - Java Beginners
java.util package Design a Date class similar to the one provided in the java.util package.?
Thanks in ADVANCE.... Hi Friend,
Please visit the following link:
Internet and Web related questions for Web Master.
Internet and Web related questions for Web Master.
Explain the difference between the Internet and Web.
What are Web browsers? Explain the two main... is Java? What are the applications of Java that you can use for Web designing
package - Java Beginners
Creating a package in Java Create a package called My Package. In this, create a class call Marks that specifies the name of student, the marks in three subjects and the total of these marks. Displays the details of three
Package categories in Java
Package categories in Java
Java supports two types of packages as shown below....
java.nio
This package handles New I/O
framework for Java
package creation
package creation program to create package having four different class in java
regarding java package - Java Beginners
regarding java package can you provide tutorial for java.sql package
please help Hi friend,
I am sending you a link. This link will help you.
Please visit for more information.
java awt package tutorial
Java AWT Package
In Java, Abstract Window Toolkit(AWT) is a platform independent
widget toolkit for windowing, graphics, and user-interface.
As the Java..., the buttons work as Microsoft Windows buttons when we run a
Java application
Write short note on Java package.
Write short note on Java package. Write short note on Java package
Java Util Package - Utility Package of Java
Java Util Package - Utility Package of Java
Java Utility package is one of the most commonly used packages in the java
program. The Utility Package of Java consist
userdefined package
userdefined package package javap;
class HelloWorld
{
public... declare a package then in command prompt i set the classpath.After that i compiled the class and run the package then i got the error
C:\Users
problem with package
problem with package Dear sir,
i have created one java file with package com.net; and i compiled the program.it showing the .class file... message as can not access package class methods
The package keyword
;
The package in java programming language
is a keyword that is used to define a package that includes the java classes. Keywords
are basically reserved words....
In java programming language while
defining a package then the package statement
Java package
Java package
Introduction to Java Package
Package is a mechanism for organizing a group... and category.
An example of package is the JDK package of SUN Java as shown
which package imported by the java compiler by default?
which package imported by the java compiler by default? which package imported by java by default
core java collection package - Java Interview Questions
core java collection package why collection package doesnot handle..., Java includes wrapper classes which convert the primitive data types into real Java Objects.
There is no class in Java called int but there is a class called
Java AWT Package Example
Java util package Examples
missing package-info.java file
missing package-info.java file How to find and add the packages in Java if it's missing from the list
Java Zip Package
Java Zip Package
In Java, the java.util.zip package provides classes for reading... to
include classes for manipulating ZIP files as part of the standard Java APIs
Which package is imported by default?
package is imported by default? The java.lang package is imported by default even without a package declaration. In Java class has been imported in the following...Which package is imported by default? hi,
Which package
Compiling package in command line
Compiling package in command line Hi friends,
i am totally new to java programming, i am basic learner in java.
My query is, How to compile java package using command line.
For Eg: When i compile following command,
c:>set
Java Get classes In Package
Java Get classes In Package
... the classes from the
package by providing the path of the jar file and the package....
Following code adds all the classes of the package getting from the jar
user-define package for applet - Java Beginners
user-define package for applet how to import a user-define package to applet ?? Hi
import javax.swing.*;
import java.awt.Graphics...://
The java.text package
The java.text package
This Section describes :-
Use of standard J2SE APIs in the java.text package to
correctly format or parse dates, numbers... = Locale.getDefault();
The Java 2 platform provides a number of classes
use of package concepts
use of package concepts i m getting error when i use .* method to access all package files. when i use this through another method like... to learning java
Java nio package - Learn how to use java nio package.
Java nio package.
In this section we will learn about the java.nio package... input output) package was introduced in Java 1.4
which is broadly ... package and how it is implemented
in java programming
Creating your own package in java
The package to which the source file belongs is specified with the keyword
package at the top left of the source file, before the code that defines the
real classes in the package.
To know more about how to create own package
Local Variable ,Package & import
;
System.out.print(classVariable);
}
}
Package & import
Java classes can be grouped together in packages. A package name is the same
as the directory...Local Variable ,Package & import
A local variable has a local scope.Such
Input and Output package
();
}
}
For more information, visit the following link:
Java IO package
Create Subpackages (i.e. A Package inside another package)
Create Subpackages (i.e. A Package inside another package)
We can also put a package inside an another package. The packages that comes lower in the naming hierarchy
java
java hi im new to java plz suggest me how to master [email protected]
Import My Own Package (Automatically)
Import My Own Package (Automatically) How can I import my own package in every java program ( automatically )....?
For example :- java.lang.String... automatically imported, we need not to import what are abstract methods
Please visit the following link:
Create Your Own Package
-qualified class name
is the name of the java class that includes its package name...
Create Your Own Package
The package to which the source file belongs is specified
java
, visit the following links:
java
://
import user-define package - Applet
import user-define package how to import user-define package to the frame/graphic of the applet.
could i create a new frame or not ??
please help...://
Introduction to java.sql package
Introduction to java.sql package
This package provides the APIs for accessing... database by using the java programming language. It includes a framework where we
Java Package Formatter
Java Package Formatter
When you want to format multiple Java source in Eclipse...
allows you to select one or more packages in the Java Package Explorer
How to import a package
How to import a package
... in package.
Declaring the fully-qualified class name. For
example...;
Lets see an example importing the created package into
the another program file
java
??all the database must be in master computer only and all other computer must retrieve that data from the master computer only.please help
find a substring by using I/O package
find a substring by using I/O package Write a java program to find a sub string from given string by using I/O package
JAVA PACKAGES - Java Beginners
JAVA PACKAGES I HAVE A DOUBT. I CRATED A PACKAGE BUT I AM NOT ABLE TO IMMPORT ANY FILES TO THE ANOTHER PACKAGE HOW CAN I IMPORT ANY PACKAGE FROM...://
Thanks.
Amardeep
Masters of Java Assignment Plugin
it significantly easier to develop Master of Java
Assignments by making use of the Eclipse Java IDE.
The plugin has the following features... Masters of Java Assignment Plugin
Java program to get class name without package
Java program to get class name without package ... example which
describes you that how you can get the class name without package. For this
purpose we have to fetch first the full class name with package
java
java What are different types of access modifiers? ...: Accessible with in the package and sub class of the package also
default: Accessible with in the package only
how to import user-define package to applet - Applet
how to import user-define package to applet how to import user-define package to applet...
can u write a java coding can execute in jdk only...());
}
}
--------------------------------------------------
Read for more information.
java
java what is package and how its creates,and advantage also
Java
Java why all the class in io package are abstract and collection are interface
java
java Write a Java program that prompts the user to enter a name. The program will compare the name with a list of names from a file named Names.txt.... package for all input
java
java Construct a Java program that will read a list of integers from a file named number.txt. The program will sum all the integers and keep... is in individual row. Use classes and methods from the java.io package for all
java
java why data structures?
The data structures provided by the Java utility package are very powerful and perform a wide range of functions. These data structures consist of the following interface and classes
Java - Java Beginners
Java Java Master get ready....
Can we make plugin for Browser in java ?
Any reply is appriciated
JAVA
JAVA Hi,
here is my code:
package project1;
public class dddddddddd {
public static void main(String[] args...:
java.lang.NoSuchMethodError: main
Exception in thread "main" Java Result: 1
BUILD
java - Java Beginners
Java array add What is array and how can i add an element into an array in Java? IT would be nice if you can give an example.Thanks
java
. Because you can get GlassFish with Java EE package for NetBeans, it is easier...Java Programming tools what is the differance between eclipes... based application in Java. Servlet/JSP development is fairly very simple compared
java
you can get GlassFish with Java EE package for NetBeans, it is easier to use than...java netbeans what is the differance between eclipes and netbeans... application in Java. Servlet/JSP development is fairly very simple compared to Eclipse
java
. Because you can get GlassFish with Java EE package for NetBeans, it is easier...What is Java eclipes what is the differance between eclipes... application in Java. Servlet/JSP development is fairly very simple compared
java
in NetBeans. Because you can get GlassFish with Java EE package for NetBeans...java eclipes and netbeans tutorial what is the differance between... are developing MVC based application in Java. Servlet/JSP development is fairly very
java
in NetBeans. Because you can get GlassFish with Java EE package for NetBeans, it is easier...java eclipes and net beans what is the differance between eclipes... based application in Java. Servlet/JSP development is fairly very simple
java
is better in NetBeans. Because you can get GlassFish with Java EE package...differance between java eclipes and netbeans what is the differance... are developing MVC based application in Java. Servlet/JSP development is fairly
Java
Java You want subclasses in any package to have access to members of a superclass. Which is the most restrictive access that accomplishes this objective
java
in NetBeans. Because you can get GlassFish with Java EE package for NetBeans... MVC based application in Java. Servlet/JSP development is fairly very simple... the Java community about these two IDE are fairly similar. For basic Java (Java SE
java
. Because you can get GlassFish with Java EE package for NetBeans, it is easier to use... application in Java. Servlet/JSP development is fairly very simple compared... fills a different, but similar niche).
The general opinions within the Java
java
is better in NetBeans. Because you can get GlassFish with Java EE package for NetBeans... are developing MVC based application in Java. Servlet/JSP development is fairly very... within the Java community about these two IDE are fairly similar. For basic Java
java
. Because you can get GlassFish with Java EE package for NetBeans, it is easier... application in Java. Servlet/JSP development is fairly very simple compared... fills a different, but similar niche).
The general opinions within
Ask Questions?
If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.
Ask your questions, our development team will try to give answers to your questions. | http://www.roseindia.net/tutorialhelp/comment/68796 | CC-MAIN-2013-20 | en | refinedweb |
11 March 2011 17:55 [Source: ICIS news]
HOUSTON (ICIS)--The Hydrographic and Oceanographic Service of the Chilean navy has issued a tsunami alert for the coastal areas of the country, the local daily el Mercurio said on Friday.
The Chilean government called for calm while scientists study what effects the devastating earthquake in ?xml:namespace>
The tsunami alert was for both the coastal and interior regions, according to the alert.
The navy’s oceanographic service estimated arrival times for different locations along the coast and said updates would be issued throughout the day.
The tsunami wave is expected to hit the Easter Island at 17:47 hours (
The
However, local sources did not expect major consequences of the tsunami in
There were no reports of production interruptions in the refineries and chemical plants of
Enap, the national oil company, has two refineries, one in
A Petroquim source said that operations were normal, despite the fact that the plant site was near the coast and only about 5 feet above sea level.
A Petroquim official said there was a wait-and-see attitude and many uncertainties about the magnitude of the waves.
Official information about the effects of the tsunami in other areas could change things rapidly, the Petroqu. | http://www.icis.com/Articles/2011/03/11/9443232/chilean-navy-warns-of-tsunami-danger-on-pacific-coast.html | CC-MAIN-2013-20 | en | refinedweb |
QNX Developer Support
snd_ctl_open()
Create a connection and handle to the specified control device
Synopsis:
#include <sys/asoundlib.h> int snd_ctl_open( snd_ctl_t **handle, int card );
Arguments:
- handle
- A pointer to a location in which snd_ctl_open() stores a handle for the card, which you need to pass to the other snd_ctl_* functions.
- card
- The card number.
Library:
libasound.a
Description:
The snd_ctl_open() function creates a new handle and opens a connection to the control interface for sound card number card (0-N). This handle may be used in all of the other snd_ctl_*() calls.
Returns:
Zero on success, or a negative value if an error occurs. | http://www.qnx.com/developers/docs/6.3.0SP3/neutrino/audio/libs/snd_ctl_open.html | CC-MAIN-2013-20 | en | refinedweb |
Ticket #2310 (closed defect: invalid)
x264: x264_cqm_init access beyond array causes undefined behavior in gcc48
Description
Summary of the bug:
can't x264 bugs be submitted with trac..? anyways...
i can get to 7, whereas quant4_mf quant4_bias0 quant4_mf dequant4_mf and unquant4_mf are defined as array [4], therefore undefined behavior happens with gcc-4.8-0.14.fc19 (infinite loop).
How to reproduce:
run x264 and it segfaults in x264_cqm_init.
small test case which causes infinite loop
#include <stdio.h>
#include <string.h>
#include <inttypes.h>
#include <stdlib.h>
uint32_t (*quant4_mf[4])[16];
int main(int argc, char *argv[])
{
int i;
for(i = 0; i < 8; i++ )
{
fprintf(stderr, "i=%d\n", i);
quant4_mf[i] = (void*)0;
}
return 0;
}
% ffmpeg -i input ... output ffmpeg version built on ...
Patches should be submitted to the ffmpeg-devel mailing list and not this bug tracker.
Change History
comment:1 Changed 3 months ago by cehoyos
- Keywords libx264 added
- Status changed from new to closed
- Resolution set to invalid
comment:2 Changed 5 weeks ago by rogerdpack
I think I may have just run into this on windows (cross compiling) with 4.8 (it crashes right after the line [libx264 @ 037bd3a0] using SAR=32/27).
Was this ever reported to x264-devel does anybody know?
Program received signal SIGSEGV, Segmentation fault.
0x759c79c8 in msvcrt!memcmp () from C:\Windows\syswow64\msvcrt.dll
(gdb) bt
#0 0x759c79c8 in msvcrt!memcmp () from C:\Windows\syswow64\msvcrt.dll
#1 0x004a303c in x264_cqm_init ()
Also related: which seems to have some fix.
Please consider posting on | http://ffmpeg.org/trac/ffmpeg/ticket/2310 | CC-MAIN-2013-20 | en | refinedweb |
A friendly place for programming greenhorns!
Big Moose Saloon
Search
|
Java FAQ
|
Recent Topics
Register / Login
JavaRanch
»
Java Forums
»
Products
»
JBoss
Author
SEAM accessing clicked link's object on next page (SOLVED)
Varun Chopra
Ranch Hand
Joined: Jul 10, 2008
Posts: 204
I like...
posted
Apr 09, 2009 06:41:47
0
I have a page on which few hyperlinks are displayed. It's code is pasted below:
<body> <f:view> <h2>Screen List</h2> <h:outputText <h:dataTable <h:column> <h:outputLink <h:outputText </h:outputLink><br></br> <h:outputText </h:column> </h:dataTable> </f:view> </body> </html>
As you can see above, each hyperlink belongs to a
java
object whose class has name 'screen' under SEAM. Here's Screen class's code
@Entity @Name("screen") @Scope(ScopeType.CONVERSATION) @Table(name="Screen_Code") @SecondaryTable(name="Screen_Code_Display") @PrimaryKeyJoinColumn(name="Screen_Code", referencedColumnName="SCRCODEID") public class Screen implements Serializable { /** * */ private static final long serialVersionUID = 4506287642101108125L; private Long id; private String label; private String definition; private String url; private List<ScreenParam> parameterList = null; // getters and setters omitted }
My question is, when user clicks a hyperlink, how can I access corresponding screen object on next page. I am trying following on next page:
<body> <f:view> <h2>Parameter Search</h2> <h2>#{screen.url}</h2> </f:view> </body> </html>
But I get nothing within second <h2> and </h2>. How do I access clicked link's object? Is it a scope thing for Screen class? I have tried Session and Event but to no use.
-Varun -
(
My Blog
) -
Mock Tests
Vivek Murugesan
Greenhorn
Joined: Apr 09, 2009
Posts: 9
posted
Apr 09, 2009 12:02:57
0
<h
utputLink
<h
utputText
<f:param
</h
utputLink><br></br>
<h
utputText
In pages.xml, you can track it (event context)
<page view-
<param name="url"/>
</page>
Hope this helps!!
Varun Chopra
Ranch Hand
Joined: Jul 10, 2008
Posts: 204
I like...
posted
Apr 10, 2009 02:16:34
0
Thanks Vivek, unfortunately that will not solve the problem.
I need whole screen object on next page, not url parameter only. I pasted simplified (next page) code to communicate requirement.
There must be a way in SEAM to propagate selected/clicked object to next page, I wonder if that has anything to do with its conversation scope.
Anybody to help please?
Ryan Waggoner
Ranch Hand
Joined: Jun 27, 2007
Posts: 75
posted
Apr 10, 2009 08:13:05
0
Here is how I do things with Seam, for cases like this.
First I create a SF bean. In this bean I would put your list of Screen objects, and an instance of the Screen (to select a specific one)
@Stateful @Name("screenActivityBean") @Conversational public class ScreenActivityBean { @DataModel private List<Screen> screensList; @DataModelSelection @Out(required=false) Screen screen; ...
You can look up the annotations
here.
Than a method to select the current screen, which you will call with your links...
public String selectScreen(){ return "selectScreen"
So now if we change the first
JSP
a little bit..
<f:view> <h2>Screen List</h2> <h:outputText <h:dataTable <h:column> <h:commandLink <h:outputText </h:outputLink><br></br> <h:outputText </h:column> </h:dataTable> </f:view>
So now the screenList is in the bean we just made as a list of screens (you'll have to populate it)
When you select a screen from your list, the DatamodelSelection annotation makes it really easy for us, and will automatically map the screen you clicked to the screen in the bean. Now you have that bean in the conversation and you can do whatever you want with it, before you end the conversation.
Let me know if that helped...I am still new to Seam myself...
Varun Chopra
Ranch Hand
Joined: Jul 10, 2008
Posts: 204
I like...
posted
Apr 13, 2009 23:33:04
0
Thanks Ryan for your help. I tried similar code earlier, but was not able to make that work. I am sure it will work and I was missing something (I was using ScopeType.Conversation for Screen object, not for the SB used to populate screen objects).
But good thing is problem is solved now with a very small change. I am still using ScopeType.EVENT for Screen object. Only thing changed is view file. Instead of using h: outputLink tag I am now using s: link with view attribute. Earlier I had tried s: link with action element and I was confused as to how to provide a JSP/JSF file to action which was supposed to call a method. I was not paying attention to view attribute of s: link. See the code below, it works and gives me selected screen object on next page:
<body> <f:view> <h2>Screen List</h2> <h:outputText <h:dataTable <h:column> <s:link <br></br> <h:outputText </h:column> </h:dataTable> </f:view> </body>
I agree. Here's the link:
subject: SEAM accessing clicked link's object on next page (SOLVED)
Similar Threads
Dynamic Component in JSF
Problem in Editing Table Data
Datatable with scrollbar in JSF
Bean request Scope won't Call method
how to remember the value in h:commandLink inside a h:datatable
All times are in JavaRanch time: GMT-6 in summer, GMT-7 in winter
JForum
|
Paul Wheaton | http://www.coderanch.com/t/440330/JBoss/SEAM-accessing-clicked-link-object | CC-MAIN-2013-20 | en | refinedweb |
This section of the article discusses the steps that are required to set-up your environment for React development. You might feel that there are so many steps for this to get started but believe me, this will help you achieve faster development very soon.
You will require Node JS and NPM installed on your system to get the React JS development setup. Node JS is the platform that is required for the React development. After successful installation of both Node JS and NPM, then comes the part of installing React JS which can be done in two ways, and they are as follows:
Installing React JS using Webpack and Babel
Installing React JS using the Create-React-App command
Let us now look at each of these installation processes individually:
1. Installing React JS using Webpack and Babel:
Webpack is a module bundler which helps to manage and to load dependent modules and compiles them into a single file or bundle. This bundle can be used during your application development using either by the command line interface or by configuring in webpack.config file.
Babel, on the other hand, is a JavaScript compiler and transpiler which helps to convert one source code to another format. We are going to use this as this converts all your ES6 features in your code to ES5 format – so that it can be run on all browsers.
With the dependencies for the installation process handled and understood, let us get down to the business of (React JS) installation altogether.
- Create the root (ReactJS Application):
Create a folder naming ReactJS Application on the desktop to install the required software and dependencies. All of this will be done using the command-line way.
C:Users<Your Username>Desktop>mkdir ReactJSApplication C:Users<Your Username>Desktop>cd ReactJSApplication
Module creation is controlled by the package.json file, and now that we have created the required folder, let us run the npm init commands to create the package.json file. This will ask for more details further, which can be skipped by padding a -y parameter to the previous command.
C:Users<Your Username>Desktop>ReactJSApplication>npm init -y
- Install react and react-dom modules:
Since we need to install ReactJS, we need to install its dom packages using the install react and react-dom npm commands. The packages that we are installing now can be saved to the package.json file by adding the –save option in the commands above.
C:Users<Your Username>Desktop>ReactJSApplication>npm install react --save C:Users<Your Username>Desktop>ReactJSApplication>npm install react-dom --save
Instead of two different commands, if you want to combine these commands into a single command – It can be done this way:
C:UsersDesktop>ReactJSApplication>npm install react react-dom --save
- Install webpack modules:
After the react and react-dom modules are installed, it is time to install the webpack modules, which can be done in either ways. The installation here requires to install all the three Webpack modules namely webpack, webpack-dev-server and webpack-cli.
C:Users<Your Username>Desktop>ReactJSApplication>npm install webpack --save C:Users<Your Username>Desktop>ReactJSApplication>npm install webpack-dev-server --save C:Users<Your Username>Desktop>ReactJSApplication>npm install webpack-cli --save
Or we can install all of these modules at once using just this single command as shown below:
C:Users<Your Username>Desktop>ReactJSApplication>npm install webpack webpack-dev-server webpack-cli --save
- Install Babel modules:
After the installation of webpack modules, we need to install all the 5 babel dependencies namely babel-loader, babel-core, babel-preset-dev, html-webpack-plugin and babel-preset-react. Identify the difference below, as we are going to save these dependencies as only development required dependencies.
C:Users<Your Username>Desktop>ReactJSApplication>npm install babel-core --save-dev C:Users<Your Username>Desktop>ReactJSApplication>npm install babel-loader --save-dev C:Users<Your Username>Desktop>ReactJSApplication>npm install babel-preset-env --save-dev C:Users<Your Username>Desktop>ReactJSApplication>npm install babel-preset-react --save-dev C:Users<Your Username>Desktop>ReactJSApplication>npm install html-webpack-plugin --save-dev
All of these modules can be installed at once using just this in a single command, like the following:
C:Users<Your Username>Desktop>ReactJSApplication>npm install babel-core babel-loader babel-preset-env babel-preset-react html-webpack-plugin --save-dev
C:Users<Your Username>Desktop>ReactJSApplication>npm i @babel/core babel-loader @babel/preset-env @babel/preset-react --save-dev
- Create the necessary files:
There is a requirement to create a certain set of files either manually or using the command prompt, which will finally mark the installation process complete. The files that need to be created are shown below:
C:Users<Your Username>Desktop>ReactJSApplication>type nul > index.html C:Users<Your Username>Desktop>ReactJSApplication>type nul > App.js C:Users<Your Username>Desktop>ReactJSApplication>type nul > main.js C:Users<Your Username>Desktop>ReactJSApplication>type nul > webpack.config.js C:Users<Your Username>Desktop>ReactJSApplication>type nul > .babelrc
- Set the Compiler, Server Loaders respectively:
Open the webpack.config.js using Notepad++ or Visual Code, add the following code snippet given below. By this change, we would be setting the webpack entry point as main.js, and output path will be the path where the bundle application will be served, and development port is set to 8001 which can be changed to any port of your choice (but it should be open for use).' }) ] }
Once the above change is done, open package.json in Notepad++ or Visual Code and delete the test, echo, and exit 1 entries under the scripts object. This is not required as we wouldn’t be doing any testing in this section after this installation, but add start and build commands instead. .package,json file that we created sometime back.Remove the test data and this data in the script portion.
"start": "webpack-dev-server --mode development --open --hot","build": "webpack --mode production"
Changes required to setup the index.html, App.js and main.js:
index.html is a regular HTML file. Here, we are adding the following code div id = “app” to mark it as the root element and also we will be adding index_bundle.js script, to mark that is our bundled application.
<!DOCTYPE html> <html lang = "en"> <head> <meta charset = "UTF-8"> <title>React App</title> </head> <body> <div id = "app"></div> <script src = 'index_bundle.js'></script> </body> </html>
App.js is our first React component which will render a simple Hello, World message on successfully starting the React server.
import React, { Component } from 'react'; class App extends Component{ render(){ return( <div> <h1>Hello World</h1> </div> ); } } export default App; .babelrc file that we created sometime back.
{ "presets": ["@babel/preset-env", "@babel/preset-react"] }
Running the React Server:
The steps until now should ideally complete the installation of React on your system and for us to test it, we need to start the React server using this command:
C:Users<Your Username>DesktopReactJSApplication>npm start
This shows the port that we used to open in your favourite browser, and once when we open, it shows something similar to the following (which confirms your React setup is all done without any issues):
If you want to generate the bundle file, then you will have to execute the build command as like this (this will generate the bundle under the bundle folder of the installation directory):
C:Users<Your Username>DesktopReactJSApplication>npm run build
2. Install via the create-react-app command:
React can also be installed using the create-react-app command which is far more easy than what we have seen earlier (with Webpack and Babel dependencies). Let us dig into the installation process now:
- Install the create-react-app package:
The installation process doesn’t change much when it comes with npm, take a look at the command below:
C:Users<Your Username>Desktop>npx create-react-app myapplication cd myapplication npm start
| https://blog.codehunger.in/reactjs-environment-setup/ | CC-MAIN-2021-43 | en | refinedweb |
I am getting an 'AttributeError: 'ADC' object has no attribute 'vref_to_pin()'' error when I try to use the ADC library in micropython on a lopy4
I am working with a lopy4 module for a contest I am entering. I use the machine.ADC library for getting data from an analog sensor.
I can use basic functions like ADC.init(), but as you know, before getting data from an ADC pin, you need to calibrate the voltage reference of the used pin.
As documented on the pycom docs, the process of calibration is based on the ADC.vref_to_pin() attribute. However, when I try to call ADC.vref_to_pin(), it returns an 'AttributeError: 'ADC' object has no attribute 'vref_to_pin'. The same happens when I try to use ADC.vref().
I must add that the machine library works fine, as I am using the machine.I2C library just fine.
Here is the basic code I am trying to run:
import pycom import machine adc = machine.ADC() voltage = adc.vref_to_pin('P22') print (voltage)
i think the function does not return any thing. it just connects the internal 1,1 V to a pin
so voltage does not become anything.
what software version are you running. if i run
adc.vref_to_pin('P22')
i get nothing
if i run
voltage = adc.vref_to_pin('P22') print (voltage)
i get None | https://forum.pycom.io/topic/4608/i-am-getting-an-attributeerror-adc-object-has-no-attribute-vref_to_pin-error-when-i-try-to-use-the-adc-library-in-micropython-on-a-lopy4 | CC-MAIN-2021-43 | en | refinedweb |
Important: Please read the Qt Code of Conduct -
why when i want copy (with memcpy)struct array to char array , character array is null??
- stackprogramer last edited by kshegunov
why when i want copy (with memcpy)struct array to char array , character array is null??
#include <iostream> #include <string.h> using namespace std; int main() { struct group{ int num=1; int age=2;}; struct group a[17]; int m = sizeof(a); char b[200]; memcpy(&b[0],&a,sizeof(a)); cout << "Hello World" <<n<< " "<<m<<endl<<"b='"<<b[2]<<"'--"<<endl; return 0; }
you can see that output is null, why we can not copy struc array to char array??
thank in advance
sh-4.2$ main Hello World 136 b=''--
[Moved to C++ Gurus ~kshegunov]
- mrjj Lifetime Qt Champion last edited by
What are u trying to do ?
The list (group) is structs and you try to copy a struct to one char ?
That can never really work. It won't fit.
The struct is 2 ints and how would that fit into one char `?
Can you explain what you want b (array) to be ?
- stackprogramer last edited by
@mrjj thanks
i want to copy struct to char array not one char ....
i want to use this for send on udp socket. new array char is send for other ip with this binary form,
i don't want to use Qbytearray, i should only use char array, i am strict on this method.
to add to @mrjj you got a couple of issues to observe.
- byte order
- size of int
- byte alignment
In your case you are running into the byte order issue, I guess. This is dependent on processor you are using. The size problem depends on the OS and compiler. Also there is the byte alignment which changes the size of your structure. When you are using a 64 bit compiler you might problems with the size of b.
- jsulm Lifetime Qt Champion last edited by
@stackprogramer Instead of hacking around with low level stuff you should take a look at
@stackprogramer
You well understand what memcpy does?
memcpy(str2, str1, 10);
The above line copies the first 10 characters of str1 to str2. | https://forum.qt.io/topic/80200/why-when-i-want-copy-with-memcpy-struct-array-to-char-array-character-array-is-null | CC-MAIN-2021-43 | en | refinedweb |
First I need some data to expose as JSON, so I will create a small service class that generates some data based on the following entity:
public class Car { public int Id { get; set; } public string Make { get; set; } public string Model { get; set; } public int Year { get; set; } public int Doors { get; set; } public string Colour { get; set; } public decimal Price { get; set; } }
The simple service will have one method that conforms to an interface, generating and returning a list of cars:
public interface ICarService { List<Car> ReadAll(); } public class CarService : ICarService { public List<Car> ReadAll() { List<Car> cars = new List<Car>{ new Car{Id = 1, Make="Audi",Model="R8",Year=2014,Doors=2,Colour="Red",Price=79995}, new Car{Id = 2, Make="Aston Martin",Model="Rapide",Year=2010,Doors=2,Colour="Black",Price=54995}, new Car{Id = 3, Make="Porsche",Model=" 911 991",Year=2016,Doors=2,Colour="White",Price=155000}, new Car{Id = 4, Make="Mercedes-Benz",Model="GLE 63S",Year=2017,Doors=5,Colour="Blue",Price=83995}, new Car{Id = 5, Make="BMW",Model="X6 M",Year=2016,Doors=5,Colour="Silver",Price=62995}, }; return cars; } }
This service is registered with the ASP.NET Core Dependency Injection system so that it can be made available throughout the application:
public void ConfigureServices(IServiceCollection services) { services.AddMvc(); services.AddTransient<ICarService, CarService>(); }
JsonResult in a Razor Page
Because Razor Pages is built on top of the ASP.NET Core MVC framework,
primitives from MVC are available to PageModel files.
One of those primitives is the
JsonResult action result which serialises data to
JSON and returns is as a response with the content type set to
application/json. Therefore you can configure a Razor Page to
deliver JSON. The following example shows the PageModel file content for a
simple Razor Page (GetCars.cshtml) that is designed solely to return JSON:
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc.RazorPages; using RazorJSON.Services; namespace RazorJSON.Pages { public class GetCarsModel : PageModel { private readonly ICarService _carService; public GetCarsModel(ICarService carService) { _carService = carService; } public JsonResult OnGet() { return new JsonResult(_carService.ReadAll()); } } }
The service is injected into the PageModel constructor and the data is
returned as a JsonResult. To make the JsonResult type available to the PageModel
file, you need to add
using Microsoft.AspNetCore.Mvc; to the top of
the file. You add a place in a different page for the results to appear:
<ul id="car-list"></ul>
And a snippet of jQuery to make the call to the page:
@section scripts{ <script type="text/javascript"> $(function () { $.get('/GetCars/').done(function (cars) { $.each(cars, function (i, car) { var item = `<li> <strong>${car.make} ${car.model}</strong> (£${car.price})</li>`; $('#car-list').append(item); }); }); }); </script> }
When you run the page, the list of cars appears:
This works fine but creating a Razor Page just to serve JSON doesn't feel
right. Razor Pages are intended to generate UI, not act as a data service. You
could instead use an existing page and add a
named handler to deliver JSON. Let's alter the method in the example page to
adopt this approach by renaming
OnGet to
OnGetCarList:
public JsonResult OnGetCarList() { return new JsonResult(_carService.ReadAll()); }
Then we change the actual Razor Page so that the special
handler parameter becomes a
route parameter rather than a querystring parameter:
@page "{handler?}"
Now we can call this method from client-side code:
$.get('/GetCars/carlist').done(function (cars) { $.each(cars, function (i, car) { var item = `<li> <strong>${car.make} ${car.model}</strong> (£${car.price})</li>`; $('#car-list').append(item); }); });
This is a bit better in that we are not creating a bunch of Razor Pages purely to serve data, but this kind of piggy-backing of a resource that is intended to generate UI still feels a bit like the old PageMethods approach that Web Forms offered.
JsonResult from an MVC Controller
Since MVC primitives are available to a Razor Pages application, you can use an MVC Controller to deliver JSON. You can try this out by adding a folder named Controllers to the application and then right click on the folder and choose Add... Controller (if using Visual Studio). Then choose the Empty Controller option from the resulting dialogue and name it CarsController (plural). Replace the content with the following:
using Microsoft.AspNetCore.Mvc; using RazorAPI.Services; namespace RazorAPI.Controllers { public class CarsController : Controller { private readonly ICarService _carService; public CarsController(ICarService carService) { _carService = carService; } public JsonResult Index() { return Json(_carService.ReadAll()); } } }
Once again, you inject the CarService into the controller via its constructor. The car data is obtained in the Index method and returned as JSON to the callee. The same client side code is use but the URL is changed:
@section scripts{ <script type="text/javascript"> $(function () { $.get('/Cars/').done(function (cars) { $.each(cars, function (i, car) { var item = `<li> <strong>${car.make} ${car.model}</strong> (£${car.price})</li>`; $('#car-list').append(item); }); }); }); </script> }
This certainly feels like an improvement, but there is still another (possibly better) option.
Web API
The final option is to use a Web API controller. Web API is designed specifically to provide data services over HTTP. It is also easy to work with in ASP.NET Core as its part of the framework, unlike previous versions of ASP.NET. Finally, in the context of this discussion, the default data format that Web API works with is JSON.
Web API provides RESTful services, that is resources available over HTTP that respond in specific ways depending on the HTTP verb that is used for the request. The HTTP verbs typically map to standard CRUD operations as follows:
To test this out, right click on the Controllers folder and choose Add... Controller. This time, choose API Controller - Empty and name the controller CarController (singular). Amend the existing code as follows:
using Microsoft.AspNetCore.Mvc; using RazorAPI.Models; using RazorAPI.Services; using System.Collections.Generic; namespace RazorAPI.Controllers { [Produces("application/json")] [Route("api/Car")] public class CarController : Controller { private readonly ICarService _carService; public CarController(ICarService carService) { _carService = carService; } // GET: api/Car [HttpGet] public IEnumerable<Car> Get() { return _carService.ReadAll(); } } }
The controller is decorated with a couple of attributes. The
Produces
attribute specifies the content type that the controller works with, and the
Route attribute specifies the URL at which the service is available.
This controller only contains one method which responds to all
GET requests,
resulting in the collection of Cars being returned as JSON. You can see examples
of other operations at Working With JSON on
learnrazorpages.com. And this is
the key point about Web API resources- they are designed ot work with a variety
of CRUD operations and so are much more suitable if you want to do more than
just produce read-only data to be consumed by client code.
Once again, the only alteration required to the existing client code to make it work with the Web API approach is a change in the URL that's called:
@section scripts{ <script type="text/javascript"> $(function () { $.get('/api/car/').done(function (cars) { $.each(cars, function (i, car) { var item = `<li> <strong>${car.make} ${car.model}</strong> (£${car.price})</li>`; $('#car-list').append(item); }); }); }); </script> }
Summary
This article has looked at a number of ways to work with JSON in a Razor Pages application. The first option was a Razor Page handler method producing a JsonResult. While this works, it's not recommended - unless you are providing a small number of read-only operations. If that's the case, you should look to re-use existing pages with named handlers rather than cluttering your Pages folder with files that will invariably add routes to your application but are not intended to be navigated to.
An MVC Controller providing JsonResults offers an improvement over a Razor Page, in that you can work with them without having to add superfluous view files to the application. Web API really shines if you want to offer a full range of CRUD services in a RESTful manner - especially if you want to expose those services to third parties. | https://www.mikesdotnetting.com/article/318/working-with-json-in-razor-pages | CC-MAIN-2021-43 | en | refinedweb |
Having swipeable components in your app is very useful for actions such as deleting and archiving. The swiping ability inside your app brings down the rigid nature of user interface and increase the flexibility of app usage.
Here, let’s create a simple swipeable component in react native using react native gesture handler library. React native gesture handler is a very useful library to manage gesture actions. If you are using react navigation library then you may be already familiar with react native gesture handler.
First of all, install react native gesture handler using any of the following commands.
yarn add react-native-gesture-handler
npm install –save react-native-gesture-handler
For iOS, run the following command from the ios folder of your project.
cd ios
pod install
If you are using react native version less than 0.60 in your project then run the following command too.
react-native link react-native-gesture-handler
After that, navigate to yourProject/android/app/src/main/java/com/yourProject/MainActivity.java file and add some changes as given below. Add the lines which start with + symbol. Don’t forget to remove + symbol from your code.); + } + }; + } }
The installation part is over and now, let’s dive into the code.
Swipeable is a component provided by react native gesture handler which can be used to create swipeable rows. It is imported from the library as given below.
import Swipeable from 'react-native-gesture-handler/Swipeable'; <Swipeable renderRightActions={this.renderRightActions} renderLeftActions={this.renderLeftActions}> <Text> "hello" </Text> </Swipeable>
This is the basic usage of Swipeable component where renderRightActions show components when swiped right whereas renderLeftActions render components when the row is swiped right. The Swipeable component has many props such as friction, leftThreshold, rightThreshold, onSwipeableLeftOpen, onSwipeableRightOpen, onSwipeableOpen, onSwipeableClose etc. For more details, go here.
I have implemented a simple swipeable row in the following react native swipeable example.
Following is the output of react native swipeable row example.
I hope this blog post helped you. Thank you for reading! | https://reactnativeforyou.com/how-to-create-a-swipeable-component-in-react-native/ | CC-MAIN-2021-43 | en | refinedweb |
GREPPER
SEARCH
SNIPPETS
USAGE DOCS
INSTALL GREPPER
All Languages
>>
Whatever
>>
pip list outdated
“pip list outdated” Code Answer’s
pip list outdated
whatever by
JThayil
on Feb 28 2021
Comment
0
# List Outdated Pip Packages py -m pip list -o
list all packages installed with pip
shell by
poeblu
on Aug 13 2020
Comment
0
pipenv lock -r
Source:
list all pip packages
python by
Elated Eagle
on Jun 21 2020
Comment
-2
pip3 freeze
Add a Grepper Answer
Whatever answers related to “pip list outdated”
check pip version
pip version
pip version command
python pip version check
To check pip version
WARNING: You are using pip version 19.2.3, however version 21.2.4 is available.
how to check if pip is installed
python pip not working
python how to see what pip packages are installed
empty pip list
list all pip packages
pip packages list
pip list packages
python update installed packages
windows where are pip packages installed
update all pip packages
pip problem linux
python pip past
pip list upgradable
how to see pip installed packages
upgrade pip error
pip3 has no installation candidate
pip install quiet
update pip and setup tools
how to verify if pip installed a package
pip list in cmd py2
Update all packages using pip on Windows
Whatever queries related to “pip list outdated”
check pip3 installed packages
command to list all the installed packages in python
how to check all the installed method in pip
how to see a list of all packages pip
list all pip install
where is python 3 installed
pip see list of installed packages
how to list things installed with pip
list packages installed in python
python pip install all packages
see all pip installed modules
get all pip installed packages
how to see all installed packages in the environment python
python check all installed packages list
install python package all versions
list all python packages pip
where pip installed packages
list pip environments
python3 packages
python pip show installed packages location
how view all pip package installed in an environment
search installed pip packages
pip see all packages
pip show installed package
how to install all packages through pip
get all the python packages that are installed
pip3 list installed
see list of python packages installed
pip display installed packages
pip get list of installed packages
find all packages installed pip
how to check packages installed in python
get all pip installed packages in a file
get all pip installed packages in a folder
how to list installed packages python
check all pip packages
list of python pip packages
get pip installed packages
python pip list all libraries
how to get outdated library list pip
pip packages installed folder
pip list installed software
how to check all pip installed packages
pip show outdated
pip list installed packages
pip show packages installed
python check packages installed
see all installed packages python
show all pip packages
list pip installed packages
list python packages installed
how to see all the packages installed in python
python get list of all installed packages
python pip check installed packages
get pip list and install all of them
list installed packages pip
check all packages installed python
find all pip installed packages
list all pip packages installed
pip get all installed packages in a directory
pip get all installed packages
where pip packages are installed
see installed pip packages
how to get installed packages pip
pip command to know all the installed packages
how to see pip installed packages
how to get list of all installed packages python
how to get list of installed pip packages
list installed packages in pip
show installed python packages
pip outdated packages
check packages installed python
how to check all pip packages on your system
pip all packages
display all libraires installed pip
see the packages installed in your python
pip all installed packages
get a list of all pip install
see pip installed packages
see pip packages
find all packages installed in python via pip
how to list all packages in python
list packages installed by python
how to see the installed packages in python
python show install packages
check all python packages installed
how to list installed python packages
pip list installed develop
see all python packages
python see list of installed packages
pip list package list
pip list installed packages with version
list installed packages python
how to see all python packages installed
pip list of installed packages
print all packages pip
get installed pip packages
pip list all modules
how to check the packages installed in python
how to find where packages are installed via pip
check all pip package
pip install list of packages
install all pip packages
how to check all python packages installed
to see all installed packages in python
show all packages installed python
show packages installed python
get list of all installed packages in python
command for see list of packages installed python
list all packages installed python ?
get list of pip installed
python get all installed packages
list all installed packages in an environment pip
list all install packages in an environment pip
list all installed python packages
get installed packages python
pip3 list --outdated
check where pip installed packages
python pip install list of packages
list all the installed packages in python
print all installed pip packages
get all installed python packages
list pip packages in terminal
pip find all used packages
python list installed pip packages
how can I see the packages installed in python
pip installed libraries
install all packages python
how to get list of installed packages in python
python list installed packages
check all packages in python
how to list all pip packages installed by user
list all packages in python downloaded
pip show where package is installed
how to list package by pip
pip installed packages directory
python see all installed packages
pip show all installed packages
check the packages installed in python
get outdated packages pip
python show installed packages
list pip packages
listing all the packages in python
pip installed modules list
list all installed packages pip
python show all packages
pip install a list of packages from list
how to check which packages are installed pip
check the installed packages in python
pip list installed packages name
check packages installed in python
how to list all the packages installed in python
how to see all pip installed packages
how to get list of installed packages from pip
show installed packages python
how to show all installed pip library
how to check all install packages pip
pip list outdated now how to update
how to list installed packages in python
how to install all pip packages
pip get all modules installed
pip list available packages
all installed packages python
check packages installed throught pip
command to get all pip packages
list installed library pip
see all pip packages installed
pip list all installed packages
python get list of installed packages
list installed packages pip3
check all python installed packages
show all installed packages python
list of all packages in pip
pip list all manually installed packages
how to get a list of installed python packages
python packages list installed
show all installed pip packages
list of pip packages
view installed pip packages
list of all pip packages
list all packages installed in python
get all installed packages python
pip install a list of packages
where do pip packages get installed
see all packages installed python
python check all installed packages
pip list installed modules
python pip list all installed packages
list all install python packages
get list of packages installed python
where does pip get the list of installed packages
get all packages installed python
see what packages available with pip
pip packages list
list all pip packages with their path
pip install all packages
see installed packages pip
see all modules pip
list all python packages installed
pip view all installed packages
how to list all python packages installed
see packages installed python
pip show installed packages
how to see the packages installed in python
see all packages pip
python see installed packages
pip check all packages installed
how to check all the packages installed in python
pip list installed packages and versions
how to see packages installed in python
check installed packages pip
pip check outdated packages
list conda packages
pipenv list packages
how to show all packages installed in windows
python install package list
List packages installed pip
pip seeing installed packages
list of paid pip packages
pip list user packages
check my python package'
what python package installed
how to show pip install libaries
check package installed python
list pip versions
Pring all modules pip
list pip instalation
how to check python libraries
pip get all packages
pip show all modules installed
how to check pip installed packages
show packages pip
how to get all installed modules in pip
show installed packages pip
python compare pip3 list
installed packages command python
pip show installed
check installed pip packages
how to list package with pip
check python packages
python installed package list
how to check pip packages installed
pip command to check all the packages that has been installed
how to see al livraries installed pip
pip show all
how to check current python libraries all installed
where all the python packages are installed
where are my pip packages installed
how to list python version packages installed
how to list pip packages on ubuntu
how to check what pip has installed
read all installed packages python
python see installed modules
pip check installed package
python get installed packages in python
python get installed packages script
python pip list installed
show installed pip packages
see list of installed packages python
find where a package is installed python
check how many packages install pip
how to check all installed modules in python
pip3 list
python see libraries installed
python see all versions of packages
python script to check list package linux
find the packages intalled in python3\
check modules that are install python
list of python packages installed in mac
list pip packages installed
how to see list of packages installed in python
pcheck module in python
pip list all moudles
python get all installed pip
pip --list
all pip libraries
python get library list
python pip how to see all packages
python pip list all packages
python pip modules list
how to see what modules are installed in python
terminal command for seeing what python modules are installed
how to know the available packages in pip
pip how to know the available packages
list all packages installed pip
how to get the list of installed packages in pip
pip check module installed
install a list with pip
find out the list of command in a package in python
python see all packages installed
pip list oudated
how to list python libraries installed
how to check the list of packages by pip
check installed libraries python
python check all packages installed
figure out what all is in pip list
discover pip list items
pip list items
how to list all pip installed packages
list pip user installed packages
what are all the pip packages available
python list packages non pip
how to check all the pip installed packages on my pc
check what packages are installed in python
how to see what libraries are installed in python
pip3 installed packages
python pip install package list
list of installed packages python
how to see all packages installed in python
check python installed packages
install everything in pip list
use pip to see installed packages
how to get a list of pip packages
show pip installed packages
list of installed dependences pip
how to see installed packege in python
pip commands to show a list of installs
view installed packages pip
pip check what library install a package
python check package installed
pypi list available packages
get list of pip installed packages
check python packages installed
checking all the python installed python packeges
list all pip installed packages
show packages installad in python pip
what packages are installed with pip
where are all the pip files
view pip lis6
pip outdated
show installed packages in python
check pip installed list
list packages python
python all pip pacages
python see packages
how to list pip3 package installed
check which python packages are installed
how to list all the pip installed packages
how to list python packages
how to see installed packages in python
pip show all modukes
how to check a python package is installed in ubuntu
check module directory pip list
pip list --outdate name only
pip list name only
pip list all outdate modules
pip list >
python how see list of installed packages by pip
python pip show installed packages
pip show all packages
get installed modules pip
liat python packages
list python packages
list all pip libraries installed on pc
how to check which python library is installed
filter 20.2 version from output of pip3 --verison
what packages installed on pip
pip list of all packages
pip list all
list installed pip packages
python show packages
list all pip3 packages
find out all packages installed pytho
pip list packages installed
pip list packages versions
list packages installed by pip
pip get all versions of package
python list all pip install packages
python show pip list
find installed packages pip
how to view pip installed packagesd
python pip list
pip package list
uptodate list python
uptodate øist python
how to find system pip installed packages
python get installed libraries
check all pip installed packages
what directory to find all installed packages by pip
python all pip
how to know the installed packages in python
pip list outdated output
pip list outdated
python3 pip list
print all pip packages
show pip packages
command to check list of python packages installed
how to see libraries in python installed
list pip3 packages
pip3 list installed packages
pip check packages
pip command to check installed packages
pip get installed packages
see all the modules I pip
list all packages in python
pip list comand
list packages installed python
pip list modules
how to check all pip installed packages in python
show installed package list python
list installed python packages
more than one pip installed packages
pip show list of modules
see installed packages python ubuntu
python list all installed packages
pip installed list
pip how to know the packages installed with packages required
check what pip has installed
show all python packages in cmd
check list of python packages installed
pip list installed
list of pip installed packages
how to view all pip packages ubuntu
list all libraries installed in python
python list packages
how to find out the list of installed libraries pythhin
how to check pip package installed
python check installed packages
pip3 get list of installed packages
how to check installed packages in python
pip3 get installed packages
pip see all installed packages
to see all applications in pip
check pip packages are the latest
list a package version in pip
how to list installed python packages via pip
cmdview python modules
show all python packages installed
checking pip registry
how to know which packages are installed in python
how to see all installed libraries in python
pip list all explitly isntalled packges
pip output all installed packages
how to show all outdated packages in python
how to list pip installed packages
pip all installed lib
terminal check all pip installs
check pip install list the latest installation
pip3 show all installed versions
list of python packages installed
check installed packages in python
list all packages installed with pip
where can i see my installed pip packages
see all pip installed packages
pip installed libaries
check installed libraries pip
list not install packages pip
pip list local
check pip packages
defult pip pasckages
defualt pip libraries
see all installed pip packages
get all python pip
pip list command
python pip list packages
pip list packages
where all the pip python
python show pip installed packages
pip install list
pip list windows
pip list application versions
pip list all packages
pip list version of package
pip installed packages
see all pip packages
list all installed pip packgaes
pip see installed packages
pip show list of packages
pip list
pip check installed packages
list python pip packages installed
pip list python
pip list python 3
pip list pythong version
pip check module
pip options list
list all apps pip
how to list pip packages with version
how to list pip packages
show pip list
list all pip packages
More “Kinda” Related Whatever Answers
View All Whatever Answers »
incompatible implicit declaration of built-in function ‘malloc’
a pointer to a bound function may only be used to call the function
notepadd++ ledt ti rigth
notepad++ switch between left to right and right to left
learn c++
getline doesn't work visual studio
c++ stirng
arduino format specifiers
arduino stepper motor code
download arduino ide in raspberry pi through terminal
define args discord
implicit declaration of function ‘strtok_r’;
implicit declaration of function ‘getline’
code for led blink in arduino
arduino write to console
number of cores c++
the current thread cannot
wpf invoke
iif arduino
runif in r example
arduino for loop
arduino code analogwrite
tic tac toe programmiz in c
string length arduino
c code to add two numbers
arduino string to int
arithmetic exception
how to blink inbuilt led in arduino uno
what is meaning of product *= in c
flux pointer exception
arduino connect accelstepper 2 wire
div en langage c
cjne instruction makes
best calcculator c program
raspberry pi memory command
ffgf
single instruction multiple data
why do we use * while declarating pointer
how to fix Print(hi)
arduino even or odd
come creare variabili casuali in c
what is the difference between a macro and a variable
lhapüasdjadj+#asd
c send struct over message queue
arduino button next array
compare float values c++
cls in r?
note++
var i_s_v = (ct).Sell_I_Volume
how to define an unsigned signal in VHDL
arduino send messasge
comment in assembly language
cannot open source file "iostream"
g++ header error
objective-c
octave pass function as parameter
ascii 167
valid triangle in c
ros launch file with args
ultrasonic sensor arduino code
safe scanf c
arduino digitalread
bash command check 2 arguments
ios_base::sync_with_stdio(false);cin.tie(0);
c guessing game
get cor value out of cor.test r
casting arduino
c check dir/file
how compress string in c
how to multiply in arduino
attachinterrupt arduino
how to add two numbers in c
arduino print array
what does fml stand for
c style array
modulo golang
how to read keyboard input in c
switch type golang
Segmentation fault: 11 nasm
queue with linked list in c
variadic macros
printing hello world without using header file in c
strcasecmp in c
base sync cin.tie
fastio cpp
ios base sync with stdio
fastio in c++
c allocate memory for struct
pushad x86
arduino if-else
factorial using recursion in c
c style string
What would be the DFS traversal of the given Graph
stl import c++
print ascii value in c
is not equal to arduino
how to print something in two different lines in c
arduino substring
long unsigned int printf c
what is ci
which programming language is used to program arduino
how to declare variables in assembly
valgrind
size of pointer in c
c code to calculate power using recursion
double data type format in c
nop instruction
outlook mac attach email
entete
entete c/c++
using a keybpad in arduino
max size for int c
octave if-else
c how to declare a constant
c code to find power of a number
apowb program in c
array arduino
declaring a function in matlab
memcmp c
null pointer exception
hc sr05 arduino
abs function in c language
Why volatile keyword is used for?
interrupt arduino
What’s null pointer exception?
arduino l298n code
difference between pointer and reference
what is the function prototype for fscanf()
For Loop in C++
cannot open source file bits/stdc++.h
cin.getline
range int in c
arduino code to rgb led
print matrix c
how to connect a button arduino
input output string in c
c program for swapping of two numbers using temporary variable
getting string input in c
c program to print prime number from 2 to n
toggle led arduino
length arduino
arduino pow()
binary search in c
c multiple definition
c code factorial function
how to count lines in a file c
arduino char to int
variable parameters in c
variable arguments in c
%= in c
How to turn a servo Arduino
macro mod do
arduino taster
char array to int arduino
arduino what is #if
how to make a function return a string c
buzzer tone arduino
vgg16 architecture
esp8266 arduino
random function c++
how to assign struct address to the pointer
if arduino
how to input multiple strings in c
arduino digitalwrite
bash function return value
gotoxy function in c
clang cpp compile command
int and string concatination cp[
winmain in c
how to make a class c
#include <bits/stdc++.h> use
arduino pinMode
how to install c
function maltab
matlab function
how to setup arduino code
#include <stdio.h>
pipelining in computer architecture
args in shell
console readline c
c print to stderr
Invalid argument supplied for foreach() in C
what is ci cd
c struct array
arduino if else
queue using c
gsoc
run a motor using arduino
clrscr in c
c check if argument is integer
How do I define variables in arduino
segmentation fault
c++ list add
take long long input in c
set number in vi
struct
how to use timer register in arduino
#include <iostream> using namespace std; int main() { int n; cout << "Enter an integer: "; cin >> n; if ( n % 2 == 0) cout << n << " is even."; else cout << n << " is odd."; return 0; }
arduino
arduino sd card module
gdb segmentation fault trace
how to make pointers in c
files .h in c
header file headers
random number c custom rand
c rand range
start serial monitor arduino
assembly language 16 bit addition
c ? operator
queue program in c
c basics
c program for array
String as Parameter on C
c stat example
what is float in c
getch () in c
struct in c
how to initialize a struct in c
memset c
backtick
C print 2D array
How to use pointers in C
cccccccccc
sprintf R examples
64 bit assembly Hello world
collegamento 2 arduino codice
ex: C hello world
arduino and
escape sequence in c
addition.c
c undefined reference to pow
#include sdfat.h arduino
Segmentation fault (core dumped)
#include int main(){ int i,j; i=j=2,3; while(--i&&j++) printf(%d %d,i,j); return 0; }
Which condition will print hello? var a=2; var b=3; if(a___?___b){console.log(“Hello”);}
arduino rgb led with pushbutton
wc show number of lines in a folder
fdgs
for arduinp
arduino for
cpp get exception type
pwm code for led arduino
macro mod loop
c how to printf a vector
pointer c
how to change directories in c
you wanna import math on c++
compile c code to llvm
Postfix evaluation in c
C dynamic array
print short in c
C random array
Methods of interprocess communication
struct c overload
string arduino library
how to write a function in matlab
hello world c
how to empty array in c
#include <stdio.h> void main() { int i = "hello"; printf(i); }
double pointer malloc in c
how to initialize a queue in c
max function c
c why do we have to use pthread_join
pow not working c
create array of strings in c from user input
number pattern in c
data structures in c
random c++
C code to MIPS assembly converter online
For loop in C
c read numbers from file
Malloc
declare structure in c
lower bound upper bound cpp
function in bash
compile c program code
pointer to an address
scanf c library
emplace_back
what does emplace_back back return in c++
%d in printf in c
c++ in unity
C# Stream
malloc in c
online c compiler
variable array arduino
best c compiler
c random list
instance for c in struct
leap year in c
8086 example hello world
change data type inline in c
arduino ldr brightness controll
fwrite in c
printf not working after signal()
long form of tcp
how to get variable from another function in c
0-main.c alx-coding
unity <> f__mg$cache
void PinCallerReceive1( void *Data );
passing reference to thread c++
movslq in assembly x86
fputc in c
interface grafica biblioteca WIN32 em Linguagem c
code name bybit
how to print the process id in c
C# movement
Write a C program to take 10 employee data and store/read it in /from the file
Write a C program to Implementation Stack Using dynamic Array.
gotoxy function in c in code blocks
assembly lea
adc instruction in 8086
c program for array stackflowover
Dyanamically allocating memory for a structure
what ci library
procv in R
Macros
mov command assembly
print char* address C
error: *.cpp: Invalid argument
tri par selection en c
array can not pass by function in c
bmpcc4k
asciidoctor code
error in global declaration in abap
!= in f#
Arduino RTC
loops questions on c
vc meaning
arduino rgb controller
c++ template policy
calloc in C++/C
<function nilai_bmi at 0x7fdf90b211f0>
Objective-C switch statement
arduino ide visual studio code arduino.path
dequeue function in queue in c
_cat/tasks
arduino indexOf
programma che fa una procedura e somma due parametri assembly
c share variable between forks
#include<stdio.h> int main { int arr[ 5]), i=0; while(i<5) arr[i]=++i; for i=0; i<5; i++) printf("%d", arr[i]; return 0;
output
error: invalid conversion from ‘void*’ to ‘char*’ [-fpermissive] mmap
echo intval
Program C Pola Bintang
atoi
If you do not know the number of arguments that will be passed into your function, there is a prefix you can add in the function definition, which prefix?
how to initiate pointer array with NULL in c
user define function in c
c print only in debug mode
add strings in lua
c triple pointer
mallorar
error in global data in abap
difference between input and input_pullup arduino
21. What do you understand by the following two declarations? a) const int *pOne; b) int const *pTwo;
octave define local function
program in c that uses cipher shift
floating array in c
arduino alphanumeeric variable
esomeprasol
jump if greater than assembly
Calloc C++
copy struct to buffer
program to perform fundamental string functions in c
cp alternative with speed and progress
sfml en c
Multiple tasking in arduino
how cgpa is calculated
fnaf
clang does not recognize std::cout
how to know ROS path
storing multiple string values in an array in C
add c program
g++
What is (\d+)/(\d+)
void main
Matlab function that can tell when no person is present
how to trace efficiently
command parse pipe output
table of strings in c
clang pass argument to plugin
panagram in c
check for lib c
c xv
what is the diffrence between getline and cin
c64 basic define variable
write a program to check leap year in R
how to write 2d array from bin file in c
function param pointer to struct prototype in c
What is the code for Arduino Board reset
bash get all function names of a c file
i cant use print
golang function exaple
operazioni aritmetiche c++
in instantiation of function template specialization 'std::__1::__gcd<int>' requested here
clang++ error limit
create static array in c
struct anidadas en c
output of this
promt user input C
left factoring program in c
echo ros path
error: out-of-line declaration of a member must be a definition [-Wout-of-line-declaration]
corsair fan led broken
passing an array to a function in c
arduino sd card reader
script in c
std::list insert
en c code pour affichage
how to runa c file executable in ubuntu
C function is a linked list empty
recursion function r
++i v.s i++
c ++ The output should be (abc),(def),(ghw)
glab variable
tutorialspoint.com interprocess communication
grove relay photon
arduino binary representation
Recursive version of LS in c programming
#include <stdio.h> int main() { char array [100]; scanf("%s", array); printf("%s",array); return 0; }
arma 3 vehicle initialization config
command parameter wpf
makros in c
deno stdin
inventor of cpr
Variabili globali c++
c++ system() from variable
What is the difference between an ADC and a digital input pin?
RESW assembly instruction meaning
why do we put inside parenthesis when incrementing pointers in c
namespace.usingvar
puts()
adc project using lcd mikroc
missing number
arduinodht11 lcd
Convert arduino String to C language String
number in c
icue led broken
variadic macros c
disadvantages of using contiguos allocation method file system
plot in octave
pointers in assembly
isogram c
golang go func
if(pointer) in c
csvWriter.WriteRecords custom header
how to get pid of c process
arduino loop
c in to str
Variadic C/C++ Macros
bdd process
octave two outputs of a function
arma 3 ternary operator
declare a structer in cpp
esp32 AsyncTCP look for stm32 header
if in octave
man write c
condition variable operating system
Operatore ternario c++
assembly code to word
c flush filed discriptor
how to convert bcd to decimal in c
how to modulo in c without %
gcc compile multi thread
missing number in c
string back function
determination data type in c
change struct name after defining c
arduino how to verbose upload
f# syntax
std::enable_shared_from_this include
8085 microprocessor code
convert c program to assembly language online
main proc near
c programm pointer change in function
Write a program for the simulation of the following file allocation strategies a)Sequential b)Indexed c)Linked
how to dereference a variable twice in tcl
csvwriter write header with space C#
reverse number in c
cgi-sys 669 787 489 list
c in unity
/* Program to print %*/
Compiling Example Using ADA
lw instruction
if statement octave
College application c++
A static method avg High Temp() that receives no parameter
assembly strlen
lcd i2c print function not excucuting
arduino ble led dimmer code
assembly from c issues
how to modulo in c without use the operator
what is %d\t in c
argument about changing school uniforms
Tower of honie without recursion in c
use pipe output as argument
remove buffer after char in c
C++ variables
; }
what do I return in void main function?
how many types of variables are there in c language
c matrix
how to do add operation in ARM
What will be output when you will execute following c code? #include<stdio.h> int main(){ printf("%d\t",sizeof(6.5)); printf("%d\t",sizeof(90000)); printf("%d",sizeof('A')); return 0;
c flag gcc
how to know a type of a numbe in c
graphics is not a member of eventargs
#define in c
nui callback fivem
arduino send message
write a procedure exp(Base,Exponent,Result) prolog
how to check file pointers in c
arduino analogread
binary array display with arduino
c program array prime number
c++ struct use
lua variable
c program to using switch to determine whether entered number is either 0, 1 or 2
which of the following is not a fasta program
monitor arduino code serial out
x86 assembly not instruction
create process bar in c
#include <queue>
arm str example
LP2T2021
include for sprintf
how to define push back as pb
how to store string in c
changing data type in one line c program
Representation of data structure in memory is known as:
#include<stdio.h> main () { int a; printf("Enter the number:"); scanf("%d",&a); printf("the number was:",a); return 0; }
remove buffer overflow
swap number in lua
how to compile a c file in linux
c toggle int between 0 and 1
exponential function matlab
std::copy C ++
how to output in green in c
which keyword is used to transfer control from a function back to the calling function in c
bash data types
g_application_run()
create node in c
r o b u x
ControlValueAccessor
struct Camera;
arduino upload code to the attiny
how to compile c code with wiringPi
C++ if and
ejemplo c holamundo
WAP to read and print ‘n’ student details using structure and Dynamic Memory Allocation.
#fff
arduino dht11 lcd 16x2 i2c
c loader
unknown amount of parameters to function arduino
include for sprintf c++
1 f = c
grabar microfono en tarjeta arduino sd
how to get a string input in c
hello world program in c ++ using standard namespace
arduino internal pull up resistor
ctrl+g
buffer overflow in c
while(++i<5)f*=i;System.out.println(f);
ssize_t c
print natural numbers in assembly
sum using for loop in c
c code recursive function to print numbers between two numbers
inverse laplace transform matlab
```c
process.argv
toString method in c++ using sstream
coding in c++ with linux
How to make a Arduino Bluetooth car
template queue in c
if else c language
strtol in c
sending keystrokes in c
Line logger
c "hello world"
c# if else
EXPKEYSIG
read memory access error c programming
echo
stomp
Assembly editing the program stack
open and close lead arduino
c process bar
what can raise segmentation fault
pulp write cplex lp
use MIDI as macro
protocol buffers stream golang
array in assembly
recieving from serial arduino
sprintf trong c
gcc compile with math
r lm write interactions
how to printf n+1 infinitely in c
C++ Dynamic allocation failing
The technique of assigning a memory address to each I/O device in the computer system is called:
while i am using int function in c one extra output is coming
jmp instruction in assembly programming
SparqEE CELLv1.0 linking to arduino
how to devowel string in c program
php over serial arduino
memory is full
shortcut for writing if condition
c swapping array elements
strtok_r c
c function fork
#include <stdio.h> int main() { char *arr = "iaminibgroup"; printf("%d", sizeof(arr)); getchar(); return 0; }
cl'c
#pragma pack(1) in c
bash stack trace caller array
printf("Enter the second number: \n")
assembly language display message
implicit declaration of function ‘getpid’
arduino bool
arduino pullup
what is fork in c
palindrome
palindrome program in c
how do i make my own c compiler
memcpy() C
c++ ifstream open
quicksort in c
strcpy implementation in c
multiple definition c++
execute c program in linuz
what is __name__ == "__main__":
arduino custom pwm
whiel loop in C
using sort function in c
qsort c code
sort in c inbuilt
definition qsort c program
system cls c programming
example ramda pipe
exception out of range c
c function with array parameter
strtol c
what is %u in C
how print triangles in c
scope of variables in c
loop c#
message queue c not
return in void function c
c program to print pid of a process
execute 2 3 positional arguments
int main(int c, char *v[]) { char *c; c=v[1] + v[2] + v[3]; printf(“%c”, c); }
how to calculate the execution time of a program in c
mooc
"write code to change the value of a pointer. write code to change the value to which the pointer points"
att asm stdin
c
arduino-cli add esp32
using pointers to read from microcontroller flash memory
light scheduling arduino
_aligned_malloc
fsid=0
"xargs -0"
%lu vs%ldott
godot
eng to fil
tagalog to english
spanish dictionary
bengali to english
est-ce tu une grande famille in english
eng to span
flexbox align right and left
you-tube
youtube
yoyu
you tube
ytouube
dogecoin price usd
$gme requests python
how to import requests in python
install requsts pypi
ModuleNotFoundError: No module named 'requests'
install python requests check error
mongoose connect
calgary weather
code grepper
authentication vs authorization
what is brainfuck for
ascii art
flex force div right side
dropdown with search box jquery bootstrap
float right flex
searchable dropdown bootstrap
select
anaconda remove environment
delete conda env
conda delete environment stackoverflow
How to set a image as a backgroung image
flutter apk release
list latex
flutter release per abi
flutter build android release apk small
latex bullet points text field form
flutter text field
flutter input text in container
list docker images
how to list docker images
display all image docker
postgres alter user password
alter user password postgres
silicon valley
tailwind text size
stack overflow
brooklyn nine nine
word reference
portainer
docker portainer
cloudflare dns
Module not found: Can't resolve 'react-router-dom'
less equal latex
123movies
movie app
links in md
add link in md
react refresh 404 error
TypeError: argument of type 'WindowsPath' is not iterable
tailwind font weight
czy salad jest policzalne
angular/http deprecated
what is a stored procedure
matplotlib plot dpi -> change format to svg
skal man have nyt pas hvis man skifter nanv
bootstrap link remove underline
what are your responsibilities
godot export vector3
ausnüchtern englisch
guitext is obsolete use ui.text instead
check if a directory doesn't exist
deseq2 design two conditions
tkinter combobox get selected value
\nbproject\build-impl.xml:1030: Deployment error: Starting of Tomcat failed, the server port 8080 is already in use.
windows 10 activate text
networkx remove edge
asp classic connect to database
specification table code
Template parsing error: template: :1: bad character U+002D '-'
what does adi stand for computer science
ImportError: cannot import name 'get_config' from 'tensorflow.python.eager.context'
how to set background to general view in android
godot move node up
tr command in unix
is daddyskins.com legit
noreferrer noopener
how to pass data from activity to fragment
regex special characters to escape
roundup vba custom formula
V is the midpoint of GH. G has coordinates (5, -3) and V has coordinates (-1, 3). Identify the coordinates of H.
hangfire delay job
alcohol
mongoose remove
Attempt by security transparent method 'System.Web.Mvc.PreApplicationStartCode.Start()' to access security critical method 'System.Web.WebPages.Razor.PreApplicationStartCode.Start()' failed.
brendan eich
roblox magnitude
numpy indexing
custom function in r
mongodb insert
what is virtualization
background video not working in iphone
TLS protocol preferences
custom function for woocommerce price format
show databases codeigniter 4
bootstrap temp
how can i make my own jarvis
khatri community explanation
docker portainer
sort an array in descending order
gco switch project concole
blindtext latex
hiudaw
basic config palo alto cli
dataframe from function
date format in django template
google snake
d = {'Mark': 100.0, 'Peter': 50.0, 'John': 25.0}for i, j in d.items(): print (i + ' pays ' + str(j))
hide html element by id
error: src refspec develop does not match any
two point 3D distance matlab
NullpointerException while autowire
png to data uri
high female voice
modal route inside initstate flutter
failed to save NoPermissions (FileSystemError): Error: EACCES: permission denied,
what is palindrome
install rpm ubuntu
How does the FEATURE FILE WORK?
'keytool' is not recognized as the name of a cmdlet
organize imports
Laravel polimorfic faker
adasds
javascript some method
datagridview current row cell value vb.net
dinosaur play
flutter center title ignore button
get all consumer groups kafka
rails find_by order limit
failed to write core dump
StringFormat C#
short integer
firemonkey android ini file read
Clipping input data to the valid range for imshow suppress
mailbox
verify
krakend 405 method not allowed
android studio apk download for pc
set min date in datepickerdialog android
robux.com free
jwt encode
kali install ghost newwork command
@react-native-community_clipboard
latex tabular
delete multiple kafka topics
set height of kendo grid mvc
what is enumeration fingerprinting in hacking
reload ssh config
recovery testing
BloxLife.com
add log4j to classpath in sonarqube
composer failed to open stream too many open files
tldr or tl;dr
Call to a member function getQuery() on array
free robux site
breakpoint hotkey visual studio
Excel does not support datetimes with timezones. Please ensure that datetimes are timezone unaware before writing to Excel.
Module not found: Error: Can't resolve 'laravel-echo' in 'D:\Open Server\domains\laraveluzh.loc\resources\js'
count is inplace or not
dl dt dd bootstrap
zinc nitrate
use npm to update packages to latest version
retrofit android
preview-tablet customizer
how do you do positive api testing
kernel is dead jupyter
FileNotFound
The parameter 'key' can't have a value of 'null' because of its type, but the implicit default value is 'null'.
write sentence multiple times in vim
android studio circular image button
AttributeError: module 'PIL.ImageTk' has no attribute 'Photoimage'
postgres get last value
tailwind grid jit
composer install vendor
adobe premiere reset to default
prevent xss
style rule that displays the footer only when both margins are clear of floating objects
pandas data frame from part of excel easy
Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
How the US president is elected?
ImportError: No module named 'seaborn'
mine cryptocurrency easy
gsap.to
telugu translation to english
exit insert mode vi
select all occurrences
pymongo insert if not exists
Maven Artifact
dude why
react-dom and babel cdn
tired
MongooseError - Operation `users.findOne()` buffering timed out after 10000ms
youtube mp3 convertor without ads
was bedeuted masaka
light orange color code
call of duty black ops cold war download pc torrent
product details page bootstrap
how to increase the delay of leader in ci\\vim]
save output in txt ansible
Error: This contract object doesn't have address set yet, please set an address first.
antlr4
matlab covariance
best challenges in front end development
http response methods
motioneyeos raspberry pi zero w wifi
event target data atributes
get mac temperature
pizza
Warning: require(/home/../wp-includes/rest-api/endpoints/class-wp-rest-application-passwords-controller.php): failed to open stream:
maven spring-boot-configuration-processor install
android fragment fullscreen
readline/readline.h: No such file or directory
Could not connect to Redis at 127.0.0.1:6379: Connection refused
Nginx webp
password in django
How to update all npm packages in package.json
discord.js
Merci à tous ceux qui aident à combattre le coronavirus
how to read excel file in matlab
your ip address has changed. please log in again. whm
AlanTechCo.
DEVELOPER_MESSENGE
ionic 5 "firebasex" plugin grant Permission tutorial
how to use jenkins
Save current page as HTML to server
excel formula to find last space in string
decision table testing technique
latex tutorial
bash remove first and last quotes
how to make gradle task copy files ignore certain files/folder
apex truncate string if it is longer
what do gamma rays do in cancer treatment
view history is remote desktop
fat terry b99
edited
how to add one plus one
decisiontreeclassifier sklearn
how to promote fiverr giga
como llamar un recurso en layouut android studio
a example for cunfuision matrix
Girafa fr
liveware wizard
mcdonald's junction 1
duck
why testing failed test
pwd in command prompt
how to import text file into database
Github Readme image hinzugfügen
. | https://www.codegrepper.com/code-examples/whatever/pip+list+outdated | CC-MAIN-2021-43 | en | refinedweb |
Celery client / worker for in node.js
This project focuses on implementing task queue using celery protocol in node.js influenced by node-celery
Task queue is a mechanism to distribute or dispatch "tasks" or "jobs" across "workers" or "machines" for executing them asynchronously.
Common use cases of task queue:
Applications, also called as "Producers", "Publishers" register logical blocks of code as "tasks".
Workers, also called "Consumers" consume these "task" and optionally store any results to a "message backend".
The broker (task queue) receives tasks encapsulated as messages from "producers" and routes them to "consumers".
But managing messages is not as simple as storing them in a data sotre as aqueue.
Suppose that a number of messages sent and dispatched by large number of producers and workers.
We have to consider below.
Celery is a one of most famous task queue open source software. A Celery system can consist of multiple workers and brokers, giving way to high availability and horizontal scaling.
The features of celery is
Celery is written in Python, but the protocol can be implemneted in any languages. There's gocelery for Go and like gocelery, here's celery.node.
We usually make programs using different languages because of the specific features of each language and sometimes the programs should be communicated with each others by task-queueing, such as python web application with go worker or nodejs worker for better performance.
We can make the programs distribute the tasks to processes written in different languages super easily by using celery, gocelery, and celery.node.
Also, you can use celery.node as pure nodejs task queue.
celery protocol reference
Celery.node now supports Celery Message Protocol Version 1 and Version 2.
client.conf.TASK_PROTOCOL = 1; // 1 or 2. default is 2.
$ npm install celery-node
const celery = require('celery-node'); const client = celery.createClient( "amqp://", "amqp://" ); const task = client.createTask("tasks.add"); const result = task.applyAsync([1, 2]); result.get().then(data => { console.log(data); client.disconnect(); });
from celery import Celery app = Celery('tasks', broker='amqp://', backend='amqp://' ) @app.task def add(x, y): return x + y if __name__ == '__main__': result = add.apply_async((1, 2), serializer='json') print(result.get())
const celery = require('celery-node'); const worker = celery.createWorker( "amqp://", "amqp://" ); worker.register("tasks.add", (a, b) => a + b); worker.start();
from celery import Celery app = Celery('tasks', broker='amqp://', backend='amqp://' ) @app.task def add(x, y): return x + y
$ celery worker -A tasks --loglevel=INFO
Ensure you already installed nodejs, npm, and docker-compose
# Generate dist/ directory, tutorial files depend on it $ npm run dist # start a docker container rabbitmq in the background $ docker-compose -f examples/docker-compose.yml up -d rabbit # run celery.node client with rabbitmq $ node examples/tutorial/client.js # run celery.node worker with rabbitmq # when you run worker, you can see the result printed out from client $ node examples/tutorial/worker.js # stop and remove containers $ docker-compose -f examples/docker-compose.yml down
Before contributing, please read contributing.md
Let's make this project more awesome! | https://awesomeopensource.com/project/actumn/celery.node | CC-MAIN-2021-43 | en | refinedweb |
kdevplatform/language/duchain
#include <declarationid.h>
Detailed Description
Allows clearly identifying a Declaration.
DeclarationId is needed to uniquely address Declarations that are in another top-context, because there may be multiple parsed versions of a file.
There are two forms of DeclarationId, one indirect and one direct. The direct form holds a reference to the Declaration instance, whereas the indirect form stores the qualified identifier and an additional index to disambiguate instances of multiple declarations with the same identifier.
Both forms also have a specialization index. It can be used in a language-specific way to pick other versions of the declaration. When the declaration is found, Declaration::specialize() is called on the found declaration with this value, and the returned value is the actually found declaration.
- Note
- This only works when the Declaration is in the symbol table.
Definition at line 50 of file declarationid.h.
Constructor & Destructor Documentation
◆ DeclarationId() [1/3]
Constructor for indirect access to a declaration.
The resulting DeclarationId will not have a direct reference to the Declaration, but will look it up as needed.
- Parameters
-
Definition at line 31 of file declarationid.cpp.
◆ DeclarationId() [2/3]
Constructor for direct access to a declaration.
The resulting DeclarationId will directly reference the Declaration
- Parameters
-
Definition at line 39 of file declarationid.cpp.
◆ DeclarationId() [3/3]
Definition at line 47 of file declarationid.cpp.
◆ ~DeclarationId()
Definition at line 60 of file declarationid.cpp.
Member Function Documentation
◆ declaration()
Retrieve the declaration, from the perspective of context.
In order to be retrievable, the declaration must be in the symbol table.
- Parameters
-
- Returns
- the referenced Declaration, or null if none was found.
Definition at line 154 of file declarationid.cpp.
◆ declarations()
Same as declaration(..), but returns all matching declarations if there are multiple.
This also returns found forward-declarations.
Definition at line 97 of file declarationid.cpp.
◆ hash()
Hash function for this declaration identifier.
- Warning
- This may return different hashes for the same declaration, depending on whether the id is direct or indirect, and thus you cannot compare hashes for declaration equality (use operator==() instead)
Definition at line 126 of file declarationid.h.
◆ isDirect()
Determine whether this DeclarationId directly references a Declaration by indices, or if it uses identifiers and other data to reference the Declaration.
- Returns
- true if direct, false if indirect.
Definition at line 82 of file declarationid.cpp.
◆ isValid()
Determine whether this declaration identifier references a valid declaration.
Definition at line 114 of file declarationid.h.
◆ operator!=()
Not equal operator.
- Parameters
-
- Returns
- true if not equal, otherwise false.
Definition at line 106 of file declarationid.h.
◆ operator=()
Definition at line 67 of file declarationid.cpp.
◆ operator==()
Equality operator.
- Parameters
-
- Returns
- true if equal, otherwise false.
Definition at line 87 of file declarationid.h.
◆ qualifiedIdentifier()
Return the qualified identifier for this declaration.
- Warning
- This is relatively expensive, and not 100% correct in all cases(actually a top-context would be needed to resolve this correctly), so avoid using this, except for debugging purposes.
Definition at line 217 of file declarationid.cpp.
◆ setSpecialization()
Set the specialization index (see class documentation).
- Parameters
-
Definition at line 87 of file declarationid.cpp.
◆ specialization()
Retrieve the specialization index (see class documentation).
- Returns
- the specialization index.
Definition at line 92 of file declarationid.cpp.
Member Data Documentation
◆ m_directData
Definition at line 195 of file declarationid.h.
◆ m_indirectData
Definition at line 194 of file declarationid.h.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2021 The KDE developers.
Generated on Fri Oct 15 2021 23:33:24 by doxygen 1.8.16 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online. | https://api.kde.org/appscomplete-api/kdevelop-apidocs/kdevplatform/language/duchain/html/classKDevelop_1_1DeclarationId.html | CC-MAIN-2021-43 | en | refinedweb |
- Legacy Code Never Goes Away
- Glue Logic: A Sticky Business
- Is Python a Scripting Language or a Full Development Language?
- C++ Design Issues
- Conclusion
- References
Glue Logic: A Sticky Business
In this context, glue logic is simply a piece of Python script that allows you to call your legacy C++ programs, with no need to change them. Suppose we have a bunch of such C++ programs that must be called from Python, with the major requirement that we cannot make any changes to the C++ code. In other words, C++ code exists and is in use by real users. We can call it—but not change it!
With this requirement in mind, let's look at an example of the glue logic approach.
Calling C++ Programs from Python
Let's say we have a really simple C++ program (called CPlusPlus0xProject) that we want to call from Python. Listing 1 illustrates an excerpt from the C++ program.
Listing 1A simple C++ program.
int main() { cout << endl << "Now calling doSomeMemoryWork()" << endl; doSomeMemoryWork(); cout << "Now calling getPersonDetails()" << endl; getPersonDetails(); return 0; }
How do we run this C++ program from Python? This goal is achieved with the Python script in Listing 2.
Listing 2Python invocation of a C++ program.
import os, errno import subprocess as sp def invokeProgram(): try: print('Just before Python program invocation') p = sp.Popen(['/home/stephen/CPlusPlus0xProject'], stdout = sp.PIPE) result = p.communicate()[0] print('CPlusPlus0xProject invoked' + result + '\n') except OSError as e: print('Exception handler error occurred: ' + str(e.errno) + '\n') if __name__ == '__main__': invokeProgram()
In Listing 2, our simple C++ program is invoked from Python by using the subprocess module. The script imports a few standard modules, defines a function, and then has a main section. The C++ program can be anything you like; Listing 2 is essentially the same as running the C++ program directly from the console.
Listing 3 shows the combined Python and C++ program output.
Listing 3The Python and C++ program output.
Just before Python program invocation CPlusPlus0xProject invoked Now calling doSomeMemoryWork() Function name: doSomeMemoryWork() Before memory assignment a = aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa b = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb c = cccccccccccccccccccccccccccccc After memory assignment a = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb b = bbbbbbbbbbbbbbbbbbbbbbbbbbbbbb c = cccccccccccccccccccccccccccccc Now calling getPersonDetails() Person just created is: John Doe Person name = John Doe Now inside the Person class destructor
Why go to the trouble of using Python like this? Isn't it just as easy to run the C++ program from the console?
Well, using Python like this gives you a great deal more power than is the case with the console. For one thing, you can take advantage of Python's exception-management facilities—this is the try-except block in Listing 2. If anything goes wrong inside the Python exception block, you'll see a message printed on the console. For example, let's change this line in Listing 2:
p = sp.Popen(['/home/stephen/CPlusPlus0xProject'], stdout = sp.PIPE)
to this:
p = sp.Popen(['./home/stephen/CPlusPlus0xProject'], stdout = sp.PIPE)
Running this erroneous Python code results in the following program output:
Just before Python program invocation Exception handler error occurred: 2
Notice the exception that has been caught and reported. Now, you might be thinking, "This fellow is very pessimistic in outlook, worrying about exceptions from the word 'go.'" This is a good point, but exceptions are generally an unavoidable fact of life. Exception handling is perhaps not the most glamorous of areas to code, but working hard on your exception logic makes for a more solid end product. This in turn provides for an improved end-user experience.
Clearly, the code being executed in these examples is very simple. But as you scale up the size of both the Python code and the C++ programs, you'll begin to see the power of the glue logic approach. A large number of C++ programs can be invoked from a fairly simple Python script.
Now let's take a closer look at Python exceptions.
Python Exceptions
Python has a powerful exception-management facility and is substantially documented online. Listing 4 shows a typical exception example.
Listing 4Python I/O exception management.
try: fh = open('/home/stephen/myFile.txt', "w") fh.write("A test file.") except IOError as e: print('Exception handler error occurred: ' + str(e.errno) + '\n') else: print 'Successfully updated file.'
The script in Listing 4 opens a file in write mode and then attempts to write to the file. If no errors occur, the output should be that associated with the else clause:
Successfully updated file.
If an IOError exception occurs, the except clause is executed.
The Python exception code we've seen so far is very similar to the equivalent Java (or even C++) mechanism. The major merit of such exception handling is that errors can be handled close to where they occur. If the code in question can't handle the exception, at the very least it should document the exception in a logfile and then rethrow it. The latter scenario then gives higher-level code (that is, the calling code) a chance to handle the exception. Think of this as the rule:
Exceptions are inconvenient, but they should never be ignored or swallowed by code without a really good reason.
Given that Python has strong exception-support facilities, is it a full development language? | https://www.informit.com/articles/article.aspx?p=2175997&seqNum=2 | CC-MAIN-2021-43 | en | refinedweb |
public class PDFAnnotation extends Object.
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait) PDFAnnotation getPopup()
public float[] getRectangle()
setRectangle()method for a discussion on units.
setRectangle(float, float, float, float)
public boolean hasAppearanceState(String state)
state- the state to check - "N" for normal, "D" for down or "R" for rollover()
public void setLocked(boolean position, boolean content)
Set the annotation to be "locked". It's possible to lock the size and position of the annotation, the content, or both - although locking the content is only supported in Acrobat 8 or later
position- whether to lock the size/position of the annotation
content- whether to lock the content of the annotation
public boolean isPositionLocked()
public boolean isContentLocked()
public void setMetaData(String metadata)
getXMP().read(new StringReader(xmldata == null ? "" : xmldata)). We strongly recommend using the
getXMP()method and modifying the XMP directly rather than using this method.
metadata- the XML data to embed into the document, or null to clear any existing metadata. No validation is performed on this input. XMP getXMP()
public Calendar getModifyDate()
nullotherwise.
getLastModified
public void setModifyDate(Calendar date)
date- the Date to set the modification date to
public Calendar getCreationDate()
nullotherwise.
public void rebuild()
PropertyChangeEvent) is run on a specific thread.
public int getOpacity()
setOpacity(int)<PDFAnnotation> getReplies()
Get an unmodifiable List of
PDFAnnotation objects that are in
reply to this Annotation.
Since Acrobat 6.0 it has been possible to add "replies" to another
annotation. These replies are actually
PDFAnnotation objects -
although the specification allows for any type of annotation to be used
as a reply, in general
PDFAnnotation<PDFAnnotation> getReviews()
Get an unmodifiable List of
PDFAnnotation objects
PDFAnnotation
PDFAnnotation void addPropertyChangeListener(PropertyChangeListener l)
FormElement.addPropertyChangeListener(java.beans.PropertyChangeListener),
PDFPage.addPropertyChangeListener(java.beans.PropertyChangeListener)
public void removePropertyChangeListener(PropertyChangeListener l)
removePropertyChangeListener(java.beans.PropertyChangeListener)
public void flatten()
Stamp the visible appearance of this annotation permanently onto its page, and remove the annotation from the page. The annotation object should be discarded afterwards.
Note that this method removes this PDFAnnotation from the page list (and
if this annotation is a Widget, from the
FormElement.getAnnotations()
FormElement Annotations list} as well),
which could result in a
ConcurrentModificationException if you
were
iterating over the page's annotations. To flatten
all the annotations on a page we'd recommend something like this:
List l = page.getAnnotations(); while (l.size() > 0) { ((PDFAnnotation)l.get(l.size() - 1)).flatten(); }
FormElement.flatten(),
Form.flatten()
public void setLocale(Locale locale)
public Locale getLocale()
setLocale(java.util.Locale). The ability for an annotation to have a Locale is new in PDF 2.0
public void setOptionalContentDescriptor(OptionalContentDescriptor descriptor)
PDFCanvas.setOptionalContentDescriptor(org.faceless.pdf2.OptionalContentDescriptor)
public OptionalContentDescriptor getOptionalContentDescriptor()
setOptionalContentDescriptor(org.faceless.pdf2.OptionalContentDescriptor)
public Collection<EmbeddedFile> getAssociatedFiles()
OutputProfile.getAssociatedFiles()and
PDFPage.getAssociatedFiles(). The ability to associate files with a PDFAnnotation is new in PDF 2.0.
AnnotationFile
public PDFAction getAction(Event event)
setAction(org.faceless.pdf2.Event, org.faceless.pdf2.PDFAction), or null if its unset.
event- the event
public void setAction(Event event, PDFAction action)
Set an action to occur when the specified event happens to this annotation.
The event can be one of
Event.MOUSEOVER,
Event.MOUSEOUT,
Event.MOUSEDOWN,
Event.MOUSEUP,
Event.FOCUS,
Event.BLUR,
Event.SHOW,
Event.HIDE,
Event.OPEN or
Event.CLOSE
event- the event the action applies to
action- the action you wish to occur, or
nullto remove the action
IllegalArgumentException- if the event is invalid.
public void putUserData(String key, Object value)
value- a CharSequence, Number, Date, Calendar, Boolean, byte[], or a List/Map of those values, or null to remove the property
public Object getUserData(String key)
putUserData()method
public ColorSpace getDefaultColorSpace(int components)
Return the ColorSpace used by this annotation to anchor device-dependent
colors to a profile. For example, the ColorSpace returned by
getDefaultColorSpace(3) is used by all "Device RGB" colors
on the annotation, effectively turning them into calibrated colors.
Annotations do not inherit any default ColorSpace set on the page.
components- identifies the Default ColorSpace we're requesting - valid values are 1 for Gray, 3 for RGB or 4 for CMYK.
PDFPage.getDefaultColorSpace(int)
public void setDefaultColorSpace(int components, ColorSpace cs)
getColorSpace(java.lang.String).
components- identifies the Default ColorSpace to set - valid values are 1 for Gray, 3 for RGB or 4 for CMYK.
cs- the ColorSpace to set, which must be either null (to delete the existing value) or a ColorSpace of a type that matches the "components" parameter.
public String toString() | https://bfo.com/products/pdf/docs/api/org/faceless/pdf2/PDFAnnotation.html | CC-MAIN-2021-43 | en | refinedweb |
Hello, i tried this tutorial for interacting with ubidots:
but both the above and a modified version to suit my needs kept crashing on the ApiUbidots AsyncTask call as i see when running the app with breakpoints.
What i did:
-edited the gradle as suggested in the link
-edited the manifest as suggested in the link
-edited the layout and activity as suggested to the link with the only difference the use of ConstraintLayout
What i didn’t:
-add some fancy tags on the Ubidots website since the UI is very different now from what it was on the tutorial
The token and variable id are probably correct since i use the very same to upload the variables from an arduino to that ubidots device.
Android Studio Version: 2.3.2
Android Version : 4.4.2
[code]import android.app.Activity;
import android.os.AsyncTask;
import android.os.Bundle;
import android.widget.TextView;
import com.ubidots.*;
public class MainActivity extends Activity {
private TextView mAlertTextView;
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); mAlertTextView = (TextView) findViewById(R.id.alert); new ApiUbidots().execute(); } public class ApiUbidots extends AsyncTask<Void, Void, Value[]> { private final String API_KEY = "TOKEN_HERE"; private final String ALERT_ID = "VAR_ID_HERE"; @Override protected Value[] doInBackground(Void... params) { ApiClient apiClient = new ApiClient(API_KEY); Variable alert = apiClient.getVariable(ALERT_ID); return alert.getValues(); } @Override protected void onPostExecute(Value[] variableValues) { mAlertTextView.setText(String.valueOf(variableValues[0])); } }
}[/code]
Thanks in advance for any help | https://ubidots.com/community/t/solved-android-sdk-example-crashes/1140 | CC-MAIN-2021-43 | en | refinedweb |
Source code for globus_sdk.transport.retry
import enum import logging from typing import Callable, Dict, List, Optional, cast import requests from globus_sdk.authorizers import GlobusAuthorizer log = logging.getLogger(__name__)[docs]class RetryContext: """ The RetryContext is an object passed to retry checks in order to determine whether or not a request should be retried. The context is constructed after each request, regardless of success or failure. If an exception was raised, the context will contain that exception object. Otherwise, the context will contain a response object. Exactly one of ``response`` or ``exception`` will be present. :param attempt: The request attempt number, starting at 0. :type attempt: int :param response: The response on a successful request :type response: requests.Response :param exception: The error raised when trying to send the request :type exception: Exception :param authorizer: The authorizer object from the client making the request :type authorizer: :class:`GlobusAuthorizer \ <globus_sdk.authorizers.GlobusAuthorizer>` """ def __init__( self, attempt: int, *, authorizer: Optional[GlobusAuthorizer] = None, response: Optional[requests.Response] = None, exception: Optional[Exception] = None, ): # retry attempt number self.attempt = attempt # if there is an authorizer for the request, it will be available in the context self.authorizer = authorizer # the response or exception from a request # we expect exactly one of these to be non-null self.response = response self.exception = exception # the retry delay or "backoff" before retrying self.backoff: Optional[float] = None[docs]class RetryCheckResult(enum.Enum): #: yes, retry the request do_retry = enum.auto() #: no, do not retry the request do_not_retry = enum.auto() #: "I don't know", ask other checks for an answer no_decision = enum.auto()[docs]class RetryCheckFlags(enum.Flag): #: no flags (default) NONE = enum.auto() #: only run this check once per request RUN_ONCE = enum.auto()# stub for mypy class _RetryCheckFunc: _retry_check_flags: RetryCheckFlags[docs]def set_retry_check_flags(flag: RetryCheckFlags) -> Callable[[Callable], Callable]: """ A decorator for setting retry check flags on a retry check function. Usage: >>> @set_retry_check_flags(RetryCheckFlags.RUN_ONCE) >>> def foo(ctx): ... """ def decorator(func: Callable) -> Callable: as_check = cast(_RetryCheckFunc, func) as_check._retry_check_flags = flag return func return decorator# types useful for declaring RetryCheckRunner and related types RetryCheck = Callable[[RetryContext], RetryCheckResult][docs]class RetryCheckRunner: """ A RetryCheckRunner is an object responsible for running retry checks over the lifetime of a request. Unlike the checks or the retry context, the runner persists between retries. It can therefore implement special logic for checks like "only try this check once". Its primary responsibility is to answer the question "should_retry(context)?" with a boolean. It takes as its input a list of checks. Checks may be paired with flags to indicate their configuration options. When not paired with flags, the flags are taken to be "NONE". Supported flags: ``RUN_ONCE`` The check will run at most once for a given request. Once it has run, it is recorded as "has_run" and will not be run again on that request. """ # check configs: a list of pairs, (check, flags) # a check without flags is assumed to have flags=NONE def __init__(self, checks: List[RetryCheck]): self._checks = [] self._check_data: Dict[Callable, Dict] = {} for check in checks: self._checks.append(check) self._check_data[check] = {} def should_retry(self, context: RetryContext) -> bool: for check in self._checks: flags = getattr(check, "_retry_check_flags", RetryCheckFlags.NONE) if flags & RetryCheckFlags.RUN_ONCE: if self._check_data[check].get("has_run"): continue else: self._check_data[check]["has_run"] = True result = check(context) log.debug( # try to get name but don't fail if it's not a function... "ran retry check (%s) => %s", getattr(check, "__name__", check), result ) if result is RetryCheckResult.no_decision: continue elif result is RetryCheckResult.do_not_retry: return False else: return True # fallthrough: don't retry any request which isn't marked for retry return False | https://globus-sdk-python.readthedocs.io/en/stable/_modules/globus_sdk/transport/retry.html | CC-MAIN-2021-43 | en | refinedweb |
inquisitor alternatives and similar packages
Based on the "ORM and Datamapping" category.
Alternatively, view inquisitor alternatives based on common mentions on social networks and blogs.
ecto10.0 9.2 inquisitor VS ectoA toolkit for data mapping and language integrated query.
eredis9.7 0.0 inquisitor VS eredisErlang Redis client
postgrex9.6 6.8 inquisitor VS postgrexPostgreSQL driver for Elixir
redix9.5 6.2 inquisitor VS redixFast, pipelined, resilient Redis driver for Elixir. 🛍
eventstore9.4 7.6 inquisitor VS eventstoreEvent store using PostgreSQL for persistence
mongodb9.2 6.7 inquisitor VS mongodbMongoDB driver for Elixir
ecto_enum9.2 0.1 inquisitor VS ecto_enumEcto extension to support enums in models
amnesia9.2 0.0 inquisitor VS amnesiaMnesia wrapper for Elixir.
memento9.1 4.1 inquisitor VS mementoSimple + Powerful interface to the Mnesia Distributed Database 💾
moebius9.0 0.0 inquisitor VS moebiusA functional query tool for Elixir
mongodb_ecto9.0 0.0 inquisitor VS mongodb_ectoMongoDB adapter for Ecto
rethinkdb9.0 0.0 inquisitor VS rethinkdbRethinkdb client in pure elixir (JSON protocol)
mysql9.0 3.5 inquisitor VS mysqlMySQL/OTP – MySQL and MariaDB client for Erlang/OTP
paper_trail8.9 7.3 inquisitor VS paper_trailTrack and record all the changes in your database with Ecto. Revert back to anytime in history.
arc_ecto8.8 0.0 inquisitor VS arc_ectoAn integration with Arc and Ecto.
exredis8.7 0.0 inquisitor VS exredisRedis commands for Elixir
mariaex8.6 0.0 inquisitor VS mariaexPure Elixir database driver for MariaDB / MySQL
triplex8.4 2.7 inquisitor VS triplexDatabase multitenancy for Elixir applications!
ExAudit8.4 4.1 inquisitor VS ExAuditEcto auditing library that transparently tracks changes and can revert them.
ecto_mnesia8.3 0.0 inquisitor VS ecto_mnesiaEcto adapter for Mnesia Erlang term database.
shards8.2 1.3 inquisitor VS shardsPartitioned ETS tables for Erlang and Elixir
xandra8.2 0.0 inquisitor VS xandraFast, simple, and robust Cassandra driver for Elixir.
riak8.2 0.0 inquisitor VS riakA Riak client written in Elixir.
Bolt.Sips8.1 1.3 inquisitor VS Bolt.SipsNeo4j driver for Elixir
timex_ecto7.9 0.0 inquisitor VS timex_ectoAn adapter for using Timex DateTimes with Ecto
kst7.8 8.0 inquisitor VS kst💿 KVS: Abstract Chain Database
atlas7.8 0.0 inquisitor VS atlasObject Relational Mapper for Elixir
instream7.7 8.6 inquisitor VS instreamInfluxDB driver for Elixir
tds7.7 1.7 inquisitor VS tdsTDS Driver for Elixir
esqlite7.6 1.2 L3 inquisitor VS esqliteErlang NIF for sqlite
ecto_psql_extras7.6 4.8 inquisitor VS ecto_psql_extrasEcto PostgreSQL database performance insights. Locks, index usage, buffer cache hit ratios, vacuum stats and more.
arbor7.6 0.0 inquisitor VS arborEcto elixir adjacency list and tree traversal. Supports Ecto versions 2 and 3.
extreme7.5 0.0 inquisitor VS extremeElixir Adapter for EventStore
ecto_fixtures7.4 0.0 inquisitor VS ecto_fixturesFixtures for Elixir apps
sqlitex7.3 3.4 inquisitor VS sqlitexAn Elixir wrapper around esqlite. Allows access to sqlite3 databases.
kalecto7.3 0.0 inquisitor VS kalectoAdapter for the Calendar library in Ecto
mongo7.2 0.0 inquisitor VS mongoMongoDB driver for Elixir
mongodb_driver7.1 5.9 inquisitor VS mongodb_driverMongoDB driver for Elixir
boltun7.0 0.0 inquisitor VS boltunTransforms notifications from the Postgres LISTEN/NOTIFY mechanism into callback execution
redo7.0 0.0 inquisitor VS redopipelined erlang redis client
tds_ecto7.0 0.0 inquisitor VS tds_ectoTDS Adapter for Ecto
gremlex6.9 0.0 inquisitor VS gremlexElixir Client for Gremlin (Apache TinkerPop™)
sqlite_ecto6.9 0.0 inquisitor VS sqlite_ectoSQLite3 adapter for Ecto
couchdb_connector6.9 0.0 inquisitor VS couchdb_connectorA couchdb connector for Elixir
neo4j_sips6.8 0.0 inquisitor VS neo4j_sipsElixir driver for the Neo4j graph database server
sql_dust6.8 2.3 inquisitor VS sql_dustEasy. Simple. Powerful. Generate (complex) SQL queries using magical Elixir SQL dust.
craterl6.8 0.0 inquisitor VS craterlErlang client for crate.
github_ecto6.7 0.0 inquisitor VS github_ectoEcto adapter for GitHub API
ecto_cassandra6.6 0.0 inquisitor VS ecto_cassandraCassandra Ecto Adapter
triton6.5 0.0 inquisitor VS tritona Cassandra ORM for Elixir
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest.
Do you think we are missing an alternative of inquisitor or a related project?
README
Inquisitor
Easily build composable queries for Ecto.
Inquisitor is built and maintained by DockYard, contact us for expert Elixir and Phoenix consulting.
Usage
Adding Inquisitor to a project is simple:
defmodule MyApp.PostController do use Inquisitor def index(conn, params) do posts = App.Post |> build_query(conn, params) |> Repo.all() json(conn, posts) end end
After
use Inquisitor
build_query/3 is added to
the
MyApp.PostController. It takes a queryable variable, the
conn, and the
params as arguments.
This sets up a key/value queryable API for the
Post model. Any
combination of fields on the model can be queried against. For example,
requesting
[GET] /posts?foo=bar&baz=qux could create the query:
SELECT p0."foo", p0."baz" FROM posts as p0 WHERE (p0."foo" = $1) AND (p0."baz" = $1);
$1 and
$2 will get the values of
"bar" and
"qux",
Security
By default, Inquisitor is an opt-in library. It will not provide any querying access to any key/value pair. The params list will be iterated over and a no-op function is called on each element. You must add custom query handlers that have a higher matching order on a case by case basis.
If you'd like to add a catch-all for any key/value pair you can override the default:
def build_query(query, attr, value, _conn) do Ecto.Query.where(query, [r], field(r, ^String.to_existing_atom(attr)) == ^value) end
However, this is not recommended. Instead you should create a
@whitelist module attribute that contains all of they keys you
wish to allow access to:
@whitelist ["title", "bio"] def build_query(query, attr, value, _conn) when attr in @whitelist do Ecto.Query.where(query, [r], field(r, ^String.to_existing_atom(attr)) == ^value) end
This will handle matching keys in the whitelist and all unmatched keys will fall back to the pass-through without affecting the query.
Adding custom query handlers
Use
build_query/4 to add key/value pair handlers:
defmodule MyApp.PostsController do use Inquisitor def index(conn, params) do posts = App.Post |> build_query(params) |> Repo.all() json(conn, posts) end def build_query(query, "inserted_at", date, _conn) do Ecto.Query.where(query, [p], p.inserted_at >= ^date) end end
Handing fields that don't exist on the model
The keys you query against don't need to exist on the model. Revisiting the date example, let's say we want to find all posts inserted for a given month and year:
def build_query(query, attr, value, _conn) when attr == "month" or attr == "year" do Ecto.Query.where(query, [e], fragment("date_part(?, ?) = ?", ^attr, e.inserted_at, type(^value, :integer))) end
Usage Outside of Phoenix Controllers
To use inside a module other than a Phoenix Controller, you'll need to import
Ecto.from/1 otherwise you may see an error like
cannot use ^value outside of match clauses.
Note: we use
warn: false to suppress an incorrect warning generated by Elixir thinking
from is unused.
defmodule MyApp.PlainModule do import Ecto.Query, only: [from: 1], warn: false use Inquisitor end
Plugins
We collect all Inquisitor plugins that extend its behavior:
- inquisitor_jsonapi - implements query handling according to the JSON API inquisitor README section above are relevant to that project's source code only. | https://elixir.libhunt.com/inquisitor-alternatives | CC-MAIN-2021-43 | en | refinedweb |
4.9: Parameters and Arguments
- Page ID
- 8571. Here is an example of a user-defined function that takes an argument:
def print_twice(bruce): print(bruce) print(bruce)
This function assigns the argument to a parameter named
bruce. When the function is called, it prints the value of the parameter (whatever it is) twice.
This function works with any value that can be printed.
>>> print_twice('Spam') Spam Spam >>> print_twice(17) 17 17 >>> import math >>> print_twice(math.pi) 3.141592653589793 3.141592653589793
The same rules of composition that apply to built-in functions also apply to user-defined functions, so we can use any kind of expression as an argument for
print_twice:
>>> print_twice('Spam '*4) Spam Spam Spam Spam Spam Spam Spam Spam >>> print_twice(math.cos(math.pi)) -1.0 -1.0
The argument is evaluated before the function is called, so in the examples the expressions
Spam '*4 and
math.cos(math.pi) are only evaluated once.
You can also use a variable as an argument:
>>>>> print_twice(michael) Eric, the half a bee. Eric, the half a bee.
The name of the variable we pass as an argument (
michael) has nothing to do with the name of the parameter (
bruce). It doesn't matter what the value was called back home (in the caller); here in
print_twice, we call everybody
bruce. | https://eng.libretexts.org/Courses/Delta_College/Introduction_to_Programming_Concepts_-_Python/04%3A_Functions/4.09%3A_Parameters_and_Arguments | CC-MAIN-2021-43 | en | refinedweb |
CircuitPython library for SD cards.
Project description
Introduction
CircuitPython driver for SD cards. This implements the basic reading and writing block functionality needed to mount an SD card using storage.VfsFat.
Dependencies
This driver depends on:
Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading the Adafruit library and driver bundle.
Usage Example
Mounting a filesystem on an SD card so that its available through the normal Python ways is easy.
Below is an example for the Feather M0 Adalogger. Most of this will stay the same across different boards with the exception of the pins for the SPI and chip select (cs) connections.
import adafruit_sdcard import busio import digitalio import board import storage # Connect to the card and mount the filesystem. spi = busio.SPI(board.SCK, board.MOSI, board.MISO) cs = digitalio.DigitalInOut(board.SD_CS) sdcard = adafruit_sdcard.SDCard(spi, cs) vfs = storage.VfsFat(sdcard) storage.mount(vfs, "/sd") # Use the filesystem as normal. with open("/sd/test.txt", "w") as f: f.write("Hello world\n")-sd -. | https://pypi.org/project/adafruit-circuitpython-sd/ | CC-MAIN-2019-13 | en | refinedweb |
mediaconnect
import "github.com/aws/aws-sdk-go/service/mediaconnect"
Package mediaconnect provides the client and types for making API requests to AWS MediaConnect.
API for AWS Elemental MediaConnect
See for more information on this service.
See mediaconnect package documentation for more information.
Using the Client
To contact AWS MediaCon MediaConnect client MediaConnect for more information on creating client for this service. | https://docs.aws.amazon.com/sdk-for-go/v1/api/service.mediaconnect.html | CC-MAIN-2019-13 | en | refinedweb |
Subject: Re: [geometry] Index distance predicates names
From: Adam Wulkiewicz (adam.wulkiewicz_at_[hidden])
Date: 2012-08-26 16:56:24
Hi,
I'm testing the r-tree implementation and have problem with some names.
I've been using near() and far() but these are macros defined in
windows.h. Since the r-tree isn't released yet, the simplest way of
fixing it is to change names. But first, I'll explain what are those
predicates.
R-tree allows to store volumetric values (boxes) and find some number of
them nearest to some point. It is possible to define which point of
volumetric object is taken in distance calculation. It may be the
nearest point, the centroid or the furthest point. This corresponds to
functions bgi::near(), bgi::centroid() and bgi::far().
bgi stands for boost::geometry::index namespace.
To complicate things. There is also a method rtree.nearest(Predicate)
and function bgi::nearest(rtree, Predicate). So knn query may look like
this:
tree.nearest(bgi::near(pt), output);
bgi::nearest(tree, bgi::near(pt), output);
tree | bgi::filters::nearest_filtered(bgi::near(pt))
or this:
bgi::nearest(
tree,
bgi::bounded(
bgi::near(pt),
bgi::centroid(10),
bgi::far(20)
), output);
Some names may form non-intuitive query, e.g.:
bgi::nearest(tree, bgi::nearest(pt), output);
What is more, I'd rather avoid furthest() because it is nice antonym of
nearest() and may be used as similar function name.
To the point. Possible names are:
near -> nearest, close, closest
far -> furthest, distant, most_distant
Do you have any preferences or other ideas?
Regards,
Adam
Geometry list run by mateusz at loskot.net | https://lists.boost.org/geometry/2012/08/2044.php | CC-MAIN-2019-13 | en | refinedweb |
Connecting a sensor to WiPy 1 via I2C
Hi
I'm trying to connect a lux sensor (TSL2561) to a wipy 1 with expansion board via I2C. I have connected the Vin and GND pins of the sensor to the 3V3 and GND pins respectively, and connected the SCL and SDA pins of the sensor to some of the pairs marked I2C0_... in the pinout ().
lux_sda = Pin('GP12', mode=Pin.ALT, alt=5) lux_scl = Pin('GP13', mode=Pin.ALT, alt=5)
I initialize the I2C bus like this:
print('configuring I2C') #i2c = I2C(0, I2C.MASTER, baudrate=100000) i2c = I2C(0) print(i2c.scan()) # returns list of slave addresses
However, i2c.scan() always returns an empty list []
What am I missing?
Thanks for your help
@jnc said in Connecting a sensor to WiPy 1 via I2C:
I assume you have to specify the scl and ads pin in the constructor, like:
i2c = I2C(0, scl=lux_scl, sda=lux_sda)
And you may have to switch GP12 and GP13, as far as I understand the PinOut
lux_scl = Pin('GP12', mode=Pin.ALT, alt=5)
lux_sda = Pin('GP13', mode=Pin.ALT, alt=5)
Not sure if you have figured out, but yesterday I started playing with my TSL2561 and I was able to get the lux.
Here is the code I used:
*import time
from machine import I2C
i2c = I2C(0, I2C.MASTER, baudrate=100000)
#----- NOTE:
#If you now do i2c.scan() you should get the address, typically 57 or 0x39 in hex (if you did not connected the address pins on the TSL2561)
addr = 0x39
#Power ON
i2c.writeto_mem(addr, 0x80, 0x03)
#Set Gain 1x and integration time to 402ms
i2c.writeto_mem(addr, 0x81, 0x02)
data = i2c.readfrom_mem(addr, 0x8C, 2)
total_light = ((data[1]<<8) + data[0])
data1 = i2c.readfrom_mem(addr, 0x8E, 2)
ir_light = ((data[1]<<8) + data[0])
print("Total: "+total_light)*
The sensor chip is designed for 3.3V, the module has an LDO and two FETs for level conversion. It should be OK to power the sensor module with 3.3V on 3vo and Vin pins together (the MIC5225 regulator used draws negligible reverse current). All of the I/O are open drain. Powering the device with 3.3V only on the Vin pin may be insufficient (the LDO has a dropout voltage around 0.3V).
Thanks a lot for your help; regarding the voltage, I'm not really familiar with those electronic schemas; where do you see that it is foreseen for a 5V logic?
On Adafruit's page (), I read: "New! As of June 3, 2014 we are shipping a version with a 3.3V regulator and level shifting circuitry so it can be used with any 3-5V power/logic microcontroller." So I thought it should work with the wipy
Best
Checked your post. Normally the I2C class should set up the pins if you pass it to them, like this:
I2C.init(mode, *, baudrate=100000, pins=(SDA, SCL))
But my main concern here is that after checking adafruit's schematic for that board, it seems that the board was designed to be used with 5V. Sadly I believe powering it up from 3.3V won't do the trick, unless you either find a way to convert the signals back to 3.3V or you bypass the level converters FETs in it (the sensor chip works at 3.3V logic). | https://forum.pycom.io/topic/259/connecting-a-sensor-to-wipy-1-via-i2c | CC-MAIN-2019-13 | en | refinedweb |
Having wanted something that could be easily modified as new sensors were added, but that didn't use dynamic memory allocation or other techniques that are impractical in an embedded environment.
The result is TinyEKF, a C/C++ EKF implementation that takes care of most of the EKF algorithm for you. There is a C++ version for Arduino/Teensy, and a pure C version for STM32. For both versions, you use #define to specify the number of state values N and the number of sensor measurements M. You also provide a method to compute the output of the state-transition function f(x), the observation function h(x), and their respective Jacobian matrices F(x) and H(x). As you'll see from the examples, this involves perhaps ten lines of code for each implementation. TinyEKF takes care of the rest (prediction, update). This implementation is naturally not as efficient as the hard-coded EKFs you see in actual flight controllers, but I am hoping that with today's increasingly fast ARM processors, and perhaps some behind-the-scenes optimizations, TinyEKF will become a useful, scaleable way of implementing your own EKF.
I've provided an Arduino example using sensor fusion of a BMP180 barometer / temperature sensor with an LM35 temperature sensor. For those who don't have an Arduino but want to try it out anyway, there's also a GPS example in C, using realistic satellite data stored in a .CSV spreadsheet. Once I get my STM32 Nucleo board, I plan to port the Arduino sensor fusion example to that platform as well.
Views: 22646
Comment
Cool stuff , I might give it a try on my homebrew IMU.
Funny though, It took me 20 years to step from Scmitt Trigger to Kalman Filter...
20 years? Now that's what I call a "trigger warning"! ;^)
Srsly, I'll be interested in seeing if you can get it working on a real IMU. Happy to help out if I can.
yes, that's my next weekend test as i am going to work on a new flicghtcontroller.
thanks for sharing.
this is what i am using at the moment.
at some time i am going to rewrite it using the dsp lib.
LOL !!
Yeah right, I guess that "Lithium" batteries might have some incidence with this behavior change on my "circuits" :-)
Thanks for your help
Very interesting. I will have to play with this more.
Using a #define to change a single letter into a number seems like a recipe for compile errors if any variable in the project starts with that letter. I would change them to something more unique (i.e. M to M_SENSOR_INPUTS and N to N_STATE_VALUES). I might be paranoid.
Thanks for the suggestion, Phillip. I was concerned about that same issue, so I tested the code below and found that it compiles (using gcc) and runs just fine. Of course, using N and M as #define'd constants means you can use those symbols elsewhere in your code, but I figured that that was a small price to pay to keep the code simple and aligned with the notation in the literature.
#define N 8
#define M 4
#include "tinyekf.h"
int main(int argc, char ** argv)
{
int Nfoo = 0; // Will this survive #define N 8 ?
printf("%d\n", Nfoo);
// etc.
}
Sorry, I meant "you cannot use those symbols elsewhere in your code".
paranoid :-)
colums and rows are better as defines.
but i would initialize all memory - memory might look different after a warmstart. | https://diydrones.com/profiles/blogs/tinyekf-lightweight-c-c-extended-kalman-filter-for | CC-MAIN-2019-13 | en | refinedweb |
> <script src=""></script> <script src=""></script> <div id="root"/> <script type="text/babel"> function Example(props) { const loginButton = props.loggedIn ? 'Hello User!' : <button>Login!</button> return ( <> <h1>Welcome</h1> {loginButton} </> ); } ReactDOM.render(<Example loggedIn={false} />, document.getElementById('root')); </script>
#modal-container { position: relative; z-index: 999; } .app { height: 10em; width: 10em; background: lightblue; overflow: hidden; } .modal { background-color: rgba(0,0,0,0.5); position: fixed; height: 100%; width: 100%; top: 0; left: 0; display: flex; align-items: center; justify-content: center; }
Also see: Tab Triggers | https://codepen.io/anon/pen/JLgjNK?editors=1000 | CC-MAIN-2019-13 | en | refinedweb |
view raw
I want to run FlatCAM on MAC OS X El Capitan and it needs PyQt package. I installed PyQt4 using homebrew.
$ brew install qt
Warning: qt-4.8.7_2 already installed
$ brew install pyqt
Warning: pyqt-4.11.4 already installed
$ brew install sip
Warning: sip-4.18.1 already installed
$ brew install PyQt --with-python
Warning: pyqt-4.11.4 already installed
Although these warnings, when I run FlatCAM, I take this error:
Traceback (most recent call last):
File "FlatCAM.py", line 2, in
from PyQt4 import QtGui
ImportError: No module named PyQt4
Why it doesn't see PyQt4?
FlatCAM uses python 2.7 but default homebrew installation seems like using python3.
Solution here: How can i install PyQT4 for Python 2.7? | https://codedump.io/share/c3XAzbBV9oSh/1/no-module-named-pyqt4-according-to-it-is-installed | CC-MAIN-2017-22 | en | refinedweb |
Learning Unity3D using C#
Outstanding Scholars Work
Philip Keefner
103629078
Fall 2012
Learning Unity Using C#
2
Table of Contents
Summaries
C# Tutorials 3
Unity Basic Video Tutorials 3
2D Gameplay Tutorial 3
Unity C# Tutorials 4
Mario Personal Project 5
Conclusion 5
Created Reference Sections
1) Unity Basics 6
2) C# in Unity 11
Outside References 15
Learning Unity Using C#
3
C# Tutorials
I began by taking a look at various C# tutorials. I read through a couple and found out
that C# is very similar to Java and that the syntax and expressions are very similar, if not the
same, as those in Java. I began to realize that starting so far down was not going to help me
and that I should turn my attention to the Unity game engine and then return to C# when I
found out more about how it is used in Unity and what specifically I would need to know about
it.
Unity Basic Video Tutorials
I figured that the best place to start with Unity would be to watch the video tutorials
suggested by the welcome window with the first start-up after downloading the engine itself.
There were six videos that I went through which teaches the basics of navigating through the
engine and some very simple but useful actions a user can do when working with the engine.
What I Learned
Through these tutorials I learned how to navigate the Unity interface effectively and
how to use the game engine as demonstrated by the Reference Section 1) Unity Basics.
2D Gameplay Tutorial
After learning about the basics of unity, I was interested in starting right into a game.
From the Unity3D website I found a tutorial for a 2D platformer game. Personally, I like
platformer games and I thought that constraining unity to two dimensions would be a natural
place to start and help me ease into learning to create 3D games. I downloaded the PDF and
project components for the tutorial then read and followed through the whole thing.
What I Learned
Through the tutorial I reinforced a lot of what I had learned through the videos by
examples as well as getting into some not so simple scripts. The scripts included were in
JavaScript but I easily found C# translations of them on the internet. This tutorial also taught
me more about how much is involved in creating games and different small sections which
game some understanding of controllers and colliders and those kinds of parts of the game.
Learning Unity Using C#
4
Continued
At the end of the tutorial it suggested making changes to the game in order to test yourself.
One such change I had already thought of while following along. I decided to change the GUI
button interface for switching between controlling the character and the spaceship within the
level to switching by simply pressing a button. Then I went on to restrict switching control to
only when the character is close to the ship, and finally, making the character disappear when
controlling the ship and reappear when switching control back to the character, wherever the
ship is. I have included the executable of these changes in an attachment entitled MyFirstLevel.
The Controls are in a text document also attached entitled MyFirstLevelControls. I have also
attached a copy of the CameraFocus.cs script where I added all of the code for switching
characters.
Unity C# Tutorials
After completing the 2D Gameplay Tutorial, I still felt that I did not have a full
understanding of basic scripting elements in C# for Unity, so I sought out another tutorial to
help me with this. This was my favourite set of tutorials because it managed to stay simple
enough to learn everything line by line from scratch, as well as delve into some more
complicated scripts all the while teaching you about the different specific basic elements in a C#
script used in unity.
What I Learned
I learned a lot about different elements in C# that are used in Unity scripts. These
tutorials were exactly what I wanted to learn about in order to get a basic understanding of C#
scripts in Unity. After completing the tutorials, I thought of the idea of making a reference
sheet for all that I had learned so that I could have easy access to look up of functions and other
elements without having to search them out separately online. This was the inspiration for
Reference Sheet 2) C# in Unity.
Continued
I also have attached an executable for the Cube Run Game in the last tutorial that I did
which is pretty much the same as what was directed by the tutorial except for the colours. One
thing I did add to it though was a button to fall faster down to a platform which made the game
easier to land on the platforms and more fun in my opinion.
Learning Unity Using C#
5
Mario Personal Project
After completing the other tutorials I wanted to test out how much I had learned. So I
came up with the idea of trying to recreate the first level from the original Mario game for the
NES. Not worrying about graphics, I altered the skin for the character in the 2D platformer
tutorial and left the shape alone, as well as collected sprites from the Mario game in order to
use for blocks and other things. Borrowing objects and the character with its controls from the
2D platformer tutorial, I created a new scene and built it to mimic the level in mind then started
to mimic the different components from the game. Currently, I only have the first mushroom
block with the mushroom and Mario’s growth upon picking up the power-up, but I am
continuing to work on it still. I have attached a build of the level so far entitled MarioLevel.
Conclusion
In conclusion I think that I have learned a lot about the Unity 3D game engine and its
scripts using C# over the past semester. After school work, studying, and working on the
weekends, most of my time has gone in to working with Unity. I feel confident about what I
have learned and hope that it is what was expected from me. If it is not then I am truly sorry,
and will most certainly learn from my mistakes if given the chance to continue in the
outstanding scholars program. I requested to work with Dr. Goodwin because I have a passion
for creating videogames and am hoping to make this field of work my career. I will continue to
work with and learn more about Unity as it is a great game engine to work with which I have
found out through this semester. If nothing else I am extremely grateful for the opportunity to
have been directed towards this for learning. If I appeared unambitious or ungrateful I
apologize but this is not what I was trying to do. I will make sure that nothing like this happens
again. Thank you for taking the time to read my report.
Learning Unity Using C#
6
Unity Basics
Unity Layout
The unity layout for the different windows can be configured by the drop down menu in the top
right corner which has the current layout name in it.
The layouts are:
• 2 by 3
• 4 Split
• Tall
• Wide
You can make your own custom layouts as well if you wish and save them in the same drop
down menu.
Scene Window
The scene window shows you how your scene is physically set up with any of the objects and
gizmos placed inside of it. Navigation inside of the scene window can be achieved in various
ways.
• Arrow Keys- move through the scene in the direction pressed
• Right Mouse Button - rotates the view in the window
• Right Mouse Button while holding Alt- zooms the view in the window
• Middle Mouse Button- pans the view in the window
• Mouse Wheel- zooms the view in the window
You can also click the Hand symbol in the toolbar at the top left of the program to add some
more controls for navigating the scene.
• Left Mouse Button- pans the view in the window
• Left Mouse Button while holding Alt- rotates the view in the window
Learning Unity Using C#
7
You can snap the view to one of the axis by clicking one in the image in the top right corner of
the scene window. Also, you can press the cube in the center of the axes for an indirect view of
all of the axes.
You can manipulate the game objects in your scene in this window as well. When a game
object is highlighted you can move it freely by left clicking and dragging in the direction you
want to move it, or to be more precise, you can choose one of the color coordinated axes
arrows to move it along that axes only. Using the three options in the top left on the toolbar
you can Move an object this way, Rotate an object this way, or Scale an object this way.
Game Window
The game window shows you what is currently being seen by the main camera in your game.
The main camera is an object which can be seen and moved within the scene window, it is not
the view in the scene window itself.
The game window is in a tab with the scene window in most layouts so you only see one or the
other depending on which tab you click. The tabs are located at the top of the scene window or
game window.
You can test your game by clicking the Play button in the top middle of the toolbar. This will
automatically switch the game window to the front. While testing your game in this way, you
can also use the Pause button to pause and un-pause the game, as well as the Step button to
make the game step forward one frame at a time. All three of these buttons are located next to
one another.
NOTE: if you switch back to the scene window and make any changes while the game is playing,
or make any changes in any of the other windows, they will revert back to how it was before
playing the game when the game stops.
Hierarchy Window
The hierarchy window is used to keep track of all of the objects currently in the scene. It
appears as a list of objects and if one is selected, it is also selected within the scene. If you
double click an object, the scene view changes so it is focused on that object.
You can rename objects in the hierarchy to keep track of them as well as parent objects with
other objects. Parenting an object with another object means that if you move the parent
object within the scene, the children of that object move with respect to the parent as well.
Learning Unity Using C#
8
This is very useful to keep several objects that make up one larger object always together.
Parenting an object with another object is achieved by simply clicking the child object in the
hierarchy window and dragging it onto the parent object, still in the hierarchy window.
When an object is a parent with children, it has an arrow head beside it that is either open
(pointing down) or closed (pointing to the right). When open, it shows all of the parent’s
children below it in the list but indented. When closed, the children do not appear in the
hierarchy window’s list of objects.
NOTE: when you have a parent object and any number of child objects, you cannot move the
parent object without its children.
A useful trick that I learned in order to keep objects organized is to create an empty object to
use as a parent for child objects if there is no “base” object that always moves with all of its
children.
Project Window
The project window shows all of the assets that are in the folder associated with the specific
project you are working on. Assets can include textures, materials, physic materials, scripts,
prefab objects, and more, just to name some common ones I have worked with so far, as well
as folders to organize them. Brief descriptions of these assets are:
• Texture- a flat image that is included in materials in order to render an object visually in
a scene in more than just a colour.
• Material- has a texture or sometimes multiple textures associated with it which it wraps
around an object’s mesh in order to render it visually in a scene in more than just a
colour.
NOTE: if you change the texture in a material for one object, it changes for all objects
with the same material. If you wish to change a texture for one instance of an object
but not all, change the material for the object.
• Physic Material- used in Rigidbodies, the physical aspects of objects with properties
affected by the physics system built in to unity. An example of a property of physic
materials is friction.
• Scripts- programs that are attached to objects and execute within the game. In unity,
they are written in JavaScript, C#, or Boo.
• Prefab- an object with certain properties that are saved in order to be used more than
once. Any object can be made a prefab by simply clicking and dragging it from the
hierarchy window into the project window. If a parent is made a prefab, all of its
Learning Unity Using C#
9
children are included in the prefab as well. A prefab can be added into the scene by
clicking and dragging from the project window to either the hierarchy window or the
scene window.
Inspector Window
The inspector window is used to manipulate all properties of any selected object. The inspector
can be used to manipulate prefabs or specific game objects within a scene. If an object in a
scene is changed which has a prefab, the prefab can be updated by clicking the Apply button
near the top right of the inspector.
A component can be added to an object either via the dropdown menu at the top of the
program or by clicking and dragging from the project window to the inspector window with the
target object already selected.
The inspector can be used to manipulate the properties of pretty much everything about the
object. The most common properties which are always included and always located at the top
of the inspector are the objects transform properties.
The transform properties are the physical location of the object within the scene. They include
the position of the object, the rotation of the object, and the scale of the object, all with x, y,
and z axis numerical components. All three of those properties can be manipulated in the
inspector in order to precisely manipulate the object within the scene.
Toolbar
The toolbar at the top has already been discussed but to recap, the important buttons for now,
from left to right, are:
• Hand- to add more maneuverability to the scene view
• Move- to move an object’s position within the scene
• Rotate- to rotate an object within the scene
• Scale- to scale an object within the scene
• Play- to run the game for testing
• Pause- to pause and un-pause the game when it is running
• Step Forward- to move one frame forward within the game while it is paused
• Layout Drop Down Menu- to select the layout
Learning Unity Using C#
10
Creating Game Objects
Objects can be created from either the drop down Game Object menu at the top of the
program or, to a lesser extent, from the drop down create menu in the hierarchy window.
You can create a variety of different types of objects, the basics with very brief descriptions
being:
• Empty Objects- with no properties other than its transform properties.
• Particle Systems- special effects that are generated within systems
• Cameras- to view the game through
• GUI Text- to show text in the game
• Lights- to light the game in a variety of ways including from a source, or in one direction
• Shapes- generic game objects such as cubes, spheres, cylinders, etc.
Creating Components
Components are created in a similar way to game Objects. Either through the drop down
Components menu or, to a lesser extent, through the drop down create menu in the project
window.
There are also a variety of different components, again some basic ones with very brief
descriptions are:
• Meshes- for wrapping textures to your objects
• Effects- such as particle systems and trails
• Physics- components involved in unity’s physics engine such as:
o Rigidbodies- the physical properties of an object
o Colliders- the area where objects collide with other physical objects
o Controllers- physical controllers for character in the game
• Audio- listeners and sources for producing audio in a game
• Skybox- the background of the game as seen by the game camera
• Scripts- different programs to add to objects within the game to perform specific tasks
Learning Unity Using C#
11
C# in Unity
All Scripts include at the top:
using UnityEngine;
using System.Collections;
(in some cases, just “using System;”)
and after that, usually start with:
public class ScriptName
: MonoBehaviour {
Access Modifiers
private- variables are only accessible in the script
public- variables can be assigned and changed in the inspector window, as well as accessed by
other scripts with the proper referencing.
static- used to create global variables
Variable Types
int- a non-decimal number
float- a decimal number, assign by adding an ‘f’ after the number
Example: float num = 12f;
char- a character
string- a string of characters
bool- a true or false Boolean variable
Vector3- a float with 3 components, an x, y, and z component usually, commonly used for
position, rotation, and scaling of an object
Transform- a transform component to a game object
Learning Unity Using C#
12
GameObject- an instance of a game object
GUIText- a GUI text object
Material- a material component
PhysicMaterial- a physic material component
Queue<VariableType>- a generic queue included in System.Collections.Generic
Specific Examples
• TimeSpan timespan = DateTime.Now.TimeOfDay; - used for analog time
Later uses: timespan.TotalHours
timespan.TotalMinutes
timespan.TotalSeconds
• DateTime time = DateTime.Now; - used for discrete time
Later uses: time.Hour
time.Minute
time.Second
• Quaternion.Euler(float,float,float) - used for rotations
• Randome.Range(float,float) - used to generate a random float between two floats
• Randome.Range(int,int) - used to generate a random int between two ints
• Input.GetButtonDown(“ButtonName”) - detects if a certain button is pressed
• Input.GetButtonUp(“ButtonName”) - detects if a certain button is released
Methods
void Start() - used when object is first instantiated
void Update() - used when you want the object to update each frame
void FixedUpdate() - used when dealing with the physics engine, updates via time instead of
frames
void OnTriggerEnter() - used when you want something to happen when another object
triggers the one with this function
void OnTriggerExit() – used when you want something to happen when another object exits
the trigger zone of this object
Learning Unity Using C#
13
void OnCollisionEnter() – used when you want something to happen when another object
collides with this object
void OnCollisionExit() – used when you want something to happen when another object stops
colliding with this object
Accessors
.active – gets if the game object is active or not
.enabled – gets if the game object is enabled
.emit – whether a particle system is emitting particles or not
.gameObject – gets the game object
.transform – gets the game object’s transform
.localPosition – from a transform, gets the position of that transform
.localRotate – from a transform, gets the rotation of that transform
.localScale – from a transform, gets the scale of that transform
.Length – length of an array
.x – first component of a Vector3
.y – second component of a Vector3
.z – third component of a Vector3
.rigidbody – gets the rigidbody of an object
.VelocityChange – used after ForceMode, changes the velocity
.Acceleration – used after ForceMode, accelerates the velocity
.isKinematic – gets if a rigidbody is kinematic (doesn’t use physics) or not
Built In Functions
.ToString() – gets the string of the object
Learning Unity Using C#
14
.ToString(“f0”) – gets the string of a float formatted a certain way
.ClearParticles() – clears the particles in a particle system
.Enqueue(VariableTypeOfQueue) – used in generic queue to add an object
.Dequeue() – used in generic queue to remove an object
.Peek() – used in generic queue to look at but not remove the next object
.AddForce(Vector3,ForceMode) – adds a force to a rigidbody
Learning Unity Using C#
15
References
Unity Basics Video Tutorials
2D Gameplay Tutorial
Unity C# Tutorials
Log in to post a comment | https://www.techylib.com/en/view/sandpaperlead/learning_unity3d_using_c | CC-MAIN-2017-22 | en | refinedweb |
CodePlexProject Hosting for Open Source Software
Hey guys,
On the front page of my site, I would like to have a section that lists the most current blog entries (from my blog page) and when the entry is clicked on, the blog page with the entry clicked is shown. I would think that this wouldn't too difficult to achieve,
but my relative newness to XSLT is causing me to draw a blank on that.
I would really appreciate any suggestions on how this could be achieved. (Note: once the News package is updated to 2.0, I will be doing something similar)
Thanks a lot guys!
Robert
The blog package use an XSLT extension (that come with the blog package) to create the date+title based URL element. So you call this extension to get the info. You can sneak peak in the existing XSLT for BlogRenderer. The primary steps here are:
1) Register the custom XSLT Extension for the blog by adding a call to "Composite.Community.Blog.XsltExtensions" on the Functions tab. Your preview will now display details about this extension
2) Register a namespace to this extension - easiest way is to add the following xmlns declaration inside the <xsl:stylesheet /> element:
xmlns:be="#BlogXsltExtensionsFunction"
xmlns:be="#BlogXsltExtensionsFunction"
3) Make sure that you include the "PageId", "Date" and "Title" fields in the "GetEntriesXml" function call so you have those values in the XML.
4) When you iterate through the resulting <Entries /> elements you go:
<a href="~/Renderers/Page.aspx{be:GetBlogUrl(@Date, @Title)}?pageId={@PageId}">
<xsl:value-of
</a>
The markup above is pretty much a raw copy from the BlogRenderer function that ships with the package.
Hope this help :)
Thank you thank you thank you! :)
That was just enough information for me to go forward with. Knowing what to use when and where (like Composite.Community.Blog.XsltExtensions, for instance) is the difficult part. It will just take some time, I guess, poking into areas and learning as
I go.
I GREATLY appreciate the assistance and will try to keep these kinds of posts to a minimum. :)
Thanks again!!
shouldn't you be able to render the "real" url of your page, and not actually using the Renderers/Page.aspx-pattern which is not very user friendly? What will the markup be for that?
>> shouldn't you be able to render the "real" url of your page, and not actually using the Renderers/Page.aspx-pattern which is not very user friendly? What will the markup be for that?
C1 automatically replaces url's like ~/Renderers/Page.aspx?id=.... with friendly urls. In "/Renderers/Page.aspx" there's a call to
PageUrlHelper.ChangeRenderingPageUrlsToPublic which does this work.
The reason for that is that users friendly url's are subject to change, futher more reference like
~/Renderers/Page.aspx?id=....
will be referenced to the same language and publication scope as the page it is put on, f.e. by viewing page in "en-US" all those internal
links will shown as links to pages from "en-US" language.
Ok, I have another question about this.
I have the functionality working except the list of blogs are not being presented in descending chronological order. I cannot really determine what order they are being displayed in.
The BlogRenderer function is displaying in descending order, correctly (of course), however, I cannot see anything in the code that regulates or determines this.
Any pointers would, again, be most welcome and appreciated.
Thank you,
If you are using the GetEntriesXml function to get data, you probably have two parameters on that function named OrderByField and OrderAscending - if you do, try setting them to the date field and 'false'.
*sigh*
So simple.
Thanks once more Marcus.
;-)
Hi guys,
Is that possible to get a source code of Composite.Community.Blog.dll assembly ?
-Ruslan
Are you sure you want to delete this post? You will not be able to recover it later.
Are you sure you want to delete this thread? You will not be able to recover it later. | http://c1cms.codeplex.com/discussions/234501 | CC-MAIN-2017-22 | en | refinedweb |
RadDockPanel is used to layout visual elements. The specific of the RadDockPanel control consists in that it docks its children to either
left, top, bottom and right. You are able to control the side to which an element gets docked by setting a single property.
To use RadDockPanel in your application you have to reference the following assembly:
After adding references to the aforementioned dll, you can declare a new RadDockPanel instance as any normal Silverlight control.
To use the RadDockPanel control in the XAML you have to add the following namespace declaration:
<telerikPrimitives:RadDockPanel x:
To dock its children to the desired docking location, you just have to set their RadDockPanel.Dock attached property. Here is an example.
<telerikPrimitives:RadDockPanel x:
<Border Width="100" telerikPrimitives:RadDockPanel.
<Border Width="100" telerikPrimitives:RadDockPanel.
</telerikPrimitives:RadDockPanel>
Here is a snapshot of the result. | http://docs.telerik.com/help/windows-phone/raddockpanel-getting-started.html | CC-MAIN-2017-22 | en | refinedweb |
.
Composer is heavily inspired by NPM which has built a strong culture of code-sharing and easy deployment in the Node.js community.
Easy for users
With Composer, managing dependencies in your project is very easy. Simply create a composer.json file where you state your dependencies, and let the package management system worry about the rest.
Packages that are registered with packagist.org are obviously easiest to depend on, but you can also state packages coming from custom repositories (like your company's internal version control system), or PHP extensions that you need.
Here is for example the composer.json from the Midgard PHPCR provider:
{ "name": "midgard/phpcr", "type": "library", "require": { "php": ">=5.3.0", "ext-midgard2": ">=10.05.5", "phpcr/phpcr": ">=2.1.0-beta1" } }
With this file, Composer knows that our PHPCR provider runs only on PHP 5.3 or newer (as it uses namespaces), and that it needs the Midgard PHP extension and the PHPCR interface classes to be available.
Now installing the project is easy:
$ wget $ php composer.phar install
How about autoloading? Traditionally PHP required you to manually include or require all files you wanted to use in your code, with the possibility to write an autoloader to handle it automatically when you call an undefined class. But managing these autoloaders is also a chore.
Composer helps here too, by automatically generating an autoloader that will be able to load your own code, and the code from all your dependencies. So you can get rid of your own autoloaders and include statements, and just include the Composer-generated autoloader in your code:
require 'vendor/.composer/autoload.php';
After this all the classes you've stated your application needing will be available.
Easy for developers
While ease-of-installation is important, it isn't enough to build an ecosystem. The other thing that has to be easy is publishing code. Basically: if you've written a piece of functionality in PHP that you could see yourself using in another project, it should be effortless to publish it as a library.
This is where approaches like PEAR mostly failed, by making it too cumbersome to define your packages, to build them, and to upload them to the repository.
With Composer this is very easy. You again define a composer.json for your package, and push that to your project's Git repository. Then just register the Git repository URL with packagist.org.
After this Packagist will spider your repository and make it available as a package.
Publishing new versions is very easy: simply keep your composer.json up-to-date, and tag your releases in Git.
Where are we now?
It is still early days for Composer, and the project is being worked on at a hectic pace. However, it is already good enough for managing dependencies to modern, PSR-0 compatible libraries.
What I would like to see happen next is support for custom package roles and autoloaders. This would allow us to handle more specific cases, like for example installation of Midgard MVC components and their non-namespaced autoloading needs. After that we should be able to get rid of our custom installer code and just join the Composer crowd.
But if your code is already fully namespaced, this is a great time to get started with Composer.
Source:
{{ parent.title || parent.header.title}}
{{ parent.tldr }}
{{ parent.linkDescription }}{{ parent.urlSource.name }} | https://dzone.com/articles/composer-solves-php-code | CC-MAIN-2017-22 | en | refinedweb |
What is a 1099 and Why did I Get One?
1099s Report Income to you
In general, 1099 forms are used to report income that is potentially taxable to you. There are at least seventeen 1099 forms.
1098 forms are used to report payments that you made and that are potentially tax deductible such as mortgage interest (1098) and college tuition (1098-T).
Unless otherwise indicated, you should receive these forms by January 31st following the tax year they pertain to. Filing your tax return prior to receiving all of your forms could require you to file an amended tax return (1040-X) after you finally receive them.
1099 of the Self-Employed
1099-MISC
This is the big one that, in my tax office, people are often surprised they received. They do a little work for someone, maybe babysitting, car repair, consulting or cleaning a house and at the end of the year, they get a 1099-MISC. 1099-MISC forms are issued to non-employee independent contractors for services performed. No income, Social Security or Medicare taxes are deducted from this income by the payer (although back-up withholding rules do apply).
Everyone who receives $600 or more from a payer will be issued a 1099-MISC from that payer.
To report this income on your 1040, the income is first reported on Schedule C with expenses deducted from the gross income reported.
Self-employed individuals are required to pay both the employer and employee portions of the Social Security and Medicare taxes.
Taxpayers who did not expect to get a 1099-MISC and did not keep tract of expenses are surprised not only by their income tax bill, but also the Social Security and Medicare taxes they have to pay at the end of the year.
In addition to being used to report income to a sub-contractor or independent contractor, 1099-MISC is also used to report such earnings as:
- Rent or Royalty Payments ($10 or more reportable)
- Prizes and Awards, such as winnings on TV or Radio Shows (Note: Gambling winnings are reported on a W-2G).
- Payments to Crew Members by Owners or Operators of fishing boats including payments of proceeds from sale of catch
- Fish purchase paid in cash for resale.
- Crop insurance proceeds.
- Substitute dividends and tax-exempt interest payments reportable by brokers.
- Gross proceeds paid to attorneys ($600 and over).
Most 1099-MISC should be received by January 31st with a few exceptions due by February 15th.
1099-K
Merchant Card and Third-Party Network Payments
Banks and other payment settlement entities, such as PayPal, are required to report payment card and third-party network transactions with their participating merchants. 2011 was the first year this form was required to be used.
Unlike a 1099-MISC, the 1099-K is for informational purposes. Basically, it documents the credit card or third party network payments you receive in return for goods or services. Most likely, you will already have records documenting these transactions when they occurred. Do not double count the transaction records (gross receipts) and the 1099-K.
With the 1099-K, the IRS hopes to decrease underreporting of these types of transactions and thus underreporting of income and the subsequent income tax owed by small business owners.
If you received $600 or more as a single or aggregate payment from a third-party network or credit card company, you will receive a 1099-K by January 31st. This will affect a lot of people who run eBay or other on-line businesses. Since writers on HubPages are paid only through PayPal, a third party network, writers will no longer receive a 1099-MISC from HubPages, but will instead receive a 1099-K from PayPal.
The Common 1099s
The common 1099s that many people get include:
- 1099-INT Interest Income
Interest income from banks, credit unions, and other financial institutions are reported on a 1099-INT. Interest from savings bonds are also reported on a 1099-INT, but interest from money market accounts is reported on a 1099-DIV.
- 1099-DIV Dividends and Distributions
Dividends, capital gain distributions and nontaxable distributions paid on stock, mutual funds or ETFs are reported on a 1099-DIV.
- 1099-G Certain Government Payments
State and local tax refunds and unemployment compensation are reported on a 1099-G. It is also used to report agricultural payments and taxable grants.
- SSA-1099 Social Security Benefit Statement
Social Security benefits and your payment of Medicare Part B and/or Part D premiums are reported on a SSA-1099.
- 1099-R Distributions from Pensions, Annuities, Retirement or Profit-Sharing Plans, IRAs, Insurance Contracts, etc.
Distributions from pensions, annuities, 401(k)s, IRAs and insurance contracts will be reported on a 1099-R. Transfers, conversions, and recharacterizations of IRAs will also be reported on a 1099-R. While all of these transactions must be reported on your income tax return, not all of them result in a tax liability.
- 1099-B Proceeds from Broker and Barter Exchange Transactions
A 1099-B issued by a broker or financial institution records sales or redemptions of securities such as stocks, bonds, mutual funds, and ETFs. It is also used to record the sales or redemptions of futures transactions, commodities, and barter exchange transactions. It must document the date of purchase and the purchase price (basis) as well as the date of sale and sales price of each asset sold or redemed.
You should receive this form by February 15th.
- 1099-C Cancellation of Debt
You will receive a 1099-C with the cancellation of debt by a financial institution, a credit union, the Federal Government, the U.S. postal service, FDIC or NCUA. Unless your debt is cancelled as a result of bankruptcy or you document that you are insolvent at the time the debt is cancelled, the cancelled debt will be considered taxable income. Under the Mortgage Debt Relief Act of 2007, the forgiveness of debt by restructuring or foreclosure on your principal residence is generally not taxable. This act expires at the end of 2012.
Taxpayers who have a credit card debt cancelled by a bank are surprised to receive a 1099-C and even more surprised as to how it affects their taxable income. Often, instead of receiving a refund they now owe taxes.
- 1099-OID Original Issue Discount
OID is a type of interest on zero coupon bonds and other similar debt instruments that pay no interest until their maturity.
- 1099-S Proceeds from a Real Estate Transactions
Gross proceeds from the sale of real estate and certain royalty payments are reported on a 1099-S.
Other Less Common 1099s
- 1099-A Acqusition or Abandonment of Secured Property
- 1099-CAP Changes in Corporate Control and Capital Structure
- 1099-H Health Coverage Tax Credit (HCTC) Advance Payments
- 1099-LTC Long-Term Care and Accelerated Death Benefits
- 1099-PATR Taxable Distributions Received from Cooperatives
- 1099-SA Proceeds from an HSA, Archer MSA, or Medicare Advantage MSA.
© 2012 bankscottage | https://hubpages.com/money/What-is-a-1099-and-Why-did-I-Get-One | CC-MAIN-2017-22 | en | refinedweb |
Opened 11 years ago
Closed 11 years ago
Last modified 11 years ago
#1205 closed defect (invalid)
PasswordField for secret input is missing and not easily self-madeable.
Description
There doesnt seem to be a thing like a PasswordField, or?
I found a formfield.PasswordField, but when I try to derive from CharField like this:
class PasswordField(meta.CharField):
def get_manipulator_field_objs(self):
return [formfields.PasswordField]
and want to use the resulting class, manage.py throws:
File "/usr/lib/python2.3/site-packages/django/core/management.py", line 75, in get_sql_create
col_type = db.DATA_TYPES[data_type]
KeyError: 'PasswordField'
Change History (2)
comment:1 Changed 11 years ago by
comment:2 Changed 11 years ago by
Milestone Version 0.91 deleted
Add this to your
PasswordField: | https://code.djangoproject.com/ticket/1205 | CC-MAIN-2017-22 | en | refinedweb |
Learning
ACTIONSCRIPT
®
3.0
Last updated 5/2/2011
Legal notices
Legal notices
For legal notices, see
h
t
t
p://h
e
l
p
.ado
b
e
.co
m/en_US/lega
ln
o
t
ices/in
dex.h
t
m
l
.
iii
Last updated 5/2/2011
Contents
Chapter 1: Introduction to ActionScript 3.0
About ActionScript
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
Advantages of ActionScript 3.0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
1
What’s new in ActionScript 3.0
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
2
Chapter 2: Getting started with ActionScript
Programming fundamentals
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
Working with objects
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
Common program elements
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
15
Example: Animation portfolio piece (Flash Professional)
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
17
Building applications with ActionScript
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
Creating your own classes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
23
Example: Creating a basic application
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
25
Chapter 3: ActionScript language and syntax
Language overview
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
33
Objects and classes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
Packages and namespaces
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
34
Variables
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
44
Data types
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
47
Syntax
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
59
Operators
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
64
Conditionals
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
69
Looping
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
71
Functions
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
74
Chapter 4: Object-oriented programming in ActionScript
Introduction to object-oriented programming
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
Classes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
85
Interfaces
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
99
Inheritance
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
101
Advanced topics
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
109
Example: GeometricShapes
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
115
1
Last updated 5/2/2011
Chapter 1: Introduction to ActionScript
3.0
About ActionScript:
•
A new ActionScript Virtual Machine, called AVM2, that uses a new bytecode instruction set and provides
significant performance improvements
•
A more modern compiler code base that performs deeper optimizations than previous versions of the compiler
•
An expanded and improved application programming interface (API), with low-level control of objects and a true
object-oriented model
•
An XML API based on the ECMAScript for XML (E4X) specification (ECMA-357 edition 2). E4X is a language
extension to ECMAScript that adds XML as a native data type of the language.
•
An event model based on the Document Object Model (DOM) Level 3 Events Specification
Advantages of ActionScript 3.0.
2
LEARNING ACTIONSCRIPT 3.0
Introduction to ActionScript 3.0
Last updated 5/2/2011
What’s new in ActionScript 3.0.
Core language features
The core language defines the basic building blocks of the programming language, such as statements, expressions,
conditions, loops, and types. ActionScript 3.0 contains many features that speed up the development process.
Run-time exceptions.
Run-time types.
Sealed classes.
Method closures
ActionScript 3.0 enables a method closure to automatically remember its original object instance. This feature is useful
for event handling. In ActionScript 2.0, method closures do not remember what object instance they were extracted
from, leading to unexpected behavior when the method closure is called.
ECMAScript for XML (E4X)
.
Regular expressions
ActionScript 3.0 includes native support for regular expressions so that you can quickly search for and manipulate
strings. ActionScript 3.0 implements support for regular expressions as they are defined in the ECMAScript (ECMA-
262) edition 3 language specification.
3
LEARNING ACTIONSCRIPT 3.0
Introduction to ActionScript 3.0
Last updated 5/2/2011
Namespaces.
New primitive types.
API features.
DOM3 event model.
Display list API.
Handling dynamic data and content.
4
LEARNING ACTIONSCRIPT 3.0
Introduction to ActionScript 3.0
Last updated 5/2/2011
Low-level data access.
Working with text.
5
Last updated 5/2/2011
Chapter 2: Getting started with
ActionScript
Programming fundamentals
Since ActionScript is a programming language, it can help you to learn ActionScript if you first understand a few
general computer programming concepts.
What computer programs do
First of all, it’s useful to have a conceptual idea of what a computer program is and what it does. There are two main
aspects to a computer program:
•
A program is a series of instructions or steps for the computer to carry out.
•
Each step ultimately involves manipulating some piece of information or data.
In a general sense, a computer program is just a list of step-by-step instructions that you give to the computer, which
it performs one by one. Each individual instruction is known as a statement. In ActionScript, each statement is written
with a semicolon at the end.
In essence, all that a given instruction in a program does is manipulate some bit of data that’s stored in the computer’s
memory. A simple example is instructing the computer to add two numbers and store the result in its memory. A more
complex example is if there is a rectangle drawn on the screen and you want to write a program to move it somewhere
else on the screen. The computer remembers certain information about the rectangle: the x, y coordinates where it’s
located, how wide and tall it is, what color it is, and so on. Each of those bits of information is stored somewhere in the
computer’s memory. A program to move the rectangle to a different location would have steps like “change the x
coordinate to 200; change the y coordinate to 150.” In other words, it would specify new values for the x and y
coordinates. Behind the scenes, the computer does something with this data to actually turn those numbers into the
image that appears on the computer screen. However, at the basic level of detail it’s enough to know that the process
of “moving a rectangle on the screen” just involves changing bits of data in the computer’s memory.
Variables and constants
Programming mainly involves changing pieces of information in the computer’s memory. Consequently, it’s
important to have a way to represent a single piece of information in a program. A variable is a name that represents
a value in the computer’s memory. As you write statements to manipulate values, you write the variable’s name in place
of the value. Any time the computer sees the variable name in your program, it looks in its memory and uses the value
it finds there. For example, if you have two variables named
value1
and
value2
, each containing a number, to add
those two numbers you could write the statement:
value1 + value2
When it’s actually carrying out the steps, the computer looks to see the values in each variable and adds them together.
In ActionScript 3.0, a variable actually consists of three different parts:
•
The variable’s name
•
The type of data that can be stored in the variable
•
The actual value stored in the computer’s memory
6
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
You’ve seen how the computer uses the name as a placeholder for the value. The data type is also important. When
you create a variable in ActionScript, you specify the specific type of data that it is meant to hold. From that point on,
your program’s instructions can store only that type of data in the variable. You can manipulate the value using the
particular characteristics associated with its data type. In ActionScript, to create a variable (known as declaring the
variable), you use the
var
statement:
var value1:Number;
This example tells the computer to create a variable named
value1
, which can hold only Number data. (“Number” is
a specific data type defined in ActionScript.) You can also store a value in the variable right away:
var value2:Number = 17;
Adobe Flash Professional
In Flash Professional, there is another way to declare a variable. When you place a movie clip symbol, button symbol,
or text field on the Stage, you can give it an instance name in the Property inspector. Behind the scenes, Flash
Professional creates a variable with the same name as the instance name. You can use that name in your ActionScript
code to represent that Stage item. Suppose, for example, that you have a movie clip symbol on the Stage and you give
it the instance name
rocketShip
. Whenever you use the variable
rocketShip
in your ActionScript code, you are in
fact manipulating that movie clip.
A constant is similar to a variable. It is a name that represents a value in the computer’s memory with a specified data
type. The difference is that a constant can only be assigned a value one time in the course of an ActionScript
application. Once a constant’s value is assigned, it is the same throughout the application. The syntax for declaring a
constant is almost the same as that for declaring a variable. The only difference is that you use the
const
keyword
instead of the
var
keyword:
const SALES_TAX_RATE:Number = 0.07;
A constant is useful for defining a value that is used in multiple places throughout a project, which don’t change under
normal circumstances. Using a constant rather than a literal value makes your code more readable. For example,
consider two versions of the same code. One multiplies a price by
SALES_TAX_RATE
. The other multiplies the price by
0.07
. The version that uses the
SALES_TAX_RATE
constant is easier to understand. In addition, suppose the value
defined by the constant does change. If you use a constant to represent that value throughout your project, you can
change the value in one place (the constant declaration). In contrast, you would have to change it in various places if
you used hard-coded literal values.
Data types
In ActionScript, there are many data types that you can use as the data type of the variables you create. Some of these
data types can be thought of as “simple” or “fundamental” data types:
•
String: a textual value, like a name or the text of a book chapter
•
Numeric: ActionScript 3.0 includes three specific data types for numeric data:
•
Number: any numeric value, including values with or without a fraction
•
int: an integer (a whole number without a fraction)
•
uint: an “unsigned” integer, meaning a whole number that can’t be negative
•
Boolean: a true-or-false value, such as whether a switch is on or whether two values are equal
7
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
The simple data types represent a single piece of information: for example, a single number or a single sequence of text.
However, most of the data types defined in ActionScript could are complex data types. They represent a set of values
in a single container. For example, a variable with the data type Date represents a single value (a moment in time).
Nevertheless, that date value is represented as several values: the day, month, year, hours, minutes, seconds, and so on,
all of which are individual numbers. People generally think of a date as a single value, and you can treat a date as a
single value by creating a Date variable. However, internally the computer thinks of it as a group of several values that,
put together, define a single date.
Most of the built-in data types, as well as data types defined by programmers, are complex data types. Some of the
complex data types you probably recognize are:
•
MovieClip: a movie clip symbol
•
TextField: a dynamic or input text field
•
SimpleButton: a button symbol
•
Date: information about a single moment in time (a date and time)
Two words that are often used as synonyms for data type are class and object. A class is simply the definition of a data
type. It’s like a template for all objects of the data type, like saying “all variables of the Example data type have these
characteristics: A, B, and C.” An object, on the other hand, is just an actual instance of a class. For example, a variable
whose data type is MovieClip could be described as a MovieClip object. The following are different ways of saying the
same thing:
•
The data type of the variable
myVariable
is Number.
•
The variable
myVariable
is a Number instance.
•
The variable
myVariable
is a Number object.
•
The variable
myVariable
is an instance of the Number class.
Working with objects.
Adobe Flash Professional.
8
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011:
•
Properties
•
Methods
•
Events
These elements are used to manage the pieces of data used by the program and to decide what actions are carried out
and in what order.
Properties.
Methods();
9
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011();
Events.
Basic event handling
The technique for specifying certain actions to perform in response to particular events is known as event handling.
When you are writing ActionScript code to perform event handling, there are three important elements you’ll want to
identify:
•).
•
The event: What is the thing that is going to happen, the thing that you want to respond to? The specific event is
important to identify, because many objects trigger several events.
•
The response: What steps do you want performed when the event happens?
10
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011:
•
First, the name of the specific event you want to respond to. Each event is affiliated with a specific class. Every event
class has a special value, which is like a unique name, defined for each of its events. You use that value for the first
parameter.
•
Second, the name of your event response function. Note that a function name is written without parentheses when
it’s passed as a parameter.
The event-handling process);
11
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
Here is how this code would actually work when it’s running:
1
When the SWF file loads, the computer makes note of the fact that there’s a function named
eventResponse()
.
2.
12
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
3
At some point, the user clicks the
myButton
object, triggering its
click
event (identified as
MouseEvent.CLICK
in
the code).
At that point, the following occurs:
a.
b.
13
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
c
When the
eventResponse()
function is called, the code in that function runs, so your specified actions are
carried out.
Event-handling examples
Here are a few more concrete examples of event handling code. These examples are meant to give you an idea of some
of the common event elements and possible variations available when you write event-handling code:
•);
•);
•);
14
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
Creating object instances:
•
Literal numeric value (enter the number directly):
var someNumber:Number = 17.239;
var someNegativeInteger:int = -53;
var someUint:uint = 22;
•
Literal String value (surround the text with double quotation marks):
var firstName:String = "George";
var soliloquy:String = "To be or not to be, that is the question...";
•
Literal Boolean value (use the literal values
true
or
false
):
var niceWeather:Boolean = true;
var playingOutside:Boolean = false;
•
Literal Array value (wrap a comma-separated list of values in square brackets):
var seasons:Array = ["spring", "summer", "autumn", "winter"];
•:
15
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011.
Adobe Flash Professional
In Flash Professional, the
new
operator can also be used to create an instance of a movie clip symbol that is defined in
the Library but isn’t placed on the Stage.
More Help topics
Working with arrays
Using regular expressions
Creating MovieClip objects with ActionScript
Common program elements
There are a few additional building blocks that you use to create an ActionScript program.
Operators
Operators are special symbols (or occasionally words) that are used to perform calculations. They are mostly used for
math operations, and also used when comparing values to each other. Generally, an operator uses one or more values
and “works out” to a single result. For example:
•
The addition operator (
+
) adds two values together, resulting in a single number:
var sum:Number = 23 + 32;
•
The multiplication operator (
*
) multiplies one value by another, resulting in a single number:
var energy:Number = mass * speedOfLight * speedOfLight;
•
The equality operator (
==
) compares two values to see if they are equal, resulting in a single true-or-false (Boolean)
value:
if (dayOfWeek == "Wednesday")
{
takeOutTrash();
}
As shown here, the equality operator and the other “comparison” operators are most commonly used with the
if
statement to determine whether or not certain instructions are carried out.
16
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
As you’re writing ActionScript, you’ll often want to leave notes to yourself. For example, sometimes you want to
explain how certain lines of code work or why you made a particular choice. Code comments are a tool you can use to
write text that the computer ignores in your code. ActionScript includes two kinds of comments:
•
Single-line comment: A single-line comment is designated by placing two slashes anywhere on a line. The computer
ignores everything after the slashes up to the end of that line:
// This is a comment; it's ignored by the computer.
var age:Number = 10; // Set the age to 10 by default.
•
Multiline comments: A multiline comment includes a starting comment marker (
/*
), then the comment content,
and an ending comment marker (
*/
). The computer ignores everything between the starting and ending markers
regardless of how many lines the comment spans:
/*
This is a long description explaining what
a particular
function is used for or explaining a section of code.
In any case, the computer ignores these lines.
*/
Another common use of comments is to temporarily “turn off” one or more lines of code. For example, you can use
comments if you’re testing out a different way of doing something. You can also use them to try to figure out why
certain ActionScript code isn’t working the way you expect.
Flow control
Many times in a program, you want to repeat certain actions, perform only certain actions and not others, perform
alternative actions depending on certain conditions, and so on. Flow control is the control over which actions are
performed. There are several types of flow control elements available in ActionScript.
•
Functions: Functions are like shortcuts. They provide a way to group a series of actions under a single name, and
can be used to perform calculations. Functions are necessary for handling events, but are also used as a general tool
for grouping a series of instructions.
•
Loops: Loop structures let you designate a set of instructions that the computer performs a set number of times or
until some condition changes. Often loops are used to manipulate several related items, using a variable whose
value changes each time the computer works through the loop.
•
Conditional statements: Conditional statements provide a way to designate certain instructions that are carried out
only under certain circumstances. They are also used to provide alternative sets of instructions for different
conditions. The most common type of conditional statement is the
if
statement. The
if
statement checks a value
or expression in its parentheses. If the value is
true,
the lines of code in curly brackets are carried out. Otherwise,
they are ignored. For example:
if (age < 20)
{
// show special teenager-targeted content
}
The
if
statement’s companion, the
else
statement, lets you designate alternative instructions that the computer
performs if the condition is not
true
:
17
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
if (username == "admin")
{
// do some administrator-only things, like showing extra options
}
else
{
// do some non-administrator things
}
Example: Animation portfolio piece (Flash Professional):
1
Prepare the FLA file for adding ActionScript and interactive elements.
2
Create and add the buttons.
3
Write the ActionScript code.
4
Test the application.
Preparing to add interactivity.
To set up your FLA for adding interactive elements:
1
Create a FLA file with a simple animation such as a single motion tween or shape tween. If you already have a FLA
file containing the animation that you’re showcasing in the project, open that file and save it with a new name.
2.
3
Add a new layer, above the other layers in the Timeline, and name it buttons. This layer is where you’ll add the
buttons.
4
Add a new layer, above the buttons layer, and name it actions. This layer is where you’ll add ActionScript code to
your application.
Creating and adding buttons
Next, you’ll actually create and position the buttons that form the center of the interactive application.
18
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
To create and add buttons to the FLA:
1
Using the drawing tools, create the visual appearance of your first button (the “play” button) on the buttons layer.
For example, draw a horizontal oval with text on top of it.
2
Using the Selection tool, select all the graphic parts of the single button.
3
From the main menu, choose Modify
> Convert To Symbol.
4
In the dialog box, choose Button as the symbol type, give the symbol a name, and click OK.
5
With the button selected, in the Property inspector give the button the instance name playButton.
6
Repeat steps 1 through 5 to create the button that takes the viewer to the author’s home page. Name this button
homeButton.
Writing the code
The ActionScript code for this application can be divided into three sets of functionality, although you enter it all in
the same place. The three things the code does are:
•
Stop the playhead as soon as the SWF file loads (when the playhead enters Frame 1).
•
Listen for an event to start the SWF file playing when the user clicks the play button.
•
Listen for an event to send the browser to the appropriate URL when the user clicks the author home page button.
To create code to stop the playhead when it enters Frame 1:
1
Select the keyframe on Frame 1 of the actions layer.
2
To open the Actions panel, from the main menu, choose Window
> Actions.
3
In the Script pane, enter the following code:
stop();
To write code to start the animation when the play button is clicked:
1
At the end of the code entered in the previous steps, add two empty lines.
2
Enter the following code at the bottom of the script:
function startMovie(event:MouseEvent):void
{
this.play();
}
This code defines a function called
startMovie()
. When
startMovie()
is called, it causes the main timeline to
start playing.
3.
To write code to send the browser to a URL when the home page button is clicked:
1
At the end of the code entered in the previous steps, add two empty lines.
2
Enter this code at the bottom of the script:
19
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011.
3
On the line following the code added in the previous step, enter this line of code:.
Testing the application
The application is now completely functional. Let’s test it to make sure that’s the case.
To test the application:
1
From the main menu, choose Control
> Test Movie. Flash Professional creates the SWF file and opens it in a Flash
Player window.
2
Try both the buttons to make sure that they do what you expect them to.
3
If the buttons don’t work, here are some things to check for:
•
Do the buttons both have distinct instance names?
•
Do the
addEventListener()
method calls use the same names as the buttons’ instance names?
•
Are the correct event names used in the
addEventListener()
method calls?
•.
Building applications with ActionScript:
•
What programs can be used for writing ActionScript?
•
How do you organize ActionScript code?
•
How do you include ActionScript code in an application?
•
What steps do you follow in developing an ActionScript application?
20
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
Options for organizing your code
You can use ActionScript 3.0 code to power everything from simple graphics animations to complex client-server
transaction processing systems. Depending on the type of application you’re building, use one or more of these
different ways of including ActionScript in your project.
Storing code in frames in a Flash Professional timeline).
Embedding code in Flex MXML files.
Note: You can specify a source parameter for an
<fx:Script>
tag. Using a source parameter lets you “import”
ActionScript code from an external file as if it was typed directly within the
<fx:Script>
tag. However, the source file
that you use cannot define its own class, which limits its reusability.
Storing code in.
•
•
ActionScript class definition: A definition of an ActionScript class, including its method and property definitions.
21
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
When you define a class you can access the ActionScript code in the class by creating an instance of the class and
using its properties, methods, and events. Using your own classes is identical to using any of the built-in
ActionScript classes, and requires two parts:
•.
•.
Choosing the right tool
You can use one of several tools (or multiple tools together) for writing and editing your ActionScript code.
Flash Builder.
Flash Professional.
22
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
Flash Professional includes two tools for writing ActionScript code:
•
Actions panel: Available when working in a FLA file, this panel allows you to write ActionScript code attached to
frames on a timeline.
•
Script window: The Script window is a dedicated text editor for working with ActionScript (.as) code files.
Third-party ActionScript editor:
•
You prefer to write ActionScript code in a separate program and design visual elements in Flash Professional.
•
You use an application for non-ActionScript programming (such as creating HTML pages or building applications
in another programming language). You want to use the same application for your ActionScript coding as well.
•
You want to create ActionScript-only or Flex projects using the Flex SDK without Flash Professional or Flash
Builder.
Some of the notable code editors providing ActionScript-specific support include:
•
Adobe Dreamweaver® CS4
•
ASDT
•
FDT
•
FlashDevelop
•
PrimalScript
•
SE|PY
•
TextMate
(with
ActionScript and Flex bundles
)
The ActionScript development process
Whether your ActionScript project is large or small, using a process to design and develop your application makes
work more efficient and effective. The following steps describe a basic development process for building an application
that uses ActionScript 3.0:
1
Design your application.
Describe your application in some way before you start building it.
2
Compose your ActionScript 3.0 code.
You can create ActionScript code using Flash Professional, Flash Builder, Dreamweaver, or a text editor.
3.
4
Publish and test your ActionScript application.
23
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011.
Creating your own classes
The process of creating classes for use in your projects can seem daunting. However, the more difficult part of creating
a class is the task of designing the class’s methods, properties, and events.
Strategies for designing a class
The topic of object-oriented design is a complex one; entire careers have been devoted to the academic study and
professional practice of this discipline. Nevertheless, here are a few suggested approaches that can help you get started.
1
Think about the role that the instances of this class play in the application. Generally, objects serve one of these
three roles:
•
Value object: These objects serve primarily as containers of data. They probably have several properties and
fewer methods (or sometimes no methods). They are generally code representations of clearly defined items. For
example, a music player application could include a Song class representing a single real-world song and a
Playlist class representing a conceptual group of songs.
•
Display object: These are objects that actually appear on the screen. Examples include user-interface elements
like a drop-down list or status readout, graphical elements like creatures in a video game, and so on.
•
Application structure: These objects play a broad range of supporting roles in the logic or processing performed
by applications. For example, you can make an object to perform certain calculations in a biology simulation.
You can make one that’s responsible for synchronizing values between a dial control and a volume readout in a
music player application. Another one can manage the rules in a video game. Or you can make a class to load a
saved picture in a drawing application.
2
Decide the specific functionality that the class needs. The different types of functionality often become the methods
of the class.
3
If the class is intended to serve as a value object, decide the data that the instances include. These items are good
candidates for properties.
4
Since your class is being designed specifically for your project, what’s most important is that you provide the
functionality that your application needs. Try to answer these questions for yourself:
•
What pieces of information is your application storing, tracking, and manipulating? Answering this question
helps you identify any value objects and properties you need.
•
What sets of actions does the application perform? For example, what happens when the application first loads,
when a particular button is clicked, when a movie stops playing, and so on? These are good candidates for
methods. They can also be properties if the “actions” involve changing individual values.
•
For any given action, what information is necessary to perform that action? Those pieces of information become
the parameters of the method.
24
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
•
As the application proceeds to do its work, what things change in your class that other parts of your application
need to know about? These are good candidates for events.
5
Is there is an existing object that is similar to the object you need except that it’s lacking some additional
functionality you want to add? Consider creating a subclass. (A subclass is a class which builds on the functionality
of an existing class, rather than defining all of its own functionality.) For example, to create a class that is a visual
object on the screen, use the behavior of an existing display object as a basis for your class. In that case, the display
object (such as MovieClip or Sprite) would be the base class, and your class would extend that class.
Writing the code for a class
Once you have a design for your class, or at least some idea of what information it stores and what actions it carries
out, the actual syntax of writing a class is fairly straightforward.
Here are the minimum steps to create your own ActionScript class:
1
Open a new text document in your ActionScript text editor program.
2
Enter a
class
statement to define the name of the class. To add a
class
statement, enter the words
public class
and then the class’s name. Add opening and closing curly brackets to contain the contents of the class (the method
and property definitions). For example:
public class MyClass
{
}
The word
public
indicates that the class can be accessed from any other code. For other alternatives, see Access
control namespace attributes.
3
Type a
package
statement to indicate the name of the package that contains your class. The syntax is the word
package
, followed by the full package name, followed by opening and closing curly brackets around the
class
statement block) For example, change the code in the previous step to the following:
package mypackage
{
public class MyClass
{
}
}
4
Define each property in the class using the
var
statement within the class body. The syntax is the same as you use
to declare any variable (with the addition of the
public
modifier). For example, adding these lines between the
opening and closing curly brackets of the class definition creates properties named
textProperty
,
numericProperty
, and
dateProperty
:
public var textProperty:String = "some default value";
public var numericProperty:Number = 17;
public var dateProperty:Date;
5
Define each method in the class using the same syntax that’s used to define a function. For example:
•
To create a
myMethod()
method, enter:
public function myMethod(param1:String, param2:Number):void
{
// do something with parameters
}
•
To create a constructor (the special method that is called as part of the process of creating an instance of a class),
create a method whose name matches exactly the name of the class:
25
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
public function MyClass()
{
// do stuff to set initial values for properties
// and otherwise set up the object
textVariable = "Hello there!";
dateVariable = new Date(2001, 5, 11);
}
If you don’t include a constructor method in your class, the compiler automatically creates an empty constructor
in your class. (In other words, a constructor with no parameters and no statements.)
There are a few more class elements that you can define. These elements are more complex.
•
Accessors are a special cross between a method and a property. When you write the code to define the class, you
write the accessor like a method. You can perform multiple actions rather than just reading or assigning a value,
which is all you can do when you define a property. However, when you create an instance of your class, you
treat the accessor like a property and use the name to read or assign the value.
•
Events in ActionScript aren’t defined using a specific syntax. Instead, you define events in your class using the
functionality of the EventDispatcher class.
More Help topics
Handling events
Example: Creating a basic application
ActionScript 3.0 can be used within a number of application development environments, including the Flash
Professional and Flash Builder tools or any text editor.
This example walks through the steps in creating and enhancing a simple ActionScript 3.0 application using Flash
Professional or Flash Builder. The application you’ll build presents a simple pattern for using external ActionScript 3.0
class files in Flash Professional and Flex.
Designing your ActionScript application
This example ActionScript application is a standard “Hello World” application, so its design is simple:
•
The application is called HelloWorld.
•
It displays a single text field containing the words “Hello World!”
•
The application uses a single object-oriented class named Greeter. This design allows the class to be used from
within a Flash Professional or Flex project.
•
In this example, you first create a basic version of the application. Next you add functionality to have the user enter
a user name and have the application check the name against a list of known users.
With that concise definition in place, you can start building the application itself.
Creating the HelloWorld project and the Greeter class
The design statement for the Hello World application says that its code is easy to reuse. To achieve that goal, the
application uses a single object-oriented class named Greeter. You use that class from within an application that you
create in Flash Builder or Flash Professional.
26
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
To create the HelloWorld project and Greeter class in Flex:
1
In Flash Builder, select File
> New> Flex Project,
2
Type HelloWorld as the Project Name. Make sure that the Application type is set to “Web (runs in Adobe Flash
Player),” and then click Finish.
Flash Builder creates your project and displays it in the Package Explorer. By default the project already contains a
file named HelloWorld.mxml, and that file is open in the editor.
3
Now to create a custom ActionScript class file in Flash Builder, select File
> New
> ActionScript Class.
4
In the New ActionScript Class dialog box, in the Name field, type Greeter as the class name, and then click Finish.
A new ActionScript editing window is displayed.
Continue with adding code to the Greeter class.
To create the Greeter class in Flash Professional:
1
In Flash Professional, select File
> New.
2
In the New Document dialog box, select ActionScript file, and click OK.
A new ActionScript editing window is displayed.
3
Select File
> Save. Select a folder to contain your application, name the ActionScript file Greeter.as, and then click OK.
Continue with adding code to the Greeter class.
Adding code to the Greeter class
The Greeter class defines an object,
Greeter
, that you use in your HelloWorld application.
To add code to the Greeter class:
1
Type the following code into the new file (some of the code may have been added for you):
package
{
public class Greeter
{
public function sayHello():String
{
var greeting:String;
greeting = "Hello World!";
return greeting;
}
}
}
The Greeter class includes a single
sayHello()
method, which returns a string that says “Hello World!”.
2
Select File
> Save to save this ActionScript file.
The Greeter class is now ready to be used in an application.
Creating an application that uses your ActionScript code
The Greeter class that you have built defines a self-contained set of software functions, but it does not represent a
complete application. To use the class, you create a Flash Professional document or Flex project.
The code needs an instance of the Greeter class. Here’s how to use the Greeter class to your application.
27
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
To create an ActionScript application using Flash Professional:
1
Select File
> New.
2
In the New Document dialog box, select Flash File (ActionScript 3.0), and click OK.
A new document window is displayed.
3
Select File
> Save. Select the same folder that contains the Greeter.as class file, name the Flash document
HelloWorld.fla, and click OK.
4
In the Flash Professional tools palette, select the Text tool. Drag across the Stage to define a new text field
approximately 300 pixels wide and 100 pixels high.
5
In the Properties panel, with the text field still selected on the Stage, set the text type to “Dynamic Text.” Type
mainText as the instance name of the text field.
6
Click the first frame of the main timeline. Open the Actions panel by choosing Window > Actions.
7
In the Actions panel, type the following script:
var myGreeter:Greeter = new Greeter();
mainText.text = myGreeter.sayHello();
8
Save the file.
Continue with Publishing and testing your ActionScript application.
To create an ActionScript application using Flash Builder:
1
Open the HelloWorld.mxml file, and add code to match the following listing:
<?xml version="1.0" encoding="utf-8"?>
<s:Application xmlns:fx=""
xmlns:s="library://ns.adobe.com/flex/spark"
xmlns:
<fx:Script>
<![CDATA[
private var myGreeter:Greeter = new Greeter();
public function initApp():void
{
// says hello at the start, and asks for the user's name
mainTxt.text = myGreeter.sayHello();
}
]]>
</fx:Script>
<s:layout>
<s:VerticalLayout/>
</s:layout>
<s:TextArea
</s:Application>
This Flex project includes four MXML tags:
•
An
<s:Application>
tag, which defines the Application container
28
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
•
An
<s:layout>
tag, which defines the layout style (vertical layout) for the Application tag
•
An
<fx:Script>
tag that includes some ActionScript code
•
An
<s:TextArea>
tag, which defines a field to display text messages to the user
The code in the
<fx:Script>
tag defines an
initApp()
method that is called when the application loads. The
initApp()
method sets the text value of the
mainTxt
TextArea to the “Hello World!” string returned by the
sayHello()
method of the custom class Greeter, which you just wrote.
2
Select File
> Save to save the application.
Continue with Publishing and testing your ActionScript application.
Publishing and testing your ActionScript application
Software development is an iterative process. You write some code, try to compile it, and edit the code until it compiles
cleanly. You run the compiled application and test it to see if it fulfills the intended design. If it doesn’t, you edit the
code again until it does. The Flash Professional and Flash Builder development environments offer a number of ways
to publish, test, and debug your applications.
Here are the basic steps for testing the HelloWorld application in each environment.
To publish and test an ActionScript application using Flash Professional:
1
Publish your application and watch for compilation errors. In Flash Professional, select Control
> Test Movie to
compile your ActionScript code and run the HelloWorld application.
2
If any errors or warnings are displayed in the Output window when you test your application, fix these errors in the
HelloWorld.fla or HelloWorld.as files. Then try testing the application again.
3
If there are no compilation errors, you see a Flash Player window showing the Hello World application.
You have created a simple but complete object-oriented application that uses ActionScript 3.0. Continue with
Enhancing the HelloWorld application.
To publish and test an ActionScript application using Flash Builder:
1
Select Run
> Run HelloWorld.
2
The HelloWorld application starts.
•
If any errors or warnings are displayed in the Output window when you test your application, fix the errors in
the HelloWorld.mxml or Greeter.as files. Then try testing the application again.
•
If there are no compilation errors, a browser window opens showing the Hello World application. The text
“Hello World!” appears.
You have created a simple but complete object-oriented application that uses ActionScript 3.0. Continue with
Enhancing the HelloWorld application.
Enhancing the HelloWorld application
To make the application a little more interesting, you’ll now make it ask for and validate a user name against a
predefined list of names.
First you update the Greeter class to add new functionality. Then you update the application to use the new
functionality.
29
LEARNING ACTIONSCRIPT 3.0
Getting started with ActionScript
Last updated 5/2/2011
To update the Greeter.as file:
1
Open the Greeter.as file.
2
Change the contents of the file to the following (new and changed lines are shown in boldface):
package
{
public class Greeter
{
/**
* Defines the names that | https://www.techylib.com/el/view/anthropologistbarren/learning_actionscript_3 | CC-MAIN-2017-22 | en | refinedweb |
t_jit_gl_context_view object struct. More...
#include <jit.gl.context.view.h>
t_jit_gl_context_view object struct.
Manages an OpenGL context within a rectangle. Objects that use a t_jit_gl_context_view to manage an OpenGL context should attach themselves to the object for its lifetime and implement an "update" method in order to handle modifications to the t_jit_gl_context_view that may require a rebuild or further response within the embedding object. | http://cycling74.com/sdk/MaxSDK-6.1.1/html/structt__jit__gl__context__view.html | CC-MAIN-2014-42 | en | refinedweb |
29 January 2013 20:27 [Source: ICIS news]
HOUSTON (ICIS)--A ?xml:namespace>
BP agreed on 15 November to plead guilty to 11 counts of felony manslaughter, one count of felony obstruction of Congress and violations of the Clean Water and Migratory Bird Treaty acts.
Neither the US Department of Justice nor BP presented arguments to Judge Sarah Vance, although written statements had been given by victims and relatives of the 11 workers killed in the April 2010 Macondo explosion and fire that led to a massive oil spill in the Gulf of Mexico.
Part of the $4bn criminal recovery will be dedicated to environmental restoration and preservation efforts, as well as oil-spill prevention and response programmes.
BP will be placed on five years' probation and will have to independently monitor its process-safety and risk-management programmes and retain an ethics monitor to improve its code of conduct. Feb | http://www.icis.com/Articles/2013/01/29/9635862/us-judge-approves-bps-4bn-deal-to-settle-criminal-spill-charges.html | CC-MAIN-2014-42 | en | refinedweb |
:I think we should change this. And actually it is quite easy. Replace : :#ifdef SMP : code :#endif : :with : if (is_smp) { : code : } : :and have some header doing : :#ifndef _KERNEL_MODULE :const static int is_smp =3D :# ifdef SMP : 1; :# else : 0; :# endif :#else :extern const int is_smp; :#endif : :and initialize is_smp appropriately in some kernel source. : :The kernel will be compiled optimized, because the compiler knows that is= :_smp is a const value and thus can remove dead code. Modules will take t= :he penalty of checking this variable, but that's hardly an impact, becaus= :e it will be in the cache anyways. Just make sure that the variable is i= :n its own cache line, which never changes. : :comments? : :cheers : simon This works to some degree. The only issue is that #ifdef'd SMP code is not parsed at all if SMP is not defined, and so it may reference variables and procedures that otherwise do not exist (and are undeclared) for non-SMP kernels. if (IS_SMP) { ... } code *IS* parsed by the compiler, so even though the compiler may optimize it out you could still end up with warnings and errors pertaining to variables that are not declared for SMP builds. My only other comment on the matter is that constant declarations replacing #ifdef's should probably be all-caps. e.g. IS_SMP rather then is_smp, to differentiate those variables from normal variables and make the code more readable. I use the const trick for the KTR logging code. It works quite well given the caveats. -Matt | http://leaf.dragonflybsd.org/mailarchive/kernel/2007-02/msg00132.html | CC-MAIN-2014-42 | en | refinedweb |
Introduction:
Here I will explain how to create directory or folder, delete directory or folder in asp.net using C# and VB.NET or Delete all Files in a Directory.
Description:
In previous articles I explained Delete files from uploaded folder in asp.net, Check username availability with progressbar, Richtextbox example in asp.net, Asp.net Interview questions, Joins in SQL Server, Highlight Gridview records based on search and many articles relating to Gridview, SQL ,jQuery,asp.net, C#,VB.NET. Now I will explain how to create, delete directory or folder in asp.net using C# and VB.NET.
To create or delete directory/folder we need to write the code like as shown below
Now in code behind add the following namespaces
C# Code
Once you add namespaces write the following code in code behind
VB.NET Code
Demo
3 comments :
If you demo with 3 tiers is very good, because all application often use 3 tiers.
If you can, you are to do so.
I'd like your examples.
r u big appateker (tinhdamsugia) | http://www.aspdotnet-suresh.com/2013/04/aspnet-create-delete-directoryfolder.html | CC-MAIN-2014-42 | en | refinedweb |
04 April 2012 12:31 [Source: ICIS news]
LONDON (ICIS)--The European April styrene customer reference price (CRP) has been settled at €1,325/tonne ($1,743/tonne), down by €17/tonne from the previous month, the seller involved confirmed on Wednesday.
The contract was agreed on a free carrier (FCA) ?xml:namespace>
The settlement reflects raw material cost movements, as a €37/tonne fall in the April benzene contract price was partially offset by a rise in the ethylene contract price, which increased by €40/tonne from March to hit a record high of €1,345/tonne free delivered (FD) northwest Europe | http://www.icis.com/Articles/2012/04/04/9547839/europe-april-styrene-crp-settles-at-1325tonne-down.html | CC-MAIN-2014-42 | en | refinedweb |
12 December 2012 19:58 [Source: ICIS news]
Corrected: ?xml:namespace>
Correction: In the ICIS story headlined "US nylon October exports down by 10% year on year – ITC" dated 12 December, please read the headline as "…down by 9.1…" instead of "…down by 10…".
Please read in the first paragraph …were down by 9.1%… instead of …were down by 10%…. A corrected story follows.
HOUSTON (ICIS)--US nylon exports for October were down by 9.1% year on year, according to data made available by the US International Trade Commission (ITC) on Wednesday.
October 2012 exports decreased to 47,356 tonnes from 52,090 tonnes in October 2011, the ITC said.
Year to date, exports of nylon have totalled 505,878 tonnes, a decrease of 5.9% from the same period in 2011.
Top destinations for US nylon exports in October were Mexico, China and Canada.
Imports for October amounted to 7,001 tonnes, an increase by 9.7% year on year.
Canada, Germany and Italy were the top three points of origin for nylon material brought to the US in October.
The ITC groups nylon 6, nylon 11, nylon 12, nylon 6,6, nylon 6,9, nylon 6,10 and nylon 6,12 in its report.
ICIS provides pricing reports for nylon 6 and nylon 6,6.
US producers of nylon include Ascend Performance Materials, BASF Corp, DuPont, EMS-Grivory, Honeywell, INVISTA, NYCOA and Sh | http://www.icis.com/Articles/2012/12/12/9623828/corrected-us-nylon-october-exports-down-by-9.1-year-on-year-itc.html | CC-MAIN-2014-42 | en | refinedweb |
Module: Webgen
- Defined in:
- lib/webgen/website.rb,
lib/webgen/cli.rb,
lib/webgen/tag.rb,
lib/webgen/page.rb,
lib/webgen/tree.rb,
lib/webgen/node.rb,
lib/webgen/path.rb,
lib/webgen/cache.rb,
lib/webgen/error.rb,
lib/webgen/common.rb,
lib/webgen/source.rb,
lib/webgen/output.rb,
lib/webgen/logger.rb,
lib/webgen/version.rb,
lib/webgen/context.rb,
lib/webgen/loggable.rb,
lib/webgen/languages.rb,
lib/webgen/blackboard.rb,
lib/webgen/webgentask.rb,
lib/webgen/context/tags.rb,
lib/webgen/sourcehandler.rb,
lib/webgen/context/nodes.rb,
lib/webgen/websiteaccess.rb,
lib/webgen/configuration.rb,
lib/webgen/websitemanager.rb,
lib/webgen/context/render.rb,
lib/webgen/contentprocessor.rb,
lib/webgen/source/filesystem.rb,
lib/webgen/source/tararchive.rb
Overview
The Webgen namespace houses all classes/modules used by webgen.
webgen
webgen is a command line application for generating a web site from templates and content files. Despite this fact, the implementation also provides adequate support for using webgen as a library and full support for extending it.
Extending webgen
webgen can be extended very easily. Any file called init.rb put into the ext/ directory of the website or into one of its sub-directories is automatically loaded on Website#init.
You can extend webgen in several ways. However, no magic or special knowledge is needed since webgen relies on the power of Ruby itself. So, for example, an extension is just a normal Ruby class. Most extension types provide a Base module for mixing into an extension which provides default implementations for needed methods.
Following are links to detailed descriptions on how to develop specific types of extensions:
- Webgen::Source
Information on how to implement a class that provides source paths for webgen. For example, one could implement a source class that uses a database as backend.
- Webgen::Output
Information on how to implement a class that writes content to an output location. The default output class just writes to the file system. One could, for example, implement an output class that writes the generated files to multiple locations or to a remote server.
- Webgen::ContentProcessor
Information on how to develop an extension that processes the content. For example, markup-to-HTML converters are implemented as content processors in webgen.
- Webgen::SourceHandler::Base
Information on how to implement a class that handles objects of type source Path and creates Node instances. For example, Webgen::SourceHandler::Page handles the conversion of .page files to .html files.
- Webgen::Tag::Base
Information on how to implement a webgen tag. webgen tags are used to provide an easy way for users to include dynamic content such as automatically generated menus.
General information
Here are some detail on the internals of webgen that will help you while developing for webgen:
webgen uses a not so complex system for determining whether a node needs to be recreated or re-rendered. However, for this to work correctly all extensions have to follow some rules:
It is necessary that all node alcns from which the content is used are put into the destination node's node_info[:used_nodes] set.
It is necessary that all other node alcns that are used for a node in any way, even if they are only referenced or the route to their output path used, have to be put into the node's node_info[:used_meta_info_nodes] set.
Any node that is created during the rendering phase, ie. via a content processor, a tag or in the #content method of a source handler needs to be put into the rendered node's node_info[:used_meta_info_nodes] or node_info[:used_nodes] set (see above for details)! This is especially necessary when using resolved nodes since resolved nodes can be created by passive sources!
webgen provides various Error classes. However, errors should only be raised if additional runs won't correct the problem. For example, if a path cannot be resolved, it is possible that in the next run a node will be created and that the path can be resolved then. This is always the case, for example, with fragment nodes! In such cases an error message should be written out to the log to inform the user that there is a potential problem.
Blackboard services
The Blackboard class provides an easy communication facility between objects. It implements the Observer pattern on the one side and allows the definition of services on the other side. One advantage of a service over the direct use of an object instance method is that the caller does not need to how to find the object that provides the service. It justs uses the Website#blackboard instance. An other advantage is that one can easily exchange the place where the service was defined without breaking extensions that rely on it.
Following is a list of all services available in the stock webgen distribution by the name and the method that implements it (which is useful for looking up the parameters of service).
Following is the list of all messages that can be listened to:
Other places to look at
Here is a list of modules/classes that are primarily used throughout webgen or provide useful methods for developing extensions:
Common, Tree, Node, Path, Cache, Page
Defined Under Namespace
Modules: CLI, Common, ContentProcessor, LanguageManager, Loggable, Output, Source, SourceHandler, Tag, WebsiteAccess Classes: Blackboard, Cache, CommandNotFoundError, Configuration, Context, Error, Language, LoadError, Logger, Node, NodeCreationError, Page, Path, ProxyNode, RenderError, Tree, WebgenTask, Website, WebsiteManager
Constant Summary
- VERSION =
The version of webgen.
'0.5.14'
Class Method Summary (collapse)
- + (Object) data_dir
Returns the data directory for webgen.
Class Method Details
+ (Object) data_dir
Returns the data directory for webgen. | http://www.rubydoc.info/github/gettalong/webgen/master/Webgen | CC-MAIN-2014-42 | en | refinedweb |
Recent Notes
Displaying keyword search results 1 - 7
A simple socket client in C.
#include <stdio.h> #include <stdlib.h> #incl...
When I ran this code snippet with strace :
f = fopen("TZ", "rb"); fseek(f, 0, SEEK_END); ...I saw ENOTTY error with uClibc :
open("TZ", O_RDONLY|O_LARGEFILE) = 3 ioc...With the normal gnu libc , there's no such error:
open("TZ", O_RDONLY) = 3 fstat64...There was no error running the program. But for some reason, uClibc did a ioctl call when it opened a file, and handled it appropriately.... | http://www.xinotes.net/notes/keywords/code/error/null/ | CC-MAIN-2014-42 | en | refinedweb |
InternalBufferOverflowException Class
The exception thrown when the internal buffer overflows.
For a list of all members of this type, see InternalBufferOverflowException Members.
System.Object
System.Exception
System.SystemException
System.IO.InternalBufferOverflowException
[Visual Basic] <Serializable> Public Class InternalBufferOverflowException Inherits SystemException [C#] [Serializable] public class InternalBufferOverflowException : SystemException [C++] [Serializable] public __gc class InternalBufferOverflowException : public SystemException [JScript] public Serializable class InternalBufferOverflowException extends SystemException
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Remarks.
Requirements
Platforms: Windows NT Server 4.0, Windows NT Workstation 4.0, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family
Assembly: System (in System.dll)
See Also
InternalBufferOverflowException Members | System.IO Namespace | FileSystemEventArgs | FileSystemEventHandler | FileSystemWatcher | IncludeSubdirectories | InternalBufferSize | NotifyFilter | NotifyFilters | RenamedEventArgs | RenamedEventHandler | WaitForChangedResult | WatcherChangeTypes | http://msdn.microsoft.com/en-us/library/system.io.internalbufferoverflowexception(v=vs.71) | CC-MAIN-2014-42 | en | refinedweb |
This is the mail archive of the [email protected] mailing list for the GDB project.
One other solution would be to add some changes to gdb_ari.sh that would automatically parse #if 0 Blabla #else Real code #endif and consider Blabla as being only comments? The main problem is that there is until now no code at all for parsing of conditionals and I am not so sure to be able to correctly handle nesting levels and complicated conditions... I agree that the ARI is not a good option here, but any of your two other proposals are probably much easier to solve this problem... Pierre Muller as ARI maintainer > -----Message d'origine----- > De : [email protected] [mailto:gdb-patches- > [email protected]] De la part de Joel Brobecker > Envoyé : jeudi 16 mai 2013 09:31 > À : [email protected] > Cc : [email protected] > Objet : Re: New ARI warning Thu May 16 01:51:20 UTC 2013 in -D 2013-05-16- > gmt > > > > 625a626,631 > > > gdb/rs6000-aix-tdep.c:780: regression: hash: Do not use ' #...', instead > use '#...'(some compilers only correctly parse a C preprocessor directive > when '#' is the first character on the line) > > gdb/rs6000-aix-tdep.c:780: #include <stddef.h> > > > gdb/rs6000-aix-tdep.c:781: regression: hash: Do not use ' #...', instead > use '#...'(some compilers only correctly parse a C preprocessor directive > when '#' is the first character on the line) > [...] > > These come from some sample code provided as a comment in the sources: > > > /* The following data has been generated by compiling and running > > the following program on AIX 5.3. */ > > > > #if 0 > > #include <stddef.h> > > #include <stdio.h> > > #define __LDINFO_PTRACE32__ > > [...] > > The code was copy/pasted and then indented, then commented-out > using #if 0. I couldn't use the usual "/*" and "*/" because > the code itself uses them. > > I am really easy about how to fix those. I could add /* ARI: */ > markers, which do not really make much sense once the code is > copy-pasted out int, but does not harm either. Or I could > just add a second layer of commenting-out, using the C++ "//". > Ie: > > > #if 0 > > // #include <stddef.h> > > // #include <stdio.h> > > // #define __LDINFO_PTRACE32__ > > Or I could simply un-indent the code, but I think it would look > worse. > > Any preference? > > -- > Joel | http://sourceware.org/ml/gdb-patches/2013-05/msg00578.html | CC-MAIN-2014-42 | en | refinedweb |
This article is intended as a brief introduction to some of the more basic elements comprising .NET development. I will create and describe five simple applications for .NET, using nothing more than the .NET Framework SDK and a text editor. I will be playing off of the ever popular, "hello, world" theme. The language that I will be using in the article is C#.
I have written a number of articles on .NET programming recently, and a common feedback that I have received is that .NET is overly complicated to develop in. That it is much easier to code with language X and Notepad. On the face of it, this might seem like a valid criticism given Visual Studio's size and complexity, but it is not the language or even the framework that is to blame. Microsoft's C#.NET and Sun's Java are remarkably similar in their semantics and high level design - generally what the developer is acquainted with, as opposed to the language purists, who can tell you the difference between the CLR and JVM. The pain (and pleasure) of the development process that is most difficult and different with .NET, is the IDE, Visual Studio. Powerful? Definitely, but the ramp is steep and even simple things drag along a considerable amount of unnecessary cruft when the IDE is used.
I decided to strike back against the complex and visually breathtaking IDE based development using only "primitive" tools - a command-line and text editor. divided into five "hello, world" tutorials covering command-line development using .NET:
A basic understanding of .NET, the command-line, and working in Windows is assumed. Here are some good resources to help you get up to speed on these topics:
OK, I will admit that when I first sat down to write this section, I was intending to simply state the requirements and leave it to the reader as an exercise to actually do the getting and installation. However, when I sat down at my wife's computer and tested out the process, it quickly became apparent that more was required.
There are basically four required pieces to doing .NET development using the command-line:
To install IIS on your PC:
After you install a major component like IIS, it is a really good idea to run Windows Update.
More information is available here.
If you have Visual Studio 2003 installed, you will not need to install the Framework separately. Instead of a regular command-line, you can use the Visual Studio .NET 2003 Command Prompt which is located in the Visual Studio .NET Tools start folder. Alternatively, you can open a regular command-line and run the vsvars32.bat batch file to set up the environment for you.
If you need to install the Framework, you will need to check and see if the Redistributable (runtime) is installed on your machine:
If it is not installed, download and install the Redistributable:
Install the Microsoft .NET Framework 1.1 Redistributable - dotnetfx.exe, 23698 KB, Published 3/30/2004, Version 1.1.
Once the Redistributable is installed, download and install the .NET Framework SDK Version 1.1 - setup.exe, 108757 KB, Published 4/9/2003, Version 1.1.
If either of the links above do not work, both programs can be found at the Microsoft Download Center.
Add SDK directory to the path:
It is possible that .NET has lost its mind since the redistributable was installed. If you try to access a .aspx file from a web browser and do not see any data coming back, you may need to remind Windows about .NET. The fix is to re-register .NET by running the command:
"%windir%\Microsoft.NET\Framework\v1.1.4322\aspnet_regiis.exe" -i
To use the SDK, it is simplest to open a Command Prompt and use the SDK environment setup batch file:
sdkvars.bat
Well, OK, it is not a requirement, but it will sure make things easier. Get it here. If you do not have a decent text editor, Notepad will work OK.
You should now be set up to develop with the command-line. It is time to begin the tutorials.
This tutorial is the easiest of the five. When you have finished it, you will have the pleasure of seeing the phrase "hello, world", printed on the command-line.
OK, let's get started. What are the goals? Borrowing directly from Kernighan and Ritchie, these will be our goals for all of the tutorials: needed to compile
//so I added the following include - it is not part }
using
System
Console
namespace
class
Car
HelloWorld
Main
public
static
WriteLine
Save the file to your hard drive as HelloConsole.cs and open a command prompt.
Compile the application using the C# compiler:
csc HelloConsole.cs
This should produce output similar to the following, without error.
Microsoft (R) Visual C# .NET Compiler version 7.10.3052.4
for Microsoft (R) .NET Framework version 1.1.4322
Compiling the application will generate an executable named HelloConsole.exe.
Loading and running the program are accomplished in a single step. Load and run the application from the command-line by typing:
HelloConsole.exe
Console output is incredibly easy to find. Generally, it appears on the line immediately following the command itself. Running the program should produce the following output:
hello, world
Congratulations, you have completed the HelloConsole.
HelloFile is going to be a near duplicate of HelloConsole with the addition of the ability to write to a file. When you have finished this tutorial, you will have a file named Hello.txt in the same directory as the program, that has the phrase, "hello, world" as the contents.
Here is the code for the application:
1 using System;
2 using System.IO;
3
4 namespace mynamespace {
5 public class HelloWorld {
6 public static void Main(string [] args) {
7 FileInfo fi = new FileInfo("Hello.txt");
8 StreamWriter sw = fi.CreateText();
9 sw.WriteLine("hello, world");
10 sw.Close();
11 }
12 }
13 }
System.IO
FileInfo
StreamWriter
File
CreateText
StreamWriter WriteLine()
Save the file to your hard drive as HelloFile.cs and open a command prompt.
csc HelloFile.cs
Compiling the application will generate an executable named HelloFile.exe.
HelloFile.exe
There will not be any discernable output on the console, remember that we are directing the output to the file Hello.txt.
Where did the output go? We told the program to send its output to the file Hello.txt. The file should be located in the same directory that the HelloFile.exe file was run from. The easiest way to view the file's contents is to use the type command:
type Hello.txt
You should see the following output:
That is all there is to HelloFile.
With this tutorial, we begin to move into the 21st century. At the end of the tutorial, you will have a browse-able web application that is running on a web server that, when called, will return HTML with the phrase, "hello, world", as the contents.
HelloBrowser is different than the console applications in that the program will run in the context of the local web server and its output will be sent to a browser as HTML.
I will be using code-behind. Code-behind is new to .NET programming, and for our purposes, refers to the fact that algorithms and program logic reside in a separate file from the HTML that comprises the graphical user elements. I will not belabor it, but code-behind is the only way to go, mixing HTML and code is a nightmare waiting to prey on the weak minded.
What this means is that there will be two files, one for HTML and one for C#.NET code.
Here is the HTML file, called HelloBrowser.aspx.
1 <%@ Page language="c#" Codebehind="HelloBrowser>
Page
language
Codebehind
Inherits
FORM
DIV
Save the file to disk as HelloBrowser.aspx.
Here is the C#.NET file, called HelloBrowser.aspx.cs. divHelloWorld.InnerText = "hello, world";
13 }
14
15 override protected void OnInit(EventArgs e)
16 {
17 this.Load += new System.EventHandler(this.Page_Load);
18 }
19 }
20 }
System.Web.UI.HtmlControls
System.Web.UI.HtmlControls.HtmlGenericControl
System.Web.UI.Page
Page_Load()
System.Web.UI.Page Page_Load()
InnerText
OnInit
HelloWorld Page_Load()
EventHandler Page_Load()
HelloWorld.Load()
Save the file to disk as HelloBrowser.aspx.cs.
This is where things get interesting. The .aspx file will be compiled at run time by the web server. The .aspx.cs file will need to be compiled into a .dll. First, though, let's prepare for the files. This is a web application after all - it needs a little more in the way of deployment than a simple console application.
Create a directory to contain the .aspx file:
md HelloBrowser
Copy HelloBrowser.aspx to the HelloBrowser directory.
copy HelloBrowser.aspx HelloBrowser
Create a directory to contain the .aspx.cs assembly .dll file:
md HelloBrowser\bin
Compile the .aspx.cs file.
Open a command prompt and type:
csc /t:library /out:Hellobrowser\bin\HelloBrowser.dll HelloBrowser.aspx.cs
You should see something like the following:
This should create a file HelloBrowser.dll in the HelloWorld\bin directory.
Create a virtual directory in the web server.
These steps will be managed by the web server when the page is requested. To test, type the address below into your browser's address bar:
The output will be in the browser's display area. I have chosen to use the Mozilla Browser 1.6 available here as the browser for this article. Mozilla is a much more advanced browser than Microsoft's Internet Explorer and it can be a developer's best friend. However, this is one big caveat - some sites on the web are not Mozilla friendly and you will definitely need to keep IE around. It is also a good idea to use IE to develop UI elements for web pages - it is the most popular browser. Feel free to use IE for the tutorials - I tested with IE and Mozilla. Here is the output:
That is it for HelloBrowser.
This is the most difficult of the tutorials, but when you are finished, you will be pleased to find that you have created an XML web service that exposes a HelloWorld method to any client that has access to the web server. The method will return a SOAP document containing XML with the phrase "hello, world" as the content, to any client requesting it.
The web service will be written using code-behind and will operate in the context of the web server. There will be two files, one for the WebService directive and one for C#.NET code.
WebService
Here is the WebService directive, called HelloWebService.asmx.
1 <%@ WebService Language="c#" Codebehind="HelloWebService.asmx.cs"
Class="mynamespace.HelloWebService" %>
Class
Save the file to disk as HelloWebService.asmx.
Here is the C# file, HelloWebService.asmx.cs, that defines the web service logic:
1 using System;
2 using System.Web.Services;
3
4 namespace mynamespace
5 {
6 [WebService(Namespace="")]
7 public class HelloWebService : WebService
8 {
9 [WebMethod]
10 public string SayHelloWorld()
11 {
12 return "hello, world";
13 }
14 }
15 }
System.Web.Services
tempuri
HelloWebService
WebMethod
Save the file to disk as HelloWebService.asmx.cs.
The .asmx file will be compiled at run time by the web server. The .asmx.cs file will need to be compiled into a .dll. First, though, let's prepare for the files. This is a web service - it needs more in the way of deployment.
Create a directory to contain the .asmx file:
md HelloWebService
Copy the HelloWebService.asmx file to the HelloWebService directory:
copy HelloWebService.asmx HelloWebService
Create a directory to contain the .asmx.cs file:
md HelloWebService\bin
Compile the .asmx.cs file.
csc /t:library /out:HelloWebService\bin\HelloWebService.dll
HelloWebService.asmx.cs
This should create a file HelloWebService.dll in the HelloWebService\bin directory.
These steps will be managed by the web server when the page is requested. To test it out, type the address below into your browser's Address bar:
In order to locate the output of a web service, you will need to perform a few steps. The browser page shows the web methods that are available to use.
You can choose one of two paths here. One is the web method SayHelloWorld. The other is the webservice service description. First, look at the service description.
SayHelloWorld
Next, go back and select the SayHelloWorld web method.
This brings you to a page that shows some sample SOAP code for those of you that want to delve deeper. There is also a button that says, Invoke, press the button.
This simulates a client of the web service requesting the SayHelloWorld web method via webservices.
There is one additional page that we might be interested in, and that is the .disco file, or Discovery document of the web service. To display the .disco file, browse to:
That is it for HelloWebService.
What good would a web service be without a client application? None, so here is that application. It is a simple web application that calls the web service created in the previous tutorial and displays the phrase, "hello, world", returned by the web service in the browser window.
This is another code-behind web application, but with a twist - we need to create a proxy. Web services use a pretty sophisticated communication mechanism. Thankfully, the .NET Framework provides the ability to auto-generate the proxy code and lets us concentrate on the productive stuff.
First, some prep work - create a directory to contain the web service client web application:
md HelloWebServiceClient
We need a directory for the code-behind DLL:
md HelloWebServiceClient\bin
To generate the proxy code, open a command prompt, and from the same directory as the .aspx.cs file:
wsdl /out:HelloWebService_proxy.cs
This should result in some semblance of the following output:
Microsoft (R) web services Description Language Utility
[Microsoft (R) .NET Framework, Version 1.1.4322.573]
Writing file 'HelloWebService_proxy.cs'.
Here is the code for the .aspx web application file:
1 <%@ Page language="c#" Codebehind="HelloWebServiceClient>
Save the file to disk as HelloWebServiceClient.aspx.
Here is the C# code-behind source: HelloWebService hello = new HelloWebService();
13 divHelloWorld.InnerText = hello.SayHelloWorld();
14 }
15
16 override protected void OnInit(EventArgs e)
17 {
18 this.Load += new System.EventHandler(this.Page_Load);
19 }
20 }
21 }
This file is remarkably similar to the web application's code-behind.
SayHelloWorld()
Save the file to disk as HelloWebServiceClient.aspx.cs.
Compile the proxy:
csc /t:library /out:HelloWebServiceClient\bin\HelloWebService_proxy.dll
HelloWebService_proxy.cs
The output should resemble:
Compile the code-behind:
csc /t:library /r:HelloWebServiceClient\bin\HelloWebService_proxy.dll \
/out:HelloWebServiceClient\bin\HelloWebServiceClient.dll HelloWebServiceClient.aspx.cs
The output will resemble:
Copy the HelloWebServiceClient.aspx file to the HelloWebServiceClient directory:
copy HelloWebServiceClient.aspx HelloWebServiceClient
The output will be in the browser window and will appear as it did in the HelloBrowser application.
If you have come this far, you are serious about your command-line .NET experience. My hope is that you have found this article interesting and useful.
Please let me know what you think.
Version 1.0 - This
main(argc, argv)
char *argv[];
{
printf("hello, world\n");
}
General News Suggestion Question Bug Answer Joke Rant Admin
Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages. | http://www.codeproject.com/Articles/6908/hello-world-A-primitive-view-of-the-state-of-the-a?msg=3551161 | CC-MAIN-2014-42 | en | refinedweb |
25 January 2012 12:02 [Source: ICIS news]
LONDON (ICIS)--US-based Praxair's fourth-quarter 2011 net profit more than tripled to $420m from $133m the year before on the back of higher sales, it said on Wednesday.
Sales for the three months ending on 31 December rose by 6.6% year on year to $2.80bn (€2.16bn), as the company signed a record number of new contracts for projects and demand increased across all geographic regions, it added.
Higher volumes and prices also contributed to better sales figures, the company said.
Praxair produces, sells and distributes atmospheric and process gases, as well as high-performance surface coatings. It is the largest industrial gases company in North and ?xml:namespace>
The group’s operating profit during the fourth quarter grew by 22% compared with the same period the year before, to $618m.
“Praxair again delivered strong growth combined with industry-leading profitability,” said chairman and CEO Steve Angel.
For the full year of 2011, reported net income was $1.67bn, up by 40% from 2010, while sales grew by 11% year on year to $11.25bn.
“We signed a record amount of new contracts in 2011 and finished the year with a backlog of $2.7bn of new projects under construction which will come on-stream in 2012, 2013, and 2014,” Angel added.
Looking ahead into 2012 Angel remained positive, particularly for the North American energy, manufacturing and materials industries that Praxair serves, and the growing economies in Asia and
“We expect strong project activity again in 2012 and we remain confident in our ability to execute in a manner our customers and shareholders have grown to anticipate,” he said.
For the full year of 2012, Praxair expects sales in the area of $11.7bn–12bn, up by 4–7% year on year.
On an underlying basis, Praxair expects to sustain sales growth of 8–12%, similar to 2011, | http://www.icis.com/Articles/2012/01/25/9526643/us-praxair-q4-2011-net-profit-more-than-triples-to-420m.html | CC-MAIN-2014-42 | en | refinedweb |
To support NFS activities, several daemons are started when a system goes into run level 3 or multiuser mode. The mountd and nfsd daemons are run on systems that are servers. The automatic startup of the server daemons depends on the existence of entries that are labeled with the NFS file-system type in /etc/dfs/sharetab. To support NFS file locking, the lockd and statd daemons are run on NFS clients and servers. However, unlike previous versions of NFS, in NFS version 4, the daemons lockd, statd, mountd, and nfslogd are not used.
This section describes the following daemons.
This.
This.
This daemon handles file-system mount requests from remote systems and provides access control. The mountd daemon checks /etc/dfs/sharetab to determine which file systems are available for remote mounting and which systems are allowed to do the remote mounting. You can use the -v option and the -r option with this command. See the mountd(1M) man page.
The -v option runs the command in verbose mode. Every time an NFS server determines the access that a client should be granted, a message is printed on the console. The information that is generated can be useful when trying to determine why a client cannot access a file system.
The -r option rejects all future mount requests from clients. This option does not affect clients that already have a file system mounted.
NFS version 4 does not use this daemon.
nfs4cbd, which is for the exclusive use of the NFS version 4 client, manages the communication endpoints for the NFS version 4 callback program. The daemon has no user-accessible interface. For more information, see the nfs4cbd(1M) man page.
This daemon handles other client file-system requests. You can use several options with this command. See the nfsd(1M) man page for a complete listing. These options can either be used from the command line or by editing the appropriate string in /etc/default/nfs.
The NFSD_LISTEN_BACKLOG=length parameter in /etc/default/nfs sets the length of the connection queue over connection-oriented transports for NFS and TCP. The default value is 32 entries. The same selection can be made from the command line by starting nfsd with the -l option.
The NFSD_MAX_CONNECTIONS=#-conn parameter in /etc/default/nfs selects the maximum number of connections per connection-oriented transport. The default value for #-conn is unlimited. The same parameter can be used from the command line by starting the daemon with the -c #-conn option.
The NFSD_SERVER=nservers parameter in /etc/default/nfs selects the maximum number of concurrent requests that a server can handle. The default value for nservers is 16. The same selection can be made from the command line by starting nfsd with the nservers option.
Unlike older versions of this daemon, nfsd does not spawn multiple copies to handle concurrent requests. Checking the process table with ps only shows one copy of the daemon running.
This daemon provides operational logging. NFS operations that are logged against a server are based on the configuration options that are defined in /etc/default/nfslogd. When NFS server logging is enabled, records of all RPC operations on a selected file system are written to a buffer file by the kernel. Then nfslogd postprocesses these requests. The name service switch is used to help map UIDs to logins and IP addresses to host names. The number is recorded if no match can be found through the identified name services.
Mapping of file handles to path names is also handled by nfslogd. The daemon tracks these mappings in a file-handle-to-path mapping table. One mapping table exists for each tag that is identified in /etc/nfs/nfslogd. After post-processing, the records are written to ASCII log files.
NFS version 4 does not use this daemon.
Version 4 of the NFS protocol (RFC3530) changed the way user or group identifiers (UID or GID) are exchanged between the client and server. The protocol requires that a file's owner and group attributes be exchanged between an NFS version 4 client and an NFS version 4 server as strings in the form of user@nfsv4_domain or group@nfsv4_domain, respectively.
For example, user known_user has a UID 123456 on an NFS version 4 client whose fully qualified hostname is system.example.com. For the client to make requests to the NFS version 4 server, the client must map the UID 123456 to [email protected] and then send this attribute to the NFS version 4 server. The NFS version 4 server expects to receive user and group file attributes in the user_or_group@nfsv4_domain format. After the server receives [email protected] from the client, the server maps the string to the local UID 123456, which is understood by the underlying file system. This functionality assumes that every UID and GID in the network is unique and that the NFS version 4 domains on the client match the NFS version 4 domains on the server.
If the server does not recognize the given user or group name, even if the NFS version 4 domains match, the server is unable to map the user or group name to its unique ID, an integer value. Under such circumstances, the server maps the inbound user or group name to the nobody user. To prevent such occurrences, administrators should avoid making special accounts that only exist on the NFS version 4 client.
The NFS version 4 client and server are both capable of performing integer-to-string and string-to-integer conversions. For example, in response to a GETATTR operation, the NFS version 4 server maps UIDs and GIDs obtained from the underlying file system into their respective string representation and sends this information to the client. Alternately, the client must also map UIDs and GIDs into string representations. For example, in response to the chown command, the client maps the new UID or GID to a string representation before sending a SETATTR operation to the server.
Note, however, that the client and server respond differently to unrecognized strings:
If the user does not exist on the server, even within the same NFS version 4 domain configuration, the server rejects the remote procedure call (RPC) and returns an error message to the client. This situation limits the operations that can be performed by the remote user.
If the user exists on both the client and server, but they have mismatched domains, the server rejects the attribute modifying operations (such as SETATTR) that require the server to map the inbound user string to an integer value that the underlying file system can understand. For NFS version 4 clients and servers to function properly, their NFS version 4 domains, the portion of the string after the @ sign, should match.
If the NFS version 4 client does not recognize a user or group name from the server, the client is unable to map the string to its unique ID, an integer value. Under such circumstances, the client maps the inbound user or group string to the nobody user. This mapping to nobody creates varied problems for different applications. As for NFS version 4 functionality, operations that modify file attributes will fail.
The
For nfsmapid to work properly, NFS version 4 clients and servers must have the same domain. To ensure matching NFS version 4 domains, nfsmapid follows these strict precedence rules:
The daemon first checks the /etc/default/nfs file for a value that has been assigned to the NFSMAPID_DOMAIN keyword. If a value is found, the assigned value takes precedence over any other settings. The assigned value is appended to the outbound attribute strings and is compared against inbound attribute strings. For more information about keywords in the /etc/default/nfs file, see Keywords for the /etc/default/nfs File. For procedural information, see Setting Up NFS Services.
The use of the NFSMAPID_DOMAIN setting is not scalable and is not recommended for large deployments.
If no value has been assigned to NFSMAPID_DOMAIN, then the daemon checks for a domain name from a DNS TXT RR. nfsmapid relies on directives in the /etc/resolv.conf file that are used by the set of routines in the resolver. The resolver searches through the configured DNS servers for the _nfsv4idmapdomain TXT RR. Note that the use of DNS TXT records is more scalable. For this reason, continued use of TXT records is much preferred over setting the keyword in the /etc/default/nfs file.
If no DNS TXT record is configured to provide a domain name, then the nfsmapid daemon uses the value specified by the domain or search directive in the /etc/resolv.conf file, with the directive specified last taking precedence.
In the following example, where both the domain and search directives are used, the nfsmapid daemon uses the first domain listed after the search directive, which is company.com.
If the /etc/resolv.conf file does not exist, nfsmapid obtains the NFS version 4 domain name by following the behavior of the domainname command. Specifically, if the /etc/defaultdomain file exists, nfsmapid uses the contents of that file for the NFS version 4 domain. If the /etc/defaultdomain file does not exist, nfsmapid uses the domain name that is provided by the network's configured naming service. For more information, see the domainname(1M) man page.
The ubiquitous nature of DNS provides an efficient storage and distribution mechanism for the NFS version 4 domain name. Additionally, because of the inherent scalability of DNS, the use of DNS TXT resource records is the preferred method for configuring the NFS version 4 domain name for large deployments. You should configure the _nfsv4idmapdomain TXT record on enterprise-level DNS servers. Such configurations ensure that any NFS version 4 client or server can find its NFS version 4 domain by traversing the DNS tree.
The following is an example of a preferred entry for enabling the DNS server to provide the NFS version 4 domain name:
In this example, the domain name to configure is the value that is enclosed in double-quotes. Note that no ttl field is specified and that no domain is appended to _nfsv4idmapdomain, which is the value in the owner field. This configuration enables the TXT record to use the zone's ${ORIGIN} entry from the Start-Of-Authority (SOA) record. For example, at different levels of the domain namespace, the record could read as follows:
This configuration provides DNS clients with the added flexibility of using the resolv.conf file to search up the DNS tree hierarchy. See the resolv.conf(4) man page. This capability provides a higher probability of finding the TXT record. For even more flexibility, lower level DNS sub-domains can define their own DNS TXT resource records (RRs). This capability enables lower level DNS sub-domains to override the TXT record that is defined by the top level DNS domain.
The domain that is specified by the TXT record can be an arbitrary string that does not necessarily match the DNS domain for clients and servers that use NFS version 4. You have the option of not sharing NFS version 4 data with other DNS domains.
Before:
This.
For more information about nfsmapid, see the following:
nfsmapid(1M) man page
ACLs and nfsmapid in NFS Version 4
This daemon works with lockd to provide crash and recovery functions for the lock manager. The statd daemon tracks the clients that hold locks on an NFS server. If a server crashes, on rebooting statd on the server contacts statd on the client. The client statd can then attempt to reclaim any locks on the server. The client statd also informs the server statd when a client has crashed so that the client's locks on the server can be cleared. You have no options to select with this daemon. For more information, see the statd(1M) man page.
In the Solaris 7 release, the way that statd tracks the clients has been improved. In all earlier Solaris releases, statd created files in /var/statmon/sm for each client by using the client's unqualified host name. This file naming caused problems if you had two clients in different domains that shared a host name, or if clients were not resident in the same domain as the NFS server. Because the unqualified host name only lists the host name, without any domain or IP-address information, the older version of statd had no way to differentiate between these types of clients. To fix this problem, the Solaris 7 statd creates a symbolic link in /var/statmon/sm to the unqualified host name by using the IP address of the client. The new link resembles the following:
In this example, the client host name is myhost and the client's IP address is 192.168.255.255. If another host with the name myhost were mounting a file system, two symbolic links would lead to the host name.
NFS version 4 does not use this daemon. | http://docs.oracle.com/cd/E19253-01/816-4555/rfsrefer-8/index.html | CC-MAIN-2014-42 | en | refinedweb |
A 'Response Handler' is the closure that is executed to parse the HTTP response that is returned from the server. Multiple handlers are usually defined, and correct handler is chosen based on the HTTP status code in the response.
Generally, status codes may be grouped into two categories - 'success' (any status less than 400) or 'failure' (400 or greater). Within the request configuration closure, handlers may be defined through the response property, which returns a map of response closures. This map may then be used to add response handlers for this request:
import groovyx.net.http.HTTPBuilder import static groovyx.net.http.Method.GET import static groovyx.net.http.ContentType.TEXT new HTTPBuilder('').request(GET) { req -> response.success = { resp -> println 'request was successful' assert resp.status < 400 } response.failure = { resp -> println 'request failed' assert resp.status >= 400 } }
These status handlers may be combined with more specific handlers that only handle a specific response code:
http.request(...) { // success handler // ... // only called for an HTTP 401 response code: response.'401' = { resp -> println 'access denied' } }
In all cases, a handler will first be retrieved by the exact status code, and if none is found, it will fall back to a generic 'success' or 'failure' handler.
In cases where a response sends a redirect status code, this is handled internally by Apache HttpClient, which by default will simply follow the redirect by re-sending the request to the new URL. You do not need to do anything special in order to follow 302 responses.
Similarly, a 401 status code can be handled transparently by HttpClient when authorization has been configured. In most cases, you (the user) are not interested in these 'intermediate' responses, so they are handled internally by the framework. If you want to handle these responses directly, it can be configured through the underlying HttpClient instance.
Similarly, HttpURLClient has a followRedirects property to configure redirect behavior.
The default handlers are good for cases where the user is not interested in dealing with streaming responses. In this case, the response data is simply parsed (or buffered in the case of a binary or text response) and returned from the request method:
try { def response = new HTTPBuilder('').request(GET,TEXT) {} assert response instanceof Reader // response data is buffered in-memory println response.text() } catch ( HttpResponseException ex ) { // default failure handler throws an exception: println "Unexpected response error: ${ex.statusCode}" }
The default failure handler will throw an exception.
This behavior can also be customized by setting your own default handlers on the HTTPBuilder instance like so:
def http = new HTTPBuilder() http.handler.success = { "Success!" } http.handler.failure = { resp -> "Unexpected failure: ${resp.statusLine}" } // we can set code-specific default handlers as well: http.handler.'404 = { 'Not Found' } def result = http.get( uri:'' ) assert result == 'Not Found' | http://groovy.codehaus.org/modules/http-builder/doc/handlers.html | CC-MAIN-2014-42 | en | refinedweb |
Overview
Thread jiggler is a simple testing framework for exercising code to find threading problems. It works by modifying classes bytecode at runtime to insert Thread.yield() calls between instructions – “jiggling” the threads. This greatly increases the likelihood of discovering threading issues, and does it without you needing to change your production code.
Background
I was recently researching how to test multithreaded code for threading issues, and found out about a tool from IBM called ConTest, but couldn’t find any code I could use myself. So naturally, I thought I’d spike my own.
Consider this canonical simple, but thread unsafe class:
private int count = 0 ; public void count() { count++; }
The count method’s byte code is:
DUP GETFIELD asm/Foo.counter : I ICONST_1 IADD PUTFIELD asm/Foo.counter : I
This provides several places where there could be a context switch, which means that count my be increased, but not stored as expected. Let consider a quick unit test:
Counter counter = new BadCounter(); int n = 1000; @Test public void singleThreadedTest() throws Exception { for (int i = 0; i < n; i++) { counter.count(); } assertEquals(n, counter.getCount()); } ...
This test runs in a single thread, and passes. Lets try and run this on two threads and see if it fails.
public void threadedTest() throws Exception { final CompletionService<Void> service = new ExecutorCompletionService<Void>(Executors.newFixedThreadPool(2)); for (int i = 0; i < n; i++) { service.submit(new Callable<Void>() { @Override public Void call() { counter.count(); return null; } }); } for (int i = 0; i < n; ++i) { service.take().get(); } assertEquals(n, counter.getCount()); }
This also passes. On my computer I can increase n to 100,000 before it starts to fail consistently.
Expected :1000000 Actual :999661
Just 0.04% of the tests had a problem. What have we learned? We’ve learned a simple way to run a multithreaded test, but we’ve learned that, because we can’t control when threads do their work, it’s a bit trial and error.
Thread Jiggling
So one problem exercising code to find threading defects is that you can’t control when threads will yield. However, we can re-write the bytecode to insert Thread.yield() into the bytecode between instructions. In the above example we can get the code to produce more issues by changing the bytecode:
DUP GETFIELD asm/Foo.counter : I INVOKESTATIC java/lang/Thread.yield ()V ICONST_1 IADD PUTFIELD asm/Foo.counter : I
Using ASM, we can create a rewriter to insert these invocations. The JigglingClassLoader re-writes classes on the fly, adding these calls. From this we can create a JUnit runner to run use the new class loader for the test.
@Jiggle("threadjiggler.test.*") public class BadCounterTest { ... }
Now running the test:
Expected :1000000 Actual :836403
The number of test where we see the threading problem jump to 16%. We’ve done this with out any recompilation of the code, or impacting on other unit tests running in the same JVM.
Exercise for the Reader
SimpleDateFormat is a well know, non-thread safe class in Java. Write a test that jiggles the class. Why is it not thread-safe? How would you rewrite it so that it was thread safe? How can you do so without using a ThreadLocal, locks or synchronisation?
Source Code
The code for this can be found on Github.
Further Reading
I’ve written a post on testing threaded code for correctnes. You may also wish to read more generally:
- Concurrent Bug Patterns and How to Test Them – Eitan Farchi, Yarden Nir, Shmuel Ur IBM Haifa Research Labs
- A presentation describing the difficulty of testing and debugging concurrent software – Shmuel Ur
- Java theory and practice: Characterizing thread safety | http://www.javacodegeeks.com/2013/09/thread-jiggling.html | CC-MAIN-2014-42 | en | refinedweb |
A convolution-based approach to detect urban extents.
Project description
Urban footprinter
A reusable convolution-based approach to detect urban extents from raster datasets.
The approach is built upon the methods used in the Atlas of Urban Expansion. The main idea is that a pixel is considered part of the urban extent depending on the proportion of built-up pixels that surround it. See the notebook overview or this blog post for a more detailed description of the procedure.
Installation and usage
To install use pip:
$ pip install urban-footprinter
Or clone the repo:
$ git clone $ python setup.py install
Then use it as:
import urban_footprinter as ufp # Or use `ufp.urban_footprint_mask_shp` to obtain the urban extent as a # shapely geometry urban_mask = ufp.urban_footprint_mask("path/to/raster.tif", kernel_radius, urban_threshold, urban_classes=urban_classes)
where
help(ufp.urban_footprint_mask) Help on function urban_footprint_mask in module urban_footprinter: urban_footprint_mask(raster, kernel_radius, urban_threshold, urban_classes=None, largest_patch_only=True, buffer_dist=None, res=None) Computes a boolean mask of the urban footprint of a given raster. Parameters ---------- raster : ndarray or str, file object or pathlib.Path object Land use/land cover (LULC) raster. If passing a ndarray (instead of the path to a geotiff), the resolution (in meters) must be passed to the `res` keyword argument. kernel_radius : numeric The radius (in meters) of the circular kernel used in the convolution. urban_threshold : float from 0 to 1 Proportion of neighboring (within the kernel) urban pixels after which a given pixel is considered urban. urban_classes : int or list-like, optional Code or codes of the LULC classes that must be considered urban. Not needed if `raster` is already a boolean array of urban/non-urban LULC classes. largest_patch_only : boolean, default True Whether the returned urban/non-urban mask should feature only the largest urban patch. buffer_dist : numeric, optional Distance to be buffered around the urban/non-urban mask. If no value is provided, no buffer is applied. res : numeric, optional Resolution of the `raster` (assumes square pixels). Ignored if `raster` is a path to a geotiff. Returns ------- urban_mask : ndarray
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages. | https://pypi.org/project/urban-footprinter/0.2.0/ | CC-MAIN-2021-43 | en | refinedweb |
GREPPER
SEARCH
SNIPPETS
USAGE DOCS
INSTALL GREPPER
All Languages
>>
C
>>
tuple in python
“tuple in python” Code Answer’s
changing tuple values
c by
Bst Barracuda
on May 17 2020
Comment
4
x = ("apple", "banana", "cherry") y = list(x) y[1] = "kiwi" x = tuple(y) print(x)
what is a tuple in python
python by
SkelliBoi
on Mar 03 2020
Donate
Comment
52
# A tuple is a sequence of immutable Python objects. Tuples are # sequences, just like lists. The differences between tuples # and lists are, the tuples cannot be changed unlike lists and # tuples use parentheses, whereas lists use square brackets. tup1 = ('physics', 'chemistry', 1997, 2000); tup2 = "a", "b", "c", "d"; # To access values in tuple, use the square brackets for # slicing along with the index or indices to obtain value # available at that index. tup1[0] # Output: 'physics'
Source:
tuples in python
python by
Smoggy Stag
on Oct 12 2020
Comment
4
my_tuple = 3, 4.6, "dog" print(my_tuple) # tuple unpacking is also possible a, b, c = my_tuple print(a) # 3 print(b) # 4.6 print(c) # dog
Source:
how to use tupels python
python by
Terrible Turtle
on Jun 13 2020
Comment
3
tupel = ('banana',10,True) print(tupel[2])
tuple in python
python by
Dr. Hippo
on Mar 14 2020
Comment
4
#a tuple is basically the same thing as a #list, except that it can not be modified. tup = ('a','b','c')
tuple in python
python by
Donald Duck
on Jul 21 2021
Comment
-1
Tup1 = (1) print(Tup1) print(type(Tup1)) # To crate a tuple you must have at least 2 ELEMENTS tup3 = (1, 2, 3, 4, 5, 6, 7, 8, 9) tup4 = ('a', 'b', 'c') defseq = 2,5 print(defseq) print(type(defseq)) # 2 or more integers assigned to a variable will become tuple automaticaly tuple = (1, 2, 3, 4, 5, 6, 7, 8, 9) print("Original", tuple) print("Single element", tuple[2]) print("Definate range", tuple[2:5]) #print("Start a definate", tuple[]) # tup = (3, 5, 7, 9) # del tup # print("It'll show an error") # print(tup, "It'll show an error") # print("Length of tuple is ", len(tup)) # CONCATENATE tup3 = (8,2) print(tup3+tuple) print(("Hello Students ") * 3) print("Membership =", 8 in tup3) print(max(tup3)) print(min(tup3)) quo, rem = divmod(100, 3) print("Quotient =", quo) print("Remainder = ", rem) com_tup1 = (1, 2, 3, 4) # sum is 10 com_tup2 = (7, 8, 9, 2) # sum is 26 print(com_tup1, com_tup2) print(com_tup1 > com_tup2, "Tuple 1 is greater than tuple 2") print(com_tup1 < com_tup2, "Tuple 2 is greater than tuple 2") print(com_tup1 == com_tup2, "They're both the same ") if com_tup1 > com_tup2: print("Tuple 1 is greater than tuple 2") elif com_tup1 < com_tup2: print("Tuple 2 is greater than tuple 1") else: print("They're both the same") # Comparision is not the length, it's the sum # Tuples are compared position by position: the first item of the first tuple is compared to the first item of the second tuple; if they are # not equal (i.e. the first is greater or smaller than the second) then that's # the result of the comparison, else the second item is considered, then the third and so on. # Nested Tuples toppers = ('Arnav', 101, 'High School', ('999-6969-420', '[email protected]')), ('Mayank', 107, 'Inter', ('999-6969-420', '[email protected]')), ('Manish', 103, 'Higher Sec', ('999-6969-420', '[email protected]')) print(toppers) for i in toppers: print(i) print(com_tup1.index(3)) print(com_tup1.count(3)) # Zip() function - takes 2 or more sequences and zips into a list (creats a list with tuples) tup_zip = (1, 2, 3, 4) list_zip = ['a', 'b', 'c', 'd'] print(list(zip(tup_zip, list_zip))) # Sorted() function. The ssort() function doesn't work because it is immutable # sorted to sort a tuple of values tup_sort = (1, 4, 3, 5, 3, 4, 7, 2, 3, 9) print(sorted(tup_sort))
Add a Grepper Answer
C queries related to “tuple in python”
why is tuple used in python
create a tuple in a loop python
tuple python []
tuple in python syntax
tuples python
type tuple python
make tuples python
create tuple python ]
tuple of python
python tuples are?
tuple variable python
python function tuple
CHANGE A TUPLE IN PYTHON
what is a tuplesin python
tuples python simple definition
tuple toturial in python
tuples in python in system programing
hwo to use tuple python
how to denote a tuple in Python
built in tuple functions in python
using tuples
what is [].tuple|() in python
what is [].tuple in python
changing items in a tuple
how to use tuples in python
tuple in function python
create tuple from tuple python
how to iterate tuples of tuples in python
create tupl;e python
python changing value in a tuple
tuples in python beginners
what is a tuple in python for beginners
tuple class in python
python tuple of types
tuple built in methods in python
use a tuple python
define tuples
change value in a tuple python
whats a tuple python
python reference to a tuple
tuple syntax python
python working with tuple
define tuple in python
tuplees in python
how to update tuple value in python
what tuple does in python
puthon tuples
typle in python
uses of tuples in python
python tuple of tuple
what is a tuples in python
python tuple statements
use of tuples in python
when to use tuple in python
why use a tuple python
tuple use in python
what is tuples in python example
syntax of a tuple
python reference tuple
change a value in tuple python
implementation of tuple in python
change value of tuple in python
why use tuples in python
type tuple python in function
when would a tuple be used example
tuple create python
when to use tuples python
what is the work of tuple in python
change value of a tuple
tuplei in python
tuple methods py
how to write tuple in python
python __tuple__
correct syntax to create a tuple in python
accessing tuple in python
how to create a new tuple in python
ways to create tuple python
more ways to create tuple python
ways to create tuple in python
how to createa tuple in python
what are tuples use in python
are tuples usefull in python
tuples in python 3 methods
example tuple in python
tuple is python
tuple method in python
how to use tuples
PYTHON TUPLE IN LIST
PYTHON TUPLE IN
modify value inside tuple python
change the values of a tuple in python
change a value in a tuple python
tuple t[][][] in python
where would we use python tuple
update value in tuple of tuple in python
tuples python methods
how is tuple implemented in python
what is the purpose of a named tuple python
python own tuple
python tuple value
what is tuple python
why tuple in python
tuples in def pyton
tuples in definition pyton
Python program that takes a tuple of tuples
what is a value of a tuple called in python
method with tuple python
tuple in python3
what is tuple used for in python
a tuple of tuples python
modify value of a tuple
tuple methods in python 3
tuple built in function in python
Python tuples are
declaring a tuple i python
method tuple python
how to generate tuple in python
methods used in python tuple
when do you use tuples in python
meaning of tuple in python
what is the purpose of a tuple in python
what is a tuple in python and examples
what are tuples in ypthon
tuples in pythin
how to access tuple in python
what is tuples in python
in at python tuple
python tuple - tuple
defining a tuple in python
tuples and list in python
how are tuples python
update value of tuple in python
python declare a tuple
what is tuplein python
examples of tuples in python
what is tuple and list in python
python tuples function
get tuple from function python
declare a tuple python
python "/" in tuple
tuple() python 3
declare tuple in python
what are python tuple
methods in tuplein python
change value in tuple python
operations with tuple python
change value of tuple python
what is a tuple in python 3
reading tuple in python
tuple python method
python tuple concept
which of the following statement would create a tuple in python
pyton tuples
tuple in tuple python
python.org tuple
tuple nedir python
syntax of tuple
can you change a value of a tuple
tuple of tuples python
tuple to {} in python
tuple in pyton syntax
where tuple is used in python
tuple python data
make a tuple python
python .Tuple
python tuples examples
tuples in pytho
tuples in py
what function we perform in tuple in python
define equivalent in python tuple
whats tuple python
operation on tuple in python
python tuple in tuple
python tuple modify value
tuple real python
tuple definition in python
definition tuple
code to update tuple value in python
python change item tuple value
python *tuple
modify a value of tuple py
tuple typehint in python
tuple type in python
tuple python how
can we use tuple in list python
do a tuple python
pthon Tuples
tuple in python and functions
function tuple python
all about tuple python
(, 1) tuple
what is a type tuple in python
what is a tuple python 3
tuple library python
pyhon tuples
change tuples data
tuple syntax
tupels python
python tuple)
python tuple[
python tuple with for
making a tuple in python
how to change value in a python tuple
what a tuple in python
which one of the following created the tuple in python
tuples def
tuple functions in python with examples
python working with tuples
for in tuples(tuple) python
when tuples are useful in python
tuple in python what is
tuples examples python
tuple in python program
tuple(x) python
how to declare tupel in python
python's tuple syntax
how to require a tuple ppython function
how to create a tuple i python
what does a tuple do in python
tuple in python
python for tuples
python when to use tuple
tuple - tuple python
tuple(
operations on tuple in python
what is tuple used in python
why would you use tuples in python
tuples in python3
tuples declaration in python
py tuple()
how to make a tuple python
tuple file in python
python program with tuple
python program to implement tuple function.
tuple function in python
update tuple value python
python can you change values in a tuple
python how to create a tuple
how to access tuples in python
python tuple implementation
tuple en python
python tuple declaration
creating tuple in python
python tuple usage
update tuple values in python
methods in tuple in python
is (1) a tuple
el in python tuple
what's a python tuple
tuple in python correct way
tuple in python
pythons tuples
how to assign tuple in python
tuples in pyhon
python 3 tuples with ,
python tuping Tuple
modify tuple value python
use python tuple
python tuple explained
tuples in
untuple tuple of tuples python
untuple tuple python
what tuple in python is
python make tuple
tuple (3, )
example of a tuple in python
different ways to create a tuple in python
*tuple in python
get a tuple from function python
what does tuple do in python
definition of tuple in python
what is a tuple used for in python
tuple element python
tuple + tuple python
syntax for tuple in python
python tuple of tuples
why use tuples python
tuples in python syntax
python tupels
all() tuple python
* tuple python
python make a tuple
python how to built a tuple
what are named tuples in python
python tuple for
tuple operations
how to call a tuple in python
how to access tuple in a tuple python
what does tuple mean
tuple manipulation in python
tuple item() python
python tuple syntax
python define tuple
tuple list python
how does python tuple creation work
is tuple in python
python tuple change value
how do you create a tuple in python
python tuple tutorial
tuple() function python
can you change the value of a tuple python
can we sot tuple in python
basic tuple operations in python
how to access the tuple in python
how to work with tuple in python
methods of tuple in python
tuple value python
tuple python syntax
python modify tuple value
tuples in pythom
pyhton tuple()
how to change tuple values in python
tuple of tuples in python
python tuple uses
python tuple use function
python + can i modify value of tuple
tuples real python
declaring a tuple in python
python tuple[0] = tuple[1] + tuple[2]
tuple definition python
functions for tuples in python
how to create a tuple on python
tuple example in python
data tuple in python
tuple python methods
python why use tuples
python tuple meaning
tuple declaration python
Which of the following is a Python tuple?
python tuple update
how to turn tuple into string
python how to for tuple
tuple creation in python
tuple+tuple1 in python
how to display a tuple in python
what are tuples used for in python
what's a tuple python
whats a tuple python
tuple python modify value
all tuple methods in python
methods in tuples in python
how to change value of tuple in python
tuple' python
tuple access in python
example of tuple in python
functions for tuple in python
tuples py
python * tuple
how to do a tuple in a tuple python
import tuple python
tuple operation python
whats a tuple in python
tuple function
change values in tuple python
update tuple value in python
how to use a tuple in a tuple in python
tuple with tuples
tuples functions in python
can you use for in tuple in python
python tuples basics
python using tuple
tuple in python pytype
how to code tuplein python
python Tupel
tuple python
python for tuple in
how to change tuple value in python
make a new tuple python
python change value in tuple
which of the following is a python tuple
ways to create a tuple in python
how to use tuple values in a function in python
tuple in a tuple python
tuple python do
python use tuple
python how to make tuples
tuple python function
how to use tuple in python
tuple functions python
how to make tuple of tuples in python
python tuples example
python tuple
make tuple python
tuple function python
+= python tuple
python what's a tuple
python tuple mehod
coding tuple python
tuple python nedir
poython tuples
what the heck is tuple in python
how to use a tuple in python
tuple elements python
tuple functions in python 3
tuple(list) python
what is tuple in python
how to create a tuple python
how to change value in tuple python
* in python for tuple
explain tuples and various operations on in in python with examples
tuple() python
defination of Tuple in python
when are tuples used in python
what is the use of tuple in python
untuple a tuple python
how are tuples made in python
use tuples python
python change a value in a tuple
properties of tuple in python
how to declare tuple in python
python tuples what is it
access tuple in python
why we use tuple in python
how to declare a tuple in python
python in tuple
why are tuples created in python
tuple()
("what",) python tuple
tuple declaration in python
when do we use tuple in python
calling a tuple in python
python tuple
program using tuple in python
tuple in a list python
how to work with tuples in python
what are tuples in python used for
tuples in pytohn
how to call tuple in python
make tuple in python
how to use tuples python
python example of a tuple
tuple method python
how to change the value of a tuple
__ tuple python meaning
Python Tuple Methods
python how to create tuples
tuple definition
print tuple elements python
next value of tuple in python
what is tuple in python with example
how to access the item of a tuple in python
python tuple access
python tuples?
python grabbing from tuble
define a new tuple python
python operations on tuples
change tuple values python
how to handle tuple object in python file handling
how to handle tupl robhjrct in python
how to read tuple in python
python operations with tuples
get values from a tuple in python
change a value inside a tuple python
tooples in python
access elements of a tuple python
accessing tuple items python
python named tuple
tuple with for python
named tuple python
named tuple in python
index of a tuple python
get in tuple python
tup function in python
access values in tuple
print tuple python error
print tuple python
typles python
python get tuple element
tuple inside tuple in python 3 online
tuple in python 3 online
how to get an element from a tuple in python
short note on tuples in python
program in python to print in tupl
accessing values from tuple python
functions of tuple in python
accessing items in a tuple python
python tuple class
how to edit values inside a tuple
how to refer to a tuple python
python values from tuples
how to use tuples in if in python
python tubples
how to read a tuple in python
building a tuple in python
tuples pyython
printing a tuple in python
tuple method in python
tuple command
python tuples
python call tuple
tuple get value
how to get n item in tuple python
format a python tuple with html
handling tuples in python
how to access elements in tuple
which of these collections defines a tuple in python
how to access tuple elements in python
tuple in python example
access values in tuple python
how to get each point of a tuple in python
how to access emlemts of a tupe pythin
how to get tuple values in python
access tuples python
get element of tuple python
what are list and tuple in python
how to use tuple in simple python
how to get tuple value python
print a tuple python
access tuple python by index
functions on tuples in python
python tuple indexing
reAD ELEMENTS IN TUPLE
how to access element in python tuple
how to get a certain value from a tuple python
how to use topels in python
index tupli python
create typple with for python
how to call tuples in python\
how to print tuple in python
get element in tuple python
tuple reference element in sequence python
fetch data from tuple python
tuple indexing python
tuple of tuples
creating tuples in python
get property from tuple python
how to get value from a tuple python
declare tuple
get value from tuplepython
python truplae
python value in tuple of tuples
python value in tuple
how to get index of tuple in python
sending tuple python
tuples allow us
tuple syntax in python
how to get tuples
how to parse a tuple in python
how to access values in a tuple
python tuple#
python tubleds
turple python
access element tuple python
how to write a tuple in python
access element tuple in python
declare a tuple in python
tuple program in python
python tuples index
tuple in python w3schools
tuples in python functions
get value from tuple
tuple value replace
python tupils
does tuple have title attribute 'in python
python parsing tupples
create tuple from another tuple and change one element
explain tuples in python
view values of tuple python
python get tuple
python whats is tuple
a tuble in python
item() in tuple
item() on tuple
tuples are immutable a 5 in tuple python
consider a tuple python
tuples in pyhton
python what is tuple
how to grab elements of a tupple
value in tuple python
print tuple element
tuple element
python typles
indexing using tuple python
tuple items
how to access elements in tuple python
python tuple list
python tubles
make a tuple in python
python3 define tuple
get items from tuple python
tuple in python meaning
python access tu
python get index from tuple
change element of tuple python
functions of tuples
python element in tuple
how do you make a tuple in python 3
python tuple method
tuple' object atributes
tuple' object
python set value of tuple
python tuple with attributes
basic Tuple operations with examples
when we use tuple in python
access elements of tuple in python
tuple access python
how to replace the tupple value
how to access values in tuple python
python turple
python access values f tuple
access tuple where
What is a Python Tuple? *
what is a python tuple
read tuple in python
get tuple in python
access index of tuple python
python tuple get element
how to get data from a touple in python
index method in tuple python
python range tuple
tuples operations in python
tuple methods
tuples in python 3
create tuples in python
truple python
3 tuples inside a tuple
python tuble
tuple all()
python tuple example
python numbers in tuple
how to make tuples python
how to make tuples python'
how to get elements from a tuple in python
how to adress the elements of a tuple
how to address all values in a tuple python
create a tuple python
get value of a tuple python
python how to adress all the values of a tuple
python how to define all the values of a tuple
tuples and value inside a print statement python
how to get from tuple python
construct a tuple python
how to access element in tuple python
tuple operations python
python print tuples
access tupole
get value of tuple in tuple python
access a tuple in python
create tuples python
python 2-tuples
tuples data type in python
example of tuple python
how to get tuples values
python tuple + tuple
get values in tuple python
python tuple 1..10
python how to tuple
operations on tuple python
i python how to change tuple value
access tuples
sccessing tuples
how to index tuples python
In python, a tuple value is 1,2,3, how to change the center value to 4?
use of tuple in python
python tuple function
how to access a tuple
python get access to item in tuple
python tuples functions
how to get values of tuple
access in tuple
python value from tuple
how to select value from tuple in python
how to select from tuple
python get value of tuple at index
python tuple index
python .tuple()
python tuple()
accessing tuples in python
index through tuples python
printing tuple in python
python access variable in tuple
attribute in tuple wss
python print tuple
python print(tuple)
what are the operations on python tuples
tuple python element
python tupule
python touple
access index in tuple python
ython tuples
python tuple object get x
tuple formation in python
accesss tuples
tuples in functions python
access individual element of tuple
using tuple in python
increase the value of x and y tuple in python
python access a tuple
python tuplet
access tuple elements python
tuples functions python
access data from tuple
tuple get value python
how to access elements of tuple in python
access values in python tuple
access tuple item
tuple example python
python tiple
tuple meaning in python
get element from tuple
element replaced with the value in tuple python
how to access elements in a tuple python
how tuplws are created are in python
python tuple get
how to reference a tuple in python
tuple built in functions in python
python get index tuple
python define a tuple
what does tuple() do in python
tuples in pyhto
how to get value from tupple
uses of python tuple
python change tuple in index
accesing elements in turple
get item in tuple python
tup in python
tupe in python
tuple type python
print tuples
reassign each value in a tuplr python
tuples in pytong
python type tuple
use tuple as sequence python
python tuple to number index
python get x element from tuple
how to get the value of a tuple in python
how to use python tuples
python tuple * operator
legal tuple in python
what is a tuples
replace object in tuple
how to define a tuple python
get element of tuple
how to get element of a tuple python
how to get element of a tuple python
how to edit a tuple in python
get value from a tuple python
can tuples be changed python
replace element in tuple python
assign value inside a tuple of tuple
python to tupple
loython tuples
data touple python
for tuple of tuples python
python get index in tuple
python get previous in tuple
how to access a value in a tuple
what is tuples
get item from tuple python
edit tuple python
get data from tuple python
how to create user defined tuple in python
how to acess each element of tuple
get value in turple python
how to access the elements in a tuple python
tuple format
get element of a tuplepython
replace tuple python
increase element in tuple python
can tuples be changed
what does a tuple look like in python
change value tuple python
operation on tuple
what is a tuple object in python
how to replace a tuple in python
get a tuple element python
tuple double python
how to make a tuplet in python
how to get value from tuple
sample tuple code in python
access a part of a tuple
index of tuple python
how to increase a tuplet python
how to change the type of the first element of a tuple
how to declare a tuple in python 3
get access to turple element
different ways to use tuples
python + tuple in tuple
python getTuple
make a tuple of any object in python
iget tupla element
Python get an element from a tuple
Python get an item from an index tuple
python how to alter tuple
python print class tuple
python tuple access by index
python tuple indices
tupples python
how to query tuples in python
set value in a tuple
get values of tuple python
python reference tuple element
how to get the attribute value of tuple python
tuple funcs python
how to get data from tuple
access item in tuple python
taple python
indexing in tuples python
select elements of a tuple python
python select from tuple
how to change the value of a tuple in python
acess tuple python
index in tuple python
reassign element tuple python
get data from tuple
4th elements of a tuple in python
aluse to display tuples
tuples inside tuples
python how to make tuple
get a value from a tuple python
tuples in python
tuples methods python
get values from tuple python
print values in tuple python
python tuple *
access elelemt of tuple python
access elelemt of tuple
changing element in list in tuple change tuple?
for x,y in tuple in python
replace a tuple calue
how to get an item on a tuple python
python how to use tuples
parse tuple of tuple in python
python get tuple from tuples
python touplr
replace tuple value python
tup: tup[1] python
how to access python tuple
get elements from tuple python
python tuple elements
get first value of tuple
tuple concept in python
tuple login
tuple in python
tuples in python
replace values in tuple python
python tuple replace
python change tuple value
python tuplemethods
how to access the tuple and print
modify tuple python
python all posibul tuple indices
python parse tuple
how to access the index of tuple
tuple functions in python
print tuple
python get from tuple
modifying elements of a tuple python
how to change a value of a tuple
tuple python operations
print element of tuple from index python
index value python tuple
application of tuple in python
how to access tuple using index
accessing data inside tuples
creating a tuple in python
python tuplr
Select the built-in functions of tuple
select elements from tuple python
python get tuple elemt
tuple in python how to write it
change y value of tuple python
python tuple definition
python tuplle
how to get item in tuple python
how to tuple in python
python select tuple element
create tuple python3
how to enter into tuple in python
operations on tuples in python
python access value in tuple
tuple example py
how do you access info in tuple in python
create a new tuple python
tuple properties python
how to read data from tuple in python
object = tuple
declare a tuple of 2 python
tuple functions in python
tuple datatype built in functions
accessing values in tuples python
change tuple value python
enmurat tuple python
python numbers in a tuple
python how to create tuple
tuple in the python
2-tuple python
tuple in python index
python print value of tuple
call the tuple object python
python creating tuples
for tuple python
tuple python example why
how to make a python tuple
python use for tuples
python tuple functions
print one value of tuple python
how to access elements of a tuple python
make_tuple(6) python
python tuple get value
get a tuple value python
python can tuple elements be changed
python how to change tuple value
python tuple functions and methods
how to get the values of a tuple in python
how to make a tuple in python 3
change tuple value in python
how to get an element of a tuple python
python can you change tuple value
python construct tupe
python reference tuple values
tupil in python
python change value of tuple in list
% tuple in python
what is tuple object in python
python replace tuple type
python how to print an elemento of a tuple
get element from tuple python
how to get values from tuples in python
printing items in a tuple python
elements of tuple python
acessing a element from tuple python
tuple python has items
python declare tuple
python get item from tuple
where are tuples used in python
python change value of tuple
python print part of tuple
python navigate tuple by line
get elemen of touple python
access an element in an tuple python
a tuple in python
python new tuple
tuple in list python
tuples python w3schools
python change one element of tuple
can we perform indexing in tuple in python
python access tuple item
is in tuple python
subsripting tuples python
make tuples in python
access value from tuple python
parse tuple python
output tuple python
python reference element in tuple
index through tuple python
how to output a tuple in python
change tuple val python
how to index tuple in python
tuple inside tuple python
tuples methods in python
subscript tuple python
access tuple python
'tuple' object
tuple operations in python
how to get a value from a tuple in python
python function print all tuple values
tuples function in python
how to change element in tuple python
how to create a tuple in python 3
writing tuple in python
tuple.index python
acess object in tuple
python tuple get index
how to access tuple data in python
how to select an item in a tuple python
can expression be tuples in python
how to return certain elements of a tuple in python
making a typle python
python how to make a tuple
how to define tuple in python
tuples and lists in python functions
tuple python w3schools
python print tuple when changes
how to access a value in a tuple python
python tulpe
tutorails point tuples
applications of tuples in python
how to access value in tuple python
python edit tuple
tuple python 3
print elements of tuple python
Write a python program to create an empty tuple, tuple with items of different data types, slice the tuple, add items to the tuple, and Convert tuple to a list ,Convert a tuple to a string
python access element of tuple
python get values from tuple
indexing tuples python
how to get value out of tuple in python
python how to construct a tuple
access element in tuple python
tuple python definition
tupel python
how to get part of tuple in python
*tuple python
how to access tuple values in python
how to read tuple within tuple in python
how to change tuple value python
change item in tuple python
w3schols python tuples
tupples in python
access python tple
declaring tuple in python
python class tuple
tuple example
turples in python
why can i change a tuple in python
create tuple in python
python tupl
how to represent tuples in python
tuple change value python
how to get element by index python tuple
python get value of tuple
python acce tuple
what is type turple in python
how to get value from tuple in python
tuple data type in python
python access tuple by index
python tuple operation
python tuple modify element
how to access individual elements of a tuple in python
what is python tuple
python print each number in tuple
print all numbers in a tuple function
function print values in tuple
accessing a tuple in python
python differentz in tuple
how to get single value from a tuple python
tuple pairs python
python access elements in tuple
whow to use tuples python
w3schools.com python arrays, tuples.....
tuple methods python
new tuple python
how to make tuple python
how to view values of tuple in python
access elements of typle
python create a tuple
index tuple
get index tuple python
display element of tuple
tupple in python
tupple
python tuples]
what's a tuple in python
how to index a tuple in python
how to get value in tuple python
declasre python tuple type example
how to make tuples in python
python refer to tuple element
how to get tuple value in python
index a tuple python
python typle
python get values of tuple
python for tuple with index
accessing tuples python
create a tuple in python
python access tuple values on return
change tuple
python code to evalute element in tuple
what are tuples used for python
what is tuple
access third element in a tuple python
python access elements of tuple
how to use tupels python
acces tuple elements python
what is a tuple
get element from a tuple python
tuples
how to make a tuple of
tuples meaning in python
tuplein python
yuple python
get tuple value python3
touple example
get tuple element python
get tuple from initial tuple
access tuple values python
change element in tuple python
change one tuple to another
operations on a tuple code
select element of tuple python
create tuple
operatins on a tuple
print elements in tuple
how to change value inside a tuple inside list
python tuple examples
can I change tuples
Operations on a Tuple
access elements of tuple python
tuple create in python
tuple
access elements of tuple
accessing tuple elements
tuple methods in python
python construct tuple
tuple pythno
access a tuple python
tuple in python 3
how to create tuple in python
Write a function `print_tuple` that prints all the values in a tuple
python tuplets
get values from a tuple python
using tuples in python
update value in tuple python
what is str in python
dictionary python 3
what is json in python
what is b in python
what is the tuple in python
what is a constructor in python
why string is immutable in java
index a tuple in python
is a tuple immutable in python
tuple inside list python
what is the string main arg in c#
python how to acess tuple
accessing elements of a tuple in python
access tuples python slice
python select value from tuple
get element of tuple in python
accessing tuple elements in python
tuple python
tuple object python
calling a element in tuples python
access element of tuple python
python how to work with tuples
define a tuple python
define tuple python
changing tuple values
function that prints all valus in a tuple
properties python tuple
python string vlaue of tuple
get value from tuple python
create atuple in python
tupple python
how to make tuple in python
python get tuple value
how to access a tuple in python
whats an tuple in python
python tuple operations
how to access elements of a tuple in python
using tuple.s python
python how to index a tuple
print all the values in a tuple python
working with tuples in python
Python use for tuples
tuple python example
get value of tuple python
python get value from tuple
how to create a tuple in python
how to define a tuple in python
tuple code
tuple() in python
python tupples
what is tuple in python
python what is a tuple
python read a tuple
how to make a tuple in python
create tuple python
getting value from tuple python
define tuple in python
python touples
python how to access tuples
declare tuple python
python tuple items
access items in tuple python
what is a tuple python
accesign a tuples values python
how to access tuple in python
how to set a tuple in python
how to access items in a tuple python
access tuples python
get tuple value python
python create tuple
tubles in python
tuple pythonm
definition of tuple in python
getting tuple values python
define a tuple in python
read tuples in python
what is tuple data type in python
what are tuples in python
tuple in python
python get tuple elements
tuples in python
index tuple python
python tuples
tupel in python
tuples python
python tuple means
tuple manipulation python
python get value from tuple
python tuple
printing a tuple in a function
tuple python
a tuple of tuples python
python access tuple
what is a tuple in python)
deepak rake
Navigator.of(context).pop(); gives black screen instead of closing draer
terraform fargate cpu
Complete the function in the editor. It has one parameter: an array, . It must iterate through the array performing one of the following actions on each element: IN
. | https://www.codegrepper.com/code-examples/c/tuple+in+python | CC-MAIN-2021-43 | en | refinedweb |
.
Is logout impossible while in Eclipse?
I created this utterly simple example app to try quitting the Vaadin app by sending the user to a static web page.
But while running inside Eclipse Indigo with Tomcat 7.0.27, I get a 404 error: The requested resource (/logout.html) is not available.
…for the URL:
I followed the Book of Vaadin exactly. Here's the entire app code in this one file.
package com.example.testclose; import com.vaadin.Application; import com.vaadin.ui.*; import com.vaadin.ui.Button.ClickEvent; public class TestcloseApplication extends Application { @Override public void init() { System.out.println("Basil - Running init() method on TestcloseApplication class. " + new java.util.Date() ); this.setLogoutURL( "/logout.html" ); Window mainWindow = new Window("Testclose Application"); // Quit app button. Button quitButton = new Button("Quit"); quitButton.addListener( new Button.ClickListener() { @Override public void buttonClick( ClickEvent event ) { event.getComponent().getApplication().close(); } } ); mainWindow.addComponent( quitButton ); setMainWindow(mainWindow); } }
Here's the little HTML page, in a file named "logout.html" in the WebContent folder at this path:
/Users/basilbourque/Documents/workspace/TestClose/WebContent/logout.html
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> </head> <body> <p>Game over, dude.</p> </body> </html>
I have multiple Vaadin apps that run well in Eclipse, so I believe I have both Eclipse WTP and Tomcat configured properly.
Why can't I make a simple app logout? Is this just not possible in Eclipse+WTP+Tomcat?
--Basil Bourque
I would say, your URL is just missing the Context-Root of your web-application. You can check it in the Properties of the Web-Project. Not exactly sure how the category is named (and no eclipse available to check), but it will be something like "Web Application Settings" or the like. | https://vaadin.com/forum/thread/1379720/is-logout-impossible-while-in-eclipse | CC-MAIN-2021-43 | en | refinedweb |
.
Get something like overflow-Event
Hi,
i am trying to set up a Button bar which does not have a specific with.
It is set to 100% by the parent component.
Now i have somethin like a bar of buttons where multiple buttons are added,
but at some point the buttons will ether overflow or there will be a scrollbar, but i would like to have another solution where a button pops up to show "more buttons availible" and no overflow and no scrollbar should be visible.
But can't find any resources on that one.
Here is a quick example:
ButtonBar bar = new ButtonBar(); bar.setWith("100%"); //add some buttons public class ButtonBar extends VerticalLayout{ private ArrayList<Button> someMore; private Button moreButtons; public ButtonBar(){ someMore = new ArrayListButton<>(); moreButtons.addClickListener(new ClickListener() { @Override public void buttonClick(ClickEvent event) { //show smoeMore Buttons in something like a dropdown } }); addComponent(moreButtons); } public void addButton(Button btn){ boolean doesFitInLayout = ???; if(doesFitInLayout){ addComponent(btn, getComponentCount()-1); }else{ someMore.add(btn); } } }
Thanks for your help and ideas
greetings Michael
Hi,
You could use the MenuBar component, which does exactly this (collapses the options that do not fit in the layout to a dropdown. Resize the browser to see it happen: | https://vaadin.com/forum/thread/15295403/get-something-like-overflow-event | CC-MAIN-2021-43 | en | refinedweb |
GREPPER
SEARCH
SNIPPETS
USAGE DOCS
INSTALL GREPPER
All Languages
>>
Shell/Bash
>>
jupyter notebook install
“jupyter notebook install” Code Answer’s
installing hinterland for jupyter without anaconda
shell by
LazyCompiler
on Sep 07 2020
Comment
2 on Hinterland step 3: Open new python file and check autocomplete feature
install jupyter notebook
shell by
Rickey Estes
on Jan 22 2021
Donate
Comment
3
python -m pip install jupyterlab
install jupyter notebook pypi
shell by
DevPedrada
on Dec 13 2020
Donate
Comment
0
pip install jupyter
Source:
stackoverflow.com
install jupyter
shell by
Tremendous Enceladus
on Mar 21 2020
6
pip3 install jupyter
pip install in jupyter notebook
shell by
Helpless Hippopotamus
on May 01 2020
Comment
3
!pip install package-name
jupyter notebook install
whatever by
Breakable Bug
on Apr 30 2020
Comment
8
pip install jupyterlab
Source:
jupyter.org
Add a Grepper Answer
Shell/Bash answers related to “jupyter notebook install”
conda install notebook
how to install jupyter
install jupyter notebook
jupyter python downkload
how to install jupyter notebook
how to install packages from jupyter notebook
how to install packages using jupyter notebook
jupyter command install
install jupyter notebook pypi
jupyter labs install conda windows
Shell/Bash queries related to “jupyter notebook install”
install plugins jupyterlab
python 3.9 install jupyter
conda install jupyter notebok
python 3.10 install jupyter
can i use jupyter notebook without anaconda
install package via pip in jupyter
pip install jupiter lab
install jupyter notebook in linux
install jupyer windows
jupyter download pip
installing jupyter on windows
how to install jupyter desktop
sudo apt install jupyter-notebook
launch jupyter notebook ubun
can you install jupyter notebook without anaconda
jupyter notebook install new python version
how to download matplotlib in jupyter notebook
how to install python 3 on jupyter notebook
how to install java in jupyter notebook
jupyter download windows
babel pip install jupyter notebook
jupyter notebook without anaconda
jupyter notebooks without anaconda
install jupyter using python3 windows
jupyter lab install in ubuntu
how to install jupiter notebook in ubuntu
jupiter notebook for python
install jupyterhub on ubuntu 18.04
ubuntu 18.04 install jupyterhub
install jupyter notebook .exe
how do I install Jupyter notebook?
how do I install jupyter
how install jupyter notebook pip
install jupyter notebook in anaconda
install library for jupter
jupyter notebook module install
install jupyterlab extension
install nodejs for jupyter lab
how to install jupyterlab build
will installing jupyter notebook install python
install jupyt\
how to setup jupyter notebook environment ubuntu
download jupyter for ubuntu cmd
installing seurat from jupyter notebook
install jupyter notebook server ubuntu
install python and jupyter notebook
how to install jupyter notbook
installing pandas in jupyter
jupyter install ubuntu
installing jupyter on ubuntu
pip install jupyter-lab
pip instsll jupyter notebook
install Jupyter notebook ubuntu
set up jupyterlab on pc
install jupyter notebook ubuntu server
install matplotlib in jupyter notebook
installing jupyterlab and jupyter notebook
installing jupyterlab on windows
jupyter notebook install python
run jupyter notebook ubuntu
pip install jupyter notebook version
jupyterlab install pandas
install jupyter notebook in python 3.9
cannot install jupyter to windows
install Jupyter-Notebook
pip install jupyterlab
python no module jupyter notebook
install jupyter notebook ubuntu python3
how to install jupyternotebook with terminal
download jupyter anaconda
how to install jupyter in windows 10
jupyter notebook for windows
install and run jupyter
how to install jupyter notebook on linux
JupyterApp installer
installer jupyter
ipython install jupyter
jupyter notebook !pip install
jupyter lab ubuntu install
install jupyterlab ubuntu
No module named 'jupyter_dash'
python.exe no module named notebook windows
how to install pandas in jupyter notebook
run jupyter notebook in ubuntu
download jupyter notebooks
how to install jupyter with anaconda
jupyter python download
install python package jupyter
no module found jupyter notebook
how to install jupyter notebook in windows 10 for python
free downlond jupyter install
how to install jupiter notebooks on windows
download jupyter for windows
jupyter notebook instalar
pip install jupyter notebooks
jupyter pip
python jupyter install windows 10
jupyter notebook install on ubuntu
jupyter ubuntu
isntall jupyter
download jupyter
how to download and install jupyter notebook in windows 10
jupyter notebook free download
install jupyter lab in anaconda
jupyter install ipython
pip install ipython jupyter
start jupyter notebook ubuntu anaconda
start jupyter notebook ubuntu
jupyter notebook on ubuntu windows
download jupyter notebook windows
how to install the latest jupyter version
jupyter notebook anaconda download
jupyternotebook install
how to run jupyter notebook in ubuntu
jupyter notebook in [ * ]
launch jupyter notebook ubuntu
jupyter anaconda download
install jupyter notebook windows 10
jupyter notebook ubunutu
install jupyter notebook in ubuntu using anaconda
how to install jupyter notebook windows
use pip in jupyter notebook
installing jupyter notebook on ubuntu
jupyter notebook install
anaconda python jupyter download
how to install anaconda and jupyter notebook in windows 10
anaconda jupyter notebook install windows
jupyterhub installation ubuntu
install library from jupyter notebook
jupyter notebook install package pip
how install jupyter notebook
HOW INSTALL JUPYTER UBUNTU
how to install jupyter-matplotlib
python notebook download
ipython notebook download
jupyter-notebook pip
jupiter notebook download
jupyter notebook on ubuntu
jupyter on windows installation
jupyter through pip
jupyter numpy install
jupyter notebook install windows 10
jupyter notebook ubuntu
jupyter notebook ubuntu windows
using pip in jupyter
jupyter installing
how to pip install in jupyter
pip install jupyter meaning
how to install jupyter in ubuntu
how to install jupyter notebook desktop icon for ubuntu
how to install jupyter notebook on ubuntu from command line
download jupyter python
jupyter notebook windows pip
install jupyter anaconda windows 10
how to jupyter notebook
download jupyter notebook with anaconda
install notebook for ubuntu
linux, install jupyter notebook
jupyter modulenotfounderror no module named 'notebook'
install jupyter notebook in python
how to install python notebook
python using jupyter notebook
how to install anaconda jupyter notebook in windows 11
how to install anaconda jupyter notebook in windows 10
jupyter notebook for python download
jupyter notebook install package
jupyter download ubuntu
command to install jupyter notebook in windows
instalar jupyter notebook windows
anaconda pip install jupyter
jupyter notebook in ubuntu
how to install library in jupyter notebook
jupyter notebook windows 10 install
get jupyter notebook python pip
can i install jupyter notebook without anaconda
install ipython notebook
instal pip di jupyter notebook
what jupyter notebook
no module named pandas jupyter
no module named pip jupyter notebook
how to install pip in jupyter
apt install jupyter
npm install jupyter notebook
ubuntu pip install jupyter
how to install jupyter in anaconda
python jupyter notebook download
install jupyter client
how to install on jupyter notebook
download jupyter notebook for windows
how to install jupyter notebooks using pip
anaconda python jupyter install
jupyterbook pip
how to install jupyter??
how to install jupyter?
how to install jupyter notebook?
jupyter notebook installation in windows
install jupyter notebook python windows
anaconda install jupyter-lab
how to download jupyter notebook in ubuntu
install jupyter notebook on ubuntu
how to install jupyter notebook in ubuntu
install jupyter in ubuntu
how to install matplotlib in jupyter notebook
anaconda jupyter download
install jupyter ubuntu
how to install jupyter in python
install pyproj jupyter notebook
install jupyter on ubuntu
install and run jupyter pip
jupyter notebook pip
download library jupyter notebook with pip
jupyter notebook download for windows
jupyter ide download
pip jupyter notebook
ubuntu install jupyter lab
jupyter notebook for ubuntu
anaconda jupyter notebook download
install jupyter notebook in win 10
ubuntu jupyter notebook
install jupyter-client
hinterland jupyter install conda
which python in jupyter notebook
how to install package in jupyter notebook
instalar jupyter pip
install jupyter notebook on python3
jupyter install on windows 10
jupiter notebook install
pip install jupyter windows
how to install jupyter notebook download
how to install jupyter notebook anaconda
steps to install jupyter notebook
jupyter notebook install for windows 7
how to install a package in jupyter notebook via setup.py
how to install juypter notebook
does installing jupyter install python
install module from jupyter notebook
how to install jupyter notebook through pip
how to install jupyther notebook
install jupyter notebook using anaconda
install jupiter notebook
jupyter notebook library
jupyter lab installation
install jupyter notebook without conda
installing jupyter notebook without anaconda
installing jupyter to windows
how to install npm in jupyter
jupyter notebook what is
pip in jupyter notebook
installing jupyter notebook step by step
how to use jupyter notebook for python
install jupyter notebook command line
how to install python library in jupyter notebook
pip install jupyter notebook
jupyter notebook python 2.7 install
install jupyter notebook cmd
download python jupyter
jupyter notebook python 3 install windows
jupyter command install
installing jupyter notebook in windows
download jupyter notebook for python
installing hinterland for jupyter with anaconda
install and run jupyter notebook
install windows jupyter notebook
jupyter pytohn
jupyter installation windows
!install python jupyter notebook
install jupyter notebook python pip
pip install on jupyter notebook
using anaconda to install jupyter notebook
jupyter notebook site:jupyter.org
how to install pip in jupyter notebook
npm jupyter install
pip install py to jupyter
jupyer lab install
install jupyter on python 3
how to pip reinstall jupyter -notebook
how to install python jupyter notebook in windows 10
install jupyter library
how to instal jupyter notebook
jupyter how to install
python jupyter notebook install
jupiter notebook installation
windows install jupyter notebook
install jupyter notebook in django
jupyter notebook install npm
download jupyter for python
install jupytar notebook
install jupyter lab pip
jupyter notebook install modulle
what is jupyter notebook used for python
install jupyter without anaconda
install libraries on jupyter
how to install jupyter in windows
how to download and install jupyter notebook
anaconda install jupyter
install jupyter with anaconda
install jupyer notebook
install jupyter lad
jupyter ohne installation
No module named 'notebook'
jupyter package how to install
pip install jupytern notebook
install jupyter using conda
install pip jupyter
how to download a jupyter notebook
download jupyter notebook using pip
how to install a package in jupyter notebook
how to install jupyter notebook with python 3
pip install how to in jupyter jupyter notebook
install jupyetr
install jupyter kernel
pip install for jupyter notebook
install jupyter notebook+conda
download and install jupyter notebook for windows 10
install jupyter windows
juypter notebook install on windows
install jupyternotebook
how to install from jupyter notebook
vpython install jupyter notebook
pypy install jupyter notebook
jupyter notebook install install
python pip install in jupyter notebook
when to use "!" to install jupyter notebook
jupyter install library
jupyter notebook install windows
jupyter install Cython
how to install jupyter notebook in windows 7
install pip in jupyter notebook
jupyter conda install
how to install jupyter notebook pip
how to install jupyter notebook via pip
how to install jupyter by pip by on windows 10
install jupter notebook
install pip jupyter
how to install package jupyter notebook
install jupyter in windows anaconda
install jupyter in windows
how to install jupyter notebook in windows 10?
how to install jupyter notebook in
how to install jupyter notebook from pip
how to install python and jupyter notebook
how to download jupyter
how to install jupyter notebook in windows 10 for python 3
install jupyter with anaconda windows
jupyter notebookks
how to install and use jupyter in windows 10
install anaconda jupyter
pip instal jupyter notebook
how to download jupyter notebook for python
how to pip install jupyter lab?
install jupyter notebook in windows 10
no module named jupyter
using pip to install jupyter notebook
using pip to install jupyter
installing jupyter without anaconda
install jupyter notebook for python 2.7
install jupyter notebook and python 3
do we need to install jupyter after installing anaconda
install jupyter notebook on windows
how to pip install on jupyter notebook
install module in jupyter notebook
install jupyter notebook pypi
how to install python 3.7 using jupyter
install jupyter notebook python 2.7
install jupyter notebook conda install
install jupyter notebook conda
install python library on jupyter
pypolt install jupyter
how to install into jupyter notebook kernel
python jupyter install
install jupyter notebook using cmd
install jupyter notebook in windows
install jupyter notebook pip windows
install python library in jupiter notebook
how to pip install jupyter notebook
how to pip install from jupyter notebook
installing jupyter and jupyter lab
how to install jupyter notebook step by step
install jupyter notebook anaconda conda
install pip on jupyter notebook
how to install jupyter python
install jupyter notebook with pip
python library jupyter
i install jupyter in python
install pandas in jupyter notebook
jupiter notebook install on windwos 10
jupyter notebook [*]
install anaconda without jupyter
install jupyter server
install ipython kernel conda
how to install packages when using jupyter notebook
install jupyter setup
install juypter
install jupyter notebook python3
instal jupyter notebook pip
install jupyter notebook windows anaconda
in jupyter notebook
is jupyter lab necessary to install jupyter notebook
should we install jupyter notebook or jupyterlab
how to install basic jupyter notebook
jupyter install anaconda
how to install python libraries jupyter
jupyter installation guide
jupyter python install package
install jupyter notebook numpy
jupyter notebook conda install
ModuleNotFoundError: No module named 'notebook'
install jupyter on windows 10
windows install jupyter
install jupyter notebook with python
jupyter notebook *
jupyter installing jupyter lab
install jupyter with pip
install jupyter notebook with python 3
install jupyter notebook pip
pip install from jupyter notebook
install jupyter pip
install jupyter on windows
jupyter notebook pip install
install python libraries in jupyter notebook
how to install jupyter on windows
installer jupyter notebook
install jupyter notebook in conda
install jupyter notebooks
how to install jupyter notebook using pip
install jupyter notebook windows python3.7
how to install jupyter notebook without anaconda
python install jupyter notebook
how to install jupyter using pip
install juypter notebook
how to install jupyter notebook in python
install python library from jupyter notebook
install pip jupyter notebook
python install jupyter
jupyter notebook python install
how to install in jupyter notebook
installer jupyter notebook windows
No module named 'pandas' jupyter notebook
jupyter install pip
jupyter install pip package
jupyter notebook notebooks
install extensions in jupyter notebook
no module named jupyter notebook
install python module jupyter notebook
install python package in jupyter kernel
how to install module in jupyter notebook
jupyter notebook install module
pip install in jupyter notebook
how to install a library in jupyter notebook
jupyter r notebook install
jupyter notebook installation
pip install jupyter notebook windows
install jupyter for anaconda
jupyter install windows
no module named pandas in jupyter notebook
install jupyter for js
install toc2 jupyter
HOW TO INSTALL A python library on jupyther notebook
jupyter install in windows
nbextensions install
jupyter lab windows install
install des package depuis jupyter
windows jupyter notebook python UnityEnvironmentException
update python packages in jupyter notebook not updating windows
jupyter notebook: install packages
install jupyther python
install python jupyter
install jupyter notebook ubuntu
jupyter notebook $
install jupyter notebook for python
jupyter noteook cant access anaconda t install packaes using pip
installing mdules in jupyter
how to download jupyter notebook on windows 10
Configurable nbextensions
install jupyter nbextensions
install notebook extensions
jupyter contrib nbextension install --user
how to use pip in jupyter notebpook
jupyter installation
pip install jupyter_contrib_nbextensions
nb extensions install
download jupyter lab windows
how to install packages on jupyter notebook
jupyter extensions file
where should i install my package for jupyter notebook to import
install jupyter notebook and jupyterlab
how to install add in for jupyter
how to install nbextensions in anaconda
"jupyter contrib nbextension install" with virtual env
jupyter_contrib_nbextensions command line
can you pip install in jupyter notebook
how to get jupyter notebook
anaconda install verbose jupyter
jupyte install
pip jupyter
ide jupyter notebook
pip install in jupyter
instal jupyter download linux
install python package for jupyter notebook
install jupyter notebook -jupyterlab
how to install python for jupyter
jupyter notebook windows 1-
jupyter setup
install jupyter notebook linux
jupyter install package
jupyter-notebook install
jupyter notebook no module named
nbextensions enable mac
nbextensions enaible mac
install a package in jupyter
install jupyter notebook using pip
install package ipynb
enable venv in jupyter notebook extensions
jupyter contrib nbextesion
how to activate the jupyter notebook extensio
jupyter notebook latest version download
adding packages to jupyter notebook
jupyter notebooks extension py
jupyter insytall
install juptyer notebook
install a library through jupyter
jupyter extensions install
install options in jupyter
install xlrd in jupyter notebook
download jupyter lab for windows
install the jupyter_contrib_nbextensions
jupyter lab app
sys.executable pip install
is it saf eto pip install notebook
how to run pip install in jupiter notebook
install biopython in jupyter notebook without pip
how to download all the library for jupyter notebook
jupyter install packages locally
how to install jupyter library from a folder
how to install jupyter library from a file
install jupyter on anaconda
nb extension for jupyterhub
install lintel in jupyter
jupyter notebook in environment
jupyter windows
install all nbextensions in jupyterhub
install packages for jupyter notebook
jupyter notebook install python package
how to pip install a package when jupyter is running
how to install library in jupyter
using pip install in jupyter notebook
jupyter install module
jupyter notebook nbextensions conda
setup python notebook
python to jupyter notebook
jupyter notebook include python library
jupyter lab windows
how to install librabries in juptyer
jupyter add library
jupyter extensions
download jupyter notebook as py
how to add a library to jupyter notebook through bash
when i install packages it doesn't work in jupyter notebook
jupyter nbextension disable <nbextension require path>
pip install via jupyter
jupyter lab reinstal
jupyterhub install kernel packages
jupyter notebook intall pip package
jupyter notebook pip install requirement
clean install jupyter notebook linux
jupyter client mac
installing a package in jupyter notebook
installing packages jupyter
pip install module in jupyter notebook
list of jupyter nb extensions on my system
configure nbextensions jupyter
jupyter notebook web
jupyter nbextension enable
jupyter notebook new version
install python and jupyter notebook ubuntu
conda install extensions
jupyter notebook instal library
juputer lab
install boto3 in jupyter notebook
install conda jupyter
how to download and install jupyter
jupyter nbextension enable hinterland
hinterland jupyter install
run pip in jupyter
install jupyther lab
jupyter notebook nbextensions
how to install jupyter notebook in python shell
jupyter notebook install extensions
python jupyter download
notebook extensions jupyter
ubuntu install jupyter notebook python 3
how to install nbextensions in jupyter conda
how to install nbextensions in jupyter
jupyter pip install
install jupyter notebook debian 10
use packages in jupyter notebook
notebook pip install
download jupyter lab
install jupyter notebook and lab
mac install jupyterlab
how to install user defined packages in jupyter notebook
confirm python package installed in jupyter notebook
how to install python package from local directory to jupyter notebook
install modules in jupyter notebook
jupyter lab notebook
pip install packagesin jupyter notebook
jupyter notebook install package system
install stuff on jupyter
jupyter for python download
jupyter notebook download for windows 10
jupyter install requests
pip instal jupyter
juoyter notebook install
coding jupyter
how to download an use python notebooks
project jupiter
conda how to install jupyter hinterland
jupyter nbextensions install
jupyter nbextensions
whre jupyter is installed in anaconda
how to installl somthing in jupyter notebook
notebook jupyter windows
install module jupyter notebook
Installing Jupyter using Anaconda
Jupyter install how to
Hooking up bitalina with jupyter notebooks
jupyter python
download jupiter notebook
Can you pip install in Jupyter notebook?
installer jupyter sur windows
install packages in jupyter notebook python
download jupyter notebook
installing jupyter notebook windows 10
online jupyter notebook download
jupitor python
jupyter addons windows
install for jupyter lab packages
install nbconvert extensions
jupyter notebook normal install
install pacage for jupityr notebook
jupy python install
how to setup jupyter notebook environment
enable jupyter nbextensions
jupyter extension
jupyter notebook No module named 'pandas'
how to download a package in jupyter notebook
!pip install inside jupyter notebook
jupyter python3
download and set up jupiter
installing python jupyter
install module on jupyter notebook
install on jupyter notebook
latest jupyter notebook version
download jup notbook windows
what is Project Jupyter?
jupyter network version python
conda unstall jupyter
install jupyter notebook without anaconda
jupyter on python 3
jupyter download
install jupyter notebook windows
nbextensions version
install jupyter notebook
magic command jupyter pip install
how to download library in jupyter notebook
how to use pip install in jupyter notebook
jupyter notebook extensions install
jupyter notebook extensions contrib extensions
jupyter jupyter notebook
install hinterland jupyter
anaconda notebook python 3
jupyter notebook wndows
default extension jupyter
how to add nb configurable extensions
how to get NBextensions adde to jupyter notebook
No module named notebook
pip install jupyter extensions
how to use pip command for jupyter
install package python in jupyter notebook
miniconda jupyter lab
how to install package with jupyter
ipython run pip install
jupyter notebook download
python package jupyter notebook
jupyter installer
how to install packages from jupyter notebook
how to do pip on jupyter notebook
how to use and install jupyter notebook
install jupyterlab windows 10
jupiter for linux
conda jupyter notebook
install notebook using pip
install anaconda with jupyter notebook
format code yupiter
install python model in jupyter notebook
how to install jupyter notebook with conda
install python packages in jupyter notebook
install package jupyter python
Users cannot enable notebook extensions on DSX Jupyter notebooks.
install jupyter notebook python
where does jupyter notebook get python package
how to install nbextensions jupyter ubuntu
how to install nbextensions jupyte ubuntu
pip install from within jupyter notebook
how to install libraries on jupyter notebook
jupyter contrib extensions
install jupyter conda
install jupyter notebook from anaconda prompt
how to install pypdf2 in jupyter notebook
where to find python open source code jupyter notebook
how to download module in jupyter
how to install libraries in jupyter notebook
conda intall jupyter
install library in python jupyter
jupyter labs download
how to import library in jupyter notebook
jupyter notebook extension
jupiter scripting language
guideline to for installation to use jupyter notebook
jupyter lab
software req for jupyter notebook
jupyter notebook to wes service
jupyter notebook to wes servecise
conda indtall nbextensions jupyter lab
install jupyter notebook extensions
what si a jupyter notebook
install toc2 jupyter notebook
setting up jupyter notebook
jupyter lab install python libraries
python jupyter notebook html doc not working nbextensions update
jupyter notebook windows
installing jupyter windows
jupyter notebook install
download library for jupyter notebook ubuntu
anaconda install notebook
jupiter windows
install nbextensions anaconda
enable nbextensions jupyter
jupyter interpreteer
jupyter notebook using anaconda
nbextensions jupyter linux anaconda
pip install jupyter
import xlrd jupyter notebook
jupyterinstall using python
how to set up jupyter
dowload jupyter labs
force instal a function in anaconda jypter notebooks
conda install within jypter
in jupyter notebook using pip install
projects in jupyter notebook
hinterland python install
how to install packages in jupyter notebook online
how to install a module in jupiter notebook
managing packages jupyter noteboo
how to download jupyter notebooks programs
install pip from notebook
install python packages jupyter notebook windows
pip install jupyter extention
ipython notebook jupyter
get jupyter notebook version
jupyter software
install jupyter-lab debian
install module in notebooks
installing jupyternotebook with anaconda
install jupyter labs
add new jupiter
Jupyter Server applications
jupyter lab for mac
how to import requests in jupyter notebook
install jupyter la
download numpy jupyter notebook
jupyter notebook python download
jupyter notebook login
jupyter python for
installer jupyter lab mac os
how to install jupyter notebook on python3
jupyter contrib nbextension
jupyter nbextensions conda
jupyter notebo
install jupiter windows
how to install juypter
command t install package quietly jupyter
add downloaded package to jupyter notebook
jupyter online acess
how to do pip install from jupyter notebook
install lib on jupyter notebook
install packages jupyter notebook
how to install module on jupyter
installing jupytterin python3
How to setup pip on Jupter
how to install numopy package and module in jupiter notebok
jupyter via conda
contrib_nbextensions with jupyter lab
how to install latest library jupyter
view jupyter notebook online
install modules jupyter notebook
jupyter notebook server platform
how to set up jupyter notebook for python 3 in windows
create a jupyter notebook online
install library jupyter notebook
how to install python packagr to jupiter ntebook browser
jupyter anaconda install
how to link jupyter notebook to site-packages
conda install nbextensions
how to install packages for python kernel in jupyter notebook
nb extension jupyter notebook enable
import pydotplus as pdtp in jupyter notebook
install package to jupyterlab
jupyter notebook use pip install
Install xlrd on jupyter
reinstall jupyter notebook
what is a jupyter notebook?
pip install safely in jupyter
jupyter notebook is slagging
jupyter notebook lab install
how to view PiChart3D in jupyter
how to install and use jupyter notebook
how to install dependencies in python jupyter
julia notebook online
how to Install Jupyter extension package
jupyter notebook app download
enable jupyter notebook hinterland from command line
jupyter add module
pypdf2 jupyter notebook
download packages to jupyter notebook
navies in jupyter notebook
how to install numpy for jupyter lab
hinterland pip
how to open a jupyter notebook online
download nbextensions
where is jupyter installed
install jupter lab
acoda jupyter lab
jupyter-notebook nutre journal
jupyter python install
doenload jupyter notebook code file in pc
jupyter.org
how to get library package help in jupyter notebook
jupyter server windows
pip3.6 jupyter notebook install
download jupyterlab
jupyter notebook extension manager
update jupyter notebook and nbextensions
how to do pip install in jupyter notebook
how to import labelBinarizerin jupyter notebook
ntebook python
jupyter notebook interpreter
install package in jupyter
install numpy jupyter notebook
jupyter for
jupyter notebook local
how to install pip command in jupyter notebook
pip install command in jupyter notebook
how to install modules in jupyter notebook
download packages in jupyter from python
jupyter for python
online julia notebook
jupyter notebook language support
how to add a library to jupyter notebook
jupyter language
pip3 used in jupyter
where pip jupyter install packages
install nbextensions
jupyter notebook exe download
how to get nbextensions in jupyter notebook
ONLINE PYTHON WORKBOOK
jupyter notebook &
install a package in jupyter notebook
Install and enable the jupyter_http_over_ws jupyter extension (one-time)
python install jupyter lab
how to install a module in jupyter lab
how to load packages in jupyter notebook
pyp3 jupyter notebook
install jupyter notebook extension
jupyter network
nbextensions jupyter lab
install jupyter extensions
jupyter extension in ubuntu
how to install python libraries in jupyter notebook
jupyter utility
how to install numpy in jupyter notebook
where do you install packages for jupyter notebook
install packages for jupyter lab
install python package run in jupyter
how to install a module in jupyter notebook
jupyter hub in windows
jupitar python
installing hinterland for jupyter without anaconda
jupyter -js-widgets/extension
how to install module in jupyter
jjupyter notebook
how to make pip work in jupyter notebook
how to use python 3 in jupyter notebook
jupyter notebook run pip install
installing packages in jupyter notebook
jupyter kernel website
jupyter notebook onlineer
install jupyer lab
install libraries in jupyterlab in jupyterhub
download a jupyter notebook code on desktop
download a jupyter notebook on desktop
importing libraries in jupyter notebook
installing cr-horoplethr in jupyter notebook
classic jupyter notebook
install library in jupyter notebook
python online ide jupyter
pip install in notebook
location of jupyter packages
how to run jupyterlab wothout anaconda navigator
how to check installed packages in jupyter notebook
after conda install jupyter, how to use it
jupyter notebooks installing libraries
installing libraries in jupyter notebook
using libraries in jupyter notebook
jupyter notebook if not installed install
jupyter noteebook
most needed packages for jupyter notebook
add model packaging to jupyter notebook
add packaging to jupyter notebook
how to install python packages in jupyter notebook
how to re install jupyter notebook
local jupyter notebook
import sys pip install
pip3 jupyter
install package jupyter notebook
Could not install jupyter. If pip is not available, please use the package manager of your choice to manually install this library into your Python environment.
to use numpy package injupyter
how to update numpy in jupyter notebook
jupyter notebook\ notebook
conda jupyter install
jupyter ide for python
use pip in notebook
run pip install in jupyter notebook
jupyter lab python
how to install python jupyter notebook in windows
install jupyter in python
how to install libraries in jupyter environment
how to install jupyter notebook in conda environment
download jupyter Notebook Home
jupyter notebook what is @
jupyter notebook detention
jupyter notebook windows ide
install jupyter notebook for python 3
how to install jupyter notebook using anaconda
Jupyter notebook how to install packages from requirements.txt
install with pip jupyter notebook
run pip in notebook
download jupyter notebook client
how to do a pip instal from jupyter notebook
what is jupyter notebook install
jupyter install libraties
install pip in notebook
can you download packages on jupyter lab terminal
how to do pip install in a note book juptr
install lib in jupyter notebook
jupyter lab application
install numpy in jupyter notebook
anaconda jupy
njupter to python
install jupyter python3
jupyter notebook on website
download jupyter ab
download jupyter ;ab
CLOUJUPYTER LINUX
jupyter linux
jupyter notebooks mac app
jupyter notebooks app
jupyter notebook version
how to import libraries and dependencies in jupyter notebook remotely
jupyter notebook as a app
i have jupyter notebook
pip install from jupyter notebook using system
how to download module in jupyter notebook
how to add modules from pip in jupyter notebook
install using jupyter
jupyter notebook latesr version
add packages to jupyter notebooks
web based jupyter notebook
jupyter kernel packages
installing a package in jupyter
install some package in jupyter notebook
online jupyter environment
jupyter python installed
jupyter notebook sudo pip install
install jupyterlab
rnotebook.io install new libraries
jupyter python downkload
Jupyter notebook pexpectsh
anaconda jupyter notebook how to pip install while in notebook
install jupyterlab python 3
directly installing packages through jupyter
jupyter for windows
python jupiter notebook
installing a new package in jupyter lab
how to install dependencies in python in jupyter notebook
jupyter vs jupiter
pip3 install package jupyter notebook
jupyter notebook indir
install package jupyter
installing in jupyter notebook
jupyter shell magic pip install
pip install from notebook
how to install pandas for python 3 in jupyter notebook by terminal in ubuntu
installing jupyter notebook using anaconda
jupyter book download
jupyter notebook runsepe
install jupyter note book
installing jupyter with anaconda
jupyter install packages
notebook install package
how to install jupyter latest version
how to install jupiter notebook
installing in jupyter notrnbook modules
install packages in jupyter lab
open jupyter notebook online
anaconda et jupiter
how to instal jupyter notebook python3
how to import packages in jupyter notebook
how to install jupyter notebook in windows 10
pip install jupyter notebook
install jupyter notebook python3 ubuntu server
best way to install python windows jupyter
sys executable installing package in jupyter python
how do you get jupyter notebook
installing numpy in jupyter notebook
pip install numpy jupyter notebook
set up jupyter notebook
install jupyter notebook anaconda
jupyter install
install jupyter cmd
run jupyter notebook from conda
jupyter notbook dowload
pip install xlrd jupyter notebook
install lib in jupyter
install jupyter notebook python2
notebook install tushare
jupyter notebook pip install package
conda install in jupyter notebook
install libraries in jupyter
how to download dnspython on jupyter notebook
install modules in ipynb
jupyter ide
use pip install package in jupyter notebook
jupyter notes
install package in jupyter notebook
how to use 3.5 and 3.8 version of python in jupyter notebook
python 3.5 jupyter notebook
how to run a python notebook that comes with a package
how to properly download anaconda and jupyter
how to install packages in jupyter notebook
how to use pip install jupyter notebook
install packages on jupyter notebook
how to install jupyter lab
where is jupyter notebook installed
jupyter notebook anaconda
vz_projector in jupyter notebook
anaconda jupyter
use jupyter notebook with anaconda
install jupyter for 3.7
jupyter notebook install module pip
install anaconda jupyter notebook in ubuntu
jupyter python add artifactId
installing python notebooks on windows
juptyer python
anaconda jupyter python 3
where are packages installed python jupyter
how to download modules in jupyter notebook
jupyter lab install
how to setup jupyter notebook
install anaconda jupyter notebook
install specific version of jupyter notebook 5
install specific version of jupyter notebook
anaconda jupyter install options
how to Import the Python requests to jupyter notebook
how to import libraries in jupyter notebook
how to install jupyter notebook on windows 10
how to re-install jupyter notebook in windows 10
jupyter notebook software
pip install notebook
jupyter-notebook
install jupyter with conda
most useful pip jupyter notebook packages
most useful pip jupyter packages
Jyputer Notebook
instal jupyter notebook
jupyter pip install package
how to install pip in python jupyter notebook
jupyter notebook package install
anaconda jupyter lab
jupyter python 3 ide
jupyter notebool
jupyter notebook install in windows 10
jupyter notebook install in windows
jupypter notebook
jupter notebook
how big is jupyter notebook
python jupyter notebook
google jupyter notebook interface
install jupyter notebook in linux mint
installing jupyter notebook with conda
free download code notebook
installing jupyter lab
jupyter download projects
download jupyter notebook projects
jupiter notebook pkg
jypter python
install package for jupyter notebook
how to install jupyter notebook in macbook pro
anaconda 3 jupyter notebook
how to install packages for jupyter notebook
how to install packages in jupyter
jupyter version
how to install jupyter after installing anaconda
hwo to instaall jupyter in
jupyter notebook
jupyter conda isntall
install pachakge jupyer
how to setup jyputer notebook
python jupyter lab install
jupyter python online ide
packages installing before jupyter notebook
jupyter notebook latest version
how to download python jupyter
jupter
what is jupyterR
install upyter notebook
what is jupyter notebook
what is a jupyter notebook
how to use pip in jupyter notebook
how to install modules jupyter notebook
install and runjupyter notebook
install jupyter notebook mac python 3
setup jupyter notebooks
juypter
how to add a python module in jupyter
where are the module download in jupyter notebook
how to install the jupyter notebook
how to install python module in jupyter notebook
install jupyter notebook from terminal
install jupyter notebook anaconda through terninal
jupiter programming
jupiter software
jupyter lab download
install jupyter for python 3
what the difference between pip install jupyter and notebook
how to use jupyter notebook following pip install
jupyt
jupyter noteboox
py jupiter
jupyterlogo
using jupyter after installing
jupyter noteb
python notebooks
set up jupyter notebook with pip file
anaconda install jupyter notebook
how to learn jupyter notebook conda in linux
how to install jupyter
notebook on python
download all jupyter packagees
install jupyter notebook using conda
jupter install by conda
install jupyter notebookconda
how to download a package on jupyter notebook
jupyter notebook python 3
use jupyter notebook kali linux
jupiter IDE
what is jupyter
python jupiter
apache jupyter
how to install jupyter notebook in anaconda
install packages in jupyter notebook
jupyter tools
jupyter note pad
hwo to install jypytor
install jupyter notebook in a anaconda environment
jupyter notebook add python
how to update python libraries in jupyter notebook using pip
how to download only jupyter notebook
how to install Jupyter Notebooks
juypter notebook
jupyterlab ide download
jupyterlab download
how to reinstall jupyter notebook
pip3 install jupyter
jupyter notebook install pip
jupyder notebook
how to use pip installed python libraries in jupyter notebook
how to use pip install python libraries in jupyter notebook
jupiter notebook
install jupyter notebook with anaconda
import libraries in jupyter
set up jupyter
how to download jupyter notebook from anaconda
jupyter notebook ?
ipython notebook
install module to jupyter notebook
anaconda install ipython
installing packages through jupyter notebook
notebook jupyter
install package using jupyter notebook
how to pip install in jupyter notebook
jupyter noteboook
conda install on jupyter notebook
jupyter python 3
juperter python
python jupyter
python notebook
anaconda jupyter notebook install
jupiter python
do I have to install conda to use jupyter notebooks
jupyter notebook install boto3
jupyter install modules
how to install jupyter notebook in windows
pre installed library jupyter notebook
install jupyter noo
how to install jupyter on mac
how to write pip command in jupyter notebook
jupyter notebook for python
jupyter notebook python
install package in notebook
how to install jupyter nitebook
how to install extra packages into juyter
raylet jupyter note
jupyter notebook app
jupyter
Jupyter Notebooks
jupyter notebook with anaconda
install jupyter notebook conda
jupyter notebook to python
how to install jupyter notebook for python
install and use jupyter linux
how to use anaconda to install jupyter notebook
install jupyter notebook windows machine
installing packages in jupyter
install python library in jupyter notebook
jupyter notebbok
install packages from jupyter notebook
install from jupyter notebook
jupyter conda
Jupyter Notebook
how to install jupyter notebook to conda
conda install jupyte
installing jupyter notebook on windows
installing jupyter notebook
how intstall jupyter cli
install jupyter lab
conda install jupyter
how to download python notebook
to install jupyter notebook
install jupyter notebook on linux
install jupyter notebook python 3
jupyter notebook conda
install jupyter notebook f
how to install jupyter noetbook terminal
how to install jupyter notebook
conda install jupyter notebook
how to download jupyter notebook
install jupyter notebook
installing jupyter
how to install jupyter notebook with anaconda
how to install jupyter notebook on windows
install jupyter
More “Kinda” Related Shell/Bash Answers
View All Shell/Bash Answers »
gatsby starter hello world
update angular cli globally
install material ui
install dependencies react project material ui
yarn emojis
composer install production
create react app typescript
Cannot find module '@angular/compiler-cli'
npm install upgrade react version react-scripts
uninstall nginx
delete nginx
uniinstall nginx
npm to fix lint issues
eslint fix
update composer ubuntu
vue cli upgrade
update global package npm
npm install redux and react-redux
install grunt mac
Grunt--install cli
bs4.FeatureNotFound: Couldn't find a tree builder with the features you requested: lxml. Do you need to install a parser library?
gatsby js install
install angular cli
npm install material ui icons
check if nginx is running
install angular material
responsive grid system angular
add material library angular
ng add @angular/material
upgrade composer version
update composer globally
how to uninstall composer in ubuntu
composer update composer
install vue router
nuget package manager restore
vs force restore all packages command line
Could not find a part of the path 'E:\Projects\Server Migration Projects\AndrianBus-U8\Adrian-Bus\AdrianBus\bin\roslyn\csc.exe'.
Install for [ 'create-react-app@latest' ] failed with code 1
how to update laravel installer
upgrade all packages in package.json
magento bin install
install amplify cli mac
install amplify
install material-ui
Module not found: Can't resolve '@material-ui/core/Button'
install netlify cli
can't resolve 'sass-loader' vue
install entity framework in visual studio 2019 command
command to install react cli
node-pre-gyp install --fallback-to-build --library=static_library
nginx on mac
version nginx command
determine nginx version
how to check nginx version in ubuntu
Install cpanel on upcloud
how to install react router dom with typescript
npm install redux thunk
install reach router
install apollo
install angular bootstrap
install ionic globally
ionic cli
ionic install 3.19.0
install firebase angular 8
Module not found: Can't resolve '@material-ui/pickers' in 'C:\Users\61455\Documents\React apps\mya2o\src
Cannot find module 'typescript'
how to check for angular cli version
install ionic cli specific version
'webpack-dev-server' is not recognized as an internal or external command
install antd
ant design import
install ant library next js
magento 2 check version command line
install particular version of laravel
composer 2 install in windows 10
quasar install
create react app install
install yarn in react native
install firebase npm globally
install firebase tools
firebase cli windows
angular install firebase tools
command to install firebase in raspberry
firebase-tools npm
Firebase tools
webpack-dev-server command not found
Failed at the [email protected] postinstall script.
laravel 8 composer install
npm dev dependencies
install laravel ui in laravel 8
installing eslint globally
how to share gatsby project on lan
npm install angular do not install devkit
install react native navigation
install ngrok
install webpack
instamm webpack 4.42.0 how with command
composer install drush
how to install react with typescript
stylelint run
Install Peer Dependencies
failed to load module canberra-gtk-module
expo typescript
vue scss
How To Update ionic
Error: Cannot find module 'webpack-dev-server'
create react app with npm not yarn
react
install cors
npm i --global expo-cli
expo install in ubuntu
expo install globally
gulp cli
install babel command line
npm i -D @babel/core @babel/preset-env babel-loader
install sequelize cli
styled componets npm
expo build android
cordova live reload
install material ui icons
install webpack cli
create-react-app typescript
gatsby-plugin-styled-components
restart nginx
reload nginx
install dependencies @material-ui/lab/Rating
codeigniter 4 install composer
semantic ui react npm install
requireNativeComponent: "RNCSafeAreaProvider" was not found in the UIManager.
install nginx
reactjs capacitor init
react native expo install
install babel loader
bookbuild react app from scratch
angular update
angular cli global update
npm install ngrx
how can I see my gatsby version
how to install jest
restart nginx in mac
install scss in react js
install babel core
react native installation
feathersjs cli
install firebase in react
install gz file
how to install tar.gz in ubuntu
ngx translate install
install package chart.js
prettier whole project
install deno
npx create-react-app not working
npx create-react-app error
canot creat new app react js error fetch npx
install next auth
mui treasury styles install
spacy install
installing react router dom with yarn
install react router
react js router
react router install
router dom react
install ext-dom linux
phpunit/phpunit[8.5.8, ..., 8.5.x-dev, 9.3.3, ..., 9.5.x-dev] require ext-dom * -> it is missing from your system. Install or enable PHP's dom extension
composer requires ext-dom *
install ext-dom
install material ui lab
install @angular/core
yii2
yii install
moment js ionic
install angular 9.1.7
updating to gulp 4
install en_web_core md
crontab test
install vuex
vuex install
npm install yarn equivalent
ubuntu start nginx
stop nginx
how to install expo cli on windows
how to install vue router
ionic install
install angular cdk
ionic plugin list command
linux install figlet
edit cron jobs
material ui install
jest vscode autocomplete
install @angular/router
replace ionic-angular @ionic/angular
stylelint fix
redux install
install firebase-tools globally yarn
angular/animations install npm
convert crt to pem
tailwind install in laravel
ionic 4 install bootstrap
laravel create project command with version
laravel 6
How to install laravel with specified version
install laravel
create laravel 6 project using composer
install laravel specific version using composer
yarn 2 outdated packages
npm install ant design
install strapi cli
jasmine.clock().install() jest
unable to resolve module safe area context from index.tsx
font awesome install in angular
install magento 2 using composer
create magento 2 project
magento 2 reindex command line
composer tree
npm to yarn migration
How to check the installed version of React-Native
install bootstrap in angular 9
how to install bootstrap in angular 11
vue install
how to install enzyme
how to add husky to angular
npm install line awesome
getting started with sanity
install mdx for nextjs
npx cap sync Unable to find node_modules/@angular-eslint/builder
how to find current active yarn resource manager
makepkg resolve auto dependencies
Package "ngx-mask" has an incompatible peer dependency to "@angular/common"
how to install comtypes
@react-navigation/bottom-tabs install
install ngrx/effects
scss in gatsby
composer drupal install
angular create a service
webpack install
create necxt app
react-router-breadcrumbs-hoc@^3.2.3 yarn upgrade
ionic install copycliboard
pulseeffects ubuntu
install react latest version
how to install gatsby with typescript
styled components props typescript
create r anaconda environment
expo upgrade reset
dexie nuxt
ngxcountup
angular cli generate new module
test nginx config mac
angular localize install
downgrade npm package to specific version
install bootstrap angular
run prettier
laravel create model
how to install a package from a specific repo in r
ts3 install script
install semantic ui react
eslint npm install
install eslint
install vue in laravel
Unmet dependencies.
install angular animation 10.0.12
magento 2 gulp
composer require laravel/ui app.css empty
npm install dev dependencies only
install strapi
html webpack plugin
install ionicons react native
ionic cordova live reload
tsc init
upgrading composer globally on windows
update composer on windows
yarn version
how to check yarn version
create new project gatsby
how to install bootstrap in react
how to deploy to netlify from cli
run laravel project from github
install existing laravel project in xampp
install angular cli specific version
npm install vuelidate
npm install react
install wireguard
twig install
how to install webpack
download nextcloud
export crontab
import crontab
import crontab from file
update package repository arch
eslint prettier reactjs
npm install production
npm install production only
composer installed versions
upgrading ionic 5
yarn 2 upgrade all packages
laravel composer install
A template was not provided. This is likely because you're using an outdated version of create-react-app. Please note that global installs of create-react-app are no longer supported.
npx --ignore-existing
create react native app
composer get version of package
add router to vue
install redux npm
install boostrap react
react bootstrap
install react bootstrap
react and bootstrap
bootstrap react install
npm install React Bootstrap
install react-bootstrap
lets encrypt nginx
Package "ngx-material-file-input"
install redux-thunk
redux-thunk
thunk redux
redux thunk npm
Can't resolve 'redux-thunk'
github drupalcomposer project
reinstall angular core
how to start cloned laravel
npm install mocha dev dependency
install react-redux & types
create react app with redux and typescript
composer list packages
install magento 2 command line composer
install pavucontrol
deploy netlify angular
angular serve open
apollo client install in gatsby
install Build Tools revision 26.0.2
styled-components
install ionic cordova globally
install font awesome
laravel install telescope
install bootstrap in laravel
how to install vue in laravel
install gulp
install typescript in gatsby
magento 2 configure cron command line
angular install ng-apexcharts
ionic publish
magento shell reindex
npm install @ngx-translate/http-loader
how to install asyncstorage in react native
angular cli generate component
ng cli generate component
angular new component
install styled components in Gatsby
iconify react
how to install cordova
update angular
dependencies dpkg
install @ng-bootstrap/[email protected]
install react native navigation stack
Unable to resolve "react-navigation-stack" react native
error when npm install @react-navigation/stack
mui install
Install Material ui on react app
install sass loader
download specific version of drupal using composer
install ionic
yarn frozen lockfile
composer install one line
helm install
Module Error (from ./node_modules/sass-loader/dist/cjs.js): Node Sass version 6.0.0 is incompatible with ^4.0.0 || ^5.0.0.
update yarn
react natibe debugger
how to run eslint on the whole project
install gatsby typography
electron app from vue
electron app any website
npm install -g angular cli
yarn equivalent of npm ci
restart nginx mac
vuetify install
install angular app
react typescript testing
setup gatsby project
npm firebase
install material icons
install expo app loading
react slick typescript
run mutiple sass files at once
install angular cli version
how to check laravel installer version
expo cli not installing
expo install
create a new project with create-react-app
how to install emotion in gatsby
npm install --unsafe-perm
composer upgrade to 2
npm install package as developer dependency
install react dependencies
react navigation react native
navigation in react native
npm install without dev dependencies
react-darkmode-toggler
how to install react in laravel 8
centos install copmposer
angular add component
create middleware in laravel
react add typescript to existing project
instalación de angular cli
node sass generate css
check nativescript version
install easyadmin-bundle symfony
commmand for installing tailwind to react
yarn add install all packages in package,json
install all yarn
yarn install from package.json
CPANEL AUTO DEPLOYMENT WITH GITLAB
install react native cli
material ui
redux logger
composer minimum stability
linux install sass
jest command coverage
install expo
typescript css modules in react
install fast api
react hooks npm install
npm install dev dependencies
axios react native
create custom artisan command laravel
install ionicons
install bootstrap laravel 8
install livewire laravel
how to install Sunra\PhpSimple\HtmlDomParser composer
How to install php-simple-html-dom-parser
run global packages macos composer
install laravel vue
how to install gatsby gatsby-plugin-manifest
how to install protractor
elifecycle npm install error
apollo client install
symfony install website skeleton
set up redux in react
show version laravel
install bootstrap in angular
angular bootstrap
install bootstrap in angular 10
yarn add @materialui
Input is required, but Expo CLI
alias firebase="npm 'config get prefix'/bin/firebase"
install laravel 7
check angular version
@react-navigation/stack install
rename laravel project
prittier download ubuntu
prettier code formatter is removing ;
prettier config vscode
vscode prettier show errors
No local configuration (i.e. .prettierrc or .editorconfig) detected, falling back to VS Code configuration prettier
prettier install
create app expo
angular install ngx-bootstrap
yarn react
create strapi app
update snapshot jest
install yarn
ionic cordova generate component
Failed to load module "canberra-gtk-module"
@react-native-community/netinfo
npm install --global vue-cli
enzyme npm install
install lerna on Linux
install lerna
expo install react native gesture
how to install vue cli
how to install vue
install react yarn
expo font install
react create app
install appx package windows
install kind
laravel 7 composer install
yarn add global
how to add packages globally in yarn
yarn global
yarn init project
how to install react native
yarn nuxt install
create new nuxt project
yarn install No such file or directory: 'install'
npm legacy-peer-deps
install tailwind
react-router
npm slugify
install react-native-vector-icons/ionicons
how to use sass in react without eject
angular 8 install agm
how to install react redux
rvm set default
Ignore Composer Platform Request
install react-native-safe-area-context
how to install phpunit
install devtools
react native map install npm
force app.js update
Tailwindcss cli
npm history react install command
ionic init
my app.js is not updating
app.js not updating vue
install react select
force app.js file update
react select install
install adminlte in laravel
angular add modulee
jekyll run
Command `npm install --save --save-exact react-native` failed
how to install bootstrap in angular
run dotnet core app
./node_modules/@material-ui/styled-engine/index.js Module not found: Can't resolve '@emotion/styled'
how to install new project in laravel
symfony install doctrine
angular add service worker
windows install composer
install tailwind in angular
install vue cli 3
angular add universal
react-scroll
install twilio laravel
install twilio using composer
install twilio
react htaccess
install scrollmagic npm
expo icons
laravel/sail
laravel sail composer
nginx letsencrypt
react navigation
react navigation install
how to install dependencies from package.json
how to install all dependencies in package.json using npm reactnative
change name in package json from command line
laravel 4 installer
how to install gulp version 3.9.1
draw.io download linux
install draw io locally
vue js sass
install gulp serve
How to Install & Run CodeIgniter Framework
composer global install
ngx-bootstrap npm
expo react native init
redis download
material ui npm
react native elements install
react native elements
react navigation bottom tabs
install admin lte in laravel
yarn add specific version
npm install strapi
install bootstrap vue
conda install from yaml
install react 16
install saas
bash get package dependencies
install prettier globaly
install prettier
composer download
composer installation cmd
composer install via cmd
composer php
install composer
composer install on mac
install compser
cmd composer
install composer ubuntu 18.04
installer composer windows 10
install composer ubuntu
install composer in ubuntu
install composer phar
how to install new gatsby project locally
build cordova app command
@react-navigation/stack install npm
Cannot find module 'axios' or its corresponding type declarations.
step to install vue project in visual studio code
what .net framework do i have installed
@material-ui/icons
composer require maatwebsite/excel install
cara install laravel
npm install webpack
install composer package from github
yarn download windows
mvn build project
install dev dependency yarn
install bootstrap in gatsbyjs
how to update composer in laravel
laravel version global upgrade
cant find module firebase
install apexcharts
rails install devise
gats gatsby-plugin-offline
install react react testing library
install yarn windows
ngb-tabset install
composer install fast download
node_modules/@react-leaflet/core/esm/dom.js Module not found: Can't resolve 'leaflet' in
setup apollo server express
install prisma
laravel install by composer
yarn react install
gatsby-plugin-react-helmet npm
laravel install valet
default gatsby typescript started
conda install paraview
generate component angular without folder
package manager dotnet 5.0 frameworks
install react-player react
laravel
install react hot loader
install react-content loader
electron quickstart guide
run cron command line magento 2
install apollo server
react icons
netlify build command
npm install --save-dev @angular/cli@latest
Maatwebsite\Excel\ install laravel
react quill
react redux install
ionic link app
Install-Package MailKit
update composer
upgrade composer
strapi run command
to import sass files you first need to install node-sass. react
install react-native-community hooks
synfony run
ext-dom missing ubuntu
composer install require ext-dom * -> it is missing from your system
surge install command
filter npm audit only high
npm audit only high vuln
install classnames
npm install router
angular install ngx-perfect-scrollbar
material-ui
install appx
Install for [ 'create-react-app@latest' ] failed with code 7
install whitenoise
react circular progress bar
how to use /dev/urandom
upgrade to composer 2 windows
how to install source plugin gatsby
react hook install
how to upgrade package yarn global
The "@angular/compiler-cli" package was not properly installed.
update cpanel
yarn install production only
should mocha and chai be npm installed as dependencies or dev dependencies
add stetho plugin ionic
vitejs tailwind
install bootstrap vue laravel 7
install vuex orm
aos animate install
browserrouter react not working install
react js BrowserRouter npm
install wordpress theme
Unable to find a specification for `React-Core` depended upon by `react-native-document-picker`
angular new project
installing nginx on ubuntu 20.04
publish ionic app
how to install axios in react
install package in r
slugify npm
how to create ionic react app
how to install react loader spinner
npm run custom script
npm add optional dependency
como atualizar a versão do angular
gatsby typescript template
infinite-react-carousel install
create react app
eslint init
gulp install
laravel installer version
install react form
how to install react hook form
install react hook form
install clasp
install react
how to install react spring with typescript
magento installer
comment installer tar.gz
composer add package
firebase install
otp npm
npm install tslint airbnb config
prettier npm
appollo in react
crear una aplicación con angular cli
ionic
install maatwebsite/excel in laravel
where do you install composer
flutter change package name
flutter app package name
add dependencies to package.json
react native typescript
install automapper asp.net core mvc
npx eslint fix
ionic download
sass to scss
install laravel dompdf
yarn lock conflicts
nativescript create angular project
react-helmet typescript
axiox install
uninstall en_web_core md
npm install composition apiu
strapi
npm find peer dependencies
installing firebase libraries in apache cordova
Managing the Nginx Process
npm install capacitor to existing angular project
install gulp global
create sbt project
nginx install in fedora 34
infinite-react-carousel code ERESOLVE npm ERR! ERESOLVE unable to resolve dependency tree
install formik
nuxt .env file not load
maven create project from archetype command line
hugo build
install.packages( tidyverse ) not working
npm install tough-cookie
how to edit crontab macos
Failed to install expo package with error: yarnpkg exited with non-zero code: 1 yarnpkg exited with non-zero code: 1
install vuetif
install haskell stack
how to install prettier globally on mac
composer install
react navigation 5 install
how to install flow on gatsbyjs
react native toast
npm warn ws butterfly install peer dependencies
install magento 2 docker
failed to install expo package with error: spawn yarnpkg enoent
install blender tar.xz
no source map sass
leaflet install yarn
auth install laravel 8
react native init typescript
zypper install build-essential
yum downgrade php
angular install @angular/cdk/drag-drop
angular routing
react native reactotron bug
reactotron not connecting
reaect native reactotron
yum list installed packages from specific repo
react native reactotron doesn't work
instal kdenlive
use gulp
deploy react express to github pages
hosting react on gh pages
install redux
supertest example
supertest npm
bootstrap
update bootstrap 4 to 5 version in laravel
install jekyll
Cannot install windows-build-tools
unable to find expo in this project - have you run yarn / npm install yet?
angular cli interface generate
error installed react native using npx react native init
yarn change version
swagger editor locally
generate rs256 key pair
install ignite-cli
jsonwebtoken generate key
gatsby-plugin-typography
deno bundler
laravel 7 upgrade
how to renew let's encrypt certificate nginx
install react spinner
npm install --save-dev shortcut
composer update ubuntu 20.04
install capacitor ionic
relead ngix
install npm on cpanel
cordova plugin command
how to run a create-react-app server
run react app locally
run react app vscode
react app run
how to install redux for react native
start server in react js
laravel install
install angular playground
install mpdf laravel
composer install package with specific version
latest package yarn dependencies
npm install webpack server
styled componennts
webpack-dev-server --https
create android and ios folder react native
run the scripts in package json
yarn install specific version
how to install ros package
cors package install npm
cors npm
react native paper install
install babel language
React js tutorial
lancer un serveur express
expo-server-sdk
install next-auth
deprecation problem in vscode when using sass
gastby yarn install
como agregar angular material al proyecto
nstall the XmlDoc2CmdletDoc NuGet package into your project.
npm install apmplify
composer install --
unable to install all modules vmware
install lxml
install and save axios react
install dot-prop
install neo layout
How to install cookies react
install pusher srever in larvel
use -i
install dotnet runtime
setupfor react app on linux
yarn create chrome extension with react and typescript
angular new site
error when i install sass
what is --save-dev check when we install a pachage
install extra requires
automatically install all dependences of a package in R
Failed to load module. If you have prettier or plugins referenced in package.json, ensure you have run `npm install`
install expo on react native bare project
conda install cufflinks
Redis download and installtion
terminal read json file
how to install amplify cli to your react project
install dotnet sdk
Jest failed after upgrade to react-native 0.64
ionic equivalent of android clean project
install yarn in nginx
yaml
install laravel globally mac
npm react js package for form factor responsive site development
how to install cargo crate
when you cant use npm and gem in powershell and git bash anymore
rvm not function rvm use
cron
jekyll new site
npm install firebase @angular/fire
which repository is made when expo init
build java ant project
install convox
install older version of laravel
how to make a rule install for makefile
comand for insalling playonlinux
react 17 install
Cannot find module 'react' from '../../../../node_modules/react-redux/lib/components/Provider.js'
new angular project no tests
Instala o Prettier no desenvolvimento
install pug angular
install react-livechat
how to install cargo packages
how to check default path of the nginx
yarn install package from github
add module with composer without adding it to git
how to create mavenw.bat
create file of packages to install with yum
how to install voyager on existing project with dummy data
how to install baeutiful soap
instalar conky manager ubuntu 18.04
what is amplify cli
add and install gem rails
how to uninstall global babel jest npm
install mana in kali complete method
how to install ruby on rails with curl
dgvai/laravel-adminlte-components
vue create from preset
laravel mix Uncaught ReferenceError: babelHelpers is not defined
lavastore js
install stress tool
install composer wsl
react spring version 8
plugin custom code to install another plugin
nuxt check is production
ng command new app
conky manager
install todoist
npm install multiple dependencies
running eslint
install graphene federation
qusar framework install jest
mana toolkit install
wait-on yarn
ng table angular 9 install
composer preferred-install dist and source
what is appmenu-gtk-module
meterial ui installesions
npm lavastore
install radium
quarkus build native maven
config php.ini for magento@
How to install florence
react-laag
install plugins from package.json ionic cordova
install todoist linux
Install styletron
install phoenix 1.6
install tainwind on laravel
install all dependency go
install specific version of passport laravel 6
bash list package dependencies
babel json loader
install modules mu
npm install hangs on lodash
regex prenom et nom compose
yii3 install
how to create reactportal in gatsby
zypper install nginx
install plugins from package.json
start nginx in terminal
pick yarn version
selinux
how to upgrade react in cra
Add base url to react router for gh-pages deployment
run ilastik automatically
install pg module
source scl_source enable devtoolset-6
how to run ng add on nx
Do you need to install EsLint after intalling the extension
npm otp-generator
Platform Browsing
javascript axios
react native youtube install
Refusing to install package with name "mongoose" under a package
Jekyll serve fails on Ruby 3.0
verbose stack Error: [email protected] install: `node-pre-gyp install --fallback-to-build`
alter package body compile
install gulp gulp-util exited with code 1
installation testing
install libraries in the carfile file command shell carthagfe
how to install comoposer without show dependecies in laravel
install reachrouter
npm i install react boostrapp grid
how to disable maintenance mode in magento 2
react-native-redux login example github
angular firebse via github action
how to install gatsby transformer plugin
gulp-gzip
install sweetlalert angular
imstall prettier
Jeton non reconnu dans le texte source. Au niveau de ligne : 1 Caractère : 20 + npm install --save <<<< @fortawesome/fontawesome-free + CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException + FullyQualifiedErrorId : UnrecognizedToken
Platform Browsing and Platform CLI
shopware 6 build storefront
libcblas-dev
npm install smoothscroll-polyfill
le wagon setup
how i can install composer after download froject from githb
what is installation testing
install figlet package and run a simple command
install Helm v3.x
babel source maps
cordova plugin install specific branch
Start rc.local manually
gulp-tar
how to install bower dependencies
install spotify-web-api-js
76 packages are looking for funding run `npm fund` for details found 7 vulnerabilities (5 low, 1 moderate, 1 high) run `npm audit fix` to fix them, or `npm audit` for details
Platform CLI for Platform Browsing
how to install Grub Customizer
how to install nginx on vbox on windows 10
install coreutils
vue search npm
install vue native globally
ng2-dragula valor software github
how-to-install-angular-cli-locally-without-the-g-flag
heroku vujs internal/modules/cjs/loader.js:883 throw err; ^ Error: Cannot find module 'express' Require stack: - /app/server.js
phoenix install
kontiki cli
install jigsaw
angular extract i18n
how to show freeswitch registrations from fs_cli
cpanel /home/cPanelInstall
symfony new project
julia install
yarn add --save-exact
how to install composer windows
prettier install in vscode
font awesome react
vendor/autoload.php download
angular library
react os
npm install in laravel 8.28.1
the requested nginx plugin does not appear to be installed certbot
install mvc 5.2.4 nugget console
install owlready2
how to install rebar3
facebook signin does not working on facbook app works only when no app is installed
install sketchjs
install onnxmltools
cordova install plugin at branch
install newman-reporter-htmlextra
composer install delete from parameters.yml symfony 3
magemojo cron extension installation
git push to branch
git rename branch
install .deb files in terminal linux
install deb file
remove remote origin git
remove remote origin
git remove origin
how to remove remote origin from git repo
remote origin already exists
how to switch branch
git
how to see all branches in git
branch list
get git remote url
kill a port process in ubuntu
kill ubuntu port
what is --use-feature=2020-resolver
unable to create process using ' ' virtualenv
pip upgrade
how to upgrade pip
pip remove
git discard local changes
pip install nodejs
linux install node
node js download ubuntu
update nodejs raspberry pi
how to uninstall node.JS
restart apache ubuntu
npm install bootstrap
install bootstrap 4 npm
npm bootstrap
check jdk version
java check java version
java check jre version
linux zip a directory
change remote url git
change git commit message
git change commit message of old commit
node install ubuntu
express js
install express globally
ubuntu remove directory
install git debian
ubuntu install git
how to install git in ubuntu 18.04
how to switch branch on git
canging branch in git
sitch a branch command line
curl get example
zoom repository ubuntu
zoom download view stash
git stash contnet
git stash
upgrade dart in flutter
update flutter
flutter web run using vscode
remove all files inside directory linux
git fetch remote branch
open visual studio code from terminal mac
rename folder command line linux
react-scripts is not recognized as an internal command windows
refusing to merge unrelated histories git
git allow unrelated histories
refusing to merge unrelated histories
install composer centos 7
ubuntu install composer
create gitignore
centos install composer
install composer
how to install virtualbox in ubuntu
python install mysql connector
install jquery npm
git stash clean command
git stash drop all
delete already stashed files git
check what ports are open linux
poython opencv pip
python install opencv
python
git revert commit
git create tag and push
npm install moment
linux add to path
export path linux
screen recorder ubuntu
best screen capture software for linux u
screen recorder linux
git abort merge
cancel merge
git merge cancel
cancel a merge git
cancel merging
git undo comflicted merge
git push existing repo
abort git merge
git merge abort
git add new files to existing repository
install node mac
how to make new user linux termil
git remove folder remotely
check ubuntu disk space
login git in terminal
git bash sign in
how to get ip address in ubuntu
vim plug
debian give write permission
install deb file in ubuntu
ip on mac
uninstall franz ubuntu
ubuntu apt uninstall google chrome ubuntu
install chrome apt-get
install chrome on linux
install google chrome linux
docker stop all
docker stop all containers
stop all container in docker
docker delete all containers
stop all docker ps-a
get all module npm global
see list of globally installed npm packages mac
npm list global packages
list npm packages installed globally
install virtualenv
bash: gulp: command not found
how to install gulp
linux distros
git branch list
remove mysql
how to install pycharm on linux
install pycharm in linux mint
pycharm ubuntu download
add email to git config
change last commit message
how to fix the last commit message
git reset head
change message commit git
edit last commit message
rename commit message in linux
retsrta nginx
restart nginx
nginx restart ubuntu
how to start nginx in linux
windows install chocolatey
update pip
conda install pytorch
pytorch
pip install pytorch windows
pytorch install
python pytorch
installing pytorch
Cannot find module 'node-sass'
install pytorch gpu on windows
how to find a file in linux terminal
windows kill port
port already in use windows 10
git clone submodule
how to ping in cmd
ping in cmd
restart apache
remove directory in cmd
create symbolic link linux
list all collections in the MongoDB shell
How to start apache2 server
ubuntu open port
add sudo user ubuntu
apt install slack
slack for linux mint
install slack ubuntu
git soft reset head
slack ubuntu download 20.04
install slack
firebase deploy command
how to install rclone as service on windows
create swapfile ubuntu
fit gnuplot error bars
android studio (not installed) windows
git push heroku master everything up-to-date
how to add a group windows powershell
git revert uncommitted changes
attributeerror module 'platform' has no attribute 'linux_distribution' ubuntu 20.04 docker-compose
find out which procses is using port linux
commands for windows 10
upgrade docker compose windows
recursively remove files with extension linux
git text editor commit exit
git alias
get all branches from remote
bash print lines unique to one file
command check macos version
npm protractor
check login info on mac os
on-root/non-service/non-daemon users
remove all directrories in onde command hit
add a file to git
arch linux grub boot loader installed
how to overwrite local repository with remote
valet: command not found
vagrant install kvm provider ubuntu 18.04
linux microphone noise reduction
linux see drivers
Digit Frequency
what is my git config
delete local nuget caches
linux ext-gd *
uninstall visual studio code ubuntu
gpg2 install ubuntu
crontab every 5 minutes
github push use ssh
iframe in react
how to move from one to another drive in powershell
bash split string into variables
enable remote desktop powershell server 2019
remove all untaged images
bash rename multiple files pattern
how to upgrade julia
find largest digit in a number
install raylib osx
docker toolbox windows clean
ubuntu essential commands
dockerfile for vuejs
feature branch naming convention git
how to check cpu temperature ubuntu
fsl reg
bat stop if call command fails
fsl bet brain extraction
set node role kubernetes
how to pull from a branch in git
how to run orange3 on linux
sh increment variable
clone a particular branch
update ubuntu to gnome 40
ssh connection timeout
npm install proxy
gatsby-plugin-feed-generator
github extension for visual studio 2019 vs git scm
how to install pandas profiling
recursive rename powershell
exclude/prevent file from commit using git ignore
conda install git
bash wget file name
bluetooth xubuntu activate linux
python jupyter notebook
cannot be loaded because running scripts is disabled on this system.
screen in ubuntu in stack overflow
texlive 2019 in ubuntu 18.4
how to prevent bash or zsh from interpreting special characters
git bypass hook
installer docker ubuntu 18.04
curl form data
bash list files with full file path
fatal: unable to access '': The requested URL returned error: 502
Error: Your account has MFA enabled; API requests using basic authentication with email and password are not supported. Please generate an authorization token for API access.
error: Pulling is not possible because you have unmerged files. hint: Fix them up in the work tree, and then use 'git add/rm <file>' hint: as appropriate to mark resolution and make a commit. fatal: Exiting because of an unresolved conflict.
tableplus
systemd stop service and start
haproxy in centos 7
davinci resolve system requirements
sed line
local update when master branch has been renamed to main
make directory mac
mac find command printf
ansible hosts
install all python project dependencies using pip
vim gitignore
how to install kite on manjero
gif in markdown
listen EADDRINUSE: address already in use :::8081
discord.py install
git clone from specific branch command
pyang installtion ubuntu
use xargs multiple times
ssh command
docker-compose
how to check endianness in linux
ImportError: libGL.so.1: cannot open shared object file: No such file or directory
install qwebengineview pyqt5
locate file in same directory linux
install onedrive in ubuntu 18.04
git revert pr merge
remove thunar with its dependency
cypress github actions yaml
assign home directory to user linux
how to remove an apt repository
view to path powershell
aws cloudfront invalidation cli
how to install podman in ubuntu
image converter linux
supprimer une branch git
recursively delete node_modules
count github commits
gh-pages
intellij copy line down mac
ssh for github
How to pass a user defined argument in scrapy spider
list drives unbuntu server
xrandr 1600x900 ubuntu
elementary os install window cut off
grep last instance
install deb file in manjaro
track a git submodule on a branch
cannot import urlencode from werkzeug
bash find term in files
two sed command together
git config global rerere
minikube insecure registry
set ubuntu display landscape
du sort by size linux
how to install mysql python
how to remove unused pip dependencies on mac
anaconda install selenium
shell get given line
linux install android sdk
how to exit vim
how to uninstall vs code from windows
Failed to start redis-server.service: Unit redis-server.service is masked.
nano zsh
git commit current changes to existing branch
npm install moment
download teamviewer for ubuntu 20.04
sed replace with variable
ubuntu kill process for user
install mariadb 10.2 ubuntu 16.04
how to create bootable usb on manjaro
git stash example
sh declare variable
INSTALL_FAILED_UPDATE_INCOMPATIBLE: Package com.*.version signatures do not match previously installed version; ignoring!
shell profile
Finding path to some ruby versions
You have not concluded your merge (MERGE_HEAD exists)
cmp in linux
how to create an environment in conda
error: ‘thread’ is not a member of std
getting firebase token
Ansible gather facts with adhoc command
how to execute a file in ubuntu by double click
ubuntu xampp apache web server running
bash redirect all output
pg_hba.conf location ubuntu 18.04
upgrade grails 2 to 3 transactional
record system audio linux terminal
should you use docker on linux
Could not install from "Hussain\AppData\Roaming\npm-cache\_npx\15208" as it does not contain a package.json file.
instal maven in mac brew
night light ubuntu 20.04
linux give permission to folder
fullter
Install TILIX on redhat centos debian ubuntu fedora
fix failed to fetch in apt-get update
or create a self signed certificate openssl in csr
brew installs slack homebew
find mtime rm
linux find md5 checksum
about all linux macos android and windows results file
how to install virtualbox in ubuntu
sftp local directory
git checkout specific file types only
virtualbox homebrew
brew error
dukto for ubuntu download
Faster Telegram installation on Kali Linux
git reset in gitlab
linux merge two pdfs
how do i make a gif from youtube
como veo lo que he cambiado en git
how to print output of a command to a file in linux
convert to png images liunx
how to remove a pushed file from git
jqueary
search by commit message
https ssh
show battery percentage
. | https://www.codegrepper.com/code-examples/shell/jupyter+notebook+install | CC-MAIN-2021-43 | en | refinedweb |
#include "ltwrappr.h"
L_BOOL LImageViewerCell::IsTitlebarIconChecked(nSubCellIndex, nIconIndex, uFlags)
Determines whether the specific title bar icon of the specific cell or sub-cell is checked or unchecked.
A zero-based index into the image list attached to the cell. The status of the icon attached to the sub-cell at this index will be retrieved. Pass -2 to retrieve the status of the icon attached to the active sub-cell.
A zero-based index of the icon to retrieve its status.
Reserved for future use. Pass 0.
To check or uncheck a specific title bar icon, call the LImageViewerCell::CheckTitlebarIcon function.
Required DLLs and Libraries
For an example, refer to LImageViewerCell::ShowTitlebar.
Direct Show .NET | C API | Filters
Media Foundation .NET | C API | Transforms
Media Streaming .NET | C API | https://www.leadtools.com/help/sdk/v22/imageviewer/clib/limageviewercell-istitlebariconchecked.html | CC-MAIN-2021-43 | en | refinedweb |
Which statement is true about a method?.
Which statement is true about an object?
An object is what classes are instantiated from.
An object is an instance of a class.
An object is a blueprint for creating concrete realization of abstractions.
An object is a reference to an attribute.
An object is a variable.
Which line contains a constructor in this class definition?
public class Counter { // (1)
int current, step;
public Counter(int startValue, int stepValue) { // (2)
set(startValue);
setStepValue(stepValue);
}
public int get() { return current; } // (3)
public void set(int value) { current = value; } // (4)
public void setStepValue(int stepValue) { step = stepValue; } // (5)
}
Code marked with (1) is a constructor.
Code marked with (2) is a constructor.
Code marked with (3) is a constructor.
Code marked with (4) is a constructor.
Code marked with (5) is a constructor.
Given that Thing is a class, how many objects and how many reference variables are created by the following code?
Thing item, stuff;
item = new Thing();
Thing entity = new Thing();
Select the two correct answers.
One object is created.
Two objects are created.
Three objects are created.
One reference variable is created.
Two reference variables are created.
Three reference variables are created.
Which statement is true about an instance method?
An instance member is also called a static member.
An instance member is always a field.
An instance member is never a method.
An instance member belongs to an instance, not to the class as a whole.
An instance member always represents an operation.
How do objects pass messages in Java?
They pass messages by modifying each other's fields.
They pass messages by modifying the static variables of each other's classes.
They pass messages by calling each other's instance methods.
They pass messages by calling static methods of each other's classes.
Given the following code, which statements are true?
class A {
int value1;
}
class B extends A {
int value2;
}
Class A extends class B.
Class B is the superclass of class A.
Class A inherits from class B.
Class B is a subclass of class A.
Objects of class A have a field named value2.
Objects of class B have a field named value1. | https://etutorials.org/cert/java+certification/Chapter+1.+Basics+of+Java+Programming/Review+Questions/ | CC-MAIN-2021-43 | en | refinedweb |
In previous tutorials, all the variables covered had been scalar. That means they hold one value each. But there are many occasions when being able to hold a list of values or even a two dimensional list (grid) or three dimensions can be very useful.
This list of values is called an array and it holds the specified number of values all of the same type. If a single int occupies 4 bytes then an array of 10 ints is 40 bytes in size. And they are held together in one place in RAM.
Some Rules With Arrays
Arrays are declared like this: type variable [number of elements] syntax. For example
10 ints in a variable called primes are declared like this:
int primes[10];
You can initialize in the declaration by putting the values inside {} and separating them with commas.
int primes[10]={2,3,5,7,11,13,17,19,23,29};
You don’t have to initialize every value. If you only wanted to initialize the first 8, then this would do. The last two elements are zero.
int primes[10]={2,3,5,7,11,13,17,19};
Finally you can make it read-only by putting a const on the front.
const int primes[10]={2,3,5,7,11,13,17,19,23,29};
The compiler will generate a syntax error if you try to modify any element of the primes array. Here’s an example program.
#include <stdio.h> const int primes[10]={2,3,5,7,11,13,17,19,23,29}; int main(int argc, char* argv[]) { int i; int numelements= sizeof(primes)/sizeof(int) ; for ( i=0; i<numelements; i++) { printf("Primes[%d] = %d\n\r",i,primes[i]) ; } return 0; }
When run this outputs:
Primes[0] = 2 Primes[1] = 3 Primes[2] = 5 Primes[3] = 7 Primes[4] = 11 Primes[5] = 13 Primes[6] = 17 Primes[7] = 19 Primes[8] = 23 Primes[9] = 29
I’ve introduced the for statement that lets you create loops and sizeof() function that returns the size of any variable or type. I will cover for loops in detail a future tutorial on loop statements but I’ll explain what it does below.
Let’s look at some of this code to try and understand what it does:
int numelements= sizeof(primes)/sizeof(int);
This declares the int variable numelements and sets it to the sizeof(primes) which is 40 divided by sizeof(int) which is 4, so numelements is set to 40/4 = 10. I could do this explicitly that’s not always the best thing to do. Here’s what that would look like:
int numelements = 10;
But doing it the sizeof() way is usually better. If I change the number of elements in the array say to 20, I don’t have to remember to change it because the sizeof() calculations determines it correctly. Had it explicitly been declared numelements = 10 then I’d have to remember to change that as well.
The for loop starts with 0 and counts up as long as i is less than numelemenets which means it goes u to nine. This is a very important thing to remember, when we count elements in arrays, they start at 0.
Arrays start at 0
Most computer languages, but not all e.g. Visual Basic start arrays with the first element at index 0. I always remember this as the first element is zero distance from the start of the array. Visual Basic starts at 1.
So in a ten element array the indices run from 0 to 9, not 1 to 10.
For Loops
This is a very convenient way to index through the elements of an array. It uses an index variable and has three parts all within brackets and separated by semi-colons ;
for ( i=0; i<numelements; i++) {
In the example, snipped above the three parts of the for loop are:
- i=0
- i<numelements
- i++
The first part is where the loop index is initialized. i=0. You can leave this blank if the loop variable has already been initialized. So this works as well:
int i=0; for (;i<numelements; i++) {
The second part is where the loop is checked to see if it has finished. Because the last element is at index 9 (not 10), this needs to check if i < numelements. If this is true the loop continues.
Finally the third part is where the loop variable is incremented. It’s traditional to increment but you can call any statement or function here, so long as the loop variable is altered. If you don’t it will loop forever or until it crashes.
Below is an infinite loop and you will have to wait forever for it to finish. Clearly this is not a good thing.
for (;;) { ... }
Any or all three parts can be empty as the infinite loop above shows. However we do have a way of breaking out of a loop early using the statement break. I’ll cover that in a future tutorial on looping.
The Array Size is always Static
The size must always be specified at compile time, so you can’t do this:
int a= 50; int values[a];
Because arrays always have to be declared statically, you have to use things call pointers to have dynamic arrays, i.e. arrays that change size at runtime. When we get to pointers in a future tutorial, you’ll see how dynamic data structures can be created.
You can use a #define but it’s still statically declared. Like this:
#define TENCATS 10 int values[TENCATS];
Arrays have dimensions
So far all the arrays I’ve described have been single dimension arrays, like houses in a street. But you can have two, three or many dimensions. The only limit is usually memory. I suspect some compilers possibly also limit you to 256 dimension arrays as it would be a logical limit.
To declare a multi dimension array you put how many elements there are in each dimension, in square brackets. Imagine a set of cubes 2 high, three wide and four deep. You’d declare it as a three dimension array like this:
int cubes[2][3][4];
That has 2 x 3 x 4 = 24 ints. Likewise you might declare a two-dimension chess board with 8 x 8 squares as
int board[8][8];
What is a #define?
It’s a way of giving a name to a piece of text. Before the C compiler does its magic, it runs a program called a pre-processor through your source code looking for things like #defines. Everywhere it finds one, it replaces it with the text,
In the example above I created a #define called TENCATS which has the text 10. Note, I use uppercase for TENCATS. You don’t have to, it is a convention rather than a hard and fast rule, but it tells anyone reading the program that it is a #define. And the text that is represents is not put inside quotes or double quotes.
When the compiler compiles int values[TENCATS] the pre-processor first changes its copy of the source in memory so every instance of TENCATS that it finds becomes becomes 10, and it actually compiles int values[10].
Why does that matter? Why not just use 10? Because we would typically access this array using a loop and we need to know how many elements there are. If you used 10 instead of a #define TENCATS and later needed to change it to 50, then you would have to go through your program and change every relevant 10 to 50. You might change a wrong 10 or maybe overlook one. This can introduce unnecessary bugs. If you use the #define then you only need to change the value once e.g. #define TENCATS 50. The pre-processor will then substitute 50 everywhere that it finds TENCATS.
That’s it for arrays though we’ll revisit them when we look at pointers. In the next tutorial I’ll look at structs.
Link to previous tutorial.
Link to next tutorial. | https://learncgames.com/tutorials/tutorial-four-all-about-arrays-in-c/ | CC-MAIN-2021-43 | en | refinedweb |
A Brief Introduction to Template Haskell
In this article, we will explore some of the intricacies of Template Haskell and build a practical example that will introduce you to the metaprogramming capabilities of Haskell.
We will first use Template Haskell to generate some functions instead of writing them manually for the purpose of understanding how its basic machinery works. Then we will go through a more practical example and use TH to generate boilerplate code that will define class definitions and instances for those classes.
What is Template Haskell?
Template Haskell, also known as TH, is a set of functions and datatypes exposed through the template-haskell package, which allows the programmer to manipulate Haskell code programmatically. Some of the things Template Haskell allows are:
- Generate new functions or datatypes procedurally.
- Inspect what will be generated for certain Haskell constructions.
- Execute code during compile-time.
Template Haskell is mostly useful for generating boilerplate code and automating some aspects of the compilation. In this article, we will focus on the former and use TH to generate boilerplate for us.
Getting started
We are going to start by making a simple example that might be contrived but hopefully useful to understand how TH works. As the first step, let’s see how we can generate basic functions with TH instead of writing them manually.
Quoting and quasi-quoting
Template Haskell provides us with a simple tool to work with various parts of its machinery: quotations. With them, we can take a Haskell expression at compile-time and use it to create an Abstract Syntax Tree (or AST). They provide a shortcut for writing Template Haskell code in many situations and can also be used to help us inspect generated code.
Furthermore, Haskell provides a mechanism to extend the language with more quotations called quasi-quotations, in addition to the quotations in Template Haskell that are explored in this article, namely
e,
p,
t and
d.
It’s important to understand some of the quoting mechanisms which can be used and what they produce. First, fire up GHCi with the
template-haskell package and import the
Language.Haskell.TH module, which is our main interest for this article. Note that we will also need to activate the
TemplateHaskell language extension.
>>> import Language.Haskell.TH >>> :set -XTemplateHaskell
Now we are ready for our first example. We will start by learning the
[e| ... |] quoter, which takes in some Haskell expression and returns an AST representing that particular expression.
>>> runQ [e|1 + 2|] InfixE (Just (LitE (IntegerL 1))) (VarE GHC.Num.+) (Just (LitE (IntegerL 2)))
By using
runQ :: Quasi m => Q a -> m a, we can extract our quotation, which is then printed by GHCi. We will see later that
IO and
Q are two instances of the
Quasi typeclass, and so we are able to use it from our interactive interpreter.
The result of this was an AST that represents our expression, which is better visualized when drawn as an actual tree.
InfixE / | \ Just VarE Just / | \ LitE GHG.Num.+ LitE / \ IntegerL IntegerL / \ 1 2
It’s interesting to notice that
Just has appeared in the operands. An expression such as
[e|(1 +)|] would instead have
Nothing as its second operand!
So far, we’ve been using quotation to write Template Haskell. But we also can use ordinary Haskell constructors defined in the
template-haskell library. For example, instead of writing
[e|(4, 2)|], we may as well type out the full AST to obtain the same result:
>>> runQ (pure (TupE [Just (LitE (IntegerL 4)), Just (LitE (IntegerL 2))])) TupE [Just (LitE (IntegerL 4)),Just (LitE (IntegerL 2))]
TupE | : / \ Just \ / : LitE / \ / Just [] IntegerL | / LitE 4 | IntegerL | 2
Template Haskell follows a nice pattern of naming nodes for the AST where expressions will be suffixed with E, patterns with P, literals with L, declarations with D, and types with T. We also have quasi-quoters equivalent to some of the trees, namely
e,
p,
d, and
t.
As a matter of fact, working with
[e| ... |] is so common that we can just use
[| ... |] instead.
We’ve been using
e to generate Haskell expressions so far, although it is also of interest to create other Haskell constructs, such as declarations. Without further ado, let’s use Template Haskell to generate a declaration that is equivalent to the following Haskell code:
decl :: Int decl = 1 + 2
Since we have a declaration, we may use the
d quasi-quoter for this:
>>> runQ [d| ... decl :: Int ... decl = 1 + 2 ... |] [ SigD decl_0 (ConT GHC.Types.Int) , ValD (VarP decl_0) ( NormalB ( -- NormalB is the body of a declaration without pattern guards InfixE (Just (LitE (IntegerL 1))) (VarE GHC.Num.+) (Just (LitE (IntegerL 2))) ) ) [] ]
The
template-haskell package provides comprehensible documentation for all of the types generated by the Exp, Pat, Dec and Type quasi-quoters.
Splicing
So far, we’ve used TH to analyze the trees produced by various Haskell constructs. While that is interesting, it is not so useful since the main purpose of TH is to generate Haskell code that can be compiled and used. For this, we may use splices, which will essentially allow us to call our definitions made with TH.
-- A function which takes two other functions and composes them, as (.): >>> compose :: Q Exp ... compose = [|\left right x -> left (right x)|] >>> $compose (* 2) (+ 1) 0 2
What is going on with the
$compose? This is a splice, and it allows us to use a given Template Haskell definition. The expression that immediately follows the
$ will evaluate the TH definition and return an actual Haskell definition that we can use. Splices will try to inject any kind of code that is given to them, so make sure it is correct. As demonstrated below, we can inject a bound variable in Template Haskell:
>>> x = 20 >>> compose' :: Q Exp ... compose' = [|\left right -> left (right x)|] >>> $compose' (* 2) (+ 1) 42
Since Template Haskell is evaluated during compile time, if we replace
x with a variable that was not bound, such as
z, we get a
Variable not in scope: z error instead during the splice generation. Any malformed expressions will be reported like any other regular Haskell expression. In other words, we analyze a Template Haskell declaration as if it was any other ordinary Haskell declaration.
Stage restriction
One caveat of splices exists on where they may be defined and used within some source file. To visualize the problem, we will create a new file called
Main.hs with the following:
import Language.Haskell.TH someSplice :: Q [Dec] someSplice = [d|y = 0|] x :: Int x = 42 $someSplice z :: String z = show x
Now try to load it in GHCi:
>>> :l Main.hs [1 of 1] Compiling Main ( Main.hs, interpreted ) Failed, no modules loaded. Main.hs:11:1: error: GHC stage restriction: ‘someSplice’ is used in a top-level splice, quasi-quote, or annotation, and must be imported, not defined locally | 11 | $someSplice | ^^^^^^^^^^^
Oops! We’ve encountered a stage restriction. If you ever come across a project that uses TH, you may notice that often there is a separate module for all things that are related to TH. To fix the error, let’s move the definition of
someSplice to a new
TH.hs file.
module TH where import Language.Haskell.TH someSplice :: Q [Dec] someSplice = [d|y = 0|]
And change
Main.hs to import it:
import Language.Haskell.TH import TH x :: Int x = 42 $someSplice z :: String z = show x
And now we should be able to load
Main and use
y.
Another restriction comes with declaration groups. Notably, if we swap where
x and
z are declared:
z :: String z = show x $someSplice x :: Int x = 42
and load the file again, we see a problem:
Main.hs:8:10: error: • Variable not in scope: x • ‘x’ (line 13) is not in scope before the splice on line 10 | 8 | z = show x |
Whenever we insert a splice, the file is divided between everything that was declared before and after the splice. In our first example,
x was in the scope of
z but not the opposite, but after swapping both declarations,
z is in the scope of
x but not the opposite. To mitigate the problem, we often try to insert all splices at the very bottom of the file, if possible.
-ddump-splices
It’s useful to see what code was generated with Template Haskell. We can use the
-ddump-splices to see the output:
>>> :set -ddump-splices
If we load
Main again (this time with the correct order of declarations), we should see the generated output of the splice:
>>> :r [2 of 2] Compiling Main ( Main.hs, interpreted ) Main.hs:10:1-11: Splicing declarations someSplice ======> y_a65Q = 0 Ok, two modules loaded.
The output shows our
y was declared as
0.
Example: generating instances
Let’s create a simple example to best understand how TH works. One thing that could be potentially useful is a way to extract the third, fourth, fifth, etc. element of some tuple. Users of the
lens library probably have found methods such as
_1,
_2,
_3, etc. to deal with tuples of arbitrary sizes. Let’s try to generate these instances automatically using TH.
We will use the following approach. First, we will define typeclasses
Tuple2,
Tuple3, … for tuples of arbitrary sizes. Each of them will have methods
_1,
_2,
_3, … for accessing elements of tuples. After this, we will generate instances for each
(a, b),
(a, b, c),
(a, b, c, d), etc.
To begin, let’s start by creating a file
TuplesTH.hs:
module TuplesTH where import Control.Monad (unless) import Data.Traversable (for) import Language.Haskell.TH
How does TH represent the tuple of a tuple as an AST? We could check the documentation, but we can also check out GHCi:
>>> runQ [d|x :: (a,b,c); x = undefined|] [ SigD x_8 (AppT (AppT (AppT (TupleT 3) (VarT a_5)) (VarT b_6)) (VarT c_7)) , ValD (VarP x_8) (NormalB (VarE GHC.Err.undefined)) [] ]
Don’t worry if your variable names are not the same. The relevant part for us is
AppT (AppT (AppT (TupleT 3) (VarT a_5)) (VarT b_6)) (VarT c_7):
AppT / \ AppT VarT / \ \ AppT VarT c_7 / \ \ TupleT VarT b_6 / \ 3 a_5
We must mimic this structure for our class instance declarations. Not only this, but our method will have the format
(a, b, ..., t, ...) -> t where
t is the n-th type of our tuple. Again, let’s see what is the Template Haskell equivalent for a function:
>>> runQ [d|x :: a -> b; x = undefined|] [ SigD x_15 (AppT (AppT ArrowT (VarT a_13)) (VarT b_14)) , ValD (VarP x_15) (NormalB (VarE GHC.Err.undefined)) [] ]
We see that an arrow
(->) is represented as
ArrowT. Keep in mind that
a -> b is the same as
(->) a b.
AppT / \ AppT VarT / \ \ ArrowT VarT b_14 \ a_13
With this, we can create a function which generates a tuple class. We have a declaration, so by looking up the documentation for
Dec we find our constructor for declaring a class:
ClassD Cxt Name [TyVarBndr ()] [FunDep] [Dec]. This class should have the form
class TupleX t r | t -> r where _X :: t -> r, where
X is the number of elements in the tuple. With this information, we can declare a function which will generate such class for us:
generateTupleClass :: Int -> Q [Dec] generateTupleClass size = do unless (size > 0) $ fail $ "Non-positive size: " ++ size' pure [cDecl] where size' = show size className = mkName ("Tuple" ++ size') methodName = mkName ('_' : size') t = mkName "t" r = mkName "r" -- class TupleX t r | t -> r where cDecl = ClassD [] className [PlainTV t, PlainTV r] [FunDep [t] [r]] [mDecl] -- _X :: t -> r mDecl = SigD methodName (AppT (AppT ArrowT (VarT t)) (VarT r))
We only handle cases with at least 1 element, so we throw an error if we have less than this. We use the
mkName function to create the names of our class (
TupleX), its method (
_X), and the
t and
r type variables.
For the declaration of the class, we use the
ClassD constructor with the following fields:
[] :: Ctx— An empty array of constraints, since we don’t impose further restrictions on our types.
className :: Name— The name of the class being declared.
[PlainTV t, PlainTV r] :: [TyVarBndr ()]— The bindings of our typeclass, which are
tand
r.
[FunDep [t] [r]] :: [FunDep]— A functional dependency of the format
t -> r.
[mDecl] :: [Dec]— Our class declarations, containing
_X, a method of type
t -> r.
Now let’s create a
Main.hs and test out what we made:
import TuplesTH $(generateTupleClass 3)
If we now load this in GHCi, we get:
>>> :l Main [2 of 2] Compiling Main ( Main.hs, interpreted ) Ok, two modules loaded. >>> :i Tuple3 type Tuple3 :: * -> * -> Constraint class Tuple3 t r | t -> r where _3 :: t -> r -- Defined at Main.hs:8:3
Hooray! We made a class declaration using TH. Now let’s generate some instances. In the same manner as
ClassD, we can use
InstanceD for this, which in
Dec has a constructor of the form
InstanceD (Maybe Overlap) Ctx Type [Dec]. What should the AST for the instance look like? Let GHCi come to our rescue again!
>>> runQ [d|instance Tuple3 (a, b, c) c where _3 (_, _, c) = c|] [InstanceD Nothing [] (AppT (AppT (ConT Main.Tuple3) (AppT (AppT (AppT (TupleT 3) (VarT a_4)) (VarT b_5)) (VarT c_6))) (VarT c_6)) [FunD Main._3 [Clause [TupP [WildP,WildP,VarP c_7]] (NormalB (VarE c_7)) []]]]
This is a bit verbose, but we can notice two useful things. The first one is that we have a nested sequence of
AppT for our tuple type like before. What’s interesting right now is how the tuple is represented as a sequence of
AppT other_app_ts some_type_var, with
TupleT 3 at the end. We can use
foldl to apply the
AppT nodes to some
VarT variable, using
TupleT 3 as the initial value for our fold. After this, we only need to apply the result of the fold inside
AppT (AppT (ConT our_class_name) result_of_our_fold).
The second thing to notice is that
InstanceD also expects a declaration, in our case a function, represented as
FunD. We want a pattern for our tuple where the X-th tuple element has a variable pattern and the other ones are wildcards. We can create a function that takes the index of the element we want to generate a getter for and the total size of the tuple and generates an instance accessing this element.
Having this in mind, we can create our tuple type
(t1, t2, ...) and generate a type
TupleX (t1, t2, ...) tX which is the instance declaration for our class with its corresponding method declaration, which is a function
_X (_, _, ..., x, ...) = x that corresponds to our accessor.
generateTupleInstance :: Int -> Int -> Q [Dec] generateTupleInstance element size = do unless (size > 0) $ fail $ "Non-positive size: " ++ element' unless (size >= element) $ fail $ "Can't extract element " ++ element' ++ " of " ++ size' ++ "-tuple" pure [iDecl] where element' = show element size' = show size className = mkName ("Tuple" ++ element') methodName = mkName ('_' : element') x = mkName "x" vars = [mkName ('t' : show n) | n <- [1..size]] signature = foldl (\acc var -> AppT acc (VarT var)) (TupleT size) vars -- instance TupleX (t1, ..., tX, ...) tX where iDecl = InstanceD Nothing [] (AppT (AppT (ConT className) signature) (VarT $ mkName ('t' : element'))) [mDecl] -- _X (_, _, ..., x, ...) = x mDecl = FunD methodName [Clause [TupP $ replicate (element - 1) WildP ++ [VarP x] ++ replicate (size - element) WildP] (NormalB $ VarE x) []]
If we now add
$(generateTupleInstance 3 5) to our
Main module and load it in GHCi, we can see that this indeed generated an instance:
>>> :i Tuple3 type Tuple3 :: * -> * -> Constraint class Tuple3 t r | t -> r where _3 :: t -> r -- Defined at Main.hs:8:3 instance Tuple3 (t1, t2, t3, t4, t5) t3 -- Defined at Main.hs:9:3 >>> _3 (42, "hello", '#', [], 3.14) '#'
Finally, let’s add one more TH function which will generate instances for all tuples up to 62 elements (which is the maximum tuple size allowed by GHC). We want to generate N instances for all M-tuples such that N ≤ M:
generateTupleBoilerplate :: Int -> Q [Dec] generateTupleBoilerplate size = concatFor [1..size] $ \classDeclIndex -> do cDecl <- generateTupleClass classDeclIndex iDecls <- for [1..classDeclIndex] $ \instanceDeclIndex -> generateTupleInstance instanceDeclIndex classDeclIndex pure $ concat (cDecl : iDecls) where concatFor xs = fmap concat . for xs
Now change your
Main to contain
$(generateTupleBoilerplate 62) and voilá! We have all instances for tuples.
Exercises
- Change the definition of
TupleXso that each class declaration also contains a
Tuple(X-1)constraint. For example,
class Tuple2 a => Tuple3 a,
class Tuple1 a => Tuple2 aetc. Notice
Tuple1should have no constraints.
- Create a
mapXmethod that maps the X-th element of a tuple, similarly to
fmap.
Further reading
In this post, we’ve seen the basics of Template Haskell. We used it to declare some instances, inspect the generated AST, and implement instances for tuple types. For more resources on Template Haskell, I suggest checking out the following links:
For more Haskell tutorials, you can check out our Haskell articles or follow us on Twitter or Medium.
.jpg)
.jpg)
.jpg)
.jpg)
.jpg) | https://serokell.io/blog/introduction-to-template-haskell | CC-MAIN-2021-43 | en | refinedweb |
README
@varasto/server@varasto/server
HTTP interface implementation to Varasto key-value store. Can be run standalone or embedded to other Express.js applications.
InstallationInstallation
If you want to run the server as standalone:
$ npm install @varasto/server
Or if you want to use the server in your own Express.js application:
$ npm install --save @varasto/server
UsageUsage
As mentioned previously, the package can be used as part of an Express.js application or as an standalone application.
StandaloneStandalone
$ varasto [-p port] [-a username:password] <directory>
Port which the HTTP server will be responding from can be specified with the
-p flag. By default Varasto will use port
3000.
Optional basic access authentication can be enabled with
-a flag.
The directory where items are stored is specified with
<directory> command
line argument. If the directory does not exist, it will be created once items
are being stored.
Once the HTTP server is up and running, you can use HTTP methods
GET,
and
DELETE to retrieve, store and remove items from the store.
HTTPS suppportHTTPS suppport
HTTPS support can be enabled with
--certificate and
--private-key command
line arguments.
$ varasto --certificate /path/to/cert.crt --private-key /path/to/key.key
Security notesSecurity notes
The server does not currently support any other type of authentication than basic access authentication (which is not enabled by default), so you might not want to expose it to public network.
EmbeddedEmbedded
The package provides an function called
createServer, which returns an
Express.js application.
Basic usage looks like this:
import { createServer } from '@varasto/server'; import { createFileSystemStorage } from '@varasto/fs-storage'; import express from 'express'; const app = express(); const storage = createFileSystemStorage({ dir: './data' }); app.use('/', createServer(storage));
AuthenticationAuthentication
To enable basic access authentication for the API, an optional configuration
can be given to the
createServer function.
app.use('/', createServer(storage, { auth: { username: 'AzureDiamond', password: 'hunter2' } }));
Storing itemsStoring items
To store an item, you can use a
POST request like this:
POST /foo/bar HTTP/1.0 Content-Type: application/json Content-Length: 14 {"foo": "bar"}
Or you can use curl to store an item like this:
$ curl -X POST \ -H 'Content-Type: application/json' \ -d '{"foo": "bar"}' \
Namespace of the item in the example above would be
foo and the key would be
bar. These identifiers can now be used to retrieve, update or remove the
stored item.
Retrieving itemsRetrieving items
To retrieve a previously stored item, you make an
GET request, where the
request path again acts as the identifier of the item.
GET /foo/bar HTTP/1.0
To which the HTTP server will respond with the JSON object previously stored
with namespace
foo and key
bar. If an item with given key under the given
namespace does not exist, HTTP error 404 will be returned instead.
Listing itemsListing items
To list all items stored under an namespace, you make an
GET request with
name of the namespace as the request path.
GET /foo HTTP/1.0
To which the HTTP server will respond with an JSON object which contains
each item stored under namespace
foo mapped with the key that they were
stored with.
Removing itemsRemoving items
To remove an previously stored item, you make a
DELETE request, with the
request path again acting as the identifier of the item you wish to remove.
DELETE /foo/bar HTTP/1.0
If item with key
bar under namespace
foo exists, it's value will be
returned as response. If such item does not exist, HTTP error 404 will be
returned instead.
Updating itemsUpdating items
You can also partially update an already existing item with
PATCH request.
The JSON sent with an
PATCH request will be shallowly merged with the already
existing data and the result will be sent as response.
For example, you have an item
john-doe under namespace
people with the
following data:
{ "name": "John Doe", "address": "Some street 4", "phoneNumber": "+35840123123" }
And you send an
PATCH request like this:
PATCH /people/john-doe HTTP/1.0 Content-Type: application/json Content-Length: 71 { "address": "Some other street 5", "faxNumber": "+358000000" }
You end up with:
{ "name": "John Doe", "address": "Some other street 5", "phoneNumber": "+35840123123", "faxNumber": "+358000000" } | https://www.skypack.dev/view/@varasto/server | CC-MAIN-2021-43 | en | refinedweb |
Details
- Type:
Bug
- Status: Closed
- Priority:
Not Evaluated
- Resolution: Invalid
- Affects Version/s: 5.15.1
- Fix Version/s: None
- Component/s: Core: Filesystem watching
- Labels:None
- Environment:$/opt/mxe/usr/x86_64-w64-mingw32.shared.posix/qt5/bin/qmake --version
QMake version 3.1
Using Qt version 5.15.1 in /opt/mxe/usr/x86_64-w64-mingw32.shared.posix/qt5/lib
- Platform/s:
Description
Hi,
well, it's a bit hard to explain. The Qt 5.15.1 upgrade broke our test environment (no problem with Qt 5.13 so far). We cross-compile our application (Linux host, MinGW 64 build), and we run our tests on Linux host with wine.
We noticed "Broken filename passed to function" errors in the logs, and I managed to find a bug in the QFileInfo::canonicalFilePath()'s function. When the path is relative and contains a "../" inside, the resolved path will be wrong.
Example code to trigger the issue:
#include <QCoreApplication> #include <QDebug> #include <QDirIterator> #include <QFileInfo> #include <iostream> int main(int argc, char *argv[]) { QCoreApplication a(argc, argv); Q_UNUSED(a) const auto somePath = qEnvironmentVariable("SOME_PATH", QStringLiteral("/tmp")); QFileInfo info(somePath); std::cout << "cannonicalFilePath " << info.canonicalFilePath().toStdString() << std::endl; QDirIterator it(info.canonicalFilePath(), QDirIterator::Subdirectories); while (it.hasNext()) { QString file = it.next(); if (it.fileInfo().isFile()) { std::cout << " file " << file.toStdString() << std::endl; } } return 0; }
Output when it's working as expected:
$SOME_PATH=$PWD/ file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/brokenfilenameqt5151.exe file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/commands.txt file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/main.o file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/Makefile file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/strace_fail.txt file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/strace_success.txt file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/winedebug_fail.txt file Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa/winedebug_success.txt
Output when it is not working:
$SOME_PATH=$PWD/../aaa ../aaa $ls $PWD/../aaa -1 brokenfilenameqt5151.exe commands.txt main.o Makefile strace_fail.txt strace_success.txt winedebug_fail.txt winedebug_success.txt
The problem is that the canonical file path is wrong.
Z:/mnt/home/tomi/zwa/projects/adp-developing-2.0/source/adp/brokenfilenameqt5151/aaa missind a '/' here ../aaa
I have also attached a sample project with debug outputs with strace and wine logs.
Most probably this was an issue with our qmltestcase test apps, where the -import path stopped working for us, and had to change the deployment for our tests to be able to run it them with wine.
This might be related to this bug: | https://bugreports.qt.io/browse/QTBUG-87171?gerritReviewStatus=All | CC-MAIN-2021-43 | en | refinedweb |
Package: ghostscript Version: 9.04~dfsg-3 Severity: normal 0. ghostscript lies about the toolkit used to create the XMP in x:xmptk. It uses an identifier normally associated with Adobe's toolkit even though it does not use that toolkit[0]. The attribute is unspecified by the XMP specification, so it should probably be removed. 1. The value for rdf:about is not a URI. XMP is based on RDF, and RDF requires that rdf:about be a URI. The XMP specification does as well. There's really no reason to generate a UUID per document and rdf:about="" is more meaningful anyway, so again, it should probably be removed. 2. "uuid:" (as used in xapMM:DocumentID) is not a registered URI scheme. There is a perfectly good existing URN specification for that, so "urn:uuid:" should be used instead. (The use of "adobe:ns:meta/" as a namespace is unfortunate, but we're stuck with it now.) There is a PDF demonstrating these bugs in #649909. (I can clone these into separate bugs if you'd prefer.) [0] I was actually surprised to see this at first because I stopped work on XMP upstream because they refused to add a dependency on exempi and I didn't really feel like reinventing the wheel just for them. I then realized that there was no external dependency at all, but instead some text hard-coded into the source. -- System Information: Debian Release: wheezy/sid APT prefers unstable APT policy: (500, 'unstable'), (1, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.1.0-1-amd64 (SMP w/2 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages ghostscript depends on: ii cdebconf [debconf-2.0] 0.158 ii debconf [debconf-2.0] 1.5.41 ii debianutils 4.0.4 ii gsfonts 1:8.11+urwcyr1.0.7~pre44-4.2 ii libc6 2.13-21 ii libgs9 9.04~dfsg-3 ghostscript recommends no packages. Versions of packages ghostscript suggests: ii ghostscript-cups 9.04~dfsg-3 ii ghostscript-x 9.04~dfsg-3 ii hpijs 3.11.10-1 -- no debconf | https://lists.debian.org/debian-printing/2011/11/msg00049.html | CC-MAIN-2021-43 | en | refinedweb |
Themes are a sure way to add a vibrant touch to your apps. With Flutter's theming support, you can customize literally everything with only a few lines of code. What if you want to let your users change the themes on the fly though? At the very least, every app should support light and dark mode.
One option is to hack something together using StatefulWidgets. Another, and better option, is to use the flutter_bloc library to create an extensible and manageable theme switching framework.
Project Setup
Before we get started building the UI, let's add a few dependencies. We obviously need flutter_bloc and we're also going to add equatable - this is optional, but should we need value equality, this package will do the repetitive work for us.
pubspec.yaml
... dependencies: flutter: sdk: flutter flutter_bloc: ^0.20.0 equatable: ^0.4.0 ...
Let's also create the basic scaffolding of this project. The most important part is the global/theme folder - that's where the ThemeBloc and other related code will be located. After all, themes should be applied globally.
The project structure
Making Custom Themes
Before doing anything else, we first have to decide on the themes our app will use. Let's keep it simple with only 4 themes - green and blue, both with light and dark variants. Create a new file app_themes.dart inside the theme folder.
Flutter uses a class ThemeData to, well, store theme data. Since we want to configure 4 distinct instances of ThemeData, we will need a simple way to access them. The best option is to use a map. We could use strings for the keys...
app_themes.dart
final appThemeData = { "Green Light": ThemeData( brightness: Brightness.light, primaryColor: Colors.green, ), ... };
As you can imagine, as soon as we add multiple themes, strings will become cumbersome to use. Instead, let's create an enum AppTheme. The final code will look like this:
app_themes.dart
import 'package:flutter/material.dart'; enum AppTheme { GreenLight, GreenDark, BlueLight, BlueDark, } final appThemeData = { AppTheme.GreenLight: ThemeData( brightness: Brightness.light, primaryColor: Colors.green, ), AppTheme.GreenDark: ThemeData( brightness: Brightness.dark, primaryColor: Colors.green[700], ), AppTheme.BlueLight: ThemeData( brightness: Brightness.light, primaryColor: Colors.blue, ), AppTheme.BlueDark: ThemeData( brightness: Brightness.dark, primaryColor: Colors.blue[700], ), };
Adding the Bloc
Having custom themes created, we can move on to create a way for the UI to initiate and also listen to theme changes. This will all happen inside a ThemeBloc which will receive ThemeChanged events, figure out which theme should be displayed, and then output ThemeState containing the proper ThemeData pulled from the Map created above.
If you're new to the Bloc library or the reactive Bloc pattern in general, check out the following tutorial.
While we could create all the files and classes manually, there's a handy extension for both VS Code and IntelliJ which will spare us some time. At least in VS Code, right click on the theme folder and select Bloc: New Bloc from the menu. The name should be "theme" and select "yes" to use the equatable package. This will generate 4 files. One of them, called "bloc", is a barrel file which just exports all the other files.
ThemeEvent
There will be only one event ThemeChanged which pass the selected AppTheme enum value to the Bloc.
theme_event.dart
import 'package:equatable/equatable.dart'; import 'package:meta/meta.dart'; import '../app_themes.dart'; abstract class ThemeEvent extends Equatable { // Passing class fields in a list to the Equatable super class ThemeEvent([List props = const []]) : super(props); } class ThemeChanged extends ThemeEvent { final AppTheme theme; ThemeChanged({ this.theme, }) : super([theme]); }
ThemeState
Similar to the event, there will be only a single ThemeState. We will actually make the generated class concrete (not abstract), instead of creating a new subclass. There can logically be only one theme in the app. On the other hand, there can be multiple events which cause the theme to change.
This state will hold a ThemeData object which can be used by the MaterialApp.
theme_state.dart
import 'package:equatable/equatable.dart'; import 'package:flutter/material.dart'; import 'package:meta/meta.dart'; class ThemeState extends Equatable { final ThemeData themeData; ThemeState({ this.themeData, }) : super([themeData]); }
ThemeBloc
Bloc is the glue which connects events and states together with logic. Because of the way we've set up the app theme data, ThemeBloc will take up only a few simple lines of code.
theme_bloc.dart
import 'dart:async'; import 'package:bloc/bloc.dart'; import '../app_themes.dart'; import './bloc.dart'; class ThemeBloc extends Bloc<ThemeEvent, ThemeState> { ThemeState get initialState => // Everything is accessible from the appThemeData Map. ThemeState(themeData: appThemeData[AppTheme.GreenLight]); Stream<ThemeState> mapEventToState( ThemeEvent event, ) async* { if (event is ThemeChanged) { yield ThemeState(themeData: appThemeData[event.theme]); } } }
Changing Themes
To apply a theme to the whole app, we have to change the theme property on the root MaterialApp. The ThemeBloc will also have to be available throughout the whole app. After all, we need to use its state in the aforementioned MaterialApp and also dispatch events from the PreferencePage, which we are yet to create.
Let's wrap the root widget of our app be a BlocProvider and while we're at it, also add a BlocBuilder which will rebuild the UI on every state change. Since we're operating with the ThemeBloc, the whole UI will be rebuilt when a new ThemeState is outputted.
main.dart
import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'ui/global/theme/bloc/bloc.dart'; import 'ui/home/home_page.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { Widget build(BuildContext context) { return BlocProvider( builder: (context) => ThemeBloc(), child: BlocBuilder<ThemeBloc, ThemeState>( builder: _buildWithTheme, ), ); } Widget _buildWithTheme(BuildContext context, ThemeState state) { return MaterialApp( title: 'Material App', home: HomePage(), theme: state.themeData, ); } }
Of course, the UI won't ever be rebuilt just yet. For that we need to dispatch the ThemeChanged event to the ThemeBloc. Users will select their preferred theme in the PreferencePage, but first, to make the UI a bit more realistic, let's add a dummy HomePage.
home_page.dart
import 'package:flutter/material.dart'; import '../preference/preference_page.dart'; class HomePage extends StatelessWidget { Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Home'), actions: <Widget>[ IconButton( icon: Icon(Icons.settings), onPressed: () { // Navigate to the PreferencePage Navigator.of(context).push(MaterialPageRoute( builder: (context) => PreferencePage(), )); }, ) ], ), body: Center( child: Container( child: Text( 'Home', style: Theme.of(context).textTheme.display1, ), ), ), ); } }
PreferencePage is where the ThemeChanged events will be dispatched. Again, because of the way we can access all of the app themes, implementing the UI will be as simple as accessing the appThemeData map in a ListView.
preference_page.dart
import 'package:flutter/material.dart'; import 'package:flutter_bloc/flutter_bloc.dart'; import 'package:theme_switching_prep/ui/global/theme/app_themes.dart'; import 'package:theme_switching_prep/ui/global/theme/bloc/bloc.dart'; class PreferencePage extends StatelessWidget { const PreferencePage({Key key}) : super(key: key); Widget build(BuildContext context) { return Scaffold( appBar: AppBar( title: Text('Preferences'), ), body: ListView.builder( padding: EdgeInsets.all(8), itemCount: AppTheme.values.length, itemBuilder: (context, index) { // Enums expose their values as a list - perfect for ListView // Store the theme for the current ListView item final itemAppTheme = AppTheme.values[index]; return Card( // Style the cards with the to-be-selected theme colors color: appThemeData[itemAppTheme].primaryColor, child: ListTile( title: Text( itemAppTheme.toString(), // To show light text with the dark variants... style: appThemeData[itemAppTheme].textTheme.body1, ), onTap: () { // This will make the Bloc output a new ThemeState, // which will rebuild the UI because of the BlocBuilder in main.dart BlocProvider.of<ThemeBloc>(context) .dispatch(ThemeChanged(theme: itemAppTheme)); }, ), ); }, ), ); } }
Now launch the app and test it out! Of course, once the app is closed, the selected theme won't be remembered on the next launch. You can use a persistence library of any sort, such as simple preferences, SEMBAST or even Moor. Just persist the selected theme inside the ThemeBloc whenever the ThemeChanged event is dispatched.
Conclusion
Changing themes is a feature which every production app should have. With flutter_bloc and some clever design decisions along the way, we managed to painlessly change the themes while keeping the code maintainable, organized and clean.
pls upload the code for simple preferences for saving the state . so that next time it loads on selected theme.
can’t get it done
I’d recommend you to check out an extension to the flutter_bloc library (from the same author) called hydrated_bloc. It can automatically persist the last state of a Bloc.
Very good as usual.
Please remake your “firebase-firestore-chat-app” in flutter, implementing flutter_bloc & Equatable as well. Thank you in advance.
Thank you! I’m certainly going to make a Firebase Flutter app course.
Hello Matej, cool tutorial! I followed with success but i now want to persist the selected theme for the user. I tried using SharedPreferences to store the selected theme as a string, but in the initialState getter of the ThemeBloc i can’t use async function to wait for SharedPreferences to return the stored value. Any pointers on how to go about this? Also I use enum_to_string package to convert the stored string theme value back to enum.
Thanks!
Hey Antonis! To be honest, I didn’t try the proposed solutions at the end of this tutorial myself 😅. You should take a look at the hydrated_bloc package – it persists the last bloc state automatically.
Hello all,
I have completed the theme persistence task. Check the code here.
Thanks.
Great use of HydratedBloc! 👌
Hi, thank you for this great tut!
I believe there’s an error in the URI in preference_page.dart
import ‘package:theme_switching_prep…
Should be =>
import ‘package:theme_switching_bloc…
(according to your YouTube video tutorial) | https://resocoder.com/2019/08/09/switch-themes-with-flutter-bloc-dynamic-theming-tutorial-dark-light-theme/ | CC-MAIN-2020-24 | en | refinedweb |
A PeerDist discovery segment. More...
#include <peerdisc.h>
A PeerDist discovery segment.
Definition at line 42 of file peerdisc.h.
Reference count.
Definition at line 44 of file peerdisc.h.
List of segments.
Definition at line 46 of file peerdisc.h.
Referenced by peerdisc_find().
Segment identifier string.
This is MS-PCCRC's "HoHoDk", transcribed as an upper-case Base16-encoded string.
Definition at line 52 of file peerdisc.h.
Message UUID string.
Definition at line 54 of file peerdisc.h.
List of discovered peers.
The list of peers may be appended to during the lifetime of the discovery segment. Discovered peers will not be removed from the list until the last discovery has been closed; this allows users to safely maintain a pointer to a current position within the list.
Definition at line 63 of file peerdisc.h.
Referenced by peerblk_open().
List of active clients.
Definition at line 65 of file peerdisc.h.
Transmission timer.
Definition at line 67 of file peerdisc.h. | https://dox.ipxe.org/structpeerdisc__segment.html | CC-MAIN-2020-24 | en | refinedweb |
Hi again everybody.
I know there are some references to this kind of thing around the web but none of them are simple enough for me to understand.
In my code below, I am trying to initialize a function pointer with a class member function but I'm not sure I understand how.
For simplicity my function pointer "myfunction" is to be initialized with myclass::class_function.
How do I do this?
Thank you.
#include <iostream> #include <cstdlib> using namespace std; class myclass { public: void class_function() { cout << "Class Function Called" << endl; } }; int main() { void(*myfunction)(); myclass cls; myfunction = cls.class_function; // I get an error here. //C:\CodeBlocksFiles\All\FunctionPointers\main.cpp:31:15: error: cannot convert //'myclass::class_function' from type 'void (myclass::)()' to type 'void (*)()' system("pause>nul"); } | https://www.daniweb.com/programming/software-development/threads/493909/initialize-a-function-pointer-with-a-class-member-function | CC-MAIN-2020-24 | en | refinedweb |
By default Play binds URLs to controller methods statically, that is, Controller instances are created by the framework and then the appropriate static method is invoked depending on the given URL. In certain situations, however, you may want to manage controller creation and that’s when the new routing syntax comes handy.
Route definitions starting with
@ will be managed by
play.GlobalSettings#getControllerInstance method, so given the following route definition:
GET / @controllers.Application.index()
Play will invoke
play.GlobalSettings#getControllerInstance which in return will provide an instance of
controllers.Application (by default this is happening via
controllers.Application’s default constructor). Therefore, if you want to manage controller class instantiation either via a dependency injection framework or manually you can do so by overriding
getControllerInstance in your application’s
Global class.
Here’s an example using Guice:
import play.GlobalSettings; import com.google.inject.Guice; import com.google.inject.Injector; public class Global extends GlobalSettings { private static final Injector INJECTOR = createInjector(); @Override public <A> A getControllerInstance(Class<A> controllerClass) throws Exception { return INJECTOR.getInstance(controllerClass); } private static Injector createInjector() { return Guice.createInjector(); } }
another example using Spring:
Found an error in this documentation? The source code for this page can be found here. After reading the documentation guidelines, please feel free to contribute a pull request. Have questions or advice to share? Go to our community forums to start a conversation with the community. | https://www.playframework.com/documentation/2.1.x/JavaInjection | CC-MAIN-2020-24 | en | refinedweb |
AudioPlayerSwift alternatives and similar libraries
Based on the "Audio" category
AudioKit9.8 8.9 L2 AudioPlayerSwift VS AudioKitPowerful audio synthesis, processing and analysis, without the steep learning curve.
SwiftySound7.0 3.0 L5 AudioPlayerSwift VS SwiftySoundSwifty Sound is a simple library that lets you play sounds with a single line of code.
AudioPlayer6.5 0.8 L3 AudioPlayerSwift VS AudioPlayerA wrapper around AVPlayer with some cool features.
Beethoven6.2 0.0 L4 AudioPlayerSwift VS BeethovenAn audio processing Swift library for pitch detection of musical signals.
MusicKit5.8 0.0 L4 AudioPlayerSwift VS MusicKitA framework for composing and transforming music in Swift.
voice-overlay-iosAn overlay that gets your user’s voice permission and input as text in a customizable UI.
TuningFork5.0 0.0 L5 AudioPlayerSwift VS TuningForkA Simple Tuner for iOS.
ModernAVPlayerPersistence AVPlayer to resume playback after bad network connection even in background mode.
SwiftAudioPlayerSimple audio player for iOS that streams and performs realtime audio manipulations with AVAudioEngine.
Soundable2.0 0.0 AudioPlayerSwift VS SoundableSoundable allows you to play sounds, single and in sequence, in a very easy way.
* Code Quality Rankings and insights are calculated and provided by Lumnify.
They vary from L1 to L5 with "L5" being the highest. Visit our partner's website for more details.
Do you think we are missing an alternative of AudioPlayerSwift or a related project?
README
AudioPlayer
AudioPlayer is a simple class for playing audio in iOS, macOS and tvOS apps.
Usage
// Initialize let audioPlayer = AudioPlayer("sound.mp3") // Start playing audioPlayer.play() // Stop playing with a fade out audioPlayer.fadeOut()
See the samples project to see advanced usage
Installation
CocoaPods
Add the following to your Podfile:
pod 'AudioPlayerSwift'
Carthage
Add the following to your Cartfile:
github 'tbaranes/AudioPlayerSwift'
Swift Package Manager
AudioPlayer is available on SPM. Just add the following to your Package file:
import PackageDescription let package = Package( dependencies: [ .Package(url: "", majorVersion: 1) ] )
Manual Installation
Just drag the
Source/*.swift files into your project.
AudioPlayer properties
name
The name of the sound. This is either the name that was passed to the
init, or the last path component of the audio file.
url
The absolute URL of the audio file.
completionHandler
A callback closure that will be called when the audio finishes playing, or is stopped.
isPlaying
Is it playing or not?
duration
The duration of the sound.
currentTime
The current time offset into the sound of the current playback position.
volume
The volume for the sound. The nominal range is from 0.0 to 1.0.
numberOfLoops
Number of times that the sound will return to the beginning upon reaching the end.
- A value of zero means to play the sound just once.
- A value of one will result in playing the sound twice, and so on..
- Any negative number will loop indefinitely until stopped.
pan
The left/right stereo pan of the file. -1.0 is left, 0.0 is center, 1.0 is right.
AudioPlayer methods
init(fileName: String) throws init(contentsOfPath path: String) throws init(contentsOf url: URL) throws
These methods create a new AudioPlayer instance from a file name or file path.
func play()
Plays the sound. Has no effect if the sound is already playing.
func stop()
Stops the sound. Has no effect if the sound is not already playing.
func fadeTo(volume: Float, duration: TimeInterval = 1.0)
This method fades a sound from it's current volume to the specified volume over the specified time period.
func fadeIn(duration: TimeInterval = 1.0)
Fades the sound volume from 0.0 to 1.0 over the specified duration.
func fadeOut(duration: TimeInterval = 1.0)
Fades the sound from it's current volume to 0.0 over the specified duration.
Notifications
SoundDidFinishPlayingNotification
This notification is fired (via NSNotificationCenter) whenever a sound finishes playing, either due to it ending naturally, or because the stop method was called. The notification object is an instance of the AudioPlayer class. You can access the AudioPlayer class's
name property to find out which sound has finished.
What's next
- AudioPlayerManager
- Your features!
Contribution
- If you found a bug, open an issue
- If you have a feature request, open an issue
- If you want to contribute, submit a pull request
Licence
AudioPlayerSwift is available under the MIT license. See the LICENSE file for more info.
*Note that all licence references and agreements mentioned in the AudioPlayerSwift README section above are relevant to that project's source code only. | https://swift.libhunt.com/audioplayerswift-alternatives | CC-MAIN-2020-24 | en | refinedweb |
Exercise 1: Dust off that Compiler
In this second exercise, its all about writing code and seeing what happens. Click here for the tutorial’s index page.
This is the code snippet for this exercise.
#include <stdio.h> /*This is a comment*/ int main(int argc, char *argv[]) { int distance = 100; //This is another comment printf("You are %d miles away \n", distance); return 0; }
Compiling
To compile it you have to use make. GNU Make is a tool which controls the generation of executables and other non-source files of a program from the program’s source files. Make gets its knowledge of how to build a.
But for now we shall not create/modify our make file.
make ex1
Before we execute our program we need to check for errors(debug) using a special tool called lldb. The LLDB Debugger (LLDB) is the debugger component of the LLVM project. It is built as a set of reusable components which extensively use existing libraries from LLVM, such as the Clang expression parser and LLVM disassembler. LLDB is free and open-source software.
lldb ex1
When it reports no errors, then you can exectute the program. To exit from lldb, just type: exit and hit enter.
./ex1 You are 100 miles away
What I’ve Learnt
First of all by running:
man printf
I got to realise that it was developed by MacKenzie and it takes a variety of parameters. To check how printf works, I shall run the above code but remove the last variable parameter and see what my program tells me. Here we go…
printf("You are %d miles away \n");
The compilation stage passes with no errors. I then execute it to see what happens. This is the result I get.
You are -969057704 miles away
The reason why I get the negative result is because printf and C operate on raw memory. In C there is no virtual machine that protects the programmer from such errors. Its Raw memory as it is. Because C expects there to be a parameter it find nothing so returns whatever memory is available at the expected point. That is how raw things get here.
I then check with lldb on whats happening inside. | https://wilfred.githuka.com/post/ex1/ | CC-MAIN-2020-24 | en | refinedweb |
Exposing .)
Let’s start by reviewing the shape of asynchronous APIs in WinRT.
WinRT async interfaces
WinRT has several interfaces related to asynchronous operations. The first is IAsyncInfo, which every valid WinRT async operation implements. It surfaces the common capabilities for an asynchronous operation, including the operation’s current status, the operation’s error if it failed, an ID for the operation, and the operation’s ability to have cancellation requested:
public interface IAsyncInfo { AsyncStatus Status { get; } Exception ErrorCode { get; } uint Id { get; } void Cancel(); void Close(); }
In addition to implementing IAsyncInfo, every valid WinRT asynchronous operation implements one of four additional interfaces: IAsyncAction, IAsyncActionWithProgress<TProgress> , IAsyncOperation<TResult> , or IAsyncOperationWithProgress<TResult,TProgress> . These additional interfaces allow the consumer to set a callback that will be invoked when the asynchronous work completes, and optionally allow for the consumer to get a result and/or to receive progress reports:
// No results, no progress public interface IAsyncAction : IAsyncInfo { AsyncActionCompletedHandler Completed { get; set; } void GetResults(); } // No results, with progress public interface IAsyncActionWithProgress<TProgress> : IAsyncInfo { AsyncActionWithProgressCompletedHandler<TProgress> Completed { get; set; } AsyncActionProgressHandler<TProgress> Progress { get; set; } void GetResults(); } // With results, no progress public interface IAsyncOperation<TResult> : IAsyncInfo { AsyncOperationCompletedHandler<TResult> Completed { get; set; } TResult GetResults(); } // With results, with progress public interface IAsyncOperationWithProgress<TResult,TProgress> : IAsyncInfo { AsyncOperationWithProgressCompletedHandler<TResult,TProgress> Completed { get; set; } AsyncOperationProgressHandler<TResult,TProgress> Progress { get; set; } TResult GetResults(); }
(IAsyncAction provides a GetResults method even though there are no results to be returned. This provides a method on a faulted async operation to throw its exception, rather than forcing all consumers to access the IAsyncInfo’s ErrorCode property. It is similar to how awaiter types in C# and Visual Basic expose a GetResult method, even if that GetResult method is typed to return void.)
When building a WinRT library, all publicly exposed asynchronous operations in that library are strongly typed to return one of these four interfaces. In contrast, new asynchronous operations exposed from .NET libraries follow the Task-based Asynchronous Pattern (TAP), returning Task or Task<TResult> , the former for operations that don’t return a result, and the latter for operations that do.
Task and Task<TResult> don’t implement these WinRT interfaces, nor does the Common Language Runtime (CLR) implicitly paper over the differences (as it does do for some types, such as the WinRT Windows.Foundation.Uri type and the BCL System.Uri type). Instead, we need to explicitly convert from one world to the other. In the Diving Deep with Await and WinRT post, we saw how the AsTask extension method in the BCL provides an explicit cast-like mechanism to convert from the WinRT async interfaces to .NET Tasks. The BCL also supports the other direction, with methods to convert from .NET Tasks to the WinRT async interfaces.
Converting with AsAsyncAction and AsAsyncOperation
For the purposes of this blog post, let’s assume we have a .NET asynchronous method DownloadStringAsyncInternal. We pass to it a URL to a web page, and the method asynchronously downloads and returns the contents of that page as a string:
internal static Task<string> DownloadStringAsyncInternal(string url);
How this method is implemented doesn’t matter. Rather, our goal is to wrap this as a WinRT asynchronous operation, meaning as a method that returns one of the four previously mentioned interfaces. As our operation has a result (a string) and as it doesn’t support progress reporting, our WinRT async operation returns IAsyncOperation<string> :
public static IAsyncOperation<string> DownloadStringAsync(string url);
To implement this method, we can call the DownloadStringAsyncInternal method to get the resulting Task<string> . Then we need to convert that task to the required IAsyncOperation<string> … but how?
public static IAsyncOperation<string> DownloadStringAsync(string url) { Task<string> from = DownloadStringAsyncInternal(url); IAsyncOperation<string> to = ...; // TODO: how do we convert 'from'? return to; }
To address this gap, the System.Runtime.WindowsRuntime.dll assembly in .NET 4.5 includes extension methods for Task and Task<TResult> that provide the necessary conversions:
// in System.Runtime.WindowsRuntime.dll public static class WindowsRuntimeSystemExtensions { public static IAsyncAction AsAsyncAction( this Task source); public static IAsyncOperation<TResult> AsAsyncOperation<TResult>( this Task<TResult> source); ... }
These methods return a new IAsyncAction or IAsyncOperation<TResult> instance that wraps the supplied Task or Task<TResult> , respectively (because Task<TResult> derives from Task, both of these methods are available for Task<TResult> , though it’s relatively rare that you would use AsAsyncAction with a result-returning asynchronous method). Logically, you can think of these operations as explicit, synchronous casts, or from a design pattern perspective, as adapters. They return an instance that represents the underlying task but that exposes the required surface area for WinRT. With such extension methods, we can complete our DownloadStringAsync implementation:
public static IAsyncOperation<string> DownloadStringAsync(string url) { Task<string> from = DownloadStringAsyncInternal(url); IAsyncOperation<string> to = from.AsAsyncOperation(); return to; }
We can also write this more succinctly, highlighting how very cast-like the operation is:
public static IAsyncOperation<string> DownloadStringAsync(string url) { return DownloadStringAsyncInternal(url).AsAsyncOperation(); }
DownloadStringAsyncInternal is being invoked before we ever call AsAsyncOperation. This means that we need the synchronous call to DownloadStringAsyncInternal to return quickly to ensure that the DownloadStringAsync wrapper method is responsive. If for some reason you fear the synchronous work you’re doing will take too long, or if you explicitly want to offload the invocation to a thread pool for other reasons, you can do so using Task.Run, then invoking AsAsyncOperation on its returned task:
public static IAsyncOperation<string> DownloadStringAsync(string url) { return Task.Run(()=>DownloadStringAsyncInternal(url)).AsAsyncOperation(); }
More flexibility with AsyncInfo.Run
These built-in AsAsyncAction and AsAsyncOperation extension methods are great for simple conversions from Task to IAsyncAction and from Task<TResult> to IAsyncOperation<TResult> . But what about more advanced conversions?
System.Runtime.WindowsRuntime.dll contains another type that provides more flexibility: AsyncInfo, in the System.Runtime.InteropServices.WindowsRuntime namespace. AsyncInfo exposes four overloads of a static Run method, one for each of the four WinRT async interfaces:
// in System.Runtime.WindowsRuntime.dll public static class AsyncInfo { // No results, no progress public static IAsyncAction Run( Func<CancellationToken, Task> taskProvider); // No results, with progress public static IAsyncActionWithProgress<TProgress> Run<TProgress>( Func<CancellationToken, IProgress<TProgress>, Task> taskProvider); // With results, no progress public static IAsyncOperation<TResult> Run<TResult>( Func<CancellationToken, Task<TResult>> taskProvider); // With results, with progress public static IAsyncOperationWithProgress<TResult, TProgress> Run<TResult, TProgress>( Func<CancellationToken, IProgress<TProgress>, Task<TResult>> taskProvider); }
The AsAsyncAction and AsAsyncOperation methods we’ve already examined accept a Task as an argument. In contrast, these Run methods accept a function delegate that returns a Task, and this difference between Task and Func<…,Task> is enough to give us the added flexibility we need for more advanced operations.
Logically, you can think of AsAsyncAction and AsAsyncOperation as being simple helpers on top of the more advanced AsyncInfo.Run:
public static IAsyncAction AsAsyncAction( this Task source) { return AsyncInfo.Run(_ => source); } public static IAsyncOperation<TResult> AsAsyncOperation<TResult>( this Task<TResult> source) { return AsyncInfo.Run(_ => source); }
This isn’t exactly how they’re implemented in .NET 4.5, but functionally they behave this way, so it helps to think about them as such to contrast between the basic and advanced support. If you have a simple case, use AsAsyncAction and AsAsyncOperation, but there are several advanced cases where AsyncInfo.Run shines.
Cancellation
AsyncInfo.Run makes it possible to support cancellation with WinRT async methods.
To continue with our downloading example, let’s say we have another DownloadStringAsyncInternal overload that accepts a CancellationToken:
internal static Task<string> DownloadStringAsyncInternal( string url, CancellationToken cancellationToken);
CancellationToken is .NET Framework type that supports cooperative cancellation in a composable manner. You can pass a single token into any number of method calls, and when that token has cancellation requested (via the CancellationTokenSource that created the token), the cancellation request is then visible to all of those consuming operations. This approach differs slightly from that used by WinRT async, which is to have each individual IAsyncInfo expose its own Cancel method. Given that, how do we arrange for a call to Cancel on the IAsyncOperation<string> to have cancellation requested on a CancellationToken that’s passed into DownloadStringAsyncInternal? AsAsyncOperation won’t work in this case:
public static IAsyncOperation<string> DownloadStringAsync(string uri) { return DownloadStringAsyncInternal(uri, … /* what goes here?? */) .AsAsyncOperation(); }
To know when cancellation is requested of the IAsyncOperation<string> , that instance would need to somehow notify a listener that its Cancel method was called, for example by requesting cancellation of a CancellationToken that we’d pass into DownloadStringAsyncInternal. But in a classic “catch-22,” we don’t get the Task<string> on which to invoke AsAsyncOperation until we’ve already invoked DownloadStringAsyncInternal, at which point we would have already needed to supply the very CancellationToken we’d have wanted AsAsyncOperation to provide.
There are multiple ways to solve this conundrum, including the solution employed by AsyncInfo.Run. The Run method is responsible for constructing the IAsyncOperation<string> , and it creates that instance to request cancellation of a CancellationToken that it also creates when the async operation’s Cancel method is called. Then when invoking the user-supplied delegate passed to Run, it passes in this token, avoiding the previously discussed cycle:
public static IAsyncOperation<string> DownloadStringAsync(string uri) { return AsyncInfo.Run(cancellationToken => DownloadStringAsyncInternal(uri, cancellationToken)); }
Lambdas and Anonymous Methods
AsyncInfo.Run simplifies using lambda functions and anonymous methods to implement WinRT async methods.
For example, if we didn’t already have the DownloadStringAsyncInternal method, we might implement it and DownloadStringAsync like this:
public static IAsyncOperation<string> DownloadStringAsync(string uri) { return AsyncInfo.Run(delegate(CancellationToken cancellationToken) { return DownloadStringAsyncInternal(uri, cancellationToken)); }); } private static async Task<string> DownloadStringAsyncInternal( string uri, CancellationToken cancellationToken) { var response = await new HttpClient().GetAsync( uri, cancellationToken); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); }
By taking advantage of the C# and Visual Basic support for writing asynchronous anonymous methods, we can simplify our implementation by combining these two methods into one:
public static IAsyncOperation<string> DownloadStringAsync(string uri) { return AsyncInfo.Run(async delegate(CancellationToken cancellationToken) { var response = await new HttpClient().GetAsync( uri, cancellationToken); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); }); }
Progress
AsyncInfo.Run also provides support for progress reporting through WinRT async methods.
Instead of our DownloadStringAsync method returning an IAsyncOperation<string> , imagine if we instead wanted it to return an IAsyncOperationWithProgress<string,int> :
public static IAsyncOperationWithProgress<string,int> DownloadStringAsync(string uri);
DownloadStringAsync now can provide progress updates containing integral data, such that consumers can set a delegate as the interface’s Progress property to receive notifications of progress change.
AsyncInfo.Run provides an overload that accepts a Func<CancellationToken,IProgress<TProgress>,Task<TResult>> . Just as AsyncInfo.Run passes into the delegate a CancellationToken that will have cancellation requested when the Cancel method is called, it can also pass in an IProgress<TProgress> instance whose Report method triggers invocations of the consumer’s Progress delegate. For example, if we wanted to modify our previous example to report 0% progress at the beginning, 50% progress after getting the response back, and 100% progress after parsing the response into a string, that might look like this:
public static IAsyncOperationWithProgress<string,int> DownloadStringAsync(string uri) { return AsyncInfo.Run(async delegate( CancellationToken cancellationToken, IProgress<int> progress) { progress.Report(0); try { var response = await new HttpClient().GetAsync(uri, cancellationToken); progress.Report(50); response.EnsureSuccessStatusCode(); return await response.Content.ReadAsStringAsync(); } finally { progress.Report(100); } }); }
A look under the cover
To get a good mental model for how all of this works, let’s explore an implementation of AsAsyncOperation and AsyncInfo.Run. These are not the same implementations that exist in .NET 4.5, and they aren’t as robust. Rather, they are approximations that provide a good sense of how things work under the cover, and are not intended to be used in production.
AsAsyncOperation
The AsAsyncOperation method takes a Task<TResult> and returns an IAsyncOperation<TResult> :
public static IAsyncOperation<TResult> AsAsyncOperation<TResult>( this Task<TResult> source);
To implement this method, we need to create a type that implements IAsyncOperation<TResult> and that wraps the supplied task.
public static IAsyncOperation<TResult> AsAsyncOperation<TResult>( this Task<TResult> source) { return new TaskAsAsyncOperationAdapter<TResult>(source); } internal class TaskAsAsyncOperationAdapter<TResult> : IAsyncOperation<TResult> { private readonly Task<TResult> m_task; public TaskAsAsyncOperationAdapter(Task<TResult> task) { m_task = task; } ... }
Each of the interface method implementations on this type will delegate to functionality on the wrapped task. Let’s start with the easiest members.
First, the IAsyncInfo.Close method is supposed to aggressively clean up any resources that the completed asynchronous operation used. As we have no such resources (our object just wraps a task), our implementation is empty:
public void Close() { /* NOP */ }
With the IAsyncInfo.Cancel method a consumer of the async operation can request its cancellation. It is purely a request, and doesn’t in any way force the operation to exit. We simply use a CancellationTokenSource to store that a request occurred:
private readonly CancellationTokenSource m_canceler = new CancellationTokenSource(); public void Cancel() { m_canceler.Cancel(); }
The IAsyncInfo.Status property returns an AsyncStatus to represent the current status of the operation with regards to its asynchronous lifecycle. This can be one of four values: Started, Completed, Error, or Canceled. For the most part, we can simply delegate to the underlying Task’s Status property and map from its returned TaskStatus to the needed AsyncStatus:
If the Task is not yet completed and cancellation has been requested, we need to return Canceled instead of Started. This means that although TaskStatus.Canceled is only a terminal state, AsyncStatus.Canceled can be either a terminal state or a non-terminal state, in that it’s possible for an IAsyncInfo to end in the Canceled state, or for an IAsyncInfo in the Canceled state to transition to either AsyncStatus.Completed or AsyncStatus.Error.
public AsyncStatus Status { get { switch (m_task.Status) { case TaskStatus.RanToCompletion: return AsyncStatus.Completed; case TaskStatus.Faulted: return AsyncStatus.Error; case TaskStatus.Canceled: return AsyncStatus.Canceled; default: return m_canceler.IsCancellationRequested ? AsyncStatus.Canceled : AsyncStatus.Started; } } }
The IAsyncInfo.Id property returns a UInt32 identifier for the operation. As Task itself already exposes such an identifier (as an Int32), we can implement this property simply by delegating through to the underlying Task property:
public uint Id { get { return (uint)m_task.Id; } }
WinRT defines the IAsyncInfo.ErrorCode property to return an HResult. But the CLR internally maps the WinRT HResult to a .NET Exception, surfacing it that way to us through the managed projection. Task itself exposes an Exception property, so we can just delegate through to it: if the Task ended in the Faulted state, we return its first exception (a Task could potentially fault due to multiple exceptions, such as with a Task returned from Task.WhenAll), returning null otherwise:
public Exception ErrorCode { get { return m_task.IsFaulted ? m_task.Exception.InnerException : null; } }
That’s it for implementing IAsyncInfo. Now we need to implement the two additional members supplied by IAsyncOperation<TResult> : GetResults and Completed.
Consumers call GetResults after the operation completes successfully or after an exception occurs. In the former case, it returns the computed result, and in the latter case, it throws the relevant exception. If the operation ended as Canceled, or if it hasn’t ended yet, it’s illegal to invoke GetResults. As such, we can implement GetResults as follows, relying on the task’s awaiter’s GetResult method to return the result if successful or to propagate the right exception if the task ended as Faulted.
public TResult GetResults() { switch (m_task.Status) { case TaskStatus.RanToCompletion: case TaskStatus.Faulted: return m_task.GetAwaiter().GetResult(); default: throw new InvalidOperationException("Invalid GetResults call."); } }
Finally, we have the Completed property. Completed represents a delegate that should be invoked when the operation completes. If the operation has already finished when Completed is set, the supplied delegate must be invoked or scheduled immediately. Additionally, a consumer can set the property only once (attempts to set multiple times result in exceptions). And after the operation has been completed, implementations must drop the reference to the delegate to avoid memory leaks. We can rely on Task’s ContinueWith method to implement much of this behavior, but because ContinueWith can be used multiple times on the same Task instance, we need to manually implement the more restrictive “set once” behavior:
private AsyncOperationCompletedHandler<TResult> m_handler; private int m_handlerSet; public AsyncOperationCompletedHandler<TResult> Completed { get { return m_handler; } set { if (value == null) throw new ArgumentNullException("value"); if (Interlocked.CompareExchange(ref m_handlerSet, 1, 0) != 0) throw new InvalidOperationException("Handler already set."); m_handler = value; var sc = SynchronizationContext.Current; m_task.ContinueWith(delegate { var handler = m_handler; m_handler = null; if (sc == null) handler(this, this.Status); else sc.Post(delegate { handler(this, this.Status); }, null); }, CancellationToken.None, TaskContinuationOptions.ExecuteSynchronously, TaskScheduler.Default); } }
With that, our implementation of AsAsyncOperation is complete, and we can use any Task<TResult> -returning method as an IAsyncOperation<TResult> method.
AsyncInfo.Run
Now, what about the more advanced AsyncInfo.Run?
public static IAsyncOperation<TResult> Run<TResult>( Func<CancellationToken,Task<TResult>> taskProvider);
To support this Run overload, we can use the same TaskAsAsyncOperationAdapter<TResult> type we just created, with all of our existing implementation intact. In fact, we just need to augment it with the ability to work in terms of Func<CancellationToken,Task<TResult>> instead of only in terms of Task<TResult> . When such a delegate is provided, we can simply invoke it synchronously, passing in the m_canceler CancellationTokenSource we defined earlier and storing the returned task:
internal class TaskAsAsyncOperationAdapter<TResult> : IAsyncOperation<TResult> { private readonly Task<TResult> m_task; public TaskAsAsyncOperationAdapter(Task<TResult> task) { m_task = task; } public TaskAsAsyncOperationAdapter( Func<CancellationToken,Task<TResult>> func) { m_task = func(m_canceler.Token); } ... } public static class AsyncInfo { public static IAsyncOperation<TResult> Run<TResult>( Func<CancellationToken, Task<TResult>> taskProvider) { return new TaskAsAsyncOperationAdapter<TResult>(taskProvider); } … }
This implementation highlights that there’s no magic happening here. AsAsyncAction, AsAsyncOperation, and AsyncInfo.Run are all just helper implementations that save you from having to write all of this boilerplate yourself.
Conclusion
At this point, I hope you have a good understanding of what AsAsyncAction, AsAsyncOperation, and AsyncInfo.Run do for you: they make it easy to take a Task or a Task<TResult> , and expose it as an IAsyncAction, an IAsyncOperation<TResult> , an IAsyncActionWithProgress<TProgress> , or an IAsyncOperationWithProgress<TResult,TProgress> . Combined with the async and await keywords in C# and Visual Basic, this makes it very easy to implement new WinRT asynchronous operations in managed code.
As long as the functionality you’re exposing is available as a Task or Task<TResult> , you should rely on these built-in capabilities to do the conversions for you instead of implementing the WInRT async interfaces manually. And if the functionality you’re trying to expose is not available yet as a Task or Task<TResult> , try to expose it as a Task or Task<TResult> first, and then rely on the built-in conversions. It can be quite difficult to get all of the semantics around a WinRT asynchronous interface implementation correct, which is why these conversions exist to do it for you. Similar support also exists if you’re implementing WinRT asynchronous operations in C++, whether through the base AsyncBase class in the Windows Runtime Library, or through the create_async function in the Parallel Pattern Library.
Happy async’ing.
--Stephen Toub, Visual Studio | https://docs.microsoft.com/en-us/archive/blogs/windowsappdev/exposing-net-tasks-as-winrt-asynchronous-operations | CC-MAIN-2020-24 | en | refinedweb |
Android solves this with the beloved ROOM library, on Flutter though, you are stuck with the low-level SQFLite package... Not anymore! MOOR is a library allowing you to work with the Flutter's SQLite database fluently and in pure Dart. Behind the scenes, it uses the SQFLite package. Oh, and if you're wondering, MOOR is just ROOM spelled backwards.
Preparing the project
Other dependencies include provider and flutter_slidable which are here purely for making the UI possible.
pubspec.yaml
... dependencies: flutter: sdk: flutter moor_flutter: ^1.4.0 # For the UI provider: ^3.0.0+1 flutter_slidable: ^0.5.3 ... dev_dependencies: flutter_test: sdk: flutter moor_generator: ^1.4.0 build_runner: ...
What we will build
Project-based approach to learning is the best approach. In this series, we are going to build a task list app. At the end of this part, you are going to have an app which can create new tasks, complete them & display them. All of this will happen persistently using the Moor's fluent query syntax.
Creating a table
The biggest benefit of Moor is that you don't have to leave Dart in order to work with the database. This also applies to defining SQL tables. All you need, is to create a class representing the table. Subsequently, columns are specified as get-only properties of the class.
What's more, Moor takes this Table class and creates a data class out of it! Moor's data classes support value equality, simple deep copies, and even converting to & from JSON.
All the Moor-related code will be inside a file moor_database.dart to keep it organized.
Location of the file
moor_database.dart
import 'package:moor/moor.dart'; import 'package:moor_flutter/moor_flutter.dart'; // Moor works by source gen. This file will all the generated code. part 'moor_database.g.dart'; // The name of the database table is "tasks" // By default, the name of the generated data class will be "Task" (without "s") class Tasks extends Table { // autoIncrement automatically sets this to be the primary key IntColumn get id => integer().autoIncrement()(); // If the length constraint is not fulfilled, the Task will not // be inserted into the database and an exception will be thrown. TextColumn get name => text().withLength(min: 1, max: 50)(); // DateTime is not natively supported by SQLite // Moor converts it to & from UNIX seconds DateTimeColumn get dueDate => dateTime().nullable()(); // Booleans are not supported as well, Moor converts them to integers // Simple default values are specified as Constants BoolColumn get completed => boolean().withDefault(Constant(false))(); }
More on defining tables
The code above is all we need for the app we're building. However there are some additional things you might want to know - how to define custom primary keys and how to change the name of the generated data class.
moor_database.dart
// The default data class name "Tasks" would now be "SomeOtherNameIfYouWant" ('SomeOtherNameIfYouWant') class Tasks extends Table { ... // Custom primary keys defined as a set of columns Set<Column> get primaryKey => {id, name}; }
The Database class
With the table definition done, we need to get the actual database running. Moor makes this simple. Create a class, annotate it and specify the location of the database file.
moor_database.dart
// This annotation tells the code generator which tables this DB works with (tables: [Tasks]) // _$AppDatabase is the name of the generated class class AppDatabase extends _$AppDatabase { AppDatabase() // Specify the location of the database file : super((FlutterQueryExecutor.inDatabaseFolder( path: 'db.sqlite', // Good for debugging - prints SQL in the console logStatements: true, ))); // Bump this when changing tables and columns. // Migrations will be covered in the next part. int get schemaVersion => 1; }
At this point, it's good if we finally generate the code. As usual, it's done through the build_runner command. We will use watch instead of build, so that we don't have to constantly rerun the command.
Queries
Moor supports all kinds of queries in the fluent syntax and it also allows you to write custom SQL. Most of the time though, you don't have to leave the comfort of Dart. In this part, we will take a look at the basic queries and leave the more advanced ones for the next part. Queries can be put into the AppDatabase class.
moor_database.dart
class AppDatabase extends _$AppDatabase { ... // All tables have getters in the generated class - we can select the tasks table Future<List<Task>> getAllTasks() => select(tasks).get(); // Moor supports Streams which emit elements when the watched data changes Stream<List<Task>> watchAllTasks() => select(tasks).watch(); Future insertTask(Task task) => into(tasks).insert(task); // Updates a Task with a matching primary key Future updateTask(Task task) => update(tasks).replace(task); Future deleteTask(Task task) => delete(tasks).delete(task); }(tables: [Tasks])
Making the UI
Once you have the database class fully set up, you can use it throughout the app however you please. It doesn't require any additional setup. One thing you should keep in mind is that the AppDatabase class should be a singleton. In this app, we will accomplish it with the Provider package.
main.dart
import 'package:flutter/material.dart'; import 'package:provider/provider.dart'; import 'data/moor_database.dart'; import 'ui/home_page.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { Widget build(BuildContext context) { return Provider( // The single instance of AppDatabase builder: (_) => AppDatabase(), child: MaterialApp( title: 'Material App', home: HomePage(), ), ); } }
Since this is only a simple app, we won't use any fancy state management solution. Simple Stateful widgets will suffice. If you'd like to step up your state management game, I highly recommend the BLoC library.
This is not a tutorial about Flutter's widgets, so the rest of the UI code will be here without any real explanation. Check out the video tutorial for more info.
home_page(), ], )); } StreamBuilder<List<Task>> _buildTaskList(BuildContext context) { final database = Provider.of<AppDatabase>(context); return StreamBuilder( stream: database.watchAllTasks(), builder: (context, AsyncSnapshot<List<Task>> snapshot) { final tasks = snapshot.data ?? List(); return ListView.builder( itemCount: tasks.length, itemBuilder: (_, index) { final itemTask = tasks[index]; return _buildListItem(itemTask, database); }, ); }, ); } Widget _buildListItem(Task itemTask, AppDatabase database) { return Slidable( actionPane: SlidableDrawerActionPane(), secondaryActions: <Widget>[ IconSlideAction( caption: 'Delete', color: Colors.red, icon: Icons.delete, onTap: () => database.deleteTask(itemTask), ) ], child: CheckboxListTile( title: Text(itemTask.name), subtitle: Text(itemTask.dueDate?.toString() ?? 'No date'), value: itemTask.completed, onChanged: (newValue) { database.updateTask(itemTask.copyWith(completed: newValue)); }, ), ); } }
The following code is for the bottom bar where new tasks can be inputted.
new_task_input_widget.dart
import 'package:flutter; TextEditingController controller; void initState() { super.initState(); controller = TextEditingController(); } Widget build(BuildContext context) { return Container( padding: const EdgeInsets.all(8.0), child: Row( mainAxisSize: MainAxisSize.max, children: <Widget>[ _buildTextField(context), _buildDateButton(context), ], ), ); } Expanded _buildTextField(BuildContext context) { return Expanded( child: TextField( controller: controller, decoration: InputDecoration(hintText: 'Task Name'), onSubmitted: (inputName) { final database = Provider.of<AppDatabase>(context); final task = Task( name: inputName, dueDate: newTaskDate, ); database.insertTask(task); resetValuesAfterSubmit(); }, ), ); }; controller.clear(); }); } }
Conclusion
You've learned how to use Moor to fluently create tables and queries in your Flutter apps. There's a lot more that Moor can handle, so be sure to stick around for the future parts of this series.
Very good tutorial! Is there any way to use your own model? Cause i have a model that i use for an api service and i want to store that model to the db.
Custom model is not possible, you’ll have to use the Moor data class to store the object in the database.
Hello @resocoder is it moor_flutter supports json data column and we can make select query on the json data?
Hi! Moor currently supports neither JSON data (unless you convert it to a String) nor querying JSON. You should check out the SEMBAST NoSQL local DB, if you’re interested.
Yes, Thank you @resocoder.
Hi @resocoder! Very good tutorial! Is there any way to use your own model class? because i have a model that i use for an api service and i want to store that model to the db.
Hmm, I don’t think that’s possible. You have to use Moor’s generated classes for the DB. You could, however, convert your existing model objects into Moor objects.
Thank you for the article.
But I can’t understand – For example, you have an SQLite database on a VPS. How to connect to that database via Moor? Or moor – only for local databases?
Yes, Moor is only a local DB.
The function update(tasks).replace(task), return a int or bool?
Hello, what if I want to delete all data in a table?
Fixed.
Here the query —> return delete(subCategories).go();
Your tutorials seem great to me! Can you teach about how to do with several tables with SQLite and Flutter?
It’s not working for me, I m using latest 2.2.0 version of moor.
eg Future insertTask(Insertable pin) => into(pins).insert(pin);
it gives error
Undefined name ‘pins’.
Try correcting the name to one that is defined, or defining the name.
Pin is table class
Great article!
I have a question, is there a way to backup my database using moor?
Hi, your tutorial is great, thanks, could you help me in the use of batch insert. I was reading but I Can’t achieve this.
Thank you for the tutorials. Did moor work on windows desktop application ? because am trying to get this example work with a windows application, but there is no auto generated classes. (for example : _$AppDatabase)
Hi Matt, thanks for the tutorial,
but i am getting an error, once i run ‘ flutter packages pub run build_runner watch ‘ the file doesn’t get generated , i’ve tried couple of times but i cannot figure out what’s wrong.
—— look at the codes
import ‘package:moor_flutter/moor_flutter.dart’;
part ‘moor_database.g.dart’;
class Tasks extends Table {
// Defining properties (Table columns)
// by default the id id set as primary key when applying autoIncrement(),
// but can be overriden using a setter
IntColumn get id => integer().autoIncrement().call();
TextColumn get name => text().withLength(min: 1, max: 50)();
DateTimeColumn get dueDate => dateTime()();
BoolColumn get completed => boolean().withDefault(Constant(false))();
}
// The database class
@UseMoor(tables: [Tasks])
class AppDatabase extends _$AppDatabase {
AppDatabase() : super(FlutterQueryExecutor.inDatabaseFolder(path: ‘db.sqlite’, logStatements: true));
}
—– this is the error
[SEVERE] moor_generator:moor_generator on lib/data/moor_database.dart:
Error running MoorGenerator
NoSuchMethodError: The getter ‘typeConverter’ was called on null.
Receiver: null
Tried calling: typeConverter
Thanks for helping me out
Same problem on my end. Have you figured it out?, ‘db.sqlite’));
return VmDatabase(file);
});
}
// this annotation tells moor to prepare a database class that uses both of the
// tables we just defined. We’ll see how to use that database class in a moment.
@UseMoor(tables: [Tasks])
class AppDatabase extends _$AppDatabase {
AppDatabase() : super(_openConnection());
@override
int get schemaVersion => 1;
Future<List> getAllTasks() => select(tasks).get();
Stream<List> watchAllTasks() => select(tasks).watch();
Future insertTask(Task task) => into(tasks).insert(task);
Future updateTask(Task task) => update(tasks).replace(task);
Future deleteTask(Task task) => delete(tasks).delete(task);
}
Hi, Thanks for the tutorial .
as following your tutorial….
the task is not been saved on textField submit, also giving no errors , so unable to figure out the actual problem .
i fixed with 2 things:
– final database = Provider.of(context);
to
final database = Provider.of(context, listen: false);
– final task = Task(
name: inputName,
dueDate: newTaskDate,
);
to
final task = TasksCompanion(
name: Value(inputName),
dueDate: Value(newTaskDate),
);
Maybe because of more recent version of Provider package and moor_ffi instead of moor_flutter package like it’s recommand in the docs.
And in the moor_database.dart:
Future insertTask(TasksCompanion task) => into(tasks).insert(task);
Because we send partials data to the insert, so we use de Companion class
I had the same issue, all i did was add the listen: value and it worked for me
Your tutorials are life-changing, it makes me a batter app dev.
thank you, my man.
Thanks for another great tutorial for Flutter. I love them.
My question is where would be place the database files using the clean architecture explained in the another tutorial?
Thanks in advance
Best regards
Thanks a lot.
I’m using latest moor(^3.0.2) and provider(^4.1.1), everything works perfect except using Provider.of(context). It fails to get the provider ……
I changed to use context.read(), it works!
Just share it in case others have similar problems. | https://resocoder.com/2019/06/26/moor-room-for-flutter-tables-queries-fluent-sqlite-database/ | CC-MAIN-2020-24 | en | refinedweb |
Introduction: MPU 6050 Gyro,Accelerometer Communication With Arduino (Atmega328p)
The MPU6050 IMU has both 3-Axis accelerometer and 3-Axis gyroscope integrated on a single chip.
The gyroscope measures rotational velocity or rate of change of the angular position over time, along the X, Y and Z axis.
The outputs of the gyroscope are in degrees per second, so in order to get the angular position we just need to integrate the angular velocity.
On the other hand, the MPU6050 accelerometer measures acceleration by measuring gravitational acceleration along the 3 axes and using some trigonometry math we can calculate the angle at which the sensor is positioned. So, if we fuse, or combine the accelerometer and gyroscope data we can get very accurate information about the sensor orientation..
Teacher Notes
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1:
Step 2: Calculations.
For example,
Suppose, after 2’ complement we get accelerometer X axes raw value = +15454
Then Ax = +15454/16384 = 0.94 g.
More,
So we know we are running at a sensitivity of +/-2G and +/- 250deg/s but how do our values correspond to those accelerations/angles.
These are both straight line graphs and we can work out from them that for 1G we will read 16384 and for 1degree/sec we will read 131.07(Although the .07 will get ignore due to binary) these values were just worked out by drawing the straight line graph with 2G at 32767 and -2G at -32768 and 250/-250 at the same values.
So now we know our sensitivity values (16384 and 131.07) we just need to minus the offsets from our values and then devide by the sensitivity.
These will work fine for the X and Y values but as the Z was recorded at 1G and not 0 we will need to minus off 1G (16384) before we divide by our sensitivity.
Step 3: MPU6050-Atmega328p Connections
- Just Connect everyting as given in the diagram....
The connections are given as follows:-
- MPU6050<======> Arduino Nano.
VCC <======> 5v out pin
GND <======>Ground pin
SDA <======> A4 pin //serial data
SCL<======> A5 pin // serial clock
Pitch and Roll Calculation:
Roll is the rotation around x-axis and pitch is the rotation along y-axis.
The result is in radians. (convert to degrees by multiplying by 180 and dividing by pi)
Step 4: Codes and Explanations
#include <Wire.h> }</p><p </p><p> //Acceleration data correction AcXcal = -950; AcYcal = -300; AcZcal = 0;</p><p> //Temperature correction tcal = -1600;</p><p> //Gyro correction GyXcal = 480; GyYcal = 170; GyZcal = 210;</p><p> //read accelerometer data) //read temperature data Tmp=Wire.read()<<8|Wire.read(); // 0x41 (TEMP_OUT_H) 0x42 (TEMP_OUT_L) //read gyroscope data) </p><p> //temperature calculation tx = Tmp + tcal; t = tx/340 + 36.53; //equation for temperature in degrees C from datasheet tf = (t * 9/5) + 32; //fahrenheit</p><p> /); </p><p></p><p> //converting radians into degrees pitch = pitch * (180.0/3.14); roll = roll * (180.0/3.14) ; } ----------------------------------------------------------------------------------------------- Results:- -------------------------------------------------------------------------------------- Angle: Pitch = 88.89 Roll = -0.47<br>Accelerometer: X = 15974 Y = -440 Z = 312 Temperature in celsius = 29.38 fahrenheit = 84.88 Gyroscope: X = -111 Y = 341 Z = 211 Angle: Pitch = 89.41 Roll = -0.27 Accelerometer: X = 16102 Y = -380 Z = 172 Temperature in celsius = 29.42 fahrenheit = 84.96 Gyroscope: X = -115 Y = 373 Z = 228 Angle: Pitch = 89.28 Roll = -0.34 Accelerometer: X = 16058 Y = -400 Z = 204 Temperature in celsius = 29.42 fahrenheit = 84.96 Gyroscope: X = -98 Y = 354 Z = 224 Angle: Pitch = 88.83 Roll = -0.54 Accelerometer: X = 15978 Y = -460 Z = 320 Temperature in celsius = 29.33 fahrenheit = 84.79 Gyroscope: X = -124 Y = 376 Z = 207 Angle: Pitch = 89.21 Roll = -0.31 Accelerometer: X = 15978 Y = -392 Z = 228 Temperature in celsius = 29.42 fahrenheit = 84.96 Gyroscope: X = -121 Y = 364 Z = 189 Angle: Pitch = 89.00 Roll = -0.56 Accelerometer: X = 15890 Y = -464 Z = 260 Temperature in celsius = 29.38 fahrenheit = 84.88 Gyroscope: X = -111 Y = 361 Z = 221 Angle: Pitch = 88.67 Roll = -0.65 Accelerometer: X = 16018 Y = -492 Z = 360 Temperature in celsius = 29.38 fahrenheit = 84.88 Gyroscope: X = -130 Y = 340 Z = 216 Angle: Pitch = 88.53 Roll = -0.43 Accelerometer: X = 16110 Y = -428 Z = 432 Temperature in celsius = 29.42 fahrenheit = 84.96 Gyroscope: X = -92 Y = 380 Z = 217 Angle: Pitch = 88.85 Roll = -0.60 Accelerometer: X = 15930 Y = -476 Z = 304 Temperature in celsius = 29.47 fahrenheit = 85.05 Gyroscope: X = -102 Y = 374 Z = 219 Angle: Pitch = 88.87 Roll = -0.24 Accelerometer: X = 16222 Y = -372 Z = 344 Temperature in celsius = 29.52 fahrenheit = 85.13 Gyroscope: X = -96 Y = 351 Z = 226 Angle: Pitch = 89.05 Roll = -0.26 Accelerometer: X = 15970 Y = -376 Z = 284 Temperature in celsius = 29.38 fahrenheit = 84.88 Gyroscope: X = -105 Y = 367 Z = 201 Angle: Pitch = 89.13 Roll = -0.62 Accelerometer: X = 16034 Y = -484 Z = 200 Temperature in celsius = 29.52 fahrenheit = 85.13 Gyroscope: X = -110 Y = 391 Z = 207 Angle: Pitch = 88.98 Roll = -0.51 Accelerometer: X = 16178 Y = -452 Z = 280 Temperature in celsius = 29.47 fahrenheit = 85.05 Gyroscope: X = -117 Y = 379 Z = 221 Angle: Pitch = 89.27 Roll = -0.43 Accelerometer: X = 16066 Y = -428 Z = 192 Temperature in celsius = 29.42 fahrenheit = 84.96 Gyroscope: X = -101 Y = 359 Z = 208 Angle: Pitch = 89.31 Roll = -0.19 Accelerometer: X = 16150 Y = -356 Z = 212 Temperature in celsius = 29.52 fahrenheit = 85.13 Gyroscope: X = -115 Y = 361 Z = 189 Angle: Pitch = 88.76 Roll = -0.51 Accelerometer: X = 16026 Y = -452 Z = 348 Temperature in celsius = 29.42 fahrenheit = 84.96 Gyroscope: X = -139 Y = 368 Z = 192 Angle: Pitch = 88.57 Roll = -0.69 Accelerometer: X = 16086 Y = -504 Z = 388 Temperature in celsius = 29.33 fahrenheit = 84.79 Gyroscope: X = -118 Y = 352 Z = 214</p>
Step 5: Understanding Tilt Angle
Accelerometer
The earth’s gravity is a constant acceleration where the force is always pointing down to the centre of the Earth.
When the accelerometer is parallel with the gravity, the measured acceleration will be 1G, when the accelerometer is perpendicular with the gravity, it will measure 0G.
Tilt angle can be calculated from the measured acceleration by using this equation:
θ = sin-1 (Measured Acceleration / Gravity Acceleration)
Gyro
Gyro (a.k.a. rate sensor) is used to measure the angular velocity (ω).
In order to get the tilt angle of a robot, we need to integrate the data from the gyro as shown in the equation below:
ω = dθ / dt ,
θ = ∫ ω dt
Gyro and Accelerometer Sensor Fusion
After studying the characteristics of both gyro and accelerometer, we know that they have their own strengths and weakness. The calculated tilt angle from the accelerometer data has slow response time, while the integrated tilt angle from the gyro data is subjected to drift over a period of time. In other words, we can say that the accelerometer data is useful for long term while the gyro data is useful for short term.
Link for better understanding: Click Here
Be the First to Share
Recommendations
Discussions | https://www.instructables.com/id/Accelerometer-MPU-6050-Communication-With-AVR-MCU/ | CC-MAIN-2020-24 | en | refinedweb |
User:Wynndale/language test
This is a rewrite of the language bar ({{Languages}} template) that is intended to address some weaknesses in the current implementation.
Contents
Objectives for rewriting the Languages bar
- .
- There has to be an explicit page name for pages in languages without dedicated namespaces and an explicit argument ns= for pages in non-default categories.
The strategy
Instead of splitting links into upper and lower bars, every link goes together in one sequence, with red links hidden by CSS. A link has been added to “Other languages” (more discoverable than a “show” link) to unhide the links.
The templates
There are four new templates:
User:Wynndale/Languages is a replacement for the existing {{Languages}} template. It is only used to determine the base page name for link targets; everything else is done lower down.
User:Wynndale/Languages/div contains the guts, mainly the language links; one reason for the separate template is to make the links as compact as possible. All language links are in one single format so that they can be copied and pasted easily.
User:Wynndale/LanguageLink is a modified replacement for the existing {{LanguageLink}} template, with three changes:
- The bullet is made part of the link, so that bullets for red links have the “new” style set and the CSS hides them.
- Links to English are checked for and the language prefix is omitted, unlike the existing {{LanguageLinkEn}} template there is no search for alternative names, which needs
#ifexist.
- The calling syntax has been changed to make language links as small as possible and therefore easier to add.
Template:Languagename is a modified replacement for the #language parser function that additionally handles a language whose name Mediawiki doesn’t know.
How to use User:Wynndale/Languages
Most of the time the syntax
{{languages}} is enough. The full page name except for language prefixes (usually the name of the page in English) is needed if it is different, for instance
{{Languages|Map Features}} on NL:Kaarteigenschappen. The
ns parameter (namespace) is never needed but is accepted for backwards compatibility. There is an additional parameter
ifexist=no that avoids all uses of
#ifexist; it is intended for Map Features pages in languages other than English and may have undesirable side effects elsewhere. The template can be used on talk pages, for instance Talk:Bicycle, DE talk:Bicycle and Talk:Hu:Bicycle.
The CSS and script
This requires additions to the global style settings and scripts.
Thanks to Vincent Meurisse for refining the style sheet and script.
Add these styles to MediaWiki:Common.css and MediaWiki:Mobile.css.
/* Styles for language bar */ .LanguageBar { margin : 0; background : #f9f9f9; border : none; padding : 0.5em; font-size : 95%; line-height : normal; text-align : justify; } .LanguageBar .new { /* Hide language names where the page is unavailable, even when the link has been disabled */ display : none; } .LanguageBar.showOther a.new { /* ...but only show them again when the links are usable */ display: inline; }
Add this script to MediaWiki:Common.js and MediaWiki:Mobile.js.
// adds expansion link for language bars addOnloadHook(function() { $('#ExpandLanguages a:first-child').click(function(event) { event.preventDefault(); $('#Languages').toggleClass('showOther'); // The text of the link might need to change as well }); });
The issues
- On Firefox (36–44, Windows 7 and 8.1), right-to-left languages are listed from right to left and the bullets are part of the link to the right of the language name, or separated. IE11 (Windows 7) and Chrome 34 (Android 4.4) list these languages from left to right and the bullet to the left of the language is part of the link.
Fixed in Mozilla-based browsers such as Firefox (which still do not support "unicode-bidi:isolate" of CSS3 but only "unicode-bidi:-moz-isolate", at least in recent versions)
- No problem in Safari, Chrome and Android WebView (which support "unicode-bidi:isolate" in recent versions, and "unicode-bidi:-webkit-isolate" in older versions)
- Further tests or tweaks may be needed in IE11 (and Edge for Windows 10).
- Older browsers only support "unicode-bidi:embed" of CSS2 or do not support at all this CSS2 property and apply a default (embed) style for "bdi" elements. — Verdy_p (talk) 18:41, 22 April 2016 (UTC)
- When there is more than one bar on a page, every “Other languages” link displays the first set of red links.
- The first time you look at the wiki with the mobile view there is a flash of red links until the style sheet is cached.
- This is a minor problem.
- In fact the red links will disappear once the custom javascript (not the stylesheet) is loaded. This also means that mobile browsers with Javascript disable will still see the red links.
- For now the default Language bar uses the "nomobile" class to hide by default the bottom part of "missing" languages (or untested languages above the current limit of ~50 major languages), and this does not depend on Javascript support, only on CSS support.
- May be the "mobile" class could be used to display a "Other languages" link to a page listing all the languages (including red links) without really testing their existence.
- Note that the custom MediaWiki skin for the Mobile version still does not allow navigating parent categories (there's already a bug tracker in MediaWiki's Phabricator), so it's not evident to locate these other translated versions when they exist). There are still lots of missing features for Mobile MediaWiki to make it fully functional (not just on this wiki, but all MediaWiki-based wikis in general). For now we still need to use the desktop version for viewing/using missing features.
- — Verdy_p (talk) 19:00, 22 April 2016 (UTC)
- For all I know, there are sites out there that have their own maybe better solutions.
- The Javascript uses
addOnloadHook(function...)which is strongly deprecated: its execution order is unpredictable and this could create caveats (including during checks for the dynamic "loader" of dependant scripts and stylesheets) when there are multiple such hooks. We should better use jQuery:
$(document).load(function...)or better
$(document).ready(function...)which exexutes as soon as the DOM is complete (not necessarily "loaded" as the document may be in cache and the "load" event is not always fired in this case).
addOnloadHook() will soon be removed from MediaWiki (or may no longer work at all except to write an error message on the console saying it is no longer supported). The dynamic "loader" of MediaWiki is an important feature added a couple of years ago, as it greately reduces the total page load time, it allows parallelisation of scripts, and better management of caches, by executing those scripts only on demand and when they can effectively run. It largely improves the performance. — Verdy_p (talk) 19:09, 22 April 2016 (UTC)
Implementation plan
All stages depend on community approval.
- Tighten up or rewrite the templates and web code. Everyone has the opportunity to make further changes without affecting live wiki pages.
- Test on separate MediaWiki install -
DONE
- Move the custom CSS and script into MediaWiki:Common.css and MediaWiki:Common.js. These must be stable as all users will load them on all pages. I propose to drop the “Debug” ending from style classes and ids at this stage to differentiate the rolled-out versions from the private copies that are currently neede. -
DONE
- Change a few pages to use User:Wynndale/Languages instead of {{Languages}} and ask for feedback.
- Further refine the templates.
- Replace {{Languages}} with a copy of User:Wynndale/Languages and reinstate the pages that use the development version. | https://wiki.openstreetmap.org/wiki/User:Wynndale/language_test | CC-MAIN-2020-24 | en | refinedweb |
Join the community to find out what other Atlassian users are discussing, debating and creating.
Hi,
When using the Create a subtask function of the script listener, I want to add Issue Links(Linked Issues) through the Additional issue actions because there is no comment copy function.
def cf = customFieldManager.getCustomFieldObjects (issue).find {it.name = 'MyCustomFieldType'}
miss.setCustomFieldValue(cf, 'my value')
Like this one, what script should I use to set Issue Links(Linked Issues) to a certain value? | https://community.atlassian.com/t5/Jira-questions/How-to-set-Linked-issues-to-a-specific-value/qaq-p/1207476 | CC-MAIN-2020-24 | en | refinedweb |
Originally, critics accused the Internet and e-business of failing to provide the kind of customized service typically experienced in "brick-and-mortar" stores. To address this problem, e-businesses began to establish mechanisms by which they could personalize users' browsing experiences, tailoring content to individual users while enabling them to bypass irrelevant information. Businesses achieve this level of service by tracking each customer's movement through the Internet and combining the collected data with information provided by the consumer, including billing information, personal preferences, interests and hobbies.
Personalization
Personalization makes it possible for e-businesses to communicate effectively with their customers and also improves users' ability to locate desired products and services. Companies that provide content of particular interest to users can establish relationships with customers and build on those relationships over time. Furthermore, by targeting consumers with personal offers, recommendations, advertisements, promotions and services, e-businesses create customer loyalty. Web sites can use sophisticated technology to allow visitors to customize home pages to suit their individual needs and preferences. Similarly, online shopping sites often store personal information for customers, tailoring notifications and special offers to their interests. Such services encourage customers to visit sites more frequently and make purchases more regularly.
Privacy
A trade-off exists, however, between personalized e-business service and protection of privacy. Some consumers embrace the idea of tailored content, but others fear the possible adverse consequences if the info they provide to e-businesses is released or collected by tracking technologies. Consumers and privacy advocates ask: What if the e-business to which we give personal data sells or gives that information to another organization without our knowledge? What if we do not want our actions on the Interneta supposedly anonymous mediumto be tracked and recorded by unknown parties? What if unauthorized parties gain access to sensitive private data, such as credit-card numbers or medical history? All of these are questions that must be debated and addressed by programmers, consumers, e-businesses and lawmakers alike.
Recognizing Clients
To provide personalized services to consumers, e-businesses must be able to recognize clients when they request information from a site. As we have discussed, the request/response system on which the Web operates is facilitated by HTTP. Unfortunately, HTTP is a stateless protocolit does not support persistent connections that would enable Web servers to maintain state information regarding particular clients. This means that Web servers cannot determine whether a request comes from a particular client or whether the same or different clients generate a series of requests. To circumvent this problem, sites can provide mechanisms by which they identify individual clients. A session represents a unique client on a Web site. If the client leaves a site and then returns later, the client will still be recognized as the same user. To help the server distinguish among clients, each client must identify itself to the server. Tracking individual clients, known as session tracking, can be achieved in a number of ways. One popular technique uses cookies (Section 21.6.1); another uses ASP.NET's HttpSessionState object (Section 21.6.2). Additional sessiontracking techniques include the use of input form elements of type "hidden" and URL rewriting. Using "hidden" form elements, a Web Form can write session-tracking data into a form in the Web page that it returns to the client in response to a prior request. When the user submits the form in the new Web page, all the form data, including the "hidden" fields, is sent to the form handler on the Web server. When a Web site performs URL rewriting, the Web Form embeds session-tracking information directly in the URLs of hyperlinks that the user clicks to send subsequent requests to the Web server.
Note that our previous examples set the Web Form's EnableSessionState property to False. However, because we wish to use session tracking in the following examples, we keep this property's default settingtrue.
21.6.1. Cookies
Cookies provide Web developers with a tool for personalizing Web pages. A cookie is a piece of data stored in a small text file on the user's computer. A cookie maintains information about the client during and between browser sessions. The first time a user visits the Web site, the user's computer might receive a cookie; this cookie is then reactivated each time the user revisits that site. The collected information is intended to be an anonymous record containing data that is used to personalize the user's future visits to the site. For example, cookies in a shopping application might store unique identifiers for users. When a user adds items to an online shopping cart or performs another task resulting in a request to the Web server, the server receives a cookie containing the user's unique identifier. The server then uses the unique identifier to locate the shopping cart and perform any necessary processing.
In addition to identifying users, cookies also can indicate clients' shopping preferences. When a Web Form receives a request from a client, the Web Form can examine the cookie(s) it sent to the client during previous communications, identify the client's preferences and immediately display products of interest to the client.
Every HTTP-based interaction between a client and a server includes a header containing information either about the request (when the communication is from the client to the server) or about the response (when the communication is from the server to the client). When a Web Form receives a request, the header includes information such as the request type (e.g., Get) and any cookies that have been sent previously from the server to be stored on the client machine. When the server formulates its response, the header information contains any cookies the server wants to store on the client computer and other information, such as the MIME type of the response.
The expiration date of a cookie determines how long the cookie remains on the client's computer. If you do not set an expiration date for a cookie, the Web browser maintains the cookie for the duration of the browsing session. Otherwise, the Web browser maintains the cookie until the expiration date occurs. When the browser requests a resource from a Web server, cookies previously sent to the client by that Web server are returned to the Web server as part of the request formulated by the browser. Cookies are deleted when they expire.
Using Cookies to Provide Book Recommendations
The next Web application demonstrates the use of cookies. The example contains two pages. In the first page (Figs. 21.2321.24), users select a favorite programming language from a group of radio buttons and submit the XHTML form to the Web server for processing. The Web server responds by creating a cookie that stores a record of the chosen language, as well as the ISBN number for a book on that topic. The server then returns an XHTML document to the browser, allowing the user either to select another favorite programming language or to view the second page in our application (Figs. 21.25 and 21.26), which lists recommended books pertaining to the programming language that the user selected previously. When the user clicks the hyperlink, the cookies previously stored on the client are read and used to form the list of book recommendations.
Figure 21.23. ASPX file that presents a list of programming languages.
Figure 21.24. Code-behind file that writes a cookie to the client.
(This item is displayed on pages 1097 - 1099 in the print version)
Figure 21.25. ASPX file that displays book recommendations based on cookies.
(This item is displayed on pages 1099 - 1100 in the print version)
Figure 21.26. Reading cookies from a client to determine book recommendations.
(This item is displayed on page 1101 in the print version)
The ASPX file in Fig. 21.23 contains five radio buttons (lines 2127) with the values Visual Basic 2005, Visual C# 2005, C, C++, and Java. Recall that you can set the values of radio buttons via the ListItem Collection Editor, which is opened either by clicking the RadioButtonList's Items property in the Properties window or by clicking the Edit Items... link in the RadioButtonList Tasks smart tag menu. The user selects a programming language by clicking one of the radio buttons. The page contains a Submit button, which when clicked, creates a cookie containing a record of the selected language. Once created, this cookie is added to the HTTP response header, and a postback occurs. Each time the user chooses a language and clicks Submit, a cookie is written to the client.
When the postback occurs, certain controls are hidden and others are displayed. The Label, RadioButtonList and Button used to select a language are hidden. Toward the bottom of the page, a Label and two HyperLinks are displayed. One link requests this page (lines 3638), and the other requests Recommendations.aspx (lines 4143). Notice that clicking the first hyperlink (the one that requests the current page) does not cause a postback to occur. The file Options.aspx is specified in the NavigateUrl property of the hyperlink. When the hyperlink is clicked, this page is requested as a completely new request. Recall that earlier in the chapter, we set NavigateUrl to a remote Web site (). To set this property to a page within the same ASP.NET application, click the ellipsis button next to the NavigateUrl property in the Properties window to open the Select URL dialog. Use this dialog to select a page within your project as the destination for the HyperLink.
Adding and Linking to a New Web Form
Setting the NavigateUrl property to a page in the current application requires that the destination page exist already. Thus, to set the NavigateUrl property of the second link (the one that requests the page with book recommendations) to Recommendations.aspx, you must first create this file by right clicking the project location in the Solution Explorer and selecting Add New Item... from the menu that appears. In the Add New Item dialog, select Web Form from the Templates pane and change the name of the file to Recommendations.aspx. Finally, check the box labeled Place code in separate file to indicate that the IDE should create a code-behind file for this ASPX file. Click Add to create the file. (We discuss the contents of this ASPX file and code-behind file shortly.) Once the Recommendations.aspx file exists, you can select it as the NavigateUrl value for a HyperLink in the Select URL dialog.
Writing Cookies in a Code-Behind File
Figure 21.24 presents the code-behind file for Options.aspx (Fig. 21.23). This file contains the code that writes a cookie to the client machine when the user selects a programming language. The code-behind file also modifies the appearance of the page in response to a postback.
Lines 1617 create books as a Hashtable (namespace System.Collections)a data structure that stores keyvalue pairs. A program uses the key to store and retrieve the associated value in the Hashtable. In this example, the keys are strings containing the programming languages' names, and the values are strings containing the ISBN numbers for the recommended books. Class Hashtable provides method Add, which takes as arguments a key and a value. A value that is added via method Add is placed in the Hashtable at a location determined by the key. The value for a specific Hashtable enTRy can be determined by indexing the Hashtable with that value's key. The expression
HashtableName[ keyName ]
returns the value in the keyvalue pair in which keyName is the key. For example, the expression books[ language ] in line 64 returns the value that corresponds to the key contained in language. Class Hashtable is discussed in detail in Chapter 25, Data Structures.
Clicking the Submit button creates a cookie if a language is selected and causes a postback to occur. In the submitButton_Click event handler (lines 5672), a new cookie object (of type HttpCookie) is created to store the language and its corresponding ISBN number (line 67). This cookie is then Added to the Cookies collection sent as part of the HTTP response header (line 70). The postback causes the condition in the if statement of Page_Load (line 33) to evaluate to true, and lines 3751 execute. Lines 3739 reveal the initially hidden controls responseLabel, languageLink and recommendationsLink. Lines 4244 hide the controls used to obtain the user's language selection. Line 47 determines whether the user selected a language. If so, that language is displayed in responseLabel (lines 4849). Otherwise, text indicating that a language was not selected is displayed in responseLabel (line 51).
Displaying Book Recommendations Based on Cookie Values
After the postback of Options.aspx, the user may request a book recommendation. The book recommendation hyperlink forwards the user to Recommendations.aspx (Fig. 21.25) to display the recommendations based on the user's language selections.
Recommendations.aspx contains a Label (lines 1619), a ListBox (lines 2122) and a HyperLink (lines 2427). The Label displays the text Recommendations if the user has selected one or more languages; otherwise, it displays No Recommendations. The ListBox displays the recommendations created by the code-behind file, which is shown in Fig. 21.26. The HyperLink allows the user to return to Options.aspx to select additional languages.
Code-Behind File That Creates Book Recommendations From Cookies
In the code-behind file Recommendations.aspx.cs (Fig. 21.26), method Page_Init (lines 1740) retrieves the cookies from the client, using the Request object's Cookies property (line 20). This returns a collection of type HttpCookieCollection, containing cookies that have previously been written to the client. Cookies can be read by an application only if they were created in the domain in which the application is runninga Web server can never access cookies created outside the domain associated with that server. For example, a cookie created by a Web server in the deitel.com domain cannot be read by a Web server in any other domain.
Line 23 determines whether at least one cookie exists. Lines 2527 add the information in the cookie(s) to the booksListBox. The for statement retrieves the name and value of each cookie using i, the statement's control variable, to determine the current value in the cookie collection. The Name and Value properties of class HttpCookie, which contain the language and corresponding ISBN, respectively, are concatenated with " Howto Program. ISBN# " and added to the ListBox. Lines 3338 execute if no language was selected. We summarize some commonly used HttpCookie properties in Fig. 21.27.
21.6.2. Session Tracking with HttpSessionState
C# provides session-tracking capabilities in the Framework Class Library's HttpSessionState class. To demonstrate basic session-tracking techniques, we modified Fig. 21.26 so that it uses HttpSessionState objects. Figure 21.28 presents the ASPX file, and Fig. 21.29 presents the code-behind file. The ASPX file is similar to that presented in Fig. 21.23, except Fig. 21.28 contains two additional Labels (lines 3536 and lines 3839), which we discuss shortly.
Figure 21.28. ASPX file that presents a list of programming languages.
(This item is displayed on pages 1103 - 1105 in the print version)
Every Web Form includes an HttpSessionState object, which is accessible through property Session of class Page. Throughout this section, we use property Session to manipulate our page's HttpSessionState object. When the Web page is requested, an HttpSessionState object is created and assigned to the Page's Session property. As a result, we often refer to property Session as the Session object.
Adding Session Items
When the user presses Submit on the Web Form, submitButton_Click is invoked in the code-behind file (Fig. 21.29). Method submitButton_Click responds by adding a keyvalue pair to our Session object, specifying the language chosen and the ISBN number for a book on that language. These keyvalue pairs are often referred to as session items. Next, a postback occurs. Each time the user clicks Submit, submitButton_Click adds a new session item to the HttpSessionState object. Because much of this example is identical to the last example, we concentrate on the new features.
Figure 21.29. Creates a session item for each programming language selected by the user on the ASPX page.
Like a cookie, an HttpSessionState object can store namevalue pairs. These session items are placed in an HttpSessionState object by calling method Add. Line 74 calls Add to place the language and its corresponding recommended book's ISBN number in the HttpSessionState object. If the application calls method Add to add an attribute that has the same name as an attribute previously stored in a session, the object associated with that attribute is replaced.
The application handles the postback event (lines 3360) in method Page_Load. Here, we retrieve information about the current client's session from the Session object's properties and display this information in the Web page. The ASP.NET application contains information about the HttpSessionState object for the current client. Property SessionID (line 56) contains the unique session IDa sequence of random letters and numbers. The first time a client connects to the Web server, a unique session ID is created for that client. When the client makes additional requests, the client's session ID is compared with the session IDs stored in the Web server's memory to retrieve the HttpSessionState object for that client. Property Timeout (line 59) specifies the maximum amount of time that an HttpSessionState object can be inactive before it is discarded. Figure 21.30 lists some common HttpSessionState properties.
Displaying Recommendations Based on Session Values
As in the cookies example, this application provides a link to Recommendations.aspx (Fig. 21.31), which displays a list of book recommendations based on the user's language selections. Lines 2122 define a ListBox Web control that is used to present the recommendations to the user.
Figure 21.31. Session-based book recommendations displayed in a ListBox.
Code-Behind File That Creates Book Recommendations from a Session
Figure 21.32 presents the code-behind file for Recommendations.aspx. Event handler Page_Init (lines 1747) retrieves the session information. If a user has not selected a language on Options.aspx, our Session object's Count property will be 0. This property provides the number of session items contained in a Session object. If Session object's Count property is 0 (i.e., no language was selected), then we display the text No Recommendations and update the Text of the HyperLink back to Options.aspx.
Figure 21.32. Session data used to provide book recommendations to the user.
If the user has chosen a language, the for statement (lines 2534) iterates through our Session object's session items, temporarily storing each key name (line 27). The value in a keyvalue pair is retrieved from the Session object by indexing the Session object with the key name, using the same process by which we retrieved a value from our Hashtable in the preceding section.
Line 27 accesses the Keys property of class HttpSessionState, which returns a collection containing all the keys in the session. Line 27 indexes this collection to retrieve the current key. Lines 3133 concatenate keyName's value to the string " Howto Program. ISBN#: " and the value from the Session object for which keyName is the key. This string is the recommendation that appears in the ListBox. | https://flylib.com/books/en/2.255.1/session_tracking.html | CC-MAIN-2020-24 | en | refinedweb |
Re-imagining WSGI and Pylons
Simon Willison wrote a blog post today, about a micro-framework called djng, a light-weight stack that depends on Django. His implementation ideas seem to be quite similiar to what Pylons does already with StackedObjectProxies but I want to share with you where I've got to with the work I started 6 months ago to re-imagine Pylons. Before I get too carried away let me start at the start...
During the process of writing The Definitive Guide to Pylons I came across lots of things I thought could be improved. Anyone who's worked on a large open source project will know that getting consensus for change can be difficult, particularly if you don't have concrete ideas about how to solve the problems you can see. Anyone who's written a book about an evolving product will know that simply trying to keep on top of the changes in the existing product is an extremely difficult task and anyone who has tried to do both at the same time will realize it is quite close to impossible! I finsished the last work on the print version of the book about 6 months ago and then started work on the code for a start-up I'm launching this year (still top secret at the moment) but rather than simply taking Pylons 0.9.7 I started with an empty Python file and added in code as I needed it with a view to using as many of the Pylons components as possilbe but not including any code which had touched the problem areas I was aware of from writing the book.
What I've produced as a result is what I call an "enterprise micro-framework". It's an extremely simple architecture made of small components that would feel right at home in any home-made framework, but is powerful and complete enough to run huge multi-server systems. Now the code is more or less complete I feel in a good position to explain it and to explain why it is the most effective architecure I know for web development.
I'll start the description in this post and then hopefully blog about more aspects of the system over the next few weeks.
Let's get started...
What's Wrong with WSGI?
Actually nothing! WSGI is a stroke of brilliance and has done a huge amount to help all the Python web framework communities. The one problem with it has been how people like me interpreted this paragraph from PJE's WSGI PEP 333:.
I've used this quote in many talks myself because I felt my intreptation of it was important. It gave me a license to put any kind of service (eg database connections, templating set-ups etc) into the WSGI environment along with all the CGI-like string variables like QUERY_STRING. Since the environ object is available through a WSGI application it was a very convenient place to have all these other objects too. Pylons uses this approach quite a lot too and although it proves to be very, very useful it led PJE to write a post entitled WSGI Considered Harmful where he critisised the use of Python objects in the environment and instead suggests such things should be dealt with by instantiating objects elsewhere by passing the WSGI environ to an object which provides a particular API, rather than putting that object in the WSGi environ. Here's a pertinent quote:.
The problem with PJE's critisim is that, however ugly it appeared, the approach of adding services to the WSGI environ worked extrodinarily well and was really useful. To try to deal with PJE's critisisms there were various attempts to solve the problem by simply renaming WSGI middleware components which add services to the WSGI environment as WSGI Framework Components or WFCs so the term "WSGI middleware" did indeed refer to components that operated just on the HTTP-level, that way we could all carry on regardless.
This all might sound a bit esoteric but so for those of you who haven't used Pylons before and aren't too familiar with WSGI here's a quick run-down of how a WSGI application using the "bung it all in the environment approach" might work:
def get_posts_app(environ, start_response): connection = environ['database.pool'].connect() status = '200 OK' headers = [('Content-type', 'text/html')] start_response(status, headers) return [ '<html>\n' '<head><title>Blog Posts</title></head>\n' '<body>'\n' '<h1>Blog Posts</h1>\n' get_posts(connection) '</body>\n' '</html>\n' ]
As the request comes in it passes through the stack of WSGI middlweare and WSGI Framework Components. One of the WSGI Frameworks components adds a database connection pool to the environ dictionary as the database.pool key. The request eventually gets to the WSGI application (get_potsts_app), which is called with environ and start_response arguments. The environ argument contains all the request information and services set up by WSGI Framework Components. The start_response argument is a function created by the server so that the application can tell it the HTTP status and the headers which it needs to sen to the browser before the page itself is returned.
The interesting thing in this example is how the database connection is used. It is extracted from the environ dictionary and then passed to the get_posts() function (which I haven't shown) which would simply return the HTML for some blog posts using a database connection.
The application then returns the page as an iterable containing strings.
How Can We Make this Example Better?
Well, one approach is to get rid of start_response() and this has been discussed here and here. My interest lies elsewhere. I want to think about how we can avoid having to put things like database connection pools in the WSGI environ dictionary.
The most obvious thing which springs to mind is to pass services such as the database connection pool as arguments to the WSGI application along with environ and start_response like this:
def get_posts_app(environ, start_response, pool): connection = pool.connect() status = '200 OK' headers = [('Content-type', 'text/html')] start_response(status, headers) return [ '<html>\n' '<head><title>Blog Posts</title></head>\n' '<body>'\n' '<h1>Blog Posts</h1>\n' get_posts(connection) '</body>\n'
That's looking neater already. Now imagine I use a templating system as well as a database. The new app might look like this:
def get_posts_app(environ, start_response, pool, render): connection = pool.connect() status = '200 OK' headers = [('Content-type', 'text/html')] start_response(status, headers) return render('blog_posts.html', posts=get_posts(connection))
Now that's looking more like what you'd expect to see in a proper application framework. You can imagine that a real app might have more service arguments though.
Two Leaps of Faith
From this point I'm going to ask you to make two of leaps of faith.
Think of environ and start_response as Services
It is easy to think of pool and render as services (even though we haven't formally defined "service" yet) but I want you to also think of environ and start_response as being servies. After all, environ is an object that provides information about the request, the server and the WSGI variables, and start_response() is a service that lets you set response information. You can look at it like this: It just so happens that environ and start_response "services" have been standardised in the WSGI spec whereas pool and render haven't.
There's one problem with this "pass services as arguments" approach though: different applications need different services and we wouldn't want an API which was different for every different possible combination of services an application could use. We'll come back to this in a minute. First let's look at another problem with most web frameworks: thread-locals.
Thread-Local Hell
HTTP connections are generally very slow at getting data to and from the server so dedicating an entire process to each request is very inefficient. Instead, the same process can handle multiple requests at the same time using threads. This is great for performance put introduces a technical challenge: if you aren't careful, different threads can change each other's data, after all they are sharing the same code. The vast majority of the time you'll never notice this problem as a web developer because the framework you are using takes care of it.
In the case of Pylons, global variables are used along with StackedObjectProxies to solve the problem. Here's some psuedo-code demonstarting the sort of approach Pylons takes:
from pylons import request, response, pool, render def get_posts_app(): connection = pool.connect() response.status = '200 OK' response.content_type', 'text/html' return render('blog_posts.html', posts=get_posts(connection))
As you can see, rather than passing the services as arguments to the application, you import StackedObjectProxies from Pylons and use them as global variables. Pylons ensures that whichever thread you access the "service" from, you get the correct data for that thread. This magic all happens behind the scenes using thread-locals to make programming a multithreaded web application as easy as programming any other sort of code. Other frameworks use variations of this idea too and other components within Pylons (such as the SQLAlchemy session use their own implementation of the same idea too).
There are some problems with the thread-local approach though:
- Thread-locals used as globals are hard to understand
- They hide what is really going (which breaks the principle of least surprise)
- They make it very hard to use code that relies on the StackedObjectProxies outside of a web request because the proxy objects aren't initialised until a request starts so any code treating them as normal object won't work.
With these thought's in mind, why not avoid the threading problem completely by passing an object containing all the services we need explictily from one part of an application to another? Let's call that object state as it represents the state of the application and all its services for the particular thread which is executing. Our code instead looks like this:
def get_posts_app(state): connection = state.pool.connect() state.response.status = '200 OK' state.response.content_type', 'text/html' return state.render('blog_posts.html', posts=get_posts(connection))
This new application just takes the one argument, state, which is an object which contains all the "services" (including the WSGI environ and WSGI start_response() callable) and can be customised depending on the services the application requires. It just means there is a bit more typing (you have to type state in front of each service) and you have to adapt existing code to explicitly take a state argument rather than relying on the right data to magically appearing in the function you are using it from. Whilst this is a bit of hassle, the vast removal of complexity is well, well worth it.
Having a single state argument to the application also solves the problem of different applications requiring different services.
So that's the two leaps of faith:
- Treating environ and start_response() as just one of many services
- Having an explicit state object containing all services, passed explicitly around that application as a function argument rather than a myriad of thread-local hacks
[If you've been following this for a long time, this is pretty much what I was pushing for right at the start of Pylons in this post from 2005. I just didn't describe it as a state and I didn't describe the attributes exposed as being services]
How Do You Build the State Object?
Now we've established the beneits of a state object, let's have a think about how to build it. Before we do you need to be aware that there are actually two types of state: appliction state and request state. Let's look at some examples and think about the dependencies of each of these two types of state.
Application State vs Request State
Objects that get created when an application is first loaded into memory make up the application state. For example, database connections, template renders etc. Objects which are set up on each request make up the request state, for example Request and Response objects, an object which gives access to a session store, authentication information etc. Things which have request state are created at the start of a request and destroyed at the end of a request. Things which have application state are destroyed when the server is shut down.
Now in practice objects which have application state and those which have request state might be related. Think about our database connection pool again. Although the individual connections are created when the application is loaded and thus have application state, you might want to ensure that the same connection is used throughout a particular request so that if a problem occurs, all the changes from that request can be rolled back. This means that the object which manages a connection for a request has request state. This situation happens rather a lot.
Introducing Service Objects
With the distinction between application state and request state firmly established, let's think of what a "service" object might look like to provide an object as an attribute of state. (Hint: it looks a lot like Django middleware by coincidence):
class DatabasePoolService(object): def __init__(self, dsn): # Save the input arguments so that they can be accessed if needed elsewhere self.dsn = dsn # Set up the connection pool self.pool = make_connection_pool(dsn) def start(self, state, key): # The request is starting, create a connection for this request state['key'] = RequestSpecificConnection(self.pool.connect()) def stop(self, state, key): # Commit the changes and relase the connection back to the pool state['key'].commit() state['key'].release() def error(self, state, key): # An error occurred, rollback the changes and return the connection to the pool state['key'].rollback() state['key'].release()
An instance of this class will be created when the application is first loaded and remain in memory for the entire lifetime of the application. When it is created it initialises a connection pool which it saves as self.pool. On each request the service's start() method is called to set up any request-specific objects and add them as attributes of the state object passed as an argument. If the key argument is also passed the request-specific object should be added as that key to the state.
Using a Service Object
Now, say as a user you want to use this new database code, this is all you need to do:
# Create the state (AttributeDict is any object that behaves like a # dictionary but whose keys can be accessed as attributes) state = AttributeDict() # Create a service database_service = DatabasePoolService('mysq://[email protected]:password/test') # Start the serivce database_service.start(state, 'pool') # Run the application try: get_posts(state) except: # Handle errors database_service.error(state, 'pool') # Stop the services database_service.stop(state, 'pool')
If you have lots of services you might put them all in a dictionary and initialis them all at once:
# Create the state state = AttributeDict() # Create a service services = { 'pool': DatabasePoolService('mysq://[email protected]:password/test'), 'template': TemplateService('/path/to/templates'), } # Start the serivces for key, service in services.items(): service.start(state, key) # Run the application try: get_posts(state) except: # Handle errors for key, service in services.items(): service.error(state, key) # Stop the services for key, service in services.items(): service.start(state, key) database_service.stop(state, key)
All you need to do now is set up the environ and start_response "services" and to replace the call to get_posts(state) with some code which handles dispatch and you have the basis of an entire framework, standardised around the concept of a service:
def create_application(dsn, template_dir) # Create a service services = { 'pool': DatabasePoolService(dsn), 'template': TemplateService(template_dir), } def handle_request(environ, start_response): # Create the state state = AttributeDict() # Set up the application state state.app = services # Set up environ and start_response state.environ = environ state.start_response = start_response # Start the serivces for key, service in services.items(): service.start(state, key) # Run the application try: if state.environ.get('PATH_INFO') == '/posts': return get_posts(state) else: return handle_404(state) except: # Handle errors for key, service in services.items(): service.error(state, key) finally: # Stop the services for key, service in services.items(): service.start(state, key) database_service.stop(state, key) return handle_request
By adding new service objects to this architecture you can easily recreate a framework as sophisticated as Pylons.
It is also very suprising just how many things which are currently written as WSGI middleware can actually be re-implemented much more simply as services.
As you can probably spot, handle_request is a valid WSGI application so you could easily build a WSGI middleware stack around it rather than returning it directly.
In fact, it isn't necessary to have all the services defined in one place either. In my production version of this concept services are created only for the requests that need them (making the possibility of running this entire framework as a CGI script more plausible as only those services which are required for the particular request are instantiated). In the production version the services have dependencies amongst each other, for example the error handler service requires the mail service etc. There are also tools to extract objects from the WSGI environment to turn them into services (so that you can use Beaker session store via the state object for example). You can also create services at different parts of the middleware stack so that WSGI middleware itself can use services.
Note
If you try to apply the services+state approach to existing Pylons code relying on StackedObjectProxies you quickly find it hard work. Since this new API is so clean though it is very easy to set up attributes of the state object with the Pylons registry manager so that you can still access them as module globals when you really needed. In fact this stack can run existing Pylons 0.9.7 applications very well. One of the first things I did as a proof of concept was to see if I could get the SimpleSite tutotorial from the Pylons Book to run under this stack (including SQLAlchemy) but without the PylonsApp() instance itself and I'm pleased to say I could.
Where else can services be used?
Well that's the beauty of the services+state approach. You can use the same initialisation code anywhere you want to use the services whether in a request or not. This means there's not only no need for PylonsApp(), there's no need for environment.py, config.py and even no need to have any complex code in websetup.py. Anywhere that wants to use a service outside of a web request just sets it up in the same way and uses the state object as if it were provided in a web application. Everything is nice, clean, simple and well encapsulated. It's just so simple and I've been so close to it for so long, I can't imagine why it's taken me so long to formalise and why it isn't used more widely. [I know Aquarium used an explicit state but I'd be interested to hear of other examples.]
So What Does a Production Application Look Like?
Using this approach a production application is nothing more than a series of single functions (no classes either) which each take a state argument arranged into files. Services are created where a set of these functions all need to access similar functionality. If it helps you can think of the state argument as being to a request what the self argument is to a class method.
Once the actually controller code is broken down into nothing more than simple functions with a state argument, other aspects of the code become simpler. It becomes easy to have these functions called directly from a middleware compoment to handle something like a sign in screen (since all the dependencies are well controlled in the state object and calling the function isn't going to have any unexpected consequences).
Summing up
As I mentioned, I've been using this stack for about 6 months now and I absolutley love it. It is genuinely a real pleasure to use. The only problem is that my success encouraged me to look at other Pylons-related problems and I've also re-invented Routes, FormEncode, solutions to the problems solved by SQLAlchemy and much more. I'm currently re-inventing templating and one that's finished there won't be any Pylons left in my Pylons-like stack. I'm not saying that's necessarily a good thing, (after all Pylons rocks!) but I have found it very refreshing trying to re-tackle every problem solved by Pylons to see if any parts can be improved. I'll try to blog about some of the more interesting experiences when I get chance.
I'm also very excited that a similar thing is happening in the Django community because if Django ends up with a similar refator there would be no problem in mixing and matching Django and Pylons components, without necessrily requiring either Django or Pylons and that could be quite a future.
If you are interested in microframeworks or in the approach I've taken here please get in touch. I'm happy to post comments you email me here. | https://www.jimmyg.org/blog/2009/pylons-as-a-microframework.html | CC-MAIN-2020-24 | en | refinedweb |
flame_texturepacker
A flame plugin to import spritesheets generated by TexturePacker
Install from Dart Pub
Include the following to your pubspec.yaml file:
dependencies: flame_texturepacker: any
Usage
Drop generated spritesheet image into the
assets/images/ folder and the spritesheet json into
assets/ and link the files in your
pubspec.yaml file:
assets: - assets/spritesheet.json - assets/images/spritesheet.png
import the plugin like this:
import 'package:flame_texturepacker/flame_texturepacker.dart';
generate a list of Sprites from the provided spritesheet:
List<Sprites> sprites = await TexturepackerLoader.fromJSONAtlas('spritesheet.png', 'spritesheet.json');
the list can be used to generate an Animation as well:
Animation anim = Animation.spriteList( sprites, stepTime: 0.1, loop: true, );
Full working example can be found in example folder. | https://pub.dev/documentation/flame_texturepacker/latest/ | CC-MAIN-2020-05 | en | refinedweb |
Before you start getting mad at me first a disclaimer: I really think you should adhere to the DRY (don’t repeat yourself) principle. But in my opinion the term “code duplication” is too weak and blurry and should be rephrased.
Let me start with a real life story from a few weeks ago that lead to a fruitful discussion with some fellow colleagues and my claims.
The story
We are developing a system using C#/.NET Core for managing network devices like computers, printers, IP cameras and so on in a complex network infrastructure. My colleague was working on a feature to sync these network devices with another system. So his idea was to populate our carefully modelled domain entities using the JSON-data from the other system and compare them with the entities in our system. As this was far from trivial we decided to do a pair-programming session.
We wrote unit tests and fixed one problem after another, refactored the code that was getting messing and happily chugged along. In this process it became more and more apparent that the type system was not helping us and we required quite some special handling like custom
IEqualityComparers and the like.
The problem was that certain concepts like AddressPools that we had in our domain model were missing in the other system. Our domain handles subnets whereas the other system talks about ranges. In our system the entities are persistent and have a database id while the other system does not expose ids. And so on…
By using the same domain model for the other system we introduced friction and disabled benefits of C#’s type system and made the code harder to understand: There were several occasions where methods would take two
IEnumerables of
NetworkedDevices or
Subnets and you needed to pay attention which one is from our system and which from the other.
The whole situation reminded me of a blog post I read quite a while ago:
Obviously, we were using the wrong abstraction for the entities we obtained from the other system. We found ourselves somewhere around point 6. in Sandy’s sequence of events. In our effort to reuse existing code and avoid code duplication we went down a costly and unpleasant path.
Illustration by example
If code duplication is on the method level we may often simply extract and delegate like Uncle Bob demonstrates in this article. In our story that would not have been possible. Consider the following model of Price and Discount e-commerce system:
public class Price { public final BigDecimal amount; public final Currency currency; public Price(BigDecimal amount, Currency currency) { this.amount = amount; this.currency = currency; } // more methods like add(Price) } public class Discount { public final BigDecimal amount; public final Currency currency; public Discount(BigDecimal amount, Currency currency) { this.amount = amount; this.currency = currency; } // more methods like add(Discount<span data-</span>) }
The initial domain entities for price and discount may be implemented in the completely same way but they are completely different abstractions. Depending on your domain it may be ok or not to add two discounts. Discounts could be modelled in a relative fashion like “30 % off” using a base price and so. Coupling them early on by using one entity for different purposes in order to avoid code duplication would be a costly error as you will likely need to disentangle them at some later point.
Another example could be the initial model of a name. In your system Persons, countries and a lot of other things could have a name entity attached which may look identical at first. As you flesh out your domain it becomes apparent that the names are different things really: person names should not be internationalized and sometimes obey certain rules. Country names in contrast may very well be translated.
Modified code duplication claim
Duplicated code is the root of all evil in software design.
— Robert C. Martin
I would like to reduce the temptation of eliminating code duplication for different abstractions by modifying the well known claim of Uncle Bob to be a bit more precise:
Duplicated code for the same abstraction is the root of all evil in software design.
If you introduce coupling of independent concepts by eliminating code duplication you open up a new possibility for errors and maintenance drag. And these new problems tend to be harder to spot and to resolve than real code duplication.
Duplication allows code to evolve independently. I think it is important to add these two concepts to your thinking. | https://schneide.blog/category/year/2019/ | CC-MAIN-2020-05 | en | refinedweb |
Provided by: gnutls-doc_3.0.11+really2.12.14-5ubuntu3_all
NAME
gnutls_openpgp_privkey_get_preferred_key_id - API function
SYNOPSIS
#include <gnutls/openpgp.h> int gnutls_openpgp_privkey_get_preferred_key_id(gnutls_openpgp_privkey_t key, gnutls_openpgp_keyid_t keyid);
ARGUMENTS
gnutls_openpgp_privkey_t key the structure that contains the OpenPGP public key. gnutls_openpgp_keyid_t keyid the struct to save the keyid.
DESCRIPTION
Get the preferred key-id for the key.
RETURNS
the 64-bit preferred keyID of the OpenPGP key, or if it hasn't been set it returns GNUTLS_E_INVALID_REQUEST..12.6gnutls_openpgp_privkey_get_preferred_key_id(3) | http://manpages.ubuntu.com/manpages/precise/man3/gnutls_openpgp_privkey_get_preferred_key_id.3.html | CC-MAIN-2020-05 | en | refinedweb |
#include <attachmentloadjob.h>
Detailed Description
A base class for jobs to load attachments from different sources.
Definition at line 35 of file attachmentloadjob.h.
Constructor & Destructor Documentation
Creates a new attachment load job.
- Parameters
-
Definition at line 32 of file attachmentloadjob.cpp.
Destroys the attachment load job.
Definition at line 38 of file attachmentloadjob.cpp.
Member Function Documentation
Returns the loaded attachment.
Definition at line 48 of file attachmentloadjob.cpp.
Subclasses use this method to set the loaded
part.
Definition at line 53 of file attachmentloadjob.cpp.
Starts the attachment load job.
Definition at line 43 of file attachmentloadjob.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2020 The KDE developers.
Generated on Fri Jan 17 2020 04:24:58 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online. | https://api.kde.org/kdepim/messagelib/html/classMessageCore_1_1AttachmentLoadJob.html | CC-MAIN-2020-05 | en | refinedweb |
Adrian Brenton8,110 Points
Hello all I'm unsure how to solve this challenge. I've tried a function also - no luck, please advise, many thanks
I've tried defining a function for this, to no avail, and am a bit stuck with this challenge.
Not sure if my logic is flawed, or if I'm making a silly mistake with this one here.
Help would be very much appreciated!
Many Thanks
import sys start_movie = input("Do you want to start the movie? Y/n") if start_movie != "n" or "N": print("Enjoy the show! ") else: sys.exit()
1 Answer
Steve HunterTreehouse Moderator 57,561 Points
Hi Adrian,
You have to write the conditional tests in full; you can't use
or like that.
You'd need to have:
if start_movie != "n" or start_movie != "N":
However, working through your logic, you'd need both to be
!= so you should use
and. Alternatively, use
.lower() to simplify the tests:
if start_movie.lower() != "n":
I hope that helps,
Steve.
Adrian Brenton8,110 Points
Adrian Brenton8,110 Points
Many thanks Steve - much appreciated! | https://teamtreehouse.com/community/hello-all-im-unsure-how-to-solve-this-challenge-ive-tried-a-function-also-no-luck-please-advise-many-thanks | CC-MAIN-2020-05 | en | refinedweb |
Introduction: ESP32 Long Distance - LoRaWan
In this article, we are going to discuss LoRaWAN, a network that travels with little energy. But for just how far? With the chip I use in the video, the ESP32, the control distance reaches 3.6 kilometers. So today, we talk about the characteristics of the chip and the LoRa network, which was practically made for IoT (Internet of Things).
In the assembly, in the example of Heltec, with the ESP32 plus the SX1276 chip, we have Sender sending the data packet to the Receiver. In the green head device, the Receiver, we have the signal that is at -9dB. This is because the antennas are practically glued and extremely close, but as you move them away from each other, you can see that the signal strength decreases, reaching -124dB when you stop to receive the information. In the same display, Rx9 bytes indicate the packet size and Hello is the string that the yellow cable device, Sender, is sending. In Sender, we also have a LED flashing at 500 milliseconds.
Teacher Notes
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: ESP32 LoRaWan
Concerning my ESP32 cards, I bought them with the LoRa chips already built-in. These development kits already come with display, which I consider advantageous. So we dismantled the kit. Under the device, we can see the information on the SX1276 chip.
It is important to remember that the ESP32 has three chips: Flash memory, Espressif, which is the processor of Tensilica, and also there is a USB to Serial Ttl, of Silicon Labs. In the case of this development kit, we also have a fourth chip, which is the SX1276.
Step 2: How the LoRa Network Is Used
To understand the use of the network, we have the LoRa chips communicating with each other, measuring geographic position, temperature, pressure, humidity, and all the information that is analyzed through the IoT in the LoRa network. We then have a hub, the Gateway, which receives all these signals. This is going to enter the TCP / IP network LoRaWAN SSL and then follow to a server side, a more robust thing, IBM Watson, Amazon, in short, the data is processed at another level.
Step 3: Key Features of LoRa Technology and LoRaWAN Protocol
Here, I show some characteristics of the LoRa technology and the LoRaWAN protocol.
I emphasize that the idea of this network LoRa is not for you to send multimedia content, but to send packages of data of reading.
LoRaWAN Protocol
LoRaWAN is a protocol specification built upon the LoRa technology developed by the LoRa Alliance. It uses unlicensed radio spectrum in the Industrial, Scientific, and Medical (ISM) bands to enable low power and wide area communication between remote sensors and gateways connected to the network. This standards-based approach to building an LPWAN enables the rapid deployment of public or private IoT networks anywhere using hardware and software that is bi-directional, secure, interoperable, and mobile, which provides a precise location and works the way you would expect it to.
Step 4: CHIP Sx1276
Then, by disassembling the development kit, we unscrew the display and locate the LoRa chip, created by the French company Semtech. Here, I have a table taken from the Datasheet with information of this device on the 1276, 1277, 1278, and 1279 models. The difference is more in frequency.
Step 5: ESP32 LoRa X ESP32 WiFi
Comparing the traditional ESP32 with ESP32 LoRa, we again point out that the traditional has three chips, while LoRa has four. This fourth chip, in this case, is the sx1276.
It is connected via the SPI port. As for OLED Flat, it is connected to i2c.
Step 6: ESP32 LoRa Pinout
It is important to note the pins that are already occupied.
Step 7: Test
ESP32 LoRaWAN TTGO To perform the test, we took the chips from TTGO, put on an antenna and battery, and walked out. Right away, we found it running at 915 MHz. We tested the 433 MHz as well.
We set up a packet to send Sender to the Receiver. The second will receive this packet and measure the signal strength in dB, which will show on the display. In this way, it will be possible for you to perform a test. I also intend to do this using my drone, which travels up to 7 kilometers, to see how far I can get.
Step 8: ESP32 LoRaWAN - Heltec
This is Heltec's model, which is at 433 MHz and works very well. If you are looking to buy an ESP32, I recommend this brand because it has a Lib inside the Arduino IDE, which makes handling easier.
Step 9: Lib and Heltec Examples
Heltec examples are in GitHub.
Below is the path to locate the source code of your computer after installation.
C: \ Program Files (x86) \ Arduino \ hardware \ heltec \ esp32 \ libraries \ LoRa \ examples \ OLED_LoRa_Sender
Step 10: Manual PDF
I translated the manual from Portuguese and will deliver it to you in a PDF file.
Register to my email list:
You will receive a message confirming your application. Check your inbox, as well as your spam box, among others.
With the confirmed registration, I will send you a second email with the download link from the manual: "How to install Arduino IDE ESP32 LoRa - Heltec on Windows".
Step 11: Source Code
Today, we have two .INO programs, the Sender and the Receiver.
Sender and Receiver
First, I declare the SPI pins and set the radio frequency, that is, I make all the necessary statements.
#include <spi.h> //responsável pela comunicação serial
#include <lora.h> //responsável pela comunicação com o WIFI Lora #include <wire.h> //responsável pela comunicação i2c #include "SSD1306.h" //responsável pela comunicação com o display #include "images.h" //contém o logo para usarmos ao iniciar o display // Definição dos pinos #define SCK 5 // GPIO5 -- SX127x's SCK #define MISO 19 // GPIO19 -- SX127x's MISO #define MOSI 27 // GPIO27 -- SX127x's MOSI #define SS 18 // GPIO18 -- SX127x's CS #define RST 14 // GPIO14 -- SX127x's RESET #define DI00 26 // GPIO26 -- SX127x's IRQ (Interrupt Request) #define BAND 915E6 //Frequencia do radio - podemos utilizar ainda : 433E6, 868E6, 915E6 #define PABOOST true
Sender: OLED_LoRa_Sender.ino
Here, I have the display that is connected to the i2c pins and the strings.
//variável responsável por armazenar o valor do contador (enviaremos esse valor para o outro Lora)
unsigned int counter = 0; //parametros: address,SDA,SCL SSD1306 display(0x3c, 4, 15); //construtor do objeto que controlaremos o display String rssi = "RSSI --"; String packSize = "--"; String packet ;
Setup: OLED_LoRa_Sender.ino
Here, we configure the pins as output, as well as the actions of the display. We initiate LoRa communication and configure the pins that will be used by the library.
Highlight: Every time you connect the ESP32 to the LoRa network, it checks if the antenna is plugged into the Pigtail connector, because if you connect to the USB without it being connected to the antenna, you can burn the transmitter chip.
void setup()
{ //configura os pinos como saida pinMode(16,OUTPUT); //RST do oled pinMode(25,OUTPUT); digitalWrite(16, LOW); // reseta o OLED delay(50); digitalWrite(16, HIGH); // enquanto o OLED estiver ligado, GPIO16 deve estar HIGH display.init(); //inicializa o display display.flipScreenVertically(); display.setFont(ArialMT_Plain_10); //configura a fonte para um tamanho maior //imprime o logo na tela logo(); delay(1500); display.clear(); //apaga todo o conteúdo da tela do display SPI.begin(SCK,MISO,MOSI,SS); //inicia a comunicação serial com o Lora LoRa.setPins(SS,RST,DI00); //configura os pinos que serão utlizados pela biblioteca (deve ser chamado antes do LoRa.begin) //inicializa o Lora com a frequencia específica. if (!LoRa.begin(BAND,PABOOST)) { display.drawString(0, 0, "Starting LoRa failed!"); display.display(); //mostra o conteúdo na tela while (1); } //indica no display que inicilizou corretamente. display.drawString(0, 0, "LoRa Initial success!"); display.display(); //mostra o conteúdo na tela delay(1000); }
Loop: OLED_LoRa_Sender.ino
Here's how to assemble a package and turn on the LED.
void loop()
{ //apaga o conteúdo do display display.clear(); display.setTextAlignment(TEXT_ALIGN_LEFT); display.setFont(ArialMT_Plain_16); display.drawString(0, 0, "Sending packet: "); display.drawString(40, 26, String(counter)); display.display(); //mostra o conteúdo na tela / //incrementa uma unidade no contador counter++; digitalWrite(25, HIGH); // liga o LED indicativo delay(500); // aguarda 500ms digitalWrite(25, LOW); // desliga o LED indicativo delay(500); // aguarda 500ms }
Print - Logo: OLED_LoRa_Sender.ino
This function only prints the logo on the display.
//essa função apenas imprime o logo na tela do display
void logo() { //apaga o conteúdo do display display.clear(); //imprime o logo presente na biblioteca "images.h" display.drawXbm(0,5,logo_width,logo_height,logo_bits); display.display(); }
Setup: OLED_LoRa.Reciver.ino
We start LoRa here with the specific frequency, we point the correct initialization in the display, and we enable LoRa to receive the data sent by Sender. We also check the receipt of the package.
//inicializa o Lora com a frequencia específica.
if (!LoRa.begin(BAND,PABOOST)) { display.drawString(0, 0, "Starting LoRa failed!"); display.display(); while (1); } //indica no display que inicilizou corretamente. display.drawString(0, 0, "LoRa Initial success!"); display.drawString(0, 10, "Wait for incomm data..."); display.display(); delay(1000); //LoRa.onReceive(cbk); LoRa.receive(); //habilita o Lora para receber dados } void loop() { //parsePacket: checa se um pacote foi recebido //retorno: tamanho do pacote em bytes. Se retornar 0 (ZERO) nenhum pacote foi recebido int packetSize = LoRa.parsePacket(); //caso tenha recebido pacote chama a função para configurar os dados que serão mostrados em tela if (packetSize) { cbk(packetSize); //função responsável por recuperar o conteúdo do pacote recebido delay(10); } }
Print on OLED: OLED_LoRa.Reciver.ino
Here, we configure the information that will appear on the display.
//função responsável por configurar os dados que serão exibidos em tela.
//RSSI : primeira linha //RX packSize : segunda linha //packet : terceira linha void loraData(){ display.clear(); display.setTextAlignment(TEXT_ALIGN_LEFT); display.setFont(ArialMT_Plain_16); display.drawString(0 , 18 , "Rx "+ packSize + " bytes"); display.drawStringMaxWidth(0 , 39 , 128, packet); display.drawString(0, 0, rssi); display.display(); }
Step 12:
Be the First to Share
Recommendations
2 Discussions
1 year ago
Sad that you are mixing languages! It makes it less informative and harder to understand.
1 year ago on Step 11
Your code doesn't work on my computer for the sender.
when do you think finish your Tuto ? | https://www.instructables.com/id/ESP32-Long-Distance-LoRaWan/ | CC-MAIN-2020-05 | en | refinedweb |
#include <modelinvariantrowmapper.h>
Detailed Description
This class is an optimizing helper for dealing with large flat QAbstractItemModel objects.
The problem:
When you're an user of a flat QAbstractItemModel you access its contents by the means of QModelIndex. The model index is basically a row index (for flat models). You usually fetch some data for a row and then store the row index in order to fetch more data later (think of a tree view that shows the "name" for an item but when clicked needs to open a window with the details associated to the item).
The problem is that your row indexes may become invalid when rows are added or removed from the model. For instance, if a row is added at position 10, then any cached index after position 10 must be updated in order to point to the same content. With very large models this can become a problem since the update must be somewhat "atomic" in order to preserve consistency. Atomic, then, means "unbreakable": you can't chunk it in smaller pieces. This also means that your application will simply freeze if you have a model with 100000 cached indexes and a row is added/removed at the beginning. Yet worse: your app will freeze EVERY time a row is added. This means that if you don't really optimize, or just add non contiguous rows, you must do the update multiple times...
This class tries to solve this problem with a little overhead. It basically gives you a ModelInvariantIndex for each "new" row you query. Later the model may change by addition/removal of rows but with a ModelInvariantIndex you will still be able to retrieve the content that the index was pointing to at the time it was created.
You don't need to implement any row update in your rowsInserted() / rowsRemoved() handlers. Just call the modelRowsInserted() modelRowsRemoved() functions: they will do everything for you in a substantially constant time.
As the model structure changes the lookups will get a bit slower since the row mapper must apply the changes sequentially to each invariant. To avoid this, and to avoid storing the whole history of changes the ModelInvariantRowMapper will perform a background update of your ModelInvariantIndex objects. You don't need to care about this: it will happen automagically.
The ModelInvariantIndex allocation and destruction is in fact left to you. This is a GOOD approach because you're very likely to have some sort of structures associated to the items you display. You may then simply derive your objects from ModelInvariantIndex. This will save an additional memory allocation for each one of your items (we are optimizing, aren't we ?) and you will be able to dynamic_cast<> the ModelInvariantIndex pointers directly to your structure pointers (which will likely save a large QHash<>...). Even in the unlikely case in that you don't have a data structure for your items, it's still an operator new() call that YOU make instead of this implementation. It doesn't impact performance at all. You just have to remember to delete your ModelInvariantIndex objects when you no longer need them.
Definition at line 86 of file modelinvariantrowmapper.h.
Member Function Documentation
Binds a ModelInvariantIndex structure to the specified CURRENT modelIndexRow.
Later you can use the ModelInvariantIndex to retrieve the model contents that the parameter modelIndexRow refers to... even if the model changes. Call this function only if you're sure that there is no such invariant yet, otherwise take a look at modelIndexRowToModelInvariantIndex().
This function ASSUMES that invariantToFill is a newly allocated ModelInvariantIndex.
Definition at line 339 of file modelinvariantrowmapper.cpp.
This basically applies modelIndexRowToModelInvariantIndex() to a range of elements.
The returned pointer can be null if no existing ModelInvariantIndex object were present in the range (this can happen if you don't request some of them). If the returned value is not 0 then you're responsable of deleting it.
Definition at line 358 of file modelinvariantrowmapper.cpp.
Finds the existing ModelInvariantIndex that belongs to the specified CURRENT modelIndexRow.
Returns the ModelInvariantIndex found or 0 if such an invariant wasn't yet created (by the means of createModelInvariantIndex()).
Definition at line 353 of file modelinvariantrowmapper.cpp.
Maps a ModelInvariantIndex to the CURRENT associated row index in the model.
As long as the underlying model is consistent, the returned row index is guaranteed to point to the content that this ModelInvariantIndex pointed at the time it was created.
Returns the current associated row index in the model or -1 if the invariant does not belong to this mapper (model) or is marked as invalid at all.
Definition at line 247 of file modelinvariantrowmapper.cpp.
Call this function from your handlers of reset() and layoutChanged() AFTER you ve last accessed the model underlying data.
You probably want this function to be the first call of your reset() or layoutChanged() handlers.
This function assumes that all the ModelInvariantIndex are being invalidated and need to be requeried.
Definition at line 560 of file modelinvariantrowmapper.cpp.
Call this function when rows are inserted to the underlying model BEFORE scanning the model for the new items.
You probably want this function to be the first call in your rowsInserted() handler or the last call in the rowsAboutToBeInserted() handler.
Definition at line 387 of file modelinvariantrowmapper.cpp.
Call this function when rows are removed from the underlying model AFTER accessing the removed rows for the last time.
You probably want this function to be the first call of your rowsRemoved() handler or the last call in the rowsAboutToBeRemoved() handler.
This function will invalidate any ModelInvariantIndex instances that are affected by the change. It will also do you a favor by returning the list of the invalidated ModelInvariantIndex objects since you'll probably want to delete them. The returned pointer can be null if no existing ModelInvariantIndex object were affected by the change (this can happen if you don't request some of them). If the returned value is not 0 then you're responsable of deleting it.
Definition at line 450 of file modelinvariantrowmapper.cpp.
Sets the maximum time we can spend inside a single lazy update step.
The larger this time, the more resources we consume and leave less to UI processing but also larger the update throughput (that is, we update more items per second). This is 50 msec by default.
Definition at line 237 of file modelinvariantrowmapper.cpp.
Sets the idle time between two lazy updates in milliseconds.
The larger this time, the less resources we consume and leave more to UI processing but also smaller the update throughput (that is, we update less items per second). This is 50 msec by default.
Definition at line 242 of file modelinvariantrowmapper.c. | https://api.kde.org/kdepim/messagelib/html/classMessageList_1_1Core_1_1ModelInvariantRowMapper.html | CC-MAIN-2020-05 | en | refinedweb |
import "go.chromium.org/luci/server/auth/internal"
func RegisterClientFactory(f ClientFactory)
RegisterClientFactory allows external module to provide implementation of the ClientFactory.
This is needed to resolve module dependency cycle between server/auth and server/auth/internal.
See init() in server/auth/client.go.
If client factory is not set, Do(...) uses http.DefaultClient. This happens in unit tests for various auth/* subpackages.
WithTestTransport puts a testing transport in the context to use for fetches.
ClientFactory knows how to produce http.Client that attach proper OAuth headers.
If 'scopes' is empty, the factory should return a client that makes anonymous requests.
type Request struct { Method string // HTTP method to use URL string // URL to access Scopes []string // OAuth2 scopes to authenticate with or anonymous call if empty Headers map[string]string // optional map with request headers Body interface{} // object to convert to JSON and send as body or []byte with the body Out interface{} // where to deserialize the response to }
Request represents one JSON REST API request.
Do performs an HTTP request with retries on transient errors.
It can be used to make GET or DELETE requests (if Body is nil) or POST or PUT requests (if Body is not nil). In latter case the body will be serialized to JSON.
Respects context's deadline and cancellation.
TestTransportCallback is used from unit tests.
Package internal imports 10 packages (graph) and is imported by 8 packages. Updated 2019-12-21. Refresh now. Tools for package owners. | https://godoc.org/go.chromium.org/luci/server/auth/internal | CC-MAIN-2020-05 | en | refinedweb |
Errors can be broadly categorized into two types. We will discuss them one by one.
Compile Time Errors – Errors caught during compiled time is called Compile time errors. Compile time errors include library reference, syntax error or incorrect class import.
Run Time Errors - They are also known as exceptions. An exception caught during run time creates serious issues.
Errors hinder normal execution of program. Exception handling is the process of handling errors and exceptions in such a way that they do not hinder normal execution of the system. For example, User divides a number by zero, this will compile successfully but an exception or run time error will occur due to which our applications will be crashed. In order to avoid this we'll introduce exception handling technics in our code.
In C++, Error handling is done using three keywords:
Syntax:
try { //code throw parameter; } catch(exceptionname ex) { //code to handle exception }
tryblock
The code which can throw any exception is kept inside(or enclosed in) a
try block. Then, when the code will lead to any error, that error/exception will get caught inside the
catch block.
catchblock
catch block is intended to catch the error and handle the exception condition. We can have multiple catch blocks to handle different types of exception and perform different actions when the exceptions occur. For example, we can display descriptive messages to explain why any particular excpetion occured.
throwstatement
It is used to throw exceptions to exception handler i.e. it is used to communicate information about error. A
throw expression accepts one parameter and that parameter is passed to handler.
throw statement is used when we explicitly want an exception to occur, then we can use
throw statement to throw or generate that exception.
Let's take a simple example to understand the usage of try, catch and throw.
Below program compiles successfully but the program fails at runtime, leading to an exception.
#include <iostream>#include<conio.h> using namespace std; int main() { int a=10,b=0,c; c=a/b; return 0; }
The above program will not run, and will show runtime error on screen, because we are trying to divide a number with 0, which is not possible.
How to handle this situation? We can handle such situations using exception handling and can inform the user that you cannot divide a number by zero, by displaying a message.
try,
catchand
throwStatement
Now we will update the above program and include exception handling in it.
#include <iostream> #include<conio.h> using namespace std; int main() { int a=10, b=0, c; // try block activates exception handling try { if(b == 0) { // throw custom exception throw "Division by zero not possible"; c = a/b; } } catch(char* ex) // catches exception { cout<<ex; } return 0; }
Division by zero not possible
In the code above, we are checking the divisor, if it is zero, we are throwing an exception message, then the
catch block catches that exception and prints the message.
Doing so, the user will never know that our program failed at runtime, he/she will only see the message "Division by zero not possible".
This is gracefully handling the exception condition which is why exception handling is used.
catchblocks
Below program contains multiple
catch blocks to handle different types of exception in different way.
#include <iostream> #include<conio.h> using namespace std; int main() { int x[3] = {-1,2}; for(int i=0; i<2; i++) { int ex = x[i]; try { if (ex > 0) // throwing numeric value as exception throw ex; else // throwing a character as exception throw 'ex'; } catch (int ex) // to catch numeric exceptions { cout << "Integer exception\n"; } catch (char ex) // to catch character/string exceptions { cout << "Character exception\n"; } } }
Integer exception Character exception
The above program is self-explanatory, if the value of integer in the array
x is less than 0, we are throwing a numeric value as exception and if the value is greater than 0, then we are throwing a character value as exception. And we have two different
catch blocks to catch those exceptions.
catchblock in C++
Below program contains a generalized
catch block to catch any uncaught errors/exceptions.
catch(...) block takes care of all type of exceptions.
#include <iostream> #include<conio.h> using namespace std; int main() { int x[3] = {-1,2}; for(int i=0; i<2; i++) { int ex=x[i]; try { if (ex > 0) throw ex; else throw 'ex'; } // generalised catch block catch (...) { cout << "Special exception\n"; } } return 0; }
Special exception Special exception
In the case above, both the exceptions are being catched by a single
catch block. We can even have separate
catch blocks to handle integer and character exception along with th generalised
catch block.
There are some standard exceptions in C++ under <exception> which we can use in our programs. They are arranged in a parent-child class hierarchy which is depicted below: | https://www.studytonight.com/cpp/exception-handling-in-cpp.php | CC-MAIN-2020-05 | en | refinedweb |
.
What is Project Calico? It’s a virtual networking implementation for Linux, targeting high-density virtualization and container (Docker) environments. It comes with Neutron plug-in (and a few other plugins), making it immediately usable in OpenStack deployments.
How does it work? The virtual network is modeled as a single microsegmented flat VLAN with shared IP address space. iptables (packet filters implemented in Linux hosts) are used to implement tenant separation.
However, the creators of Calico know that a single flat VLAN doesn’t scale, so they added an interesting twist almost identical to my IPv6 microsegmentation ideas:
- Every Linux host is an IP router running BGP;
- Virtual machines (or containers) are attached to a virtual router, not a bridge (similar to what Juniper Contrail or Microsoft Hyper-V are doing);
- Host routes are used for end-to-end packet forwarding between customer endpoints and distributed between Linux hosts with BGP;
- BGP route reflectors (also running on Linux hosts) are used to build a scalable routing control plane.
This architecture retains the properties of a flat layer-2 network (it’s easy to move customer IP addresses between hosts), but scales much better – the number of active endpoints on the layer-2 segment is equal to the number of physical hosts, not the number of virtual machines or containers.
The flooding across the physical layer-2 network is also reduced to a minimum. Unless you want to deploy IP multicast across customer workload, you won’t see much more than ARP requests between physical hosts in the transport VLAN (it’s highly unlikely that a hypervisor host remains silent for a long enough time to trigger unknown unicast flooding).
The Obvious Problems
Project Calico uses a single microsegmented network, resulting in the obvious drawbacks of microsegmentation:
- Single forwarding domain, which makes service insertion way harder to implement than multiple forwarding domains. You could (in theory) use iptables on Linux hosts to implement service insertion with PBR, but I’m positive I don’t want to see the results or be involved in a troubleshooting session;
- Provider-coordinated IP addresses. When multiple tenants share the same IP address space, someone has to coordinate the addresses, which means that you cannot simply migrate your existing workload into such a cloud (unless you’re running new-age applications that rely exclusively on DNS and mechanisms like service registration and discovery);
- No overlapping IP addresses. The creators of Project Calico recognized the problem and proposed a “solution” using 464XLAT (emulating end-to-end IPv4 with a sequence of NAT46 and NAT64). I definitely wouldn’t want to be anywhere nearby a cloud that uses this approach (see also RFC 1925, section 2.3);
If you’re willing to accept these limitations, and offer cloud services where you force the tenants to use provider-supplied IP addresses (Amazon figured out years ago that they cannot do that), Project Calico might be a perfect fit for your private or public cloud… unless you want to build a scalable environment.
I’m also wondering about the performance of the solution, as (based on my experience with virtual appliances) Linux IP stack isn’t exactly the fastest IP forwarding mechanism in the universe, but maybe I’m wrong… or maybe few Gbps per host (which hopefully has 2 10Gbps uplinks) is still ludicrous speed.
The Big Problems
The router-in-hypervisor approach is definitely the right way to go (it’s used by reasonably-scalable networks like Amazon VPC), but the flat VLAN transport between hypervisor hosts kills the beauty of the concept for environments that need more than one or two switches – you’re forced to deploy fragile kludges like MLAG, proprietary layer-2 fabrics, or concoctions that would make MacGyver proud.
Do I have to emphasize yet again that every layer-2 domain represents a single failure domain and that it inevitably fails sooner or later?
Alternatively, you could use a real IP fabric and dump all host routes into physical switches using BGP between hypervisor hosts and physical switches… and kill scalability because you’d become dependent on the L3 table sizes in physical switches.
Finally, you might decide to do route summarization on the ToR switches (resulting in an architecture very similar to my microsegmentation ideas), which seems to be the next step that the Project Calico engineers are thinking about, but then you’d lose the ability to migrate VMs… or you might get really smart and advertise out-of-rack host routes and summarize the in-rack routes.
Can It Be Fixed?
Of course it might be possible to fix the Project Calico architecture to support true multi-tenancy and multiple routing domains:
- Use overlay virtual networks to decouple hypervisor-based packet forwarding from the transport network;
- Replace simple BGP with MPLS/VPN or EVPN.
If this description sounds a lot like an existing product, you’re absolutely right. Fixing Project Calico to address the not-so-very-insignificant corner cases would turn its architecture into something very close to Juniper Contrail.
Unfortunately, I don’t expect to see anything along these lines anytime soon. It’s relatively easy to take existing open-source components and add some glue; writing a proper multi-tenant control plane (using BGP or something else) from scratch is a totally different ballgame.
For another perspective on these same issues, read the blog post by Christopher Liljenstolpe, the original architect of Project Calico.
Related posts by categories
Please read our Blog Commenting Policy before writing a comment.
8 comments:
Constructive courteous comments are most welcome. Anonymous trolling will be removed with prejudice.
I looked at Calico from an enterprise perspective i.e. no multi-tenancy. What I liked was turning the hypervisor into a router and exchanging host routes with the ToR. I also liked the direct connectivity between virtual machines and physical servers whether they are databases, or backup systems, etc. without a need for an overlay connecting to a gateway of some sort.
I do think scalability could be limited with all the host routes being advertised into the core switching environment. As you stated, summarization at the ToR, could be an answer.
You note that you have a concern with IP forwarding in Linux. Would this be similar to the performance of a vxlan gateway in kernel in a hypervisor such as ESX?
All in all, I thought it was a clever solution to avoid an overlay network deployment. For my enterprise though, it is not going to work in the near future since we have standardized on VMware.
There is significant issue with single forwarding VLAN.Single L2 domain.When that one breaks,everything falls apart.Butterfly effect:)
I also looked at it, but without a multi-tenant control/forwarding plane it's kind of a non-starter these days. I haven't kept up but 6WIND was going to contribute changes to Quagga to support VRFs through Linux network namespaces. On the Quagga side it could be represented by a different physical interface or VLAN or whatever.
Thanks for picking up this topic.
Is Callico basically host routing per tenant with some proxy ARP on the vRouter ? Would be great if a network picture could be added to this article to make it clearer.
Does Amazon VPC do the same thing alongwith some type of MPLS VPN/ EVPN ?
As always, follow the links in the blog post for more details, including packet forwarding diagrams.
Very interesting read. We are actually using Calico at our Bare Metal servers for our front-ended Elastic Cloud Routers we deploy. We are a pure L3 design where we do eBGP from the Calico/BIRD container on the BMS up to the LEAF, and then iBGP up to the SPINE. Route-Reflection and all the like is in place, so scalability is there. Our workloads are able to spin up fine etc.. The key for us though, is we aren't a multi-tenant environment for the edge use case. It's purely for ingest. I'm really looking forward to seeing where they take Calico over the years, and also if they focus solely on the container world, or lean more towards OpenStack integration and beef up their Neutron integrations.
I'm confused on the single flat VLAN you are referring to. It's possible to build multiple subnets using Calico.
Focus on what you need as the transport network between the hypervisor hosts. | https://blog.ipspace.net/2015/06/project-calico-is-it-any-good.html | CC-MAIN-2020-05 | en | refinedweb |
In this tutorial we’ll explore the
Service component and its superclass, the
IntentService. You'll learn when and how to use this component to create great concurrency solutions for long-running background operations. We’ll also take quick look at IPC (Inter Process Communication), to learn how to communicate with services running on different processes.
To follow this tutorial you'll need some understanding of concurrency on Android. If you don’t know much about it, you might want to read some of our other articles about the topic first.
- Android SDKAndroid From Scratch: Background OperationsPaul Trebilcox-Ruiz
- AndroidUnderstanding AsyncTask Values in 60 SecondsPaul Trebilcox-Ruiz
- Android SDKUnderstanding Concurrency on Android Using HaMeRTin Megali
- Android SDKPractical Concurrency on Android With HaMeRTin Megali
1. The Service Component
The
Service component is a very important part of Android's concurrency framework. It fulfills the need to perform a long-running operation within an application, or it supplies some functionality for other applications. In this tutorial we’ll concentrate exclusively on
Service’s long-running task capability, and how to use this power to improve concurrency.
What is a Service?
A
Service is a simple component that's instantiated by the system to do some long-running work that doesn't necessarily depend on user interaction. It can be independent from the activity life cycle and can also run on a complete different process.
Before diving into a discussion of what a
Service represents, it's important to stress that even though services are commonly used for long-running background operations and to execute tasks on different processes, a
Service doesn't represent a
Thread or a process. It will only run in a background thread or on a different process if it's explicitly asked to do so.
A
Service has two main features:
- A facility for the application to tell the system about something it wants to be doing in the background.
- A facility for an application to expose some of its functionality to other applications.
Services and Threads
There is a lot of confusion about services and threads. When a
Service is declared, it doesn't contain a
Thread. As a matter of fact, by default it runs directly on the main thread and any work done on it may potentially freeze an application. (Unless it's a
IntentService, a
Service subclass that already comes with a worker thread configured.)
So, how do services offer a concurrency solution? Well, a
Service doesn't contain a thread by default, but it can be easily configured to work with its own thread or with a pool of threads. We'll see more about that below.
Disregarding the lack of a built-in thread, a
Service is an excellent solution for concurrency problems in certain situations. The main reasons to choose a
Service over other concurrency solutions like
AsyncTask or the HaMeR framework are:
- A
Servicecan be independent of activity life cycles.
- A
Serviceis appropriate for running long operations.
- Services don't depend on user interaction.
- When running on different processes, Android can try to keep services alive even when the system is short on resources.
- A
Servicecan be restarted to resume its work.
Service Types
There are two types of
Service, started and bound.
A started service is launched via
Context.startService(). Generally it performs only one operation and it will run indefinitely until the operation ends, then it shuts itself down. Typically, it doesn't return any result to the user interface.
The bound service is launched via
Context.bindService(), and it allows a two-way communication between client and
Service. It can also connect with multiple clients. It destroys itself when there isn't any client connected to it.
To choose between those two types, the
Service must implement some callbacks:
onStartCommand() to run as a started service, and
onBind() to run as a bound service. A
Service may choose to implement only one of those types, but it can also adopt both at the same time without any problems.
2. Service Implementation
To use a service, extend the
Service class and override its callback methods, according to the type of
Service . As mentioned before, for started services the
onStartCommand() method must be implemented and for bound services, the
onBind() method. Actually, the
onBind() method must be declared for either service type, but it can return null for started services.; } }
onStartCommand(): launched by
Context.startService(). This is usually called from an activity. Once called, the service may run indefinitely and it's up to you to stop it, either calling
stopSelf()or
stopService().
onBind(): called when a component wants to connect to the service. Called on the system by
Context.bindService(). It returns an
IBinderthat provides an interface to communicate with the client.
The service's life cycle is also important to take into consideration. The
onCreate() and
onDestroy() methods should be implemented to initialize and shut down any resources or operations of the service.
Declaring a Service on Manifest
The
Service component must be declared on the manifest with the
<service> element. In this declaration it's also possible, but not obligatory, to set a different process for the
Service to run in.
<manifest ... > ... <application ... > <service android: ... </application> </manifest>
2.2. Working with Started Services
To initiate a started service you must call
Context.startService() method. The
Intent must be created with the
Context and the
Service class. Any relevant information or data should also be passed in this
Intent.
Intent serviceIntent = new Intent(this, CustomService.class); // Pass data to be processed on the Service Bundle data = new Bundle(); data.putInt("OperationType", 99); data.putString("DownloadURL", ""); serviceIntent.putExtras(data); // Starting the Service startService(serviceIntent);
In your
Service class, the method that you should be concerned about is the
onStartCommand(). It's on this method that you should call any operation that you want to execute on the started service. You'll process the
Intent to capture information sent by the client. The
startId represents an unique ID, automatically created for this specific request and the
flags can also contain extra information about it.
@Override public int onStartCommand(Intent intent, int flags, int startId) { Bundle data = intent.getExtras(); if (data != null) { int operation = data.getInt(KEY_OPERATION); // Check what operation to perform and send a msg if ( operation == OP_DOWNLOAD){ // make a download } } return START_STICKY; }
The
onStartCommand() returns a constant
int that controls the behavior:
Service.START_STICKY: Service is restarted if it gets terminated.
Service.START_NOT_STICKY: Service is not restarted.
Service.START_REDELIVER_INTENT: The service is restarted after a crash and the intents then processing will be redelivered.
As mentioned before, a started service needs to be stopped, otherwise it will run indefinitely. This can be done either by the
Service calling
stopSelf() on itself or by a client calling
stopService() on it.
void someOperation() { // do some long-running operation // and stop the service when it is done stopSelf(); }
Binding to Services
Components can create connections with services, establishing a two-way communication with them. The client must call
Context.bindService(), passing an
Intent, a
ServiceConnection interface and a
flag as parameters. A
Service can be bound to multiple clients and it will be destroyed once it has no clients connected to it.
void bindWithService() { Intent intent = new Intent(this, PlayerService.class); // bind with Service bindService(intent, mConnection, Context.BIND_AUTO_CREATE); }
It's possible to send
Message objects to services. To do it you'll need to create a
Messenger on the client side in a
ServiceConnection.onServiceConnected interface implementation and use it to send
Message objects to the
Service.; } };
It's also possible to pass a response
Messenger to the
Service for the client to receive messages. Watch out though, because the client may not no longer be around to receive the service's message. You could also use
BroadcastReceiver or any other broadcast solution.(); }
It's important to unbind from the Service when the client is being destroyed.
@Override protected void onDestroy() { super.onDestroy(); // disconnect from service if (mBound) { unbindService(mConnection); mBound = false; } }
On the
Service side, you must implement the
Service.onBind() method, providing an
IBinder provided from a
Messenger. This will relay a response
Handler to handle the
Message objects received from client.));
3 Concurrency Using Services
Finally, it's time to talk about how to solve concurrency problems using services. As mentioned before, a standard
Service doesn't contain any extra threads and it will run on the main
Thread by default. To overcome this problem you must add an worker
Thread, a pool of threads or execute the
Service on a different process. You could also use a subclass of
Service called
IntentService that already contains a
Thread.
Making a Service Run on a Worker Thread
To make the
Service execute on a background
Thread you could just create an extra
Thread and run the job there. However Android offers us a better solution. One way to take the best advantage of the system is to implement the HaMeR framework inside the
Service, for example by looping a
Thread with a message queue that can process messages indefinitely..
To use HaMeR you must provide the
Service with a
Looper, a
Handler and a
HandlerThread.); }
If the HaMeR framework is unfamiliar to you, read our tutorials on HaMer for Android concurrency.
- Android SDKUnderstanding Concurrency on Android Using HaMeRTin Megali
- Android SDKPractical Concurrency on Android With HaMeRTin Megali
The IntentService
If there is no need for the
Service to be kept alive for a long time, you could use
IntentService, a
Service subclass that's ready to run tasks on background threads. Internally,
IntentService is a
Service with a very similar implementation to the one proposed above.
To use this class, all you have to do is extend it and implement the
onHandleIntent(), a hook method that will be called every time a client calls
startService() on this
Service. It's important to keep in mind that the
IntentService will stop as soon as its job is completed.
public class MyIntentService extends IntentService { public MyIntentService() { super("MyIntentService"); } @Override protected void onHandleIntent(Intent intent) { // handle Intents send by startService } }
IPC (Inter Process Communication)
A
Service can run on a completely different
Process, independently from all tasks that are happening on the main process. A process has its own memory allocation, thread group, and processing priorities. This approach can be really useful when you need to work independently from the main process.
Communication between different processes is called IPC (Inter Process Communication). In a
Service there are two main ways to do IPC: using a
Messenger or implementing an
AIDL interface.
We've learned how to send and receive messages between services. All that you have to do is use create a
Messenger using the
IBinder instance received during the connection process and use it to send a reply
Messenger back to the
Service.(); } }
The
AIDL interface is a very powerful solution that allows direct calls on
Service methods running on different processes and it's appropriate to use when your
Service is really complex. However,
AIDL is complicated to implement and it's rarely used, so its use won't be discussed in this tutorial.
4. Conclusion documentation and Android guides.
See you soon!
Envato Tuts+ tutorials are translated into other languages by our community members—you can be involved too!Translate this post
| https://code.tutsplus.com/tutorials/concurrency-on-android-with-service--cms-27277 | CC-MAIN-2020-05 | en | refinedweb |
Building a Laravel Translation Package – Scaffolding.
Scaffolding the Package
The first thing you need to do when creating a PHP package of any kind is setting up the repository, and most importantly the composer file. There’s no de-facto standard approach to organizing Composer packages; however, I will walk you through my approach.
I tend to start by installing a fresh version on Laravel using the installer. Using a test Laravel installation gives me a shiny new playground in which to work.
In the root of my newly installed Laravel project, I create a directory called
packages. Within this directory, I create a directory structure for my package which aligns with the GitHub repository where the code will ultimately reside – in this case,
joedixon/laravel-translation.
From within the package directory, I run
git init to set up version control. Next, I run
composer init and follow the instructions which create my
composer.json file for managing any dependencies I may require and for later submission to Packagist.
Next, I create an
src directory at the root of my package which will contain all of the domain specific logic of the package.
In the composer.json file, I add the following PSR-4 configuration to tell Composer how to autoload my package namespace:
"autoload": { "psr-4": { "JoeDixon\\Translation\\": "src" } },
Finally, before I write a single line of code, I amend the
composer.json file at the root of the Laravel application to tell it how to load my app.
"require": { … "joedixon/laravel-translation": "dev-master" }, "repositories": [ { "type": "path", "url": "./packages/joedixon/laravel-translation", "options": { "symlink": true } } ]
Hopefully, the
require section will look familiar to you. The
repositories section, however, may not.
The repositories section tells Composer to symlink the package from the local installation. Using this approach allows us to work on and test the package locally without having to
composer update anytime something changes.
When using the local file path approach, it’s worth noting the package can be anywhere on your machine; however, I like to keep it contained within the application structure for development.
Now that the package has been bootstrapped and autoload configured, we can start writing some code.
Package structure
When building a package, I try to mirror the Laravel application structure as much as possible. As such, everything typically found in my
app directory such as controllers, console commands, event listeners, etc. go into my package
src directory and things such as routes and resources live at the root of the package.
Service Provider
For Laravel to start using the package, we need to build a service provider. The service provider class is where we will bootstrap the package by performing actions such as binding services to the container, registering routes, publishing configuration, and just about anything else you can imagine that need tying into the Laravel app!
Tip
Typically, I will run
php artisan make:provider TranslationServiceProvider which will scaffold a service provider in the Providers directory of the Laravel application. I then move it to my package and update the namespace accordingly.
At this stage, I will register things like routes, config, views, and translations without necessarily fleshing out all of the details. I find doing it in this way makes things faster later on in development.
Testing
No good package would be complete without tests.
Setting up tests in a package can be quite tricky; mainly if you want to be able to access Laravel’s testing helpers. Fortunately, the
orchestra/testbench package makes it possible to use all of Laravel’s native test helpers within your packages tests.
Run
composer require --dev orchestra/testbench to install it as a development dependency. Running Composer should give you the following configuration in the
composer.json file:
"require-dev": { "orchestra/testbench": "~3.0" }
Before we’re done, let’s commit what we have to the
master branch:
# within ./packages/joedixon/laravel-translation echo "vendor/" >> .gitignore git add . git commit -m"Initial Commit"
That just about wraps up the package scaffolding. Next time, we’ll start building out some package functionality, starting by building out the file based translation driver.ametrics – Self-hosted Metrics and Notifications
Larametrics is an open-source self-hosted metrics and notifications platform for Laravel apps created by Andrew Schme…
Lighthouse GraphQL Server for Laravel
Lighthouse is a PHP package that allows you to serve a GraphQL endpoint from your Laravel application. It aims to red… | https://laravel-news.com/scaffolding-a-package | CC-MAIN-2020-05 | en | refinedweb |
I’m on vacation right now, enjoying skiing by day at the lovely town and resort of Breckenridge. I did give myself something to do over the vacation, though. Ever since I was convinced of the flux architecture, I’ve been using my own simple flux library. It’s basically using the Facebook dispatcher, but my own store implementation that is tied into component views using the componentWillMount and componentWillUnmount methods of the React API. It works and it is simple.
I’m not a fan of building a new wheel just because one can, though. If I am to maintain my own library, then it must offer something that no other library can. In the case of my flux library, that isn’t the case. It’s at the bottom of a pack of flux implementations. In addition, every single list of things that React programmers can learn is to use Redux. Redux is the flux implementation at the top of the list if you look at popularity. So I set myself a task of learning React Redux over my vacation.
My requirements are very simple – I have a single API that receives authentication information from the server. I need to initiate the request to the server and then handle the response. I have two actions in my application right now – one to do the request and one to handle the response. My code is just 214 lines of code, but it has lots of side effects. Let’s see how it goes.
With apologies to Dan Abramov – I’m sure he (and several others) will cringe as I go through this…
Step 1: Action Creators
An action is an object with a type field and potentially some associated data. Something like this:
{ type: 'AUTH-ANONYMOUS' } { type: 'AUTH-AUTHENTICATED', providerInfo: response } { type: 'AUTH-ERROR', error: error.message }
If you follow most standard flux implementations, they will tell you to create a function that dispatches the action. Redux doesn’t do that. Instead you create an Action Creator that returns an action. It isn’t dispatched (yet). This philosophy changes when we discuss async functions. However, let’s create some action creators. I’ve created a directory called redux where I am going to store all the implementation details. In there, I have an action.js that will hold my action creators:
/** * Redux Action Creator for handling anonymous response * @returns {Object} Redux Action */ function receiveAnonymousAuth() { return { type: 'AUTH-ANONYMOUS' }; } /** * Redux Action Creator for handling authenticated response * @param {Array} response the response from the server * @returns {Object} Redux Action */ function receiveAuthenticatedAuth(response) { return { type: 'AUTH-AUTHENTICATED', providerInfo: response[0] }; } /** * Redux Action Creator for handling error conditions * @param {Error} the error that happened * @returns {Object} Redux Action */ function receiveErrorCondition(error) { return { type: 'AUTH-ERROR', error: error }; }
These are internal actions – I am not expecting my application UI to initiate these actions. I do not export these functions because they are internal. We’ll get onto the linkage eventually. Right now there is one action creator for each of my potential results – authenticated, anonymous and error. I’ve merged all three cases in my existing code which isn’t the best, so take the opportunity to refactor the code into something more maintainable as well.
Redux suggests that you have a big list of constants for the type. However, they are just strings – in smaller applications (like mine), you can do away with the constants and just specify the strings.
Step 1A: Async Action Creators
I have another action creator – the one that initiates the request. That one was a problem. To be honest, I don’t think Redux actually deals with async well. It should “just work” and it doesn’t. Here is my function:
import fetch from 'isomorphic-fetch'; // baseUrl is required for the fetch actions let baseUrl = ''; if (window.GRUMPYWIZARDS && window.GRUMPYWIZARDS.base) baseUrl = window.GRUMPYWIZARDS.base.replace(/\/$/, ''); /** * Redux Action Creator for requesting authentication information * @returns {Function} */)); }); }; }
There is a little code at the top to figure out where the API actually is. The majority of the code is a direct copy from my original store implementation. Instead of doing the store update right there, I dispatch another action (created by one of the action creators I wrote earlier) to handle the actual action.
Step 2: Reducers
The next element in the Redux implementation is a reducer. A reducer takes a state and an action and turns it into the new state. This is a relatively simple concept. The “reducer” terminology is from the Array.reduce() functionality within JavaScript, which is designed to provide an accumulator functionality – you start with an initial value and mutate it based on each value within the array. In the case of Redux, you start with the current state of the store and you mutate it based on the action. Except that you don’t mutate the state – you return a new copy of the state. So, I guess the analogy breaks down there.
One of the golden rules of Redux is this: Reducers must be free of side effects.
In other words, if you call the reducer with the same state and the same action, it will return the same state each time. You can’t put “call this other API” or “look in a database” or that sort of thing. Right now, I’ve got one reducer (called reducers.js) that has a case statement in it to handle each action.
/* eslint-disable no-case-declarations */ const initialState = { phase: 'pending', user: null, error: null }; export default function authReducer(state, action) { if (typeof state === 'undefined') { state = initialState; } switch (action.type) { case 'AUTH-ANONYMOUS': return Object.assign({}, state, { phase: 'anonymous', user: null, error: null }); case 'AUTH-AUTHENTICATED': let claims = action.providerInfo.reduce((target, claim) => { target[claim.typ] = claim.val; if (claim.typ.indexOf('') !== -1) target[claim.typ.slice(claim.typ.lastIndexOf('/') + 1)] = claim.val; return claims; }); let user = { accessToken: action.providerInfo.access_token, claims: claims, firstname: claims.firstname || '', id: action.providerInfo.user_id, provider: action.providerInfo.provider_name, providerToken: action.providerInfo.authentication_token, surname: claims.surname || '' }; return Object.assign({}, state, { phase: 'authenticated', user: user, error: null }); case 'AUTH-ERROR': return Object.assign({}, state, { phase: 'error', user: null, error: action.error.message }); default: return state; } }
UPDATE Dan Abramov contacted me and suggested that putting the initialState with the reducer was “the right pattern”. We don’t want to be propagating anti-patterns. As a result, I have moved the initialState to the reducer after the initial publication of this blog post. You can also use an ES6 default argument to set the initialState.
Why is this requirement for no side effects so important? You do like to test your code, right? This requirement enables the testability of the code, and that is very important.
There are definitely other ways to organize your code once your store (and state requirements) grow, and you can read about them over on the Redux web site. However, this is good enough for now. We’ve got an action creator, a set of actions that describe the manipulations to application state we want to handle, including one action that won’t actually work (we’ll get onto that later, but take a wild guess as to which one!) and a reducer that will return the new state when it is fed an action.
Step 3: Creating the Store
The next question, of course, is how do we tie all this together? Well, that’s the job of the store. Note that this is a singular entity. In my implementation of flux, I would suggest that you have different stores to handle different types of data. If you are doing a blog, you might have a store for authentication, a store for blogs, a store for comments, and so on. In Redux, there is only one store.
Here is how I implemented the store given the reducers and actions I’ve already created:
import { createStore } from 'redux'; import reducer from './reducers'; let store = createStore(reducer); export default store;
The store is created with createStore(). The first argument is the reducer (or set of reducers if your application is more complex).
UPDATE: createStore() takes a second optional argument – the initialState. However, Dan Abramov contacted me and suggested that this was an anti-pattern in client applications. I’ve since moved the initialState to the reducer (above).
You can now use this store to subscribe to store changes and to dispatch actions. Dispatching actions that are not asynchronous is easy:
// store.dispatch(actionCreator(args)); // For example: store.dispatch(receiveAuthenticatedAuth(response));
You’ve actually already seen this in the actions.js file I showed earlier. However, that async method is going to take something. Here is how I started with it:
import { createStore } from 'redux'; import { requestAuthInfo } from './actions'; import reducer from './reducers'; const initialState = { phase: 'pending', user: null, error: null }; let store = createStore(reducer, initialState); // Dispatch the initial action let requestAction = requestAuthInfo(); requestAction(store.dispatch); export default store;
It doesn’t actually dispatch an action. I’ve got a problem with that, but I’ll come back to that later. On to our components:
Step 4: Update the Component Views
I’ve got one component view – the Chrome.jsx file. There are also a couple of calls you need to know – the main one being that you can subscribe to changes and then unsubscribe later on. Let’s take a look at my Chrome.jsx – at least the important parts. First off, the constructor:
constructor(props) { super(props); logger.entry('$constructor', props); this.state = { phase: 'pending', user: null, error: null, leftMenu: { isOpen: false } }; logger.debug('state = ', this.state); logger.exit('$constructor'); }
Note that the state includes all my store variables. This actually is fairly important at this point. It will become less so later on. Now, onto the component state lifecyle functions:
/** * React API: Called when the component is mounting itself in the DOM * * @returns {void} * @overrides React.Component#componentWillMount */ componentWillMount() { logger.entry('componentWillMount'); this.unsubscribe = store.subscribe(() => { return this.updateState(); }); logger.exit('componentWillMount'); } /** * React API: Called when the component is removed from the DOM * * @returns {void} * @overrides React.Component#componentWillUnmount */ componentWillUnmount() { logger.entry('componentWillUnmount'); this.unsubscribe(); logger.exit('componentWillUnmount'); } /** * Update the internal state of the component-view from the flux store */ updateState() { logger.entry('updateState'); this.setState(store.getState()); logger.debug('New State = ', this.state); logger.exit('updateState'); }
This is pretty much standard stuff for flux. You register your interest in the componentWillMount() method and then deregister in the componentWillUnmount() method. In the updateState() method, I merge the stores state with the components state which will then re-render the DOM.
That’s pretty much all there is to redux. Instead of a complicated function in a store, the store is completely separated and reducers take over the task of actually doing the state transitions. Otherwise, this is as vanilla Redux as you can get. Sure, it’s a little more modular, and smaller (141 lines of code instead of 214 for my store implementation), but…
The only real advantage is that I’m not writing the store myself.
However, there is much more to Redux than what we’ve done thus far. In the next post, I’m going to take a look at two of those things. Firstly, I am going to simplify my component view to get rid of a lot of the boiler-plate code for handling state updates. Secondly, I’m going to look at the role of middleware to handle async functions. Until then, check out the code in my GitHub Repository. | https://shellmonger.com/2016/02/16/an-introduction-to-react-redux-part-1/ | CC-MAIN-2017-51 | en | refinedweb |
Sinon expect is a wrapper for the assertions built into sinon.
A quick example is:
var object ={};//Yes we are overriding expect//You can also save it to another variable but that is uglyexpect = ;sinon;//Assert stylesinonassert;//Expect style//All assertions are found under the .spy namespace/"flag"was;
See Sinon Assertions for additional documentation for each of these assertions.
Drop the first argument (the spy) otherwise the method signature is the same.
MIT (see LICENSE) | https://www.npmjs.com/package/sinon-expect | CC-MAIN-2017-51 | en | refinedweb |
Ted Kremenek writes: “Today is July 27 — and the last planned day to take source-breaking changes for Swift 3. It has been an incredible ride to this point, so let’s take stock of where we are.”
Accepted but not implemented reviews:
-
Ted continues:
!”
One Comment
Hi,
no one is going to understand this – instead of producing such non-understandable non-sense they should have rather created a real namespace system like the one in Java.
Can there be a better example for this? Because I do not really understand it.
“A member may not have a type that references any declarations that aren’t accessible wherever the member is accessible. (This replaces an existing rule that states that the type of a declaration may not reference any declarations that have broader access.) This permits the following code:
struct Outer {
private typealias Value = Int
private struct Inner {
var value: Value
}
}
and continues to treat this code as illegal:
struct Outer {
private struct Inner {
private typealias Value = Int
var value: Value
}
}
“ | http://ericasadun.com/2016/07/27/end-of-source-breaking-changes-for-swift-3/ | CC-MAIN-2017-51 | en | refinedweb |
We have created a custom class, say
Person, and use it in a unit test.
void TestPerson::testEquality() { Person p1("Alice", 42); Person p2("Bob", 37); QCOMPARE(p1, p2); }
The unit test fails with this message.
FAIL! : TestPerson::testEquality() Compared values are not the same Loc: [../QComparePrint/TestPerson.cpp(8)]
This message does not tell us how the two
Person objects differ. We would like to see this message as we would see it for any type known to
QCOMPARE.
FAIL! : TestPerson::testEquality() Compared values are not the same Actual (p1): "Person(Alice, 42)" Expected (p2): "Person(Bob, 37)" Loc: [../QComparePrint/TestPerson.cpp(16)]
How do we achieve such a pretty-printed output for
QCOMPARE?
The solution turns out to be very simple. The QCOMPARE documentation gives the crucial hint.
For your own classes, you can use QTest::toString() to format values for outputting into the test log.
Unfortunately, the documentation links to the first overload of
QTest::toString(), which is irrelevant for our problem. If we don’t give up and scroll down to the last overload of
QTest::toString(), we will be rewarded. It suggests to overload
toString() in the namespace of our class
Person. Using the example from the documentation, we can quickly come up with our own overload of
toString().
char *toString(const Person &p) { return QTest::toString("Person(" + p.firstName() + ", " + QString::number(p.age()) + ")"); }
Our overload assembles a formatted string of a
Person object and passes this string to
QTest::toString(const QString &value).
If we use
QCOMPARE on
Person objects only in one test class, we add our new
toString() function to the source file of this test class. If we use it in several test classes, we put the function in a custom test library containing common test functionality.
You can find the example code on github. | http://www.embeddeduse.com/2017/10/07/pretty-printing-output-for-qcompare/ | CC-MAIN-2017-51 | en | refinedweb |
#include "FastLED.h"// How many leds in your strip?#define NUM_LEDS 4#define DATA_PIN_0 3#define CLOCK_PIN_0 2#define DATA_PIN_1 5#define CLOCK_PIN_1 4#define DATA_PIN_2 7#define CLOCK_PIN_2 6#define DATA_PIN_3 9#define CLOCK_PIN_3 8// Define the array of ledsCRGB leds[NUM_LEDS];void setup() { Serial.begin(115200); FastLED.addLeds<P9813, RGB>(leds, NUM_LEDS); FastLED.addLeds<P9813, DATA_PIN_0, CLOCK_PIN_0, RGB>(leds, NUM_LEDS); FastLED.addLeds<P9813, DATA_PIN_1, CLOCK_PIN_1, RGB>(leds, NUM_LEDS); FastLED.addLeds<P9813, DATA_PIN_2, CLOCK_PIN_2, RGB>(leds, NUM_LEDS); FastLED.addLeds<P9813, DATA_PIN_3, CLOCK_PIN_3, RGB>(leds, NUM_LEDS);}void loop() { for(int i = 0; i < NUM_LEDS; i++) { leds[i] = CRGB::Green; FastLED.show(); // clear this led for the next time around the loop leds[i] = CRGB::Black; Serial.println(i); Serial.println(leds[i]); delay(250); }}
I am unable to control them separately when more than one is connected.
Perhaps, Grumpy_Mike, you could offer a command or function or snippet even, rather than just telling me I'm doing it wrong. I already knew that.
but I can't find any examples of multiple independent led strings.
In your code I see four cascaded LED boards defined.But I also see four clock pins and four data pins.
but that seems like it is more complicated than it needs to be.
I rewired them in the chainable fashion instead of trying to have each with its own connection to the arduino and they are working! | http://forum.arduino.cc/index.php?topic=515539.0;prev_next=prev | CC-MAIN-2017-51 | en | refinedweb |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.