returning json values from database - mysql

Could anyone tell me what kind of characters JSON doesn't return?
Because I have varchar which gets me null:
Mark Zuckerberg wrote Facemash, the predecessor to Facebook, on October 28, 2003, while attending Harvard as a sophomore. According to The Harvard Crimson, the site was comparable to Hot or Not, and "used photos compiled from the online facebooks of nine houses, placing two next to each other at a time and asking users to choose the 'hotter' person".
To accomplish this, Zuckerberg hacked into the protected areas of Harvard's computer network and copied the houses' private dormitory ID images. Harvard at that time did not have a student "facebook" (a directory with photos and basic information), though individual houses had been issuing their own paper facebooks since the mid-1980s. Facemash attracted 450 visitors and 22,000 photo-views in its first four hours online.
The site was quickly forwarded to several campus group list-servers, but was shut down a few days later by the Harvard administration. Zuckerberg was charged by the administration with breach of security, violating copyrights, and violating individual privacy, and faced expulsion. Ultimately, the charges were dropped. Zuckerberg expanded on this initial project that semester by creating a social study tool ahead of an art history final, by uploading 500 Augustan images to a website, with one image per page along with a comment section. He opened the site up to his classmates, and people started sharing their notes.
and varchar:
jjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkk
jjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkkjjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkkjjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkk
jjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkk
jjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkk
jjjjjjjjjjjjjjjskkkkkkkkkkkkkkkkkkkkkk
which works just fine. So I would like to know why JSON gives me null? Or it's the problem from MySQL?
Now using this code:
$title = 'Twitter history';
$q=mysql_query("SELECT mdl_resource.alltext FROM mdl_resource WHERE mdl_resource.name = '$title'");
while($e=mysql_fetch_assoc($q))
$output[]=$e;
print(json_encode($output));

Related

How to generate sequential numbers on a web page?

Most of our staff work remotely in different countries of the world.
Often several staff work (on different aspects) of the same case.
At the moment the person who initiates the cases has to email the office manager who has to inssue a case number which then has to be shared with different staff members to make sure they use the same Case number in their forms and correspondence.
I was wondering whether it would be possible to:
Have a page on our website (accesible to our staff only)
Where the person initating a case goes to
The staff member is asked to enter his initials (eg DH or RD)
Then automatically a code is generated (RD001, DH001, etc.), it will be helpful for other purposes if the number is always 5 characters long (e.g. RD001, RD025, RD234, etc...).
These numbers need to be sequential (so if RD got the number RD001 1 hr ago, or 1 day ago, he needs to get RD002 the next time he requests a number), so the page needs to remember the last number that was issued for that staff member (they need to be sequential per staff member).
That number is then emailed to the relevant staff members who need to be aware that this number has been issued
Is that possible?
Sure it's possible, but what you are asking is actually a complete solution development. You've to hire a developer, who will create a system with authentication AND authorization, cases management (new case, details of the case, etc...) and so on.
But overall, it's a trivial job : )
EDIT: If your question is exclusively considering only HTML, then I really don't think this is possible, since your "number" should be generated and accessed from anywhere. Then, you have to make it globally accessible.
Also, it's really important that only your staff, and only the ones with rights to do that, could access and/or generate new numbers, hence the authorization/authentication need.
EDIT 2: Another possibility is search for a already made solution. I believe that should exist even online services with your requirements, like some online CRM or something like that.

Can I apply different styles to columns in column-count?

Is there any way to add different styles for columns made with column-count? I have a div which is divided into multiple columns using column-count. At a time only two columns are visible on page. I need to add margin-left to the first column and margin-right for the second column and so on.
What I need is the same spacing on both (outer and inner) sides of the pages just like book.
.main {
overflow: scroll;
width: 100%;
height: 438px;
column-gap: 160px;
columns: 2 auto;
column-fill: auto;
margin-top: 5px;
}
<div class="main">
Wikidata is a free, collaborative, multilingual, secondary database, collecting structured data to provide support for Wikipedia, Wikimedia Commons, the other wikis of the Wikimedia movement, and to anyone in the world. What does this mean? Let's look
at the opening statement in more detail: Contents 1 What does this mean? 2 How does Wikidata work? 2.1 The Wikidata repository 2.2 Working with Wikidata 3 Where to get started 4 How can I contribute? 5 There is more to come Free. The data in Wikidata
is published under the Creative Commons Public Domain Dedication 1.0, allowing the reuse of the data in many different scenarios. You can copy, modify, distribute and perform the data, even for commercial purposes, without asking for permission. Collaborative.
Data is entered and maintained by Wikidata editors, who decide on the rules of content creation and management. Automated bots also enter data into Wikidata. Multilingual. Editing, consuming, browsing, and reusing the data is fully multilingual. Data
entered in any language is immediately available in all other languages. Editing in any language is possible and encouraged. A secondary database. Wikidata records not just statements, but also their sources, and connections to other databases. This
reflects the diversity of knowledge available and supports the notion of verifiability. Collecting structured data. Imposing a high degree of structured organization allows for easy reuse of data by Wikimedia projects and third parties, and enables
computers to process and “understand” it. Support for Wikimedia wikis. Wikidata assists Wikipedia with more easily maintainable information boxes and links to other languages, thus reducing editing workload while improving quality. Updates in one language
are made available to all other languages. Anyone in the world. Anyone can use Wikidata for any number of different ways by using its application programming interface. How does Wikidata work? This diagram of a Wikidata item shows you the most important
terms in Wikidata. Wikidata is a central storage repository that can be accessed by others, such as the wikis maintained by the Wikimedia Foundation. Content loaded dynamically from Wikidata does not need to be maintained in each individual wiki project.
For example, statistics, dates, locations and other common data can be centralized in Wikidata. The Wikidata repository Items and their data are interconnected. The Wikidata repository consists mainly of items, each one having a label, a description
and any number of aliases. Items are uniquely identified by a Q followed by a number, such as Douglas Adams (Q42). Statements describe detailed characteristics of an Item and consist of a property and a value. Properties in Wikidata have a P followed
by a number, such as with educated at (P69). For a person, you can add a property to specifying where they were educated, by specifying a value for a school. For buildings, you can assign geographic coordinates properties by specifying longitude and
latitude values. Properties can also link to external databases. A property that links an item to an external database, such as an authority control database used by libraries and archives, is called an identifier. Special Sitelinks connect an item
to corresponding content on client wikis, such as Wikipedia, Wikibooks or Wikiquote. All this information can be displayed in any language, even if the data originated in a different language. When accessing these values, client wikis will show the
most up-to-date data. Item Property Value Q42 P69 Q691283 Douglas Adams educated at St John's College Working with Wikidata There are a number of ways to access Wikidata using built-in tools, external tools, or programming interfaces. Wikidata Query
and Reasonator are some of the popular tools to search for and examine Wikidata items. The tools page has an extensive list of interesting projects to explore. Client wikis can access data for their pages using a Lua Scribunto interface. You can retrieve
all data independently using the Wikidata API. Where to get started The Wikidata tours designed for new users are the best place to learn more about Wikidata. Some links to get started: Set your user options, especially the 'Babel' extension, to choose
your language preferences Help with missing labels and descriptions Help with interwiki conflicts and constraint violations Improve a random item Help translating How can I contribute? Go ahead and start editing. Editing is the best way to learn about
the structure and concepts of Wikidata. If you would like to gain understanding of Wikidata's concepts upfront, you may want to have a look at the help pages. If you have questions, please feel free to drop them in the project chat or contact the development
team. There is more to come Wikidata is an ongoing project that is under active development. More data types as well as extensions will be available in the future. You can find more information about Wikidata and its ongoing development on the Wikidata
page on Meta. Subscribe to the the Wikidata mailing list to receive up-to-date information about the development and to participate in discussions about the future of the project. North Korea conducted its sixth nuclear test on 3 September 2017, according
to Japanese and South Korean officials. The Japanese Ministry of Foreign Affairs also concluded that North Korea conducted a nuclear test.[6] The United States Geological Survey reported an earthquake of 6.3-magnitude not far from North Korea's Punggye-ri
nuclear test site.[7] South Korean authorities said the earthquake seemed to be artificial, consistent with a nuclear test.[6] The USGS, as well as China's earthquake administration, reported that the initial event was followed by a second, smaller,
earthquake at the site, several minutes later, which was characterized as a collapse of the cavity.[8][9] North Korea claimed that it detonated a hydrogen bomb that can be loaded on to an intercontinental ballistic missile (ICBM) with great destructive
power.[10] Photos of North Korean leader Kim Jong-un inspecting a device resembling a thermonuclear weapon warhead were released a few hours before the test.[11] Contents 1 Yield estimates 2 Reactions 3 See also 4 References Yield estimates According
to estimates of Kim Young-Woo, the chief of the South Korean parliament's defense committee, the nuclear yield was equivalent to about 100 kilotons of TNT (100 kt). "The North's latest test is estimated to have a yield of up to 100 kilotons, though
it is a provisional report," Kim Young-Woo told Yonhap News Agency.[2] On 3 September, South Korea’s weather agency, the Korea Meteorological Administration, estimated that the nuclear blast yield of the presumed test was between 50 to 60 kilotons.[3]
On 4 September, the academics from University of Science and Technology of China[12] have released their findings based on seismic results and concluded that the Nuclear Test Location is at 41°17′53.52″N 129°4′27.12″E on 03:30 UTC which is only a few
hundred meters apart from the previous 4 tests (2009, 2013, January 2016 and September 2016) with the estimated yield at 108.1 ± 48.1 kt. In contrast, the independent seismic monitoring agency NORSAR estimated that the blast had a yield of about 120
kilotons, based on a seismic magnitude of 5.8.[4] The Federal Institute for Geosciences and Natural Resources in Germany estimates a higher yield at "a few hundred kilotons" based on a detected tremor of 6.1 magnitude.[5] Reactions South Korea, China,
Japan, Russia and members of the ASEAN[13] voiced strong criticism of the nuclear test.[14] US President Donald Trump tweeted "North Korea has conducted a major Nuclear Test. Their words and actions continue to be very hostile and dangerous to the United
States".[15][16] Trump was asked whether the US would attack North Korea and replied, "We'll see".[17] On September 3, U.S. Defense Secretary James Mattis warned North Korea, saying that the country would be met with a "massive military response" if
it threatened the United States or its allies.[18] The United Nations Security Council will meet in an open emergency meeting on September 4, 2017 at the request of the US, South Korea, Japan, France and the UK.[19] Federal Institute for Geosciences
and Natural Resources From Wikipedia, the free encyclopedia (Redirected from Bundesanstalt für Geowissenschaften und Rohstoffe) Federal Institute for Geosciences and Natural Resources Bundesanstalt für Geowissenschaften und Rohstoffe (BGR) Agency overview
Headquarters Hanover, Germany Employees 795 in 2013 Website www.bgr.bund.de The Federal Institute for Geosciences and Natural Resources (Bundesanstalt für Geowissenschaften und Rohstoffe or BGR) is a German agency within the Federal Ministry of Economics
and Technology. It acts as a central geoscience consulting institution for the German federal government.[1] The headquarters of the agency is located in Hanover and there is a branch in Berlin. Early 2013, the BGR employed a total of 795 employees.
The BGR, the State Authority for Mining, Energy and Geology and the Leibniz Institute for Applied Geophysics form the Geozentrum Hanover. All three institutions have a common management and infrastructure, and complement each other through their interdisciplinary
expertise.
</div>
Here is the JSFiddle for testing link

Is there an API for crime in the US?

As the question title states, I need the crime data from all the united states. I can't find a dataset for that, only numerous small ones for the different cities and countrysides.
Is there such a united API or should I maintain these small ones as well ?
There is currently no single open dataset or API (Socrata maintained or otherwise) that covers the US completely. Many cities publish crime reports to their open data portals, but the coverage is still pretty sparse.
There's also the FBI Uniform Crime Reporting datasets, but those are aggregated at the city level (which again is somewhat sparse) and the most recent data is a partial update from the first half of 2015.

Getting Your Customer's Bills in to Bill Pay Sites

We are looking at ways to cut costs, and one idea I had was to push our customer's bills into the Bill Pay systems that banks (and other sites) use. Only thing is, I don't know how to do that? My searches in the past didn't turn up any information for the company side.
Can anyone point me in a productive direction? Is there a single clearing house for this or do you have to set something up with each site?
More details: We are a local government that sends out utility bills on a monthly basis. We currently offer ACH and online bill payment (through our web site) options. But with so many (or so it seems) people using the free bill pay that banks are now offering, it would be a great option to push their bills to those that like to use this option. If it's cost effective, that is.
Instead of pushing them to a third party (who you presumably pay for the service) could you build your own system?
Either email a PDF bill, or let them log onto your website to get their balance etc. Then let them pay through your website?
It's not that difficult to sent up an online payment system....

Traveling Contracting

I am fresh out of College (graduated in December with BS in Comp Sci). I have been working for a very large (40,000+ employee) company for over two years. My job is as stable as anyone could hope for. However, I am always bored, they cannot keep us (developers) busy. I am thinking about apply at some local contracting companies and try out contracting. I have been told that I could make a lot more money as a contractor and even more if I was willing to travel. I have been told that as a contractor I would basically be constantly coding, no BS meetings about project charters and stage gates, and that I would learn more in a year than I would in 10 years at my current job (this I believe since we're using java 1.4 and our brand new laptops have windows 2000 on them... lol). I just want to know what to expect if I decided to go the contracting route, and if traveling is worth it. Since I don't have any kids and this seems like the best time to do something like this.
What have been your experiences with contracting? How do the mechanics of travel as a contractor work (what is paid for, do you work 4 10 hour days... etc)? Will I really be mostly coding? Will I really gain valuable insight and knowledge of the IT world?
I can't speak for your situation in particular, but my company recently terminated all of our contractors as part of our cutbacks, and many other companies did the same. Most companies have hiring freezes, where they will not take on new employees at all, contractors or not. My friends that were working as contractors all lost their jobs, and are generally having a difficult time finding new positions.
If you are already in a steady job, I would say that now is not the best time to drop it and try switching to the life of a contractor.
You expressed an interest in learning new technologies, so if your company doesn't keep you busy, and you're "always bored", why aren't you using that time to read up on the things you're interested in?
I've been migrant IT labor for 30+ years.
"I have been told that as a contractor I would basically be constantly coding"
False. You might wind up doing a lot of new development or a lot of maintenance. Depends on the contract firm's relationships.
"no BS meetings about project charters and stage gates"
False. The contract firm has to land the gig. As a contractor, you write a LOT of proposals that get shot down in flames. In-house initiatives are quietly morphed into something else. Out-of-house initiatives turn ugly -- the contracts are fired -- there are lawsuits.
"and that I would learn more in a year than I would in 10 years at my current job"
True. If you pay close attention and take careful notes. More importantly, if you've done your homework outside the workplace. I've been to a fair amount of training, but I think that 75% of the skills I use regularly (Java, Python, DB Design, Architecture, Apache config, HTML) I had to learn on my own.
"what to expect if I decided to go the contracting route"
Parts of it are bad. Parts are good. It's a job -- that's why they have to pay you to do it.
"if traveling is worth it."
Let me list the benefits -- Skiing in Anchorage, Skiing in Utah, Diving in the Florida Keys, flying the entire family first-class to San Diego, using Hilton Honors points to stay at the Waldorf=Astoria.
Let me list the problems -- kids who got into serious trouble at school. Missing family time because of travel. The unending stress of air travel, including the TSA security theater setups everywhere.
Nearly everywhere I've been, we've hired contractors to work on the old, legacy stuff that our employees have forgotten or otherwise don't want to work on. Nobody is going to hire you in order to teach you things - you won;t be around long enough, so they will only hire you for your current skills. Quite a few contractors complain about having to keep their skills up to date, at their own expense.
You'll also get less time spent in meetings (well... maybe not, you'll be there to be told what they expect of you), but you'll also have to manage your own accounts, and invoice the client, and then chase up payment.
So, don;t think contracting is a magic route to fun coding with the latest technologies. Its probably the opposite of that. What you want is a different job.
The grass is always greener on the other side of the fence.
You're stuck in a large company with all the large company management bureaucracy and strict job roles that goes with it. If you contract for a large company guess what you get? However you can choose who you contract for (if they're happy contracting to someone with two years experience). To me it sounds like you actually want to work for a small company developing software in a more agile fashion, and that's a more risky move!
Note that with contracting you'll go from project to project, and having to pick up the client's systems (code, models, databases, workflows, etc) from new each time, often with very little assistance. If the systems are in any way mature, then there will be lots of cruft to sift out - if you're lucky it will be documented! So every time you have a problem, you will have to get on the phone to them or find them (a difficult task on its own) to get the knowledge you need.
I've been contracting/consulting for just over a year and am really enjoying it. A few of the perks:
money is good.
changing projects fairly often keeps the boredom levels down.
working from home rules.
because you are an expensive resource relative to other employees, the amount of administrative fluff and pointless meetings is minimal. The client wants you to spend as much time as possible working on whatever it is you've been contracted to do.
I'm picking up new knowledge much faster than when I was a normal employee. I suppose its related to changing projects often and working with a range of people.
I strongly disagree with the sentiment that contractors get boxed in and have to teach themselves new skills in their own time. Perhaps this is true for some domains but my experience has been the absolute opposite. One thing I have noticed is that if you do a good job with a project, you'll be asked to look at other projects even if you have no experience with the technology in question. Being trusted as competent and honest is far more important to most employers than a '5 years experience with J2EE' line on your resume.
That said, its not all rainbows and butterflies. Some of the downsides:
getting a mortgage is going to be really hard because of the lack of permanent employment.
whenever there is a downturn, you'll be the first against the wall.
if you are working on a fixed cost basis, you'll have to get really good at project estimation or risk lots of unpaid overtime.
taking on multiple clients at the same time can be a horrible mess unless you have excellent time management skills.
Overall, I'm really enjoying it and for me the pros far outweigh the cons. I think I'd only go back to being a normal employee if I had a family and couldnt warrant the risk of being out of work for an extended period of time.
As a contractor you do tend to be less involved in meetings, in my experience. But you spend a lot of time teasing requirements out of clients and waiting for responses on things. As you're not in the day-to-day flow of the organization, you have to work a lot harder to understand what's going on.